Merge branch 'core' of ssh://git.mnml.gg:40022/~/mnml into core
This commit is contained in:
commit
1739045f2c
@ -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;
|
||||||
|
|||||||
@ -606,6 +606,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
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -617,6 +618,7 @@ impl Construct {
|
|||||||
construct,
|
construct,
|
||||||
amount: recharge,
|
amount: recharge,
|
||||||
overhealing,
|
overhealing,
|
||||||
|
display: EventConstruct::new(self),
|
||||||
colour: Colour::Red
|
colour: Colour::Red
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -678,6 +680,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
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -689,6 +692,7 @@ impl Construct {
|
|||||||
construct,
|
construct,
|
||||||
amount: recharge,
|
amount: recharge,
|
||||||
overhealing,
|
overhealing,
|
||||||
|
display: EventConstruct::new(self),
|
||||||
colour: Colour::Blue
|
colour: Colour::Blue
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -727,7 +731,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 => {
|
||||||
@ -781,6 +791,7 @@ impl Construct {
|
|||||||
amount: healing,
|
amount: healing,
|
||||||
overhealing,
|
overhealing,
|
||||||
colour: Colour::Green,
|
colour: Colour::Green,
|
||||||
|
display: EventConstruct::new(self),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
true => {
|
true => {
|
||||||
@ -826,7 +837,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 => {
|
||||||
|
|||||||
@ -437,9 +437,6 @@ impl Game {
|
|||||||
let mut r_animation_ms = 0;
|
let mut r_animation_ms = 0;
|
||||||
while let Some(cast) = self.stack.pop() {
|
while let Some(cast) = self.stack.pop() {
|
||||||
// info!("{:} casts ", cast);
|
// info!("{:} casts ", cast);
|
||||||
|
|
||||||
// r_animation_ms = Resolutions.iter().fold(r_animation_ms, |acc, r| acc + r.clone().get_delay());
|
|
||||||
|
|
||||||
// if theres no resolution Resolutions, the skill didn't trigger (disable etc)
|
// if theres no resolution Resolutions, the skill didn't trigger (disable etc)
|
||||||
// if Resolutions.len() > 0 && cast.used_cooldown() {
|
// if Resolutions.len() > 0 && cast.used_cooldown() {
|
||||||
// casters.push(cast);
|
// casters.push(cast);
|
||||||
@ -456,8 +453,8 @@ impl Game {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 },
|
||||||
@ -1689,13 +1686,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,
|
||||||
}));
|
}));
|
||||||
@ -1709,21 +1706,21 @@ mod tests {
|
|||||||
let target = game.players[1].constructs[0].id;
|
let target = game.players[1].constructs[0].id;
|
||||||
|
|
||||||
game.resolve(Cast::new(source, player_id, target, Skill::Siphon));
|
game.resolve(Cast::new(source, player_id, target, Skill::Siphon));
|
||||||
|
|
||||||
// assert!(resolutions.iter().any(|r| match r.event {
|
|
||||||
// Event::Damage { construct, colour, amount, mitigation: _, display: _ } =>
|
|
||||||
// construct == target && amount > 0 && colour == Colour::Blue,
|
|
||||||
// _ => false,
|
|
||||||
// }));
|
|
||||||
|
|
||||||
// assert!(resolutions.iter().any(|r| match r.event {
|
|
||||||
// Event::Healing { construct, colour, amount, overhealing: _ } =>
|
|
||||||
// construct == source && amount > 0 && colour == Colour::Green,
|
|
||||||
// _ => false,
|
|
||||||
// }));
|
|
||||||
game = game.resolve_phase_start();
|
game = game.resolve_phase_start();
|
||||||
|
|
||||||
let last = game.resolutions.len() - 1;
|
let last = game.resolutions.len() - 1;
|
||||||
let resolutions = &game.resolutions[last];
|
let resolutions = &game.resolutions[last];
|
||||||
println!("{:#?}", resolutions);
|
|
||||||
|
assert!(resolutions.iter().any(|r| match r.event {
|
||||||
|
Event::Damage { construct, colour, amount, mitigation: _, display: _ } =>
|
||||||
|
construct == target && amount > 0 && colour == Colour::Blue,
|
||||||
|
_ => false,
|
||||||
|
}));
|
||||||
|
|
||||||
|
assert!(resolutions.iter().any(|r| match r.event {
|
||||||
|
Event::Healing { construct, colour, amount, overhealing: _, display: _ } =>
|
||||||
|
construct == source && amount > 0 && colour == Colour::Green,
|
||||||
|
_ => 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