diff --git a/src/main/java/dk/sdu/mmmi/modulemon/HeadlessBattleView/HeadlessBattleView.java b/src/main/java/dk/sdu/mmmi/modulemon/HeadlessBattleView/HeadlessBattleView.java index b3f915fe..b4ee0b88 100644 --- a/src/main/java/dk/sdu/mmmi/modulemon/HeadlessBattleView/HeadlessBattleView.java +++ b/src/main/java/dk/sdu/mmmi/modulemon/HeadlessBattleView/HeadlessBattleView.java @@ -33,6 +33,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Random; import java.util.concurrent.*; public class HeadlessBattleView implements IGameViewService { @@ -67,6 +68,8 @@ public class HeadlessBattleView implements IGameViewService { private boolean editingMode = false; private int[] battleAmounts = {1, 10, 100, 250, 500, 750, 1000}; private int battleAmountIndex = 1; + private MonsterSelector monsterSelector; + private final int TEAM_MONSTER_AMOUNT = 3; private CSVWriter csvWriter; @@ -103,6 +106,7 @@ public void init(IGameViewManager gameViewManager) { scene = new HeadlessBattleScene(settings); battlingScene = new HeadlessBattlingScene(); + monsterSelector = new MonsterSelector(1337, monsterRegistry); concurrentBattles = (int) settings.getSetting(settingsRegistry.getConcurrentBattleAmount()); } @@ -343,6 +347,7 @@ public void handleInput(GameData gameData, IGameViewManager gameViewManager) { chooseSound.play(getSoundVolume()); battleResults = new ArrayList>(); battleResultsToRemove = new ArrayList>(); + monsterSelector.refreshSelector(); for (var i = 0; i < concurrentBattles; i++) { battleResults.add(runBattle()); } @@ -368,8 +373,8 @@ private Future runBattle() { } // Currently just static list of monsters. Maybe create random teams, load from file or let user select teams - List teamA = Arrays.asList(monsterRegistry.getMonster(0), monsterRegistry.getMonster(1), monsterRegistry.getMonster(2)); - List teamB = Arrays.asList(monsterRegistry.getMonster(0), monsterRegistry.getMonster(1), monsterRegistry.getMonster(2)); + List teamA = monsterSelector.createMonsterTeam(TEAM_MONSTER_AMOUNT); + List teamB = monsterSelector.createMonsterTeam(TEAM_MONSTER_AMOUNT); var teamAPlayer = new BattleParticipant(teamA, true); var teamBPlayer = new BattleParticipant(teamB, false); diff --git a/src/main/java/dk/sdu/mmmi/modulemon/HeadlessBattleView/MonsterSelector.java b/src/main/java/dk/sdu/mmmi/modulemon/HeadlessBattleView/MonsterSelector.java new file mode 100644 index 00000000..60b6d588 --- /dev/null +++ b/src/main/java/dk/sdu/mmmi/modulemon/HeadlessBattleView/MonsterSelector.java @@ -0,0 +1,42 @@ +package dk.sdu.mmmi.modulemon.HeadlessBattleView; + + +import com.badlogic.gdx.utils.Array; +import dk.sdu.mmmi.modulemon.CommonMonster.IMonster; +import dk.sdu.mmmi.modulemon.CommonMonster.IMonsterRegistry; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class MonsterSelector { + private Random random; + private final Array allowedMonsters; + private final int seed; + + public MonsterSelector(int seed, IMonsterRegistry registry) { + this.seed = seed; + this.random = new Random(this.seed); + allowedMonsters = new Array<>(registry.getMonsterAmount()-1); + for (IMonster mon : registry.getAllMonsters()) { + if(!mon.getName().equalsIgnoreCase("god")){ + allowedMonsters.add(mon); + } + } + } + + public List createMonsterTeam(int amount){ + List monsters = new ArrayList<>(); + for(int i = 0; i < amount; i++){ + var chosenMonsterIndex = random.nextInt(allowedMonsters.size); + var monster = allowedMonsters.get(chosenMonsterIndex).clone(); + monsters.add(monster); + } + + return monsters; + } + + public void refreshSelector(){ + random = new Random(this.seed); + } +} diff --git a/src/main/java/dk/sdu/mmmi/modulemon/Monster/BattleMonsterProcessor.java b/src/main/java/dk/sdu/mmmi/modulemon/Monster/BattleMonsterProcessor.java index a95d1c59..5747478f 100644 --- a/src/main/java/dk/sdu/mmmi/modulemon/Monster/BattleMonsterProcessor.java +++ b/src/main/java/dk/sdu/mmmi/modulemon/Monster/BattleMonsterProcessor.java @@ -122,7 +122,6 @@ public float calculateCriticalHit (Monster monster) { boolean criticalHit = randomVal < threshold; if (criticalHit) { - System.out.println("critical hit"); return 1.5f; } else { return 1f; diff --git a/src/main/resources/images/phoenix_back.png b/src/main/resources/images/phoenix_back.png new file mode 100644 index 00000000..7c021b81 Binary files /dev/null and b/src/main/resources/images/phoenix_back.png differ diff --git a/src/main/resources/images/phoenix_front.png b/src/main/resources/images/phoenix_front.png new file mode 100644 index 00000000..a4a41239 Binary files /dev/null and b/src/main/resources/images/phoenix_front.png differ diff --git a/src/main/resources/images/rockGolem_back.png b/src/main/resources/images/rockGolem_back.png new file mode 100644 index 00000000..0434a3c2 Binary files /dev/null and b/src/main/resources/images/rockGolem_back.png differ diff --git a/src/main/resources/images/rockGolem_front.png b/src/main/resources/images/rockGolem_front.png new file mode 100644 index 00000000..bf537001 Binary files /dev/null and b/src/main/resources/images/rockGolem_front.png differ diff --git a/src/main/resources/images/thunderBison_back.png b/src/main/resources/images/thunderBison_back.png new file mode 100644 index 00000000..15b60838 Binary files /dev/null and b/src/main/resources/images/thunderBison_back.png differ diff --git a/src/main/resources/images/thunderBison_front.png b/src/main/resources/images/thunderBison_front.png new file mode 100644 index 00000000..1e00cd9c Binary files /dev/null and b/src/main/resources/images/thunderBison_front.png differ diff --git a/src/main/resources/images/turtle_back.png b/src/main/resources/images/turtle_back.png new file mode 100644 index 00000000..e489a701 Binary files /dev/null and b/src/main/resources/images/turtle_back.png differ diff --git a/src/main/resources/images/turtle_front.png b/src/main/resources/images/turtle_front.png new file mode 100644 index 00000000..33c2097f Binary files /dev/null and b/src/main/resources/images/turtle_front.png differ diff --git a/src/main/resources/images/vineSerpent_back.png b/src/main/resources/images/vineSerpent_back.png new file mode 100644 index 00000000..0feef53d Binary files /dev/null and b/src/main/resources/images/vineSerpent_back.png differ diff --git a/src/main/resources/images/vineSerpent_front.png b/src/main/resources/images/vineSerpent_front.png new file mode 100644 index 00000000..22c5427d Binary files /dev/null and b/src/main/resources/images/vineSerpent_front.png differ diff --git a/src/main/resources/json/monsters.json b/src/main/resources/json/monsters.json index 92a524d7..e283214c 100644 --- a/src/main/resources/json/monsters.json +++ b/src/main/resources/json/monsters.json @@ -133,7 +133,67 @@ "back": "/images/seagull_back.png" }, { - "id" : 8, + "id": 8, + "name": "Turtle", + "type": "WATER", + "hp": 110, + "defence": 120, + "attack": 95, + "speed": 60, + "moves": ["tackle", "shellDefense", "headButt", "aquaticWave"], + "front": "/images/turtle_front.png", + "back": "/images/turtle_back.png" + }, + { + "id": 9, + "name": "Phoenix", + "type": "FIRE", + "hp": 92, + "defence": 80, + "attack": 135, + "speed": 110, + "moves": ["fireBall", "wingSlash", "inferno", "soar"], + "front": "/images/phoenix_front.png", + "back": "/images/phoenix_back.png" + }, + { + "id": 10, + "name": "Rock Golem", + "type": "EARTH", + "hp": 120, + "defence": 150, + "attack": 75, + "speed": 40, + "moves": ["rockThrow", "earthquake", "ironDefense", "tackle"], + "front": "/images/rockGolem_front.png", + "back": "/images/rockGolem_back.png" + }, + { + "id": 11, + "name": "Thunder Bison", + "type": "LIGHTNING", + "hp": 100, + "defence": 95, + "attack": 120, + "speed": 80, + "moves": ["charge", "lightningStrike", "thunderStomp", "hornSlam"], + "front": "/images/thunderBison_front.png", + "back": "/images/thunderBison_back.png" + }, + { + "id": 12, + "name": "Vine Serpent", + "type": "GRASS", + "hp": 88, + "defence": 75, + "attack": 110, + "speed": 100, + "moves": ["vineWhip", "leafShield", "razorLeaf", "natureBlast"], + "front": "/images/vineSerpent_front.png", + "back": "/images/vineSerpent_back.png" + }, + { + "id" : 13, "name" : "Jonas", "type" : "NORMAL", "hp" : 69, diff --git a/src/main/resources/json/moves.json b/src/main/resources/json/moves.json index e62799b6..ae6f6aef 100644 --- a/src/main/resources/json/moves.json +++ b/src/main/resources/json/moves.json @@ -1,9 +1,9 @@ [ { - "id" : "spit", - "name" : "Spit", - "damage" : 40, - "type" : "WATER", + "id": "spit", + "name": "Spit", + "damage": 40, + "type": "WATER", "sound": "/sounds/spit.ogg" }, { @@ -14,17 +14,17 @@ "sound": "/sounds/water_blast.ogg" }, { - "id" : "mudBlast", - "name" : "Mud Blast", - "damage" : 55, - "type" : "WATER", + "id": "mudBlast", + "name": "Mud Blast", + "damage": 55, + "type": "WATER", "sound": "/sounds/mud_blast.ogg" }, { - "id" : "trample", - "name" : "Trample", - "damage" : 60, - "type" : "GRASS", + "id": "trample", + "name": "Trample", + "damage": 60, + "type": "GRASS", "sound": "/sounds/trample.ogg" }, { @@ -35,17 +35,17 @@ "sound": "/sounds/fur_ball.ogg" }, { - "id" : "dig", - "name" : "Dig", - "damage" : 60, - "type" : "EARTH", + "id": "dig", + "name": "Dig", + "damage": 60, + "type": "EARTH", "sound": "/sounds/dig.ogg" }, { - "id" : "earthquake", - "name" : "Earthquake", - "damage" : 80, - "type" : "EARTH", + "id": "earthquake", + "name": "Earthquake", + "damage": 80, + "type": "EARTH", "sound": "/sounds/earthquake.ogg" }, { @@ -84,17 +84,17 @@ "sound": "/sounds/flame_fang.ogg" }, { - "id" : "zap", - "name" : "Zap", - "damage" : 40, - "type" : "LIGHTNING", + "id": "zap", + "name": "Zap", + "damage": 40, + "type": "LIGHTNING", "sound": "/sounds/zap.ogg" }, { - "id" : "arcBolt", - "name" : "Arc Bolt", - "damage" : 80, - "type" : "LIGHTNING", + "id": "arcBolt", + "name": "Arc Bolt", + "damage": 80, + "type": "LIGHTNING", "sound": "/sounds/arc_bolt.ogg" }, { @@ -133,6 +133,135 @@ "sound": "/sounds/screech.ogg", "accuracy": 0.4 }, + {"_comment": "New data from here, which still needs to be balanced", + "name": "N/A", "damage": 0, "type": "NONE", "id": "NONE" + }, + { + "id": "vineWhip", + "name": "Vine Whip", + "damage": 50, + "type": "GRASS", + "sound": "/sounds/vineWhip.ogg" + }, + { + "id": "shellDefense", + "name": "Shell Defense", + "damage": 30, + "type": "NORMAL", + "sound": "/sounds/shellDefense.ogg" + }, + { + "id": "headButt", + "name": "Head Butt", + "damage": 70, + "type": "NORMAL", + "sound": "/sounds/headButt.ogg" + }, + { + "id": "aquaticWave", + "name": "Aquatic Wave", + "damage": 60, + "type": "WATER", + "sound": "/sounds/aquaticWave.ogg" + }, + { + "id": "fireBall", + "name": "Fire Ball", + "damage": 55, + "type": "FIRE", + "sound": "/sounds/fireBall.ogg" + }, + { + "id": "wingSlash", + "name": "Wing Slash", + "damage": 65, + "type": "AIR", + "sound": "/sounds/wingSlash.ogg" + }, + { + "id": "inferno", + "name": "Inferno", + "damage": 75, + "type": "FIRE", + "sound": "/sounds/inferno.ogg" + }, + { + "id": "soar", + "name": "Soar", + "damage": 40, + "type": "AIR", + "sound": "/sounds/soar.ogg" + }, + { + "id": "rockThrow", + "name": "Rock Throw", + "damage": 50, + "type": "EARTH", + "sound": "/sounds/rockThrow.ogg" + }, + { + "id": "ironDefense", + "name": "Iron Defense", + "damage": 30, + "type": "NORMAL", + "sound": "/sounds/ironDefense.ogg" + }, + { + "id": "tackle", + "name": "Tackle", + "damage": 55, + "type": "NORMAL", + "sound": "/sounds/tackle.ogg" + }, + { + "id": "charge", + "name": "Charge", + "damage": 65, + "type": "LIGHTNING", + "sound": "/sounds/charge.ogg" + }, + { + "id": "lightningStrike", + "name": "Lightning Strike", + "damage": 75, + "type": "LIGHTNING", + "sound": "/sounds/lightningStrike.ogg" + }, + { + "id": "thunderStomp", + "name": "Thunder Stomp", + "damage": 60, + "type": "LIGHTNING", + "sound": "/sounds/thunderStomp.ogg" + }, + { + "id": "hornSlam", + "name": "Horn Slam", + "damage": 55, + "type": "EARTH", + "sound": "/sounds/hornSlam.ogg" + }, + { + "id": "leafShield", + "name": "Leaf Shield", + "damage": 35, + "type": "GRASS", + "sound": "/sounds/leafShield.ogg" + }, + { + "id": "razorLeaf", + "name": "Razor Leaf", + "damage": 70, + "type": "GRASS", + "sound": "/sounds/razorLeaf.ogg" + }, + { + "id": "natureBlast", + "name": "Nature Blast", + "damage": 65, + "type": "GRASS", + "sound": "/sounds/natureBlast.ogg" + }, { "id": "christmasWish", "name": "Christmas Wish", diff --git a/src/main/resources/sounds/aquaticWave.ogg b/src/main/resources/sounds/aquaticWave.ogg new file mode 100644 index 00000000..ad2da237 Binary files /dev/null and b/src/main/resources/sounds/aquaticWave.ogg differ diff --git a/src/main/resources/sounds/charge.ogg b/src/main/resources/sounds/charge.ogg new file mode 100644 index 00000000..dd4008f5 Binary files /dev/null and b/src/main/resources/sounds/charge.ogg differ diff --git a/src/main/resources/sounds/fireBall.ogg b/src/main/resources/sounds/fireBall.ogg new file mode 100644 index 00000000..25538a86 Binary files /dev/null and b/src/main/resources/sounds/fireBall.ogg differ diff --git a/src/main/resources/sounds/headButt.ogg b/src/main/resources/sounds/headButt.ogg new file mode 100644 index 00000000..ba6ffe77 Binary files /dev/null and b/src/main/resources/sounds/headButt.ogg differ diff --git a/src/main/resources/sounds/hornSlam.ogg b/src/main/resources/sounds/hornSlam.ogg new file mode 100644 index 00000000..83ef2bad Binary files /dev/null and b/src/main/resources/sounds/hornSlam.ogg differ diff --git a/src/main/resources/sounds/inferno.ogg b/src/main/resources/sounds/inferno.ogg new file mode 100644 index 00000000..37cfdbe6 Binary files /dev/null and b/src/main/resources/sounds/inferno.ogg differ diff --git a/src/main/resources/sounds/ironDefense.ogg b/src/main/resources/sounds/ironDefense.ogg new file mode 100644 index 00000000..605a70ae Binary files /dev/null and b/src/main/resources/sounds/ironDefense.ogg differ diff --git a/src/main/resources/sounds/leafShield.ogg b/src/main/resources/sounds/leafShield.ogg new file mode 100644 index 00000000..197ca9a9 Binary files /dev/null and b/src/main/resources/sounds/leafShield.ogg differ diff --git a/src/main/resources/sounds/lightningStrike.ogg b/src/main/resources/sounds/lightningStrike.ogg new file mode 100644 index 00000000..f43213cb Binary files /dev/null and b/src/main/resources/sounds/lightningStrike.ogg differ diff --git a/src/main/resources/sounds/natureBlast.ogg b/src/main/resources/sounds/natureBlast.ogg new file mode 100644 index 00000000..e584d90a Binary files /dev/null and b/src/main/resources/sounds/natureBlast.ogg differ diff --git a/src/main/resources/sounds/old/slam.ogg b/src/main/resources/sounds/old/slam.ogg new file mode 100644 index 00000000..aafd1e5a Binary files /dev/null and b/src/main/resources/sounds/old/slam.ogg differ diff --git a/src/main/resources/sounds/old/tackle.ogg b/src/main/resources/sounds/old/tackle.ogg index aafd1e5a..b3060aa9 100644 Binary files a/src/main/resources/sounds/old/tackle.ogg and b/src/main/resources/sounds/old/tackle.ogg differ diff --git a/src/main/resources/sounds/razorLeaf.ogg b/src/main/resources/sounds/razorLeaf.ogg new file mode 100644 index 00000000..d7af30d2 Binary files /dev/null and b/src/main/resources/sounds/razorLeaf.ogg differ diff --git a/src/main/resources/sounds/rockThrow.ogg b/src/main/resources/sounds/rockThrow.ogg new file mode 100644 index 00000000..97cabfc0 Binary files /dev/null and b/src/main/resources/sounds/rockThrow.ogg differ diff --git a/src/main/resources/sounds/shellDefense.ogg b/src/main/resources/sounds/shellDefense.ogg new file mode 100644 index 00000000..555159e3 Binary files /dev/null and b/src/main/resources/sounds/shellDefense.ogg differ diff --git a/src/main/resources/sounds/soar.ogg b/src/main/resources/sounds/soar.ogg new file mode 100644 index 00000000..dd319a3f Binary files /dev/null and b/src/main/resources/sounds/soar.ogg differ diff --git a/src/main/resources/sounds/tackle.ogg b/src/main/resources/sounds/tackle.ogg index b3060aa9..2718a589 100644 Binary files a/src/main/resources/sounds/tackle.ogg and b/src/main/resources/sounds/tackle.ogg differ diff --git a/src/main/resources/sounds/thunderStomp.ogg b/src/main/resources/sounds/thunderStomp.ogg new file mode 100644 index 00000000..34f66ef5 Binary files /dev/null and b/src/main/resources/sounds/thunderStomp.ogg differ diff --git a/src/main/resources/sounds/vineWhip.ogg b/src/main/resources/sounds/vineWhip.ogg new file mode 100644 index 00000000..37b602ee Binary files /dev/null and b/src/main/resources/sounds/vineWhip.ogg differ diff --git a/src/main/resources/sounds/wingSlash.ogg b/src/main/resources/sounds/wingSlash.ogg new file mode 100644 index 00000000..258cc10a Binary files /dev/null and b/src/main/resources/sounds/wingSlash.ogg differ