1.6
This commit is contained in:
parent
ee22e1a929
commit
88f618cadf
55 changed files with 1299 additions and 447 deletions
|
|
@ -463,11 +463,38 @@
|
|||
|
||||
nestBoxTooltipLines(box) {
|
||||
if (!box || box.dead || !(typeof globalThis.isNestContainerType === "function" ? globalThis.isNestContainerType(box.type) : (box.type === "nest_box" || box.type === "pipe"))) return [];
|
||||
const occupants = this.nestBoxOccupants(box, Infinity);
|
||||
const names = occupants.map(t => t?.name).filter(Boolean).slice(0, 5);
|
||||
const more = occupants.length > names.length ? `\u3001\u307b\u304b${occupants.length - names.length}\u5339` : "";
|
||||
const label = box.type === "pipe" ? "\u571f\u7ba1" : "\u5de3\u7bb1";
|
||||
return [label, names.length ? `\u5165\u3063\u3066\u308b\u5b50: ${names.join("\u3001")}${more}` : "\u5165\u3063\u3066\u308b\u5b50: \u306a\u3057", this.temperatureTooltipLineFor?.(box, "\u5185\u90E8\u6C17\u6E29")].filter(Boolean);
|
||||
const isPipe = box.type === "pipe";
|
||||
let occupants = [];
|
||||
if (isPipe) {
|
||||
const seen = new Set();
|
||||
const pipes = (this.items || []).filter(it => it && !it.dead && it.type === "pipe");
|
||||
for (const pipe of pipes) {
|
||||
const direct = this.nestBoxOccupants?.(pipe, Infinity) || [];
|
||||
for (const t of direct) {
|
||||
if (!t || t.dead) continue;
|
||||
const key = t.id || t.name || `${t.x},${t.y}`;
|
||||
if (seen.has(key)) continue;
|
||||
seen.add(key);
|
||||
occupants.push(t);
|
||||
}
|
||||
}
|
||||
for (const t of (this.tarinai || [])) {
|
||||
if (!t || t.dead || !t.insideNestBoxId) continue;
|
||||
const holder = this.nestBoxById?.(t.insideNestBoxId) || pipes.find(it => it.id === t.insideNestBoxId) || null;
|
||||
if (!holder || holder.dead || holder.type !== "pipe") continue;
|
||||
const key = t.id || t.name || `${t.x},${t.y}`;
|
||||
if (seen.has(key)) continue;
|
||||
seen.add(key);
|
||||
occupants.push(t);
|
||||
}
|
||||
} else {
|
||||
occupants = this.nestBoxOccupants(box, Infinity);
|
||||
}
|
||||
const names = occupants.map(t => t?.name).filter(Boolean).slice(0, isPipe ? 8 : 5);
|
||||
const more = occupants.length > names.length ? `、ほか${occupants.length - names.length}匹` : "";
|
||||
const label = isPipe ? "土管" : "巣箱";
|
||||
const insideLabel = isPipe ? "土管に入ってる子" : "入ってる子";
|
||||
return [label, names.length ? `${insideLabel}: ${names.join("、")}${more}` : `${insideLabel}: なし`, this.temperatureTooltipLineFor?.(box, "内部気温")].filter(Boolean);
|
||||
},
|
||||
|
||||
|
||||
|
|
@ -488,16 +515,21 @@
|
|||
let best = null, bestD = Infinity;
|
||||
for (const t of this.tarinai) {
|
||||
if (!t || t.dead) continue;
|
||||
if (this.isTarinaiHiddenInNestBox?.(t)) continue;
|
||||
const d = distXY(p.x, p.y, t.x, t.y);
|
||||
const limit = Math.max(46, (t.radius || 20) * 1.35);
|
||||
if (d <= limit && d < bestD) { best = t; bestD = d; }
|
||||
}
|
||||
if (!best) return null;
|
||||
const behavior = (typeof behaviorText === "function" ? behaviorText(best) : "") || window.TEXT_CATALOG?.stateLabel?.(best.state, best) || best.thought || "";
|
||||
const nameLine = String(best.name || "たりない");
|
||||
const behavior = (typeof behaviorText === "function" ? behaviorText(best) : "")
|
||||
|| window.TEXT_CATALOG?.stateLabel?.(best.state, best)
|
||||
|| best.thought
|
||||
|| "様子を見ている";
|
||||
const maxEnergy = typeof tarinaiMaxEnergy === "function" ? tarinaiMaxEnergy(best) : (Number(best.maxEnergy) || 100);
|
||||
const statusLine = `\u4F53\u529B: ${Math.round(best.energy || 0)}/${Math.round(maxEnergy)}\u3000\u7A7A\u8179: ${Math.round(best.hunger || 0)}\u3000\u30B9\u30C8\u30EC\u30B9: ${Math.round(best.stress || 0)}`;
|
||||
const tempLine = this.temperatureTooltipLineFor(best, "\u4F53\u611F\u6C17\u6E29");
|
||||
return { target: best, lines: [best.name || "\u305F\u308A\u306A\u3044", behavior, statusLine, tempLine].filter(Boolean), kind: "tarinai" };
|
||||
const statusLine = `体力: ${Math.round(best.energy || 0)}/${Math.round(maxEnergy)} 空腹: ${Math.round(best.hunger || 0)} ストレス: ${Math.round(best.stress || 0)}`;
|
||||
const tempLine = this.temperatureTooltipLineFor(best, "体感気温") || "体感気温: --℃";
|
||||
return { target: best, lines: [nameLine, String(behavior), statusLine, tempLine], kind: "tarinai" };
|
||||
},
|
||||
|
||||
pointerOwnedBedInfo() {
|
||||
|
|
@ -830,10 +862,10 @@
|
|||
if (!this.canFightPair(actor, target)) return false;
|
||||
actor.intimidationCooldown = Math.max(actor.intimidationCooldown || 0, deterministicRange(this, "fight-mochi-intimidate-repeat-cooldown-actor", 5.5, 8.5, actor, target));
|
||||
target.intimidationCooldown = Math.max(target.intimidationCooldown || 0, deterministicRange(this, "fight-mochi-intimidate-repeat-cooldown-target", 4.5, 7.5, actor, target));
|
||||
actor.intimidateTimer = Math.max(actor.intimidateTimer || 0, deterministicRange(this, "fight-mochi-intimidate-actor-timer", 0.85, 1.35, actor, target));
|
||||
actor.intimidateTimer = Math.max(actor.intimidateTimer || 0, deterministicRange(this, "fight-mochi-intimidate-actor-timer", 0.32, 0.58, actor, target));
|
||||
actor.intimidateTargetId = target.id;
|
||||
actor.surpriseTimer = Math.max(actor.surpriseTimer || 0, 0.28);
|
||||
target.intimidatedTimer = Math.max(target.intimidatedTimer || 0, deterministicRange(this, "fight-mochi-intimidate-target-timer", 0.75, 1.25, actor, target));
|
||||
target.intimidatedTimer = Math.max(target.intimidatedTimer || 0, deterministicRange(this, "fight-mochi-intimidate-target-timer", 0.30, 0.56, actor, target));
|
||||
const targetProfile = socialPersonalityProfile(target);
|
||||
target.fearTimer = Math.max(target.fearTimer || 0, 0.72 * targetProfile.fear);
|
||||
actor.adjustRelation(target, -0.05, 0.06, "intimidate");
|
||||
|
|
@ -897,7 +929,7 @@
|
|||
target.fightCooldown = CONFIG.fightCooldown + deterministicRange(this, "intimidation-target-cooldown", 1, 4, actor, target);
|
||||
actor.intimidationCooldown = Math.max(actor.intimidationCooldown || 0, deterministicRange(this, "intimidation-repeat-cooldown-actor", 7.5, 11.5, actor, target));
|
||||
target.intimidationCooldown = Math.max(target.intimidationCooldown || 0, deterministicRange(this, "intimidation-repeat-cooldown-target", 5.5, 9.0, actor, target));
|
||||
actor.intimidateTimer = Math.max(actor.intimidateTimer, deterministicRange(this, "intimidation-actor-timer", 1.05, 1.65, actor, target));
|
||||
actor.intimidateTimer = Math.max(actor.intimidateTimer, deterministicRange(this, "intimidation-actor-timer", 0.34, 0.62, actor, target));
|
||||
actor.intimidateTargetId = target.id;
|
||||
actor.setActionState("intimidate", { target, reason: "\u76f8\u624b\u3092\u5a01\u5687\u3057\u3066\u3044\u308b" });
|
||||
setBehaviorText(actor, { need: "social", subNeed: "conflict", actionId: "intimidate_enemy", actionLabel: "\u5a01\u5687\u3057\u3066\u3044\u308b", reasonText: `${target.name || "\u76f8\u624b"}\u3092\u5a01\u5687\u3057\u3066\u3044\u308b`, target, phase: "perform", source: "behavior" });
|
||||
|
|
@ -907,7 +939,7 @@
|
|||
color: "rgba(145, 106, 55, 0.70)",
|
||||
}));
|
||||
this.spawnBubble(actor.x, actor.y - actor.radius * 1.30, "\u306f\u3046\u30fc\uff01", "rgba(92,62,34,0.82)");
|
||||
target.intimidatedTimer = Math.max(target.intimidatedTimer || 0, deterministicRange(this, "intimidation-target-prep-timer", 0.95, 1.55, actor, target));
|
||||
target.intimidatedTimer = Math.max(target.intimidatedTimer || 0, deterministicRange(this, "intimidation-target-prep-timer", 0.28, 0.52, actor, target));
|
||||
target.fearTimer = Math.max(target.fearTimer, 0.65 * targetProfile.fear);
|
||||
if (!deterministicChance(this, "intimidation-success", successChance, actor, target)) {
|
||||
actor.adjustPersonality?.("aggression", -0.018, "after failed intimidation");
|
||||
|
|
@ -925,8 +957,8 @@
|
|||
actor.adjustPersonality?.("aggression", 0.018, "after successful intimidation");
|
||||
target.defeatedById = actor.id;
|
||||
target.fightWinnerId = actor.id;
|
||||
target.defeatedTimer = Math.max(target.defeatedTimer, deterministicRange(this, "intimidation-defeated-timer", 1.8, 2.8, actor, target));
|
||||
target.intimidatedTimer = Math.max(target.intimidatedTimer || 0, deterministicRange(this, "intimidation-success-timer", 1.2, 2.0, actor, target));
|
||||
target.defeatedTimer = Math.max(target.defeatedTimer, deterministicRange(this, "intimidation-defeated-timer", 0.8, 1.35, actor, target));
|
||||
target.intimidatedTimer = Math.max(target.intimidatedTimer || 0, deterministicRange(this, "intimidation-success-timer", 0.34, 0.70, actor, target));
|
||||
if (target.enterPanic) target.enterPanic({ threat: actor, target: actor, reason: "\u5a01\u5687\u3055\u308c\u3066\u9003\u3052\u3066\u3044\u308b", fear: 1.35, wake: true, cause: "intimidated" });
|
||||
else { target.fearTimer = Math.max(target.fearTimer, 1.35 * targetProfile.fear); target.setActionState?.("panic", { target: actor, reason: "\u5a01\u5687\u3055\u308c\u3066\u9003\u3052\u3066\u3044\u308b", wake: true }); }
|
||||
this.spawnBubble(target.x, target.y - target.radius * 1.28, "\u306f\u3041\u3041\u3041\uff01", "rgba(84,66,86,0.80)");
|
||||
|
|
@ -939,8 +971,10 @@
|
|||
actor.lastLog = target.lastLog = this.time;
|
||||
}
|
||||
this.markFightPairCooldown?.(actor, target, Math.max(6.5, CONFIG.fightCooldown + 3));
|
||||
actor.postConflictPeaceTimer = Math.max(actor.postConflictPeaceTimer || 0, deterministicRange(this, "intimidation-success-peace-actor", 3.8, 6.2, actor, target));
|
||||
target.postConflictPeaceTimer = Math.max(target.postConflictPeaceTimer || 0, deterministicRange(this, "intimidation-success-peace-target", 3.8, 6.2, actor, target));
|
||||
actor.intimidateTimer = Math.min(actor.intimidateTimer || 0, 0.62);
|
||||
target.intimidatedTimer = Math.min(target.intimidatedTimer || 0, 0.70);
|
||||
actor.postConflictPeaceTimer = Math.max(actor.postConflictPeaceTimer || 0, deterministicRange(this, "intimidation-success-peace-actor", 2.4, 3.8, actor, target));
|
||||
target.postConflictPeaceTimer = Math.max(target.postConflictPeaceTimer || 0, deterministicRange(this, "intimidation-success-peace-target", 2.4, 3.8, actor, target));
|
||||
return true;
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue