diff -r 497185ce6691 -r 51bfc33c0566 src/main/java/ru/alphatech/icfpc/cards/Zombie.java --- a/src/main/java/ru/alphatech/icfpc/cards/Zombie.java Sun Jun 19 15:10:18 2011 +0400 +++ b/src/main/java/ru/alphatech/icfpc/cards/Zombie.java Sun Jun 19 15:10:41 2011 +0400 @@ -1,5 +1,6 @@ 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; @@ -7,23 +8,42 @@ public class Zombie implements ICard { @Override - public IValue returnValue(final IValue iVal, Player proponent, Player opponent) + public IValue returnValue(final IValue iobj, Player proponent, Player opponent) { return new ICard() { @Override public IValue returnValue(final IValue x, Player proponent, Player opponent) { - if (iVal.getClass().equals(Value.class)) + if (iobj instanceof Value) { - int i = ((Value)iVal).getValue(); - if (i >= 0 && i < 256) + int i = ((Value)iobj).getValue(); + + if (i >= 0 && i <= 255) { - opponent.getSlot(i).putValue(x); - opponent.getSlot(i).setVitality(-1); + int v = opponent.getSlot(255 - i).getVitality(); + + if(v <= 0) + { + opponent.getSlot(255 - i).putValue(x); + opponent.getSlot(255 - i).setVitality(-1); + + return new I(); + } + else + { + throw new ICFPCException(); + } + } + else + { + throw new ICFPCException(); } } - return new I(); + else + { + throw new ICFPCException(); + } } }; }