View Javadoc

1   /*
2   @See License.txt@
3    */
4   package spellcast.enchantment;
5   
6   import spellcast.beings.IBeing;
7   
8   import spellcast.damage.DamageType;
9   
10  import spellcast.model.Id;
11  
12  import java.io.Serializable;
13  
14  
15  /***
16   * An <code>Enchantment</code> is something that affects <code>IBeing</code>. It
17   * is normally the result of casting a spell.
18   *
19   * @author Barrie Treloar
20   * @version $Revision: 1.1 $
21   */
22  public interface Enchantment extends Serializable {
23      /***
24       * Return the name of this <code>Enchantment</code>.
25       *
26       * @return the name of this <code>Enchantment</code>.
27       */
28      String getName();
29  
30      /***
31       * Return the description of this <code>Enchantment</code>.
32       *
33       * @return the description of this <code>Enchantment</code>.
34       */
35      String getDescription();
36  
37      /***
38       * Return the duration left on this <code>Enchantment</code> before it
39       * expires.  If the <code>Enchantment</code> is permanent then this value
40       * has no meaning.
41       *
42       * @return the duration left on this <code>Enchantment</code>.
43       */
44      int getDuration();
45  
46      /***
47       * The <code>Id</code> of this <code>Enchantment</code>.
48       *
49       * @return the <code>Id</code> of this <code>Enchantment</code>.
50       */
51      Id getId();
52  
53      /***
54       * isPermanent indicates whether the Enchantment is permanently enabled.
55       * This means that the effect of the permanent spell on the first turn of
56       * its permenancy is repeated eternally.
57       *
58       * @return true if enchantment has been made permanent, false otherwise.
59       */
60      boolean isPermanent();
61  
62      /***
63       * setPermanent sets the permanency value of this Enchantment to the value
64       * specified.  Only enchantments may have their permanency set to true. If
65       * the value specified is true and the Enchantment is not an enchantment
66       * then this method silently ignores the value and does not set the
67       * permanency to true.
68       *
69       * @param isPermanent indicates what to set the permanency value to. True
70       *        indicates an enchantment is permanent, false indicates it is not
71       *        permanent.  Only an enchantment can have its permanency set to
72       *        true.
73       */
74      void setPermanent(boolean isPermanent);
75  
76      /***
77       * isResistant checks to see if the Enchantment will resist the specified
78       * <code>DamageType</code>.
79       *
80       * @param damageType the <code>DamageType</code> to check against for
81       *        resistance.
82       *
83       * @return true if the Enchantment can resist the specified
84       *         <code>DamageType</code>, false otherwise.
85       */
86      boolean isResistant(DamageType damageType);
87  
88      /***
89       * Notify the Enchantment that a turn has been completed and to update
90       * itself accordingly. If the Enchantment has worn off then return true,
91       * otherwise return false.
92       *
93       * @return true if the Enchantment has worn off, false otherwise.
94       */
95      boolean turnComplete();
96  
97      /***
98       * The caster of the <code>Enchantment</code>.
99       *
100      * @return the caster of the <code>Enchantment</code>.
101      */
102     IBeing getCaster();
103 
104     /***
105      * The target of the <code>Enchantment</code>.
106      *
107      * @return the target of the <code>Enchantment</code>.
108      */
109     IBeing getTarget();
110 }