From d96b83672478b8928cda25d0589581b02861e184 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sun, 12 Jun 2022 14:28:21 -0400 Subject: [PATCH] Redesign the vore system Everything is now a Container; Containers have a set of capabilities that describes what they can do --- src/components/ContainerView.vue | 11 +- src/components/ItemView.vue | 4 - src/components/WalletView.vue | 3 - src/game/ai.ts | 21 +- src/game/combat.ts | 455 ++++++++++++------ src/game/combat/actions.ts | 58 ++- src/game/combat/effects.ts | 179 +++++-- src/game/creature.ts | 16 +- src/game/creatures/characters/inazuma.ts | 97 ---- src/game/creatures/monsters/slime.ts | 39 -- src/game/creatures/monsters/werewolf.ts | 24 +- src/game/creatures/player.ts | 14 +- src/game/events.ts | 4 +- src/game/language.ts | 276 +++++++---- src/game/maps/town.ts | 41 -- src/game/vore.ts | 571 ++++++++--------------- 16 files changed, 943 insertions(+), 870 deletions(-) delete mode 100644 src/game/creatures/characters/inazuma.ts delete mode 100644 src/game/creatures/monsters/slime.ts diff --git a/src/components/ContainerView.vue b/src/components/ContainerView.vue index 393580f..bbe106d 100644 --- a/src/components/ContainerView.vue +++ b/src/components/ContainerView.vue @@ -15,7 +15,7 @@ import { Component, Prop, Vue, Watch, Emit } from 'vue-property-decorator' import { Creature } from '@/game/creature' import { POV } from '@/game/language' import { Stats, Stat } from '@/game/combat' -import { Container, VoreContainer } from '@/game/vore' +import { Container } from '@/game/vore' function wiggle (contents: HTMLElement) { setTimeout(() => wiggle(contents), 3000) @@ -36,12 +36,13 @@ function wiggle (contents: HTMLElement) { // yoinked from https://jsfiddle.net/yckart/0adfw47y/ -function draw (delta: number, dt: number, total: number, parent: HTMLElement, canvas: HTMLCanvasElement, container: VoreContainer, smoothedFraction: number, smoothedLiveliness: number) { +function draw (delta: number, dt: number, total: number, parent: HTMLElement, canvas: HTMLCanvasElement, container: Container, smoothedFraction: number, smoothedLiveliness: number) { const ctx = canvas.getContext('2d') as CanvasRenderingContext2D canvas.width = parent.clientWidth canvas.height = parent.clientHeight - ctx.fillStyle = container.fluidColor + // TODO: put this back on the container + ctx.fillStyle = "#00ff00" const fraction = container.fullness / container.capacity const livingFraction = container.contents.reduce((total: number, prey: Creature) => total + prey.voreStats.Bulk, 0) / container.capacity const deadFraction = container.digested.reduce((total: number, prey: Creature) => total + prey.voreStats.Bulk, 0) / container.capacity @@ -74,7 +75,7 @@ function draw (delta: number, dt: number, total: number, parent: HTMLElement, ca @Component export default class ContainerView extends Vue { @Prop({ required: true }) - container!: VoreContainer + container!: Container mounted () { const canvas = this.$el.querySelector('.container-waves') as HTMLCanvasElement @@ -82,7 +83,7 @@ export default class ContainerView extends Vue { canvas.width = (this.$el as HTMLElement).clientWidth canvas.height = (this.$el as HTMLElement).clientHeight canvas.width = canvas.width + 0 - requestAnimationFrame((delta: number) => draw(delta, delta, Math.random() * 1000, this.$el as HTMLElement, canvas, (this.container as VoreContainer), 0, 0)) + requestAnimationFrame((delta: number) => draw(delta, delta, Math.random() * 1000, this.$el as HTMLElement, canvas, (this.container as Container), 0, 0)) wiggle(this.$el.querySelector(".container-contents") as HTMLElement) } diff --git a/src/components/ItemView.vue b/src/components/ItemView.vue index 60c700f..6a0fe1b 100644 --- a/src/components/ItemView.vue +++ b/src/components/ItemView.vue @@ -12,10 +12,6 @@