diff --git a/src/game/combat/actions.ts b/src/game/combat/actions.ts index 9bab1d4..b60b8c7 100644 --- a/src/game/combat/actions.ts +++ b/src/game/combat/actions.ts @@ -7,6 +7,9 @@ import { LogLine, LogLines, LogEntry, nilLog } from '../interface' import { VoreContainer, Container } from '../vore' import { CapableCondition, UserDrainedVigorCondition, TogetherCondition, EnemyCondition, SoloCondition, PairCondition, ContainsCondition, ContainedByCondition } from './conditions' +/** + * The PassAction has no effect. + */ export class PassAction extends Action { constructor () { super("Pass", "Do nothing", [new SoloCondition()]) @@ -21,6 +24,9 @@ export class PassAction extends Action { } } +/** + * A generic action that causes damage. + */ export abstract class DamageAction extends Action { protected test: StatTest @@ -53,6 +59,9 @@ export abstract class DamageAction extends Action { } } +/** + * Adds flavor text to [[DamageAction]] + */ export class AttackAction extends DamageAction { constructor (damage: DamageFormula, protected verb: Verb = new Verb('smack')) { super(verb.root.capital, 'Attack the enemy', damage, [new TogetherCondition()]) @@ -72,6 +81,9 @@ export class AttackAction extends DamageAction { ) } +/** + * Devours the target. + */ export class DevourAction extends Action { private test: StatVigorTest @@ -113,6 +125,9 @@ export class DevourAction extends Action { ) } +/** + * Causes the user to be eaten by the target. + */ export class FeedAction extends Action { constructor (protected container: Container) { super( @@ -152,6 +167,9 @@ export class FeedAction extends Action { ) } +/** + * Tries to escape from the target's container + */ export class StruggleAction extends Action { private test: StatVigorTest @@ -189,24 +207,6 @@ export class StruggleAction extends Action { ) } -export abstract class EatenAction extends Action { - constructor (public container: Container, name: TextLike, desc: string) { - super( - new DynText(name, ' (', new LiveText(container, x => x.name.all), ')'), - desc, - [new CapableCondition(), new PairCondition()] - ) - } - - allowed (user: Creature, target: Creature) { - if (target.containedIn === this.container) { - return super.allowed(user, target) - } else { - return false - } - } -} - export class DigestAction extends Action { constructor (protected container: VoreContainer) { super( diff --git a/src/game/combat/consequences.ts b/src/game/combat/consequences.ts index 788c9a1..9172293 100644 --- a/src/game/combat/consequences.ts +++ b/src/game/combat/consequences.ts @@ -33,6 +33,7 @@ export class LogConsequence extends Consequence { return this.line(user, target) } } + /** * Deals damage. */ @@ -83,7 +84,6 @@ export class HealingConsequence extends Consequence { /** * Applies a status effect */ - export class StatusConsequence extends Consequence { constructor (private statusMaker: () => StatusEffect, conditions: Condition[] = []) { super(conditions) diff --git a/src/game/creatures/cafat.ts b/src/game/creatures/cafat.ts index 31cd0f0..e8ab202 100644 --- a/src/game/creatures/cafat.ts +++ b/src/game/creatures/cafat.ts @@ -1,11 +1,12 @@ import { Creature } from "../creature" -import { Stat, Damage, DamageType, Vigor, ConstantDamageFormula, Side } from '../combat' +import { Stat, Damage, DamageType, Vigor, ConstantDamageFormula, Side, Action } from '../combat' import { ProperNoun, TheyPronouns, ImproperNoun, FemalePronouns, Verb, PairLineArgs } from '../language' import { VoreType, Stomach, InnerStomach, VoreContainer } from '../vore' import { LogLine, LogLines, LogEntry, FAElem, ImgElem } from '../interface' -import { AttackAction, EatenAction, TransferAction, FeedAction } from '../combat/actions' +import { AttackAction, TransferAction, FeedAction } from '../combat/actions' import { InstantKillEffect } from '../combat/effects' import * as Words from '../words' +import { ContainedByCondition } from '../combat/conditions' class BellyCrushAction extends AttackAction { constructor (_damage: Damage) { @@ -44,9 +45,15 @@ class BelchAction extends AttackAction { ) } -class CrushAction extends EatenAction { - constructor (private _container: VoreContainer) { - super(_container, "Crush", "Crush 'em!") +class CrushAction extends Action { + constructor (private container: VoreContainer) { + super( + "Crush", + "Crush 'em!", + [ + new ContainedByCondition(container) + ] + ) this.desc = "Crush somebody in your gut" } @@ -55,7 +62,7 @@ class CrushAction extends EatenAction { } execute (user: Creature, target: Creature): LogEntry { - return new LogLines(this.line(user, target, { container: this._container }), target.applyEffect(new InstantKillEffect())) + return new LogLines(this.line(user, target, { container: this.container }), target.applyEffect(new InstantKillEffect())) } line: PairLineArgs = (user, target, args) => new LogLine(