summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-21 15:18:42 +0100
committerMattes D <github@xoft.cz>2014-12-21 15:18:42 +0100
commitd4c9daddb89cc8066f3fe36939447acbcf6c7400 (patch)
treeaf1a179ba5ac87c652b6e271c99628dee1ceb920 /src/Mobs
parentMerge branch 'master' of https://github.com/mc-server/MCServer (diff)
parentFixed damn empty line with no use (diff)
downloadcuberite-d4c9daddb89cc8066f3fe36939447acbcf6c7400.tar
cuberite-d4c9daddb89cc8066f3fe36939447acbcf6c7400.tar.gz
cuberite-d4c9daddb89cc8066f3fe36939447acbcf6c7400.tar.bz2
cuberite-d4c9daddb89cc8066f3fe36939447acbcf6c7400.tar.lz
cuberite-d4c9daddb89cc8066f3fe36939447acbcf6c7400.tar.xz
cuberite-d4c9daddb89cc8066f3fe36939447acbcf6c7400.tar.zst
cuberite-d4c9daddb89cc8066f3fe36939447acbcf6c7400.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/CMakeLists.txt2
-rw-r--r--src/Mobs/IncludeAllMonsters.h1
-rw-r--r--src/Mobs/Monster.cpp4
-rw-r--r--src/Mobs/MonsterTypes.h1
-rw-r--r--src/Mobs/Rabbit.cpp34
-rw-r--r--src/Mobs/Rabbit.h24
6 files changed, 66 insertions, 0 deletions
diff --git a/src/Mobs/CMakeLists.txt b/src/Mobs/CMakeLists.txt
index c1ac2de32..7a291dcf2 100644
--- a/src/Mobs/CMakeLists.txt
+++ b/src/Mobs/CMakeLists.txt
@@ -25,6 +25,7 @@ SET (SRCS
PassiveAggressiveMonster.cpp
PassiveMonster.cpp
Pig.cpp
+ Rabbit.cpp
Sheep.cpp
Skeleton.cpp
Slime.cpp
@@ -62,6 +63,7 @@ SET (HDRS
PassiveAggressiveMonster.h
PassiveMonster.h
Pig.h
+ Rabbit.h
Sheep.h
Silverfish.h
Skeleton.h
diff --git a/src/Mobs/IncludeAllMonsters.h b/src/Mobs/IncludeAllMonsters.h
index f5eb9dcc3..53c709c2b 100644
--- a/src/Mobs/IncludeAllMonsters.h
+++ b/src/Mobs/IncludeAllMonsters.h
@@ -15,6 +15,7 @@
#include "Mooshroom.h"
#include "Ocelot.h"
#include "Pig.h"
+#include "Rabbit.h"
#include "Sheep.h"
#include "Silverfish.h"
#include "Skeleton.h"
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 3d174677c..a02ea357e 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -45,6 +45,7 @@ static const struct
{mtMooshroom, "mooshroom", "MushroomCow"},
{mtOcelot, "ocelot", "Ozelot"},
{mtPig, "pig", "Pig"},
+ {mtRabbit, "rabbit", "Rabbit"},
{mtSheep, "sheep", "Sheep"},
{mtSilverfish, "silverfish", "Silverfish"},
{mtSkeleton, "skeleton", "Skeleton"},
@@ -499,6 +500,7 @@ void cMonster::KilledBy(TakeDamageInfo & a_TDI)
case mtCow:
case mtHorse:
case mtPig:
+ case mtRabbit:
case mtSheep:
case mtSquid:
case mtMooshroom:
@@ -851,6 +853,7 @@ cMonster::eFamily cMonster::FamilyFromType(eMonsterType a_Type)
case mtMooshroom: return mfHostile;
case mtOcelot: return mfPassive;
case mtPig: return mfPassive;
+ case mtRabbit: return mfPassive;
case mtSheep: return mfPassive;
case mtSilverfish: return mfHostile;
case mtSkeleton: return mfHostile;
@@ -963,6 +966,7 @@ cMonster * cMonster::NewMonsterFromType(eMonsterType a_MobType)
case mtMooshroom: toReturn = new cMooshroom(); break;
case mtOcelot: toReturn = new cOcelot(); break;
case mtPig: toReturn = new cPig(); break;
+ case mtRabbit: toReturn = new cRabbit(); break;
case mtSheep: toReturn = new cSheep(); break;
case mtSilverfish: toReturn = new cSilverfish(); break;
case mtSnowGolem: toReturn = new cSnowGolem(); break;
diff --git a/src/Mobs/MonsterTypes.h b/src/Mobs/MonsterTypes.h
index 0d716cca3..02bec267b 100644
--- a/src/Mobs/MonsterTypes.h
+++ b/src/Mobs/MonsterTypes.h
@@ -25,6 +25,7 @@ enum eMonsterType
mtMooshroom = E_META_SPAWN_EGG_MOOSHROOM,
mtOcelot = E_META_SPAWN_EGG_OCELOT,
mtPig = E_META_SPAWN_EGG_PIG,
+ mtRabbit = E_META_SPAWN_EGG_RABBIT,
mtSheep = E_META_SPAWN_EGG_SHEEP,
mtSilverfish = E_META_SPAWN_EGG_SILVERFISH,
mtSkeleton = E_META_SPAWN_EGG_SKELETON,
diff --git a/src/Mobs/Rabbit.cpp b/src/Mobs/Rabbit.cpp
new file mode 100644
index 000000000..cf49d2744
--- /dev/null
+++ b/src/Mobs/Rabbit.cpp
@@ -0,0 +1,34 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "Rabbit.h"
+#include "../Entities/Player.h"
+#include "../World.h"
+
+
+
+
+
+cRabbit::cRabbit(void) :
+ super("Rabbit", mtRabbit, "mob.rabbit.idle", "mob.rabbit.death", 0.82, 0.68)
+{
+}
+
+
+
+
+
+void cRabbit::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != nullptr)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, IsOnFire() ? E_ITEM_COOKED_RABBIT : E_ITEM_RAW_RABBIT);
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_RABBIT_HIDE);
+ cItems RareDrops;
+ RareDrops.Add(cItem(E_ITEM_RABBITS_FOOT));
+ AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+}
+
diff --git a/src/Mobs/Rabbit.h b/src/Mobs/Rabbit.h
new file mode 100644
index 000000000..e86c85579
--- /dev/null
+++ b/src/Mobs/Rabbit.h
@@ -0,0 +1,24 @@
+
+#pragma once
+
+#include "PassiveMonster.h"
+
+
+
+
+
+class cRabbit :
+ public cPassiveMonster
+{
+ typedef cPassiveMonster super;
+
+public:
+ cRabbit();
+
+ CLASS_PROTODEF(cRabbit)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
+
+ virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_CARROT); }
+
+} ;