This commit is contained in:
33333-33333 2026-07-09 16:08:11 +09:00
commit f1c3af2b89
49 changed files with 989 additions and 310 deletions

View file

@ -7,6 +7,12 @@ function mateTargetFor(t, world, maxDist = 520) {
if (!t || !world) return null;
const current = currentBehaviorTarget(t) || t.target;
const ok = o => o && o !== t && !o.dead && !world.areParentChild?.(t, o) && !!t.isZunchiSlave === !!o.isZunchiSlave && !o.sleepDisease && !o.fightDisease && (o.reproductionTimer || 0) <= 10 && (o.fightTimer || 0) <= 0.04 && (o.birthRitualTimer || 0) <= 0.04;
const championOk = o => ok(o) && !!t.isTarinaiChampion && !!o.isTarinaiChampion;
if (championOk(current) && dist(t, current) <= maxDist + 260) return current;
if (t.isTarinaiChampion) {
const champion = world.nearestOther?.(t, maxDist + 260, championOk) || null;
if (champion) return champion;
}
if (ok(current) && dist(t, current) <= maxDist + 120) return current;
return world.nearestOther?.(t, maxDist, ok) || null;
}
@ -45,12 +51,15 @@ function socialFightMateWeights(t, other, world, options = {}) {
&& (world.fightPairCooldownRemaining?.(t, other) || 0) <= 0.04
&& d <= Math.max(Number(options.fightRange || 58) || 58, (t.radius || 20) + (other.radius || 20) + 18);
const sameStatus = !!t.isZunchiSlave === !!other.isZunchiSlave;
const championPair = Boolean(t.isTarinaiChampion && other.isTarinaiChampion);
const mateWindow = Number.isFinite(Number(options.mateTimerWindow)) ? Number(options.mateTimerWindow) : 10;
const requireBirthReady = options.requireBirthReady !== false;
const timerOk = requireBirthReady ? ((t.reproductionTimer || 0) <= 0.04 && (other.reproductionTimer || 0) <= 0.04) : ((t.reproductionTimer || 0) <= mateWindow && (other.reproductionTimer || 0) <= mateWindow);
const mateDistanceOk = d <= Math.max(loveMochi ? 54 : 44, (t.radius || 20) + (other.radius || 20) + 14);
const enough = loveMochi ? ((t.hunger || 0) < 90 && (other.hunger || 0) < 92 && (t.energy || 0) > 18 && (other.energy || 0) > 18) : ((t.hunger || 0) < 55 && (other.hunger || 0) < 60 && (t.energy || 0) > 44 && (other.energy || 0) > 44);
const lonelyBond = loveMochi ? ((t.loneliness || 0) > 4 || (other.loneliness || 0) > 4 || (t.affection || 0) > 0 || (other.affection || 0) > 0) : ((t.loneliness || 0) > 24 || (other.loneliness || 0) > 24);
const enough = championPair
? ((t.hunger || 0) < 76 && (other.hunger || 0) < 78 && (t.energy || 0) > 30 && (other.energy || 0) > 30)
: (loveMochi ? ((t.hunger || 0) < 90 && (other.hunger || 0) < 92 && (t.energy || 0) > 18 && (other.energy || 0) > 18) : ((t.hunger || 0) < 55 && (other.hunger || 0) < 60 && (t.energy || 0) > 44 && (other.energy || 0) > 44));
const lonelyBond = championPair || (loveMochi ? ((t.loneliness || 0) > 4 || (other.loneliness || 0) > 4 || (t.affection || 0) > 0 || (other.affection || 0) > 0) : ((t.loneliness || 0) > 24 || (other.loneliness || 0) > 24));
const mateEligible = sameStatus
&& timerOk
&& mateDistanceOk
@ -73,6 +82,7 @@ function socialFightMateWeights(t, other, world, options = {}) {
fightWeight *= clamp(1 - affinity / 150, 0.34, 1.08);
fightWeight *= clamp(1 - fear / 170, fightMochi ? 0.72 : 0.42, 1.05);
fightWeight *= clamp(1.14 - Math.max(0, fearTrait - 1) * 0.16, 0.62, 1.22);
if (championPair) fightWeight *= 0.35;
if (options.mode === "conflict") fightWeight *= 1.35;
}
if (mateWeight > 0) {
@ -82,6 +92,7 @@ function socialFightMateWeights(t, other, world, options = {}) {
mateWeight *= 1 + Math.min(0.70, affinity / 140);
if (loveMochi) mateWeight *= 3.15;
if (fightMochi) mateWeight *= 0.52;
if (championPair) mateWeight *= 5.0;
if (options.mode === "mate") mateWeight *= 1.42;
}
const total = Math.max(0, fightWeight) + Math.max(0, mateWeight);