Package megamek.common.weapons.handlers
Interface AttackHandler
- All Known Implementing Classes:
ACAPHandler,ACBayHandler,ACCaselessHandler,ACFlakHandler,ACFlechetteHandler,ACIncendiaryHandler,ACTracerHandler,ACWeaponHandler,ADAMissileWeaponHandler,AdvancedSRMHandler,AmmoBayWeaponHandler,AmmoWeaponHandler,AR10Handler,ArtilleryBayWeaponCloseFireHandler,ArtilleryBayWeaponCloseHomingHandler,ArtilleryBayWeaponDistantFireHandler,ArtilleryBayWeaponDistantHomingHandler,ArtilleryCannonWeaponHandler,ArtilleryWeaponCloseFireHandler,ArtilleryWeaponCloseHomingHandler,ArtilleryWeaponDistantFireHandler,ArtilleryWeaponDistantHomingHandler,ASEWMissileWeaponHandler,ATMHandler,BALBXHandler,BAMGHandler,BarracudaHandler,BarracudaTHandler,BATaserHandler,BayWeaponHandler,BombastLaserWeaponHandler,BombAttackHandler,BPodHandler,CapitalLaserBayOrbitalBombardmentHandler,CapitalMissileBayHandler,CapitalMissileBearingsOnlyHandler,CapitalMissileHandler,CenturionWeaponSystemHandler,ChemicalLaserHandler,CLIATMHandler,CLLBXPrototypeHandler,EnergyWeaponHandler,FireExtinguisherHandler,FirefightingSupportHandler,FlamerHandler,FluidGunCoolHandler,GRHandler,HAGWeaponHandler,HGRHandler,HVACWeaponHandler,HyperLaserHandler,InfantryDisposableWeaponHandler,InfantryHeatWeaponHandler,InfantryWeaponHandler,InsulatedLaserWeaponHandler,KillerWhaleHandler,KillerWhaleTHandler,KrakenHandler,LBXHandler,LegAttackHandler,LRMAntiTSMHandler,LRMARADHandler,LRMDeadFireHandler,LRMFollowTheLeaderHandler,LRMFragHandler,LRMHandler,LRMMagneticPulseHandler,LRMScatterableHandler,LRMSmokeWarheadHandler,LRMSwarmHandler,LRMSwarmIHandler,MantaRayHandler,MekMortarAirburstHandler,MekMortarAntiPersonnelHandler,MekMortarFlareHandler,MekMortarHandler,MekMortarSmokeHandler,MekTaserHandler,MGAWeaponHandler,MGHandler,MicroBombHandler,MissileBayWeaponHandler,MissileMineClearanceHandler,MissileWeaponHandler,MPodHandler,MRMHandler,MRMSaturationHandler,NailRivetGunHandler,NarcExplosiveHandler,NarcHandler,PiranhaHandler,PlasmaBayWeaponHandler,PlasmaCannonHandler,PlasmaMFUKWeaponHandler,PlasmaRifleHandler,PopUpMineLauncherHandler,PPCHandler,PrimitiveACWeaponHandler,PrototypeACWeaponHandler,PrototypeCLUltraWeaponHandler,PrototypeGaussHandler,PrototypeISUltraWeaponHandler,PrototypeLaserHandler,PrototypeLBXHandler,PrototypeRLHandler,PrototypeStreakHandler,PulseLaserWeaponHandler,RACHandler,RapidFireACWeaponHandler,RapidFireHVACWeaponHandler,ReengineeredLaserWeaponHandler,RifleWeaponHandler,RLHandler,ScreenLauncherBayHandler,ScreenLauncherHandler,SmallPulseLaserPrototypeHandler,SpaceBombAttackHandler,SRMAntiTSMHandler,SRMARADHandler,SRMAXHandler,SRMDeadFireHandler,SRMFragHandler,SRMHandler,SRMInfernoHandler,SRMMagneticPulseHandler,SRMSmokeWarheadHandler,SRMTandemChargeHandler,StingrayHandler,StopSwarmAttackHandler,StreakHandler,StreakLRMHandler,SwarmAttackHandler,SwarmWeaponAttackHandler,SwordfishHandler,TAGHandler,TeleMissileHandler,ThunderboltScatterableHandler,ThunderBoltWeaponHandler,TSEMPHandler,UltraWeaponHandler,VariableSpeedPulseLaserWeaponHandler,VehicleFlamerCoolHandler,VehicleFlamerHandler,VGLWeaponHandler,WeaponHandler,WhiteSharkHandler,WhiteSharkTHandler
public interface AttackHandler
Describes a set of methods a class can use to represent an attack from some weapon.
- Since:
- May 10, 2004
-
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanintdefault intgetBuildingDamageAdjustment(Entity entityTarget, IBuilding bldg, boolean targetStickingOutOfBuilding, int nDamage) Scale thenDamagebased on if the unit is inside a building, partially sticking out of it, or not.booleanThis method is called to perform handling of its action or attack but only if cares() returns true in the present game phase.booleanUsed to determine if the AttackHandler is handling a strafing run.booleanUsed to determine if this is the first time a weapon is firing as part of a strafing run.default booleanproducesReportThisPhase(GamePhase phase) Whether this handler will add report content (not just internal bookkeeping) whenhandle()runs this phase.voidsetAnnouncedEntityFiring(boolean announcedEntityFiring) voidsetStrafing(boolean isStrafing) voidsetStrafingFirstShot(boolean isFirstShotStrafing)
-
Method Details
-
cares
- Parameters:
phase- The current game phase- Returns:
- True when this handler acts or might act in this phase. The handle() method of this handler is only called when this method returns true for the present phase.
-
producesReportThisPhase
Whether this handler will add report content (not just internal bookkeeping) whenhandle()runs this phase. Used to decide whether to print the "Weapons fire for X" announcement header: an in-flight artillery round that merely decrements its flight timer in the offboard phase produces no report body, so announcing it would leave a dangling empty header. Defaults totrue; handlers with silent phases override it.- Parameters:
phase- The current game phase- Returns:
trueif a report body will be produced this phase,falseif the handler is silent this phase
-
handle
This method is called to perform handling of its action or attack but only if cares() returns true in the present game phase. This method must return true to keep this handler active for future phases. If it returns false, the present handler will be discarded and no longer be called, ending any treatment of the associated attack or action.- Parameters:
phase- The present game phasevPhaseReports- The reports list to add new reports to- Returns:
- True to keep this handler active, false to discard it
-
getAttackerId
int getAttackerId() -
getAttacker
Entity getAttacker() -
announcedEntityFiring
boolean announcedEntityFiring() -
setAnnouncedEntityFiring
void setAnnouncedEntityFiring(boolean announcedEntityFiring) -
getWeaponAttackAction
WeaponAttackAction getWeaponAttackAction() -
isStrafing
boolean isStrafing()Used to determine if the AttackHandler is handling a strafing run. -
setStrafing
void setStrafing(boolean isStrafing) -
isStrafingFirstShot
boolean isStrafingFirstShot()Used to determine if this is the first time a weapon is firing as part of a strafing run. This is used for handling heat, to prevent shots after the first one from generating heat. -
setStrafingFirstShot
void setStrafingFirstShot(boolean isFirstShotStrafing) -
getBuildingDamageAdjustment
default int getBuildingDamageAdjustment(Entity entityTarget, IBuilding bldg, boolean targetStickingOutOfBuilding, int nDamage) Scale thenDamagebased on if the unit is inside a building, partially sticking out of it, or not.- Parameters:
entityTarget-bldg-targetStickingOutOfBuilding-nDamage-- Returns:
- adjusted
nDamage
-