Package megamek.common.actions
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
Abstract superclass for any action where an entity is attacking another entity.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractAttackAction(int entityId, int targetId) AbstractAttackAction(int entityId, int targetType, int targetId) -
Method Summary
Modifier and TypeMethodDescriptionGets the entity associated with this attack action, using the passed-in game object.Gets an entity with the given ID, using the passed-in game object.intintstatic ToHitDatanightModifiers(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 weaponvoidsetTargetId(int targetId) voidsetTargetType(int targetType) toAccessibilityDescription(Client client) Returns a full description of the action that is (only) to be used in theAccessibilityDialogas a textual representation of the action.toString()Methods inherited from class megamek.common.actions.AbstractEntityAction
getEntityIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface megamek.common.actions.EntityAction
getEntityId, toSummaryString
-
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:
getTargetTypein interfaceAttackAction
-
getTargetId
public int getTargetId()- Specified by:
getTargetIdin interfaceAttackAction
-
setTargetType
public void setTargetType(int targetType) - Specified by:
setTargetTypein interfaceAttackAction
-
setTargetId
public void setTargetId(int targetId) - Specified by:
setTargetIdin interfaceAttackAction
-
getTarget
-
getEntity
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
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 currentGame
-
toAccessibilityDescription
Description copied from interface:EntityActionReturns a full description of the action that is (only) to be used in theAccessibilityDialogas a textual representation of the action. By default, this method returns the value of toString().- Specified by:
toAccessibilityDescriptionin interfaceEntityAction- Parameters:
client- The local client to obtain any necessary information for the description- Returns:
- A string describing the action
- See Also:
-
toString
- Overrides:
toStringin classAbstractEntityAction
-