package edu.mit.roborace;
// Copyright 1998, Matthew Gray
// Licensed under the GPL

import java.awt.Graphics;

/** This is the base class for all board elements.
    A board element is essentially anything that can appear on a square on
    the board.  This includes, robots, walls, conveyor belts, missles,
    etc.

    @author Matthew Gray <mkgray@mit.edu> and Chris Shabsin <shabby@mit.edu>
*/
public class BoardElement {
    Graphics myG;
    Square curSquare;
    int direction;


    /** Called before anything happens, at the beginning of a turn.
     */
    public void turnInit() { }

    /** Called before anything happens, at the beginning of a phase.
     */
    public void phaseInit() { }

    /** This method is called when a MobileBoardElement leaves a
	Square with this board element in it. This may cause some modification
	of the Card in question, such as in the case of an oil slick or
	water, but in most cases nothing will happen.
	
	@param mbe The MobileBoardElement that is leaving (or trying)
	@param c   The card that is being used
     */
    public void leaveSquare(MobileBoardElement mbe, Card c) { }

    /** This method is called when a MobileBoardElement moves from
	one square to another.  This is where the effects of things like
	walls and whatnot do their stuff.  Note, a wall does not actually
	prevent the robot from moving.  It asks the robot via the
	specialHandling method if it has special behavior with regard to
	walls (or whatever the board element in question is, and if it
	does not, then it stops the robot (or otherwise effects it),
	otherwise it has the robot do its own special handling. 

	@param mbe The MobileBoardElement that is moving
	@param c   The card that is being used
    */
    public void moveFrom(MobileBoardElement mbe, Card c) { }

    /** This method is called when a MobileBoardElement moves tries
	to stop movement on a square containing this board element.

	@param mbe The MobileBoardElement that is stopping here
	@param c   The card that is being used
    */
    public void stopOn(MobileBoardElement mbe, Card c) { }

    /** This method is called during the "board elements move"
	portion of the phase.

	@param mbe The MobileBoardElement who is "asking" to be effected
	@param tryhard The first time this method is called it will be
	               false, and it should decline to do anything, if
		       doing so would push another robot, or do anything
		       less than simple.  If it declines, all other
		       MobileBoardElements will call their boardElementsMove
		       method at this priority first, to see if that resolves
		       it.  Failing that, tryhard will be set to true, and
		       the BoardElement should do its stuff.
	@return The return value indicates whether it is handling (true) or
	        deferring (false) the event
     */
    public boolean boardElementsMove(MobileBoardElement mbe, boolean tryhard) { }
    /** This method gives this BoardElement an opportunity to generate
	weapon fire.
    */
    public void weaponFire(MobileBoardElement mbe, Card c) { }
    public void beamMoveFrom(MobileBoardElement mbe, Card c) { }
    public void endOfPhase(MobileBoardElement mbe, Card c) { }
    public void draw() { }
}



