refactor: self-referencing intent table!

This commit is contained in:
hypercross 2026-04-15 14:59:34 +08:00
parent 09148f5b13
commit e77e2d0737
3 changed files with 6 additions and 6 deletions

View File

@ -6,8 +6,8 @@
# nextIntents: 下一个意图id, 多个意图则从中随机
# brokenIntent: 防御被打空后改变的意图id多个意图则从中随机
# effects技能效果目标+buff/debuff/攻击/防御+数值/层数
enemy,intent,nextIntents,brokenIntent,effects
@enemyDesert,string,string[],string[],['self' | 'opponent';@effectDesert;number][]
enemy,id,nextIntents,brokenIntent,effects
@enemyDesert,string,@enemyIntentDesert[],@enemyIntentDesert[],['self' | 'opponent';@effectDesert;number][]
仙人掌怪,boost,boost;defend;defend,,[self;spike;1];[self;defend;4]
仙人掌怪,defend,attack,,[self;defend;8]

1 # 敌人行动状态机,敌人行动时会执行当前的意图,然后将意图变为下一个意图
6 # brokenIntent: 防御被打空后改变的意图id,多个意图则从中随机
7 # effects:技能效果,目标+buff/debuff/攻击/防御+数值/层数
8 enemy,intent,nextIntents,brokenIntent,effects enemy,id,nextIntents,brokenIntent,effects
9 @enemyDesert,string,string[],string[],['self' | 'opponent';@effectDesert;number][] @enemyDesert,string,@enemyIntentDesert[],@enemyIntentDesert[],['self' | 'opponent';@effectDesert;number][]
10 仙人掌怪,boost,boost;defend;defend,,[self;spike;1];[self;defend;4]
11 仙人掌怪,defend,attack,,[self;defend;8]
12 仙人掌怪,attack,boost,,[opponent;attack;5]
13 蛇,poison,attack;attack,,[opponent;venom;1];[opponent;attack;4]

View File

@ -3,9 +3,9 @@ import type { EffectDesert } from './effectDesert.csv';
type EnemyIntentDesertTable = readonly {
readonly enemy: EnemyDesert;
readonly intent: string;
readonly nextIntents: readonly string[];
readonly brokenIntent: readonly string[];
readonly id: string;
readonly nextIntents: readonly EnemyIntentDesert[];
readonly brokenIntent: readonly EnemyIntentDesert[];
readonly effects: readonly ["self" | "opponent", EffectDesert, number];
}[];

View File

@ -209,7 +209,7 @@ describe('enemyIntentDesert.csv import', () => {
it('should have correct fields for each intent', () => {
for (const intent of enemyIntentDesertData) {
expect(intent).toHaveProperty('enemy');
expect(intent).toHaveProperty('intent');
expect(intent).toHaveProperty('id');
expect(intent).toHaveProperty('nextIntents');
expect(intent).toHaveProperty('brokenIntent');
expect(intent).toHaveProperty('effects');