Procházet zdrojové kódy

Make stat damage drain vigors

vintage
Fen Dweller před 5 roky
rodič
revize
b8d239cb87
3 změnil soubory, kde provedl 24 přidání a 17 odebrání
  1. +2
    -1
      src/game/creatures/kenzie.ts
  2. +5
    -3
      src/game/creatures/withers.ts
  3. +17
    -13
      src/game/entity.ts

+ 2
- 1
src/game/creatures/kenzie.ts Zobrazit soubor

@@ -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')
)


+ 5
- 3
src/game/creatures/withers.ts Zobrazit soubor

@@ -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
)


+ 17
- 13
src/game/entity.ts Zobrazit soubor

@@ -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]
})
}
})



Načítá se…
Zrušit
Uložit