Class TWGameManager

java.lang.Object
megamek.server.AbstractGameManager
megamek.server.totalWarfare.TWGameManager
All Implemented Interfaces:
IGameManager

public class TWGameManager extends AbstractGameManager
Manages the Game and processes player actions.
  • Constructor Details

  • Method Details

    • getMainPhaseReport

      public Vector<Report> getMainPhaseReport()
    • sendNewSpecialReportsTo

      public void sendNewSpecialReportsTo(int playerId)
      Sends the given player the phase reports added since they last received a mid-phase special report, so an interruption shows only what is new rather than replaying the phase so far.
      Parameters:
      playerId - the player to bring up to date
    • sendNewSpecialReportsTo

      public void sendNewSpecialReportsTo(Iterable<Integer> playerIds)
      Sends each of the given players the phase reports they have not received yet.
      Parameters:
      playerIds - the player ids to bring up to date; repeats are harmless
    • resolveCrewConsciousness

      public Vector<Report> resolveCrewConsciousness()
    • setDamageManager

      public void setDamageManager(TWDamageManager damageManager)
    • getDamageManager

      @Deprecated(since="0.51.0", forRemoval=true) public TWDamageManager getDamageManager()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getCommandList

      public List<ServerCommand> getCommandList(Server server)
    • getGame

      public Game getGame()
      Returns:
      The current game instance.
    • hexEditHandler

      public HexEditHandler hexEditHandler()
      Returns:
      the handler that applies a gamemaster's edits to a single hex, created on first use for the same reason as lobbyBoardHandler()
    • buildingEditHandler

      public BuildingEditHandler buildingEditHandler()
      Returns:
      the handler that applies a gamemaster's edits to a building, created on first use for the same reason as lobbyBoardHandler()
    • setGame

      public void setGame(IGame game)
      Description copied from interface: IGameManager
      Sets the current game instance.
    • resetGame

      public void resetGame()
      Reset the game back to the lounge.
    • requestGameMaster

      public void requestGameMaster(Player player)
    • getGameMasterPoll

      @Nullable public Poll getGameMasterPoll()
      Returns:
      the open vote on granting a player the gamemaster role, or null when none is running
    • startGameMasterVote

      public void startGameMasterVote(Player requester)
      Opens a vote on granting the requester the gamemaster role, one request at a time. Every human player with a team may vote; the requester starts having voted yes, so a player alone in the game passes at once. There is no time limit: the vote stands until it is decided or the requester cancels it.
      Parameters:
      requester - the player asking for the gamemaster role
    • castGameMasterVote

      public void castGameMasterVote(Player voter, boolean inFavor)
      Casts a player's vote in the running gamemaster vote and applies the outcome once it is decided. Players who became eligible after the vote was called are taken in as voters here, so a vote never resolves past them.
      Parameters:
      voter - the player voting
      inFavor - true to vote yes, false to vote no
    • cancelGameMasterVote

      public void cancelGameMasterVote(Player player)
      Cancels the running gamemaster vote. Only the player who called the vote may cancel it.
      Parameters:
      player - the player asking to cancel
    • getGameMaster

      @Nullable public Player getGameMaster()
      Returns the player currently holding the Game Master role. Only one player may hold the role at a time.
      Returns:
      the current Game Master, or null if there is none
    • setGameMaster

      public void setGameMaster(Player player, boolean gameMaster)
    • setSingleBlind

      public void setSingleBlind(Player player, boolean singleBlind)
    • setStartingPosition

      public void setStartingPosition(Player player, int startingPos)
      Sets which edge of the board a player's units arrive from.

      The zone is read when a unit deploys, so this affects whatever has not arrived yet and leaves anything already on the board where it stands.

      Parameters:
      player - The player whose deployment zone to set
      startingPos - The zone, as an index into IStartingPositions
    • setSeeAll

      public void setSeeAll(Player player, boolean seeAll)
    • requestTeamChangeForPlayer

      public void requestTeamChangeForPlayer(int teamID, Player player)
      request the change of a player from a team to another
      Parameters:
      teamID - Team ID to request a change to.
      player - Player requesting change.
    • allowTeamChange

      public void allowTeamChange()
    • isTeamChangeRequestInProgress

      public boolean isTeamChangeRequestInProgress()
    • getPlayerRequestingTeamChange

      public Player getPlayerRequestingTeamChange()
    • getRequestedTeam

      public int getRequestedTeam()
    • disconnect

      public void disconnect(Player player)
      Description copied from interface: IGameManager
      Handles housekeeping for a disconnected player. Removes player from the game in the lounge or victory phase, or during other phases if the player has no units. Otherwise, the player becomes a ghost.
      Parameters:
      player - The player that disconnected.
    • checkForObservers

      public void checkForObservers()
      Checks each player to see if he has no entities, and if true, sets the observer flag for that player. An exception is that there are no observers during the lounge phase.
    • removeAllEntitiesOwnedBy

      public void removeAllEntitiesOwnedBy(Player player)
    • sendCurrentInfo

      public void sendCurrentInfo(int connId)
      Sends a player the info they need to look at the current phase. This is triggered when a player first connects to the server.
      Parameters:
      connId - The id of the player to update
    • sendEntities

      public void sendEntities(int connId)
      Resend entities to the player called by SeeAll command
    • handleCfrPacket

      public void handleCfrPacket(Server.ReceivedPacket rp)
      Description copied from interface: IGameManager
      Handle CFR packets. //TODO: This concerns multi-threaded code and should be centralized!
      Parameters:
      rp - the CFR packet returned from a client
    • handlePacket

      public void handlePacket(int connId, Packet packet)
      Description copied from interface: IGameManager
      Handles all incoming packets. When overriding this, super() should normally be called to have the base implementation of AbstractGameManager handle packets.
      Specified by:
      handlePacket in interface IGameManager
      Overrides:
      handlePacket in class AbstractGameManager
      Parameters:
      connId - The connection ID = player ID the packet came from
      packet - The packet to process
    • cleanupCustomDZs

      public void cleanupCustomDZs()
      Worker function that goes through all the units and players and sets any custom deployment zones that do not exist in the current map settings to the default.
    • decrementASEWTurns

      public void decrementASEWTurns()
      Called during the end phase. Checks each entity for ASEW effects counters and decrements them by 1 if greater than 0
    • forceVictory

      public void forceVictory(Player victor, boolean endImmediately, boolean ignorePlayerVotes)
      Forces victory for the specified player, or his/her team at the end of the round.
    • checkReady

      protected void checkReady()
      Description copied from class: AbstractGameManager
      Called when a player declares that they are "done". By default, this method advances to the next phase, if
      - all non-ghost, non-observer players are done,
      - the present phase does not use turns (e.g. if it's a report phase), and
      - we are not in an empty lobby (= no units at all).
      In other circumstances, ending the current phase is triggered elsewhere. Note that specifically, ghost players are not checked for their status here so the game can advance through non-turn (report) phases even with ghost players.
      Overrides:
      checkReady in class AbstractGameManager
    • prepareForCurrentPhase

      protected void prepareForCurrentPhase()
      Description copied from class: AbstractGameManager
      Prepares for the game's current phase. This typically involves resetting the states of units in the game and making sure the clients have the information they need for the new phase.
      Specified by:
      prepareForCurrentPhase in class AbstractGameManager
    • executeCurrentPhase

      protected void executeCurrentPhase()
      Description copied from class: AbstractGameManager
      Do anything we need to work through the current phase, such as give a turn to the first player to play.
      Specified by:
      executeCurrentPhase in class AbstractGameManager
    • calculatePlayerInitialCounts

      public void calculatePlayerInitialCounts()
      Description copied from interface: IGameManager
      Calculates and sets any initial unit counts and BV/PV for all players, and thus should only be called at the start of a game. The initial values are supposed to be stored for later comparison so that BV or unit losses over the course of the game can be calculated.
    • checkEntityExchange

      public void checkEntityExchange()
      loop through entities in the exchange phase (i.e. after leaving chat lounge) and do any actions that need to be done
    • endCurrentPhase

      protected void endCurrentPhase()
      Description copied from class: AbstractGameManager
      Ends this phase and moves on to the next.
      Specified by:
      endCurrentPhase in class AbstractGameManager
    • sendTagInfoReset

      public void sendTagInfoReset()
    • skipCurrentTurn

      public void skipCurrentTurn()
      Skips the current turn. This only makes sense in phases that have turns. Operates by finding an entity to move and then doing nothing with it.
    • isTurnSkippable

      public boolean isTurnSkippable()
      Returns true if the current turn may be skipped. Ghost players' turns are skippable, and a turn should be skipped if there's nothing to move.
    • victory

      public boolean victory()
      Returns true if victory conditions have been met. Victory conditions are when there is only one player left with meks or only one team. will also add some reports to reporting
    • applyBoardSettings

      public void applyBoardSettings()
      Applies board settings. This loads and combines all the boards that were specified into one mega-board and sets that board as current. Surprise board picks are resolved into the game's map settings so that the settings record the board that is actually played.
    • loadUnit

      public void loadUnit(Entity loader, Entity unit, int bayNumber)
      Have the loader load the indicated unit. The unit being loaded loses its turn.
      Parameters:
      loader - - the Entity that is loading the unit.
      unit - - the Entity being loaded.
    • dropUnit

      public void dropUnit(Entity drop, Entity entity, Coords curPos, int altitude)
    • processLeaveMap

      public Vector<Report> processLeaveMap(MovePath movePath)
      Processes a flee movement action.
      Parameters:
      movePath - The move path which resulted in the entity leaving the map
      Returns:
      Vector of turn reports.
    • processLeaveMap

      public Vector<Report> processLeaveMap(MovePath movePath, boolean flewOff, int returnable)
      Processes any flee movement actions, including flying an aero off the map.
      Parameters:
      movePath - The move path which resulted in an entity leaving the map
      flewOff - When true, this is an aero flying off the map (intentionally or otherwise)
      returnable - the number of rounds until the unit can return to the map (-1 if it can't return)
      Returns:
      Vector of turn reports.
    • handleFlyOffs

      public Vector<Report> handleFlyOffs()
    • processFlyingOff

      protected Report processFlyingOff(Entity entity)
      Compile report for Aerospace unit flying off the map at the end of the round, and finalize the unit's state.
      Parameters:
      entity - Unit leaving the map using Thrust MPs (must implement IAero)
      Returns:
      Report describing the unit flying off the map
    • initializeTrailerCoordinates

      public List<Coords> initializeTrailerCoordinates(Entity tractor, List<Integer> allTowedTrailers)
      Flips the order of a tractor's towed trailers list by index and adds their starting coordinates to a list of hexes the tractor passed through
      Returns:
      Returns the properly sorted list of all train coordinates
    • processTeleguidedMissileCFR

      public int processTeleguidedMissileCFR(int playerId, List<Integer> targetIds, List<Integer> toHitValues) throws InvalidPacketDataException
      Throws:
      InvalidPacketDataException
    • processTAGTargetCFR

      public int processTAGTargetCFR(int playerId, List<Integer> targetIds, List<Integer> targetTypes) throws InvalidPacketDataException
      Throws:
      InvalidPacketDataException
    • deliverThunderAugMinefield

      public void deliverThunderAugMinefield(Coords coords, int playerId, int damage, int entityId)
      Delivers a thunder-aug shot to the targeted hex area. Thunder-Augs are 7 hexes, though, so...
      Parameters:
      damage - The per-hex density of the incoming minefield; that is, the final value with any modifiers (such as halving and rounding just for being T-Aug) already applied.
    • deliverThunderMinefield

      public void deliverThunderMinefield(Coords coords, int playerId, int damage, int entityId)
      Adds a Thunder minefield to the hex.
      Parameters:
      coords - the minefield's coordinates
      playerId - the deploying player's id
      damage - the amount of damage the minefield does
      entityId - an entity that might spot the minefield
    • deliverThunderInfernoMinefield

      public void deliverThunderInfernoMinefield(Coords coords, int playerId, int damage, int entityId)
      Adds a Thunder Inferno minefield to the hex.
      Parameters:
      coords - the minefield's coordinates
      playerId - the deploying player's id
      damage - the amount of damage the minefield does
      entityId - an entity that might spot the minefield
    • deliverFASCAMMinefield

      public void deliverFASCAMMinefield(Coords coords, int playerId, int damage, int entityId)
      Delivers an artillery FASCAM shot to the targeted hex area.
    • deliverThunderActiveMinefield

      public void deliverThunderActiveMinefield(Coords coords, int playerId, int damage, int entityId)
      Adds a Thunder-Active minefield to the hex.
      Parameters:
      coords - the minefield's coordinates
      playerId - the deploying player's id
      damage - the amount of damage the minefield does
      entityId - an entity that might spot the minefield
    • deliverThunderVibraMinefield

      public void deliverThunderVibraMinefield(Coords coords, int playerId, int damage, int sensitivity, int entityId)
      Adds a Thunder-Vibrabomb minefield to the hex.
    • deliverThunderEMPMinefield

      public void deliverThunderEMPMinefield(Coords coords, int playerId, int damage, int setting, int entityId)
      Adds an EMP minefield to the hex, as deployed by a vehicular or battle armor mine dispenser (TO:AUE p.177).
      Parameters:
      coords - the minefield's coordinates
      playerId - the deploying player's id
      damage - the amount of damage the minefield does
      setting - the weight threshold (in tons) that triggers the mine
      entityId - an entity that might spot the minefield
    • deliverArtilleryFlare

      public void deliverArtilleryFlare(Coords coords, int radius)
      Creates an artillery flare of the given radius above the target
    • deliverMortarFlare

      public void deliverMortarFlare(Coords coords, int boardId, int duration)
    • deliverMissileSmoke

      public void deliverMissileSmoke(Coords coords, int smokeType, Vector<Report> vPhaseReport)
      deliver missile smoke
      Parameters:
      coords - the Coords where to deliver
    • deliverSmokeGrenade

      public void deliverSmokeGrenade(Coords coords, Vector<Report> vPhaseReport)
    • deliverSmokeMortar

      public void deliverSmokeMortar(Coords coords, Vector<Report> vPhaseReport, int duration)
    • deliverChaffGrenade

      public void deliverChaffGrenade(Coords coords, Vector<Report> vPhaseReport)
    • deliverArtillerySmoke

      public void deliverArtillerySmoke(Coords coords, Vector<Report> vPhaseReport)
      deliver artillery smoke
      Parameters:
      coords - the Coords where to deliver
    • deliverLISmoke

      public void deliverLISmoke(Coords coords, Vector<Report> vPhaseReport)
      deliver LASER inhibiting smoke
      Parameters:
      coords - the Coords where to deliver
    • deliverArtilleryInferno

      public Vector<Integer> deliverArtilleryInferno(Coords coords, Entity ae, int subjectId, Vector<Report> vPhaseReport)
      deliver artillery inferno
      Parameters:
      coords - the Coords where to deliver
      ae - the attacking entity
      subjectId - the int id of the target
    • deliverScreen

      public void deliverScreen(Coords coords, Vector<Report> vPhaseReport)
    • deployTeleMissile

      public void deployTeleMissile(Entity ae, WeaponType weaponType, AmmoType ammoType, int wId, int capMisMod, int damage, int armor, Vector<Report> vPhaseReport)
      deploys a new telemissile entity onto the map
    • deliverInfernoMissiles

      public Vector<Report> deliverInfernoMissiles(Entity ae, Targetable t, int missiles)
      deliver inferno missiles
      Parameters:
      ae - the Entity that fired the missiles
      t - the Targetable that is the target
      missiles - the int amount of missiles
    • deliverInfernoMissiles

      public Vector<Report> deliverInfernoMissiles(Entity ae, Targetable t, int missiles, boolean areaEffect)
      deliver inferno missiles
      Parameters:
      ae - the Entity that fired the missiles
      t - the Targetable that is the target
      missiles - the int amount of missiles
      areaEffect - a boolean indicating whether the attack is from an area effect weapon such as Arrow IV inferno, and partial cover should be ignored.
    • deliverInfernoMissiles

      public Vector<Report> deliverInfernoMissiles(Entity ae, Targetable t, int missiles, int called)
      deliver inferno missiles
      Parameters:
      ae - the Entity that fired the missiles
      t - the Targetable that is the target
      missiles - the int amount of missiles
      called - an int indicated the aiming mode used to fire the inferno missiles (for called shots)
    • deliverInfernoMissiles

      public Vector<Report> deliverInfernoMissiles(Entity ae, Targetable t, int missiles, int called, boolean areaEffect)
      deliver inferno missiles
      Parameters:
      ae - the Entity that fired the missiles
      t - the Targetable that is the target
      missiles - the int amount of missiles
      called - an int indicated the aiming mode used to fire the inferno missiles (for called shots)
      areaEffect - a boolean indicating whether the attack is from an area effect weapon such as Arrow IV inferno, and partial cover should be ignored.
    • handlePitfall

      public boolean handlePitfall(Entity entity, Coords dest, Vector<Report> vMineReport)
      Handles an entity stepping on a pit trap. Returns true if the entity entering the hex fell over
    • handleTripwire

      public boolean handleTripwire(Entity entity, Coords src, Coords dest, EntityMovementType movementType, Vector<Report> vMineReport)
      Handles an entity stepping on a tripwire. Returns true if the entity entering the hex fell over Assumes that src != dest
    • clearMinefield

      public boolean clearMinefield(Minefield mf, Entity en, int target, Vector<Report> vClearReport)
      attempt to clear a minefield
      Parameters:
      mf - - a Minefield to clear
      en - - entity doing the clearing
      target - - int needed to roll for a successful clearance
      Returns:
      true if clearance successful
    • clearMinefield

      public boolean clearMinefield(Minefield mf, Entity en, int target, int botch, Vector<Report> vClearReport)
    • clearMinefield

      public boolean clearMinefield(Minefield mf, Entity en, int target, int botch, Vector<Report> vClearReport, int indent)
      attempt to clear a minefield We don't actually remove the minefield here, because if this is called up from within a loop, that will cause problems
      Parameters:
      mf - - a Minefield to clear
      en - - entity doing the clearing
      target - - int needed to roll for a successful clearance
      botch - - int that indicates an accidental detonation
      vClearReport - - The report collection to report to
      indent - - The number of indents for the report
      Returns:
      true if clearance successful
    • removeMinefield

      public void removeMinefield(Minefield mf)
      Removes the minefield from the game.
      Parameters:
      mf - The Minefield to remove
    • revealMinefield

      public void revealMinefield(Team team, Minefield mf)
      Reveals a minefield for all players on a team.
      Parameters:
      team - The team whose minefield should be revealed
      mf - The Minefield to be revealed
    • revealMinefield

      public void revealMinefield(Player player, Minefield mf)
      Reveals a minefield for a specific player If on a team, does it for the whole team. Otherwise, just the player.
    • addMovementHeat

      public void addMovementHeat()
      Add heat from the movement phase. Delegates to HeatResolver, which itemizes the heat sources using the common message bundle (the HeatBreakdown.* keys live there).
    • doSetLocationsExposure

      public Vector<Report> doSetLocationsExposure(Entity entity, Hex hex, boolean isJump, int elevation)
      Set the LocationsExposure of an entity
      Parameters:
      entity - The Entity who's exposure is being set
      hex - The Hex the entity is in
      isJump - a boolean value whether the entity is jumping
      elevation - the elevation the entity should be at.
    • assignTeleMissileAMS

      public void assignTeleMissileAMS(TeleMissileAttackAction taa)
      Determine which telemissile attack actions could be affected by AMS, and assign AMS to those attacks.
    • assignAMS

      public void assignAMS()
      Determine which missile attack actions could be affected by AMS, and assign AMS (and APDS) to those attacks.
    • assignAMS

      public void assignAMS(Vector<AttackHandler> attacksVector, boolean handleArtillery)
    • tryIgniteHex

      public boolean tryIgniteHex(Coords c, int boardId, int entityId, boolean bHotGun, boolean bInferno, TargetRoll nTargetRoll, boolean bReportAttempt, int accidentTarget, Vector<Report> vPhaseReport)
      Try to ignite the hex, taking into account existing fires and the effects of Inferno rounds.
      Parameters:
      c - - the Coords of the hex being lit.
      entityId - - the int id of the entity involved.
      bHotGun - - true if the weapon is plasma/flamer/incendiary LRM/etc
      bInferno - - true if the weapon igniting the hex is an Inferno round. If some other weapon or ammo is causing the roll, this should be false.
      nTargetRoll - - the TargetRoll for the ignition roll.
      bReportAttempt - - true if the attempt roll should be added to the report.
      accidentTarget - - int the target number below which a roll has to be made in order to try igniting a hex accidentally. -1 for intentional
    • tryIgniteHex

      public boolean tryIgniteHex(Coords c, int boardId, int entityId, boolean bHotGun, boolean bInferno, TargetRoll nTargetRoll, int accidentTarget, Vector<Report> vPhaseReport)
      Try to ignite the hex, taking into account existing fires and the effects of Inferno rounds. This version of the method will not report the attempt roll.
      Parameters:
      c - - the Coords of the hex being lit.
      entityId - - the int id of the entity involved.
      bInferno - - true if the weapon igniting the hex is an Inferno round. If some other weapon or ammo is causing the roll, this should be false.
      nTargetRoll - - the int roll target for the attempt.
    • tryClearHex

      public Vector<Report> tryClearHex(Coords c, int nDamage, int entityId)
    • tryClearHex

      public Vector<Report> tryClearHex(Coords c, int boardId, int nDamage, int entityId)
    • checkRandomAeroMovement

      public void checkRandomAeroMovement(Entity entity, int hotDogMod)
    • checkForFlamingDamage

      public void checkForFlamingDamage()
      Checks to see if any non-mek units are standing in fire. Called at the end of the movement phase
    • damageCrew

      public Vector<Report> damageCrew(Entity en, int damage)
      Inflict damage on a pilot
      Parameters:
      en - The Entity who's pilot gets damaged.
      damage - The int amount of damage.
    • damageCrew

      public Vector<Report> damageCrew(Entity en, int damage, int crewPos)
      Inflict damage on a pilot
      Parameters:
      en - The Entity who's pilot gets damaged.
      damage - The int amount of damage.
      crewPos - The intposition of the crew member in a MultiCrewCockpit that takes the damage. A value < 0 applies the damage to all crew members. The basic Crew ignores this value.
    • damageEntity

      public Vector<Report> damageEntity(Entity te, HitData hit, int damage)
      Deals the listed damage to an entity. Returns a vector of Reports for the phase report
      Parameters:
      te - the target entity
      hit - the hit data for the location hit
      damage - the damage to apply
      Returns:
      a Vector of Reports
    • damageEntity

      public Vector<Report> damageEntity(Entity te, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS)
      Deals the listed damage to an entity. Returns a vector of Reports for the phase report
      Parameters:
      te - the target entity
      hit - the hit data for the location hit
      damage - the damage to apply
      ammoExplosion - ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereens
      bFrag - The DamageType of the attack.
      damageIS - Should the target location's internal structure be damaged directly?
      Returns:
      a Vector of Reports
    • damageEntity

      public Vector<Report> damageEntity(Entity te, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty)
      Deals the listed damage to an entity. Returns a vector of Reports for the phase report
      Parameters:
      te - the target entity
      hit - the hit data for the location hit
      damage - the damage to apply
      ammoExplosion - ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereens
      bFrag - The DamageType of the attack.
      damageIS - Should the target location's internal structure be damaged directly?
      areaSatArty - Is the damage from an area saturating artillery attack?
      Returns:
      a Vector of Reports
    • damageEntity

      public Vector<Report> damageEntity(Entity te, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty, boolean throughFront)
      Deals the listed damage to an entity. Returns a vector of Reports for the phase report
      Parameters:
      te - the target entity
      hit - the hit data for the location hit
      damage - the damage to apply
      ammoExplosion - ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereens
      bFrag - The DamageType of the attack.
      damageIS - Should the target location's internal structure be damaged directly?
      areaSatArty - Is the damage from an area saturating artillery attack?
      throughFront - Is the damage coming through the hex the unit is facing?
      Returns:
      a Vector of Reports
    • damageEntity

      public Vector<Report> damageEntity(Entity te, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty, boolean throughFront, boolean underWater)
      Deals the listed damage to an entity. Returns a vector of Reports for the phase report
      Parameters:
      te - the target entity
      hit - the hit data for the location hit
      damage - the damage to apply
      ammoExplosion - ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereens
      bFrag - The DamageType of the attack.
      damageIS - Should the target location's internal structure be damaged directly?
      areaSatArty - Is the damage from an area saturating artillery attack?
      throughFront - Is the damage coming through the hex the unit is facing?
      underWater - Is the damage coming from an underwater attack
      Returns:
      a Vector of Reports
    • damageEntity

      public Vector<Report> damageEntity(Entity te, HitData hit, int damage, boolean ammoExplosion, DamageType damageType, boolean damageIS, boolean areaSatArty, boolean throughFront, boolean underWater, boolean nukeS2S)
      Deals the listed damage to an entity. Returns a vector of Reports for the phase report
      Parameters:
      te - the target entity
      hit - the hit data for the location hit
      damage - the damage to apply
      ammoExplosion - ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereens
      damageType - The DamageType of the attack.
      damageIS - Should the target location's internal structure be damaged directly?
      areaSatArty - Is the damage from an area saturating artillery attack?
      throughFront - Is the damage coming through the hex the unit is facing?
      underWater - Is the damage coming from an underwater attack?
      nukeS2S - is this a ship-to-ship nuke?
      Returns:
      a Vector of Reports
    • doBoobyTrapExplosion

      public void doBoobyTrapExplosion(int engineRating, Coords position, Vector<Report> vDesc, Vector<Integer> vUnits)
      Extract explosion functionality for generalized explosions in areas.
    • doFusionEngineExplosion

      public void doFusionEngineExplosion(double engineRating, BoardLocation location, Vector<Report> vDesc, Vector<Integer> vUnits)
      Extract explosion functionality for generalized explosions in areas.
    • doExplosion

      public void doExplosion(int damage, int degradation, boolean autoDestroyInSameHex, Coords position, boolean allowShelter, Vector<Report> vDesc, Vector<Integer> vUnits, int excludedUnitId, boolean canDamageVtol)
    • doExplosion

      public void doExplosion(int damage, int degradation, boolean autoDestroyInSameHex, Coords position, int boardId, boolean allowShelter, Vector<Report> vDesc, Vector<Integer> vUnits, int excludedUnitId, boolean canDamageVtol)
      General function to cause explosions in areas.
    • doExplosion

      public void doExplosion(int[] damages, boolean autoDestroyInSameHex, Coords position, int boardId, boolean allowShelter, Vector<Report> vDesc, Vector<Integer> vUnits, int clusterAmt, int excludedUnitId, boolean engineExplosion, boolean canDamageVtol)
      General function to cause explosions in areas. TODO Luana: Refactor this function so it is less of a mess
    • canShelter

      public boolean canShelter(Coords entityPosition, int boardId, Coords position, int entityAbsHeight)
      Check if an Entity of the passed height can find shelter from a nuke blast
      Parameters:
      entityPosition - the Coords the Entity is at
      position - the Coords of the explosion
      entityAbsHeight - the int height of the entity
      Returns:
      a boolean value indicating if the entity of the given height can find shelter
    • addScheduledNuke

      public void addScheduledNuke(int[] nuke)
      add a nuke to be exploded in the next weapons attack phase
      Parameters:
      nuke - this is an int[] with i=0 and i=1 being X and Y coordinates respectively, If the input array is length 3, then i=2 is NukeType (from HS:3070) If the input array is length 6, then i=2 is the base damage dealt, i=3 is the degradation, i=4 is the secondary radius, and i=5 is the crater depth
    • addScheduledOrbitalBombardment

      public void addScheduledOrbitalBombardment(OrbitalBombardment orbitalBombardment)
      add an orbital bombardment to hit the board in the next weapons attack phase
      Parameters:
      orbitalBombardment - this is an #OrbitalBombardment object, its immutable and must be constructed through its builder.
    • drawNukeHitOnBoard

      public void drawNukeHitOnBoard(Coords coord)
    • drawNukeHitOnBoard

      public void drawNukeHitOnBoard(int[] nukeArgs)
    • doNuclearExplosion

      public void doNuclearExplosion(Coords position, int nukeType, Vector<Report> vDesc)
      do a nuclear explosion
      Parameters:
      position - the position that will be hit by the nuke
      nukeType - the type of nuke
      vDesc - a vector that contains the output report
    • doOrbitalBombardment

      public void doOrbitalBombardment(Coords position, int damage, int radius)
      do an orbital bombardment
      Parameters:
      position - the position that will be hit by the orbital bombardment
      damage - the damage to the bombardment at target hex
      radius - the radius which the damage will hit
    • doNuclearExplosion

      public void doNuclearExplosion(Coords position, int baseDamage, int degradation, int secondaryRadius, int craterDepth, Vector<Report> vDesc)
      explode a nuke
      Parameters:
      position - the position that will be hit by the nuke
      baseDamage - the base damage from the blast
      degradation - how fast the blast's power degrades
      secondaryRadius - the secondary blast radius
      craterDepth - the depth of the crater created by the blast
      vDesc - a vector that contains the output report
    • applySecondaryNuclearEffects

      public void applySecondaryNuclearEffects(Entity entity, Coords position, Vector<Report> vDesc)
      Handles secondary effects from nuclear blasts against all units in range.
      Parameters:
      entity - The entity to affect.
      position - The coordinates of the nuclear blast, for to-hit directions.
      vDesc - a description vector to use for reports.
    • applyCriticalHit

      public Vector<Report> applyCriticalHit(Entity en, int loc, CriticalSlot cs, boolean secondaryEffects, int damageCaused, boolean isCapital)
      Apply a single critical hit. The following private member of Server are accessed from this function, preventing it from being factored out of the Server class: destroyEntity() destroyLocation() checkEngineExplosion() damageCrew() explodeEquipment() game
      Parameters:
      en - the Entity that is being damaged. This value may not be null.
      loc - the int location of critical hit. This value may be Entity.NONE for hits to Tanks and for hits to a Protomek torso weapon.
      cs - the CriticalSlot being damaged. This value may not be null. For critical hits on a Tank, the index of the slot should be the index of the critical hit table.
      secondaryEffects - the boolean flag that indicates whether to allow critical hits to cause secondary effects (such as triggering an ammo explosion, sending hovercraft to watery graves, or damaging ProtoMek torso weapons). This value is normally true, but it will be false when the hit is being applied from a saved game or scenario.
      damageCaused - the amount of damage causing this critical.
      isCapital - whether it was capital scale damage that caused critical
    • criticalEntity

      public Vector<Report> criticalEntity(Entity en, int loc, boolean isRear, int critMod, int damage)
      Rolls and resolves critical hits with a die roll modifier.
    • criticalEntity

      public Vector<Report> criticalEntity(Entity en, int loc, boolean isRear, int critMod, int damage, DamageType damageType)
      Rolls and resolves critical hits with a die roll modifier.
    • oneCriticalEntity

      public Vector<Report> oneCriticalEntity(Entity en, int loc, boolean isRear, int damage)
      Rolls one critical hit
    • criticalEntity

      public Vector<Report> criticalEntity(Entity en, int loc, boolean isRear, int critMod, boolean rollNumber, boolean isCapital, int damage)
      Rolls and resolves critical hits on meks or vehicles. if rollNumber is false, a single hit is applied - needed for MaxTech Heat Scale rule.
    • criticalEntity

      public Vector<Report> criticalEntity(Entity en, int loc, boolean isRear, int critMod, boolean rollNumber, boolean isCapital, int damage, DamageType damageType)
      Rolls and resolves critical hits on meks or vehicles. if rollNumber is false, a single hit is applied - needed for MaxTech Heat Scale rule.
    • breachCheck

      public Vector<Report> breachCheck(Entity entity, int loc, Hex hex)
      Checks for location breach and returns phase logging.

      Parameters:
      entity - the Entity that needs to be checked.
      loc - the int location on the entity that needs to be checked for a breach.
      hex - the Hex the entity occupies when checking. This value will be null if the check is the result of an attack, and non-null if it occurs during movement.
    • destroyEntity

      public Vector<Report> destroyEntity(Entity entity, String reason)
      Mark the unit as destroyed! Units transported in the destroyed unit will get a chance to escape.
      Parameters:
      entity - - the Entity that has been destroyed.
      reason - - a String detailing why the entity was destroyed.
      Returns:
      a Vector of Report objects that can be sent to the output log.
    • destroyEntity

      public Vector<Report> destroyEntity(Entity entity, String reason, boolean survivable)
      Marks a unit as destroyed! Units transported inside the destroyed unit will get a chance to escape unless the destruction was not survivable.
      Parameters:
      entity - - the Entity that has been destroyed.
      reason - - a String detailing why the entity was destroyed.
      survivable - - a boolean that identifies the destruction as unsurvivable for transported units.
      Returns:
      a Vector of Report objects that can be sent to the output log.
    • destroyEntity

      public Vector<Report> destroyEntity(Entity entity, String reason, boolean survivable, boolean canSalvage)
      Marks a unit as destroyed! Units transported inside the destroyed unit will get a chance to escape unless the destruction was not survivable.
      Parameters:
      entity - - the Entity that has been destroyed.
      reason - - a String detailing why the entity was destroyed.
      survivable - - a boolean that identifies the destruction as unsurvivable for transported units.
      canSalvage - - a boolean that indicates if the unit can be salvaged (or cannibalized for spare parts). If true, salvage operations are possible, if false, the unit is too badly damaged.
      Returns:
      a Vector of Report objects that can be sent to the output log.
    • destroyTransportedUnits

      protected void destroyTransportedUnits(Entity entity, int condition, boolean survivable, Vector<Report> vDesc)
      Helper function that handles destroying units transported by a unit that is itself being destroyed.
      Parameters:
      entity - Carrier unit
      condition - int representing the salvage state of destroyed units
      survivable - boolean indicating whether carried units have any chance to avoid destruction themselves
      vDesc - Vector of Reports
    • destroyCarriedUnit

      protected void destroyCarriedUnit(Entity carrier, Entity passenger, int condition, int reportId, Vector<Report> vDesc)
      Helper to execute reporting and destruction of a carried unit
      Parameters:
      carrier - The transporting entity
      passenger - The unit to be destroyed
      condition - IEntityRemovalConditions (which governs if passenger is recoverable)
      reportId - Which report to use
      vDesc - Report vector to which this report will be added.
    • findLegalDismount

      @Nullable protected Coords findLegalDismount(Entity carrier, Entity loadedEntity, List<Coords> candidateCoords)
      Attempt to find a safe evacuation hex per the rules for destroyed carriers on TW pg 90. Non-aerospace units causing stacking violations have to try to move out to an adjacent hex. Predicate: candidateCoords are arranged in center-out ring order so that minimum-displacement is maintained
      Parameters:
      carrier - Destroyed
      loadedEntity - Entity trying to escape this calamity.
      candidateCoords - Pre-determined set of coordinates to disembark into.
      Returns:
      Coords, or null if no legal.
    • explodeEquipment

      public Vector<Report> explodeEquipment(Entity en, int loc, Mounted<?> mounted)
      Explodes a piece of equipment on the unit.
    • explodeEquipment

      public Vector<Report> explodeEquipment(Entity en, int loc, Mounted<?> mounted, boolean overrideExplosiveCheck)
      Makes a piece of equipment on a mek explode! POW! This expects either ammo, or an explosive weapon. Returns a vector of Report objects. Possible to override 'is explosive' check
    • explodeAmmoFromHeat

      public Vector<Report> explodeAmmoFromHeat(Entity entity)
      Makes one slot of ammo, determined by certain rules, explode on a mek.
    • checkIgnition

      public boolean checkIgnition(Coords c, int boardId, TargetRoll roll, boolean bInferno, int entityId, Vector<Report> vPhaseReport)
      Checks for fire ignition based on a given target roll. If successful, lights a fire also checks to see that fire is possible in the specified hex.
      Parameters:
      c - - the Coords to be lit.
      roll - - the TargetRoll for the ignition roll
      bInferno - - true if the fire is an inferno fire. If this value is false the hex will be lit only if it contains Woods, jungle or a Building.
      entityId - - the entityId responsible for the ignite attempt. If the value is Entity.NONE, then the roll attempt will not be included in the report.
    • checkIgnition

      public boolean checkIgnition(Coords c, int boardId, TargetRoll roll)
      Returns true if the hex is set on fire with the specified roll. Of course, also checks to see that fire is possible in the specified hex. This version of the method will not report the attempt roll.
      Parameters:
      c - - the Coords to be lit.
      roll - - the int target number for the ignition roll
    • ignite

      public void ignite(Coords c, int fireLevel, Vector<Report> vReport)
    • ignite

      public void ignite(Coords c, int boardId, int fireLevel, Vector<Report> vReport)
      add fire to a hex
      Parameters:
      c - - the Coords of the hex to be set on fire
      fireLevel - - The level of fire, see Terrains
    • removeFire

      public void removeFire(int boardId, Coords fireCoords, String reason)
      Removes the fire from a hex on a specific board, clearing any flamer-started-fire marker and notifying the clients that view that board. Fire processing runs once per board (see FireProcessor), so the board id must be passed through to keep the per-board Board.removeFlamerStartedFire(Coords) state and the hex update on the correct board.
      Parameters:
      boardId - the id of the board the burning hex is on
      fireCoords - Coords of the hex on fire
      reason - reason to remove the fire
    • removeFire

      @Deprecated(since="0.51.0", forRemoval=true) public void removeFire(Coords fireCoords, String reason)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 0.51.0, use removeFire(int, Coords, String) so the fire and the per-board flamer-started-fire marker are cleared on the correct board in multi-board games. This overload only affects board 0.
      Removes the fire from a hex on the first board.
      Parameters:
      fireCoords - Coords of the hex on fire.
      reason - Reason to remove the fire.
    • addSmoke

      public void addSmoke(List<Coords> coords, Board board, boolean bInferno)
      Called when a fire is burning. Called 3 times per fire hex.
      Parameters:
      coords - The Coords x-coordinate of the hex
    • getBoardSizes

      public static Set<BoardDimensions> getBoardSizes()
      Get a list of the available board sizes from the boards data directory.
      Returns:
      A Set containing all the available board sizes.
    • entityUpdate

      public void entityUpdate(int nEntityID)
      In a double-blind game, update only visible entities. Otherwise, update everyone
    • entityUpdate

      public void entityUpdate(int nEntityID, Vector<UnitLocation> movePath, boolean updateVisibility, Map<UnitTargetPair,LosEffects> losCache)
      In a double-blind game, update only visible entities. Otherwise, update everyone
      Parameters:
      updateVisibility - Flag that determines if whoCanSee needs to be called to update who can see the entity for double-blind games.
    • createSpecialReportPacket

      @Deprecated(since="0.51.01", forRemoval=true) public Packet createSpecialReportPacket()
      Deprecated, for removal: This API element is subject to removal in a future version.
      this sends the whole phase report accumulated so far, so a second mid-phase interruption re-sends everything the first one already delivered. Use sendNewSpecialReportsTo(int) to send a player only what is new, or createSpecialReportPacket(Vector) to send an explicit set of reports.
      Creates a packet containing a Vector of special Reports which needs to be sent during a phase that is not a report phase.
    • createSpecialReportPacket

      public Packet createSpecialReportPacket(Vector<Report> reports)
      Creates a packet containing a specific Vector of Reports which needs to be sent during a phase that is not a report phase. Use this when you want to send only specific reports (e.g., EMP mine detonation) rather than all accumulated reports.
      Parameters:
      reports - The specific reports to include in the packet
    • createFullEntitiesPacket

      public Packet createFullEntitiesPacket()
      Creates a packet containing all current and out-of-game entities
    • sendSmokeCloudAdded

      public void sendSmokeCloudAdded(SmokeCloud cloud)
    • sendTemporaryECMFieldAdded

      public void sendTemporaryECMFieldAdded(TemporaryECMField field)
    • sendSyncTemporaryECMFields

      public void sendSyncTemporaryECMFields()
      Sends all temporary ECM fields to clients, replacing their existing list. Called after expired fields are removed to sync client state.
    • sendChangedHex

      public void sendChangedHex(Coords coords)
      Sends notification to clients that the specified hex has changed. LEGACY - replace with the boardId version
    • sendChangedHex

      public void sendChangedHex(Coords coords, int boardId)
    • sendChangedHexes

      public void sendChangedHexes()
      Sends notification to clients that the specified hex has changed.
    • sendChangedMines

      public void sendChangedMines(Coords coords)
      Sends notification to clients that the specified hex has changed.
    • sendVisibilityIndicator

      public void sendVisibilityIndicator(Entity e)
    • sendNovaChange

      public void sendNovaChange(int id, String net)
      Send a packet to all connected clients.
    • checkExplodeIndustrialZone

      @Deprecated(since="0.51.0", forRemoval=true) public void checkExplodeIndustrialZone(Coords coords, Vector<Report> vDesc)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • checkExplodeIndustrialZone

      public void checkExplodeIndustrialZone(Coords c, int boardId, Vector<Report> vDesc)
      checks for unintended explosion of heavy industrial zone hex and applies damage to entities occupying the hex
    • damageInfantryIn

      public Vector<Report> damageInfantryIn(IBuilding bldg, int damage, Coords hexCoords)
    • damageInfantryIn

      public Vector<Report> damageInfantryIn(IBuilding bldg, int damage, Coords hexCoords, int infDamageClass)
      Apply the correct amount of damage that passes on to any infantry unit in the given building, based upon the amount of damage the building just sustained. This amount is a percentage dictated by pg. 172 of TW.
      Parameters:
      bldg - - the Building that sustained the damage.
      damage - - the int amount of damage.
    • checkForCollapse

      public boolean checkForCollapse(IBuilding bldg, Map<BoardLocation,List<Entity>> positionMap, Coords coords, boolean checkBecauseOfDamage, Vector<Report> vPhaseReport)
      Determine if the given building should collapse. If so, inflict the appropriate amount of damage on each entity in the building and update the clients. If the building does not collapse, determine if any entities crash through its floor into its basement. Again, apply appropriate damage.
      Parameters:
      bldg - the Building being checked. This value should not be null.
      positionMap - a Hashtable that maps the Coords positions or each unit in the game to a Vector of Entity's at that position. This value should not be null.
      coords - the Coords of the building hex to be checked
      Returns:
      true if the building collapsed.
    • collapseBuilding

      public void collapseBuilding(IBuilding building, Map<BoardLocation,List<Entity>> positionMap, Coords coords, Vector<Report> vPhaseReport)
      Collapse one hex of a building that can no longer stand, such as a building hex burned down to a Construction Factor of 0. Damages and drops whatever is inside, on top of or in the basement of that hex, replaces the hex with rubble and updates the clients.
      Parameters:
      building - the Building that is coming down. This value should not be null.
      positionMap - a map of the Coords positions of each unit in the game to the Entitys at that position. May be empty when no unit is on the board.
      coords - the Coords of the building hex that is coming down
      vPhaseReport - the current phase reports to attach new reports to
    • checkForCollapse

      public boolean checkForCollapse(IBuilding bldg, Coords coords, boolean checkBecauseOfDamage, Vector<Report> vPhaseReport)
      Determine if the given building should collapse. If so, inflict the appropriate amount of damage on each entity in the building and update the clients. If the building does not collapse, determine if any entities crash through its floor into its basement. Again, apply appropriate damage.
      Parameters:
      bldg - the Building being checked. This value should not be null.
      coords - the Coords of the building hex to be checked
      Returns:
      true if the building collapsed.
    • damageBuilding

      public Vector<Report> damageBuilding(IBuilding bldg, int damage, Coords coords)
    • damageBuilding

      public Vector<Report> damageBuilding(IBuilding bldg, int damage, Coords coords, int level)
      Apply the given amount of damage to the building. Please note, this method does not apply any damage to units inside the building, update the clients, or check for the building's collapse.

      A default message will be used to describe why the building took the damage.

      Parameters:
      bldg - - the Building that has been damaged. This value should not be null, but no exception will occur.
      damage - - the int amount of damage.
      coords - - the Coords of the building hex to be damaged
      level - - the absolute level where the damage is dealt
      Returns:
      a Report to be shown to the players.
    • damageBuilding

      public Vector<Report> damageBuilding(IBuilding bldg, int damage, String why, Coords coords)
    • damageBuilding

      public Vector<Report> damageBuilding(IBuilding bldg, int damage, String why, Coords coords, int level)
      Apply the given amount of damage to the building. Please note, this method does not apply any damage to units inside the building, update the clients, or check for the building's collapse.
      Parameters:
      bldg - - the Building that has been damaged. This value should not be null, but no exception will occur.
      damage - - the int amount of damage.
      why - - the String message that describes why the building took the damage.
      coords - - the Coords of the building hex to be damaged
      level - - the level at which the damage occurred (defaults to 0)
      Returns:
      a Report to be shown to the players.
    • sendNewBuildings

      public void sendNewBuildings(Vector<IBuilding> buildings)
    • sendChangedBuildings

      public void sendChangedBuildings(Vector<IBuilding> buildings)
    • sendRemovedBuildings

      public void sendRemovedBuildings(Vector<IBuilding> buildings)
    • creditKill

      public void creditKill(Entity target, @Nullable Entity attacker)
      Credits a Kill for an entity, if the target got killed.
      Parameters:
      target - The Entity that got killed.
      attacker - The Entity that did the killing, which may be null
    • ejectEntity

      public Vector<Report> ejectEntity(Entity entity, boolean autoEject)
      Eject an Entity.
      Parameters:
      entity - The Entity to eject.
      autoEject - The boolean state of the entity's auto-ejection system
      Returns:
      a Vector of report objects for the game log.
    • ejectEntity

      public Vector<Report> ejectEntity(Entity entity, boolean autoEject, boolean skin_of_the_teeth)
      Eject an Entity.
      Parameters:
      entity - The Entity to eject.
      autoEject - The boolean state of the entity's auto-ejection system
      skin_of_the_teeth - Perform a skin of the teeth ejection
      Returns:
      a Vector of report objects for the game log.
    • ejectSpacecraft

      public Vector<Report> ejectSpacecraft(Aero entity, boolean inSpace, boolean airborne, Coords pos)
      Abandon a spacecraft (large or small).
      Parameters:
      entity - The Aero to eject.
      inSpace - Is this ship spaceborne?
      airborne - Is this ship in atmospheric flight?
      pos - The coords of this ejection. Needed when abandoning a grounded ship
      Returns:
      a Vector of report objects for the game log.
    • getEjectModifiers

      public static PilotingRollData getEjectModifiers(Game game, Entity entity, int crewPos, boolean autoEject)
    • getEjectModifiers

      public static PilotingRollData getEjectModifiers(Game game, Entity entity, int crewPos, boolean autoEject, Coords targetCoords, String desc)
    • resolveCallSupport

      public void resolveCallSupport()
      Creates a new Ballistic Infantry unit at the end of the movement phase
    • abandonEntity

      public Vector<Report> abandonEntity(Entity entity)
      Abandon an Entity.
      Parameters:
      entity - The Entity to abandon.
      Returns:
      a Vector of report objects for the game log.
    • launchCombatVehicleEscapePod

      public Vector<Report> launchCombatVehicleEscapePod(Tank tank, Coords chosenLandingHex)
      Launches a Combat Vehicle Escape Pod per TO:AUE p.121.

      The crew attempts to escape via the CVEP: 1. Piloting Skill Roll +2 for launch 2. Pod travels up to 4 hexes directly behind the vehicle 3. Landing roll (MekWarrior Ejection roll) +2 4. Each failed roll results in one crewman taking a hit 5. Surviving crew become conventional foot infantry 6. Vehicle is destroyed (Crew Killed result)

      Parameters:
      tank - The Tank launching the escape pod
      Returns:
      Vector of Reports for the game log
    • exitEscapePod

      public Vector<Report> exitEscapePod(CombatVehicleEscapePod pod)
      Handles crew exiting a Combat Vehicle Escape Pod. Per TO:AUE p.121, crew can exit the pod as conventional foot infantry, or remain inside if in water/toxic environment.
      Parameters:
      pod - The escape pod being exited
      Returns:
      Vector of Reports for the game log
    • announceUnitAbandonment

      public Vector<Report> announceUnitAbandonment(Entity entity)
      Announces that a unit will abandon during the next End Phase. For Meks (TacOps:AR p.165): Must be prone and shutdown. For Vehicles (TacOps): Can be abandoned anytime.
      Parameters:
      entity - the unit announcing abandonment
      Returns:
      a Vector of reports for the game log
    • vehicleMotiveDamage

      public Vector<Report> vehicleMotiveDamage(Tank te, int modifier)
    • addReport

      public void addReport(Vector<Report> reports)
      Add a whole lotta Reports to the players report queues as well as the Master report queue vPhaseReport.
    • addReport

      public void addReport(Vector<Report> reports, int indents)
      Add a whole lotta Reports to the players report queues as well as the Master report queue vPhaseReport, indenting each report by the passed value.
    • addReport

      public void addReport(ReportEntry report)
      Add a single report to the report queue of all players and the master vPhaseReport queue
    • doAssaultDrop

      public void doAssaultDrop(Entity entity)
      resolve the landing of an assault drop
      Parameters:
      entity - the Entity for which to resolve it
    • doMagmaDamage

      public void doMagmaDamage(Entity en, boolean eruption)
      do damage from magma
      Parameters:
      en - the affected Entity
      eruption - boolean indicating whether this is because of an eruption
    • doHazardousLiquidDamage

      public void doHazardousLiquidDamage(Entity en, boolean eruption, int depth)
      do damage from hazardous liquids
      Parameters:
      en - the affected Entity
      eruption - boolean indicating whether this is because of an eruption (geyser)
      depth - How deep is the hazardous liquid?
    • doUltraSublevelDamage

      public void doUltraSublevelDamage(Entity entity)
    • doGreenSmokeDamage

      public Vector<Report> doGreenSmokeDamage(Entity entity)
      Applies damage to any eligible unit hit by anti-TSM missiles or entering a hex with green smoke.
      Parameters:
      entity - An entity subject to anti-TSM damage
      Returns:
      The damage reports
    • artilleryDamageHex

      public Vector<Integer> artilleryDamageHex(Coords coords, int boardId, Coords attackSource, int damage, AmmoType ammo, int subjectId, Entity killer, Entity exclude, boolean flak, int altitude, int targetLevel, Vector<Report> vPhaseReport, boolean asfFlak, Vector<Integer> alreadyHit, boolean variableDamage, DamageFalloff falloff)
      deal area saturation damage to an individual hex
      Parameters:
      coords - The hex being hit
      attackSource - The location the attack came from. For hit table resolution
      damage - Amount of damage to deal to each entity
      ammo - The ammo type being used
      subjectId - Subject for reports
      killer - Who should be credited with kills
      exclude - Entity that should take no damage (used for homing splash)
      flak - Flak, hits flying units only, instead of flyers being immune
      altitude - Absolute altitude for flak attack
      vPhaseReport - The Vector of Reports for the phase report
      asfFlak - Is this flak against ASF?
      alreadyHit - a vector of unit ids for units that have already been hit that will be ignored
      variableDamage - if true, treat damage as the number of six-sided dice to roll
    • artilleryDamageArea

      public Vector<Integer> artilleryDamageArea(Coords centre, AmmoType ammo, int subjectId, Entity killer, boolean flak, int altitude, boolean mineClear, Vector<Report> vPhaseReport, boolean asfFlak)
      deal area saturation damage to the map, used for artillery
      Parameters:
      centre - The hex on which damage is centred
      ammo - The ammo type doing the damage
      subjectId - Subject for reports
      killer - Who should be credited with kills
      flak - Flak, hits flying units only, instead of flyers being immune
      altitude - Absolute altitude for flak attack
      mineClear - Does this clear mines?
      vPhaseReport - The Vector of Reports for the phase report
      asfFlak - Is this flak against ASF?
    • artilleryDamageArea

      public Vector<Integer> artilleryDamageArea(Coords centre, AmmoType ammo, int subjectId, Entity killer, DamageFalloff falloff, boolean flak, int altitude, Vector<Report> vPhaseReport, boolean asfFlak)
    • artilleryDamageArea

      public Vector<Integer> artilleryDamageArea(Coords centre, int boardId, AmmoType ammo, int subjectId, Entity killer, DamageFalloff falloff, boolean flak, int altitude, Vector<Report> vPhaseReport, boolean asfFlak)
      Deals area-saturation damage to an area of the board. Used for artillery, bombs, or anything else with linear decrease in damage
      Parameters:
      centre - The hex on which damage is centred
      ammo - The ammo type doing the damage
      subjectId - Subject for reports
      killer - Who should be credited with kills
      falloff - Lightweight class describing base damage, falloff per level/ring, cluster y/n, and radius
      flak - Flak, hits flying units only, instead of flyers being immune
      altitude - Absolute altitude/elevation for flak attack
      vPhaseReport - The Vector of Reports for the phase report
      asfFlak - Is this flak against ASF?
    • deliverBombDamage

      public Vector<Integer> deliverBombDamage(HexTarget targetHex, BombType.BombTypeEnum type, int subjectId, Entity killer, Vector<Report> vPhaseReport)
    • deliverBombInferno

      public Vector<Integer> deliverBombInferno(Coords coords, Entity ae, int subjectId, Vector<Report> vPhaseReport)
      deliver inferno bomb
      Parameters:
      coords - the Coords where to deliver
      ae - the attacking entity
      subjectId - the int id of the target
    • sendToast

      public void sendToast(GameToastEvent.Level level, String message, @Nullable Entity entity)
      Sends a transient toast notification to all clients, to be shown on the board view. Use for high-signal one-shot events (such as a fortification completing) that warrant more emphasis than a routine report line, without flooding the player with a toast per report entry.
      Parameters:
      level - the severity of the toast
      message - the (already localized) text to display
      entity - the acting unit whose icon should accompany the toast, or null for a text-only toast
    • sendMagneticPulseToast

      public void sendMagneticPulseToast(Entity target, boolean improved, boolean applied)
      Sends a toast when a unit gains or loses a Magnetic Pulse missile effect (IO p.182 / IMP rules), so the player sees the debuff appear and expire rather than only in the report log.
      Parameters:
      target - the affected unit
      improved - true for the iATM Improved Magnetic Pulse effect, false for the standard MP effect
      applied - true when the unit becomes affected, false when the effect wears off
    • sendArtilleryNetToast

      public void sendArtilleryNetToast(String momentKey, Entity firingEntity, int momentRound)
      Sends a single artillery call-for-fire toast (Shot / Splash / Rounds complete) to the firing player and their teammates only. Delegates to ArtilleryNotifications.sendArtilleryNetToast(java.lang.String, megamek.common.units.Entity, int).
      Parameters:
      momentKey - the call-for-fire moment (Artillery.netToast.<momentKey>)
      firingEntity - the artillery unit (its owner and team define the audience)
      momentRound - the round the moment occurs in, used to scope de-duplication
    • sendArtilleryNetToast

      public void sendArtilleryNetToast(String momentKey, Entity firingEntity, int momentRound, @Nullable String targetGrid)
      Sends a single artillery call-for-fire toast naming the target grid, to the firing player and their teammates only. The grid is the team-only channel for the aim point. Delegates to ArtilleryNotifications.sendArtilleryNetToast(String, Entity, int, String).
      Parameters:
      momentKey - the call-for-fire moment (Artillery.netToast.<momentKey>)
      firingEntity - the artillery unit (its owner and team define the audience)
      momentRound - the round the moment occurs in, used to scope de-duplication
      targetGrid - the target grid square to name in the toast (team-only), or null for none
    • sendCounterBatteryObservedToast

      public void sendCounterBatteryObservedToast(Entity observer, Entity enemyBattery, Coords impactHex, int momentRound)
      Sends a radio-flavored counter-battery toast to the team that just spotted an enemy off-board battery's fall of shot. Delegates to ArtilleryNotifications.sendCounterBatteryObservedToast(megamek.common.units.Entity, megamek.common.units.Entity, megamek.common.board.Coords, int).
      Parameters:
      observer - the friendly unit that observed the enemy battery's fall of shot
      enemyBattery - the off-board enemy battery that was spotted
      impactHex - the hex the enemy rounds landed on (what the observer saw)
      momentRound - the round the observation happens in, used to scope de-duplication
    • remindHomingArtilleryInbound

      public void remindHomingArtilleryInbound()
      Reminds each team with a homing artillery round landing next round to put a TAG on the target. Delegates to ArtilleryNotifications.remindHomingArtilleryInbound().
    • createSmoke

      public void createSmoke(Coords coords, int level, int duration)
      create a SmokeCloud object and add it to the server list LEGACY - use real board id
      Parameters:
      coords - the location to create the smoke
      level - 1=Light 2=Heavy Smoke 3:light LI smoke 4: Heavy LI smoke
      duration - How long the smoke will last.
    • createSmoke

      public void createSmoke(Coords coords, Board board, int level, int duration)
    • createSmoke

      public void createSmoke(List<Coords> coords, Board board, int level, int duration)
      create a SmokeCloud object and add it to the server list
      Parameters:
      coords - the location to create the smoke
      level - 1=Light 2=Heavy Smoke 3:light LI smoke 4: Heavy LI smoke
      duration - duration How long the smoke will last.
    • removeSmokeTerrain

      public void removeSmokeTerrain(SmokeCloud cloud)
      remove a cloud from the map
      Parameters:
      cloud - the location to remove the smoke from
    • getSmokeCloudList

      public List<SmokeCloud> getSmokeCloudList()
    • getAirborneVTOLForSand

      public Vector<Integer> getAirborneVTOLForSand(Team team)
      Cycle through entities on team and collect all the airborne VTOL/WIGE vehicles Only vehicles can be affected by Blowing Sand (TO:AR 6th Ed. pg. 60)
      Returns:
      a vector of relevant entity ids
    • getHexUpdateSet

      public Set<BoardLocation> getHexUpdateSet()
    • sendGroundObjectUpdate

      public void sendGroundObjectUpdate()
      Convenience function to send a ground object update.
    • sendIndustrialElevatorUpdate

      public void sendIndustrialElevatorUpdate()
      Sends industrial elevator state to all clients.