set cast / hit to full duration if theres no overlap
This commit is contained in:
parent
445a641b8d
commit
60587351b5
@ -14,7 +14,6 @@ module.exports = {
|
||||
activeSkill: createReducer(null, 'SET_ACTIVE_SKILL'),
|
||||
|
||||
animating: createReducer(false, 'SET_ANIMATING'),
|
||||
animSkill: createReducer(null, 'SET_ANIM_SKILL'),
|
||||
animSource: createReducer(null, 'SET_ANIM_SOURCE'),
|
||||
animFocus: createReducer(null, 'SET_ANIM_FOCUS'),
|
||||
animTarget: createReducer(null, 'SET_ANIM_TARGET'),
|
||||
|
||||
105
core/src/game.rs
105
core/src/game.rs
@ -526,8 +526,6 @@ impl Game {
|
||||
}
|
||||
|
||||
fn resolve(&mut self, cast: Cast) -> &mut Game {
|
||||
let skill = cast.skill;
|
||||
|
||||
// calculate values first?
|
||||
// for result damage value need to pass &Resolutions and .find()
|
||||
|
||||
@ -560,6 +558,43 @@ impl Game {
|
||||
resolved.append(&mut resolutions);
|
||||
}
|
||||
|
||||
{
|
||||
let mut r_iter = resolved.iter_mut().peekable();
|
||||
while let Some(r) = r_iter.next() {
|
||||
let set_full_delay = match r.event {
|
||||
Event::Cast { construct: _, player: _, direction: _} => {
|
||||
match r_iter.peek() {
|
||||
Some(next_r) => {
|
||||
match next_r.event {
|
||||
Event::Cast { construct: _, player: _, direction: _} => true,
|
||||
_ => false
|
||||
}
|
||||
},
|
||||
None => true,
|
||||
}
|
||||
},
|
||||
|
||||
Event::Hit { construct: _, player: _, direction: _} => {
|
||||
match r_iter.peek() {
|
||||
Some(next_r) => {
|
||||
match next_r.event {
|
||||
Event::Cast { construct: _, player: _, direction: _} |
|
||||
Event::Hit { construct: _, player: _, direction: _} => true,
|
||||
_ => false
|
||||
}
|
||||
},
|
||||
None => true,
|
||||
}
|
||||
},
|
||||
_ => false,
|
||||
};
|
||||
|
||||
if set_full_delay {
|
||||
r.set_full_delay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.resolutions.last_mut().unwrap().append(&mut resolved);
|
||||
|
||||
self
|
||||
@ -886,7 +921,6 @@ impl Resolution {
|
||||
};
|
||||
|
||||
let delay = event.delay();
|
||||
|
||||
Resolution {
|
||||
skill: cast.skill,
|
||||
delay,
|
||||
@ -894,6 +928,11 @@ impl Resolution {
|
||||
event,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_full_delay(&mut self) -> &mut Resolution {
|
||||
self.delay = self.event.set_full_delay();
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub type Disable = Vec<Effect>;
|
||||
@ -922,17 +961,27 @@ pub enum Event {
|
||||
|
||||
impl Event {
|
||||
fn delay(&self) -> i64 {
|
||||
// let source_duration = 1000; // Time for SOURCE ONLY
|
||||
let target_duration = 1500; // Time for target animation
|
||||
let target_delay = 500; // Add delay if theres source animation
|
||||
let combat_text_delay = 1300; // Time for all post skill
|
||||
let combat_text_overlap = 600; // overlap between animation and combat text
|
||||
let combat_text_delay = 900; // Time for target animation
|
||||
let combat_text_duration = 1300; // Time for all post skill
|
||||
|
||||
match self {
|
||||
Event::Cast { construct: _, direction: _, player: _ } => target_delay,
|
||||
Event::Hit { construct: _, direction: _, player: _ } |
|
||||
Event::HitAoe { construct: _ } => target_duration - combat_text_overlap,
|
||||
_ => combat_text_delay,
|
||||
Event::HitAoe { construct: _ } => combat_text_delay,
|
||||
_ => combat_text_duration,
|
||||
}
|
||||
}
|
||||
fn set_full_delay(&self) -> i64 {
|
||||
let source_duration = 1000;
|
||||
let target_duration = 1500;
|
||||
let combat_text_duration = 1300;
|
||||
|
||||
match self {
|
||||
Event::Cast { construct: _, direction: _, player: _ } => source_duration,
|
||||
Event::Hit { construct: _, direction: _, player: _ } |
|
||||
Event::HitAoe { construct: _ } => target_duration,
|
||||
_ => combat_text_duration,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -960,44 +1009,6 @@ impl EventConstruct {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
||||
pub enum ResolutionStages {
|
||||
#[serde(rename = "START_SKILL END_SKILL POST_SKILL")]
|
||||
AllStages, // Anim Anim Anim
|
||||
#[serde(rename = "START_SKILL END_SKILL")]
|
||||
StartEnd, // Anim Anim Skip
|
||||
#[serde(rename = "START_SKILL POST_SKILL")]
|
||||
StartPost, // Anim Skip Anim
|
||||
#[serde(rename = "START_SKILL")]
|
||||
StartOnly, // Anim Skip Skip
|
||||
#[serde(rename = "END_SKILL POST_SKILL")]
|
||||
EndPost, // Skip Anim Anim
|
||||
#[serde(rename = "END_SKILL")]
|
||||
EndOnly, // Skip Anim Skip
|
||||
#[serde(rename = "POST_SKILL")]
|
||||
PostOnly, // Skip Skip Anim
|
||||
}
|
||||
|
||||
impl ResolutionStages {
|
||||
fn delay(self) -> i64 {
|
||||
let source_duration = 1000; // Time for SOURCE ONLY
|
||||
let target_delay = 500; // Used for Source + Target
|
||||
let target_duration = 1500; // Time for TARGET ONLY
|
||||
let post_skill = 1000; // Time for all POST
|
||||
let source_and_target_total = target_delay + target_duration; // SOURCE + TARGET time
|
||||
|
||||
match self {
|
||||
ResolutionStages::AllStages => source_and_target_total + post_skill, // Anim Anim Anim
|
||||
ResolutionStages::StartEnd => source_and_target_total, // Anim Anim Skip
|
||||
ResolutionStages::StartPost => source_duration + post_skill, // Anim Skip Anim
|
||||
ResolutionStages::StartOnly => source_duration, // Anim Skip Skip
|
||||
ResolutionStages::EndPost => target_duration + post_skill, // Skip Anim Anim
|
||||
ResolutionStages::EndOnly => target_duration, // Skip Anim Skip
|
||||
ResolutionStages::PostOnly => post_skill, // Skip Skip Anim
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use game::*;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user