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

View File

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