1.1 --- a/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Dbl.java Fri Jun 17 19:10:39 2011 +0400
1.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Dbl.java Fri Jun 17 19:26:59 2011 +0400
1.3 @@ -1,23 +1,22 @@
1.4 package ru.alpha.ltg.cards;
1.5
1.6 import ru.alpha.ltg.cards.api.ICard;
1.7 +import ru.alpha.ltg.cards.api.IPlayer;
1.8 import ru.alpha.ltg.cards.api.IValue;
1.9 import ru.alpha.ltg.cards.api.Value;
1.10
1.11 public class Dbl implements ICard
1.12 {
1.13 @Override
1.14 - public IValue returnValue(IValue[] values, Slot[] slots)
1.15 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
1.16 {
1.17 - IValue n = values[0];
1.18 -
1.19 - if(n.getClass().equals(Value.class))
1.20 + if(value.getClass().equals(Value.class))
1.21 {
1.22 - if (((Value)n).getValue() * 2 >= 65535)
1.23 + if (((Value)value).getValue() * 2 >= 65535)
1.24 {
1.25 return new Value(65535);
1.26 }
1.27 - return new Value(((Value)n).getValue() * 2);
1.28 + return new Value(((Value)value).getValue() * 2);
1.29 }
1.30
1.31 return new Value(-100);
2.1 --- a/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Get.java Fri Jun 17 19:10:39 2011 +0400
2.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Get.java Fri Jun 17 19:26:59 2011 +0400
2.3 @@ -1,17 +1,18 @@
2.4 package ru.alpha.ltg.cards;
2.5
2.6 import ru.alpha.ltg.cards.api.ICard;
2.7 +import ru.alpha.ltg.cards.api.IPlayer;
2.8 import ru.alpha.ltg.cards.api.IValue;
2.9 import ru.alpha.ltg.cards.api.Value;
2.10
2.11 public class Get implements ICard
2.12 {
2.13 @Override
2.14 - public IValue returnValue(IValue[] values, Slot[] slots)
2.15 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
2.16 {
2.17 - if (values[0].getClass().equals(Value.class))
2.18 + if (value.getClass().equals(Value.class))
2.19 {
2.20 - return slots[((Value)values[0]).getValue()].getValue();
2.21 + return proponent.getSlot(((Value)value).getValue()).getValue();
2.22 }
2.23 else
2.24 {
3.1 --- a/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/I.java Fri Jun 17 19:10:39 2011 +0400
3.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/I.java Fri Jun 17 19:26:59 2011 +0400
3.3 @@ -1,13 +1,14 @@
3.4 package ru.alpha.ltg.cards;
3.5
3.6 import ru.alpha.ltg.cards.api.ICard;
3.7 +import ru.alpha.ltg.cards.api.IPlayer;
3.8 import ru.alpha.ltg.cards.api.IValue;
3.9
3.10 public class I implements ICard
3.11 {
3.12 @Override
3.13 - public IValue returnValue(IValue[] values, Slot[] slots)
3.14 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
3.15 {
3.16 - return values[0];
3.17 + return value;
3.18 }
3.19 }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Inc.java Fri Jun 17 19:26:59 2011 +0400
4.3 @@ -0,0 +1,31 @@
4.4 +package ru.alpha.ltg.cards;
4.5 +
4.6 +import ru.alpha.ltg.cards.api.ICard;
4.7 +import ru.alpha.ltg.cards.api.IPlayer;
4.8 +import ru.alpha.ltg.cards.api.IValue;
4.9 +import ru.alpha.ltg.cards.api.Value;
4.10 +
4.11 +public class Inc implements ICard
4.12 +{
4.13 + @Override
4.14 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
4.15 + {
4.16 + if(value.getClass().equals(Value.class))
4.17 + {
4.18 + if (((Value)value).getValue() < 256 && ((Value)value).getValue() > -1)
4.19 + {
4.20 + proponent.getSlot(((Value)value).getValue()).setVitality(proponent.getSlot(((Value)value).getValue()).getVitality() + 1);
4.21 + return new ICard()
4.22 + {
4.23 + @Override
4.24 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
4.25 + {
4.26 + return value;
4.27 + }
4.28 + };
4.29 + }
4.30 + }
4.31 +
4.32 + return new Value(-100);
4.33 + }
4.34 +}
5.1 --- a/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/K.java Fri Jun 17 19:10:39 2011 +0400
5.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/K.java Fri Jun 17 19:26:59 2011 +0400
5.3 @@ -1,17 +1,18 @@
5.4 package ru.alpha.ltg.cards;
5.5
5.6 import ru.alpha.ltg.cards.api.ICard;
5.7 +import ru.alpha.ltg.cards.api.IPlayer;
5.8 import ru.alpha.ltg.cards.api.IValue;
5.9
5.10 public class K implements ICard
5.11 {
5.12
5.13 @Override
5.14 - public IValue returnValue(IValue value, Slot[] slots)
5.15 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
5.16 {
5.17 return new ICard()
5.18 {
5.19 - public IValue returnValue(IValue value, Slot[] slots)
5.20 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
5.21 {
5.22 return value;
5.23 }
6.1 --- a/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Put.java Fri Jun 17 19:10:39 2011 +0400
6.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Put.java Fri Jun 17 19:26:59 2011 +0400
6.3 @@ -1,13 +1,21 @@
6.4 package ru.alpha.ltg.cards;
6.5
6.6 import ru.alpha.ltg.cards.api.ICard;
6.7 +import ru.alpha.ltg.cards.api.IPlayer;
6.8 import ru.alpha.ltg.cards.api.IValue;
6.9
6.10 public class Put implements ICard
6.11 {
6.12 @Override
6.13 - public IValue returnValue(IValue value, Slot[] slots)
6.14 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
6.15 {
6.16 - return new I();
6.17 + return new ICard()
6.18 + {
6.19 + @Override
6.20 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
6.21 + {
6.22 + return value;
6.23 + }
6.24 + };
6.25 }
6.26 }
7.1 --- a/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/S.java Fri Jun 17 19:10:39 2011 +0400
7.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/S.java Fri Jun 17 19:26:59 2011 +0400
7.3 @@ -1,20 +1,21 @@
7.4 package ru.alpha.ltg.cards;
7.5
7.6 import ru.alpha.ltg.cards.api.ICard;
7.7 +import ru.alpha.ltg.cards.api.IPlayer;
7.8 import ru.alpha.ltg.cards.api.IValue;
7.9
7.10 public class S implements ICard
7.11 {
7.12 @Override
7.13 - public IValue returnValue(IValue value, Slot[] slots)
7.14 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
7.15 {
7.16 return new ICard()
7.17 {
7.18 - public IValue returnValue(IValue value, Slot[] slots)
7.19 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
7.20 {
7.21 return new ICard()
7.22 {
7.23 - public IValue returnValue(IValue value, Slot[] slots)
7.24 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
7.25 {
7.26 return value;
7.27 }
8.1 --- a/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Succ.java Fri Jun 17 19:10:39 2011 +0400
8.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Succ.java Fri Jun 17 19:26:59 2011 +0400
8.3 @@ -1,13 +1,14 @@
8.4 package ru.alpha.ltg.cards;
8.5
8.6 import ru.alpha.ltg.cards.api.ICard;
8.7 +import ru.alpha.ltg.cards.api.IPlayer;
8.8 import ru.alpha.ltg.cards.api.IValue;
8.9 import ru.alpha.ltg.cards.api.Value;
8.10
8.11 public class Succ implements ICard
8.12 {
8.13 @Override
8.14 - public IValue returnValue(IValue value, Slot[] slots)
8.15 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
8.16 {
8.17 if(value.getClass().equals(Value.class))
8.18 {
9.1 --- a/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Zero.java Fri Jun 17 19:10:39 2011 +0400
9.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/Zero.java Fri Jun 17 19:26:59 2011 +0400
9.3 @@ -1,12 +1,13 @@
9.4 package ru.alpha.ltg.cards;
9.5
9.6 import ru.alpha.ltg.cards.api.ICard;
9.7 +import ru.alpha.ltg.cards.api.IPlayer;
9.8 import ru.alpha.ltg.cards.api.IValue;
9.9 import ru.alpha.ltg.cards.api.Value;
9.10
9.11 public class Zero implements ICard
9.12 {
9.13 - public IValue returnValue(IValue value, Slot[] slots)
9.14 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent)
9.15 {
9.16 return new Value(0);
9.17 }
10.1 --- a/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/api/ICard.java Fri Jun 17 19:10:39 2011 +0400
10.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/api/ICard.java Fri Jun 17 19:26:59 2011 +0400
10.3 @@ -1,9 +1,6 @@
10.4 package ru.alpha.ltg.cards.api;
10.5
10.6 -import ru.alpha.ltg.cards.Slot;
10.7 -
10.8 -
10.9 public interface ICard extends IValue
10.10 {
10.11 - public IValue returnValue(IValue value, Slot[] slots);
10.12 + public IValue returnValue(IValue value, IPlayer proponent, IPlayer opponent);
10.13 }
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/ru.alpha.ltg.cards/src/test/java/ru/alpha/ltg/cards/api/IPlayer.java Fri Jun 17 19:26:59 2011 +0400
11.3 @@ -0,0 +1,8 @@
11.4 +package ru.alpha.ltg.cards.api;
11.5 +
11.6 +import ru.alpha.ltg.cards.Slot;
11.7 +
11.8 +public interface IPlayer
11.9 +{
11.10 + public Slot getSlot(int i);
11.11 +}
12.1 Binary file ru.alpha.ltg.cards/target/test-classes/ru/alpha/ltg/cards/I.class has changed
13.1 Binary file ru.alpha.ltg.cards/target/test-classes/ru/alpha/ltg/cards/api/ICard.class has changed