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