hatred/hostility
This commit is contained in:
parent
26ab281fdb
commit
52edc38cba
@ -9,7 +9,7 @@ use failure::err_msg;
|
|||||||
|
|
||||||
use account::Account;
|
use account::Account;
|
||||||
use rpc::{GameStateParams, GameSkillParams};
|
use rpc::{GameStateParams, GameSkillParams};
|
||||||
use cryp::{Cryp, EffectMeta};
|
use cryp::{Cryp};
|
||||||
use skill::{Skill, Effect, Cast, Resolution, Event, resolve};
|
use skill::{Skill, Effect, Cast, Resolution, Event, resolve};
|
||||||
use player::{Player};
|
use player::{Player};
|
||||||
use instance::{instance_game_finished, global_game_finished};
|
use instance::{instance_game_finished, global_game_finished};
|
||||||
|
|||||||
@ -75,6 +75,8 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio
|
|||||||
Skill::Slay => unimplemented!(),
|
Skill::Slay => unimplemented!(),
|
||||||
Skill::Taunt => taunt(source, target, resolutions),
|
Skill::Taunt => taunt(source, target, resolutions),
|
||||||
|
|
||||||
|
Skill::Hostility => hostility(source, target, resolutions),
|
||||||
|
|
||||||
Skill::Corrupt => corrupt(source, target, resolutions),
|
Skill::Corrupt => corrupt(source, target, resolutions),
|
||||||
Skill::Corruption => panic!("corruption should not be castable"),
|
Skill::Corruption => panic!("corruption should not be castable"),
|
||||||
Skill::CorruptionTick => corruption_tick(source, target, resolutions),
|
Skill::CorruptionTick => corruption_tick(source, target, resolutions),
|
||||||
@ -91,16 +93,24 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio
|
|||||||
|
|
||||||
// if any event dealt damage to target cryp
|
// if any event dealt damage to target cryp
|
||||||
// hit them with corruption
|
// hit them with corruption
|
||||||
resolutions = match target.affected(Effect::Corrupt) {
|
|
||||||
true => match resolutions.iter().any(|r|
|
// on damage events
|
||||||
match r.event {
|
// todo not sure if this fucks up with multiple calls to resolve
|
||||||
Event::Damage { amount: _, mitigation: _, category: _, skill: _ } => true,
|
// have to think
|
||||||
_ => false,
|
for r in resolutions.clone() {
|
||||||
}) {
|
match r.event {
|
||||||
true => corruption(target, source, resolutions),
|
Event::Damage { amount, skill, mitigation: _, category: _ } => {
|
||||||
false => resolutions,
|
if target.affected(Effect::Corrupt) {
|
||||||
},
|
resolutions = corruption(target, source, resolutions);
|
||||||
false => resolutions,
|
}
|
||||||
|
|
||||||
|
if target.affected(Effect::Hostility) {
|
||||||
|
resolutions = hatred(target, source, resolutions, skill, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// i don't think we need to check the source being ko
|
// i don't think we need to check the source being ko
|
||||||
@ -183,7 +193,7 @@ impl Resolution {
|
|||||||
pub enum Event {
|
pub enum Event {
|
||||||
Disable { skill: Skill, disable: Disable },
|
Disable { skill: Skill, disable: Disable },
|
||||||
Immunity { skill: Skill, immunity: Immunity },
|
Immunity { skill: Skill, immunity: Immunity },
|
||||||
Damage { skill: Skill, amount: u64, mitigation: u64, category: Category },
|
Damage { skill: Skill, amount: u64, mitigation: u64, category: Category },
|
||||||
Healing { skill: Skill, amount: u64, overhealing: u64 },
|
Healing { skill: Skill, amount: u64, overhealing: u64 },
|
||||||
Recharge { skill: Skill, red: u64, blue: u64 },
|
Recharge { skill: Skill, red: u64, blue: u64 },
|
||||||
Inversion { skill: Skill },
|
Inversion { skill: Skill },
|
||||||
@ -221,7 +231,6 @@ pub enum Effect {
|
|||||||
|
|
||||||
Empower,
|
Empower,
|
||||||
Taunt,
|
Taunt,
|
||||||
Hatred,
|
|
||||||
|
|
||||||
Invert,
|
Invert,
|
||||||
Strangle,
|
Strangle,
|
||||||
@ -244,6 +253,11 @@ pub enum Effect {
|
|||||||
Corrupt,
|
Corrupt,
|
||||||
Corruption,
|
Corruption,
|
||||||
|
|
||||||
|
// hostility is the buff
|
||||||
|
// hatred is the increased damage
|
||||||
|
Hostility,
|
||||||
|
Hatred,
|
||||||
|
|
||||||
// magic immunity
|
// magic immunity
|
||||||
Shield,
|
Shield,
|
||||||
|
|
||||||
@ -384,6 +398,8 @@ impl Effect {
|
|||||||
Effect::Corrupt => Category::BlueBuff,
|
Effect::Corrupt => Category::BlueBuff,
|
||||||
Effect::Corruption => Category::BlueDebuff,
|
Effect::Corruption => Category::BlueDebuff,
|
||||||
|
|
||||||
|
Effect::Hostility => Category::BlueBuff,
|
||||||
|
|
||||||
// magic immunity
|
// magic immunity
|
||||||
Effect::Shield => Category::BlueBuff,
|
Effect::Shield => Category::BlueBuff,
|
||||||
Effect::Invert => Category::GreenBuff,
|
Effect::Invert => Category::GreenBuff,
|
||||||
@ -431,6 +447,9 @@ impl Effect {
|
|||||||
Effect::Amplify => 2,
|
Effect::Amplify => 2,
|
||||||
Effect::Silence => 2,
|
Effect::Silence => 2,
|
||||||
|
|
||||||
|
Effect::Hostility => 2,
|
||||||
|
Effect::Hatred => 5,
|
||||||
|
|
||||||
Effect::Corrupt => 2,
|
Effect::Corrupt => 2,
|
||||||
Effect::Corruption => 3,
|
Effect::Corruption => 3,
|
||||||
|
|
||||||
@ -515,6 +534,8 @@ pub enum Skill {
|
|||||||
SiphonTick,
|
SiphonTick,
|
||||||
Curse,
|
Curse,
|
||||||
|
|
||||||
|
Hostility,
|
||||||
|
|
||||||
Corrupt,
|
Corrupt,
|
||||||
Corruption,
|
Corruption,
|
||||||
CorruptionTick,
|
CorruptionTick,
|
||||||
@ -588,6 +609,8 @@ impl Skill {
|
|||||||
Skill::Corruption => None,
|
Skill::Corruption => None,
|
||||||
Skill::CorruptionTick => None,
|
Skill::CorruptionTick => None,
|
||||||
|
|
||||||
|
Skill::Hostility => Some(1),
|
||||||
|
|
||||||
// -----------------
|
// -----------------
|
||||||
// Test
|
// Test
|
||||||
// -----------------
|
// -----------------
|
||||||
@ -669,6 +692,8 @@ impl Skill {
|
|||||||
Skill::Slay => Category::Red,
|
Skill::Slay => Category::Red,
|
||||||
Skill::Taunt => Category::Red,
|
Skill::Taunt => Category::Red,
|
||||||
|
|
||||||
|
Skill::Hostility => Category::Blue,
|
||||||
|
|
||||||
Skill::Corrupt => Category::Blue,
|
Skill::Corrupt => Category::Blue,
|
||||||
Skill::Corruption => Category::Blue,
|
Skill::Corruption => Category::Blue,
|
||||||
Skill::CorruptionTick => Category::Blue,
|
Skill::CorruptionTick => Category::Blue,
|
||||||
@ -955,12 +980,27 @@ fn ruin(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resol
|
|||||||
return results;;
|
return results;;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn hex(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn hex(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
||||||
let hex = CrypEffect::new(Effect::Hex);
|
let hex = CrypEffect::new(Effect::Hex);
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Hex, hex)));
|
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Hex, hex)));
|
||||||
return results;;
|
return results;;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn hostility(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
||||||
|
let effect = CrypEffect::new(Effect::Hostility);
|
||||||
|
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Hostility, effect)));
|
||||||
|
return results;;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn hatred(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill, amount: u64) -> Resolutions {
|
||||||
|
let effect = CrypEffect::new(Effect::Hatred)
|
||||||
|
.set_meta(EffectMeta::AddedDamage(amount));
|
||||||
|
|
||||||
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
|
return results;;
|
||||||
|
}
|
||||||
|
|
||||||
fn curse(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn curse(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
||||||
let curse = CrypEffect::new(Effect::Curse);
|
let curse = CrypEffect::new(Effect::Curse);
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Curse, curse)));
|
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Curse, curse)));
|
||||||
@ -1221,6 +1261,22 @@ mod tests {
|
|||||||
assert!(x.affected(Effect::Corruption));
|
assert!(x.affected(Effect::Corruption));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn hatred_test() {
|
||||||
|
let mut x = Cryp::new()
|
||||||
|
.named(&"muji".to_string());
|
||||||
|
|
||||||
|
let mut y = Cryp::new()
|
||||||
|
.named(&"camel".to_string());
|
||||||
|
|
||||||
|
hostility(&mut y.clone(), &mut y, vec![]);
|
||||||
|
assert!(y.affected(Effect::Hostility));
|
||||||
|
|
||||||
|
resolve(Skill::Attack, &mut x, &mut y, vec![]);
|
||||||
|
|
||||||
|
assert!(x.affected(Effect::Hatred));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn triage_test() {
|
fn triage_test() {
|
||||||
let mut x = Cryp::new()
|
let mut x = Cryp::new()
|
||||||
|
|||||||
@ -68,6 +68,7 @@ pub enum Var {
|
|||||||
Curse,
|
Curse,
|
||||||
Decay,
|
Decay,
|
||||||
Empower,
|
Empower,
|
||||||
|
Hostility,
|
||||||
Haste,
|
Haste,
|
||||||
Heal,
|
Heal,
|
||||||
Hex,
|
Hex,
|
||||||
@ -189,6 +190,7 @@ impl Var {
|
|||||||
Var::Haste => Some(Skill::Haste),
|
Var::Haste => Some(Skill::Haste),
|
||||||
Var::Heal => Some(Skill::Heal),
|
Var::Heal => Some(Skill::Heal),
|
||||||
Var::Hex => Some(Skill::Hex),
|
Var::Hex => Some(Skill::Hex),
|
||||||
|
Var::Hostility => Some(Skill::Hostility),
|
||||||
Var::Invert => Some(Skill::Invert),
|
Var::Invert => Some(Skill::Invert),
|
||||||
Var::Parry => Some(Skill::Parry),
|
Var::Parry => Some(Skill::Parry),
|
||||||
Var::Purge => Some(Skill::Purge),
|
Var::Purge => Some(Skill::Purge),
|
||||||
@ -206,7 +208,7 @@ impl Var {
|
|||||||
Var::Clutch => Some(Skill::Clutch),
|
Var::Clutch => Some(Skill::Clutch),
|
||||||
Var::Taunt => Some(Skill::Taunt),
|
Var::Taunt => Some(Skill::Taunt),
|
||||||
Var::Throw => Some(Skill::Throw),
|
Var::Throw => Some(Skill::Throw),
|
||||||
Var::Corrupt => Some(Skill::Corrupt),
|
Var::Corrupt => Some(Skill::Corrupt),
|
||||||
Var::Triage => Some(Skill::Triage),
|
Var::Triage => Some(Skill::Triage),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
@ -255,6 +257,7 @@ impl From<Skill> for Var {
|
|||||||
Skill::Decay => Var::Decay,
|
Skill::Decay => Var::Decay,
|
||||||
Skill::Empower => Var::Empower,
|
Skill::Empower => Var::Empower,
|
||||||
Skill::Haste => Var::Haste,
|
Skill::Haste => Var::Haste,
|
||||||
|
Skill::Hostility => Var::Hostility,
|
||||||
Skill::Heal => Var::Heal,
|
Skill::Heal => Var::Heal,
|
||||||
Skill::Hex => Var::Hex,
|
Skill::Hex => Var::Hex,
|
||||||
Skill::Invert => Var::Invert,
|
Skill::Invert => Var::Invert,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user