armour init

This commit is contained in:
ntr 2019-01-11 17:03:34 +11:00
parent b91c1620e4
commit 13bba0200b
4 changed files with 81 additions and 16 deletions

View File

@ -5,6 +5,8 @@
# Key Mechanics
* 10d chaos maths, not rock paper scissors
* phys is faster and chaotic
* spells are slow and reliable
# WORK WORK
@ -13,16 +15,19 @@ strangle
## NOW
* armour and SS
* rolls as a drop item
* armour and SS the same
* evasion is a % function of the value
## SOON
* clean up categories
* why is the text fucked?
* iconography
* full svg buttons to not have to fuck around with text
* FAQ
## SOON
* aoe skills
* armour and SS
* keep track of games joined
* concede game on leave
@ -92,3 +97,31 @@ gem td style attr combinations
* 18: Restrictions breed creativity
* 19: Your audience is good at recognizing problems and bad at solving them
* 20: All the lessons connect
Evasion:
• Provides a X% chance to dodge direct hits
• Exists a bar with e.g. 200 / 200 evasion rating
• Your chance to dodge is reduced as your evasion rating is reduced
20% base dodge with e.g 150 / 200 rating will reduce your chance to dodge to 15%
• As you take damage your evasion rating decreases as a linear proportion of your HP bar
(not armour or magic shield)
E.g. with 700/900 hp your (200 / 200) evasion rating would be reduced to
(7/9) * 200 = 155
Armor:
• Defensive bonus against incoming physical damage
• Provides a X% mitigation to reduce incoming physical damage before it is applied
• Armor exists as an additional pseudo health bar
• Armor is reduced to zero before damage is applied to cryp health
• If damage taken is physical, armor is the first defensive bar to be reduced
• A cryp has the X% mitigation while they have at least 1 armour
Magic Shield (same as armor basically)
• Defensive bonus against incoming magic damage
• Provides a X% mitigation to reduce incoming magic damage before it is applied
• Magic shield exists as an additional pseudo health bar
• Magic shield is reduced to zero before damage is applied to cryp health
• If damage taken is magic, armor is the first defensive bar to be reduced
• A cryp has the X% mitigation while they have at least 1 magic shield

View File

@ -50,6 +50,8 @@ pub enum Stat {
SpellDamageTaken,
Healing,
HealingTaken,
Armour,
SpellShield,
}
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
@ -91,9 +93,11 @@ pub struct Cryp {
pub account: Uuid,
pub phys_dmg: CrypStat,
pub spell_dmg: CrypStat,
pub stamina: CrypStat,
pub speed: CrypStat,
pub stamina: CrypStat,
pub hp: CrypStat,
pub armour: CrypStat,
pub spell_shield: CrypStat,
pub xp: u64,
pub lvl: u8,
pub skills: Vec<CrypSkill>,
@ -118,6 +122,8 @@ impl Cryp {
speed: CrypStat { base: 0, stat: Stat::Speed },
stamina: CrypStat { base: 0, stat: Stat::Stamina },
hp: CrypStat { base: 0, stat: Stat::Hp },
armour: CrypStat { base: 50, stat: Stat::Armour },
spell_shield: CrypStat { base: 50, stat: Stat::SpellShield },
lvl: 0,
xp: 0,
skills: vec![],
@ -441,10 +447,21 @@ impl Cryp {
let modified_phys_dmg = phys_dmg_mods.iter().fold(amount, |acc, m| m.apply(acc));
self.hp.reduce(modified_phys_dmg);
// calculate amount of damage armour will not absorb
// eg 50 armour 25 dmg -> 25 remainder
// 50 armour 100 dmg -> 0 remainder
let remainder = self.armour.base.saturating_sub(modified_phys_dmg);
let mitigation = modified_phys_dmg.saturating_sub(remainder);
// reduce armour by damage amount
self.armour.reduce(modified_phys_dmg);
// deal remainder to hp
self.hp.reduce(remainder);
return ResolutionResult::Damage {
amount: modified_phys_dmg,
mitigation,
category: Category::PhysDmg,
immunity,
};
@ -471,7 +488,14 @@ impl Cryp {
let modified_spell_dmg = spell_dmg_mods.iter().fold(amount, |acc, m| m.apply(acc));
self.hp.reduce(modified_spell_dmg);
// reduce spell_shield by damage amount
self.spell_shield.reduce(modified_spell_dmg);
// reduce amount by the amount absorbed by spell_shield
let remainder = amount.saturating_sub(modified_spell_dmg);
// deal remainder to hp
self.hp.reduce(remainder);
return ResolutionResult::Damage {
amount: modified_spell_dmg,

View File

@ -347,28 +347,36 @@ impl Game {
for result in cast.resolution.results.iter() {
match result {
ResolutionResult::Damage { amount, category: _, immunity } => {
ResolutionResult::Damage { amount, mitigation, category: _, 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!("[{:}] {:} {:?} {:} {:}", cast.resolution.speed, source.name, cast.skill, target.name, amount)),
true => self.log.push(format!("[{:}] {:} {:?} {:} immune {:?}",
cast.resolution.speed, source.name, cast.skill, target.name, immunity.effects)),
false => self.log.push(format!("[{:}] {:} {:?} {:} {:}",
cast.resolution.speed, source.name, cast.skill, target.name, amount)),
}
},
ResolutionResult::Healing { amount, overhealing, category: _, 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!("[{:}] {:} {:?} {:} {:} ({:}OH)", cast.resolution.speed, source.name, cast.skill, target.name, amount, overhealing)),
true => self.log.push(format!("[{:}] {:} {:?} {:} immune {:?}",
cast.resolution.speed, source.name, cast.skill, target.name, immunity.effects)),
false => self.log.push(format!("[{:}] {:} {:?} {:} {:} ({:}OH)",
cast.resolution.speed, source.name, cast.skill, target.name, amount, overhealing)),
}
},
ResolutionResult::Effect { effect, duration, 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!("[{:}] {:} {:?} {:} {:?} {:}T", cast.resolution.speed, source.name, cast.skill, target.name, effect, duration)),
true => self.log.push(format!("[{:}] {:} {:?} {:} immune {:?}",
cast.resolution.speed, source.name, cast.skill, target.name, immunity.effects)),
false => self.log.push(format!("[{:}] {:} {:?} {:} {:?} {:}T",
cast.resolution.speed, source.name, cast.skill, target.name, effect, duration)),
}
},
ResolutionResult::Removal { effect, 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!("[{:}] {:?} removed {:} {:?}", cast.resolution.speed, source.name, target.name, effect)),
true => self.log.push(format!("[{:}] {:} {:?} {:} immune {:?}",
cast.resolution.speed, source.name, cast.skill, target.name, immunity.effects)),
false => self.log.push(format!("[{:}] {:?} removed {:} {:?}",
cast.resolution.speed, source.name, target.name, effect)),
}
},
}

View File

@ -66,7 +66,7 @@ impl Disable {
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
pub enum ResolutionResult {
Damage { amount: u64, category: Category , immunity: Immunity },
Damage { amount: u64, mitigation: u64, category: Category , immunity: Immunity },
Healing { amount: u64, overhealing: u64, category: Category , immunity: Immunity },
Effect { effect: Effect, duration: u8, immunity: Immunity },
Removal { effect: Effect, immunity: Immunity },