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 iobj, Player proponent, Player opponent)
16 public IValue returnValue(final IValue jobj, Player proponent, Player opponent)
21 public IValue returnValue(final IValue nobj, Player proponent, Player opponent)
23 if(iobj instanceof Value && nobj instanceof Value)
25 int i = ((Value)iobj).getValue();
26 int n = ((Value)nobj).getValue();
28 if(i >= 0 && i <= 255)
30 int v = proponent.getSlot(i).getVitality();
34 if(jobj instanceof Value)
36 int j = ((Value)jobj).getValue();
38 if(j >= 0 && j <= 255)
40 int w = opponent.getSlot(255 - j).getVitality();
44 int wdec = (int) Math.floor(9 * n / 10);
47 opponent.getSlot(255 - j).setVitality(resw < 0 ? 0 : w);
54 throw new ICFPCException();
59 throw new ICFPCException();
64 throw new ICFPCException();
69 throw new ICFPCException();
74 throw new ICFPCException();