private void CalculateEZImpedance(List<Impedance> imps, int maxPlayers, string name, out Impedance toAdd) { float duration = 20 * 60 * 1000, freq = 20 * 60, chance = 1f; Dictionary<bool, int> BreakCounts = new Dictionary<bool, int>() { { false, 0 }, { true, 0 }, }; Dictionary<PLAYER_ROLES, int> ARCounts = new Dictionary<PLAYER_ROLES, int>() { { PLAYER_ROLES.MainTank, 0 }, { PLAYER_ROLES.OffTank, 0 }, { PLAYER_ROLES.TertiaryTank, 0 }, { PLAYER_ROLES.MeleeDPS, 0 }, { PLAYER_ROLES.RangedDPS, 0 }, { PLAYER_ROLES.RaidHealer, 0 }, { PLAYER_ROLES.MainTankHealer, 0 }, { PLAYER_ROLES.OffAndTertTankHealer, 0 }, }; // foreach (Impedance t in imps) { duration = Math.Min(duration, t.Duration); freq = Math.Min(freq, t.Frequency); chance = Math.Min(chance, t.Chance); BreakCounts[t.Breakable]++; for (int i = 0; i < (int)PLAYER_ROLES.RaidHealer; i++) { if (t.AffectsRole[(PLAYER_ROLES)i]) { ARCounts[(PLAYER_ROLES)i]++; } } } // bool snb = false; foreach (bool nb in BreakCounts.Keys) { if (BreakCounts[nb] > BreakCounts[snb]) { snb = nb; } if (BreakCounts[snb] == BreakCounts[false]) { snb = false; } } toAdd = new Impedance { Name = name, Duration = duration, Frequency = freq, Chance = chance, Breakable = snb, }; foreach (PLAYER_ROLES pr in ARCounts.Keys) { toAdd.AffectsRole[pr] = ((float)ARCounts[pr] / (float)imps.Count) > 0.25f; // at least 25% of the affected roles matched } }
private void CalculateAvgImpedance(List<Impedance> imps, float fightDur, int maxPlayers, string name, out Impedance toAdd) { float duration = 0, freq = 0, chance = 0, phaseUptime = 0; Dictionary<bool, int> BreakCounts = new Dictionary<bool, int>() { { false, 0 }, { true, 0 }, }; Dictionary<PLAYER_ROLES, int> ARCounts = new Dictionary<PLAYER_ROLES, int>() { { PLAYER_ROLES.MainTank, 0 }, { PLAYER_ROLES.OffTank, 0 }, { PLAYER_ROLES.TertiaryTank, 0 }, { PLAYER_ROLES.MeleeDPS, 0 }, { PLAYER_ROLES.RangedDPS, 0 }, { PLAYER_ROLES.RaidHealer, 0 }, { PLAYER_ROLES.MainTankHealer, 0 }, { PLAYER_ROLES.OffAndTertTankHealer, 0 }, }; // foreach (Impedance t in imps) { duration += t.Duration; freq += t.Frequency; chance += t.Chance; phaseUptime += t.FightUptimePercent; BreakCounts[t.Breakable]++; for (int i = 0; i < (int)PLAYER_ROLES.RaidHealer; i++) { if (t.AffectsRole[(PLAYER_ROLES)i]) { ARCounts[(PLAYER_ROLES)i]++; } } } // duration /= (float)imps.Count; freq /= (float)imps.Count; chance /= (float)imps.Count; phaseUptime /= (float)imps.Count; // bool snb = false; foreach (bool nb in BreakCounts.Keys) { if (BreakCounts[nb] > BreakCounts[snb]) { snb = nb; } if (BreakCounts[snb] == BreakCounts[false]) { snb = false; } } toAdd = new Impedance { Name = name, Duration = duration, Frequency = freq, Chance = chance, Breakable = snb, FightDuration = fightDur, }; toAdd.PhaseTimes[1] = new float[] { 0, fightDur * phaseUptime }; foreach (PLAYER_ROLES pr in ARCounts.Keys) { toAdd.AffectsRole[pr] = ((float)ARCounts[pr] / (float)imps.Count) > 0.25f; // at least 25% of the affected roles matched } }
public Impedance(Impedance i) { Impedance clone = (Impedance)i.MemberwiseClone(); Frequency = clone.Frequency; Duration = clone.Duration; Chance = clone.Chance; Breakable = clone.Breakable; }