public void AddDamage(object source, MissionLogEventDamage e) { if (source == null || e.Damage <= 0) { return; } if (source is GameObject sourceGo) { var existing = this.HitsSources.FirstOrDefault(hs => hs?.Hits != null && hs.Object != null && hs.Object.Id == sourceGo.Id ); if (existing != null) { existing.Hits.Damage += e.Damage; } } else if (source is Player player) { var existing = this.HitsSources.FirstOrDefault(hs => hs?.Hits != null && hs.Player != null && hs.Player.Id == player.Id ); if (existing != null) { existing.Hits.Damage += e.Damage; } } }
public void AddDamage(MissionLogEventDamage e) { if (e == null) { return; } if (e.TargetObject != null) { e.TargetObject.AddDamage((object)e.AttackerPlayer ?? e.AttackerObject, e); } else if (e.TargetPlayer != null) { e.TargetPlayer.AddDamage((object)e.AttackerPlayer ?? e.AttackerObject, e); } }
public void AddDamage(object source, MissionLogEventDamage e) { if (source == null || e.Damage <= 0) { return; } if (source is GameObject) { var existing = HitsSources.FirstOrDefault(o => o != null && o.Hits != null && o.Object != null && o.Object.Id == (source as GameObject).Id ); if (existing != null) { existing.Hits.Damage += e.Damage; } } else if (source is Player) { var existing = HitsSources.FirstOrDefault(o => o != null && o.Hits != null && o.Player != null && o.Player.Id == (source as Player).Id ); if (existing != null) { existing.Hits.Damage += e.Damage; } } }
/// <summary> /// Damage. For live events only. Doesn't run on history events /// </summary> /// <param name="data"></param> virtual public void OnDamage(MissionLogEventDamage data) { }