88 lines
3.1 KiB
Java
88 lines
3.1 KiB
Java
package uulm.teamname.marvelous.server;
|
|
|
|
import uulm.teamname.marvelous.gamelibrary.config.*;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.concurrent.ThreadLocalRandom;
|
|
|
|
public class BaseGameLogicTest {
|
|
protected static final Iterator<Integer> randomIntegers = ThreadLocalRandom.current().ints().iterator();
|
|
|
|
protected static final PartyConfig partyConfig = new PartyConfig();
|
|
protected static final CharacterConfig characterConfig = new CharacterConfig();
|
|
protected static final ScenarioConfig scenarioConfig = new ScenarioConfig();
|
|
|
|
protected static final ArrayList<Integer> player1Selection = new ArrayList<>();
|
|
protected static final ArrayList<Integer> player2Selection = new ArrayList<>();
|
|
|
|
protected static void generate() {
|
|
partyConfig.maxRounds = 50;
|
|
partyConfig.mindStoneCD = 2;
|
|
partyConfig.powerStoneCD = 3;
|
|
partyConfig.realityStoneCD = 4;
|
|
partyConfig.soulStoneCD = 5;
|
|
partyConfig.spaceStoneCD = 6;
|
|
partyConfig.timeStoneCD = 7;
|
|
partyConfig.mindStoneDMG = 3;
|
|
|
|
partyConfig.maxRoundTime = 1000;
|
|
partyConfig.maxGameTime = 1000;
|
|
partyConfig.maxAnimationTime = 1000;
|
|
partyConfig.maxResponseTime = 1000;
|
|
partyConfig.maxPauseTime = 1000;
|
|
|
|
characterConfig.characters = new CharacterProperties[24];
|
|
for(int i = 0; i < characterConfig.characters.length; i++) {
|
|
characterConfig.characters[i] = generateCharacter(i);
|
|
}
|
|
|
|
scenarioConfig.name = generateName(20);
|
|
scenarioConfig.author = generateName(20);
|
|
scenarioConfig.scenario = new FieldType[20][20];
|
|
for(int x = 0; x < scenarioConfig.scenario[0].length; x++) {
|
|
for(int y = 0; y < scenarioConfig.scenario.length; y++) {
|
|
if(Math.abs(randomIntegers.next() % 100) < 10) {
|
|
scenarioConfig.scenario[y][x] = FieldType.ROCK;
|
|
}else {
|
|
scenarioConfig.scenario[y][x] = FieldType.GRASS;
|
|
}
|
|
}
|
|
}
|
|
|
|
for(int i = 0; i < 6; i++) {
|
|
player1Selection.add(i);
|
|
}
|
|
|
|
for(int i = 6; i < 12; i++) {
|
|
player2Selection.add(i);
|
|
}
|
|
}
|
|
|
|
private static String generateName(int length) {
|
|
StringBuilder name = new StringBuilder();
|
|
for (int j = 0; j < length; j++) {
|
|
name.append((char) (
|
|
65 + Math.abs(randomIntegers.next() % 26) + 32 * Math.abs(randomIntegers.next() % 2)
|
|
));
|
|
}
|
|
return name.toString();
|
|
}
|
|
|
|
private static CharacterProperties generateCharacter(int id) {
|
|
CharacterProperties props = new CharacterProperties();
|
|
|
|
props.characterID = id;
|
|
props.name = generateName(10);
|
|
|
|
props.HP = Math.abs(randomIntegers.next() % 15) + 5;
|
|
props.MP = Math.abs(randomIntegers.next() % 5) + 2;
|
|
props.AP = Math.abs(randomIntegers.next() % 5) + 2;
|
|
props.meleeDamage = Math.abs(randomIntegers.next() % 5) + 2;
|
|
props.rangedDamage = Math.abs(randomIntegers.next() % 5) + 2;
|
|
props.attackRange = Math.abs(randomIntegers.next() % 5) + 2;
|
|
|
|
return props;
|
|
}
|
|
}
|