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 implements ICard
12 public String getName() {
17 public IValue returnValue(final IValue iobj, Player proponent, Player opponent)
22 public String getName() {
27 public IValue returnValue(final IValue jobj, Player proponent, Player opponent)
32 public String getName() {
36 public IValue returnValue(final IValue nobj, Player proponent, Player opponent)
38 if(iobj instanceof Value && nobj instanceof Value)
40 int i = ((Value)iobj).getValue();
41 int n = ((Value)nobj).getValue();
43 if(i >= 0 && i <= 255)
45 int v = proponent.getSlot(i).getVitality();
49 if(jobj instanceof Value)
51 int j = ((Value)jobj).getValue();
53 if(j >= 0 && j <= 255)
55 int w = opponent.getSlot(255 - j).getVitality();
61 int wdec = (int) Math.floor(9 * n / 10);
64 opponent.getSlot(255 - j).setVitality(resw > 65535 ? 65535 : w);
71 int wdec = (int) Math.floor(9 * n / 10);
74 opponent.getSlot(255 - j).setVitality(resw < 0 ? 0 : w);
82 throw new ICFPCException();
87 throw new ICFPCException();
92 throw new ICFPCException();
97 throw new ICFPCException();
102 throw new ICFPCException();