diff options
Diffstat (limited to 'src/jrummikub/model/Hand.java')
-rw-r--r-- | src/jrummikub/model/Hand.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/jrummikub/model/Hand.java b/src/jrummikub/model/Hand.java index ab5eb19..35ea49f 100644 --- a/src/jrummikub/model/Hand.java +++ b/src/jrummikub/model/Hand.java @@ -10,6 +10,12 @@ public class Hand extends StoneTray<Stone> implements IHand { * The width of the hand */ public final static int WIDTH = 14; + + private GameSettings settings; + + public Hand(GameSettings settings) { + this.settings = settings; + } @Override public int getFreeRowSpace(int row) { @@ -54,4 +60,18 @@ public class Hand extends StoneTray<Stone> implements IHand { } } } + + public int getStonePoints() { + int points = 0; + + for (Pair<Stone, Position> entry : this) { + if (entry.getFirst().isJoker()) { + points += settings.getJokerPoints(); + } else { + points += entry.getFirst().getValue(); + } + } + + return points; + } } |