(PCStat stat, boolean useTemp, boolean useEquip)
| 740 | } |
| 741 | |
| 742 | public int getPartialStatBonusFor(PCStat stat, boolean useTemp, boolean useEquip) |
| 743 | { |
| 744 | String statAbbr = stat.getKeyName(); |
| 745 | final String prefix = "STAT." + statAbbr; |
| 746 | Map<String, String> bonusMap = new HashMap<>(); |
| 747 | Map<String, String> nonStackMap = new ConcurrentHashMap<>(); |
| 748 | Map<String, String> stackMap = new ConcurrentHashMap<>(); |
| 749 | |
| 750 | for (BonusObj bonus : getActiveBonusList()) |
| 751 | { |
| 752 | if (pc.isApplied(bonus) && bonus.getBonusName().equals("STAT")) |
| 753 | { |
| 754 | boolean found = false; |
| 755 | Object co = getSourceObject(bonus); |
| 756 | for (Object element : bonus.getBonusInfoList()) |
| 757 | { |
| 758 | if (element instanceof PCStat && element.equals(stat)) |
| 759 | { |
| 760 | found = true; |
| 761 | break; |
| 762 | } |
| 763 | // TODO: This should be put into a proper object when |
| 764 | // parisng. |
| 765 | if (element instanceof MissingObject) |
| 766 | { |
| 767 | String name = ((MissingObject) element).getObjectName(); |
| 768 | if (("%LIST".equals(name) || "LIST".equals(name)) && co instanceof CDOMObject creator) |
| 769 | { |
| 770 | for (String assoc : pc.getConsolidatedAssociationList(creator)) |
| 771 | { |
| 772 | //TODO Case sensitivity? |
| 773 | if (assoc.contains(statAbbr)) |
| 774 | { |
| 775 | found = true; |
| 776 | break; |
| 777 | } |
| 778 | } |
| 779 | } |
| 780 | } |
| 781 | } |
| 782 | if (!found) |
| 783 | { |
| 784 | continue; |
| 785 | } |
| 786 | |
| 787 | // The bonus has been applied to the target stat |
| 788 | // Should it be included? |
| 789 | boolean addIt; |
| 790 | if (co instanceof Equipment || co instanceof EquipmentModifier) |
| 791 | { |
| 792 | addIt = useEquip; |
| 793 | } |
| 794 | else if (co instanceof Ability) |
| 795 | { |
| 796 | List<String> types = ((Ability) co).getTypes(); |
| 797 | if (types.contains("Equipment")) |
| 798 | { |
| 799 | addIt = useEquip; |
no test coverage detected