View: Multi-Page Single Page

Helpers

Multi-target overloads, query methods, battle history, and utility features.

Multi-Target Overloads

DealDamage, Heal, ApplyStatus, and ApplyBuff all have overloads that accept IList<ICombatant> instead of a single target. Each individual action still fires its own event. Additionally, a group event fires with aggregated data.

  • OnGroupDamageDealt(GroupDamageEvent) — contains Source, list of Hits (IReadOnlyList<DamageEvent>), TotalDamage
  • OnGroupHealed(GroupHealEvent) — contains Source, list of Heals (IReadOnlyList<HealEvent>), TotalHealed
  • OnGroupStatusApplied(GroupStatusEvent) — contains Source, list of Applications
  • OnGroupBuffApplied(GroupBuffEvent) — contains Source, list of Applications
var enemies = battle.GetEnemies(actor);
battle.DealDamage(actor, enemies, 50, "magic", "Fire");
// Fires OnDamageDealt for EACH enemy, then OnGroupDamageDealt once

Query Helpers

GetEnemies(combatant) returns all alive combatants NOT on the same team. GetAllies(combatant, includeSelf) returns alive combatants on the same team. GetAlive(team) and GetDead(team) filter by team (-1 for all).

var enemies = battle.GetEnemies(hero);     // All alive enemies
var allies = battle.GetAllies(hero, true);  // All alive allies including hero
var dead = battle.GetDead(0);               // Dead party members (team 0)

Battle History

Battle records every event as a BattleHistoryEntry with Sequence number, TurnNumber, EventType string, and the Event object. Access via battle.History (IReadOnlyList<BattleHistoryEntry>).

foreach (var entry in battle.History)
    Debug.Log($"[Turn {entry.TurnNumber}] {entry.EventType}: {entry.Event}");

RemoveCombatant

Removes a combatant from battle entirely (not just KO). Fires OnCombatantRemoved. Useful for flee-per-combatant or banish mechanics.

battle.RemoveCombatant(summon); // Completely removes from battle

BattleResult

Created when battle ends via EndBattle() or CheckBattleEnd(). Contains Outcome (BattleState), TotalTurns, Survivors (list of alive combatants), and full History. Access via battle.Result.

battle.OnBattleEnd += (b, state) =>
{
    var result = b.Result;
    Debug.Log($"Outcome: {result.Value.Outcome}");
    Debug.Log($"Turns: {result.Value.TotalTurns}");
    Debug.Log($"Survivors: {result.Value.Survivors.Count}");
};
↓ ↑