autobattler init

This commit is contained in:
Mashy 2020-08-18 16:33:40 +10:00
parent cc8ffc946e
commit 9dfd3a733a
2 changed files with 10 additions and 14 deletions

View File

@ -189,9 +189,9 @@ impl Game {
} }
self.pve_add_skills(); self.pve_add_skills();
if self.skill_phase_finished() { // pve game where both bots will have readied up //if self.skill_phase_finished() { // pve game where both bots will have readied up
return self.resolve_phase_start() // return self.resolve_phase_start()
} //}
self self
} }
@ -201,8 +201,7 @@ impl Game {
let mut rng = thread_rng(); let mut rng = thread_rng();
for mobs in self.players for mobs in self.players
.iter() .iter() {
.filter(|t| t.bot) {
let player_player = self.players.iter().find(|t| t.id != mobs.id).unwrap(); let player_player = self.players.iter().find(|t| t.id != mobs.id).unwrap();
for mob in mobs.constructs.iter() { for mob in mobs.constructs.iter() {

View File

@ -55,9 +55,9 @@ impl TimeControl {
fn game_time_seconds(&self) -> i64 { fn game_time_seconds(&self) -> i64 {
match self { match self {
TimeControl::Standard => 60, TimeControl::Standard => 1,
TimeControl::Slow => 120, TimeControl::Slow => 1,
TimeControl::Practice => panic!("practice game seconds called"), TimeControl::Practice => 1,
} }
} }
@ -77,12 +77,9 @@ impl TimeControl {
} }
pub fn game_phase_end(&self, resolution_time_ms: i64) -> Option<DateTime<Utc>> { pub fn game_phase_end(&self, resolution_time_ms: i64) -> Option<DateTime<Utc>> {
match self { Some(Utc::now()
TimeControl::Practice => None,
_ => Some(Utc::now()
.checked_add_signed(Duration::milliseconds(self.game_time_seconds() * 1000 + resolution_time_ms)) .checked_add_signed(Duration::milliseconds(self.game_time_seconds() * 1000 + resolution_time_ms))
.expect("could not set game phase end")), .expect("could not set game phase end"))
}
} }
} }