WIP add missions etc.

This commit is contained in:
joachimschmidt557 2019-03-20 14:05:49 +01:00
parent 3ceb4492d1
commit 6f8b981cea
3 changed files with 79 additions and 2 deletions

View file

@ -6,27 +6,65 @@ public abstract class Goal {
private final String description; private final String description;
private final String name; private final String name;
/**
* Constructs a new goal/mission
* @param name Quick name
* @param description Description for the goal
*/
public Goal(String name, String description) { public Goal(String name, String description) {
this.name = name; this.name = name;
this.description = description; this.description = description;
} }
/**
* Set the current game
* @param game The game
*/
public void setGame(Game game) { public void setGame(Game game) {
this.game = game; this.game = game;
} }
/**
* Returns whether the goal/mission is completed
* @return True if the mission is complete, false
* otherwise
*/
public abstract boolean isCompleted(); public abstract boolean isCompleted();
/**
* Returns the winner of the game or null
* if there is no winner (yet)
* @return A Player object or null
*/
public abstract Player getWinner(); public abstract Player getWinner();
/**
* Returns whether a player has lost
* @param player The player
* @return True if the player has lost
*/
public abstract boolean hasLost(Player player); public abstract boolean hasLost(Player player);
public final String getDescription() { /**
* Gets the description of the mission
* @return The description
*/
public final String getDescription() {
return this.description; return this.description;
} }
/**
* Gets the name of the mission
* @return The name
*/
public final String getName() { public final String getName() {
return this.name; return this.name;
} }
/**
* Gets the game attached to this mission
* @return The game
*/
protected Game getGame() { protected Game getGame() {
return this.game; return this.game;
} }

View file

@ -0,0 +1,31 @@
package game.goals;
import game.Goal;
import game.Player;
public class CaptureTheFlagGoal extends Goal {
public CaptureTheFlagGoal() {
// TODO Auto-generated constructor stub
super("Capture the flag", "");
}
@Override
public boolean isCompleted() {
// TODO Auto-generated method stub
return false;
}
@Override
public Player getWinner() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean hasLost(Player player) {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -192,5 +192,13 @@ Für alle noch nicht abgearbeiteten Knoten gilt:
Für alle abgearbeiteten Knoten gilt: Für alle abgearbeiteten Knoten gilt:
\subsection{Kürzester Pfad zu allen Knoten} \subsection{Kürzester Pfad zu allen Knoten}
\section{Weitergestaltung des Spiels}
\subsection{Computergegner}
\subsection{Missionen}
\subsection{Joker}
\end{document} \end{document}