3.0 KiB
3.0 KiB
Legacy Items, Traits, and Action Modules
This document summarizes the legacy action modules that supply modifiers and
triggers: items, specials, personalities, nation types, crew types, and
scenario effects. Primary references include legacy/hwe/sammo/iAction.php,
legacy/hwe/sammo/BaseItem.php, legacy/hwe/sammo/BaseSpecial.php,
and legacy/hwe/sammo/Action*/ directories.
Core Concept: iAction
All traits/items/effects implement iAction and are merged by
General::getActionList() (see docs/architecture/legacy-engine-general.md).
They can:
- Modify stats and command calculations (
onCalcStat,onCalcDomestic, etc.). - Provide triggers (
getPreTurnExecuteTriggerList, battle init/phase triggers). - Apply ad-hoc effects (
onArbitraryAction).
DefaultAction provides no-op implementations for all hooks.
Item System
- Base class:
BaseItemimplementsiActionand exposes:getCost(),isConsumable(),isBuyable(),getReqSecu().
- Stat items inherit
BaseStatItemand apply a fixed stat bonus inonCalcStat()based on class name tokens. - Item instances live on the general (
General::getItem()); items can also insert battle triggers (seeActionItem/).
Items are configured via GameConst::$allItems and scenario overrides.
Specials (Domestic / War)
- Base class:
BaseSpecial(implementsiAction). ActionSpecialDomestic/*modifies domestic outcomes (onCalcDomestic), e.g., cost/success/score adjustments.ActionSpecialWar/*injects battle triggers or stat modifiers.- Weighting and eligibility are managed by
SpecialityHelper:- Uses
selectWeight+ stat/arm constraints to choose specials. - Deterministic RNG affects special selection for NPCs or resets.
- Uses
Personalities
- Stored in
ActionPersonality/*and also implementiAction. - Typically adjust core stats or apply small domestic bonuses.
Nation Types
ActionNationType/*extendsBaseNation.- Provide global modifiers to income and domestic outcomes.
- Injected per-nation via
buildNationTypeClass().
Crew Types (Units as Actions)
ActionCrewType/*defines per-crewiActionadditions.- Crew types can alter battle order, apply triggers, or modify war stats.
- For example,
che_성벽선제forces city battle order to a high value.
Scenario Effects
ActionScenarioEffect/*provides scenario-wide modifiers (e.g., attacker advantage, trigger overrides).- Bound to
GameConst::$scenarioEffectduring scenario build.
Interaction with Triggers
Action modules often construct trigger callers:
- Items and war specials can return
WarUnitTriggerCallerwithBaseWarUnitTrigger. - Some item triggers use
raiseTypeto allow coexistence with non-item versions.
See docs/architecture/legacy-engine-triggers.md for trigger execution rules.
Open Questions / Follow-ups
- The precise selection rules for personalities and specials depend on
SpecialityHelperRNG thresholds and scenario overrides; capture those when documenting specific rule packs.