diff --git a/src/game/ai/deciders.ts b/src/game/ai/deciders.ts index 2925160..c2d48ed 100644 --- a/src/game/ai/deciders.ts +++ b/src/game/ai/deciders.ts @@ -81,9 +81,6 @@ export class ConsequenceFunctionDecider implements Decider { } } -/** - * A [[ConsequenceFunctionDecider]] that filters out status effects - */ export class NoSurrenderDecider extends ConsequenceFunctionDecider { constructor () { super( diff --git a/src/game/combat/perks.ts b/src/game/combat/perks.ts index 9e5a139..81a5466 100644 --- a/src/game/combat/perks.ts +++ b/src/game/combat/perks.ts @@ -1,4 +1,4 @@ -import { Effective } from '../combat' +import { Effective, Damage, DamageType } from '../combat' import { TextLike } from '../language' import { Creature } from '../creature' import { TestCategory } from './tests' @@ -9,6 +9,36 @@ export abstract class Perk extends Effective { } } +export class BellyBulwakPerk extends Perk { + constructor () { + super( + "Belly Bulwark", + "Take 50% less damage for every bodyweight's worth of prey in you" + ) + } + + preDamage (creature: Creature, damage: Damage): Damage { + const newDamage = new Damage() + + damage.damages.forEach( + instance => { + const affected = (instance.type !== DamageType.Pure && instance.type !== DamageType.Heal) + const bulk = creature.voreStats.Bulk + const mass = creature.voreStats.Mass + const modifier = Math.pow(0.5, bulk / mass) + newDamage.damages.push( + { + amount: affected ? instance.amount * modifier : instance.amount, + target: instance.target, + type: instance.type + } + ) + } + ) + return newDamage + } +} + export class RavenousPerk extends Perk { constructor () { super( diff --git a/src/game/creatures/player.ts b/src/game/creatures/player.ts index a3eed0a..ee0e5bc 100644 --- a/src/game/creatures/player.ts +++ b/src/game/creatures/player.ts @@ -7,6 +7,7 @@ import { TogetherCondition } from '../combat/conditions' import { DamageConsequence } from '../combat/consequences' import { OpposedStatTest, TestCategory } from '../combat/tests' import { LogLine } from '../interface' +import { RavenousPerk, BellyBulwakPerk } from '../combat/perks' export class Player extends Creature { constructor () { @@ -30,6 +31,9 @@ export class Player extends Creature { this.containers.push(bowels) this.perspective = POV.Second + this.perks.push(new RavenousPerk()) + this.perks.push(new BellyBulwakPerk()) + this.actions.push( new CompositionAction( "Bite",