diff options
author | Joseph Botosh <rumly111@gmail.com> | 2015-07-24 15:55:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-07-25 21:39:05 +0300 |
commit | 60906e87e854f6420804839db7b2afadb69662bb (patch) | |
tree | fee04d39cef15dc48ba6e55dcdeac74d4ee8fe59 /src/actions/actions.cpp | |
parent | f5d2e707df5171146af3fe1366ecb8fa17b56eea (diff) | |
download | manaplus-60906e87e854f6420804839db7b2afadb69662bb.tar.gz manaplus-60906e87e854f6420804839db7b2afadb69662bb.tar.bz2 manaplus-60906e87e854f6420804839db7b2afadb69662bb.tar.xz manaplus-60906e87e854f6420804839db7b2afadb69662bb.zip |
healmd checks healing radius
Diffstat (limited to 'src/actions/actions.cpp')
-rw-r--r-- | src/actions/actions.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index aaa71848f..4f78bc375 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -98,6 +98,7 @@ #include "utils/delete2.h" #include "utils/gettext.h" #include "utils/timer.h" +#include "utils/mathutils.h" #ifdef ANDROID #ifndef USE_SDL2 @@ -531,7 +532,21 @@ impHandler0(healmd) { if (actorManager) { - Being *target = actorManager->findMostDamagedPlayer(); + const int matk = PlayerInfo::getStatEffective(Attributes::MATK); + int maxHealingRadius; + + // magic levels < 2 + if (PlayerInfo::getSkillLevel(340) < 2 + || PlayerInfo::getSkillLevel(341) < 2) + { + maxHealingRadius = matk / 100 + 1; + } + else + { + maxHealingRadius = (12 * fastSqrtInt(matk) + matk) / 100 + 1; + } + + Being *target = actorManager->findMostDamagedPlayer(maxHealingRadius); if (target) actorManager->heal(target); |