Merge branch 'release/1.11.0' of ssh://git.mnml.gg:40022/~/mnml into release/1.11.0
This commit is contained in:
commit
8e03564b46
@ -435,12 +435,14 @@ impl Construct {
|
||||
}
|
||||
|
||||
pub fn skill_set_cd(&mut self, skill: Skill) -> &mut Construct {
|
||||
// println!("{:?} {:?} skill cooldown set", self.name, skill);
|
||||
|
||||
// tests force resolve some skills
|
||||
// which cause the game to attempt to put them on cd
|
||||
// even though the construct doesn't know the skill
|
||||
if let Some(i) = self.skills.iter().position(|s| s.skill == skill) {
|
||||
self.skills.remove(i);
|
||||
self.skills.push(ConstructSkill::new(skill));
|
||||
self.skills.insert(i, ConstructSkill::new(skill));
|
||||
}
|
||||
|
||||
self
|
||||
|
||||
@ -508,14 +508,14 @@ impl Game {
|
||||
self.resolve(Cast { skill, ..cast });
|
||||
}
|
||||
|
||||
// for aoe events send the source / target animations before each set of casts
|
||||
if cast.skill.aoe() {
|
||||
if cast.skill.cast_animation() {
|
||||
let event = self.cast(cast);
|
||||
self.add_resolution(&cast, &event);
|
||||
self.action(cast, Action::Cast);
|
||||
}
|
||||
let event = self.hit_aoe(cast);
|
||||
self.add_resolution(&cast, &event);
|
||||
|
||||
if cast.skill.aoe() {
|
||||
self.action(cast, Action::HitAoe);
|
||||
} else {
|
||||
self.action(cast, Action::Hit);
|
||||
}
|
||||
|
||||
let casts = self.modify_cast(cast);
|
||||
@ -559,6 +559,7 @@ impl Game {
|
||||
let new_events = match action {
|
||||
Action::Cast => vec![self.cast(cast)],
|
||||
Action::Hit => vec![self.hit(cast)],
|
||||
Action::HitAoe => vec![self.hit_aoe(cast)],
|
||||
|
||||
Action::Damage { construct, amount, colour } => self.damage(construct, amount, colour),
|
||||
Action::Heal { construct, amount, colour } => self.heal(construct, amount, colour),
|
||||
@ -848,6 +849,7 @@ pub enum Value {
|
||||
#[derive(Debug,Clone,PartialEq)]
|
||||
pub enum Action {
|
||||
Hit,
|
||||
HitAoe,
|
||||
Cast,
|
||||
Heal { construct: Uuid, amount: usize, colour: Colour },
|
||||
Damage { construct: Uuid, amount: usize, colour: Colour },
|
||||
@ -1033,6 +1035,7 @@ mod tests {
|
||||
.learn(Skill::Siphon)
|
||||
.learn(Skill::Amplify)
|
||||
.learn(Skill::Stun)
|
||||
.learn(Skill::Ruin)
|
||||
.learn(Skill::Block)
|
||||
.learn(Skill::Sleep)
|
||||
.learn(Skill::Decay);
|
||||
@ -1251,6 +1254,31 @@ mod tests {
|
||||
assert!(game.player_by_id(y_player.id).unwrap().constructs[0].skill_on_cd(Skill::Block).is_none());
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn ruin_cooldown_test() {
|
||||
let mut game = create_test_game();
|
||||
|
||||
let x_player = game.players[0].clone();
|
||||
let y_player = game.players[1].clone();
|
||||
|
||||
let x_construct = x_player.constructs[0].clone();
|
||||
let y_construct = y_player.constructs[0].clone();
|
||||
|
||||
while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Ruin).is_some() {
|
||||
game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
|
||||
}
|
||||
|
||||
game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Ruin).unwrap();
|
||||
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
game.player_ready(y_player.id).unwrap();
|
||||
|
||||
game = game.resolve_phase_start();
|
||||
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Ruin).is_some());
|
||||
}
|
||||
|
||||
// #[cfg(test)]
|
||||
// mod tests {
|
||||
// use skill::*;
|
||||
@ -1595,55 +1623,6 @@ mod tests {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
#[test]
|
||||
fn sleep_cooldown_test() {
|
||||
let mut game = create_test_game();
|
||||
|
||||
let x_player = game.players[0].clone();
|
||||
let y_player = game.players[1].clone();
|
||||
|
||||
let x_construct = x_player.constructs[0].clone();
|
||||
let y_construct = y_player.constructs[0].clone();
|
||||
|
||||
|
||||
for _n in 1..10 {
|
||||
// should auto progress back to skill phase
|
||||
assert!(game.phase == Phase::Skill);
|
||||
|
||||
// Sleep 2T CD
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Decay).is_none());
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Sleep).is_some());
|
||||
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
game.player_ready(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
|
||||
// Sleep 1T CD
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Decay).is_none());
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Sleep).is_some());
|
||||
|
||||
game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Decay).unwrap();
|
||||
// game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Attack).unwrap();
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
game.player_ready(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
|
||||
// Sleep 0T CD (we use it here)
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Decay).is_none());
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Sleep).is_none());
|
||||
|
||||
game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Sleep).unwrap();
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
game.player_ready(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
|
||||
// Sleep back to 2T CD
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Decay).is_none());
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Sleep).is_some());
|
||||
}
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// fn counter_test() {
|
||||
// let mut game = create_test_game();
|
||||
|
||||
@ -1427,20 +1427,13 @@ mod tests {
|
||||
assert_eq!(Item::StrikePlus.components(), vec![
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
]);
|
||||
assert_eq!(Item::StrikePlusPlus.components(), vec![
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
Item::Red, Item::Red, Item::Attack,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
@ -42,13 +42,6 @@ impl Cast {
|
||||
}
|
||||
|
||||
pub fn resolve(self, game: &mut Game) {
|
||||
if !self.skill.aoe() {
|
||||
if self.skill.cast_animation() {
|
||||
game.action(self, Action::Cast);
|
||||
}
|
||||
game.action(self, Action::Hit);
|
||||
}
|
||||
|
||||
match self.skill {
|
||||
Skill::Attack => attack(self, game, Attack::Base),
|
||||
Skill::Block => block(self, game, Block::Base),
|
||||
|
||||
@ -25,6 +25,7 @@ dotenv = "0.9.0"
|
||||
log = "0.4"
|
||||
fern = { version = "0.5", features = ["colored", "syslog-4"] }
|
||||
syslog = "4"
|
||||
log-panics = "2"
|
||||
|
||||
iron = "0.6"
|
||||
bodyparser = "0.8"
|
||||
|
||||
@ -15,6 +15,7 @@ extern crate serde_cbor;
|
||||
#[macro_use] extern crate failure;
|
||||
|
||||
extern crate fern;
|
||||
extern crate log_panics;
|
||||
#[macro_use] extern crate log;
|
||||
|
||||
extern crate stripe;
|
||||
@ -55,6 +56,8 @@ use crossbeam_channel::{unbounded};
|
||||
|
||||
#[cfg(unix)]
|
||||
pub fn setup_logger() -> Result<(), fern::InitError> {
|
||||
log_panics::init();
|
||||
|
||||
let formatter = syslog::Formatter3164 {
|
||||
facility: syslog::Facility::LOG_USER,
|
||||
hostname: None,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user