Exemple #1
0
 public Armor() : base("", "", 0, 0)
 {
     AR            = 0.0;
     Qualities     = new string[] { };
     Location      = ArmorLocations.MAX;
     _isEquippable = true;
 }
Exemple #2
0
 public Armor(string name, double ar, int encumbrance, int price, ArmorLocations location, string[] qualities) :
     base(name, "", encumbrance, price)
 {
     AR            = ar;
     Qualities     = qualities;
     Location      = location;
     _isEquippable = true;
     _equipSlots   = new List <string> {
         location.ToString()
     };
 }
Exemple #3
0
        public Armor GetArmorPiece(ArmorLocations location)
        {
            Armor result = new Armor();

            for (int i = 0; i < _armorPieces.Count; i++)
            {
                if (_armorPieces[i].Location == location)
                {
                    result = _armorPieces[i];
                    break;
                }
            }
            return(result);
        }
        /// <summary>
        /// Calculate the total damage received to a particular location.
        /// </summary>
        private void updateDamage()
        {
            ArmorLocations location = (ArmorLocations)hitLocationCb.SelectedIndex;

            if (int.TryParse(receivedDamageTb.Text, out int damage) &&
                int.TryParse(receivedPenTb.Text, out int pen) &&
                _activeCharacter != null)
            {
                Armor  selectedPiece   = _activeCharacter.GetArmorPiece(location);
                double armorMitigation = (selectedPiece != null) ? selectedPiece.AR : 0;
                armorMitigation = Math.Max(armorMitigation - pen, 0);                 // Pen reduces armorMitigation to a lower limit of zero.
                damage          = Math.Max(damage - (int)armorMitigation, 0);         // armorMitigation then reduces received damage to a lower limit of zero.

                finalDamageReceivedTb.Text = damage.ToString();
            }
        }
Exemple #5
0
 public Armor(Guid id, string name, string namePlural, int value, ArmorLocations location, int minimumLevelToUse = 0, int maximumStackSize = 0)
     : base(id, name, namePlural, value, minimumLevelToUse, maximumStackSize)
 {
     ArmorLocation = location;
 }
Exemple #6
0
 public Armor(Guid id, string name, string namePlural, int value, ArmorLocations location, int minimumLevelToUse = 0, int maximumStackSize = 0)
     : base(id, name, namePlural, value, minimumLevelToUse, maximumStackSize)
 {
     ArmorLocation = location;
 }