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;
|
int numFlagCastles;
|
||||||
|
|
||||||
private static Random random = new Random();
|
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) {
|
private static int newRandomInt(int min, int max) {
|
||||||
return min + random.nextInt(max - min + 1);
|
return min + random.nextInt(max - min + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new capture the flag goal
|
||||||
|
*/
|
||||||
public CaptureTheFlagGoal() {
|
public CaptureTheFlagGoal() {
|
||||||
super("Capture the flag", "Derjenige Spieler gewinnt, der zuerst"
|
super("Capture the flag", "Derjenige Spieler gewinnt, der zuerst"
|
||||||
+ " alle weiß umrandeten Flaggen-Schlösser erobert.");
|
+ " 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) {
|
public boolean isFlagCastle(Castle castle) {
|
||||||
|
|
||||||
return flagCastles.contains(castle);
|
return flagCastles.contains(castle);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ import game.map.Castle;
|
||||||
|
|
||||||
public class ConquerGoal extends Goal {
|
public class ConquerGoal extends Goal {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new conquer goal
|
||||||
|
*/
|
||||||
public ConquerGoal() {
|
public ConquerGoal() {
|
||||||
super("Eroberung", "Derjenige Spieler gewinnt, der als erstes alle Gebiete erobert hat.");
|
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 populationNeeded = 10;
|
||||||
private int castlesNeeded = 5;
|
private int castlesNeeded = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new population goal
|
||||||
|
*/
|
||||||
public PopulationGoal() {
|
public PopulationGoal() {
|
||||||
super("Bevölkerung", "Derjenige Spieler gewinnt, der als erstes jeweils 10 Truppen auf 5 Burgen bringt");
|
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;
|
int maxRounds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new time goal with the default limit
|
||||||
|
*/
|
||||||
public TimeGoal() {
|
public TimeGoal() {
|
||||||
this(4);
|
this(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new time goal with the specified limit
|
||||||
|
* @param maxRounds The limit of rounds
|
||||||
|
*/
|
||||||
public TimeGoal(int maxRounds) {
|
public TimeGoal(int maxRounds) {
|
||||||
super("Countdown", "Derjenige Spieler gewinnt, der nach " + maxRounds + " Runden die meisten Burgen besitzt.");
|
super("Countdown", "Derjenige Spieler gewinnt, der nach " + maxRounds + " Runden die meisten Burgen besitzt.");
|
||||||
this.maxRounds = maxRounds;
|
this.maxRounds = maxRounds;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue