Sfoglia il codice sorgente

Add newline elements and solo-pov text with arguments

master
Fen Dweller 5 anni fa
parent
commit
54a7f1b014
3 ha cambiato i file con 33 aggiunte e 3 eliminazioni
  1. +11
    -3
      src/game/creatures/withers.ts
  2. +6
    -0
      src/game/interface.ts
  3. +16
    -0
      src/game/language.ts

+ 11
- 3
src/game/creatures/withers.ts Vedi File

@@ -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<Creature, { count: number }>([
[[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<Creature>): 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 })
]
))
}



+ 6
- 0
src/game/interface.ts Vedi File

@@ -114,6 +114,12 @@ export class LogLine implements LogEntry {
}
}

export class Newline implements LogEntry {
render (): HTMLElement[] {
return [document.createElement("br")]
}
}

/**
* Produces a FontAwesome icon
*/


+ 16
- 0
src/game/language.ts Vedi File

@@ -48,6 +48,22 @@ export class POVSolo<K extends Entity> {
}
}

export class POVSoloArgs<K extends Entity, U> {
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,


Loading…
Annulla
Salva