diff --git a/src/game/creatures/kenzie.ts b/src/game/creatures/kenzie.ts index fc05883..e2fa86a 100644 --- a/src/game/creatures/kenzie.ts +++ b/src/game/creatures/kenzie.ts @@ -35,7 +35,8 @@ export class Kenzie extends Creature { new AttackAction( new StatDamageFormula([ { fraction: 0.5, stat: Stat.Toughness, target: Vigor.Health, type: DamageType.Crush }, - { fraction: 0.05, stat: VoreStat.Bulk, target: Vigor.Health, type: DamageType.Crush } + { fraction: 0.05, stat: VoreStat.Bulk, target: Vigor.Health, type: DamageType.Crush }, + { fraction: 0.01, stat: VoreStat.Bulk, target: Stat.Toughness, type: DamageType.Crush } ]), new Verb('stomp') ) diff --git a/src/game/creatures/withers.ts b/src/game/creatures/withers.ts index 321ba54..897b125 100644 --- a/src/game/creatures/withers.ts +++ b/src/game/creatures/withers.ts @@ -122,9 +122,11 @@ class BootContainer extends NormalContainer { const flex = new FlexToesAction( new UniformRandomDamageFormula(new Damage( - { target: Vigor.Health, type: DamageType.Crush, amount: 50 }, - { target: Vigor.Stamina, type: DamageType.Crush, amount: 50 }, - { target: Vigor.Resolve, type: DamageType.Crush, amount: 50 } + { target: Stat.Toughness, type: DamageType.Crush, amount: 10 }, + { target: Stat.Power, type: DamageType.Crush, amount: 10 }, + { target: Stat.Speed, type: DamageType.Crush, amount: 10 }, + { target: Stat.Willpower, type: DamageType.Crush, amount: 10 }, + { target: Stat.Charm, type: DamageType.Crush, amount: 10 } ), 0.5), this ) diff --git a/src/game/entity.ts b/src/game/entity.ts index df499d7..c52c69e 100644 --- a/src/game/entity.ts +++ b/src/game/entity.ts @@ -118,22 +118,26 @@ export class Creature extends Vore implements Combatant { } takeDamage (damage: Damage): LogEntry { + // first, we record health to decide if the entity just died const startHealth = this.vigors.Health + damage.damages.forEach(instance => { const factor = instance.type === DamageType.Heal ? -1 : 1 - const resistance: number|undefined = this.resistances.get(instance.type) - if (resistance !== undefined) { - if (instance.target in Vigor) { - this.vigors[instance.target as Vigor] -= instance.amount * factor * resistance - } else if (instance.target in Stat) { - this.stats[instance.target as Stat] -= instance.amount * factor * resistance - } - } else { - if (instance.target in Vigor) { - this.vigors[instance.target as Vigor] -= instance.amount * factor - } else if (instance.target in Stat) { - this.stats[instance.target as Stat] -= instance.amount * factor - } + const effectiveResistance: number|undefined = this.resistances.get(instance.type) + const resistance = effectiveResistance === undefined ? factor : effectiveResistance * factor + + if (instance.target in Vigor) { + // just deal damage + this.vigors[instance.target as Vigor] -= instance.amount * factor * resistance + } else if (instance.target in Stat) { + // drain the stats, then deal damage to match + const startVigors = this.maxVigors + this.stats[instance.target as Stat] -= instance.amount * factor * resistance + const endVigors = this.maxVigors + + Object.keys(Vigor).map(vigor => { + this.vigors[vigor as Vigor] -= startVigors[vigor as Vigor] - endVigors[vigor as Vigor] + }) } })