예제 #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);
        }
예제 #2
0
    void OnEquipmentChanged(Equipment newItem, Equipment oldItem)
    {
        if (newItem != null)
        {
            Armor.AddModifier(newItem.ArmorModifier);
            Damage.AddModifier(newItem.DamageModifier);
        }

        if (oldItem != null)
        {
            Armor.RemoveModifier(oldItem.ArmorModifier);
            Damage.RemoveModifier(oldItem.DamageModifier);
        }
    }
예제 #3
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);
        }