Browse Source

Switch vore containers to use methods, not properties, for lines; add some variety

vintage
Fen Dweller 5 years ago
parent
commit
d91ca8fb59
4 changed files with 68 additions and 35 deletions
  1. +17
    -0
      src/game/interface.ts
  2. +1
    -1
      src/game/maps/town.ts
  3. +44
    -34
      src/game/vore.ts
  4. +6
    -0
      src/game/words.ts

+ 17
- 0
src/game/interface.ts View File

@@ -129,6 +129,23 @@ export class LogLine implements LogEntry {
} }
} }


export class RandomEntry implements LogEntry {
private options: Array<LogEntry>

constructor (...options: Array<LogEntry>) {
this.options = options
}

render (): HTMLElement[] {
if (this.options.length === 0) {
return nilLog.render()
} else {
const choice = Math.floor(Math.random() * this.options.length)
return this.options[choice].render()
}
}
}

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


+ 1
- 1
src/game/maps/town.ts View File

@@ -248,7 +248,7 @@ export const Town = (): Place => {
"Eat someone", "Eat someone",
"Slurp", "Slurp",
(world, executor) => { (world, executor) => {
const snack = new Creatures.Human(new ProperNoun(["Snack", "Treat", "Tasty", "Dinner", "Appetizer"][Math.floor(Math.random() * 5)]), TheyPronouns)
const snack = new Creatures.Human(new ProperNoun(["Snack", "Treat", "Tasty", "Dinner", "Appetizer"][Math.floor(Math.random() * 5)]), [MalePronouns, FemalePronouns, TheyPronouns][Math.floor(Math.random() * 3)])
snack.applyEffect(new SurrenderEffect()) snack.applyEffect(new SurrenderEffect())
const options = executor.validActions(snack).filter(action => action instanceof DevourAction) const options = executor.validActions(snack).filter(action => action instanceof DevourAction)
return options[Math.floor(options.length * Math.random())].execute(executor, snack) return options[Math.floor(options.length * Math.random())].execute(executor, snack)


+ 44
- 34
src/game/vore.ts View File

@@ -1,6 +1,6 @@
import { Mortal } from './entity' import { Mortal } from './entity'
import { Damage, DamageType, Stats, Actionable, Action, Vigor, VoreStats, VisibleStatus, VoreStat, DamageInstance, DamageFormula } from './combat' import { Damage, DamageType, Stats, Actionable, Action, Vigor, VoreStats, VisibleStatus, VoreStat, DamageInstance, DamageFormula } from './combat'
import { LogLines, LogEntry, LogLine, nilLog } from './interface'
import { LogLines, LogEntry, LogLine, nilLog, RandomEntry } from './interface'
import { Noun, Pronoun, ImproperNoun, TextLike, Verb, SecondPersonPronouns, PronounAsNoun, FirstPersonPronouns, PairLineArgs, SoloLine, POV, RandomWord } from './language' import { Noun, Pronoun, ImproperNoun, TextLike, Verb, SecondPersonPronouns, PronounAsNoun, FirstPersonPronouns, PairLineArgs, SoloLine, POV, RandomWord } from './language'
import { RubAction, DevourAction, ReleaseAction, StruggleAction, TransferAction } from './combat/actions' import { RubAction, DevourAction, ReleaseAction, StruggleAction, TransferAction } from './combat/actions'
import * as Words from './words' import * as Words from './words'
@@ -40,7 +40,7 @@ export interface Container extends Actionable {
releaseVerb: Verb; releaseVerb: Verb;
struggleVerb: Verb; struggleVerb: Verb;


consumeLine: PairLineArgs<Creature, { container: Container }>;
consumeLine (user: Creature, target: Creature): LogEntry;


} }


@@ -64,16 +64,16 @@ export abstract class NormalContainer implements Container {
return this.capacityFactor * this.owner.voreStats.Mass return this.capacityFactor * this.owner.voreStats.Mass
} }


consumeLine: PairLineArgs<Creature, { container: Container }> = (user, target, args) => {
return new LogLine(`${user.name.capital} ${user.name.conjugate(this.consumeVerb)} ${target.name.objective} in ${user.pronouns.possessive} ${args.container.name}.`)
consumeLine (user: Creature, target: Creature): LogEntry {
return new LogLine(`${user.name.capital} ${user.name.conjugate(this.consumeVerb)} ${target.name.objective} in ${user.pronouns.possessive} ${this.name}.`)
} }


releaseLine: PairLineArgs<Creature, { container: Container }> = (user, target, args) => {
return new LogLine(`${user.name.capital} ${user.name.conjugate(this.releaseVerb)} ${target.name.objective} up from ${user.pronouns.possessive} ${args.container.name}.`)
releaseLine (user: Creature, target: Creature): LogEntry {
return new LogLine(`${user.name.capital} ${user.name.conjugate(this.releaseVerb)} ${target.name.objective} up from ${user.pronouns.possessive} ${this.name}.`)
} }


struggleLine: PairLineArgs<Creature, { container: Container }> = (user, target, args) => {
return new LogLine(`${user.name.capital} ${user.name.conjugate(this.struggleVerb)} within ${target.name.possessive} ${args.container.name}.`)
struggleLine (user: Creature, target: Creature): LogEntry {
return new LogLine(`${user.name.capital} ${user.name.conjugate(this.struggleVerb)} within ${target.name.possessive} ${this.name}.`)
} }


get fullness (): number { get fullness (): number {
@@ -96,7 +96,7 @@ export abstract class NormalContainer implements Container {
} }
this.contents.push(prey) this.contents.push(prey)
prey.containedIn = this prey.containedIn = this
return this.consumeLine(this.owner, prey, { container: this })
return this.consumeLine(this.owner, prey)
} }


release (prey: Creature): LogEntry { release (prey: Creature): LogEntry {
@@ -106,11 +106,11 @@ export abstract class NormalContainer implements Container {
if (this.owner.containedIn !== null) { if (this.owner.containedIn !== null) {
this.owner.containedIn.contents.push(prey) this.owner.containedIn.contents.push(prey)
} }
return this.releaseLine(this.owner, prey, { container: this })
return this.releaseLine(this.owner, prey)
} }


struggle (prey: Creature): LogEntry { struggle (prey: Creature): LogEntry {
return this.struggleLine(prey, this.owner, { container: this })
return this.struggleLine(prey, this.owner)
} }


describe (): LogEntry { describe (): LogEntry {
@@ -148,7 +148,7 @@ export abstract class InnerContainer extends NormalContainer {
release (prey: Creature): LogEntry { release (prey: Creature): LogEntry {
prey.containedIn = this.escape prey.containedIn = this.escape
this.contents = this.contents.filter(victim => victim !== prey) this.contents = this.contents.filter(victim => victim !== prey)
return this.releaseLine(this.owner, prey, { container: this })
return this.releaseLine(this.owner, prey)
} }
} }


@@ -184,20 +184,27 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor
return Array.from(this.contents.concat(this.digested, this.absorbed).values()).reduce((total: number, prey: Creature) => total + prey.voreStats.Bulk, 0) return Array.from(this.contents.concat(this.digested, this.absorbed).values()).reduce((total: number, prey: Creature) => total + prey.voreStats.Bulk, 0)
} }


consumeLine: PairLineArgs<Creature, { container: Container }> = (user, target, args) => {
return new LogLine(`${user.name.capital} ${user.name.conjugate(this.consumeVerb)} ${target.name.objective}, forcing ${target.pronouns.objective} into ${user.pronouns.possessive} ${args.container.name}.`)
consumeLine (user: Creature, target: Creature) {
return new RandomEntry(
new LogLine(`${user.name.capital} ${user.name.conjugate(this.consumeVerb)} ${target.name.objective}, forcing ${target.pronouns.objective} into ${user.pronouns.possessive} ${this.name}.`),
new LogLine(`${user.name.capital} ${user.name.conjugate(new Verb("pounce"))} on ${target.name.objective} and ${user.name.conjugate(this.consumeVerb)} ${target.pronouns.objective}, ${Words.Force.present} ${target.pronouns.objective} into ${user.pronouns.possessive} ${this.name}.`)
)
} }


tickLine: PairLineArgs<Creature, { container: VoreContainer; damage: Damage }> = (user, target, args) => {
return new LogLine(`${user.name.capital} ${user.name.conjugate(Words.Churns)} ${target.name.objective} in ${user.pronouns.possessive} ${args.container.name} for `, args.damage.renderShort(), `.`)
tickLine (user: Creature, target: Creature, args: { damage: Damage }): LogEntry {
return new RandomEntry(
new LogLine(`${user.name.capital} ${user.name.conjugate(Words.Churns)} ${target.name.objective} in ${user.pronouns.possessive} ${this.name} for `, args.damage.renderShort(), `.`),
new LogLine(`${user.name.capital.possessive} ${this.name} ${Words.Churns}, stewing ${target.name.objective} for `, args.damage.renderShort(), `.`),
new LogLine(`${target.name.capital} ${target.name.conjugate(new Verb("thrash", "thrashes"))} in ${user.name.possessive} ${Words.Slick} ${this.name} as it churns ${target.pronouns.objective} for `, args.damage.renderShort(), `.`)
)
} }


digestLine: PairLineArgs<Creature, { container: VoreContainer }> = (user, target, args) => {
return new LogLine(`${user.name.capital.possessive} ${args.container.name} ${args.container.name.conjugate(new Verb('finish', 'finishes'))} ${Words.Digests.present} ${target.name.objective} down, ${target.pronouns.possessive} ${Words.Struggles.singular} fading away.`)
digestLine (user: Creature, target: Creature): LogEntry {
return new LogLine(`${user.name.capital.possessive} ${this.name} ${this.name.conjugate(new Verb('finish', 'finishes'))} ${Words.Digests.present} ${target.name.objective} down, ${target.pronouns.possessive} ${Words.Struggles.singular} fading away.`)
} }


absorbLine: PairLineArgs<Creature, { container: VoreContainer }> = (user, target, args) => {
return new LogLine(`${user.name.capital.possessive} ${args.container.name} ${args.container.name.conjugate(new Verb('finish', 'finishes'))} ${Words.Absorbs.present} ${target.name.objective}, fully claiming ${target.pronouns.objective}.`)
absorbLine (user: Creature, target: Creature): LogEntry {
return new LogLine(`${user.name.capital.possessive} ${this.name} ${this.name.conjugate(new Verb('finish', 'finishes'))} ${Words.Absorbs.present} ${target.name.objective}, fully claiming ${target.pronouns.objective}.`)
} }


tick (dt: number): LogEntry { tick (dt: number): LogEntry {
@@ -210,7 +217,7 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor


this.contents.forEach(prey => { this.contents.forEach(prey => {
const scaled = this.damage.calc(this.owner, prey).scale(dt / 60) const scaled = this.damage.calc(this.owner, prey).scale(dt / 60)
tickedEntryList.push(this.tickLine(this.owner, prey, { container: this, damage: scaled }))
tickedEntryList.push(this.tickLine(this.owner, prey, { damage: scaled }))


damageResults.push(prey.takeDamage(scaled)) damageResults.push(prey.takeDamage(scaled))


@@ -258,11 +265,11 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor
} }


absorb (preys: Creature[]): LogEntry { absorb (preys: Creature[]): LogEntry {
return new LogLines(...preys.map(prey => this.absorbLine(this.owner, prey, { container: this })))
return new LogLines(...preys.map(prey => this.absorbLine(this.owner, prey)))
} }


digest (preys: Creature[]): LogEntry { digest (preys: Creature[]): LogEntry {
return new LogLines(...preys.map(prey => this.digestLine(this.owner, prey, { container: this })))
return new LogLines(...preys.map(prey => this.digestLine(this.owner, prey)))
} }


onAbsorb (prey: Creature): LogEntry { onAbsorb (prey: Creature): LogEntry {
@@ -288,7 +295,7 @@ export abstract class InnerVoreContainer extends NormalVoreContainer {
prey.containedIn = this.escape prey.containedIn = this.escape
this.contents = this.contents.filter(victim => victim !== prey) this.contents = this.contents.filter(victim => victim !== prey)
this.escape.consume(prey) this.escape.consume(prey)
return this.releaseLine(this.owner, prey, { container: this })
return this.releaseLine(this.owner, prey)
} }
} }


@@ -330,13 +337,16 @@ export class Bowels extends NormalVoreContainer {
super(new ImproperNoun('bowel', 'bowels').plural.all, owner, new Set([VoreType.Anal]), capacity, damage) super(new ImproperNoun('bowel', 'bowels').plural.all, owner, new Set([VoreType.Anal]), capacity, damage)
} }


tickLine: PairLineArgs<Creature, { container: VoreContainer; damage: Damage }> = (user, target, args) => {
return new LogLine(`${user.name.capital} ${user.name.conjugate(
new RandomWord([
new Verb('crush', 'crushes'),
new Verb('clench', 'clenches')
])
)} ${target.name.objective} in ${user.pronouns.possessive} ${args.container.name} for `, args.damage.renderShort(), `.`)
tickLine (user: Creature, target: Creature, args: { damage: Damage }) {
return new RandomEntry(
new LogLine(`${user.name.capital} ${user.name.conjugate(
new RandomWord([
new Verb('crush', 'crushes'),
new Verb('clench', 'clenches')
])
)} ${target.name.objective} in ${user.pronouns.possessive} ${this.name} for `, args.damage.renderShort(), `.`),
super.tickLine(user, target, args)
)
} }
} }


@@ -353,13 +363,13 @@ export class Cock extends NormalVoreContainer {
) )
} }


tickLine: PairLineArgs<Creature, { container: VoreContainer; damage: Damage }> = (user, target, args) => {
tickLine (user: Creature, target: Creature, args: { damage: Damage }): LogEntry {
return new LogLine(`${user.name.capital} ${user.name.conjugate( return new LogLine(`${user.name.capital} ${user.name.conjugate(
new RandomWord([ new RandomWord([
new Verb('crush', 'crushes'), new Verb('crush', 'crushes'),
new Verb('clench', 'clenches') new Verb('clench', 'clenches')
]) ])
)} ${target.name.objective} in ${user.pronouns.possessive} ${args.container.name}.`)
)} ${target.name.objective} in ${user.pronouns.possessive} ${this.name}.`)
} }
} }


@@ -411,7 +421,7 @@ export function biconnectContainers (outer: VoreContainer, inner: VoreContainer)
outer.onDigest = (prey: Creature) => { outer.onDigest = (prey: Creature) => {
outer.digested = outer.digested.filter(victim => victim !== prey) outer.digested = outer.digested.filter(victim => victim !== prey)
inner.digested.push(prey) inner.digested.push(prey)
return inner.consumeLine(inner.owner, prey, { container: inner })
return inner.consumeLine(inner.owner, prey)
} }


outer.actions.push( outer.actions.push(


+ 6
- 0
src/game/words.ts View File

@@ -68,3 +68,9 @@ export const Brutally = new RandomWord([
new Adjective('ruthlessly'), new Adjective('ruthlessly'),
new Adjective('mercilessly') new Adjective('mercilessly')
]) ])

export const Force = new RandomWord([
new Verb("force", "forces", "forcing", "forced"),
new Verb("cram", "crams", "cramming", "crammed"),
new Verb("stuff", "stuffs", "stuffing", "stuffed")
])

Loading…
Cancel
Save