This commit is contained in:
33333-33333 2026-06-30 10:57:06 +09:00
commit f941200504
70 changed files with 1856 additions and 429 deletions

View file

@ -454,18 +454,46 @@
},
lowHealthSprite() {
// \u4f4e\u4f53\u529b\u306f\u7a7a\u8179\u30fb\u7720\u6c17\u3060\u3051\u3067\u306a\u304f\u3001\u5065\u5eb7\u6b32\u6c42\u306e\u60aa\u5316\u3084\u8ca0\u50b7\u3082\u53cd\u6620\u3059\u308b\u3002
const healthNeed = Number(this.needRaw?.health ?? this.needs?.health ?? 0) || 0;
const hurt = (this.hurtTimer || 0) > 0.10;
const critical = this.hunger > 112 || this.energy < 7 || healthNeed >= 90 || (hurt && this.energy < 20);
if (critical) return "stretch";
const weak = this.hunger > 102 || this.energy < 18 || healthNeed >= 66 || hurt;
if (weak) return "weak";
// 体力比率による段階表示: 30%以下 cry、20%以下 weak、10%以下 stretch。
const maxEnergy = typeof tarinaiMaxEnergy === "function" ? tarinaiMaxEnergy(this) : (Number(this.maxEnergy) || 100);
const energyRatio = (Number(this.energy) || 0) / Math.max(1, Number(maxEnergy) || 100);
if (energyRatio <= 0.10) return "stretch";
if (energyRatio <= 0.20) return "weak";
if (energyRatio <= 0.30) return "cry";
return null;
},
briefDeathReason(reason = this.deathReason) { return HEALTH.briefDeathReason(this, reason); },
temperatureDiscomfortSprite(baseId = "") {
const world = this.world || null;
const felt = world?.temperatureAt?.(this.x, this.y) ?? this.feltTemperature ?? this.tempComfort ?? (CONFIG.standardTemperature ?? 15);
const status = this.temperatureStatus || world?.temperatureStatusFor?.(felt) || null;
if (!status || status.comfortable || (status.discomfort || 0) < 2.5) return "";
const pool = (status.direction === "cold" ? ["cold_1", "cold_2", "cold_3"] : ["hot_1", "hot_2", "hot_3"]).filter(id => SPRITES.some(s => s.id === id));
if (!pool.length) return "";
const mapped = ({
smile: 0,
normal_happy: 0,
normal_tongue: 0,
jito: 1,
normal_smirk: 1,
pokan: 2,
angry: 2,
hungry_70: 2,
})[String(baseId || "")];
const fallbackIndex = status.harmful ? 2 : ((status.discomfort || 0) >= 7 ? 1 : 0);
const index = clamp(Number.isFinite(mapped) ? mapped : fallbackIndex, 0, pool.length - 1);
return pool[index] || pool[0] || "";
},
applyTemperatureSprite(baseId = "") {
const id = String(baseId || "");
if (!id) return id;
if (!["smile", "jito", "normal_smirk", "normal_tongue", "normal_happy", "pokan", "angry", "hungry_70"].includes(id)) return id;
return this.temperatureDiscomfortSprite(id) || id;
},
variantSprite(category) {
const pools = {
hurt: ["hurt", "hurt2"],