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

Method setXP

code/src/java/pcgen/core/PlayerCharacter.java:2165–2181  ·  view source on GitHub ↗

Sets the total Experience Points for the Player Character to the given value. Note this sets earned Experience Points as a side effect (calculated based on the level-adjusted Experience Points the Player Character may have). If the given xp value is less than the level-adjusted Experience Points

(int xp)

Source from the content-addressed store, hash-verified

2163 * @param xp The total Experience Points for the Player Character
2164 */
2165 public void setXP(int xp)
2166 {
2167 // Remove the effect of LEVELADJ when storing our
2168 // internal notion of experience
2169 int realXP = xp - getLAXP();
2170
2171 if (realXP < 0)
2172 {
2173 Logging.errorPrint("ERROR: too little experience: " + realXP);
2174 realXP = 0;
2175 }
2176
2177 if (xpFacet.set(id, realXP))
2178 {
2179 setDirty(true);
2180 }
2181 }
2182
2183 /**
2184 * Return the total Experience Points for the Player Character.

Callers

nothing calls this directly

Calls 4

getLAXPMethod · 0.95
errorPrintMethod · 0.95
setDirtyMethod · 0.95
setMethod · 0.65

Tested by

no test coverage detected