hide certain effects

This commit is contained in:
ntr 2019-12-12 11:50:44 +10:00
parent 5a34bb9435
commit 9ec1d2974e
4 changed files with 25 additions and 11 deletions

View File

@ -3,6 +3,6 @@ last round of animations skipped cause no skill phase to add new vec
check silence skill multiplier
game ready not auto starting resolve phase
purify conditional healing
purify conditional healing
absorb post resolve

View File

@ -518,7 +518,7 @@ impl Construct {
Stat::Cooldowns => self.skills.iter().filter(|cs| cs.cd.is_some()).count(),
Stat::Skills(colour) => self.skills.iter().filter(|cs| cs.skill.colours().contains(&colour)).count(),
Stat::EffectsCount => self.effects.len(),
Stat::EffectsCount => self.effects.iter().filter(|ce| !ce.effect.hidden()).count(),
_ => panic!("{:?} cannot be calculated without an amount", stat),
}
@ -893,6 +893,7 @@ impl Construct {
}
pub fn effect_add(&mut self, effect: ConstructEffect) -> Vec<Event> {
let mut results = vec![];
if self.is_ko() { return vec![Event::TargetKo { construct: self.id }] }
if let Some(p) = self.effects.iter().position(|ce| ce.effect == effect.effect) {
@ -902,19 +903,20 @@ impl Construct {
self.effects[p] = effect;
} else {
// new effect
// info!("{:?} {:?} adding effect", self.name, effect.effect);
self.effects.push(effect);
}
// todo modified durations cause of buffs
let result = Event::Effect {
construct: self.id,
effect: effect.effect,
duration: effect.duration,
display: EventConstruct::new(self)
// probably not a good idea
if !effect.effect.hidden() {
results.push(Event::Effect {
construct: self.id,
effect: effect.effect,
duration: effect.duration,
display: EventConstruct::new(self)
});
};
return vec![result];
return results;
}
pub fn effect_remove(&mut self, effect: Effect) -> Vec<Event> {

View File

@ -117,6 +117,18 @@ impl Effect {
}
}
// hidden effects are used generally for immunities
// they are not displayed on client
// and not included in counts
pub fn hidden(&self) -> bool {
match self {
Effect::Siphoned => true,
Effect::Decayed => true,
Effect::Triaged => true,
_ => false,
}
}
pub fn disables_skill(&self, skill: Skill) -> bool {
if skill.is_tick() {
return false;

View File

@ -995,7 +995,7 @@ impl EventConstruct {
red: construct.stat(Stat::RedLife),
green: construct.stat(Stat::GreenLife),
blue: construct.stat(Stat::BlueLife),
effects: construct.effects.clone(),
effects: construct.effects.iter().cloned().filter(|ce| !ce.effect.hidden()).collect(),
}
}
}