--
This commit is contained in:
parent
5ed977788c
commit
f500279abd
93 changed files with 1893 additions and 1198 deletions
|
|
@ -176,6 +176,10 @@
|
|||
const nextScale = Number.isFinite(t.scale) ? t.scale : (Number.isFinite(t.adultScale) ? t.adultScale : 0.28);
|
||||
const nextAdultScale = Number.isFinite(t.adultScale) ? t.adultScale : nextScale;
|
||||
const nextGrowth = Number.isFinite(t.growth) ? t.growth : 1;
|
||||
const nextGenetics = typeof normalizeGenetics === "function" ? normalizeGenetics(t.genetics, t.familyKey || t.id || "") : { ...(t.genetics || {}) };
|
||||
const nextFightWins = Number(t.totalFightWins || 0) || 0;
|
||||
const nextFightLosses = Number(t.totalFightLosses || 0) || 0;
|
||||
const nextChampion = !!t.isTarinaiChampion;
|
||||
if (!this.family[familyKey]) {
|
||||
this.family[familyKey] = {
|
||||
id: familyKey,
|
||||
|
|
@ -191,6 +195,11 @@
|
|||
scale: nextScale,
|
||||
adultScale: nextAdultScale,
|
||||
growth: nextGrowth,
|
||||
genetics: nextGenetics,
|
||||
lifeSpan: Number(t.lifeSpan) || 0,
|
||||
totalFightWins: nextFightWins,
|
||||
totalFightLosses: nextFightLosses,
|
||||
isTarinaiChampion: nextChampion,
|
||||
alive: !t.dead,
|
||||
deathReason: t.deathReason || "",
|
||||
};
|
||||
|
|
@ -206,6 +215,11 @@
|
|||
if (Math.abs((Number(entry.scale) || 0) - nextScale) > 0.002) changed = true;
|
||||
if (Math.abs((Number(entry.adultScale) || 0) - nextAdultScale) > 0.002) changed = true;
|
||||
if (Math.abs((Number(entry.growth) || 0) - nextGrowth) > 0.02) changed = true;
|
||||
for (const key of ["lifeSpanMul", "attackMul", "speedMul", "sizeMul"]) if (Math.abs((Number(entry.genetics?.[key]) || 1) - (Number(nextGenetics?.[key]) || 1)) > 0.002) changed = true;
|
||||
if (Math.abs((Number(entry.lifeSpan) || 0) - (Number(t.lifeSpan) || 0)) > 1) changed = true;
|
||||
if ((Number(entry.totalFightWins) || 0) !== nextFightWins) changed = true;
|
||||
if ((Number(entry.totalFightLosses) || 0) !== nextFightLosses) changed = true;
|
||||
if (!!entry.isTarinaiChampion !== nextChampion) changed = true;
|
||||
if ((entry.deathReason || "") !== (t.deathReason || entry.deathReason || "")) changed = true;
|
||||
if (entry.alive !== nextAlive) changed = true;
|
||||
if (!sameList(entry.parents, nextParents)) changed = true;
|
||||
|
|
@ -219,6 +233,11 @@
|
|||
entry.scale = nextScale;
|
||||
entry.adultScale = nextAdultScale;
|
||||
entry.growth = nextGrowth;
|
||||
entry.genetics = nextGenetics;
|
||||
entry.lifeSpan = Number(t.lifeSpan) || entry.lifeSpan || 0;
|
||||
entry.totalFightWins = nextFightWins;
|
||||
entry.totalFightLosses = nextFightLosses;
|
||||
entry.isTarinaiChampion = nextChampion;
|
||||
entry.hasPaired = !!t.hasPaired;
|
||||
entry.deathReason = t.deathReason || entry.deathReason || "";
|
||||
entry.parents = nextParents;
|
||||
|
|
@ -278,13 +297,23 @@
|
|||
scale: Number.isFinite(live?.scale) ? live.scale : (Number.isFinite(n.scale) ? n.scale : (Number.isFinite(live?.adultScale) ? live.adultScale : (Number.isFinite(n.adultScale) ? n.adultScale : 0.28))),
|
||||
adultScale: Number.isFinite(live?.adultScale) ? live.adultScale : (Number.isFinite(n.adultScale) ? n.adultScale : (Number.isFinite(live?.scale) ? live.scale : (Number.isFinite(n.scale) ? n.scale : 0.28))),
|
||||
growth: Number.isFinite(live?.growth) ? live.growth : (Number.isFinite(n.growth) ? n.growth : 1),
|
||||
genetics: live && typeof normalizeGenetics === "function" ? normalizeGenetics(live.genetics, live.familyKey || live.id || "") : (typeof normalizeGenetics === "function" ? normalizeGenetics(n.genetics, id) : { ...(n.genetics || {}) }),
|
||||
lifeSpan: Number(live?.lifeSpan || n.lifeSpan || 0) || 0,
|
||||
totalFightWins: Number(live?.totalFightWins ?? n.totalFightWins ?? 0) || 0,
|
||||
totalFightLosses: Number(live?.totalFightLosses ?? n.totalFightLosses ?? 0) || 0,
|
||||
isTarinaiChampion: !!(live?.isTarinaiChampion || n.isTarinaiChampion),
|
||||
alive: live ? !live.dead : n.alive !== false,
|
||||
deathReason: live?.deathReason || n.deathReason || "",
|
||||
};
|
||||
for (const key of Object.keys(next)) {
|
||||
const a = family[id]?.[key];
|
||||
const b = next[key];
|
||||
const equal = Array.isArray(a) && Array.isArray(b) ? sameList(a, b) : a === b;
|
||||
let equal = false;
|
||||
if (key === "genetics") {
|
||||
equal = ["lifeSpanMul", "attackMul", "speedMul", "sizeMul"].every(gk => Math.abs((Number(a?.[gk]) || 1) - (Number(b?.[gk]) || 1)) <= 0.002);
|
||||
} else {
|
||||
equal = Array.isArray(a) && Array.isArray(b) ? sameList(a, b) : a === b;
|
||||
}
|
||||
if (!equal) changed = true;
|
||||
}
|
||||
family[id] = next;
|
||||
|
|
@ -441,6 +470,17 @@
|
|||
|
||||
addTarinai(opts = {}) {
|
||||
opts = global.TarinaiSeedFactory?.prepareAddOptions?.(this, opts) || opts;
|
||||
const seedParents = Array.isArray(opts.seedParents) ? opts.seedParents.filter(p => p && typeof p === "object") : [];
|
||||
if (!opts.genetics && seedParents.length >= 2 && typeof inheritedGenetics === "function") {
|
||||
opts.genetics = inheritedGenetics(seedParents[0], seedParents[1], opts.birthSeed || opts.familyKey || "");
|
||||
}
|
||||
if (opts.genetics) {
|
||||
if (!Number.isFinite(opts.adultScale) && typeof adultScaleFromGenetics === "function") opts.adultScale = adultScaleFromGenetics(opts.birthSeed || opts.familyKey || "", opts.genetics);
|
||||
if (!Number.isFinite(opts.lifeSpan)) {
|
||||
const profile = global.TarinaiSeedFactory?.birthProfile?.(opts.birthSeed || opts.familyKey || "", opts) || {};
|
||||
if (Number.isFinite(profile.lifeSpan)) opts.lifeSpan = profile.lifeSpan;
|
||||
}
|
||||
}
|
||||
const t = new Tarinai(this, opts);
|
||||
this.assignTarinaiLiveId(t);
|
||||
this.tarinai.push(t);
|
||||
|
|
@ -476,8 +516,8 @@
|
|||
if (!box || box.dead || box.type !== "nest_box") 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 ? `、ほか${occupants.length - names.length}匹` : "";
|
||||
return ["巣箱", names.length ? `入ってる子: ${names.join("、")}${more}` : "入ってる子: なし"];
|
||||
const more = occupants.length > names.length ? `\u3001\u307b\u304b${occupants.length - names.length}\u5339` : "";
|
||||
return ["\u5de3\u7bb1", names.length ? `\u5165\u3063\u3066\u308b\u5b50: ${names.join("\u3001")}${more}` : "\u5165\u3063\u3066\u308b\u5b50: \u306a\u3057"];
|
||||
},
|
||||
|
||||
pointerOwnedBedInfo() {
|
||||
|
|
@ -497,7 +537,7 @@
|
|||
ownedBedTooltipLines(bed) {
|
||||
if (!bed || bed.dead || bed.type !== "grass_bed") return [];
|
||||
const owner = this.liveTarinaiById?.(bed.ownerId) || null;
|
||||
return ["かんたんベッド", `持ち主: ${owner?.name || "不明"}`];
|
||||
return ["\u304b\u3093\u305f\u3093\u30d9\u30c3\u30c9", `\u6301\u3061\u4e3b: ${owner?.name || "\u4e0d\u660e"}`];
|
||||
},
|
||||
|
||||
pointerItemTooltipInfo() {
|
||||
|
|
@ -532,7 +572,7 @@
|
|||
b.birthRitualRole = 1;
|
||||
a.birthRitualLeader = true;
|
||||
b.birthRitualLeader = false;
|
||||
const ritualReason = "へこへこしている";
|
||||
const ritualReason = "\u3078\u3053\u3078\u3053\u3057\u3066\u3044\u308b";
|
||||
const applyRitualAction = (actor, partner) => {
|
||||
if (!actor) return false;
|
||||
if (typeof actor.setActionState === "function") {
|
||||
|
|
@ -557,10 +597,10 @@
|
|||
const bBehavior = typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(b) : b.behavior;
|
||||
const aLoveCause = (aBehavior?.source === "love_mochi" || (a.loveMochiTimer || 0) > 0.04) ? "\u3078\u3053\u9905\u306e\u52b9\u679c" : `${b.name || "\u76f8\u624b"}\u304c\u6c17\u306b\u306a\u308b`;
|
||||
const bLoveCause = (bBehavior?.source === "love_mochi" || (b.loveMochiTimer || 0) > 0.04) ? "\u3078\u3053\u9905\u306e\u52b9\u679c" : `${a.name || "\u76f8\u624b"}\u304c\u6c17\u306b\u306a\u308b`;
|
||||
const aText = typeof buildReasonText === "function" ? buildReasonText("social", aBehavior?.tiedNeeds || ["social"], { id: "birth_ritual", need: "social", subNeed: "mate", label: `${b.name || "\u76f8\u624b"}\u3068へこへこしている` }, a, this, { causeText: aLoveCause }) : `${b.name || "\u76f8\u624b"}\u3068へこへこしている`;
|
||||
const bText = typeof buildReasonText === "function" ? buildReasonText("social", bBehavior?.tiedNeeds || ["social"], { id: "birth_ritual", need: "social", subNeed: "mate", label: `${a.name || "\u76f8\u624b"}\u3068へこへこしている` }, b, this, { causeText: bLoveCause }) : `${a.name || "\u76f8\u624b"}\u3068へこへこしている`;
|
||||
setBehaviorText(a, { need: "social", subNeed: "mate", actionId: "birth_ritual", actionLabel: `${b.name || "\u76f8\u624b"}\u3068へこへこしている`, reasonText: aText, causeText: aLoveCause, target: b });
|
||||
setBehaviorText(b, { need: "social", subNeed: "mate", actionId: "birth_ritual", actionLabel: `${a.name || "\u76f8\u624b"}\u3068へこへこしている`, reasonText: bText, causeText: bLoveCause, target: a });
|
||||
const aText = typeof buildReasonText === "function" ? buildReasonText("social", aBehavior?.tiedNeeds || ["social"], { id: "birth_ritual", need: "social", subNeed: "mate", label: `${b.name || "\u76f8\u624b"}\u3068\u3078\u3053\u3078\u3053\u3057\u3066\u3044\u308b` }, a, this, { causeText: aLoveCause }) : `${b.name || "\u76f8\u624b"}\u3068\u3078\u3053\u3078\u3053\u3057\u3066\u3044\u308b`;
|
||||
const bText = typeof buildReasonText === "function" ? buildReasonText("social", bBehavior?.tiedNeeds || ["social"], { id: "birth_ritual", need: "social", subNeed: "mate", label: `${a.name || "\u76f8\u624b"}\u3068\u3078\u3053\u3078\u3053\u3057\u3066\u3044\u308b` }, b, this, { causeText: bLoveCause }) : `${a.name || "\u76f8\u624b"}\u3068\u3078\u3053\u3078\u3053\u3057\u3066\u3044\u308b`;
|
||||
setBehaviorText(a, { need: "social", subNeed: "mate", actionId: "birth_ritual", actionLabel: `${b.name || "\u76f8\u624b"}\u3068\u3078\u3053\u3078\u3053\u3057\u3066\u3044\u308b`, reasonText: aText, causeText: aLoveCause, target: b });
|
||||
setBehaviorText(b, { need: "social", subNeed: "mate", actionId: "birth_ritual", actionLabel: `${a.name || "\u76f8\u624b"}\u3068\u3078\u3053\u3078\u3053\u3057\u3066\u3044\u308b`, reasonText: bText, causeText: bLoveCause, target: a });
|
||||
}
|
||||
a.reproductionTimer = CONFIG.reproductionCooldown + rand(2, 10);
|
||||
b.reproductionTimer = CONFIG.reproductionCooldown + rand(2, 10);
|
||||
|
|
@ -577,7 +617,7 @@
|
|||
if (source) participants.push(source);
|
||||
if (partner && partner !== source) participants.push(partner);
|
||||
if (!participants.length) return false;
|
||||
const reason = options.reason || "繁殖が中断された";
|
||||
const reason = options.reason || "\u7e41\u6b96\u304c\u4e2d\u65ad\u3055\u308c\u305f";
|
||||
let canceled = false;
|
||||
for (const t of participants) {
|
||||
if (!t || t.dead) continue;
|
||||
|
|
@ -615,7 +655,7 @@
|
|||
const threshold = Number(options.threshold || 180) || 180;
|
||||
if (amount < threshold) return false;
|
||||
return this.cancelBirthRitual(tarinai, {
|
||||
reason: options.reason || "強い衝撃で繁殖が中断された",
|
||||
reason: options.reason || "\u5f37\u3044\u885d\u6483\u3067\u7e41\u6b96\u304c\u4e2d\u65ad\u3055\u308c\u305f",
|
||||
target: options.target || null,
|
||||
fear: options.fear ?? 1.0,
|
||||
cause: options.cause || "external_force",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue