1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  package net.sf.magicproject.test;
22  
23  import java.io.IOException;
24  import java.io.InputStream;
25  import java.util.List;
26  
27  import net.sf.magicproject.annotation.XmlTestElement;
28  import net.sf.magicproject.clickable.ability.Ability;
29  import net.sf.magicproject.clickable.targetable.card.MCard;
30  import net.sf.magicproject.event.FacedDown;
31  import net.sf.magicproject.event.FacedUp;
32  import net.sf.magicproject.event.MEventListener;
33  import net.sf.magicproject.token.IdZones;
34  
35  /***
36   * @author <a href="mailto:hoani.cross@gmail.com">Hoani CROSS</a>
37   * @since 0.90
38   */
39  @XmlTestElement(id = IdTest.IS_FACE_UP)
40  public class IsFaceUp extends TestCard {
41  
42  	/***
43  	 * Create an instance of IsFaceUp by reading a file. Offset's file must
44  	 * pointing on the first byte of this test <br>
45  	 * <ul>
46  	 * Structure of InputStream : Data[size]
47  	 * </ul>
48  	 * 
49  	 * @param inputFile
50  	 *          is the file containing this event
51  	 * @throws IOException
52  	 *           if error occurred during the reading process from the specified
53  	 *           input stream
54  	 */
55  	IsFaceUp(InputStream inputFile) throws IOException {
56  		super(inputFile);
57  	}
58  
59  	@Override
60  	public boolean testCard(Ability ability, MCard tested) {
61  		return on.getCard(ability, tested).visibility.isVisibleForYou();
62  	}
63  
64  	@Override
65  	public void extractTriggeredEvents(List<MEventListener> res, MCard source,
66  			Test globalTest) {
67  		
68  		res.add(new FacedUp(IdZones.PLAY, And.append(new IsTested(on), globalTest),
69  				source));
70  		res.add(new FacedDown(IdZones.PLAY, And
71  				.append(new IsTested(on), globalTest), source));
72  	}
73  }