summaryrefslogtreecommitdiff
path: root/resources/js/classes/utility/TechniqueEffect.js
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-18 23:19:13 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-18 23:19:13 +0200
commit91d048ef0f994446aaee91e3afcbd99788e439d7 (patch)
tree30063656343d7c3c0f9ebd37b2eb1896bfa76820 /resources/js/classes/utility/TechniqueEffect.js
parentf9b00e47e04eac414d892a08136a90833abeefd6 (diff)
item effects,conditions
Diffstat (limited to 'resources/js/classes/utility/TechniqueEffect.js')
-rw-r--r--resources/js/classes/utility/TechniqueEffect.js72
1 files changed, 72 insertions, 0 deletions
diff --git a/resources/js/classes/utility/TechniqueEffect.js b/resources/js/classes/utility/TechniqueEffect.js
new file mode 100644
index 0000000..10e9399
--- /dev/null
+++ b/resources/js/classes/utility/TechniqueEffect.js
@@ -0,0 +1,72 @@
+class TechniqueEffect {
+ /**
+ * @type {string}
+ */
+ type = '';
+
+ /**
+ * @type {(('user' | 'target')|Monster)}
+ */
+ recipient = null;
+
+ /**
+ * @type {('give' | 'remove')}
+ */
+ application = '';
+
+ /**
+ * @type {StatusEffectType}
+ */
+ statusEffect = null;
+
+ /**
+ * @type {Monster}
+ */
+ user = null;
+
+ /**
+ * @type {Monster}
+ */
+ target = null;
+
+ /**
+ * @param {string} effectCode
+ */
+ constructor (effectCode) {
+ if (effectCode.includes('status_')) {
+ this.type = 'status';
+
+ this.recipient = effectCode.split(',')[1];
+ this.application = effectCode.split(' ')[0];
+ this.statusEffect = effectCode.split(',')[0].split(' ')[1].split('_')[1];
+ }
+
+ else if (effectCode.includes('healing')) {
+ this.type = 'healing';
+
+ this.recipient = effectCode.split(' ')[1];
+ }
+
+ else {
+ this.type = effectCode;
+ }
+ }
+
+ /**
+ * @type {Monster}
+ */
+ setUser (user) {
+ if (this.recipient === 'user') {
+ this.recipient = user;
+ }
+ }
+
+ /**
+ * @type {Monster}
+ */
+ setTarget (target) {
+ if (this.recipient === 'target') {
+ this.recipient = target;
+ }
+ }
+}