cleaner printing in log
This commit is contained in:
parent
7520d85c67
commit
528ca88228
@ -210,7 +210,6 @@ class CombatSkills extends Phaser.Scene {
|
||||
}
|
||||
|
||||
crypName.select();
|
||||
console.log(crypName);
|
||||
this.activeName = crypName;
|
||||
|
||||
skillButtons.forEach((button, j) => {
|
||||
|
||||
@ -35,7 +35,7 @@ impl Team {
|
||||
.filter(|c| !c.is_ko())
|
||||
.filter(|c| c.available_skills().len() > 0)
|
||||
.collect::<Vec<&Cryp>>().len();
|
||||
// println!("{:?} requires {:?} skills this turn", self.id, required);
|
||||
// println!("{:} requires {:} skills this turn", self.id, required);
|
||||
return required;
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ impl Game {
|
||||
}
|
||||
|
||||
let team_description = team.cryps.iter().map(|c| c.name.clone()).collect::<Vec<String>>().join(", ");
|
||||
self.log.push(format!("{:?} has joined the game.", team_description));
|
||||
self.log.push(format!("{:} has joined the game.", team_description));
|
||||
|
||||
self.teams.push(team);
|
||||
|
||||
@ -126,7 +126,7 @@ impl Game {
|
||||
fn team_by_id(&mut self, id: Uuid) -> &mut Team {
|
||||
match self.teams.iter_mut().find(|t| t.id == id) {
|
||||
Some(t) => t,
|
||||
None => panic!("id not in game {:?}", id),
|
||||
None => panic!("id not in game {:}", id),
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ impl Game {
|
||||
let active_cryps = active_cryps as u32 as f64;
|
||||
let max_targets = (incoming / active_cryps).ceil();
|
||||
|
||||
println!("targets {:?} / {:?} = {:?}", incoming, active_cryps, max_targets);
|
||||
println!("targets {:} / {:} = {:}", incoming, active_cryps, max_targets);
|
||||
|
||||
let targeted = self.stack.iter()
|
||||
.filter(|s| s.target_cryp_id.is_some())
|
||||
@ -357,7 +357,7 @@ impl Game {
|
||||
.count();
|
||||
|
||||
if targeted >= max_targets as usize {
|
||||
return Err(format_err!("cryp target of maximum number of skills ({:?})", max_targets));
|
||||
return Err(format_err!("cryp target of maximum number of skills ({:})", max_targets));
|
||||
}
|
||||
|
||||
return Ok(());
|
||||
@ -409,7 +409,7 @@ impl Game {
|
||||
fn log_resolution(&mut self, source: &Cryp, target: &Cryp, cast: &Cast) -> &mut Game {
|
||||
match cast.resolution.disable.disabled {
|
||||
true => {
|
||||
self.log.push(format!("{:?} {:?} {:?} disabled [{:?}]", source.name, cast.skill, target.name, cast.resolution.disable.effects));
|
||||
self.log.push(format!("{:} {:?} {:} disabled {:?}", source.name, cast.skill, target.name, cast.resolution.disable.effects));
|
||||
return self;
|
||||
},
|
||||
false => (),
|
||||
@ -418,16 +418,16 @@ impl Game {
|
||||
for result in cast.resolution.results.iter() {
|
||||
match result {
|
||||
ResolutionResult::Damage { amount, category: _, immunity: _ } => {
|
||||
self.log.push(format!("{:?} {:?} {:?} {:?}", source.name, cast.skill, target.name, amount));
|
||||
self.log.push(format!("{:} {:?} {:} {:}", source.name, cast.skill, target.name, amount));
|
||||
},
|
||||
ResolutionResult::Healing { amount, category: _, immunity: _ } => {
|
||||
self.log.push(format!("{:?} {:?} {:?} {:?}", source.name, cast.skill, target.name, amount));
|
||||
self.log.push(format!("{:} {:?} {:} {:}", source.name, cast.skill, target.name, amount));
|
||||
},
|
||||
ResolutionResult::Effect { effect, duration, immunity: _ } => {
|
||||
self.log.push(format!("{:?} {:?} {:?} {:?} {:?}T", source.name, cast.skill, target.name, effect, duration));
|
||||
self.log.push(format!("{:} {:?} {:} {:?} {:}T", source.name, cast.skill, target.name, effect, duration));
|
||||
},
|
||||
ResolutionResult::Removal { effect, immunity: _ } => {
|
||||
self.log.push(format!("{:?} removed {:?} {:?}", source.name, target.name, effect));
|
||||
self.log.push(format!("{:?} removed {:} {:?}", source.name, target.name, effect));
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -458,7 +458,7 @@ impl Game {
|
||||
|
||||
// update the stack with the resolved skills
|
||||
self.stack = self.stack.clone().iter_mut().map(|skill| {
|
||||
// println!("{:?} resolving ", skill);
|
||||
// println!("{:} resolving ", skill);
|
||||
let mut source = self.cryp_by_id(skill.source_cryp_id).unwrap().clone();
|
||||
let mut target = self.cryp_by_id(skill.target_cryp_id.unwrap()).unwrap().clone();
|
||||
|
||||
@ -471,7 +471,7 @@ impl Game {
|
||||
vec![&mut source, &mut target].iter_mut()
|
||||
.for_each(|c| {
|
||||
if c.is_ko() {
|
||||
self.log.push(format!("{:?} KO", c.name));
|
||||
self.log.push(format!("{:} KO", c.name));
|
||||
c.effects.clear();
|
||||
}
|
||||
});
|
||||
@ -495,7 +495,7 @@ impl Game {
|
||||
|
||||
fn progress_durations(&mut self) -> &mut Game {
|
||||
for mut cryp in self.all_cryps() {
|
||||
// println!("progressing durations for {:?}", cryp.name);
|
||||
// println!("progressing durations for {:}", cryp.name);
|
||||
|
||||
if cryp.is_ko() {
|
||||
continue;
|
||||
@ -534,7 +534,7 @@ impl Game {
|
||||
{
|
||||
let winner = self.teams.iter().find(|t| t.cryps.iter().any(|c| !c.is_ko()));
|
||||
match winner {
|
||||
Some(w) => self.log.push(format!("Winner: {:?}", w.id)),
|
||||
Some(w) => self.log.push(format!("Winner: {:}", w.id)),
|
||||
None => self.log.push(format!("Game was drawn.")),
|
||||
};
|
||||
}
|
||||
@ -623,7 +623,7 @@ pub fn game_new(game: &Game, tx: &mut Transaction) -> Result<(), Error> {
|
||||
|
||||
result.iter().next().ok_or(format_err!("no game written"))?;
|
||||
|
||||
println!("{:?} wrote game", game.id);
|
||||
println!("{:} wrote game", game.id);
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
@ -669,7 +669,7 @@ pub fn players_write(account: &Account, game_id: Uuid, tx: &mut Transaction) ->
|
||||
|
||||
let _returned = result.iter().next().expect("no row written");
|
||||
|
||||
println!("wrote player {:?} joined game: {:?}", account.name, game_id);
|
||||
println!("wrote player {:} joined game: {:}", account.name, game_id);
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
@ -689,7 +689,7 @@ pub fn game_update(game: &Game, tx: &mut Transaction) -> Result<(), Error> {
|
||||
|
||||
result.iter().next().ok_or(format_err!("game {:?} could not be written", game))?;
|
||||
|
||||
println!("{:?} wrote game", game.id);
|
||||
println!("{:} wrote game", game.id);
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
@ -801,7 +801,7 @@ pub fn game_join(params: GameJoinParams, tx: &mut Transaction, account: &Account
|
||||
.collect::<Result<Vec<Cryp>, Error>>()?;
|
||||
|
||||
if cryps.len() != game.team_size {
|
||||
return Err(format_err!("incorrect team size. ({:?})", game.team_size));
|
||||
return Err(format_err!("incorrect team size. ({:})", game.team_size));
|
||||
}
|
||||
|
||||
let mut team = Team::new(account.id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user