From aa44f67ab57673528e96a4a075fbd8cd0354bd68 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 17 Aug 2023 22:46:12 +0200 Subject: ui --- resources/js/classes/StatusEffect.js | 2 ++ resources/js/classes/Technique.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'resources/js/classes') diff --git a/resources/js/classes/StatusEffect.js b/resources/js/classes/StatusEffect.js index ac6ae54..e1ae9c9 100644 --- a/resources/js/classes/StatusEffect.js +++ b/resources/js/classes/StatusEffect.js @@ -4,6 +4,8 @@ class StatusEffect { /** * @type {Monster} + * + * currently only used for lifeleech */ issuer = null; diff --git a/resources/js/classes/Technique.js b/resources/js/classes/Technique.js index a24e094..7558748 100644 --- a/resources/js/classes/Technique.js +++ b/resources/js/classes/Technique.js @@ -3,10 +3,14 @@ class Technique { #potency = 0; #power = 0; + turnLastUse = 0; + constructor (slug) { this.slug = slug; this.resetStats(); + + this.turnLastUse = -this.rechargeLength; } get name () { @@ -36,6 +40,22 @@ class Technique { return DB.techniques[this.slug].effects; } + get rechargeLength () { + return DB.techniques[this.slug].recharge; + } + + isUsable () { + if (this.turnLastUse >= Game.turn) { + return true; + } + + return Game.turn - this.turnLastUse >= this.rechargeLength; + } + + use () { + this.turnLastUse = Game.turn; + } + get accuracy () { return this.#accuracy; } -- cgit v1.2.3