Procházet zdrojové kódy

Make prey spill out when the pred dies

vintage
Fen Dweller před 5 roky
rodič
revize
576a2d597f
2 změnil soubory, kde provedl 39 přidání a 9 odebrání
  1. +11
    -1
      src/game/entity.ts
  2. +28
    -8
      src/game/vore.ts

+ 11
- 1
src/game/entity.ts Zobrazit soubor

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


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


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


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

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


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

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

+ 28
- 8
src/game/vore.ts Zobrazit soubor

@@ -1,7 +1,7 @@
import { Entity, Mortal, POV, Creature } from './entity' 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 { LogLines, LogEntry, CompositeLog, LogLine } from './interface'
import { Noun, POVPair, POVPairArgs, ImproperNoun } from './language'
import { Noun, Pronoun, POVPair, POVPairArgs, ImproperNoun } from './language'


export enum VoreType { export enum VoreType {
Oral = "Oral Vore", Oral = "Oral Vore",
@@ -10,12 +10,32 @@ export enum VoreType {
Unbirth = "Unbirthing" 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 { export interface Container extends Actionable {


Načítá se…
Zrušit
Uložit