From 60906e87e854f6420804839db7b2afadb69662bb Mon Sep 17 00:00:00 2001 From: Joseph Botosh Date: Fri, 24 Jul 2015 15:55:30 +0300 Subject: healmd checks healing radius --- src/actions/actions.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/actions') 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); -- cgit v1.2.3-70-g09d2