aa
This commit is contained in:
parent
f941200504
commit
ad2cc76429
34 changed files with 616 additions and 365 deletions
|
|
@ -210,8 +210,8 @@ function createTemperatureComfortActionSpec() {
|
|||
label: "快適な温度帯へ移動している",
|
||||
phrase: "快適な温度帯を探している",
|
||||
text(t, world) {
|
||||
const felt = world?.temperatureAt?.(t?.x, t?.y) ?? t?.feltTemperature ?? t?.tempComfort ?? (CONFIG.standardTemperature ?? 15);
|
||||
const status = world?.temperatureStatusFor?.(felt) || t?.temperatureStatus || null;
|
||||
const felt = world?.feltTemperatureFor?.(t) ?? world?.temperatureAt?.(t?.x, t?.y, t) ?? t?.feltTemperature ?? t?.tempComfort ?? (CONFIG.standardTemperature ?? 15);
|
||||
const status = world?.temperatureStatusFor?.(felt, t) || t?.temperatureStatus || null;
|
||||
return status?.direction === "cold" ? "寒いので温まろうとしている。" : "暑いので涼もうとしている。";
|
||||
},
|
||||
weight: 42,
|
||||
|
|
@ -219,20 +219,20 @@ function createTemperatureComfortActionSpec() {
|
|||
return world?.findComfortTemperatureSpot?.(t, { force: !!ctx.force, requireComfort: true }) || null;
|
||||
},
|
||||
canStart(t, world, ctx = {}) {
|
||||
const felt = world?.temperatureAt?.(t.x, t.y);
|
||||
const status = world?.temperatureStatusFor?.(Number.isFinite(Number(felt)) ? felt : (t?.feltTemperature ?? CONFIG.standardTemperature ?? 15));
|
||||
const felt = world?.feltTemperatureFor?.(t) ?? world?.temperatureAt?.(t.x, t.y, t);
|
||||
const status = world?.temperatureStatusFor?.(Number.isFinite(Number(felt)) ? felt : (t?.feltTemperature ?? CONFIG.standardTemperature ?? 15), t);
|
||||
if (!status || status.comfortable || (status.discomfort || 0) < 2.5) return false;
|
||||
return !!(ctx.target ?? this.selectTarget(t, world, ctx));
|
||||
},
|
||||
start(t, world, ctx = {}) {
|
||||
const status = world?.temperatureStatusFor?.(world?.temperatureAt?.(t.x, t.y) ?? t?.feltTemperature ?? (CONFIG.standardTemperature ?? 15));
|
||||
const status = world?.temperatureStatusFor?.(world?.feltTemperatureFor?.(t) ?? world?.temperatureAt?.(t.x, t.y, t) ?? t?.feltTemperature ?? (CONFIG.standardTemperature ?? 15), t);
|
||||
const label = status?.direction === "cold" ? "あたたかい場所へ移動している" : (status?.direction === "hot" ? "涼しい場所へ移動している" : this.label);
|
||||
const target = ctx.target ?? this.selectTarget(t, world, ctx);
|
||||
return moveToOrUse(t, target, "seek_temperature", label);
|
||||
},
|
||||
tick(t, world, dt, needs, ctx = {}) {
|
||||
const felt = world?.temperatureAt?.(t.x, t.y) ?? t?.feltTemperature ?? (CONFIG.standardTemperature ?? 15);
|
||||
const status = world?.temperatureStatusFor?.(felt);
|
||||
const felt = world?.feltTemperatureFor?.(t) ?? world?.temperatureAt?.(t.x, t.y, t) ?? t?.feltTemperature ?? (CONFIG.standardTemperature ?? 15);
|
||||
const status = world?.temperatureStatusFor?.(felt, t);
|
||||
if (status?.comfortable || (status?.discomfort || 0) <= 1.5) {
|
||||
if (typeof applyNeedSatisfaction === "function") applyNeedSatisfaction(t, { health: 10, safety: 8 }, "temperature");
|
||||
t.goIdle?.("快適な温度になった");
|
||||
|
|
@ -287,7 +287,7 @@ function createWanderActionSpec() {
|
|||
}
|
||||
|
||||
function selectFightRivalTarget(tarinai, world, range = 360) {
|
||||
const candidate = conflictTargetFor(tarinai, world, (tarinai?.fightMochiTimer || 0) > 0.04 || isCurrentBehaviorForced(tarinai) ? 18 : 34);
|
||||
const candidate = conflictTargetFor(tarinai, world, (tarinai?.fightMochiTimer || 0) > 0.04 || isCurrentBehaviorForced(tarinai) ? 18 : 14);
|
||||
const current = currentBehaviorTarget(tarinai);
|
||||
return isLiveTarinaiEntity(candidate?.target)
|
||||
? candidate.target
|
||||
|
|
@ -395,17 +395,12 @@ function createFightRivalActionSpec() {
|
|||
canStart(t, world, ctx = {}) {
|
||||
if ((t.fightCooldown || 0) > 0.04 || (t.postConflictPeaceTimer || 0) > 0.04) return false;
|
||||
const forced = (t?.fightMochiTimer || 0) > 0.04 || isCurrentBehaviorForced(t);
|
||||
const candidate = conflictTargetFor(t, world, forced ? 24 : 42);
|
||||
if (!forced) {
|
||||
const parts = t?.socialReasonParts || {};
|
||||
const conflict = Number(parts.conflict || 0) || 0;
|
||||
const socialPull = Math.max(Number(parts.bond || 0) || 0, Number(parts.mate || 0) || 0, Number(parts.family || 0) || 0);
|
||||
if (!candidate?.target || conflict < 22 || conflict < socialPull * 0.68) return false;
|
||||
}
|
||||
const candidate = conflictTargetFor(t, world, forced ? 24 : 7);
|
||||
if (!candidate?.target && !ctx.target) return false;
|
||||
return !!(ctx.target ?? candidate?.target ?? this.selectTarget(t, world, ctx));
|
||||
},
|
||||
start(t, world, ctx = {}) {
|
||||
const candidate = conflictTargetFor(t, world, (t?.fightMochiTimer || 0) > 0.04 || isCurrentBehaviorForced(t) ? 18 : 26);
|
||||
const candidate = conflictTargetFor(t, world, (t?.fightMochiTimer || 0) > 0.04 || isCurrentBehaviorForced(t) ? 18 : 7);
|
||||
const rival = ctx.target ?? this.selectTarget(t, world, ctx);
|
||||
if (!isLiveTarinaiEntity(rival)) return false;
|
||||
t.conflictTargetId = rival.id;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue