View Javadoc

1   /*
2    @See License.txt@
3    */
4   package spellcast.beings;
5   
6   import spellcast.damage.Damage;
7   import spellcast.enchantment.Enchantment;
8   import spellcast.model.Id;
9   import util.Nullable;
10  
11  /***
12   * The Being Interface.
13   *
14   * @author Barrie Treloar
15   * @version $Revision: 1.1 $
16   */
17  public interface IBeing extends Nullable {
18      /***
19       * Add an enchantment to this Being.
20       *
21       * @param anEnchantment the enchantment to add.
22       */
23       void addEnchantment(final Enchantment anEnchantment);
24  
25      /***
26       * Remove the specified <code>Enchantment</code> from this
27       * <code>Being</code>. If the enchantment does not exist then nothing is
28       * removed.
29       *
30       * @param enchantment the enchantment to remove. Ignored if the enchantment
31       *        is not in effect on this <code>Being</code>.
32       */
33       void removeEnchantment(final Enchantment enchantment);
34  
35      /***
36       * Return an array of all <code>Enchantment</code>s that are in effect upon
37       * this <code>Being</code>.
38       *
39       * @return an array of all <code>Enchantment</code>s that are in effect
40       *         upon this <code>Being</code>.
41       */
42       Enchantment[] getEnchantments();
43  
44      /***
45       * Each <code>Enchantment</code> on this <code>Being</code> is notified
46       * that the turn has been completed via <code>turnComplete</code>. If the
47       * <code>Enchantment</code> indicates that it should no longer be in
48       * effect then it is removed.
49       *
50       * @see Enchantment#turnComplete
51       */
52       void updateEnchantments();
53  
54      /***
55       * Indicates whether this <code>Being</code> is active this turn.
56       *
57       * @return whether this <code>Being</code> is active this turn.
58       */
59       boolean isActive();
60  
61      /***
62       * Sets this <code>Being</code> as active for this turn.
63       *
64       * @param isActive if this<code>Being</code> is active for this turn, false
65       *        otherwise.
66       */
67       void setActive(final boolean isActive);
68  
69      /***
70       * Determine if this <code>Being</code> is currently alive. True if alive,
71       * false otherwise.
72       *
73       * @return true if the <code>Being</code> is alive, false otherwise.
74       */
75       boolean isAlive();
76  
77      /***
78       * Sets whether this <code>Being</code> is currently alive. True if alive,
79       * false otherwise.
80       *
81       * @param isAlive true if alive, false otherwise.
82       */
83       void setAlive(final boolean isAlive);
84  
85      /***
86       * Determine if this being should die. TODO this should probably return an
87       * object which indicates: who killed the Being and what killed them.
88       */
89       void shouldDie();
90  
91      /***
92       * The <code>Id</code> of this <code>Being</code>.
93       *
94       * @return the <code>Id</code> of this <code>Being</code>.
95       */
96       Id getId();
97  
98      /***
99       * Set the <code>Id</code> of this <code>Being</code>.
100      *
101      * @param theId the <code>Id</code> of this <code>Being</code>.
102      */
103      void setId(final Id theId);
104 
105     /***
106      * Returns the value of the current Hit Points for this <code>Being</code>.
107      * The current hit points will never exceed max hit points.
108      *
109      * @return the value of the current Hit Points for this <code>Being</code>.
110      */
111      int getHitPoints();
112 
113     /***
114      * Set the value for the current <code>HitPoints</code> for this Being. Any
115      * values that are negative are converted into 0. Any values that are
116      * greater than <code>getMaxHitPoints</code> are converted into
117      * <code>getMaxHitPoints</code>.
118      *
119      * @param theHitPoints the value to set the Hit Points to. Any negative
120      *        values are converted to 0. Any values that are greater
121      *        than<code>getMaxHitPoints</code> are converted into
122      *        <code>getMaxHitPoints</code>.
123      */
124      void setHitPoints(final int theHitPoints);
125 
126     /***
127      * Returns the value for the Maximum Hit Points for this
128      * <code>Being</code>.
129      *
130      * @return the maximum hit points for this <code>Being</code>.
131      */
132      int getMaxHitPoints();
133 
134     /***
135      * Set the value for the Maximum Hit Points for this <code>Being</code>.
136      * Only positive values are allowed for maxHitPoints.  Any invalid values
137      * are silently ignored and the value is set to 0.
138      *
139      * @param theMaxHitPoints the value to set the Maximum Hit Points to. Valid
140      *        values are > 0. Invalid values are silently ignored and the
141      *        value is set to 0.
142      */
143      void setMaxHitPoints(final int theMaxHitPoints);
144 
145     /***
146      * The specified damage is dealt to this Being. If there are any
147      * <code>Enchantment</code>s that provide resistance to the
148      * <code>DamageType</code> being dealt then the damage is reduced to zero.
149      *
150      * @param damageDealt the damage to deal to this <code>Being</code>.
151      */
152      void takeDamage(final Damage damageDealt);
153 
154     /***
155      * The name of the <code>Being</code>.
156      *
157      * @return the name of the <code>Being</code>.
158      */
159      String getName();
160 
161     /***
162      * Sets the name of this <code>Being</code>.
163      *
164      * @param theName the name for this <code>Being</code>.
165      */
166      void setName(final String theName);
167 
168     /***
169      * Return the <code>Gender</code> of this <code>Being</code>.
170      *
171      * @return the <code>Gender</code> of this <code>Being</code>.
172      */
173      Gender getGender();
174 
175     /***
176      * Sets the <code>Gender</code> of this <code>Being</code>.
177      *
178      * @param theGender the <code>Gender</code> of this <code>Being</code>.
179      */
180      void setGender(final Gender theGender);
181 
182     /***
183      * Indicates whether this <code>Being</code> should leave a corpse when it
184      * dies.
185      *
186      * @return true if a corpse should be created on death, false otherwise.
187      */
188      boolean getLeavesCorpse();
189 
190     /***
191      * This <code>Being</code> will leave a corpse on death if this value is
192      * true, otherwise no corpse will be created.
193      *
194      * @param shouldLeaveCorpse true if a corpse should be created on death,
195      *        false otherwise.
196      */
197      void setLeavesCorpse(final boolean shouldLeaveCorpse);
198 
199 }