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:
|
2019-02-09 23:14:30 +11:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
Action();
|
2019-03-07 20:27:45 +11:00
|
|
|
Action( Entity::CharaPtr caster, uint32_t actionId, Data::ActionPtr actionData, 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 );
|
2019-02-10 22:13:47 +11:00
|
|
|
void setResidentTargetId( uint64_t targetId );
|
2018-10-28 21:53:21 +01:00
|
|
|
Entity::CharaPtr getTargetChara() const;
|
2019-02-11 10:14:14 +11:00
|
|
|
Entity::CharaPtr getSourceChara() const;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool isInterrupted() const;
|
2019-02-10 21:21:34 +11:00
|
|
|
void setInterrupted( Common::ActionInterruptType type );
|
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-10 22:13:47 +11:00
|
|
|
/*!
|
|
|
|
* @brief Checks if the action *may* target a resident instead of an actor
|
|
|
|
* @return true if the target *may* be a resident and not an actor, otherwise false.
|
|
|
|
*/
|
|
|
|
bool hasResidentTarget() const;
|
|
|
|
|
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
|
|
|
|
*/
|
2019-02-11 00:40:00 +11:00
|
|
|
bool hasCastTime() const;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-03-07 20:27:45 +11:00
|
|
|
/*!
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
bool precheck();
|
2019-02-09 17:36:44 +11:00
|
|
|
|
2019-02-09 18:32:10 +11:00
|
|
|
/*!
|
2019-03-07 20:27:45 +11:00
|
|
|
* @brief Starts the cast. Finishes it immediately if there is no cast time (weaponskills).
|
2019-02-09 18:32:10 +11:00
|
|
|
*/
|
2019-03-07 20:33:14 +11:00
|
|
|
virtual void start();
|
2019-02-11 10:03:36 +11:00
|
|
|
|
2019-02-09 18:32:10 +11:00
|
|
|
/*!
|
2019-03-07 20:27:45 +11:00
|
|
|
* @brief Finishes the cast, effected targets are calculated here.
|
2019-02-09 18:32:10 +11:00
|
|
|
*/
|
2019-03-07 20:33:14 +11:00
|
|
|
virtual void execute();
|
2019-02-09 17:36:44 +11:00
|
|
|
|
2019-02-11 00:40:00 +11:00
|
|
|
/*!
|
2019-03-07 20:27:45 +11:00
|
|
|
* @brief Called when a cast is interrupted for any reason
|
|
|
|
*
|
|
|
|
* m_interruptType will have the reason why the action was interrupted (eg. damage, movement, ...)
|
2019-02-11 00:40:00 +11:00
|
|
|
*/
|
2019-03-07 20:33:14 +11:00
|
|
|
virtual void interrupt();
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-03-07 20:33:14 +11:00
|
|
|
/*!
|
|
|
|
* @brief Called on each player update tick
|
|
|
|
* @return true if a cast has finished and should be removed from the owning chara
|
|
|
|
*/
|
2018-10-28 21:53:21 +01:00
|
|
|
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 23:14:30 +11:00
|
|
|
void calculateActionCost();
|
2019-03-07 20:27:45 +11:00
|
|
|
void calculateMPCost( uint16_t baseCost );
|
2019-02-09 20:49:22 +11:00
|
|
|
|
2019-03-07 20:27:45 +11:00
|
|
|
bool playerPrecheck( Entity::Player& player );
|
2019-02-09 17:36:44 +11:00
|
|
|
|
|
|
|
uint32_t m_id;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2019-03-07 20:27:45 +11:00
|
|
|
Common::ActionPrimaryCostType m_primaryCostType;
|
|
|
|
uint16_t m_primaryCost;
|
2019-02-09 23:14:30 +11:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint64_t m_startTime;
|
|
|
|
uint32_t m_castTime;
|
2019-02-10 22:13:47 +11:00
|
|
|
uint16_t m_recastTime;
|
2019-02-10 21:01:04 +11:00
|
|
|
uint8_t m_cooldownGroup;
|
2019-02-11 01:50:41 +11:00
|
|
|
int8_t m_range;
|
|
|
|
uint8_t m_effectRange;
|
2019-02-11 10:03:36 +11:00
|
|
|
Common::ActionAspect m_aspect;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2019-03-07 20:27:45 +11: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;
|
2019-02-10 22:13:47 +11:00
|
|
|
bool m_hasResidentTarget;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2019-02-10 21:21:34 +11:00
|
|
|
Common::ActionInterruptType m_interruptType;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-12-29 00:53:52 +01:00
|
|
|
FrameworkPtr m_pFw;
|
2019-03-07 20:27:45 +11:00
|
|
|
Data::ActionPtr m_actionData;
|
2018-12-29 00:53:52 +01:00
|
|
|
|
2019-02-09 18:32:10 +11:00
|
|
|
Common::FFXIVARR_POSITION3 m_pos;
|
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
|