1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 14:57:44 +00:00

Add method to simplify applying statuses to self

This commit is contained in:
Lucy 2023-03-08 00:34:36 +01:00
parent 6fce046225
commit 6cbf94d9c2
2 changed files with 11 additions and 4 deletions

View file

@ -501,6 +501,14 @@ std::pair< uint32_t, Common::ActionHitSeverityType > Action::Action::calcHealing
return Math::CalcStats::calcActionHealing( *m_pSource, potency, wepDmg );
}
void Action::Action::applyStatusEffectSelf( uint16_t statusId, uint8_t param )
{
if( m_hitActors.size() > 0 )
getEffectbuilder()->applyStatusEffect( m_hitActors[ 0 ], statusId, param, true );
else
getEffectbuilder()->applyStatusEffect( m_pSource, statusId, param );
}
void Action::Action::handleAction()
{
snapshotAffectedActors( m_hitActors );
@ -613,10 +621,7 @@ void Action::Action::handleStatusEffects()
{
for( auto& status : m_lutEntry.statuses.caster )
{
if( m_hitActors.size() > 0 )
getEffectbuilder()->applyStatusEffect( m_hitActors[ 0 ], status.id, 0, true );
else
getEffectbuilder()->applyStatusEffect( m_pSource, status.id, 0 );
applyStatusEffectSelf( status.id );
m_pSource->addStatusEffectByIdIfNotExist( status.id, status.duration, *m_pSource, status.modifiers );
}
}

View file

@ -105,6 +105,8 @@ namespace Sapphire::World::Action
EffectBuilderPtr getEffectbuilder();
void applyStatusEffectSelf( uint16_t statusId, uint8_t param = 0 );
void handleAction();
void handleStatusEffects();