From c2f2ef7cb4e4232cae18aaddcc6c86253e6c859b Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 23 Apr 2014 14:56:39 -0700 Subject: Rename mob source files to fit CamelCase. Rename Cavespider.cpp to CaveSpider.cpp Rename Cavespider.h to CaveSpider.h Rename Magmacube.cpp to MagmaCube.cpp Rename Magmacube.h to MagmaCube.h Rename Zombiepigman.cpp to ZombiePigman.cpp Rename Zombiepigman.h to ZombiePigman.h --- src/Mobs/CaveSpider.cpp | 47 +++++++++++++++++++++++++++++++++++++++++ src/Mobs/CaveSpider.h | 25 ++++++++++++++++++++++ src/Mobs/Cavespider.cpp | 48 ----------------------------------------- src/Mobs/Cavespider.h | 26 ----------------------- src/Mobs/MagmaCube.cpp | 30 ++++++++++++++++++++++++++ src/Mobs/MagmaCube.h | 31 +++++++++++++++++++++++++++ src/Mobs/Magmacube.cpp | 31 --------------------------- src/Mobs/Magmacube.h | 32 ---------------------------- src/Mobs/ZombiePigman.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++++++ src/Mobs/ZombiePigman.h | 25 ++++++++++++++++++++++ src/Mobs/Zombiepigman.cpp | 54 ----------------------------------------------- src/Mobs/Zombiepigman.h | 26 ----------------------- 12 files changed, 211 insertions(+), 217 deletions(-) create mode 100644 src/Mobs/CaveSpider.cpp create mode 100644 src/Mobs/CaveSpider.h delete mode 100644 src/Mobs/Cavespider.cpp delete mode 100644 src/Mobs/Cavespider.h create mode 100644 src/Mobs/MagmaCube.cpp create mode 100644 src/Mobs/MagmaCube.h delete mode 100644 src/Mobs/Magmacube.cpp delete mode 100644 src/Mobs/Magmacube.h create mode 100644 src/Mobs/ZombiePigman.cpp create mode 100644 src/Mobs/ZombiePigman.h delete mode 100644 src/Mobs/Zombiepigman.cpp delete mode 100644 src/Mobs/Zombiepigman.h diff --git a/src/Mobs/CaveSpider.cpp b/src/Mobs/CaveSpider.cpp new file mode 100644 index 000000000..4660ae44d --- /dev/null +++ b/src/Mobs/CaveSpider.cpp @@ -0,0 +1,47 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Cavespider.h" +#include "../World.h" + + + + + +cCavespider::cCavespider(void) : + super("Cavespider", mtCaveSpider, "mob.spider.say", "mob.spider.death", 0.7, 0.5) +{ +} + + + + + +void cCavespider::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + + // TODO: Check vanilla if cavespiders really get passive during the day / in daylight + m_EMPersonality = (GetWorld()->GetTimeOfDay() < (12000 + 1000)) ? PASSIVE : AGGRESSIVE; +} + + + + + +void cCavespider::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STRING); + if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf"))) + { + AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_SPIDER_EYE); + } +} + + + + diff --git a/src/Mobs/CaveSpider.h b/src/Mobs/CaveSpider.h new file mode 100644 index 000000000..c2aacd2c7 --- /dev/null +++ b/src/Mobs/CaveSpider.h @@ -0,0 +1,25 @@ +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cCavespider : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cCavespider(void); + + CLASS_PROTODEF(cCaveSpider); + + virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; +} ; + + + + diff --git a/src/Mobs/Cavespider.cpp b/src/Mobs/Cavespider.cpp deleted file mode 100644 index 94e93283d..000000000 --- a/src/Mobs/Cavespider.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Cavespider.h" -#include "../World.h" - - - - - -cCavespider::cCavespider(void) : - super("Cavespider", mtCaveSpider, "mob.spider.say", "mob.spider.death", 0.7, 0.5) -{ -} - - - - - -void cCavespider::Tick(float a_Dt, cChunk & a_Chunk) -{ - super::Tick(a_Dt, a_Chunk); - - // TODO: Check vanilla if cavespiders really get passive during the day / in daylight - m_EMPersonality = (GetWorld()->GetTimeOfDay() < (12000 + 1000)) ? PASSIVE : AGGRESSIVE; -} - - - - - -void cCavespider::GetDrops(cItems & a_Drops, cEntity * a_Killer) -{ - int LootingLevel = 0; - if (a_Killer != NULL) - { - LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); - } - AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STRING); - if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf"))) - { - AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_SPIDER_EYE); - } -} - - - - diff --git a/src/Mobs/Cavespider.h b/src/Mobs/Cavespider.h deleted file mode 100644 index 10ea03f7b..000000000 --- a/src/Mobs/Cavespider.h +++ /dev/null @@ -1,26 +0,0 @@ - -#pragma once - -#include "AggressiveMonster.h" - - - - - -class cCavespider : - public cAggressiveMonster -{ - typedef cAggressiveMonster super; - -public: - cCavespider(void); - - CLASS_PROTODEF(cCaveSpider); - - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; -} ; - - - - diff --git a/src/Mobs/MagmaCube.cpp b/src/Mobs/MagmaCube.cpp new file mode 100644 index 000000000..064152072 --- /dev/null +++ b/src/Mobs/MagmaCube.cpp @@ -0,0 +1,30 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Magmacube.h" + + + + + +cMagmaCube::cMagmaCube(int a_Size) : + super("MagmaCube", mtMagmaCube, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size), + m_Size(a_Size) +{ +} + + + + + +void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + UNUSED(a_Killer); + if (GetSize() > 1) + { + AddRandomUncommonDropItem(a_Drops, 25.0f, E_ITEM_MAGMA_CREAM); + } +} + + + + diff --git a/src/Mobs/MagmaCube.h b/src/Mobs/MagmaCube.h new file mode 100644 index 000000000..43065cae5 --- /dev/null +++ b/src/Mobs/MagmaCube.h @@ -0,0 +1,31 @@ +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cMagmaCube : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + /// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest + cMagmaCube(int a_Size); + + CLASS_PROTODEF(cMagmaCube); + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + int GetSize(void) const { return m_Size; } + +protected: + + /// Size of the MagmaCube, 1 .. 3, with 1 being the smallest + int m_Size; +} ; + + + + diff --git a/src/Mobs/Magmacube.cpp b/src/Mobs/Magmacube.cpp deleted file mode 100644 index 05405f082..000000000 --- a/src/Mobs/Magmacube.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Magmacube.h" - - - - - -cMagmaCube::cMagmaCube(int a_Size) : - super("MagmaCube", mtMagmaCube, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size), - m_Size(a_Size) -{ -} - - - - - -void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer) -{ - UNUSED(a_Killer); - if (GetSize() > 1) - { - AddRandomUncommonDropItem(a_Drops, 25.0f, E_ITEM_MAGMA_CREAM); - } -} - - - - diff --git a/src/Mobs/Magmacube.h b/src/Mobs/Magmacube.h deleted file mode 100644 index 130952970..000000000 --- a/src/Mobs/Magmacube.h +++ /dev/null @@ -1,32 +0,0 @@ - -#pragma once - -#include "AggressiveMonster.h" - - - - - -class cMagmaCube : - public cAggressiveMonster -{ - typedef cAggressiveMonster super; - -public: - /// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest - cMagmaCube(int a_Size); - - CLASS_PROTODEF(cMagmaCube); - - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - int GetSize(void) const { return m_Size; } - -protected: - - /// Size of the MagmaCube, 1 .. 3, with 1 being the smallest - int m_Size; -} ; - - - - diff --git a/src/Mobs/ZombiePigman.cpp b/src/Mobs/ZombiePigman.cpp new file mode 100644 index 000000000..b6f95a3e1 --- /dev/null +++ b/src/Mobs/ZombiePigman.cpp @@ -0,0 +1,53 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Zombiepigman.h" +#include "../World.h" + + + + + +cZombiePigman::cZombiePigman(void) : + super("ZombiePigman", mtZombiePigman, "mob.zombiepig.zpighurt", "mob.zombiepig.zpigdeath", 0.6, 1.8) +{ +} + + + + + +void cZombiePigman::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ROTTEN_FLESH); + AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_GOLD_NUGGET); + + cItems RareDrops; + RareDrops.Add(cItem(E_ITEM_GOLD)); + AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel); + AddRandomArmorDropItem(a_Drops, LootingLevel); + AddRandomWeaponDropItem(a_Drops, LootingLevel); +} + + + + + +void cZombiePigman::KilledBy(cEntity * a_Killer) +{ + super::KilledBy(a_Killer); + + if ((a_Killer != NULL) && (a_Killer->IsPlayer())) + { + // TODO: Anger all nearby zombie pigmen + // TODO: In vanilla, if one player angers ZPs, do they attack any nearby player, or only that one attacker? + } +} + + + + diff --git a/src/Mobs/ZombiePigman.h b/src/Mobs/ZombiePigman.h new file mode 100644 index 000000000..ab3cebf6d --- /dev/null +++ b/src/Mobs/ZombiePigman.h @@ -0,0 +1,25 @@ +#pragma once + +#include "PassiveAggressiveMonster.h" + + + + + +class cZombiePigman : + public cPassiveAggressiveMonster +{ + typedef cPassiveAggressiveMonster super; + +public: + cZombiePigman(void); + + CLASS_PROTODEF(cZombiePigman); + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + virtual void KilledBy(cEntity * a_Killer) override; +} ; + + + + diff --git a/src/Mobs/Zombiepigman.cpp b/src/Mobs/Zombiepigman.cpp deleted file mode 100644 index a0142b566..000000000 --- a/src/Mobs/Zombiepigman.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Zombiepigman.h" -#include "../World.h" - - - - - -cZombiePigman::cZombiePigman(void) : - super("ZombiePigman", mtZombiePigman, "mob.zombiepig.zpighurt", "mob.zombiepig.zpigdeath", 0.6, 1.8) -{ -} - - - - - -void cZombiePigman::GetDrops(cItems & a_Drops, cEntity * a_Killer) -{ - int LootingLevel = 0; - if (a_Killer != NULL) - { - LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); - } - AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ROTTEN_FLESH); - AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_GOLD_NUGGET); - - cItems RareDrops; - RareDrops.Add(cItem(E_ITEM_GOLD)); - AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel); - AddRandomArmorDropItem(a_Drops, LootingLevel); - AddRandomWeaponDropItem(a_Drops, LootingLevel); -} - - - - - -void cZombiePigman::KilledBy(cEntity * a_Killer) -{ - super::KilledBy(a_Killer); - - if ((a_Killer != NULL) && (a_Killer->IsPlayer())) - { - // TODO: Anger all nearby zombie pigmen - // TODO: In vanilla, if one player angers ZPs, do they attack any nearby player, or only that one attacker? - } -} - - - - diff --git a/src/Mobs/Zombiepigman.h b/src/Mobs/Zombiepigman.h deleted file mode 100644 index 67991d56a..000000000 --- a/src/Mobs/Zombiepigman.h +++ /dev/null @@ -1,26 +0,0 @@ - -#pragma once - -#include "PassiveAggressiveMonster.h" - - - - - -class cZombiePigman : - public cPassiveAggressiveMonster -{ - typedef cPassiveAggressiveMonster super; - -public: - cZombiePigman(void); - - CLASS_PROTODEF(cZombiePigman); - - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void KilledBy(cEntity * a_Killer) override; -} ; - - - - -- cgit v1.2.3