diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2016-12-10 19:21:19 +0100 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2016-12-10 19:21:19 +0100 |
commit | f1592d3f88cbb4729f5c450146175b28d24542b0 (patch) | |
tree | 7916fd88dd0ec486427f44b5b1163c8c29a2e90d /src | |
parent | Add BoardTest (diff) | |
download | seven-wonders-f1592d3f88cbb4729f5c450146175b28d24542b0.tar.gz seven-wonders-f1592d3f88cbb4729f5c450146175b28d24542b0.tar.bz2 seven-wonders-f1592d3f88cbb4729f5c450146175b28d24542b0.zip |
Add special action skeleton to finish wonders data parsing
These special actions imply a new input from the user, which is not implemented yet
Diffstat (limited to 'src')
4 files changed, 73 insertions, 8 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/data/definitions/EffectsDefinition.java b/src/main/java/org/luxons/sevenwonders/game/data/definitions/EffectsDefinition.java index f7fe5573..d239318d 100644 --- a/src/main/java/org/luxons/sevenwonders/game/data/definitions/EffectsDefinition.java +++ b/src/main/java/org/luxons/sevenwonders/game/data/definitions/EffectsDefinition.java @@ -12,6 +12,8 @@ import org.luxons.sevenwonders.game.effects.MilitaryReinforcements; import org.luxons.sevenwonders.game.effects.ProductionIncrease; import org.luxons.sevenwonders.game.effects.RawPointsIncrease; import org.luxons.sevenwonders.game.effects.ScienceProgress; +import org.luxons.sevenwonders.game.effects.SpecialAction; +import org.luxons.sevenwonders.game.effects.SpecialActionTrigger; public class EffectsDefinition implements Definition<List<Effect>> { @@ -29,6 +31,8 @@ public class EffectsDefinition implements Definition<List<Effect>> { private RawPointsIncrease points; + private SpecialAction action; + @Override public List<Effect> create(Settings settings) { List<Effect> effects = new ArrayList<>(); @@ -53,6 +57,9 @@ public class EffectsDefinition implements Definition<List<Effect>> { if (points != null) { effects.add(points); } + if (action != null) { + effects.add(new SpecialActionTrigger(action)); + } return effects; } } diff --git a/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAction.java b/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAction.java new file mode 100644 index 00000000..83cc1956 --- /dev/null +++ b/src/main/java/org/luxons/sevenwonders/game/effects/SpecialAction.java @@ -0,0 +1,25 @@ +package org.luxons.sevenwonders.game.effects; + +public enum SpecialAction { + /** + * The player can play the last card of each age instead of discarding it. This card can be played by paying its + * cost, discarded to gain 3 coins or used in the construction of his or her Wonder. + */ + PLAY_LAST_CARD, + + /** + * Once per age, a player can construct a building from his or her hand for free. + */ + ONE_FREE, + + /** + * The player can look at all cards discarded since the beginning of the game, pick one and build it for free. + */ + PLAY_DISCARDED, + + /** + * The player can, at the end of the game, “copy” a Guild of his or her choice (purple card), built by one of his or + * her two neighboring cities. + */ + COPY_GUILD; +} diff --git a/src/main/java/org/luxons/sevenwonders/game/effects/SpecialActionTrigger.java b/src/main/java/org/luxons/sevenwonders/game/effects/SpecialActionTrigger.java new file mode 100644 index 00000000..aef06741 --- /dev/null +++ b/src/main/java/org/luxons/sevenwonders/game/effects/SpecialActionTrigger.java @@ -0,0 +1,26 @@ +package org.luxons.sevenwonders.game.effects; + +import org.luxons.sevenwonders.game.boards.Board; + +public class SpecialActionTrigger implements Effect { + + private final SpecialAction specialAction; + + public SpecialActionTrigger(SpecialAction specialAction) { + this.specialAction = specialAction; + } + + public SpecialAction getSpecialAction() { + return specialAction; + } + + @Override + public void apply(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard) { + + } + + @Override + public int computePoints(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard) { + return 0; + } +} diff --git a/src/main/resources/org/luxons/sevenwonders/game/data/wonders.json b/src/main/resources/org/luxons/sevenwonders/game/data/wonders.json index cac9e82d..eb04b90e 100644 --- a/src/main/resources/org/luxons/sevenwonders/game/data/wonders.json +++ b/src/main/resources/org/luxons/sevenwonders/game/data/wonders.json @@ -121,7 +121,7 @@ "resources": "WWG" }, "effects": { - "custom": "play2" + "action": "PLAY_LAST_CARD" } }, { @@ -307,7 +307,7 @@ "resources": "OOO" }, "effects": { - "custom": "discard" + "action": "PLAY_DISCARDED" } }, { @@ -332,7 +332,7 @@ }, "effects": { "points": 2, - "custom": "discard" + "action": "PLAY_DISCARDED" } }, { @@ -342,7 +342,7 @@ }, "effects": { "points": 1, - "custom": "discard" + "action": "PLAY_DISCARDED" } }, { @@ -351,7 +351,7 @@ "resources": "GPL" }, "effects": { - "custom": "discard" + "action": "PLAY_DISCARDED" } } ], @@ -378,7 +378,7 @@ "resources": "SS" }, "effects": { - "custom": "1free" + "action": "ONE_FREE" } }, { @@ -402,7 +402,14 @@ "resources": "WW" }, "effects": { - "custom": "discount" + "discount": { + "resourceTypes": "WSOC", + "providers": [ + "LEFT_PLAYER", + "RIGHT_PLAYER" + ], + "discountedPrice": 1 + } } }, { @@ -420,7 +427,7 @@ "resources": "OOL" }, "effects": { - "custom": "guild" + "action": "COPY_GUILD" } } ], |