summaryrefslogtreecommitdiff
path: root/src/game-server/item.cpp
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-04-10 23:04:42 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-04-11 13:47:17 +0200
commitd7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da (patch)
tree1b4d200ba66c6afcdb7763951980476756339cf1 /src/game-server/item.cpp
parentaa04597c5f8bb806996d604699fc8ebff6d53bdd (diff)
downloadmanaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.tar.gz
manaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.tar.bz2
manaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.tar.xz
manaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.zip
Converted Being into a Component
I did not really care too much about staying consistent with the use of static_casts to Actors since they are only temporary anyway until Actor is a component too.
Diffstat (limited to 'src/game-server/item.cpp')
-rw-r--r--src/game-server/item.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/game-server/item.cpp b/src/game-server/item.cpp
index 7295b95a..2b2d4620 100644
--- a/src/game-server/item.cpp
+++ b/src/game-server/item.cpp
@@ -33,28 +33,33 @@
#include <map>
#include <string>
-bool ItemEffectAttrMod::apply(Being *itemUser)
+bool ItemEffectAttrMod::apply(Entity *itemUser)
{
LOG_DEBUG("Applying modifier.");
- itemUser->applyModifier(mAttributeId, mMod, mAttributeLayer,
- mDuration, mId);
+ itemUser->getComponent<BeingComponent>()->applyModifier(*itemUser,
+ mAttributeId, mMod,
+ mAttributeLayer,
+ mDuration, mId);
return false;
}
-void ItemEffectAttrMod::dispell(Being *itemUser)
+void ItemEffectAttrMod::dispell(Entity *itemUser)
{
LOG_DEBUG("Dispelling modifier.");
- itemUser->removeModifier(mAttributeId, mMod, mAttributeLayer,
- mId, !mDuration);
+ itemUser->getComponent<BeingComponent>()->removeModifier(*itemUser,
+ mAttributeId,
+ mMod,
+ mAttributeLayer,
+ mId, !mDuration);
}
-bool ItemEffectAttack::apply(Being *itemUser)
+bool ItemEffectAttack::apply(Entity *itemUser)
{
itemUser->getComponent<CombatComponent>()->addAttack(mAttackInfo);
return false;
}
-void ItemEffectAttack::dispell(Being *itemUser)
+void ItemEffectAttack::dispell(Entity *itemUser)
{
itemUser->getComponent<CombatComponent>()->removeAttack(mAttackInfo);
}
@@ -63,7 +68,7 @@ ItemEffectScript::~ItemEffectScript()
{
}
-bool ItemEffectScript::apply(Being *itemUser)
+bool ItemEffectScript::apply(Entity *itemUser)
{
if (mActivateEventName.empty())
return false;
@@ -82,7 +87,7 @@ bool ItemEffectScript::apply(Being *itemUser)
return false;
}
-void ItemEffectScript::dispell(Being *itemUser)
+void ItemEffectScript::dispell(Entity *itemUser)
{
if (mDispellEventName.empty())
return;
@@ -123,7 +128,7 @@ void ItemClass::addEffect(ItemEffectInfo *effect,
mDispells.insert(std::make_pair(dispell, effect));
}
-bool ItemClass::useTrigger(Being *itemUser, ItemTriggerType trigger)
+bool ItemClass::useTrigger(Entity *itemUser, ItemTriggerType trigger)
{
if (!trigger)
return false;