fix logs for immunity and make bots target smarter
This commit is contained in:
parent
5b0bcd5e3e
commit
40caa6ab37
@ -303,15 +303,26 @@ impl Game {
|
||||
let mobs = self.team_by_id(mob_team_id).clone();
|
||||
|
||||
// TODO attack multiple players based on some criteria
|
||||
for incoming_skill_id in self.stack.clone().iter()
|
||||
for (i, incoming_skill_id) in self.stack.clone().iter()
|
||||
.filter(|s| s.target_cryp_id.is_none() && s.target_team_id == mob_team_id)
|
||||
.map(|s| s.id) {
|
||||
let target_id = match mobs.cryps.iter().find(|c| {
|
||||
self.cryp_targetable(mob_team_id, c.id).is_ok()})
|
||||
{
|
||||
Some(c) => c.id,
|
||||
None => panic!("could not find a targetable pve cryp"),
|
||||
};
|
||||
.enumerate()
|
||||
.map(|(i, s)| (i, s.id)) {
|
||||
// let target_id = match mobs.cryps.iter().find(|c| {
|
||||
// self.cryp_targetable(mob_team_id, c.id).is_ok()})
|
||||
// {
|
||||
// Some(c) => c.id,
|
||||
// None => panic!("could not find a targetable pve cryp"),
|
||||
// };
|
||||
let targets = mobs.cryps
|
||||
.iter()
|
||||
.filter(|c| self.cryp_targetable(mob_team_id, c.id).is_ok())
|
||||
.collect::<Vec<&Cryp>>();
|
||||
|
||||
if targets.len() == 0 {
|
||||
panic!("could not find a targetable pve cryp");
|
||||
}
|
||||
|
||||
let target_id = targets[i % targets.len()].id;
|
||||
self.add_target(mob_team_id, target_id, incoming_skill_id).unwrap();
|
||||
}
|
||||
}
|
||||
@ -418,17 +429,29 @@ 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));
|
||||
ResolutionResult::Damage { amount, category: _, immunity } => {
|
||||
match immunity.immune {
|
||||
true => self.log.push(format!("{:} {:?} {:} immune {:?}", source.name, cast.skill, target.name, immunity.effects)),
|
||||
false => 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));
|
||||
ResolutionResult::Healing { amount, category: _, immunity } => {
|
||||
match immunity.immune {
|
||||
true => self.log.push(format!("{:} {:?} {:} immune {:?}", source.name, cast.skill, target.name, immunity.effects)),
|
||||
false => 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));
|
||||
ResolutionResult::Effect { effect, duration, immunity } => {
|
||||
match immunity.immune {
|
||||
true => self.log.push(format!("{:} {:?} {:} immune {:?}", source.name, cast.skill, target.name, immunity.effects)),
|
||||
false => 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));
|
||||
ResolutionResult::Removal { effect, immunity } => {
|
||||
match immunity.immune {
|
||||
true => self.log.push(format!("{:} {:?} {:} immune {:?}", source.name, cast.skill, target.name, immunity.effects)),
|
||||
false => self.log.push(format!("{:?} removed {:} {:?}", source.name, target.name, effect)),
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user