add acceleration to shield throw
This commit is contained in:
+20
-2
@@ -217,18 +217,34 @@ export default class Ability {
|
||||
name: 'Shield Throw',
|
||||
castTime: 0.25,
|
||||
cooldown: 5,
|
||||
deceleratePerTick: 90,
|
||||
radius: 110,
|
||||
range: 1025,
|
||||
speed: 2400,
|
||||
effect: function shieldThrowEffect(caster, cursor) {
|
||||
const ability = this
|
||||
|
||||
const accelerateLogic = function accelerateLogic() {
|
||||
const projectile = this
|
||||
projectile.speed += ability.deceleratePerTick
|
||||
}
|
||||
|
||||
const decelerateLogic = function decelerateLogic() {
|
||||
const projectile = this
|
||||
if (projectile.speed - ability.deceleratePerTick >= ability.deceleratePerTick) {
|
||||
projectile.speed = projectile.speed - ability.deceleratePerTick
|
||||
}
|
||||
}
|
||||
|
||||
const shieldThrowReturn = function shieldThrowReturn(projectile, homingTarget) {
|
||||
const returnProjectile = new Projectile({
|
||||
homingTarget: caster,
|
||||
logic: accelerateLogic,
|
||||
owner: caster.id,
|
||||
position: projectile.position.clone(),
|
||||
radius: ability.radius,
|
||||
speed: ability.speed,
|
||||
homingTarget: caster,
|
||||
speed: ability.deceleratePerTick,
|
||||
visionRange: ability.radius,
|
||||
})
|
||||
|
||||
caster.game?.spawnProjectile(returnProjectile)
|
||||
@@ -236,10 +252,12 @@ export default class Ability {
|
||||
|
||||
const projectile = new Projectile({
|
||||
after: shieldThrowReturn,
|
||||
logic: decelerateLogic,
|
||||
owner: caster.id,
|
||||
position: caster.position.clone(),
|
||||
radius: ability.radius,
|
||||
speed: ability.speed,
|
||||
visionRange: ability.radius,
|
||||
})
|
||||
|
||||
projectile.destination = caster.position.clone().add(cursor.clone().sub(caster.position).normalize().multiplyScalar(ability.range + caster.radius))
|
||||
|
||||
@@ -40,6 +40,7 @@ export default class Template {
|
||||
q: Ability.straightShot.id,
|
||||
w: Ability.expose.id,
|
||||
e: Ability.control.id,
|
||||
r: Ability.shieldThrow.id,
|
||||
d: Ability.circleOfResurrection.id,
|
||||
f: Ability.blink.id,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user