Android Open Source - bluedroid-mp Camp






From Project

Back to project page bluedroid-mp.

License

The source code is released under:

Apache License

If you think the Android project bluedroid-mp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package uk.ac.gcu.bluedroid.resources;
/*w w  w .  j  av a2  s. c o m*/
import uk.ac.gcu.bluedroid.game.Player;
import uk.ac.gcu.bluedroid.util.Position;

public class Camp extends Resource {

  // constants
  public static final int PALADIN_COST_GOLD = 6;
  public static final int ARCHER_COST_GOLD = 1;
  public static final int SOLDIER_COST_GOLD = 2;
  public static final int PALADIN_COST_FOOD = 12;
  public static final int ARCHER_COST_FOOD = 8;
  public static final int SOLDIER_COST_FOOD = 6;
  public static final int ARCHER = 1;
  public static final int SOLDIER = 2;
  public static final int PALADIN = 3;

  private boolean working;

  public Camp(int owner, Position pos) {
    super(owner, pos);
    working = true;
  }

  public Camp(Position pos) {
    super(0, pos);
    working = true;
  }
  
  public boolean hasEnoughResources(int type, Player player){
    switch (type) {
    case Camp.ARCHER:
      return player.getGold() >= Camp.ARCHER_COST_GOLD && player.getFood() >= Camp.ARCHER_COST_FOOD;
    case Camp.SOLDIER:
      return player.getGold() >= Camp.SOLDIER_COST_GOLD && player.getFood() >= Camp.SOLDIER_COST_FOOD;
    case Camp.PALADIN:
      return player.getGold() >= Camp.PALADIN_COST_GOLD && player.getFood() >= Camp.PALADIN_COST_FOOD;
    default:
      return false;
    }
    
  }

  public boolean isWorking() {
    return working;
  }

  public void setWorking(boolean bol) {
    this.working = bol;
  }

}




Java Source Code List

uk.ac.gcu.bluedroid.BluetoothChatService.java
uk.ac.gcu.bluedroid.DeviceListActivity.java
uk.ac.gcu.bluedroid.MainActivity.java
uk.ac.gcu.bluedroid.Wrapper.java
uk.ac.gcu.bluedroid.game.GameState.java
uk.ac.gcu.bluedroid.game.Map.java
uk.ac.gcu.bluedroid.game.Maps.java
uk.ac.gcu.bluedroid.game.Player.java
uk.ac.gcu.bluedroid.game.TurnInfo.java
uk.ac.gcu.bluedroid.resources.Camp.java
uk.ac.gcu.bluedroid.resources.Crop.java
uk.ac.gcu.bluedroid.resources.Mine.java
uk.ac.gcu.bluedroid.resources.Resource.java
uk.ac.gcu.bluedroid.units.Archer.java
uk.ac.gcu.bluedroid.units.Paladin.java
uk.ac.gcu.bluedroid.units.Soldier.java
uk.ac.gcu.bluedroid.units.Unit.java
uk.ac.gcu.bluedroid.util.CustomImageVIew.java
uk.ac.gcu.bluedroid.util.MyTextView.java
uk.ac.gcu.bluedroid.util.Node.java
uk.ac.gcu.bluedroid.util.Pathfinder.java
uk.ac.gcu.bluedroid.util.Position.java
uk.ac.gcu.bluedroid.util.Util.java