|
|
|
@@ -160,7 +160,7 @@ export abstract class InnerContainer extends NormalContainer { |
|
|
|
|
|
|
|
export interface VoreContainer extends Container { |
|
|
|
digested: Array<Creature>; |
|
|
|
tick: (dt: number) => LogEntry; |
|
|
|
tick: (dt: number, victims?: Array<Creature>) => LogEntry; |
|
|
|
digest: (preys: Creature[]) => LogEntry; |
|
|
|
absorb: (preys: Creature[]) => LogEntry; |
|
|
|
sound: Word; |
|
|
|
@@ -222,7 +222,7 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor |
|
|
|
return new LogLine(`${user.name.capital.possessive} ${this.name} ${this.name.conjugate(new Verb('finish', 'finishes'))} ${Words.Absorb.present} ${target.name.objective}, fully claiming ${target.pronouns.objective}.`) |
|
|
|
} |
|
|
|
|
|
|
|
tick (dt: number): LogEntry { |
|
|
|
tick (dt: number, victims?: Array<Creature>): LogEntry { |
|
|
|
const justDigested: Array<Creature> = [] |
|
|
|
const justAbsorbed: Array<Creature> = [] |
|
|
|
|
|
|
|
@@ -230,7 +230,8 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor |
|
|
|
|
|
|
|
const tickedEntryList: LogEntry[] = [] |
|
|
|
|
|
|
|
this.contents.forEach(prey => { |
|
|
|
const victimList = victims ?? this.contents |
|
|
|
victimList.forEach(prey => { |
|
|
|
const scaled = this.damage.calc(this.owner, prey).scale(dt / 60) |
|
|
|
const modified = this.owner.effects.reduce((damage, effect) => effect.modDigestionDamage(this.owner, prey, this, damage), scaled) |
|
|
|
tickedEntryList.push(this.tickLine(this.owner, prey, { damage: modified })) |
|
|
|
@@ -288,6 +289,13 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor |
|
|
|
return new LogLines(...preys.map(prey => this.digestLine(this.owner, prey))) |
|
|
|
} |
|
|
|
|
|
|
|
consume (prey: Creature): LogEntry { |
|
|
|
const logLine = super.consume(prey) |
|
|
|
const results: Array<LogEntry> = [] |
|
|
|
this.owner.effects.forEach(effect => results.push(effect.postConsume(this.owner, prey, this))) |
|
|
|
return new LogLines(...[logLine].concat(results)) |
|
|
|
} |
|
|
|
|
|
|
|
onAbsorb (prey: Creature): LogEntry { |
|
|
|
return nilLog |
|
|
|
} |
|
|
|
@@ -486,10 +494,12 @@ export class InnerBladder extends InnerVoreContainer { |
|
|
|
} |
|
|
|
|
|
|
|
export function biconnectContainers (outer: VoreContainer, inner: VoreContainer): void { |
|
|
|
const old = outer.onDigest |
|
|
|
outer.onDigest = (prey: Creature) => { |
|
|
|
const oldResult = old(prey) |
|
|
|
outer.digested = outer.digested.filter(victim => victim !== prey) |
|
|
|
inner.digested.push(prey) |
|
|
|
return inner.consumeLine(inner.owner, prey) |
|
|
|
return new LogLines(oldResult, inner.consumeLine(inner.owner, prey), inner.tick(0, [prey])) |
|
|
|
} |
|
|
|
|
|
|
|
outer.actions.push( |
|
|
|
|