fix healing event, remove brackets

This commit is contained in:
Mashy
2019-12-10 18:38:34 +10:00
parent c8561dba9a
commit 89fb27d858
4 changed files with 30 additions and 16 deletions
+19 -2
View File
@@ -607,6 +607,7 @@ impl Construct {
construct,
amount: green_healing,
overhealing: 0,
display: EventConstruct::new(self),
colour: Colour::Green
}
);
@@ -618,6 +619,7 @@ impl Construct {
construct,
amount: recharge,
overhealing,
display: EventConstruct::new(self),
colour: Colour::Red
}
);
@@ -681,6 +683,7 @@ impl Construct {
construct,
amount: green_healing,
overhealing: 0,
display: EventConstruct::new(self),
colour: Colour::Green
}
);
@@ -692,6 +695,7 @@ impl Construct {
construct,
amount: recharge,
overhealing,
display: EventConstruct::new(self),
colour: Colour::Blue
}
);
@@ -731,7 +735,13 @@ impl Construct {
let overhealing = modified_amount - healing;
if healing != 0 {
events.push(Event::Healing { construct: self.id, amount: healing, overhealing, colour: Colour::Red });
events.push(Event::Healing {
construct: self.id,
amount: healing,
overhealing,
display: EventConstruct::new(self),
colour: Colour::Red
});
}
},
true => {
@@ -786,6 +796,7 @@ impl Construct {
amount: healing,
overhealing,
colour: Colour::Green,
display: EventConstruct::new(self),
});
},
true => {
@@ -832,7 +843,13 @@ impl Construct {
let overhealing = modified_amount - healing;
if healing != 0 {
events.push(Event::Healing { construct: self.id, amount: healing, overhealing, colour: Colour::Red });
events.push(Event::Healing {
construct: self.id,
amount: healing,
overhealing,
colour: Colour::Red,
display: EventConstruct::new(self),
});
}
},
true => {
+9 -12
View File
@@ -449,15 +449,12 @@ impl Game {
};
// go through the whole most recent round and modify delays of the resolutions
{
let last = self.resolutions.len() - 1;
let mut iter = self.resolutions[last].iter_mut().peekable();
while let Some(res) = iter.next() {
res.set_delay(iter.peek());
r_animation_ms += res.delay;
}
let last = self.resolutions.len() - 1;
let mut iter = self.resolutions[last].iter_mut().peekable();
while let Some(res) = iter.next() {
res.set_delay(iter.peek());
r_animation_ms += res.delay;
}
// info!("{:#?}", self.casts);
// handle cooldowns and statuses
@@ -898,7 +895,7 @@ pub enum Event {
Effect { construct: Uuid, effect: Effect, duration: u8, display: EventConstruct },
Removal { construct: Uuid, effect: Effect, display: EventConstruct },
Healing { construct: Uuid, amount: usize, overhealing: usize, colour: Colour },
Healing { construct: Uuid, amount: usize, overhealing: usize, colour: Colour, display: EventConstruct },
Inversion { construct: Uuid },
Reflection { construct: Uuid },
Ko { construct: Uuid },
@@ -1692,13 +1689,13 @@ mod tests {
let resolutions = &game.resolutions[last];
assert!(resolutions.iter().any(|r| match r.event {
Event::Healing { construct, colour, amount, overhealing: _ } =>
Event::Healing { construct, colour, amount, overhealing: _, display: _, } =>
construct == target && amount > 0 && colour == Colour::Green,
_ => false,
}));
assert!(resolutions.iter().any(|r| match r.event {
Event::Healing { construct, colour, amount, overhealing: _ } =>
Event::Healing { construct, colour, amount, overhealing: _, display: _ } =>
construct == target && amount > 0 && colour == Colour::Red,
_ => false,
}));
@@ -1723,7 +1720,7 @@ mod tests {
}));
assert!(resolutions.iter().any(|r| match r.event {
Event::Healing { construct, colour, amount, overhealing: _ } =>
Event::Healing { construct, colour, amount, overhealing: _, display: _ } =>
construct == source && amount > 0 && colour == Colour::Green,
_ => false,
}));
+1 -1
View File
@@ -732,7 +732,7 @@ impl Cast {
values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }],
},
Action::Heal {
construct: self.target,
construct: self.source,
colour: Colour::Green,
values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Red, mult: 50 }],
},