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

Method getDamage

code/src/java/pcgen/io/exporttoken/WeaponToken.java:2097–2247  ·  view source on GitHub ↗
(PlayerCharacter pc, Equipment eq, int range, int content, int ammo,
		boolean bonusOnly, int hands, int damageMode, boolean base)

Source from the content-addressed store, hash-verified

2095 }
2096
2097 private static String getDamage(PlayerCharacter pc, Equipment eq, int range, int content, int ammo,
2098 boolean bonusOnly, int hands, int damageMode, boolean base)
2099 {
2100 boolean isDouble = (eq.isDouble() && (eq.getLocation() == EquipmentLocation.EQUIPPED_TWO_HANDS));
2101 boolean isDoubleSplit = (eq.isType("Head1") || eq.isType("Head2"));
2102
2103 if (eq.isMelee() && (eq.isWeaponTwoHanded(pc)))
2104 {
2105 if (!isDouble && !isDoubleSplit && (damageMode != DAMAGEMODE_NORMAL) && (damageMode != DAMAGEMODE_TWOHANDS)
2106 && (damageMode != DAMAGEMODE_DOUBLE))
2107 {
2108 return LanguageBundle.getString("SettingsHandler.not.applicable");
2109 }
2110 }
2111
2112 if (eq.isMelee() && eq.isWeaponOutsizedForPC(pc) && !eq.isNatural())
2113 {
2114 return LanguageBundle.getString("SettingsHandler.not.applicable");
2115 }
2116
2117 if (eq.isWeaponLightForPC(pc) && (hands == 2))
2118 {
2119 // if wielding a 'Light' weapon two handed
2120 // treat as if wielding 1 handed for damage bonus
2121 hands = 1;
2122 }
2123
2124 String profName = getProfName(eq);
2125
2126 String damString = getEqDamage(pc, eq);
2127 int meleeDamageStatBonus = (int) pc.getDisplay().getStatBonusTo("COMBAT", "DAMAGE.MELEE");
2128 // TODO: remove this old syntax
2129 meleeDamageStatBonus += (int) pc.getDisplay().getStatBonusTo("DAMAGE", "TYPE.MELEE");
2130 meleeDamageStatBonus += (int) pc.getTotalBonusTo("WEAPONPROF=" + profName, "STATDAMAGE");
2131 double meleeDamageMult = pc.getTotalBonusTo("COMBAT", "DAMAGEMULT:" + hands);
2132 meleeDamageMult += pc.getTotalBonusTo("WEAPONPROF=" + profName, "DAMAGEMULT:" + hands);
2133 meleeDamageMult += BonusCalc.charBonusTo(eq, "WEAPON", "DAMAGEMULT:" + hands, pc);
2134
2135 int bonus = 0;
2136 int weaponProfBonus = 0;
2137 int eqbonus = 0;
2138 int totalBonus = 0;
2139
2140 damString = getMonkUnarmed(pc, eq, damString);
2141
2142 if (!base)
2143 {
2144 int index;
2145 for (index = 0; index < damString.length(); ++index)
2146 {
2147 if ((damString.charAt(index) == '+') || (damString.charAt(index) == '-'))
2148 {
2149 totalBonus = Delta.decode(damString.substring(index));
2150 break;
2151 }
2152 }
2153
2154 eqbonus = getEqBonus(pc, eq, content, ammo);

Callers 4

getDamageTokenMethod · 0.95
getBasicDamageTokenMethod · 0.95
getTHDamageTokenMethod · 0.95
getOHDamageTokenMethod · 0.95

Calls 15

getStringMethod · 0.95
getProfNameMethod · 0.95
getEqDamageMethod · 0.95
charBonusToMethod · 0.95
getMonkUnarmedMethod · 0.95
decodeMethod · 0.95
getEqBonusMethod · 0.95
getGeneralBonusMethod · 0.95
getWeaponProfBonusMethod · 0.95
toStringMethod · 0.95
isDoubleMethod · 0.80
isMeleeMethod · 0.80

Tested by

no test coverage detected