src/main/java/ru/alphatech/icfpc/cards/Copy.java
changeset 35 743564afa994
parent 12 042162c73d0f
child 68 a84a3c755d93
     1.1 --- a/src/main/java/ru/alphatech/icfpc/cards/Copy.java	Sun Jun 19 10:50:46 2011 +0400
     1.2 +++ b/src/main/java/ru/alphatech/icfpc/cards/Copy.java	Sun Jun 19 12:12:55 2011 +0400
     1.3 @@ -1,5 +1,6 @@
     1.4  package ru.alphatech.icfpc.cards;
     1.5  
     1.6 +import ru.alphatech.icfpc.game.ICFPCException;
     1.7  import ru.alphatech.icfpc.game.IValue;
     1.8  import ru.alphatech.icfpc.game.Player;
     1.9  import ru.alphatech.icfpc.game.Value;
    1.10 @@ -11,9 +12,20 @@
    1.11  	{
    1.12  		if (i.getClass().equals(Value.class))
    1.13  		{
    1.14 -			return opponent.getSlot(((Value)i).getValue()).getValue();
    1.15 +			int iVal = ((Value)i).getValue();
    1.16 +			if (iVal >= 0 && iVal < 256)
    1.17 +			{
    1.18 +				return opponent.getSlot(((Value)i).getValue()).getValue();
    1.19 +			}
    1.20 +			else
    1.21 +			{
    1.22 +				throw new ICFPCException();
    1.23 +			}
    1.24 +		}
    1.25 +		else
    1.26 +		{
    1.27 +			throw new ICFPCException();
    1.28  		}
    1.29  
    1.30 -		return null;
    1.31  	}
    1.32  }