Kaynağa Gözat

Make prey spill out when the pred dies

vintage
Fen Dweller 5 yıl önce
ebeveyn
işleme
576a2d597f
2 değiştirilmiş dosya ile 39 ekleme ve 9 silme
  1. +11
    -1
      src/game/entity.ts
  2. +28
    -8
      src/game/vore.ts

+ 11
- 1
src/game/entity.ts Dosyayı Görüntüle

@@ -19,9 +19,10 @@ export interface Mortal extends Entity {
takeDamage: (damage: Damage) => void;
stats: Stats;
status: string;
destroy: () => void;
}

export class Creature implements Mortal, Vore, Vore, Combatant {
export class Creature extends Vore implements Combatant {
vigors = {
[Vigor.Health]: 100,
[Vigor.Stamina]: 100,
@@ -52,6 +53,7 @@ export class Creature implements Mortal, Vore, Vore, Combatant {
containedIn: Container|null = null;

constructor (public name: Noun, public pronouns: Pronoun, public stats: Stats, public preyPrefs: Set<VoreType>, public predPrefs: Set<VoreType>, bulk: number) {
super()
this.baseBulk = bulk
}

@@ -68,6 +70,10 @@ export class Creature implements Mortal, Vore, Vore, Combatant {
this.vigors[instance.target] -= instance.amount
}
})

if (this.vigors.Health <= -100) {
this.destroy()
}
}

get status (): string {
@@ -106,4 +112,8 @@ export class Creature implements Mortal, Vore, Vore, Combatant {
return action.allowed(this, target)
})
}

destroy (): void {
super.destroy()
}
}

+ 28
- 8
src/game/vore.ts Dosyayı Görüntüle

@@ -1,7 +1,7 @@
import { Entity, Mortal, POV, Creature } from './entity'
import { Damage, Actionable, Action, DevourAction, FeedAction, DigestAction, ReleaseAction, StruggleAction, Vigor } from './combat'
import { Damage, DamageType, Stats, Actionable, Action, DevourAction, FeedAction, DigestAction, ReleaseAction, StruggleAction, Vigor } from './combat'
import { LogLines, LogEntry, CompositeLog, LogLine } from './interface'
import { Noun, POVPair, POVPairArgs, ImproperNoun } from './language'
import { Noun, Pronoun, POVPair, POVPairArgs, ImproperNoun } from './language'

export enum VoreType {
Oral = "Oral Vore",
@@ -10,12 +10,32 @@ export enum VoreType {
Unbirth = "Unbirthing"
}

export interface Vore extends Mortal {
preyPrefs: Set<VoreType>;
bulk: number;
containedIn: Container | null;
predPrefs: Set<VoreType>;
containers: Array<Container>;
export abstract class Vore implements Mortal {
abstract name: Noun;
abstract pronouns: Pronoun;
abstract perspective: POV;
abstract vigors: {[key in Vigor]: number};
abstract maxVigors: {[key in Vigor]: number};
abstract disabled: boolean;
abstract resistances: Map<DamageType, number>;
abstract takeDamage (damage: Damage): void;
abstract stats: Stats;
abstract status: string;
abstract preyPrefs: Set<VoreType>;
abstract bulk: number;
abstract containedIn: Container | null;
abstract predPrefs: Set<VoreType>;
abstract containers: Array<Container>;
destroy (): void {
this.containers.map(container => {
container.contents.map(prey => {
prey.containedIn = this.containedIn
if (this.containedIn !== null) {
this.containedIn.contents.push(prey)
}
})
})
}
}

export interface Container extends Actionable {


Yükleniyor…
İptal
Kaydet