src/main/java/ru/alphatech/icfpc/cards/Copy.java
author akhmetovlz
Mon, 20 Jun 2011 01:42:04 +0400
changeset 120 f8c080bbb572
parent 102 cc814352ab43
permissions -rw-r--r--
фикс багов в аттакхэдпе
     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 Copy extends AbstractCard
     9 {
    10 	@Override
    11 	public String getName() {
    12 		return "copy";
    13 	}
    14 	
    15 	@Override
    16 	public IValue returnValue(IValue iobj, Player proponent, Player opponent)
    17 	{
    18 		incAndTest();
    19 		
    20 		if (iobj instanceof Value)
    21 		{
    22 			int i = ((Value)iobj).getValue();
    23 
    24 			if (i >= 0 && i <= 255)
    25 			{
    26 				return opponent.getSlot(i).getValue();
    27 			}
    28 			else
    29 			{
    30 				throw new ICFPCException();
    31 			}
    32 		}
    33 		else
    34 		{
    35 			throw new ICFPCException();
    36 		}
    37 
    38 	}
    39 }