This commit is contained in:
33333-33333 2026-06-30 22:30:37 +09:00
commit 7455d630fc
82 changed files with 2179 additions and 900 deletions

View file

@ -198,6 +198,37 @@ function updatePanicBehavior(t, world, dt, needs) {
const now = Number(world?.time || 0) || 0;
if (!Number.isFinite(t.panicStartedAt) || t.state !== "panic") t.panicStartedAt = now;
if (t.lastPanicCause === "tarinai_champion") {
const kingFleeReason = "\u305F\u308A\u306A\u3044\u738B\u304C\u6016\u304F\u3066\u9003\u3052\u3066\u3044\u308B\u3002";
const kingHardStop = Number(t.panicHardStopAt || 0) || 0;
if (kingHardStop > 0 && now >= kingHardStop) {
t.lastPanicCause = "";
t.fearTimer = 0;
t.lastNeedShockBreaker = null;
return "finished";
}
const nest = t.target?.type === "nest_box" ? t.target : null;
if (nest && !nest.dead) {
if (typeof setBehaviorText === "function") {
setBehaviorText(t, {
need: "safety",
actionId: "panic_escape",
actionLabel: "\u9003\u3052\u3066\u3044\u308B",
reasonText: kingFleeReason,
target: nest,
phase: "perform",
source: "behavior",
});
}
if (t.state !== "panic") t.setActionState?.("panic", { target: nest, reason: kingFleeReason, wake: true, sleeping: false });
t.fearTimer = Math.max(t.fearTimer || 0, 0.34);
if (dist(t, nest) <= Math.max(50, (t.radius || 20) + (nest.r || 24) + 18)) {
t.enterNestBox?.(nest, dt, { forceDisplace: true, reason: kingFleeReason });
}
return true;
}
}
// Survival needs must be able to break panic. Otherwise a stale fear state
// can suppress eating/sleeping long enough to kill the colony.
if (!realDanger && survivalNeedShouldCancelPanic(t, needs)) {