-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPokemon.java
249 lines (197 loc) · 7.68 KB
/
Pokemon.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
import greenfoot.*;
import java.util.ArrayList;
/**
Pokemon.java
This interface includes all of the required methods that a Pokemon must have
Each of these methods must be found in your Pokemon's class. Most of these
methods are 'getters' and 'setters'. Getters get field properties of your
Pokemon, while setters set field properties of your Pokemon.
Each Pokemon should at minimum have the following fields defined as
global private variables within their class:
* Name of Pokemon
* Image Location
* Battle Image Location
* Pokemon Type (Normal, Fire, Water, Electric, Grass, Ice, Fighting, Poison,
Ground, Flying, Psychic, Bug, Rock, Ghost, Dragon, or Dark
types available)
* Hit Points (HP)
* Attack
* Defense
* Special Attack
* Special Defense
* Speed
* Evasion
* Accuracy
*
* And all current stats of these fields
*
* Level Up Points
* Experience (EXP)
* Level #
* ArrayList<Move> moves ( The moves that are available to learn depend on
Pokemon type. See Pokedex.java for details )
* ArrayList<Item> items
* Total Battle Wins
* Status
* Number of evolutions
*
* Height (of Pokemon)
* Weight (of Pokemon)
* Description
*
* Critical hit ratio (and current)
@author Peter Olson
@version 3/17/22
@see PokemonActor.java
*/
public interface Pokemon {
public enum Status {
NORMAL, BURN, FREEZE, PARALYSIS, POISON, SLEEP, BOUND, CONFUSION, FAINTED;
}
public boolean isTouchingPokemon( Class cls );
public Actor getOneIntersectingPokemon( Class cls );
/* @@@@@@@@@@@@@@@@@@@@@ HW 1 -- Getters and Setters for Fields -- @@@@@@@@@@@@@@@@@@@@@ */
public String getName();
public String getImageName();
public void setImageName( String imageLoc );
public String getBattleImageName();
public void setBattleImageName( String imageLoc );
public Status getStatus();
public void setStatus( Status status );
public String getType();
public int getHP();
public void setHP( int HP );
public int getCurrentHP();
public void setCurrentHP( int currentHP );
public void addHP( int HP );
public int getAttack();
public void setAttack( int attack );
public int getCurrentAttack();
public void setCurrentAttack( int currentAttack );
public int getDefense();
public void setDefense( int defense );
public int getCurrentDefense();
public void setCurrentDefense( int currentDefense );
public int getSpecialAttack();
public void setSpecialAttack( int specialAttack );
public int getCurrentSpecialAttack();
public void setCurrentSpecialAttack( int currentSpecialAttack );
public int getSpecialDefense();
public void setSpecialDefense( int specialDefense );
public int getCurrentSpecialDefense();
public void setCurrentSpecialDefense( int currentSpecialDefense );
public int getSpeed();
public void setSpeed( int speed );
public int getCurrentSpeed();
public void setCurrentSpeed( int currentSpeed );
public int getEvasion();
public void setEvasion( int evasion );
public int getCurrentEvasion();
public void setCurrentEvasion( int currentEvasion );
public int getAccuracy();
public void setAccuracy( int accuracy );
public int getCurrentAccuracy();
public void setCurrentAccuracy( int currentAccuracy );
public int getCurrentPoints();
public void setCurrentPoints( int points );
public int getTotalExp();
public int getRemainingExp();
public boolean setTotalExp( int exp ) /*throws InvalidExpException*/;
public boolean addExp( int exp );
public int getCurrentLevel();
public ArrayList<Item> getItems();
public Item getCurrentItem();
public void setCurrentItem( Item currentItem );
public ArrayList<Move> getMoves();
public Move getCurrentMove();
public void setCurrentMove( Move currentMove );
public void addMove( Move move ) throws InvalidPokemonPointsException, InvalidTypeException;
public boolean deleteMove( String moveName );
public boolean deleteMove( int moveNumber );
public int getMovePP( String moveName );
public int getMovePP( int moveNumber );
public int getCurrentMovePP( String moveName );
public int getCurrentMovePP( int moveNumber );
public int getTotalAddedExp();
public int getTotalWins();
public void setTotalWins( int wins );
public int getTotalEvolutions();
public Pokedex getPokedex();
public double getHeight();
public double getWeight();
public void setHeight( double height );
public void setWeight( double weight );
public String getDescription();
public void setDescription( String description );
public int getPokemonNumber();
public double getCurrentCriticalHitRatio();
public void setCurrentCriticalHitRatio( double currentCriticalHitRatio );
public double getCriticalHitRatio();
public void setCriticalHitRatio( double criticalHitRatio );
/**
Exception class related to errors with the allocation of experience
*//* @@FIX: This Exception had to be commented out both in this interface and in PokemonActor due to an error with
* OneDrive not syncing files correctly on Windows 10/11.... this could be fixed by moving this project
* off OneDrive
public class InvalidExpException extends Exception {
/**
Throw new exception
@param errorMessage The message to print
*//*
public InvalidExpException( String errorMessage ) {
super( errorMessage );
}
}*/
/**
Exception class related to errors with the allocation of Pokepoints for
the creation of a new Pikachu object
*/
public class InvalidPokemonPointsException extends Exception {
/**
Throw new exception
@param errorMessage The message to print
*/
public InvalidPokemonPointsException( String errorMessage ) {
super( errorMessage );
}
}
/**
Exception class related to a Pokemon having less than PokeWorld.MIN_NUMBER_OF_MOVES
known move or more than PokeWorld.MAX_NUMBER_OF_MOVES moves
*/
public class InvalidMoveTotalException extends Exception {
/**
Throw new exception
@param errorMessage The message to print
*/
public InvalidMoveTotalException( String errorMessage ) {
super( errorMessage );
}
}
/**
Exception class related to Pokemon values being too low or too high
*/
public class InvalidPokemonValuesException extends Exception {
/**
Throw new exception
@param errorMessage The message to print
*/
public InvalidPokemonValuesException( String errorMessage ) {
super( errorMessage );
}
}
/**
Exception class related to a Pokemon trying to learn a Move that has a different type than this Pokemon's type.
Or related to an invalid type entry, if the type does not exist or if the type formatting is incorrect
*/
public class InvalidTypeException extends Exception {
/**
Throw new exception
@param errorMessage The message to print
*/
public InvalidTypeException( String errorMessage ) {
super( errorMessage );
}
}
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ END OF HW 1 TASKS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
}