This commit is contained in:
33333-33333 2026-06-24 17:39:44 +09:00
commit 9ef1b8dbb1
23 changed files with 329 additions and 96 deletions

View file

@ -7,6 +7,9 @@
draw(ctx, t, lighting = null) {
if (this.dead) return;
const lightState = lighting || getLightingState(this.world);
const quality = this.world.performanceQuality?.() || {};
const effectDensity = clamp(Number(quality.effectDensity || 1) || 1, 0.12, 1);
const showDecor = effectDensity > 0.45 || this.world.selected === this;
const sprite = this.spriteId();
const img = typeof getRenderableImage === "function" ? getRenderableImage(sprite, "smile") : (images.get(sprite) || images.get(this.type));
const metrics = getImageMetrics(sprite) || getImageMetrics(this.type) || getImageMetrics("smile");
@ -63,18 +66,18 @@
const shadow = projectedShadowParams(lightState, 0.95 + visualScale * 0.8);
const shadowContactY = this.y + bob + (drawH / squish) * 0.30;
if (img) {
if (showDecor && img) {
drawImageProjectedShadow(ctx, img, this.x, shadowContactY, drawW * squish, drawH / squish, shadow, {
faceRight,
alpha: shadow.alpha * (this.state === "sleep" ? 1.10 : 0.92) * nestHideAlpha,
widthScale: this.state === "sleep" ? 1.12 : 1,
heightScale: this.state === "sleep" ? 0.88 : 1,
});
} else {
} else if (showDecor) {
drawProjectedShadow(ctx, this.x, shadowContactY, drawW * 0.52, drawH * 0.13, { ...shadow, alpha: shadow.alpha * 0.82 * nestHideAlpha });
}
drawCreatureGlow(ctx, this, drawW, drawH, lightState);
if (this.powerItemMode === "protein" || this.powerItemMode === "niteropu") {
if (showDecor) drawCreatureGlow(ctx, this, drawW, drawH, lightState);
if (showDecor && (this.powerItemMode === "protein" || this.powerItemMode === "niteropu")) {
ctx.save();
const up = this.powerItemMode === "protein";
const baseColor = up ? "rgba(224,54,40,0.92)" : "rgba(116,80,190,0.88)";
@ -194,7 +197,7 @@
ctx.textBaseline = "middle";
ctx.fillText(focusLabel, 0, ly);
ctx.restore();
} else if ((this.world.performanceLevel ? this.world.performanceLevel() : 0) < 2 && this.world.pointer?.inside && distXY(this.x, this.y, this.world.pointer.x, this.world.pointer.y) < this.radius * 2.0) {
} else if (showDecor && this.world.pointer?.inside && distXY(this.x, this.y, this.world.pointer.x, this.world.pointer.y) < this.radius * 2.0) {
ctx.save();
ctx.globalAlpha = 0.28;
ctx.strokeStyle = this.state === "cursor_enemy" ? "rgba(180, 92, 92, 0.70)" : "rgba(255, 250, 220, 0.78)";
@ -231,7 +234,7 @@
ctx.restore();
}
if ((this.world.performanceLevel ? this.world.performanceLevel() : 0) < 2 && (this.goodMode === "smile" || this.state === "cursor_friend") && this.mood > 58 && this.stress < 44 && this.state !== "sleep") {
if (showDecor && (this.goodMode === "smile" || this.state === "cursor_friend") && this.mood > 58 && this.stress < 44 && this.state !== "sleep") {
ctx.save();
const cursorLove = this.state === "cursor_friend" ? Math.max(0, this.cursorPetting || 0) : 0;
ctx.globalAlpha = this.state === "cursor_friend" ? clamp(0.82 + cursorLove * 0.16, 0.82, 1) : 0.34;
@ -312,8 +315,10 @@
ctx.font = `${starSize}px "Apple Color Emoji", "Segoe UI Emoji", sans-serif`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.shadowColor = "rgba(255, 198, 28, 0.82)";
ctx.shadowBlur = 14;
if (showDecor) {
ctx.shadowColor = "rgba(255, 198, 28, 0.82)";
ctx.shadowBlur = 14;
}
ctx.lineWidth = Math.max(2, starSize * 0.12);
ctx.strokeStyle = "rgba(92, 62, 0, 0.86)";
ctx.fillStyle = "rgba(255, 218, 46, 1)";
@ -324,7 +329,7 @@
const hpActive = (this.hpBarTimer || 0) > 0;
const stressActive = (this.stressBarTimer || 0) > 0;
if (hpActive || stressActive) {
if ((hpActive || stressActive) && (showDecor || this.world.selected === this || this.hurtTimer > 0.04)) {
const bw = Math.max(28, this.radius * 2.35);
const bh = 5;
const x = this.x - bw / 2;