summaryrefslogtreecommitdiff
path: root/resources/js/classes
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-17 22:46:12 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-17 22:46:12 +0200
commitaa44f67ab57673528e96a4a075fbd8cd0354bd68 (patch)
treec232349cbe9583378ad510774be27b4371d50cd4 /resources/js/classes
parentcc685bfe02b42b592987117fa008a4461785f53c (diff)
ui
Diffstat (limited to 'resources/js/classes')
-rw-r--r--resources/js/classes/StatusEffect.js2
-rw-r--r--resources/js/classes/Technique.js20
2 files changed, 22 insertions, 0 deletions
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;
}