Exemplo n.º 1
0
        public void Damage(Player attacker, float damage, string cause)
        {
            if (LastDamage == null)
            {
                LastDamage = new PlayerDamage(attacker, this, damage, cause);
            }
            else
            {
                LastDamage = new PlayerDamage(LastDamage, attacker, this, damage, cause);
            }

            Health -= damage;
            OnDamaged(damage);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructs a player damage object where the previous
        /// player damage can receive assistant credit.
        /// </summary>
        public PlayerDamage(PlayerDamage previous, Player attacker, Player attacked,
                            float damage, string cause)
        {
            Attacker = attacker;
            if (attacker != previous.Attacker)
            {
                AttackerAssistant  = previous.Attacker;
                AttackerAssistedAt = previous.DamagedAt;
            }
            else if (previous.AttackerAssistant != null)
            {
                AttackerAssistant  = previous.AttackerAssistant;
                AttackerAssistedAt = previous.AttackerAssistedAt;
            }
            Attacked = attacked;
            Damage   = damage;
            Cause    = cause;

            DamagedAt = Environment.TickCount;
        }