mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-21 17:47:45 +00:00
Null-check ActionResultBuilder
This commit is contained in:
parent
97e1772d7f
commit
cc63ac182f
4 changed files with 22 additions and 10 deletions
|
@ -22,18 +22,19 @@ public:
|
|||
auto pPlayer = action.getSourceChara()->getAsPlayer();
|
||||
auto pSource = action.getSourceChara();
|
||||
auto pTarget = action.getHitChara();
|
||||
auto pActionBuilder = action.getActionResultBuilder();
|
||||
|
||||
if( !pPlayer )
|
||||
if( !pPlayer || !pActionBuilder )
|
||||
return;
|
||||
|
||||
if( auto status = pPlayer->getStatusEffectById( Defiance ); status )
|
||||
status->setModifier( Common::ParamModifier::DamageDealtPercent, 0 );
|
||||
|
||||
auto dmg = action.calcDamage( Potency );
|
||||
action.getActionResultBuilder()->damage( pSource, pTarget, dmg.first, dmg.second );
|
||||
action.getActionResultBuilder()->heal( pTarget, pSource, dmg.first, Common::CalcResultType::TypeRecoverHp, Common::ActionResultFlag::EffectOnSource );
|
||||
pActionBuilder->damage( pSource, pTarget, dmg.first, dmg.second );
|
||||
pActionBuilder->heal( pTarget, pSource, dmg.first, Common::CalcResultType::TypeRecoverHp, Common::ActionResultFlag::EffectOnSource );
|
||||
|
||||
action.getActionResultBuilder()->applyStatusEffectSelf( InnerBeast, 15000, 0, { StatusModifier{ Common::ParamModifier::DamageTakenPercent, -20 } } );
|
||||
pActionBuilder->applyStatusEffectSelf( InnerBeast, 15000, 0, { StatusModifier{ Common::ParamModifier::DamageTakenPercent, -20 } } );
|
||||
|
||||
if( !pPlayer->hasStatusEffect( Unchained ) )
|
||||
{
|
||||
|
|
|
@ -18,14 +18,15 @@ public:
|
|||
void onExecute( Sapphire::World::Action::Action& action ) override
|
||||
{
|
||||
auto pPlayer = action.getSourceChara()->getAsPlayer();
|
||||
auto pActionBuilder = action.getActionResultBuilder();
|
||||
|
||||
if( !pPlayer )
|
||||
if( !pPlayer || !pActionBuilder )
|
||||
return;
|
||||
|
||||
if( auto status = pPlayer->getStatusEffectById( Defiance ); status )
|
||||
status->setModifier( Common::ParamModifier::DamageDealtPercent, 0 );
|
||||
|
||||
action.getActionResultBuilder()->applyStatusEffectSelf( Unchained, 20000, 0 );
|
||||
pActionBuilder->applyStatusEffectSelf( Unchained, 20000, 0 );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -611,6 +611,11 @@ void Action::Action::buildActionResults()
|
|||
|
||||
void Action::Action::handleStatusEffects()
|
||||
{
|
||||
auto pActionBuilder = getActionResultBuilder();
|
||||
|
||||
if( !pActionBuilder )
|
||||
return;
|
||||
|
||||
if( isComboAction() && !isCorrectCombo() )
|
||||
return;
|
||||
|
||||
|
@ -619,7 +624,7 @@ void Action::Action::handleStatusEffects()
|
|||
{
|
||||
for( auto& status : m_lutEntry.statuses.caster )
|
||||
{
|
||||
getActionResultBuilder()->applyStatusEffectSelf( status.id, status.duration, 0, status.modifiers, status.flag, true );
|
||||
pActionBuilder->applyStatusEffectSelf( status.id, status.duration, 0, status.modifiers, status.flag, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -630,7 +635,7 @@ void Action::Action::handleStatusEffects()
|
|||
{
|
||||
for( auto& status : m_lutEntry.statuses.target )
|
||||
{
|
||||
getActionResultBuilder()->applyStatusEffect( actor, status.id, status.duration, 0, status.modifiers, status.flag, true );
|
||||
pActionBuilder->applyStatusEffect( actor, status.id, status.duration, 0, status.modifiers, status.flag, true );
|
||||
}
|
||||
|
||||
if( actor->getStatusEffectMap().size() > 0 )
|
||||
|
|
|
@ -33,6 +33,11 @@ void Warrior::handleWrath( Entity::Player& player, Action& action )
|
|||
auto parry = 2;
|
||||
auto asChara = player.getAsChara();
|
||||
|
||||
auto pActionBuilder = action.getActionResultBuilder();
|
||||
|
||||
if( !pActionBuilder )
|
||||
return;
|
||||
|
||||
if( player.hasStatusEffect( Wrath ) )
|
||||
{
|
||||
player.replaceSingleStatusEffectById( Wrath );
|
||||
|
@ -59,7 +64,7 @@ void Warrior::handleWrath( Entity::Player& player, Action& action )
|
|||
}
|
||||
|
||||
if( !player.hasStatusEffect( Infuriated ) )
|
||||
{
|
||||
action.getActionResultBuilder()->applyStatusEffectSelf( effectToApply, 30000, 0, { StatusModifier{ Common::ParamModifier::ParryPercent, parry } }, 0, false );
|
||||
{
|
||||
pActionBuilder->applyStatusEffectSelf( effectToApply, 30000, 0, { StatusModifier{ Common::ParamModifier::ParryPercent, parry } }, 0, false );
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue