Browse Source

ITEM loot uses chance to drop

master
FatBoy-DOTC 1 year ago
parent
commit
f5375bca26
  1. 15
      src/engine/loot/LootManager.java

15
src/engine/loot/LootManager.java

@ -104,7 +104,7 @@ public class LootManager {
} }
break; break;
case "ITEM": case "ITEM":
GenerateItemLootDrop(mob,bse); GenerateItemLootDrop(mob,bse,multiplier);
break; break;
} }
} }
@ -175,9 +175,9 @@ public class LootManager {
if(mobLevel > 65){ if(mobLevel > 65){
mobLevel = 65; mobLevel = 65;
} }
int max = (int)(5.882 * mobLevel + 127.0); int max = (int)(4.882 * mobLevel + 127.0);
if(max > 320){ if(max > 321){
max = 320; max = 321;
} }
int min = (int)(4.469 * mobLevel - 3.469); int min = (int)(4.469 * mobLevel - 3.469);
int roll = ThreadLocalRandom.current().nextInt(max-min) + min; int roll = ThreadLocalRandom.current().nextInt(max-min) + min;
@ -273,7 +273,12 @@ public class LootManager {
} }
return; return;
} }
public static void GenerateItemLootDrop(Mob mob, BootySetEntry bse){ public static void GenerateItemLootDrop(Mob mob, BootySetEntry bse, float multiplier){
int chanceRoll = ThreadLocalRandom.current().nextInt(100) + 1;
if (chanceRoll > bse.dropChance * multiplier) {
//early exit, failed to hit minimum chance roll
return;
}
MobLoot disc = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true); MobLoot disc = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
if (disc != null) if (disc != null)
mob.getCharItemManager().addItemToInventory(disc); mob.getCharItemManager().addItemToInventory(disc);

Loading…
Cancel
Save