ソースを参照

Add another perk; give the player both

vintage
Fen Dweller 5年前
コミット
6404603bcb
3個のファイルの変更35行の追加4行の削除
  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 ファイルの表示

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

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


+ 31
- 1
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(


+ 4
- 0
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",


読み込み中…
キャンセル
保存