Add: JavaDoc for Order2
This commit is contained in:
@@ -7,12 +7,30 @@ import it.polimi.ingsw.gc14.Model.Player;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class Order2 extends OrderLogicCard {
|
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
|
||||||
|
*/
|
||||||
public Order2(ArrayList<Player> players)throws NoSuchElementException {
|
public Order2(ArrayList<Player> players)throws NoSuchElementException {
|
||||||
if(players.size()!=2)
|
if(players.size()!=2)
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
super(players);
|
super(players);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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,
|
||||||
|
* 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}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void effect(Player player,int index) throws IndexOutOfBoundsException
|
protected void effect(Player player,int index) throws IndexOutOfBoundsException
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user