Class Battle

java.lang.Object
  |
  +--java.awt.Component
        |
        +--Battle
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Battle
extends java.awt.Component

Defines the battling arena. Displays the Player and opponents health, Handles the use of Items, Switches the Active Monster, and if opponent is a Trainer gives the Player his Badge if Player wins. The Player recieves half of the money carried by the opponent and recieves experience propertional to the level of the opponent's Monster(s). Displays the dialogue associated with the opponent after the conclusion of the battle if Player wins, else Fires a GameOverEvent.

See Also:
Monster, MapObject, People, Person, Player, BattleEndEvent, BattleEndListener, GameOverEvent, GameOverListener, ImageMap, Item, Serialized Form

Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Battle(Player p, MapObject opp)
          Construct a Battle between Player and the MapObject.
Battle(Player p, MapObject opp, ImageMap[] monsterImageMap)
          Construct a Battle between Player and the MapObject using images in the ImageMap.
 
Method Summary
 void addBattleEndListener(BattleEndListener bl)
          Adds a BattleEndListener to be informed.
 void addGameOverListener(GameOverListener bl)
          Adds a GameOverListener to be informed.
 void paint(java.awt.Graphics g)
          Draws the Battle screen system with Monsters, Health bars, and Menus
 void processEvent(java.awt.AWTEvent e)
          Process the events passed to this.
 void removeBattleListener(BattleEndListener bl)
          Removes a BattleEndListener to not be informed anymore.
 void removeGameOverListener(GameOverListener bl)
          Removes a GameOverListener to stop being informed.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Battle

public Battle(Player p,
              MapObject opp)
Construct a Battle between Player and the MapObject.

Parameters:
p - the Player to battle with
opp - the opponent of the Player
See Also:
Player, MapObject, Trainer, People, Person

Battle

public Battle(Player p,
              MapObject opp,
              ImageMap[] monsterImageMap)
Construct a Battle between Player and the MapObject using images in the ImageMap.

Parameters:
p - the Player to battle with
opp - the opponent of the Player
monsterImageMap - the Images (Front and Back) of all the Monsters used
See Also:
Player, MapObject, Trainer, People, Person, ImageMap
Method Detail

processEvent

public void processEvent(java.awt.AWTEvent e)
Process the events passed to this. Overrides the implementation of KeyEvent.KEY_PRESSED, and allows super to handle the rest.

Overrides:
processEvent in class java.awt.Component
Parameters:
e - the AWTEvent to handle

paint

public void paint(java.awt.Graphics g)
Draws the Battle screen system with Monsters, Health bars, and Menus

Overrides:
paint in class java.awt.Component
Parameters:
g - the Graphics

addBattleEndListener

public void addBattleEndListener(BattleEndListener bl)
Adds a BattleEndListener to be informed.

Parameters:
bl - the Class to be informed of BattleEndEvents.
See Also:
BattleEndEvent, BattleEndListener

removeBattleListener

public void removeBattleListener(BattleEndListener bl)
Removes a BattleEndListener to not be informed anymore.

Parameters:
bl - the Class to stop being informed of BattleEndEvents.
See Also:
BattleEndEvent, BattleEndListener

addGameOverListener

public void addGameOverListener(GameOverListener bl)
Adds a GameOverListener to be informed.

Parameters:
bl - the Class to be informed of GameOverEvents.
See Also:
GameOverEvent, GameOverListener

removeGameOverListener

public void removeGameOverListener(GameOverListener bl)
Removes a GameOverListener to stop being informed.

Parameters:
bl - the Class to stop being informed of GameOverEvents.
See Also:
GameOverEvent, GameOverListener