Browse Source

Add another perk; give the player both

master
Fen Dweller 5 years ago
parent
commit
6404603bcb
3 changed files with 35 additions and 4 deletions
  1. +0
    -3
      src/game/ai/deciders.ts
  2. +31
    -1
      src/game/combat/perks.ts
  3. +4
    -0
      src/game/creatures/player.ts

+ 0
- 3
src/game/ai/deciders.ts View File

@@ -81,9 +81,6 @@ export class ConsequenceFunctionDecider implements Decider {
} }
} }


/**
* A [[ConsequenceFunctionDecider]] that filters out status effects
*/
export class NoSurrenderDecider extends ConsequenceFunctionDecider { export class NoSurrenderDecider extends ConsequenceFunctionDecider {
constructor () { constructor () {
super( super(


+ 31
- 1
src/game/combat/perks.ts View File

@@ -1,4 +1,4 @@
import { Effective } from '../combat'
import { Effective, Damage, DamageType } from '../combat'
import { TextLike } from '../language' import { TextLike } from '../language'
import { Creature } from '../creature' import { Creature } from '../creature'
import { TestCategory } from './tests' 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 { export class RavenousPerk extends Perk {
constructor () { constructor () {
super( super(


+ 4
- 0
src/game/creatures/player.ts View File

@@ -7,6 +7,7 @@ import { TogetherCondition } from '../combat/conditions'
import { DamageConsequence } from '../combat/consequences' import { DamageConsequence } from '../combat/consequences'
import { OpposedStatTest, TestCategory } from '../combat/tests' import { OpposedStatTest, TestCategory } from '../combat/tests'
import { LogLine } from '../interface' import { LogLine } from '../interface'
import { RavenousPerk, BellyBulwakPerk } from '../combat/perks'


export class Player extends Creature { export class Player extends Creature {
constructor () { constructor () {
@@ -30,6 +31,9 @@ export class Player extends Creature {
this.containers.push(bowels) this.containers.push(bowels)
this.perspective = POV.Second this.perspective = POV.Second


this.perks.push(new RavenousPerk())
this.perks.push(new BellyBulwakPerk())

this.actions.push( this.actions.push(
new CompositionAction( new CompositionAction(
"Bite", "Bite",


Loading…
Cancel
Save