disabled log

This commit is contained in:
ntr 2019-05-28 22:46:31 +10:00
parent 7c9dacd5be
commit ad00059f74
2 changed files with 5 additions and 5 deletions

View File

@ -46,12 +46,8 @@
* eth adapter * eth adapter
* pay for rerolls * pay for rerolls
* disabled skills set before skill phase
so client can display
* remove test variants of skills * remove test variants of skills
## SOON ## SOON
* push events * push events

View File

@ -38,6 +38,7 @@ pub struct Game {
pub log: Vec<String>, pub log: Vec<String>,
pub instance: Option<Uuid>, pub instance: Option<Uuid>,
phase_end: DateTime<Utc>, phase_end: DateTime<Utc>,
phase_start: DateTime<Utc>,
} }
impl Game { impl Game {
@ -53,6 +54,7 @@ impl Game {
log: vec![], log: vec![],
instance: None, instance: None,
phase_end: Utc::now(), phase_end: Utc::now(),
phase_start: Utc::now(),
}; };
} }
@ -92,6 +94,7 @@ impl Game {
let player_description = player.constructs.iter().map(|c| c.name.clone()).collect::<Vec<String>>().join(", "); let player_description = player.constructs.iter().map(|c| c.name.clone()).collect::<Vec<String>>().join(", ");
self.log.push(format!("{:} has joined the game. [{:}]", player.name, player_description)); self.log.push(format!("{:} has joined the game. [{:}]", player.name, player_description));
player.constructs.sort_unstable_by_key(|c| c.id);
self.players.push(player); self.players.push(player);
Ok(self) Ok(self)
@ -163,6 +166,7 @@ impl Game {
} }
fn skill_phase_start(mut self) -> Game { fn skill_phase_start(mut self) -> Game {
self.phase_start = Utc::now();
self.phase_end = Utc::now() self.phase_end = Utc::now()
.checked_add_signed(Duration::seconds(60)) .checked_add_signed(Duration::seconds(60))
.expect("could not set phase end"); .expect("could not set phase end");
@ -177,7 +181,7 @@ impl Game {
for construct in player.constructs.iter_mut() { for construct in player.constructs.iter_mut() {
for i in 0..construct.skills.len() { for i in 0..construct.skills.len() {
if let Some(d) = construct.disabled(construct.skills[i].skill) { if let Some(d) = construct.disabled(construct.skills[i].skill) {
info!("{:?} disabled {:?}", construct.skills[i].skill, d); // info!("{:?} disabled {:?}", construct.skills[i].skill, d);
construct.skills[i].disabled = true; construct.skills[i].disabled = true;
} else { } else {
construct.skills[i].disabled = false; construct.skills[i].disabled = false;