Release Healer Man 0.1.35
This commit is contained in:
1 parent
46c272f889
commit
40d9f346d8
13 files changed
+218
-118
No files matched your search
@@ -19,7 +19,7 @@ export interface PartyBreadcrumbCursor {
|
||||
breadcrumbId: number | null;
|
||||
}
|
||||
|
||||
export type PartyCombatMovementIntent = "hold" | "approach" | "retreat" | "reposition";
|
||||
export type PartyCombatMovementIntent = "hold" | "approach" | "retreat";
|
||||
|
||||
export interface PartyMovementProfile {
|
||||
readonly followDistanceJitter: number;
|
||||
@@ -427,44 +427,6 @@ export function personalizedPartyCombatRangeBand(
|
||||
};
|
||||
}
|
||||
|
||||
/** Adds a bounded local repulsion so allies do not occupy the same point. */
|
||||
export function partySeparationGoal(
|
||||
current: PartyWorldPosition,
|
||||
desired: PartyWorldPosition,
|
||||
peers: readonly PartyWorldPosition[],
|
||||
fallbackAngle: number,
|
||||
out: MutablePartyWorldPosition,
|
||||
separationDistance = 0.85,
|
||||
maximumCorrection = 0.35,
|
||||
): boolean {
|
||||
let offsetX = 0;
|
||||
let offsetZ = 0;
|
||||
const safeSeparation = Math.max(EPSILON, separationDistance);
|
||||
for (const peer of peers) {
|
||||
const dx = current[0] - peer[0];
|
||||
const dz = current[2] - peer[2];
|
||||
const distance = Math.hypot(dx, dz);
|
||||
if (!Number.isFinite(distance) || distance >= safeSeparation) continue;
|
||||
const weight = (safeSeparation - distance) / safeSeparation;
|
||||
if (distance <= EPSILON) {
|
||||
offsetX += Math.sin(fallbackAngle) * weight;
|
||||
offsetZ += Math.cos(fallbackAngle) * weight;
|
||||
} else {
|
||||
offsetX += dx / distance * weight;
|
||||
offsetZ += dz / distance * weight;
|
||||
}
|
||||
}
|
||||
const length = Math.hypot(offsetX, offsetZ);
|
||||
out[0] = desired[0];
|
||||
out[1] = desired[1];
|
||||
out[2] = desired[2];
|
||||
if (length <= EPSILON) return false;
|
||||
const correction = Math.min(Math.max(0, maximumCorrection), length);
|
||||
out[0] += offsetX / length * correction;
|
||||
out[2] += offsetZ / length * correction;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Chooses an individual combat destination. Melee only closes distance;
|
||||
* ranged attackers also back out when a target collapses their preferred band.
|
||||
@@ -524,7 +486,6 @@ export function partyPersonalizedCombatMovementGoal(
|
||||
targetVisible: boolean,
|
||||
rangeBand: PartyCombatRangeLike,
|
||||
preferredBearing: number,
|
||||
forceReposition: boolean,
|
||||
out: MutablePartyWorldPosition,
|
||||
): PartyCombatMovementIntent {
|
||||
const intent = partyCombatMovementGoal(
|
||||
@@ -538,10 +499,10 @@ export function partyPersonalizedCombatMovementGoal(
|
||||
Math.sin(preferredBearing),
|
||||
Math.cos(preferredBearing),
|
||||
);
|
||||
if (!targetVisible || (intent === "hold" && !forceReposition)) return intent;
|
||||
if (!targetVisible || intent === "hold") return intent;
|
||||
|
||||
out[0] = target[0] + Math.sin(preferredBearing) * rangeBand.preferred;
|
||||
out[1] = target[1];
|
||||
out[2] = target[2] + Math.cos(preferredBearing) * rangeBand.preferred;
|
||||
return intent === "hold" ? "reposition" : intent;
|
||||
return intent;
|
||||
}
|
||||
Reference in new issue
Block a user