mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-28 20:27:46 +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;
|
float remainingDamage = damage;
|
||||||
bool shieldChanged = false;
|
bool shieldChanged = false;
|
||||||
std::vector< uint8_t > destroyedShieldSlotList;
|
|
||||||
|
|
||||||
for( auto const& entry : getStatusEffectMap() )
|
for( auto const& entry : getStatusEffectMap() )
|
||||||
{
|
{
|
||||||
|
@ -976,24 +975,14 @@ float Sapphire::Entity::Chara::applyShieldProtection( float damage )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
remainingDamage -= effectEntry.effectValue1;
|
remainingDamage -= effectEntry.effectValue1;
|
||||||
destroyedShieldSlotList.push_back( entry.first );
|
status->markToRemove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( shieldChanged )
|
if( shieldChanged )
|
||||||
{
|
sendEffectResultToUpdateShieldValue();
|
||||||
if( !destroyedShieldSlotList.empty() )
|
|
||||||
{
|
|
||||||
for( auto const& slotId : destroyedShieldSlotList )
|
|
||||||
{
|
|
||||||
removeStatusEffect( slotId, false );
|
|
||||||
}
|
|
||||||
sendStatusEffectUpdate();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sendEffectResultToUpdateShieldValue(); // yes this is the packet to update shield value
|
|
||||||
}
|
|
||||||
return remainingDamage;
|
return remainingDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,7 @@ void Sapphire::StatusEffect::StatusEffect::onBeforeActionStart( Sapphire::World:
|
||||||
m_effectEntry.effectValue1--;
|
m_effectEntry.effectValue1--;
|
||||||
if( m_effectEntry.effectValue1 == 0 )
|
if( m_effectEntry.effectValue1 == 0 )
|
||||||
{
|
{
|
||||||
m_markToRemove = true;
|
markToRemove();
|
||||||
}
|
}
|
||||||
action->setCastTime( 0 );
|
action->setCastTime( 0 );
|
||||||
}
|
}
|
||||||
|
@ -327,6 +327,11 @@ bool Sapphire::StatusEffect::StatusEffect::isMarkedToRemove()
|
||||||
return m_markToRemove;
|
return m_markToRemove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sapphire::StatusEffect::StatusEffect::markToRemove()
|
||||||
|
{
|
||||||
|
m_markToRemove = true;
|
||||||
|
}
|
||||||
|
|
||||||
void Sapphire::StatusEffect::StatusEffect::refresh()
|
void Sapphire::StatusEffect::StatusEffect::refresh()
|
||||||
{
|
{
|
||||||
m_value = 0;
|
m_value = 0;
|
||||||
|
|
|
@ -57,6 +57,8 @@ public:
|
||||||
|
|
||||||
bool isMarkedToRemove();
|
bool isMarkedToRemove();
|
||||||
|
|
||||||
|
void markToRemove();
|
||||||
|
|
||||||
void refresh();
|
void refresh();
|
||||||
void refresh( Sapphire::World::Action::StatusEffectEntry newEntry );
|
void refresh( Sapphire::World::Action::StatusEffectEntry newEntry );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue