Class AbstractAttackAction

java.lang.Object
megamek.common.actions.AbstractEntityAction
megamek.common.actions.AbstractAttackAction
All Implemented Interfaces:
Serializable, AttackAction, EntityAction
Direct Known Subclasses:
BAVibroClawAttackAction, BrushOffAttackAction, DisplacementAttackAction, LayExplosivesAttackAction, PheromoneAttackAction, PhysicalAttackAction, ProtoMekPhysicalAttackAction, RamAttackAction, SearchlightAttackAction, SuicideImplantsAttackAction, TeleMissileAttackAction, ThrashAttackAction, ToxinAttackAction, WeaponAttackAction, WoodsClearingAttackAction

public abstract class AbstractAttackAction extends AbstractEntityAction implements AttackAction
Abstract superclass for any action where an entity is attacking another entity.
See Also:
  • Constructor Details

    • AbstractAttackAction

      public AbstractAttackAction(int entityId, int targetId)
    • AbstractAttackAction

      public AbstractAttackAction(int entityId, int targetType, int targetId)
  • Method Details

    • getTargetType

      public int getTargetType()
      Specified by:
      getTargetType in interface AttackAction
    • getTargetId

      public int getTargetId()
      Specified by:
      getTargetId in interface AttackAction
    • setTargetType

      public void setTargetType(int targetType)
      Specified by:
      setTargetType in interface AttackAction
    • setTargetId

      public void setTargetId(int targetId)
      Specified by:
      setTargetId in interface AttackAction
    • getTarget

      @Nullable public Targetable getTarget(Game game)
    • getEntity

      @Nullable public Entity getEntity(Game g)
      Gets the entity associated with this attack action, using the passed-in game object.
      Returns:
      the entity even if it was destroyed or fled.
    • getEntity

      @Nullable public Entity getEntity(Game g, int entityID)
      Gets an entity with the given ID, using the passed-in game object.
      Returns:
      the entity even if it was destroyed or fled.
    • nightModifiers

      public static ToHitData nightModifiers(Game game, Targetable target, AmmoType ammoType, Entity attacker, boolean isWeapon)
      used by the toHit of derived classes ammoType may be null if not using an ammo based weapon
      Parameters:
      game - The current Game
    • toAccessibilityDescription

      public String toAccessibilityDescription(Client client)
      Description copied from interface: EntityAction
      Returns a full description of the action that is (only) to be used in the AccessibilityDialog as a textual representation of the action. By default, this method returns the value of toString().
      Specified by:
      toAccessibilityDescription in interface EntityAction
      Parameters:
      client - The local client to obtain any necessary information for the description
      Returns:
      A string describing the action
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class AbstractEntityAction