stam -> hp

This commit is contained in:
ntr 2019-03-14 18:57:44 +11:00
parent 9d02499c5a
commit 788c68c015
11 changed files with 61 additions and 80 deletions

View File

@ -28,7 +28,7 @@ class StatBar extends Phaser.GameObjects.Graphics {
if (type === 'HP') { if (type === 'HP') {
this.val = this.crypObj.cryp.hp.value; this.val = this.crypObj.cryp.hp.value;
this.max = this.crypObj.cryp.stamina.value; this.max = this.crypObj.cryp.hp.value;
this.margin = 0; this.margin = 0;
} else if (type === 'Red Shield') { } else if (type === 'Red Shield') {
this.val = this.crypObj.cryp.red_shield.value; this.val = this.crypObj.cryp.red_shield.value;

View File

@ -67,7 +67,7 @@ class StatSheet extends Phaser.Scene {
}; };
const CRYP_STATS = [ const CRYP_STATS = [
cryp.stamina, cryp.hp,
cryp.red_shield, cryp.red_shield,
cryp.blue_shield, cryp.blue_shield,
cryp.evasion, cryp.evasion,

View File

@ -19,7 +19,7 @@ This homepage shows your cryps, joinable online games, PVE options and your item
If you have no cryps yet, press SPAWN and give your cryp a name to create one. If you have no cryps yet, press SPAWN and give your cryp a name to create one.
Once you have made a cryp, click on them to visit their stat page and teach them some SKILLS. Once you have made a cryp, click on them to visit their stat page and teach them some SKILLS.
The stat page also has descriptions of each skill and their effects. The stat page also has descriptions of each skill and their effects.
cryps have 3 basic stats: stamina, red damage and magic damage. cryps have 3 basic stats: hp, red damage and magic damage.
Toggle whether a cryp is selected for your team by clicking the coloured stripes next to the cryp or press 1,2,3. Toggle whether a cryp is selected for your team by clicking the coloured stripes next to the cryp or press 1,2,3.
Once you have a team ready press the New PVE Game button to start playing. Once you have a team ready press the New PVE Game button to start playing.
`; `;

View File

@ -3,7 +3,7 @@
### Defenses ### ### Defenses ###
Rare `Increased Stamina` Rare `Increased Hp`
Common `Increased Evasion rating` Common `Increased Evasion rating`
Common `Increased Blue Shield rating` Common `Increased Blue Shield rating`

View File

@ -76,7 +76,7 @@ Non-Violence
Enhancement & Preservation Enhancement & Preservation
-------------------------- --------------------------
the philosophy of nonviolence teaches that the sanctity of life is above all else the philosophy of nonviolence teaches that the sanctity of hp is above all else
its adherants are defensive and gracious, seeking to minimise the damage done by others and doing no direct harm themselves. its adherants are defensive and gracious, seeking to minimise the damage done by others and doing no direct harm themselves.
they seek to prevent damage in any way possible they seek to prevent damage in any way possible
@ -98,8 +98,8 @@ specialise in magical damage dealing
* damage amplification * damage amplification
* nukes * nukes
* life leach * hp leach
* life exchange * hp exchange
* poison * poison
* aoe * aoe

View File

@ -85,17 +85,10 @@ In your team Cryp #1 has `Strike`, Cryp #2 has `Slay` and `Heal`, Cryp #3 has `S
### Generic Specs ### Generic Specs
(Base white skills not upgraded count as have 1 gem basic ?) # Basic % Hp
`Base` -> 5% inc hp
# Basic Damage
`Base` -> 10% inc basic damage
`Team Bonus` -> 3 basic gems -> +10% // 6 basic gems -> +15% // 12 basic gems -> +25%
Maximum 60% inc basic damage
# Basic % Life
`Base` -> 5% inc life
`Team Bonus` -> 3 basic gems -> +5% // 6 basic gems -> +10% // 12 basic gems -> +15% `Team Bonus` -> 3 basic gems -> +5% // 6 basic gems -> +10% // 12 basic gems -> +15%
Maximum 35% inc life Maximum 35% inc hp
# Basic Speed # Basic Speed
`Base` -> 5% inc speed `Base` -> 5% inc speed
@ -146,9 +139,9 @@ Add 1 blue and 1 green gem
`Team Bonus` (2B + 2G gems) -> +5% + 5% // (5B + 5G gems) -> +10% + 10% % // (10B + 10G) gems -> +15% + 15% `Team Bonus` (2B + 2G gems) -> +5% + 5% // (5B + 5G gems) -> +10% + 10% % // (10B + 10G) gems -> +15% + 15%
Maximum +35% inc blue damage and 35% inc healing Maximum +35% inc blue damage and 35% inc healing
### Increased Life Combos ### ### Increased Hp Combos ###
Generate by combining `Generic Spec (Basic Life)` with respective RGB Generate by combining `Generic Spec (Basic Hp)` with respective RGB
# Increased % Red Shield (Basic %HP + 2R) # Increased % Red Shield (Basic %HP + 2R)
Add 2 `red gems` Add 2 `red gems`
@ -156,11 +149,11 @@ Add 2 `red gems`
`Team Bonus` 5 red gems -> +10% // 10 red gems -> +15% // 20 red gems -> +20% `Team Bonus` 5 red gems -> +10% // 10 red gems -> +15% // 20 red gems -> +20%
Maximum +55% inc red shield Maximum +55% inc red shield
# Increased % Red Shield and Life (Basic %HP + 1R1G) # Increased % Red Shield and Hp (Basic %HP + 1R1G)
Add 1 red 1 green gem Add 1 red 1 green gem
`Base` -> 5% inc red shield and 5% inc life `Base` -> 5% inc red shield and 5% inc hp
`Team Bonus` (2R + 2G gems) -> +5% + 5% // (5R + 5G gems) -> +10% + 10% % // (10R + 10G) gems -> +15% + 15% `Team Bonus` (2R + 2G gems) -> +5% + 5% // (5R + 5G gems) -> +10% + 10% % // (10R + 10G) gems -> +15% + 15%
Maximum +35% inc red shield and 35% inc life Maximum +35% inc red shield and 35% inc hp
# Increased % Blue Shield (Basic %HP + 2B) # Increased % Blue Shield (Basic %HP + 2B)
Add 2 `blue gems` Add 2 `blue gems`
@ -168,13 +161,13 @@ Add 2 `blue gems`
`Team Bonus` 5 blue gems -> +10% // 10 blue gems -> +15% // 20 blue gems -> +20% `Team Bonus` 5 blue gems -> +10% // 10 blue gems -> +15% // 20 blue gems -> +20%
Maximum +55% inc blue shield Maximum +55% inc blue shield
# Increased % Blue Shield and Life (Basic %HP + 1B1G) # Increased % Blue Shield and Hp (Basic %HP + 1B1G)
Add `1 blue and 1 green gems` Add `1 blue and 1 green gems`
`Base` -> 5% inc red shield and 5% inc life `Base` -> 5% inc red shield and 5% inc hp
`Team Bonus` (2B + 2G gems) -> +5% + 5% // (5B + 5G gems) -> +10% + 10% % // (10B + 10G) gems -> +15% + 15% `Team Bonus` (2B + 2G gems) -> +5% + 5% // (5B + 5G gems) -> +10% + 10% % // (10B + 10G) gems -> +15% + 15%
Maximum +35% inc blue shield and 35% inc life Maximum +35% inc blue shield and 35% inc hp
# Increased % Life (Basic %HP + 2G) # Increased % Hp (Basic %HP + 2G)
Add `2 green gems` Add `2 green gems`
`Base` -> 10% inc hp `Base` -> 10% inc hp
`Team Bonus` 5 green gems -> +10% // 10 green gems -> +15% // 20 green gems -> +20% `Team Bonus` 5 green gems -> +10% // 10 green gems -> +15% // 20 green gems -> +20%
@ -182,7 +175,7 @@ Maximum +55% inc hp
# Increased % Blue and Red Shield (Basic %HP + 1B1R) # Increased % Blue and Red Shield (Basic %HP + 1B1R)
Add `1 blue and 1 red gem` Add `1 blue and 1 red gem`
`Base` -> 5% inc red shield and 5% inc life `Base` -> 5% inc red shield and 5% inc hp
`Team Bonus` (2B + 2R gems) -> +5% + 5% // (5B + 5R gems) -> +10% + 10% % // (10B + 10R) gems -> +15% + 15% `Team Bonus` (2B + 2R gems) -> +5% + 5% // (5B + 5R gems) -> +10% + 10% % // (10B + 10R) gems -> +15% + 15%
Maximum +35% inc blue shield and 35% inc red shield Maximum +35% inc blue shield and 35% inc red shield

View File

@ -44,7 +44,6 @@ pub enum Stat {
Int, Int,
Hp, Hp,
Speed, Speed,
Stamina,
RedDamage, RedDamage,
RedDamageTaken, RedDamageTaken,
BlueDamage, BlueDamage,
@ -60,6 +59,7 @@ pub enum Stat {
pub struct CrypStat { pub struct CrypStat {
base: u64, base: u64,
value: u64, value: u64,
max: u64,
pub stat: Stat, pub stat: Stat,
} }
@ -80,6 +80,7 @@ impl CrypStat {
// but still needs access to the base amount // but still needs access to the base amount
let value = specs.iter().fold(self.base, |acc, s| s.apply(acc, self.base)); let value = specs.iter().fold(self.base, |acc, s| s.apply(acc, self.base));
self.value = value; self.value = value;
self.max = value;
self self
} }
@ -120,7 +121,6 @@ pub struct Cryp {
pub blue_shield: CrypStat, pub blue_shield: CrypStat,
pub blue_damage: CrypStat, pub blue_damage: CrypStat,
pub speed: CrypStat, pub speed: CrypStat,
pub stamina: CrypStat,
pub hp: CrypStat, pub hp: CrypStat,
pub evasion: CrypStat, pub evasion: CrypStat,
pub xp: u64, pub xp: u64,
@ -143,14 +143,13 @@ impl Cryp {
return Cryp { return Cryp {
id, id,
account: id, account: id,
red_damage: CrypStat { base: 0, value: 0, stat: Stat::RedDamage }, red_damage: CrypStat { base: 0, value: 0, max: 0, stat: Stat::RedDamage },
red_shield: CrypStat { base: 0, value: 0, stat: Stat::RedShield }, red_shield: CrypStat { base: 0, value: 0, max: 0, stat: Stat::RedShield },
blue_damage: CrypStat { base: 0, value: 0, stat: Stat::BlueDamage }, blue_damage: CrypStat { base: 0, value: 0, max: 0, stat: Stat::BlueDamage },
blue_shield: CrypStat { base: 0, value: 0, stat: Stat::BlueShield }, blue_shield: CrypStat { base: 0, value: 0, max: 0, stat: Stat::BlueShield },
speed: CrypStat { base: 0, value: 0, stat: Stat::Speed }, speed: CrypStat { base: 0, value: 0, max: 0, stat: Stat::Speed },
stamina: CrypStat { base: 0, value: 0, stat: Stat::Stamina }, hp: CrypStat { base: 0, value: 0, max: 0, stat: Stat::Hp },
hp: CrypStat { base: 0, value: 0, stat: Stat::Hp }, evasion: CrypStat { base: 0, value: 0, max: 0, stat: Stat::Evasion },
evasion: CrypStat { base: 0, value: 0, stat: Stat::Evasion },
lvl: 0, lvl: 0,
xp: 0, xp: 0,
skills: vec![], skills: vec![],
@ -225,10 +224,7 @@ impl Cryp {
Stat::RedDamage => self.red_damage.set(rng.gen_range(stat_min, stat_max), &self.specs), Stat::RedDamage => self.red_damage.set(rng.gen_range(stat_min, stat_max), &self.specs),
Stat::BlueDamage => self.blue_damage.set(rng.gen_range(stat_min, stat_max), &self.specs), Stat::BlueDamage => self.blue_damage.set(rng.gen_range(stat_min, stat_max), &self.specs),
Stat::Speed => self.speed.set(rng.gen_range(stat_min, stat_max), &self.specs), Stat::Speed => self.speed.set(rng.gen_range(stat_min, stat_max), &self.specs),
Stat::Stamina => { Stat::Hp => self.hp.set(rng.gen_range(stam_min, stam_max), &self.specs),
self.stamina.set(rng.gen_range(stam_min, stam_max), &self.specs);
self.hp.set(self.stamina.base, &self.specs)
},
Stat::BlueShield => self.blue_shield.set(rng.gen_range(stat_min, stat_max), &self.specs), Stat::BlueShield => self.blue_shield.set(rng.gen_range(stat_min, stat_max), &self.specs),
Stat::RedShield => self.red_shield.set(rng.gen_range(stat_min, stat_max), &self.specs), Stat::RedShield => self.red_shield.set(rng.gen_range(stat_min, stat_max), &self.specs),
Stat::Evasion => self.evasion.set(rng.gen_range(evasion_min, evasion_max), &self.specs), Stat::Evasion => self.evasion.set(rng.gen_range(evasion_min, evasion_max), &self.specs),
@ -249,7 +245,7 @@ impl Cryp {
self.roll_stat(Stat::RedDamage); self.roll_stat(Stat::RedDamage);
self.roll_stat(Stat::BlueDamage); self.roll_stat(Stat::BlueDamage);
self.roll_stat(Stat::Speed); self.roll_stat(Stat::Speed);
self.roll_stat(Stat::Stamina); self.roll_stat(Stat::Hp);
self self
} }
@ -276,10 +272,7 @@ impl Cryp {
self.blue_shield.recalculate(&self.specs); self.blue_shield.recalculate(&self.specs);
self.evasion.recalculate(&self.specs); self.evasion.recalculate(&self.specs);
self.speed.recalculate(&self.specs); self.speed.recalculate(&self.specs);
self.hp.recalculate(&self.specs);
// special case where hp is tied to stam
self.stamina.recalculate(&self.specs);
self.hp.set(self.stamina.value, &self.specs);
self self
} }
@ -406,7 +399,7 @@ impl Cryp {
} }
// pub fn rez(&mut self) -> &mut Cryp { // pub fn rez(&mut self) -> &mut Cryp {
// self.hp.set(self.stamina.base); // self.hp.set(self.hp.base);
// self // self
// } // }
@ -449,10 +442,6 @@ impl Cryp {
self.hp.value self.hp.value
} }
pub fn stamina(&self) -> u64 {
self.stamina.value
}
pub fn heal(&mut self, skill: Skill, amount: u64) -> ResolutionResult { pub fn heal(&mut self, skill: Skill, amount: u64) -> ResolutionResult {
let immunity = self.immune(skill); let immunity = self.immune(skill);
let immune = immunity.immune; let immune = immunity.immune;
@ -478,7 +467,7 @@ impl Cryp {
let current_hp = self.hp(); let current_hp = self.hp();
let new_hp = *[ let new_hp = *[
self.hp().saturating_add(modified_healing), self.hp().saturating_add(modified_healing),
self.stamina() self.hp.max
].iter().min().unwrap(); ].iter().min().unwrap();
let healing = new_hp - current_hp; let healing = new_hp - current_hp;
@ -597,7 +586,7 @@ impl Cryp {
} }
let mut rng = thread_rng(); let mut rng = thread_rng();
let hp_pct = (self.hp.value * 100) / self.stamina.value; let hp_pct = (self.hp.value * 100) / self.hp.value;
let evasion_rating = (self.evasion.value * hp_pct) / 100; let evasion_rating = (self.evasion.value * hp_pct) / 100;
let roll = rng.gen_range(0, 100); let roll = rng.gen_range(0, 100);
println!("{:} < {:?}", roll, evasion_rating); println!("{:} < {:?}", roll, evasion_rating);

View File

@ -20,7 +20,7 @@ pub enum ItemAction {
RerollRedDamage, RerollRedDamage,
RerollBlueDamage, RerollBlueDamage,
RerollSpeed, RerollSpeed,
RerollStamina, RerollHp,
RerollRedShield, RerollRedShield,
RerollBlueShield, RerollBlueShield,
RerollEvasion, RerollEvasion,
@ -52,7 +52,7 @@ impl Item {
fn apply(&mut self, tx: &mut Transaction, target: Uuid) -> Result<(), Error> { fn apply(&mut self, tx: &mut Transaction, target: Uuid) -> Result<(), Error> {
match self.action { match self.action {
ItemAction::RerollStamina => reroll(self, tx, target, Stat::Stamina), ItemAction::RerollHp => reroll(self, tx, target, Stat::Hp),
ItemAction::RerollRedDamage => reroll(self, tx, target, Stat::RedDamage), ItemAction::RerollRedDamage => reroll(self, tx, target, Stat::RedDamage),
ItemAction::RerollBlueDamage => reroll(self, tx, target, Stat::BlueDamage), ItemAction::RerollBlueDamage => reroll(self, tx, target, Stat::BlueDamage),
ItemAction::RerollSpeed => reroll(self, tx, target, Stat::Speed), ItemAction::RerollSpeed => reroll(self, tx, target, Stat::Speed),
@ -85,7 +85,7 @@ fn reroll(item: &mut Item, tx: &mut Transaction, target: Uuid, stat: Stat) -> Re
fn mode_drops(mode: GameMode) -> Vec<(ItemAction, usize)> { fn mode_drops(mode: GameMode) -> Vec<(ItemAction, usize)> {
match mode { match mode {
GameMode::Normal => vec![ GameMode::Normal => vec![
(ItemAction::RerollStamina, 1), (ItemAction::RerollHp, 1),
(ItemAction::RerollRedDamage, 1), (ItemAction::RerollRedDamage, 1),
(ItemAction::RerollBlueDamage, 1), (ItemAction::RerollBlueDamage, 1),
], ],
@ -103,7 +103,7 @@ fn mode_drops(mode: GameMode) -> Vec<(ItemAction, usize)> {
(ItemAction::RerollSpeed, 1), (ItemAction::RerollSpeed, 1),
], ],
// _ => vec![ // _ => vec![
// (ItemAction::RerollStamina, 1), // (ItemAction::RerollHp, 1),
// (ItemAction::RerollRedDamage, 1), // (ItemAction::RerollRedDamage, 1),
// (ItemAction::RerollBlueDamage, 1), // (ItemAction::RerollBlueDamage, 1),
// (ItemAction::RerollSpeed, 1), // (ItemAction::RerollSpeed, 1),

View File

@ -1045,7 +1045,7 @@ mod tests {
y.reduce_effect_durations(&mut log); y.reduce_effect_durations(&mut log);
let _decay = y.effects.iter().find(|e| e.effect == Effect::Decay); let _decay = y.effects.iter().find(|e| e.effect == Effect::Decay);
// assert!(y.hp() == y.stamina().saturating_sub(decay.unwrap().tick.unwrap().amount)); // assert!(y.hp() == y.hp().saturating_sub(decay.unwrap().tick.unwrap().amount));
} }
#[test] #[test]

View File

@ -3,7 +3,7 @@ use cryp::{Stat};
#[derive(Debug,Copy,Clone,Serialize,Deserialize,PartialEq)] #[derive(Debug,Copy,Clone,Serialize,Deserialize,PartialEq)]
pub enum Spec { pub enum Spec {
SpeedI, SpeedI,
StaminaI, HpI,
RedDamageI, RedDamageI,
GreenDamageI, GreenDamageI,
BlueDamageI, BlueDamageI,
@ -20,7 +20,7 @@ impl Spec {
Spec::RedShieldI => Stat::RedShield, Spec::RedShieldI => Stat::RedShield,
Spec::BlueShieldI => Stat::BlueShield, Spec::BlueShieldI => Stat::BlueShield,
Spec::SpeedI => Stat::Speed, Spec::SpeedI => Stat::Speed,
Spec::StaminaI => Stat::Stamina, Spec::HpI => Stat::Hp,
} }
} }
@ -30,7 +30,7 @@ impl Spec {
Spec::GreenDamageI => modified + (base * 5 / 100), Spec::GreenDamageI => modified + (base * 5 / 100),
Spec::BlueDamageI => modified + (base * 5 / 100), Spec::BlueDamageI => modified + (base * 5 / 100),
Spec::SpeedI => modified + (base * 5 / 100), Spec::SpeedI => modified + (base * 5 / 100),
Spec::StaminaI => modified + (base * 5 / 100), Spec::HpI => modified + (base * 5 / 100),
Spec::RedShieldI => modified + 50, Spec::RedShieldI => modified + 50,
Spec::BlueShieldI => modified + 50, Spec::BlueShieldI => modified + 50,
} }

View File

@ -33,17 +33,15 @@ pub enum Var {
// specs // specs
Damage, Damage,
Protection, Hp,
Speed, Speed,
Stamina,
StaminaI, HpI,
RedDamageI, RedDamageI,
BlueDamageI, BlueDamageI,
GreenDamageI, GreenDamageI,
RedShieldI, RedShieldI,
BlueShieldI, BlueShieldI,
SpeedI,
Amplify, Amplify,
Banish, Banish,
@ -87,7 +85,7 @@ impl Var {
Var::Debuff | Var::Debuff |
Var::Buff => true, Var::Buff => true,
Var::Protection | Var::Hp |
Var::Damage => true, Var::Damage => true,
_ => false, _ => false,
@ -137,13 +135,16 @@ impl Var {
fn spec(&self) -> Option<Spec> { fn spec(&self) -> Option<Spec> {
match *self { match *self {
Var::StaminaI => Some(Spec::StaminaI), Var::Speed => Some(Spec::SpeedI),
Var::SpeedI => Some(Spec::SpeedI),
Var::RedDamageI => Some(Spec::RedDamageI), Var::RedDamageI => Some(Spec::RedDamageI),
Var::BlueDamageI => Some(Spec::BlueDamageI), Var::BlueDamageI => Some(Spec::BlueDamageI),
Var::GreenDamageI => Some(Spec::GreenDamageI), Var::GreenDamageI => Some(Spec::GreenDamageI),
Var::HpI => Some(Spec::HpI),
Var::RedShieldI => Some(Spec::RedShieldI), Var::RedShieldI => Some(Spec::RedShieldI),
Var::BlueShieldI => Some(Spec::BlueShieldI), Var::BlueShieldI => Some(Spec::BlueShieldI),
_ => None, _ => None,
} }
} }
@ -175,8 +176,8 @@ impl Vbox {
Var::Attack, Var::Attack,
Var::Attack, Var::Attack,
Var::Attack, Var::Attack,
Var::StaminaI, Var::Hp,
Var::SpeedI, Var::Speed,
Var::Damage, Var::Damage,
Var::Red, Var::Red,
Var::Green, Var::Green,
@ -214,9 +215,8 @@ impl Vbox {
let specs = vec![ let specs = vec![
(Var::Damage, 1), (Var::Damage, 1),
(Var::Protection, 1), (Var::Hp, 1),
(Var::Speed, 1), (Var::Speed, 1),
(Var::Stamina, 1),
]; ];
let mut rng = thread_rng(); let mut rng = thread_rng();
@ -358,16 +358,15 @@ impl Vbox {
ColourCode::GB => return Err(err_msg("unhandled skill combo")), ColourCode::GB => return Err(err_msg("unhandled skill combo")),
ColourCode::BR => return Err(err_msg("unhandled skill combo")), ColourCode::BR => return Err(err_msg("unhandled skill combo")),
}, },
Var::Protection => match colour_code { Var::Hp => match colour_code {
ColourCode::RR => Var::RedShieldI, ColourCode::RR => Var::RedShieldI,
ColourCode::GG => Var::StaminaI, ColourCode::GG => Var::HpI,
ColourCode::BB => Var::BlueShieldI, ColourCode::BB => Var::BlueShieldI,
ColourCode::RG => return Err(err_msg("unhandled skill combo")), ColourCode::RG => return Err(err_msg("unhandled skill combo")),
ColourCode::GB => return Err(err_msg("unhandled skill combo")), ColourCode::GB => return Err(err_msg("unhandled skill combo")),
ColourCode::BR => return Err(err_msg("unhandled skill combo")), ColourCode::BR => return Err(err_msg("unhandled skill combo")),
}, },
_ => panic!("wrong base {:?}", base), _ => panic!("wrong base {:?}", base),
}; };