From 6a27ec2ea0a707d44580dc19e52bb4b6181bb403 Mon Sep 17 00:00:00 2001 From: bibo38 Date: Fri, 17 Jul 2015 01:09:06 +0200 Subject: Added Rabbit Metadata values. Added the Rabbit Types and the MoreCarrotTicks value. Types are selected randomly on creation. Fixes #1867 --- src/Mobs/Rabbit.cpp | 15 ++++++++++++++- src/Mobs/Rabbit.h | 25 ++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) (limited to 'src/Mobs') diff --git a/src/Mobs/Rabbit.cpp b/src/Mobs/Rabbit.cpp index c7f3d58f0..9d10212bf 100644 --- a/src/Mobs/Rabbit.cpp +++ b/src/Mobs/Rabbit.cpp @@ -10,7 +10,20 @@ cRabbit::cRabbit(void) : - super("Rabbit", mtRabbit, "mob.rabbit.idle", "mob.rabbit.death", 0.82, 0.68) + cRabbit(static_cast(cFastRandom().NextInt( + static_cast(eRabbitType::SaltAndPepper) + 1 // Max possible Rabbit-Type + )), 0) +{ +} + + + + + +cRabbit::cRabbit(eRabbitType Type, int MoreCarrotTicks) : + super("Rabbit", mtRabbit, "mob.rabbit.idle", "mob.rabbit.death", 0.82, 0.68), + m_Type(Type), + m_MoreCarrotTicks(MoreCarrotTicks) { } diff --git a/src/Mobs/Rabbit.h b/src/Mobs/Rabbit.h index e86c85579..56181e3d0 100644 --- a/src/Mobs/Rabbit.h +++ b/src/Mobs/Rabbit.h @@ -7,6 +7,21 @@ +enum class eRabbitType : UInt8 +{ + Brown = 0, + White = 1, + Black = 2, + BlackAndWhite = 3, + Gold = 4, + SaltAndPepper = 5, + TheKillerBunny = 99 +}; + + + + + class cRabbit : public cPassiveMonster { @@ -14,11 +29,19 @@ class cRabbit : public: cRabbit(); + cRabbit(eRabbitType Type, int MoreCarrotTicks = 0); 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); } + eRabbitType GetRabbitType() const { return m_Type; } + UInt8 GetRabbitTypeAsNumber() const { return static_cast(GetRabbitType()); } + int GetMoreCarrotTicks() const { return m_MoreCarrotTicks; } + +private: + + eRabbitType m_Type; + int m_MoreCarrotTicks; // Ticks until the Rabbit eat planted Carrots } ; -- cgit v1.2.3