MCPcopy Create free account
hub / github.com/TurningWheel/Barony / rangedAttackGetSpeedModifier

Function rangedAttackGetSpeedModifier

src/items.cpp:7214–7285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7212}
7213
7214real_t rangedAttackGetSpeedModifier(const Stat* const myStats)
7215{
7216 if ( !myStats || !myStats->weapon )
7217 {
7218 return 1.0;
7219 }
7220
7221 real_t bowModifier = 1.00;
7222 real_t arrowModifier = 0.0;
7223 real_t equipmentModifier = 0.0;
7224
7225 if ( myStats->helmet && myStats->helmet->type == HAT_BYCOCKET )
7226 {
7227 if ( myStats->helmet->beatitude >= 0 || shouldInvertEquipmentBeatitude(myStats) )
7228 {
7229 equipmentModifier -= std::min(0.3, 0.1 + 0.1 * abs(myStats->helmet->beatitude));
7230 }
7231 else
7232 {
7233 equipmentModifier += std::min(0.6, 0.3 * abs(myStats->helmet->beatitude));
7234 }
7235 }
7236
7237 if ( myStats->shield )
7238 {
7239 if ( myStats->shield->type == QUIVER_LIGHTWEIGHT )
7240 {
7241 arrowModifier = -.5;
7242 }
7243 }
7244
7245 if ( myStats->weapon->type == LONGBOW )
7246 {
7247 bowModifier = 1.25;
7248 }
7249 else if ( myStats->weapon->type == BRANCH_BOW
7250 || myStats->weapon->type == BRANCH_BOW_INFECTED
7251 || myStats->weapon->type == BONE_SHORTBOW )
7252 {
7253 bowModifier = 1.0;
7254 }
7255 else if ( myStats->weapon->type == ARTIFACT_BOW )
7256 {
7257 bowModifier = 0.75;
7258 }
7259 else if ( myStats->weapon->type == COMPOUND_BOW )
7260 {
7261 bowModifier = 0.75;
7262 arrowModifier /= 2;
7263 }
7264 else if ( myStats->weapon->type == SLING )
7265 {
7266 bowModifier = 0.75;
7267 arrowModifier = 0.0; // no impact on slings.
7268 }
7269 else if ( myStats->weapon->type == CROSSBOW
7270 || myStats->weapon->type == BLACKIRON_CROSSBOW )
7271 {

Callers 1

actHudWeaponFunction · 0.85

Calls 1

Tested by

no test coverage detected