diff options
Diffstat (limited to 'resources/js/classes/utility/TechniqueEffect.js')
-rw-r--r-- | resources/js/classes/utility/TechniqueEffect.js | 72 |
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; + } + } +} |