diff options
author | Chuck Miller <shadowmil@gmail.com> | 2008-11-25 22:45:39 -0500 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-11-26 09:08:44 +0100 |
commit | 770c9079087e76712e7b8cc455b92c64f2aab3e3 (patch) | |
tree | bec979e98065a5522667097ea0447443e3a78343 /src | |
parent | 3eb5752bde929c8629680f12db4e5cd5d0c32d71 (diff) | |
download | manaserv-770c9079087e76712e7b8cc455b92c64f2aab3e3.tar.gz manaserv-770c9079087e76712e7b8cc455b92c64f2aab3e3.tar.bz2 manaserv-770c9079087e76712e7b8cc455b92c64f2aab3e3.tar.xz manaserv-770c9079087e76712e7b8cc455b92c64f2aab3e3.zip |
Allows the damage struct to carry more then one used skill
Diffstat (limited to 'src')
-rw-r--r-- | src/game-server/being.hpp | 3 | ||||
-rw-r--r-- | src/game-server/character.cpp | 2 | ||||
-rw-r--r-- | src/game-server/monster.cpp | 17 | ||||
-rw-r--r-- | src/scripting/lua.cpp | 1 |
4 files changed, 13 insertions, 10 deletions
diff --git a/src/game-server/being.hpp b/src/game-server/being.hpp index 2db04f65..9d088de8 100644 --- a/src/game-server/being.hpp +++ b/src/game-server/being.hpp @@ -23,6 +23,7 @@ #include <string> #include <vector> +#include <list> #include "limits.h" #include "defines.h" @@ -65,7 +66,7 @@ struct Damage unsigned short cth; /**< Chance to hit. Opposes the evade attribute. */ unsigned char element; /**< Elemental damage. */ unsigned char type; /**< Damage type: Physical or magical? */ - size_t usedSkill; /**< Skill used by source (needed for exp calculation) */ + std::list<size_t> usedSkills; /**< Skills used by source (needed for exp calculation) */ }; /** diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index c4a806a0..8ae2e85d 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -102,7 +102,7 @@ void Character::perform() damage.type = DAMAGE_PHYSICAL; damage.cth = getModifiedAttribute(BASE_ATTR_HIT) + getModifiedAttribute(CHAR_SKILL_WEAPON_BEGIN + type); - damage.usedSkill = CHAR_SKILL_WEAPON_BEGIN + type; + damage.usedSkills.push_back(CHAR_SKILL_WEAPON_BEGIN + type); if (ic) { diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp index b8333e40..14f60c03 100644 --- a/src/game-server/monster.cpp +++ b/src/game-server/monster.cpp @@ -122,7 +122,6 @@ void Monster::perform() damage.cth = getModifiedAttribute(BASE_ATTR_HIT); damage.element = mCurrentAttack->element; damage.type = mCurrentAttack->type; - damage.usedSkill = 0; performAttack(damage, &mCurrentAttack->attackZone); } if (!mAttackTime) @@ -336,14 +335,18 @@ int Monster::damage(Object *source, Damage const &damage) ib.first->second += HPLoss; } - if (damage.usedSkill) + std::list<size_t>::const_iterator iSkill; + for (iSkill = damage.usedSkills.begin(); iSkill != damage.usedSkills.end(); ++iSkill) { - mExpReceivers[s].insert(damage.usedSkill); - if (!mOwnerTimer || mOwner == s || mOwner->getParty() == s->getParty()) + if (*iSkill) { - mOwner = s; - mLegalExpReceivers.insert(s); - mOwnerTimer = KILLSTEAL_PROTECTION_TIME; + mExpReceivers[s].insert(*iSkill); + if (!mOwnerTimer || mOwner == s || mOwner->getParty() == s->getParty()) + { + mOwner = s; + mLegalExpReceivers.insert(s); + mOwnerTimer = KILLSTEAL_PROTECTION_TIME; + } } } } diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 40461855..0387f3bb 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -611,7 +611,6 @@ static int LuaBeing_Damage(lua_State *s) damage.cth = lua_tointeger(s, 4); damage.type = lua_tointeger(s, 5); damage.element = lua_tointeger(s, 6); - damage.usedSkill = 0; being->damage(NULL, damage); |