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

Method testApply

code/src/java/pcgen/core/kit/KitProf.java:86–213  ·  view source on GitHub ↗
(Kit aKit, PlayerCharacter aPC, List<String> warnings)

Source from the content-addressed store, hash-verified

84 }
85
86 @Override
87 public boolean testApply(Kit aKit, PlayerCharacter aPC, List<String> warnings)
88 {
89 thePObject = null;
90 weaponProfs = null;
91
92 PersistentTransitionChoice<WeaponProf> wpPTC = null;
93 if (isRacial())
94 {
95 final Race pcRace = aPC.getRace();
96
97 if (pcRace == null)
98 {
99 warnings.add("PROF: PC has no race");
100
101 return false;
102 }
103 if (!aPC.hasBonusWeaponProfs(pcRace))
104 {
105 warnings.add("PROF: Race has already selected bonus weapon proficiency");
106
107 return false;
108 }
109 thePObject = pcRace;
110 wpPTC = getPTC(pcRace);
111 if (wpPTC == null)
112 {
113 warnings.add("PROF: PC race has no WEAPONBONUS");
114
115 return false;
116 }
117 }
118 else
119 {
120 Collection<PCClass> pcClasses = aPC.getClassSet();
121 if (pcClasses == null || pcClasses.isEmpty())
122 {
123 warnings.add("PROF: No owning class found.");
124
125 return false;
126 }
127
128 // Search for a class that has bonusWeaponProfs.
129 PCClass pcClass = null;
130 for (PCClass aClass : pcClasses)
131 {
132 pcClass = aClass;
133 wpPTC = getPTC(pcClass);
134 if (wpPTC != null)
135 {
136 break;
137 }
138 }
139 if (wpPTC == null)
140 {
141 warnings.add("PROF: PC classes have no WEAPONBONUS");
142
143 return false;

Callers

nothing calls this directly

Calls 15

isRacialMethod · 0.95
getPTCMethod · 0.95
getSafeCountMethod · 0.95
getChoiceFromListMethod · 0.95
hasBonusWeaponProfsMethod · 0.80
addMethod · 0.65
isEmptyMethod · 0.65
getSetMethod · 0.65
getChoicesMethod · 0.65
getMethod · 0.65
containsMethod · 0.65
actMethod · 0.65

Tested by

no test coverage detected