* 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. */
| 585 | * @return The radius. |
| 586 | */ |
| 587 | int 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. |
no outgoing calls
no test coverage detected