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 {
|
pub fn skill_set_cd(&mut self, skill: Skill) -> &mut Construct {
|
||||||
|
// println!("{:?} {:?} skill cooldown set", self.name, skill);
|
||||||
|
|
||||||
// tests force resolve some skills
|
// tests force resolve some skills
|
||||||
// which cause the game to attempt to put them on cd
|
// which cause the game to attempt to put them on cd
|
||||||
// even though the construct doesn't know the skill
|
// even though the construct doesn't know the skill
|
||||||
if let Some(i) = self.skills.iter().position(|s| s.skill == skill) {
|
if let Some(i) = self.skills.iter().position(|s| s.skill == skill) {
|
||||||
self.skills.remove(i);
|
self.skills.remove(i);
|
||||||
self.skills.push(ConstructSkill::new(skill));
|
self.skills.insert(i, ConstructSkill::new(skill));
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
self
|
||||||
|
|||||||
@ -508,14 +508,14 @@ impl Game {
|
|||||||
self.resolve(Cast { skill, ..cast });
|
self.resolve(Cast { skill, ..cast });
|
||||||
}
|
}
|
||||||
|
|
||||||
// for aoe events send the source / target animations before each set of casts
|
if cast.skill.cast_animation() {
|
||||||
|
self.action(cast, Action::Cast);
|
||||||
|
}
|
||||||
|
|
||||||
if cast.skill.aoe() {
|
if cast.skill.aoe() {
|
||||||
if cast.skill.cast_animation() {
|
self.action(cast, Action::HitAoe);
|
||||||
let event = self.cast(cast);
|
} else {
|
||||||
self.add_resolution(&cast, &event);
|
self.action(cast, Action::Hit);
|
||||||
}
|
|
||||||
let event = self.hit_aoe(cast);
|
|
||||||
self.add_resolution(&cast, &event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let casts = self.modify_cast(cast);
|
let casts = self.modify_cast(cast);
|
||||||
@ -559,6 +559,7 @@ impl Game {
|
|||||||
let new_events = match action {
|
let new_events = match action {
|
||||||
Action::Cast => vec![self.cast(cast)],
|
Action::Cast => vec![self.cast(cast)],
|
||||||
Action::Hit => vec![self.hit(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::Damage { construct, amount, colour } => self.damage(construct, amount, colour),
|
||||||
Action::Heal { construct, amount, colour } => self.heal(construct, amount, colour),
|
Action::Heal { construct, amount, colour } => self.heal(construct, amount, colour),
|
||||||
@ -848,6 +849,7 @@ 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, amount: usize, colour: Colour },
|
Heal { construct: Uuid, amount: usize, colour: Colour },
|
||||||
Damage { construct: Uuid, amount: usize, colour: Colour },
|
Damage { construct: Uuid, amount: usize, colour: Colour },
|
||||||
@ -1033,6 +1035,7 @@ mod tests {
|
|||||||
.learn(Skill::Siphon)
|
.learn(Skill::Siphon)
|
||||||
.learn(Skill::Amplify)
|
.learn(Skill::Amplify)
|
||||||
.learn(Skill::Stun)
|
.learn(Skill::Stun)
|
||||||
|
.learn(Skill::Ruin)
|
||||||
.learn(Skill::Block)
|
.learn(Skill::Block)
|
||||||
.learn(Skill::Sleep)
|
.learn(Skill::Sleep)
|
||||||
.learn(Skill::Decay);
|
.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());
|
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)]
|
// #[cfg(test)]
|
||||||
// mod tests {
|
// mod tests {
|
||||||
// use skill::*;
|
// 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]
|
// #[test]
|
||||||
// fn counter_test() {
|
// fn counter_test() {
|
||||||
// let mut game = create_test_game();
|
// let mut game = create_test_game();
|
||||||
|
|||||||
@ -716,7 +716,7 @@ impl Item {
|
|||||||
Item::HealPlusPlus |
|
Item::HealPlusPlus |
|
||||||
Item::Triage |
|
Item::Triage |
|
||||||
Item::TriagePlus |
|
Item::TriagePlus |
|
||||||
Item::TriagePlusPlus |
|
Item::TriagePlusPlus |
|
||||||
Item::Break |
|
Item::Break |
|
||||||
Item::BreakPlus |
|
Item::BreakPlus |
|
||||||
Item::BreakPlusPlus |
|
Item::BreakPlusPlus |
|
||||||
@ -735,7 +735,7 @@ impl Item {
|
|||||||
Item::Invert |
|
Item::Invert |
|
||||||
Item::InvertPlus |
|
Item::InvertPlus |
|
||||||
Item::InvertPlusPlus |
|
Item::InvertPlusPlus |
|
||||||
Item::Decay |
|
Item::Decay |
|
||||||
Item::DecayPlus |
|
Item::DecayPlus |
|
||||||
Item::DecayPlusPlus |
|
Item::DecayPlusPlus |
|
||||||
Item::Siphon|
|
Item::Siphon|
|
||||||
@ -817,7 +817,7 @@ impl Item {
|
|||||||
|
|
||||||
Item::AmplifyPlus => vec![Item::Amplify, Item::Amplify],
|
Item::AmplifyPlus => vec![Item::Amplify, Item::Amplify],
|
||||||
Item::AmplifyPlusPlus => vec![Item::AmplifyPlus, Item::AmplifyPlus],
|
Item::AmplifyPlusPlus => vec![Item::AmplifyPlus, Item::AmplifyPlus],
|
||||||
|
|
||||||
Item::HastePlus => vec![Item::Haste, Item::Haste],
|
Item::HastePlus => vec![Item::Haste, Item::Haste],
|
||||||
Item::HastePlusPlus => vec![Item::HastePlus, Item::HastePlus],
|
Item::HastePlusPlus => vec![Item::HastePlus, Item::HastePlus],
|
||||||
|
|
||||||
@ -832,9 +832,9 @@ impl Item {
|
|||||||
Item::Curse => vec![Item::Debuff, Item::Red, Item::Blue],
|
Item::Curse => vec![Item::Debuff, Item::Red, Item::Blue],
|
||||||
Item::Decay => vec![Item::Debuff, Item::Green, Item::Blue],
|
Item::Decay => vec![Item::Debuff, Item::Green, Item::Blue],
|
||||||
|
|
||||||
Item::PurgePlus => vec![Item::Purge, Item::Purge],
|
Item::PurgePlus => vec![Item::Purge, Item::Purge],
|
||||||
Item::PurgePlusPlus => vec![Item::PurgePlus, Item::PurgePlus],
|
Item::PurgePlusPlus => vec![Item::PurgePlus, Item::PurgePlus],
|
||||||
|
|
||||||
Item::InvertPlus => vec![Item::Invert, Item::Invert],
|
Item::InvertPlus => vec![Item::Invert, Item::Invert],
|
||||||
Item::InvertPlusPlus => vec![Item::InvertPlus, Item::InvertPlus],
|
Item::InvertPlusPlus => vec![Item::InvertPlus, Item::InvertPlus],
|
||||||
|
|
||||||
@ -843,10 +843,10 @@ impl Item {
|
|||||||
|
|
||||||
Item::SilencePlus => vec![Item::Silence, Item::Silence],
|
Item::SilencePlus => vec![Item::Silence, Item::Silence],
|
||||||
Item::SilencePlusPlus => vec![Item::SilencePlus, Item::SilencePlus],
|
Item::SilencePlusPlus => vec![Item::SilencePlus, Item::SilencePlus],
|
||||||
|
|
||||||
Item::CursePlus => vec![Item::Curse, Item::Curse],
|
Item::CursePlus => vec![Item::Curse, Item::Curse],
|
||||||
Item::CursePlusPlus => vec![Item::CursePlus, Item::CursePlus],
|
Item::CursePlusPlus => vec![Item::CursePlus, Item::CursePlus],
|
||||||
|
|
||||||
Item::DecayPlus => vec![Item::Decay, Item::Decay],
|
Item::DecayPlus => vec![Item::Decay, Item::Decay],
|
||||||
Item::DecayPlusPlus => vec![Item::DecayPlus, Item::DecayPlus],
|
Item::DecayPlusPlus => vec![Item::DecayPlus, Item::DecayPlus],
|
||||||
|
|
||||||
@ -1427,20 +1427,13 @@ mod tests {
|
|||||||
assert_eq!(Item::StrikePlus.components(), vec![
|
assert_eq!(Item::StrikePlus.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,
|
|
||||||
]);
|
]);
|
||||||
assert_eq!(Item::StrikePlusPlus.components(), vec![
|
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,
|
||||||
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) {
|
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 {
|
match self.skill {
|
||||||
Skill::Attack => attack(self, game, Attack::Base),
|
Skill::Attack => attack(self, game, Attack::Base),
|
||||||
Skill::Block => block(self, game, Block::Base),
|
Skill::Block => block(self, game, Block::Base),
|
||||||
|
|||||||
@ -25,6 +25,7 @@ dotenv = "0.9.0"
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
fern = { version = "0.5", features = ["colored", "syslog-4"] }
|
fern = { version = "0.5", features = ["colored", "syslog-4"] }
|
||||||
syslog = "4"
|
syslog = "4"
|
||||||
|
log-panics = "2"
|
||||||
|
|
||||||
iron = "0.6"
|
iron = "0.6"
|
||||||
bodyparser = "0.8"
|
bodyparser = "0.8"
|
||||||
|
|||||||
@ -15,6 +15,7 @@ extern crate serde_cbor;
|
|||||||
#[macro_use] extern crate failure;
|
#[macro_use] extern crate failure;
|
||||||
|
|
||||||
extern crate fern;
|
extern crate fern;
|
||||||
|
extern crate log_panics;
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
|
|
||||||
extern crate stripe;
|
extern crate stripe;
|
||||||
@ -55,6 +56,8 @@ use crossbeam_channel::{unbounded};
|
|||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub fn setup_logger() -> Result<(), fern::InitError> {
|
pub fn setup_logger() -> Result<(), fern::InitError> {
|
||||||
|
log_panics::init();
|
||||||
|
|
||||||
let formatter = syslog::Formatter3164 {
|
let formatter = syslog::Formatter3164 {
|
||||||
facility: syslog::Facility::LOG_USER,
|
facility: syslog::Facility::LOG_USER,
|
||||||
hostname: None,
|
hostname: None,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user