From d7b7c5ff72f94d59e23a8bca91790994ac2f1163 Mon Sep 17 00:00:00 2001 From: HoangTran <99.hoangtran@gmail.com> Date: Wed, 22 May 2024 08:25:53 +0700 Subject: [PATCH] refactor --- src/game/gameObject/spells/Ahri_W.js | 5 +++-- src/game/gameObject/spells/Ashe_W.js | 6 +++--- src/game/gameObject/spells/Shaco_R.js | 7 ++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/game/gameObject/spells/Ahri_W.js b/src/game/gameObject/spells/Ahri_W.js index f6ccab2..332fcaa 100644 --- a/src/game/gameObject/spells/Ahri_W.js +++ b/src/game/gameObject/spells/Ahri_W.js @@ -15,9 +15,10 @@ export default class Ahri_W extends Spell { coolDown = 5000; onSpellCast() { - for (let i = 0; i < 3; i++) { + let count = 3; + for (let i = 0; i < count; i++) { let obj = new Ahri_W_Object(this.owner); - obj.angle = (i * 2 * PI) / 3; + obj.angle = (i * 2 * PI) / count; this.game.objectManager.addObject(obj); } } diff --git a/src/game/gameObject/spells/Ashe_W.js b/src/game/gameObject/spells/Ashe_W.js index 6dc0720..3f3f088 100644 --- a/src/game/gameObject/spells/Ashe_W.js +++ b/src/game/gameObject/spells/Ashe_W.js @@ -13,16 +13,16 @@ export default class Ashe_W extends Spell { name = 'Tán Xạ Tiễn (Ashe_W)'; description = 'Bắn ra 10 mũi tên theo hình nón. Mỗi mũi tên gây 5 sát thươngLàm Chậm 75% kẻ địch trúng chiêu trong 1.5 giây'; - coolDown = 5000; + coolDown = 1000; onSpellCast() { let mouse = this.game.worldMouse.copy(); let direction = mouse.sub(this.owner.position).normalize(); - let arrowCount = 10; + let arrowCount = 15; let arrowLength = 500; let angle = direction.heading(); - let angleStep = Math.PI / 20; + let angleStep = Math.PI / (arrowCount * 2); for (let i = 0; i < arrowCount; i++) { let _angle = angle - (angleStep * arrowCount) / 2 + angleStep * i; diff --git a/src/game/gameObject/spells/Shaco_R.js b/src/game/gameObject/spells/Shaco_R.js index 6f5f67a..bcd78d0 100644 --- a/src/game/gameObject/spells/Shaco_R.js +++ b/src/game/gameObject/spells/Shaco_R.js @@ -149,13 +149,14 @@ class Shaco_R_Clone extends Champion { }); // create 3 shaco W objects, place around dead clone - for (let i = 0; i < 3; i++) { + let count = 3; + for (let i = 0; i < count; i++) { let obj = new Shaco_W_Object(this.shacoR_championOwner); obj.lifeTime = 3000; obj.position = clonePos.copy(); obj.destination = clonePos.copy().add( - Math.cos((i * 2 * Math.PI) / 3) * 100, // 100 is the radius - Math.sin((i * 2 * Math.PI) / 3) * 100 + Math.cos((i * 2 * Math.PI) / count) * 100, // 100 is the radius + Math.sin((i * 2 * Math.PI) / count) * 100 ); this.game.objectManager.addObject(obj); }