diff --git a/client/src/scenes/combat.animations.js b/client/src/scenes/combat.animations.js index 94dcbd8e..6468831b 100644 --- a/client/src/scenes/combat.animations.js +++ b/client/src/scenes/combat.animations.js @@ -30,15 +30,16 @@ class CombatSkills extends Phaser.GameObjects.Group { if (type === 'attack') { this[randomAnimation()](isAlly); } else { - this.heal(); + this[type](isAlly); } } - heal() { + Heal(isAlly) { const lifespan = DELAYS.ANIMATION_DURATION; const particles = this.scene.add.particles(randomColour()); + const x = isAlly ? COMBAT.width() * 0.7 : COMBAT.width() * 0.3; const emitter = particles.createEmitter({ - x: COMBAT.width() * 0.3, + x, y: COMBAT.height() * 0.2, angle: { min: 250, max: 290 }, speed: 250, @@ -50,7 +51,41 @@ class CombatSkills extends Phaser.GameObjects.Group { }); this.add(particles); this.scene.time.delayedCall(lifespan, () => { emitter.stop(); }, [], this); + } + Block(isAlly) { + const lifespan = DELAYS.ANIMATION_DURATION; + const colour = randomColour(); + const x = isAlly ? COMBAT.width() * 0.7 : COMBAT.width() * 0.3; + const emitter1 = this.scene.add.particles(colour).createEmitter({ + x, + y: COMBAT.height() * 0.4, + scale: { start: 0.75, end: 0.25 }, + blendMode: 'ADD', + emitZone: { + source: new Phaser.Geom.Rectangle(-100, -100, 200, 200), + type: 'edge', + quantity: 24, + yoyo: true, + }, + }); + const emitter2 = this.scene.add.particles(colour).createEmitter({ + x, + y: COMBAT.height() * 0.4, + blendMode: 'SCREEN', + scale: { start: 0.2, end: 0 }, + speed: { min: -100, max: 100 }, + quantity: 50, + active: false, + emitZone: { + source: new Phaser.Geom.Rectangle(-100, -100, 200, 200), + type: 'edge', + quantity: 50, + }, + }); + this.scene.time.delayedCall(lifespan / 2, () => { emitter1.stop(); }, [], this); + this.scene.time.delayedCall(lifespan / 2, () => { emitter2.active = true; }, [], this); + this.scene.time.delayedCall(lifespan, () => { emitter2.stop(); }, [], this); } wall(isAlly) { diff --git a/client/src/scenes/combat.render.resolutions.js b/client/src/scenes/combat.render.resolutions.js index b1fffcd8..d4098cc3 100644 --- a/client/src/scenes/combat.render.resolutions.js +++ b/client/src/scenes/combat.render.resolutions.js @@ -69,7 +69,8 @@ function animatePhase(scene, game, resolution, cb) { scene.time.delayedCall(MOVE_CREEP, () => { const isAlly = resolution.target_team_id !== account.id; // animate animation - if (resolution.skill === 'Heal') animations.getSkill(resolution.skill, isAlly); + const workingSkills = ['Heal', 'Block']; + if (workingSkills.includes(resolution.skill)) animations.getSkill(resolution.skill, isAlly); else animations.getSkill('attack', isAlly); // Target cryp takes damage diff --git a/client/src/scenes/combat.skills.js b/client/src/scenes/combat.skills.js index 7611a109..18805249 100644 --- a/client/src/scenes/combat.skills.js +++ b/client/src/scenes/combat.skills.js @@ -234,13 +234,17 @@ class CombatSkills extends Phaser.Scene { const skillPos = targetTextPosition(iter, team); const skillObj = new CrypSkill(this, skillPos[0], skillPos[1], skill, cryp); this.add.existing(skillObj); - this.input.setDraggable(skillObj); - - keyboard.on( - TARGET_KEY_MAP[iter], - () => this.mapTargetKeys(skillObj, game.id, friendlyCryps, iter), - this - ); + // Don't add interaction for self_target skills + if (skill.self_targeting) { + skillObj.skillBox.setFillStyle(0x9d9ea0); + } else { + this.input.setDraggable(skillObj); + keyboard.on( + TARGET_KEY_MAP[iter], + () => this.mapTargetKeys(skillObj, game.id, friendlyCryps, iter), + this + ); + } }); return true;