diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index df0bab07..91c1ebed 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -87,6 +87,7 @@ bool Action::Action::init() m_cooldownGroup = m_actionData->data().RecastGroup; m_range = m_actionData->data().SelectRange; 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_aspect = static_cast< Common::ActionAspect >( m_actionData->data().AttackType ); @@ -147,12 +148,12 @@ bool Action::Action::init() return true; } -void Action::Action::setPos( Sapphire::Common::FFXIVARR_POSITION3 pos ) +void Action::Action::setPos( const Sapphire::Common::FFXIVARR_POSITION3& pos ) { m_pos = pos; } -Sapphire::Common::FFXIVARR_POSITION3 Action::Action::getPos() const +const Sapphire::Common::FFXIVARR_POSITION3& Action::Action::getPos() const { return m_pos; } @@ -202,6 +203,16 @@ bool Action::Action::hasCastTime() const 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 { return m_pSource; @@ -419,7 +430,7 @@ void Action::Action::execute() if( isCorrectCombo() ) { auto player = m_pSource->getAsPlayer(); - Manager::PlayerMgr::sendDebug( *player,"action combo success from action#{0}", player->getLastComboActionId() ); + Manager::PlayerMgr::sendDebug( *player, "action combo success from action#{0}", player->getLastComboActionId() ); } if( !hasClientsideTarget() ) @@ -433,7 +444,7 @@ void Action::Action::execute() // set currently casted action as the combo action if it interrupts a combo // 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 if( !m_hitActors.empty() && ( !isComboAction() || isCorrectCombo() ) ) @@ -560,7 +571,7 @@ void Action::Action::buildEffects() 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 } @@ -663,6 +674,7 @@ void Action::Action::setAdditionalData( uint32_t data ) m_additionalData = data; } +// TODO: write something that can traverse comboparent in action parse bool Action::Action::isCorrectCombo() const { auto lastActionId = m_pSource->getLastComboActionId(); diff --git a/src/world/Action/Action.h b/src/world/Action/Action.h index fd5d0190..d5d4999d 100644 --- a/src/world/Action/Action.h +++ b/src/world/Action/Action.h @@ -25,8 +25,8 @@ namespace Sapphire::World::Action bool init(); - void setPos( Common::FFXIVARR_POSITION3 pos ); - Common::FFXIVARR_POSITION3 getPos() const; + void setPos( const Common::FFXIVARR_POSITION3& pos ); + const Common::FFXIVARR_POSITION3& getPos() const; void setTargetId( uint64_t targetId ); uint64_t getTargetId() const; @@ -75,6 +75,18 @@ namespace Sapphire::World::Action */ 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 * @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; Common::ActionAspect m_aspect; Common::CastType m_castType; + Common::ActionCategory m_category; uint32_t m_additionalData;