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