use ability keys instead of indices
This commit is contained in:
+3
-3
@@ -6,7 +6,7 @@ import Team from './team.js'
|
||||
|
||||
export default class Entity {
|
||||
id = crypto.randomUUID()
|
||||
abilities = [null, null, null, null] // TODO: do something about this being an array...
|
||||
abilities = {}
|
||||
casting = null
|
||||
cooldowns = {}
|
||||
dead = false
|
||||
@@ -266,7 +266,7 @@ export default class Entity {
|
||||
|
||||
if (this.#attacking) {
|
||||
const cursor = this.#dest ?? this.position
|
||||
const basicAttack = this.ability(0)
|
||||
const basicAttack = this.ability('a')
|
||||
if (basicAttack != null) {
|
||||
const target = this.closestTargetTo(cursor, 500)
|
||||
if (target != null && this.distanceTo(target.position) < basicAttack.range + this.radius + target.radius) {
|
||||
@@ -275,7 +275,7 @@ export default class Entity {
|
||||
const timestamp = this.game?.currentTick ?? 0
|
||||
if (lastCast != null && lastCast + cooldown > timestamp) { return false }
|
||||
|
||||
this.castAction(0, cursor, false)
|
||||
this.castAction('a', cursor, false)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -5,7 +5,7 @@ import Team from './team.js'
|
||||
export default class Template {
|
||||
static minion(team, options = {}) {
|
||||
return {
|
||||
abilities: [options.ranged ? Ability.rangedAttack.id : Ability.meleeAttack.id, null, null, null],
|
||||
abilities: { a: options.ranged ? Ability.rangedAttack.id : Ability.meleeAttack.id },
|
||||
height: options.ranged ? 40 : 38,
|
||||
logic: this.#minionLogic(options.route),
|
||||
maxHealth: options.ranged ? 300 : 450,
|
||||
@@ -19,12 +19,12 @@ export default class Template {
|
||||
|
||||
static player(overrides) {
|
||||
return {
|
||||
abilities: [
|
||||
Ability.rangedAttack.id,
|
||||
Ability.straightShot.id,
|
||||
Ability.shieldThrow.id,
|
||||
Ability.blink.id,
|
||||
],
|
||||
abilities: {
|
||||
a: Ability.rangedAttack.id,
|
||||
q: Ability.straightShot.id,
|
||||
w: Ability.shieldThrow.id,
|
||||
e: Ability.blink.id,
|
||||
},
|
||||
height: 80,
|
||||
logic: this.#playerLogic,
|
||||
maxHealth: 600,
|
||||
|
||||
Reference in New Issue
Block a user