Exemplo n.º 1
0
        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;
                }
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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;
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Damage. For live events only. Doesn't run on history events
 /// </summary>
 /// <param name="data"></param>
 virtual public void OnDamage(MissionLogEventDamage data)
 {
 }