- private int castlePosition;
- public int getCastlePosition() {
- return castlePosition;
- }
- public void setCastlePosition(int pos) {
- castlePosition = pos;
- }
-
- private int stones;
- public int getStones()
- {
- return stones;
- }
- public void consumeStones(int n) throws InvalidAction {
- if (n > stones) {
- throw new InvalidAction("attempted to throw more stones than they had.");
- }
- setStones(stones - n);
- }
- public void setStones(int n) {
- stones = n;
- if (stones <= 0) {
- stoneCounter.setText("No stones!");
- stoneCounter.setFillColor(0xff7777);
- }
- else if (stones == 1) {
- stoneCounter.setText("1 stone");
- stoneCounter.setFillColor(0xffbb77);
- }
- else {
- stoneCounter.setText(stones + " stones");
- }
- }
-
- private int multiplier;
- public int getMultiplier() {
- return multiplier;
- }
- public void setMultiplier(int m){
- multiplier = m;
- }
-
- public void adjustScore(int trollPosition) {
- setScore(Math.abs(castlePosition - trollPosition));
- }