View Javadoc

1   /*
2    * Created on Sep 10, 2004 
3    * 
4    *   Magic-Project is a turn based strategy simulator
5    *   Copyright (C) 2003-2007 Fabrice Daugan
6    *
7    *   This program is free software; you can redistribute it and/or modify it 
8    * under the terms of the GNU General Public License as published by the Free 
9    * Software Foundation; either version 2 of the License, or (at your option) any
10   * later version.
11   *
12   *   This program is distributed in the hope that it will be useful, but WITHOUT 
13   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14   * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
15   * details.
16   *
17   *   You should have received a copy of the GNU General Public License along  
18   * with this program; if not, write to the Free Software Foundation, Inc., 
19   * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20   * 
21   */
22  package net.sf.magicproject.action;
23  
24  import net.sf.magicproject.action.handler.StandardAction;
25  import net.sf.magicproject.clickable.ability.Ability;
26  import net.sf.magicproject.event.context.ContextEventListener;
27  import net.sf.magicproject.modifier.Modifier;
28  
29  /***
30   * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
31   */
32  public class RefreshModifier extends MAction implements StandardAction {
33  
34  	/***
35  	 * Creates a new instance of RemoveMe <br>
36  	 * 
37  	 * @param modifier
38  	 */
39  	public RefreshModifier(Modifier modifier) {
40  		super();
41  		this.modifier = modifier;
42  	}
43  
44  	/***
45  	 * The modifier to remove with this action
46  	 */
47  	private Modifier modifier;
48  
49  	/***
50  	 * Return the index of this action. As default, this is a zero id
51  	 * 
52  	 * @return the index of this action.
53  	 * @see Actiontype
54  	 */
55  	@Override
56  	public final Actiontype getIdAction() {
57  		return Actiontype.REFRESH_MODIFIER;
58  	}
59  
60  	public boolean play(ContextEventListener context, Ability ability) {
61  		modifier.refresh();
62  		return true;
63  	}
64  
65  	@Override
66  	public String toString(Ability ability) {
67  		return "refresh modifier : " + modifier;
68  	}
69  
70  }