Exemplo n.º 1
0
        public void PayloadShouldCapAtZero()
        {
            var agressor = new Character("");
            var victim = new Character("");

            var payload = new DamagePayload(agressor);
            payload.Apply(victim);

            Assert.Equal(0, victim.CharacterStats[ (int) StatTypes.Hitpoints].CurrentValue);
        }
Exemplo n.º 2
0
        public void ApplyDamage(DamagePayload damagePayload)
        {
            // If we're already dead, don't bother
            if (!IsAlive)
                return;

            // Applies the actual damage to this character
            damagePayload.Apply(this);

            // If this died, tell any interested parties
            if (CharacterStats[(int)StatTypes.Hitpoints].CurrentValue <= 0)
            {
                CharacterStats[(int)StatTypes.Hitpoints].CurrentValue = 0;
                OnKilled(damagePayload.Aggressor, this);
            }
        }
Exemplo n.º 3
0
        public void ApplyDamage(DamagePayload damagePayload)
        {
            _lastCharacterToHitMe = damagePayload.Aggressor;

            // Applies the actual damage to this character
            damagePayload.Apply(this);

            // If this died, tell any interested parties
            if (CharacterStats[(int)StatTypes.Hitpoints].CurrentValue <= 0)
            {
                CharacterStats[(int)StatTypes.Hitpoints].CurrentValue = 0;
            }
        }