mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-04 17:57:47 +00:00
Merge pull request #917 from collett8192/Sapphire5.58_action
minor fixes
This commit is contained in:
commit
1341c53ff2
6 changed files with 38 additions and 29 deletions
|
@ -692,11 +692,11 @@ namespace Sapphire::Common
|
|||
MpLoss = 10,
|
||||
MpGain = 11,
|
||||
TpLoss = 12,
|
||||
TpGain = 13,
|
||||
GpGain = 14,
|
||||
ApplyStatusEffectTarget = 15,
|
||||
ApplyStatusEffectSource = 16, // effect entry on target but buff applies to source, like storm's eye
|
||||
StatusNoEffect = 20, // shifted one up from 5.18
|
||||
//TpGain = 13, // everything below shifted one up since 5.2
|
||||
GpGain = 13,
|
||||
ApplyStatusEffectTarget = 14,
|
||||
ApplyStatusEffectSource = 15, // effect entry on target but buff applies to source, like storm's eye
|
||||
StatusNoEffect = 20,
|
||||
/*!
|
||||
* @brief Tells the client that it should show combo indicators on actions.
|
||||
*
|
||||
|
@ -704,10 +704,10 @@ namespace Sapphire::Common
|
|||
* @param value The actionid that starts/continues the combo. eg, 3617 will start a spinning slash and/or syphon strike combo
|
||||
*/
|
||||
Provoke = 24,
|
||||
StartActionCombo = 27, // shifted one up from 5.18
|
||||
ComboSucceed = 28, // shifted one up from 5.18, on retail this is not seen anymore, still working though.
|
||||
StartActionCombo = 27,
|
||||
ComboSucceed = 28, // two more values inserted between this and Mount since 5.2
|
||||
Knockback = 33,
|
||||
Mount = 40, // shifted one down from 5.18
|
||||
Mount = 40,
|
||||
VFX = 59, // links to VFX sheet
|
||||
};
|
||||
|
||||
|
|
|
@ -504,6 +504,7 @@ void Action::Action::buildEffects()
|
|||
}
|
||||
|
||||
uint8_t victimCounter = 0, validVictimCounter = 0;
|
||||
Entity::CharaPtr firstValidVictim = nullptr;
|
||||
|
||||
for( auto& actor : m_hitActors )
|
||||
{
|
||||
|
@ -576,9 +577,7 @@ void Action::Action::buildEffects()
|
|||
else
|
||||
m_effectBuilder->damage( actor, actor, dmg.first, dmg.second, dmg.first == 0 ? Common::ActionEffectResultFlag::Absorbed : Common::ActionEffectResultFlag::None, getExecutionDelay() + victimCounter * 100 );
|
||||
|
||||
auto reflectDmg = Math::CalcStats::calcDamageReflect( m_pSource, actor, dmg.first,
|
||||
attackType == Common::AttackType::Physical ? Common::ActionTypeFilter::Physical :
|
||||
( attackType == Common::AttackType::Magical ? Common::ActionTypeFilter::Magical : Common::ActionTypeFilter::Unknown ) );
|
||||
auto reflectDmg = Math::CalcStats::calcDamageReflect( m_pSource, actor, dmg.first, getActionTypeFilterFromAttackType( attackType ) );
|
||||
if( reflectDmg.first > 0 )
|
||||
{
|
||||
m_effectBuilder->damage( actor, m_pSource, reflectDmg.first, reflectDmg.second, Common::ActionEffectResultFlag::Reflected, getExecutionDelay() + victimCounter * 100 );
|
||||
|
@ -624,7 +623,7 @@ void Action::Action::buildEffects()
|
|||
}
|
||||
}
|
||||
|
||||
if( validVictimCounter == 0 )
|
||||
if( validVictimCounter == 0 ) // effects only apply once if aoe, on first valid target (can be single target action as well)
|
||||
{
|
||||
if( isCorrectCombo() )
|
||||
m_effectBuilder->comboSucceed( actor );
|
||||
|
@ -697,6 +696,8 @@ void Action::Action::buildEffects()
|
|||
}
|
||||
}
|
||||
}
|
||||
if( validVictimCounter == 0 )
|
||||
firstValidVictim = actor;
|
||||
validVictimCounter++;
|
||||
}
|
||||
}
|
||||
|
@ -718,7 +719,12 @@ void Action::Action::buildEffects()
|
|||
if( m_lutEntry.selfStatus != 0 )
|
||||
{
|
||||
if( !isComboAction() || isCorrectCombo() )
|
||||
m_effectBuilder->applyStatusEffect( m_pSource, m_pSource, m_lutEntry.selfStatus, m_lutEntry.selfStatusDuration, m_lutEntry.selfStatusParam );
|
||||
{
|
||||
if( firstValidVictim )
|
||||
m_effectBuilder->applyStatusEffect( firstValidVictim, m_pSource, m_lutEntry.selfStatus, m_lutEntry.selfStatusDuration, m_lutEntry.selfStatusParam, getExecutionDelay(), true );
|
||||
else
|
||||
m_effectBuilder->applyStatusEffect( m_pSource, m_pSource, m_lutEntry.selfStatus, m_lutEntry.selfStatusDuration, m_lutEntry.selfStatusParam, getExecutionDelay() );
|
||||
}
|
||||
}
|
||||
|
||||
scriptMgr.onBeforeBuildEffect( *this, victimCounter, validVictimCounter );
|
||||
|
|
|
@ -99,17 +99,17 @@ void EffectBuilder::comboSucceed( Entity::CharaPtr& target )
|
|||
moveToResultList( target, nextResult );
|
||||
}
|
||||
|
||||
void EffectBuilder::applyStatusEffect( Entity::CharaPtr& target, Entity::CharaPtr& source, uint16_t statusId, uint32_t duration, uint16_t param, uint64_t resultDelayMs )
|
||||
void EffectBuilder::applyStatusEffect( Entity::CharaPtr& target, Entity::CharaPtr& source, uint16_t statusId, uint32_t duration, uint16_t param, uint64_t resultDelayMs, bool statusToSource )
|
||||
{
|
||||
EffectResultPtr nextResult = make_EffectResult( target, source, Common::Util::getTimeMs() + resultDelayMs );
|
||||
nextResult->applyStatusEffect( statusId, duration, param );
|
||||
nextResult->applyStatusEffect( statusId, duration, param, statusToSource );
|
||||
moveToResultList( target, nextResult );
|
||||
}
|
||||
|
||||
void EffectBuilder::applyStatusEffect( Entity::CharaPtr& target, Entity::CharaPtr& source, StatusEffect::StatusEffectPtr pStatusEffect, uint64_t resultDelayMs )
|
||||
void EffectBuilder::applyStatusEffect( Entity::CharaPtr& target, Entity::CharaPtr& source, StatusEffect::StatusEffectPtr pStatusEffect, uint64_t resultDelayMs, bool statusToSource )
|
||||
{
|
||||
EffectResultPtr nextResult = make_EffectResult( target, source, Common::Util::getTimeMs() + resultDelayMs );
|
||||
nextResult->applyStatusEffect( pStatusEffect );
|
||||
nextResult->applyStatusEffect( pStatusEffect, statusToSource );
|
||||
moveToResultList( target, nextResult );
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ namespace Sapphire::World::Action
|
|||
|
||||
void comboSucceed( Entity::CharaPtr& target );
|
||||
|
||||
void applyStatusEffect( Entity::CharaPtr& target, Entity::CharaPtr& source, uint16_t statusId, uint32_t duration, uint16_t param, uint64_t resultDelayMs = 500 );
|
||||
void applyStatusEffect( Entity::CharaPtr& target, Entity::CharaPtr& source, StatusEffect::StatusEffectPtr pStatusEffect, uint64_t resultDelayMs = 500 );
|
||||
void applyStatusEffect( Entity::CharaPtr& target, Entity::CharaPtr& source, uint16_t statusId, uint32_t duration, uint16_t param, uint64_t resultDelayMs = 500, bool statusToSource = false );
|
||||
void applyStatusEffect( Entity::CharaPtr& target, Entity::CharaPtr& source, StatusEffect::StatusEffectPtr pStatusEffect, uint64_t resultDelayMs = 500, bool statusToSource = false );
|
||||
|
||||
void statusNoEffect( Entity::CharaPtr& target, uint16_t statusId );
|
||||
|
||||
|
|
|
@ -115,22 +115,24 @@ void EffectResult::comboSucceed()
|
|||
m_type = Common::ActionEffectType::ComboSucceed;
|
||||
}
|
||||
|
||||
void EffectResult::applyStatusEffect( uint16_t statusId, uint32_t duration, uint16_t param )
|
||||
void EffectResult::applyStatusEffect( uint16_t statusId, uint32_t duration, uint16_t param, bool statusToSource )
|
||||
{
|
||||
m_value = statusId;
|
||||
m_statusDuration = duration;
|
||||
m_param2 = param;
|
||||
m_flag = statusToSource ? Common::ActionEffectResultFlag::EffectOnSource : Common::ActionEffectResultFlag::None;
|
||||
|
||||
m_type = Common::ActionEffectType::ApplyStatusEffectTarget;
|
||||
m_type = statusToSource ? Common::ActionEffectType::ApplyStatusEffectSource : Common::ActionEffectType::ApplyStatusEffectTarget;
|
||||
}
|
||||
|
||||
void EffectResult::applyStatusEffect( StatusEffect::StatusEffectPtr pStatusEffect )
|
||||
void EffectResult::applyStatusEffect( StatusEffect::StatusEffectPtr pStatusEffect, bool statusToSource )
|
||||
{
|
||||
m_value = pStatusEffect->getId();
|
||||
m_param2 = pStatusEffect->getParam();
|
||||
m_pPreBuiltStatusEffect = std::move( pStatusEffect );
|
||||
m_flag = statusToSource ? Common::ActionEffectResultFlag::EffectOnSource : Common::ActionEffectResultFlag::None;
|
||||
|
||||
m_type = Common::ActionEffectType::ApplyStatusEffectTarget;
|
||||
m_type = statusToSource ? Common::ActionEffectType::ApplyStatusEffectSource : Common::ActionEffectType::ApplyStatusEffectTarget;
|
||||
}
|
||||
|
||||
void EffectResult::statusNoEffect( uint16_t statusId )
|
||||
|
@ -202,8 +204,9 @@ void EffectResult::execute()
|
|||
case Common::ActionEffectType::ApplyStatusEffectTarget:
|
||||
case Common::ActionEffectType::ApplyStatusEffectSource:
|
||||
{
|
||||
auto applyTarget = m_type == Common::ActionEffectType::ApplyStatusEffectTarget ? m_target : m_source;
|
||||
//refreshing old buff
|
||||
for( auto const& entry : m_target->getStatusEffectMap() )
|
||||
for( auto const& entry : applyTarget->getStatusEffectMap() )
|
||||
{
|
||||
auto statusEffect = entry.second;
|
||||
if( statusEffect->getId() == m_value && statusEffect->getSrcActorId() == m_source->getId() )
|
||||
|
@ -216,17 +219,17 @@ void EffectResult::execute()
|
|||
{
|
||||
statusEffect->refresh();
|
||||
}
|
||||
m_target->sendStatusEffectUpdate();
|
||||
applyTarget->sendStatusEffectUpdate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_pPreBuiltStatusEffect )
|
||||
{
|
||||
m_target->addStatusEffect( m_pPreBuiltStatusEffect );
|
||||
applyTarget->addStatusEffect( m_pPreBuiltStatusEffect );
|
||||
}
|
||||
else
|
||||
m_target->addStatusEffectById( m_value, m_statusDuration, *m_source, m_param2 );
|
||||
applyTarget->addStatusEffectById( m_value, m_statusDuration, *m_source, m_param2 );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace Sapphire::World::Action
|
|||
void restoreMP( uint32_t amount, Common::ActionEffectResultFlag flag = Common::ActionEffectResultFlag::None );
|
||||
void startCombo( uint16_t actionId );
|
||||
void comboSucceed();
|
||||
void applyStatusEffect( uint16_t statusId, uint32_t duration, uint16_t param );
|
||||
void applyStatusEffect( StatusEffect::StatusEffectPtr pStatusEffect );
|
||||
void applyStatusEffect( uint16_t statusId, uint32_t duration, uint16_t param, bool statusToSource = false );
|
||||
void applyStatusEffect( StatusEffect::StatusEffectPtr pStatusEffect, bool statusToSource = false );
|
||||
void statusNoEffect( uint16_t statusId );
|
||||
void mount( uint16_t mountId );
|
||||
void provoke();
|
||||
|
|
Loading…
Add table
Reference in a new issue