fix game construct css classes

This commit is contained in:
Mashy
2019-12-09 11:18:52 +10:00
parent 60587351b5
commit d33cda012e
5 changed files with 32 additions and 24 deletions
+8 -8
View File
@@ -533,8 +533,8 @@ impl Game {
for action in cast.actions() {
let events = match action {
Action::Cast { construct } => self.cast(construct, cast),
Action::Hit { construct } => self.hit(construct, cast),
Action::Cast => self.cast(cast),
Action::Hit => self.hit(cast),
Action::Damage { construct, values, colour } => {
let amount = self.calculate_amount(&values, &resolved);
@@ -663,12 +663,12 @@ impl Game {
// }
}
fn cast(&mut self, construct: Uuid, cast: Cast) -> Vec<Event> {
vec![Event::Cast { construct, player: cast.player, direction: self.direction(cast) }]
fn cast(&mut self, cast: Cast) -> Vec<Event> {
vec![Event::Cast { construct: cast.source, player: cast.player, direction: self.direction(cast) }]
}
fn hit(&mut self, construct: Uuid, cast: Cast) -> Vec<Event> {
vec![Event::Hit { construct, player: cast.player, direction: self.direction(cast) }]
fn hit(&mut self, cast: Cast) -> Vec<Event> {
vec![Event::Hit { construct: cast.target, player: cast.player, direction: self.direction(cast) }]
}
fn damage(&mut self, construct: Uuid, amount: usize, colour: Colour) -> Vec<Event> {
@@ -893,8 +893,8 @@ pub enum Value {
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
pub enum Action {
Hit { construct: Uuid },
Cast { construct: Uuid },
Hit,
Cast,
Heal { construct: Uuid, values: Vec<Value>, colour: Colour },
Damage { construct: Uuid, values: Vec<Value>, colour: Colour },
Effect { construct: Uuid, effect: ConstructEffect },
+4 -4
View File
@@ -57,10 +57,10 @@ impl Cast {
let mut actions = vec![];
if self.skill.cast_animation() {
actions.push(Action::Cast { construct: self.source });
actions.push(Action::Cast);
}
actions.push(Action::Hit { construct: self.target });
actions.push(Action::Hit);
let mut rest = match self.skill {
Skill::Attack => vec![
@@ -1616,12 +1616,12 @@ mod tests {
let actions = cast.actions();
match actions[0] {
Action::Cast { construct: _ } => (),
Action::Cast => (),
_ => panic!("{:?}", actions),
};
match actions[1] {
Action::Hit { construct: _ } => (),
Action::Hit => (),
_ => panic!("{:?}", actions),
};