Player created
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package ch.zhaw.catan;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* New Class PLayer
|
||||
@@ -11,10 +11,51 @@ public class Player {
|
||||
|
||||
private String name;
|
||||
private Config.Faction faction;
|
||||
private Config.Resource resource;
|
||||
private HashMap<Config.Resource,Integer> resources;
|
||||
private int roadsToUse;
|
||||
private int settlementsToUse;
|
||||
|
||||
public Player (String name, Config.Faction faction){
|
||||
this.name = new name(" ");
|
||||
//Datenfelder
|
||||
this.name = name;
|
||||
this.faction = faction;
|
||||
roadsToUse = Config.Structure.ROAD.getStockPerPlayer();
|
||||
settlementsToUse = Config.Structure.SETTLEMENT.getStockPerPlayer();
|
||||
//Ressourcen initialisiern
|
||||
resources = new HashMap<>();
|
||||
for(Config.Resource resource : Config.Resource.values()) {
|
||||
resources.put(resource,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns all the resources the player has at the moment
|
||||
* @return HashMap
|
||||
*/
|
||||
public HashMap<Config.Resource,Integer> getResources() {
|
||||
return resources;
|
||||
}
|
||||
|
||||
|
||||
public boolean buildRoad() {
|
||||
if (roadsToUse > 0) {
|
||||
roadsToUse--;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean buildSettlement() {
|
||||
if (settlementsToUse > 0) {
|
||||
settlementsToUse--;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user