1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00
sapphire/src/world/Action/ActionResultBuilder.h

54 lines
2.4 KiB
C
Raw Normal View History

#pragma once
2019-07-25 22:46:10 +10:00
#include <ForwardsZone.h>
#include <Common.h>
[3.x] WIP: Initial Action and StatusEffect implementation (#958) * Check statuses to determine valid lut entry * Add duration field to statuses * Rename buildEffects to make more sense * Add basic generic handler for applying statuseffects * Add more modifiers * Add basic modifier impl for Chara * Apply/remove modifiers for statuseffects * Add some example statuses to lut * Fix windows build error * Don't clear tick effect * Add status entry for Maim * Apply status effects properly for self when having a target * Fix hasStatusEffect to prevent duplicates * Basic dot/hot ticks implemented * Update HP on tick effects * Apply effect to correct target * Add method to simplify applying statuses to self * Add job actions for warrior * Add some actions and statuses for war * Add even more modifiers * Add statuseffect cost type * Add option to not send statusremove order * Change delModifier assert to return early instead * Add option for scripts to enable the generic/lut handler * Add enums for common action values * fix indentation * Fix modifier name for Defiance * Remove status tick logging * Move modifiers to statuseffect * Add ParryPercent modifier * Remove wrath when Defiance ends * Apply modifiers in applyStatus * Remove unused method * Persistence for cross-class skills * Add flags to StatusEffects * Some exd struct fixes * Some aoe work * Add flags to lut * Add missing changeclass * Add SET_STATUS_ME to ActionIntegrity * Improve offensive action check * Add flag to overloaded applyStatusEffectSelf * indentation fix * Some calculation work * Null-check ActionResultBuilder --------- Co-authored-by: Lucy <44952533+Skyliegirl33@users.noreply.github.com> Co-authored-by: Mordred <30826167+SapphireMordred@users.noreply.github.com>
2024-06-21 04:27:01 +02:00
#include "ActionLut.h"
2019-07-25 22:46:10 +10:00
namespace Sapphire::World::Action
{
class ActionResultBuilder
2019-07-25 22:46:10 +10:00
{
public:
ActionResultBuilder( Entity::CharaPtr source, uint32_t actionId, uint32_t resultId, uint16_t requestId );
2019-07-25 22:46:10 +10:00
2020-01-05 20:49:50 +09:00
void heal( Entity::CharaPtr& effectTarget, Entity::CharaPtr& healingTarget, uint32_t amount,
2023-03-15 15:21:03 +01:00
Common::CalcResultType hitType = Common::CalcResultType::TypeRecoverMp,
Common::ActionResultFlag flag = Common::ActionResultFlag::None );
2019-07-25 22:46:10 +10:00
2020-01-05 20:49:50 +09:00
void restoreMP( Entity::CharaPtr& effectTarget, Entity::CharaPtr& restoringTarget, uint32_t amount,
Common::ActionResultFlag flag = Common::ActionResultFlag::None );
2019-07-25 22:46:10 +10:00
2020-01-05 20:49:50 +09:00
void damage( Entity::CharaPtr& effectTarget, Entity::CharaPtr& damagingTarget, uint32_t amount,
2023-03-15 15:21:03 +01:00
Common::CalcResultType hitType = Common::CalcResultType::TypeDamageHp,
Common::ActionResultFlag flag = Common::ActionResultFlag::None );
2019-07-25 22:46:10 +10:00
2020-01-05 17:09:27 +09:00
void startCombo( Entity::CharaPtr& target, uint16_t actionId );
2020-01-05 20:49:50 +09:00
void comboSucceed( Entity::CharaPtr& target );
2020-01-05 17:09:27 +09:00
[3.x] WIP: Initial Action and StatusEffect implementation (#958) * Check statuses to determine valid lut entry * Add duration field to statuses * Rename buildEffects to make more sense * Add basic generic handler for applying statuseffects * Add more modifiers * Add basic modifier impl for Chara * Apply/remove modifiers for statuseffects * Add some example statuses to lut * Fix windows build error * Don't clear tick effect * Add status entry for Maim * Apply status effects properly for self when having a target * Fix hasStatusEffect to prevent duplicates * Basic dot/hot ticks implemented * Update HP on tick effects * Apply effect to correct target * Add method to simplify applying statuses to self * Add job actions for warrior * Add some actions and statuses for war * Add even more modifiers * Add statuseffect cost type * Add option to not send statusremove order * Change delModifier assert to return early instead * Add option for scripts to enable the generic/lut handler * Add enums for common action values * fix indentation * Fix modifier name for Defiance * Remove status tick logging * Move modifiers to statuseffect * Add ParryPercent modifier * Remove wrath when Defiance ends * Apply modifiers in applyStatus * Remove unused method * Persistence for cross-class skills * Add flags to StatusEffects * Some exd struct fixes * Some aoe work * Add flags to lut * Add missing changeclass * Add SET_STATUS_ME to ActionIntegrity * Improve offensive action check * Add flag to overloaded applyStatusEffectSelf * indentation fix * Some calculation work * Null-check ActionResultBuilder --------- Co-authored-by: Lucy <44952533+Skyliegirl33@users.noreply.github.com> Co-authored-by: Mordred <30826167+SapphireMordred@users.noreply.github.com>
2024-06-21 04:27:01 +02:00
void applyStatusEffect( Entity::CharaPtr& target, uint16_t statusId, uint32_t duration, uint8_t param, bool shouldOverride = false );
void applyStatusEffect( Entity::CharaPtr& target, uint16_t statusId, uint32_t duration, uint8_t param,
std::vector< World::Action::StatusModifier > modifiers, uint32_t flag = 0, bool shouldOverride = false );
void applyStatusEffectSelf( uint16_t statusId, uint32_t duration, uint8_t param, bool shouldOverride = false );
void applyStatusEffectSelf( uint16_t statusId, uint32_t duration, uint8_t param, std::vector< World::Action::StatusModifier > modifiers,
uint32_t flag = 0, bool shouldOverride = false );
2020-01-06 19:25:01 +09:00
2020-01-23 22:36:01 +09:00
void mount( Entity::CharaPtr& target, uint16_t mountId );
void sendActionResults( const std::vector< Entity::CharaPtr >& targetList );
2019-07-25 22:46:10 +10:00
private:
void addResultToActor( Entity::CharaPtr& chara, ActionResultPtr result );
2019-07-25 22:46:10 +10:00
Network::Packets::FFXIVPacketBasePtr createActionResultPacket( const std::vector< Entity::CharaPtr >& targetList );
2020-01-05 17:09:27 +09:00
2019-07-26 20:28:01 +10:00
private:
2019-07-25 22:46:10 +10:00
uint32_t m_actionId;
uint16_t m_requestId;
uint32_t m_resultId;
2019-07-25 22:46:10 +10:00
2019-07-26 20:28:01 +10:00
Entity::CharaPtr m_sourceChara;
std::unordered_map< Entity::CharaPtr, std::vector< ActionResultPtr > > m_actorResultsMap;
2019-07-25 22:46:10 +10:00
};
}