diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-22 21:32:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-22 21:32:40 +0300 |
commit | 7f06820c754522b00d1a3954036931a0b6efcf0f (patch) | |
tree | 6d8d09b860e7d916118e38a9190b094b4620d9fe | |
parent | 59eee3c29a818fbae8d844c0036d1f894905c179 (diff) | |
download | manaverse-7f06820c754522b00d1a3954036931a0b6efcf0f.tar.gz manaverse-7f06820c754522b00d1a3954036931a0b6efcf0f.tar.bz2 manaverse-7f06820c754522b00d1a3954036931a0b6efcf0f.tar.xz manaverse-7f06820c754522b00d1a3954036931a0b6efcf0f.zip |
Prevent from healing enemies.
-rw-r--r-- | src/actorspritemanager.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index 870d1a59d..0161b6890 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -27,6 +27,7 @@ #include "logger.h" #include "main.h" #include "playerinfo.h" +#include "playerrelations.h" #include "gui/chatwindow.h" #include "gui/equipmentwindow.h" @@ -1099,6 +1100,7 @@ void ActorSpriteManager::heal(Being* target) return; } + // self if (target && player_node->getName() == target->getName()) { if (PlayerInfo::getAttribute(MP) >= 6 @@ -1110,6 +1112,7 @@ void ActorSpriteManager::heal(Being* target) chatWindow->localChatInput(mSpellHeal1); } } + // magic levels < 2 else if (PlayerInfo::getStatEffective(340) < 2 || PlayerInfo::getStatEffective(341) < 2) { @@ -1131,15 +1134,31 @@ void ActorSpriteManager::heal(Being* target) } } } + // magic level >= 2 and not self else { + // mp > 10 and target not monster if (PlayerInfo::getAttribute(MP) >= 10 && target && target->getType() != Being::MONSTER) { - if (!Client::limitPackets(PACKET_CHAT)) - return; - chatWindow->localChatInput(mSpellHeal2 + " " + target->getName()); + // target not enemy + if (player_relations.getRelation(target->getName()) != + PlayerRelation::ENEMY2) + { + if (!Client::limitPackets(PACKET_CHAT)) + return; + chatWindow->localChatInput(mSpellHeal2 + " " + + target->getName()); + } + // target enemy + else + { + if (!Client::limitPackets(PACKET_CHAT)) + return; + chatWindow->localChatInput(mSpellHeal1); + } } + // heal self if selected monster or selection empty else if ((!target || target->getType() == Being::MONSTER) && PlayerInfo::getAttribute(MP) >= 6 && PlayerInfo::getAttribute(HP) |