From f3ee7954c3ea39386225f39b1158fdec5c881ad9 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Wed, 8 Jul 2020 12:19:58 -0400 Subject: [PATCH] Move stuff into the App component --- src/App.vue | 19 +++++++--- src/components/Combat.vue | 55 +++++++++++++++++++++++++++++ src/components/HelloWorld.vue | 66 ----------------------------------- src/game/combat.ts | 7 ++-- src/game/creatures/wolf.ts | 2 +- src/game/interface.ts | 2 +- src/game/vore.ts | 1 + 7 files changed, 78 insertions(+), 74 deletions(-) create mode 100644 src/components/Combat.vue delete mode 100644 src/components/HelloWorld.vue diff --git a/src/App.vue b/src/App.vue index 583fb9b..31ff36b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,20 +1,31 @@ diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue deleted file mode 100644 index 9a45482..0000000 --- a/src/components/HelloWorld.vue +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - diff --git a/src/game/combat.ts b/src/game/combat.ts index 8f90e17..4a4de6d 100644 --- a/src/game/combat.ts +++ b/src/game/combat.ts @@ -43,7 +43,7 @@ export enum State { Normal, Grappled, Grappling, - Eaten, + Eaten } export interface Combatant { @@ -148,7 +148,10 @@ export class StruggleAction extends PairAction { } execute (user: Creature, target: Creature): LogEntry { - if (user.containedIn) { return new CompositeLog(this.lines[user.perspective][target.perspective](user, target), user.containedIn.release(user)) } else { return new LogLines("The prey wasn't actually eaten...") } + if (user.containedIn) { + user.state = State.Normal + return new CompositeLog(this.lines[user.perspective][target.perspective](user, target), user.containedIn.release(user)) + } else { return new LogLines("The prey wasn't actually eaten...") } } } diff --git a/src/game/creatures/wolf.ts b/src/game/creatures/wolf.ts index 1622ba6..018190d 100644 --- a/src/game/creatures/wolf.ts +++ b/src/game/creatures/wolf.ts @@ -18,7 +18,7 @@ export class Wolf extends Creature { super(new ImproperNoun('wolf', 'wolves'), MalePronouns, { [Stat.STR]: 10, [Stat.DEX]: 10, [Stat.CON]: 10 }, new Set([VoreType.Oral]), new Set([VoreType.Oral]), 25) this.actions.push(new BiteAction()) - const stomach = new Stomach(this, 50, new Damage({ amount: 5, type: DamageType.Acid }, { amount: 5, type: DamageType.Crush })) + const stomach = new Stomach(this, 50, new Damage({ amount: 50, type: DamageType.Acid }, { amount: 500, type: DamageType.Crush })) this.containers.add(stomach) this.actions.push(new DevourAction(stomach)) diff --git a/src/game/interface.ts b/src/game/interface.ts index 77aaf32..52ae454 100644 --- a/src/game/interface.ts +++ b/src/game/interface.ts @@ -34,5 +34,5 @@ export class CompositeLog implements LogEntry { } export function log (entry: LogEntry): void { - entry.render().forEach(elem => document.body.appendChild(elem)) + entry.render().forEach(elem => document.querySelector('#log')?.appendChild(elem)) } diff --git a/src/game/vore.ts b/src/game/vore.ts index 1eb4f9c..1b5e01f 100644 --- a/src/game/vore.ts +++ b/src/game/vore.ts @@ -56,6 +56,7 @@ abstract class NormalContainer implements Container { release (prey: Prey): LogEntry { prey.containedIn = null + this.contents.delete(prey) return new LogLines('ANTI-MUNCH') }