feat: add killturn to general meta and update related tests
- Introduced a new meta property `killturn` to the GeneralMeta interface. - Implemented a function `readMetaNumber` to handle the retrieval of numeric values from meta. - Updated the `mapGeneralRow` function to ensure `killturn` is required and properly handled. - Modified various tests to include the `killturn` property in the general's meta data. - Adjusted related action files to utilize the new GeneralMeta type for better type safety. - Ensured backward compatibility by updating existing test cases across multiple scenarios.
This commit is contained in:
@@ -85,7 +85,7 @@ const buildGeneral = (id: number, nationId: number, cityId: number, name = 'Test
|
||||
modifiers: {},
|
||||
meta: {},
|
||||
},
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
});
|
||||
|
||||
const buildCity = (id: number, nationId: number): City => ({
|
||||
|
||||
@@ -50,7 +50,7 @@ const buildGeneral = (id: number, nationId: number, cityId: number, name = 'Test
|
||||
modifiers: {},
|
||||
meta: {},
|
||||
},
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
});
|
||||
|
||||
const buildCity = (id: number, nationId: number): City => ({
|
||||
|
||||
@@ -105,7 +105,7 @@ const buildGeneral = (id: number, nationId: number, cityId: number, name = 'Test
|
||||
modifiers: {},
|
||||
meta: {},
|
||||
},
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
});
|
||||
|
||||
const buildCity = (id: number, nationId: number, name = `City${id}`): City => ({
|
||||
|
||||
@@ -92,7 +92,7 @@ const buildGeneral = (): General => ({
|
||||
modifiers: {},
|
||||
meta: {},
|
||||
},
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
});
|
||||
|
||||
const buildCities = (): City[] => [
|
||||
|
||||
@@ -48,7 +48,7 @@ const buildGeneral = (id: number, nationId: number, cityId: number): General =>
|
||||
modifiers: {},
|
||||
meta: {},
|
||||
},
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
});
|
||||
|
||||
const buildCity = (id: number, nationId: number): City => ({
|
||||
|
||||
@@ -117,7 +117,7 @@ describe('Diplomacy Scenario', () => {
|
||||
items: { horse: null, weapon: null, book: null, item: null },
|
||||
},
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
const snapshot: WorldSnapshot = {
|
||||
|
||||
@@ -74,7 +74,7 @@ describe('Domestic Affairs Scenario', () => {
|
||||
items: { horse: null, weapon: null, book: null, item: null },
|
||||
},
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
const snapshot: WorldSnapshot = {
|
||||
@@ -208,7 +208,7 @@ describe('Domestic Affairs Scenario', () => {
|
||||
items: { horse: null, weapon: null, book: null, item: null },
|
||||
},
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
const snapshot: WorldSnapshot = {
|
||||
|
||||
@@ -140,7 +140,7 @@ describe('che_NPC능동', () => {
|
||||
age: 20,
|
||||
npcState: 2, // NPC
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
world.snapshot.generals.push(general);
|
||||
|
||||
@@ -195,7 +195,7 @@ describe('che_NPC능동', () => {
|
||||
age: 20,
|
||||
npcState: 0, // Human
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
world.snapshot.generals.push(general);
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ describe('che_강행', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const nation: Nation = {
|
||||
id: 1,
|
||||
@@ -214,7 +214,7 @@ describe('che_강행', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
world.snapshot.generals.push(general);
|
||||
world.snapshot.nations.push(nation);
|
||||
@@ -285,7 +285,7 @@ describe('che_강행', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const nation: Nation = {
|
||||
id: 1,
|
||||
@@ -298,7 +298,7 @@ describe('che_강행', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
world.snapshot.generals.push(general);
|
||||
world.snapshot.nations.push(nation);
|
||||
@@ -362,7 +362,7 @@ describe('che_강행', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
const sub: General = {
|
||||
@@ -391,7 +391,7 @@ describe('che_강행', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
const nation: Nation = {
|
||||
|
||||
@@ -180,7 +180,7 @@ describe('che_귀환', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const nation: Nation = {
|
||||
id: 1,
|
||||
@@ -193,7 +193,7 @@ describe('che_귀환', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
world.snapshot.generals.push(general);
|
||||
world.snapshot.nations.push(nation);
|
||||
@@ -252,7 +252,7 @@ describe('che_귀환', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: { officer_city: 103 },
|
||||
meta: { killturn: 24, officer_city: 103 },
|
||||
};
|
||||
const nation: Nation = {
|
||||
id: 1,
|
||||
@@ -265,7 +265,7 @@ describe('che_귀환', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
world.snapshot.generals.push(general);
|
||||
world.snapshot.nations.push(nation);
|
||||
@@ -318,7 +318,7 @@ describe('che_귀환', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const nation: Nation = {
|
||||
id: 1,
|
||||
@@ -331,7 +331,7 @@ describe('che_귀환', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
world.snapshot.generals.push(general);
|
||||
world.snapshot.nations.push(nation);
|
||||
@@ -400,7 +400,7 @@ describe('che_귀환', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: { officer_city: 103 },
|
||||
meta: { killturn: 24, officer_city: 103 },
|
||||
};
|
||||
const nation: Nation = {
|
||||
id: 1,
|
||||
@@ -413,7 +413,7 @@ describe('che_귀환', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
world.snapshot.generals.push(general);
|
||||
world.snapshot.nations.push(nation);
|
||||
|
||||
@@ -172,7 +172,7 @@ describe('che_등용수락', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
const recruiterGen: General = {
|
||||
@@ -201,7 +201,7 @@ describe('che_등용수락', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
const nation2: Nation = {
|
||||
@@ -215,7 +215,7 @@ describe('che_등용수락', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
world.snapshot.generals.push(neutralGen);
|
||||
@@ -284,7 +284,7 @@ describe('che_등용수락', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: { betray: 1 },
|
||||
meta: { killturn: 24, betray: 1 },
|
||||
};
|
||||
const nation1: Nation = {
|
||||
id: 1,
|
||||
@@ -297,7 +297,7 @@ describe('che_등용수락', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
const recruiterGen: General = {
|
||||
@@ -326,7 +326,7 @@ describe('che_등용수락', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const nation2: Nation = {
|
||||
id: 2,
|
||||
@@ -339,7 +339,7 @@ describe('che_등용수락', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
world.snapshot.generals.push(betrayer);
|
||||
@@ -408,7 +408,7 @@ describe('che_등용수락', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const nation1: Nation = {
|
||||
id: 1,
|
||||
@@ -421,7 +421,7 @@ describe('che_등용수락', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const recruiterGen: General = {
|
||||
id: 2,
|
||||
@@ -444,7 +444,7 @@ describe('che_등용수락', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const nation2: Nation = {
|
||||
id: 2,
|
||||
@@ -457,7 +457,7 @@ describe('che_등용수락', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
world.snapshot.generals.push(monarch);
|
||||
@@ -512,7 +512,7 @@ describe('che_등용수락', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const nation1: Nation = {
|
||||
id: 1,
|
||||
@@ -525,7 +525,7 @@ describe('che_등용수락', () => {
|
||||
power: 0,
|
||||
level: 1,
|
||||
typeCode: 'che_def',
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const recruiterGen: General = {
|
||||
id: 2,
|
||||
@@ -548,7 +548,7 @@ describe('che_등용수락', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
world.snapshot.generals.push(general);
|
||||
|
||||
@@ -92,7 +92,7 @@ describe('che_이동', () => {
|
||||
age: 20,
|
||||
npcState: 0,
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
const nation: Nation = {
|
||||
id: 1,
|
||||
|
||||
@@ -131,7 +131,7 @@ describe('General Commands New Scenario', () => {
|
||||
items: { horse: null, weapon: null, book: null, item: null },
|
||||
},
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
const snapshot: WorldSnapshot = {
|
||||
|
||||
@@ -76,7 +76,7 @@ describe('Troop Management Scenario', () => {
|
||||
items: { horse: null, weapon: null, book: null, item: null },
|
||||
},
|
||||
triggerState: { flags: {}, counters: {}, modifiers: {}, meta: {} },
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
};
|
||||
|
||||
const snapshot: WorldSnapshot = {
|
||||
|
||||
@@ -60,7 +60,7 @@ const buildGeneral = (overrides: Partial<General> = {}): General => ({
|
||||
modifiers: {},
|
||||
meta: {},
|
||||
},
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
...overrides,
|
||||
});
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ const buildGeneral = (id: number, nationId: number, cityId: number): General =>
|
||||
modifiers: {},
|
||||
meta: {},
|
||||
},
|
||||
meta: {},
|
||||
meta: { killturn: 24 },
|
||||
});
|
||||
|
||||
describe('war aftermath', () => {
|
||||
|
||||
@@ -153,6 +153,7 @@ const buildGeneral = (strength: number): General => ({
|
||||
meta: {},
|
||||
},
|
||||
meta: {
|
||||
killturn: 24,
|
||||
dex1: 5000,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user