summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/EntityEffect.cpp86
-rw-r--r--src/Entities/EntityEffect.h8
-rw-r--r--src/Entities/Player.cpp9
3 files changed, 94 insertions, 9 deletions
diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp
index f08755674..1a923930f 100644
--- a/src/Entities/EntityEffect.cpp
+++ b/src/Entities/EntityEffect.cpp
@@ -233,6 +233,92 @@ void cEntityEffect::OnTick(cPawn & a_Target)
////////////////////////////////////////////////////////////////////////////////
+// cEntityEffectSpeed:
+
+void cEntityEffectSpeed::OnActivate(cPawn & a_Target)
+{
+ if (a_Target.IsMob())
+ {
+ cMonster * Mob = (cMonster*) &a_Target;
+ Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() + 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);
+ }
+}
+
+
+
+
+
+void cEntityEffectSpeed::OnDeactivate(cPawn & a_Target)
+{
+ if (a_Target.IsMob())
+ {
+ cMonster * Mob = (cMonster*) &a_Target;
+ Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() - 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);
+ }
+}
+
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// cEntityEffectSlowness:
+
+void cEntityEffectSlowness::OnActivate(cPawn & a_Target)
+{
+ if (a_Target.IsMob())
+ {
+ cMonster * Mob = (cMonster*) &a_Target;
+ Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() - 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->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() + 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);
+ }
+}
+
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////
// cEntityEffectInstantHealth:
void cEntityEffectInstantHealth::OnActivate(cPawn & a_Target)
diff --git a/src/Entities/EntityEffect.h b/src/Entities/EntityEffect.h
index 47c298f57..7cf9cd3d5 100644
--- a/src/Entities/EntityEffect.h
+++ b/src/Entities/EntityEffect.h
@@ -137,6 +137,10 @@ public:
super(a_Duration, a_Intensity, a_DistanceModifier)
{
}
+
+ virtual void OnActivate(cPawn & a_Target) override;
+
+ virtual void OnDeactivate(cPawn & a_Target) override;
};
@@ -152,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;
};
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index b0da6965a..ea795e346 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -627,15 +627,6 @@ void cPlayer::FinishEating(void)
return;
}
ItemHandler->OnFoodEaten(m_World, this, &Item);
-
- GetInventory().RemoveOneEquippedItem();
-
- // if the food is mushroom soup, return a bowl to the inventory
- if (Item.m_ItemType == E_ITEM_MUSHROOM_SOUP)
- {
- cItem EmptyBowl(E_ITEM_BOWL);
- GetInventory().AddItem(EmptyBowl, true, true);
- }
}