Fix: Fixed Typos In Order2.java, Order3.java, Order4.java, Order5.java.

This commit is contained in:
GabrieleRadice
2026-04-12 19:45:47 +02:00
parent 4db74976c1
commit 6ff5ca00aa
4 changed files with 34 additions and 39 deletions
@@ -1,6 +1,5 @@
package it.polimi.ingsw.gc14.Model.Orders;
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.OrderLogicCard;
import it.polimi.ingsw.gc14.Model.Player;
@@ -11,8 +10,8 @@ public class Order2 extends OrderLogicCard {
/**
* Creates an Order2 logic card for a two-player game.
*
* @param players the list of players associated with this order card
* @throws NoSuchElementException if the number of players is not equal to 2
* @param players the list of players associated with this order card.
* @throws NoSuchElementException if the number of players is not equal to 2.
*/
public Order2(ArrayList<Player> players)throws NoSuchElementException {
if(players.size()!=2)
@@ -23,13 +22,13 @@ public class Order2 extends OrderLogicCard {
/**
* Applies the effect associated with the specified position index for the given player.
* If {@code index == 0}, the player gains 1 Food and the building effect is applied.
* If {@code index == 1}, the player tries to remove 1 Food; if the player cannot remove it,
* <p>If {@code index == 0}, the player gains 1 Food and the building effect is applied.
* <p>If {@code index == 1}, the player tries to remove 1 Food; if the player cannot remove it,
* the player loses 2 Prestige.
*
* @param player the player to whom the effect is applied
* @param index the position index of the effect to apply
* @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 2}
* @param player the player to whom the effect is applied.
* @param index the position index of the effect to apply.
* @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 2}.
*/
@Override
protected void effect(Player player,int index) throws IndexOutOfBoundsException
@@ -47,7 +46,6 @@ public class Order2 extends OrderLogicCard {
if(index==1){
if(!player.removeFood(1)){
player.removePrestige(2);
return;
}
}
}
@@ -11,8 +11,8 @@ public class Order3 extends OrderLogicCard {
/**
* Creates an Order3 logic card for a three-player game.
*
* @param players the list of players associated with this order card
* @throws NoSuchElementException if the number of players is not equal to 3
* @param players the list of players associated with this order card.
* @throws NoSuchElementException if the number of players is not equal to 3.
*/
public Order3(ArrayList<Player> players) throws NoSuchElementException{
if(players.size()!=3)
@@ -22,13 +22,13 @@ public class Order3 extends OrderLogicCard {
/**
* Applies the effect associated with the specified position index for the given player.
* If {@code index == 0}, the player gains 2 Food and the building effect is applied.
* If {@code index == 1}, no effect is applied.
* If {@code index == 2}, if the player can remove 1 Food, the player loses 2 Prestige.
* <p>If {@code index == 0}, the player gains 2 Food and the building effect is applied.
* <p>If {@code index == 1}, no effect is applied.
* <p>If {@code index == 2}, if the player can remove 1 Food, the player loses 2 Prestige.
*
* @param player the player to whom the effect is applied
* @param index the position index of the effect to apply
* @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 3}
* @param player the player to whom the effect is applied.
* @param index the position index of the effect to apply.
* @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 3}.
*/
@Override
protected void effect(Player player,int index) throws IndexOutOfBoundsException
@@ -47,7 +47,6 @@ public class Order3 extends OrderLogicCard {
if(player.removeFood(1)){
player.removePrestige(2);
}
return;
}
}
}
@@ -11,8 +11,8 @@ public class Order4 extends OrderLogicCard {
/**
* Creates an Order4 logic card for a four-player game.
*
* @param players the list of players associated with this order card
* @throws NoSuchElementException if the number of players is not equal to 4
* @param players the list of players associated with this order card.
* @throws NoSuchElementException if the number of players is not equal to 4.
*/
public Order4(ArrayList<Player> players)throws NoSuchElementException {
if(players.size()!=4)
@@ -22,15 +22,15 @@ public class Order4 extends OrderLogicCard {
/**
* Applies the effect associated with the specified position index for the given player.
* If {@code index == 0}, the player gains 2 Food and the building effect is applied.
* If {@code index == 1}, the player gains 1 Food and the building effect is applied.
* If {@code index == 2}, no effect is applied.
* If {@code index == 3}, the player tries to remove 1 Food; if the removal succeeds,
* <p>If {@code index == 0}, the player gains 2 Food and the building effect is applied.
* <p>If {@code index == 1}, the player gains 1 Food and the building effect is applied.
* <p>If {@code index == 2}, no effect is applied.
* <p>If {@code index == 3}, the player tries to remove 1 Food; if the removal succeeds,
* the player loses 2 Prestige.
*
* @param player the player to whom the effect is applied
* @param index the position index of the effect to apply
* @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 4}
* @param player the player to whom the effect is applied.
* @param index the position index of the effect to apply.
* @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 4}.
*/
@Override
protected void effect(Player player,int index) throws IndexOutOfBoundsException
@@ -55,7 +55,6 @@ public class Order4 extends OrderLogicCard {
if(player.removeFood(1)){
player.removePrestige(2);
}
return;
}
}
}
@@ -11,8 +11,8 @@ public class Order5 extends OrderLogicCard {
/**
* Creates an Order5 logic card for a five-player game.
*
* @param players the list of players associated with this order card
* @throws NoSuchElementException if the number of players is not equal to 5
* @param players the list of players associated with this order card.
* @throws NoSuchElementException if the number of players is not equal to 5.
*/
public Order5(ArrayList<Player> players) throws NoSuchElementException{
if(players.size()!=5)
@@ -22,16 +22,16 @@ public class Order5 extends OrderLogicCard {
/**
* Applies the effect associated with the specified position index for the given player.
* If {@code index == 0}, the player gains 3 Food and the building effect is applied.
* If {@code index == 1}, the player gains 1 Food and the building effect is applied.
* If {@code index == 2}, no effect is applied.
* If {@code index == 3}, no effect is applied.
* If {@code index == 4}, the player tries to remove 1 Food; if the removal succeeds,
* <p>If {@code index == 0}, the player gains 3 Food and the building effect is applied.
* <p>If {@code index == 1}, the player gains 1 Food and the building effect is applied.
* <p>If {@code index == 2}, no effect is applied.
* <p>If {@code index == 3}, no effect is applied.
* <p>If {@code index == 4}, the player tries to remove 1 Food; if the removal succeeds,
* the player loses 2 Prestige.
*
* @param player the player to whom the effect is applied
* @param index the position index of the effect to apply
* @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 5}
* @param player the player to whom the effect is applied.
* @param index the position index of the effect to apply.
* @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 5}.
*/
@Override
protected void effect(Player player,int index) throws IndexOutOfBoundsException
@@ -56,7 +56,6 @@ public class Order5 extends OrderLogicCard {
if(player.removeFood(1)){
player.removePrestige(2);
}
return;
}
}
}