summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheJumper <maximilian.springer@web.de>2014-02-21 18:45:00 +0100
committerTheJumper <maximilian.springer@web.de>2014-02-21 18:45:00 +0100
commit1b32b005626e7dd7e466358910d461bf5fb11a64 (patch)
tree28d1261dc2a00dff85c6a03328c3d78c3c4d8937
parentBlockBed.cpp: Fixed space at if statement (diff)
downloadcuberite-1b32b005626e7dd7e466358910d461bf5fb11a64.tar
cuberite-1b32b005626e7dd7e466358910d461bf5fb11a64.tar.gz
cuberite-1b32b005626e7dd7e466358910d461bf5fb11a64.tar.bz2
cuberite-1b32b005626e7dd7e466358910d461bf5fb11a64.tar.lz
cuberite-1b32b005626e7dd7e466358910d461bf5fb11a64.tar.xz
cuberite-1b32b005626e7dd7e466358910d461bf5fb11a64.tar.zst
cuberite-1b32b005626e7dd7e466358910d461bf5fb11a64.zip
-rw-r--r--src/Mobs/Blaze.cpp6
-rw-r--r--src/Mobs/Cavespider.cpp8
-rw-r--r--src/Mobs/Chicken.cpp5
-rw-r--r--src/Mobs/Cow.cpp5
-rw-r--r--src/Mobs/Creeper.cpp3
-rw-r--r--src/Mobs/Enderman.cpp3
-rw-r--r--src/Mobs/Ghast.cpp5
-rw-r--r--src/Mobs/Horse.cpp3
-rw-r--r--src/Mobs/IronGolem.cpp1
-rw-r--r--src/Mobs/Magmacube.cpp5
-rw-r--r--src/Mobs/Monster.cpp29
-rw-r--r--src/Mobs/Monster.h3
-rw-r--r--src/Mobs/Mooshroom.cpp5
-rw-r--r--src/Mobs/Pig.cpp3
-rw-r--r--src/Mobs/Skeleton.cpp24
-rw-r--r--src/Mobs/Slime.cpp7
-rw-r--r--src/Mobs/SnowGolem.cpp2
-rw-r--r--src/Mobs/Spider.cpp8
-rw-r--r--src/Mobs/Squid.cpp3
-rw-r--r--src/Mobs/Witch.cpp27
-rw-r--r--src/Mobs/Witch.h1
-rw-r--r--src/Mobs/Zombie.cpp15
-rw-r--r--src/Mobs/Zombiepigman.cpp10
23 files changed, 144 insertions, 37 deletions
diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp
index f9c05b17a..084567708 100644
--- a/src/Mobs/Blaze.cpp
+++ b/src/Mobs/Blaze.cpp
@@ -19,7 +19,11 @@ cBlaze::cBlaze(void) :
void cBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 1, E_ITEM_BLAZE_ROD);
+ if (a_Killer->IsA("cPlayer") || a_Killer->IsA("cWolf"))
+ {
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_BLAZE_ROD);
+ }
}
diff --git a/src/Mobs/Cavespider.cpp b/src/Mobs/Cavespider.cpp
index aba1ff9f5..0554f5c2a 100644
--- a/src/Mobs/Cavespider.cpp
+++ b/src/Mobs/Cavespider.cpp
@@ -31,8 +31,12 @@ void cCavespider::Tick(float a_Dt, cChunk & a_Chunk)
void cCavespider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_STRING);
- AddRandomDropItem(a_Drops, 0, 1, E_ITEM_SPIDER_EYE);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STRING);
+ if (a_Killer->IsA("cPlayer") || a_Killer->IsA("cWolf"))
+ {
+ AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_SPIDER_EYE);
+ }
}
diff --git a/src/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp
index fab92ce49..4ca016883 100644
--- a/src/Mobs/Chicken.cpp
+++ b/src/Mobs/Chicken.cpp
@@ -48,8 +48,9 @@ void cChicken::Tick(float a_Dt, cChunk & a_Chunk)
void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_FEATHER);
- a_Drops.push_back(cItem(IsOnFire() ? E_ITEM_COOKED_CHICKEN : E_ITEM_RAW_CHICKEN, 1));
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_FEATHER);
+ AddRandomDropItem(a_Drops, 1, 1, IsOnFire() ? E_ITEM_COOKED_CHICKEN : E_ITEM_RAW_CHICKEN);
}
diff --git a/src/Mobs/Cow.cpp b/src/Mobs/Cow.cpp
index d8e905217..2740e4e72 100644
--- a/src/Mobs/Cow.cpp
+++ b/src/Mobs/Cow.cpp
@@ -21,8 +21,9 @@ cCow::cCow(void) :
void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_LEATHER);
- AddRandomDropItem(a_Drops, 1, 3, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
+ AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
}
diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp
index ff0abfdca..594878e52 100644
--- a/src/Mobs/Creeper.cpp
+++ b/src/Mobs/Creeper.cpp
@@ -39,7 +39,8 @@ void cCreeper::Tick(float a_Dt, cChunk & a_Chunk)
void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_GUNPOWDER);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER);
if ((a_Killer != NULL) && (a_Killer->IsProjectile()))
{
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp
index a784131e4..b79bf20fc 100644
--- a/src/Mobs/Enderman.cpp
+++ b/src/Mobs/Enderman.cpp
@@ -21,7 +21,8 @@ cEnderman::cEnderman(void) :
void cEnderman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 1, E_ITEM_ENDER_PEARL);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ENDER_PEARL);
}
diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp
index 96a29b2d8..b62069d63 100644
--- a/src/Mobs/Ghast.cpp
+++ b/src/Mobs/Ghast.cpp
@@ -18,8 +18,9 @@ cGhast::cGhast(void) :
void cGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_GUNPOWDER);
- AddRandomDropItem(a_Drops, 0, 1, E_ITEM_GHAST_TEAR);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER);
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_GHAST_TEAR);
}
diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp
index bb9a4e3f6..4220585a1 100644
--- a/src/Mobs/Horse.cpp
+++ b/src/Mobs/Horse.cpp
@@ -140,7 +140,8 @@ void cHorse::OnRightClicked(cPlayer & a_Player)
void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_LEATHER);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
if (m_bIsSaddled)
{
a_Drops.push_back(cItem(E_ITEM_SADDLE, 1));
diff --git a/src/Mobs/IronGolem.cpp b/src/Mobs/IronGolem.cpp
index 47c961098..057834afd 100644
--- a/src/Mobs/IronGolem.cpp
+++ b/src/Mobs/IronGolem.cpp
@@ -19,6 +19,7 @@ cIronGolem::cIronGolem(void) :
void cIronGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 5, E_ITEM_IRON);
+ AddRandomDropItem(a_Drops, 0, 2, E_BLOCK_FLOWER);
}
diff --git a/src/Mobs/Magmacube.cpp b/src/Mobs/Magmacube.cpp
index 86447ff6b..ec6137ca6 100644
--- a/src/Mobs/Magmacube.cpp
+++ b/src/Mobs/Magmacube.cpp
@@ -19,7 +19,10 @@ cMagmaCube::cMagmaCube(int a_Size) :
void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 1, E_ITEM_MAGMA_CREAM);
+ if (GetSize() > 1)
+ {
+ AddRandomUncommonDropItem(a_Drops, 25.0f, E_ITEM_MAGMA_CREAM);
+ }
}
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index b5cf693cb..66629474b 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -880,6 +880,35 @@ void cMonster::AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned
+void cMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth)
+{
+ MTRand r1;
+ int Count = r1.randInt() % 1000;
+ if (Count < (a_Chance*10))
+ {
+ a_Drops.push_back(cItem(a_Item, 1, a_ItemHealth));
+ }
+}
+
+
+
+
+
+void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel)
+{
+ MTRand r1;
+ int Count = r1.randInt() % 200;
+ if (Count < (5 + a_LootingLevel))
+ {
+ int Rare = r1.randInt() % a_Items.Size();
+ a_Drops.push_back(a_Items.at(Rare));
+ }
+}
+
+
+
+
+
void cMonster::HandleDaylightBurning(cChunk & a_Chunk)
{
if (!m_BurnsInDaylight)
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index 4d2e099c5..909504213 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -224,6 +224,9 @@ protected:
bool m_BurnsInDaylight;
void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);
+ void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0);
+ void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel);
+
} ; // tolua_export
diff --git a/src/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp
index 88101cd83..4c245ea2d 100644
--- a/src/Mobs/Mooshroom.cpp
+++ b/src/Mobs/Mooshroom.cpp
@@ -23,8 +23,9 @@ cMooshroom::cMooshroom(void) :
void cMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_LEATHER);
- AddRandomDropItem(a_Drops, 1, 3, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
+ AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
}
diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp
index d8f3dda37..063e2a5b4 100644
--- a/src/Mobs/Pig.cpp
+++ b/src/Mobs/Pig.cpp
@@ -21,7 +21,8 @@ cPig::cPig(void) :
void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 1, 3, IsOnFire() ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_PORKCHOP);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_PORKCHOP);
if (m_bIsSaddled)
{
a_Drops.push_back(cItem(E_ITEM_SADDLE, 1));
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp
index 4c8e78988..b0a5670cf 100644
--- a/src/Mobs/Skeleton.cpp
+++ b/src/Mobs/Skeleton.cpp
@@ -20,8 +20,28 @@ cSkeleton::cSkeleton(bool IsWither) :
void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_ARROW);
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_BONE);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ if (IsWither())
+ {
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE);
+ AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_COAL);
+ cItems RareDrops;
+ RareDrops.Add(cItem(E_ITEM_HEAD, 1, 1));
+ if (!GetEquippedWeapon().IsEmpty()) RareDrops.Add(GetEquippedWeapon());
+ AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+ }
+ else
+ {
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ARROW);
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE);
+ cItems RareDrops;
+ if (!GetEquippedHelmet().IsEmpty()) RareDrops.Add(GetEquippedHelmet());
+ if (!GetEquippedChestplate().IsEmpty()) RareDrops.Add(GetEquippedChestplate());
+ if (!GetEquippedLeggings().IsEmpty()) RareDrops.Add(GetEquippedLeggings());
+ if (!GetEquippedBoots().IsEmpty()) RareDrops.Add(GetEquippedBoots());
+ if (!GetEquippedWeapon().IsEmpty()) RareDrops.Add(GetEquippedWeapon());
+ AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+ }
}
diff --git a/src/Mobs/Slime.cpp b/src/Mobs/Slime.cpp
index 19f376c21..f5b2cabc2 100644
--- a/src/Mobs/Slime.cpp
+++ b/src/Mobs/Slime.cpp
@@ -20,8 +20,11 @@ cSlime::cSlime(int a_Size) :
void cSlime::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- // TODO: only when tiny
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_SLIMEBALL);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ if (GetSize() == 1)
+ {
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SLIMEBALL);
+ }
}
diff --git a/src/Mobs/SnowGolem.cpp b/src/Mobs/SnowGolem.cpp
index c60103055..b68d18575 100644
--- a/src/Mobs/SnowGolem.cpp
+++ b/src/Mobs/SnowGolem.cpp
@@ -19,7 +19,7 @@ cSnowGolem::cSnowGolem(void) :
void cSnowGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 5, E_ITEM_SNOWBALL);
+ AddRandomDropItem(a_Drops, 0, 15, E_ITEM_SNOWBALL);
}
diff --git a/src/Mobs/Spider.cpp b/src/Mobs/Spider.cpp
index b19a5dcef..1f41328a2 100644
--- a/src/Mobs/Spider.cpp
+++ b/src/Mobs/Spider.cpp
@@ -18,8 +18,12 @@ cSpider::cSpider(void) :
void cSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_STRING);
- AddRandomDropItem(a_Drops, 0, 1, E_ITEM_SPIDER_EYE);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STRING);
+ if (a_Killer->IsA("cPlayer") || a_Killer->IsA("cWolf"))
+ {
+ AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_SPIDER_EYE);
+ }
}
diff --git a/src/Mobs/Squid.cpp b/src/Mobs/Squid.cpp
index 5a27762ff..9dee69cbb 100644
--- a/src/Mobs/Squid.cpp
+++ b/src/Mobs/Squid.cpp
@@ -21,7 +21,8 @@ cSquid::cSquid(void) :
void cSquid::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
// Drops 0-3 Ink Sacs
- AddRandomDropItem(a_Drops, 0, 3, E_ITEM_DYE, E_META_DYE_BLACK);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 3 + LootingLevel, E_ITEM_DYE, E_META_DYE_BLACK);
}
diff --git a/src/Mobs/Witch.cpp b/src/Mobs/Witch.cpp
index 25d27041f..88e8f4e50 100644
--- a/src/Mobs/Witch.cpp
+++ b/src/Mobs/Witch.cpp
@@ -18,13 +18,26 @@ cWitch::cWitch(void) :
void cWitch::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 6, E_ITEM_GLASS_BOTTLE);
- AddRandomDropItem(a_Drops, 0, 6, E_ITEM_GLOWSTONE_DUST);
- AddRandomDropItem(a_Drops, 0, 6, E_ITEM_GUNPOWDER);
- AddRandomDropItem(a_Drops, 0, 6, E_ITEM_REDSTONE_DUST);
- AddRandomDropItem(a_Drops, 0, 6, E_ITEM_SPIDER_EYE);
- AddRandomDropItem(a_Drops, 0, 6, E_ITEM_STICK);
- AddRandomDropItem(a_Drops, 0, 6, E_ITEM_SUGAR);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ MTRand r1;
+ int DropTypeCount = (r1.randInt() % 3) + 1;
+ for (int i = 0; i < DropTypeCount; i++)
+ {
+ int DropType = r1.randInt() % 7;
+ switch (DropType)
+ {
+ case 0: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLASS_BOTTLE);
+ case 1: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLOWSTONE_DUST);
+ case 2: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER);
+ case 3: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_REDSTONE_DUST);
+ case 4: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SPIDER_EYE);
+ case 5: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STICK);
+ case 6: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SUGAR);
+ }
+ }
+ cItems RareDrops;
+ if (!GetEquippedWeapon().IsEmpty()) RareDrops.Add(GetEquippedWeapon());
+ AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
}
diff --git a/src/Mobs/Witch.h b/src/Mobs/Witch.h
index 4e637beea..51c63322a 100644
--- a/src/Mobs/Witch.h
+++ b/src/Mobs/Witch.h
@@ -2,6 +2,7 @@
#pragma once
#include "AggressiveMonster.h"
+#include "../MersenneTwister.h"
diff --git a/src/Mobs/Zombie.cpp b/src/Mobs/Zombie.cpp
index 27e8ed5fb..72373266a 100644
--- a/src/Mobs/Zombie.cpp
+++ b/src/Mobs/Zombie.cpp
@@ -23,9 +23,18 @@ cZombie::cZombie(bool a_IsVillagerZombie) :
void cZombie::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 0, 2, E_ITEM_ROTTEN_FLESH);
-
- // TODO: Rare drops
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ROTTEN_FLESH);
+ cItems RareDrops;
+ RareDrops.Add(cItem(E_ITEM_IRON));
+ RareDrops.Add(cItem(E_ITEM_CARROT));
+ RareDrops.Add(cItem(E_ITEM_POTATO));
+ if (!GetEquippedHelmet().IsEmpty()) RareDrops.Add(GetEquippedHelmet());
+ if (!GetEquippedChestplate().IsEmpty()) RareDrops.Add(GetEquippedChestplate());
+ if (!GetEquippedLeggings().IsEmpty()) RareDrops.Add(GetEquippedLeggings());
+ if (!GetEquippedBoots().IsEmpty()) RareDrops.Add(GetEquippedBoots());
+ if (!GetEquippedWeapon().IsEmpty()) RareDrops.Add(GetEquippedWeapon());
+ AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
}
diff --git a/src/Mobs/Zombiepigman.cpp b/src/Mobs/Zombiepigman.cpp
index 6ac89ed4c..d1eadc2ae 100644
--- a/src/Mobs/Zombiepigman.cpp
+++ b/src/Mobs/Zombiepigman.cpp
@@ -19,10 +19,14 @@ cZombiePigman::cZombiePigman(void) :
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);
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(21);
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ROTTEN_FLESH);
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_GOLD_NUGGET);
- // TODO: Rare drops
+ cItems RareDrops;
+ RareDrops.Add(cItem(E_ITEM_GOLD));
+ if (!GetEquippedWeapon().IsEmpty()) RareDrops.Add(GetEquippedWeapon());
+ AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
}