summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorTheJumper <maximilian.springer@web.de>2014-02-23 19:35:56 +0100
committerTheJumper <maximilian.springer@web.de>2014-02-23 19:35:56 +0100
commit2f59517023765e8f5d5555adacafd146729ab071 (patch)
treebb5202265e994a69e16041a86e8199563ee6e940 /src/Mobs/Monster.cpp
parentAdded static Enchantment Constants, Replaced cryptic Looting ID (diff)
downloadcuberite-2f59517023765e8f5d5555adacafd146729ab071.tar
cuberite-2f59517023765e8f5d5555adacafd146729ab071.tar.gz
cuberite-2f59517023765e8f5d5555adacafd146729ab071.tar.bz2
cuberite-2f59517023765e8f5d5555adacafd146729ab071.tar.lz
cuberite-2f59517023765e8f5d5555adacafd146729ab071.tar.xz
cuberite-2f59517023765e8f5d5555adacafd146729ab071.tar.zst
cuberite-2f59517023765e8f5d5555adacafd146729ab071.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Monster.cpp49
1 files changed, 48 insertions, 1 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 66629474b..4ab485321 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -81,6 +81,12 @@ cMonster::cMonster(const AString & a_ConfigName, eType a_MobType, const AString
, m_AttackDamage(1)
, m_AttackRange(2)
, m_AttackInterval(0)
+ , m_DropChanceWeapon(0.085)
+ , m_DropChanceHelmet(0.085)
+ , m_DropChanceChestplate(0.085)
+ , m_DropChanceLeggings(0.085)
+ , m_DropChanceBoots(0.085)
+ , m_CanPickUpLoot(true)
, m_SightDistance(25)
, m_BurnsInDaylight(false)
{
@@ -884,7 +890,7 @@ void cMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short
{
MTRand r1;
int Count = r1.randInt() % 1000;
- if (Count < (a_Chance*10))
+ if (Count < (a_Chance * 10))
{
a_Drops.push_back(cItem(a_Item, 1, a_ItemHealth));
}
@@ -909,6 +915,47 @@ void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a
+void cMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel)
+{
+ MTRand r1;
+ if (r1.randInt() % 200 < ((m_DropChanceHelmet * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedHelmet().IsEmpty()) a_Drops.push_back(GetEquippedHelmet());
+ }
+
+ if (r1.randInt() % 200 < ((m_DropChanceChestplate * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedChestplate().IsEmpty()) a_Drops.push_back(GetEquippedChestplate());
+ }
+
+ if (r1.randInt() % 200 < ((m_DropChanceLeggings * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedLeggings().IsEmpty()) a_Drops.push_back(GetEquippedLeggings());
+ }
+
+ if (r1.randInt() % 200 < ((m_DropChanceBoots * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedBoots().IsEmpty()) a_Drops.push_back(GetEquippedBoots());
+ }
+}
+
+
+
+
+
+void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel)
+{
+ MTRand r1;
+ if (r1.randInt() % 200 < ((m_DropChanceWeapon * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedWeapon().IsEmpty()) a_Drops.push_back(GetEquippedWeapon());
+ }
+}
+
+
+
+
+
void cMonster::HandleDaylightBurning(cChunk & a_Chunk)
{
if (!m_BurnsInDaylight)