2017-08-08 13:53:47 +02:00
|
|
|
#ifndef _ACTION_H_
|
|
|
|
#define _ACTION_H_
|
|
|
|
|
2018-03-06 22:22:19 +01:00
|
|
|
#include <Common.h>
|
2018-09-24 23:48:42 +02:00
|
|
|
#include "ForwardsZone.h"
|
2019-02-09 19:43:30 +11:00
|
|
|
#include <array>
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-02-09 15:39:05 +11:00
|
|
|
namespace Sapphire::Data
|
|
|
|
{
|
|
|
|
struct Action;
|
|
|
|
using ActionPtr = std::shared_ptr< Action >;
|
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
namespace Sapphire::Action
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
class Action
|
|
|
|
{
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
public:
|
|
|
|
Action();
|
2019-02-09 15:39:05 +11:00
|
|
|
Action( Entity::CharaPtr caster, uint32_t actionId, Data::ActionPtr action, FrameworkPtr fw );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
virtual ~Action();
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-02-09 15:39:05 +11:00
|
|
|
uint32_t getId() const;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-02-09 18:32:10 +11:00
|
|
|
void setPos( Common::FFXIVARR_POSITION3 pos );
|
|
|
|
Common::FFXIVARR_POSITION3 getPos() const;
|
|
|
|
|
2019-02-09 15:39:05 +11:00
|
|
|
void setTargetChara( Entity::CharaPtr chara );
|
2018-10-28 21:53:21 +01:00
|
|
|
Entity::CharaPtr getTargetChara() const;
|
2019-02-08 22:09:48 +11:00
|
|
|
Entity::CharaPtr getActionSource() const;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool isInterrupted() const;
|
|
|
|
void setInterrupted();
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint32_t getCastTime() const;
|
|
|
|
void setCastTime( uint32_t castTime );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-02-08 22:09:48 +11:00
|
|
|
/*!
|
|
|
|
* @brief Tests whether the action is instantly usable or has a cast assoc'd with it
|
|
|
|
* @return true if action has a cast time
|
|
|
|
*/
|
|
|
|
bool isCastedAction() const;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-02-09 18:32:10 +11:00
|
|
|
/*!
|
|
|
|
* @brief Starts the cast. Finishes it immediately if there is no cast time (weaponskills).
|
|
|
|
*/
|
2019-02-08 22:09:48 +11:00
|
|
|
void start();
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-02-09 17:36:44 +11:00
|
|
|
void buildEffectPacket();
|
|
|
|
|
2019-02-09 18:32:10 +11:00
|
|
|
/*!
|
|
|
|
* @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
|
|
|
|
*/
|
2019-02-09 17:36:44 +11:00
|
|
|
void damageTarget( uint32_t amount, Entity::Chara& chara, Common::ActionAspect aspect = Common::ActionAspect::Unaspected );
|
2019-02-09 18:32:10 +11:00
|
|
|
/*!
|
|
|
|
* @brief Heals a target and adds the effect entry
|
|
|
|
* @param amount Amount of healing to apply
|
|
|
|
* @param chara Chara to receive healing
|
|
|
|
*/
|
2019-02-09 17:36:44 +11:00
|
|
|
void healTarget( uint32_t amount, Entity::Chara& chara );
|
|
|
|
|
2019-02-08 22:09:48 +11:00
|
|
|
virtual void onStart();
|
|
|
|
virtual void onFinish();
|
|
|
|
virtual void onInterrupt();
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
// update action, if returns true, action is done and has to be removed from the actor
|
|
|
|
virtual bool update();
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
protected:
|
2019-02-09 15:39:05 +11:00
|
|
|
|
2019-02-09 17:36:44 +11:00
|
|
|
/*!
|
|
|
|
* @brief Some actions are capable of both healing and dealing damage. This identifies them.
|
|
|
|
*/
|
|
|
|
enum EffectPacketIdentity : uint8_t
|
|
|
|
{
|
|
|
|
DamageEffect,
|
|
|
|
HealingEffect,
|
|
|
|
|
|
|
|
MAX_ACTION_EFFECT_PACKET_IDENT
|
|
|
|
};
|
|
|
|
|
|
|
|
struct EffectPacketData
|
|
|
|
{
|
|
|
|
std::vector< Common::EffectEntry > m_entries;
|
|
|
|
std::vector< uint32_t > m_hitActors;
|
|
|
|
};
|
|
|
|
|
|
|
|
uint32_t m_id;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2019-02-09 18:01:39 +11:00
|
|
|
Common::ActionCostType m_costType;
|
|
|
|
uint16_t m_cost;
|
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint64_t m_startTime;
|
|
|
|
uint32_t m_castTime;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
Entity::CharaPtr m_pSource;
|
|
|
|
Entity::CharaPtr m_pTarget;
|
2019-02-09 15:39:05 +11:00
|
|
|
uint64_t m_targetId;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool m_bInterrupt;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-12-29 00:53:52 +01:00
|
|
|
FrameworkPtr m_pFw;
|
|
|
|
|
2019-02-09 18:32:10 +11:00
|
|
|
Common::FFXIVARR_POSITION3 m_pos;
|
|
|
|
|
2019-02-09 17:36:44 +11:00
|
|
|
std::array< EffectPacketData, MAX_ACTION_EFFECT_PACKET_IDENT > m_effects;
|
2018-10-28 21:53:21 +01:00
|
|
|
};
|
2017-08-08 13:53:47 +02:00
|
|
|
}
|
|
|
|
|
2017-12-08 15:38:25 +01:00
|
|
|
#endif
|