From 1c0e9f5d744c4c84414b63c84c0f50b224d9d010 Mon Sep 17 00:00:00 2001 From: Chris Kearney <chris@kearneymail.com> Date: Sun, 7 Aug 2016 18:02:47 -0700 Subject: [PATCH] changing beer to health potion, tuning mobs --- .../java/com/comandante/creeper/ConfigureNpc.java | 11 +++++------ .../java/com/comandante/creeper/Items/ItemType.java | 8 ++++---- .../comandante/creeper/Items/ItemUseRegistry.java | 4 +--- .../com/comandante/creeper/npc/NpcAdapterTest.java | 5 +---- .../comandante/creeper/player/NpcTestHarness.java | 13 +++++++++++-- world/npcs/treeberserker.json | 8 ++++---- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/comandante/creeper/ConfigureNpc.java b/src/main/java/com/comandante/creeper/ConfigureNpc.java index b6053341..e9ee4c63 100755 --- a/src/main/java/com/comandante/creeper/ConfigureNpc.java +++ b/src/main/java/com/comandante/creeper/ConfigureNpc.java @@ -15,7 +15,6 @@ import com.comandante.creeper.world.Area; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import java.io.FileNotFoundException; import java.io.IOException; import java.util.List; import java.util.Map; @@ -41,9 +40,9 @@ public class ConfigureNpc { configureAllNpcs(gameManager); Main.startUpMessage("Adding beer"); - ItemSpawner itemSpawner = new ItemSpawner(ItemType.BEER, new SpawnRuleBuilder().setArea(Area.NEWBIE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(100).setMaxPerRoom(5).setRandomPercent(40).createSpawnRule(), gameManager); - ItemSpawner itemSpawner1 = new ItemSpawner(ItemType.BEER, new SpawnRuleBuilder().setArea(Area.FANCYHOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(), gameManager); - ItemSpawner itemSpawner2 = new ItemSpawner(ItemType.BEER, new SpawnRuleBuilder().setArea(Area.HOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(), gameManager); + ItemSpawner itemSpawner = new ItemSpawner(ItemType.SMALL_HEALTH_POTION, new SpawnRuleBuilder().setArea(Area.NEWBIE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(100).setMaxPerRoom(5).setRandomPercent(40).createSpawnRule(), gameManager); + ItemSpawner itemSpawner1 = new ItemSpawner(ItemType.SMALL_HEALTH_POTION, new SpawnRuleBuilder().setArea(Area.FANCYHOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(), gameManager); + ItemSpawner itemSpawner2 = new ItemSpawner(ItemType.SMALL_HEALTH_POTION, new SpawnRuleBuilder().setArea(Area.HOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(), gameManager); ItemSpawner itemSpawner5 = new ItemSpawner(ItemType.KEY, new SpawnRuleBuilder().setArea(Area.LOBBY).setSpawnIntervalTicks(600).setMaxInstances(1).setMaxPerRoom(1).setRandomPercent(5).createSpawnRule(), gameManager); entityManager.addEntity(itemSpawner); @@ -52,7 +51,7 @@ public class ConfigureNpc { entityManager.addEntity(itemSpawner5); Map<Integer, MerchantItemForSale> itemsForSale = Maps.newLinkedHashMap(); - itemsForSale.put(1, new MerchantItemForSale(ItemType.BEER, 8)); + itemsForSale.put(1, new MerchantItemForSale(ItemType.SMALL_HEALTH_POTION, 8)); itemsForSale.put(2, new MerchantItemForSale(ItemType.PURPLE_DRANK, 80)); itemsForSale.put(3, new MerchantItemForSale(ItemType.LEATHER_SATCHEL, 25000)); @@ -60,7 +59,7 @@ public class ConfigureNpc { gameManager.getRoomManager().addMerchant(64, lloydBartender); Map<Integer, MerchantItemForSale> nigelForSale = Maps.newLinkedHashMap(); - nigelForSale.put(1, new MerchantItemForSale(ItemType.BEER, 6)); + nigelForSale.put(1, new MerchantItemForSale(ItemType.SMALL_HEALTH_POTION, 6)); NigelBartender nigelBartender = new NigelBartender(gameManager, new Loot(18, 26, Sets.<ItemType>newHashSet()), nigelForSale); gameManager.getRoomManager().addMerchant(377, nigelBartender); diff --git a/src/main/java/com/comandante/creeper/Items/ItemType.java b/src/main/java/com/comandante/creeper/Items/ItemType.java index 38d9d96e..4b1d9186 100755 --- a/src/main/java/com/comandante/creeper/Items/ItemType.java +++ b/src/main/java/com/comandante/creeper/Items/ItemType.java @@ -26,10 +26,10 @@ public enum ItemType { Rarity.BASIC, 10, Sets.<TimeTracker.TimeOfDay>newHashSet(TimeTracker.TimeOfDay.NIGHT)), - BEER(2, Arrays.asList("beer", "can of beer", "b"), - "a dented can of " + CYAN + "beer" + RESET, - "a " + CYAN + "beer" + RESET + " lies on the ground, unopened", - "an ice cold " + CYAN + "beer" + RESET + " that restores 50 health" + RESET, + SMALL_HEALTH_POTION(2, Arrays.asList("potion", "health potion", "vial", "small vial of health potion", "p"), + "a small vial of " + RED + "health potion" + RESET, + "a small vial of " + RED + "health potion" + RESET + " rests on the ground.", + "a small vial of " + RED + "health potion" + RESET + " that restores 50 health" + RESET, true, 0, 60, diff --git a/src/main/java/com/comandante/creeper/Items/ItemUseRegistry.java b/src/main/java/com/comandante/creeper/Items/ItemUseRegistry.java index c8f89507..fe76f1bd 100644 --- a/src/main/java/com/comandante/creeper/Items/ItemUseRegistry.java +++ b/src/main/java/com/comandante/creeper/Items/ItemUseRegistry.java @@ -1,9 +1,7 @@ package com.comandante.creeper.Items; import com.comandante.creeper.Items.use.DefaultApplyStatsAction; -import com.comandante.creeper.Items.use.DirtyBombUseAction; import com.comandante.creeper.Items.use.LightningSpellBookUseAction; -import com.comandante.creeper.Items.use.ResetAllEffectsUseAction; import com.comandante.creeper.managers.GameManager; import com.comandante.creeper.player.Player; import com.comandante.creeper.spells.Effect; @@ -32,7 +30,7 @@ public class ItemUseRegistry { public static void configure() { //Beer - addItemUseAction(new DefaultApplyStatsAction(ItemType.BEER, buildStats(100, 0), Sets.<Effect>newHashSet())); + addItemUseAction(new DefaultApplyStatsAction(ItemType.SMALL_HEALTH_POTION, buildStats(100, 0), Sets.<Effect>newHashSet())); //Purple Drank addItemUseAction(new DefaultApplyStatsAction(ItemType.PURPLE_DRANK, buildStats(500, 0), Sets.<Effect>newHashSet())); diff --git a/src/main/java/com/comandante/creeper/npc/NpcAdapterTest.java b/src/main/java/com/comandante/creeper/npc/NpcAdapterTest.java index fcf701e5..e5665609 100644 --- a/src/main/java/com/comandante/creeper/npc/NpcAdapterTest.java +++ b/src/main/java/com/comandante/creeper/npc/NpcAdapterTest.java @@ -9,14 +9,11 @@ import com.comandante.creeper.stat.Stats; import com.comandante.creeper.stat.StatsBuilder; import com.comandante.creeper.world.Area; import com.google.common.collect.Sets; -import com.google.common.io.Files; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.junit.Before; import org.junit.Test; -import java.io.File; -import java.nio.charset.Charset; import java.util.Random; import java.util.Set; import java.util.UUID; @@ -56,7 +53,7 @@ public class NpcAdapterTest { .setWillpower(randomGenerator.nextInt(100)) .createStats(); - Loot npcOneLoot = new Loot(randomGenerator.nextInt(100), randomGenerator.nextInt(100), Sets.newHashSet(ItemType.BEER)); + Loot npcOneLoot = new Loot(randomGenerator.nextInt(100), randomGenerator.nextInt(100), Sets.newHashSet(ItemType.SMALL_HEALTH_POTION)); SpawnRule npcOneSpawnRule1 = new SpawnRuleBuilder().setArea(Area.BLOODRIDGE10_ZONE).setSpawnIntervalTicks(randomGenerator.nextInt(100)).setMaxInstances(randomGenerator.nextInt(100)).setMaxPerRoom(randomGenerator.nextInt(100)).setRandomPercent(randomGenerator.nextInt(100)).createSpawnRule(); SpawnRule npcOneSpawnRule2 = new SpawnRuleBuilder().setArea(Area.BLOODRIDGE10_ZONE).setSpawnIntervalTicks(randomGenerator.nextInt(100)).setMaxInstances(randomGenerator.nextInt(100)).setMaxPerRoom(randomGenerator.nextInt(100)).setRandomPercent(randomGenerator.nextInt(100)).createSpawnRule(); npcOne = new NpcBuilder() diff --git a/src/test/com/comandante/creeper/player/NpcTestHarness.java b/src/test/com/comandante/creeper/player/NpcTestHarness.java index 0e251ede..2c573e1c 100644 --- a/src/test/com/comandante/creeper/player/NpcTestHarness.java +++ b/src/test/com/comandante/creeper/player/NpcTestHarness.java @@ -12,6 +12,9 @@ import com.comandante.creeper.npc.NpcBuilder; import com.comandante.creeper.npc.NpcExporter; import com.comandante.creeper.server.ChannelCommunicationUtils; import com.comandante.creeper.server.CreeperSession; +import com.comandante.creeper.stat.Stats; +import com.comandante.creeper.stat.StatsBuilder; +import com.comandante.creeper.stat.StatsHelper; import com.comandante.creeper.world.MapsManager; import com.comandante.creeper.world.RoomManager; import com.comandante.creeper.world.WorldExporter; @@ -71,10 +74,11 @@ public class NpcTestHarness { int npcWins = 0; totalFightRounds = 0; - int totalIterations = 1000; + int totalIterations = 100; + Player player = null; for (int i = 0; i < totalIterations; i++) { String username = UUID.randomUUID().toString(); - Player player = createRandomPlayer(username); + player = createRandomPlayer(username); Npc npc = new NpcBuilder(treeBerseker).createNpc(); gameManager.getEntityManager().addEntity(npc); player.getCurrentRoom().addPresentNpc(npc.getEntityId()); @@ -91,6 +95,10 @@ public class NpcTestHarness { System.out.println("Fight iterations: " + i); } } + Stats difference = StatsHelper.getDifference(player.getPlayerStatsWithEquipmentAndLevel(), new PlayerStats().DEFAULT_PLAYER.createStats()); + String player1 = gameManager.buildLookString("player", player.getPlayerStatsWithEquipmentAndLevel(),difference ); + System.out.println(player1); + System.out.println(""); System.out.println("Player Wins: " + playerWins); System.out.println("Npc Wins: " + npcWins); System.out.println("Average rounds: " + totalFightRounds / totalIterations); @@ -125,6 +133,7 @@ public class NpcTestHarness { gameManager.getPlayerManager().addPlayer(player); gameManager.placePlayerInLobby(player); gameManager.getPlayerManager().getSessionManager().putSession(creeperSession); + player.addExperience(Levels.getXp(3)); return player; } diff --git a/world/npcs/treeberserker.json b/world/npcs/treeberserker.json index eb59d5f2..906edfc1 100755 --- a/world/npcs/treeberserker.json +++ b/world/npcs/treeberserker.json @@ -11,9 +11,9 @@ "north1_zone" ], "stats": { - "agile": 3, + "agile": 2, "aim": 1, - "armorRating": 16, + "armorRating": 17, "currentHealth": 100, "currentMana": 100, "experience": 22600, @@ -22,8 +22,8 @@ "meleSkill": 12, "numberOfWeaponRolls": 1, "strength": 10, - "weaponRatingMax": 9, - "weaponRatingMin": 6, + "weaponRatingMax": 15, + "weaponRatingMin": 9, "willPower": 1 }, "spawnAreas": { -- GitLab