Add: PlayerTest.java Added Javadoc For "removeFood".
This commit is contained in:
@@ -114,7 +114,7 @@ public class Player {
|
||||
|
||||
/**
|
||||
* Getter for the private attribute {@link #PrestigeValue}.
|
||||
* @return {@code int} - The amount of Prestige the player possesses.
|
||||
* @return {@code int} - The amount of Prestige the Player possesses.
|
||||
*/
|
||||
public int getPrestigeValue() {
|
||||
return PrestigeValue;
|
||||
@@ -134,13 +134,27 @@ public class Player {
|
||||
* Adds {@code Value} amount of {@code Food} to the Player.
|
||||
* @param Value The amount of {@code Food} to be added.
|
||||
* Should be positive for expected results
|
||||
* (otherwise the method will subtract {@code abs(Value)}).
|
||||
* (otherwise the method will subtract the absolute
|
||||
* value of {@code Value}).
|
||||
* @see #FoodValue
|
||||
*/
|
||||
public void addFood(int Value){
|
||||
this.FoodValue += Value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes {@code Value} amount of {@code Food} from the Player.
|
||||
* Note: {@link #FoodValue} cannot be negative, so the method will
|
||||
* return {@code False} if {@code Value} is greater than the
|
||||
* amount of {@code Food} the Player possesses, {@code False} otherwise.
|
||||
* @param Value The amount of {@code Food} to be removed.
|
||||
* Should be positive for expected results
|
||||
* (otherwise the method will add the absolute
|
||||
* value of {@code Value}).
|
||||
* @return {@code Boolean} - {@code True} if {@code Value} is greater than
|
||||
* the amount of {@code Food} the Player possesses, {@code False} otherwise.
|
||||
* @see #FoodValue
|
||||
*/
|
||||
public Boolean removeFood(int Value){
|
||||
if(Value > this.FoodValue){
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user