3.6 KiB
3.6 KiB
Ability System Review (Dungeon)
Scope
- Files reviewed:
Game/Dungeon/MobAI.cs,Game/Dungeon/DungeonSimulation.cs,Game/Dungeon/DungeonHandler.cs,Game/Dungeon/DungeonHandlerAdmin.cs. - Goal: document what works, what is missing, and the plan for per-ability animation binding when assigning abilities to mobs.
How It Currently Works
- Mob definitions and ability assignments are loaded into cache in
DungeonHandler(RefreshMobCacheAsync). - When a dungeon simulation is created, each spawned mob gets runtime
MobAbilityStateentries fromMobAbilityAssignment. - During ticks, mobs in
MobState.AttackingcallProcessMobAbility. ProcessMobAbilityselects highest-priority available ability and routes to the implementation byMobAbilityType.- Ability visuals are emitted as
AbilityEventand now sent to clients in dungeon state packets (events.abilities).
Ability Type Coverage
Implemented in DungeonSimulation.ProcessMobAbility
MeleeAttackCleaveProjectileSingleProjectileAoeGroundAoeConeAttackSummonSingleSummonBulkPoisonBleedBurnStunSlowRootFearKnockbackPullHazardZone
Declared in enum but not executed in ProcessMobAbility
HealSelfHealAllyHealAoeSilence(status builder exists, but switch does not route this type)BuffSelfBuffAlliesDebuffEnrageShieldChargeTeleportRetreatPhaseChange
Known Gaps / Risks
- Healer AI can enter
MobState.Healing, but ability execution currently only runs when state isMobState.Attacking. Targetingmetadata on ability definitions is currently not used in runtime targeting logic.- Player ability-cast pipeline is not present in dungeon simulation right now (player flow is basic attack), so player-ability mana enforcement is pending until player ability execution exists.
Bonelord / Summon Issue Notes
- Root cause for disappearing admin-spawned boss after cast: runtime mob ID collision risk between admin-spawned IDs and summoned IDs.
- Fix approach implemented: centralized runtime ID allocation for both admin spawns and summons.
Plan: Ability Animation Binding on Mob Ability Assignment
- Add optional mapping from
MobAbilityAssignmentto animation key. - Resolve animation key for each runtime ability at load:
- mapping override if present
- else ability definition animation
- else
attack
- Support directional placeholders (
[dir]/{dir}) at cast time. - Emit resolved animation key in ability events.
- Admin UX: when assigning ability, optionally choose animation key from assigned mob animations.
- Show assigned/resolved animation in mob ability table for transparency.
Implementation Checklist
- Load
mob_ability_animation_mappingsinto dungeon mob cache. - Pass ability-animation mappings into all
DungeonSimulationconstructors. - Resolve mapped animation key into runtime
MobAbilityState. - Support
[dir]/{dir}replacement when emitting ability animation key. - Include ability events in outbound dungeon state payload (
events.abilities). - Enforce mob ability mana costs before casting.
- Add admin UI support to select optional animation key when assigning a mob ability.
- Display ability animation (and override marker) in mob ability list.
- Remove ability-animation mappings when removing an ability assignment.
- Fix runtime mob ID allocation so admin spawns and summons cannot collide.
- Enforce mana for player-cast abilities once player ability casting exists in dungeon runtime.