Exemplo n.º 1
0
        public void Unequip(Armor i)
        {
            if (i == null)
            {
                return;
            }
            Armortype key = null;

            //check if it even exists in the set
            foreach (KeyValuePair <Armortype, Armor> a in this.Armors)
            {
                if (a.Value == i)
                {
                    key = a.Key;
                    break;
                }
            }
            //then remove
            if (key != null)
            {
                i.unequip();
                Armors.Remove(key);
                foreach (DamageType d in DamageType.allDamageTypes())
                {
                    increaseDamageBlock(d, -i.getArmor(d));
                }
            }
        }
Exemplo n.º 2
0
        public void Equip(Armor a)
        {
            Unequip(Armors[a.getArmortype()]);

            this.Armors[a.getArmortype()] = a;
            a.equip();
            foreach (DamageType d in DamageType.allDamageTypes())
            {
                increaseDamageBlock(d, a.getArmor(d));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Checks if the Armorpiec is better  (has a higher total of Damagereduction) than the param
        /// </summary>
        public Boolean IsBetterThan(Armor a)
        {
            if (a == null)
            {
                return(true);
            }
            float sumThis  = 0;
            float sumOther = 0;

            foreach (DamageType d in DamageType.allDamageTypes())
            {
                sumThis  += this.getArmor(d);
                sumOther += a.getArmor(d);
            }
            return(sumThis > sumOther);
        }