This commit is contained in:
33333-33333 2026-06-22 02:03:19 +09:00
commit e8f1d1db1e
60 changed files with 2417 additions and 612 deletions

View file

@ -203,6 +203,13 @@ function personalityEffectValue(value) {
return trait.direction * (trait.strength === "strong" ? 1 : 0.5);
}
function effectivePersonalityValue(tarinai, key) {
const p = ensurePersonality(tarinai).currentPersonality;
const base = clampPersonalityValue(p[key]);
const moodDelta = clampPersonalityValue(tarinai?.world?.colonyMood?.effects?.personality?.[key] || 0);
return clampPersonalityValue(base + moodDelta);
}
function personalityReasonText(reason = "") {
const key = String(reason || "").replace(/[.\u3002]+$/g, "").trim();
const map = {
@ -239,12 +246,12 @@ function getPersonalityTraitTags(tarinai) {
const p = ensurePersonality(tarinai).currentPersonality;
const tags = [];
for (const key of PERSONALITY_KEYS) {
const trait = getTraitStrength(p[key]);
const trait = getTraitStrength(effectivePersonalityValue(tarinai, key));
if (!trait.direction) continue;
const label = PERSONALITY_LABELS[key]?.[trait.direction > 0 ? "high" : "low"] || key;
tags.push(trait.strength === "slight" ? `\u5c11\u3057${label}` : label);
}
const cowardly = (p.neuroticism || 0) >= 0.75 && (p.aggression || 0) <= -0.5;
const cowardly = effectivePersonalityValue(tarinai, "neuroticism") >= 0.75 && effectivePersonalityValue(tarinai, "aggression") <= -0.5;
if (cowardly && !tags.includes("\u81c6\u75c5")) tags.push("\u81c6\u75c5");
return tags;
}
@ -355,8 +362,7 @@ function adjustPersonality(tarinai, key, delta, reason = "") {
}
function shouldApplyPersonalityBehavior(tarinai, key, direction = 1) {
const p = ensurePersonality(tarinai).currentPersonality;
const trait = getTraitStrength(p[key]);
const trait = getTraitStrength(effectivePersonalityValue(tarinai, key));
if (trait.direction !== Math.sign(direction || 1)) return false;
return trait.strength === "strong" || Math.random() < 0.5;
}
@ -570,9 +576,9 @@ class SpatialGrid {
if (!it || it.dead) return;
this.add(this.itemCells, it);
const type = it.type || "";
if (type === "stone" || type === "ball" || type === "nest_box" || type === "bed" || type === "fence_v" || type === "fence_h") this.add(this.obstacleCells, it);
if (type === "sweet" || type === "love_mochi" || type === "fight_mochi" || type === "grass" || type === "water" || type === "water_bowl" || type === "ant_corpse" || (typeof isParamEffectItemType === "function" && isParamEffectItemType(type))) this.add(this.foodCells, it);
if (type === "firecracker" || type === "genkotsu" || type === "pushpin" || type === "sleep_drug" || type === "zunchi" || type === "splat" || type === "mystery_drug" || type === "laxative" || type === "niteropu" || type === "mercury" || type === "giant_drug" || type === "dwarf_drug") this.add(this.hazardCells, it);
if (typeof itemHasTrait === "function" ? itemHasTrait(type, "obstacle") : (type === "stone" || type === "ball" || type === "nest_box" || type === "bed" || type === "fence_v" || type === "fence_h")) this.add(this.obstacleCells, it);
if (typeof itemHasTrait === "function" ? itemHasTrait(type, "food_interest") : (type === "sweet" || type === "love_mochi" || type === "fight_mochi" || type === "grass" || type === "water" || type === "water_bowl" || type === "ant_corpse" || (typeof isParamEffectItemType === "function" && isParamEffectItemType(type)))) this.add(this.foodCells, it);
if (itemHasTrait(type, "hazard")) this.add(this.hazardCells, it);
}
rebuild(items, tarinai, ants = []) {