Cards bugs revealed.
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.Run;
7 import ru.alphatech.icfpc.game.Value;
9 public class Attack extends AbstractCard
12 public String getName() {
17 public IValue returnValue(final IValue iobj, Player proponent, Player opponent)
19 return new AbstractCard()
22 public String getName() {
23 return "attack(" + iobj + ")";
27 public IValue returnValue(final IValue jobj, Player proponent, Player opponent)
31 return new AbstractCard()
34 public String getName() {
35 return "attack(" + iobj + ")(" + jobj + ")";
38 public IValue returnValue(final IValue nobj, Player proponent, Player opponent)
42 if(iobj instanceof Value && nobj instanceof Value)
44 int i = ((Value)iobj).getValue();
45 int n = ((Value)nobj).getValue();
47 if(i >= 0 && i <= 255)
49 int v = proponent.getSlot(i).getVitality();
53 proponent.getSlot(i).setVitality(v - n);
55 if(jobj instanceof Value)
57 int j = ((Value)jobj).getValue();
59 if(j >= 0 && j <= 255)
61 int w = opponent.getSlot(255 - j).getVitality();
67 int wdec = (int) Math.floor(9 * n / 10);
70 opponent.getSlot(255 - j).setVitality(resw > 65535 ? 65535 : w);
77 int wdec = (int) Math.floor(9 * n / 10);
80 opponent.getSlot(255 - j).setVitality(resw < 0 ? 0 : w);
88 throw new ICFPCException();
93 throw new ICFPCException();
98 throw new ICFPCException();
103 throw new ICFPCException();
108 throw new ICFPCException();