From 0df4adea1ba8dc61b63336e1a7a063505ab39810 Mon Sep 17 00:00:00 2001 From: Chris Kearney <chris@kearneymail.com> Date: Sun, 7 Aug 2016 23:48:45 -0700 Subject: [PATCH] update to rarity settings, bug fix for my test harness --- .../java/com/comandante/creeper/Items/Rarity.java | 10 +++++----- .../comandante/creeper/player/NpcTestHarness.java | 15 ++++++++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/comandante/creeper/Items/Rarity.java b/src/main/java/com/comandante/creeper/Items/Rarity.java index 0c58b47e..94935cd3 100644 --- a/src/main/java/com/comandante/creeper/Items/Rarity.java +++ b/src/main/java/com/comandante/creeper/Items/Rarity.java @@ -3,11 +3,11 @@ package com.comandante.creeper.Items; public enum Rarity { - BASIC("basic", 2.0), - UNCOMMON("uncommon", 1.2), - RARE("rare", .6), - LEGENDARY("legendary", .2), - EXOTIC("exotic", .01); + BASIC("basic", 15.0), + UNCOMMON("uncommon", 7), + RARE("rare", 3), + LEGENDARY("legendary", 1), + EXOTIC("exotic", .5); private final String rarityTypeName; private final double percentToLoot; diff --git a/src/test/com/comandante/creeper/player/NpcTestHarness.java b/src/test/com/comandante/creeper/player/NpcTestHarness.java index 1c45807f..03340228 100644 --- a/src/test/com/comandante/creeper/player/NpcTestHarness.java +++ b/src/test/com/comandante/creeper/player/NpcTestHarness.java @@ -3,6 +3,7 @@ package com.comandante.creeper.player; import com.comandante.creeper.ConfigureCommands; import com.comandante.creeper.CreeperConfiguration; import com.comandante.creeper.Items.Item; +import com.comandante.creeper.Items.ItemType; import com.comandante.creeper.Items.ItemUseRegistry; import com.comandante.creeper.Main; import com.comandante.creeper.entity.EntityManager; @@ -89,18 +90,18 @@ public class NpcTestHarness { t.addCell("Avg Rounds"); t.addCell("Avg Gold"); t.addCell("Drops"); - //equipment.add(ItemType.BERSEKER_BOOTS.create()); - // equipment.add(ItemType.BERSERKER_BATON.create()); - //equipment.add(ItemType.BERSERKER_CHEST.create()); - //equipment.add(ItemType.BERSEKER_SHORTS.create()); + Set<Item> equipment = Sets.newHashSet(); + equipment.add(ItemType.BERSEKER_BOOTS.create()); + //equipment.add(ItemType.BERSERKER_BATON.create()); + equipment.add(ItemType.BERSERKER_CHEST.create()); + equipment.add(ItemType.BERSEKER_SHORTS.create()); - Map<String, AtomicInteger> drops = new HashMap<String, AtomicInteger>(); for (int level = 0; level < 10; level++) { - Set<Item> equipment = Sets.newHashSet(); int playerWins = 0; int npcWins = 0; int totalGold = 0; totalFightRounds = 0; + Map<String, AtomicInteger> drops = new HashMap<String, AtomicInteger>(); for (int i = 0; i < 100; i++) { String username = UUID.randomUUID().toString(); player = createRandomPlayer(username, level); @@ -135,7 +136,7 @@ public class NpcTestHarness { t.addCell(String.valueOf(playerWinPercent)+"%"); t.addCell(String.valueOf(npcWinPercent)+"%"); t.addCell(String.valueOf(totalFightRounds / totalIterations)); - t.addCell(String.valueOf(totalGold / totalIterations)); + t.addCell(String.valueOf(totalGold / playerWins)); StringBuilder sb = new StringBuilder(); drops.entrySet().stream().map(entry -> entry.getKey() + "(" + entry.getValue().get() + ")").forEach(s -> sb.append(s).append(",")); t.addCell(sb.toString()); -- GitLab