feat: add new general actions for border return, gifting, disbanding, founding nations, and fierce training
- Implemented '접경귀환' action for returning to a home city within 3 spaces. - Added '증여' action for transferring resources between generals with constraints. - Created '해산' action to disband a faction, resetting generals and cities. - Developed '건국' action for founding a new nation with specified attributes. - Introduced '맹훈련' action for training generals, enhancing their stats. - Added tests for the new actions to ensure functionality and constraints are respected.
This commit is contained in:
@@ -11,6 +11,14 @@ export const resolveConstraintEnv = (
|
||||
): ConstraintEnv => {
|
||||
const startYear = typeof scenarioMeta?.startYear === 'number' ? scenarioMeta.startYear : undefined;
|
||||
const relYear = typeof startYear === 'number' ? world.currentYear - startYear : undefined;
|
||||
const worldMeta = world.meta as Record<string, unknown>;
|
||||
const rawKillturn = worldMeta.killturn;
|
||||
const killturn =
|
||||
typeof rawKillturn === 'number'
|
||||
? rawKillturn
|
||||
: typeof rawKillturn === 'string'
|
||||
? Number(rawKillturn)
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
currentYear: world.currentYear,
|
||||
@@ -21,5 +29,6 @@ export const resolveConstraintEnv = (
|
||||
relYear,
|
||||
openingPartYear: env.openingPartYear,
|
||||
minAvailableRecruitPop: env.minAvailableRecruitPop,
|
||||
...(Number.isFinite(killturn) ? { killturn } : {}),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -136,6 +136,20 @@ export const buildReservedTurnDefinitions = async (options: {
|
||||
nation: Map<string, GeneralActionDefinition>;
|
||||
}> => {
|
||||
const itemModules = await loadItemModules([...ITEM_KEYS]);
|
||||
options.env.itemCatalog = Object.fromEntries(
|
||||
itemModules.map((item) => [
|
||||
item.key,
|
||||
{
|
||||
slot: item.slot,
|
||||
name: item.name,
|
||||
rawName: item.rawName,
|
||||
cost: item.cost,
|
||||
reqSecu: item.reqSecu,
|
||||
buyable: item.buyable,
|
||||
unique: item.unique,
|
||||
},
|
||||
])
|
||||
);
|
||||
const itemRegistry = createItemModuleRegistry(itemModules);
|
||||
const itemActionModules = createItemActionModules(itemRegistry);
|
||||
const inheritBuffModules = createInheritBuffModules();
|
||||
|
||||
@@ -64,6 +64,13 @@ const resolveConstraintEnv = (
|
||||
const relYear = typeof startYear === 'number' ? world.currentYear - startYear : undefined;
|
||||
const joinModeRaw = worldMeta.join_mode ?? worldMeta.joinMode;
|
||||
const joinMode = joinModeRaw === 'onlyRandom' ? 'onlyRandom' : 'full';
|
||||
const killturnRaw = worldMeta.killturn;
|
||||
const killturn =
|
||||
typeof killturnRaw === 'number'
|
||||
? killturnRaw
|
||||
: typeof killturnRaw === 'string'
|
||||
? Number(killturnRaw)
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
...env,
|
||||
@@ -76,6 +83,7 @@ const resolveConstraintEnv = (
|
||||
openingPartYear: env.openingPartYear,
|
||||
minAvailableRecruitPop: env.minAvailableRecruitPop,
|
||||
join_mode: joinMode,
|
||||
...(Number.isFinite(killturn) ? { killturn } : {}),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user