Merge pull request #20

Add: PlayerTest.java Added Javadoc For "removeFood".
This commit is contained in:
GabrieleRadice
2026-04-12 16:56:42 +02:00
committed by GitHub
@@ -114,7 +114,7 @@ public class Player {
/** /**
* Getter for the private attribute {@link #PrestigeValue}. * 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() { public int getPrestigeValue() {
return PrestigeValue; return PrestigeValue;
@@ -134,13 +134,27 @@ public class Player {
* Adds {@code Value} amount of {@code Food} to the Player. * Adds {@code Value} amount of {@code Food} to the Player.
* @param Value The amount of {@code Food} to be added. * @param Value The amount of {@code Food} to be added.
* Should be positive for expected results * 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 * @see #FoodValue
*/ */
public void addFood(int Value){ public void addFood(int Value){
this.FoodValue += 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){ public Boolean removeFood(int Value){
if(Value > this.FoodValue){ if(Value > this.FoodValue){
return false; return false;