Android build v1.1.16

This commit is contained in:
Warren H
2026-07-04 17:41:45 -04:00
parent 99e97e5208
commit 0d269a6041
20 changed files with 2304 additions and 307 deletions
+49 -1
View File
@@ -1,5 +1,5 @@
import { IWT2_CLASS_METADATA } from '../content/classes'
import { BULLDROME_BOSS_METADATA } from '../content/bosses'
import { BULLDROME_BOSS_METADATA, IWT2_BOSS_METADATA } from '../content/bosses'
import type { Iwt2ArenaState, Iwt2HostileAddState, Iwt2PartyEntityState, Iwt2Vec2 } from './types'
import {
addVec2,
@@ -14,6 +14,11 @@ import {
withFallbackFacing,
} from './vector'
const CENTER_LEASH_BOSS_IDS = new Set(['great-jaggi', 'khezu'])
const CENTER_LEASH_START_DISTANCE = 230
const CENTER_LEASH_WALL_MARGIN = 96
const CENTER_LEASH_EXTRA_DISTANCE = 36
export function tickPartyMember(
member: Iwt2PartyEntityState,
state: Iwt2ArenaState,
@@ -115,12 +120,55 @@ function getPartyDesiredPosition(
const drift = decisionSecondsRemaining <= 0 ? decisionDrift(member, state.time) : { x: 0, y: 0 }
const attackTarget = getPriorityAttackTarget(member, state)
const anchor = attackTarget?.position ?? state.boss.position
const centerLeash = getTankCenterLeashPosition(member, state)
if (centerLeash) return centerLeash
return {
x: anchor.x + member.preferredOffset.x + drift.x,
y: anchor.y + member.preferredOffset.y + drift.y,
}
}
function getTankCenterLeashPosition(
member: Iwt2PartyEntityState,
state: Iwt2ArenaState,
): Iwt2Vec2 | null {
if (member.aiRole !== 'tank' || !CENTER_LEASH_BOSS_IDS.has(state.boss.bossId)) return null
const center = arenaCenter(state)
const bossCenterDistance = distanceVec2(state.boss.position, center)
const nearWall = isBossNearWall(state)
if (!nearWall && bossCenterDistance < CENTER_LEASH_START_DISTANCE) return null
const bossMetadata = IWT2_BOSS_METADATA[state.boss.bossId]
const towardCenter = withFallbackFacing(subtractVec2(center, state.boss.position), {
x: state.boss.position.x < center.x ? 1 : -1,
y: state.boss.position.y < center.y ? 0.35 : -0.35,
})
const leashDistance = bossMetadata.meleeRange + state.boss.radius + member.radius + CENTER_LEASH_EXTRA_DISTANCE
return clampVec2ToArena(
addVec2(state.boss.position, scaleVec2(towardCenter, leashDistance)),
member.radius,
state.bounds,
)
}
function arenaCenter(state: Iwt2ArenaState): Iwt2Vec2 {
return {
x: state.bounds.width * 0.5,
y: state.bounds.height * 0.5,
}
}
function isBossNearWall(state: Iwt2ArenaState): boolean {
const margin = state.boss.radius + CENTER_LEASH_WALL_MARGIN
return (
state.boss.position.x <= margin
|| state.boss.position.x >= state.bounds.width - margin
|| state.boss.position.y <= margin
|| state.boss.position.y >= state.bounds.height - margin
)
}
function getDangerAvoidancePosition(member: Iwt2PartyEntityState, state: Iwt2ArenaState): Iwt2Vec2 | null {
const boss = state.boss
const hazardEscape = getHazardAvoidancePosition(member, state)