From 6a88a6e6940d1ce56975f182b185cc8b604a08b9 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sat, 9 Feb 2019 18:32:10 +1100 Subject: [PATCH] fix actions being interrupted incorrectly --- src/world/Action/Action.cpp | 13 ++++++++++++- src/world/Action/Action.h | 19 +++++++++++++++++++ src/world/Manager/ActionMgr.cpp | 3 +++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index 80bcded9..27a5ff78 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -27,7 +27,8 @@ Sapphire::Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, m_pSource( std::move( caster ) ), m_pFw( std::move( fw ) ), m_id( actionId ), - m_startTime( 0 ) + m_startTime( 0 ), + m_bInterrupt( false ) { m_castTime = static_cast< uint32_t >( action->cast100ms ) * 100; @@ -50,6 +51,16 @@ void Sapphire::Action::Action::setType( Sapphire::Common::HandleActionType type m_type = type; } +void Sapphire::Action::Action::setPos( Sapphire::Common::FFXIVARR_POSITION3 pos ) +{ + m_pos = pos; +} + +Sapphire::Common::FFXIVARR_POSITION3 Sapphire::Action::Action::getPos() const +{ + return m_pos; +} + void Sapphire::Action::Action::setTargetChara( Sapphire::Entity::CharaPtr chara ) { assert( chara ); diff --git a/src/world/Action/Action.h b/src/world/Action/Action.h index dea371ec..e78e89fe 100644 --- a/src/world/Action/Action.h +++ b/src/world/Action/Action.h @@ -27,6 +27,9 @@ namespace Sapphire::Action Common::HandleActionType getType() const; void setType( Common::HandleActionType type ); + void setPos( Common::FFXIVARR_POSITION3 pos ); + Common::FFXIVARR_POSITION3 getPos() const; + void setTargetChara( Entity::CharaPtr chara ); Entity::CharaPtr getTargetChara() const; Entity::CharaPtr getActionSource() const; @@ -43,11 +46,25 @@ namespace Sapphire::Action */ bool isCastedAction() const; + /*! + * @brief Starts the cast. Finishes it immediately if there is no cast time (weaponskills). + */ void start(); void buildEffectPacket(); + /*! + * @brief Damages a target and adds the effect entry + * @param amount The amount of damage the target takes + * @param chara The chara to inflict damage upon + * @param aspect The aspect of the damage + */ void damageTarget( uint32_t amount, Entity::Chara& chara, Common::ActionAspect aspect = Common::ActionAspect::Unaspected ); + /*! + * @brief Heals a target and adds the effect entry + * @param amount Amount of healing to apply + * @param chara Chara to receive healing + */ void healTarget( uint32_t amount, Entity::Chara& chara ); virtual void onStart(); @@ -93,6 +110,8 @@ namespace Sapphire::Action FrameworkPtr m_pFw; + Common::FFXIVARR_POSITION3 m_pos; + std::array< EffectPacketData, MAX_ACTION_EFFECT_PACKET_IDENT > m_effects; }; } diff --git a/src/world/Manager/ActionMgr.cpp b/src/world/Manager/ActionMgr.cpp index 844b93ea..03d0a1da 100644 --- a/src/world/Manager/ActionMgr.cpp +++ b/src/world/Manager/ActionMgr.cpp @@ -24,6 +24,9 @@ void World::Manager::ActionMgr::handleAoEPlayerAction( Entity::Player& player, u auto action = Action::make_Action( player.getAsPlayer(), actionId, actionData, framework() ); action->setType( static_cast< Common::HandleActionType >( type ) ); + action->setPos( pos ); + + bootstrapAction( player, action, *actionData ); } void World::Manager::ActionMgr::handleTargetedPlayerAction( Entity::Player& player, uint8_t type,