1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-29 07:37:45 +00:00

some ogcd checks;

This commit is contained in:
Alice Ogeda 2022-01-20 17:39:22 -03:00
parent 3f6f31b848
commit 24708040d0
2 changed files with 32 additions and 7 deletions

View file

@ -87,6 +87,7 @@ bool Action::Action::init()
m_cooldownGroup = m_actionData->data().RecastGroup; m_cooldownGroup = m_actionData->data().RecastGroup;
m_range = m_actionData->data().SelectRange; m_range = m_actionData->data().SelectRange;
m_effectRange = m_actionData->data().EffectRange; m_effectRange = m_actionData->data().EffectRange;
m_category = static_cast< Common::ActionCategory >( m_actionData->data().Category );
m_castType = static_cast< Common::CastType >( m_actionData->data().EffectType ); m_castType = static_cast< Common::CastType >( m_actionData->data().EffectType );
m_aspect = static_cast< Common::ActionAspect >( m_actionData->data().AttackType ); m_aspect = static_cast< Common::ActionAspect >( m_actionData->data().AttackType );
@ -147,12 +148,12 @@ bool Action::Action::init()
return true; return true;
} }
void Action::Action::setPos( Sapphire::Common::FFXIVARR_POSITION3 pos ) void Action::Action::setPos( const Sapphire::Common::FFXIVARR_POSITION3& pos )
{ {
m_pos = pos; m_pos = pos;
} }
Sapphire::Common::FFXIVARR_POSITION3 Action::Action::getPos() const const Sapphire::Common::FFXIVARR_POSITION3& Action::Action::getPos() const
{ {
return m_pos; return m_pos;
} }
@ -202,6 +203,16 @@ bool Action::Action::hasCastTime() const
return m_castTimeMs > 0; return m_castTimeMs > 0;
} }
bool Action::Action::isAbility() const
{
return m_category == ActionCategory::Ability;
}
bool Action::Action::isWeaponskill() const
{
return m_category == ActionCategory::Weaponskill;
}
Sapphire::Entity::CharaPtr Action::Action::getSourceChara() const Sapphire::Entity::CharaPtr Action::Action::getSourceChara() const
{ {
return m_pSource; return m_pSource;
@ -433,7 +444,7 @@ void Action::Action::execute()
// set currently casted action as the combo action if it interrupts a combo // set currently casted action as the combo action if it interrupts a combo
// ignore it otherwise (ogcds, etc.) // ignore it otherwise (ogcds, etc.)
if( !m_actionData->data().ComboContinue ) if( isWeaponskill() && !m_actionData->data().ComboContinue )
{ {
// potential combo starter or correct combo from last action, must hit something to progress combo // potential combo starter or correct combo from last action, must hit something to progress combo
if( !m_hitActors.empty() && ( !isComboAction() || isCorrectCombo() ) ) if( !m_hitActors.empty() && ( !isComboAction() || isCorrectCombo() ) )
@ -560,7 +571,7 @@ void Action::Action::buildEffects()
shouldRestoreMP = false; shouldRestoreMP = false;
} }
if( !m_actionData->data().ComboContinue ) // we need something like m_actionData->hasNextComboAction if( isWeaponskill() && !m_actionData->data().ComboContinue ) // we need something like m_actionData->hasNextComboAction
{ {
m_effectBuilder->startCombo( m_pSource, getId() ); // this is on all targets hit m_effectBuilder->startCombo( m_pSource, getId() ); // this is on all targets hit
} }
@ -663,6 +674,7 @@ void Action::Action::setAdditionalData( uint32_t data )
m_additionalData = data; m_additionalData = data;
} }
// TODO: write something that can traverse comboparent in action parse
bool Action::Action::isCorrectCombo() const bool Action::Action::isCorrectCombo() const
{ {
auto lastActionId = m_pSource->getLastComboActionId(); auto lastActionId = m_pSource->getLastComboActionId();

View file

@ -25,8 +25,8 @@ namespace Sapphire::World::Action
bool init(); bool init();
void setPos( Common::FFXIVARR_POSITION3 pos ); void setPos( const Common::FFXIVARR_POSITION3& pos );
Common::FFXIVARR_POSITION3 getPos() const; const Common::FFXIVARR_POSITION3& getPos() const;
void setTargetId( uint64_t targetId ); void setTargetId( uint64_t targetId );
uint64_t getTargetId() const; uint64_t getTargetId() const;
@ -75,6 +75,18 @@ namespace Sapphire::World::Action
*/ */
bool hasCastTime() const; bool hasCastTime() const;
/*!
* @brief Tests whether the action is an ability/oGCD
* @return true if action is an ability
*/
bool isAbility() const;
/*!
* @brief Tests whether the action is a weaponskill
* @return true if action is an weaponskill
*/
bool isWeaponskill() const;
/*! /*!
* @brief Tests if an action is castable by the current source chara * @brief Tests if an action is castable by the current source chara
* @return true if castable, false if the caster doesn't meet the requirements * @return true if castable, false if the caster doesn't meet the requirements
@ -172,6 +184,7 @@ namespace Sapphire::World::Action
uint8_t m_xAxisModifier; uint8_t m_xAxisModifier;
Common::ActionAspect m_aspect; Common::ActionAspect m_aspect;
Common::CastType m_castType; Common::CastType m_castType;
Common::ActionCategory m_category;
uint32_t m_additionalData; uint32_t m_additionalData;