diff --git a/src/game/creatures/wolf.ts b/src/game/creatures/wolf.ts index 63dc8d2..89e83e5 100644 --- a/src/game/creatures/wolf.ts +++ b/src/game/creatures/wolf.ts @@ -1,7 +1,7 @@ import { Creature } from "../creature" import { Damage, DamageType, ConstantDamageFormula, Vigor, Side } from '../combat' import { MalePronouns, ImproperNoun, ProperNoun, ObjectPronouns, FemalePronouns, TheyPronouns } from '../language' -import { VoreType, Stomach, Bowels, Cock, Balls, anyVore, Slit, Womb } from '../vore' +import { VoreType, Stomach, Bowels, Cock, Balls, anyVore, Slit, Womb, biconnectContainers } from '../vore' import { AttackAction, TransferAction, FeedAction } from '../combat/actions' import { Human } from '../creatures' @@ -73,15 +73,10 @@ export class Wolf extends Creature { this.containers.push(balls) this.containers.push(cock) - this.containers.push(slit) this.containers.push(womb) + this.containers.push(slit) - this.actions.push( - new TransferAction(cock, balls) - ) - - this.actions.push( - new TransferAction(slit, womb) - ) + biconnectContainers(cock, balls) + biconnectContainers(slit, womb) } } diff --git a/src/game/maps/town.ts b/src/game/maps/town.ts index 52cf868..9663a18 100644 --- a/src/game/maps/town.ts +++ b/src/game/maps/town.ts @@ -7,6 +7,7 @@ import { LogLine, nilLog } from '../interface' import { Creature } from '../creature' import { DevourAction } from '../combat/actions' import { SurrenderEffect } from '../combat/effects' +import moment from 'moment' function makeParty (): Creature[] { const fighter = new Creatures.Human(new ProperNoun("Redgar"), MalePronouns, { @@ -128,6 +129,15 @@ export const Town = (): Place => { ) ] + home.choices.push( + new Choice( + "Nap", + "Zzzzzz", + (world, executor) => { + return world.advance(moment.duration(1, "hour")) + } + ) + ) home.choices.push( new Choice( "Eat someone", diff --git a/src/game/vore.ts b/src/game/vore.ts index 7e1fb85..018b9a9 100644 --- a/src/game/vore.ts +++ b/src/game/vore.ts @@ -1,8 +1,8 @@ import { Mortal } from './entity' import { Damage, DamageType, Stats, Actionable, Action, Vigor, VoreStats, VisibleStatus, VoreStat, DamageInstance } from './combat' -import { LogLines, LogEntry, LogLine } from './interface' +import { LogLines, LogEntry, LogLine, nilLog } from './interface' import { Noun, Pronoun, ImproperNoun, TextLike, Verb, SecondPersonPronouns, PronounAsNoun, FirstPersonPronouns, PairLineArgs, SoloLine, POV } from './language' -import { DigestAction, DevourAction, ReleaseAction, StruggleAction } from './combat/actions' +import { DigestAction, DevourAction, ReleaseAction, StruggleAction, TransferAction } from './combat/actions' import * as Words from './words' export enum VoreType { @@ -230,7 +230,11 @@ export interface VoreContainer extends Container { digested: Array; tick: (dt: number) => LogEntry; digest: (preys: Vore[]) => LogEntry; + absorb: (preys: Vore[]) => LogEntry; fluidColor: string; + + onDigest: (prey: Vore) => LogEntry; + onAbsorb: (prey: Vore) => LogEntry; } export abstract class NormalVoreContainer extends NormalContainer implements VoreContainer { @@ -287,6 +291,7 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor prey.destroyed = true this.digested.push(prey) justDigested.push(prey) + this.onDigest(prey) } }) @@ -307,6 +312,7 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor if (prey.voreStats.Mass === 0) { this.absorbed.push(prey) justAbsorbed.push(prey) + this.onAbsorb(prey) } }) @@ -332,6 +338,14 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor digest (preys: Vore[]): LogEntry { return new LogLines(...preys.map(prey => this.digestLine(this.owner, prey, { container: this }))) } + + onAbsorb (prey: Vore): LogEntry { + return nilLog + } + + onDigest (prey: Vore): LogEntry { + return nilLog + } } export abstract class InnerVoreContainer extends NormalVoreContainer { @@ -448,3 +462,24 @@ export class Womb extends InnerVoreContainer { ) } } + +export function biconnectContainers (outer: VoreContainer, inner: VoreContainer): void { + outer.onDigest = (prey: Vore) => { + outer.digested = outer.digested.filter(victim => victim !== prey) + return inner.consume(prey) + } + + outer.actions.push( + new TransferAction( + outer, + inner + ) + ) + + inner.actions.push( + new TransferAction( + inner, + outer + ) + ) +}