1
0

Added slowness effect and added entity support.

This commit is contained in:
Howaner 2014-08-30 12:45:39 +02:00
parent d7ee2245e8
commit 003206b1b0
2 changed files with 66 additions and 17 deletions

View File

@ -237,17 +237,18 @@ void cEntityEffect::OnTick(cPawn & a_Target)
void cEntityEffectSpeed::OnActivate(cPawn & a_Target)
{
// TODO: Add SetMormalMaxSpeed to cMonster
if (!a_Target.IsPlayer())
if (a_Target.IsMob())
{
return;
cMonster * Mob = (cMonster*) &a_Target;
Mob->SetWalkSpeed(Mob->GetWalkSpeed() + 0.2 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
cPlayer * Player = (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);
}
cPlayer * Player = (cPlayer*) &a_Target;
Player->SetNormalMaxSpeed(1.0 + 0.2 * m_Intensity);
Player->SetSprintingMaxSpeed(1.3 + 0.26 * m_Intensity);
Player->SetFlyingMaxSpeed(1.0 + 0.2 * m_Intensity);
}
@ -256,17 +257,61 @@ void cEntityEffectSpeed::OnActivate(cPawn & a_Target)
void cEntityEffectSpeed::OnDeactivate(cPawn & a_Target)
{
// TODO: Add SetMormalMaxSpeed to cMonster
if (!a_Target.IsPlayer())
if (a_Target.IsMob())
{
return;
cMonster * Mob = (cMonster*) &a_Target;
Mob->SetWalkSpeed(Mob->GetWalkSpeed() - 0.2 * m_Intensity);
}
cPlayer * Player = (cPlayer*) &a_Target;
else if (a_Target.IsPlayer())
{
cPlayer * Player = (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);
}
}
Player->SetNormalMaxSpeed(1.0);
Player->SetSprintingMaxSpeed(1.3);
Player->SetFlyingMaxSpeed(1.0);
////////////////////////////////////////////////////////////////////////////////
// cEntityEffectSlowness:
void cEntityEffectSlowness::OnActivate(cPawn & a_Target)
{
if (a_Target.IsMob())
{
cMonster * Mob = (cMonster*) &a_Target;
Mob->SetWalkSpeed(Mob->GetWalkSpeed() - 0.15 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
cPlayer * Player = (cPlayer*) &a_Target;
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() - 0.15 * m_Intensity);
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() - 0.195 * m_Intensity);
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() - 0.15 * m_Intensity);
}
}
void cEntityEffectSlowness::OnDeactivate(cPawn & a_Target)
{
if (a_Target.IsMob())
{
cMonster * Mob = (cMonster*) &a_Target;
Mob->SetWalkSpeed(Mob->GetWalkSpeed() + 0.15 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
cPlayer * Player = (cPlayer*) &a_Target;
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() + 0.15 * m_Intensity);
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() + 0.195 * m_Intensity);
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() + 0.15 * m_Intensity);
}
}

View File

@ -156,6 +156,10 @@ public:
super(a_Duration, a_Intensity, a_DistanceModifier)
{
}
virtual void OnActivate(cPawn & a_Target) override;
virtual void OnDeactivate(cPawn & a_Target) override;
};