diff --git a/core/fixme.md b/core/fixme.md index b7d4f7d4..9cc3cf06 100644 --- a/core/fixme.md +++ b/core/fixme.md @@ -1,7 +1,9 @@ # FIXME + check silence skill multiplier game ready not auto starting resolve phase purify conditional healing set static speed for dot ticks -infinite counter loop \ No newline at end of file +infinite counter loop +cooldowns reduced after 1 complete cast \ No newline at end of file diff --git a/core/src/game.rs b/core/src/game.rs index 152243c0..008564ac 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -442,11 +442,7 @@ impl Game { // because need to check cooldown use before pushing them into the complete list let mut r_animation_ms = 0; while let Some(cast) = self.stack.pop() { - self.events = vec![]; - self.resolve(cast); - - // sort the stack again in case speeds have changed - self.stack_sort_speed(); + self.new_resolve(cast); }; self.progress_durations(); @@ -466,6 +462,15 @@ impl Game { self.skill_phase_start(r_animation_ms) } + fn new_resolve(&mut self, cast: Cast) -> &mut Game { + self.events = vec![]; + self.resolve(cast); + + // sort the stack again in case speeds have changed + self.stack_sort_speed(); + self + } + fn resolve(&mut self, cast: Cast) -> &mut Game { // If the skill is disabled for source nothing else will happen if let Some(effects) = self.construct(cast.source).disabled(cast.skill) { @@ -590,7 +595,7 @@ impl Game { fn add_resolution(&mut self, cast: &Cast, event: &Event) -> &mut Game { let last = self.resolutions.len() - 1; - println!("{:?}", event); + // println!("{:?}", event); self.resolutions[last].push(Resolution::new(cast.clone(), event.clone())); self } @@ -1871,11 +1876,12 @@ mod tests { let source = game.players[0].constructs[0].id; let target = game.players[1].constructs[0].id; - game.resolve(Cast::new(source, player_id, target, Skill::Blast)); - game.resolve(Cast::new(source, player_id, target, Skill::Blast)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Blast)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Blast)); + // Abosrb restores blue life here - game.resolve(Cast::new(source, player_id, target, Skill::Absorb)); - game.resolve(Cast::new(source, player_id, target, Skill::Blast)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Absorb)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Blast)); assert!(match game.players[1].constructs[0].effects[0].meta { Some(EffectMeta::AddedDamage(d)) => d, @@ -1893,9 +1899,9 @@ mod tests { let source = game.players[0].constructs[0].id; let target = game.players[1].constructs[0].id; - game.resolve(Cast::new(source, player_id, source, Skill::Reflect)); - game.resolve(Cast::new(target, target_player_id, target, Skill::Reflect)); - game.resolve(Cast::new(source, player_id, target, Skill::Blast)); + game.new_resolve(Cast::new(source, player_id, source, Skill::Reflect)); + game.new_resolve(Cast::new(target, target_player_id, target, Skill::Reflect)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Blast)); assert!(game.players[0].constructs[0].is_ko() == false); assert!(game.players[1].constructs[0].is_ko() == false); @@ -1911,9 +1917,9 @@ mod tests { let source = game.players[0].constructs[0].id; let target = game.players[1].constructs[0].id; - game.resolve(Cast::new(source, player_id, source, Skill::Counter)); - game.resolve(Cast::new(target, target_player_id, target, Skill::Counter)); - game.resolve(Cast::new(source, player_id, target, Skill::Attack)); + game.new_resolve(Cast::new(source, player_id, source, Skill::Counter)); + game.new_resolve(Cast::new(target, target_player_id, target, Skill::Counter)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Attack)); assert!(game.players[0].constructs[0].is_ko() == false); assert!(game.players[1].constructs[0].is_ko() == false); @@ -1932,11 +1938,11 @@ mod tests { let interceptor = game.players[1].constructs[1].id; // Cast intercept - game.resolve(Cast::new(interceptor, other_player_id, interceptor, Skill::Intercept)); + game.new_resolve(Cast::new(interceptor, other_player_id, interceptor, Skill::Intercept)); // Enemy casts skill on target which as a teammate intercepting - game.resolve(Cast::new(source, player_id, target, Skill::Attack)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Attack)); // Intercepting teammate attacks someone on same team - game.resolve(Cast::new(interceptor, other_player_id, target, Skill::Attack)); + game.new_resolve(Cast::new(interceptor, other_player_id, target, Skill::Attack)); let last = game.resolutions.len() - 1; let resolutions = &game.resolutions[last]; @@ -1963,8 +1969,8 @@ mod tests { let source = game.players[0].constructs[0].id; let target = game.players[1].constructs[0].id; - game.resolve(Cast::new(source, player_id, target, Skill::Decay)); - game.resolve(Cast::new(source, player_id, target, Skill::Siphon)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Decay)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Siphon)); game = game.resolve_phase_start(); @@ -1978,9 +1984,9 @@ mod tests { let source = game.players[0].constructs[0].id; let target = game.players[1].constructs[0].id; - game.resolve(Cast::new(source, player_id, target, Skill::Decay)); - game.resolve(Cast::new(source, player_id, source, Skill::HastePlusPlus)); - game.resolve(Cast::new(source, player_id, target, Skill::Siphon)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Decay)); + game.new_resolve(Cast::new(source, player_id, source, Skill::HastePlusPlus)); + game.new_resolve(Cast::new(source, player_id, target, Skill::Siphon)); game = game.resolve_phase_start();