From 620fad57fe989e70c6f83902f9f6e8ea45f953ea Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 23 Apr 2023 22:07:54 -0500 Subject: [PATCH] Mob equipment drops once more, including vorg with proper chance --- src/engine/ai/MobileFSM.java | 2 +- src/engine/loot/LootManager.java | 34 +++++++++++++++++++------------- src/engine/objects/Mob.java | 3 ++- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 3470125a..6023032e 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -464,7 +464,7 @@ public class MobileFSM { mob.setCombatTarget(null); } } - if (mob.getLoc().distanceSquared2D(mob.getBindLoc()) > sqr(2000)) { + if(MovementUtilities.inRangeOfBindLocation(mob) == false) { PowersBase recall = PowersManager.getPowerByToken(-1994153779); PowersManager.useMobPower(mob, mob, recall, 40); mob.setCombatTarget(null); diff --git a/src/engine/loot/LootManager.java b/src/engine/loot/LootManager.java index ef70966c..137684ce 100644 --- a/src/engine/loot/LootManager.java +++ b/src/engine/loot/LootManager.java @@ -71,11 +71,27 @@ public class LootManager { } } private static void RunBootySet(ArrayList entries, Mob mob, float multiplier, boolean inHotzone, boolean fromDeath) { + if(fromDeath){ + //do equipment here + if (mob.getEquip() != null){ + for (MobEquipment me : mob.getEquip().values()){ + if (me.getDropChance() == 0) + continue; + float equipmentRoll = ThreadLocalRandom.current().nextFloat(); + float dropChance = me.getDropChance(); + if (equipmentRoll < dropChance){ + MobLoot ml = new MobLoot(mob, me.getItemBase(), false); + mob.getCharItemManager().addItemToInventory(ml); + } + } + } + return; + } for (BootySetEntry bse : entries) { - int roll = ThreadLocalRandom.current().nextInt(101); + int roll = ThreadLocalRandom.current().nextInt(100); switch (bse.bootyType) { case "GOLD": - if (roll > (bse.dropChance * multiplier) || fromDeath) { + if (roll > (bse.dropChance * multiplier)) { //early exit, failed to hit minimum chance roll OR booty was generated from mob's death break; } @@ -87,7 +103,7 @@ public class LootManager { } break; case "LOOT": - if (roll > (bse.dropChance * multiplier) || fromDeath) { + if (roll > (bse.dropChance * multiplier)) { //early exit, failed to hit minimum chance roll OR booty was generated from mob's death break; } @@ -110,16 +126,6 @@ public class LootManager { mob.getCharItemManager().addItemToInventory(disc); break; - case "EQUIP": - if (roll > (bse.dropChance * multiplier) && fromDeath) { - //early exit, failed to hit minimum chance roll OR booty wasn't generated from mob's death - break; - } - MobLoot equipToAdd = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true); - if (equipToAdd != null) { - mob.getCharItemManager().addItemToInventory(equipToAdd); - } - break; } } } @@ -128,7 +134,7 @@ public class LootManager { return null; } MobLoot outItem; - int roll = new Random().nextInt(100); + int roll = new Random().nextInt(101); GenTableRow selectedRow = generalItemTables.get(genTableID).getRowForRange(roll); if(selectedRow == null) { return null; diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 56cc9505..c5b0426f 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1270,7 +1270,8 @@ public class Mob extends AbstractIntelligenceAgent { //cleanup effects playerAgroMap.clear(); - if (!this.isPlayerGuard && this.equip != null) LootManager.GenerateMobLoot(this, true); + if (!this.isPlayerGuard && this.equip != null) + LootManager.GenerateMobLoot(this, true); } try {