mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-06 18:57:45 +00:00
Add function to remove multiple statuseffects by id
This commit is contained in:
parent
6b72992b9f
commit
2965d8a03a
3 changed files with 21 additions and 6 deletions
|
@ -15,12 +15,7 @@ public:
|
|||
|
||||
void onExpire( Entity::Chara& actor ) override
|
||||
{
|
||||
actor.removeSingleStatusEffectById( Unchained );
|
||||
actor.removeSingleStatusEffectById( Wrath );
|
||||
actor.removeSingleStatusEffectById( WrathII );
|
||||
actor.removeSingleStatusEffectById( WrathIII );
|
||||
actor.removeSingleStatusEffectById( WrathIV );
|
||||
actor.removeSingleStatusEffectById( Infuriated );
|
||||
actor.removeStatusEffectById( { Unchained, Wrath, WrathII, WrathIII, WrathIV, Infuriated } );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -559,6 +559,24 @@ void Chara::removeSingleStatusEffectById( uint32_t id )
|
|||
}
|
||||
}
|
||||
|
||||
void Chara::removeStatusEffectById( std::vector< uint32_t > ids )
|
||||
{
|
||||
for( auto effectIt = m_statusEffectMap.begin(); effectIt != m_statusEffectMap.end(); )
|
||||
{
|
||||
auto foundStatus = std::find( ids.begin(), ids.end(), effectIt->second->getId() );
|
||||
|
||||
if( foundStatus != ids.end() )
|
||||
{
|
||||
effectIt = removeStatusEffect( effectIt->first );
|
||||
ids.erase( foundStatus );
|
||||
}
|
||||
else
|
||||
{
|
||||
++effectIt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Chara::removeStatusEffectByFlag( Common::StatusEffectFlag flag )
|
||||
{
|
||||
for( auto effectIt = m_statusEffectMap.begin(); effectIt != m_statusEffectMap.end(); )
|
||||
|
|
|
@ -114,6 +114,8 @@ namespace Sapphire::Entity
|
|||
|
||||
void removeSingleStatusEffectById( uint32_t id );
|
||||
|
||||
void removeStatusEffectById( std::vector< uint32_t > ids );
|
||||
|
||||
void removeStatusEffectByFlag( Common::StatusEffectFlag flag );
|
||||
|
||||
void updateStatusEffects();
|
||||
|
|
Loading…
Add table
Reference in a new issue