diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-11-09 22:24:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-11-09 22:24:00 +0300 |
commit | 197609376af61e4ef4a02d1e5805c2f923dee4bb (patch) | |
tree | 4c4e55613d8f7bf79ccd02688994976bb6333b92 /src/being | |
parent | 91e8452086ff85b1ba759e1932ac6af0a2179cf3 (diff) | |
download | manaplus-197609376af61e4ef4a02d1e5805c2f923dee4bb.tar.gz manaplus-197609376af61e4ef4a02d1e5805c2f923dee4bb.tar.bz2 manaplus-197609376af61e4ef4a02d1e5805c2f923dee4bb.tar.xz manaplus-197609376af61e4ef4a02d1e5805c2f923dee4bb.zip |
Add skill unit support in most files excluding net code.
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/being.cpp | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 7a937ceaf..9e8b1f6db 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -80,6 +80,7 @@ #include "resources/db/monsterdb.h" #include "resources/db/npcdb.h" #include "resources/db/petdb.h" +#include "resources/db/skillunitdb.h" #include "resources/map/map.h" @@ -269,8 +270,11 @@ Being::Being(const BeingId id, mGotComment = true; } - if (mType == ActorType::Portal) + if (mType == ActorType::Portal || + mType == ActorType::SkillUnit) + { mShowName = false; + } config.addListener("visiblenames", this); @@ -403,6 +407,19 @@ void Being::setSubtype(const BeingTypeId subtype, mYDiff = mInfo->getSortOffsetY(); } } + if (mType == ActorType::SkillUnit) + { + mInfo = SkillUnitDb::get(mSubType); + if (mInfo) + { + setName(mInfo->getName()); + setupSpriteDisplay(mInfo->getDisplay(), + ForceDisplay_true, + 0, + mInfo->getColor(fromInt(mLook, ItemColor))); + mYDiff = mInfo->getSortOffsetY(); + } + } #endif else if (mType == ActorType::Npc) { @@ -681,8 +698,9 @@ void Being::takeDamage(Being *const attacker, UserColorId::HIT_PLAYER_MONSTER); } } - else if (mType == ActorType::Player && attacker != localPlayer - && this == localPlayer) + else if (mType == ActorType::Player && + attacker != localPlayer && + this == localPlayer) { // here player was attacked by other player. mark him as enemy. color = &userPalette->getColor(UserColorId::HIT_PLAYER_PLAYER); @@ -1439,8 +1457,12 @@ void Being::setAction(const BeingActionT &action, const int attackId) this, false, mX, mY); - if (mType == ActorType::Monster || mType == ActorType::Npc) + if (mType == ActorType::Monster || + mType == ActorType::Npc || + mType == ActorType::SkillUnit) + { mYDiff = mInfo->getDeadSortOffsetY(); + } } break; case BeingAction::STAND: @@ -2248,6 +2270,21 @@ void Being::updateColors() setDefaultNameColor(UserColorId::NPC); mTextColor = &userPalette->getColor(UserColorId::NPC); } + else if (mType == ActorType::Pet) + { + setDefaultNameColor(UserColorId::PET); + mTextColor = &userPalette->getColor(UserColorId::PET); + } + else if (mType == ActorType::Homunculus) + { + setDefaultNameColor(UserColorId::HOMUNCULUS); + mTextColor = &userPalette->getColor(UserColorId::HOMUNCULUS); + } + else if (mType == ActorType::SkillUnit) + { + setDefaultNameColor(UserColorId::SKILLUNIT); + mTextColor = &userPalette->getColor(UserColorId::SKILLUNIT); + } else if (this == localPlayer) { mNameColor = &userPalette->getColor(UserColorId::SELF); |