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/Technique.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'resources/js/classes/Technique.js') 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