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 Details

    • cares

      boolean cares(GamePhase phase)
      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

      default boolean producesReportThisPhase(GamePhase phase)
      Whether this handler will add report content (not just internal bookkeeping) when handle() 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 to true; handlers with silent phases override it.
      Parameters:
      phase - The current game phase
      Returns:
      true if a report body will be produced this phase, false if the handler is silent this phase
    • handle

      boolean handle(GamePhase phase, Vector<Report> vPhaseReports)
      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 phase
      vPhaseReports - 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 the nDamage based on if the unit is inside a building, partially sticking out of it, or not.
      Parameters:
      entityTarget -
      bldg -
      targetStickingOutOfBuilding -
      nDamage -
      Returns:
      adjusted nDamage