MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / getExplosionRadius

Method getExplosionRadius

src/Ruleset/RuleItem.cpp:587–617  ·  view source on GitHub ↗

* Returns the item's max explosion radius. Small explosions don't have a restriction. * Larger explosions are restricted using a formula, with a maximum of radius 10 no matter how large the explosion is. * @return The radius. */

Source from the content-addressed store, hash-verified

585 * @return The radius.
586 */
587int RuleItem::getExplosionRadius() const
588{
589 int radius = 0;
590
591 if (_blastRadius == -1)
592 {
593 // heavy explosions, incendiary, smoke or stun bombs create AOE explosions
594 // all the rest hits one point:
595 // AP, melee (stun or AP), laser, plasma, acid
596 if (_damageType == DT_IN)
597 {
598 radius = (_power / 30) + 1;
599 }
600 else if (_damageType == DT_HE || _damageType == DT_STUN || _damageType == DT_SMOKE)
601 {
602 radius = _power / 20;
603 }
604 // cap the formula to 11
605 if (radius > 11)
606 {
607 radius = 11;
608 }
609 }
610 else
611 {
612 // unless a blast radius is actually defined.
613 radius = _blastRadius;
614 }
615
616 return radius;
617}
618
619/**
620 * Returns the item's recovery points.

Callers 6

projectileActionMethod · 0.80
grenadeActionMethod · 0.80
thinkMethod · 0.80
initMethod · 0.80
explodeMethod · 0.80
tryReactionSnapMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected