diff options
Diffstat (limited to 'source/Mobs/Monster.cpp')
-rw-r--r-- | source/Mobs/Monster.cpp | 74 |
1 files changed, 43 insertions, 31 deletions
diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp index 167a07486..8a5717e27 100644 --- a/source/Mobs/Monster.cpp +++ b/source/Mobs/Monster.cpp @@ -624,61 +624,73 @@ int cMonster::GetSpawnDelay(cMonster::eFamily a_MobFamily) cMonster * cMonster::NewMonsterFromType(cMonster::eType a_MobType) { + cFastRandom Random; cMonster * toReturn = NULL; - cFastRandom RandomDerps; // Create the mob entity switch (a_MobType) { case mtMagmaCube: - case mtSlime: toReturn = new cSlime (RandomDerps.NextInt(2) + 1); break; // Size parameter - case mtSheep: toReturn = new cSheep (RandomDerps.NextInt(15)); break; // Colour parameter - case mtZombie: toReturn = new cZombie (false); break; // TODO: Infected zombie parameter + case mtSlime: + { + toReturn = new cSlime (Random.NextInt(2) + 1); + break; + } case mtSkeleton: { // TODO: Actual detection of spawning in Nether - toReturn = new cSkeleton(RandomDerps.NextInt(1) == 0 ? false : true); + toReturn = new cSkeleton(Random.NextInt(1) == 0 ? false : true); break; } case mtVillager: { - int VilType = RandomDerps.NextInt(6); - if (VilType == 6) { VilType = 0; } // Give farmers a better chance of spawning + int VillagerType = Random.NextInt(6); + if (VillagerType == 6) + { + // Give farmers a better chance of spawning + VillagerType = 0; + } - toReturn = new cVillager(cVillager::eVillagerType(VilType)); // Type (blacksmith, butcher, etc.) parameter + toReturn = new cVillager((cVillager::eVillagerType)VillagerType); break; } case mtHorse: { // Horses take a type (species), a colour, and a style (dots, stripes, etc.) - int HseType = RandomDerps.NextInt(7); - int HseColor = RandomDerps.NextInt(6); - int HseStyle = RandomDerps.NextInt(6); - int HseTameTimes = RandomDerps.NextInt(6) + 1; + int HorseType = Random.NextInt(7); + int HorseColor = Random.NextInt(6); + int HorseStyle = Random.NextInt(6); + int HorseTameTimes = Random.NextInt(6) + 1; - if ((HseType == 5) || (HseType == 6) || (HseType == 7)) { HseType = 0; } // Increase chances of normal horse (zero) + if ((HorseType == 5) || (HorseType == 6) || (HorseType == 7)) + { + // Increase chances of normal horse (zero) + HorseType = 0; + } - toReturn = new cHorse(HseType, HseColor, HseStyle, HseTameTimes); + toReturn = new cHorse(HorseType, HorseColor, HorseStyle, HorseTameTimes); break; } - case mtBat: toReturn = new cBat(); break; - case mtBlaze: toReturn = new cBlaze(); break; - case mtCaveSpider: toReturn = new cCavespider(); break; - case mtChicken: toReturn = new cChicken(); break; - case mtCow: toReturn = new cCow(); break; - case mtCreeper: toReturn = new cCreeper(); break; - case mtEnderman: toReturn = new cEnderman(); break; - case mtGhast: toReturn = new cGhast(); break; - case mtMooshroom: toReturn = new cMooshroom(); break; - case mtOcelot: toReturn = new cOcelot(); break; - case mtPig: toReturn = new cPig(); break; - case mtSilverfish: toReturn = new cSilverfish(); break; - case mtSpider: toReturn = new cSpider(); break; - case mtSquid: toReturn = new cSquid(); break; - case mtWitch: toReturn = new cWitch(); break; - case mtWolf: toReturn = new cWolf(); break; - case mtZombiePigman: toReturn = new cZombiePigman(); break; + case mtBat: toReturn = new cBat(); break; + case mtBlaze: toReturn = new cBlaze(); break; + case mtCaveSpider: toReturn = new cCavespider(); break; + case mtChicken: toReturn = new cChicken(); break; + case mtCow: toReturn = new cCow(); break; + case mtCreeper: toReturn = new cCreeper(); break; + case mtEnderman: toReturn = new cEnderman(); break; + case mtGhast: toReturn = new cGhast(); break; + case mtMooshroom: toReturn = new cMooshroom(); break; + case mtOcelot: toReturn = new cOcelot(); break; + case mtPig: toReturn = new cPig(); break; + case mtSheep: toReturn = new cSheep (Random.NextInt(15)); break; // Colour parameter + case mtSilverfish: toReturn = new cSilverfish(); break; + case mtSpider: toReturn = new cSpider(); break; + case mtSquid: toReturn = new cSquid(); break; + case mtWitch: toReturn = new cWitch(); break; + case mtWolf: toReturn = new cWolf(); break; + case mtZombie: toReturn = new cZombie(false); break; // TODO: Infected zombie parameter + case mtZombiePigman: toReturn = new cZombiePigman(); break; default: { ASSERT(!"Unhandled mob type whilst trying to spawn mob!"); |