1.1 --- a/src/main/java/ru/alphatech/icfpc/cards/Help.java Sun Jun 19 10:50:46 2011 +0400
1.2 +++ b/src/main/java/ru/alphatech/icfpc/cards/Help.java Sun Jun 19 12:12:55 2011 +0400
1.3 @@ -1,5 +1,6 @@
1.4 package ru.alphatech.icfpc.cards;
1.5
1.6 +import ru.alphatech.icfpc.game.ICFPCException;
1.7 import ru.alphatech.icfpc.game.IValue;
1.8 import ru.alphatech.icfpc.game.Player;
1.9 import ru.alphatech.icfpc.game.Value;
1.10 @@ -24,16 +25,37 @@
1.11 int ival = ((Value)i).getValue();
1.12 int jval = ((Value)j).getValue();
1.13 int nval = ((Value)n).getValue();
1.14 - proponent.getSlot(ival).setVitality(proponent.getSlot(ival).getVitality() - nval);
1.15 - proponent.getSlot(jval).setVitality(proponent.getSlot(jval).getVitality() + ((11 * nval)/10));
1.16 - return new ICard()
1.17 + if (ival >= 0 && ival < 256 && jval >= 0 && jval < 256)
1.18 {
1.19 - @Override
1.20 - public IValue returnValue(IValue value, Player proponent, Player opponent)
1.21 + int v = proponent.getSlot(ival).getVitality();
1.22 + int w = proponent.getSlot(jval).getVitality();
1.23 +
1.24 + if (v > nval)
1.25 {
1.26 - return value;
1.27 + proponent.getSlot(ival).setVitality(v - nval);
1.28 + if (w > 0)
1.29 + {
1.30 + if (w >= 65535)
1.31 + {
1.32 + proponent.getSlot(jval).setVitality(65535);
1.33 + }
1.34 + else
1.35 + {
1.36 + proponent.getSlot(jval).setVitality(w + ((11 * nval)/10));
1.37 + }
1.38 + }
1.39 }
1.40 - };
1.41 + else
1.42 + {
1.43 + throw new ICFPCException();
1.44 + }
1.45 + }
1.46 + else
1.47 + {
1.48 + throw new ICFPCException();
1.49 + }
1.50 +
1.51 + return new I();
1.52 }
1.53 return null;
1.54 }