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 Dbl implements ICard
{
	@Override
	public IValue returnValue(IValue nobj, Player proponent, Player opponent)
	{
		if(nobj instanceof Value)
		{
			int n = ((Value)nobj).getValue();
			
			if(n >= 32767)
			{
				return new Value(65535);
			}
			else
			{
				return new Value(n * 2);
			}
		}
		else
		{
			throw new ICFPCException();
		}
	}
}
