private void _handleActorReadyEvent(IActor source) { // Decision should be either ACTOR_READY or RESOLVE_ACTION. BattleEvent decision = source.DecideAction(Time, Actors, Enemies); EventQueue.Add(decision); }
private void _handleEvent(BattleEvent e) { switch (e.Type) { // Actor-driven events. case BattleEventType.ACTOR_READY: _handleActorReadyEvent(e.Source); break; case BattleEventType.USE_ACTION: // Initiate the use of an action. // Generates: // Begin cast events // RESOLVE_ACTION // ACTOR_READY _handleUseActionEvent(e.Source, e.Target, e.Action); break; case BattleEventType.RESOLVE_ACTION: // Resolve the effects of an action. // Generates: // Damage/healing battle events // Cast battle events // ACTOR_READY // APPLY_AURA // APPLY_AURA_STACK // EXPIRE_AURA (?) // EXPIRE_AURA_STACK _handleResolveActionEvent(e.Source, e.Target, e.Action); break; case BattleEventType.APPLY_AURA: // Apply an aura to a target. // Generates: // Aura applied battle events // Aura refreshed battle events // EXPIRE_AURA // APPLY_AURA_STACK _handleApplyAuraEvent(e.Source, e.Target, e.BaseAura); break; case BattleEventType.APPLY_AURA_STACK: // Add a stack to an existing aura. // Generates: // Aura stack applied battle events. // Aura refreshed battle events. // EXPIRE_AURA _handleApplyAuraStackEvent(); break; case BattleEventType.EXPIRE_AURA: // Remove an aura from the target. // Generates: // Aura expired battle event. _handleExpireAuraEvent(e.Target, e.Aura); break; case BattleEventType.REMOVE_AURA_STACK: // Remove a stack from an existing aura. // Generates: // Aura stack removed battle event. _handleRemoveAuraStackEvent(); break; // Independent events. case BattleEventType.AURA_TICK: // Tick all auras on all targets. // Generates: // Damage/Healing battle events. // Refresh battle events. // AURA_TICK _handleAuraTickEvent(); break; case BattleEventType.REGEN_TICK: // Tick passive regeneration on all _players_. // Generates: // HP/MP/TP regeneration battle events. // REGEN_TICK _handleRegenTickEvent(); break; case BattleEventType.FIGHT_COMPLETE: // Cleanup; ignore all future events and report all // generated battle events. _handleFightCompleteEvent(); break; } }