feat(items): add new item modules and enhance item functionality
- Introduced various item modules including '흑색마', '사륜거', '단궁', '동호비궁', '도기', '변도론', '전론', and '환약'. - Implemented stat item modules to enhance general and war action contexts. - Added triggers for item healing and sniping actions during battles. - Enhanced item management with new utility functions for inventory handling. - Updated the item registry and loader to support new items and their functionalities. - Improved the overall structure of item-related code for better maintainability and scalability.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { GeneralActionModule } from '@sammo-ts/logic/triggers/general-action.js';
|
||||
import type { WarActionModule } from '@sammo-ts/logic/war/actions.js';
|
||||
|
||||
export interface TurnCommandEnv {
|
||||
develCost: number;
|
||||
@@ -24,4 +25,5 @@ export interface TurnCommandEnv {
|
||||
baseRice: number;
|
||||
maxResourceActionAmount: number;
|
||||
generalActionModules?: Array<GeneralActionModule>;
|
||||
warActionModules?: Array<WarActionModule>;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import type {
|
||||
} from '@sammo-ts/logic/war/types.js';
|
||||
import { resolveWarAftermath } from '@sammo-ts/logic/war/aftermath.js';
|
||||
import { resolveWarBattle } from '@sammo-ts/logic/war/engine.js';
|
||||
import type { WarActionModule } from '@sammo-ts/logic/war/actions.js';
|
||||
import {
|
||||
increaseMetaNumber,
|
||||
simpleSerialize,
|
||||
@@ -268,6 +269,11 @@ export class ActionDefinition<
|
||||
> {
|
||||
public readonly key = 'che_출병';
|
||||
public readonly name = ACTION_NAME;
|
||||
private readonly warModules: Array<WarActionModule<TriggerState>>;
|
||||
|
||||
constructor(modules: Array<WarActionModule<TriggerState> | null | undefined> = []) {
|
||||
this.warModules = modules.filter(Boolean) as Array<WarActionModule<TriggerState>>;
|
||||
}
|
||||
|
||||
parseArgs(raw: unknown): DispatchArgs | null {
|
||||
const data = raw as { destCityId?: unknown };
|
||||
@@ -439,11 +445,13 @@ export class ActionDefinition<
|
||||
general: context.general,
|
||||
city: attackerCity,
|
||||
nation: attackerNation,
|
||||
modules: this.warModules,
|
||||
},
|
||||
defenders: defenderGenerals.map((general) => ({
|
||||
general,
|
||||
city: defenderCity,
|
||||
nation: defenderNation,
|
||||
modules: this.warModules,
|
||||
})),
|
||||
defenderCity,
|
||||
defenderNation,
|
||||
@@ -580,5 +588,6 @@ export const commandSpec: GeneralTurnCommandSpec = {
|
||||
category: '군사',
|
||||
reqArg: true,
|
||||
args: { destCityId: 0 },
|
||||
createDefinition: (_env: TurnCommandEnv) => new ActionDefinition(),
|
||||
createDefinition: (env: TurnCommandEnv) =>
|
||||
new ActionDefinition(env.warActionModules ?? []),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user