Esempio n. 1
0
        public void CreateCharacterWithPrimaryStatsAndScaleArmorAndModifyArmorMeanwhile()
        {
            //primary
            var strenght      = new Stat("Strenght", 10f, 1f);
            var armorModified = new Armor("Armor", 3);
            var armorFlat     = new Armor("Armor", 3);

            ReferenceStatModifier m = new ReferenceStatModifier(strenght, 0.1f);

            armorModified.AddModifier(m);


            float dmgValue = 100.0f;
            var   result1  = armorFlat.ApplyArmor(dmgValue);


            var result2 = armorModified.ApplyArmor(dmgValue);


            Assert.IsTrue(result1 > result2);


            strenght.BaseValue += 10;

            var result3 = armorModified.ApplyArmor(dmgValue);

            Assert.IsTrue(result2 > result3);
        }
Esempio n. 2
0
        public void CreateArmorAndApplyItWithNegativeValues()
        {
            string Name   = "";
            float  Value  = -10.0f;
            float  dmgVal = 100;
            Armor  a      = new Armor(Name, Value);

            float reduced = a.ApplyArmor(dmgVal);

            Assert.IsTrue(reduced == (137.5f));
        }
Esempio n. 3
0
        public void CreateArmorAndApplyIt()
        {
            string Name   = "";
            float  Value  = 10.0f;
            float  dmgVal = 100;
            Armor  a      = new Armor(Name, Value);

            float reduced = a.ApplyArmor(dmgVal);

            Assert.IsTrue(a.Reduction == 0.375f);
            Assert.IsTrue(reduced == (62.5f));
        }
Esempio n. 4
0
        public void CreateCharacterWithPrimaryStatsAndInflictMagicDamage()
        {
            //primary
            var strenght     = new Stat("Strenght", 10f, 1f);
            var agility      = new Stat("Agility", 10f, 1f);
            var intelligence = new Stat("Intelligence", 10f, 1f);
            //derivative
            var health      = new DerivativeStat(strenght, 10);
            var mana        = new DerivativeStat(intelligence, 17);
            var armor       = new Armor("Armor", 3);
            var magicResist = new Armor("Magic Resist", 10, 0.02f);


            var   dmg = 25;
            float dmgReducedByArmor = magicResist.ApplyArmor(dmg);

            Assert.IsTrue(health.CurrentValue == 100);
            health.ModifyValue(dmgReducedByArmor * -1);
            Assert.AreEqual(health.CurrentValue, 100 - dmgReducedByArmor);
        }
Esempio n. 5
0
    // Dispara al enemigo en la primera posicion del array de deteccion;
    public void FireIntruder()
    {
        RaycastHit hitInfo;

        if (Physics.Raycast(firePoint.position, firePoint.transform.forward, out hitInfo, maxDistance, layer))
        {
            targetHp    = hitInfo.collider.GetComponent <Life>();
            targetArmor = hitInfo.collider.GetComponent <Armor>();
            if (targetHp.dead == false)
            {
                if (Time.time - shotTime > cadence)
                {
                    Instantiate(shotEffect, firePoint.transform.position, firePoint.transform.rotation);
                    targetArmor.ApplyArmor(damage);
                    shotTime = Time.time;
                }
            }
        }
        else
        {
            currentObjetive += 1;
        }
    }
Esempio n. 6
0
        public void CreateArmorAndApplyItWithNegativeValues()
        {
            string Name = "";
            float Value = -10.0f;
            float dmgVal = 100;
            Armor a = new Armor(Name, Value);

            float reduced = a.ApplyArmor(dmgVal);

            Assert.IsTrue(reduced == (137.5f));
        }
Esempio n. 7
0
        public void CreateArmorAndApplyIt()
        {
            string Name = "";
            float Value = 10.0f;
            float dmgVal = 100;
            Armor a = new Armor(Name, Value);

            float reduced = a.ApplyArmor(dmgVal);

            Assert.IsTrue(a.Reduction == 0.375f);
            Assert.IsTrue(reduced == (62.5f));
        }
Esempio n. 8
0
        public void CreateCharacterWithPrimaryStatsAndScaleArmorAndModifyArmorMeanwhile()
        {
            //primary
            var strenght = new Stat("Strenght", 10f, 1f);
            var armorModified = new Armor("Armor", 3);
            var armorFlat = new Armor("Armor", 3);

            ReferenceStatModifier m = new ReferenceStatModifier(strenght, 0.1f);
            armorModified.AddModifier(m);

            float dmgValue = 100.0f;
            var result1 = armorFlat.ApplyArmor(dmgValue);

            var result2 = armorModified.ApplyArmor(dmgValue);

            Assert.IsTrue(result1 > result2);

            strenght.BaseValue += 10;

            var result3 = armorModified.ApplyArmor(dmgValue);

            Assert.IsTrue(result2 > result3);
        }
Esempio n. 9
0
        public void CreateCharacterWithPrimaryStatsAndInflictPhysicDamage()
        {
            //primary
            var strenght = new Stat("Strenght", 10f, 1f);
            var agility = new Stat("Agility", 10f, 1f);
            var intelligence = new Stat("Intelligence", 10f, 1f);
            //derivative
            var health = new DerivativeStat(strenght, 10);
            var mana = new DerivativeStat(intelligence, 17);
            var armor = new Armor("Armor", 3);
            var magicResist = new Armor("Magic Resist", 10, 0.02f);

            var dmg = 25;
            float dmgReducedByArmor = armor.ApplyArmor(dmg);

            Assert.IsTrue(health.CurrentValue == 100);
            health.ModifyValue(dmgReducedByArmor * -1);
            Assert.AreEqual(health.CurrentValue, 100 - dmgReducedByArmor);
        }