示例#1
0
  /*What effect does a GOBACK card have on a player?*/
  private void goback_effect(AbstractPlayer player) {
    int location = player.getLocation();

    if (location >= 0) location -= 3;
    else location = (Game.BOARDSIZE - location);

    player.setLocation(location);
  }
示例#2
0
 // is this supposed to be relative or absolute??
 // the advance to GO card moves the player 0 spaces.
 private void moveto_effect(AbstractPlayer player) {
   // Move player and if they pass go they collect $200
   int location = player.getLocation() + this.amount;
   if (location > (Game.BOARDSIZE - 1)) {
     location = location - (Game.BOARDSIZE - 1);
     player.addMoney(200);
   }
   player.setLocation(location);
 }