Package megamek.common.actions
Class WeaponAttackAction
java.lang.Object
megamek.common.actions.AbstractEntityAction
megamek.common.actions.AbstractAttackAction
megamek.common.actions.WeaponAttackAction
- All Implemented Interfaces:
- Serializable,- AttackAction,- EntityAction
- Direct Known Subclasses:
- ArtilleryAttackAction
Represents intention to fire a weapon at the target.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic intprotected booleanBoolean flag that determines if this shot was fired using homing ammunition.protected booleanBoolean flag that determines if this shot was fired as part of a pointblank shot from a hidden unit.protected booleanBoolean flag that determines if this shot was the first one by a particular weapon in a strafing run.protected intstatic final intstatic int
- 
Constructor SummaryConstructorsConstructorDescriptionWeaponAttackAction(int entityId, int targetId, int weaponId) WeaponAttackAction(int entityId, int targetType, int targetId, int weaponId) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidintintgetAltitudeLoss(Game game) intReturns the entity id of the unit carrying the ammo used by this attackintintintintintintintintbooleanisAirToAir(Game game) booleanisAirToGround(Game game) booleanisDiveBomb(Game game) Deprecated, for removal: This API element is subject to removal in a future version.no indicated uses.booleanisGroundToAir(Game game) booleanDeprecated, for removal: This API element is subject to removal in a future version.booleanbooleanisOrbitToSurface(Game game) booleanbooleanbooleanbooleanvoidsetAimedLocation(int aimedLocation) voidsetAimingMode(AimingMode aimMode) voidsetAmmoCarrier(int entityId) Sets the entity id of the ammo carrier for this shot, if different from the firing entityvoidsetAmmoId(int ammoId) voidsetAmmoMunitionType(EnumSet<AmmoType.Munitions> ammoMunitionType) voidsetBombPayloads(HashMap<String, BombLoadout> bombPayloads) voidsetHomingShot(boolean isHomingShot) voidsetLaunchVelocity(int velocity) Needed by teleoperated missilesvoidsetNemesisConfused(boolean nemesisConfused) voidsetOldTargetId(int id) voidsetOldTargetType(int t) voidsetOriginalTargetId(int id) voidsetOriginalTargetType(int t) voidsetOtherAttackInfo(int newInfo) voidsetPointblankShot(boolean isPointblankShot) voidsetStrafing(boolean isStrafing) voidsetStrafingFirstShot(boolean isStrafingFirstShot) voidsetSwarmingMissiles(boolean swarmingMissiles) voidsetSwarmMissiles(int swarmMissiles) voidsetWeaponId(int weaponId) static booleantargetInShortCoverBuilding(Targetable target) Quick routine to determine if the target should be treated as being in a short building.toAccessibilityDescription(Client client) Returns a full description of the action that is (only) to be used in theAccessibilityDialogas a textual representation of the action.static ToHitDatatoHit(Game game, int attackerId, Targetable target) To-hit number for attacker firing a generic weapon at the target.static ToHitDatatoHit(Game game, int attackerId, Targetable target, int weaponId, boolean isStrafing) static ToHitDatatoHit(Game game, int attackerId, Targetable target, int weaponId, int aimingAt, AimingMode aimingMode, boolean isStrafing) static ToHitDatatoHit(Game game, int attackerId, Targetable target, int weaponId, int aimingAt, AimingMode aimingMode, boolean isNemesisConfused, boolean exchangeSwarmTarget, Targetable oldTarget, Targetable originalTarget, boolean isStrafing, boolean isPointblankShot, boolean evenIfAlreadyFired, int ammoId, int ammoCarrier) static ToHitDatatoHit(Game game, int attackerId, Targetable target, int weaponId, int aimingAt, AimingMode aimingMode, boolean isNemesisConfused, boolean exchangeSwarmTarget, Targetable oldTarget, Targetable originalTarget, boolean isStrafing, boolean isPointblankShot, int ammoId, int ammoCarrier) toSummaryString(Game game) Returns a short one-line description of the action that is used in the UI, e.g.voidupdateTurnsTilHit(Game game) Methods inherited from class megamek.common.actions.AbstractAttackActiongetEntity, getEntity, getTarget, getTargetId, getTargetType, nightModifiers, setTargetId, setTargetType, toStringMethods inherited from class megamek.common.actions.AbstractEntityActiongetEntityIdMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface megamek.common.actions.EntityActiongetEntityId
- 
Field Details- 
DEFAULT_VELOCITYpublic static int DEFAULT_VELOCITY
- 
UNASSIGNEDpublic static int UNASSIGNED
- 
STRATOPS_SENSOR_SHADOW_WEIGHT_DIFFpublic static final int STRATOPS_SENSOR_SHADOW_WEIGHT_DIFF- See Also:
 
- 
launchVelocityprotected int launchVelocity
- 
isStrafingFirstShotprotected boolean isStrafingFirstShotBoolean flag that determines if this shot was the first one by a particular weapon in a strafing run. Used to ensure that heat is only added once.
- 
isPointblankShotprotected boolean isPointblankShotBoolean flag that determines if this shot was fired as part of a pointblank shot from a hidden unit. In this case, to-hit numbers should not be modified for terrain or movement. See TW pg 260
- 
isHomingShotprotected boolean isHomingShotBoolean flag that determines if this shot was fired using homing ammunition. Can be checked to allow casting of attack handlers to the proper homing handler.
 
- 
- 
Constructor Details- 
WeaponAttackActionpublic WeaponAttackAction(int entityId, int targetId, int weaponId) 
- 
WeaponAttackActionpublic WeaponAttackAction(int entityId, int targetType, int targetId, int weaponId) 
- 
WeaponAttackAction
 
- 
- 
Method Details- 
getWeaponIdpublic int getWeaponId()
- 
getAmmoIdpublic int getAmmoId()
- 
getAmmoMunitionType
- 
getAmmoCarrierpublic int getAmmoCarrier()Returns the entity id of the unit carrying the ammo used by this attack
- 
getAimedLocationpublic int getAimedLocation()
- 
getCounterEquipment
- 
setWeaponIdpublic void setWeaponId(int weaponId) 
- 
setAmmoIdpublic void setAmmoId(int ammoId) 
- 
setAmmoMunitionType
- 
setAmmoCarrierpublic void setAmmoCarrier(int entityId) Sets the entity id of the ammo carrier for this shot, if different from the firing entity
- 
setAimedLocationpublic void setAimedLocation(int aimedLocation) 
- 
getAimingMode
- 
setAimingMode
- 
addCounterEquipment
- 
setOtherAttackInfopublic void setOtherAttackInfo(int newInfo) 
- 
getOtherAttackInfopublic int getOtherAttackInfo()
- 
isAirToGround
- 
isAirToAir
- 
isGroundToAir
- 
isOrbitToSurface
- 
isDiveBombDeprecated, for removal: This API element is subject to removal in a future version.no indicated uses.
- 
getAltitudeLoss
- 
toHit
- 
toHit- Parameters:
- evenIfAlreadyFired- false: an already fired weapon will return a ToHitData with value IMPOSSIBLE true: an already fired weapon will return a ToHitData with the value of its chance to hit
 
- 
toHit
- 
toHitpublic static ToHitData toHit(Game game, int attackerId, Targetable target, int weaponId, boolean isStrafing) 
- 
toHitpublic static ToHitData toHit(Game game, int attackerId, Targetable target, int weaponId, int aimingAt, AimingMode aimingMode, boolean isStrafing) 
- 
toHitpublic static ToHitData toHit(Game game, int attackerId, Targetable target, int weaponId, int aimingAt, AimingMode aimingMode, boolean isNemesisConfused, boolean exchangeSwarmTarget, Targetable oldTarget, Targetable originalTarget, boolean isStrafing, boolean isPointblankShot, int ammoId, int ammoCarrier) 
- 
toHitpublic static ToHitData toHit(Game game, int attackerId, Targetable target, int weaponId, int aimingAt, AimingMode aimingMode, boolean isNemesisConfused, boolean exchangeSwarmTarget, Targetable oldTarget, Targetable originalTarget, boolean isStrafing, boolean isPointblankShot, boolean evenIfAlreadyFired, int ammoId, int ammoCarrier) 
- 
toHitTo-hit number for attacker firing a generic weapon at the target. Does not factor in any special weapon or ammo considerations, including range modifiers. Also does not include gunnery skill.- Parameters:
- game- The current- Game
 
- 
isNemesisConfusedpublic boolean isNemesisConfused()- Returns:
- Returns the nemesisConfused.
 
- 
setNemesisConfusedpublic void setNemesisConfused(boolean nemesisConfused) - Parameters:
- nemesisConfused- The nemesisConfused to set.
 
- 
isSwarmingMissilespublic boolean isSwarmingMissiles()
- 
setSwarmingMissilespublic void setSwarmingMissiles(boolean swarmingMissiles) 
- 
setOldTargetIdpublic void setOldTargetId(int id) 
- 
getOldTargetIdpublic int getOldTargetId()
- 
setOldTargetTypepublic void setOldTargetType(int t) 
- 
getOldTargetTypepublic int getOldTargetType()
- 
setOriginalTargetIdpublic void setOriginalTargetId(int id) 
- 
getOriginalTargetIdpublic int getOriginalTargetId()
- 
setOriginalTargetTypepublic void setOriginalTargetType(int t) 
- 
getOriginalTargetTypepublic int getOriginalTargetType()
- 
getSwarmMissilespublic int getSwarmMissiles()
- 
setSwarmMissilespublic void setSwarmMissiles(int swarmMissiles) 
- 
getBombPayload
- 
getBombPayloads
- 
setBombPayloads- Parameters:
- bombPayloads- These are the "bomb payload" for internal and external bomb stores. It's a HashMap of two arrays, each indexed by the constants declared in BombType. Each element indicates how many types of that bomb should be fired.
 
- 
isStrafingpublic boolean isStrafing()
- 
setStrafingpublic void setStrafing(boolean isStrafing) 
- 
isStrafingFirstShotpublic boolean isStrafingFirstShot()
- 
setStrafingFirstShotpublic void setStrafingFirstShot(boolean isStrafingFirstShot) 
- 
isPointblankShotpublic boolean isPointblankShot()
- 
setPointblankShotpublic void setPointblankShot(boolean isPointblankShot) 
- 
isHomingShotDeprecated, for removal: This API element is subject to removal in a future version.
- 
setHomingShotpublic void setHomingShot(boolean isHomingShot) 
- 
setLaunchVelocitypublic void setLaunchVelocity(int velocity) Needed by teleoperated missiles- Parameters:
- velocity- - an integer representing initial velocity
 
- 
updateTurnsTilHit
- 
targetInShortCoverBuildingQuick routine to determine if the target should be treated as being in a short building.
- 
toAccessibilityDescriptionDescription 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 interface- EntityAction
- Overrides:
- toAccessibilityDescriptionin class- AbstractAttackAction
- Parameters:
- client- The local client to obtain any necessary information for the description
- Returns:
- A string describing the action
- See Also:
 
- 
toSummaryStringDescription copied from interface:EntityActionReturns a short one-line description of the action that is used in the UI, e.g. on attack arrows in the BoardView and in the action summary inTurnDetailsOverlay.- Parameters:
- game- The game object to get information from
- Returns:
- A short String describing the action
- See Also:
 
 
-