This commit is contained in:
ntr 2019-12-13 13:51:27 +10:00
parent b1f03a0981
commit 416ec01b77
2 changed files with 194 additions and 212 deletions

View File

@ -544,24 +544,14 @@ impl Game {
Action::Cast => vec![self.cast(cast)], Action::Cast => vec![self.cast(cast)],
Action::Hit => vec![self.hit(cast)], Action::Hit => vec![self.hit(cast)],
Action::Damage { construct, values, colour } => { Action::Damage { construct, amount, colour } => self.damage(construct, amount, colour),
let amount = self.reduce_values(&values, &events); Action::Heal { construct, amount, colour } => self.heal(construct, amount, colour),
self.damage(construct, amount, colour)
},
Action::Heal { construct, values, colour } => {
let amount = self.reduce_values(&values, &events);
self.heal(construct, amount, colour)
},
Action::Effect { construct, effect } => self.effect(construct, effect), Action::Effect { construct, effect } => self.effect(construct, effect),
Action::Remove { construct, effect } => self.effect_remove(construct, effect), Action::Remove { construct, effect } => self.effect_remove(construct, effect),
Action::RemoveAll { construct } => self.remove_all(construct), Action::RemoveAll { construct } => self.remove_all(construct),
Action::IncreaseCooldowns { construct, turns } => self.increase_cooldowns(construct, turns), Action::IncreaseCooldowns { construct, turns } => self.increase_cooldowns(construct, turns),
Action::SetEffectMeta { construct, values, effect } => { Action::SetEffectMeta { construct, amount, effect } => self.effect_meta(construct, effect, amount),
let amount = self.reduce_values(&values, &events);
self.effect_meta(construct, effect, amount)
}
}; };
// this event is now considered to have happened // this event is now considered to have happened
@ -597,46 +587,41 @@ impl Game {
self self
} }
fn reduce_values(&mut self, values: &Vec<Value>, events: &Vec<Event>) -> usize { pub fn value(&self, value: Value, events: &Vec<Event>) -> usize {
values.iter() match value {
.fold(0, |total, value| { Value::Stat { construct, stat } =>
total + match value { self.construct(construct).stat(stat),
Value::Stat { construct, stat, mult } =>
self.construct_by_id(*construct).unwrap().stat(*stat).pct(*mult),
Value::Fixed { value } => *value, Value::Cooldowns { construct } =>
self.construct(construct).stat(Stat::Cooldowns),
Value::Cooldowns { construct, mult } => Value::Effects { construct } =>
self.construct_by_id(*construct).unwrap().stat(Stat::Cooldowns).pct(*mult), self.construct(construct).stat(Stat::EffectsCount),
Value::Effects { construct, mult } => Value::ColourSkills { construct, colour } =>
self.construct_by_id(*construct).unwrap().stat(Stat::EffectsCount).pct(*mult), self.construct(construct).stat(Stat::Skills(colour)),
Value::ColourSkills { construct, colour, mult } => Value::DamageReceived { construct, colour } =>
self.construct_by_id(*construct).unwrap().stat(Stat::Skills(*colour)).pct(*mult), events.iter().fold(0, |dmg, e| match e {
Event::Damage { construct: event_construct, amount, mitigation:_, colour: event_colour, display: _ } =>
match construct == *event_construct && colour == *event_colour {
true => dmg + amount,
false => dmg,
}
_ => dmg,
}),
Value::DamageReceived { construct, colour, mult } => Value::Removals { construct } =>
events.iter().fold(0, |dmg, e| match e { events.iter().fold(0, |dmg, e| match e {
Event::Damage { construct: event_construct, amount, mitigation:_, colour: event_colour, display: _ } => Event::Damage { construct: event_construct, amount, mitigation:_, colour: event_colour, display: _ } =>
match *construct == *event_construct && *colour == *event_colour { match construct == *event_construct {
true => dmg + amount.pct(*mult), true => dmg + amount,
false => dmg, false => dmg,
} }
_ => dmg, _ => dmg,
}), }),
// Skills { construct: Uuid, colour: Colour },
Value::Removals { construct, mult } => }
events.iter().fold(0, |dmg, e| match e {
Event::Damage { construct: event_construct, amount, mitigation:_, colour: event_colour, display: _ } =>
match *construct == *event_construct {
true => dmg + amount.pct(*mult),
false => dmg,
}
_ => dmg,
}),
// Skills { construct: Uuid, colour: Colour },
}
})
} }
fn cast(&mut self, cast: Cast) -> Event { fn cast(&mut self, cast: Cast) -> Event {
@ -827,12 +812,11 @@ pub enum Colour {
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)] #[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
pub enum Value { pub enum Value {
Stat { construct: Uuid, stat: Stat, mult: usize }, Stat { construct: Uuid, stat: Stat },
Fixed { value: usize }, Cooldowns { construct: Uuid },
Cooldowns { construct: Uuid, mult: usize }, ColourSkills { construct: Uuid, colour: Colour },
ColourSkills { construct: Uuid, colour: Colour, mult: usize }, Effects { construct: Uuid },
Effects { construct: Uuid, mult: usize }, Removals { construct: Uuid },
Removals { construct: Uuid, mult: usize },
DamageReceived { construct: Uuid, colour: Colour, mult: usize }, DamageReceived { construct: Uuid, colour: Colour, mult: usize },
} }
@ -840,13 +824,13 @@ pub enum Value {
pub enum Action { pub enum Action {
Hit, Hit,
Cast, Cast,
Heal { construct: Uuid, values: Vec<Value>, colour: Colour }, Heal { construct: Uuid, amount: usize, colour: Colour },
Damage { construct: Uuid, values: Vec<Value>, colour: Colour }, Damage { construct: Uuid, amount: usize, colour: Colour },
Effect { construct: Uuid, effect: ConstructEffect }, Effect { construct: Uuid, effect: ConstructEffect },
Remove { construct: Uuid, effect: Effect }, Remove { construct: Uuid, effect: Effect },
RemoveAll { construct: Uuid }, RemoveAll { construct: Uuid },
IncreaseCooldowns { construct: Uuid, turns: usize }, IncreaseCooldowns { construct: Uuid, turns: usize },
SetEffectMeta { construct: Uuid, values: Vec<Value>, effect: Effect }, SetEffectMeta { construct: Uuid, amount: usize, effect: Effect },
} }
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)] #[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]

View File

@ -1112,17 +1112,17 @@ impl Skill {
} }
} }
fn attack(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn attack(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::RedPower }, events).pct(cast.skill.multiplier()),
}, },
] ]
} }
fn block(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn block(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1131,7 +1131,7 @@ fn block(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn buff(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn buff(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1140,7 +1140,7 @@ fn buff(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn debuff(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn debuff(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1149,7 +1149,7 @@ fn debuff(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn stun(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn stun(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1159,7 +1159,7 @@ fn stun(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
} }
fn amplify(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn amplify(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1168,7 +1168,7 @@ fn amplify(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn amplify_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn amplify_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1177,7 +1177,7 @@ fn amplify_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action>
] ]
} }
fn amplify_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn amplify_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1186,7 +1186,7 @@ fn amplify_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Act
] ]
} }
fn absorb(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn absorb(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1194,13 +1194,13 @@ fn absorb(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
}, },
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
colour: Colour::Blue, colour: Colour::Blue,
}, },
] ]
} }
fn absorb_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn absorb_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1208,13 +1208,13 @@ fn absorb_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
}, },
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
colour: Colour::Blue, colour: Colour::Blue,
}, },
] ]
} }
fn absorb_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn absorb_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1222,13 +1222,13 @@ fn absorb_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Acti
}, },
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
colour: Colour::Blue, colour: Colour::Blue,
}, },
] ]
} }
fn absorption(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn absorption(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Remove { Action::Remove {
construct: cast.source, construct: cast.source,
@ -1241,12 +1241,12 @@ fn absorption(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::SetEffectMeta { Action::SetEffectMeta {
construct: cast.source, construct: cast.source,
effect: Effect::Absorption, effect: Effect::Absorption,
values: vec![Value::DamageReceived { construct: cast.source, colour: Colour::Blue, mult: 100 }], amount: game.value(Value::DamageReceived { construct: cast.source, colour: Colour::Blue }, events).pct(100),
}, },
] ]
} }
fn absorption_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn absorption_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Remove { Action::Remove {
construct: cast.source, construct: cast.source,
@ -1259,12 +1259,12 @@ fn absorption_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Actio
Action::SetEffectMeta { Action::SetEffectMeta {
construct: cast.target, construct: cast.target,
effect: Effect::Absorption, effect: Effect::Absorption,
values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], amount: game.value(Value::DamageReceived { construct: cast.target, colour: Colour::Blue }, events).pct(100),
}, },
] ]
} }
fn absorption_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn absorption_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Remove { Action::Remove {
construct: cast.source, construct: cast.source,
@ -1277,22 +1277,22 @@ fn absorption_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<
Action::SetEffectMeta { Action::SetEffectMeta {
construct: cast.target, construct: cast.target,
effect: Effect::Absorption, effect: Effect::Absorption,
values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], amount: game.value(Value::DamageReceived { construct: cast.target, colour: Colour::Blue }, events),
}, },
] ]
} }
fn banish(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn banish(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![Value::Stat { construct: cast.target, stat: Stat::RedLife, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.target, stat: Stat::RedLife }, events).pct(cast.skill.multiplier()),
}, },
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.target, stat: Stat::BlueLife, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.target, stat: Stat::BlueLife }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1301,15 +1301,16 @@ fn banish(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn bash(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn bash(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
let cds = game.value(Value::Cooldowns { construct: cast.source }, events);
let red_power = game.value(Value::Stat { construct: cast.source, stat: Stat::RedPower }, events);
let amount = red_power.pct(cast.skill.multiplier().pct(100 + 45usize.saturating_mul(cds)));
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![ amount,
Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() },
Value::Cooldowns { construct: cast.source, mult: 45 },
],
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1322,17 +1323,17 @@ fn bash(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn blast(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn blast(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
] ]
} }
fn break_zero(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn break_zero(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1345,7 +1346,7 @@ fn break_zero(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn break_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn break_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1358,7 +1359,7 @@ fn break_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn break_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn break_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1372,7 +1373,7 @@ fn break_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Actio
} }
fn curse(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn curse(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1381,7 +1382,7 @@ fn curse(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn curse_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn curse_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1390,7 +1391,7 @@ fn curse_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn curse_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn curse_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1400,30 +1401,25 @@ fn curse_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Actio
} }
fn chaos(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn chaos(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
let mut rng = thread_rng(); let mut rng = thread_rng();
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![ amount:
Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }, game.value(Value::Stat { construct: cast.source, stat: Stat::RedPower }, events).pct(cast.skill.multiplier() + rng.gen_range(0, 30))
Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: rng.gen_range(0, 30) },
],
}, },
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![ amount:
Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }, game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier() + rng.gen_range(0, 30))
Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: rng.gen_range(0, 30) },
],
}, },
] ]
} }
fn counter(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn counter(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1432,7 +1428,7 @@ fn counter(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn counter_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn counter_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1441,7 +1437,7 @@ fn counter_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action>
] ]
} }
fn counter_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn counter_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1450,22 +1446,22 @@ fn counter_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Act
] ]
} }
fn counter_attack(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn counter_attack(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::RedPower }, events).pct(cast.skill.multiplier()),
}, },
] ]
} }
fn decay(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn decay(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1483,12 +1479,12 @@ fn decay(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn decay_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn decay_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1506,12 +1502,12 @@ fn decay_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn decay_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn decay_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1529,12 +1525,12 @@ fn decay_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Actio
] ]
} }
fn decay_tick(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn decay_tick(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1543,7 +1539,7 @@ fn decay_tick(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn electrify(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn electrify(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1552,7 +1548,7 @@ fn electrify(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn electrify_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn electrify_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1561,7 +1557,7 @@ fn electrify_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action
] ]
} }
fn electrify_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn electrify_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1570,7 +1566,7 @@ fn electrify_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<A
] ]
} }
fn electrocute(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn electrocute(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Remove { Action::Remove {
construct: cast.source, construct: cast.source,
@ -1583,7 +1579,7 @@ fn electrocute(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
}, },
] ]
} }
fn electrocute_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn electrocute_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Remove { Action::Remove {
construct: cast.source, construct: cast.source,
@ -1597,7 +1593,7 @@ fn electrocute_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Acti
] ]
} }
fn electrocute_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn electrocute_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Remove { Action::Remove {
construct: cast.source, construct: cast.source,
@ -1611,27 +1607,27 @@ fn electrocute_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec
] ]
} }
fn electrocute_tick(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn electrocute_tick(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
] ]
} }
fn heal(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn heal(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
colour: Colour::Green, colour: Colour::Green,
values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events).pct(cast.skill.multiplier()),
}, },
] ]
} }
fn haste(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn haste(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1640,7 +1636,7 @@ fn haste(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn haste_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn haste_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1649,7 +1645,7 @@ fn haste_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn haste_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn haste_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1658,17 +1654,17 @@ fn haste_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Actio
] ]
} }
fn haste_strike(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn haste_strike(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![Value::Stat { construct: cast.source, stat: Stat::Speed, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::Speed }, events).pct(cast.skill.multiplier()),
}, },
] ]
} }
fn hybrid(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn hybrid(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1677,7 +1673,7 @@ fn hybrid(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn hybrid_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn hybrid_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1686,7 +1682,7 @@ fn hybrid_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn hybrid_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn hybrid_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1695,17 +1691,17 @@ fn hybrid_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Acti
] ]
} }
fn hybrid_blast(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn hybrid_blast(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events).pct(cast.skill.multiplier()),
}, },
] ]
} }
fn intercept(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn intercept(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1713,13 +1709,13 @@ fn intercept(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
}, },
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::RedPower }, events).pct(cast.skill.multiplier()),
colour: Colour::Red, colour: Colour::Red,
}, },
] ]
} }
fn invert(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn invert(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1728,7 +1724,7 @@ fn invert(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn invert_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn invert_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1737,7 +1733,7 @@ fn invert_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn invert_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn invert_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1746,7 +1742,7 @@ fn invert_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Acti
] ]
} }
fn link(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn link(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1755,14 +1751,12 @@ fn link(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![ amount: game.value(Value::Effects { construct: cast.target }, events).pct(cast.skill.multiplier()),
Value::Effects { construct: cast.target, mult: cast.skill.multiplier() },
],
}, },
] ]
} }
fn purge(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn purge(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::RemoveAll { Action::RemoveAll {
construct: cast.target, construct: cast.target,
@ -1774,7 +1768,7 @@ fn purge(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn purge_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn purge_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::RemoveAll { Action::RemoveAll {
construct: cast.target, construct: cast.target,
@ -1786,7 +1780,7 @@ fn purge_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn purge_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn purge_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::RemoveAll { Action::RemoveAll {
construct: cast.target, construct: cast.target,
@ -1798,7 +1792,11 @@ fn purge_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Actio
] ]
} }
fn purify(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn purify(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
let gp = game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events);
let rms = game.value(Value::Removals { construct: cast.target }, events);
let amount = gp.pct(cast.skill.multiplier().saturating_mul(rms));
vec![ vec![
Action::RemoveAll { Action::RemoveAll {
construct: cast.target, construct: cast.target,
@ -1806,10 +1804,7 @@ fn purify(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
colour: Colour::Green, colour: Colour::Green,
values: vec![ amount,
Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() },
Value::Removals { construct: cast.target, mult: cast.skill.multiplier() },
],
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1818,7 +1813,11 @@ fn purify(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn purify_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn purify_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
let gp = game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events);
let rms = game.value(Value::Removals { construct: cast.target }, events);
let amount = gp.pct(cast.skill.multiplier().saturating_mul(rms));
vec![ vec![
Action::RemoveAll { Action::RemoveAll {
construct: cast.target, construct: cast.target,
@ -1826,10 +1825,7 @@ fn purify_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
colour: Colour::Green, colour: Colour::Green,
values: vec![ amount,
Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() },
Value::Removals { construct: cast.target, mult: cast.skill.multiplier() },
],
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1838,7 +1834,11 @@ fn purify_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn purify_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn purify_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
let gp = game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events);
let rms = game.value(Value::Removals { construct: cast.target }, events);
let amount = gp.pct(cast.skill.multiplier().saturating_mul(rms));
vec![ vec![
Action::RemoveAll { Action::RemoveAll {
construct: cast.target, construct: cast.target,
@ -1846,10 +1846,7 @@ fn purify_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Acti
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
colour: Colour::Green, colour: Colour::Green,
values: vec![ amount,
Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() },
Value::Removals { construct: cast.target, mult: cast.skill.multiplier() },
],
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1858,22 +1855,22 @@ fn purify_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Acti
] ]
} }
fn recharge(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn recharge(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::RedPower }, events).pct(cast.skill.multiplier()),
}, },
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
] ]
} }
fn reflect(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn reflect(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1881,13 +1878,13 @@ fn reflect(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
}, },
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
colour: Colour::Blue, colour: Colour::Blue,
}, },
] ]
} }
fn restrict(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn restrict(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1896,18 +1893,18 @@ fn restrict(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![Value::ColourSkills { construct: cast.source, colour: Colour::Red, mult: cast.skill.multiplier() }], amount: game.value(Value::ColourSkills { construct: cast.source, colour: Colour::Red }, events).pct(cast.skill.multiplier()),
}, },
] ]
} }
fn ruin(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn ruin(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.target, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.target, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1917,7 +1914,7 @@ fn ruin(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
} }
fn siphon(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn siphon(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1927,7 +1924,7 @@ fn siphon(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1936,12 +1933,12 @@ fn siphon(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Heal { Action::Heal {
construct: cast.source, construct: cast.source,
colour: Colour::Green, colour: Colour::Green,
values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], amount: game.value(Value::DamageReceived { construct: cast.target, colour: Colour::Blue }, events).pct(100),
}, },
] ]
} }
fn siphon_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn siphon_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1951,7 +1948,7 @@ fn siphon_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1960,12 +1957,12 @@ fn siphon_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Heal { Action::Heal {
construct: cast.source, construct: cast.source,
colour: Colour::Green, colour: Colour::Green,
values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], amount: game.value(Value::DamageReceived { construct: cast.target, colour: Colour::Blue }, events).pct(100),
}, },
] ]
} }
fn siphon_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn siphon_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1975,7 +1972,7 @@ fn siphon_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Acti
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -1984,17 +1981,17 @@ fn siphon_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Acti
Action::Heal { Action::Heal {
construct: cast.source, construct: cast.source,
colour: Colour::Green, colour: Colour::Green,
values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], amount: game.value(Value::DamageReceived { construct: cast.target, colour: Colour::Blue }, events).pct(100),
}, },
] ]
} }
fn siphon_tick(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn siphon_tick(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Blue, colour: Colour::Blue,
values: vec![Value::Stat { construct: cast.source, stat: Stat::BluePower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2003,27 +2000,27 @@ fn siphon_tick(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Heal { Action::Heal {
construct: cast.source, construct: cast.source,
colour: Colour::Green, colour: Colour::Green,
values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Blue, mult: 100 }], amount: game.value(Value::DamageReceived { construct: cast.target, colour: Colour::Blue }, events).pct(100),
}, },
] ]
} }
fn slay(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn slay(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::RedPower }, events).pct(cast.skill.multiplier()),
}, },
Action::Heal { Action::Heal {
construct: cast.source, construct: cast.source,
colour: Colour::Green, colour: Colour::Green,
values: vec![Value::DamageReceived { construct: cast.target, colour: Colour::Red, mult: 50 }], amount: game.value(Value::DamageReceived { construct: cast.target, colour: Colour::Red, mult: 50 }, events),
}, },
] ]
} }
fn sleep(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn sleep(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2031,13 +2028,13 @@ fn sleep(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
}, },
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events).pct(cast.skill.multiplier()),
colour: Colour::Blue, colour: Colour::Blue,
}, },
] ]
} }
fn sleep_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn sleep_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2045,13 +2042,13 @@ fn sleep_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
}, },
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events).pct(cast.skill.multiplier()),
colour: Colour::Blue, colour: Colour::Blue,
}, },
] ]
} }
fn sleep_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn sleep_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2059,13 +2056,17 @@ fn sleep_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Actio
}, },
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events).pct(cast.skill.multiplier()),
colour: Colour::Blue, colour: Colour::Blue,
}, },
] ]
} }
fn silence(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn silence(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
let bp = game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events);
let silences = game.value(Value::ColourSkills { construct: cast.target, colour: Colour::Blue }, events);
let amount = bp.pct(45usize.saturating_mul(silences));
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2074,25 +2075,22 @@ fn silence(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![ amount,
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<Event>) -> Vec<Action> { fn strike(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
colour: Colour::Red, colour: Colour::Red,
values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::RedPower }, events).pct(cast.skill.multiplier()),
}, },
] ]
} }
fn sustain(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn sustain(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2100,13 +2098,13 @@ fn sustain(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
}, },
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
values: vec![Value::Stat { construct: cast.source, stat: Stat::RedPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::RedPower }, events).pct(cast.skill.multiplier()),
colour: Colour::Red, colour: Colour::Red,
}, },
] ]
} }
fn triage(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn triage(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2116,7 +2114,7 @@ fn triage(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
colour: Colour::Green, colour: Colour::Green,
values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2125,7 +2123,7 @@ fn triage(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn triage_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn triage_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2135,7 +2133,7 @@ fn triage_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
colour: Colour::Green, colour: Colour::Green,
values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2144,7 +2142,7 @@ fn triage_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> {
] ]
} }
fn triage_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn triage_plus_plus(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2154,7 +2152,7 @@ fn triage_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Acti
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
colour: Colour::Green, colour: Colour::Green,
values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2163,12 +2161,12 @@ fn triage_plus_plus(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Acti
] ]
} }
fn triage_tick(cast: &Cast, _game: &Game, _events: &Vec<Event>) -> Vec<Action> { fn triage_tick(cast: &Cast, game: &Game, events: &Vec<Event>) -> Vec<Action> {
vec![ vec![
Action::Heal { Action::Heal {
construct: cast.target, construct: cast.target,
colour: Colour::Green, colour: Colour::Green,
values: vec![Value::Stat { construct: cast.source, stat: Stat::GreenPower, mult: cast.skill.multiplier() }], amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }, events).pct(cast.skill.multiplier()),
}, },
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
@ -2198,7 +2196,7 @@ mod tests {
// }; // };
// match actions[2] { // match actions[2] {
// Action::Damage { construct: _, values: _, colour } => { // Action::Damage { construct: _, amount: _, colour } => {
// assert_eq!(colour, Colour::Red); // assert_eq!(colour, Colour::Red);
// }, // },
// _ => panic!("{:?}", actions), // _ => panic!("{:?}", actions),