(PlayerCharacter theCharacter, EquipNode node, Equipment item)
| 659 | } |
| 660 | |
| 661 | public boolean canEquip(PlayerCharacter theCharacter, EquipNode node, |
| 662 | Equipment item) |
| 663 | { |
| 664 | // Check for a required location (i.e. you can't carry a natural weapon) |
| 665 | EquipNode requiredLoc = getNatWeaponLoc(theCharacter, item); |
| 666 | if (requiredLoc != null) |
| 667 | { |
| 668 | return validLocationForNaturalWeapon(node, item, requiredLoc); |
| 669 | } |
| 670 | |
| 671 | // Is this a container? Then check if the object can fit in |
| 672 | if (node.getNodeType() == EquipNode.NodeType.EQUIPMENT) |
| 673 | { |
| 674 | EquipmentFacade parent = node.getEquipment(); |
| 675 | if ((parent instanceof Equipment) && ((Equipment) parent).isContainer()) |
| 676 | { |
| 677 | // Check if it fits |
| 678 | if (((Equipment) parent).canContain(theCharacter, item) == 1) |
| 679 | { |
| 680 | return true; |
| 681 | } |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | if (node.getNodeType() == EquipNode.NodeType.PHANTOM_SLOT) |
| 686 | { |
| 687 | // Check first for an already full or taken slot |
| 688 | if (!getNodeList().containsElement(node)) |
| 689 | { |
| 690 | return false; |
| 691 | } |
| 692 | EquipSlot slot = node.getSlot(); |
| 693 | if (slot.canContainType(item.getType())) |
| 694 | { |
| 695 | if (item.isWeapon()) |
| 696 | { |
| 697 | final String slotName = slot.getSlotName(); |
| 698 | |
| 699 | if (item.isUnarmed() && slotName.equals(Constants.EQUIP_LOCATION_UNARMED)) |
| 700 | { |
| 701 | return true; |
| 702 | } |
| 703 | if (item.isShield() && slotName.equals(Constants.EQUIP_LOCATION_SHIELD)) |
| 704 | { |
| 705 | return true; |
| 706 | } |
| 707 | |
| 708 | // If it is outsized, they can't equip it to a weapon slot |
| 709 | if (item.isWeaponOutsizedForPC(theCharacter)) |
| 710 | { |
| 711 | return false; |
| 712 | } |
| 713 | |
| 714 | if (slotName.startsWith(Constants.EQUIP_LOCATION_BOTH)) |
| 715 | { |
| 716 | return true; |
| 717 | } |
| 718 | if (item.isMelee() && item.isDouble() && slotName.equals(Constants.EQUIP_LOCATION_DOUBLE)) |
nothing calls this directly
no test coverage detected