Browse Source

Add crunches to instant digestion

This includes a new postEnter hook for status effects, so that
they can distinguish between consumption and transfer
master
Fen Dweller 3 years ago
parent
commit
fde7ed19a4
4 changed files with 56 additions and 3 deletions
  1. +11
    -0
      src/game/combat.ts
  2. +7
    -2
      src/game/combat/effects.ts
  3. +35
    -1
      src/game/onomatopoeia.ts
  4. +3
    -0
      src/game/vore.ts

+ 11
- 0
src/game/combat.ts View File

@@ -753,6 +753,17 @@ export class Effective {
return nilLog
}

/**
* Triggers after prey enters a container
*/
postEnter (
predator: Creature,
prey: Creature,
container: Container
): LogEntry {
return nilLog
}

/**
* Affects a stat
*/


+ 7
- 2
src/game/combat/effects.ts View File

@@ -10,8 +10,9 @@ import {
import { DynText, LiveText, ToBe, Verb } from "@/game/language"
import { Creature } from "../creature"
import { LogLine, LogEntry, LogLines, FAElem, nilLog } from "@/game/interface"
import { Container } from "@/game/vore"
import { Container, ContainerCapability } from "@/game/vore"
import * as Words from "@/game/words"
import * as Onomatopoeia from "@/game/onomatopoeia"

export class InstantKillEffect extends StatusEffect {
constructor () {
@@ -307,7 +308,10 @@ export class InstantDigestionEffect extends StatusEffect {
)
}

postConsume (predator: Creature, prey: Creature, container: Container) {
postEnter (predator: Creature, prey: Creature, container: Container) {
if (!container.capabilities.has(ContainerCapability.Digest)) {
return nilLog
}
prey.applyEffect(new InstantKillEffect())
predator.voreStats.Mass += prey.voreStats.Mass
prey.voreStats.Mass = 0
@@ -316,6 +320,7 @@ export class InstantDigestionEffect extends StatusEffect {
new ToBe()
)} instantly digested! `,
new FAElem("fas fa-skull"),
Onomatopoeia.makeOnomatopoeia(Onomatopoeia.Crunch),
container.tick(0, [prey])
)
}


+ 35
- 1
src/game/onomatopoeia.ts View File

@@ -1,5 +1,9 @@
import { Onomatopoeia, RandomWord } from "./language"
import { FormatEntry, FormatOpt, LogEntry, LogLine } from "./interface"
import { Onomatopoeia, RandomWord, Word } from "./language"

export function makeOnomatopoeia (word: Word): LogEntry {
return new FormatEntry(new LogLine(`${word}`), FormatOpt.Onomatopoeia)
}
export const Swallow = new RandomWord([
new Onomatopoeia([
["GL", 1, 1],
@@ -56,3 +60,33 @@ export const Gurgle = new RandomWord([
["e", 1, 1]
])
])

export const MuffledScream = new RandomWord([
new Onomatopoeia([
["m", 5, 9],
["p", 2, 4],
["h", 4, 8]
]),
new Onomatopoeia([
["h", 4, 9],
["m", 3, 8],
["p", 1, 3],
["h", 3, 5]
]),
new Onomatopoeia([
["n", 4, 9],
["g", 3, 5],
["h", 5, 10]
])
])

export const Crunch = new RandomWord([
new Onomatopoeia([
["C", 1, 1],
["R", 4, 8],
["U", 1, 3],
["N", 2, 4],
["CH", 1, 1],
["!", 1, 1]
])
])

+ 3
- 0
src/game/vore.ts View File

@@ -214,6 +214,7 @@ export abstract class DefaultContainer implements Container {
this.voreRelay.dispatch("onReleased", this, { prey: prey }),
prey.voreRelay.dispatch("onReleased", this, { prey: prey })
]

return new LogLines(...results)
}

@@ -229,6 +230,8 @@ export abstract class DefaultContainer implements Container {
prey.voreRelay.dispatch("onEntered", this, { prey: prey })
]

this.owner.effects.forEach(effect => results.push(effect.postEnter(this.owner, prey, this)))

return new LogLines(...results)
}



Loading…
Cancel
Save