diff -r 0e21db22ecec -r 743564afa994 src/main/java/ru/alphatech/icfpc/cards/Help.java --- a/src/main/java/ru/alphatech/icfpc/cards/Help.java Sun Jun 19 10:50:46 2011 +0400 +++ b/src/main/java/ru/alphatech/icfpc/cards/Help.java Sun Jun 19 12:12:55 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; @@ -24,16 +25,37 @@ int ival = ((Value)i).getValue(); int jval = ((Value)j).getValue(); int nval = ((Value)n).getValue(); - proponent.getSlot(ival).setVitality(proponent.getSlot(ival).getVitality() - nval); - proponent.getSlot(jval).setVitality(proponent.getSlot(jval).getVitality() + ((11 * nval)/10)); - return new ICard() + if (ival >= 0 && ival < 256 && jval >= 0 && jval < 256) { - @Override - public IValue returnValue(IValue value, Player proponent, Player opponent) + int v = proponent.getSlot(ival).getVitality(); + int w = proponent.getSlot(jval).getVitality(); + + if (v > nval) { - return value; + proponent.getSlot(ival).setVitality(v - nval); + if (w > 0) + { + if (w >= 65535) + { + proponent.getSlot(jval).setVitality(65535); + } + else + { + proponent.getSlot(jval).setVitality(w + ((11 * nval)/10)); + } + } } - }; + else + { + throw new ICFPCException(); + } + } + else + { + throw new ICFPCException(); + } + + return new I(); } return null; }