diff --git a/src/world/Actor/Chara.cpp b/src/world/Actor/Chara.cpp index 2994cfce..2f7bbf8a 100644 --- a/src/world/Actor/Chara.cpp +++ b/src/world/Actor/Chara.cpp @@ -492,12 +492,12 @@ void Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEffect ) auto& teriMgr = Common::Service< Manager::TerritoryMgr >::ref(); auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() ); - int8_t nextSlot = -1; - if( !pEffect->getCanApplyMultipleTimes() ) + int8_t nextSlot = getStatusEffectSlotWithIdAndSource( pEffect->getId(), pEffect->getSrcActorId() ); + if( nextSlot == -1 && !pEffect->getCanApplyMultipleTimes() ) { - nextSlot = getStatusEffectSlotWithId( pEffect->getId() ); + nextSlot = getStatusEffectSlotWithId( pEffect->getId()); } - if( nextSlot == -1 || pEffect->getCanApplyMultipleTimes() ) + if( nextSlot == -1) { nextSlot = getStatusEffectFreeSlot(); } @@ -526,11 +526,24 @@ void Chara::addStatusEffectByIdIfNotExist( StatusEffect::StatusEffectPtr pStatus addStatusEffect( pStatus ); } -int8_t Chara::getStatusEffectSlotWithId( uint8_t id ) +int8_t Chara::getStatusEffectSlotWithIdAndSource( uint8_t statusId, uint32_t sourceId ) { for( const auto& effectIt : m_statusEffectMap ) { - if( effectIt.second->getId() == id ) + if( effectIt.second->getId() == statusId && effectIt.second->getSrcActorId() == sourceId ) + { + return effectIt.first; + } + } + + return -1; +} + +int8_t Chara::getStatusEffectSlotWithId( uint8_t statusId ) +{ + for( const auto& effectIt : m_statusEffectMap ) + { + if( effectIt.second->getId() == statusId ) { return effectIt.first; } diff --git a/src/world/Actor/Chara.h b/src/world/Actor/Chara.h index f36a6702..a48f60f4 100644 --- a/src/world/Actor/Chara.h +++ b/src/world/Actor/Chara.h @@ -120,7 +120,9 @@ namespace Sapphire::Entity bool hasStatusEffect( uint32_t id ); - int8_t getStatusEffectSlotWithId( uint8_t id ); + int8_t getStatusEffectSlotWithIdAndSource( uint8_t statusId, uint32_t sourceId ); + + int8_t getStatusEffectSlotWithId( uint8_t statusId ); int8_t getStatusEffectFreeSlot();