|
|
|
@@ -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( |
|
|
|
|