This commit is contained in:
33333-33333 2026-06-30 13:40:36 +09:00
commit ad2cc76429
34 changed files with 616 additions and 365 deletions

View file

@ -71,8 +71,10 @@
}
global.TarinaiCursorCareSystem.updateOne(t, dt);
const wasFighting = t.fightTimer > 0.04;
const endingFightTargetIds = wasFighting ? [...new Set([t.fightTargetId, ...(Array.isArray(t.fightTargetIds) ? t.fightTargetIds : [])].filter(Boolean))] : [];
t.fightTimer = Math.max(0, t.fightTimer - dt);
t.fightCooldown = Math.max(0, t.fightCooldown - dt);
t.postConflictPeaceTimer = Math.max(0, (t.postConflictPeaceTimer || 0) - dt);
t.groundStumbleCooldown = Math.max(0, (t.groundStumbleCooldown || 0) - dt);
t.defeatedTimer = Math.max(0, t.defeatedTimer - dt);
if (wasFighting && t.fightTimer <= 0.04 && t.defeatedById) {
@ -88,6 +90,19 @@
t.fightTargetIds = [];
t.fightTargetId = null;
}
if (wasFighting && t.fightTimer <= 0.04) {
const rivals = endingFightTargetIds.map(id => t.world?.liveTarinaiById?.(id)).filter(Boolean);
const cooldown = CONFIG.fightCooldown + detRange(t.world, "fight-ended-cooldown", 8, 14, t, endingFightTargetIds.join("/"));
t.fightCooldown = Math.max(t.fightCooldown || 0, cooldown);
t.postConflictPeaceTimer = Math.max(t.postConflictPeaceTimer || 0, detRange(t.world, "fight-ended-peace", 5.5, 9.0, t, endingFightTargetIds.join("/")));
for (const rival of rivals) t.world?.markFightPairCooldown?.(t, rival, cooldown + 2);
if (!t.defeatedById) {
t.fightTargetIds = [];
t.fightTargetId = null;
t.counterAttackFromId = null;
if (t.state === "fight" || t.state === "seek_enemy") t.setActionState?.("idle", { target: null, reason: "喧嘩が終わって少し距離を置いている。", sleeping: false, clearTarget: true });
}
}
t.grassEatTimer = Math.max(0, t.grassEatTimer - dt);
t.hurtTimer = Math.max(0, t.hurtTimer - dt);
t.fallTimer = Math.max(0, t.fallTimer - dt);
@ -121,13 +136,13 @@
t.tempTimer += dt;
if (t.tempTimer >= 0.55) {
const felt = t.world?.temperatureAt?.(t.x, t.y) ?? (CONFIG.standardTemperature ?? 15);
const felt = t.world?.feltTemperatureFor?.(t) ?? t.world?.temperatureAt?.(t.x, t.y, t) ?? (CONFIG.standardTemperature ?? 15);
t.tempComfort = felt;
t.feltTemperature = felt;
t.temperatureStatus = t.world?.temperatureStatusFor?.(felt) || null;
t.temperatureStatus = t.world?.temperatureStatusFor?.(felt, t) || null;
t.tempTimer = 0;
}
const tempStatus = t.temperatureStatus || t.world?.temperatureStatusFor?.(t.tempComfort ?? (CONFIG.standardTemperature ?? 15)) || { discomfort: 0, stressExcess: 0, harmExcess: 0, direction: "comfort" };
const tempStatus = t.temperatureStatus || t.world?.temperatureStatusFor?.(t.tempComfort ?? (CONFIG.standardTemperature ?? 15), t) || { discomfort: 0, stressExcess: 0, harmExcess: 0, direction: "comfort" };
const coldDiscomfort = tempStatus.direction === "cold" ? Math.max(0, tempStatus.discomfort || 0) : 0;
const hungerScale = t.metabolicHungerMultiplier ? t.metabolicHungerMultiplier() : (typeof tarinaiMetabolicHungerScale === "function" ? tarinaiMetabolicHungerScale(t) : 1);
t.hunger += CONFIG.hungerPerMinute * minute * t.trait.hunger * hungerScale * (1 + coldDiscomfort * 0.018);
@ -151,7 +166,6 @@
if ((tempStatus.harmExcess || 0) > 0) {
const harm = tempStatus.harmExcess || 0;
t.energy -= dt * (0.10 + harm * 0.075 + harm * harm * 0.006);
t.hurtTimer = Math.max(t.hurtTimer || 0, Math.min(1.2, 0.28 + harm * 0.035));
t.lastDamageCause = tempStatus.direction === "cold" ? "凍結" : "熱中症";
t.lastTemperatureDamageAt = t.world?.time || 0;
}