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() {
27 public IValue returnValue(final IValue jobj, Player proponent, Player opponent)
31 return new AbstractCard()
34 public String getName() {
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 if(jobj instanceof Value)
55 int j = ((Value)jobj).getValue();
57 if(j >= 0 && j <= 255)
59 int w = opponent.getSlot(255 - j).getVitality();
65 int wdec = (int) Math.floor(9 * n / 10);
68 opponent.getSlot(255 - j).setVitality(resw > 65535 ? 65535 : w);
75 int wdec = (int) Math.floor(9 * n / 10);
78 opponent.getSlot(255 - j).setVitality(resw < 0 ? 0 : w);
86 throw new ICFPCException();
91 throw new ICFPCException();
96 throw new ICFPCException();
101 throw new ICFPCException();
106 throw new ICFPCException();