mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-26 03:27:44 +00:00
use markToRemove instead of removing status directly
This commit is contained in:
parent
dff0033464
commit
a366042d28
3 changed files with 11 additions and 15 deletions
|
@ -956,7 +956,6 @@ float Sapphire::Entity::Chara::applyShieldProtection( float damage )
|
|||
{
|
||||
float remainingDamage = damage;
|
||||
bool shieldChanged = false;
|
||||
std::vector< uint8_t > destroyedShieldSlotList;
|
||||
|
||||
for( auto const& entry : getStatusEffectMap() )
|
||||
{
|
||||
|
@ -976,24 +975,14 @@ float Sapphire::Entity::Chara::applyShieldProtection( float damage )
|
|||
else
|
||||
{
|
||||
remainingDamage -= effectEntry.effectValue1;
|
||||
destroyedShieldSlotList.push_back( entry.first );
|
||||
status->markToRemove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( shieldChanged )
|
||||
{
|
||||
if( !destroyedShieldSlotList.empty() )
|
||||
{
|
||||
for( auto const& slotId : destroyedShieldSlotList )
|
||||
{
|
||||
removeStatusEffect( slotId, false );
|
||||
}
|
||||
sendStatusEffectUpdate();
|
||||
}
|
||||
else
|
||||
sendEffectResultToUpdateShieldValue(); // yes this is the packet to update shield value
|
||||
}
|
||||
sendEffectResultToUpdateShieldValue();
|
||||
|
||||
return remainingDamage;
|
||||
}
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ void Sapphire::StatusEffect::StatusEffect::onBeforeActionStart( Sapphire::World:
|
|||
m_effectEntry.effectValue1--;
|
||||
if( m_effectEntry.effectValue1 == 0 )
|
||||
{
|
||||
m_markToRemove = true;
|
||||
markToRemove();
|
||||
}
|
||||
action->setCastTime( 0 );
|
||||
}
|
||||
|
@ -327,6 +327,11 @@ bool Sapphire::StatusEffect::StatusEffect::isMarkedToRemove()
|
|||
return m_markToRemove;
|
||||
}
|
||||
|
||||
void Sapphire::StatusEffect::StatusEffect::markToRemove()
|
||||
{
|
||||
m_markToRemove = true;
|
||||
}
|
||||
|
||||
void Sapphire::StatusEffect::StatusEffect::refresh()
|
||||
{
|
||||
m_value = 0;
|
||||
|
|
|
@ -57,6 +57,8 @@ public:
|
|||
|
||||
bool isMarkedToRemove();
|
||||
|
||||
void markToRemove();
|
||||
|
||||
void refresh();
|
||||
void refresh( Sapphire::World::Action::StatusEffectEntry newEntry );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue