Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -343,6 +347,7 @@ public void handleInput(GameData gameData, IGameViewManager gameViewManager) {
chooseSound.play(getSoundVolume());
battleResults = new ArrayList<Future<IBattleResult>>();
battleResultsToRemove = new ArrayList<Future<IBattleResult>>();
monsterSelector.refreshSelector();
for (var i = 0; i < concurrentBattles; i++) {
battleResults.add(runBattle());
}
Expand All @@ -368,8 +373,8 @@ private Future<IBattleResult> runBattle() {
}

// Currently just static list of monsters. Maybe create random teams, load from file or let user select teams
List<IMonster> teamA = Arrays.asList(monsterRegistry.getMonster(0), monsterRegistry.getMonster(1), monsterRegistry.getMonster(2));
List<IMonster> teamB = Arrays.asList(monsterRegistry.getMonster(0), monsterRegistry.getMonster(1), monsterRegistry.getMonster(2));
List<IMonster> teamA = monsterSelector.createMonsterTeam(TEAM_MONSTER_AMOUNT);
List<IMonster> teamB = monsterSelector.createMonsterTeam(TEAM_MONSTER_AMOUNT);

var teamAPlayer = new BattleParticipant(teamA, true);
var teamBPlayer = new BattleParticipant(teamB, false);
Expand Down
Original file line number Diff line number Diff line change
@@ -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<IMonster> 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<IMonster> createMonsterTeam(int amount){
List<IMonster> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Binary file added src/main/resources/images/phoenix_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/phoenix_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/rockGolem_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/rockGolem_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/thunderBison_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/thunderBison_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/turtle_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/turtle_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/vineSerpent_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/vineSerpent_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 61 additions & 1 deletion src/main/resources/json/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
185 changes: 157 additions & 28 deletions src/main/resources/json/moves.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[
{
"id" : "spit",
"name" : "Spit",
"damage" : 40,
"type" : "WATER",
"id": "spit",
"name": "Spit",
"damage": 40,
"type": "WATER",
"sound": "/sounds/spit.ogg"
},
{
Expand All @@ -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"
},
{
Expand All @@ -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"
},
{
Expand Down Expand Up @@ -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"
},
{
Expand Down Expand Up @@ -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",
Expand Down
Binary file added src/main/resources/sounds/aquaticWave.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/charge.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/fireBall.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/headButt.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/hornSlam.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/inferno.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/ironDefense.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/leafShield.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/lightningStrike.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/natureBlast.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/old/slam.ogg
Binary file not shown.
Binary file modified src/main/resources/sounds/old/tackle.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/razorLeaf.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/rockThrow.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/shellDefense.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/soar.ogg
Binary file not shown.
Binary file modified src/main/resources/sounds/tackle.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/thunderStomp.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/vineWhip.ogg
Binary file not shown.
Binary file added src/main/resources/sounds/wingSlash.ogg
Binary file not shown.