MCPcopy Create free account
hub / github.com/PCGen/pcgen / modifier

Method modifier

code/src/java/pcgen/core/analysis/SkillModifier.java:41–112  ·  view source on GitHub ↗
(Skill sk, PlayerCharacter aPC)

Source from the content-addressed store, hash-verified

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

Callers 10

test2857848aMethod · 0.95
test2857848bMethod · 0.95
test2857848cMethod · 0.95
runMethod · 0.95
getTokenMethod · 0.95
getSkillPropValueMethod · 0.95
getSkillBreakdownMethod · 0.95
includeSkillMethod · 0.95
resolveMethod · 0.95
getSkillPropValueMethod · 0.95

Calls 15

getGameAsPropertyMethod · 0.95
getTotalRankMethod · 0.95
getTrueTypeListMethod · 0.80
getSafeMethod · 0.80
calculateBonusMethod · 0.80
getRankModFormulaMethod · 0.80
intValueMethod · 0.80
getKeyNameMethod · 0.65
getMethod · 0.65
isEmptyMethod · 0.65
toStringMethod · 0.65
getVariableValueMethod · 0.65

Tested by 3

test2857848aMethod · 0.76
test2857848bMethod · 0.76
test2857848cMethod · 0.76