This commit is contained in:
33333-33333 2026-08-08 15:31:31 +09:00
commit 28591233f3
85 changed files with 946 additions and 267 deletions

View file

@ -3,6 +3,34 @@
// Food, medicine, grass, ant-corpse, and zunchi eating branch for Tarinai item interaction.
(function (global) {
const OCHIBI_DIRTY_SPEECHES = [
{ id: "voice_ochibi_dirty_001", text: "くちゃいのだ" },
{ id: "voice_ochibi_dirty_002", text: "ずんちがめだまについたのだ!" },
{ id: "voice_ochibi_dirty_003", text: "おえええ!" },
{ id: "voice_ochibi_dirty_004", text: "ずんちがおくちについたのだ!" }
];
function maybePlayOchibiDirtySpeech(tarinai, delta = 0) {
if (!tarinai || !tarinai.isAcquiredTarinai || tarinai.dead) return false;
if (!(delta > 0.01)) return false;
const now = Number(tarinai.world?.time || 0) || 0;
const nextAllowed = Number(tarinai.ochibiDirtySpeechCooldownUntil || 0) || 0;
const lastLevel = Number(tarinai.ochibiDirtySpeechLastLevel || 0) || 0;
const currentLevel = Number(tarinai.zunchiStain || 0) || 0;
if (now < nextAllowed && currentLevel < lastLevel + 5) return false;
if ((tarinai.nextBubbleAt || 0) > now) return false;
const idx = Math.floor(Math.random() * OCHIBI_DIRTY_SPEECHES.length) % OCHIBI_DIRTY_SPEECHES.length;
const line = OCHIBI_DIRTY_SPEECHES[idx];
if (!line) return false;
const bubbled = tarinai.bubble?.(line.text, 4.8, "rgba(82,66,42,0.84)");
if (!bubbled) return false;
const audio = global.TarinaiAudio;
if (audio?.playSample) audio.playSample(line.id, 1.5, "voice") || audio.play?.(line.id, { category: "voice", minGap: 1.5 });
else if (audio?.play) audio.play(line.id, { category: "voice", minGap: 1.5 });
tarinai.ochibiDirtySpeechCooldownUntil = now + 3.2;
tarinai.ochibiDirtySpeechLastLevel = currentLevel;
return true;
}
function updateCandidate(tarinai, ctx, it, dt = 0) {
if (!tarinai || tarinai.dead || !ctx || !it || it.dead) return false;
if (it.type === "duplicator" && global.TarinaiSignalSystem?.powerOverride?.(it) === false) return false;
@ -157,7 +185,7 @@ if (it.type === "zunchi") {
applyNeedShock(tarinai, { health: touch * dt * 7, safety: touch * dt * 4 });
if (touch > 0.08) tarinai.adjustPersonality("neuroticism", -dt * touch * 0.0045, "after repeated contact with poop.");
}
tarinai.zunchiStain = clamp((tarinai.zunchiStain || 0) + touch * dt * (tarinai.isZunchiSlave ? 5.2 : 9.5), 0, 100);
{ const __prev = Number(tarinai.zunchiStain || 0) || 0; tarinai.zunchiStain = clamp((tarinai.zunchiStain || 0) + touch * dt * (tarinai.isZunchiSlave ? 5.2 : 9.5), 0, 100); maybePlayOchibiDirtySpeech(tarinai, (Number(tarinai.zunchiStain || 0) || 0) - __prev); }
const emergencyHunger = (tarinai.hunger || 0) >= 104 || foodNeed >= 94;
const zunchiTooFresh = zunchiEatingBlocked(tarinai, it, tarinai.world) || (!emergencyHunger && !tarinai.isZunchiSlave && it.stage === "fresh" && (it.age || 0) < 150 && foodNeed < 94 && (tarinai.hunger || 0) < 104);
if (canZunchiBite && !zunchiTooFresh) {
@ -171,7 +199,7 @@ if (it.type === "zunchi") {
tarinai.recoverHealth(bite * (tarinai.isZunchiSlave ? 0.10 : 0.02));
applyNeedShock(tarinai, { health: bite * (tarinai.isZunchiSlave ? 0.2 : 1.2), safety: bite * (tarinai.isZunchiSlave ? 0.1 : 0.6) });
if (!tarinai.isZunchiSlave) tarinai.adjustPersonality("neuroticism", -bite * 0.0015, "after repeated contact with poop.");
tarinai.zunchiStain = clamp((tarinai.zunchiStain || 0) + bite * (tarinai.isZunchiSlave ? 0.75 : 1.75), 0, 100);
{ const __prev = Number(tarinai.zunchiStain || 0) || 0; tarinai.zunchiStain = clamp((tarinai.zunchiStain || 0) + bite * (tarinai.isZunchiSlave ? 0.75 : 1.75), 0, 100); maybePlayOchibiDirtySpeech(tarinai, (Number(tarinai.zunchiStain || 0) || 0) - __prev); }
tarinai.lastMealColor = "#6b8d3f";
tarinai.eatTimer = Math.max(tarinai.eatTimer, 1.0);
tarinai.eatCooldown = rand(1.0, 1.22);