Merge branch 'multipliers'
This commit is contained in:
commit
2987d56f9e
@ -75,8 +75,8 @@ pub struct CrypEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CrypEffect {
|
impl CrypEffect {
|
||||||
pub fn new(effect: Effect) -> CrypEffect {
|
pub fn new(effect: Effect, duration: u8) -> CrypEffect {
|
||||||
CrypEffect { effect, duration: effect.duration(), meta: None, tick: None }
|
CrypEffect { effect, duration, meta: None, tick: None }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_tick(mut self, tick: Cast) -> CrypEffect {
|
pub fn set_tick(mut self, tick: Cast) -> CrypEffect {
|
||||||
@ -702,7 +702,7 @@ impl Cryp {
|
|||||||
// todo modified durations cause of buffs
|
// todo modified durations cause of buffs
|
||||||
let result = Event::Effect {
|
let result = Event::Effect {
|
||||||
effect: effect.effect,
|
effect: effect.effect,
|
||||||
duration: effect.effect.duration(),
|
duration: effect.duration,
|
||||||
skill,
|
skill,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1085,8 +1085,8 @@ mod tests {
|
|||||||
let x_cryp = x_player.cryps[0].clone();
|
let x_cryp = x_player.cryps[0].clone();
|
||||||
let y_cryp = y_player.cryps[0].clone();
|
let y_cryp = y_player.cryps[0].clone();
|
||||||
|
|
||||||
game.player_by_id(y_player.id).unwrap().cryp_by_id(y_cryp.id).unwrap().red_damage.force(u64::max_value());
|
game.player_by_id(y_player.id).unwrap().cryp_by_id(y_cryp.id).unwrap().red_damage.force(1000000000);
|
||||||
game.player_by_id(y_player.id).unwrap().cryp_by_id(y_cryp.id).unwrap().speed.force(u64::max_value());
|
game.player_by_id(y_player.id).unwrap().cryp_by_id(y_cryp.id).unwrap().speed.force(1000000000);
|
||||||
|
|
||||||
// just in case
|
// just in case
|
||||||
// remove all mitigation
|
// remove all mitigation
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use util::{IntPct};
|
||||||
use cryp::{Cryp, CrypEffect, EffectMeta, Stat};
|
use cryp::{Cryp, CrypEffect, EffectMeta, Stat};
|
||||||
use vbox::{Var};
|
use vbox::{Var};
|
||||||
|
|
||||||
@ -35,55 +36,59 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
resolutions = match skill {
|
resolutions = match skill {
|
||||||
Skill::Amplify => amplify(source, target, resolutions), // increase magic damage
|
Skill::Amplify => amplify(source, target, resolutions, Skill::Amplify), // increase magic damage
|
||||||
Skill::Attack => attack(source, target, resolutions),
|
Skill::Attack => attack(source, target, resolutions, Skill::Attack),
|
||||||
Skill::Banish => banish(source, target, resolutions), // TODO prevent all actions
|
Skill::Banish => banish(source, target, resolutions, Skill::Banish), // TODO prevent all actions
|
||||||
Skill::Blast => blast(source, target, resolutions),
|
Skill::Blast => blast(source, target, resolutions, Skill::Blast),
|
||||||
Skill::Block => block(source, target, resolutions),
|
Skill::Block => block(source, target, resolutions, Skill::Block),
|
||||||
Skill::Clutch => clutch(source, target, resolutions),
|
Skill::Clutch => clutch(source, target, resolutions, Skill::Clutch),
|
||||||
Skill::Corrupt => corrupt(source, target, resolutions),
|
Skill::Corrupt => corrupt(source, target, resolutions, Skill::Corrupt),
|
||||||
Skill::CorruptionTick => corruption_tick(source, target, resolutions),
|
Skill::CorruptionTick => corruption_tick(source, target, resolutions, Skill::CorruptionTick),
|
||||||
Skill::Curse => curse(source, target, resolutions),
|
Skill::Curse => curse(source, target, resolutions, Skill::Curse),
|
||||||
Skill::Decay => decay(source, target, resolutions), // dot
|
Skill::Decay => decay(source, target, resolutions, Skill::Decay), // dot
|
||||||
Skill::DecayTick => decay_tick(source, target, resolutions), // dot
|
Skill::DecayTick => decay_tick(source, target, resolutions, Skill::DecayTick), // dot
|
||||||
Skill::Empower => empower(source, target, resolutions), // increased phys damage
|
Skill::Empower => empower(source, target, resolutions, Skill::Empower), // increased phys damage
|
||||||
Skill::Haste => haste(source, target, resolutions), // speed slow
|
Skill::Haste => haste(source, target, resolutions, Skill::Haste), // speed slow
|
||||||
Skill::Heal => heal(source, target, resolutions),
|
Skill::Heal => heal(source, target, resolutions, Skill::Heal),
|
||||||
Skill::Hex => hex(source, target, resolutions),
|
Skill::Hex => hex(source, target, resolutions, Skill::Hex),
|
||||||
Skill::Hostility => hostility(source, target, resolutions),
|
Skill::Hostility => hostility(source, target, resolutions, Skill::Hostility),
|
||||||
Skill::Invert => invert(source, target, resolutions),
|
Skill::Invert => invert(source, target, resolutions, Skill::Invert),
|
||||||
Skill::Injure => injure(source, target, resolutions),
|
Skill::Injure => injure(source, target, resolutions, Skill::Injure),
|
||||||
Skill::Parry => parry(source, target, resolutions),
|
Skill::Parry => parry(source, target, resolutions, Skill::Parry),
|
||||||
Skill::Purge => purge(source, target, resolutions), // dispel all buffs
|
Skill::Purge => purge(source, target, resolutions, Skill::Purge), // dispel all buffs
|
||||||
Skill::Purify => purify(source, target, resolutions), // dispel all debuffs
|
Skill::Purify => purify(source, target, resolutions, Skill::Purify), // dispel all debuffs
|
||||||
Skill::Recharge => recharge(source, target, resolutions), // target is immune to magic damage and fx
|
Skill::Recharge => recharge(source, target, resolutions, Skill::Recharge), // target is immune to magic damage and fx
|
||||||
Skill::Reflect => reflect(source, target, resolutions),
|
Skill::Reflect => reflect(source, target, resolutions, Skill::Reflect),
|
||||||
Skill::Riposte => panic!("riposte should not be caste"),
|
Skill::Riposte => panic!("riposte should not be caste"),
|
||||||
Skill::Ruin => ruin(source, target, resolutions),
|
Skill::Ruin => ruin(source, target, resolutions, Skill::Ruin),
|
||||||
Skill::Shield => shield(source, target, resolutions), // target is immune to magic damage and fx
|
Skill::Shield => shield(source, target, resolutions, Skill::Shield), // target is immune to magic damage and fx
|
||||||
Skill::Silence => silence(source, target, resolutions), // target cannot cast spells
|
Skill::Silence => silence(source, target, resolutions, Skill::Silence), // target cannot cast spells
|
||||||
Skill::Siphon => siphon(source, target, resolutions),
|
Skill::Siphon => siphon(source, target, resolutions, Skill::Siphon),
|
||||||
Skill::SiphonTick => siphon_tick(source, target, resolutions), // hot
|
Skill::SiphonTick => siphon_tick(source, target, resolutions, Skill::SiphonTick), // hot
|
||||||
Skill::Slay => unimplemented!(),
|
Skill::Slay => unimplemented!(),
|
||||||
Skill::Slow => slow(source, target, resolutions), // speed slow
|
Skill::Slow => slow(source, target, resolutions, Skill::Slow), // speed slow
|
||||||
Skill::Snare => snare(source, target, resolutions),
|
Skill::Snare => snare(source, target, resolutions, Skill::Snare),
|
||||||
Skill::Strangle => strangle(source, target, resolutions),
|
Skill::Strangle => strangle(source, target, resolutions, Skill::Strangle),
|
||||||
Skill::StrangleTick => strangle_tick(source, target, resolutions),
|
Skill::StrangleTick => strangle_tick(source, target, resolutions, Skill::StrangleTick),
|
||||||
Skill::Strike => strike(source, target, resolutions),
|
|
||||||
Skill::Stun => stun(source, target, resolutions),
|
Skill::Strike => strike(source, target, resolutions, Skill::Strike),
|
||||||
Skill::Taunt => taunt(source, target, resolutions),
|
Skill::StrikeII => strike(source, target, resolutions, Skill::StrikeII),
|
||||||
Skill::Throw => throw(source, target, resolutions), // no damage stun, adds vulnerable
|
Skill::StrikeIII => strike(source, target, resolutions, Skill::StrikeIII),
|
||||||
Skill::Triage => triage(source, target, resolutions), // hot
|
|
||||||
Skill::TriageTick => triage_tick(source, target, resolutions), // hot
|
Skill::Stun => stun(source, target, resolutions, Skill::Stun),
|
||||||
|
Skill::Taunt => taunt(source, target, resolutions, Skill::Taunt),
|
||||||
|
Skill::Throw => throw(source, target, resolutions, Skill::Throw), // no damage stun, adds vulnerable
|
||||||
|
Skill::Triage => triage(source, target, resolutions, Skill::Triage), // hot
|
||||||
|
Skill::TriageTick => triage_tick(source, target, resolutions, Skill::TriageTick), // hot
|
||||||
|
|
||||||
// -----------------
|
// -----------------
|
||||||
// Test
|
// Test
|
||||||
// -----------------
|
// -----------------
|
||||||
Skill::TestTouch => touch(source, target, resolutions),
|
Skill::TestTouch => touch(source, target, resolutions, Skill::TestTouch),
|
||||||
Skill::TestStun => stun(source, target, resolutions),
|
Skill::TestStun => stun(source, target, resolutions, Skill::Stun),
|
||||||
Skill::TestBlock => block(source, target, resolutions),
|
Skill::TestBlock => block(source, target, resolutions, Skill::Block),
|
||||||
Skill::TestParry => parry(source, target, resolutions),
|
Skill::TestParry => parry(source, target, resolutions, Skill::Parry),
|
||||||
Skill::TestSiphon => siphon(source, target, resolutions),
|
Skill::TestSiphon => siphon(source, target, resolutions, Skill::Siphon),
|
||||||
};
|
};
|
||||||
|
|
||||||
// if any event dealt damage to target cryp
|
// if any event dealt damage to target cryp
|
||||||
@ -96,15 +101,15 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio
|
|||||||
match r.event {
|
match r.event {
|
||||||
Event::Damage { amount, skill, mitigation: _, colour: _ } => {
|
Event::Damage { amount, skill, mitigation: _, colour: _ } => {
|
||||||
if target.affected(Effect::Corrupt) {
|
if target.affected(Effect::Corrupt) {
|
||||||
resolutions = corruption(target, source, resolutions);
|
resolutions = corruption(target, source, resolutions, Skill::Corrupt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.affected(Effect::Hostility) {
|
if target.affected(Effect::Hostility) {
|
||||||
resolutions = hatred(source, target, resolutions, skill, amount);
|
resolutions = hatred(source, target, resolutions, skill, amount, Skill::Hostility);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Event::Immunity { skill: _, immunity } => match immunity.contains(&Effect::Parry) {
|
Event::Immunity { skill: _, immunity } => match immunity.contains(&Effect::Parry) {
|
||||||
true => resolutions = riposte(target, source, resolutions),
|
true => resolutions = riposte(target, source, resolutions, Skill::Riposte),
|
||||||
false => (),
|
false => (),
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
@ -428,58 +433,6 @@ impl Effect {
|
|||||||
Effect::Ko => Category::Ko,
|
Effect::Ko => Category::Ko,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn duration(&self) -> u8 {
|
|
||||||
match self {
|
|
||||||
Effect::Block => 1,
|
|
||||||
Effect::Parry => 1,
|
|
||||||
Effect::Clutch => 1,
|
|
||||||
|
|
||||||
Effect::Reflect => 1,
|
|
||||||
|
|
||||||
Effect::Injured => 2,
|
|
||||||
|
|
||||||
Effect::Strangle => 2,
|
|
||||||
Effect::Strangling => 2,
|
|
||||||
|
|
||||||
Effect::Stun => 1,
|
|
||||||
Effect::Vulnerable => 2,
|
|
||||||
Effect::Snare => 2,
|
|
||||||
|
|
||||||
Effect::Taunt => 1,
|
|
||||||
Effect::Empower => 2,
|
|
||||||
Effect::Invert => 1,
|
|
||||||
|
|
||||||
Effect::Hex => 2,
|
|
||||||
Effect::Ruin => 1,
|
|
||||||
Effect::Curse => 2,
|
|
||||||
Effect::Banish => 1,
|
|
||||||
|
|
||||||
Effect::Slow => 2,
|
|
||||||
Effect::Haste => 2,
|
|
||||||
|
|
||||||
Effect::Amplify => 2,
|
|
||||||
Effect::Silence => 2,
|
|
||||||
|
|
||||||
Effect::Hostility => 2,
|
|
||||||
Effect::Hatred => 5,
|
|
||||||
|
|
||||||
Effect::Corrupt => 2,
|
|
||||||
Effect::Corruption => 3,
|
|
||||||
|
|
||||||
Effect::Shield => 2,
|
|
||||||
|
|
||||||
Effect::Triage => 3,
|
|
||||||
Effect::Decay => 3,
|
|
||||||
Effect::Siphon => 2,
|
|
||||||
|
|
||||||
_ => {
|
|
||||||
println!("{:?} does not have a duration", self);
|
|
||||||
return 1;
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
||||||
@ -527,6 +480,8 @@ pub enum Skill {
|
|||||||
StrangleTick,
|
StrangleTick,
|
||||||
|
|
||||||
Strike,
|
Strike,
|
||||||
|
StrikeII,
|
||||||
|
StrikeIII,
|
||||||
Stun,
|
Stun,
|
||||||
// Evade, // actively evade
|
// Evade, // actively evade
|
||||||
|
|
||||||
@ -584,10 +539,92 @@ pub enum Skill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Skill {
|
impl Skill {
|
||||||
|
pub fn multiplier(&self) -> u64 {
|
||||||
|
match self {
|
||||||
|
Skill::Attack => 100, // 1.0 to pass tests
|
||||||
|
Skill::Strike => 110,
|
||||||
|
Skill::StrikeII => 130,
|
||||||
|
Skill::StrikeIII => 150,
|
||||||
|
Skill::StrangleTick => 30,
|
||||||
|
Skill::Riposte => 100,
|
||||||
|
Skill::Heal => 100, // 1.0 to pass tests
|
||||||
|
Skill::TriageTick => 65,
|
||||||
|
Skill::Blast => 130,
|
||||||
|
Skill::CorruptionTick => 80,
|
||||||
|
Skill::DecayTick => 60,
|
||||||
|
Skill::SiphonTick => 100, // 1.0 to pass tests
|
||||||
|
_ => 100,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn duration(&self) -> u8 {
|
||||||
|
match self {
|
||||||
|
Skill::Block => 1,
|
||||||
|
Skill::Parry => 1,
|
||||||
|
Skill::Clutch => 1,
|
||||||
|
|
||||||
|
Skill::Reflect => 1,
|
||||||
|
|
||||||
|
Skill::Injure => 2,
|
||||||
|
|
||||||
|
Skill::Strangle => 2,
|
||||||
|
|
||||||
|
Skill::Stun => 2,
|
||||||
|
Skill::Throw => 2,
|
||||||
|
Skill::Snare => 2,
|
||||||
|
|
||||||
|
Skill::Taunt => 1,
|
||||||
|
Skill::Empower => 2,
|
||||||
|
Skill::Invert => 1,
|
||||||
|
|
||||||
|
Skill::Hex => 2,
|
||||||
|
Skill::Ruin => 1,
|
||||||
|
Skill::Curse => 2,
|
||||||
|
Skill::Banish => 1,
|
||||||
|
|
||||||
|
Skill::Slow => 2,
|
||||||
|
Skill::Haste => 2,
|
||||||
|
|
||||||
|
Skill::Amplify => 2,
|
||||||
|
Skill::Silence => 2,
|
||||||
|
|
||||||
|
Skill::Hostility => 2, // Primary Buff
|
||||||
|
Skill::Corrupt => 2, // Primary Buff
|
||||||
|
|
||||||
|
Skill::Shield => 2,
|
||||||
|
|
||||||
|
Skill::Triage => 3,
|
||||||
|
Skill::Decay => 3,
|
||||||
|
Skill::Siphon => 2,
|
||||||
|
|
||||||
|
_ => {
|
||||||
|
println!("{:?} does not have a duration", self);
|
||||||
|
return 1;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn secondary_duration(&self) -> u8 {
|
||||||
|
match self {
|
||||||
|
Skill::Hostility => 5, // Increased dmg buff
|
||||||
|
Skill::Corrupt => 3, // Damage over time
|
||||||
|
Skill::Throw => 3, // Inc dmg taken debuff
|
||||||
|
|
||||||
|
_ => {
|
||||||
|
println!("{:?} does not have a secondary duration", self);
|
||||||
|
return 1;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn base_cd(&self) -> Cooldown {
|
pub fn base_cd(&self) -> Cooldown {
|
||||||
match self {
|
match self {
|
||||||
Skill::Attack => None,
|
Skill::Attack => None,
|
||||||
Skill::Strike => None,
|
Skill::Strike => None,
|
||||||
|
Skill::StrikeII => None,
|
||||||
|
Skill::StrikeIII => None,
|
||||||
Skill::Block => None, // reduce damage
|
Skill::Block => None, // reduce damage
|
||||||
Skill::Parry => None, // avoid all damage
|
Skill::Parry => None, // avoid all damage
|
||||||
Skill::Riposte => None, // used on parry
|
Skill::Riposte => None, // used on parry
|
||||||
@ -644,6 +681,8 @@ impl Skill {
|
|||||||
match self {
|
match self {
|
||||||
Skill::Attack => Category::Red,
|
Skill::Attack => Category::Red,
|
||||||
Skill::Strike => Category::Red,
|
Skill::Strike => Category::Red,
|
||||||
|
Skill::StrikeII => Category::Red,
|
||||||
|
Skill::StrikeIII => Category::Red,
|
||||||
Skill::Injure => Category::Red,
|
Skill::Injure => Category::Red,
|
||||||
Skill::Strangle => Category::Red,
|
Skill::Strangle => Category::Red,
|
||||||
Skill::StrangleTick => Category::Red,
|
Skill::StrangleTick => Category::Red,
|
||||||
@ -688,6 +727,7 @@ impl Skill {
|
|||||||
// -----------------
|
// -----------------
|
||||||
// Test
|
// Test
|
||||||
// -----------------
|
// -----------------
|
||||||
|
|
||||||
Skill::TestTouch => Category::Red,
|
Skill::TestTouch => Category::Red,
|
||||||
Skill::TestStun => Category::Red,
|
Skill::TestStun => Category::Red,
|
||||||
Skill::TestParry => Category::Red,
|
Skill::TestParry => Category::Red,
|
||||||
@ -718,6 +758,8 @@ impl Skill {
|
|||||||
Skill::TestSiphon => 10,
|
Skill::TestSiphon => 10,
|
||||||
|
|
||||||
Skill::Strike => u8::max_value(),
|
Skill::Strike => u8::max_value(),
|
||||||
|
Skill::StrikeII => Skill::Strike.speed(),
|
||||||
|
Skill::StrikeIII => Skill::Strike.speed(),
|
||||||
|
|
||||||
Skill::SiphonTick => Var::from(Skill::Siphon).speed(),
|
Skill::SiphonTick => Var::from(Skill::Siphon).speed(),
|
||||||
Skill::DecayTick => Var::from(Skill::Decay).speed(),
|
Skill::DecayTick => Var::from(Skill::Decay).speed(),
|
||||||
@ -777,85 +819,85 @@ impl Skill {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn touch(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn touch(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
target.deal_red_damage(Skill::TestTouch, 0)
|
target.deal_red_damage(skill, 0)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn attack(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn attack(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.red_damage();
|
let amount = source.red_damage().pct(skill.multiplier());
|
||||||
target.deal_red_damage(Skill::Attack, amount)
|
target.deal_red_damage(skill, amount)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn strike(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn strike(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.red_damage();
|
let amount = source.red_damage().pct(skill.multiplier());
|
||||||
target.deal_red_damage(Skill::Strike, amount)
|
target.deal_red_damage(skill, amount)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn injure(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn injure(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.red_damage();
|
let amount = source.red_damage().pct(skill.multiplier());
|
||||||
target.deal_red_damage(Skill::Injure, amount)
|
target.deal_red_damage(skill, amount)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
|
|
||||||
let effect = CrypEffect::new(Effect::Injured);
|
let effect = CrypEffect::new(Effect::Injured, 2);
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Injure, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stun(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn stun(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Stun);
|
let effect = CrypEffect::new(Effect::Stun, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Stun, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clutch(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn clutch(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Clutch);
|
let effect = CrypEffect::new(Effect::Clutch, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Clutch, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn taunt(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn taunt(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Taunt);
|
let effect = CrypEffect::new(Effect::Taunt, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Taunt, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn throw(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn throw(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let stun = CrypEffect::new(Effect::Stun);
|
let stun = CrypEffect::new(Effect::Stun, skill.duration());
|
||||||
let vulnerable = CrypEffect::new(Effect::Vulnerable);
|
let vulnerable = CrypEffect::new(Effect::Vulnerable, skill.secondary_duration());
|
||||||
|
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Throw, stun)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, stun)));
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Throw, vulnerable)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, vulnerable)));
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn strangle(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn strangle(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let target_stun = CrypEffect::new(Effect::Strangle)
|
let target_stun = CrypEffect::new(Effect::Strangle, skill.duration())
|
||||||
.set_tick(Cast::new_tick(source, target, Skill::StrangleTick));
|
.set_tick(Cast::new_tick(source, target, Skill::StrangleTick));
|
||||||
|
|
||||||
let attacker_immunity = CrypEffect::new(Effect::Strangling);
|
let attacker_immunity = CrypEffect::new(Effect::Strangling, skill.duration());
|
||||||
|
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Strangle, target_stun)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, target_stun)));
|
||||||
results.push(Resolution::new(source, source).event(source.add_effect(Skill::Strangle, attacker_immunity)));
|
results.push(Resolution::new(source, source).event(source.add_effect(skill, attacker_immunity)));
|
||||||
return strangle_tick(source, target, results);
|
return strangle_tick(source, target, results, Skill::StrangleTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn strangle_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn strangle_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.red_damage();
|
let amount = source.red_damage().pct(skill.multiplier());
|
||||||
target.deal_red_damage(Skill::StrangleTick, amount)
|
target.deal_red_damage(skill, amount)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
|
|
||||||
@ -872,100 +914,100 @@ fn strangle_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions)
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn block(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn block(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let block = CrypEffect::new(Effect::Block);
|
let block = CrypEffect::new(Effect::Block, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Block, block)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, block)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parry(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn parry(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Parry);
|
let effect = CrypEffect::new(Effect::Parry, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Parry, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn riposte(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn riposte(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.red_damage();
|
let amount = source.red_damage().pct(skill.multiplier());
|
||||||
target.deal_red_damage(Skill::Riposte, amount)
|
target.deal_red_damage(skill, amount)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn snare(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn snare(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let snare = CrypEffect::new(Effect::Snare);
|
let snare = CrypEffect::new(Effect::Snare, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Snare, snare)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, snare)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn empower(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn empower(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let empower = CrypEffect::new(Effect::Empower);
|
let empower = CrypEffect::new(Effect::Empower, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Empower, empower)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, empower)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn heal(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn heal(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.green_damage();
|
let amount = source.green_damage().pct(skill.multiplier());
|
||||||
target.deal_green_damage(Skill::Heal, amount)
|
target.deal_green_damage(skill, amount)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn triage(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn triage(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Triage)
|
let effect = CrypEffect::new(Effect::Triage, skill.duration())
|
||||||
.set_tick(Cast::new_tick(source, target, Skill::TriageTick));
|
.set_tick(Cast::new_tick(source, target, Skill::TriageTick));
|
||||||
|
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Triage, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return triage_tick(source, target, results);
|
return triage_tick(source, target, results, Skill::TriageTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn triage_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn triage_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.green_damage().wrapping_div(2);
|
let amount = source.green_damage().pct(skill.multiplier());
|
||||||
target.deal_green_damage(Skill::TriageTick, amount)
|
target.deal_green_damage(Skill::TriageTick, amount)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blast(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn blast(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.blue_damage();
|
let amount = source.blue_damage().pct(skill.multiplier());
|
||||||
target.deal_blue_damage(Skill::Blast, amount)
|
target.deal_blue_damage(skill, amount)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn amplify(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn amplify(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amplify = CrypEffect::new(Effect::Amplify);
|
let amplify = CrypEffect::new(Effect::Amplify, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Amplify, amplify)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, amplify)));
|
||||||
return results;;
|
return results;;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn haste(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn haste(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Haste);
|
let effect = CrypEffect::new(Effect::Haste, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Haste, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;;
|
return results;;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn slow(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn slow(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Slow);
|
let effect = CrypEffect::new(Effect::Slow, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Slow, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;;
|
return results;;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn decay(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn decay(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let decay = CrypEffect::new(Effect::Decay)
|
let decay = CrypEffect::new(Effect::Decay, skill.duration())
|
||||||
.set_tick(Cast::new_tick(source, target, Skill::DecayTick));
|
.set_tick(Cast::new_tick(source, target, Skill::DecayTick));
|
||||||
|
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Decay, decay)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, decay)));
|
||||||
return decay_tick(source, target, results);
|
return decay_tick(source, target, results, Skill::DecayTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn decay_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn decay_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.blue_damage() / 2;
|
let amount = source.blue_damage().pct(skill.multiplier());
|
||||||
target.deal_blue_damage(Skill::DecayTick, amount)
|
target.deal_blue_damage(skill, amount)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
return results;
|
return results;
|
||||||
@ -973,88 +1015,88 @@ fn decay_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) ->
|
|||||||
|
|
||||||
// corrupt is the buff effect
|
// corrupt is the buff effect
|
||||||
// when attacked it runs corruption and applies a debuff
|
// when attacked it runs corruption and applies a debuff
|
||||||
fn corrupt(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn corrupt(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Corrupt);
|
let effect = CrypEffect::new(Effect::Corrupt, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Corrupt, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;;
|
return results;;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn corruption(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn corruption(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Corruption)
|
let effect = CrypEffect::new(Effect::Corruption, skill.secondary_duration())
|
||||||
.set_tick(Cast::new_tick(source, target, Skill::CorruptionTick));
|
.set_tick(Cast::new_tick(source, target, Skill::CorruptionTick));
|
||||||
|
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Corrupt, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return corruption_tick(source, target, results);
|
return corruption_tick(source, target, results, Skill::CorruptionTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn corruption_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn corruption_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.blue_damage() / 2;
|
let amount = source.blue_damage().pct(skill.multiplier());
|
||||||
target.deal_blue_damage(Skill::CorruptionTick, amount)
|
target.deal_blue_damage(skill, amount)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ruin(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn ruin(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Ruin);
|
let effect = CrypEffect::new(Effect::Ruin, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Ruin, effect)));
|
|
||||||
return results;;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fn hex(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
|
||||||
let hex = CrypEffect::new(Effect::Hex);
|
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Hex, hex)));
|
|
||||||
return results;;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn hostility(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
|
||||||
let effect = CrypEffect::new(Effect::Hostility);
|
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Hostility, effect)));
|
|
||||||
return results;;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn hatred(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill, amount: u64) -> Resolutions {
|
|
||||||
let effect = CrypEffect::new(Effect::Hatred)
|
|
||||||
.set_meta(EffectMeta::AddedDamage(amount));
|
|
||||||
|
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;;
|
return results;;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn curse(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
|
||||||
let curse = CrypEffect::new(Effect::Curse);
|
fn hex(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
|
let hex = CrypEffect::new(Effect::Hex, skill.duration());
|
||||||
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, hex)));
|
||||||
|
return results;;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn hostility(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
|
let effect = CrypEffect::new(Effect::Hostility, skill.duration());
|
||||||
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
|
return results;;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn hatred(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, reflect_skill: Skill, amount: u64, skill: Skill) -> Resolutions {
|
||||||
|
let effect = CrypEffect::new(Effect::Hatred, skill.secondary_duration())
|
||||||
|
.set_meta(EffectMeta::AddedDamage(amount));
|
||||||
|
|
||||||
|
results.push(Resolution::new(source, target).event(target.add_effect(reflect_skill, effect)));
|
||||||
|
return results;;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn curse(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
|
let curse = CrypEffect::new(Effect::Curse, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Curse, curse)));
|
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Curse, curse)));
|
||||||
return results;;
|
return results;;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn invert(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn invert(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Invert);
|
let effect = CrypEffect::new(Effect::Invert, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Invert, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;;
|
return results;;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reflect(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn reflect(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let effect = CrypEffect::new(Effect::Reflect);
|
let effect = CrypEffect::new(Effect::Reflect, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Reflect, effect)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
|
||||||
return results;;
|
return results;;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn recharge(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn recharge(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
results.push(Resolution::new(source, target).event(target.recharge()));
|
results.push(Resolution::new(source, target).event(target.recharge()));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn siphon(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn siphon(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let siphon = CrypEffect::new(Effect::Siphon)
|
let siphon = CrypEffect::new(Effect::Siphon, skill.duration())
|
||||||
.set_tick(Cast::new_tick(source, target, Skill::SiphonTick));
|
.set_tick(Cast::new_tick(source, target, Skill::SiphonTick));
|
||||||
|
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Siphon, siphon)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, siphon)));
|
||||||
return siphon_tick(source, target, results);
|
return siphon_tick(source, target, results, Skill::SiphonTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn siphon_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn siphon_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let amount = source.blue_damage();
|
let amount = source.blue_damage().pct(skill.multiplier());
|
||||||
let siphon_events = target.deal_blue_damage(Skill::SiphonTick, amount);
|
let siphon_events = target.deal_blue_damage(Skill::SiphonTick, amount);
|
||||||
|
|
||||||
for e in siphon_events {
|
for e in siphon_events {
|
||||||
@ -1074,19 +1116,19 @@ fn siphon_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn shield(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn shield(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let shield = CrypEffect::new(Effect::Shield);
|
let shield = CrypEffect::new(Effect::Shield, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Shield, shield)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, shield)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn silence(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn silence(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let silence = CrypEffect::new(Effect::Silence);
|
let silence = CrypEffect::new(Effect::Silence, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Silence, silence)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, silence)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn purge(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn purge(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
while let Some(i) = target.effects
|
while let Some(i) = target.effects
|
||||||
.iter()
|
.iter()
|
||||||
.position(|ce| [Category::Buff, Category::Buff].contains(&ce.effect.category())) {
|
.position(|ce| [Category::Buff, Category::Buff].contains(&ce.effect.category())) {
|
||||||
@ -1097,7 +1139,7 @@ fn purge(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Reso
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn purify(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn purify(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
while let Some(i) = target.effects
|
while let Some(i) = target.effects
|
||||||
.iter()
|
.iter()
|
||||||
.position(|ce| [Category::Debuff, Category::Debuff].contains(&ce.effect.category())) {
|
.position(|ce| [Category::Debuff, Category::Debuff].contains(&ce.effect.category())) {
|
||||||
@ -1108,9 +1150,9 @@ fn purify(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Res
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn banish(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -> Resolutions {
|
fn banish(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||||
let banish = CrypEffect::new(Effect::Banish);
|
let banish = CrypEffect::new(Effect::Banish, skill.duration());
|
||||||
results.push(Resolution::new(source, target).event(target.add_effect(Skill::Banish, banish)));
|
results.push(Resolution::new(source, target).event(target.add_effect(skill, banish)));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1130,7 +1172,7 @@ mod tests {
|
|||||||
|
|
||||||
x.deal_red_damage(Skill::Attack, 5);
|
x.deal_red_damage(Skill::Attack, 5);
|
||||||
|
|
||||||
heal(&mut y, &mut x, vec![]);
|
heal(&mut y, &mut x, vec![], Skill::Heal);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1141,7 +1183,7 @@ mod tests {
|
|||||||
let mut y = Cryp::new()
|
let mut y = Cryp::new()
|
||||||
.named(&"camel".to_string());
|
.named(&"camel".to_string());
|
||||||
|
|
||||||
decay(&mut x, &mut y, vec![]);
|
decay(&mut x, &mut y, vec![], Skill::Decay);
|
||||||
|
|
||||||
assert!(y.effects.iter().any(|e| e.effect == Effect::Decay));
|
assert!(y.effects.iter().any(|e| e.effect == Effect::Decay));
|
||||||
|
|
||||||
@ -1162,10 +1204,10 @@ mod tests {
|
|||||||
x.red_damage.force(100);
|
x.red_damage.force(100);
|
||||||
y.green_life.force(500);
|
y.green_life.force(500);
|
||||||
|
|
||||||
block(&mut y.clone(), &mut y, vec![]);
|
block(&mut y.clone(), &mut y, vec![], Skill::Block);
|
||||||
assert!(y.effects.iter().any(|e| e.effect == Effect::Block));
|
assert!(y.effects.iter().any(|e| e.effect == Effect::Block));
|
||||||
|
|
||||||
let mut results = attack(&mut x, &mut y, vec![]);
|
let mut results = attack(&mut x, &mut y, vec![], Skill::Attack);
|
||||||
|
|
||||||
let Resolution { source: _, target: _, event } = results.remove(0);
|
let Resolution { source: _, target: _, event } = results.remove(0);
|
||||||
match event {
|
match event {
|
||||||
@ -1182,12 +1224,12 @@ mod tests {
|
|||||||
let mut y = Cryp::new()
|
let mut y = Cryp::new()
|
||||||
.named(&"camel".to_string());
|
.named(&"camel".to_string());
|
||||||
|
|
||||||
x.red_damage.force(u64::max_value());
|
x.red_damage.force(10000000000000); // multiplication of int max will cause overflow
|
||||||
|
|
||||||
clutch(&mut y.clone(), &mut y, vec![]);
|
clutch(&mut y.clone(), &mut y, vec![], Skill::Clutch);
|
||||||
assert!(y.affected(Effect::Clutch));
|
assert!(y.affected(Effect::Clutch));
|
||||||
|
|
||||||
let mut results = attack(&mut x, &mut y, vec![]);
|
let mut results = attack(&mut x, &mut y, vec![], Skill::Attack);
|
||||||
assert!(y.green_life() == 1);
|
assert!(y.green_life() == 1);
|
||||||
|
|
||||||
let Resolution { source: _, target: _, event } = results.remove(0);
|
let Resolution { source: _, target: _, event } = results.remove(0);
|
||||||
@ -1223,15 +1265,15 @@ mod tests {
|
|||||||
y.red_life.reduce(64);
|
y.red_life.reduce(64);
|
||||||
x.red_damage.force(256 + 64);
|
x.red_damage.force(256 + 64);
|
||||||
|
|
||||||
invert(&mut y.clone(), &mut y, vec![]);
|
invert(&mut y.clone(), &mut y, vec![], Skill::Invert);
|
||||||
assert!(y.affected(Effect::Invert));
|
assert!(y.affected(Effect::Invert));
|
||||||
|
|
||||||
// heal should deal green damage
|
// heal should deal green damage
|
||||||
heal(&mut x, &mut y, vec![]);
|
heal(&mut x, &mut y, vec![], Skill::Heal);
|
||||||
assert!(y.green_life() == 768);
|
assert!(y.green_life() == 768);
|
||||||
|
|
||||||
// attack should heal and recharge red shield
|
// attack should heal and recharge red shield
|
||||||
let mut results = attack(&mut x, &mut y, vec![]);
|
let mut results = attack(&mut x, &mut y, vec![], Skill::Attack);
|
||||||
assert!(y.green_life() == 1024);
|
assert!(y.green_life() == 1024);
|
||||||
|
|
||||||
match results.remove(0).event {
|
match results.remove(0).event {
|
||||||
@ -1258,7 +1300,7 @@ mod tests {
|
|||||||
let mut y = Cryp::new()
|
let mut y = Cryp::new()
|
||||||
.named(&"camel".to_string());
|
.named(&"camel".to_string());
|
||||||
|
|
||||||
reflect(&mut y.clone(), &mut y, vec![]);
|
reflect(&mut y.clone(), &mut y, vec![], Skill::Reflect);
|
||||||
assert!(y.affected(Effect::Reflect));
|
assert!(y.affected(Effect::Reflect));
|
||||||
|
|
||||||
let mut results = vec![];
|
let mut results = vec![];
|
||||||
@ -1326,7 +1368,7 @@ mod tests {
|
|||||||
let mut y = Cryp::new()
|
let mut y = Cryp::new()
|
||||||
.named(&"camel".to_string());
|
.named(&"camel".to_string());
|
||||||
|
|
||||||
corrupt(&mut y.clone(), &mut y, vec![]);
|
corrupt(&mut y.clone(), &mut y, vec![], Skill::Corrupt);
|
||||||
assert!(y.affected(Effect::Corrupt));
|
assert!(y.affected(Effect::Corrupt));
|
||||||
|
|
||||||
resolve(Skill::Attack, &mut x, &mut y, vec![]);
|
resolve(Skill::Attack, &mut x, &mut y, vec![]);
|
||||||
@ -1342,7 +1384,7 @@ mod tests {
|
|||||||
let mut y = Cryp::new()
|
let mut y = Cryp::new()
|
||||||
.named(&"camel".to_string());
|
.named(&"camel".to_string());
|
||||||
|
|
||||||
hostility(&mut y.clone(), &mut y, vec![]);
|
hostility(&mut y.clone(), &mut y, vec![], Skill::Hostility);
|
||||||
assert!(y.affected(Effect::Hostility));
|
assert!(y.affected(Effect::Hostility));
|
||||||
|
|
||||||
resolve(Skill::Attack, &mut x, &mut y, vec![]);
|
resolve(Skill::Attack, &mut x, &mut y, vec![]);
|
||||||
@ -1376,7 +1418,7 @@ mod tests {
|
|||||||
y.deal_red_damage(Skill::Attack, 5);
|
y.deal_red_damage(Skill::Attack, 5);
|
||||||
let prev_hp = y.green_life();
|
let prev_hp = y.green_life();
|
||||||
|
|
||||||
triage(&mut x, &mut y, vec![]);
|
triage(&mut x, &mut y, vec![], Skill::Triage);
|
||||||
|
|
||||||
assert!(y.effects.iter().any(|e| e.effect == Effect::Triage));
|
assert!(y.effects.iter().any(|e| e.effect == Effect::Triage));
|
||||||
assert!(y.green_life() > prev_hp);
|
assert!(y.green_life() > prev_hp);
|
||||||
@ -1396,7 +1438,7 @@ mod tests {
|
|||||||
y.deal_red_damage(Skill::Attack, 5);
|
y.deal_red_damage(Skill::Attack, 5);
|
||||||
y.deal_blue_damage(Skill::Blast, 5);
|
y.deal_blue_damage(Skill::Blast, 5);
|
||||||
|
|
||||||
let mut results = recharge(&mut x, &mut y, vec![]);
|
let mut results = recharge(&mut x, &mut y, vec![], Skill::Recharge);
|
||||||
|
|
||||||
let Resolution { source: _, target: _, event } = results.remove(0);
|
let Resolution { source: _, target: _, event } = results.remove(0);
|
||||||
match event {
|
match event {
|
||||||
@ -1414,7 +1456,7 @@ mod tests {
|
|||||||
let mut x = Cryp::new()
|
let mut x = Cryp::new()
|
||||||
.named(&"muji".to_string());
|
.named(&"muji".to_string());
|
||||||
|
|
||||||
silence(&mut x.clone(), &mut x, vec![]);
|
silence(&mut x.clone(), &mut x, vec![], Skill::Silence);
|
||||||
assert!(x.effects.iter().any(|e| e.effect == Effect::Silence));
|
assert!(x.effects.iter().any(|e| e.effect == Effect::Silence));
|
||||||
assert!(x.disabled(Skill::Silence).is_some());
|
assert!(x.disabled(Skill::Silence).is_some());
|
||||||
}
|
}
|
||||||
@ -1426,7 +1468,7 @@ mod tests {
|
|||||||
|
|
||||||
x.blue_damage.force(50);
|
x.blue_damage.force(50);
|
||||||
|
|
||||||
amplify(&mut x.clone(), &mut x, vec![]);
|
amplify(&mut x.clone(), &mut x, vec![], Skill::Amplify);
|
||||||
assert!(x.effects.iter().any(|e| e.effect == Effect::Amplify));
|
assert!(x.effects.iter().any(|e| e.effect == Effect::Amplify));
|
||||||
assert_eq!(x.blue_damage(), 100);
|
assert_eq!(x.blue_damage(), 100);
|
||||||
}
|
}
|
||||||
@ -1436,10 +1478,10 @@ mod tests {
|
|||||||
let mut x = Cryp::new()
|
let mut x = Cryp::new()
|
||||||
.named(&"muji".to_string());
|
.named(&"muji".to_string());
|
||||||
|
|
||||||
decay(&mut x.clone(), &mut x, vec![]);
|
decay(&mut x.clone(), &mut x, vec![], Skill::Decay);
|
||||||
assert!(x.effects.iter().any(|e| e.effect == Effect::Decay));
|
assert!(x.effects.iter().any(|e| e.effect == Effect::Decay));
|
||||||
|
|
||||||
purify(&mut x.clone(), &mut x, vec![]);
|
purify(&mut x.clone(), &mut x, vec![], Skill::Purify);
|
||||||
assert!(!x.effects.iter().any(|e| e.effect == Effect::Decay));
|
assert!(!x.effects.iter().any(|e| e.effect == Effect::Decay));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,6 +86,8 @@ pub enum Var {
|
|||||||
Snare,
|
Snare,
|
||||||
Strangle,
|
Strangle,
|
||||||
Strike,
|
Strike,
|
||||||
|
StrikeII,
|
||||||
|
StrikeIII,
|
||||||
Siphon,
|
Siphon,
|
||||||
Clutch,
|
Clutch,
|
||||||
Taunt,
|
Taunt,
|
||||||
@ -115,7 +117,13 @@ impl Var {
|
|||||||
Var::Red => count.red += 1,
|
Var::Red => count.red += 1,
|
||||||
Var::Blue => count.blue += 1,
|
Var::Blue => count.blue += 1,
|
||||||
Var::Green => count.green += 1,
|
Var::Green => count.green += 1,
|
||||||
_ => (),
|
_ => {
|
||||||
|
let mut combo_count = Colours::new();
|
||||||
|
unit.colours(&mut combo_count);
|
||||||
|
count.red += combo_count.red;
|
||||||
|
count.blue += combo_count.blue;
|
||||||
|
count.green += combo_count.green;
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
@ -206,6 +214,8 @@ impl Var {
|
|||||||
Var::Snare => Some(Skill::Snare),
|
Var::Snare => Some(Skill::Snare),
|
||||||
Var::Strangle => Some(Skill::Strangle),
|
Var::Strangle => Some(Skill::Strangle),
|
||||||
Var::Strike => Some(Skill::Strike),
|
Var::Strike => Some(Skill::Strike),
|
||||||
|
Var::StrikeII => Some(Skill::StrikeII),
|
||||||
|
Var::StrikeIII => Some(Skill::StrikeIII),
|
||||||
Var::Clutch => Some(Skill::Clutch),
|
Var::Clutch => Some(Skill::Clutch),
|
||||||
Var::Taunt => Some(Skill::Taunt),
|
Var::Taunt => Some(Skill::Taunt),
|
||||||
Var::Throw => Some(Skill::Throw),
|
Var::Throw => Some(Skill::Throw),
|
||||||
@ -276,6 +286,8 @@ impl From<Skill> for Var {
|
|||||||
Skill::Snare => Var::Snare,
|
Skill::Snare => Var::Snare,
|
||||||
Skill::Strangle => Var::Strangle,
|
Skill::Strangle => Var::Strangle,
|
||||||
Skill::Strike => Var::Strike,
|
Skill::Strike => Var::Strike,
|
||||||
|
Skill::StrikeII => Var::StrikeII,
|
||||||
|
Skill::StrikeIII => Var::StrikeIII,
|
||||||
Skill::Stun => Var::Stun,
|
Skill::Stun => Var::Stun,
|
||||||
Skill::Taunt => Var::Taunt,
|
Skill::Taunt => Var::Taunt,
|
||||||
Skill::Throw => Var::Throw,
|
Skill::Throw => Var::Throw,
|
||||||
@ -349,7 +361,7 @@ fn get_combos() -> Vec<Combo> {
|
|||||||
Combo { units: vec![Var::Block, Var::Green, Var::Green], var: Var::Reflect },
|
Combo { units: vec![Var::Block, Var::Green, Var::Green], var: Var::Reflect },
|
||||||
Combo { units: vec![Var::Block, Var::Blue, Var::Blue], var: Var::Corrupt },
|
Combo { units: vec![Var::Block, Var::Blue, Var::Blue], var: Var::Corrupt },
|
||||||
Combo { units: vec![Var::Block, Var::Red, Var::Green], var: Var::Taunt },
|
Combo { units: vec![Var::Block, Var::Red, Var::Green], var: Var::Taunt },
|
||||||
Combo { units: vec![Var::Block, Var::Green, Var::Blue], var: Var::Life },
|
Combo { units: vec![Var::Block, Var::Green, Var::Blue], var: Var::Recharge }, // was life before (clash)
|
||||||
Combo { units: vec![Var::Block, Var::Red, Var::Blue], var: Var::Recharge },
|
Combo { units: vec![Var::Block, Var::Red, Var::Blue], var: Var::Recharge },
|
||||||
|
|
||||||
Combo { units: vec![Var::Stun, Var::Red, Var::Red], var: Var::Strangle },
|
Combo { units: vec![Var::Stun, Var::Red, Var::Red], var: Var::Strangle },
|
||||||
@ -360,6 +372,9 @@ fn get_combos() -> Vec<Combo> {
|
|||||||
Combo { units: vec![Var::Stun, Var::Red, Var::Blue], var: Var::Hex },
|
Combo { units: vec![Var::Stun, Var::Red, Var::Blue], var: Var::Hex },
|
||||||
|
|
||||||
Combo { units: vec![Var::Attack, Var::Red, Var::Red], var: Var::Strike },
|
Combo { units: vec![Var::Attack, Var::Red, Var::Red], var: Var::Strike },
|
||||||
|
Combo { units: vec![Var::Strike, Var::Strike, Var::Strike], var: Var::StrikeII },
|
||||||
|
Combo { units: vec![Var::StrikeII, Var::StrikeII, Var::StrikeII], var: Var::StrikeIII },
|
||||||
|
|
||||||
Combo { units: vec![Var::Attack, Var::Green, Var::Green], var: Var::Heal },
|
Combo { units: vec![Var::Attack, Var::Green, Var::Green], var: Var::Heal },
|
||||||
Combo { units: vec![Var::Attack, Var::Blue, Var::Blue], var: Var::Blast },
|
Combo { units: vec![Var::Attack, Var::Blue, Var::Blue], var: Var::Blast },
|
||||||
Combo { units: vec![Var::Attack, Var::Red, Var::Green], var: Var::Purify },
|
Combo { units: vec![Var::Attack, Var::Red, Var::Green], var: Var::Purify },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user