robocode
Class Mine

java.lang.Object
  extended by robocode.Mine
All Implemented Interfaces:
Serializable

public class Mine
extends Object
implements Serializable

Represents a Mine that is returned when placing one with Ship.placeMine(double) and all Mine related events

Author:
Thales B.V. / Thomas Hakkers (original), Mathew A. Nelson (contributor), Flemming N. Larsen (contributor) (Added you guys because a lot from this class is copied from Bullet)
See Also:
Serialized Form

Constructor Summary
Mine(double x, double y, double power, String ownerName, String victimName, boolean isActive, int mineId)
          Called by the game to create a new Mine object
 
Method Summary
 boolean equals(Object obj)
           
 String getName()
          Returns the name of the ship that placed this mine.
 double getPower()
          Returns the power of this mine.
 String getVictim()
          Returns the name of the ship that this mine hit, or null if the mine has not hit a ship.
 double getX()
          Returns the X position of the mine.
 double getY()
          Returns the Y position of the mine.
 int hashCode()
           
 boolean isActive()
          Checks if this mine is still active on the battlefield.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mine

public Mine(double x,
            double y,
            double power,
            String ownerName,
            String victimName,
            boolean isActive,
            int mineId)
Called by the game to create a new Mine object

Parameters:
x - the X position of the mine.
y - the Y position of the mine.
power - the power of the mine.
ownerName - the name of the owner ship that owns the mine.
victimName - the name of the ship hit by the mine.
isActive - true if the mine is not exploding; false otherwise.
mineId - unique id of mine for owner robot.
Method Detail

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getName

public String getName()
Returns the name of the ship that placed this mine.

Returns:
the name of the ship that placed this mine

getPower

public double getPower()
Returns the power of this mine.

The mine will do (3 * power) damage if it hits another ship. If power is equal to 15, it will do an additional 5 damage. You will get (3 * power) back if you hit the other robot.

Returns:
the power of the mine

getVictim

public String getVictim()
Returns the name of the ship that this mine hit, or null if the mine has not hit a ship.

Returns:
the name of the ship that this mine hit, or null if the mine has not hit a ship.

getX

public double getX()
Returns the X position of the mine.

Returns:
the X position of the mine

getY

public double getY()
Returns the Y position of the mine.

Returns:
the Y position of the mine

isActive

public boolean isActive()
Checks if this mine is still active on the battlefield.

Returns:
true if the mine is still active on the battlefield; false otherwise


Copyright © 2015 Robocode. All Rights Reserved.