CommonLibSSE (powerof3)
ActiveEffect.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "RE/B/BSContainer.h"
5 #include "RE/B/BSFixedString.h"
6 #include "RE/B/BSPointerHandle.h"
7 #include "RE/B/BSSoundHandle.h"
8 #include "RE/B/BSTList.h"
9 #include "RE/M/MagicSystem.h"
10 #include "RE/N/NiSmartPointer.h"
11 
12 namespace RE
13 {
14  class Actor;
15  class BGSLoadFormBuffer;
16  class BGSSaveFormBuffer;
17  class EffectSetting;
18  class MagicItem;
19  class MagicTarget;
20  class NiNode;
21  class NiPoint3;
22  class ReferenceEffect;
23  class TESBoundObject;
24  struct Effect;
25 
27  {
28  public:
29  inline static constexpr auto RTTI = RTTI_ActiveEffect;
30  inline static constexpr auto VTABLE = VTABLE_ActiveEffect;
31  inline static constexpr auto VMTYPEID = static_cast<VMTypeID>(142);
32 
34  {
35  public:
36  inline static constexpr auto RTTI = RTTI_ActiveEffect__ForEachHitEffectVisitor;
37  inline static constexpr auto VTABLE = VTABLE_ActiveEffect__ForEachHitEffectVisitor;
38 
39  virtual ~ForEachHitEffectVisitor(); // 00
40 
41  // add
42  virtual BSContainer::ForEachResult operator()(ReferenceEffect* a_hitEffect) = 0; // 01
43  };
44 
45  enum class Flag
46  {
47  kHasConditions = 1 << 7,
48  kEnchanting = 1 << 8,
49  kRecovers = 1 << 9,
50  kDual = 1 << 12,
51  kInactive = 1 << 15,
52  kDispelled = 1 << 18
53  };
54 
55  enum class ConditionStatus
56  {
57  kNA = static_cast<std::underlying_type_t<ConditionStatus>>(-1),
58  kFalse = 0,
59  kTrue = 1,
60  };
61 
62  // add
63  virtual void AdjustForPerks(Actor* a_caster, MagicTarget* a_target); // 00
64  virtual void OnAdd(MagicTarget* a_target); // 01
65  virtual void OnRemove(); // 02 - { return; }
66  virtual TESObjectREFR* GetVisualsTarget(); // 03 - { return target ? target->GetTargetStatsObject() : 0; }
67  virtual void Update(float a_delta); // 04 - { return; }
68  virtual void EvaluateConditions(float a_delta, bool a_forceUpdate); // 05
69  virtual bool IsCausingHealthDamage(); // 06 - { return 0; }
70  virtual void SetLocation(const NiPoint3& a_location); // 07 - { return; }
71  virtual void SaveGame(BGSSaveFormBuffer* a_buf); // 08
72  virtual void LoadGame(BGSLoadFormBuffer* a_buf); // 09
73  virtual void FinishLoadGame(BGSLoadFormBuffer* a_buf); // 0A
74  virtual void Revert(BGSLoadFormBuffer* a_buf); // 0B - { castingSource = 4; }
75  virtual std::int32_t Compare(ActiveEffect* a_otherEffect); // 0C
76  virtual void HandleEvent(const BSFixedString& a_eventName); // 0D - { return; }
77  virtual void SwitchAttachedRoot(NiNode* a_root, NiNode* a_attachRoot); // 0E - { return; }
78  virtual void HandleQueuedStart(); // 0F - { return; }
79  virtual bool ShouldDispelOnDeath() const; // 10 - { return effect->baseEffect->data.flags.any(EffectSetting::EffectSettingData::Flag::kNoDeathDispel); }
80  virtual bool GetAllowMultipleCastingSourceStacking(); // 11 - { return 0; }
81  virtual void ClearTargetImpl(); // 12 - { return; }
82 
83  virtual ~ActiveEffect(); // 13
84 
85  virtual void Start(); // 14 - { return; }
86  virtual void Finish(); // 15 - { return; }
87  virtual bool CanFinish(); // 16
88  virtual bool CheckCustomSkillUseConditions() const; // 17 - { return 1; }
89  virtual float GetCustomSkillUseMagnitudeMultiplier(float a_mult) const; // 18 - { return 1.0; }
90 
91  void Dispel(bool a_force);
92  [[nodiscard]] EffectSetting* GetBaseObject() noexcept;
93  [[nodiscard]] const EffectSetting* GetBaseObject() const noexcept;
95  float GetMagnitude() const;
97  const Actor* GetTargetActor() const;
98 
103  MagicItem* spell; // 40
104  Effect* effect; // 48
109  float elapsedSeconds; // 70
110  float duration; // 74
111  float magnitude; // 78
112  REX::EnumSet<Flag, std::uint32_t> flags; // 7C
114  std::uint16_t usUniqueID; // 84
115  std::uint16_t pad86; // 86
116  MagicSystem::CastingSource castingSource; // 88
117  std::uint32_t pad8C; // 8C
118  };
119  static_assert(sizeof(ActiveEffect) == 0x90);
120 }
Definition: ActiveEffectReferenceEffectController.h:12
Definition: ActiveEffect.h:34
static constexpr auto VTABLE
Definition: ActiveEffect.h:37
virtual BSContainer::ForEachResult operator()(ReferenceEffect *a_hitEffect)=0
static constexpr auto RTTI
Definition: ActiveEffect.h:36
Definition: ActiveEffect.h:27
virtual void EvaluateConditions(float a_delta, bool a_forceUpdate)
float elapsedSeconds
Definition: ActiveEffect.h:109
static constexpr auto VMTYPEID
Definition: ActiveEffect.h:31
virtual void ClearTargetImpl()
virtual bool IsCausingHealthDamage()
MagicItem * spell
Definition: ActiveEffect.h:103
ConditionStatus
Definition: ActiveEffect.h:56
BSSoundHandle persistentSound
Definition: ActiveEffect.h:100
virtual void LoadGame(BGSLoadFormBuffer *a_buf)
std::uint16_t usUniqueID
Definition: ActiveEffect.h:114
static constexpr auto RTTI
Definition: ActiveEffect.h:29
REX::EnumSet< Flag, std::uint32_t > flags
Definition: ActiveEffect.h:112
static constexpr auto VTABLE
Definition: ActiveEffect.h:30
NiPointer< NiNode > sourceNode
Definition: ActiveEffect.h:102
ActiveEffectReferenceEffectController hitEffectController
Definition: ActiveEffect.h:99
virtual void AdjustForPerks(Actor *a_caster, MagicTarget *a_target)
virtual void OnAdd(MagicTarget *a_target)
virtual ~ActiveEffect()
virtual void SwitchAttachedRoot(NiNode *a_root, NiNode *a_attachRoot)
NiPointer< Actor > GetCasterActor() const
EffectSetting * GetBaseObject() noexcept
virtual void Finish()
float GetMagnitude() const
virtual bool CanFinish()
REX::EnumSet< ConditionStatus, std::uint32_t > conditionStatus
Definition: ActiveEffect.h:113
virtual bool GetAllowMultipleCastingSourceStacking()
void Dispel(bool a_force)
MagicTarget * target
Definition: ActiveEffect.h:105
std::uint32_t pad8C
Definition: ActiveEffect.h:117
Effect * effect
Definition: ActiveEffect.h:104
std::uint16_t pad86
Definition: ActiveEffect.h:115
Actor * GetTargetActor()
Flag
Definition: ActiveEffect.h:46
float duration
Definition: ActiveEffect.h:110
virtual bool ShouldDispelOnDeath() const
virtual std::int32_t Compare(ActiveEffect *a_otherEffect)
virtual void SaveGame(BGSSaveFormBuffer *a_buf)
BSSimpleList< ReferenceEffect * > * hitEffects
Definition: ActiveEffect.h:107
virtual void HandleQueuedStart()
virtual float GetCustomSkillUseMagnitudeMultiplier(float a_mult) const
virtual void OnRemove()
virtual void Revert(BGSLoadFormBuffer *a_buf)
MagicItem * displacementSpell
Definition: ActiveEffect.h:108
float magnitude
Definition: ActiveEffect.h:111
virtual void Update(float a_delta)
MagicSystem::CastingSource castingSource
Definition: ActiveEffect.h:116
virtual TESObjectREFR * GetVisualsTarget()
ActorHandle caster
Definition: ActiveEffect.h:101
TESBoundObject * source
Definition: ActiveEffect.h:106
virtual void FinishLoadGame(BGSLoadFormBuffer *a_buf)
virtual bool CheckCustomSkillUseConditions() const
virtual void Start()
virtual void SetLocation(const NiPoint3 &a_location)
virtual void HandleEvent(const BSFixedString &a_eventName)
Definition: Actor.h:133
Definition: BGSLoadFormBuffer.h:11
Definition: BGSSaveFormBuffer.h:8
Definition: BSTList.h:10
Definition: EffectSetting.h:24
Definition: MagicItem.h:30
Definition: MagicTarget.h:25
Definition: NiNode.h:12
Definition: NiPoint3.h:6
Definition: NiSmartPointer.h:9
Definition: ReferenceEffect.h:12
Definition: TESBoundObject.h:24
Definition: TESObjectREFR.h:114
Definition: BSDirectInputManager.h:8
EnumSet(Args...) -> EnumSet< std::common_type_t< Args... >, std::underlying_type_t< std::common_type_t< Args... >>>
ForEachResult
Definition: BSContainer.h:6
CastingSource
Definition: MagicSystem.h:27
Definition: AbsorbEffect.h:6
std::uint32_t VMTypeID
Definition: BSCoreTypes.h:9
constexpr std::array< REL::ID, 1 > VTABLE_ActiveEffect
Definition: Offsets_VTABLE.h:7360
constexpr std::array< REL::ID, 1 > VTABLE_ActiveEffect__ForEachHitEffectVisitor
Definition: Offsets_VTABLE.h:7362
constexpr REL::ID RTTI_ActiveEffect(static_cast< std::uint64_t >(514042))
constexpr REL::ID RTTI_ActiveEffect__ForEachHitEffectVisitor(static_cast< std::uint64_t >(686475))
Definition: EffectArchetypes.h:65
Definition: BSSoundHandle.h:10
Definition: Effect.h:11