fix healing event, remove brackets
This commit is contained in:
parent
c8561dba9a
commit
89fb27d858
@ -10,7 +10,7 @@ class GameConstructLife extends preact.Component {
|
|||||||
if (newProps.resolution && newProps.resolution !== this.props.resolution) {
|
if (newProps.resolution && newProps.resolution !== this.props.resolution) {
|
||||||
const [type, variant] = newProps.resolution.event;
|
const [type, variant] = newProps.resolution.event;
|
||||||
if (variant.construct === this.props.construct.id
|
if (variant.construct === this.props.construct.id
|
||||||
&& (type === 'Damage' || type === 'Healing' || type === 'Recharge')) return true;
|
&& (type === 'Damage' || type === 'Healing')) return true;
|
||||||
}
|
}
|
||||||
if (newProps.construct !== this.props.construct) return true;
|
if (newProps.construct !== this.props.construct) return true;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -607,6 +607,7 @@ impl Construct {
|
|||||||
construct,
|
construct,
|
||||||
amount: green_healing,
|
amount: green_healing,
|
||||||
overhealing: 0,
|
overhealing: 0,
|
||||||
|
display: EventConstruct::new(self),
|
||||||
colour: Colour::Green
|
colour: Colour::Green
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -618,6 +619,7 @@ impl Construct {
|
|||||||
construct,
|
construct,
|
||||||
amount: recharge,
|
amount: recharge,
|
||||||
overhealing,
|
overhealing,
|
||||||
|
display: EventConstruct::new(self),
|
||||||
colour: Colour::Red
|
colour: Colour::Red
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -681,6 +683,7 @@ impl Construct {
|
|||||||
construct,
|
construct,
|
||||||
amount: green_healing,
|
amount: green_healing,
|
||||||
overhealing: 0,
|
overhealing: 0,
|
||||||
|
display: EventConstruct::new(self),
|
||||||
colour: Colour::Green
|
colour: Colour::Green
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -692,6 +695,7 @@ impl Construct {
|
|||||||
construct,
|
construct,
|
||||||
amount: recharge,
|
amount: recharge,
|
||||||
overhealing,
|
overhealing,
|
||||||
|
display: EventConstruct::new(self),
|
||||||
colour: Colour::Blue
|
colour: Colour::Blue
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -731,7 +735,13 @@ impl Construct {
|
|||||||
let overhealing = modified_amount - healing;
|
let overhealing = modified_amount - healing;
|
||||||
|
|
||||||
if healing != 0 {
|
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 => {
|
true => {
|
||||||
@ -786,6 +796,7 @@ impl Construct {
|
|||||||
amount: healing,
|
amount: healing,
|
||||||
overhealing,
|
overhealing,
|
||||||
colour: Colour::Green,
|
colour: Colour::Green,
|
||||||
|
display: EventConstruct::new(self),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
true => {
|
true => {
|
||||||
@ -832,7 +843,13 @@ impl Construct {
|
|||||||
let overhealing = modified_amount - healing;
|
let overhealing = modified_amount - healing;
|
||||||
|
|
||||||
if healing != 0 {
|
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 => {
|
true => {
|
||||||
|
|||||||
@ -449,15 +449,12 @@ impl Game {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// go through the whole most recent round and modify delays of the resolutions
|
// go through the whole most recent round and modify delays of the resolutions
|
||||||
{
|
let last = self.resolutions.len() - 1;
|
||||||
let last = self.resolutions.len() - 1;
|
let mut iter = self.resolutions[last].iter_mut().peekable();
|
||||||
let mut iter = self.resolutions[last].iter_mut().peekable();
|
while let Some(res) = iter.next() {
|
||||||
while let Some(res) = iter.next() {
|
res.set_delay(iter.peek());
|
||||||
res.set_delay(iter.peek());
|
r_animation_ms += res.delay;
|
||||||
r_animation_ms += res.delay;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// info!("{:#?}", self.casts);
|
// info!("{:#?}", self.casts);
|
||||||
|
|
||||||
// handle cooldowns and statuses
|
// handle cooldowns and statuses
|
||||||
@ -898,7 +895,7 @@ pub enum Event {
|
|||||||
Effect { construct: Uuid, effect: Effect, duration: u8, display: EventConstruct },
|
Effect { construct: Uuid, effect: Effect, duration: u8, display: EventConstruct },
|
||||||
Removal { construct: Uuid, effect: Effect, 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 },
|
Inversion { construct: Uuid },
|
||||||
Reflection { construct: Uuid },
|
Reflection { construct: Uuid },
|
||||||
Ko { construct: Uuid },
|
Ko { construct: Uuid },
|
||||||
@ -1692,13 +1689,13 @@ mod tests {
|
|||||||
let resolutions = &game.resolutions[last];
|
let resolutions = &game.resolutions[last];
|
||||||
|
|
||||||
assert!(resolutions.iter().any(|r| match r.event {
|
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,
|
construct == target && amount > 0 && colour == Colour::Green,
|
||||||
_ => false,
|
_ => false,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
assert!(resolutions.iter().any(|r| match r.event {
|
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,
|
construct == target && amount > 0 && colour == Colour::Red,
|
||||||
_ => false,
|
_ => false,
|
||||||
}));
|
}));
|
||||||
@ -1723,7 +1720,7 @@ mod tests {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
assert!(resolutions.iter().any(|r| match r.event {
|
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,
|
construct == source && amount > 0 && colour == Colour::Green,
|
||||||
_ => false,
|
_ => false,
|
||||||
}));
|
}));
|
||||||
|
|||||||
@ -732,7 +732,7 @@ impl Cast {
|
|||||||
values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }],
|
values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }],
|
||||||
},
|
},
|
||||||
Action::Heal {
|
Action::Heal {
|
||||||
construct: self.target,
|
construct: self.source,
|
||||||
colour: Colour::Green,
|
colour: Colour::Green,
|
||||||
values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Red, mult: 50 }],
|
values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Red, mult: 50 }],
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user