Entity effect type: use 'eff' as a prefix instead of 'ef'
This commit is contained in:
parent
58f35af6e7
commit
73cea7065d
@ -9,30 +9,30 @@ public:
|
|||||||
/** All types of entity effects (numbers correspond to IDs) */
|
/** All types of entity effects (numbers correspond to IDs) */
|
||||||
enum eType
|
enum eType
|
||||||
{
|
{
|
||||||
efNoEffect = 0,
|
effNoEffect = 0,
|
||||||
efSpeed = 1,
|
effSpeed = 1,
|
||||||
efSlowness = 2,
|
effSlowness = 2,
|
||||||
efHaste = 3,
|
effHaste = 3,
|
||||||
efMiningFatigue = 4,
|
effMiningFatigue = 4,
|
||||||
efStrength = 5,
|
effStrength = 5,
|
||||||
efInstantHealth = 6,
|
effInstantHealth = 6,
|
||||||
efInstantDamage = 7,
|
effInstantDamage = 7,
|
||||||
efJumpBoost = 8,
|
effJumpBoost = 8,
|
||||||
efNausia = 9,
|
effNausea = 9,
|
||||||
efRegeneration = 10,
|
effRegeneration = 10,
|
||||||
efResistance = 11,
|
effResistance = 11,
|
||||||
efFireResistance = 12,
|
effFireResistance = 12,
|
||||||
efWaterBreathing = 13,
|
effWaterBreathing = 13,
|
||||||
efInvisibility = 14,
|
effInvisibility = 14,
|
||||||
efBlindness = 15,
|
effBlindness = 15,
|
||||||
efNightVision = 16,
|
effNightVision = 16,
|
||||||
efHunger = 17,
|
effHunger = 17,
|
||||||
efWeakness = 18,
|
effWeakness = 18,
|
||||||
efPoison = 19,
|
effPoison = 19,
|
||||||
efWither = 20,
|
effWither = 20,
|
||||||
efHealthBoost = 21,
|
effHealthBoost = 21,
|
||||||
efAbsorption = 22,
|
effAbsorption = 22,
|
||||||
efSaturation = 23,
|
effSaturation = 23,
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
/** The duration of the effect */
|
/** The duration of the effect */
|
||||||
|
@ -63,7 +63,7 @@ void cPawn::KilledBy(cEntity *a_Killer)
|
|||||||
|
|
||||||
void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect)
|
void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect)
|
||||||
{
|
{
|
||||||
if (a_EffectType == cEntityEffect::efNoEffect)
|
if (a_EffectType == cEntityEffect::effNoEffect)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect
|
|||||||
switch (a_EffectType)
|
switch (a_EffectType)
|
||||||
{
|
{
|
||||||
// Default effect behaviors
|
// Default effect behaviors
|
||||||
case cEntityEffect::efInstantHealth:
|
case cEntityEffect::effInstantHealth:
|
||||||
{
|
{
|
||||||
// Base heal = 6, doubles for every increase in intensity
|
// Base heal = 6, doubles for every increase in intensity
|
||||||
Heal(6 * std::pow(2, a_Effect.GetIntensity()) * a_Effect.GetDistanceModifier());
|
Heal(6 * std::pow(2, a_Effect.GetIntensity()) * a_Effect.GetDistanceModifier());
|
||||||
@ -120,7 +120,7 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect
|
|||||||
// TODO: Harms undead
|
// TODO: Harms undead
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cEntityEffect::efInstantDamage:
|
case cEntityEffect::effInstantDamage:
|
||||||
{
|
{
|
||||||
// Base damage = 6, doubles for every increase in intensity
|
// Base damage = 6, doubles for every increase in intensity
|
||||||
int damage = 6 * std::pow(2, a_Effect.GetIntensity());
|
int damage = 6 * std::pow(2, a_Effect.GetIntensity());
|
||||||
@ -129,12 +129,12 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect
|
|||||||
// TODO: Heals undead
|
// TODO: Heals undead
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cEntityEffect::efStrength:
|
case cEntityEffect::effStrength:
|
||||||
{
|
{
|
||||||
// TODO: Implement me!
|
// TODO: Implement me!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cEntityEffect::efWeakness:
|
case cEntityEffect::effWeakness:
|
||||||
{
|
{
|
||||||
// Damage reduction = 0.5 damage, multiplied by potion level (Weakness II = 1 damage)
|
// Damage reduction = 0.5 damage, multiplied by potion level (Weakness II = 1 damage)
|
||||||
//double dmg_reduc = 0.5 * (a_Effect.GetIntensity() + 1);
|
//double dmg_reduc = 0.5 * (a_Effect.GetIntensity() + 1);
|
||||||
@ -143,7 +143,7 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect
|
|||||||
// TODO: Weakened villager zombies can be turned back to villagers with the god apple
|
// TODO: Weakened villager zombies can be turned back to villagers with the god apple
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cEntityEffect::efRegeneration:
|
case cEntityEffect::effRegeneration:
|
||||||
{
|
{
|
||||||
// Regen frequency = 50 ticks, divided by potion level (Regen II = 25 ticks)
|
// Regen frequency = 50 ticks, divided by potion level (Regen II = 25 ticks)
|
||||||
int frequency = std::floor(50.0 / (double)(a_Effect.GetIntensity() + 1));
|
int frequency = std::floor(50.0 / (double)(a_Effect.GetIntensity() + 1));
|
||||||
@ -158,7 +158,7 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect
|
|||||||
// TODO: Doesn't effect undead
|
// TODO: Doesn't effect undead
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cEntityEffect::efPoison:
|
case cEntityEffect::effPoison:
|
||||||
{
|
{
|
||||||
// Poison frequency = 25 ticks, divided by potion level (Poison II = 25 ticks)
|
// Poison frequency = 25 ticks, divided by potion level (Poison II = 25 ticks)
|
||||||
int frequency = std::floor(25.0 / (double)(a_Effect.GetIntensity() + 1));
|
int frequency = std::floor(25.0 / (double)(a_Effect.GetIntensity() + 1));
|
||||||
@ -177,17 +177,17 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect
|
|||||||
// TODO: Doesn't effect undead or spiders
|
// TODO: Doesn't effect undead or spiders
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cEntityEffect::efFireResistance:
|
case cEntityEffect::effFireResistance:
|
||||||
{
|
{
|
||||||
// TODO: Implement me!
|
// TODO: Implement me!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cEntityEffect::efSpeed:
|
case cEntityEffect::effSpeed:
|
||||||
{
|
{
|
||||||
// TODO: Implement me!
|
// TODO: Implement me!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cEntityEffect::efSlowness:
|
case cEntityEffect::effSlowness:
|
||||||
{
|
{
|
||||||
// TODO: Implement me!
|
// TODO: Implement me!
|
||||||
return;
|
return;
|
||||||
|
@ -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(a_NumTicks, 0, NULL));
|
AddEntityEffect(cEntityEffect::effHunger, cEntityEffect(a_NumTicks, 0, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1872,17 +1872,17 @@ void cPlayer::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffe
|
|||||||
switch (a_EffectType)
|
switch (a_EffectType)
|
||||||
{
|
{
|
||||||
// Effects whose behaviors are overridden
|
// Effects whose behaviors are overridden
|
||||||
case cEntityEffect::efMiningFatigue:
|
case cEntityEffect::effMiningFatigue:
|
||||||
{
|
{
|
||||||
// TODO: Implement me!
|
// TODO: Implement me!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cEntityEffect::efHunger:
|
case cEntityEffect::effHunger:
|
||||||
{
|
{
|
||||||
m_FoodExhaustionLevel += 0.025; // 0.5 per second = 0.025 per tick
|
m_FoodExhaustionLevel += 0.025; // 0.5 per second = 0.025 per tick
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cEntityEffect::efSaturation:
|
case cEntityEffect::effSaturation:
|
||||||
{
|
{
|
||||||
// Increase saturation 1 per tick, adds 1 for every increase in level
|
// Increase saturation 1 per tick, adds 1 for every increase in level
|
||||||
m_FoodSaturationLevel += (1 + a_Effect.GetIntensity());
|
m_FoodSaturationLevel += (1 + a_Effect.GetIntensity());
|
||||||
@ -1890,8 +1890,8 @@ void cPlayer::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Client-side-only effects
|
// Client-side-only effects
|
||||||
case cEntityEffect::efNausia:
|
case cEntityEffect::effNausea:
|
||||||
case cEntityEffect::efNightVision:
|
case cEntityEffect::effNightVision:
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
cWitherSkullEntity::cWitherSkullEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed) :
|
cWitherSkullEntity::cWitherSkullEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed) :
|
||||||
super(pkSplashPotion, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25)
|
super(pkWitherSkull, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25)
|
||||||
{
|
{
|
||||||
SetSpeed(a_Speed);
|
SetSpeed(a_Speed);
|
||||||
}
|
}
|
||||||
|
@ -20,18 +20,18 @@ class cItemPotionHandler:
|
|||||||
// For reference: http://minecraft.gamepedia.com/Data_values#.22Potion_effect.22_bits
|
// For reference: http://minecraft.gamepedia.com/Data_values#.22Potion_effect.22_bits
|
||||||
switch (a_ItemDamage & 15)
|
switch (a_ItemDamage & 15)
|
||||||
{
|
{
|
||||||
case 1: return cEntityEffect::efRegeneration;
|
case 1: return cEntityEffect::effRegeneration;
|
||||||
case 2: return cEntityEffect::efSpeed;
|
case 2: return cEntityEffect::effSpeed;
|
||||||
case 3: return cEntityEffect::efFireResistance;
|
case 3: return cEntityEffect::effFireResistance;
|
||||||
case 4: return cEntityEffect::efPoison;
|
case 4: return cEntityEffect::effPoison;
|
||||||
case 5: return cEntityEffect::efInstantHealth;
|
case 5: return cEntityEffect::effInstantHealth;
|
||||||
case 6: return cEntityEffect::efNightVision;
|
case 6: return cEntityEffect::effNightVision;
|
||||||
case 8: return cEntityEffect::efWeakness;
|
case 8: return cEntityEffect::effWeakness;
|
||||||
case 9: return cEntityEffect::efStrength;
|
case 9: return cEntityEffect::effStrength;
|
||||||
case 10: return cEntityEffect::efSlowness;
|
case 10: return cEntityEffect::effSlowness;
|
||||||
case 12: return cEntityEffect::efInstantDamage;
|
case 12: return cEntityEffect::effInstantDamage;
|
||||||
case 13: return cEntityEffect::efWaterBreathing;
|
case 13: return cEntityEffect::effWaterBreathing;
|
||||||
case 14: return cEntityEffect::efInvisibility;
|
case 14: return cEntityEffect::effInvisibility;
|
||||||
|
|
||||||
// No effect potions
|
// No effect potions
|
||||||
case 0:
|
case 0:
|
||||||
@ -43,7 +43,7 @@ class cItemPotionHandler:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cEntityEffect::efNoEffect;
|
return cEntityEffect::effNoEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
short GetEntityEffectIntensity(short a_ItemDamage)
|
short GetEntityEffectIntensity(short a_ItemDamage)
|
||||||
@ -61,26 +61,26 @@ class cItemPotionHandler:
|
|||||||
|
|
||||||
switch (GetEntityEffectType(a_ItemDamage))
|
switch (GetEntityEffectType(a_ItemDamage))
|
||||||
{
|
{
|
||||||
case cEntityEffect::efRegeneration:
|
case cEntityEffect::effRegeneration:
|
||||||
case cEntityEffect::efPoison:
|
case cEntityEffect::effPoison:
|
||||||
{
|
{
|
||||||
base = 900;
|
base = 900;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case cEntityEffect::efSpeed:
|
case cEntityEffect::effSpeed:
|
||||||
case cEntityEffect::efFireResistance:
|
case cEntityEffect::effFireResistance:
|
||||||
case cEntityEffect::efNightVision:
|
case cEntityEffect::effNightVision:
|
||||||
case cEntityEffect::efStrength:
|
case cEntityEffect::effStrength:
|
||||||
case cEntityEffect::efWaterBreathing:
|
case cEntityEffect::effWaterBreathing:
|
||||||
case cEntityEffect::efInvisibility:
|
case cEntityEffect::effInvisibility:
|
||||||
{
|
{
|
||||||
base = 3600;
|
base = 3600;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case cEntityEffect::efWeakness:
|
case cEntityEffect::effWeakness:
|
||||||
case cEntityEffect::efSlowness:
|
case cEntityEffect::effSlowness:
|
||||||
{
|
{
|
||||||
base = 1800;
|
base = 1800;
|
||||||
break;
|
break;
|
||||||
@ -127,16 +127,16 @@ public:
|
|||||||
Vector3d Speed = a_Player->GetLookVector() * 10;
|
Vector3d Speed = a_Player->GetLookVector() * 10;
|
||||||
|
|
||||||
short potion_damage = a_Item.m_ItemDamage;
|
short potion_damage = a_Item.m_ItemDamage;
|
||||||
cProjectileEntity * Projectile = new cSplashPotionEntity(a_Player,
|
cSplashPotionEntity * Projectile = new cSplashPotionEntity(a_Player,
|
||||||
(double)a_BlockX,
|
(double)a_BlockX,
|
||||||
(double)a_BlockY,
|
(double)a_BlockY,
|
||||||
(double)a_BlockZ,
|
(double)a_BlockZ,
|
||||||
&Speed,
|
&Speed,
|
||||||
GetEntityEffectType(potion_damage),
|
GetEntityEffectType(potion_damage),
|
||||||
cEntityEffect(GetEntityEffectDuration(potion_damage),
|
cEntityEffect(GetEntityEffectDuration(potion_damage),
|
||||||
GetEntityEffectIntensity(potion_damage),
|
GetEntityEffectIntensity(potion_damage),
|
||||||
a_Player),
|
a_Player),
|
||||||
GetPotionName(potion_damage));
|
GetPotionName(potion_damage));
|
||||||
if (Projectile == NULL)
|
if (Projectile == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user