This commit is contained in:
33333-33333 2026-07-18 13:06:02 +09:00
commit f657b6a4a4
94 changed files with 3970 additions and 1241 deletions

View file

@ -32,9 +32,22 @@ function needPhraseForReason(need, tarinai = null, action = null) {
if (need === "social" && action?.subNeed === "family") return "\u5bb6\u65cf\u304c\u6c17\u306b\u306a\u308b";
if (need === "social" && action?.subNeed === "bond") return "\u4ef2\u9593\u304c\u6c17\u306b\u306a\u308b";
if (need === "safety" && action?.id === "panic_escape") return "\u6016\u3044";
if (need === "social" && action?.subNeed === "crowd") return "\u4ed6\u306e\u305f\u308a\u306a\u3044\u304c\u591a\u3059\u304e\u3066\u843d\u3061\u7740\u304b\u306a\u3044";
return TARINAI_NEED_PHRASES[need] || need;
}
function panicThreatLabel(tarinai) {
const threat = tarinai?.lastPanicThreat || tarinai?.lastNeedShockBreaker || null;
if (!threat || threat === tarinai || threat.dead) return "";
const catalog = globalThis.TEXT_CATALOG || (typeof window !== "undefined" ? window.TEXT_CATALOG : null);
let label = String(threat.name || "").trim();
if (!label && catalog?.targetLabel) label = String(catalog.targetLabel(threat) || "").trim();
if (!label && threat.type && typeof toolLabel === "function") label = String(toolLabel(threat.type) || "").trim();
if (!label || label === "\u76f8\u624b" || label === "\u4f4d\u7f6e" || label === "\u4e0d\u660e") return "";
return label.replace(/[\u3002\uff01\uff1f]+$/, "");
}
function actionTextForReason(action = null, tarinai = null) {
const behavior = currentTarinaiBehavior(tarinai);
const id = action?.id || behavior?.actionId || "";
@ -168,6 +181,11 @@ function composeTarinaiBehaviorText(tarinai, behavior = null, options = {}) {
}
const b = behavior || (currentTarinaiBehavior(tarinai)) || null;
if (!b) return "";
const panicActionId = String(b.specId || b.actionId || "");
if (panicActionId === "panic_escape" || tarinai?.state === "panic") {
const threatLabel = panicThreatLabel(tarinai);
if (threatLabel) return `${threatLabel}\u304c\u6016\u304f\u3066\u3001\u30d1\u30cb\u30c3\u30af\u306b\u306a\u3063\u3066\u3044\u308b\u3002`;
}
const stored = String(b.text || b.reason || "").trim();
if (stored && options.regenerate !== true) return stored;
const action = options.action || actionById(b.specId || b.actionId) || actionById(b.actionId) || null;