public float GetTotalDamage(D3DamageType? type = null) { float total = 0.0f; foreach (SimulationSampleSet sampleSet in this.SampleSets) { foreach (D3DamageType damageType in sampleSet.DamageTotal.Keys) { if (type != null && damageType != type.Value) { continue; } total += sampleSet.DamageTotal[damageType]; } } return total; }
// ------------------------------------------------------------------- // Private // ------------------------------------------------------------------- private void InitializeDamageType(D3DamageType type) { // Only need to check one if (this.DamageTotal.ContainsKey(type)) { return; } this.DamageTotal.Add(type, 0); this.DamageMin.Add(type, float.MaxValue); this.DamageMax.Add(type, 0); this.DamageAverage.Add(type, 0); this.DamageCount.Add(type, 0); this.DamageNormal.Add(type, 0); this.DamageCrit.Add(type, 0); }
// Used in table writing public IList<float> GetDamageValues(D3DamageType damageType) { IList<float> results = new List<float>(); results.Add(this.DamageTotal.ContainsKey(damageType) ? this.DamageTotal[damageType] : 0f); results.Add(this.DamageMin.ContainsKey(damageType) ? this.DamageMin[damageType] : 0f); results.Add(this.DamageMax.ContainsKey(damageType) ? this.DamageMax[damageType] : 0f); results.Add(this.DamageAverage.ContainsKey(damageType) ? this.DamageAverage[damageType] : 0f); results.Add(this.DamageCount.ContainsKey(damageType) ? this.DamageCount[damageType] : 0f); results.Add(this.DamageNormal.ContainsKey(damageType) ? this.DamageNormal[damageType] : 0f); results.Add(this.DamageCrit.ContainsKey(damageType) ? this.DamageCrit[damageType] : 0f); return results; }
public float GetDPS(D3DamageType damageType, int seconds) { if (seconds <= 0) { return 0f; } float total = this.DamageTotal.ContainsKey(damageType) ? this.DamageTotal[damageType] : 0f; return total / seconds; }
public void AddDamage(D3DamageType type, float value, bool isCritical) { if (!this.damageTypes.Contains(type)) { this.damageTypes.Add(type); } if (isCritical) { this.AddStat(SimulationStat.Crit); } this.InitializeDamageType(type); this.DamageTotal[type] += value; if (this.DamageMin[type] > value) { this.DamageMin[type] = value; } if (this.DamageMax[type] < value) { this.DamageMax[type] = value; } this.DamageCount[type]++; this.DamageAverage[type] = this.DamageTotal[type] / this.DamageCount[type]; if (isCritical) { this.DamageCrit[type] += value; } else { this.DamageNormal[type] += value; } }