megamek.common.actions
Class BrushOffAttackAction

java.lang.Object
  extended by megamek.common.actions.AbstractEntityAction
      extended by megamek.common.actions.AbstractAttackAction
          extended by megamek.common.actions.BrushOffAttackAction
All Implemented Interfaces:
java.io.Serializable, AttackAction, EntityAction

public class BrushOffAttackAction
extends AbstractAttackAction

The attacker brushes the target off.

See Also:
Serialized Form

Field Summary
static int BOTH
           
static int LEFT
           
static int RIGHT
           
 
Constructor Summary
BrushOffAttackAction(int entityId, int targetType, int targetId, int arm)
           
 
Method Summary
 int getArm()
           
static int getDamageFor(Entity entity, int arm)
          Damage that the specified mech does with a brush off attack.
 void setArm(int arm)
           
 ToHitData toHit(IGame game)
          To-hit number for the specified arm to brush off swarming infantry.
static ToHitData toHit(IGame game, int attackerId, Targetable target, int arm)
          To-hit number for the specified arm to brush off swarming infantry.
 
Methods inherited from class megamek.common.actions.AbstractAttackAction
getEntity, getTarget, getTargetId, getTargetType, nightModifiers, setTargetId, setTargetType
 
Methods inherited from class megamek.common.actions.AbstractEntityAction
getEntityId, setEntityId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface megamek.common.actions.EntityAction
getEntityId, setEntityId
 

Field Detail

BOTH

public static final int BOTH
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values
Constructor Detail

BrushOffAttackAction

public BrushOffAttackAction(int entityId,
                            int targetType,
                            int targetId,
                            int arm)
Method Detail

getArm

public int getArm()

setArm

public void setArm(int arm)

getDamageFor

public static int getDamageFor(Entity entity,
                               int arm)
Damage that the specified mech does with a brush off attack. This equals the damage done by a punch from the same arm.

Parameters:
entity - - the Entity brushing off the swarm.
arm - - the int of the arm making the attack; this value must be BrushOffAttackAction.RIGHT or BrushOffAttackAction.LEFT.
Returns:
the int amount of damage caused by the attack. If the attack hits, the swarming infantry takes the damage; if the attack misses, the entity deals the damage to themself.

toHit

public ToHitData toHit(IGame game)
To-hit number for the specified arm to brush off swarming infantry. If this attack misses, the Mek will suffer punch damage. This same action is used to remove iNARC pods.

Parameters:
game - - the IGame object containing all entities.
Returns:
the ToHitData containing the target roll.

toHit

public static ToHitData toHit(IGame game,
                              int attackerId,
                              Targetable target,
                              int arm)
To-hit number for the specified arm to brush off swarming infantry. If this attack misses, the Mek will suffer punch damage. This same action is used to remove iNARC pods.

Parameters:
game - - the IGame object containing all entities.
attackerId - - the int ID of the attacking unit.
target - - the Targetable object being targeted.
arm - - the int of the arm making the attack; this value must be BrushOffAttackAction.RIGHT or BrushOffAttackAction.LEFT.
Returns:
the ToHitData containing the target roll.