counterattack immunity
This commit is contained in:
parent
59b8c90496
commit
8240c704a7
@ -50,6 +50,8 @@ pub enum Effect {
|
||||
Siphon,
|
||||
Siphoned, // immunity
|
||||
|
||||
Countered,
|
||||
|
||||
// Regen,
|
||||
// Airborne,
|
||||
// Boost
|
||||
@ -119,6 +121,7 @@ impl Effect {
|
||||
Effect::Siphoned => true,
|
||||
Effect::Decayed => true,
|
||||
Effect::Triaged => true,
|
||||
Effect::Countered => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@ -239,6 +242,7 @@ impl Effect {
|
||||
Effect::Triaged => None,
|
||||
Effect::Decayed => None,
|
||||
Effect::Siphoned => None,
|
||||
Effect::Countered => None,
|
||||
Effect::Ko => None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,6 +463,29 @@ impl Game {
|
||||
self.skill_phase_start(r_animation_ms)
|
||||
}
|
||||
|
||||
fn modify_cast(&self, cast: Cast) -> Vec<Cast> {
|
||||
let target_player = self.players.iter()
|
||||
.find(|t| t.constructs.iter().any(|c| c.id == cast.target))
|
||||
.unwrap();
|
||||
|
||||
if let Some(t) = target_player.intercepting() {
|
||||
return vec![Cast { target: t.id, ..cast }];
|
||||
}
|
||||
|
||||
let casts = match cast.skill.aoe() {
|
||||
true => self.players.iter()
|
||||
.find(|t| t.constructs.iter().any(|c| c.id == cast.target))
|
||||
.unwrap()
|
||||
.constructs
|
||||
.iter()
|
||||
.map(|c| Cast { target: c.id, ..cast })
|
||||
.collect(),
|
||||
false => vec![cast],
|
||||
};
|
||||
|
||||
return casts;
|
||||
}
|
||||
|
||||
fn new_resolve(&mut self, cast: Cast) -> &mut Game {
|
||||
self.events = vec![];
|
||||
self.resolve(cast);
|
||||
@ -502,29 +525,6 @@ impl Game {
|
||||
self
|
||||
}
|
||||
|
||||
fn modify_cast(&self, cast: Cast) -> Vec<Cast> {
|
||||
let target_player = self.players.iter()
|
||||
.find(|t| t.constructs.iter().any(|c| c.id == cast.target))
|
||||
.unwrap();
|
||||
|
||||
if let Some(t) = target_player.intercepting() {
|
||||
return vec![Cast { target: t.id, ..cast }];
|
||||
}
|
||||
|
||||
let casts = match cast.skill.aoe() {
|
||||
true => self.players.iter()
|
||||
.find(|t| t.constructs.iter().any(|c| c.id == cast.target))
|
||||
.unwrap()
|
||||
.constructs
|
||||
.iter()
|
||||
.map(|c| Cast { target: c.id, ..cast })
|
||||
.collect(),
|
||||
false => vec![cast],
|
||||
};
|
||||
|
||||
return casts;
|
||||
}
|
||||
|
||||
fn execute(&mut self, cast: Cast) -> &mut Game {
|
||||
if self.construct(cast.target).is_ko() {
|
||||
self.add_resolution(&cast, &Event::TargetKo { construct: cast.target });
|
||||
@ -643,7 +643,7 @@ impl Game {
|
||||
}
|
||||
|
||||
fn cast(&mut self, cast: Cast) -> Event {
|
||||
Event::Cast { construct: cast.source, player: cast.player, direction: self.direction(cast) }
|
||||
Event::Cast { construct: cast.source, player: cast.player, target: cast.target, skill: cast.skill, direction: self.direction(cast) }
|
||||
}
|
||||
|
||||
fn hit(&mut self, cast: Cast) -> Event {
|
||||
@ -726,8 +726,8 @@ impl Game {
|
||||
|
||||
let cooldown = self.resolutions[last].iter()
|
||||
.find_map(|r| match r.event {
|
||||
Event::Cast { construct: caster, player: _, direction: _ } =>
|
||||
match caster == construct.id && r.skill.base_cd().is_some() {
|
||||
Event::Cast { construct: caster, player: _, direction: _, skill, target: _ } =>
|
||||
match caster == construct.id && skill.base_cd().is_some() {
|
||||
true => Some(r.skill),
|
||||
false => None,
|
||||
},
|
||||
@ -887,7 +887,7 @@ impl Resolution {
|
||||
|
||||
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
||||
pub enum Event {
|
||||
Cast { construct: Uuid, player: Uuid, direction: Direction },
|
||||
Cast { construct: Uuid, player: Uuid, target: Uuid, skill: Skill, direction: Direction },
|
||||
Hit { construct: Uuid, player: Uuid, direction: Direction },
|
||||
HitAoe { construct: Vec<Uuid>, player: Uuid, direction: Direction },
|
||||
|
||||
@ -955,7 +955,7 @@ impl Event {
|
||||
|
||||
fn animation(&self) -> Animation {
|
||||
match self {
|
||||
Event::Cast { construct: _, direction: _, player: _ } => Animation::Source,
|
||||
Event::Cast { construct: _, direction: _, player: _, target: _, skill: _ } => Animation::Source,
|
||||
|
||||
Event::Hit { construct: _, direction: _, player: _ } |
|
||||
Event::HitAoe { construct: _, direction: _, player: _ } => Animation::Target,
|
||||
|
||||
@ -1414,6 +1414,12 @@ fn counter_attack(cast: Cast, game: &mut Game) {
|
||||
amount: game.value(Value::Stat { construct: cast.source, stat: Stat::RedPower }).pct(cast.skill.multiplier()),
|
||||
},
|
||||
);
|
||||
game.action(cast,
|
||||
Action::Effect {
|
||||
construct: cast.target,
|
||||
effect: ConstructEffect { effect: Effect::Countered, duration: 1, meta: None }, // immunity to additional hits
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
fn decay(cast: Cast, game: &mut Game) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user