From d9f78f8ee3b07871ee0f6868eb30e935e112afd8 Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Sat, 10 Dec 2016 09:45:42 +0100 Subject: Make Effect an interface instead of abstract class --- .../org/luxons/sevenwonders/game/effects/BonusPerBoardElement.java | 2 +- src/main/java/org/luxons/sevenwonders/game/effects/Effect.java | 6 +++--- .../java/org/luxons/sevenwonders/game/effects/EndGameEffect.java | 3 ++- .../java/org/luxons/sevenwonders/game/effects/InstantEffect.java | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.java b/src/main/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.java index 51da55bb..f876328c 100644 --- a/src/main/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.java +++ b/src/main/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.java @@ -6,7 +6,7 @@ import org.luxons.sevenwonders.game.boards.Board; import org.luxons.sevenwonders.game.RelativePlayerPosition; import org.luxons.sevenwonders.game.cards.Color; -public class BonusPerBoardElement extends Effect { +public class BonusPerBoardElement implements Effect { private List boards; diff --git a/src/main/java/org/luxons/sevenwonders/game/effects/Effect.java b/src/main/java/org/luxons/sevenwonders/game/effects/Effect.java index 86a6ae8c..b9634553 100644 --- a/src/main/java/org/luxons/sevenwonders/game/effects/Effect.java +++ b/src/main/java/org/luxons/sevenwonders/game/effects/Effect.java @@ -2,9 +2,9 @@ package org.luxons.sevenwonders.game.effects; import org.luxons.sevenwonders.game.boards.Board; -public abstract class Effect { +public interface Effect { - public abstract void apply(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard); + void apply(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard); - public abstract int computePoints(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard); + int computePoints(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard); } diff --git a/src/main/java/org/luxons/sevenwonders/game/effects/EndGameEffect.java b/src/main/java/org/luxons/sevenwonders/game/effects/EndGameEffect.java index e7a08e5c..ca8a1948 100644 --- a/src/main/java/org/luxons/sevenwonders/game/effects/EndGameEffect.java +++ b/src/main/java/org/luxons/sevenwonders/game/effects/EndGameEffect.java @@ -2,8 +2,9 @@ package org.luxons.sevenwonders.game.effects; import org.luxons.sevenwonders.game.boards.Board; -public abstract class EndGameEffect extends Effect { +public abstract class EndGameEffect implements Effect { + @Override public void apply(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard) { } } diff --git a/src/main/java/org/luxons/sevenwonders/game/effects/InstantEffect.java b/src/main/java/org/luxons/sevenwonders/game/effects/InstantEffect.java index 9f2e09ff..c3e5455e 100644 --- a/src/main/java/org/luxons/sevenwonders/game/effects/InstantEffect.java +++ b/src/main/java/org/luxons/sevenwonders/game/effects/InstantEffect.java @@ -2,8 +2,9 @@ package org.luxons.sevenwonders.game.effects; import org.luxons.sevenwonders.game.boards.Board; -public abstract class InstantEffect extends Effect { +public abstract class InstantEffect implements Effect { + @Override public int computePoints(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard) { return 0; } -- cgit