remove logs
This commit is contained in:
parent
a321805f54
commit
7b0fa9ca6c
@ -589,7 +589,7 @@ impl Construct {
|
||||
}
|
||||
|
||||
if self.is_ko() {
|
||||
events.push(Event::Ko { skill });
|
||||
events.push(Event::Ko ());
|
||||
self.effects.clear();
|
||||
}
|
||||
|
||||
@ -667,7 +667,7 @@ impl Construct {
|
||||
};
|
||||
|
||||
if self.is_ko() {
|
||||
events.push(Event::Ko { skill });
|
||||
events.push(Event::Ko ());
|
||||
self.effects.clear();
|
||||
}
|
||||
|
||||
@ -742,7 +742,7 @@ impl Construct {
|
||||
};
|
||||
|
||||
if self.is_ko() {
|
||||
events.push(Event::Ko { skill });
|
||||
events.push(Event::Ko ());
|
||||
self.effects.clear();
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@ pub struct Game {
|
||||
pub phase: Phase,
|
||||
pub stack: Vec<Cast>,
|
||||
pub resolved: Vec<Resolution>,
|
||||
pub log: Vec<String>,
|
||||
pub instance: Option<Uuid>,
|
||||
phase_end: DateTime<Utc>,
|
||||
phase_start: DateTime<Utc>,
|
||||
@ -51,7 +50,6 @@ impl Game {
|
||||
phase: Phase::Start,
|
||||
stack: vec![],
|
||||
resolved: vec![],
|
||||
log: vec![],
|
||||
instance: None,
|
||||
phase_end: Utc::now(),
|
||||
phase_start: Utc::now(),
|
||||
@ -84,11 +82,12 @@ impl Game {
|
||||
|
||||
if player.constructs.iter().all(|c| c.skills.len() == 0) {
|
||||
info!("WARNING: {:?} has no skills and has forfeited {:?}", player.name, self.id);
|
||||
// self.log.push(format!("{:} has forfeited the game", player.name));
|
||||
player.forfeit();
|
||||
}
|
||||
|
||||
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);
|
||||
@ -140,7 +139,7 @@ impl Game {
|
||||
}
|
||||
|
||||
pub fn start(mut self) -> Game {
|
||||
self.log.push("Game starting...".to_string());
|
||||
// self.log.push("Game starting...".to_string());
|
||||
|
||||
// forfeit
|
||||
if self.finished() {
|
||||
@ -179,7 +178,7 @@ impl Game {
|
||||
}
|
||||
}
|
||||
|
||||
self.log.push("<Skill Phase>".to_string());
|
||||
// self.log.push("<Skill Phase>".to_string());
|
||||
|
||||
if ![Phase::Start, Phase::Resolve].contains(&self.phase) {
|
||||
panic!("game not in Resolve or start phase");
|
||||
@ -346,7 +345,7 @@ impl Game {
|
||||
assert!(self.skill_phase_finished());
|
||||
|
||||
self.phase = Phase::Resolve;
|
||||
self.log.push("<Resolve Phase>".to_string());
|
||||
// self.log.push("<Resolve Phase>".to_string());
|
||||
|
||||
self.resolve_skills()
|
||||
}
|
||||
@ -421,13 +420,14 @@ impl Game {
|
||||
// info!("{:} casts ", cast);
|
||||
|
||||
let mut resolutions = resolution_steps(&cast, &mut self);
|
||||
resolutions.reverse();
|
||||
turn_events += resolutions.len();
|
||||
while let Some(resolution) = resolutions.pop() {
|
||||
self.log_resolution(cast.speed, &resolution);
|
||||
// the results go into the resolutions
|
||||
self.resolved.push(resolution);
|
||||
}
|
||||
self.resolved.append(&mut resolutions);
|
||||
|
||||
// while let Some(resolution) = resolutions.pop() {
|
||||
// self.log_resolution(cast.speed, &resolution);
|
||||
// // the results go into the resolutions
|
||||
// self.resolved.push(resolution);
|
||||
// }
|
||||
|
||||
// the cast itself goes into this temp vec
|
||||
// to handle cooldowns
|
||||
@ -479,65 +479,65 @@ impl Game {
|
||||
self
|
||||
}
|
||||
|
||||
fn log_resolution(&mut self, speed: u64, resolution: &Resolution) -> &mut Game {
|
||||
let Resolution { source, target, event, stages: _ } = resolution;
|
||||
match event {
|
||||
Event::Ko { skill: _ }=>
|
||||
self.log.push(format!("{:} KO!", target.name)),
|
||||
// fn log_resolution(&mut self, speed: u64, resolution: &Resolution) -> &mut Game {
|
||||
// let Resolution { source, target, event, stages: _ } = resolution;
|
||||
// match event {
|
||||
// Event::Ko { skill: _ }=>
|
||||
// self.log.push(format!("{:} KO!", target.name)),
|
||||
|
||||
Event::Disable { skill, disable } =>
|
||||
self.log.push(format!("{:} {:?} {:} disabled {:?}",
|
||||
source.name, skill, target.name, disable)),
|
||||
// Event::Disable { skill, disable } =>
|
||||
// self.log.push(format!("{:} {:?} {:} disabled {:?}",
|
||||
// source.name, skill, target.name, disable)),
|
||||
|
||||
Event::Immunity { skill, immunity } =>
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} immune {:?}",
|
||||
speed, source.name, skill, target.name, immunity)),
|
||||
// Event::Immunity { skill, immunity } =>
|
||||
// self.log.push(format!("[{:}] {:} {:?} {:} immune {:?}",
|
||||
// speed, source.name, skill, target.name, immunity)),
|
||||
|
||||
Event::TargetKo { skill } =>
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} - target is KO",
|
||||
speed, source.name, skill, target.name)),
|
||||
// Event::TargetKo { skill } =>
|
||||
// self.log.push(format!("[{:}] {:} {:?} {:} - target is KO",
|
||||
// speed, source.name, skill, target.name)),
|
||||
|
||||
Event::Damage { skill, amount, mitigation, colour: _ } =>
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} {:} ({:} mitigated)",
|
||||
speed, source.name, skill, target.name, amount, mitigation)),
|
||||
// Event::Damage { skill, amount, mitigation, colour: _ } =>
|
||||
// self.log.push(format!("[{:}] {:} {:?} {:} {:} ({:} mitigated)",
|
||||
// speed, source.name, skill, target.name, amount, mitigation)),
|
||||
|
||||
Event::Healing { skill, amount, overhealing } =>
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} {:} healing ({:}OH)",
|
||||
speed, source.name, skill, target.name, amount, overhealing)),
|
||||
// Event::Healing { skill, amount, overhealing } =>
|
||||
// self.log.push(format!("[{:}] {:} {:?} {:} {:} healing ({:}OH)",
|
||||
// speed, source.name, skill, target.name, amount, overhealing)),
|
||||
|
||||
Event::Inversion { skill } =>
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} INVERTED",
|
||||
speed, source.name, skill, target.name)),
|
||||
// Event::Inversion { skill } =>
|
||||
// self.log.push(format!("[{:}] {:} {:?} {:} INVERTED",
|
||||
// speed, source.name, skill, target.name)),
|
||||
|
||||
Event::Reflection { skill } =>
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} REFLECTED",
|
||||
speed, source.name, skill, target.name)),
|
||||
// Event::Reflection { skill } =>
|
||||
// self.log.push(format!("[{:}] {:} {:?} {:} REFLECTED",
|
||||
// speed, source.name, skill, target.name)),
|
||||
|
||||
Event::Effect { skill, effect, duration, construct_effects: _ } =>
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} {:?} {:}T",
|
||||
speed, source.name, skill, target.name, effect, duration)),
|
||||
// Event::Effect { skill, effect, duration, construct_effects: _ } =>
|
||||
// self.log.push(format!("[{:}] {:} {:?} {:} {:?} {:}T",
|
||||
// speed, source.name, skill, target.name, effect, duration)),
|
||||
|
||||
Event::Skill { skill } =>
|
||||
self.log.push(format!("[{:}] {:} {:?} {:}",
|
||||
speed, source.name, skill, target.name)),
|
||||
// Event::Skill { skill } =>
|
||||
// self.log.push(format!("[{:}] {:} {:?} {:}",
|
||||
// speed, source.name, skill, target.name)),
|
||||
|
||||
Event::Removal { effect, construct_effects: _ } =>
|
||||
self.log.push(format!("[{:}] {:?} removed {:} {:?}",
|
||||
speed, source.name, target.name, effect)),
|
||||
// Event::Removal { effect, construct_effects: _ } =>
|
||||
// self.log.push(format!("[{:}] {:?} removed {:} {:?}",
|
||||
// speed, source.name, target.name, effect)),
|
||||
|
||||
Event::Recharge { skill, red, blue } =>
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} {:}R {:}B",
|
||||
speed, source.name, skill, target.name, red, blue)),
|
||||
// Event::Recharge { skill, red, blue } =>
|
||||
// self.log.push(format!("[{:}] {:} {:?} {:} {:}R {:}B",
|
||||
// speed, source.name, skill, target.name, red, blue)),
|
||||
|
||||
Event::Evasion { skill, evasion_rating } =>
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} evaded ({:}%)",
|
||||
speed, source.name, skill, target.name, evasion_rating)),
|
||||
// Event::Evasion { skill, evasion_rating } =>
|
||||
// self.log.push(format!("[{:}] {:} {:?} {:} evaded ({:}%)",
|
||||
// speed, source.name, skill, target.name, evasion_rating)),
|
||||
|
||||
Event::Incomplete => panic!("incomplete resolution {:?}", resolution),
|
||||
}
|
||||
// Event::Incomplete => panic!("incomplete resolution {:?}", resolution),
|
||||
// }
|
||||
|
||||
self
|
||||
}
|
||||
// self
|
||||
// }
|
||||
|
||||
pub fn finished(&self) -> bool {
|
||||
self.players.iter().any(|t| t.constructs.iter().all(|c| c.is_ko()))
|
||||
@ -549,15 +549,15 @@ impl Game {
|
||||
|
||||
fn finish(mut self) -> Game {
|
||||
self.phase = Phase::Finish;
|
||||
self.log.push(format!("Game finished."));
|
||||
// self.log.push(format!("Game finished."));
|
||||
|
||||
{
|
||||
let winner = self.players.iter().find(|t| t.constructs.iter().any(|c| !c.is_ko()));
|
||||
match winner {
|
||||
Some(w) => self.log.push(format!("Winner: {:}", w.name)),
|
||||
None => self.log.push(format!("Game was drawn.")),
|
||||
};
|
||||
}
|
||||
// {
|
||||
// let winner = self.players.iter().find(|t| t.constructs.iter().any(|c| !c.is_ko()));
|
||||
// match winner {
|
||||
// Some(w) => self.log.push(format!("Winner: {:}", w.name)),
|
||||
// None => self.log.push(format!("Game was drawn.")),
|
||||
// };
|
||||
// }
|
||||
|
||||
self
|
||||
}
|
||||
@ -585,7 +585,7 @@ impl Game {
|
||||
if player.warnings >= 3 {
|
||||
player.forfeit();
|
||||
info!("upkeep: {:} forfeited", player.name);
|
||||
self.log.push(format!("{:} forfeited.", player.name));
|
||||
// self.log.push(format!("{:} forfeited.", player.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -461,7 +461,8 @@ pub enum Event {
|
||||
Removal { effect: Effect, construct_effects: Vec<ConstructEffect> },
|
||||
TargetKo { skill: Skill },
|
||||
// skill not necessary but makes it neater as all events are arrays in js
|
||||
Ko { skill: Skill },
|
||||
Ko (),
|
||||
Forfeit (),
|
||||
Incomplete,
|
||||
// not used
|
||||
Evasion { skill: Skill, evasion_rating: u64 },
|
||||
@ -1552,7 +1553,7 @@ fn strangle_tick(source: &mut Construct, target: &mut Construct, mut results: Re
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::EndPost)));
|
||||
|
||||
// remove immunity if target ko
|
||||
if target.is_ko() {
|
||||
if target.is_ko() && !source.is_ko() {
|
||||
let i = source.effects
|
||||
.iter()
|
||||
.position(|e| e.effect == Effect::Strangling)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user