rr
This commit is contained in:
parent
2636d580a8
commit
d14550dad6
78 changed files with 2827 additions and 563 deletions
|
|
@ -10,7 +10,7 @@ function finishBehaviorConsumption(t, item, foodType, eating, dt, label, color =
|
|||
t.eatTimer = Math.max(t.eatTimer || 0, 1.0);
|
||||
t.eatCooldown = rand(0.96, 1.12);
|
||||
t.foodReactTimer = Math.max(t.foodReactTimer || 0, 0.16);
|
||||
if (typeof applyNeedSatisfaction === "function") applyNeedSatisfaction(t, { food: Math.max(18, Math.min(54, (Number(eating) || 0) * 1.1)) }, "meal");
|
||||
if (foodType !== "first_aid" && typeof applyNeedSatisfaction === "function") applyNeedSatisfaction(t, { food: Math.max(18, Math.min(54, (Number(eating) || 0) * 1.1)) }, "meal");
|
||||
t.lastMealColor = color;
|
||||
if (Math.random() < Math.max(0.1, dt || 0.1) * 2.2) {
|
||||
const mouth = t.mouthPosition?.(item) || { x: t.x, y: t.y };
|
||||
|
|
@ -77,13 +77,16 @@ function consumeBehaviorTarget(t, world, target, role = "food", dt = 0.12) {
|
|||
const eating = t.consumeFoodServing?.(target);
|
||||
if (!(eating > 0)) return false;
|
||||
const isParam = isParamEffectItemType(foodType);
|
||||
const hpOnlyMedicine = foodType === "first_aid";
|
||||
const isSpecial = foodType === "love_mochi" || foodType === "fight_mochi" || foodType === "sleep_drug" || isParam;
|
||||
const color = ({ sweet: "#78b957", love_mochi: "#ff7bab", fight_mochi: "#e07c43", sleep_drug: "#b89cff", protein: "#f28d3d", niteropu: "#6255a8", ammo: "#d0942f", laxative: "#788c3b", mercury: "#6e95a8", giant_drug: "#e47b3a", dwarf_drug: "#7773c8", zunda_juice: "#61b94f" })[foodType] || "#f1dfb7";
|
||||
const color = ({ sweet: "#78b957", love_mochi: "#ff7bab", fight_mochi: "#e07c43", sleep_drug: "#b89cff", first_aid: "#d24852", sedative: "#5c8eae", protein: "#f28d3d", niteropu: "#6255a8", ammo: "#d0942f", laxative: "#788c3b", mercury: "#6e95a8", giant_drug: "#e47b3a", dwarf_drug: "#7773c8", zunda_juice: "#61b94f" })[foodType] || "#f1dfb7";
|
||||
finishBehaviorConsumption(t, target, foodType, eating, effectiveDt, `${labelFor(foodType)}\u3092\u98df\u3079\u3066\u3044\u308b`, color);
|
||||
const hungerRelief = t.foodHungerReliefFor?.(foodType || target.type, eating, foodType === "sweet" ? 0.75 : (isSpecial ? 0.82 : 0.95)) ?? eating * 0.8;
|
||||
t.applyFoodHungerRelief ? t.applyFoodHungerRelief(hungerRelief) : (t.hunger -= hungerRelief);
|
||||
t.recoverHealth?.(eating * (foodType === "sweet" ? 0.28 : (isSpecial ? 0.24 : 0.46)));
|
||||
t.affection += foodType === "sweet" ? eating * 0.03 : eating * 0.012;
|
||||
if (!hpOnlyMedicine) {
|
||||
const hungerRelief = t.foodHungerReliefFor?.(foodType || target.type, eating, foodType === "sweet" ? 0.75 : (isSpecial ? 0.82 : 0.95)) ?? eating * 0.8;
|
||||
t.applyFoodHungerRelief ? t.applyFoodHungerRelief(hungerRelief) : (t.hunger -= hungerRelief);
|
||||
t.recoverHealth?.(eating * (foodType === "sweet" ? 0.28 : (isSpecial ? 0.24 : 0.46)));
|
||||
t.affection += foodType === "sweet" ? eating * 0.03 : eating * 0.012;
|
||||
}
|
||||
if (isSpecial && t.applyParamItemEffect) t.applyParamItemEffect(foodType || target.type, target, { source: "eating", nutrition: eating, silentLog: foodType === "love_mochi" || foodType === "fight_mochi" || foodType === "sleep_drug" });
|
||||
if (foodType === "sweet") {
|
||||
applyNeedRelief(t, { food: -eating * 0.4, fulfill: -eating * 0.2 });
|
||||
|
|
@ -91,7 +94,7 @@ function consumeBehaviorTarget(t, world, target, role = "food", dt = 0.12) {
|
|||
if (t.fightDisease) t.recoverFightDisease?.("\u305a\u3093\u3060\u9905\u3067\u304d\u305a\u3064\u304d\u75c5\u304c\u6cbb\u3063\u305f");
|
||||
}
|
||||
const fromDuplicator = isDuplicatorFoodSource(target);
|
||||
t.makePoop?.(normalPoopUnitsFor(foodType || target.type, eating));
|
||||
if (!hpOnlyMedicine) t.makePoop?.(normalPoopUnitsFor(foodType || target.type, eating));
|
||||
if (fromDuplicator) {
|
||||
t.mealCooldownUntil = Math.max(t.mealCooldownUntil || 0, (world.time || 0) + 1.2);
|
||||
t.behaviorLockTimer = Math.max(0, Math.min(t.behaviorLockTimer || 0, 0.18));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue