From 9a4f92bc27e3ca039e554038865e10d83c762e0d Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Wed, 15 Jul 2020 21:45:22 -0400 Subject: [PATCH] Get a decent boss-fight layout going (with Withers!) --- src/App.vue | 43 +++++++++++++++++++++++++++-------- src/components/Combat.vue | 37 ++++++++++++++---------------- src/components/Statblock.vue | 35 +++++++++++++++++++--------- src/game/combat.ts | 10 +++++--- src/game/creatures.ts | 4 +++- src/game/creatures/human.ts | 26 +++++++++++++++++++++ src/game/creatures/withers.ts | 39 +++++++++++++++++++++++++++++++ src/game/entity.ts | 7 +++--- 8 files changed, 153 insertions(+), 48 deletions(-) create mode 100644 src/game/creatures/human.ts create mode 100644 src/game/creatures/withers.ts diff --git a/src/App.vue b/src/App.vue index ceb87cf..1e27cec 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,7 +11,7 @@ import Combat from './components/Combat.vue' import Header from './components/Header.vue' import * as Creatures from '@/game/creatures' import { Creature, POV } from '@/game/entity' -import { ProperNoun } from '@/game/language' +import { ProperNoun, TheyPronouns, FemalePronouns, MalePronouns } from '@/game/language' @Component({ components: { @@ -24,15 +24,38 @@ export default class App extends Vue { combatants: Array constructor () { super() - this.left = new Creatures.Wolf() - this.left.name = new ProperNoun("Wolf") - this.right = new Creatures.Cafat() - const wolf1 = new Creatures.Wolf() - wolf1.name = new ProperNoun("Innermost Wolf") - const wolf2 = new Creatures.Wolf() - wolf2.name = new ProperNoun("Inner Wolf") - this.combatants = [this.left, this.right, wolf1, wolf2] - this.left.perspective = POV.First + + const fighter = new Creatures.Human(new ProperNoun('Fighter'), TheyPronouns, { + stats: { + Toughness: 40, + Power: 50, + Speed: 30, + Willpower: 40, + Charm: 20 + } + }) + const rogue = new Creatures.Human(new ProperNoun('Wizard'), MalePronouns, { + stats: { + Toughness: 25, + Power: 40, + Speed: 70, + Willpower: 50, + Charm: 80 + } + }) + const wizard = new Creatures.Human(new ProperNoun('Rogue'), FemalePronouns, { + stats: { + Toughness: 30, + Power: 20, + Speed: 50, + Willpower: 80, + Charm: 60 + } + }) + + this.left = fighter + this.right = new Creatures.Withers() + this.combatants = [this.left, this.right, wizard, rogue] console.log(this.left) console.log(this.right) } diff --git a/src/components/Combat.vue b/src/components/Combat.vue index 446209e..7204490 100644 --- a/src/components/Combat.vue +++ b/src/components/Combat.vue @@ -1,17 +1,11 @@ @@ -45,7 +41,7 @@ import { Component, Prop, Vue, Watch, Emit } from 'vue-property-decorator' import { Creature, POV } from '@/game/entity' import { Stats, Stat, StatIcons, StatDescs, Vigor, VigorIcons, VigorDescs, VoreStatDescs, VoreStatIcons } from '@/game/combat' import ContainerView from './ContainerView.vue' -import tippy from 'tippy.js' +import tippy, { createSingleton } from 'tippy.js' import 'tippy.js/dist/tippy.css' @Component({ @@ -88,13 +84,14 @@ export default class Statblock extends Vue { firstperson: POV = POV.First mounted () { - this.$el.querySelectorAll(".stat-entry").forEach(elem => { + const tippyInstances = Array.from(this.$el.querySelectorAll(".stat-entry")).map(elem => { const tooltip = elem.querySelector(".tooltip-template") as HTMLElement - tippy(elem, { + return tippy(elem, { content: tooltip }) }) + createSingleton(tippyInstances, { delay: 500 }) } } @@ -102,7 +99,7 @@ export default class Statblock extends Vue {