1 package ru.alphatech.icfpc.cards; |
1 package ru.alphatech.icfpc.cards; |
2 |
2 |
3 import ru.alphatech.icfpc.game.ICFPCException; |
3 import ru.alphatech.icfpc.game.ICFPCException; |
4 import ru.alphatech.icfpc.game.IValue; |
4 import ru.alphatech.icfpc.game.IValue; |
5 import ru.alphatech.icfpc.game.Player; |
5 import ru.alphatech.icfpc.game.Player; |
|
6 import ru.alphatech.icfpc.game.Run; |
6 import ru.alphatech.icfpc.game.Value; |
7 import ru.alphatech.icfpc.game.Value; |
7 |
8 |
8 public class Help implements ICard |
9 public class Help implements ICard |
9 { |
10 { |
|
11 @Override |
|
12 public String getName() { |
|
13 return "help"; |
|
14 } |
|
15 |
10 @Override |
16 @Override |
11 public IValue returnValue(final IValue iobj, Player proponent, Player opponent) |
17 public IValue returnValue(final IValue iobj, Player proponent, Player opponent) |
12 { |
18 { |
13 return new ICard() |
19 return new ICard() |
14 { |
20 { |
15 @Override |
21 @Override |
|
22 public String getName() { |
|
23 return ""; |
|
24 } |
|
25 |
|
26 @Override |
16 public IValue returnValue(final IValue jobj, Player proponent, Player opponent) |
27 public IValue returnValue(final IValue jobj, Player proponent, Player opponent) |
17 { |
28 { |
18 return new ICard() |
29 return new ICard() |
19 { |
30 { |
|
31 @Override |
|
32 public String getName() { |
|
33 return ""; |
|
34 } |
|
35 |
20 @Override |
36 @Override |
21 public IValue returnValue(final IValue nobj, Player proponent, Player opponent) |
37 public IValue returnValue(final IValue nobj, Player proponent, Player opponent) |
22 { |
38 { |
23 if(iobj instanceof Value && nobj instanceof Value) |
39 if(iobj instanceof Value && nobj instanceof Value) |
24 { |
40 { |
37 |
53 |
38 if(j >= 0 && j <= 255) |
54 if(j >= 0 && j <= 255) |
39 { |
55 { |
40 int w = proponent.getSlot(j).getVitality(); |
56 int w = proponent.getSlot(j).getVitality(); |
41 |
57 |
42 if(w > 0) |
58 if(Run.getAutoMode()) |
43 { |
59 { |
44 int winc = (int) Math.floor(11 * n / 10); |
60 if(w > 0) |
45 int resw = w + winc; |
61 { |
46 |
62 int winc = (int) Math.floor(11 * n / 10); |
47 proponent.getSlot(j).setVitality(resw > 65535 ? 65535 : resw); |
63 int resw = w - winc; |
|
64 |
|
65 proponent.getSlot(j).setVitality(resw < 0 ? 0 : resw); |
|
66 } |
48 } |
67 } |
|
68 else |
|
69 { |
|
70 if(w > 0) |
|
71 { |
|
72 int winc = (int) Math.floor(11 * n / 10); |
|
73 int resw = w + winc; |
|
74 |
|
75 proponent.getSlot(j).setVitality(resw > 65535 ? 65535 : resw); |
|
76 } |
|
77 } |
49 |
78 |
50 return new I(); |
79 return new I(); |
51 } |
80 } |
52 else |
81 else |
53 { |
82 { |