com.swath.cmd
Class AttackShip

java.lang.Object
  extended bycom.swath.Info
      extended bycom.swath.cmd.SwathCommand
          extended bycom.swath.cmd.AttackShip
All Implemented Interfaces:
CommandIfc

public final class AttackShip
extends com.swath.cmd.SwathCommand

Attack or capture an unmanned ship.
Prompts: Command prompt

Since:
SWATH 1.6
See Also:
AttackTrader

Field Summary
static int ATTACKED
          The ship was attacked but still got fighters/shields left.
static int CAPTURED
          The ship was captured and is now yours.
static int DESTROYED
          The ship was destroyed.
static int NO_ATTACK
          No attack was made for some reason.
 
Method Summary
static int exec(Ship ship)
          Try to capture an unmanned ship.
static int exec(Ship ship, int fighters)
          Attack an unmanned ship with a specific amount of fighters.
 java.lang.String getClassName()
          Gets the command class name.
 java.lang.String getName()
          Gets the name of the command.
 java.util.Enumeration getParams()
          Gets the command parameters.
 boolean initCommand()
           
 boolean isInternal()
          Indicates if this is an internal SWATH command or not.
 boolean isUserDefined()
          Indicates if this command is user defined or not.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_ATTACK

public static final int NO_ATTACK
No attack was made for some reason.

See Also:
Constant Field Values

ATTACKED

public static final int ATTACKED
The ship was attacked but still got fighters/shields left.

See Also:
Constant Field Values

DESTROYED

public static final int DESTROYED
The ship was destroyed.

See Also:
Constant Field Values

CAPTURED

public static final int CAPTURED
The ship was captured and is now yours.

See Also:
Constant Field Values
Method Detail

initCommand

public boolean initCommand()
                    throws java.lang.Exception
Throws:
java.lang.Exception

exec

public static int exec(Ship ship,
                       int fighters)
                throws java.lang.Exception
Attack an unmanned ship with a specific amount of fighters.

Parameters:
ship - The ship to attack or null to attack the first unmanned ship in the sector.
fighters - The amount of fighters to attack with.
Returns:
The result of the attack.
Throws:
java.lang.Exception
Since:
SWATH 1.6
See Also:
NO_ATTACK, ATTACKED, DESTROYED, CAPTURED

exec

public static int exec(Ship ship)
                throws java.lang.Exception
Try to capture an unmanned ship.

Parameters:
ship - The ship to capture or null to capture the first unmanned ship in the sector.
Returns:
The result of the attack.
Throws:
java.lang.Exception
Since:
SWATH 1.6
See Also:
NO_ATTACK, ATTACKED, DESTROYED, CAPTURED

isUserDefined

public final boolean isUserDefined()
Description copied from interface: CommandIfc
Indicates if this command is user defined or not.

Specified by:
isUserDefined in interface CommandIfc
Returns:
true if user defined, otherwise false.

getName

public final java.lang.String getName()
Description copied from interface: CommandIfc
Gets the name of the command.

Specified by:
getName in interface CommandIfc
Returns:
The command name.

getClassName

public final java.lang.String getClassName()
Description copied from interface: CommandIfc
Gets the command class name.

Specified by:
getClassName in interface CommandIfc
Returns:
The class name.

getParams

public final java.util.Enumeration getParams()
Description copied from interface: CommandIfc
Gets the command parameters.

Specified by:
getParams in interface CommandIfc
Returns:
The command parameters.

isInternal

public boolean isInternal()
Description copied from interface: CommandIfc
Indicates if this is an internal SWATH command or not.

Specified by:
isInternal in interface CommandIfc
Returns:
true if internal, otherwise false.