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) */
|
||||
enum eType
|
||||
{
|
||||
efNoEffect = 0,
|
||||
efSpeed = 1,
|
||||
efSlowness = 2,
|
||||
efHaste = 3,
|
||||
efMiningFatigue = 4,
|
||||
efStrength = 5,
|
||||
efInstantHealth = 6,
|
||||
efInstantDamage = 7,
|
||||
efJumpBoost = 8,
|
||||
efNausia = 9,
|
||||
efRegeneration = 10,
|
||||
efResistance = 11,
|
||||
efFireResistance = 12,
|
||||
efWaterBreathing = 13,
|
||||
efInvisibility = 14,
|
||||
efBlindness = 15,
|
||||
efNightVision = 16,
|
||||
efHunger = 17,
|
||||
efWeakness = 18,
|
||||
efPoison = 19,
|
||||
efWither = 20,
|
||||
efHealthBoost = 21,
|
||||
efAbsorption = 22,
|
||||
efSaturation = 23,
|
||||
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,
|
||||
} ;
|
||||
|
||||
/** 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)
|
||||
{
|
||||
if (a_EffectType == cEntityEffect::efNoEffect)
|
||||
if (a_EffectType == cEntityEffect::effNoEffect)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -112,7 +112,7 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect
|
||||
switch (a_EffectType)
|
||||
{
|
||||
// Default effect behaviors
|
||||
case cEntityEffect::efInstantHealth:
|
||||
case cEntityEffect::effInstantHealth:
|
||||
{
|
||||
// Base heal = 6, doubles for every increase in intensity
|
||||
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
|
||||
return;
|
||||
}
|
||||
case cEntityEffect::efInstantDamage:
|
||||
case cEntityEffect::effInstantDamage:
|
||||
{
|
||||
// Base damage = 6, doubles for every increase in intensity
|
||||
int damage = 6 * std::pow(2, a_Effect.GetIntensity());
|
||||
@ -129,12 +129,12 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect
|
||||
// TODO: Heals undead
|
||||
return;
|
||||
}
|
||||
case cEntityEffect::efStrength:
|
||||
case cEntityEffect::effStrength:
|
||||
{
|
||||
// TODO: Implement me!
|
||||
return;
|
||||
}
|
||||
case cEntityEffect::efWeakness:
|
||||
case cEntityEffect::effWeakness:
|
||||
{
|
||||
// Damage reduction = 0.5 damage, multiplied by potion level (Weakness II = 1 damage)
|
||||
//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
|
||||
return;
|
||||
}
|
||||
case cEntityEffect::efRegeneration:
|
||||
case cEntityEffect::effRegeneration:
|
||||
{
|
||||
// Regen frequency = 50 ticks, divided by potion level (Regen II = 25 ticks)
|
||||
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
|
||||
return;
|
||||
}
|
||||
case cEntityEffect::efPoison:
|
||||
case cEntityEffect::effPoison:
|
||||
{
|
||||
// Poison frequency = 25 ticks, divided by potion level (Poison II = 25 ticks)
|
||||
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
|
||||
return;
|
||||
}
|
||||
case cEntityEffect::efFireResistance:
|
||||
case cEntityEffect::effFireResistance:
|
||||
{
|
||||
// TODO: Implement me!
|
||||
return;
|
||||
}
|
||||
case cEntityEffect::efSpeed:
|
||||
case cEntityEffect::effSpeed:
|
||||
{
|
||||
// TODO: Implement me!
|
||||
return;
|
||||
}
|
||||
case cEntityEffect::efSlowness:
|
||||
case cEntityEffect::effSlowness:
|
||||
{
|
||||
// TODO: Implement me!
|
||||
return;
|
||||
|
@ -570,7 +570,7 @@ bool cPlayer::Feed(int a_Food, double a_Saturation)
|
||||
|
||||
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)
|
||||
{
|
||||
// Effects whose behaviors are overridden
|
||||
case cEntityEffect::efMiningFatigue:
|
||||
case cEntityEffect::effMiningFatigue:
|
||||
{
|
||||
// TODO: Implement me!
|
||||
return;
|
||||
}
|
||||
case cEntityEffect::efHunger:
|
||||
case cEntityEffect::effHunger:
|
||||
{
|
||||
m_FoodExhaustionLevel += 0.025; // 0.5 per second = 0.025 per tick
|
||||
return;
|
||||
}
|
||||
case cEntityEffect::efSaturation:
|
||||
case cEntityEffect::effSaturation:
|
||||
{
|
||||
// Increase saturation 1 per tick, adds 1 for every increase in level
|
||||
m_FoodSaturationLevel += (1 + a_Effect.GetIntensity());
|
||||
@ -1890,8 +1890,8 @@ void cPlayer::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffe
|
||||
}
|
||||
|
||||
// Client-side-only effects
|
||||
case cEntityEffect::efNausia:
|
||||
case cEntityEffect::efNightVision:
|
||||
case cEntityEffect::effNausea:
|
||||
case cEntityEffect::effNightVision:
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -20,18 +20,18 @@ class cItemPotionHandler:
|
||||
// For reference: http://minecraft.gamepedia.com/Data_values#.22Potion_effect.22_bits
|
||||
switch (a_ItemDamage & 15)
|
||||
{
|
||||
case 1: return cEntityEffect::efRegeneration;
|
||||
case 2: return cEntityEffect::efSpeed;
|
||||
case 3: return cEntityEffect::efFireResistance;
|
||||
case 4: return cEntityEffect::efPoison;
|
||||
case 5: return cEntityEffect::efInstantHealth;
|
||||
case 6: return cEntityEffect::efNightVision;
|
||||
case 8: return cEntityEffect::efWeakness;
|
||||
case 9: return cEntityEffect::efStrength;
|
||||
case 10: return cEntityEffect::efSlowness;
|
||||
case 12: return cEntityEffect::efInstantDamage;
|
||||
case 13: return cEntityEffect::efWaterBreathing;
|
||||
case 14: return cEntityEffect::efInvisibility;
|
||||
case 1: return cEntityEffect::effRegeneration;
|
||||
case 2: return cEntityEffect::effSpeed;
|
||||
case 3: return cEntityEffect::effFireResistance;
|
||||
case 4: return cEntityEffect::effPoison;
|
||||
case 5: return cEntityEffect::effInstantHealth;
|
||||
case 6: return cEntityEffect::effNightVision;
|
||||
case 8: return cEntityEffect::effWeakness;
|
||||
case 9: return cEntityEffect::effStrength;
|
||||
case 10: return cEntityEffect::effSlowness;
|
||||
case 12: return cEntityEffect::effInstantDamage;
|
||||
case 13: return cEntityEffect::effWaterBreathing;
|
||||
case 14: return cEntityEffect::effInvisibility;
|
||||
|
||||
// No effect potions
|
||||
case 0:
|
||||
@ -43,7 +43,7 @@ class cItemPotionHandler:
|
||||
}
|
||||
}
|
||||
|
||||
return cEntityEffect::efNoEffect;
|
||||
return cEntityEffect::effNoEffect;
|
||||
}
|
||||
|
||||
short GetEntityEffectIntensity(short a_ItemDamage)
|
||||
@ -61,26 +61,26 @@ class cItemPotionHandler:
|
||||
|
||||
switch (GetEntityEffectType(a_ItemDamage))
|
||||
{
|
||||
case cEntityEffect::efRegeneration:
|
||||
case cEntityEffect::efPoison:
|
||||
case cEntityEffect::effRegeneration:
|
||||
case cEntityEffect::effPoison:
|
||||
{
|
||||
base = 900;
|
||||
break;
|
||||
}
|
||||
|
||||
case cEntityEffect::efSpeed:
|
||||
case cEntityEffect::efFireResistance:
|
||||
case cEntityEffect::efNightVision:
|
||||
case cEntityEffect::efStrength:
|
||||
case cEntityEffect::efWaterBreathing:
|
||||
case cEntityEffect::efInvisibility:
|
||||
case cEntityEffect::effSpeed:
|
||||
case cEntityEffect::effFireResistance:
|
||||
case cEntityEffect::effNightVision:
|
||||
case cEntityEffect::effStrength:
|
||||
case cEntityEffect::effWaterBreathing:
|
||||
case cEntityEffect::effInvisibility:
|
||||
{
|
||||
base = 3600;
|
||||
break;
|
||||
}
|
||||
|
||||
case cEntityEffect::efWeakness:
|
||||
case cEntityEffect::efSlowness:
|
||||
case cEntityEffect::effWeakness:
|
||||
case cEntityEffect::effSlowness:
|
||||
{
|
||||
base = 1800;
|
||||
break;
|
||||
@ -127,16 +127,16 @@ public:
|
||||
Vector3d Speed = a_Player->GetLookVector() * 10;
|
||||
|
||||
short potion_damage = a_Item.m_ItemDamage;
|
||||
cProjectileEntity * Projectile = new cSplashPotionEntity(a_Player,
|
||||
(double)a_BlockX,
|
||||
(double)a_BlockY,
|
||||
(double)a_BlockZ,
|
||||
&Speed,
|
||||
GetEntityEffectType(potion_damage),
|
||||
cEntityEffect(GetEntityEffectDuration(potion_damage),
|
||||
GetEntityEffectIntensity(potion_damage),
|
||||
a_Player),
|
||||
GetPotionName(potion_damage));
|
||||
cSplashPotionEntity * Projectile = new cSplashPotionEntity(a_Player,
|
||||
(double)a_BlockX,
|
||||
(double)a_BlockY,
|
||||
(double)a_BlockZ,
|
||||
&Speed,
|
||||
GetEntityEffectType(potion_damage),
|
||||
cEntityEffect(GetEntityEffectDuration(potion_damage),
|
||||
GetEntityEffectIntensity(potion_damage),
|
||||
a_Player),
|
||||
GetPotionName(potion_damage));
|
||||
if (Projectile == NULL)
|
||||
{
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user