From 3e698d7b72ad7f58a1a2ab787f49c82e096845f6 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 18 Sep 2013 22:17:43 +0100 Subject: Added moar mobs! + Added dragons + Added golems + Added giants + Added horses + Added some missing items + Added missing spawn egg metas --- source/Mobs/EnderDragon.cpp | 27 +++++++++++++++++++++++++++ source/Mobs/EnderDragon.h | 25 +++++++++++++++++++++++++ source/Mobs/Giant.cpp | 27 +++++++++++++++++++++++++++ source/Mobs/Giant.h | 25 +++++++++++++++++++++++++ source/Mobs/Horse.cpp | 26 ++++++++++++++++++++++++++ source/Mobs/Horse.h | 25 +++++++++++++++++++++++++ source/Mobs/IronGolem.cpp | 26 ++++++++++++++++++++++++++ source/Mobs/IronGolem.h | 25 +++++++++++++++++++++++++ source/Mobs/Magmacube.cpp | 8 ++++---- source/Mobs/Magmacube.h | 10 +++++----- source/Mobs/Monster.h | 44 +++++++++++++++++++++++--------------------- source/Mobs/SnowGolem.cpp | 26 ++++++++++++++++++++++++++ source/Mobs/SnowGolem.h | 25 +++++++++++++++++++++++++ source/Mobs/Wither.cpp | 26 ++++++++++++++++++++++++++ source/Mobs/Wither.h | 25 +++++++++++++++++++++++++ source/Mobs/Zombiepigman.cpp | 26 +++++--------------------- source/Mobs/Zombiepigman.h | 7 +++---- 17 files changed, 348 insertions(+), 55 deletions(-) create mode 100644 source/Mobs/EnderDragon.cpp create mode 100644 source/Mobs/EnderDragon.h create mode 100644 source/Mobs/Giant.cpp create mode 100644 source/Mobs/Giant.h create mode 100644 source/Mobs/Horse.cpp create mode 100644 source/Mobs/Horse.h create mode 100644 source/Mobs/IronGolem.cpp create mode 100644 source/Mobs/IronGolem.h create mode 100644 source/Mobs/SnowGolem.cpp create mode 100644 source/Mobs/SnowGolem.h create mode 100644 source/Mobs/Wither.cpp create mode 100644 source/Mobs/Wither.h (limited to 'source/Mobs') diff --git a/source/Mobs/EnderDragon.cpp b/source/Mobs/EnderDragon.cpp new file mode 100644 index 000000000..64f2bedfa --- /dev/null +++ b/source/Mobs/EnderDragon.cpp @@ -0,0 +1,27 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "EnderDragon.h" + + + + + +cEnderDragon::cEnderDragon(void) : + // TODO: Vanilla source says this, but is it right? Dragons fly, they don't stand + super("EnderDragon", 63, "mob.enderdragon.hit", "mob.enderdragon.end", 16.0, 8.0) +{ +} + + + + + +void cEnderDragon::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + return; +} + + + + diff --git a/source/Mobs/EnderDragon.h b/source/Mobs/EnderDragon.h new file mode 100644 index 000000000..77177edfe --- /dev/null +++ b/source/Mobs/EnderDragon.h @@ -0,0 +1,25 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cEnderDragon : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cEnderDragon(void); + + CLASS_PROTODEF(cEnderDragon); + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; +} ; + + + + diff --git a/source/Mobs/Giant.cpp b/source/Mobs/Giant.cpp new file mode 100644 index 000000000..a02758a43 --- /dev/null +++ b/source/Mobs/Giant.cpp @@ -0,0 +1,27 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Giant.h" + + + + + +cGiant::cGiant(void) : + // TODO: The size is only a guesstimate, measure in vanilla and fix the size values here + super("Giant", 53, "mob.zombie.hurt", "mob.zombie.death", 2.0, 13.5) +{ +} + + + + + +void cGiant::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + AddRandomDropItem(a_Drops, 10, 50, E_ITEM_ROTTEN_FLESH); +} + + + + diff --git a/source/Mobs/Giant.h b/source/Mobs/Giant.h new file mode 100644 index 000000000..356dd4352 --- /dev/null +++ b/source/Mobs/Giant.h @@ -0,0 +1,25 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cGiant : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cGiant(void); + + CLASS_PROTODEF(cGiant); + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; +} ; + + + + diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp new file mode 100644 index 000000000..05ac73c15 --- /dev/null +++ b/source/Mobs/Horse.cpp @@ -0,0 +1,26 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Horse.h" + + + + + +cHorse::cHorse(void) : + super("Horse", 100, "mob.horse.hit", "mob.horse.death", 1.4, 1.6) +{ +} + + + + + +void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + AddRandomDropItem(a_Drops, 0, 2, E_ITEM_LEATHER); +} + + + + diff --git a/source/Mobs/Horse.h b/source/Mobs/Horse.h new file mode 100644 index 000000000..a568fbbe3 --- /dev/null +++ b/source/Mobs/Horse.h @@ -0,0 +1,25 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cHorse : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cHorse(void); + + CLASS_PROTODEF(cHorse); + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; +} ; + + + + diff --git a/source/Mobs/IronGolem.cpp b/source/Mobs/IronGolem.cpp new file mode 100644 index 000000000..42d312c23 --- /dev/null +++ b/source/Mobs/IronGolem.cpp @@ -0,0 +1,26 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "IronGolem.h" + + + + + +cIronGolem::cIronGolem(void) : + super("IronGolem", 99, "mob.IronGolem.hit", "mob.IronGolem.death", 1.4, 2.9) +{ +} + + + + + +void cIronGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + AddRandomDropItem(a_Drops, 0, 5, E_ITEM_IRON); +} + + + + diff --git a/source/Mobs/IronGolem.h b/source/Mobs/IronGolem.h new file mode 100644 index 000000000..0f2298061 --- /dev/null +++ b/source/Mobs/IronGolem.h @@ -0,0 +1,25 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cIronGolem : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cIronGolem(void); + + CLASS_PROTODEF(cIronGolem); + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; +} ; + + + + diff --git a/source/Mobs/Magmacube.cpp b/source/Mobs/Magmacube.cpp index 0b9b57e3c..7d553758e 100644 --- a/source/Mobs/Magmacube.cpp +++ b/source/Mobs/Magmacube.cpp @@ -1,14 +1,14 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules -#include "Magmacube.h" +#include "MagmaCube.h" -cMagmacube::cMagmacube(int a_Size) : - super("Magmacube", 62, "mob.magmacube.big", "mob.magmacube.big", 0.6 * a_Size, 0.6 * a_Size), +cMagmaCube::cMagmaCube(int a_Size) : + super("MagmaCube", 62, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size), m_Size(a_Size) { } @@ -17,7 +17,7 @@ cMagmacube::cMagmacube(int a_Size) : -void cMagmacube::GetDrops(cItems & a_Drops, cEntity * a_Killer) +void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer) { AddRandomDropItem(a_Drops, 0, 1, E_ITEM_MAGMA_CREAM); } diff --git a/source/Mobs/Magmacube.h b/source/Mobs/Magmacube.h index e4df4f33d..80a1d0701 100644 --- a/source/Mobs/Magmacube.h +++ b/source/Mobs/Magmacube.h @@ -7,22 +7,22 @@ -class cMagmacube : +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); + /// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest + cMagmaCube(int a_Size); - CLASS_PROTODEF(cMagmacube); + CLASS_PROTODEF(cMagmaCube); virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; protected: - /// Size of the magmacube, 1 .. 3, with 1 being the smallest + /// Size of the MagmaCube, 1 .. 3, with 1 being the smallest int m_Size; } ; diff --git a/source/Mobs/Monster.h b/source/Mobs/Monster.h index 484e32c65..b2676f5b1 100644 --- a/source/Mobs/Monster.h +++ b/source/Mobs/Monster.h @@ -26,34 +26,36 @@ public: /// This identifies individual monster type, as well as their network type-ID enum eType { + mtBat = E_META_SPAWN_EGG_BAT, + mtBlaze = E_META_SPAWN_EGG_BLAZE, + mtCaveSpider = E_META_SPAWN_EGG_CAVE_SPIDER, + mtChicken = E_META_SPAWN_EGG_CHICKEN, + mtCow = E_META_SPAWN_EGG_COW, mtCreeper = E_META_SPAWN_EGG_CREEPER, - mtSkeleton = E_META_SPAWN_EGG_SKELETON, - mtSpider = E_META_SPAWN_EGG_SPIDER, - mtGiant = E_META_SPAWN_EGG_GIANT, - mtZombie = E_META_SPAWN_EGG_ZOMBIE, - mtSlime = E_META_SPAWN_EGG_SLIME, - mtGhast = E_META_SPAWN_EGG_GHAST, - mtZombiePigman = E_META_SPAWN_EGG_ZOMBIE_PIGMAN, + mtEnderDragon = E_META_SPAWN_EGG_ENDER_DRAGON, mtEnderman = E_META_SPAWN_EGG_ENDERMAN, - mtCaveSpider = E_META_SPAWN_EGG_CAVE_SPIDER, - mtSilverfish = E_META_SPAWN_EGG_SILVERFISH, - mtBlaze = E_META_SPAWN_EGG_BLAZE, + mtGhast = E_META_SPAWN_EGG_GHAST, + mtGiant = E_META_SPAWN_EGG_GIANT, + mtHorse = E_META_SPAWN_EGG_HORSE, + mtIronGolem = E_META_SPAWN_EGG_IRON_GOLEM, mtMagmaCube = E_META_SPAWN_EGG_MAGMA_CUBE, - mtEnderDragon = E_META_SPAWN_EGG_ENDER_DRAGON, - mtWither = E_META_SPAWN_EGG_WITHER, - mtBat = E_META_SPAWN_EGG_BAT, - mtWitch = E_META_SPAWN_EGG_WITCH, + mtMooshroom = E_META_SPAWN_EGG_MOOSHROOM, + mtOcelot = E_META_SPAWN_EGG_OCELOT, mtPig = E_META_SPAWN_EGG_PIG, mtSheep = E_META_SPAWN_EGG_SHEEP, - mtCow = E_META_SPAWN_EGG_COW, - mtChicken = E_META_SPAWN_EGG_CHICKEN, - mtSquid = E_META_SPAWN_EGG_SQUID, - mtWolf = E_META_SPAWN_EGG_WOLF, - mtMooshroom = E_META_SPAWN_EGG_MOOSHROOM, + mtSilverfish = E_META_SPAWN_EGG_SILVERFISH, + mtSkeleton = E_META_SPAWN_EGG_SKELETON, + mtSlime = E_META_SPAWN_EGG_SLIME, mtSnowGolem = E_META_SPAWN_EGG_SNOW_GOLEM, - mtOcelot = E_META_SPAWN_EGG_OCELOT, - mtIronGolem = E_META_SPAWN_EGG_IRON_GOLEM, + mtSpider = E_META_SPAWN_EGG_SPIDER, + mtSquid = E_META_SPAWN_EGG_SQUID, mtVillager = E_META_SPAWN_EGG_VILLAGER, + mtWitch = E_META_SPAWN_EGG_WITCH, + mtWither = E_META_SPAWN_EGG_WITHER, + mtWolf = E_META_SPAWN_EGG_WOLF, + mtZombie = E_META_SPAWN_EGG_ZOMBIE, + mtZombiePigman = E_META_SPAWN_EGG_ZOMBIE_PIGMAN, + } ; // tolua_end diff --git a/source/Mobs/SnowGolem.cpp b/source/Mobs/SnowGolem.cpp new file mode 100644 index 000000000..51125542d --- /dev/null +++ b/source/Mobs/SnowGolem.cpp @@ -0,0 +1,26 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "SnowGolem.h" + + + + + +cSnowGolem::cSnowGolem(void) : + super("SnowGolem", 97, "", "", 0.4, 1.8) +{ +} + + + + + +void cSnowGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + AddRandomDropItem(a_Drops, 0, 5, E_ITEM_SNOWBALL); +} + + + + diff --git a/source/Mobs/SnowGolem.h b/source/Mobs/SnowGolem.h new file mode 100644 index 000000000..d1344adfd --- /dev/null +++ b/source/Mobs/SnowGolem.h @@ -0,0 +1,25 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cSnowGolem : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cSnowGolem(void); + + CLASS_PROTODEF(cSnowGolem); + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; +} ; + + + + diff --git a/source/Mobs/Wither.cpp b/source/Mobs/Wither.cpp new file mode 100644 index 000000000..8b77284c8 --- /dev/null +++ b/source/Mobs/Wither.cpp @@ -0,0 +1,26 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Wither.h" + + + + + +cWither::cWither(void) : + super("Wither", 64, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0) +{ +} + + + + + +void cWither::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + AddRandomDropItem(a_Drops, 1, 1, E_ITEM_NETHER_STAR); +} + + + + diff --git a/source/Mobs/Wither.h b/source/Mobs/Wither.h new file mode 100644 index 000000000..56effc6bb --- /dev/null +++ b/source/Mobs/Wither.h @@ -0,0 +1,25 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cWither : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cWither(void); + + CLASS_PROTODEF(cWither); + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; +} ; + + + + diff --git a/source/Mobs/Zombiepigman.cpp b/source/Mobs/Zombiepigman.cpp index 09b44816f..1aea006a6 100644 --- a/source/Mobs/Zombiepigman.cpp +++ b/source/Mobs/Zombiepigman.cpp @@ -1,15 +1,15 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules -#include "Zombiepigman.h" +#include "ZombiePigman.h" #include "../World.h" -cZombiepigman::cZombiepigman(void) : - super("Zombiepigman", 57, "mob.zombiepig.zpighurt", "mob.zombiepig.zpigdeath", 0.6, 1.8) +cZombiePigman::cZombiePigman(void) : + super("ZombiePigman", 57, "mob.zombiepig.zpighurt", "mob.zombiepig.zpigdeath", 0.6, 1.8) { } @@ -17,23 +17,7 @@ cZombiepigman::cZombiepigman(void) : -void cZombiepigman::Tick(float a_Dt, cChunk & a_Chunk) -{ - super::Tick(a_Dt, a_Chunk); - - // TODO Same as noticed in cSkeleton AND Do they really burn by sun?? :D In the neather is no sun :D - if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsOnFire()) - { - // Burn for 10 ticks, then decide again - StartBurning(10); - } -} - - - - - -void cZombiepigman::GetDrops(cItems & a_Drops, cEntity * a_Killer) +void cZombiePigman::GetDrops(cItems & a_Drops, cEntity * a_Killer) { AddRandomDropItem(a_Drops, 0, 1, E_ITEM_ROTTEN_FLESH); AddRandomDropItem(a_Drops, 0, 1, E_ITEM_GOLD_NUGGET); @@ -45,7 +29,7 @@ void cZombiepigman::GetDrops(cItems & a_Drops, cEntity * a_Killer) -void cZombiepigman::KilledBy(cEntity * a_Killer) +void cZombiePigman::KilledBy(cEntity * a_Killer) { super::KilledBy(a_Killer); diff --git a/source/Mobs/Zombiepigman.h b/source/Mobs/Zombiepigman.h index fe8c6d047..67991d56a 100644 --- a/source/Mobs/Zombiepigman.h +++ b/source/Mobs/Zombiepigman.h @@ -7,17 +7,16 @@ -class cZombiepigman : +class cZombiePigman : public cPassiveAggressiveMonster { typedef cPassiveAggressiveMonster super; public: - cZombiepigman(void); + cZombiePigman(void); - CLASS_PROTODEF(cZombiepigman); + CLASS_PROTODEF(cZombiePigman); - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void KilledBy(cEntity * a_Killer) override; } ; -- cgit v1.2.3