LeviLamina
Loading...
Searching...
No Matches
MobEffect.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/container/DenseEnumMap.h"
7#include "mc/deps/core/math/Color.h"
8#include "mc/deps/core/string/HashedString.h"
9#include "mc/deps/shared_types/legacy/LevelSoundEvent.h"
10#include "mc/world/effect/MobEffectIds.h"
11
12// auto generated forward declare list
13// clang-format off
14class Actor;
16class Amplifier;
17class Attribute;
18class AttributeBuff;
21class BaseGameVersion;
22class Experiments;
24struct EffectDuration;
25// clang-format on
26
27class MobEffect {
28public:
29 // MobEffect inner types declare
30 // clang-format off
32 // clang-format on
33
34 // MobEffect inner types define
36 public:
37 // member variables
38 // NOLINTBEGIN
39 ::ll::TypedStorage<4, 4, int> mPaddingDuration;
40 ::ll::TypedStorage<4, 4, float> mFactorStart;
41 ::ll::TypedStorage<4, 4, float> mFactorTarget;
42 ::ll::TypedStorage<4, 4, float> mFactorCurrent;
43 ::ll::TypedStorage<8, 64, ::std::function<void(::MobEffect::FactorCalculationData&, ::EffectDuration)>>
44 mUpdateFn;
45 ::ll::TypedStorage<4, 4, int> mTicksActive;
46 ::ll::TypedStorage<4, 4, float> mFactorPreviousFrame;
47 ::ll::TypedStorage<1, 1, bool> mHadEffectLastTick;
48 ::ll::TypedStorage<1, 1, bool> mHadApplied;
49 // NOLINTEND
50 };
51
52 using AttributeBuffPair = ::std::pair<::Attribute const*, ::std::shared_ptr<::AttributeBuff>>;
53
54 using AttributeModPair = ::std::pair<::Attribute const*, ::std::shared_ptr<::AttributeModifier>>;
55
56public:
57 // member variables
58 // NOLINTBEGIN
59 ::ll::TypedStorage<4, 4, uint const> mId;
60 ::ll::TypedStorage<1, 1, bool> mIsHarmful;
61 ::ll::TypedStorage<4, 16, ::mce::Color> mColor;
62 ::ll::TypedStorage<8, 48, ::HashedString> mParticleEffectId;
63 ::ll::TypedStorage<8, 48, ::HashedString> mParticleEffectAmbientId;
64 ::ll::TypedStorage<8, 32, ::std::string> mDescriptionId;
65 ::ll::TypedStorage<4, 4, int> mIcon;
66 ::ll::TypedStorage<4, 4, float> mDurationModifier;
67 ::ll::TypedStorage<1, 1, bool> mIsDisabled;
68 ::ll::TypedStorage<8, 32, ::std::string> mResourceName;
69 ::ll::TypedStorage<8, 32, ::std::string> mIconName;
70 ::ll::TypedStorage<1, 1, bool> mEffectVisible;
71 ::ll::TypedStorage<4, 8, ::std::optional<::SharedTypes::Legacy::LevelSoundEvent>> mOnApplySound;
72 ::ll::TypedStorage<8, 48, ::HashedString> mComponentName;
73 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::Amplifier>> mValueAmplifier;
74 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::Amplifier>> mDurationAmplifier;
75 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<::Attribute const*, ::std::shared_ptr<::AttributeBuff>>>>
76 mAttributeBuffs;
77 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<::Attribute const*, ::std::shared_ptr<::AttributeModifier>>>>
78 mAttributeModifiers;
79 ::ll::TypedStorage<8, 96, ::MobEffect::FactorCalculationData> mFactorCalculationData;
80 // NOLINTEND
81
82public:
83 // prevent constructor by default
84 MobEffect();
85
86public:
87 // virtual functions
88 // NOLINTBEGIN
89#ifdef LL_PLAT_S
90 virtual ~MobEffect() = default;
91#else // LL_PLAT_C
92 virtual ~MobEffect();
93#endif
94
95 virtual void applyEffects(::Actor& target, ::EffectDuration durationTicks, int amplification) const;
96
97 virtual void removeEffects(::BaseAttributeMap& attributeMapToRemoveFrom) const;
98
99 virtual void onEffectExpired(::Actor& target) const;
100
101 virtual void onActorDied(::Actor& target, int amplifier) const;
102
103 virtual void onActorHurt(::Actor& target, int amplifier, ::ActorDamageSource const& source, float damage) const;
104
105 virtual void
106 applyInstantaneousEffect(::Actor* source, ::Actor* owner, ::Actor* target, int amplification, float scale) const;
107
108 virtual bool isInstantaneous() const;
109
110 virtual float getAttributeModifierValue(int amplifier, ::AttributeModifier const& modifier) const;
111 // NOLINTEND
112
113public:
114 // member functions
115 // NOLINTBEGIN
116 MCAPI MobEffect(
117 uint id,
118 ::std::string const& resourceName,
119 ::std::string const& locName,
120 bool isHarmful,
121 int color,
122 int icon,
123 ::std::string const& iconName,
124 bool drawParticles
125 );
126
127 MCAPI ::TemporalAttributeBuff
128 _createTemporalBuff(::AttributeBuff const& baseBuff, ::EffectDuration duration, int amplification) const;
129
130 MCAPI void _setParticleEffectIds(char const* particleEffectId, char const* particleEffectAmbientId);
131
132 MCAPI void addAttributeBuff(::Attribute const& attribute, ::std::shared_ptr<::AttributeBuff> buff);
133
134 MCAPI void addAttributeModifier(::Attribute const& attribute, ::std::shared_ptr<::AttributeModifier> modifier);
135
136 MCAPI void applyModsAndBuffs(
137 ::BaseAttributeMap& attributeMapToRemoveFrom,
138 ::EffectDuration durationTicks,
139 int amplification
140 ) const;
141
142 MCAPI void updateModsAndBuffs(
143 ::BaseAttributeMap& attributeMapToRemoveFrom,
144 ::EffectDuration durationTicks,
145 int amplification
146 ) const;
147 // NOLINTEND
148
149public:
150 // static functions
151 // NOLINTBEGIN
152 MCAPI static ::MobEffect const* getByName(::std::string const& name);
153
154 MCAPI static ::std::string getNameById(uint effectId);
155
156 MCAPI static void initEffects(::BaseGameVersion const& baseGameVersion, ::Experiments const& experiments);
157 // NOLINTEND
158
159public:
160 // static variables
161 // NOLINTBEGIN
162 MCAPI static ::mce::Color const& DEFAULT_COLOR();
163
164 MCAPI static ::Bedrock::DenseEnumMap<::MobEffectIds, ::std::unique_ptr<::MobEffect>, 38>& mMobEffects();
165 // NOLINTEND
166
167public:
168 // constructor thunks
169 // NOLINTBEGIN
170 MCAPI void* $ctor(
171 uint id,
172 ::std::string const& resourceName,
173 ::std::string const& locName,
174 bool isHarmful,
175 int color,
176 int icon,
177 ::std::string const& iconName,
178 bool drawParticles
179 );
180 // NOLINTEND
181
182public:
183 // destructor thunk
184 // NOLINTBEGIN
185#ifdef LL_PLAT_C
186 MCAPI void $dtor();
187#endif
188 // NOLINTEND
189
190public:
191 // virtual function thunks
192 // NOLINTBEGIN
193 MCAPI void $applyEffects(::Actor& target, ::EffectDuration durationTicks, int amplification) const;
194
195 MCAPI void $removeEffects(::BaseAttributeMap& attributeMapToRemoveFrom) const;
196
197 MCFOLD void $onEffectExpired(::Actor& target) const;
198
199 MCFOLD void $onActorDied(::Actor& target, int amplifier) const;
200
201 MCFOLD void $onActorHurt(::Actor& target, int amplifier, ::ActorDamageSource const& source, float damage) const;
202
203 MCAPI void
204 $applyInstantaneousEffect(::Actor* source, ::Actor* owner, ::Actor* target, int amplification, float scale) const;
205
206 MCFOLD bool $isInstantaneous() const;
207
208 MCAPI float $getAttributeModifierValue(int amplifier, ::AttributeModifier const& modifier) const;
209
210
211 // NOLINTEND
212
213public:
214 // vftables
215 // NOLINTBEGIN
216 MCNAPI static void** $vftable();
217 // NOLINTEND
218};
Definition ActorDamageSource.h:18
Definition Actor.h:113
Definition Amplifier.h:5
Definition AttributeBuff.h:16
Definition AttributeModifier.h:10
Definition Attribute.h:9
Definition BaseAttributeMap.h:21
Definition BaseGameVersion.h:8
Definition Experiments.h:14
static MCAPI void ** $vftable()
Definition TemporalAttributeBuff.h:14
Definition EffectDuration.h:5
Definition MobEffect.h:35