Browse Source

Automatically move prey when they're digested

master
Fen Dweller 5 years ago
parent
commit
ab2ea91998
3 changed files with 51 additions and 11 deletions
  1. +4
    -9
      src/game/creatures/wolf.ts
  2. +10
    -0
      src/game/maps/town.ts
  3. +37
    -2
      src/game/vore.ts

+ 4
- 9
src/game/creatures/wolf.ts View File

@@ -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)
}
}

+ 10
- 0
src/game/maps/town.ts View File

@@ -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",


+ 37
- 2
src/game/vore.ts View File

@@ -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<Vore>;
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
)
)
}

Loading…
Cancel
Save