feat(combat): disable monster aggro in act-scene so monsters stay idle in place
This commit is contained in:
parent
d4fb176031
commit
dcd3da0a22
|
|
@ -66,6 +66,8 @@ export interface CombatOptions {
|
||||||
readonly playerManaPerAttack: number
|
readonly playerManaPerAttack: number
|
||||||
/** Ticks before a dead player is restored, at full resources. */
|
/** Ticks before a dead player is restored, at full resources. */
|
||||||
readonly respawnTicks: number
|
readonly respawnTicks: number
|
||||||
|
/** When true, monsters ignore aggro distance and remain standing still (idle). */
|
||||||
|
readonly disableMonsterAggro?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/** One monster's immutable numbers, read from a table row. */
|
/** One monster's immutable numbers, read from a table row. */
|
||||||
|
|
@ -731,6 +733,11 @@ function tickMonsters(world: CombatWorld, options: CombatOptions, terrain: Comba
|
||||||
if (monster.hitFlash > 0) monster.hitFlash -= 1
|
if (monster.hitFlash > 0) monster.hitFlash -= 1
|
||||||
if (monster.cooldown > 0) monster.cooldown -= 1
|
if (monster.cooldown > 0) monster.cooldown -= 1
|
||||||
|
|
||||||
|
if (options.disableMonsterAggro) {
|
||||||
|
monster.state = 'idle'
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
const player = nearestTarget(monster, targets)
|
const player = nearestTarget(monster, targets)
|
||||||
if (player === null) {
|
if (player === null) {
|
||||||
monster.state = 'idle'
|
monster.state = 'idle'
|
||||||
|
|
|
||||||
|
|
@ -1155,6 +1155,7 @@ function runScene(runtime: MapRuntime, renderer: SpriteRenderer, started: number
|
||||||
playerDamage: 7,
|
playerDamage: 7,
|
||||||
playerManaPerAttack: 2,
|
playerManaPerAttack: 2,
|
||||||
respawnTicks: 75,
|
respawnTicks: 75,
|
||||||
|
disableMonsterAggro: true,
|
||||||
},
|
},
|
||||||
lootSeed: 0x5eed,
|
lootSeed: 0x5eed,
|
||||||
talkRadius: 80,
|
talkRadius: 80,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue