package ru.alphatech.icfpc.cards;

import ru.alphatech.icfpc.game.ICFPCException;
import ru.alphatech.icfpc.game.IValue;
import ru.alphatech.icfpc.game.Player;
import ru.alphatech.icfpc.game.Value;

public class Copy implements ICard
{
	@Override
	public IValue returnValue(IValue i, Player proponent, Player opponent)
	{
		if (i.getClass().equals(Value.class))
		{
			int iVal = ((Value)i).getValue();
			if (iVal >= 0 && iVal < 256)
			{
				return opponent.getSlot(((Value)i).getValue()).getValue();
			}
			else
			{
				throw new ICFPCException();
			}
		}
		else
		{
			throw new ICFPCException();
		}

	}
}
