Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <EntityEffect.h>
Public Types | |
enum | eType { effNoEffect = 0, effSpeed = 1, effSlowness = 2, effHaste = 3, effMiningFatigue = 4, effStrength = 5, effInstantHealth = 6, effInstantDamage = 7, effJumpBoost = 8, effNausea = 9, effRegeneration = 10, effResistance = 11, effFireResistance = 12, effWaterBreathing = 13, effInvisibility = 14, effBlindness = 15, effNightVision = 16, effHunger = 17, effWeakness = 18, effPoison = 19, effWither = 20, effHealthBoost = 21, effAbsorption = 22, effSaturation = 23 } |
All types of entity effects (numbers correspond to protocol / storage types) More... | |
Public Member Functions | |
cEntityEffect (void) | |
Creates an empty entity effect. More... | |
cEntityEffect (int a_Duration, short a_Intensity, double a_DistanceModifier=1) | |
Creates an entity effect of the specified type. More... | |
cEntityEffect (const cEntityEffect &a_OtherEffect) | |
Creates an entity effect by copying another. More... | |
double | GetDistanceModifier (void) const |
Returns the distance modifier for affecting potency. More... | |
int | GetDuration (void) const |
Returns the duration of the effect. More... | |
short | GetIntensity (void) const |
Returns how strong the effect will be applied. More... | |
int | GetTicks (void) const |
Returns how many ticks this effect has been active for. More... | |
virtual void | OnActivate (cPawn &a_Target) |
Called when the effect is first added to an entity. More... | |
virtual void | OnDeactivate (cPawn &a_Target) |
Called when the effect is removed from an entity. More... | |
virtual void | OnTick (cPawn &a_Target) |
Called on each tick. More... | |
cEntityEffect & | operator= (cEntityEffect a_OtherEffect) |
Creates an entity effect by copying another. More... | |
void | SetDistanceModifier (double a_DistanceModifier) |
void | SetDuration (int a_Duration) |
void | SetIntensity (short a_Intensity) |
void | SetTicks (int a_Ticks) |
virtual | ~cEntityEffect (void) |
Static Public Member Functions | |
static std::unique_ptr< cEntityEffect > | CreateEntityEffect (cEntityEffect::eType a_EffectType, int a_Duration, short a_Intensity, double a_DistanceModifier) |
Creates a pointer to the proper entity effect from the effect type. More... | |
static int | GetPotionColor (short a_ItemDamage) |
Returns the potion color (used by the client for visuals), based on the potion's damage value. More... | |
static int | GetPotionEffectDuration (short a_ItemDamage) |
Returns the effect duration, in ticks, based on the potion's damage value. More... | |
static short | GetPotionEffectIntensity (short a_ItemDamage) |
Retrieves the intensity level from the potion's damage value. More... | |
static cEntityEffect::eType | GetPotionEffectType (short a_ItemDamage) |
Translates the potion's damage value into the entity effect that the potion gives. More... | |
static bool | IsPotionDrinkable (short a_ItemDamage) |
Returns true if the potion with the given damage is drinkable. More... | |
Protected Attributes | |
double | m_DistanceModifier |
The distance modifier for affecting potency. More... | |
int | m_Duration |
How long this effect will last, in ticks. More... | |
short | m_Intensity |
How strong the effect will be applied. More... | |
int | m_Ticks |
How many ticks this effect has been active for. More... | |
Definition at line 6 of file EntityEffect.h.
enum cEntityEffect::eType |
All types of entity effects (numbers correspond to protocol / storage types)
Definition at line 11 of file EntityEffect.h.
cEntityEffect::cEntityEffect | ( | void | ) |
Creates an empty entity effect.
Definition at line 138 of file EntityEffect.cpp.
cEntityEffect::cEntityEffect | ( | int | a_Duration, |
short | a_Intensity, | ||
double | a_DistanceModifier = 1 |
||
) |
Creates an entity effect of the specified type.
a_Duration | How long this effect will last, in ticks |
a_Intensity | How strong the effect will be applied |
a_DistanceModifier | The distance modifier for affecting potency, defaults to 1 |
Definition at line 151 of file EntityEffect.cpp.
cEntityEffect::cEntityEffect | ( | const cEntityEffect & | a_OtherEffect | ) |
Creates an entity effect by copying another.
a_OtherEffect | The other effect to copy |
Definition at line 164 of file EntityEffect.cpp.
|
inlinevirtual |
Definition at line 76 of file EntityEffect.h.
|
static |
Creates a pointer to the proper entity effect from the effect type.
a_EffectType | The effect type to create the effect from |
a_Duration | How long this effect will last, in ticks |
a_Intensity | How strong the effect will be applied |
a_DistanceModifier | The distance modifier for affecting potency, defaults to 1 |
Definition at line 190 of file EntityEffect.cpp.
|
inline |
Returns the distance modifier for affecting potency.
Definition at line 96 of file EntityEffect.h.
|
inline |
Returns the duration of the effect.
Definition at line 90 of file EntityEffect.h.
|
inline |
Returns how strong the effect will be applied.
Definition at line 93 of file EntityEffect.h.
|
static |
Returns the potion color (used by the client for visuals), based on the potion's damage value.
Definition at line 12 of file EntityEffect.cpp.
|
static |
Returns the effect duration, in ticks, based on the potion's damage value.
Definition at line 68 of file EntityEffect.cpp.
|
static |
Retrieves the intensity level from the potion's damage value.
Returns 0 for level I potions, 1 for level II potions.
Definition at line 58 of file EntityEffect.cpp.
|
static |
Translates the potion's damage value into the entity effect that the potion gives.
Definition at line 22 of file EntityEffect.cpp.
|
inline |
Returns how many ticks this effect has been active for.
Definition at line 87 of file EntityEffect.h.
|
static |
Returns true if the potion with the given damage is drinkable.
Definition at line 126 of file EntityEffect.cpp.
|
inlinevirtual |
Called when the effect is first added to an entity.
Reimplemented in cEntityEffectInvisibility, cEntityEffectInstantDamage, cEntityEffectInstantHealth, cEntityEffectSlowness, and cEntityEffectSpeed.
Definition at line 108 of file EntityEffect.h.
|
inlinevirtual |
Called when the effect is removed from an entity.
Reimplemented in cEntityEffectInvisibility, cEntityEffectSlowness, and cEntityEffectSpeed.
Definition at line 111 of file EntityEffect.h.
|
virtual |
Called on each tick.
By default increases the m_Ticks, descendants may override to provide additional processing.
Reimplemented in cEntityEffectSaturation, cEntityEffectWither, cEntityEffectPoison, cEntityEffectWeakness, cEntityEffectHunger, and cEntityEffectRegeneration.
Definition at line 227 of file EntityEffect.cpp.
cEntityEffect & cEntityEffect::operator= | ( | cEntityEffect | a_OtherEffect | ) |
Creates an entity effect by copying another.
a_OtherEffect | The other effect to copy |
Definition at line 177 of file EntityEffect.cpp.
|
inline |
Definition at line 101 of file EntityEffect.h.
|
inline |
Definition at line 99 of file EntityEffect.h.
|
inline |
Definition at line 100 of file EntityEffect.h.
|
inline |
Definition at line 98 of file EntityEffect.h.
|
protected |
The distance modifier for affecting potency.
Definition at line 124 of file EntityEffect.h.
|
protected |
How long this effect will last, in ticks.
Definition at line 118 of file EntityEffect.h.
|
protected |
How strong the effect will be applied.
Definition at line 121 of file EntityEffect.h.
|
protected |
How many ticks this effect has been active for.
Definition at line 115 of file EntityEffect.h.