EntityEffect: read-only getters, added user and distance modifier fields
User: the pawn that uses or produces the entity effect (drinks/throws a potion) Distance modifier: the potency modifier from splash potion effectivity radius
This commit is contained in:
parent
2123173202
commit
a9a4c9c6b2
@ -1,14 +1,16 @@
|
|||||||
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
||||||
|
|
||||||
#include "EntityEffects.h"
|
#include "EntityEffects.h"
|
||||||
|
#include "Pawn.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cEntityEffect::cEntityEffect():
|
cEntityEffect::cEntityEffect():
|
||||||
m_Ticks(0),
|
m_Ticks(0),
|
||||||
m_Intensity(0)
|
m_Intensity(0),
|
||||||
|
m_User(NULL),
|
||||||
|
m_DistanceModifier(1)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -17,9 +19,11 @@ cEntityEffect::cEntityEffect():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cEntityEffect::cEntityEffect(int a_Ticks, short a_Intensity):
|
cEntityEffect::cEntityEffect(int a_Ticks, short a_Intensity, cPawn *a_User, double a_DistanceModifier):
|
||||||
m_Ticks(a_Ticks),
|
m_Ticks(a_Ticks),
|
||||||
m_Intensity(a_Intensity)
|
m_Intensity(a_Intensity),
|
||||||
|
m_User(a_User),
|
||||||
|
m_DistanceModifier(a_DistanceModifier)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
class cPawn;
|
||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
class cEntityEffect {
|
class cEntityEffect {
|
||||||
public:
|
public:
|
||||||
@ -35,8 +37,14 @@ public:
|
|||||||
/** The duration of the effect */
|
/** The duration of the effect */
|
||||||
int m_Ticks;
|
int m_Ticks;
|
||||||
|
|
||||||
/** How strong the effect will be applied */
|
/** Returns how strong the effect will be applied */
|
||||||
short m_Intensity;
|
short GetIntensity() { return m_Intensity; }
|
||||||
|
|
||||||
|
/** Returns the pawn that used this entity effect */
|
||||||
|
cPawn *GetUser() { return m_User; }
|
||||||
|
|
||||||
|
/** Returns the distance modifier for affecting potency */
|
||||||
|
double GetDistanceModifier() { return m_DistanceModifier; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An empty entity effect
|
* An empty entity effect
|
||||||
@ -45,9 +53,21 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An entity effect
|
* An entity effect
|
||||||
* @param a_Ticks The duration of the effect
|
* @param a_Ticks The duration of the effect
|
||||||
* @param a_Intensity How strong the effect will be applied
|
* @param a_Intensity How strong the effect will be applied
|
||||||
|
* @param a_User The pawn that used this entity effect
|
||||||
|
* @param a_DistanceModifier The distance modifier for affecting potency, defaults to 1
|
||||||
*/
|
*/
|
||||||
cEntityEffect(int a_Ticks, short a_Intensity);
|
cEntityEffect(int a_Ticks, short a_Intensity, cPawn *a_User, double a_DistanceModifier = 1);
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** How strong the effect will be applied */
|
||||||
|
short m_Intensity;
|
||||||
|
|
||||||
|
/** The pawn that used this entity effect */
|
||||||
|
cPawn *m_User;
|
||||||
|
|
||||||
|
/** The distance modifier for affecting potency */
|
||||||
|
double m_DistanceModifier;
|
||||||
};
|
};
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
@ -570,7 +570,7 @@ bool cPlayer::Feed(int a_Food, double a_Saturation)
|
|||||||
|
|
||||||
void cPlayer::FoodPoison(int a_NumTicks)
|
void cPlayer::FoodPoison(int a_NumTicks)
|
||||||
{
|
{
|
||||||
AddEntityEffect(cEntityEffect::efHunger, cEntityEffect(0, a_NumTicks));
|
AddEntityEffect(cEntityEffect::efHunger, cEntityEffect(0, a_NumTicks, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user