refactor: restructure code and fix some events not being applied
This commit is contained in:
@ -7,8 +7,6 @@ import uulm.teamname.marvelous.gamelibrary.IntVector2;
|
||||
import uulm.teamname.marvelous.gamelibrary.config.*;
|
||||
import uulm.teamname.marvelous.gamelibrary.entities.*;
|
||||
import uulm.teamname.marvelous.gamelibrary.entities.Character;
|
||||
import uulm.teamname.marvelous.gamelibrary.events.Event;
|
||||
import uulm.teamname.marvelous.gamelibrary.events.EventType;
|
||||
import uulm.teamname.marvelous.gamelibrary.requests.*;
|
||||
|
||||
import java.util.*;
|
||||
@ -79,12 +77,12 @@ class GameLogicTest {
|
||||
|
||||
props.name = generateName(10);
|
||||
|
||||
props.HP = Math.abs(randomIntegers.next() % 20);
|
||||
props.MP = Math.abs(randomIntegers.next() % 7);
|
||||
props.AP = Math.abs(randomIntegers.next() % 7);
|
||||
props.meleeDamage = Math.abs(randomIntegers.next() % 7);
|
||||
props.rangedDamage = Math.abs(randomIntegers.next() % 7);
|
||||
props.attackRange = Math.abs(randomIntegers.next() % 7);
|
||||
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;
|
||||
}
|
||||
@ -161,35 +159,11 @@ class GameLogicTest {
|
||||
|
||||
@Test
|
||||
void testGame() {
|
||||
GameInstance game = new GameInstance(partyConfig, characterConfig, scenarioConfig);
|
||||
GameInstance server = new GameInstance(partyConfig, characterConfig, scenarioConfig);
|
||||
|
||||
ArrayList<Event> result = game.startGame(player1Selection, player2Selection);
|
||||
server.startGame(player1Selection, player2Selection);
|
||||
|
||||
assertTrue(result.size() > 0, "Start game should return at least one event");
|
||||
|
||||
Event actual = result.get(0);
|
||||
|
||||
assertEquals(EventType.GamestateEvent, actual.type, "First event should be a GameStateEvent");
|
||||
|
||||
System.out.println(game.toString());
|
||||
|
||||
game.applyEvents(GameLogic.spawnThanos(game.getState()));
|
||||
|
||||
System.out.println(game.toString());
|
||||
|
||||
NPC thanos = (NPC)game.state.getEntities().findEntity(new EntityID(EntityType.NPC, 2));
|
||||
|
||||
game.applyEvents(GameLogic.handleThanos(game.getState(), thanos));
|
||||
|
||||
System.out.println(game.toString());
|
||||
|
||||
game.applyEvents(GameLogic.handleThanos(game.getState(), thanos));
|
||||
|
||||
System.out.println(game.toString());
|
||||
|
||||
game.applyEvents(GameLogic.handleThanos(game.getState(), thanos));
|
||||
|
||||
System.out.println(game.toString());
|
||||
System.out.println(server.toString());
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user