add moveCancelable to Ability

This commit is contained in:
2025-01-17 14:43:49 +09:00
parent 787b48a4df
commit 1a5e811020
2 changed files with 4 additions and 2 deletions
+3
View File
@@ -11,6 +11,7 @@ export default class Ability {
castTime = 0
cooldown = 0
damage = 0
moveCancelable = false
radius = 1
range = 0
speed = 1000
@@ -63,6 +64,7 @@ export default class Ability {
castTime: 0.25,
cooldown: 1.25,
damage: 25,
moveCancelable: true,
radius: 5,
range: 500,
speed: 600,
@@ -94,6 +96,7 @@ export default class Ability {
name: 'Melee Attack',
castTime: 0.1,
cooldown: 1.75,
moveCancelable: true,
damage: 10,
radius: 5,
range: 100,
+1 -2
View File
@@ -120,9 +120,8 @@ export default class Entity {
this.#moving = false
}
// TODO: cancelable and uncancelable abilities
moveAction(cursor, attack = false) {
if (this.casting != null && (!this.#attacking || this.casting.ability.id != this.abilities[0].id)) {
if (this.casting != null && this.casting.ability.moveCancelable) {
this.casting = null
}