Example #1
0
 public Armor(Armor a)
     : base(a)
 {
     this.aC = a.aC;
     this.shape = a.shape;
     this.covers = new List<string>();
     foreach(string s in a.covers)
         this.covers.Add(s);
 }
Example #2
0
 public void Remove(Armor a)
 {
     inventory.Add(a);
     wornArmor.Remove(a);
 }
Example #3
0
        public bool CanWear(Armor a)
        {
            if (!(a is Armor)) //If it's not armor
            {
                message.Add("That isn't armor.");
                return false;
            }

            if (a.shape != this.armorType) //If it's not the right shape for this creature
            {
                message.Add("That doesn't fit on your body.");
                return false;
            }

            foreach (BodyPart b in anatomy)
                foreach (string s in a.covers)
                {
                    foreach (Armor other in wornArmor)
                        foreach (string otherS in other.covers)
                        {
                            if (s == otherS) //If some piece of armor is already covering a part
                            {
                                message.Add("Your " + other.name + " is already covering your " + s + ".");
                                return false;
                            }
                        }
                    if (s == b.name) //If it fits on any body part
                        return true;
                }

            message.Add("That doesn't fit on any part of your body.");
            return false;
        }
Example #4
0
 public void Wear(Armor a)
 {
     wornArmor.Add(a);
     message.Add("You wear the " + a.name + ".");
     inventory.Remove(a);
 }
        void LoadArmor(XElement itemNode)
        {
            var aC = int.Parse(itemNode.Attribute("defence").Value);
            var name = (string)itemNode.Attribute("name");
            var color = ColorTranslator.FromHtml(itemNode.Attribute("color").Value);
            var fitting = itemNode.Attribute("fitting").Value;
            var newItem = new Armor(500f, 500f, aC, fitting, new List<Item>(), name, new List<string>(), color, new List<string>());
            newItem.componentList = GetComponentsInItem(itemNode);

            items.Add(newItem);
        }
Example #6
0
 public void Wear(Armor a)
 {
     wornArmor.Add(a);
     message.Add("You wear the " + a.name + ".");
     inventory.Remove(a);
 }
Example #7
0
        } //A regeneration and health check cycle

        public void Remove(Armor a)
        {
            inventory.Add(a);
            wornArmor.Remove(a);
        }