| 39 | } |
| 40 | |
| 41 | public static Integer modifier(Skill sk, PlayerCharacter aPC) |
| 42 | { |
| 43 | int bonus = 0; |
| 44 | if (aPC == null) |
| 45 | { |
| 46 | return 0; |
| 47 | } |
| 48 | |
| 49 | String keyName = sk.getKeyName(); |
| 50 | CDOMSingleRef<PCStat> statref = sk.get(ObjectKey.KEY_STAT); |
| 51 | if (statref != null) |
| 52 | { |
| 53 | PCStat stat = statref.get(); |
| 54 | bonus = aPC.getStatModFor(stat); |
| 55 | bonus += aPC.getTotalBonusTo("SKILL", "STAT." + stat.getKeyName()); |
| 56 | } |
| 57 | bonus += aPC.getTotalBonusTo("SKILL", keyName); |
| 58 | |
| 59 | // loop through all current skill types checking for boni |
| 60 | for (Type singleType : sk.getTrueTypeList(false)) |
| 61 | { |
| 62 | bonus += aPC.getTotalBonusTo("SKILL", "TYPE." + singleType); |
| 63 | } |
| 64 | |
| 65 | // now check for any lists of skills, etc |
| 66 | bonus += aPC.getTotalBonusTo("SKILL", "LIST"); |
| 67 | |
| 68 | // now check for ALL |
| 69 | bonus += aPC.getTotalBonusTo("SKILL", "ALL"); |
| 70 | |
| 71 | // these next two if-blocks try to get BONUS:[C]CSKILL|TYPE=xxx|y to |
| 72 | // function |
| 73 | if (aPC.isClassSkill(sk)) |
| 74 | { |
| 75 | bonus += aPC.getTotalBonusTo("CSKILL", keyName); |
| 76 | |
| 77 | // loop through all current skill types checking for boni |
| 78 | for (Type singleType : sk.getTrueTypeList(false)) |
| 79 | { |
| 80 | bonus += aPC.getTotalBonusTo("CSKILL", "TYPE." + singleType); |
| 81 | } |
| 82 | |
| 83 | bonus += aPC.getTotalBonusTo("CSKILL", "LIST"); |
| 84 | } |
| 85 | |
| 86 | if (!aPC.isClassSkill(sk) && !sk.getSafe(ObjectKey.EXCLUSIVE)) |
| 87 | { |
| 88 | bonus += aPC.getTotalBonusTo("CCSKILL", keyName); |
| 89 | |
| 90 | // loop through all current skill types checking for boni |
| 91 | for (Type singleType : sk.getTrueTypeList(false)) |
| 92 | { |
| 93 | bonus += aPC.getTotalBonusTo("CCSKILL", "TYPE." + singleType); |
| 94 | } |
| 95 | |
| 96 | bonus += aPC.getTotalBonusTo("CCSKILL", "LIST"); |
| 97 | } |
| 98 | |