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 Help extends AbstractCard
12 public String getName() {
17 public IValue returnValue(final IValue iobj, Player proponent, Player opponent)
21 return new AbstractCard()
24 public String getName() {
25 return "help(" + iobj + ")";
29 public IValue returnValue(final IValue jobj, Player proponent, Player opponent)
33 return new AbstractCard()
36 public String getName() {
37 return "help(" + iobj + ")(" + jobj + ")";
41 public IValue returnValue(final IValue nobj, Player proponent, Player opponent)
45 if(iobj instanceof Value && nobj instanceof Value)
47 int i = ((Value)iobj).getValue();
48 int n = ((Value)nobj).getValue();
50 if(i >= 0 && i <= 255)
52 int v = proponent.getSlot(i).getVitality();
56 proponent.getSlot(i).setVitality(v - n);
58 if(jobj instanceof Value)
60 int j = ((Value)jobj).getValue();
62 if(j >= 0 && j <= 255)
64 int w = proponent.getSlot(j).getVitality();
70 int winc = (int) Math.floor(11 * n / 10);
73 proponent.getSlot(j).setVitality(resw < 0 ? 0 : resw);
80 int winc = (int) Math.floor(11 * n / 10);
83 proponent.getSlot(j).setVitality(resw > 65535 ? 65535 : resw);
91 throw new ICFPCException();
96 throw new ICFPCException();
101 throw new ICFPCException();
106 throw new ICFPCException();
111 throw new ICFPCException();