recharge
This commit is contained in:
parent
616a4b23cb
commit
c452a4cd92
@ -257,12 +257,12 @@ class ItemList extends Phaser.Scene {
|
||||
} return false;
|
||||
};
|
||||
|
||||
this.add.text(ITEM_WIDTH * 11, ITEM_HEIGHT * 1.1, 'Scoreboard', TEXT.HEADER);
|
||||
scores.forEach(([name, score], i) => {
|
||||
const SCORE_X = ITEM_WIDTH * 11;
|
||||
const SCORE_Y = ITEM_HEIGHT * 1.1 * (i + 2);
|
||||
this.add.text(SCORE_X, SCORE_Y, `${score.wins} - ${score.losses} | ${name}`, TEXT.NORMAL);
|
||||
});
|
||||
// this.add.text(ITEM_WIDTH * 11, ITEM_HEIGHT * 1.1, 'Scoreboard', TEXT.HEADER);
|
||||
// scores.forEach(([name, score], i) => {
|
||||
// const SCORE_X = ITEM_WIDTH * 11;
|
||||
// const SCORE_Y = ITEM_HEIGHT * 1.1 * (i + 2);
|
||||
// this.add.text(SCORE_X, SCORE_Y, `${score.wins} - ${score.losses} | ${name}`, TEXT.NORMAL);
|
||||
// });
|
||||
|
||||
// Add Handlers
|
||||
this.input.on('dragstart', (pointer, item) => {
|
||||
|
||||
@ -17,6 +17,16 @@
|
||||
## NOW
|
||||
cryp vbox
|
||||
ensure all skills impl
|
||||
Skill::Reflect -> reflect incoming attacks back to opponent
|
||||
Skill::Ruin -> aoe stun
|
||||
Skill::Slay -> red attack with bonus somethingorother for blue
|
||||
Skill::Strangle -> stun + dot
|
||||
Skill::Clutch -> cannot go below 1hp
|
||||
Skill::Taunt -> redirect incomnig attacks to self
|
||||
Skill::Toxic -> apply debuff to attackers
|
||||
|
||||
recharge
|
||||
|
||||
make parry semi-aggressive
|
||||
constants
|
||||
change to ownership pattern
|
||||
|
||||
@ -425,6 +425,27 @@ impl Cryp {
|
||||
self.hp.value
|
||||
}
|
||||
|
||||
pub fn recharge(&mut self) -> ResolutionResult {
|
||||
let immunity = self.immune(Skill::Recharge);
|
||||
let immune = immunity.immune;
|
||||
|
||||
if immune {
|
||||
ResolutionResult::Recharge {
|
||||
red: 0,
|
||||
blue: 0,
|
||||
immunity: immunity.clone(),
|
||||
};
|
||||
}
|
||||
|
||||
let red = self.red_shield.max.saturating_sub(self.red_shield.value);
|
||||
self.red_shield.value = self.red_shield.max;
|
||||
|
||||
let blue = self.blue_shield.max.saturating_sub(self.blue_shield.value);
|
||||
self.blue_shield.value = self.blue_shield.max;
|
||||
|
||||
ResolutionResult::Recharge { red, blue, immunity }
|
||||
}
|
||||
|
||||
pub fn heal(&mut self, skill: Skill, amount: u64) -> ResolutionResult {
|
||||
let immunity = self.immune(skill);
|
||||
let immune = immunity.immune;
|
||||
@ -433,7 +454,6 @@ impl Cryp {
|
||||
ResolutionResult::Healing {
|
||||
amount: 0,
|
||||
overhealing: 0,
|
||||
category: Category::RedHeal,
|
||||
immunity: immunity.clone(),
|
||||
};
|
||||
}
|
||||
@ -461,7 +481,6 @@ impl Cryp {
|
||||
return ResolutionResult::Healing {
|
||||
amount: healing,
|
||||
overhealing,
|
||||
category: Category::RedHeal,
|
||||
immunity,
|
||||
};
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ impl Game {
|
||||
cast.resolution.speed, source.name, cast.skill, target.name, amount, mitigation)),
|
||||
}
|
||||
},
|
||||
ResolutionResult::Healing { amount, overhealing, category: _, immunity } => {
|
||||
ResolutionResult::Healing { amount, overhealing, immunity } => {
|
||||
match immunity.immune {
|
||||
true => self.log.push(format!("[{:}] {:} {:?} {:} immune {:?}",
|
||||
cast.resolution.speed, source.name, cast.skill, target.name, immunity.effects)),
|
||||
@ -398,6 +398,14 @@ impl Game {
|
||||
cast.resolution.speed, source.name, target.name, effect)),
|
||||
}
|
||||
},
|
||||
ResolutionResult::Recharge { red, blue, immunity } => {
|
||||
match immunity.immune {
|
||||
true => self.log.push(format!("[{:}] {:} {:?} {:} immune {:?}",
|
||||
cast.resolution.speed, source.name, cast.skill, target.name, immunity.effects)),
|
||||
false => self.log.push(format!("[{:}] {:} {:?} {:} {:}R {:}B",
|
||||
cast.resolution.speed, source.name, cast.skill, target.name, red, blue)),
|
||||
}
|
||||
},
|
||||
ResolutionResult::Evasion { skill: _, evasion_rating } => {
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} evaded ({:}%)",
|
||||
cast.resolution.speed, source.name, cast.skill, target.name, evasion_rating));
|
||||
|
||||
@ -61,7 +61,8 @@ impl Disable {
|
||||
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
||||
pub enum ResolutionResult {
|
||||
Damage { amount: u64, mitigation: u64, category: Category , immunity: Immunity },
|
||||
Healing { amount: u64, overhealing: u64, category: Category , immunity: Immunity },
|
||||
Healing { amount: u64, overhealing: u64, immunity: Immunity },
|
||||
Recharge { red: u64, blue: u64, immunity: Immunity },
|
||||
Effect { effect: Effect, duration: u8, immunity: Immunity },
|
||||
Removal { effect: Effect, immunity: Immunity },
|
||||
Evasion { skill: Skill, evasion_rating: u64 },
|
||||
@ -291,14 +292,12 @@ impl Effect {
|
||||
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
||||
pub enum Category {
|
||||
Red,
|
||||
RedHeal,
|
||||
RedDamage,
|
||||
RedDebuff,
|
||||
RedBuff,
|
||||
RedTick,
|
||||
Blue,
|
||||
BlueDamage,
|
||||
BlueHeal,
|
||||
BlueDebuff,
|
||||
BlueBuff,
|
||||
BlueTick,
|
||||
@ -316,6 +315,14 @@ pub enum Skill {
|
||||
Parry, // avoid all damage
|
||||
Snare,
|
||||
|
||||
Recharge,
|
||||
Reflect,
|
||||
Ruin,
|
||||
Slay,
|
||||
Strangle,
|
||||
Clutch,
|
||||
Taunt,
|
||||
Toxic,
|
||||
|
||||
Strike,
|
||||
Stun,
|
||||
@ -373,33 +380,14 @@ impl Skill {
|
||||
match self {
|
||||
Skill::Attack => None,
|
||||
Skill::Strike => None,
|
||||
|
||||
// -----------------
|
||||
// Nature
|
||||
// -----------------
|
||||
Skill::Block => None, // reduce damage
|
||||
Skill::Parry => None, // avoid all damage
|
||||
Skill::Snare => Some(1),
|
||||
|
||||
|
||||
|
||||
Skill::Stun => Some(1),
|
||||
|
||||
// -----------------
|
||||
// Technology
|
||||
// -----------------
|
||||
|
||||
// -----------------
|
||||
// Preservation
|
||||
// -----------------
|
||||
Skill::Heal => None,
|
||||
Skill::Triage => None, // hot
|
||||
Skill::TriageTick => None,
|
||||
Skill::Throw => Some(1), // no damage stun, adds vulnerable
|
||||
|
||||
// -----------------
|
||||
// Destruction
|
||||
// -----------------
|
||||
Skill::Blast => None,
|
||||
Skill::Amplify => Some(1),
|
||||
Skill::Decay => None, // dot
|
||||
@ -407,23 +395,23 @@ impl Skill {
|
||||
Skill::Siphon => Some(1),
|
||||
Skill::SiphonTick => None,
|
||||
Skill::Curse => Some(1),
|
||||
|
||||
// -----------------
|
||||
// Purity
|
||||
// -----------------
|
||||
Skill::Empower => Some(1),
|
||||
Skill::Shield => None,
|
||||
Skill::Silence => Some(1),
|
||||
Skill::Purify => None,
|
||||
Skill::Purge => None,
|
||||
|
||||
// -----------------
|
||||
// Chaos
|
||||
// -----------------
|
||||
Skill::Banish => Some(1),
|
||||
Skill::Hex => None,
|
||||
Skill::Haste => None,
|
||||
Skill::Slow => None,
|
||||
Skill::Reflect => Some(2),
|
||||
Skill::Recharge => Some(2),
|
||||
Skill::Ruin => Some(1),
|
||||
Skill::Slay => None,
|
||||
Skill::Strangle => Some(1),
|
||||
Skill::Clutch => Some(2),
|
||||
Skill::Taunt => Some(1),
|
||||
Skill::Toxic => Some(1),
|
||||
|
||||
// -----------------
|
||||
// Test
|
||||
@ -494,6 +482,17 @@ impl Skill {
|
||||
Skill::Slow => Category::Blue,
|
||||
|
||||
|
||||
// WRONG
|
||||
Skill::Recharge => Category::Blue,
|
||||
Skill::Reflect => Category::Blue,
|
||||
Skill::Ruin => Category::Blue,
|
||||
Skill::Slay => Category::Blue,
|
||||
Skill::Strangle => Category::Blue,
|
||||
Skill::Clutch => Category::Blue,
|
||||
Skill::Taunt => Category::Blue,
|
||||
Skill::Toxic => Category::Blue,
|
||||
|
||||
|
||||
// -----------------
|
||||
// Test
|
||||
// -----------------
|
||||
@ -552,6 +551,16 @@ impl Skill {
|
||||
Skill::Purify => 1,
|
||||
Skill::Purge => 1,
|
||||
|
||||
Skill::Recharge => 1,
|
||||
Skill::Reflect => 1,
|
||||
Skill::Ruin => 1,
|
||||
Skill::Slay => 1,
|
||||
Skill::Strangle => 1,
|
||||
Skill::Clutch => 1,
|
||||
Skill::Taunt => 1,
|
||||
Skill::Toxic => 1,
|
||||
|
||||
|
||||
// unimplemented
|
||||
// Skill::Lag => 2, //
|
||||
|
||||
@ -593,57 +602,41 @@ impl Skill {
|
||||
}
|
||||
|
||||
match self {
|
||||
Skill::Attack => attack(source, target, resolution),
|
||||
// -----------------
|
||||
// Nature
|
||||
// -----------------
|
||||
Skill::Strike => strike(source, target, resolution),
|
||||
Skill::Block => block(source, target, resolution),
|
||||
Skill::Parry => parry(source, target, resolution),
|
||||
Skill::Snare => snare(source, target, resolution), // TODO prevent physical moves
|
||||
|
||||
|
||||
Skill::Stun => stun(source, target, resolution),
|
||||
|
||||
// -----------------
|
||||
// Technology
|
||||
// -----------------
|
||||
|
||||
// -----------------
|
||||
// Preservation
|
||||
// -----------------
|
||||
Skill::Heal => heal(source, target, resolution),
|
||||
Skill::Triage => triage(source, target, resolution), // hot
|
||||
Skill::TriageTick => triage_tick(source, target, resolution), // hot
|
||||
Skill::Throw => throw(source, target, resolution), // no damage stun, adds vulnerable
|
||||
|
||||
// -----------------
|
||||
// Destruction
|
||||
// -----------------
|
||||
Skill::Blast => blast(source, target, resolution),
|
||||
Skill::Amplify => amplify(source, target, resolution), // increase magic damage
|
||||
Skill::Attack => attack(source, target, resolution),
|
||||
Skill::Banish => banish(source, target, resolution), // TODO prevent all actions
|
||||
Skill::Blast => blast(source, target, resolution),
|
||||
Skill::Block => block(source, target, resolution),
|
||||
Skill::Curse => curse(source, target, resolution),
|
||||
Skill::Decay => decay(source, target, resolution), // dot
|
||||
Skill::DecayTick => decay_tick(source, target, resolution), // dot
|
||||
Skill::Siphon => siphon(source, target, resolution),
|
||||
Skill::SiphonTick => siphon_tick(source, target, resolution), // hot
|
||||
Skill::Curse => curse(source, target, resolution),
|
||||
|
||||
// -----------------
|
||||
// Purity
|
||||
// -----------------
|
||||
Skill::Empower => empower(source, target, resolution), // increased phys damage
|
||||
Skill::Haste => haste(source, target, resolution), // speed slow
|
||||
Skill::Heal => heal(source, target, resolution),
|
||||
Skill::Hex => hex(source, target, resolution), // todo prevent casting
|
||||
Skill::Parry => parry(source, target, resolution),
|
||||
Skill::Purge => purge(source, target, resolution), // dispel all buffs
|
||||
Skill::Purify => purify(source, target, resolution), // dispel all debuffs
|
||||
Skill::Recharge => recharge(source, target, resolution), // target is immune to magic damage and fx
|
||||
Skill::Shield => shield(source, target, resolution), // target is immune to magic damage and fx
|
||||
Skill::Silence => silence(source, target, resolution), // target cannot cast spells
|
||||
Skill::Purify => purify(source, target, resolution), // dispel all debuffs
|
||||
Skill::Purge => purge(source, target, resolution), // dispel all buffs
|
||||
|
||||
// -----------------
|
||||
// Chaos
|
||||
// -----------------
|
||||
Skill::Banish => banish(source, target, resolution), // TODO prevent all actions
|
||||
Skill::Hex => hex(source, target, resolution), // todo prevent casting
|
||||
Skill::Haste => haste(source, target, resolution), // speed slow
|
||||
Skill::Siphon => siphon(source, target, resolution),
|
||||
Skill::SiphonTick => siphon_tick(source, target, resolution), // hot
|
||||
Skill::Slow => slow(source, target, resolution), // speed slow
|
||||
Skill::Snare => snare(source, target, resolution), // TODO prevent physical moves
|
||||
Skill::Strike => strike(source, target, resolution),
|
||||
Skill::Stun => stun(source, target, resolution),
|
||||
Skill::Throw => throw(source, target, resolution), // no damage stun, adds vulnerable
|
||||
Skill::Triage => triage(source, target, resolution), // hot
|
||||
Skill::TriageTick => triage_tick(source, target, resolution), // hot
|
||||
|
||||
Skill::Reflect => unimplemented!(),
|
||||
Skill::Ruin => unimplemented!(),
|
||||
Skill::Slay => unimplemented!(),
|
||||
Skill::Strangle => unimplemented!(),
|
||||
Skill::Clutch => unimplemented!(),
|
||||
Skill::Taunt => unimplemented!(),
|
||||
Skill::Toxic => unimplemented!(),
|
||||
|
||||
// -----------------
|
||||
// Test
|
||||
@ -734,26 +727,12 @@ fn heal(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resol
|
||||
}
|
||||
|
||||
fn triage(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
|
||||
let triage = CrypEffect {
|
||||
let effect = CrypEffect {
|
||||
effect: Effect::Triage,
|
||||
duration: Effect::Triage.duration(),
|
||||
tick: Some(Cast::new_tick(cryp, target, Skill::TriageTick)),
|
||||
};
|
||||
let immunity = target.immune(Skill::Triage);
|
||||
let immune = immunity.immune;
|
||||
|
||||
let snare_result = ResolutionResult::Effect {
|
||||
effect: triage.effect,
|
||||
duration: triage.duration,
|
||||
immunity,
|
||||
};
|
||||
|
||||
resolution.results.push(snare_result);
|
||||
|
||||
if !immune {
|
||||
target.effects.push(triage);
|
||||
}
|
||||
|
||||
target.add_effect(Skill::Triage, effect);
|
||||
return resolution;
|
||||
}
|
||||
|
||||
@ -815,6 +794,11 @@ fn curse(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res
|
||||
return resolution;;
|
||||
}
|
||||
|
||||
fn recharge(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
|
||||
resolution.results.push(target.recharge());
|
||||
return resolution;
|
||||
}
|
||||
|
||||
fn siphon(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
|
||||
let siphon = CrypEffect {
|
||||
effect: Effect::Siphon,
|
||||
|
||||
@ -61,6 +61,7 @@ pub enum Var {
|
||||
Purge,
|
||||
Purify,
|
||||
Reflect,
|
||||
Recharge,
|
||||
Ruin,
|
||||
Shield,
|
||||
Silence,
|
||||
@ -153,6 +154,7 @@ impl Var {
|
||||
Var::Parry => Some(Skill::Parry),
|
||||
Var::Purge => Some(Skill::Purge),
|
||||
Var::Purify => Some(Skill::Purify),
|
||||
Var::Recharge => Some(Skill::Recharge),
|
||||
// Var::Reflect => Some(Skill::Reflect),
|
||||
// Var::Ruin => Some(Skill::Ruin),
|
||||
Var::Shield => Some(Skill::Shield),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user