(PObject po, String aType, String aName, final Object obj, final Collection<BonusObj> aBonusList, final PlayerCharacter aPC)
| 53 | } |
| 54 | |
| 55 | public static double bonusTo(PObject po, String aType, String aName, final Object obj, |
| 56 | final Collection<BonusObj> aBonusList, final PlayerCharacter aPC) |
| 57 | { |
| 58 | if ((aBonusList == null) || (aBonusList.isEmpty())) |
| 59 | { |
| 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | double retVal = 0; |
| 64 | |
| 65 | aType = aType.toUpperCase(); |
| 66 | aName = aName.toUpperCase(); |
| 67 | |
| 68 | final String aTypePlusName = aType + '.' + aName + '.'; |
| 69 | |
| 70 | if (!BonusCalc.dontRecurse && (po instanceof Ability) && (AbilityUtilities.isFeat(obj)) |
| 71 | && !Globals.checkRule(RuleConstants.FEATPRE)) |
| 72 | { |
| 73 | // SUCK! This is horrid, but bonusTo is actually recursive with respect to |
| 74 | // passesPreReqToGain and there is no other way to do this without decomposing the |
| 75 | // dependencies. I am loathe to break working code. |
| 76 | // This addresses bug #709677 -- Feats give bonuses even if you no longer qualify |
| 77 | BonusCalc.dontRecurse = true; |
| 78 | |
| 79 | boolean returnZero = false; |
| 80 | |
| 81 | if (!po.qualifies(aPC, po)) |
| 82 | { |
| 83 | returnZero = true; |
| 84 | } |
| 85 | |
| 86 | BonusCalc.dontRecurse = false; |
| 87 | |
| 88 | if (returnZero) |
| 89 | { |
| 90 | return 0; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | int iTimes = 1; |
| 95 | |
| 96 | if (aPC != null && "VAR".equals(aType)) |
| 97 | { |
| 98 | iTimes = Math.max(1, aPC.getConsolidatedAssociationList(po).size()); |
| 99 | } |
| 100 | |
| 101 | for (BonusObj bonus : aBonusList) |
| 102 | { |
| 103 | String bString = bonus.toString().toUpperCase(); |
| 104 | |
| 105 | if (aPC != null && !aPC.getConsolidatedAssociationList(po).isEmpty()) |
| 106 | { |
| 107 | int span = 4; |
| 108 | int idx = bString.indexOf("%VAR"); |
| 109 | |
| 110 | if (idx == -1) |
| 111 | { |
| 112 | idx = bString.indexOf("%LIST|"); |
no test coverage detected