summaryrefslogtreecommitdiff
path: root/resources/js/classes
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-19 13:18:54 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-19 13:18:54 +0200
commit218da95a4b387ee5ac25f168d1529419039f2e54 (patch)
tree21375d6aae287da413cbfc1002c2c8eeb7bba1ed /resources/js/classes
parent91d048ef0f994446aaee91e3afcbd99788e439d7 (diff)
refactor: enemy -> opponent, State.monsters~ -> State.Trainer.monsters
Diffstat (limited to 'resources/js/classes')
-rw-r--r--resources/js/classes/State.js25
-rw-r--r--resources/js/classes/Technique.js10
-rw-r--r--resources/js/classes/Trainer.js16
-rw-r--r--resources/js/classes/utility/TechniqueEffect.js15
4 files changed, 42 insertions, 24 deletions
diff --git a/resources/js/classes/State.js b/resources/js/classes/State.js
index c0065d1..99a642c 100644
--- a/resources/js/classes/State.js
+++ b/resources/js/classes/State.js
@@ -2,37 +2,30 @@ class State {
/**
* @type {number}
*/
- money = 0;
+ turn = 0;
/**
- * @type {Monster[]}
+ * @type {number}
*/
- monsters = [];
+ money = 0;
/**
- * @type {InventoryItem[]}
+ * @type {Monster[]}
*/
- inventory = [];
+ monsters = [];
/**
- * @type {Monster[]}
+ * @type {Trainer}
*/
- partyMonsters = [];
+ player = null;
/**
- * @type {Monster}
+ * @type {Trainer}
*/
- activeMonster = null;
+ opponent = null;
/**
* @type {Technique}
*/
activeTechnique = null;
-
- enemy = {
- /**
- * @type {Monster}
- */
- monster: null,
- };
};
diff --git a/resources/js/classes/Technique.js b/resources/js/classes/Technique.js
index 39028be..74783a2 100644
--- a/resources/js/classes/Technique.js
+++ b/resources/js/classes/Technique.js
@@ -33,6 +33,10 @@ class Technique {
return DB.techniques[this.slug].sfx;
}
+ get healingPower() {
+ return DB.techniques[this.slug].healing_power;
+ }
+
/**
* @returns {string[]}
*/
@@ -45,15 +49,15 @@ class Technique {
}
isRecharging () {
- if (this.turnLastUse >= Game.turn) {
+ if (this.turnLastUse >= Memory.state.turn) {
return false;
}
- return this.rechargeLength > Game.turn - this.turnLastUse;
+ return this.rechargeLength > Memory.state.turn - this.turnLastUse;
}
use () {
- this.turnLastUse = Game.turn;
+ this.turnLastUse = Memory.state.turn;
}
get accuracy () {
diff --git a/resources/js/classes/Trainer.js b/resources/js/classes/Trainer.js
new file mode 100644
index 0000000..668c92b
--- /dev/null
+++ b/resources/js/classes/Trainer.js
@@ -0,0 +1,16 @@
+class Trainer {
+ /**
+ * @type {Monster[]}
+ */
+ monsters = [];
+
+ /**
+ * @type {InventoryItem[]}
+ */
+ inventory = [];
+
+ /**
+ * @type {Monster}
+ */
+ activeMonster = [];
+}
diff --git a/resources/js/classes/utility/TechniqueEffect.js b/resources/js/classes/utility/TechniqueEffect.js
index 10e9399..852efad 100644
--- a/resources/js/classes/utility/TechniqueEffect.js
+++ b/resources/js/classes/utility/TechniqueEffect.js
@@ -5,11 +5,16 @@ class TechniqueEffect {
type = '';
/**
- * @type {(('user' | 'target')|Monster)}
+ * @type {('user' | 'target')}
*/
recipient = null;
/**
+ * @type {Monster[]}
+ */
+ recipients = [];
+
+ /**
* @type {('give' | 'remove')}
*/
application = '';
@@ -56,8 +61,8 @@ class TechniqueEffect {
* @type {Monster}
*/
setUser (user) {
- if (this.recipient === 'user') {
- this.recipient = user;
+ if (['user', 'both'].includes(this.recipient)) {
+ this.recipients.push(user);
}
}
@@ -65,8 +70,8 @@ class TechniqueEffect {
* @type {Monster}
*/
setTarget (target) {
- if (this.recipient === 'target') {
- this.recipient = target;
+ if (['target', 'both'].includes(this.recipient)) {
+ this.recipients.push(target);
}
}
}