removed empower, added skill placeholders change mults

This commit is contained in:
Mashy 2019-05-07 11:43:45 +10:00
parent cc82c3811c
commit 7913de7eb9
5 changed files with 204 additions and 132 deletions

View File

@ -2,8 +2,79 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## [0.0.0] - YYYY-MM-DD
### Added
### Fixed
### Changed
## [0.1.2] - YYYY-MM-DD
### Added
(Proposed changes not all impl)
New skill `Scatter `
Combines - Buff + BB
Links targets together so dmg taken is split
Recharge 140% source blue damage as blue life to target
New skill `Impurity`
Combines - Buff + GB
New buff that does the following -
Increase target green damage by 50%
Blue attacks do an additional blast equal to 20% source green damage
### Fixed
- Ruin sends a skill event so ruin only casts once, followed by debuffs
### Changed
- Removed Empower (Buff + RR) -> combined effect with amplify
- Amplify
Changed to Buff + RB (was Buff + BB)
Increases both red and blue power.
Red and blue attacks recharge red and blue life (to be impl)
- Attack
Multiplier changed 100% -> 80%
- Blast
Multiplier changed 130% -> 110%
- Chaos
Base Multiplier changed 50% -> 40%
RNG range changed from (0 - 20%) -> (0 - 30%)
Same dmg range but more RNG
- Haste
Changed to Buff + RG (was Buff + RB)
Buff causes target to deal an extra attack when using red attack base skills (strike / slay / chaos)
Extra attack does 25% source speed as red damage
- Heal
Changed multiplier 120% -> 130%
- Siphon
Multiplier changed 30% -> 40%
- Strangle
No longer provides immunity to source or target
Damage multiplier for strangle tick changed 30% -> 65%
- Strike
Change multipliers T1/T2/T3 (110/130/150 -> 90/110/130)
- Taunt
Changed to Buff + RR (was Buff + RG)
Now recharges 80% source red damage as red life to target
- Triage
Multiplier changed 65% -> 75%
## [Unreleased] ## [Unreleased]
## [0.1.1] - YYYY-MM-DD ## [0.1.1] - 2019-05-03
### Added ### Added
Event::Skill Event::Skill
needed to convey the use of skill which is followed by other events needed to convey the use of skill which is followed by other events
@ -43,7 +114,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
Cooldown changed 1T -> 2T Cooldown changed 1T -> 2T
Debuff duration increased 2T -> 3T Debuff duration increased 2T -> 3T
Snare Snare
Now also deals damage amount of 40% base blue damage Now also deals damage amount of 40% base red damage
This damage amount does 45% more damage per red skill blocked This damage amount does 45% more damage per red skill blocked
Maximum = (0.40)(1.35)*base_red_damage Maximum = (0.40)(1.35)*base_red_damage
Cooldown changed 1T -> 2T Cooldown changed 1T -> 2T

View File

@ -17,6 +17,7 @@ use cryp::{Cryp};
use skill::{Skill, Effect, Cast, Resolution, Event, resolve}; use skill::{Skill, Effect, Cast, Resolution, Event, resolve};
use player::{Player}; use player::{Player};
use instance::{instance_game_finished, global_game_finished}; use instance::{instance_game_finished, global_game_finished};
use util::{IntPct};
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)] #[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
pub enum Phase { pub enum Phase {
@ -944,7 +945,7 @@ mod tests {
.learn(Skill::TestBlock) .learn(Skill::TestBlock)
.learn(Skill::TestParry) .learn(Skill::TestParry)
.learn(Skill::TestSiphon) .learn(Skill::TestSiphon)
.learn(Skill::Empower) .learn(Skill::Amplify)
.learn(Skill::Stun) .learn(Skill::Stun)
.learn(Skill::Block); .learn(Skill::Block);
@ -956,7 +957,7 @@ mod tests {
.learn(Skill::TestBlock) .learn(Skill::TestBlock)
.learn(Skill::TestParry) .learn(Skill::TestParry)
.learn(Skill::TestSiphon) .learn(Skill::TestSiphon)
.learn(Skill::Empower) .learn(Skill::Amplify)
.learn(Skill::Stun) .learn(Skill::Stun)
.learn(Skill::Block); .learn(Skill::Block);
@ -1174,7 +1175,7 @@ mod tests {
// should not be stunned because of parry // should not be stunned because of parry
assert!(game.player_by_id(x_player.id).unwrap().cryps[0].is_stunned() == false); assert!(game.player_by_id(x_player.id).unwrap().cryps[0].is_stunned() == false);
// riposte // riposte
assert!(game.player_by_id(y_player.id).unwrap().cryps[0].green_life() == 768); assert!(game.player_by_id(y_player.id).unwrap().cryps[0].green_life() == (1024 - x_cryp.red_damage().pct(Skill::Riposte.multiplier())));
} }
#[test] #[test]
@ -1205,7 +1206,7 @@ mod tests {
assert!(game.skill_phase_finished()); assert!(game.skill_phase_finished());
game = game.resolve_phase_start(); game = game.resolve_phase_start();
game.resolved.remove(0);
let ruins = game.resolved let ruins = game.resolved
.into_iter() .into_iter()
.filter(|r| { .filter(|r| {

View File

@ -271,7 +271,7 @@ impl Instance {
fn next_round(&mut self) -> &mut Instance { fn next_round(&mut self) -> &mut Instance {
self.phase = InstancePhase::InProgress; self.phase = InstancePhase::InProgress;
self.phase_end = Utc::now() self.phase_end = Utc::now()
.checked_add_signed(Duration::seconds(120)) .checked_add_signed(Duration::seconds(12000))
.expect("could not set phase end"); .expect("could not set phase end");

View File

@ -36,57 +36,59 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio
// } // }
resolutions = match skill { resolutions = match skill {
Skill::Amplify => amplify(source, target, resolutions, Skill::Amplify), // increase magic damage Skill::Amplify => amplify(source, target, resolutions, skill), // increase magic damage
Skill::Attack => attack(source, target, resolutions, Skill::Attack), Skill::Attack => attack(source, target, resolutions, skill),
Skill::Banish => banish(source, target, resolutions, Skill::Banish), // TODO prevent all actions Skill::Banish => banish(source, target, resolutions, skill), // TODO prevent all actions
Skill::Blast => blast(source, target, resolutions, Skill::Blast), Skill::Blast => blast(source, target, resolutions, skill),
Skill::Block => block(source, target, resolutions, Skill::Block), Skill::Block => block(source, target, resolutions, skill),
Skill::Chaos => chaos(source, target, resolutions, Skill::Chaos), Skill::Chaos => chaos(source, target, resolutions, skill),
Skill::Clutch => clutch(source, target, resolutions, Skill::Clutch), Skill::Clutch => clutch(source, target, resolutions, skill),
Skill::Corrupt => corrupt(source, target, resolutions, Skill::Corrupt), Skill::Corrupt => corrupt(source, target, resolutions, skill),
Skill::CorruptionTick => corruption_tick(source, target, resolutions, Skill::CorruptionTick), Skill::CorruptionTick => corruption_tick(source, target, resolutions, skill),
Skill::Curse => curse(source, target, resolutions, Skill::Curse), Skill::Curse => curse(source, target, resolutions, skill),
Skill::Decay => decay(source, target, resolutions, Skill::Decay), // dot Skill::Decay => decay(source, target, resolutions, skill), // dot
Skill::DecayTick => decay_tick(source, target, resolutions, Skill::DecayTick), // dot Skill::DecayTick => decay_tick(source, target, resolutions, skill), // dot
Skill::Empower => empower(source, target, resolutions, Skill::Empower), // increased phys damage Skill::Haste => haste(source, target, resolutions, skill), // speed slow
Skill::Haste => haste(source, target, resolutions, Skill::Haste), // speed slow Skill::Heal => heal(source, target, resolutions, skill),
Skill::Heal => heal(source, target, resolutions, Skill::Heal), Skill::Hex => hex(source, target, resolutions, skill),
Skill::Hex => hex(source, target, resolutions, Skill::Hex), Skill::Hostility => hostility(source, target, resolutions, skill),
Skill::Hostility => hostility(source, target, resolutions, Skill::Hostility), Skill::Impurity => impurity(source, target, resolutions, skill),
Skill::Invert => invert(source, target, resolutions, Skill::Invert), Skill::Invert => invert(source, target, resolutions, skill),
Skill::Injure => injure(source, target, resolutions, Skill::Injure), Skill::Injure => injure(source, target, resolutions, skill),
Skill::Parry => parry(source, target, resolutions, Skill::Parry), Skill::Parry => parry(source, target, resolutions, skill),
Skill::Purge => purge(source, target, resolutions, Skill::Purge), // dispel all buffs Skill::Purge => purge(source, target, resolutions, skill), // dispel all buffs
Skill::Purify => purify(source, target, resolutions, Skill::Purify), // dispel all debuffs Skill::Purify => purify(source, target, resolutions, skill), // dispel all debuffs
Skill::Recharge => recharge(source, target, resolutions, Skill::Recharge), // target is immune to magic damage and fx Skill::Recharge => recharge(source, target, resolutions, skill), // target is immune to magic damage and fx
Skill::Reflect => reflect(source, target, resolutions, Skill::Reflect), Skill::Reflect => reflect(source, target, resolutions, skill),
Skill::Riposte => panic!("riposte should not be caste"), Skill::Riposte => panic!("riposte should not be caste"),
Skill::Ruin => ruin(source, target, resolutions, Skill::Ruin), Skill::Ruin => ruin(source, target, resolutions, skill),
Skill::Shield => shield(source, target, resolutions, Skill::Shield), // target is immune to magic damage and fx Skill::Scatter => scatter(source, target, resolutions, skill), // target is immune to magic damage and fx
Skill::Silence => silence(source, target, resolutions, Skill::Silence), // target cannot cast spells Skill::Silence => silence(source, target, resolutions, skill), // target cannot cast spells
Skill::Siphon => siphon(source, target, resolutions, Skill::Siphon), Skill::Siphon => siphon(source, target, resolutions, skill),
Skill::SiphonTick => siphon_tick(source, target, resolutions, Skill::SiphonTick), // hot Skill::SiphonTick => siphon_tick(source, target, resolutions, skill), // hot
Skill::Slay => slay(source, target, resolutions, Skill::Slay), // hybrid dmg self heal Skill::Slay => slay(source, target, resolutions, skill), // hybrid dmg self heal
Skill::Sleep => sleep(source, target, resolutions, Skill::Sleep), // speed slow Skill::Sleep => sleep(source, target, resolutions, skill), // speed slow
Skill::Slow => slow(source, target, resolutions, Skill::Slow), // speed slow Skill::Slow => slow(source, target, resolutions, skill), // speed slow
Skill::Snare => snare(source, target, resolutions, Skill::Snare), Skill::Snare => snare(source, target, resolutions, skill),
Skill::Strangle => strangle(source, target, resolutions, Skill::Strangle), Skill::Strangle => strangle(source, target, resolutions, skill),
Skill::StrangleTick => strangle_tick(source, target, resolutions, Skill::StrangleTick), Skill::StrangleTick => strangle_tick(source, target, resolutions, skill),
Skill::Strike => strike(source, target, resolutions, Skill::Strike), Skill::Strike => strike(source, target, resolutions, skill),
Skill::StrikeII => strike(source, target, resolutions, Skill::StrikeII), Skill::StrikeII => strike(source, target, resolutions, skill),
Skill::StrikeIII => strike(source, target, resolutions, Skill::StrikeIII), Skill::StrikeIII => strike(source, target, resolutions, skill),
Skill::Stun => stun(source, target, resolutions, Skill::Stun), Skill::Stun => stun(source, target, resolutions, skill),
Skill::Taunt => taunt(source, target, resolutions, Skill::Taunt), Skill::Taunt => taunt(source, target, resolutions, skill),
Skill::Throw => throw(source, target, resolutions, Skill::Throw), // no damage stun, adds vulnerable Skill::Throw => throw(source, target, resolutions, skill), // no damage stun, adds vulnerable
Skill::Triage => triage(source, target, resolutions, Skill::Triage), // hot Skill::Triage => triage(source, target, resolutions, skill), // hot
Skill::TriageTick => triage_tick(source, target, resolutions, Skill::TriageTick), // hot Skill::TriageTick => triage_tick(source, target, resolutions, skill), // hot
// ----------------- // -----------------
// Test // Test
// ----------------- // -----------------
Skill::TestTouch => touch(source, target, resolutions, Skill::TestTouch), Skill::TestAttack => attack(source, target, resolutions, skill),
Skill::TestHeal => heal(source, target, resolutions, skill),
Skill::TestTouch => touch(source, target, resolutions, skill),
Skill::TestStun => stun(source, target, resolutions, Skill::Stun), Skill::TestStun => stun(source, target, resolutions, Skill::Stun),
Skill::TestBlock => block(source, target, resolutions, Skill::Block), Skill::TestBlock => block(source, target, resolutions, Skill::Block),
Skill::TestParry => parry(source, target, resolutions, Skill::Parry), Skill::TestParry => parry(source, target, resolutions, Skill::Parry),
@ -237,9 +239,8 @@ pub enum Effect {
Reflect, Reflect,
Empower,
Taunt, Taunt,
Impurity,
Invert, Invert,
Strangle, Strangle,
Strangling, Strangling,
@ -268,7 +269,7 @@ pub enum Effect {
Hatred, Hatred,
// magic immunity // magic immunity
Shield, Scatter,
// effects over time // effects over time
Triage, Triage,
@ -290,17 +291,11 @@ impl Effect {
Category::Red => true, Category::Red => true,
_ => false, _ => false,
}, },
Effect::Shield => match skill.category() { Effect::Scatter => match skill.category() {
Category::Blue => true, Category::Blue => true,
Category::Red => false, Category::Red => false,
_ => false, _ => false,
}, },
Effect::Strangle => skill != Skill::StrangleTick,
Effect::Strangling => match skill.category() {
Category::BlueTick => false,
Category::RedTick => false,
_ => true,
},
Effect::Banish => true, Effect::Banish => true,
Effect::Injured => match skill.category() { Effect::Injured => match skill.category() {
Category::Green => true, Category::Green => true,
@ -341,15 +336,15 @@ impl Effect {
pub fn modifications(&self) -> Vec<Stat> { pub fn modifications(&self) -> Vec<Stat> {
match self { match self {
Effect::Empower => vec![Stat::RedDamage],
Effect::Vulnerable => vec![Stat::RedDamageTaken], Effect::Vulnerable => vec![Stat::RedDamageTaken],
Effect::Block => vec![Stat::RedDamageTaken], Effect::Block => vec![Stat::RedDamageTaken],
Effect::Hatred => vec![Stat::RedDamage, Stat::BlueDamage], Effect::Hatred => vec![Stat::RedDamage, Stat::BlueDamage],
Effect::Amplify => vec![Stat::BlueDamage], Effect::Amplify => vec![Stat::RedDamage, Stat::BlueDamage],
Effect::Curse => vec![Stat::BlueDamageTaken], Effect::Curse => vec![Stat::BlueDamageTaken],
Effect::Impurity => vec![Stat::GreenDamage],
Effect::Wither => vec![Stat::GreenDamageTaken], Effect::Wither => vec![Stat::GreenDamageTaken],
Effect::Haste => vec![Stat::Speed], Effect::Haste => vec![Stat::Speed],
@ -361,7 +356,6 @@ impl Effect {
pub fn apply(&self, value: u64, meta: Option<EffectMeta>) -> u64 { pub fn apply(&self, value: u64, meta: Option<EffectMeta>) -> u64 {
match self { match self {
Effect::Empower => value << 1,
Effect::Vulnerable => value << 1, Effect::Vulnerable => value << 1,
Effect::Block => value >> 1, Effect::Block => value >> 1,
@ -371,6 +365,7 @@ impl Effect {
Effect::Haste => value << 1, Effect::Haste => value << 1,
Effect::Slow => value >> 1, Effect::Slow => value >> 1,
Effect::Impurity => value << 1,
Effect::Wither => value >> 1, Effect::Wither => value >> 1,
Effect::Hatred => value + match meta { Effect::Hatred => value + match meta {
@ -402,7 +397,6 @@ impl Effect {
Effect::Snare => Category::Debuff, Effect::Snare => Category::Debuff,
Effect::Clutch => Category::Buff, Effect::Clutch => Category::Buff,
Effect::Taunt => Category::Buff, Effect::Taunt => Category::Buff,
Effect::Empower => Category::Buff,
Effect::Injured => Category::Debuff, Effect::Injured => Category::Debuff,
Effect::Strangle => Category::Debuff, Effect::Strangle => Category::Debuff,
Effect::Strangling => Category::Buff, Effect::Strangling => Category::Buff,
@ -427,8 +421,9 @@ impl Effect {
Effect::Hostility => Category::Buff, Effect::Hostility => Category::Buff,
// magic immunity // magic
Effect::Shield => Category::Buff, Effect::Impurity => Category::Buff,
Effect::Scatter => Category::Buff,
Effect::Invert => Category::Buff, Effect::Invert => Category::Buff,
// effects over time // effects over time
@ -485,6 +480,7 @@ pub enum Skill {
Sleep, Sleep,
Clutch, Clutch,
Taunt, Taunt,
Impurity,
Invert, Invert,
Strangle, Strangle,
@ -527,8 +523,7 @@ pub enum Skill {
// ----------------- // -----------------
// Purity // Purity
// ----------------- // -----------------
Empower, Scatter,
Shield,
Silence, Silence,
Purify, Purify,
Purge, Purge,
@ -542,8 +537,10 @@ pub enum Skill {
Haste, Haste,
Slow, Slow,
// used by tests, no cd, no damage // used by tests, no cd, 100% multiplier
TestTouch, TestAttack,
TestHeal,
TestTouch, // No damage
TestStun, TestStun,
TestBlock, TestBlock,
TestParry, TestParry,
@ -554,14 +551,15 @@ impl Skill {
pub fn multiplier(&self) -> u64 { pub fn multiplier(&self) -> u64 {
match self { match self {
// Attack Base // Attack Base
Skill::Attack => 100, // 1.0 to pass tests Skill::Attack => 80, // Base
Skill::Blast => 130, // BB Skill::Blast => 110, // BB
Skill::Chaos => 50, // BR Skill::Chaos => 40, // BR
Skill::Heal => 120, //GG Skill::Heal => 130, //GG
Skill::SiphonTick => 40, // GB
Skill::Slay => 70, // RG Skill::Slay => 70, // RG
Skill::Strike => 110, //RR Skill::Strike => 90, //RR
Skill::StrikeII => 130, Skill::StrikeII => 110,
Skill::StrikeIII => 150, Skill::StrikeIII => 130,
// Block Base // Block Base
Skill::Purify => 45, //Green dmg (heal) Skill::Purify => 45, //Green dmg (heal)
@ -570,18 +568,18 @@ impl Skill {
// Stun Base // Stun Base
Skill::Sleep => 240, //Green dmg (heal) Skill::Sleep => 240, //Green dmg (heal)
Skill::StrangleTick => 65,
// Debuff Base // Debuff Base
Skill::Silence => 55, // Deals more per blue skill on target Skill::Silence => 55, // Deals more per blue skill on target
Skill::Snare => 40, // Deals more per blue skill on target Skill::Snare => 40, // Deals more per red skill on target
// Buff base
Skill::TriageTick => 75,
// Others // Others
Skill::CorruptionTick => 80, Skill::CorruptionTick => 80,
Skill::DecayTick => 25, Skill::DecayTick => 25,
Skill::Riposte => 100, Skill::Riposte => 70,
Skill::SiphonTick => 30,
Skill::StrangleTick => 30,
Skill::TriageTick => 65,
_ => 100, _ => 100,
} }
} }
@ -605,7 +603,7 @@ impl Skill {
Skill::Snare => 3, Skill::Snare => 3,
Skill::Taunt => 1, Skill::Taunt => 1,
Skill::Empower => 2, Skill::Impurity => 3,
Skill::Invert => 1, Skill::Invert => 1,
Skill::Hex => 2, Skill::Hex => 2,
@ -622,7 +620,7 @@ impl Skill {
Skill::Hostility => 2, // Primary Buff Skill::Hostility => 2, // Primary Buff
Skill::Corrupt => 2, // Primary Buff Skill::Corrupt => 2, // Primary Buff
Skill::Shield => 2, Skill::Scatter => 2,
Skill::Triage => 3, Skill::Triage => 3,
Skill::Decay => 3, Skill::Decay => 3,
@ -668,14 +666,14 @@ impl Skill {
Skill::Blast => None, Skill::Blast => None,
Skill::Chaos => None, Skill::Chaos => None,
Skill::Amplify => Some(1), Skill::Amplify => Some(1),
Skill::Impurity => Some(3),
Skill::Invert => Some(2), Skill::Invert => Some(2),
Skill::Decay => Some(1), // dot Skill::Decay => Some(1), // dot
Skill::DecayTick => None, Skill::DecayTick => None,
Skill::Siphon => None, Skill::Siphon => None,
Skill::SiphonTick => None, Skill::SiphonTick => None,
Skill::Curse => Some(1), Skill::Curse => Some(1),
Skill::Empower => Some(1), Skill::Scatter => Some(2),
Skill::Shield => None,
Skill::Silence => Some(2), Skill::Silence => Some(2),
Skill::Purify => None, Skill::Purify => None,
Skill::Purge => None, Skill::Purge => None,
@ -703,6 +701,8 @@ impl Skill {
// ----------------- // -----------------
// Test // Test
// ----------------- // -----------------
Skill::TestAttack => None,
Skill::TestHeal => None,
Skill::TestTouch => None, Skill::TestTouch => None,
Skill::TestStun => None, Skill::TestStun => None,
Skill::TestBlock => None, Skill::TestBlock => None,
@ -733,15 +733,15 @@ impl Skill {
Skill::Triage => Category::Green, // hot Skill::Triage => Category::Green, // hot
Skill::TriageTick => Category::GreenTick, // hot Skill::TriageTick => Category::GreenTick, // hot
Skill::Throw => Category::Green, Skill::Throw => Category::Green,
Skill::Empower => Category::Green,
Skill::Shield => Category::Green,
Skill::Purify => Category::Green, Skill::Purify => Category::Green,
Skill::Recharge => Category::Green, Skill::Recharge => Category::Green,
Skill::Reflect => Category::Green, Skill::Reflect => Category::Green,
Skill::Haste => Category::Green, Skill::Haste => Category::Green,
Skill::Impurity => Category::Green,
Skill::Invert => Category::Green, Skill::Invert => Category::Green,
Skill::Sleep => Category::Green, Skill::Sleep => Category::Green,
Skill::Scatter => Category::Blue,
Skill::Blast => Category::Blue, Skill::Blast => Category::Blue,
Skill::Chaos => Category::Blue, Skill::Chaos => Category::Blue,
Skill::Amplify => Category::Blue, Skill::Amplify => Category::Blue,
@ -764,6 +764,8 @@ impl Skill {
// Test // Test
// ----------------- // -----------------
Skill::TestAttack => Category::Red,
Skill::TestHeal => Category::Green,
Skill::TestTouch => Category::Red, Skill::TestTouch => Category::Red,
Skill::TestStun => Category::Red, Skill::TestStun => Category::Red,
Skill::TestParry => Category::Red, Skill::TestParry => Category::Red,
@ -834,11 +836,10 @@ impl Skill {
match self { match self {
Skill::Heal | Skill::Heal |
Skill::Triage | Skill::Triage |
Skill::Empower |
Skill::Purify | Skill::Purify |
Skill::Parry | Skill::Parry |
Skill::Clutch | Skill::Clutch |
Skill::Shield | Skill::Scatter |
Skill::Recharge | Skill::Recharge |
Skill::Reflect | Skill::Reflect |
Skill::Haste | Skill::Haste |
@ -1003,12 +1004,6 @@ fn snare(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill:
return results; return results;
} }
fn empower(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
let empower = CrypEffect::new(Effect::Empower, skill.duration());
results.push(Resolution::new(source, target).event(target.add_effect(skill, empower)));
return results;
}
fn slay(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn slay(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
let amount = source.red_damage().pct(skill.multiplier()); let amount = source.red_damage().pct(skill.multiplier());
let slay_events = target.deal_red_damage(skill, amount); let slay_events = target.deal_red_damage(skill, amount);
@ -1055,12 +1050,12 @@ fn triage_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, s
fn chaos(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn chaos(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
let mut rng = thread_rng(); let mut rng = thread_rng();
let b_rng: u64 = rng.gen_range(0, 20); let b_rng: u64 = rng.gen_range(0, 30);
let amount = source.blue_damage().pct(skill.multiplier() + b_rng); let amount = source.blue_damage().pct(skill.multiplier() + b_rng);
target.deal_blue_damage(skill, amount) target.deal_blue_damage(skill, amount)
.into_iter() .into_iter()
.for_each(|e| results.push(Resolution::new(source, target).event(e))); .for_each(|e| results.push(Resolution::new(source, target).event(e)));
let r_rng: u64 = rng.gen_range(0, 20); let r_rng: u64 = rng.gen_range(0, 30);
let amount = source.red_damage().pct(skill.multiplier() + r_rng); let amount = source.red_damage().pct(skill.multiplier() + r_rng);
target.deal_red_damage(skill, amount) target.deal_red_damage(skill, amount)
.into_iter() .into_iter()
@ -1137,6 +1132,7 @@ fn corruption_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolution
} }
fn ruin(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn ruin(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
// results.push(Resolution::new(source, target).event(Event::Skill { skill }));
let effect = CrypEffect::new(Effect::Ruin, skill.duration()); let effect = CrypEffect::new(Effect::Ruin, skill.duration());
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect))); results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
return results;; return results;;
@ -1169,6 +1165,12 @@ fn curse(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill:
return results;; return results;;
} }
fn impurity(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
let effect = CrypEffect::new(Effect::Impurity, skill.duration());
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
return results;;
}
fn invert(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn invert(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
let effect = CrypEffect::new(Effect::Invert, skill.duration()); let effect = CrypEffect::new(Effect::Invert, skill.duration());
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect))); results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
@ -1221,9 +1223,9 @@ fn siphon_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, s
return results; return results;
} }
fn shield(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn scatter(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
let shield = CrypEffect::new(Effect::Shield, skill.duration()); let scatter = CrypEffect::new(Effect::Scatter, skill.duration());
results.push(Resolution::new(source, target).event(target.add_effect(skill, shield))); results.push(Resolution::new(source, target).event(target.add_effect(skill, scatter)));
return results; return results;
} }
@ -1331,7 +1333,7 @@ mod tests {
block(&mut y.clone(), &mut y, vec![], Skill::Block); block(&mut y.clone(), &mut y, vec![], Skill::Block);
assert!(y.effects.iter().any(|e| e.effect == Effect::Block)); assert!(y.effects.iter().any(|e| e.effect == Effect::Block));
let mut results = attack(&mut x, &mut y, vec![], Skill::Attack); let mut results = attack(&mut x, &mut y, vec![], Skill::TestAttack);
let Resolution { source: _, target: _, event } = results.remove(0); let Resolution { source: _, target: _, event } = results.remove(0);
match event { match event {
@ -1388,31 +1390,29 @@ mod tests {
y.red_life.force(64); y.red_life.force(64);
y.red_life.reduce(64); y.red_life.reduce(64);
x.red_damage.force(256 + 64); x.red_damage.force(256 + 64);
let damage: u64 = x.red_damage().pct(Skill::Attack.multiplier()); // 320 * 1.0
let healing: u64 = x.green_damage().pct(Skill::Heal.multiplier()); // 256 * 1.2
invert(&mut y.clone(), &mut y, vec![], Skill::Invert); invert(&mut y.clone(), &mut y, vec![], Skill::Invert);
assert!(y.affected(Effect::Invert)); assert!(y.affected(Effect::Invert));
// heal should deal green damage // heal should deal green damage
heal(&mut x, &mut y, vec![], Skill::Heal); heal(&mut x, &mut y, vec![], Skill::TestHeal);
assert!(y.green_life() == (1024 - healing)); assert!(y.green_life() == 768);
// attack should heal and recharge red shield // attack should heal and recharge red shield
let mut results = attack(&mut x, &mut y, vec![], Skill::Attack); let mut results = attack(&mut x, &mut y, vec![], Skill::TestAttack);
assert!(y.green_life() == 1024); assert!(y.green_life() == 1024);
match results.remove(0).event { match results.remove(0).event {
Event::Inversion { skill } => assert_eq!(skill, Skill::Attack), Event::Inversion { skill } => assert_eq!(skill, Skill::TestAttack),
_ => panic!("not inversion"), _ => panic!("not inversion"),
}; };
match results.remove(0).event { match results.remove(0).event {
Event::Healing { skill: _, overhealing: _, amount } => assert_eq!(amount, healing), Event::Healing { skill: _, overhealing: _, amount } => assert_eq!(amount, 256),
_ => panic!("not healing from inversion"), _ => panic!("not healing from inversion"),
}; };
match results.remove(0).event { match results.remove(0).event {
Event::Recharge { skill: _, red, blue: _ } => assert_eq!(red, (damage - healing)), Event::Recharge { skill: _, red, blue: _ } => assert_eq!(red, 64),
_ => panic!("not recharge from inversion"), _ => panic!("not recharge from inversion"),
}; };
} }
@ -1429,13 +1429,13 @@ mod tests {
assert!(y.affected(Effect::Reflect)); assert!(y.affected(Effect::Reflect));
let mut results = vec![]; let mut results = vec![];
results = resolve(Skill::Attack, &mut x, &mut y, results); results = resolve(Skill::TestAttack, &mut x, &mut y, results);
assert!(x.green_life() == 768); assert!(x.green_life() == 768);
let Resolution { source: _, target: _, event } = results.remove(0); let Resolution { source: _, target: _, event } = results.remove(0);
match event { match event {
Event::Reflection { skill } => assert_eq!(skill, Skill::Attack), Event::Reflection { skill } => assert_eq!(skill, Skill::TestAttack),
_ => panic!("not reflection"), _ => panic!("not reflection"),
}; };
@ -1511,11 +1511,11 @@ mod tests {
hostility(&mut y.clone(), &mut y, vec![], Skill::Hostility); hostility(&mut y.clone(), &mut y, vec![], Skill::Hostility);
assert!(y.affected(Effect::Hostility)); assert!(y.affected(Effect::Hostility));
resolve(Skill::Attack, &mut x, &mut y, vec![]); resolve(Skill::TestAttack, &mut x, &mut y, vec![]);
assert!(y.affected(Effect::Hatred)); assert!(y.affected(Effect::Hatred));
let mut results = resolve(Skill::Attack, &mut y, &mut x, vec![]); let mut results = resolve(Skill::TestAttack, &mut y, &mut x, vec![]);
let Resolution { source: _, target: _, event } = results.remove(0); let Resolution { source: _, target: _, event } = results.remove(0);
match event { match event {

View File

@ -70,11 +70,11 @@ pub enum Var {
Corrupt, Corrupt,
Curse, Curse,
Decay, Decay,
Empower,
Hostility, Hostility,
Haste, Haste,
Heal, Heal,
Hex, Hex,
Impurity,
Invert, Invert,
Parry, Parry,
Purge, Purge,
@ -82,7 +82,7 @@ pub enum Var {
Reflect, Reflect,
Recharge, Recharge,
Ruin, Ruin,
Shield, Scatter,
Silence, Silence,
Slay, Slay,
Sleep, Sleep,
@ -197,11 +197,11 @@ impl Var {
Var::Chaos => Some(Skill::Chaos), Var::Chaos => Some(Skill::Chaos),
Var::Curse => Some(Skill::Curse), Var::Curse => Some(Skill::Curse),
Var::Decay => Some(Skill::Decay), Var::Decay => Some(Skill::Decay),
Var::Empower => Some(Skill::Empower),
Var::Haste => Some(Skill::Haste), Var::Haste => Some(Skill::Haste),
Var::Heal => Some(Skill::Heal), Var::Heal => Some(Skill::Heal),
Var::Hex => Some(Skill::Hex), Var::Hex => Some(Skill::Hex),
Var::Hostility => Some(Skill::Hostility), Var::Hostility => Some(Skill::Hostility),
Var::Impurity => Some(Skill::Impurity),
Var::Invert => Some(Skill::Invert), Var::Invert => Some(Skill::Invert),
Var::Parry => Some(Skill::Parry), Var::Parry => Some(Skill::Parry),
Var::Purge => Some(Skill::Purge), Var::Purge => Some(Skill::Purge),
@ -209,7 +209,7 @@ impl Var {
Var::Recharge => Some(Skill::Recharge), Var::Recharge => Some(Skill::Recharge),
Var::Reflect => Some(Skill::Reflect), Var::Reflect => Some(Skill::Reflect),
Var::Ruin => Some(Skill::Ruin), Var::Ruin => Some(Skill::Ruin),
Var::Shield => Some(Skill::Shield), Var::Scatter => Some(Skill::Scatter),
Var::Silence => Some(Skill::Silence), Var::Silence => Some(Skill::Silence),
Var::Slay => Some(Skill::Slay), Var::Slay => Some(Skill::Slay),
Var::Sleep => Some(Skill::Sleep), Var::Sleep => Some(Skill::Sleep),
@ -273,11 +273,11 @@ impl From<Skill> for Var {
Skill::Curse => Var::Curse, Skill::Curse => Var::Curse,
Skill::Clutch => Var::Clutch, Skill::Clutch => Var::Clutch,
Skill::Decay => Var::Decay, Skill::Decay => Var::Decay,
Skill::Empower => Var::Empower,
Skill::Haste => Var::Haste, Skill::Haste => Var::Haste,
Skill::Hostility => Var::Hostility, Skill::Hostility => Var::Hostility,
Skill::Heal => Var::Heal, Skill::Heal => Var::Heal,
Skill::Hex => Var::Hex, Skill::Hex => Var::Hex,
Skill::Impurity => Var::Impurity,
Skill::Invert => Var::Invert, Skill::Invert => Var::Invert,
Skill::Parry => Var::Parry, Skill::Parry => Var::Parry,
Skill::Purge => Var::Purge, Skill::Purge => Var::Purge,
@ -285,7 +285,7 @@ impl From<Skill> for Var {
Skill::Recharge => Var::Recharge, Skill::Recharge => Var::Recharge,
Skill::Reflect => Var::Reflect, Skill::Reflect => Var::Reflect,
Skill::Ruin => Var::Ruin, Skill::Ruin => Var::Ruin,
Skill::Shield => Var::Shield, Skill::Scatter => Var::Scatter,
Skill::Silence => Var::Silence, Skill::Silence => Var::Silence,
Skill::Siphon => Var::Siphon, Skill::Siphon => Var::Siphon,
Skill::Slay => Var::Slay, Skill::Slay => Var::Slay,
@ -352,21 +352,21 @@ pub struct Combo {
fn get_combos() -> Vec<Combo> { fn get_combos() -> Vec<Combo> {
let mut combinations = vec![ let mut combinations = vec![
Combo { units: vec![Var::Buff, Var::Red, Var::Red], var: Var::Empower }, // Gereric red dmg buff Combo { units: vec![Var::Buff, Var::Red, Var::Red], var: Var::Taunt }, // Add red recharge
Combo { units: vec![Var::Buff, Var::Green, Var::Green], var: Var::Triage }, Combo { units: vec![Var::Buff, Var::Green, Var::Green], var: Var::Triage },
Combo { units: vec![Var::Buff, Var::Blue, Var::Blue], var: Var::Amplify }, // Gereric blue dmg buff Combo { units: vec![Var::Buff, Var::Blue, Var::Blue], var: Var::Scatter }, // To be impl - link targets + recharge blue shield
Combo { units: vec![Var::Buff, Var::Red, Var::Green], var: Var::Taunt }, Combo { units: vec![Var::Buff, Var::Red, Var::Green], var: Var::Haste }, // To be reworked
Combo { units: vec![Var::Buff, Var::Green, Var::Blue], var: Var::Curse }, // Needs a buff Combo { units: vec![Var::Buff, Var::Green, Var::Blue], var: Var::Impurity }, // To be added
Combo { units: vec![Var::Buff, Var::Red, Var::Blue], var: Var::Haste }, // Needs a buff Combo { units: vec![Var::Buff, Var::Red, Var::Blue], var: Var::Amplify }, // Red and blue damage buff
Combo { units: vec![Var::Debuff, Var::Red, Var::Red], var: Var::Snare }, // disable red and dmg Combo { units: vec![Var::Debuff, Var::Red, Var::Red], var: Var::Snare },
Combo { units: vec![Var::Debuff, Var::Green, Var::Green], var: Var::Purge }, // disable green and remove debuff Combo { units: vec![Var::Debuff, Var::Green, Var::Green], var: Var::Purge }, // make it disable green
Combo { units: vec![Var::Debuff, Var::Blue, Var::Blue], var: Var::Silence }, // disable blue and dmg Combo { units: vec![Var::Debuff, Var::Blue, Var::Blue], var: Var::Silence },
Combo { units: vec![Var::Debuff, Var::Red, Var::Green], var: Var::Slow }, // Needs a buff Combo { units: vec![Var::Debuff, Var::Red, Var::Green], var: Var::Curse }, // To be reworked
Combo { units: vec![Var::Debuff, Var::Green, Var::Blue], var: Var::Decay }, Combo { units: vec![Var::Debuff, Var::Green, Var::Blue], var: Var::Decay },
Combo { units: vec![Var::Debuff, Var::Red, Var::Blue], var: Var::Invert }, Combo { units: vec![Var::Debuff, Var::Red, Var::Blue], var: Var::Invert },
Combo { units: vec![Var::Block, Var::Red, Var::Red], var: Var::Parry }, Combo { units: vec![Var::Block, Var::Red, Var::Red], var: Var::Parry }, // Add red recharge
Combo { units: vec![Var::Block, Var::Green, Var::Green], var: Var::Purify }, Combo { units: vec![Var::Block, Var::Green, Var::Green], var: Var::Purify },
Combo { units: vec![Var::Block, Var::Blue, Var::Blue], var: Var::Corrupt }, Combo { units: vec![Var::Block, Var::Blue, Var::Blue], var: Var::Corrupt },
Combo { units: vec![Var::Block, Var::Red, Var::Green], var: Var::Clutch }, Combo { units: vec![Var::Block, Var::Red, Var::Green], var: Var::Clutch },