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; } } }