1
0

Added Rabbits

This commit is contained in:
Masy98 2014-12-20 10:31:34 +01:00
parent ffd8356fc1
commit 6e8e1c6d8d
14 changed files with 229 additions and 116 deletions

View File

@ -1,56 +1,14 @@
[Spider] [Bat]
AttackRange=2.0 AttackRange=2.0
AttackRate=1 AttackRate=1
AttackDamage=2.0 AttackDamage=0.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=16 MaxHealth=6
[Chicken] [Blaze]
AttackRange=2.0 AttackRange=15.0
AttackRate=1 AttackRate=1
AttackDamage=1.0 AttackDamage=6.0
SightDistance=25.0
MaxHealth=4
[Cow]
AttackRange=2.0
AttackRate=1
AttackDamage=1.0
SightDistance=25.0
MaxHealth=10
[Pig]
AttackRange=2.0
AttackRate=1
AttackDamage=1.0
SightDistance=25.0
MaxHealth=10
[Sheep]
AttackRange=2.0
AttackRate=1
AttackDamage=1.0
SightDistance=25.0
MaxHealth=8
[Squid]
AttackRange=2.0
AttackRate=1
AttackDamage=1.0
SightDistance=25.0
MaxHealth=10
[Enderman]
AttackRange=2.0
AttackRate=1
AttackDamage=4.0
SightDistance=64.0
MaxHealth=40
[ZombiePigman]
AttackRange=2.0
AttackRate=1
AttackDamage=7.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=20 MaxHealth=20
IsFireproof=1 IsFireproof=1
@ -62,6 +20,20 @@ AttackDamage=2.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=12 MaxHealth=12
[Chicken]
AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=4
[Cow]
AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=10
[Creeper] [Creeper]
AttackRange=3.0 AttackRange=3.0
AttackRate=1 AttackRate=1
@ -69,6 +41,21 @@ AttackDamage=0.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=20 MaxHealth=20
[EnderDragon]
AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=200
[Enderman]
AttackRange=2.0
AttackRate=1
AttackDamage=4.0
SightDistance=64.0
MaxHealth=40
[Ghast] [Ghast]
AttackRange=50.0 AttackRange=50.0
AttackRate=1 AttackRate=1
@ -77,6 +64,77 @@ SightDistance=50.0
MaxHealth=10 MaxHealth=10
IsFireproof=1 IsFireproof=1
[Giant]
AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=100
[Guardian]
AttackRange=2.0
AttackRate=1
AttackDamage=9.0
SightDistance=25.0
MaxHealth=30
[Horse]
AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=30
[IronGolem]
AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=100
[MagmaCube]
AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=16
IsFireproof=1
[Mooshroom]
AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=10
[Ocelot]
AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=10
[Pig]
AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=10
[Rabbit]
AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=10
[Sheep]
AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=8
[Silverfish] [Silverfish]
AttackRange=2.0 AttackRange=2.0
AttackRate=1 AttackRate=1
@ -97,27 +155,26 @@ AttackDamage=4.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=16 MaxHealth=16
[Zombie] [SnowGolem]
AttackRange=2.0 AttackRange=2.0
AttackRate=1 AttackRate=1
AttackDamage=4.0 AttackDamage=0.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=20 MaxHealth=4
[Wolf] [Spider]
AttackRange=2.0 AttackRange=2.0
AttackRate=1 AttackRate=1
AttackDamage=4.0 AttackDamage=2.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=20 MaxHealth=16
[Blaze] [Squid]
AttackRange=15.0 AttackRange=2.0
AttackRate=1 AttackRate=1
AttackDamage=6.0 AttackDamage=0.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=20 MaxHealth=10
IsFireproof=1
[Villager] [Villager]
AttackRange=2.0 AttackRange=2.0
@ -125,7 +182,6 @@ AttackRate=1
AttackDamage=0.0 AttackDamage=0.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=20 MaxHealth=20
IsFireproof=0
[Witch] [Witch]
AttackRange=2.0 AttackRange=2.0
@ -134,68 +190,24 @@ AttackDamage=0.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=26 MaxHealth=26
[Wolf]
[Ocelot]
AttackRange=2.0 AttackRange=2.0
AttackRate=1 AttackRate=1
AttackDamage=0.0 AttackDamage=4.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=10 MaxHealth=20
[Mooshroom] [Zombie]
AttackRange=2.0 AttackRange=2.0
AttackRate=1 AttackRate=1
AttackDamage=0.0 AttackDamage=4.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=10 MaxHealth=20
[MagmaCube] [ZombiePigman]
AttackRange=2.0 AttackRange=2.0
AttackRate=1 AttackRate=1
AttackDamage=6.0 AttackDamage=7.0
SightDistance=25.0 SightDistance=25.0
MaxHealth=16 MaxHealth=20
IsFireproof=1 IsFireproof=1
[Horse]
AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=30
[EnderDragon]
AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=200
[Giant]
AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=100
[IronGolem]
AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=100
[Bat]
AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=6
[Guardian]
AttackRange=2.0
AttackRate=1
AttackDamage=9.0
SightDistance=25.0
MaxHealth=30

View File

@ -32,6 +32,7 @@ struct
{entOzelot, "Ozelot"}, {entOzelot, "Ozelot"},
{entPig, "Pig"}, {entPig, "Pig"},
{entPigZombie, "PigZombie"}, {entPigZombie, "PigZombie"},
{entRabbit, "Rabbit"},
{entSheep, "Sheep"}, {entSheep, "Sheep"},
{entSilverfish, "Slverfish"}, {entSilverfish, "Slverfish"},
{entSkeleton, "Skeleton"}, {entSkeleton, "Skeleton"},

View File

@ -31,6 +31,7 @@ enum eEntityType
entOzelot, entOzelot,
entPig, entPig,
entPigZombie, entPigZombie,
entRabbit,
entSheep, entSheep,
entSilverfish, entSilverfish,
entSkeleton, entSkeleton,

View File

@ -971,6 +971,7 @@ enum
E_META_SPAWN_EGG_OCELOT = 98, E_META_SPAWN_EGG_OCELOT = 98,
E_META_SPAWN_EGG_IRON_GOLEM = 99, E_META_SPAWN_EGG_IRON_GOLEM = 99,
E_META_SPAWN_EGG_HORSE = 100, E_META_SPAWN_EGG_HORSE = 100,
E_META_SPAWN_EGG_RABBIT = 101,
E_META_SPAWN_EGG_VILLAGER = 120, E_META_SPAWN_EGG_VILLAGER = 120,
E_META_SPAWN_EGG_ENDER_CRYSTAL = 200, E_META_SPAWN_EGG_ENDER_CRYSTAL = 200,
} ; } ;

View File

@ -70,6 +70,7 @@ public:
case E_META_SPAWN_EGG_MOOSHROOM: return mtMooshroom; case E_META_SPAWN_EGG_MOOSHROOM: return mtMooshroom;
case E_META_SPAWN_EGG_OCELOT: return mtOcelot; case E_META_SPAWN_EGG_OCELOT: return mtOcelot;
case E_META_SPAWN_EGG_PIG: return mtPig; case E_META_SPAWN_EGG_PIG: return mtPig;
case E_META_SPAWN_EGG_RABBIT: return mtRabbit;
case E_META_SPAWN_EGG_SHEEP: return mtSheep; case E_META_SPAWN_EGG_SHEEP: return mtSheep;
case E_META_SPAWN_EGG_SILVERFISH: return mtSilverfish; case E_META_SPAWN_EGG_SILVERFISH: return mtSilverfish;
case E_META_SPAWN_EGG_SKELETON: return mtSkeleton; case E_META_SPAWN_EGG_SKELETON: return mtSkeleton;

View File

@ -92,6 +92,7 @@ eMonsterType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
addIfAllowed(mtCow, allowedMobs); addIfAllowed(mtCow, allowedMobs);
addIfAllowed(mtChicken, allowedMobs); addIfAllowed(mtChicken, allowedMobs);
addIfAllowed(mtEnderman, allowedMobs); addIfAllowed(mtEnderman, allowedMobs);
addIfAllowed(mtRabbit, allowedMobs);
addIfAllowed(mtSlime, allowedMobs); // MG TODO : much more complicated rule addIfAllowed(mtSlime, allowedMobs); // MG TODO : much more complicated rule
if ((a_Biome == biForest) || (a_Biome == biForestHills) || (a_Biome == biTaiga) || (a_Biome == biTaigaHills)) if ((a_Biome == biForest) || (a_Biome == biForestHills) || (a_Biome == biTaiga) || (a_Biome == biTaigaHills))
@ -164,6 +165,7 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_R
case mtCow: case mtCow:
case mtPig: case mtPig:
case mtHorse: case mtHorse:
case mtRabbit:
case mtSheep: case mtSheep:
{ {
return ( return (

View File

@ -15,6 +15,7 @@
#include "Mooshroom.h" #include "Mooshroom.h"
#include "Ocelot.h" #include "Ocelot.h"
#include "Pig.h" #include "Pig.h"
#include "Rabbit.h"
#include "Sheep.h" #include "Sheep.h"
#include "Silverfish.h" #include "Silverfish.h"
#include "Skeleton.h" #include "Skeleton.h"

View File

@ -45,6 +45,7 @@ static const struct
{mtMooshroom, "mooshroom", "MushroomCow"}, {mtMooshroom, "mooshroom", "MushroomCow"},
{mtOcelot, "ocelot", "Ozelot"}, {mtOcelot, "ocelot", "Ozelot"},
{mtPig, "pig", "Pig"}, {mtPig, "pig", "Pig"},
{mtRabbit, "rabbit", "Rabbit"},
{mtSheep, "sheep", "Sheep"}, {mtSheep, "sheep", "Sheep"},
{mtSilverfish, "silverfish", "Silverfish"}, {mtSilverfish, "silverfish", "Silverfish"},
{mtSkeleton, "skeleton", "Skeleton"}, {mtSkeleton, "skeleton", "Skeleton"},
@ -499,6 +500,7 @@ void cMonster::KilledBy(TakeDamageInfo & a_TDI)
case mtCow: case mtCow:
case mtHorse: case mtHorse:
case mtPig: case mtPig:
case mtRabbit:
case mtSheep: case mtSheep:
case mtSquid: case mtSquid:
case mtMooshroom: case mtMooshroom:
@ -851,6 +853,7 @@ cMonster::eFamily cMonster::FamilyFromType(eMonsterType a_Type)
case mtMooshroom: return mfHostile; case mtMooshroom: return mfHostile;
case mtOcelot: return mfPassive; case mtOcelot: return mfPassive;
case mtPig: return mfPassive; case mtPig: return mfPassive;
case mtRabbit: return mfPassive;
case mtSheep: return mfPassive; case mtSheep: return mfPassive;
case mtSilverfish: return mfHostile; case mtSilverfish: return mfHostile;
case mtSkeleton: return mfHostile; case mtSkeleton: return mfHostile;
@ -963,6 +966,7 @@ cMonster * cMonster::NewMonsterFromType(eMonsterType a_MobType)
case mtMooshroom: toReturn = new cMooshroom(); break; case mtMooshroom: toReturn = new cMooshroom(); break;
case mtOcelot: toReturn = new cOcelot(); break; case mtOcelot: toReturn = new cOcelot(); break;
case mtPig: toReturn = new cPig(); break; case mtPig: toReturn = new cPig(); break;
case mtRabbit: toReturn = new cRabbit(); break;
case mtSheep: toReturn = new cSheep(); break; case mtSheep: toReturn = new cSheep(); break;
case mtSilverfish: toReturn = new cSilverfish(); break; case mtSilverfish: toReturn = new cSilverfish(); break;
case mtSnowGolem: toReturn = new cSnowGolem(); break; case mtSnowGolem: toReturn = new cSnowGolem(); break;

View File

@ -25,6 +25,7 @@ enum eMonsterType
mtMooshroom = E_META_SPAWN_EGG_MOOSHROOM, mtMooshroom = E_META_SPAWN_EGG_MOOSHROOM,
mtOcelot = E_META_SPAWN_EGG_OCELOT, mtOcelot = E_META_SPAWN_EGG_OCELOT,
mtPig = E_META_SPAWN_EGG_PIG, mtPig = E_META_SPAWN_EGG_PIG,
mtRabbit = E_META_SPAWN_EGG_RABBIT,
mtSheep = E_META_SPAWN_EGG_SHEEP, mtSheep = E_META_SPAWN_EGG_SHEEP,
mtSilverfish = E_META_SPAWN_EGG_SILVERFISH, mtSilverfish = E_META_SPAWN_EGG_SILVERFISH,
mtSkeleton = E_META_SPAWN_EGG_SKELETON, mtSkeleton = E_META_SPAWN_EGG_SKELETON,

38
src/Mobs/Rabbit.cpp Normal file
View File

@ -0,0 +1,38 @@
#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.9, 0.9)
{
}
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);
}

24
src/Mobs/Rabbit.h Normal file
View File

@ -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); }
} ;

View File

@ -502,6 +502,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
case mtMooshroom: EntityClass = "MushroomCow"; break; case mtMooshroom: EntityClass = "MushroomCow"; break;
case mtOcelot: EntityClass = "Ozelot"; break; case mtOcelot: EntityClass = "Ozelot"; break;
case mtPig: EntityClass = "Pig"; break; case mtPig: EntityClass = "Pig"; break;
case mtRabbit: EntityClass = "Rabbit"; break;
case mtSheep: EntityClass = "Sheep"; break; case mtSheep: EntityClass = "Sheep"; break;
case mtSilverfish: EntityClass = "Silverfish"; break; case mtSilverfish: EntityClass = "Silverfish"; break;
case mtSkeleton: EntityClass = "Skeleton"; break; case mtSkeleton: EntityClass = "Skeleton"; break;
@ -633,6 +634,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
case mtMooshroom: case mtMooshroom:
case mtOcelot: case mtOcelot:
case mtPig: case mtPig:
case mtRabbit:
case mtSilverfish: case mtSilverfish:
case mtSnowGolem: case mtSnowGolem:
case mtSpider: case mtSpider:

View File

@ -1442,6 +1442,10 @@ void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{ {
LoadPigFromNBT(a_Entities, a_NBT, a_EntityTagIdx); LoadPigFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
} }
else if (strncmp(a_IDTag, "Rabbit", a_IDTagLength) == 0)
{
LoadRabbitFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
}
else if (strncmp(a_IDTag, "Sheep", a_IDTagLength) == 0) else if (strncmp(a_IDTag, "Sheep", a_IDTagLength) == 0)
{ {
LoadSheepFromNBT(a_Entities, a_NBT, a_EntityTagIdx); LoadSheepFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
@ -2363,6 +2367,26 @@ void cWSSAnvil::LoadPigFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
void cWSSAnvil::LoadRabbitFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
std::unique_ptr<cRabbit> Monster(new cRabbit());
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
}
if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
}
a_Entities.push_back(Monster.release());
}
void cWSSAnvil::LoadSheepFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) void cWSSAnvil::LoadSheepFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{ {
int ColorIdx = a_NBT.FindChildByName(a_TagIdx, "Color"); int ColorIdx = a_NBT.FindChildByName(a_TagIdx, "Color");

View File

@ -198,6 +198,7 @@ protected:
void LoadMooshroomFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadMooshroomFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadOcelotFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadOcelotFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadPigFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadPigFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadRabbitFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadSheepFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadSheepFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadSilverfishFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadSilverfishFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadSkeletonFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadSkeletonFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);