1 package ru.alphatech.icfpc.cards;
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;
8 public class Attack implements ICard
11 public IValue returnValue(final IValue i, Player proponent, Player opponent)
16 public IValue returnValue(final IValue j, Player proponent, Player opponent)
21 public IValue returnValue(final IValue n, Player proponent, Player opponent)
23 if (i.getClass().equals(Value.class) && j.getClass().equals(Value.class) && n.getClass().equals(Value.class))
25 int ival = ((Value)i).getValue();
26 int jval = ((Value)j).getValue();
27 int nval = ((Value)n).getValue();
29 if (ival >= 0 && ival < 256 && jval >= 0 && jval < 256)
31 int v = proponent.getSlot(ival).getVitality();
32 int w = opponent.getSlot(255 - jval).getVitality();
35 proponent.getSlot(ival).setVitality(v - nval);
38 opponent.getSlot(255 - jval).setVitality(w - ((9 * nval)/10));
43 throw new ICFPCException();
48 throw new ICFPCException();
53 throw new ICFPCException();