View Javadoc

1   /*
2   @See License.txt@
3    */
4   package spellcast.questions;
5   
6   import java.util.List;
7   
8   import org.apache.commons.chain.Context;
9   
10  import spellcast.beings.IBeing;
11  import spellcast.beings.IWizard;
12  
13  /***
14   * Select a Target Question.
15   *
16   * @author Barrie Treloar
17   * @version $Revision: 1.1 $
18   */
19  public class SelectTargetQuestion extends Question implements IQuestion {
20  
21      /***
22       * serialVersionUID.
23       */
24      private static final long serialVersionUID = 1L;
25  
26      /***
27       * The object that requires a target.
28       */
29      private IRequiresTarget requiresATarget;
30  
31      public SelectTargetQuestion(IRequiresTarget needsATarget, List<IWizard> theTargets) {
32          super("question.selectTarget", theTargets);
33          requiresATarget = needsATarget;
34      }
35  
36      public final boolean execute(Context arg0) throws Exception {
37          requiresATarget.setTarget((IBeing) getAnswer());
38          return true;
39      }
40  }