| @@ -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 { Noun, Pronoun, Adjective, ImproperNoun, TextLike } from './language' | ||||
| import { LogEntry, LogLine } from './interface' | import { LogEntry, LogLine } from './interface' | ||||
| import { Vore, VoreContainer, VoreType, Container } from './vore' | import { Vore, VoreContainer, VoreType, Container } from './vore' | ||||
| @@ -17,7 +17,7 @@ export interface Entity { | |||||
| export interface Mortal extends Entity { | export interface Mortal extends Entity { | ||||
| kind: Noun; | kind: Noun; | ||||
| vigors: {[key in Vigor]: number}; | vigors: {[key in Vigor]: number}; | ||||
| maxVigors: {[key in Vigor]: number}; | |||||
| maxVigors: Readonly<{[key in Vigor]: number}>; | |||||
| disabled: boolean; | disabled: boolean; | ||||
| resistances: Map<DamageType, number>; | resistances: Map<DamageType, number>; | ||||
| takeDamage: (damage: Damage) => void; | takeDamage: (damage: Damage) => void; | ||||
| @@ -36,10 +36,12 @@ export class Creature extends Vore implements Combatant { | |||||
| [Vigor.Resolve]: 100 | [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 | baseStats: Stats | ||||
| @@ -70,10 +72,9 @@ export class Creature extends Vore implements Combatant { | |||||
| super() | super() | ||||
| const containers = this.containers | 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.baseStats = Object.keys(Stat).reduce((base: any, key) => { base[key] = stats[key as Stat]; return base }, {}) | ||||
| this.side = Side.Heroes | this.side = Side.Heroes | ||||
| this.voreStats = { | this.voreStats = { | ||||