equal
deleted
inserted
replaced
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.IValue; |
4 import ru.alphatech.icfpc.game.IValue; |
4 import ru.alphatech.icfpc.game.Player; |
5 import ru.alphatech.icfpc.game.Player; |
5 import ru.alphatech.icfpc.game.Value; |
6 import ru.alphatech.icfpc.game.Value; |
6 |
7 |
7 public class Inc implements ICard |
8 public class Inc implements ICard |
9 @Override |
10 @Override |
10 public IValue returnValue(IValue value, Player proponent, Player opponent) |
11 public IValue returnValue(IValue value, Player proponent, Player opponent) |
11 { |
12 { |
12 if(value.getClass().equals(Value.class)) |
13 if(value.getClass().equals(Value.class)) |
13 { |
14 { |
14 if (((Value)value).getValue() < 256 && ((Value)value).getValue() > -1) |
15 int i = ((Value)value).getValue(); |
|
16 |
|
17 if (i < 256 && i > 0) |
15 { |
18 { |
16 proponent.getSlot(((Value)value).getValue()).setVitality(proponent.getSlot(((Value)value).getValue()).getVitality() + 1); |
19 int v = proponent.getSlot(i).getVitality(); |
17 return new ICard() |
20 if (v < 65535 && v > 0) |
18 { |
21 { |
19 @Override |
22 proponent.getSlot(i).setVitality(v + 1); |
20 public IValue returnValue(IValue value, Player proponent, Player opponent) |
23 } |
21 { |
24 } |
22 return value; |
25 else |
23 } |
26 { |
24 }; |
27 throw new ICFPCException(); |
25 } |
28 } |
26 } |
29 } |
|
30 else |
|
31 { |
|
32 throw new ICFPCException(); |
|
33 } |
27 |
34 |
28 return new Value(-100); |
35 return new I(); |
29 } |
36 } |
30 } |
37 } |