This commit is contained in:
33333-33333 2026-06-23 18:11:42 +09:00
commit 54aff02658
27 changed files with 1700 additions and 1034 deletions

View file

@ -147,7 +147,7 @@
const changedA = this.adjustPersonality?.("neuroticism", 0.025, "after being hurt") || 0;
const changedB = this.adjustPersonality?.("aggression", -0.015, "after being hurt") || 0;
this.fearTimer = Math.max(this.fearTimer || 0, 1.2);
this.stress = clamp((this.stress || 0) + 5, 0, 130);
if (typeof applyNeedShock === "function") applyNeedShock(this, { safety: 9 });
return Boolean(changedA || changedB);
},
@ -256,9 +256,15 @@
const tolerance = Number.isFinite(opts.tolerance) ? opts.tolerance : 0.88;
const delta = Math.max(0, (amount || 0) * tolerance);
if (delta <= 0) return 0;
if (!this.needShock) this.needShock = {};
const shock = Math.min(100, delta * 1.8);
this.needShock.safety = Math.max(this.needShock.safety || 0, shock);
const before = this.stress || 0;
this.stress = clamp(before + delta, 0, 130);
const gained = Math.max(0, this.stress - before);
if (this.needs && typeof calculateStressFromNeeds === "function") {
const nextSafety = typeof quantizeNeed === "function" ? quantizeNeed((this.needs.safety || 0) + shock) : Math.min(100, (this.needs.safety || 0) + shock);
this.stress = calculateStressFromNeeds({ ...this.needs, safety: nextSafety });
}
const gained = Math.max(delta, Math.max(0, (this.stress || 0) - before));
const threshold = opts.threshold ?? 8;
if (gained >= threshold) this.showStressBar(opts.duration ?? 4.2);
return gained;