package com.codingame.game;
+import java.util.List;
+
import java.util.regex.Pattern;
import java.util.Scanner;
import java.util.InputMismatchException;
import com.codingame.gameengine.module.entities.Sprite;
public class Player extends AbstractMultiplayerPlayer {
- Group avatar;
- Text stoneCounter;
- Text message;
- Sprite castle;
- Text stone;
+ Model.Player model;
+ View.Player view;
private String messageString = "";
public String getMessageString() { return messageString; }
- 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));
- }
-
@Override
public int getExpectedOutputLines() {
return 1;