Merge branch 'master' of ssh://cryps.gg:40022/~/cryps

This commit is contained in:
ntr
2019-05-08 14:17:21 +10:00
5 changed files with 27 additions and 22 deletions
+7 -3
View File
@@ -510,6 +510,10 @@ impl Game {
self.log.push(format!("[{:}] {:} {:?} {:} {:?} {:}T",
speed, source.name, skill, target.name, effect, duration)),
Event::AoeSkill { skill } =>
self.log.push(format!("[{:}] {:} {:?} {:}",
speed, source.name, skill, target.name)),
Event::Skill { skill } =>
self.log.push(format!("[{:}] {:} {:?} {:}",
speed, source.name, skill, target.name)),
@@ -1125,7 +1129,7 @@ mod tests {
// should auto progress back to skill phase
assert!(game.phase == Phase::Skill);
assert!(game.player_by_id(y_player.id).unwrap().cryps[0].skill_on_cd(Skill::Stun).is_none());
assert!(game.player_by_id(y_player.id).unwrap().cryps[0].skill_on_cd(Skill::Stun).is_some());
// second round
// now we block and it should go back on cd
@@ -1137,7 +1141,7 @@ mod tests {
game = game.resolve_phase_start();
assert!(game.player_by_id(x_player.id).unwrap().cryps[0].skill_on_cd(Skill::Stun).is_some());
assert!(game.player_by_id(x_player.id).unwrap().cryps[0].skill_on_cd(Skill::Stun).is_none());
assert!(game.player_by_id(y_player.id).unwrap().cryps[0].skill_on_cd(Skill::Block).is_none());
}
@@ -1319,7 +1323,7 @@ mod tests {
assert!(*duration == 1);
true
},
Event::Skill { skill } => false,
Event::AoeSkill { skill } => false,
_ => panic!("ruin result not effect {:?}", event),
}
false => false,
+8 -3
View File
@@ -16,9 +16,14 @@ pub fn resolution_steps(cast: &Cast, game: &mut Game) -> Resolutions {
}
pub fn pre_resolve(cast: &Cast, game: &mut Game, mut resolutions: Resolutions) -> Resolutions {
let skill = cast.skill;
let source = game.cryp_by_id(cast.source_cryp_id).unwrap().clone();
let targets = game.get_targets(cast.skill, &source, cast.target_cryp_id);
if skill.aoe() { // Send an aoe skill event for anims
resolutions.push(Resolution::new(&source, &game.cryp_by_id(cast.target_cryp_id).unwrap().clone()).event(Event::AoeSkill { skill }));
}
for target_id in targets {
// we clone the current state of the target and source
// so we can modify them during the resolution
@@ -294,6 +299,7 @@ pub enum Event {
Inversion { skill: Skill },
Reflection { skill: Skill },
Effect { skill: Skill, effect: Effect, duration: u8 },
AoeSkill { skill: Skill },
Skill { skill: Skill },
Removal { effect: Effect },
TargetKo { skill: Skill },
@@ -754,7 +760,7 @@ impl Skill {
Skill::Parry => Some(2), // avoid all damage
Skill::Riposte => None, // used on parry
Skill::Snare => Some(2),
Skill::Stun => Some(1),
Skill::Stun => Some(2),
Skill::Heal => None,
Skill::Triage => None, // hot
Skill::TriageTick => None,
@@ -762,7 +768,7 @@ impl Skill {
Skill::Blast => None,
Skill::Chaos => None,
Skill::Amplify => Some(1),
Skill::Impurity => None,
Skill::Impurity => Some(3),
Skill::ImpureBlast => None,
Skill::Invert => Some(2),
Skill::Decay => Some(1), // dot
@@ -1236,7 +1242,6 @@ fn corruption_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolution
}
fn ruin(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(Resolution::new(source, target).event(Event::Skill { skill }));
let effect = CrypEffect::new(Effect::Ruin, skill.duration());
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
return results;;