@param fullyQualifiedBonusType @return Total bonus for prefix from the activeBonus HashMap
(String fullyQualifiedBonusType)
| 88 | * @return Total bonus for prefix from the activeBonus HashMap |
| 89 | */ |
| 90 | private double sumActiveBonusMap(String fullyQualifiedBonusType) |
| 91 | { |
| 92 | double bonus = 0; |
| 93 | if (fullyQualifiedBonusType == null) |
| 94 | { |
| 95 | Logging.errorPrint("Unable to sum BONUS when request is null"); |
| 96 | return bonus; |
| 97 | } |
| 98 | |
| 99 | fullyQualifiedBonusType = fullyQualifiedBonusType.toUpperCase(); |
| 100 | if (cachedActiveBonusSumsMap.containsKey(fullyQualifiedBonusType)) |
| 101 | { |
| 102 | return cachedActiveBonusSumsMap.get(fullyQualifiedBonusType); |
| 103 | } |
| 104 | |
| 105 | final List<String> aList = new ArrayList<>(); |
| 106 | boolean found = false; |
| 107 | |
| 108 | for (String fullyQualifedCurrentBonus : activeBonusMap.keySet()) |
| 109 | { |
| 110 | // aKey is either of the form: |
| 111 | // COMBAT.AC |
| 112 | // or |
| 113 | // COMBAT.AC:Luck |
| 114 | // or |
| 115 | // COMBAT.AC:Armor.REPLACE |
| 116 | if (aList.contains(fullyQualifedCurrentBonus)) |
| 117 | { |
| 118 | continue; |
| 119 | } |
| 120 | |
| 121 | if (fullyQualifedCurrentBonus == null) |
| 122 | { |
| 123 | Logging.errorPrint( |
| 124 | "null BONUS: loaded into activeBonusMap. " + fullyQualifiedBonusType + " was requested"); |
| 125 | continue; |
| 126 | } |
| 127 | |
| 128 | String currentTypedBonusNameInfo = fullyQualifedCurrentBonus; |
| 129 | |
| 130 | // rString could be something like: |
| 131 | // COMBAT.AC:Armor.REPLACE |
| 132 | // So need to remove the .STACK or .REPLACE |
| 133 | // to get a match for prefix like: COMBAT.AC:Armor |
| 134 | if (currentTypedBonusNameInfo.endsWith(".STACK")) |
| 135 | { |
| 136 | currentTypedBonusNameInfo = |
| 137 | currentTypedBonusNameInfo.substring(0, currentTypedBonusNameInfo.length() - 6); |
| 138 | } |
| 139 | else if (currentTypedBonusNameInfo.endsWith(".REPLACE")) |
| 140 | { |
| 141 | currentTypedBonusNameInfo = |
| 142 | currentTypedBonusNameInfo.substring(0, currentTypedBonusNameInfo.length() - 8); |
| 143 | } |
| 144 | |
| 145 | // if prefix is of the form: |
| 146 | // COMBAT.AC |
| 147 | // then is must match rstring: |
no test coverage detected