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

Method getDamageToken

code/src/java/pcgen/io/exporttoken/WeaponToken.java:1207–1265  ·  view source on GitHub ↗

Get damage token @param pc @param eq @param range @param content @param ammo @param bonusOnly @param base @return damage token

(PlayerCharacter pc, Equipment eq, int range, int content, int ammo,
	                                     boolean bonusOnly, boolean base)

Source from the content-addressed store, hash-verified

1205 * @return damage token
1206 */
1207 private static String getDamageToken(PlayerCharacter pc, Equipment eq, int range, int content, int ammo,
1208 boolean bonusOnly, boolean base)
1209 {
1210 boolean isDouble = (eq.isDouble() && (eq.getLocation() == EquipmentLocation.EQUIPPED_TWO_HANDS));
1211 boolean isDoubleSplit = (eq.isType("Head1") || eq.isType("Head2"));
1212 int damageMode;
1213 int hands = 1;
1214
1215 if (eq.isNatural() && (eq.getLocation() == EquipmentLocation.EQUIPPED_SECONDARY))
1216 {
1217 damageMode = DAMAGEMODE_OFFHAND;
1218 hands = 0;
1219 }
1220 else if (eq.isUnarmed())
1221 {
1222 damageMode = DAMAGEMODE_BASIC;
1223 }
1224 else if (isDouble && !isDoubleSplit)
1225 {
1226 damageMode = DAMAGEMODE_DOUBLE;
1227 hands = 1;
1228 }
1229 else if ((isDoubleSplit) && (eq.isWeaponTwoHanded(pc)))
1230 {
1231 damageMode = DAMAGEMODE_TWOHANDS;
1232 hands = 2;
1233 }
1234 else if (pc.getDisplay().isSecondaryWeapon(eq))
1235 {
1236 damageMode = DAMAGEMODE_OFFHAND;
1237 hands = 0;
1238 }
1239 else if (pc.getDisplay().isPrimaryWeapon(eq))
1240 {
1241 if (eq.getLocation() == EquipmentLocation.EQUIPPED_BOTH)
1242 {
1243 damageMode = DAMAGEMODE_TWOHANDS;
1244 hands = 2;
1245 }
1246 else
1247 {
1248 damageMode = DAMAGEMODE_BASIC;
1249 }
1250 }
1251 else
1252 {
1253 // Not wielded, probably just carried
1254 if (eq.isWeaponTwoHanded(pc))
1255 {
1256 damageMode = DAMAGEMODE_TWOHANDS;
1257 hands = 2;
1258 }
1259 else
1260 {
1261 damageMode = DAMAGEMODE_BASIC;
1262 }
1263 }
1264 return getDamage(pc, eq, range, content, ammo, bonusOnly, hands, damageMode, base);

Callers 1

getWeaponTokenMethod · 0.95

Calls 10

getDamageMethod · 0.95
isDoubleMethod · 0.80
isNaturalMethod · 0.80
isUnarmedMethod · 0.80
isWeaponTwoHandedMethod · 0.80
isSecondaryWeaponMethod · 0.80
isPrimaryWeaponMethod · 0.80
getLocationMethod · 0.65
isTypeMethod · 0.65
getDisplayMethod · 0.45

Tested by

no test coverage detected