src/main/java/ru/alphatech/icfpc/cards/Get.java
author akhmetovlz
Sun, 19 Jun 2011 14:35:19 +0400
changeset 67 e2df2fbc6e8e
parent 64 8ce8964b584f
child 68 a84a3c755d93
permissions -rw-r--r--
Merge with 2c8b98d4efb84d73c56c1e57196ba8598136aeeb
     1 package ru.alphatech.icfpc.cards;
     2 
     3 import ru.alphatech.icfpc.game.ICFPCException;
     4 import ru.alphatech.icfpc.game.IValue;
     5 import ru.alphatech.icfpc.game.Player;
     6 import ru.alphatech.icfpc.game.Value;
     7 
     8 public class Get implements ICard
     9 {
    10 	@Override
    11 	public IValue returnValue(IValue iobj, Player proponent, Player opponent)
    12 	{
    13 		if (iobj instanceof Value)
    14 		{
    15 			int i =  ((Value)iobj).getValue();
    16 			int v = proponent.getSlot(i).getVitality();
    17 			
    18 			if(i >= 0 && i <= 255 && v > 0)
    19 			{
    20 				return proponent.getSlot(i).getValue();
    21 			}
    22 			else
    23 			{
    24 				throw new ICFPCException();
    25 			}
    26 		}
    27 		else
    28 		{
    29 			throw new ICFPCException();
    30 		}
    31 	}
    32 
    33 }