Javadoc for goals
This commit is contained in:
parent
c348da2de2
commit
c3284910eb
4 changed files with 28 additions and 0 deletions
|
|
@ -21,10 +21,20 @@ public class CaptureTheFlagGoal extends Goal {
|
|||
int numFlagCastles;
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
/**
|
||||
* Generates a random integer in this interval
|
||||
* @param min The minimum number
|
||||
* @param max The maximum number
|
||||
* @return The random number
|
||||
*/
|
||||
private static int newRandomInt(int min, int max) {
|
||||
return min + random.nextInt(max - min + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new capture the flag goal
|
||||
*/
|
||||
public CaptureTheFlagGoal() {
|
||||
super("Capture the flag", "Derjenige Spieler gewinnt, der zuerst"
|
||||
+ " alle weiß umrandeten Flaggen-Schlösser erobert.");
|
||||
|
|
@ -104,6 +114,11 @@ public class CaptureTheFlagGoal extends Goal {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this castle is a flag castle
|
||||
* @param castle The castle
|
||||
* @return true if the castle is a flag castle, false otherwise
|
||||
*/
|
||||
public boolean isFlagCastle(Castle castle) {
|
||||
|
||||
return flagCastles.contains(castle);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ import game.map.Castle;
|
|||
|
||||
public class ConquerGoal extends Goal {
|
||||
|
||||
/**
|
||||
* Constructs a new conquer goal
|
||||
*/
|
||||
public ConquerGoal() {
|
||||
super("Eroberung", "Derjenige Spieler gewinnt, der als erstes alle Gebiete erobert hat.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ public class PopulationGoal extends Goal {
|
|||
private int populationNeeded = 10;
|
||||
private int castlesNeeded = 5;
|
||||
|
||||
/**
|
||||
* Creates a new population goal
|
||||
*/
|
||||
public PopulationGoal() {
|
||||
super("Bevölkerung", "Derjenige Spieler gewinnt, der als erstes jeweils 10 Truppen auf 5 Burgen bringt");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,17 @@ public class TimeGoal extends Goal {
|
|||
|
||||
int maxRounds;
|
||||
|
||||
/**
|
||||
* Creates a new time goal with the default limit
|
||||
*/
|
||||
public TimeGoal() {
|
||||
this(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new time goal with the specified limit
|
||||
* @param maxRounds The limit of rounds
|
||||
*/
|
||||
public TimeGoal(int maxRounds) {
|
||||
super("Countdown", "Derjenige Spieler gewinnt, der nach " + maxRounds + " Runden die meisten Burgen besitzt.");
|
||||
this.maxRounds = maxRounds;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue