Procházet zdrojové kódy

Calculate max vigors automatically

vintage
Fen Dweller před 5 roky
rodič
revize
75f7cfe36a
1 změnil soubory, kde provedl 11 přidání a 10 odebrání
  1. +11
    -10
      src/game/entity.ts

+ 11
- 10
src/game/entity.ts Zobrazit soubor

@@ -1,4 +1,4 @@
import { DamageType, Damage, Combatant, Stats, Action, Vigor, VoreStats, VoreStat, Stat, Side, GroupAction } from './combat'
import { DamageType, Damage, Combatant, Stats, Action, Vigor, VoreStats, VoreStat, Stat, Side, GroupAction, Vigors } from './combat'
import { Noun, Pronoun, Adjective, ImproperNoun, TextLike } from './language'
import { LogEntry, LogLine } from './interface'
import { Vore, VoreContainer, VoreType, Container } from './vore'
@@ -17,7 +17,7 @@ export interface Entity {
export interface Mortal extends Entity {
kind: Noun;
vigors: {[key in Vigor]: number};
maxVigors: {[key in Vigor]: number};
maxVigors: Readonly<{[key in Vigor]: number}>;
disabled: boolean;
resistances: Map<DamageType, number>;
takeDamage: (damage: Damage) => void;
@@ -36,10 +36,12 @@ export class Creature extends Vore implements Combatant {
[Vigor.Resolve]: 100
}

maxVigors = {
[Vigor.Health]: 100,
[Vigor.Stamina]: 100,
[Vigor.Resolve]: 100
get maxVigors (): Readonly<Vigors> {
return {
Health: this.stats.Toughness * 10 + this.stats.Power * 5,
Resolve: this.stats.Willpower * 10 + this.stats.Charm * 5,
Stamina: this.stats.Speed * 10 + this.stats.Power * 2.5 + this.stats.Charm * 2.5
}
}

baseStats: Stats
@@ -70,10 +72,9 @@ export class Creature extends Vore implements Combatant {
super()
const containers = this.containers

this.vigors.Health = this.maxVigors.Health = stats.Toughness * 10 + stats.Power * 5
this.vigors.Stamina = this.maxVigors.Stamina = stats.Toughness * 3 + stats.Speed * 10 + stats.Willpower * 3
this.vigors.Resolve = this.maxVigors.Resolve = stats.Willpower * 10 + stats.Charm * 5

Object.entries(this.maxVigors).forEach(([key, val]) => {
this.vigors[key as Vigor] = val
})
this.baseStats = Object.keys(Stat).reduce((base: any, key) => { base[key] = stats[key as Stat]; return base }, {})
this.side = Side.Heroes
this.voreStats = {


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