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