This commit is contained in:
2026-04-28 19:36:39 +08:00
parent a9febe7678
commit f0471a4f8d
206 changed files with 18456 additions and 10133 deletions
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* battle_all_in_crush
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 战斗中的正面爆发动作。它要求主角不绕、不拖,直接把当前回合的叙事、
* 技能权重和视觉表现都推向“强压正面敌人”的方向。
*/
export const BATTLE_ALL_IN_CRUSH_FUNCTION_SOURCE: StateFunctionSource = {
export const BATTLE_ALL_IN_CRUSH_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'battle_all_in_crush',
state: 'battle',
@@ -56,5 +56,23 @@ export const BATTLE_ALL_IN_CRUSH_FUNCTION_SOURCE: StateFunctionSource = {
category: 'battle',
active: true,
},
runtime: {
buildSuggestedActionText({ metrics, environment }) {
if (metrics.monsterHpRatio <= 0.25) {
return `压上去收掉${environment.monsterName}最后一口气`;
}
if (metrics.playerHpRatio <= 0.35) {
return `顶着伤势强压${environment.monsterName}赌一波强杀`;
}
return `正面强压${environment.monsterName}不给喘息`;
},
getPriority({ metrics }) {
return metrics.monsterHpRatio <= 0.25
? 8
: metrics.playerHpRatio <= 0.35
? 2
: 4;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* battle_escape_breakout
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 战斗中的脱离动作。它不是继续换血,而是明确让主角放弃当前缠斗,
* 把叙事重心切到“拉开距离、甩开追击、离开战场”。
*/
export const BATTLE_ESCAPE_BREAKOUT_FUNCTION_SOURCE: StateFunctionSource = {
export const BATTLE_ESCAPE_BREAKOUT_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'battle_escape_breakout',
state: 'battle',
@@ -51,5 +51,20 @@ export const BATTLE_ESCAPE_BREAKOUT_FUNCTION_SOURCE: StateFunctionSource = {
category: 'escape',
active: true,
},
runtime: {
buildSuggestedActionText({ metrics, environment }) {
if (metrics.playerHpRatio <= 0.35) {
return `撑着伤势先脱离${environment.monsterName}的追杀`;
}
return `转身拉开距离,甩开${environment.monsterName}`;
},
getPriority({ metrics }) {
return metrics.playerHpRatio <= 0.2
? 9
: metrics.playerHpRatio <= 0.35
? 5
: 1;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* battle_feint_step
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 战斗中的机动切入动作。它把重点放在虚晃、变线与抢身位,
* 让战斗叙事更偏向灵活切入而不是硬扛伤害。
*/
export const BATTLE_FEINT_STEP_FUNCTION_SOURCE: StateFunctionSource = {
export const BATTLE_FEINT_STEP_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'battle_feint_step',
state: 'battle',
@@ -56,5 +56,16 @@ export const BATTLE_FEINT_STEP_FUNCTION_SOURCE: StateFunctionSource = {
category: 'battle',
active: true,
},
runtime: {
buildSuggestedActionText({ metrics, environment }) {
if (metrics.monsterHpRatio <= 0.35) {
return `虚晃切进去收掉${environment.monsterName}`;
}
return `借假动作切进${environment.monsterName}身前`;
},
getPriority({ metrics }) {
return metrics.monsterHpRatio <= 0.5 ? 5 : 3;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* battle_finisher_window
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 战斗中的终结窗口动作。它要求系统把这一回合理解为“敌人已经露出空档”,
* 因而优先演出收割、补刀和终结技。
*/
export const BATTLE_FINISHER_WINDOW_FUNCTION_SOURCE: StateFunctionSource = {
export const BATTLE_FINISHER_WINDOW_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'battle_finisher_window',
state: 'battle',
@@ -55,5 +55,23 @@ export const BATTLE_FINISHER_WINDOW_FUNCTION_SOURCE: StateFunctionSource = {
category: 'battle',
active: true,
},
runtime: {
buildSuggestedActionText({ metrics, environment }) {
if (metrics.monsterHpRatio <= 0.25) {
return `完成对${environment.monsterName}的残血收割`;
}
if (metrics.monsterHpRatio <= 0.45) {
return `抓住${environment.monsterName}露出的破绽补上重击`;
}
return `盯住${environment.monsterName}的空当准备终结一击`;
},
getPriority({ metrics }) {
return metrics.monsterHpRatio <= 0.25
? 10
: metrics.monsterHpRatio <= 0.45
? 6
: 1;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* battle_guard_break
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 战斗中的破架重击动作。它强调“针对敌人当前动作强拆架势”,
* 比纯换血更讲究把敌人的节奏打断。
*/
export const BATTLE_GUARD_BREAK_FUNCTION_SOURCE: StateFunctionSource = {
export const BATTLE_GUARD_BREAK_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'battle_guard_break',
state: 'battle',
@@ -54,5 +54,16 @@ export const BATTLE_GUARD_BREAK_FUNCTION_SOURCE: StateFunctionSource = {
category: 'battle',
active: true,
},
runtime: {
buildSuggestedActionText({ metrics, environment }) {
if (metrics.monsterHpRatio <= 0.35) {
return `砸开${environment.monsterName}的架势直接斩落`;
}
return `重击破开${environment.monsterName}的招架`;
},
getPriority({ metrics }) {
return metrics.monsterHpRatio <= 0.4 ? 6 : 3;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* battle_probe_pressure
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 战斗中的稳扎试探动作。适合在局势未明、资源需要保留时,
* 先用安全且持续的压制把信息和节奏摸出来。
*/
export const BATTLE_PROBE_PRESSURE_FUNCTION_SOURCE: StateFunctionSource = {
export const BATTLE_PROBE_PRESSURE_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'battle_probe_pressure',
state: 'battle',
@@ -54,5 +54,19 @@ export const BATTLE_PROBE_PRESSURE_FUNCTION_SOURCE: StateFunctionSource = {
category: 'battle',
active: true,
},
runtime: {
buildSuggestedActionText({ metrics, environment }) {
if (metrics.playerManaRatio <= 0.3) {
return `稳住节奏试探${environment.monsterName},先省下灵力`;
}
if (metrics.monsterHpRatio <= 0.3) {
return `稳步逼近,补掉${environment.monsterName}残余血量`;
}
return `稳扎稳打继续试探${environment.monsterName}`;
},
getPriority({ metrics }) {
return metrics.playerManaRatio <= 0.3 ? 8 : 4;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* battle_recover_breath
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 战斗中的恢复动作。它会把当前回合塑造成“先稳住伤势与灵力”,
* 让数值、冷却和叙事都朝回气与整顿节奏的方向靠拢。
*/
export const BATTLE_RECOVER_BREATH_FUNCTION_SOURCE: StateFunctionSource = {
export const BATTLE_RECOVER_BREATH_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'battle_recover_breath',
state: 'battle',
@@ -57,5 +57,22 @@ export const BATTLE_RECOVER_BREATH_FUNCTION_SOURCE: StateFunctionSource = {
category: 'recovery',
active: true,
},
runtime: {
buildSuggestedActionText({ metrics }) {
if (metrics.playerHpRatio <= 0.35) {
return '原地打坐恢复血量';
}
if (metrics.playerManaRatio <= 0.3) {
return '收势调息回一口灵力';
}
return '边守边调息稳住节奏';
},
getPriority({ metrics }) {
return (
(metrics.playerHpRatio <= 0.35 ? 10 : 0) +
(metrics.playerManaRatio <= 0.3 ? 6 : 0)
);
},
},
};
+21 -2
View File
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* idle_call_out
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 空闲状态下的主动喊话动作。它会把探索从“静悄悄地摸过去”
* 转成“先出声试探,看谁先回应”的节奏。
*/
export const IDLE_CALL_OUT_FUNCTION_SOURCE: StateFunctionSource = {
export const IDLE_CALL_OUT_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'idle_call_out',
state: 'idle',
@@ -44,5 +44,24 @@ export const IDLE_CALL_OUT_FUNCTION_SOURCE: StateFunctionSource = {
category: 'idle',
active: true,
},
runtime: {
applyDefinitionAdjustments(definition) {
return {
...definition,
text: '主动出声试探',
description:
'主动朝前方喊话试探,可能把附近潜着的角色或怪物直接从远处引出来。',
};
},
buildSuggestedActionText({ environment }) {
return `冲着${environment.sceneName}前方扬声试探,看是谁先被逼出来`;
},
buildDetailText() {
return '主动打破寂静,把附近潜着的角色或怪物从屏幕外直接引到眼前。';
},
getPriority() {
return 5;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* idle_explore_forward
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 空闲状态下最核心的推进动作。它负责把“继续往前探”从一句泛化文案,
* 落成真正会引出下一幕遭遇的运行时 function。
*/
export const IDLE_EXPLORE_FORWARD_FUNCTION_SOURCE: StateFunctionSource = {
export const IDLE_EXPLORE_FORWARD_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'idle_explore_forward',
state: 'idle',
@@ -44,5 +44,32 @@ export const IDLE_EXPLORE_FORWARD_FUNCTION_SOURCE: StateFunctionSource = {
category: 'idle',
active: true,
},
runtime: {
applyDefinitionAdjustments(definition) {
return {
...definition,
text: '继续向前探索',
description:
'沿着当前场景继续深入,把前路真正探出来,下一刻就可能撞上新的危险或际遇。',
};
},
buildSuggestedActionText({ metrics, environment }) {
if (metrics.playerHpRatio <= 0.35) {
return `按着伤口,沿着${environment.sceneName}继续往深处摸去`;
}
if (environment.hasForwardScene) {
return `顺着${environment.sceneName}的路势,继续朝前方深处探去`;
}
return `拨开${environment.sceneName}前的遮挡,继续朝更深处探去`;
},
buildDetailText({ environment }) {
return environment.hasForwardScene
? `沿着${environment.sceneName}继续往前压过去,真正把前方会遇到的人影、怪物或宝藏探出来。`
: `继续深入${environment.sceneName}前方未探明的地带,下一刻就可能撞见新的动静。`;
},
getPriority({ metrics }) {
return metrics.playerHpRatio > 0.45 ? 6 : 2;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* idle_follow_clue
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 空闲状态下的循线推进动作。它在源码定义层仍然存在,
* 但当前运行时会在聚合阶段被过滤,因此属于保留中的停用 function。
*/
export const IDLE_FOLLOW_CLUE_FUNCTION_SOURCE: StateFunctionSource = {
export const IDLE_FOLLOW_CLUE_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'idle_follow_clue',
state: 'idle',
@@ -44,5 +44,16 @@ export const IDLE_FOLLOW_CLUE_FUNCTION_SOURCE: StateFunctionSource = {
category: 'idle',
active: false,
},
runtime: {
buildSuggestedActionText() {
return '顺着可疑痕迹继续靠近';
},
buildDetailText() {
return '沿着声音、脚印或灵气痕迹继续摸过去,可能更快接近前方目标。';
},
getPriority() {
return 5;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* idle_observe_signs
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 空闲状态下的侦察动作。它把当前回合定义成“停下来观察”,
* 重点不是立刻推进,而是为后续选择生成可引用的观察结果。
*/
export const IDLE_OBSERVE_SIGNS_FUNCTION_SOURCE: StateFunctionSource = {
export const IDLE_OBSERVE_SIGNS_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'idle_observe_signs',
state: 'idle',
@@ -44,5 +44,16 @@ export const IDLE_OBSERVE_SIGNS_FUNCTION_SOURCE: StateFunctionSource = {
category: 'idle',
active: true,
},
runtime: {
buildSuggestedActionText() {
return '停步观察附近的风吹草动';
},
buildDetailText() {
return '先确认附近是否潜伏着人影、怪物或其他值得靠近的东西。';
},
getPriority() {
return 4;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* idle_rest_focus
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 空闲状态下的原地恢复动作。它不会推进遭遇,而是给玩家一个
* 在非战斗场景里回收少量血蓝的缓冲回合。
*/
export const IDLE_REST_FOCUS_FUNCTION_SOURCE: StateFunctionSource = {
export const IDLE_REST_FOCUS_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'idle_rest_focus',
state: 'idle',
@@ -46,5 +46,21 @@ export const IDLE_REST_FOCUS_FUNCTION_SOURCE: StateFunctionSource = {
category: 'recovery',
active: true,
},
runtime: {
buildSuggestedActionText({ metrics }) {
if (metrics.playerHpRatio <= 0.35) {
return '原地打坐恢复气血';
}
if (metrics.playerManaRatio <= 0.35) {
return '盘坐调息恢复灵力';
}
return '原地调息整理状态';
},
getPriority({ metrics }) {
return metrics.playerHpRatio <= 0.35 || metrics.playerManaRatio <= 0.35
? 8
: 2;
},
},
};
@@ -1,5 +1,5 @@
import { AnimationState } from '../../../types';
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
/**
* idle_travel_next_scene
@@ -7,7 +7,7 @@ import type { StateFunctionSource } from '../types';
* 空闲状态下的切场景动作。它代表玩家主动离开当前地点,
* 进入相邻场景重新开启新的遭遇周期。
*/
export const IDLE_TRAVEL_NEXT_SCENE_FUNCTION_SOURCE: StateFunctionSource = {
export const IDLE_TRAVEL_NEXT_SCENE_FUNCTION_SOURCE: StateFunctionRuntimeSource = {
definition: {
id: 'idle_travel_next_scene',
state: 'idle',
@@ -44,5 +44,21 @@ export const IDLE_TRAVEL_NEXT_SCENE_FUNCTION_SOURCE: StateFunctionSource = {
category: 'idle',
active: true,
},
runtime: {
buildSuggestedActionText({ environment }) {
return environment.travelSceneName
? `前往${environment.travelSceneName}`
: '前往其他场景';
},
buildDetailText({ environment }) {
return (
environment.travelSceneDescription ??
'离开当前区域,前往相邻场景继续冒险。'
);
},
getPriority({ metrics }) {
return metrics.playerHpRatio > 0.45 ? 5 : 3;
},
},
};
+6 -3
View File
@@ -1,4 +1,4 @@
import type { StateFunctionSource } from '../types';
import type { StateFunctionRuntimeSource } from '../types';
import { BATTLE_ALL_IN_CRUSH_FUNCTION_SOURCE } from './battleAllInCrush';
import { BATTLE_ATTACK_BASIC_FUNCTION } from './battleAttackBasic';
import { BATTLE_ESCAPE_BREAKOUT_FUNCTION_SOURCE } from './battleEscapeBreakout';
@@ -15,7 +15,7 @@ import { IDLE_OBSERVE_SIGNS_FUNCTION_SOURCE } from './idleObserveSigns';
import { IDLE_REST_FOCUS_FUNCTION_SOURCE } from './idleRestFocus';
import { IDLE_TRAVEL_NEXT_SCENE_FUNCTION_SOURCE } from './idleTravelNextScene';
export const STATE_FUNCTION_SOURCES: StateFunctionSource[] = [
export const STATE_FUNCTION_SOURCES: StateFunctionRuntimeSource[] = [
BATTLE_ALL_IN_CRUSH_FUNCTION_SOURCE,
BATTLE_GUARD_BREAK_FUNCTION_SOURCE,
BATTLE_PROBE_PRESSURE_FUNCTION_SOURCE,
@@ -31,6 +31,10 @@ export const STATE_FUNCTION_SOURCES: StateFunctionSource[] = [
IDLE_CALL_OUT_FUNCTION_SOURCE,
];
export const STATE_FUNCTION_RUNTIME_SOURCES = STATE_FUNCTION_SOURCES.filter(
(source) => source.runtime,
);
export const STATE_FUNCTION_DEFINITIONS = STATE_FUNCTION_SOURCES.map(
(source) => source.definition,
);
@@ -47,4 +51,3 @@ export const STATE_FUNCTION_DOCUMENTATION = [
BATTLE_USE_SKILL_FUNCTION,
...STATE_FUNCTION_SOURCES.map((source) => source.documentation),
];