fix resolve order bug
This commit is contained in:
parent
e988cc62c1
commit
da57abd1f2
@ -411,16 +411,16 @@ impl Game {
|
|||||||
self.stack_sort_speed();
|
self.stack_sort_speed();
|
||||||
|
|
||||||
// update the stack with the resolved skills
|
// update the stack with the resolved skills
|
||||||
self.stack = self.stack.clone().iter_mut().map(|skill| {
|
for mut skill in self.stack.clone() {
|
||||||
// println!("{:} resolving ", skill);
|
// println!("{:} resolving ", skill);
|
||||||
let mut source = self.cryp_by_id(skill.source_cryp_id).unwrap().clone();
|
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().clone();
|
let mut target = self.cryp_by_id(skill.target_cryp_id).unwrap().clone();
|
||||||
|
|
||||||
skill.set_resolution(&mut source, &mut target);
|
skill.set_resolution(&mut source, &mut target);
|
||||||
|
|
||||||
self.log_resolution(&mut source, &mut target, skill);
|
self.log_resolution(&mut source, &mut target, &skill);
|
||||||
|
|
||||||
self.resolved.push(skill.clone());
|
self.resolved.push(skill);
|
||||||
|
|
||||||
if target.is_ko() && !target.ko_logged {
|
if target.is_ko() && !target.ko_logged {
|
||||||
self.log.push(format!("{:} KO", target.name));
|
self.log.push(format!("{:} KO", target.name));
|
||||||
@ -441,9 +441,9 @@ impl Game {
|
|||||||
// resort the stack after each cast because
|
// resort the stack after each cast because
|
||||||
// the cryp speed may have changed
|
// the cryp speed may have changed
|
||||||
// self.stack_sort_speed();
|
// self.stack_sort_speed();
|
||||||
|
};
|
||||||
|
|
||||||
return skill.clone();
|
// println!("{:#?}", self.resolved);
|
||||||
}).collect::<Vec<Cast>>();
|
|
||||||
|
|
||||||
// now Resolve has all been assigned
|
// now Resolve has all been assigned
|
||||||
// handle cooldowns and statuses
|
// handle cooldowns and statuses
|
||||||
|
|||||||
@ -653,13 +653,13 @@ impl Skill {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resolve(&self, cryp: &mut Cryp, target: &mut Cryp) -> Resolution {
|
pub fn resolve(&self, source: &mut Cryp, target: &mut Cryp) -> Resolution {
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
let _base: u64 = rng.gen();
|
let _base: u64 = rng.gen();
|
||||||
|
|
||||||
let speed = target.skill_speed(*self);
|
let speed = source.skill_speed(*self);
|
||||||
|
|
||||||
let resolution = Resolution { skill: *self, results: vec![], disable: cryp.disabled(*self), speed };
|
let resolution = Resolution { skill: *self, results: vec![], disable: source.disabled(*self), speed };
|
||||||
|
|
||||||
if target.is_ko() {
|
if target.is_ko() {
|
||||||
return resolution;
|
return resolution;
|
||||||
@ -670,20 +670,20 @@ impl Skill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
Skill::Attack => attack(cryp, target, resolution),
|
Skill::Attack => attack(source, target, resolution),
|
||||||
// -----------------
|
// -----------------
|
||||||
// Nature
|
// Nature
|
||||||
// -----------------
|
// -----------------
|
||||||
Skill::Block => block(cryp, target, resolution),
|
Skill::Block => block(source, target, resolution),
|
||||||
Skill::Parry => parry(cryp, target, resolution),
|
Skill::Parry => parry(source, target, resolution),
|
||||||
Skill::Evade => evade(cryp, target, resolution),
|
Skill::Evade => evade(source, target, resolution),
|
||||||
Skill::Snare => snare(cryp, target, resolution), // TODO prevent physical moves
|
Skill::Snare => snare(source, target, resolution), // TODO prevent physical moves
|
||||||
|
|
||||||
Skill::Paralyse => panic!("nyi"), // no physical moves
|
Skill::Paralyse => panic!("nyi"), // no physical moves
|
||||||
Skill::Strangle => panic!("nyi"), // no physical moves
|
Skill::Strangle => panic!("nyi"), // no physical moves
|
||||||
|
|
||||||
Skill::Stun => stun(cryp, target, resolution),
|
Skill::Stun => stun(source, target, resolution),
|
||||||
Skill::Evasion => evade(cryp, target, resolution), // additional layer of dmg avoidance
|
Skill::Evasion => evade(source, target, resolution), // additional layer of dmg avoidance
|
||||||
|
|
||||||
// -----------------
|
// -----------------
|
||||||
// Technology
|
// Technology
|
||||||
@ -697,10 +697,10 @@ impl Skill {
|
|||||||
// -----------------
|
// -----------------
|
||||||
// Preservation
|
// Preservation
|
||||||
// -----------------
|
// -----------------
|
||||||
Skill::Heal => heal(cryp, target, resolution),
|
Skill::Heal => heal(source, target, resolution),
|
||||||
Skill::Triage => triage(cryp, target, resolution), // hot
|
Skill::Triage => triage(source, target, resolution), // hot
|
||||||
Skill::TriageTick => triage_tick(cryp, target, resolution), // hot
|
Skill::TriageTick => triage_tick(source, target, resolution), // hot
|
||||||
Skill::Throw => throw(cryp, target, resolution), // no dmg stun, adds vulnerable
|
Skill::Throw => throw(source, target, resolution), // no dmg stun, adds vulnerable
|
||||||
Skill::Charm => panic!("nyi"), // target casts random spell on teammate
|
Skill::Charm => panic!("nyi"), // target casts random spell on teammate
|
||||||
Skill::Calm => panic!("nyi"), // physical fear, taunt removal
|
Skill::Calm => panic!("nyi"), // physical fear, taunt removal
|
||||||
Skill::Rez => panic!("nyi"),
|
Skill::Rez => panic!("nyi"),
|
||||||
@ -708,13 +708,13 @@ impl Skill {
|
|||||||
// -----------------
|
// -----------------
|
||||||
// Destruction
|
// Destruction
|
||||||
// -----------------
|
// -----------------
|
||||||
Skill::Blast => blast(cryp, target, resolution),
|
Skill::Blast => blast(source, target, resolution),
|
||||||
Skill::Amplify => amplify(cryp, target, resolution), // increase magic dmg
|
Skill::Amplify => amplify(source, target, resolution), // increase magic dmg
|
||||||
Skill::Decay => decay(cryp, target, resolution), // dot
|
Skill::Decay => decay(source, target, resolution), // dot
|
||||||
Skill::DecayTick => decay_tick(cryp, target, resolution), // dot
|
Skill::DecayTick => decay_tick(source, target, resolution), // dot
|
||||||
Skill::Drain => drain(cryp, target, resolution),
|
Skill::Drain => drain(source, target, resolution),
|
||||||
Skill::DrainTick => drain_tick(cryp, target, resolution), // hot
|
Skill::DrainTick => drain_tick(source, target, resolution), // hot
|
||||||
Skill::Curse => curse(cryp, target, resolution),
|
Skill::Curse => curse(source, target, resolution),
|
||||||
Skill::Plague => panic!("nyi"), // dot that spreads every turn
|
Skill::Plague => panic!("nyi"), // dot that spreads every turn
|
||||||
Skill::Ruin => panic!("nyi"), // aoe version of blast
|
Skill::Ruin => panic!("nyi"), // aoe version of blast
|
||||||
|
|
||||||
@ -722,19 +722,19 @@ impl Skill {
|
|||||||
// Purity
|
// Purity
|
||||||
// -----------------
|
// -----------------
|
||||||
// Skill::Precision => panic!("nyi"),
|
// Skill::Precision => panic!("nyi"),
|
||||||
Skill::Empower => empower(cryp, target, resolution), // increased phys dmg
|
Skill::Empower => empower(source, target, resolution), // increased phys dmg
|
||||||
Skill::Slay => panic!("nyi"), // phys dmg mult by target magic dmg
|
Skill::Slay => panic!("nyi"), // phys dmg mult by target magic dmg
|
||||||
Skill::Shield => shield(cryp, target, resolution), // target is immune to magic dmg and fx
|
Skill::Shield => shield(source, target, resolution), // target is immune to magic dmg and fx
|
||||||
Skill::Silence => silence(cryp, target, resolution), // target cannot cast spells
|
Skill::Silence => silence(source, target, resolution), // target cannot cast spells
|
||||||
Skill::Inquiry => panic!("nyi"), //
|
Skill::Inquiry => panic!("nyi"), //
|
||||||
Skill::Purify => purify(cryp, target, resolution), // dispel all debuffs
|
Skill::Purify => purify(source, target, resolution), // dispel all debuffs
|
||||||
Skill::Purge => purge(cryp, target, resolution), // dispel all buffs
|
Skill::Purge => purge(source, target, resolution), // dispel all buffs
|
||||||
|
|
||||||
// -----------------
|
// -----------------
|
||||||
// Chaos
|
// Chaos
|
||||||
// -----------------
|
// -----------------
|
||||||
Skill::Banish => banish(cryp, target, resolution), // TODO prevent all actions
|
Skill::Banish => banish(source, target, resolution), // TODO prevent all actions
|
||||||
Skill::Hex => hex(cryp, target, resolution), // todo prevent casting
|
Skill::Hex => hex(source, target, resolution), // todo prevent casting
|
||||||
Skill::Fear => panic!("nyi"), // cast random spell on self
|
Skill::Fear => panic!("nyi"), // cast random spell on self
|
||||||
Skill::Taunt => panic!("nyi"), // target forced to attack
|
Skill::Taunt => panic!("nyi"), // target forced to attack
|
||||||
Skill::Pause => panic!("nyi"), // speed slow
|
Skill::Pause => panic!("nyi"), // speed slow
|
||||||
@ -743,10 +743,10 @@ impl Skill {
|
|||||||
// Test
|
// Test
|
||||||
// -----------------
|
// -----------------
|
||||||
Skill::TestTouch => Resolution { skill: Skill::TestTouch, results: vec![], disable: Disable::new(), speed: 0 },
|
Skill::TestTouch => Resolution { skill: Skill::TestTouch, results: vec![], disable: Disable::new(), speed: 0 },
|
||||||
Skill::TestStun => stun(cryp, target, resolution),
|
Skill::TestStun => stun(source, target, resolution),
|
||||||
Skill::TestBlock => block(cryp, target, resolution),
|
Skill::TestBlock => block(source, target, resolution),
|
||||||
Skill::TestParry => parry(cryp, target, resolution),
|
Skill::TestParry => parry(source, target, resolution),
|
||||||
Skill::TestDrain => drain(cryp, target, resolution),
|
Skill::TestDrain => drain(source, target, resolution),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user