add back aoe event post merge
This commit is contained in:
parent
b1cb2cec37
commit
279ab5795e
@ -90,6 +90,7 @@ function registerEvents(store) {
|
|||||||
console.log(newRes);
|
console.log(newRes);
|
||||||
return eachSeries(newRes, (r, cb) => {
|
return eachSeries(newRes, (r, cb) => {
|
||||||
const timeout = r.delay;
|
const timeout = r.delay;
|
||||||
|
if (timeout === 0) return cb(); // TargetKo etc
|
||||||
setAnimations(r, store);
|
setAnimations(r, store);
|
||||||
return setTimeout(cb, timeout);
|
return setTimeout(cb, timeout);
|
||||||
}, err => {
|
}, err => {
|
||||||
|
|||||||
@ -933,7 +933,7 @@ impl Construct {
|
|||||||
if self.is_ko() { return vec![] }
|
if self.is_ko() { return vec![] }
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
Event::Damage { construct, colour, amount, mitigation, display: _ } => {
|
Event::Damage { construct: _, colour, amount: _, mitigation: _, display: _ } => {
|
||||||
let mut casts = vec![];
|
let mut casts = vec![];
|
||||||
if self.affected(Effect::Electric) && !cast.skill.is_tick() {
|
if self.affected(Effect::Electric) && !cast.skill.is_tick() {
|
||||||
let ConstructEffect { effect: _, duration: _, meta, tick: _ } =
|
let ConstructEffect { effect: _, duration: _, meta, tick: _ } =
|
||||||
|
|||||||
@ -478,13 +478,19 @@ impl Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn resolve(&mut self, cast: Cast) -> &mut Game {
|
fn resolve(&mut self, cast: Cast) -> &mut Game {
|
||||||
// Send custom intial cast / hit aoe actions
|
// If the skill is disabled for source nothing else will happen
|
||||||
|
if let Some(effects) = self.construct(cast.source).disabled(cast.skill) {
|
||||||
|
self.add_resolution(&cast, &Event::Disable { construct: cast.source, effects });
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
// for aoe events send the source / target animations before each set of casts
|
||||||
if cast.skill.aoe() {
|
if cast.skill.aoe() {
|
||||||
/*let actions = match cast.skill.cast_animation() {
|
if cast.skill.cast_animation() {
|
||||||
true => vec![Action::Cast, Action::HitAoe],
|
let event = self.cast(cast);
|
||||||
false => vec![Action::HitAoe]
|
self.add_resolution(&cast, &event);
|
||||||
};
|
}
|
||||||
self.execute(cast, actions);*/
|
let event = self.hit_aoe(cast);
|
||||||
|
self.add_resolution(&cast, &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
let casts = self.modify_cast(cast);
|
let casts = self.modify_cast(cast);
|
||||||
@ -526,11 +532,6 @@ impl Game {
|
|||||||
// such as healing based on damage done etc
|
// such as healing based on damage done etc
|
||||||
let mut event_list = vec![];
|
let mut event_list = vec![];
|
||||||
|
|
||||||
if let Some(effects) = self.construct(cast.source).disabled(cast.skill) {
|
|
||||||
self.add_resolution(&cast, &Event::Disable { construct: cast.source, effects });
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.construct(cast.target).is_ko() {
|
if self.construct(cast.target).is_ko() {
|
||||||
self.add_resolution(&cast, &Event::TargetKo { construct: cast.target });
|
self.add_resolution(&cast, &Event::TargetKo { construct: cast.target });
|
||||||
return self;
|
return self;
|
||||||
@ -550,9 +551,8 @@ impl Game {
|
|||||||
|
|
||||||
for action in cast.actions() {
|
for action in cast.actions() {
|
||||||
let events = match action {
|
let events = match action {
|
||||||
Action::Cast => self.cast(cast),
|
Action::Cast => vec![self.cast(cast)],
|
||||||
Action::Hit => self.hit(cast),
|
Action::Hit => vec![self.hit(cast)],
|
||||||
Action::HitAoe => self.hit_aoe(cast),
|
|
||||||
|
|
||||||
Action::Damage { construct, values, colour } => {
|
Action::Damage { construct, values, colour } => {
|
||||||
let amount = self.reduce_values(&values, &event_list);
|
let amount = self.reduce_values(&values, &event_list);
|
||||||
@ -647,15 +647,15 @@ impl Game {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cast(&mut self, cast: Cast) -> Vec<Event> {
|
fn cast(&mut self, cast: Cast) -> Event {
|
||||||
vec![Event::Cast { construct: cast.source, player: cast.player, direction: self.direction(cast) }]
|
Event::Cast { construct: cast.source, player: cast.player, direction: self.direction(cast) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hit(&mut self, cast: Cast) -> Vec<Event> {
|
fn hit(&mut self, cast: Cast) -> Event {
|
||||||
vec![Event::Hit { construct: cast.target, player: cast.player, direction: self.direction(cast) }]
|
Event::Hit { construct: cast.target, player: cast.player, direction: self.direction(cast) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hit_aoe(&mut self, cast: Cast) -> Vec<Event> {
|
fn hit_aoe(&mut self, cast: Cast) -> Event {
|
||||||
let construct = self.players.iter()
|
let construct = self.players.iter()
|
||||||
.find(|t| t.constructs.iter().any(|c| c.id == cast.target))
|
.find(|t| t.constructs.iter().any(|c| c.id == cast.target))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@ -664,7 +664,7 @@ impl Game {
|
|||||||
.map(|c| c.id)
|
.map(|c| c.id)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
vec![Event::HitAoe { construct, player: cast.player, direction: self.direction(cast) }]
|
Event::HitAoe { construct, player: cast.player, direction: self.direction(cast) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn damage(&mut self, construct: Uuid, amount: usize, colour: Colour) -> Vec<Event> {
|
fn damage(&mut self, construct: Uuid, amount: usize, colour: Colour) -> Vec<Event> {
|
||||||
@ -892,7 +892,6 @@ pub enum Value {
|
|||||||
#[derive(Debug,Clone,PartialEq)]
|
#[derive(Debug,Clone,PartialEq)]
|
||||||
pub enum Action {
|
pub enum Action {
|
||||||
Hit,
|
Hit,
|
||||||
HitAoe,
|
|
||||||
Cast,
|
Cast,
|
||||||
Heal { construct: Uuid, values: Vec<Value>, colour: Colour },
|
Heal { construct: Uuid, values: Vec<Value>, colour: Colour },
|
||||||
Damage { construct: Uuid, values: Vec<Value>, colour: Colour },
|
Damage { construct: Uuid, values: Vec<Value>, colour: Colour },
|
||||||
@ -969,6 +968,7 @@ impl Event {
|
|||||||
let target_duration = 1500;
|
let target_duration = 1500;
|
||||||
let combat_text_duration = 1300;
|
let combat_text_duration = 1300;
|
||||||
|
|
||||||
|
// Exhaustively match all events so they're all properly considered
|
||||||
match self {
|
match self {
|
||||||
Event::Cast { construct: _, direction: _, player: _ } => {
|
Event::Cast { construct: _, direction: _, player: _ } => {
|
||||||
match next_event {
|
match next_event {
|
||||||
@ -994,7 +994,21 @@ impl Event {
|
|||||||
None => target_duration,
|
None => target_duration,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => combat_text_duration,
|
// Events that show combat text
|
||||||
|
Event::Damage { construct: _, amount: _, mitigation: _, colour: _, display: _ } |
|
||||||
|
Event::Effect { construct: _, effect: _, duration: _, display: _ } |
|
||||||
|
Event::Removal { construct: _, effect: _, display: _ } |
|
||||||
|
Event::Healing { construct: _, amount: _, overhealing: _, colour: _, display: _ } |
|
||||||
|
Event::Inversion { construct: _ } |
|
||||||
|
Event::Reflection { construct: _ } |
|
||||||
|
Event::Ko { construct: _ } |
|
||||||
|
Event::CooldownIncrease { construct: _, turns: _ } |
|
||||||
|
Event::CooldownDecrease { construct: _, turns: _ } => combat_text_duration,
|
||||||
|
|
||||||
|
// Events that are skipped on client
|
||||||
|
Event::TargetKo { construct: _ } |
|
||||||
|
Event::Disable { construct: _, effects: _ } |
|
||||||
|
Event::Forfeit() => 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user