summaryrefslogtreecommitdiffstats
path: root/src/Entities/EntityEffect.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2018-05-02 09:50:36 +0200
committerGitHub <noreply@github.com>2018-05-02 09:50:36 +0200
commita4dbb5c58270959884c17d720185da06464fa256 (patch)
tree2b4e81410e90e059f51726e6c9a01c03fcbfb98d /src/Entities/EntityEffect.cpp
parenttolua++ bindings use nullptr. (#4219) (diff)
downloadcuberite-a4dbb5c58270959884c17d720185da06464fa256.tar
cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.gz
cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.bz2
cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.lz
cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.xz
cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.zst
cuberite-a4dbb5c58270959884c17d720185da06464fa256.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/EntityEffect.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp
index 8f0ecc395..45a98c0d2 100644
--- a/src/Entities/EntityEffect.cpp
+++ b/src/Entities/EntityEffect.cpp
@@ -241,12 +241,12 @@ void cEntityEffectSpeed::OnActivate(cPawn & a_Target)
{
if (a_Target.IsMob())
{
- cMonster * Mob = reinterpret_cast<cMonster*>(&a_Target);
+ cMonster * Mob = static_cast<cMonster*>(&a_Target);
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() + 0.2 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
- cPlayer * Player = reinterpret_cast<cPlayer*>(&a_Target);
+ cPlayer * Player = static_cast<cPlayer*>(&a_Target);
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() + 0.2 * m_Intensity);
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() + 0.26 * m_Intensity);
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() + 0.2 * m_Intensity);
@@ -261,12 +261,12 @@ void cEntityEffectSpeed::OnDeactivate(cPawn & a_Target)
{
if (a_Target.IsMob())
{
- cMonster * Mob = reinterpret_cast<cMonster*>(&a_Target);
+ cMonster * Mob = static_cast<cMonster*>(&a_Target);
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() - 0.2 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
- cPlayer * Player = reinterpret_cast<cPlayer*>(&a_Target);
+ cPlayer * Player = static_cast<cPlayer*>(&a_Target);
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() - 0.2 * m_Intensity);
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() - 0.26 * m_Intensity);
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() - 0.2 * m_Intensity);
@@ -328,7 +328,7 @@ void cEntityEffectInstantHealth::OnActivate(cPawn & a_Target)
// Base amount = 6, doubles for every increase in intensity
int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
- if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
+ if (a_Target.IsMob() && static_cast<cMonster &>(a_Target).IsUndead())
{
a_Target.TakeDamage(dtPotionOfHarming, nullptr, amount, 0); // TODO: Store attacker in a pointer-safe way, pass to TakeDamage
return;
@@ -348,7 +348,7 @@ void cEntityEffectInstantDamage::OnActivate(cPawn & a_Target)
// Base amount = 6, doubles for every increase in intensity
int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
- if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
+ if (a_Target.IsMob() && static_cast<cMonster &>(a_Target).IsUndead())
{
a_Target.Heal(amount);
return;
@@ -367,7 +367,7 @@ void cEntityEffectRegeneration::OnTick(cPawn & a_Target)
{
super::OnTick(a_Target);
- if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
+ if (a_Target.IsMob() && static_cast<cMonster &>(a_Target).IsUndead())
{
return;
}
@@ -396,7 +396,7 @@ void cEntityEffectHunger::OnTick(cPawn & a_Target)
if (a_Target.IsPlayer())
{
- cPlayer & Target = reinterpret_cast<cPlayer &>(a_Target);
+ cPlayer & Target = static_cast<cPlayer &>(a_Target);
Target.AddFoodExhaustion(0.025 * (static_cast<double>(GetIntensity()) + 1.0)); // 0.5 per second = 0.025 per tick
}
}
@@ -448,7 +448,7 @@ void cEntityEffectPoison::OnTick(cPawn & a_Target)
if (a_Target.IsMob())
{
- cMonster & Target = reinterpret_cast<cMonster &>(a_Target);
+ cMonster & Target = static_cast<cMonster &>(a_Target);
// Doesn't effect undead mobs, spiders
if (
@@ -505,7 +505,7 @@ void cEntityEffectSaturation::OnTick(cPawn & a_Target)
{
if (a_Target.IsPlayer())
{
- cPlayer & Target = reinterpret_cast<cPlayer &>(a_Target);
+ cPlayer & Target = static_cast<cPlayer &>(a_Target);
Target.SetFoodSaturationLevel(Target.GetFoodSaturationLevel() + (1 + m_Intensity)); // Increase saturation 1 per tick, adds 1 for every increase in level
}
}