Skip to content

Commit

Permalink
PhrancisGame now takes an ECSGame as input and constructs from that
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Oct 6, 2014
1 parent 2c90f59 commit 2ce7c53
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

import org.apache.log4j.PropertyConfigurator;

import net.zomis.cardshifter.ecs.base.ECSGame;
import net.zomis.cardshifter.ecs.main.ConsoleControllerECS;
import net.zomis.cardshifter.ecs.usage.PhrancisGame;

import org.apache.log4j.PropertyConfigurator;

import com.beust.jcommander.JCommander;
import com.beust.jcommander.ParameterException;
import com.cardshifter.core.Game;
Expand Down Expand Up @@ -42,7 +43,7 @@ else if (options.isLua()) {
startLuaGame(options);
}
else {
new ConsoleControllerECS(PhrancisGame.createGame()).play(input);
new ConsoleControllerECS(PhrancisGame.createGame(new ECSGame())).play(input);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ public Entity getEntity(int entity) {
return entities.get(entity);
}

// TODO: Player component, Zone component for a zone
// TODO: Actions ++ copy actions. List<Target(s)> ("deal 1 damage to up to three targets and then give up to three targets +1/+1 until end of turn"), Set<ActionOptions>. choose one, choose two
// TODO: Network inform when a component on an entity is changed (DataChangedEvent? Aspect-oriented? onChange method? ResMap?)
// TODO: Implement the standard Phrancis game
// TODO: Enchantments
public void setRandomSeed(long seed) {
random.setSeed(seed);
}

// TODO: copy actions. Set<ActionOptions>. choose one, choose two
// TODO: More Hearthstone-like features. Enchantments, effects, battlecry, deathrattle, etc.

}
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,6 @@ private String indent(final int amount) {
}

public static void main(String[] args) {
new ConsoleControllerECS(PhrancisGame.createGame()).play(new Scanner(System.in, StandardCharsets.UTF_8.name()));
new ConsoleControllerECS(PhrancisGame.createGame(new ECSGame())).play(new Scanner(System.in, StandardCharsets.UTF_8.name()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public enum PhrancisResources implements ECSResource {

private static final int CARDS_OF_EACH_TYPE = 3;

public static ECSGame createGame() {
ECSGame game = new ECSGame();
public static ECSGame createGame(ECSGame game) {

PhaseController phaseController = new PhaseController();
game.newEntity().addComponent(phaseController);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public class PhrancisTest {
@Before
public void before() {
PropertyConfigurator.configure(PhrancisTest.class.getResourceAsStream("log4j.properties"));
game = PhrancisGame.createGame();
game = new ECSGame();
game.setRandomSeed(42);
PhrancisGame.createGame(game);
game.startGame();
phase = ComponentRetriever.singleton(game, PhaseController.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void acceptAIChoice(AIComponent aiChoice) {
}

public void initializeGame() {
game = PhrancisGame.createGame();
game = PhrancisGame.createGame(new ECSGame());
phases = ComponentRetriever.singleton(game, PhaseController.class);

if (!aiIsLoaded) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class TCGGame extends ServerGame {

public TCGGame(Server server, int id) {
super(server, id);
game = PhrancisGame.createGame();
game = PhrancisGame.createGame(new ECSGame());
game.getEvents().registerHandlerAfter(this, ResourceValueChange.class, this::broadcast);
game.getEvents().registerHandlerAfter(this, ZoneChangeEvent.class, this::zoneChange);
game.getEvents().registerHandlerAfter(this, EntityRemoveEvent.class, this::remove);
Expand Down

0 comments on commit 2ce7c53

Please sign in to comment.