View Javadoc

1   /*
2    * Created on Sep 2, 2004 
3    * Original filename was AbstractAbility.java
4    * 
5    *   Magic-Project is a turn based strategy simulator
6    *   Copyright (C) 2003-2007 Fabrice Daugan
7    *
8    *   This program is free software; you can redistribute it and/or modify it 
9    * under the terms of the GNU General Public License as published by the Free 
10   * Software Foundation; either version 2 of the License, or (at your option) any
11   * later version.
12   *
13   *   This program is distributed in the hope that it will be useful, but WITHOUT 
14   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15   * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
16   * details.
17   *
18   *   You should have received a copy of the GNU General Public License along  
19   * with this program; if not, write to the Free Software Foundation, Inc., 
20   * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21   */
22  package net.sf.magicproject.clickable.ability;
23  
24  import java.util.List;
25  
26  import net.sf.magicproject.action.MAction;
27  import net.sf.magicproject.clickable.targetable.card.MCard;
28  import net.sf.magicproject.clickable.targetable.card.SystemCard;
29  import net.sf.magicproject.event.MEventListener;
30  import net.sf.magicproject.token.TrueFalseAuto;
31  
32  /***
33   * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
34   */
35  public abstract class AbstractAbility extends Ability {
36  
37  	/***
38  	 * Creates a new instance of AbstractAbility <br>
39  	 * 
40  	 * @param name
41  	 *          the ability name
42  	 * @param event
43  	 *          the event attached to this ability.
44  	 * @param pictureName
45  	 *          the optional picture used to display this ability.
46  	 * @param linkedAbilities
47  	 *          the linked abilities. May be null.
48  	 * @param playAsSpell
49  	 *          play-as-spell.
50  	 */
51  	public AbstractAbility(String name, MEventListener event, String pictureName,
52  			List<Ability> linkedAbilities, TrueFalseAuto playAsSpell) {
53  		super(name, Optimization.none, Priority.hidden, pictureName,
54  				linkedAbilities, playAsSpell);
55  		eventComing = event;
56  	}
57  
58  	@Override
59  	public MCard getCard() {
60  		return SystemCard.instance;
61  	}
62  
63  	@Override
64  	public boolean isMatching() {
65  		return true;
66  	}
67  
68  	@Override
69  	public MAction[] actionList() {
70  		return actionList;
71  	}
72  
73  	@Override
74  	public MAction[] effectList() {
75  		return effectList;
76  	}
77  
78  	@Override
79  	public boolean recheckTargets() {
80  		return true;
81  	}
82  
83  	/***
84  	 * will contains MAction objects of cost part
85  	 */
86  	protected MAction[] actionList;
87  
88  	/***
89  	 * will contains MAction objects of effect part
90  	 */
91  	protected MAction[] effectList;
92  }