summaryrefslogtreecommitdiffstats
path: root/src/Mobs/CaveSpider.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Mobs/CaveSpider.cpp37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/Mobs/CaveSpider.cpp b/src/Mobs/CaveSpider.cpp
index ba58cdf71..505e6a9df 100644
--- a/src/Mobs/CaveSpider.cpp
+++ b/src/Mobs/CaveSpider.cpp
@@ -2,15 +2,29 @@
#include "CaveSpider.h"
#include "../World.h"
+#include "Mobs/Behaviors/BehaviorAttackerMelee.h"
+
+
+void CaveSpiderPostAttack(cBehaviorAttackerMelee & a_Behavior, cMonster & a_Attacker, cPawn & a_Attacked)
+{
+ UNUSED(a_Behavior);
+ UNUSED(a_Attacker);
+ // TODO: Easy = no poison, Medium = 7 seconds, Hard = 15 seconds
+ a_Attacked.AddEntityEffect(cEntityEffect::effPoison, 7 * 20, 0);
+}
-cCaveSpider::cCaveSpider(void) :
- super(mtCaveSpider, "entity.spider.hurt", "entity.spider.death", 0.7, 0.5)
+cCaveSpider::cCaveSpider(void)
+ : super(mtCaveSpider, "entity.spider.hurt", "entity.spider.death", 0.7, 0.5)
+ , m_BehaviorAttackerMelee(CaveSpiderPostAttack)
{
m_EMPersonality = AGGRESSIVE;
+ m_BehaviorAttackerMelee.AttachToMonster(*this);
+ m_BehaviorWanderer.AttachToMonster(*this);
+ m_BehaviorAggressive.AttachToMonster(*this);
GetMonsterConfig("CaveSpider");
}
@@ -33,25 +47,6 @@ void cCaveSpider::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
-/*
-bool cCaveSpider::Attack(std::chrono::milliseconds a_Dt)
-{
- if (!super::Attack(a_Dt))
- {
- return false;
- }
-
- if (GetTarget()->IsPawn())
- {
- // TODO: Easy = no poison, Medium = 7 seconds, Hard = 15 seconds
- static_cast<cPawn *>(GetTarget())->AddEntityEffect(cEntityEffect::effPoison, 7 * 20, 0);
- }
- return true;
-}*/
-
-
-
-
void cCaveSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{