1
0

EntityEffects.x -> EntityEffect.x, Object-Oriented effects

Changed effect map to take a pointer of the effect as a result.
This commit is contained in:
archshift
2014-06-16 20:22:17 -07:00
parent 68c30790db
commit f5529e544c
15 changed files with 748 additions and 320 deletions

View File

@@ -436,51 +436,6 @@ void cMonster::HandleFalling()
void cMonster::HandleEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect)
{
switch (a_EffectType)
{
case cEntityEffect::effPoison:
{
// Default effect for non-undead mobs and non-spiders
if (!IsUndead() && GetMobType() != mtSpider) break;
return; // No effect
}
case cEntityEffect::effRegeneration:
{
// Default effect for non-undead mobs
if (!IsUndead() && GetMobType()) break;
return; // No effect
}
case cEntityEffect::effInstantDamage:
{
// Default effect for non-undead mobs
if (!IsUndead() && GetMobType()) break;
// Undead mobs are healed by instant damage
// Base heal = 6, doubles for every increase in intensity
Heal((int)(6 * std::pow(2.0, a_Effect.GetIntensity()) * a_Effect.GetDistanceModifier()));
return;
}
case cEntityEffect::effInstantHealth:
{
// Default effect for non-undead mobs
if (!IsUndead() && GetMobType()) break;
// Undead mobs are damaged by instant health
// Base damage = 6, doubles for every increase in intensity
int damage = (int)(6 * std::pow(2.0, a_Effect.GetIntensity()) * a_Effect.GetDistanceModifier());
TakeDamage(dtPotionOfHarming, a_Effect.GetCreator(), damage, 0);
return;
}
}
super::HandleEntityEffect(a_EffectType, a_Effect);
}
int cMonster::FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ)
{
int PosY = POSY_TOINT;