Fix: Orders
This commit is contained in:
@@ -3,14 +3,19 @@ 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;
|
||||
import jdk.jshell.spi.ExecutionControl;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Order2 extends OrderLogicCard {
|
||||
public Order2(ArrayList<Player> players) {
|
||||
public class Order2 extends OrderLogicCard {
|
||||
public Order2(ArrayList<Player> players)throws NoSuchElementException {
|
||||
if(players.size()!=2)
|
||||
throw new NoSuchElementException();
|
||||
super(players);
|
||||
|
||||
}
|
||||
@Override
|
||||
public void effect(Player player,int index) throws IndexOutOfBoundsException
|
||||
protected void effect(Player player,int index) throws IndexOutOfBoundsException
|
||||
{
|
||||
if(index >= 2 || index < 0)
|
||||
{
|
||||
|
||||
@@ -4,13 +4,16 @@ import it.polimi.ingsw.gc14.Model.OrderLogicCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
public class Order3 extends OrderLogicCard {
|
||||
public Order3(ArrayList<Player> players) {
|
||||
public Order3(ArrayList<Player> players) throws NoSuchElementException{
|
||||
if(players.size()!=3)
|
||||
throw new NoSuchElementException();
|
||||
super(players);
|
||||
}
|
||||
@Override
|
||||
public void effect(Player player,int index) throws IndexOutOfBoundsException
|
||||
protected void effect(Player player,int index) throws IndexOutOfBoundsException
|
||||
{
|
||||
if(index >= 3 || index < 0)
|
||||
{
|
||||
|
||||
@@ -4,13 +4,16 @@ import it.polimi.ingsw.gc14.Model.OrderLogicCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
public class Order4 extends OrderLogicCard {
|
||||
public Order4(ArrayList<Player> players) {
|
||||
public Order4(ArrayList<Player> players)throws NoSuchElementException {
|
||||
if(players.size()!=4)
|
||||
throw new NoSuchElementException();
|
||||
super(players);
|
||||
}
|
||||
@Override
|
||||
public void effect(Player player,int index) throws IndexOutOfBoundsException
|
||||
protected void effect(Player player,int index) throws IndexOutOfBoundsException
|
||||
{
|
||||
if(index>=4 || index < 0)
|
||||
{
|
||||
|
||||
@@ -4,13 +4,16 @@ import it.polimi.ingsw.gc14.Model.OrderLogicCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
public class Order5 extends OrderLogicCard {
|
||||
public Order5(ArrayList<Player> players) {
|
||||
public Order5(ArrayList<Player> players) throws NoSuchElementException{
|
||||
if(players.size()!=5)
|
||||
throw new NoSuchElementException();
|
||||
super(players);
|
||||
}
|
||||
@Override
|
||||
public void effect(Player player,int index) throws IndexOutOfBoundsException
|
||||
protected void effect(Player player,int index) throws IndexOutOfBoundsException
|
||||
{
|
||||
if(index>=5 || index < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user