1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.magicproject.test;
20
21 import java.io.IOException;
22 import java.io.InputStream;
23
24 import net.sf.magicproject.clickable.ability.Ability;
25 import net.sf.magicproject.clickable.targetable.Targetable;
26 import net.sf.magicproject.clickable.targetable.player.Player;
27
28 /***
29 * TestObject.java Created on 25 feb. 2004
30 *
31 * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
32 * @since 0.60
33 */
34 abstract class TestPlayer extends TestObject {
35
36 /***
37 * Create an instance of TestPlayer
38 *
39 * @param inputFile
40 * @throws IOException
41 */
42 protected TestPlayer(InputStream inputFile) throws IOException {
43 super(inputFile);
44 player = TestOn.deserialize(inputFile);
45 }
46
47 @Override
48 public final boolean test(Ability ability, Targetable tested) {
49 return tested instanceof Player && testPlayer(ability, (Player) tested);
50 }
51
52 /***
53 * Return the result of test beetwen left and right op applied on the
54 * specified card.
55 *
56 * @param ability
57 * is the ability owning this test. The card component of this
58 * ability should correspond to the card owning this test too.
59 * @param tested
60 * the tested card
61 * @return true if the specified card matches with the test to do
62 */
63 protected abstract boolean testPlayer(Ability ability, Player tested);
64
65 /***
66 * The player to test
67 */
68 protected TestOn player;
69 }