1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package net.sf.magicproject.stack.phasetype;
24
25 import java.io.IOException;
26 import java.io.InputStream;
27
28 import net.sf.magicproject.tools.MToolKit;
29
30 /***
31 * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
32 * @since 0.60
33 */
34 public abstract class StackCondition {
35
36 /***
37 * Creates a new instance of StackCondition <br>
38 * <ul>
39 * Structure of InputStream : Data[size]
40 * <li>playable idCards for current player [2]</li>
41 * <li>playable idCards for non-current player [2]</li>
42 * </ul>
43 *
44 * @param inputStream
45 * @throws IOException
46 */
47 protected StackCondition(InputStream inputStream) throws IOException {
48 idCardsForYOU = MToolKit.readInt16(inputStream);
49 idCardsForOPPONENT = MToolKit.readInt16(inputStream);
50 }
51
52 /***
53 * Tell if a player can cast a card with this idCard.
54 *
55 * @param idCard
56 * id of card we would casting
57 * @param isYou
58 * is the current player waiting for that
59 * @return true if the player can cast a card with this idCard
60 */
61 public abstract boolean canICast(int idCard, boolean isYou);
62
63 /***
64 * IdCard that current player can play during this phase
65 */
66 public int idCardsForYOU;
67
68 /***
69 * IdCard that non-current player can play during this phase
70 */
71 public int idCardsForOPPONENT;
72
73 }