internal static string GetName(Guid id, Encounter enc, bool detailed) { CombatData combatDatum = enc.FindCombatData(id); if (combatDatum != null) { if (detailed) { return(combatDatum.DisplayName); } EncounterSlot encounterSlot = enc.FindSlot(combatDatum); if (encounterSlot != null) { ICreature creature = Session.FindCreature(encounterSlot.Card.CreatureID, SearchType.Global); if (creature != null && creature.Category != "") { return(creature.Category); } } } Hero hero = Session.Project.FindHero(id); if (hero != null) { return(hero.Name); } Trap trap = enc.FindTrap(id); if (trap == null) { return("Creature"); } return(trap.Name); }
private static List <Guid> get_allies(Guid id, Encounter enc) { List <Guid> guids = new List <Guid>(); if (Session.Project.FindHero(id) == null) { CombatData combatDatum = enc.FindCombatData(id); if (combatDatum != null) { EncounterSlot encounterSlot = enc.FindSlot(combatDatum); if (encounterSlot != null) { foreach (EncounterSlot slot in enc.Slots) { if (slot.Type != encounterSlot.Type) { continue; } foreach (CombatData combatDatum1 in slot.CombatData) { guids.Add(combatDatum1.ID); } } if (encounterSlot.Type == EncounterSlotType.Ally) { foreach (Hero hero in Session.Project.Heroes) { guids.Add(hero.ID); } } } } } else { foreach (Hero hero1 in Session.Project.Heroes) { guids.Add(hero1.ID); } foreach (EncounterSlot slot1 in enc.Slots) { if (slot1.Type != EncounterSlotType.Ally) { continue; } foreach (CombatData combatDatum2 in slot1.CombatData) { guids.Add(combatDatum2.ID); } } } return(guids); }
public ReportTable CreateTable(ReportType report_type, BreakdownType breakdown_type, Encounter enc) { ReportTable reportTable = new ReportTable() { ReportType = report_type, BreakdownType = breakdown_type }; List <Pair <string, List <Guid> > > pairs = new List <Pair <string, List <Guid> > >(); switch (breakdown_type) { case BreakdownType.Individual: { List <Guid> .Enumerator enumerator = this.Combatants.GetEnumerator(); try { while (enumerator.MoveNext()) { Guid current = enumerator.Current; List <Guid> guids = new List <Guid>() { current }; pairs.Add(new Pair <string, List <Guid> >(enc.WhoIs(current), guids)); } break; } finally { ((IDisposable)enumerator).Dispose(); } } case BreakdownType.Controller: { List <Guid> guids1 = new List <Guid>(); foreach (Guid combatant in this.Combatants) { if (Session.Project.FindHero(combatant) == null) { guids1.Add(combatant); } else { List <Guid> guids2 = new List <Guid>() { combatant }; pairs.Add(new Pair <string, List <Guid> >(enc.WhoIs(combatant), guids2)); } } pairs.Add(new Pair <string, List <Guid> >("DM", guids1)); break; } case BreakdownType.Faction: { List <Guid> guids3 = new List <Guid>(); List <Guid> guids4 = new List <Guid>(); List <Guid> guids5 = new List <Guid>(); List <Guid> guids6 = new List <Guid>(); foreach (Guid guid in this.Combatants) { if (Session.Project.FindHero(guid) == null) { switch (enc.FindSlot(enc.FindCombatData(guid)).Type) { case EncounterSlotType.Opponent: { guids6.Add(guid); continue; } case EncounterSlotType.Ally: { guids4.Add(guid); continue; } case EncounterSlotType.Neutral: { guids5.Add(guid); continue; } default: { continue; } } } else { guids3.Add(guid); } } pairs.Add(new Pair <string, List <Guid> >("PCs", guids3)); pairs.Add(new Pair <string, List <Guid> >("Allies", guids4)); pairs.Add(new Pair <string, List <Guid> >("Neutral", guids5)); pairs.Add(new Pair <string, List <Guid> >("Enemies", guids6)); break; } } foreach (Pair <string, List <Guid> > pair in pairs) { if (pair.Second.Count == 0) { continue; } ReportRow reportRow = new ReportRow() { Heading = pair.First }; if (pair.Second.Count == 1) { reportRow.CombatantID = pair.Second[0]; } for (int i = 1; i <= this.fRounds.Count; i++) { switch (report_type) { case ReportType.Time: { int num = 0; foreach (Guid second in pair.Second) { num += this.Time(second, i); } reportRow.Values.Add(num); break; } case ReportType.DamageToEnemies: { int num1 = 0; foreach (Guid second1 in pair.Second) { num1 += this.Damage(second1, i, false, enc); } reportRow.Values.Add(num1); break; } case ReportType.DamageToAllies: { int num2 = 0; foreach (Guid guid1 in pair.Second) { num2 += this.Damage(guid1, i, true, enc); } reportRow.Values.Add(num2); break; } case ReportType.Movement: { int num3 = 0; foreach (Guid second2 in pair.Second) { num3 += this.Movement(second2, i); } reportRow.Values.Add(num3); break; } } } reportTable.Rows.Add(reportRow); } reportTable.Rows.Sort(); switch (reportTable.ReportType) { case ReportType.Time: case ReportType.DamageToAllies: { reportTable.Rows.Reverse(); return(reportTable); } case ReportType.DamageToEnemies: { return(reportTable); } default: { return(reportTable); } } }