From 54a7f1b014de7b0898a841587ddd7c7d9c105546 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Thu, 16 Jul 2020 11:01:22 -0400 Subject: [PATCH] Add newline elements and solo-pov text with arguments --- src/game/creatures/withers.ts | 14 +++++++++++--- src/game/interface.ts | 6 ++++++ src/game/language.ts | 16 ++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/game/creatures/withers.ts b/src/game/creatures/withers.ts index c57776b..912558f 100644 --- a/src/game/creatures/withers.ts +++ b/src/game/creatures/withers.ts @@ -1,7 +1,7 @@ import { Creature, POV } from '../entity' import { Damage, DamageType, ConstantDamageFormula, Vigor, Side, GroupAction } from '../combat' -import { ImproperNoun, POVPair, ProperNoun, FemalePronouns, RandomWord, Adjective, POVPairArgs } from '../language' -import { LogLine, LogLines, LogEntry } from '../interface' +import { ImproperNoun, POVPair, ProperNoun, FemalePronouns, RandomWord, Adjective, POVPairArgs, POVSoloArgs } from '../language' +import { LogLine, LogLines, LogEntry, Newline } from '../interface' import { VoreType, Stomach, Container, Vore } from '../vore' import { AttackAction, FeedAction } from '../combat/actions' import { TogetherCondition } from '../combat/conditions' @@ -57,6 +57,11 @@ class DevourAllAction extends GroupAction { [[POV.Third, POV.Third], (user: Creature, target: Creature) => new LogLine(`${user.name.capital} scoops ${target.name} up!`)] ]) + groupLines = new POVSoloArgs([ + [[POV.First], (user, args) => new LogLine(`${Words.SwallowSound.allCaps}! All ${args.count} of your prey pour down your ${Words.Slick} throat. They're just ${user.kind.all} chow now`)], + [[POV.Third], (user, args) => new LogLine(`${Words.SwallowSound.allCaps}! All ${args.count} of ${user.pronouns.possessive} prey pour down ${user.name}'s ${Words.Slick} gullet as ${user.pronouns.subjective} ${Words.Swallows.singular}; they're just ${user.kind.all} chow now`)] + ]) + execute (user: Creature, target: Creature): LogEntry { this.container.consume(target) return new LogLines(this.lines.run(user, target)) @@ -68,7 +73,10 @@ class DevourAllAction extends GroupAction { executeGroup (user: Creature, targets: Array): LogEntry { return new LogLines(...targets.map(target => this.execute(user, target)).concat( - [new LogLine(`${Words.SwallowSound.allCaps}! All ${targets.length} of them pour down ${user.name}'s ${Words.Slick} gullet as ${user.pronouns.possessive} ${Words.Swallows.singular}; they're just ${user.kind.all} chow now`)] + [ + new Newline(), + this.groupLines.run(user, { count: targets.length }) + ] )) } diff --git a/src/game/interface.ts b/src/game/interface.ts index bcc95a1..02b0985 100644 --- a/src/game/interface.ts +++ b/src/game/interface.ts @@ -114,6 +114,12 @@ export class LogLine implements LogEntry { } } +export class Newline implements LogEntry { + render (): HTMLElement[] { + return [document.createElement("br")] + } +} + /** * Produces a FontAwesome icon */ diff --git a/src/game/language.ts b/src/game/language.ts index d93c6a7..3f8ead1 100644 --- a/src/game/language.ts +++ b/src/game/language.ts @@ -48,6 +48,22 @@ export class POVSolo { } } +export class POVSoloArgs { + run (user: K, args: U): LogEntry { + const choice = this.options.find(element => element[0][0] === user.perspective) + + if (choice === undefined) { + return new LogLine("Fen didn't write any text for this...") + } else { + return choice[1](user, args) + } + } + + constructor (private options: Array<[[POV], (user: K, args: U) => LogEntry]>) { + + } +} + enum NounKind { Specific, Nonspecific,