| BattleEvent.java |
1 import java.awt.*;
2 import java.awt.event.*;
3 import java.applet.*;
4 import java.awt.geom.*;
5 import java.util.*;
6
7 /**
8 * The BattleEvent for when Battle's start
9 *
10 * @see Grid
11 * @see Battle
12 * @see MapObject
13 * @see Monster
14 * @see Player
15 * @see Person
16 * @see Trainer
17 * @see People
18 */
19 public class BattleEvent extends AWTEvent
20 {
21 /**
22 * The opponnent
23 */
24 MapObject opp;
25 /**
26 * The Player
27 */
28 Player pl;
29 /**
30 * The UID of this Event
31 */
32 public static final int BATTLE_STARTED = RESERVED_ID_MAX + 1; // Make sure no conflicts with normal AWT components
33
34 /**
35 * Constructs a new BattleEvent.
36 *
37 * @param source the Grid this event was fired from
38 * @param id the ID
39 * @param mp1 the MapObject #1 to be passed along
40 * @param mp2 the MapObject #2 to be passed along
41 */
42 BattleEvent(Grid source, int id, MapObject mp1, MapObject mp2)
43 {
44 super( source, id );
45 if(mp1.getType() == MapObject.PLAYER)
46 {
47 pl = (Player)mp1;
48 opp = mp2;
49 }
50 else
51 {
52 pl = (Player)mp2;
53 opp = mp1;
54 }
55 }
56 /**
57 * Returns the Player of this
58 *
59 * @return the Player
60 */
61 public Player getPlayer()
62 {
63 return pl;
64 }
65 /**
66 * Returns the Opponent of the Player
67 *
68 * @return the MapObject of the Opponent
69 */
70 public MapObject getOpponent()
71 {
72 return opp;
73 }
74 }
75