Ejemplo n.º 1
0
        // Body.DoEquip takes the best (highest value) result from BodyParts.DoEquip
        public EQUIP_RESULT DoEquip(ItemArmor itemToEquip)
        {
            if (Condition == BODY_PART_CONDITION.MISSING)
            {
                return(EQUIP_RESULT.BODY_PART_MISSING);
            }
            if (itemToEquip.Type != this.Type)
            {
                return(EQUIP_RESULT.NOT_EQUIPPABLE);
            }
            if (this.Item != null)
            {
                return(EQUIP_RESULT.ITEM_ALREADY_EQUIPPED);
            }

            this.Item = itemToEquip;
            return(EQUIP_RESULT.EQUIPPED);
        }
Ejemplo n.º 2
0
        public EQUIP_RESULT DoEquip(ItemArmor itemToEquip)
        {
            EQUIP_RESULT bestResult = EQUIP_RESULT.NOT_EQUIPPABLE;

            foreach (EntityBodyPart part in BodyParts)
            {
                EQUIP_RESULT currentResult = part.DoEquip(itemToEquip);

                if (currentResult == EQUIP_RESULT.EQUIPPED)
                {
                    _defensepower += itemToEquip.ArmorFactor;
                    return(currentResult);
                }
                else if (currentResult > bestResult)
                {
                    bestResult = currentResult;
                }
            }

            return(bestResult);
        }
Ejemplo n.º 3
0
        // result determines message to display

        public Handler DoEquip(EntityHand hand)
        {
            ItemArmor    armor      = hand.Item as ItemArmor;
            EQUIP_RESULT bestResult = EQUIP_RESULT.NOT_EQUIPPABLE;

            foreach (EntityBodyPart part in BodyParts)
            {
                EQUIP_RESULT currentResult = part.DoEquip(armor);

                if (currentResult == EQUIP_RESULT.EQUIPPED)
                {
                    _defensepower += armor.ArmorFactor;
                    hand.Item      = null;
                    return(Handler.HANDLED(Statics.ItemTypeToEquipMessage[armor.Type], armor.NameAsParagraph));
                }
                else if (currentResult > bestResult)
                {
                    bestResult = currentResult;
                }
            }

            return(Handler.HANDLED(Statics.EquipResultToMessage[bestResult]));
        }
 protected ItemArmor(ItemArmor template) : base(template) {
     ArmorFactor = template.ArmorFactor;
 }