summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Mobs/AggressiveMonster.cpp29
-rw-r--r--src/Mobs/AggressiveMonster.h23
-rw-r--r--src/Mobs/Behaviors/BehaviorAttacker.cpp2
-rw-r--r--src/Mobs/Behaviors/BehaviorAttacker.h6
-rw-r--r--src/Mobs/Behaviors/BehaviorAttackerMelee.cpp8
-rw-r--r--src/Mobs/Behaviors/BehaviorAttackerMelee.h2
-rw-r--r--src/Mobs/CMakeLists.txt2
7 files changed, 10 insertions, 62 deletions
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp
deleted file mode 100644
index 172799249..000000000
--- a/src/Mobs/AggressiveMonster.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "AggressiveMonster.h"
-
-#include "../World.h"
-#include "../Entities/Player.h"
-#include "../Tracer.h"
-#include "Behaviors/BehaviorAggressive.h"
-#include "Behaviors/BehaviorWanderer.h"
-
-
-
-cAggressiveMonster::cAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) :
- super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height)
-{
- m_EMPersonality = AGGRESSIVE;
- m_BehaviorWanderer.AttachToMonster(*this);
-}
-
-
-
-
-
-
-void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
-{
- super::Tick(a_Dt, a_Chunk);
-}
diff --git a/src/Mobs/AggressiveMonster.h b/src/Mobs/AggressiveMonster.h
deleted file mode 100644
index 853504b7a..000000000
--- a/src/Mobs/AggressiveMonster.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once
-
-#include "Monster.h"
-#include "Behaviors/BehaviorAggressive.h"
-
-
-typedef std::string AString;
-
-class cAggressiveMonster :
- public cMonster
-{
- typedef cMonster super;
-
-public:
-
- cAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height);
-
- virtual void Tick (std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
-
-private:
- cBehaviorAggressive m_BehaviorAggressive;
- cBehaviorWanderer m_BehaviorWanderer;
-} ;
diff --git a/src/Mobs/Behaviors/BehaviorAttacker.cpp b/src/Mobs/Behaviors/BehaviorAttacker.cpp
index 30c18019e..00eb53179 100644
--- a/src/Mobs/Behaviors/BehaviorAttacker.cpp
+++ b/src/Mobs/Behaviors/BehaviorAttacker.cpp
@@ -57,7 +57,7 @@ void cBehaviorAttacker::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
if (m_IsStriking)
{
- if (StrikeTarget(a_Dt, a_Chunk, ++m_StrikeTickCnt))
+ if (StrikeTarget(++m_StrikeTickCnt))
{
m_Parent->UnpinBehavior(this);
m_IsStriking = false;
diff --git a/src/Mobs/Behaviors/BehaviorAttacker.h b/src/Mobs/Behaviors/BehaviorAttacker.h
index 099cb1987..4d99fda21 100644
--- a/src/Mobs/Behaviors/BehaviorAttacker.h
+++ b/src/Mobs/Behaviors/BehaviorAttacker.h
@@ -49,7 +49,7 @@ protected:
it returns false. a_StrikeTickCnt tracks how many times it was called. It is 1 the first call.
It increments by 1 each call. This mechanism allows multi-tick attacks, like blazes shooting multiple
fireballs, but most attacks are single tick and return true the first call. */
- virtual bool StrikeTarget(std::chrono::milliseconds a_Dt, cChunk & a_Chunk, int a_StrikeTickCnt) = 0;
+ virtual bool StrikeTarget(int a_StrikeTickCnt) = 0;
// Target related methods
bool TargetIsInStrikeRadius();
@@ -69,14 +69,14 @@ protected:
int m_TicksSinceLastDamaged; // How many ticks ago were we last damaged by a player?
bool m_IsStriking;
-private:
/** Our parent */
cMonster * m_Parent;
+private:
+
// The mob we want to attack
cPawn * m_Target;
-
int m_StrikeTickCnt;
};
diff --git a/src/Mobs/Behaviors/BehaviorAttackerMelee.cpp b/src/Mobs/Behaviors/BehaviorAttackerMelee.cpp
index 42e88c637..337d8d216 100644
--- a/src/Mobs/Behaviors/BehaviorAttackerMelee.cpp
+++ b/src/Mobs/Behaviors/BehaviorAttackerMelee.cpp
@@ -3,9 +3,11 @@
#include "BehaviorAttackerMelee.h"
#include "../Monster.h"
#include "../../Entities/Pawn.h"
+#include "../../BlockID.h"
-bool cBehaviorAttackerMelee::StrikeTarget(std::chrono::milliseconds a_Dt, cChunk & a_Chunk, int a_StrikeTickCnt)
+bool cBehaviorAttackerMelee::StrikeTarget(int a_StrikeTickCnt)
{
- GetTarget()->TakeDamage(dtMobAttack, this, m_AttackDamage, 0);
- return true;
+ UNUSED(a_StrikeTickCnt);
+ GetTarget()->TakeDamage(dtMobAttack, m_Parent, m_AttackDamage, 0);
+ return true; // Finish the strike. It only takes 1 tick.
}
diff --git a/src/Mobs/Behaviors/BehaviorAttackerMelee.h b/src/Mobs/Behaviors/BehaviorAttackerMelee.h
index 6bfda0aa3..49a51ff71 100644
--- a/src/Mobs/Behaviors/BehaviorAttackerMelee.h
+++ b/src/Mobs/Behaviors/BehaviorAttackerMelee.h
@@ -7,5 +7,5 @@ This behavior does not make sense in combination with BehaviorCoward. */
class cBehaviorAttackerMelee : cBehaviorAttacker
{
public:
- bool StrikeTarget(std::chrono::milliseconds a_Dt, cChunk & a_Chunk, int a_StrikeTickCnt) override;
+ bool StrikeTarget(int a_StrikeTickCnt) override;
};
diff --git a/src/Mobs/CMakeLists.txt b/src/Mobs/CMakeLists.txt
index 5f43219e2..27eb92e7d 100644
--- a/src/Mobs/CMakeLists.txt
+++ b/src/Mobs/CMakeLists.txt
@@ -3,7 +3,6 @@ project (Cuberite)
include_directories ("${PROJECT_SOURCE_DIR}/../")
SET (SRCS
- AggressiveMonster.cpp
Bat.cpp
Blaze.cpp
CaveSpider.cpp
@@ -41,7 +40,6 @@ SET (SRCS
ZombiePigman.cpp)
SET (HDRS
- AggressiveMonster.h
Bat.h
Blaze.h
CaveSpider.h