diff --git a/core/src/game.rs b/core/src/game.rs index 00cec5d7..ec2e8134 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -539,7 +539,7 @@ impl Game { return self.execute(Cast { target: cast.source, ..cast }, events); } - for action in cast.actions() { + for action in cast.actions(self, &events) { let new_events = match action { Action::Cast => vec![self.cast(cast)], Action::Hit => vec![self.hit(cast)], diff --git a/core/src/skill.rs b/core/src/skill.rs index 54c365eb..3979bb84 100644 --- a/core/src/skill.rs +++ b/core/src/skill.rs @@ -4,7 +4,7 @@ use uuid::Uuid; use util::{IntPct}; use item::{Item}; -use game::{Game, Colour, Value, Action}; +use game::{Game, Colour, Value, Action, Event}; use construct::{Construct, ConstructEffect, EffectMeta, Stat}; use effect::{Effect, Cooldown}; @@ -47,9 +47,7 @@ impl Cast { } } - pub fn actions(&self) -> Vec { - let mut rng = thread_rng(); - + pub fn actions(&self, game: &Game, events: &Vec) -> Vec { let mut actions = vec![]; if !self.skill.aoe() { @@ -60,937 +58,158 @@ impl Cast { } let mut rest = match self.skill { - Skill::Attack => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Red, - values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }], - }, - ], + Skill::Attack => attack(self, game, events), + Skill::Block => block(self, game, events), + Skill::Buff => buff(self, game, events), + Skill::Debuff => debuff(self, game, events), + Skill::Stun => stun(self, game, events), - Skill::Block => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Block, duration: 1, meta: Some(EffectMeta::Multiplier(35)) }, - }, - ], - - Skill::Buff => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Buff, duration: 3, meta: Some(EffectMeta::Multiplier(130)) }, - }, - ], - - Skill::Debuff => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Slow, duration: 3, meta: Some(EffectMeta::Multiplier(50)) }, - }, - ], - - Skill::Stun => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }, - }, - ], - - - Skill::Amplify => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Amplify, duration: 2, meta: Some(EffectMeta::Multiplier(150)) }, - }, - ], - Skill::AmplifyPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Amplify, duration: 3, meta: Some(EffectMeta::Multiplier(175)) }, - }, - ], - Skill::AmplifyPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Amplify, duration: 4, meta: Some(EffectMeta::Multiplier(200)) }, - }, - ], - - Skill::Absorb => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Absorb, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::Absorption)) }, - }, - Action::Heal { - construct: self.target, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - colour: Colour::Blue, - }, - ], - Skill::AbsorbPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Absorb, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::AbsorptionPlus)) }, - }, - Action::Heal { - construct: self.target, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - colour: Colour::Blue, - }, - ], - Skill::AbsorbPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Absorb, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::AbsorptionPlusPlus)) }, - }, - Action::Heal { - construct: self.target, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - colour: Colour::Blue, - }, - ], - Skill::Absorption => vec![ - Action::Remove { - construct: self.source, - effect: Effect::Absorb, - }, - Action::Effect { - construct: self.source, - effect: ConstructEffect { effect: Effect::Absorption, duration: 3, meta: Some(EffectMeta::AddedDamage(0)) }, - }, - Action::SetEffectMeta { - construct: self.source, - effect: Effect::Absorption, - values: vec![Value::DamageReceived { construct: self.source, colour: Colour::Blue, mult: 100 }], - }, - ], - Skill::AbsorptionPlus => vec![ - Action::Remove { - construct: self.source, - effect: Effect::Absorb, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Absorption, duration: 4, meta: Some(EffectMeta::AddedDamage(0)) }, - }, - Action::SetEffectMeta { - construct: self.target, - effect: Effect::Absorption, - values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Blue, mult: 100 }], - }, - ], - Skill::AbsorptionPlusPlus => vec![ - Action::Remove { - construct: self.source, - effect: Effect::Absorb, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Absorption, duration: 5, meta: Some(EffectMeta::AddedDamage(0)) }, - }, - Action::SetEffectMeta { - construct: self.target, - effect: Effect::Absorption, - values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Blue, mult: 100 }], - }, - ], - -// fn absorb(source: &mut Construct, target: &mut Construct, skill: Skill) { -// game.event(Event::new(source, target).event(target.effect_remove(skill, skill.effect()[0]))); -// let blue_amount = source.blue_power().pct(skill.multiplier()); -// target.recharge(skill, 0, blue_amount) -// .into_iter() -// .for_each(|e| game.event(Event::new(source, target).event(e).stages(EventStages::PostOnly))); -// } - -// fn absorption(source: &mut Construct, target: &mut Construct, reflect_skill: Skill, amount: usize, skill: Skill) { -// let absorb = skill.effect()[0].set_meta(EffectMeta::AddedDamage(amount)); - -// game.event(Event::new(source, target) -// .event(target.effect_remove(reflect_skill, absorb)) -// .stages(EventStages::PostOnly)); - -// let absorb_index = target.effects.iter().position(|e| e.effect == Effect::Absorb).expect("No absorb"); -// let ce = target.effects.remove(absorb_index); - -// game.event(Event::new(source, target) -// .event(Event::Remove { skill, effect: Some(ce.effect), construct_effects: target.effects.clone() }) -// .stages(EventStages::PostOnly)); -// } + Skill::Amplify => amplify(self, game, events), + Skill::AmplifyPlus => amplify_plus(self, game, events), + Skill::AmplifyPlusPlus => amplify_plus_plus(self, game, events), + Skill::Absorb => absorb(self, game, events), + Skill::AbsorbPlus => absorb_plus(self, game, events), + Skill::AbsorbPlusPlus => absorb_plus_plus(self, game, events), + Skill::Absorption => absorption(self, game, events), + Skill::AbsorptionPlus => absorption_plus(self, game, events), + Skill::AbsorptionPlusPlus => absorption_plus_plus(self, game, events), Skill::Banish | Skill::BanishPlus | - Skill::BanishPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Red, - values: vec![Value::Stat { construct: self.target, stat: Stat::RedLife, mult: self.skill.multiplier() }], - }, - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.target, stat: Stat::BlueLife, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Banish, duration: 2, meta: None } - } - ], + Skill::BanishPlusPlus => banish(self, game, events), Skill::Bash | Skill::BashPlus | - Skill::BashPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Red, - values: vec![ - Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }, - Value::Cooldowns { construct: self.source, mult: 45 }, - ], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None } - }, - Action::IncreaseCooldowns { - construct: self.target, - turns: 1, - }, - ], + Skill::BashPlusPlus => bash(self, game, events), Skill::Blast | Skill::BlastPlus | - Skill::BlastPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - ], + Skill::BlastPlusPlus => blast(self, game, events), - Skill::Break => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Stun, duration: 1, meta: None }, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Vulnerable, duration: 3, meta: Some(EffectMeta::Multiplier(150)), }, - }, - ], - Skill::BreakPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Stun, duration: 1, meta: None }, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Vulnerable, duration: 4, meta: Some(EffectMeta::Multiplier(175)), }, - }, - ], - Skill::BreakPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Vulnerable, duration: 4, meta: Some(EffectMeta::Multiplier(200)), }, - }, - ], + Skill::Break => break_zero(self, game, events), + Skill::BreakPlus => break_plus(self, game, events), + Skill::BreakPlusPlus => break_plus_plus(self, game, events), - Skill::Curse => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Curse, duration: 2, meta: Some(EffectMeta::Multiplier(150)) }, - }, - ], - Skill::CursePlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Curse, duration: 2, meta: Some(EffectMeta::Multiplier(175)) }, - }, - ], - Skill::CursePlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Curse, duration: 3, meta: Some(EffectMeta::Multiplier(200)) }, - }, - ], + Skill::Curse => curse(self, game, events), + Skill::CursePlus => curse_plus(self, game, events), + Skill::CursePlusPlus => curse_plus_plus(self, game, events), Skill::Chaos | Skill::ChaosPlus | - Skill::ChaosPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Red, - values: vec![ - Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }, - Value::Stat { construct: self.source, stat: Stat::RedPower, mult: rng.gen_range(0, 30) }, - ], - }, - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![ - Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }, - Value::Stat { construct: self.source, stat: Stat::BluePower, mult: rng.gen_range(0, 30) }, - ], - }, - ], + Skill::ChaosPlusPlus => chaos(self, game, events), - Skill::Counter => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Counter, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::CounterAttack)) }, - }, - ], - Skill::CounterPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Counter, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::CounterAttackPlus)) }, - }, - ], - Skill::CounterPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Counter, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::CounterAttackPlusPlus)) }, - }, - ], + Skill::Counter => counter(self, game, events), + Skill::CounterPlus => counter_plus(self, game, events), + Skill::CounterPlusPlus => counter_plus_plus(self, game, events), Skill::CounterAttack | Skill::CounterAttackPlus | - Skill::CounterAttackPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Red, - values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }], - }, - ], + Skill::CounterAttackPlusPlus => counter_attack(self, game, events), - Skill::Decay => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(50)) }, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Decay, duration: 2, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::DecayTick }) }, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks - }, - ], - Skill::DecayPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(35)) }, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Decay, duration: 4, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::DecayTickPlus }) }, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks - }, - ], - Skill::DecayPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Wither, duration: 4, meta: Some(EffectMeta::Multiplier(20)) }, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Decay, duration: 4, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::DecayTickPlusPlus }) }, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks - }, - ], + Skill::Decay => decay(self, game, events), + Skill::DecayPlus => decay_plus(self, game, events), + Skill::DecayPlusPlus => decay_plus_plus(self, game, events), Skill::DecayTick | Skill::DecayTickPlus | - Skill::DecayTickPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks - }, - ], + Skill::DecayTickPlusPlus => decay_tick(self, game, events), - Skill::Electrify=> vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Electric, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::Electrocute)) }, - }, - ], - Skill::ElectrifyPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Electric, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::ElectrocutePlus)) }, - }, - ], - Skill::ElectrifyPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Electric, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::ElectrocutePlusPlus)) }, - }, - ], - Skill::Electrocute => vec![ - Action::Remove { - construct: self.source, - effect: Effect::Electric, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Electric, duration: 2, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::ElectrocuteTick }) }, - }, - ], - Skill::ElectrocutePlus => vec![ - Action::Remove { - construct: self.source, - effect: Effect::Electric, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Electric, duration: 3, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::ElectrocuteTickPlus }) }, - }, - ], - Skill::ElectrocutePlusPlus => vec![ - Action::Remove { - construct: self.source, - effect: Effect::Electric, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Electric, duration: 4, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::ElectrocuteTickPlusPlus }) }, - }, - ], + Skill::Electrify => electrify(self, game, events), + Skill::ElectrifyPlus => electrify_plus(self, game, events), + Skill::ElectrifyPlusPlus => electrify_plus_plus(self, game, events), + Skill::Electrocute => electrocute(self, game, events), + Skill::ElectrocutePlus => electrocute_plus(self, game, events), + Skill::ElectrocutePlusPlus => electrocute_plus_plus(self, game, events), Skill::ElectrocuteTick | Skill::ElectrocuteTickPlus | - Skill::ElectrocuteTickPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - ], + Skill::ElectrocuteTickPlusPlus => electrocute_tick(self, game, events), Skill::Heal | Skill::HealPlus | - Skill::HealPlusPlus => vec![ - Action::Heal { - construct: self.target, - colour: Colour::Green, - values: vec![Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }], - }, - ], + Skill::HealPlusPlus => heal(self, game, events), - Skill::Haste => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Haste, duration: 3, meta: Some(EffectMeta::Multiplier(150)) }, - }, - ], - Skill::HastePlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Haste, duration: 3, meta: Some(EffectMeta::Multiplier(175)) }, - }, - ], - Skill::HastePlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Haste, duration: 3, meta: Some(EffectMeta::Multiplier(225)) }, - }, - ], + Skill::Haste => haste(self, game, events), + Skill::HastePlus => haste_plus(self, game, events), + Skill::HastePlusPlus => haste_plus_plus(self, game, events), - Skill::HasteStrike => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Red, - values: vec![Value::Stat { construct: self.source, stat: Stat::Speed, mult: self.skill.multiplier() }], - }, - ], + Skill::HasteStrike => haste_strike(self, game, events), - Skill::Hybrid => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Hybrid, duration: 3, meta: Some(EffectMeta::Multiplier(150)) }, - }, - ], - Skill::HybridPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Hybrid, duration: 4, meta: Some(EffectMeta::Multiplier(175)) }, - }, - ], - Skill::HybridPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Hybrid, duration: 5, meta: Some(EffectMeta::Multiplier(200)) }, - }, - ], + Skill::Hybrid => hybrid(self, game, events), + Skill::HybridPlus => hybrid_plus(self, game, events), + Skill::HybridPlusPlus => hybrid_plus_plus(self, game, events), - Skill::HybridBlast => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }], - }, - ], + Skill::HybridBlast => hybrid_blast(self, game, events), Skill::Intercept | Skill::InterceptPlus | - Skill::InterceptPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Intercept, duration: 1, meta: None }, - }, - Action::Heal { - construct: self.target, - values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }], - colour: Colour::Red, - }, - ], + Skill::InterceptPlusPlus => intercept(self, game, events), - Skill::Invert => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Invert, duration: 2, meta: None }, - }, - ], - Skill::InvertPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Invert, duration: 3, meta: None }, - }, - ], - Skill::InvertPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Invert, duration: 4, meta: None }, - }, - ], + Skill::Invert => invert(self, game, events), + Skill::InvertPlus => invert_plus(self, game, events), + Skill::InvertPlusPlus => invert_plus_plus(self, game, events), Skill::Link | Skill::LinkPlus | - Skill::LinkPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Stun, duration: 1, meta: None }, - }, - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![ - Value::Effects { construct: self.target, mult: self.skill.multiplier() }, - ], - }, - ], + Skill::LinkPlusPlus => link(self, game, events), - Skill::Purge => vec![ - Action::RemoveAll { - construct: self.target, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Purge, duration: 2, meta: None } - }, - ], - Skill::PurgePlus => vec![ - Action::RemoveAll { - construct: self.target, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Purge, duration: 3, meta: None } - }, - ], - Skill::PurgePlusPlus => vec![ - Action::RemoveAll { - construct: self.target, - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Purge, duration: 4, meta: None } - }, - ], + Skill::Purge => purge(self, game, events), + Skill::PurgePlus => purge_plus(self, game, events), + Skill::PurgePlusPlus => purge_plus_plus(self, game, events), - Skill::Purify => vec![ - Action::RemoveAll { - construct: self.target, - }, - Action::Heal { - construct: self.target, - colour: Colour::Green, - values: vec![ - Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }, - Value::Removals { construct: self.target, mult: self.skill.multiplier() }, - ], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(150)) } - }, - ], - Skill::PurifyPlus => vec![ - Action::RemoveAll { - construct: self.target, - }, - Action::Heal { - construct: self.target, - colour: Colour::Green, - values: vec![ - Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }, - Value::Removals { construct: self.target, mult: self.skill.multiplier() }, - ], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(175)) } - }, - ], - Skill::PurifyPlusPlus => vec![ - Action::RemoveAll { - construct: self.target, - }, - Action::Heal { - construct: self.target, - colour: Colour::Green, - values: vec![ - Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }, - Value::Removals { construct: self.target, mult: self.skill.multiplier() }, - ], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(200)) } - }, - ], + Skill::Purify => purify(self, game, events), + Skill::PurifyPlus => purify_plus(self, game, events), + Skill::PurifyPlusPlus => purify_plus_plus(self, game, events), Skill::Recharge | Skill::RechargePlus | - Skill::RechargePlusPlus => vec![ - Action::Heal { - construct: self.target, - colour: Colour::Red, - values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }], - }, - Action::Heal { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - ], + Skill::RechargePlusPlus => recharge(self, game, events), Skill::Reflect | Skill::ReflectPlus | - Skill::ReflectPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Reflect, duration: 1, meta: None }, - }, - Action::Heal { - construct: self.target, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - colour: Colour::Blue, - }, - ], + Skill::ReflectPlusPlus => reflect(self, game, events), Skill::Restrict | Skill::RestrictPlus | - Skill::RestrictPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Restrict, duration: 2, meta: None } - }, - Action::Damage { - construct: self.target, - colour: Colour::Red, - values: vec![Value::ColourSkills { construct: self.source, colour: Colour::Red, mult: self.skill.multiplier() }], - }, - ], + Skill::RestrictPlusPlus => restrict(self, game, events), Skill::Ruin | Skill::RuinPlus | - Skill::RuinPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.target, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Stun, duration: 1, meta: None } - } - ], + Skill::RuinPlusPlus => ruin(self, game, events), - Skill::Siphon => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Siphon, duration: 2, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::SiphonTick }) }, - }, - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks - }, - Action::Heal { - construct: self.source, - colour: Colour::Green, - values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Blue, mult: 100 }], - }, - ], - Skill::SiphonPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Siphon, duration: 3, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::SiphonTickPlus }) }, - }, - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks - }, - Action::Heal { - construct: self.source, - colour: Colour::Green, - values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Blue, mult: 100 }], - }, - ], - Skill::SiphonPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Siphon, duration: 4, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::SiphonTickPlusPlus }) }, - }, - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks - }, - Action::Heal { - construct: self.source, - colour: Colour::Green, - values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Blue, mult: 100 }], - }, - ], + Skill::Siphon => siphon(self, game, events), + Skill::SiphonPlus => siphon_plus(self, game, events), + Skill::SiphonPlusPlus => siphon_plus_plus(self, game, events), Skill::SiphonTick | Skill::SiphonTickPlus | - Skill::SiphonTickPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Blue, - values: vec![Value::Stat { construct: self.source, stat: Stat::BluePower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks - }, - Action::Heal { - construct: self.source, - colour: Colour::Green, - values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Blue, mult: 100 }], - }, - ], + Skill::SiphonTickPlusPlus => siphon_tick(self, game, events), Skill::Slay | Skill::SlayPlus | - Skill::SlayPlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Red, - values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }], - }, - Action::Heal { - construct: self.source, - colour: Colour::Green, - values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Red, mult: 50 }], - }, - ], + Skill::SlayPlusPlus => slay(self, game, events), - Skill::Sleep => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }, - }, - Action::Heal { - construct: self.target, - values: vec![Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }], - colour: Colour::Blue, - }, - ], - Skill::SleepPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }, - }, - Action::Heal { - construct: self.target, - values: vec![Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }], - colour: Colour::Blue, - }, - ], - Skill::SleepPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }, - }, - Action::Heal { - construct: self.target, - values: vec![Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }], - colour: Colour::Blue, - }, - ], + Skill::Sleep => sleep(self, game, events), + Skill::SleepPlus => sleep_plus(self, game, events), + Skill::SleepPlusPlus => sleep_plus_plus(self, game, events), Skill::Silence | Skill::SilencePlus | - Skill::SilencePlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Silence, duration: 2, meta: None }, - }, - Action::Damage { - construct: self.target, - colour: Colour::Red, - values: vec![ - Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }, - Value::ColourSkills { construct: self.target, colour: Colour::Blue, mult: self.skill.multiplier() }, - ], - }, - ], + Skill::SilencePlusPlus => silence(self, game, events), Skill::Strike | Skill::StrikePlus | - Skill::StrikePlusPlus => vec![ - Action::Damage { - construct: self.target, - colour: Colour::Red, - values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }], - }, - ], + Skill::StrikePlusPlus => strike(self, game, events), Skill::Sustain | Skill::SustainPlus | - Skill::SustainPlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Sustain, duration: 1, meta: None }, - }, - Action::Heal { - construct: self.target, - values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }], - colour: Colour::Red, - }, - ], + Skill::SustainPlusPlus => sustain(self, game, events), - Skill::Triage => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Triage, duration: 2, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::TriageTick }) }, - }, - Action::Heal { - construct: self.target, - colour: Colour::Green, - values: vec![Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, - }, - ], - Skill::TriagePlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Triage, duration: 3, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::TriageTickPlus }) }, - }, - Action::Heal { - construct: self.target, - colour: Colour::Green, - values: vec![Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, - }, - ], - Skill::TriagePlusPlus => vec![ - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Triage, duration: 4, meta: - Some(EffectMeta::CastTick { source: self.source, target: self.target, skill: Skill::TriageTickPlusPlus }) }, - }, - Action::Heal { - construct: self.target, - colour: Colour::Green, - values: vec![Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, - }, - ], + Skill::Triage => triage(self, game, events), + Skill::TriagePlus => triage_plus(self, game, events), + Skill::TriagePlusPlus => triage_plus_plus(self, game, events), Skill::TriageTick | Skill::TriageTickPlus | - Skill::TriageTickPlusPlus => vec![ - Action::Heal { - construct: self.target, - colour: Colour::Green, - values: vec![Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }], - }, - Action::Effect { - construct: self.target, - effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, - }, - ], - - // _ => unimplemented!(), - _ => vec![], // for client testing + Skill::TriageTickPlusPlus => triage_tick(self, game, events), }; actions.append(&mut rest); @@ -1893,34 +1112,1099 @@ impl Skill { } } +fn attack(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Red, + values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], + }, + ] +} + +fn block(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Block, duration: 1, meta: Some(EffectMeta::Multiplier(35)) }, + }, + ] +} + +fn buff(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Buff, duration: 3, meta: Some(EffectMeta::Multiplier(130)) }, + }, + ] +} + +fn debuff(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Slow, duration: 3, meta: Some(EffectMeta::Multiplier(50)) }, + }, + ] +} + +fn stun(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }, + }, + ] +} + + +fn amplify(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Amplify, duration: 2, meta: Some(EffectMeta::Multiplier(150)) }, + }, + ] +} + +fn amplify_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Amplify, duration: 3, meta: Some(EffectMeta::Multiplier(175)) }, + }, + ] +} + +fn amplify_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Amplify, duration: 4, meta: Some(EffectMeta::Multiplier(200)) }, + }, + ] +} + +fn absorb(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Absorb, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::Absorption)) }, + }, + Action::Heal { + construct: cast.target, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + colour: Colour::Blue, + }, + ] +} + +fn absorb_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Absorb, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::AbsorptionPlus)) }, + }, + Action::Heal { + construct: cast.target, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + colour: Colour::Blue, + }, + ] +} + +fn absorb_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Absorb, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::AbsorptionPlusPlus)) }, + }, + Action::Heal { + construct: cast.target, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + colour: Colour::Blue, + }, + ] +} + +fn absorption(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Remove { + construct: cast.source, + effect: Effect::Absorb, + }, + Action::Effect { + construct: cast.source, + effect: ConstructEffect { effect: Effect::Absorption, duration: 3, meta: Some(EffectMeta::AddedDamage(0)) }, + }, + Action::SetEffectMeta { + construct: cast.source, + effect: Effect::Absorption, + values: vec![Value::DamageReceived { construct: cast.source, colour: Colour::Blue, mult: 100 }], + }, + ] +} + +fn absorption_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Remove { + construct: cast.source, + effect: Effect::Absorb, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Absorption, duration: 4, meta: Some(EffectMeta::AddedDamage(0)) }, + }, + Action::SetEffectMeta { + construct: cast.target, + effect: Effect::Absorption, + values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], + }, + ] +} + +fn absorption_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Remove { + construct: cast.source, + effect: Effect::Absorb, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Absorption, duration: 5, meta: Some(EffectMeta::AddedDamage(0)) }, + }, + Action::SetEffectMeta { + construct: cast.target, + effect: Effect::Absorption, + values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], + }, + ] +} + +fn banish(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Red, + values: vec![Value::Stat { construct: cast.target, stat: Stat::RedLife, mult: cast.skill.multiplier() }], + }, + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.target, stat: Stat::BlueLife, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Banish, duration: 2, meta: None } + } + ] +} + +fn bash(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Red, + values: vec![ + Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }, + Value::Cooldowns { construct: cast.source, mult: 45 }, + ], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None } + }, + Action::IncreaseCooldowns { + construct: cast.target, + turns: 1, + }, + ] +} + +fn blast(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + ] +} + +fn break_zero(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Stun, duration: 1, meta: None }, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Vulnerable, duration: 3, meta: Some(EffectMeta::Multiplier(150)), }, + }, + ] +} + +fn break_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Stun, duration: 1, meta: None }, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Vulnerable, duration: 4, meta: Some(EffectMeta::Multiplier(175)), }, + }, + ] +} + +fn break_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Vulnerable, duration: 4, meta: Some(EffectMeta::Multiplier(200)), }, + }, + ] +} + + +fn curse(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Curse, duration: 2, meta: Some(EffectMeta::Multiplier(150)) }, + }, + ] +} + +fn curse_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Curse, duration: 2, meta: Some(EffectMeta::Multiplier(175)) }, + }, + ] +} + +fn curse_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Curse, duration: 3, meta: Some(EffectMeta::Multiplier(200)) }, + }, + ] +} + + +fn chaos(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + let mut rng = thread_rng(); + + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Red, + values: vec![ + Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }, + Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: rng.gen_range(0, 30) }, + ], + }, + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![ + Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }, + Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: rng.gen_range(0, 30) }, + ], + }, + ] +} + +fn counter(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Counter, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::CounterAttack)) }, + }, + ] +} + +fn counter_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Counter, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::CounterAttackPlus)) }, + }, + ] +} + +fn counter_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Counter, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::CounterAttackPlusPlus)) }, + }, + ] +} + +fn counter_attack(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Red, + values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], + }, + ] +} + +fn decay(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(50)) }, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Decay, duration: 2, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTick }) }, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks + }, + ] +} + +fn decay_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(35)) }, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Decay, duration: 4, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTickPlus }) }, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks + }, + ] +} + +fn decay_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Wither, duration: 4, meta: Some(EffectMeta::Multiplier(20)) }, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Decay, duration: 4, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTickPlusPlus }) }, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks + }, + ] +} + +fn decay_tick(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks + }, + ] +} + +fn electrify(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Electric, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::Electrocute)) }, + }, + ] +} + +fn electrify_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Electric, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::ElectrocutePlus)) }, + }, + ] +} + +fn electrify_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Electric, duration: 1, meta: Some(EffectMeta::CastOnHit(Skill::ElectrocutePlusPlus)) }, + }, + ] +} + +fn electrocute(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Remove { + construct: cast.source, + effect: Effect::Electric, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Electric, duration: 2, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::ElectrocuteTick }) }, + }, + ] +} +fn electrocute_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Remove { + construct: cast.source, + effect: Effect::Electric, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Electric, duration: 3, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::ElectrocuteTickPlus }) }, + }, + ] +} + +fn electrocute_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Remove { + construct: cast.source, + effect: Effect::Electric, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Electric, duration: 4, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::ElectrocuteTickPlusPlus }) }, + }, + ] +} + +fn electrocute_tick(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + ] +} + +fn heal(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Heal { + construct: cast.target, + colour: Colour::Green, + values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], + }, + ] +} + +fn haste(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Haste, duration: 3, meta: Some(EffectMeta::Multiplier(150)) }, + }, + ] +} + +fn haste_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Haste, duration: 3, meta: Some(EffectMeta::Multiplier(175)) }, + }, + ] +} + +fn haste_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Haste, duration: 3, meta: Some(EffectMeta::Multiplier(225)) }, + }, + ] +} + +fn haste_strike(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Red, + values: vec![Value::Stat { construct: cast.source, stat: Stat::Speed, mult: cast.skill.multiplier() }], + }, + ] +} + +fn hybrid(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Hybrid, duration: 3, meta: Some(EffectMeta::Multiplier(150)) }, + }, + ] +} + +fn hybrid_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Hybrid, duration: 4, meta: Some(EffectMeta::Multiplier(175)) }, + }, + ] +} + +fn hybrid_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Hybrid, duration: 5, meta: Some(EffectMeta::Multiplier(200)) }, + }, + ] +} + +fn hybrid_blast(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], + }, + ] +} + +fn intercept(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Intercept, duration: 1, meta: None }, + }, + Action::Heal { + construct: cast.target, + values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], + colour: Colour::Red, + }, + ] +} + +fn invert(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Invert, duration: 2, meta: None }, + }, + ] +} + +fn invert_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Invert, duration: 3, meta: None }, + }, + ] +} + +fn invert_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Invert, duration: 4, meta: None }, + }, + ] +} + +fn link(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Stun, duration: 1, meta: None }, + }, + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![ + Value::Effects { construct: cast.target, mult: cast.skill.multiplier() }, + ], + }, + ] +} + +fn purge(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::RemoveAll { + construct: cast.target, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Purge, duration: 2, meta: None } + }, + ] +} + +fn purge_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::RemoveAll { + construct: cast.target, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Purge, duration: 3, meta: None } + }, + ] +} + +fn purge_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::RemoveAll { + construct: cast.target, + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Purge, duration: 4, meta: None } + }, + ] +} + +fn purify(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::RemoveAll { + construct: cast.target, + }, + Action::Heal { + construct: cast.target, + colour: Colour::Green, + values: vec![ + Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }, + Value::Removals { construct: cast.target, mult: cast.skill.multiplier() }, + ], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(150)) } + }, + ] +} + +fn purify_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::RemoveAll { + construct: cast.target, + }, + Action::Heal { + construct: cast.target, + colour: Colour::Green, + values: vec![ + Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }, + Value::Removals { construct: cast.target, mult: cast.skill.multiplier() }, + ], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(175)) } + }, + ] +} + +fn purify_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::RemoveAll { + construct: cast.target, + }, + Action::Heal { + construct: cast.target, + colour: Colour::Green, + values: vec![ + Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }, + Value::Removals { construct: cast.target, mult: cast.skill.multiplier() }, + ], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(200)) } + }, + ] +} + +fn recharge(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Heal { + construct: cast.target, + colour: Colour::Red, + values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], + }, + Action::Heal { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + ] +} + +fn reflect(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Reflect, duration: 1, meta: None }, + }, + Action::Heal { + construct: cast.target, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + colour: Colour::Blue, + }, + ] +} + +fn restrict(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Restrict, duration: 2, meta: None } + }, + Action::Damage { + construct: cast.target, + colour: Colour::Red, + values: vec![Value::ColourSkills { construct: cast.source, colour: Colour::Red, mult: cast.skill.multiplier() }], + }, + ] +} + + +fn ruin(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.target, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Stun, duration: 1, meta: None } + } + ] +} + + +fn siphon(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Siphon, duration: 2, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::SiphonTick }) }, + }, + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks + }, + Action::Heal { + construct: cast.source, + colour: Colour::Green, + values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], + }, + ] +} + +fn siphon_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Siphon, duration: 3, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::SiphonTickPlus }) }, + }, + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks + }, + Action::Heal { + construct: cast.source, + colour: Colour::Green, + values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], + }, + ] +} + +fn siphon_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Siphon, duration: 4, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::SiphonTickPlusPlus }) }, + }, + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks + }, + Action::Heal { + construct: cast.source, + colour: Colour::Green, + values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], + }, + ] +} + +fn siphon_tick(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Blue, + values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks + }, + Action::Heal { + construct: cast.source, + colour: Colour::Green, + values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], + }, + ] +} + +fn slay(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Red, + values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], + }, + Action::Heal { + construct: cast.source, + colour: Colour::Green, + values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Red, mult: 50 }], + }, + ] +} + +fn sleep(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }, + }, + Action::Heal { + construct: cast.target, + values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], + colour: Colour::Blue, + }, + ] +} + +fn sleep_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }, + }, + Action::Heal { + construct: cast.target, + values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], + colour: Colour::Blue, + }, + ] +} + +fn sleep_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }, + }, + Action::Heal { + construct: cast.target, + values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], + colour: Colour::Blue, + }, + ] +} + +fn silence(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Silence, duration: 2, meta: None }, + }, + Action::Damage { + construct: cast.target, + colour: Colour::Red, + values: vec![ + Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }, + Value::ColourSkills { construct: cast.target, colour: Colour::Blue, mult: cast.skill.multiplier() }, + ], + }, + ] +} + +fn strike(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Damage { + construct: cast.target, + colour: Colour::Red, + values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], + }, + ] +} + +fn sustain(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Sustain, duration: 1, meta: None }, + }, + Action::Heal { + construct: cast.target, + values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], + colour: Colour::Red, + }, + ] +} + +fn triage(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Triage, duration: 2, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::TriageTick }) }, + }, + Action::Heal { + construct: cast.target, + colour: Colour::Green, + values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, + }, + ] +} + +fn triage_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Triage, duration: 3, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::TriageTickPlus }) }, + }, + Action::Heal { + construct: cast.target, + colour: Colour::Green, + values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, + }, + ] +} + +fn triage_plus_plus(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Triage, duration: 4, meta: + Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::TriageTickPlusPlus }) }, + }, + Action::Heal { + construct: cast.target, + colour: Colour::Green, + values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, + }, + ] +} + +fn triage_tick(cast: &Cast, _game: &Game, _events: &Vec) -> Vec { + vec![ + Action::Heal { + construct: cast.target, + colour: Colour::Green, + values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], + }, + Action::Effect { + construct: cast.target, + effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, + }, + ] +} + // #[cfg(test)] mod tests { use skill::*; - #[test] - fn attack_actions_test() { - let cast = Cast::new(Uuid::new_v4(), Uuid::new_v4(), Uuid::new_v4(), Skill::Attack); - let actions = cast.actions(); + // #[test] + // fn attack_actions_test() { + // let cast = Cast::new(Uuid::new_v4(), Uuid::new_v4(), Uuid::new_v4(), Skill::Attack); + // let actions = cast.actions(Game::); - match actions[0] { - Action::Cast => (), - _ => panic!("{:?}", actions), - }; + // match actions[0] { + // Action::Cast => (), + // _ => panic!("{:?}", actions), + // }; - match actions[1] { - Action::Hit => (), - _ => panic!("{:?}", actions), - }; + // match actions[1] { + // Action::Hit => (), + // _ => panic!("{:?}", actions), + // }; - match actions[2] { - Action::Damage { construct: _, values: _, colour } => { - assert_eq!(colour, Colour::Red); - }, - _ => panic!("{:?}", actions), - }; + // match actions[2] { + // Action::Damage { construct: _, values: _, colour } => { + // assert_eq!(colour, Colour::Red); + // }, + // _ => panic!("{:?}", actions), + // }; - } + // } // #[test] // fn heal_test() {