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