diff --git a/src/game/creatures/withers.ts b/src/game/creatures/withers.ts index 8c0f5db..3c7307e 100644 --- a/src/game/creatures/withers.ts +++ b/src/game/creatures/withers.ts @@ -1,10 +1,10 @@ import { Creature, POV } from '../entity' -import { Damage, DamageType, ConstantDamageFormula, Vigor, Side, GroupAction, CombatTest, Stat, DamageFormula, UniformRandomDamageFormula, Action } from '../combat' +import { Damage, DamageType, ConstantDamageFormula, Vigor, Side, GroupAction, CombatTest, Stat, DamageFormula, UniformRandomDamageFormula, Action, DamageInstance } from '../combat' import { ImproperNoun, POVPair, ProperNoun, FemalePronouns, RandomWord, Adjective, POVPairArgs, POVSoloArgs, Verb } from '../language' import { LogLine, LogLines, LogEntry, Newline } from '../interface' import { VoreType, Stomach, VoreContainer, Vore, NormalContainer, Container } from '../vore' import { AttackAction, FeedAction, TransferAction, EatenAction } from '../combat/actions' -import { TogetherCondition, ContainerCondition, EnemyCondition } from '../combat/conditions' +import { TogetherCondition, ContainerCondition, EnemyCondition, AllyCondition } from '../combat/conditions' import { InstantKill } from '../combat/effects' import * as Words from '../words' import { StatVigorTest } from '../combat/tests' @@ -190,6 +190,44 @@ class StompAction extends GroupAction { } } +class StompAllyAction extends Action { + lines: POVPair = new POVPair([ + [[POV.First, POV.Third], (user: Creature, target: Creature) => new LogLine(`You flatten ${target.name} under your boot!`)], + [[POV.Third, POV.First], (user: Creature) => new LogLine(`${user.name.capital} flattens you under ${user.pronouns.possessive} ${huge} boot!`)], + [[POV.Third, POV.Third], (user: Creature, target: Creature) => new LogLine(`${user.name.capital} flattens ${target.name} under ${user.pronouns.possessive} ${huge} boot!`)] + ]) + + execute (user: Creature, target: Creature): LogEntry { + const damages: Array = Object.keys(Stat).map(stat => ({ + target: stat as Stat, + amount: target.stats[stat as Stat] / 5, + type: DamageType.Heal + })) + + const heal = new Damage( + ...damages + ) + user.takeDamage(heal) + + return new LogLines( + this.lines.run(user, target), + new InstantKill().apply(target), + new LogLine(`${user.name.capital} absorbs ${target.pronouns.possessive} power, gaining `, heal.renderShort()) + ) + } + + describe (user: Creature, target: Creature): LogEntry { + return new LogLine('Crush an ally to absorb their power') + } + + constructor () { + super('Stomp Ally', '-1 ally, +1 buff', [ + new TogetherCondition(), + new AllyCondition() + ]) + } +} + class DevourAllAction extends GroupAction { lines: POVPair = new POVPair([ [[POV.First, POV.Third], (user: Creature, target: Creature) => new LogLine(`You scoop up ${target.name}!`)], @@ -292,5 +330,6 @@ export class Withers extends Creature { const boot = new BootContainer(this) this.otherContainers.push(boot) + this.actions.push(new StompAllyAction()) } }