diff --git a/client/src/animations.utils.jsx b/client/src/animations.utils.jsx
index 2580d68a..2290f560 100644
--- a/client/src/animations.utils.jsx
+++ b/client/src/animations.utils.jsx
@@ -2,15 +2,14 @@ const actions = require('./actions');
const { TIMES } = require('./constants');
function setAnimations(r, store, account) {
- const { cast, focus, event, delay } = r;
- const { source, target, player, skill } = cast;
+ const { skill, focus, event: [type, variant] } = r;
- store.dispatch(actions.setAnimFocus(r.focus));
+ store.dispatch(actions.setAnimFocus(focus));
- if (r.event[0] === 'Cast') {
+ if (type === 'Cast') {
store.dispatch(actions.setAnimText(null));
- const { construct, direction: [x, y] } = r.event[1];
+ const { construct, player, direction: [x, y] } = variant;
const animY = y && player === account.id ? -1 : y;
const animSource = {
animation: 'sourceCast',
@@ -22,10 +21,10 @@ function setAnimations(r, store, account) {
return setTimeout(() => store.dispatch(actions.setAnimSource(null)), TIMES.SOURCE_DURATION_MS);
}
- if (r.event[0].includes('Hit')) {
+ if (type.includes('Hit')) {
store.dispatch(actions.setAnimText(null));
- const { construct, direction: [x, y] } = r.event[1];
+ const { construct, player, direction: [x, y] } = variant;
const animY = y && player === account.id ? -1 : y;
const isPlayer = player === account.id;
const animTarget = {
diff --git a/client/src/components/game.construct.anim.text.jsx b/client/src/components/game.construct.anim.text.jsx
index 2c652e53..56f8f04d 100644
--- a/client/src/components/game.construct.anim.text.jsx
+++ b/client/src/components/game.construct.anim.text.jsx
@@ -31,7 +31,7 @@ class AnimText extends preact.Component {
const { construct, animText, itemInfo } = this.props;
if (animText && animText.event[1].construct === construct.id) {
const itemSourceDescription = () => {
- const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animText.cast.skill));
+ const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animText.skill));
const itemSourceInfo = itemSource.length
? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}`
: false;
@@ -82,7 +82,7 @@ class AnimText extends preact.Component {
return (
-
{animText.cast.skill}
+ {animText.skill}
{itemSourceDescription()}
{generateAnimText()}
diff --git a/core/src/game.rs b/core/src/game.rs
index 8b0464d6..36fc2e7d 100644
--- a/core/src/game.rs
+++ b/core/src/game.rs
@@ -535,17 +535,17 @@ impl Game {
for action in cast.actions() {
let events = match action {
- Action::Cast { construct } => self.cast(cast),
- Action::Hit { construct } => self.hit(cast),
+ Action::Cast { construct } => self.cast(construct, cast),
+ Action::Hit { construct } => self.hit(construct, cast),
Action::Damage { construct, values, colour } => {
let amount = self.calculate_amount(&values, &resolved);
- self.damage(cast, construct, amount, colour)
+ self.damage(construct, amount, colour)
},
Action::Heal { construct, values, colour } => {
let amount = self.calculate_amount(&values, &resolved);
- self.heal(cast, construct, amount, colour)
+ self.heal(construct, amount, colour)
},
Action::Effect { construct, effect } => self.effect(construct, effect),
@@ -628,21 +628,21 @@ impl Game {
// }
}
- fn cast(&mut self, cast: Cast) -> Vec {
- vec![Event::Cast { construct: cast.source, player: cast.player, direction: self.direction(cast) }]
+ fn cast(&mut self, construct: Uuid, cast: Cast) -> Vec {
+ vec![Event::Cast { construct, player: cast.player, direction: self.direction(cast) }]
}
- fn hit(&mut self, cast: Cast) -> Vec {
- vec![Event::Hit { construct: cast.target, player: cast.player, direction: self.direction(cast) }]
+ fn hit(&mut self, construct: Uuid, cast: Cast) -> Vec {
+ vec![Event::Hit { construct, player: cast.player, direction: self.direction(cast) }]
}
- fn damage(&mut self, cast: Cast, construct: Uuid, amount: usize, colour: Colour) -> Vec {
+ fn damage(&mut self, construct: Uuid, amount: usize, colour: Colour) -> Vec {
match colour {
_ => self.construct_by_id(construct).unwrap().deal_red_damage(amount) // fixme unwrap
}
}
- fn heal(&mut self, cast: Cast, construct: Uuid, value: usize, colour: Colour) -> Vec {
+ fn heal(&mut self, construct: Uuid, value: usize, colour: Colour) -> Vec {
match colour {
_ => self.construct_by_id(construct).unwrap().deal_red_damage(value) // fixme unwrap
}
@@ -870,7 +870,7 @@ pub enum Action {
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
pub struct Resolution {
- pub cast: Cast,
+ pub skill: Skill,
pub focus: Vec,
pub event: Event,
pub delay: i64,
@@ -888,7 +888,7 @@ impl Resolution {
let delay = event.delay();
Resolution {
- cast,
+ skill: cast.skill,
delay,
focus,
event,
diff --git a/core/src/skill.rs b/core/src/skill.rs
index 22d469fd..dc53ed98 100644
--- a/core/src/skill.rs
+++ b/core/src/skill.rs
@@ -599,7 +599,8 @@ impl Cast {
},
],
- _ => unimplemented!()
+ // _ => unimplemented!(),
+ _ => vec![], // for client testing
};
actions.append(&mut rest);