diff options
author | Mattes D <github@xoft.cz> | 2014-02-24 18:30:44 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-02-24 18:30:44 +0100 |
commit | 23093fd4d1b1bc5f6d7aae8b5ba6a4cce90921d6 (patch) | |
tree | dd8975008870688e77b33a20072fd54e7e34bb9c /src/Mobs/Witch.cpp | |
parent | Merge pull request #722 from mc-server/CompileFix_C++03 (diff) | |
parent | Fixed Formatting, added compiler warning suppressing methods, fixed comments (diff) | |
download | cuberite-23093fd4d1b1bc5f6d7aae8b5ba6a4cce90921d6.tar cuberite-23093fd4d1b1bc5f6d7aae8b5ba6a4cce90921d6.tar.gz cuberite-23093fd4d1b1bc5f6d7aae8b5ba6a4cce90921d6.tar.bz2 cuberite-23093fd4d1b1bc5f6d7aae8b5ba6a4cce90921d6.tar.lz cuberite-23093fd4d1b1bc5f6d7aae8b5ba6a4cce90921d6.tar.xz cuberite-23093fd4d1b1bc5f6d7aae8b5ba6a4cce90921d6.tar.zst cuberite-23093fd4d1b1bc5f6d7aae8b5ba6a4cce90921d6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Witch.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/Mobs/Witch.cpp b/src/Mobs/Witch.cpp index 25d27041f..6956f7b7a 100644 --- a/src/Mobs/Witch.cpp +++ b/src/Mobs/Witch.cpp @@ -18,13 +18,28 @@ 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 = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + 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); break; + case 1: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLOWSTONE_DUST); break; + case 2: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER); break; + case 3: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_REDSTONE_DUST); break; + case 4: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SPIDER_EYE); break; + case 5: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STICK); break; + case 6: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SUGAR); break; + } + } + AddRandomWeaponDropItem(a_Drops, LootingLevel); } |