reflect
This commit is contained in:
parent
eef88568d6
commit
1054833dfd
@ -17,15 +17,19 @@
|
||||
## NOW
|
||||
cryp vbox
|
||||
ensure all skills impl
|
||||
Skill::Reflect -> reflect incoming attacks back to opponent
|
||||
Skill::Ruin -> aoe stun
|
||||
ez
|
||||
Skill::Slay -> red attack with bonus somethingorother for blue / maim no healing
|
||||
|
||||
aoe
|
||||
Skill::Ruin -> aoe stun
|
||||
|
||||
on attack
|
||||
Skill::Reflect -> reflect incoming attacks back to opponent
|
||||
Skill::Taunt -> redirect incomnig attacks to self
|
||||
Skill::Toxic -> apply debuff to attackers
|
||||
|
||||
colour speeds
|
||||
|
||||
ticks apply on first turn
|
||||
update speed of rest of stack on cryp speed change
|
||||
include target name in effect resolution
|
||||
eg strangle applies buff to self
|
||||
|
||||
@ -301,6 +301,10 @@ impl Cryp {
|
||||
self.effects.iter().any(|s| s.effect == Effect::Invert)
|
||||
}
|
||||
|
||||
pub fn is_reflecting(&self) -> bool {
|
||||
self.effects.iter().any(|s| s.effect == Effect::Reflect)
|
||||
}
|
||||
|
||||
pub fn is_clutch(&self) -> bool {
|
||||
self.effects.iter().any(|s| s.effect == Effect::Clutch)
|
||||
}
|
||||
|
||||
@ -102,6 +102,8 @@ pub enum Effect {
|
||||
Snare,
|
||||
Clutch,
|
||||
|
||||
Reflect,
|
||||
|
||||
Empower,
|
||||
|
||||
Invert,
|
||||
@ -244,6 +246,7 @@ impl Effect {
|
||||
Effect::Banish => Category::BlueDebuff, // todo randomise
|
||||
Effect::Slow => Category::BlueDebuff,
|
||||
Effect::Haste => Category::BlueBuff,
|
||||
Effect::Reflect => Category::BlueBuff,
|
||||
Effect::Enslave => Category::BlueDebuff,
|
||||
Effect::Mesmerise => Category::BlueDebuff,
|
||||
Effect::Amplify => Category::BlueBuff,
|
||||
@ -273,6 +276,8 @@ impl Effect {
|
||||
Effect::Parry => 1,
|
||||
Effect::Clutch => 1,
|
||||
|
||||
Effect::Reflect => 1,
|
||||
|
||||
Effect::Strangle => 2,
|
||||
Effect::Strangling => 2,
|
||||
|
||||
@ -582,7 +587,7 @@ impl Skill {
|
||||
Skill::Purge => 1,
|
||||
|
||||
Skill::Recharge => 1,
|
||||
Skill::Reflect => 1,
|
||||
Skill::Reflect => 5,
|
||||
Skill::Ruin => 1,
|
||||
Skill::Slay => 1,
|
||||
Skill::Strangle => 5,
|
||||
@ -632,6 +637,15 @@ impl Skill {
|
||||
false => (),
|
||||
}
|
||||
|
||||
if target.is_reflecting() {
|
||||
// guard against overflow
|
||||
if source.is_reflecting() {
|
||||
return resolution;
|
||||
}
|
||||
let mut copy = source.clone();
|
||||
return self.resolve(&mut copy, source);
|
||||
}
|
||||
|
||||
match self {
|
||||
Skill::Amplify => amplify(source, target, resolution), // increase magic damage
|
||||
Skill::Attack => attack(source, target, resolution),
|
||||
@ -665,7 +679,7 @@ impl Skill {
|
||||
Skill::Strangle => strangle(source, target, resolution),
|
||||
Skill::StrangleTick => strangle_tick(source, target, resolution),
|
||||
|
||||
Skill::Reflect => unimplemented!(),
|
||||
Skill::Reflect => reflect(source, target, resolution),
|
||||
Skill::Ruin => unimplemented!(),
|
||||
Skill::Slay => unimplemented!(),
|
||||
Skill::Taunt => unimplemented!(),
|
||||
@ -868,6 +882,12 @@ fn invert(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Re
|
||||
return resolution;;
|
||||
}
|
||||
|
||||
fn reflect(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
|
||||
let effect = CrypEffect { effect: Effect::Reflect, duration: Effect::Reflect.duration(), tick: None };
|
||||
resolution.results.push(target.add_effect(Skill::Reflect, effect));
|
||||
return resolution;;
|
||||
}
|
||||
|
||||
fn recharge(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
|
||||
resolution.results.push(target.recharge());
|
||||
return resolution;
|
||||
@ -1069,6 +1089,28 @@ mod tests {
|
||||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reflect_test() {
|
||||
let mut x = Cryp::new()
|
||||
.named(&"muji".to_string());
|
||||
|
||||
let mut y = Cryp::new()
|
||||
.named(&"camel".to_string());
|
||||
|
||||
reflect(&mut y.clone(), &mut y, Resolution::new(Skill::Reflect));
|
||||
assert!(y.is_reflecting());
|
||||
|
||||
// heal should deal green damage
|
||||
let mut cast = Cast::new(Uuid::nil(), Uuid::nil(), Uuid::nil(), Skill::Attack);
|
||||
cast.set_resolution(&mut x, &mut y);
|
||||
|
||||
assert!(x.hp() == 768);
|
||||
|
||||
match cast.resolution.results[0] {
|
||||
ResolutionResult::Damage { amount, mitigation: _, category: _, immunity: _ } => assert_eq!(amount, 256),
|
||||
_ => panic!("not damage"),
|
||||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn triage_test() {
|
||||
|
||||
@ -172,7 +172,7 @@ impl Var {
|
||||
Var::Purge => Some(Skill::Purge),
|
||||
Var::Purify => Some(Skill::Purify),
|
||||
Var::Recharge => Some(Skill::Recharge),
|
||||
// Var::Reflect => Some(Skill::Reflect),
|
||||
Var::Reflect => Some(Skill::Reflect),
|
||||
// Var::Ruin => Some(Skill::Ruin),
|
||||
Var::Shield => Some(Skill::Shield),
|
||||
Var::Silence => Some(Skill::Silence),
|
||||
@ -249,6 +249,7 @@ impl From<Skill> for Var {
|
||||
Skill::Throw => Var::Throw,
|
||||
Skill::Triage => Var::Triage,
|
||||
Skill::Decay => Var::Decay,
|
||||
Skill::Reflect => Var::Reflect,
|
||||
|
||||
Skill::TestTouch => Var::TestTouch,
|
||||
Skill::TestStun => Var::TestStun,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user