This commit is contained in:
33333-33333 2026-06-28 13:40:41 +09:00
commit f500279abd
93 changed files with 1893 additions and 1198 deletions

View file

@ -134,6 +134,42 @@
adjustPersonality(key, delta, reason = "") { return adjustPersonality(this, key, delta, reason); },
shouldApplyPersonalityBehavior(key, direction = 1) { return shouldApplyPersonalityBehavior(this, key, direction); },
fightWinRate() {
const wins = Number(this.totalFightWins || 0) || 0;
const losses = Number(this.totalFightLosses || 0) || 0;
const total = wins + losses;
return total > 0 ? wins / total : 0;
},
tarinaiChampionEligible() {
const wins = Number(this.totalFightWins || 0) || 0;
const losses = Number(this.totalFightLosses || 0) || 0;
const total = wins + losses;
return !this.dead && !this.isZunchiSlave && total >= 6 && total > 0 && wins / total >= 0.75;
},
becomeTarinaiChampion(options = {}) {
if (!this.tarinaiChampionEligible?.() && !options.force) return false;
if (this.isTarinaiChampion && !options.forcePersonality) return false;
this.isTarinaiChampion = true;
this.tarinaiChampionSince = Number.isFinite(this.tarinaiChampionSince) && this.tarinaiChampionSince > 0 ? this.tarinaiChampionSince : (this.world?.time || 0);
ensurePersonality(this);
const boosted = [];
for (const key of ["aggression", "openness", "sociability"]) {
const before = Number(this.currentPersonality?.[key]) || 0;
const next = clampPersonalityValue(Math.max(before + 0.48, 0.86));
this.currentPersonality[key] = next;
if (this.birthPersonality && Number(this.birthPersonality[key]) > next) this.currentPersonality[key] = clampPersonalityValue(this.birthPersonality[key]);
if (Math.abs((Number(this.currentPersonality[key]) || 0) - before) > 0.001) boosted.push(PERSONALITY_LABELS[key]?.label || key);
}
this.surpriseTimer = Math.max(this.surpriseTimer || 0, 0.65);
this.focusPulseTimer = Math.max(this.focusPulseTimer || 0, 1.0);
if (boosted.length) this.recordChangeCause?.("たりない王者", boosted.join("・"), { value: +1 });
this.world?.recordFamily?.(this);
return true;
},
maybeBecomeTimidAfterDamage(cause = "") {
if (this.dead) return false;
const losses = this.totalFightLosses || 0;
@ -424,7 +460,7 @@
},
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);