Package megamek.server.totalWarfare
Class TWGameManager
java.lang.Object
megamek.server.AbstractGameManager
megamek.server.totalWarfare.TWGameManager
- All Implemented Interfaces:
IGameManager
Manages the Game and processes player actions.
-
Field Summary
Fields inherited from class megamek.server.AbstractGameManager
autoSaveService, packetHelper, saveHandler, scriptedEventHelper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabandonEntity(Entity entity) Abandon an Entity.voidAdd heat from the movement phase.voidAdd a whole lotta Reports to the players report queues as well as the Master report queue vPhaseReport.voidAdd a whole lotta Reports to the players report queues as well as the Master report queue vPhaseReport, indenting each report by the passed value.voidaddReport(ReportEntry report) Add a single report to the report queue of all players and the master vPhaseReport queuevoidaddScheduledNuke(int[] nuke) add a nuke to be exploded in the next weapons attack phasevoidaddScheduledOrbitalBombardment(OrbitalBombardment orbitalBombardment) add an orbital bombardment to hit the board in the next weapons attack phasevoidCalled when a fire is burning.voidannounceUnitAbandonment(Entity entity) Announces that a unit will abandon during the next End Phase.voidApplies board settings.applyCriticalHit(Entity en, int loc, CriticalSlot cs, boolean secondaryEffects, int damageCaused, boolean isCapital) Apply a single critical hit.voidapplySecondaryNuclearEffects(Entity entity, Coords position, Vector<Report> vDesc) Handles secondary effects from nuclear blasts against all units in range.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.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 artilleryartilleryDamageArea(Coords centre, AmmoType ammo, int subjectId, Entity killer, DamageFalloff falloff, boolean flak, int altitude, Vector<Report> vPhaseReport, boolean asfFlak) 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 hexvoidDetermine which missile attack actions could be affected by AMS, and assign AMS (and APDS) to those attacks.voidassignAMS(Vector<AttackHandler> attacksVector, boolean handleArtillery) voidDetermine which telemissile attack actions could be affected by AMS, and assign AMS to those attacks.breachCheck(Entity entity, int loc, Hex hex) Checks for location breach and returns phase logging.voidCalculates and sets any initial unit counts and BV/PV for all players, and thus should only be called at the start of a game.voidcancelGameMasterVote(Player player) Cancels the running gamemaster vote.booleancanShelter(Coords entityPosition, int boardId, Coords position, int entityAbsHeight) Check if an Entity of the passed height can find shelter from a nuke blastvoidcastGameMasterVote(Player voter, boolean inFavor) Casts a player's vote in the running gamemaster vote and applies the outcome once it is decided.voidloop through entities in the exchange phase (i.e.voidcheckExplodeIndustrialZone(Coords c, int boardId, Vector<Report> vDesc) checks for unintended explosion of heavy industrial zone hex and applies damage to entities occupying the hexvoidcheckExplodeIndustrialZone(Coords coords, Vector<Report> vDesc) Deprecated, for removal: This API element is subject to removal in a future version.booleancheckForCollapse(IBuilding bldg, Map<BoardLocation, List<Entity>> positionMap, Coords coords, boolean checkBecauseOfDamage, Vector<Report> vPhaseReport) Determine if the given building should collapse.booleancheckForCollapse(IBuilding bldg, Coords coords, boolean checkBecauseOfDamage, Vector<Report> vPhaseReport) Determine if the given building should collapse.voidChecks to see if any non-mek units are standing in fire.voidChecks each player to see if he has no entities, and if true, sets the observer flag for that player.booleancheckIgnition(Coords c, int boardId, TargetRoll roll) Returns true if the hex is set on fire with the specified roll.booleancheckIgnition(Coords c, int boardId, TargetRoll roll, boolean bInferno, int entityId, Vector<Report> vPhaseReport) Checks for fire ignition based on a given target roll.voidcheckRandomAeroMovement(Entity entity, int hotDogMod) protected voidCalled when a player declares that they are "done".voidWorker 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.booleanclearMinefield(Minefield mf, Entity en, int target, int botch, Vector<Report> vClearReport) booleanclearMinefield(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 problemsbooleanclearMinefield(Minefield mf, Entity en, int target, Vector<Report> vClearReport) attempt to clear a minefieldvoidcollapseBuilding(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.Creates a packet containing all current and out-of-game entitiesvoidcreateSmoke(List<Coords> coords, Board board, int level, int duration) create aSmokeCloudobject and add it to the server listvoidcreateSmoke(Coords coords, int level, int duration) create aSmokeCloudobject and add it to the server list LEGACY - use real board idvoidcreateSmoke(Coords coords, Board board, int level, int duration) 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.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.voidcreditKill(Entity target, Entity attacker) Credits a Kill for an entity, if the target got killed.criticalEntity(Entity en, int loc, boolean isRear, int critMod, boolean rollNumber, boolean isCapital, int damage) Rolls and resolves critical hits on meks or vehicles.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.criticalEntity(Entity en, int loc, boolean isRear, int critMod, int damage) Rolls and resolves critical hits with a die roll modifier.criticalEntity(Entity en, int loc, boolean isRear, int critMod, int damage, DamageType damageType) Rolls and resolves critical hits with a die roll modifier.damageBuilding(IBuilding bldg, int damage, String why, Coords coords) damageBuilding(IBuilding bldg, int damage, String why, Coords coords, int level) Apply the given amount of damage to the building.damageBuilding(IBuilding bldg, int damage, Coords coords) damageBuilding(IBuilding bldg, int damage, Coords coords, int level) Apply the given amount of damage to the building.damageCrew(Entity en, int damage) Inflict damage on a pilotdamageCrew(Entity en, int damage, int crewPos) Inflict damage on a pilotdamageEntity(Entity te, HitData hit, int damage) Deals the listed damage to an entity.damageEntity(Entity te, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS) Deals the listed damage to an entity.damageEntity(Entity te, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty) Deals the listed damage to an entity.damageEntity(Entity te, HitData hit, int damage, boolean ammoExplosion, DamageType bFrag, boolean damageIS, boolean areaSatArty, boolean throughFront) Deals the listed damage to an entity.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.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.damageInfantryIn(IBuilding bldg, int damage, Coords hexCoords) 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.voidCalled during the end phase.voiddeliverArtilleryFlare(Coords coords, int radius) Creates an artillery flare of the given radius above the targetdeliverArtilleryInferno(Coords coords, Entity ae, int subjectId, Vector<Report> vPhaseReport) deliver artillery infernovoiddeliverArtillerySmoke(Coords coords, Vector<Report> vPhaseReport) deliver artillery smokedeliverBombDamage(HexTarget targetHex, BombType.BombTypeEnum type, int subjectId, Entity killer, Vector<Report> vPhaseReport) deliverBombInferno(Coords coords, Entity ae, int subjectId, Vector<Report> vPhaseReport) deliver inferno bombvoiddeliverChaffGrenade(Coords coords, Vector<Report> vPhaseReport) voiddeliverFASCAMMinefield(Coords coords, int playerId, int damage, int entityId) Delivers an artillery FASCAM shot to the targeted hex area.deliverInfernoMissiles(Entity ae, Targetable t, int missiles) deliver inferno missilesdeliverInfernoMissiles(Entity ae, Targetable t, int missiles, boolean areaEffect) deliver inferno missilesdeliverInfernoMissiles(Entity ae, Targetable t, int missiles, int called) deliver inferno missilesdeliverInfernoMissiles(Entity ae, Targetable t, int missiles, int called, boolean areaEffect) deliver inferno missilesvoiddeliverLISmoke(Coords coords, Vector<Report> vPhaseReport) deliver LASER inhibiting smokevoiddeliverMissileSmoke(Coords coords, int smokeType, Vector<Report> vPhaseReport) deliver missile smokevoiddeliverMortarFlare(Coords coords, int boardId, int duration) voiddeliverScreen(Coords coords, Vector<Report> vPhaseReport) voiddeliverSmokeGrenade(Coords coords, Vector<Report> vPhaseReport) voiddeliverSmokeMortar(Coords coords, Vector<Report> vPhaseReport, int duration) voiddeliverThunderActiveMinefield(Coords coords, int playerId, int damage, int entityId) Adds a Thunder-Active minefield to the hex.voiddeliverThunderAugMinefield(Coords coords, int playerId, int damage, int entityId) Delivers a thunder-aug shot to the targeted hex area.voiddeliverThunderEMPMinefield(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).voiddeliverThunderInfernoMinefield(Coords coords, int playerId, int damage, int entityId) Adds a Thunder Inferno minefield to the hex.voiddeliverThunderMinefield(Coords coords, int playerId, int damage, int entityId) Adds a Thunder minefield to the hex.voiddeliverThunderVibraMinefield(Coords coords, int playerId, int damage, int sensitivity, int entityId) Adds a Thunder-Vibrabomb minefield to the hex.voiddeployTeleMissile(Entity ae, WeaponType weaponType, AmmoType ammoType, int wId, int capMisMod, int damage, int armor, Vector<Report> vPhaseReport) deploys a new telemissile entity onto the mapprotected voiddestroyCarriedUnit(Entity carrier, Entity passenger, int condition, int reportId, Vector<Report> vDesc) Helper to execute reporting and destruction of a carried unitdestroyEntity(Entity entity, String reason) Mark the unit as destroyed! Units transported in the destroyed unit will get a chance to escape.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.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.protected voiddestroyTransportedUnits(Entity entity, int condition, boolean survivable, Vector<Report> vDesc) Helper function that handles destroying units transported by a unit that is itself being destroyed.voiddisconnect(Player player) Handles housekeeping for a disconnected player.voiddoAssaultDrop(Entity entity) resolve the landing of an assault dropvoiddoBoobyTrapExplosion(int engineRating, Coords position, Vector<Report> vDesc, Vector<Integer> vUnits) Extract explosion functionality for generalized explosions in areas.voiddoExplosion(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.voiddoExplosion(int damage, int degradation, boolean autoDestroyInSameHex, Coords position, boolean allowShelter, Vector<Report> vDesc, Vector<Integer> vUnits, int excludedUnitId, boolean canDamageVtol) voiddoExplosion(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.voiddoFusionEngineExplosion(double engineRating, BoardLocation location, Vector<Report> vDesc, Vector<Integer> vUnits) Extract explosion functionality for generalized explosions in areas.doGreenSmokeDamage(Entity entity) Applies damage to any eligible unit hit by anti-TSM missiles or entering a hex with green smoke.voiddoHazardousLiquidDamage(Entity en, boolean eruption, int depth) do damage from hazardous liquidsvoiddoMagmaDamage(Entity en, boolean eruption) do damage from magmavoiddoNuclearExplosion(Coords position, int baseDamage, int degradation, int secondaryRadius, int craterDepth, Vector<Report> vDesc) explode a nukevoiddoNuclearExplosion(Coords position, int nukeType, Vector<Report> vDesc) do a nuclear explosionvoiddoOrbitalBombardment(Coords position, int damage, int radius) do an orbital bombardmentdoSetLocationsExposure(Entity entity, Hex hex, boolean isJump, int elevation) Set the LocationsExposure of an entityvoiddoUltraSublevelDamage(Entity entity) voiddrawNukeHitOnBoard(int[] nukeArgs) voiddrawNukeHitOnBoard(Coords coord) voidejectEntity(Entity entity, boolean autoEject) Eject an Entity.ejectEntity(Entity entity, boolean autoEject, boolean skin_of_the_teeth) Eject an Entity.ejectSpacecraft(Aero entity, boolean inSpace, boolean airborne, Coords pos) Abandon a spacecraft (large or small).protected voidEnds this phase and moves on to the next.voidentityUpdate(int nEntityID) In a double-blind game, update only visible entities.voidentityUpdate(int nEntityID, Vector<UnitLocation> movePath, boolean updateVisibility, Map<UnitTargetPair, LosEffects> losCache) In a double-blind game, update only visible entities.protected voidDo anything we need to work through the current phase, such as give a turn to the first player to play.Handles crew exiting a Combat Vehicle Escape Pod.explodeAmmoFromHeat(Entity entity) Makes one slot of ammo, determined by certain rules, explode on a mek.explodeEquipment(Entity en, int loc, Mounted<?> mounted) Explodes a piece of equipment on the unit.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.protected CoordsfindLegalDismount(Entity carrier, Entity loadedEntity, List<Coords> candidateCoords) Attempt to find a safe evacuation hex per the rules for destroyed carriers on TW pg 90.voidforceVictory(Player victor, boolean endImmediately, boolean ignorePlayerVotes) Forces victory for the specified player, or his/her team at the end of the round.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.static Set<BoardDimensions> Get a list of the available board sizes from the boards data directory.getCommandList(Server server) Deprecated, for removal: This API element is subject to removal in a future version.static PilotingRollDatagetEjectModifiers(Game game, Entity entity, int crewPos, boolean autoEject) static PilotingRollDatagetEjectModifiers(Game game, Entity entity, int crewPos, boolean autoEject, Coords targetCoords, String desc) getGame()Returns the player currently holding the Game Master role.intvoidHandle CFR packets.voidhandlePacket(int connId, Packet packet) Handles all incoming packets.booleanhandlePitfall(Entity entity, Coords dest, Vector<Report> vMineReport) Handles an entity stepping on a pit trap.booleanhandleTripwire(Entity entity, Coords src, Coords dest, EntityMovementType movementType, Vector<Report> vMineReport) Handles an entity stepping on a tripwire.voidadd fire to a hexvoidinitializeTrailerCoordinates(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 throughbooleanbooleanReturns true if the current turn may be skipped.launchCombatVehicleEscapePod(Tank tank, Coords chosenLandingHex) Launches a Combat Vehicle Escape Pod per TO:AUE p.121.voidHave the loader load the indicated unit.oneCriticalEntity(Entity en, int loc, boolean isRear, int damage) Rolls one critical hitprotected voidPrepares for the game's current phase.protected ReportprocessFlyingOff(Entity entity) Compile report for Aerospace unit flying off the map at the end of the round, and finalize the unit's state.processLeaveMap(MovePath movePath) Processes a flee movement action.processLeaveMap(MovePath movePath, boolean flewOff, int returnable) Processes any flee movement actions, including flying an aero off the map.intprocessTAGTargetCFR(int playerId, List<Integer> targetIds, List<Integer> targetTypes) intprocessTeleguidedMissileCFR(int playerId, List<Integer> targetIds, List<Integer> toHitValues) voidReminds each team with a homing artillery round landing next round to put a TAG on the target.voidremoveAllEntitiesOwnedBy(Player player) voidremoveFire(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.voidremoveFire(Coords fireCoords, String reason) Deprecated, for removal: This API element is subject to removal in a future version.since 0.51.0, useremoveFire(int, Coords, String)so the fire and the per-board flamer-started-fire marker are cleared on the correct board in multi-board games.voidRemoves the minefield from the game.voidremoveSmokeTerrain(SmokeCloud cloud) remove a cloud from the mapvoidrequestGameMaster(Player player) voidrequestTeamChangeForPlayer(int teamID, Player player) request the change of a player from a team to anothervoidReset the game back to the lounge.voidCreates a new Ballistic Infantry unit at the end of the movement phasevoidrevealMinefield(Player player, Minefield mf) Reveals a minefield for a specific player If on a team, does it for the whole team.voidrevealMinefield(Team team, Minefield mf) Reveals a minefield for all players on a team.voidsendArtilleryNetToast(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.voidsendArtilleryNetToast(String momentKey, Entity firingEntity, int momentRound, String targetGrid) Sends a single artillery call-for-fire toast naming the target grid, to the firing player and their teammates only.voidsendChangedBuildings(Vector<IBuilding> buildings) voidsendChangedHex(Coords coords) Sends notification to clients that the specified hex has changed.voidsendChangedHex(Coords coords, int boardId) voidSends notification to clients that the specified hex has changed.voidsendChangedMines(Coords coords) Sends notification to clients that the specified hex has changed.voidsendCounterBatteryObservedToast(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.voidsendCurrentInfo(int connId) Sends a player the info they need to look at the current phase.voidsendEntities(int connId) Resend entities to the player called by SeeAll commandvoidConvenience function to send a ground object update.voidSends industrial elevator state to all clients.voidsendMagneticPulseToast(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.voidsendNewBuildings(Vector<IBuilding> buildings) voidsendNewSpecialReportsTo(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.voidsendNewSpecialReportsTo(Iterable<Integer> playerIds) Sends each of the given players the phase reports they have not received yet.voidsendNovaChange(int id, String net) Send a packet to all connected clients.voidsendRemovedBuildings(Vector<IBuilding> buildings) voidsendSmokeCloudAdded(SmokeCloud cloud) voidSends all temporary ECM fields to clients, replacing their existing list.voidvoidvoidsendToast(GameToastEvent.Level level, String message, Entity entity) Sends a transient toast notification to all clients, to be shown on the board view.voidvoidsetDamageManager(TWDamageManager damageManager) voidSets the currentgameinstance.voidsetGameMaster(Player player, boolean gameMaster) voidvoidsetSingleBlind(Player player, boolean singleBlind) voidsetStartingPosition(Player player, int startingPos) Sets which edge of the board a player's units arrive from.voidSkips the current turn.voidstartGameMasterVote(Player requester) Opens a vote on granting the requester the gamemaster role, one request at a time.tryClearHex(Coords c, int nDamage, int entityId) tryClearHex(Coords c, int boardId, int nDamage, int entityId) booleantryIgniteHex(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.booleantryIgniteHex(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.vehicleMotiveDamage(Tank te, int modifier) booleanvictory()Returns true if victory conditions have been met.Methods inherited from class megamek.server.AbstractGameManager
autoSave, changePhase, getAutoSaveService, getPacketHelper, incrementAndSendGameRound, isEmptyLobby, saveGame, send, send, sendChat, sendChat, sendCurrentTurns, sendGhostSkipMessage, sendPhaseChange, sendSaveGame, sendServerChat, sendServerChat, transmitAllPlayerDones, transmitAllPlayerUpdates, transmitPlayerUpdateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface megamek.server.IGameManager
saveGame
-
Constructor Details
-
TWGameManager
public TWGameManager() -
TWGameManager
-
-
Method Details
-
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
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
-
setDamageManager
-
getDamageManager
Deprecated, for removal: This API element is subject to removal in a future version. -
getCommandList
-
getGame
- Returns:
- The current
gameinstance.
-
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
- Returns:
- the handler that applies a gamemaster's edits to a building, created on first use for the same reason as
lobbyBoardHandler()
-
setGame
Description copied from interface:IGameManagerSets the currentgameinstance. -
resetGame
public void resetGame()Reset the game back to the lounge. -
requestGameMaster
-
getGameMasterPoll
- Returns:
- the open vote on granting a player the gamemaster role, or
nullwhen none is running
-
startGameMasterVote
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
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 votinginFavor-trueto vote yes,falseto vote no
-
cancelGameMasterVote
Cancels the running gamemaster vote. Only the player who called the vote may cancel it.- Parameters:
player- the player asking to cancel
-
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
nullif there is none
-
setGameMaster
-
setSingleBlind
-
setStartingPosition
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 setstartingPos- The zone, as an index intoIStartingPositions
-
setSeeAll
-
requestTeamChangeForPlayer
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
-
getRequestedTeam
public int getRequestedTeam() -
disconnect
Description copied from interface:IGameManagerHandles 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
-
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
Description copied from interface:IGameManagerHandle CFR packets. //TODO: This concerns multi-threaded code and should be centralized!- Parameters:
rp- the CFR packet returned from a client
-
handlePacket
Description copied from interface:IGameManagerHandles all incoming packets. When overriding this, super() should normally be called to have the base implementation of AbstractGameManager handle packets.- Specified by:
handlePacketin interfaceIGameManager- Overrides:
handlePacketin classAbstractGameManager- Parameters:
connId- The connection ID = player ID the packet came frompacket- 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
Forces victory for the specified player, or his/her team at the end of the round. -
checkReady
protected void checkReady()Description copied from class:AbstractGameManagerCalled 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:
checkReadyin classAbstractGameManager
-
prepareForCurrentPhase
protected void prepareForCurrentPhase()Description copied from class:AbstractGameManagerPrepares 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:
prepareForCurrentPhasein classAbstractGameManager
-
executeCurrentPhase
protected void executeCurrentPhase()Description copied from class:AbstractGameManagerDo anything we need to work through the current phase, such as give a turn to the first player to play.- Specified by:
executeCurrentPhasein classAbstractGameManager
-
calculatePlayerInitialCounts
public void calculatePlayerInitialCounts()Description copied from interface:IGameManagerCalculates 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:AbstractGameManagerEnds this phase and moves on to the next.- Specified by:
endCurrentPhasein classAbstractGameManager
-
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
Have the loader load the indicated unit. The unit being loaded loses its turn.- Parameters:
loader- - theEntitythat is loading the unit.unit- - theEntitybeing loaded.
-
dropUnit
-
processLeaveMap
Processes a flee movement action.- Parameters:
movePath- The move path which resulted in the entity leaving the map- Returns:
- Vector of turn reports.
-
processLeaveMap
Processes any flee movement actions, including flying an aero off the map.- Parameters:
movePath- The move path which resulted in an entity leaving the mapflewOff- 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
-
processFlyingOff
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
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
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
Adds a Thunder minefield to the hex.- Parameters:
coords- the minefield's coordinatesplayerId- the deploying player's iddamage- the amount of damage the minefield doesentityId- an entity that might spot the minefield
-
deliverThunderInfernoMinefield
Adds a Thunder Inferno minefield to the hex.- Parameters:
coords- the minefield's coordinatesplayerId- the deploying player's iddamage- the amount of damage the minefield doesentityId- an entity that might spot the minefield
-
deliverFASCAMMinefield
Delivers an artillery FASCAM shot to the targeted hex area. -
deliverThunderActiveMinefield
Adds a Thunder-Active minefield to the hex.- Parameters:
coords- the minefield's coordinatesplayerId- the deploying player's iddamage- the amount of damage the minefield doesentityId- 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 coordinatesplayerId- the deploying player's iddamage- the amount of damage the minefield doessetting- the weight threshold (in tons) that triggers the mineentityId- an entity that might spot the minefield
-
deliverArtilleryFlare
Creates an artillery flare of the given radius above the target -
deliverMortarFlare
-
deliverMissileSmoke
deliver missile smoke- Parameters:
coords- theCoordswhere to deliver
-
deliverSmokeGrenade
-
deliverSmokeMortar
-
deliverChaffGrenade
-
deliverArtillerySmoke
deliver artillery smoke- Parameters:
coords- theCoordswhere to deliver
-
deliverLISmoke
deliver LASER inhibiting smoke- Parameters:
coords- theCoordswhere to deliver
-
deliverArtilleryInferno
public Vector<Integer> deliverArtilleryInferno(Coords coords, Entity ae, int subjectId, Vector<Report> vPhaseReport) deliver artillery inferno- Parameters:
coords- theCoordswhere to deliverae- the attackingentitysubjectId- theintid of the target
-
deliverScreen
-
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
deliver inferno missiles- Parameters:
ae- theEntitythat fired the missilest- theTargetablethat is the targetmissiles- theintamount of missiles
-
deliverInfernoMissiles
public Vector<Report> deliverInfernoMissiles(Entity ae, Targetable t, int missiles, boolean areaEffect) deliver inferno missiles- Parameters:
ae- theEntitythat fired the missilest- theTargetablethat is the targetmissiles- theintamount of missilesareaEffect- abooleanindicating whether the attack is from an area effect weapon such as Arrow IV inferno, and partial cover should be ignored.
-
deliverInfernoMissiles
deliver inferno missiles- Parameters:
ae- theEntitythat fired the missilest- theTargetablethat is the targetmissiles- theintamount of missilescalled- anintindicated 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- theEntitythat fired the missilest- theTargetablethat is the targetmissiles- theintamount of missilescalled- anintindicated the aiming mode used to fire the inferno missiles (for called shots)areaEffect- abooleanindicating whether the attack is from an area effect weapon such as Arrow IV inferno, and partial cover should be ignored.
-
handlePitfall
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
attempt to clear a minefield- Parameters:
mf- - aMinefieldto clearen- -entitydoing the clearingtarget- -intneeded to roll for a successful clearance- Returns:
trueif clearance successful
-
clearMinefield
-
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- - aMinefieldto clearen- -entitydoing the clearingtarget- -intneeded to roll for a successful clearancebotch- -intthat indicates an accidental detonationvClearReport- - The report collection to report toindent- - The number of indents for the report- Returns:
trueif clearance successful
-
removeMinefield
Removes the minefield from the game.- Parameters:
mf- TheMinefieldto remove
-
revealMinefield
Reveals a minefield for all players on a team.- Parameters:
team- Theteamwhose minefield should be revealedmf- TheMinefieldto be revealed
-
revealMinefield
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 toHeatResolver, which itemizes the heat sources using the common message bundle (theHeatBreakdown.*keys live there). -
doSetLocationsExposure
Set the LocationsExposure of an entity- Parameters:
entity- TheEntitywho's exposure is being sethex- TheHexthe entity is inisJump- abooleanvalue whether the entity is jumpingelevation- the elevation the entity should be at.
-
assignTeleMissileAMS
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
-
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- - theCoordsof the hex being lit.entityId- - theintid of the entity involved.bHotGun- -trueif the weapon is plasma/flamer/incendiary LRM/etcbInferno- -trueif the weapon igniting the hex is an Inferno round. If some other weapon or ammo is causing the roll, this should befalse.nTargetRoll- - theTargetRollfor the ignition roll.bReportAttempt- -trueif the attempt roll should be added to the report.accidentTarget- -intthe 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- - theCoordsof the hex being lit.entityId- - theintid of the entity involved.bInferno- -trueif the weapon igniting the hex is an Inferno round. If some other weapon or ammo is causing the roll, this should befalse.nTargetRoll- - theintroll target for the attempt.
-
tryClearHex
-
tryClearHex
-
checkRandomAeroMovement
-
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
Inflict damage on a pilot- Parameters:
en- TheEntitywho's pilot gets damaged.damage- Theintamount of damage.
-
damageCrew
Inflict damage on a pilot- Parameters:
en- TheEntitywho's pilot gets damaged.damage- Theintamount of damage.crewPos- Theintposition of the crew member in aMultiCrewCockpitthat takes the damage. A value < 0 applies the damage to all crew members. The basicCrewignores this value.
-
damageEntity
Deals the listed damage to an entity. Returns a vector of Reports for the phase report- Parameters:
te- the target entityhit- the hit data for the location hitdamage- the damage to apply- Returns:
- a
VectorofReports
-
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 entityhit- the hit data for the location hitdamage- the damage to applyammoExplosion- ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereensbFrag- The DamageType of the attack.damageIS- Should the target location's internal structure be damaged directly?- Returns:
- a
VectorofReports
-
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 entityhit- the hit data for the location hitdamage- the damage to applyammoExplosion- ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereensbFrag- 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
VectorofReports
-
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 entityhit- the hit data for the location hitdamage- the damage to applyammoExplosion- ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereensbFrag- 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
VectorofReports
-
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 entityhit- the hit data for the location hitdamage- the damage to applyammoExplosion- ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereensbFrag- 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
VectorofReports
-
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 entityhit- the hit data for the location hitdamage- the damage to applyammoExplosion- ammo explosion type damage is applied directly to the IS, hurts the pilot, causes auto-ejects, and can blow the unit to smithereensdamageType- 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
VectorofReports
-
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
-
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
Check if an Entity of the passed height can find shelter from a nuke blast- Parameters:
entityPosition- theCoordsthe Entity is atposition- theCoordsof the explosionentityAbsHeight- theintheight of the entity- Returns:
- a
booleanvalue 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
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
-
drawNukeHitOnBoard
public void drawNukeHitOnBoard(int[] nukeArgs) -
doNuclearExplosion
do a nuclear explosion- Parameters:
position- the position that will be hit by the nukenukeType- the type of nukevDesc- a vector that contains the output report
-
doOrbitalBombardment
do an orbital bombardment- Parameters:
position- the position that will be hit by the orbital bombardmentdamage- the damage to the bombardment at target hexradius- 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 nukebaseDamage- the base damage from the blastdegradation- how fast the blast's power degradessecondaryRadius- the secondary blast radiuscraterDepth- the depth of the crater created by the blastvDesc- a vector that contains the output report
-
applySecondaryNuclearEffects
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- theEntitythat is being damaged. This value may not benull.loc- theintlocation of critical hit. This value may beEntity.NONEfor hits toTanks and for hits to aProtomektorso weapon.cs- theCriticalSlotbeing damaged. This value may not benull. For critical hits on aTank, the index of the slot should be the index of the critical hit table.secondaryEffects- thebooleanflag 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 normallytrue, but it will befalsewhen 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
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
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
Checks for location breach and returns phase logging.- Parameters:
entity- theEntitythat needs to be checked.loc- theintlocation on the entity that needs to be checked for a breach.hex- theHexthe entity occupies when checking. This value will benullif the check is the result of an attack, and non-null if it occurs during movement.
-
destroyEntity
Mark the unit as destroyed! Units transported in the destroyed unit will get a chance to escape.- Parameters:
entity- - theEntitythat has been destroyed.reason- - aStringdetailing why the entity was destroyed.- Returns:
- a
VectorofReportobjects that can be sent to the output log.
-
destroyEntity
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- - theEntitythat has been destroyed.reason- - aStringdetailing why the entity was destroyed.survivable- - abooleanthat identifies the destruction as unsurvivable for transported units.- Returns:
- a
VectorofReportobjects 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- - theEntitythat has been destroyed.reason- - aStringdetailing why the entity was destroyed.survivable- - abooleanthat identifies the destruction as unsurvivable for transported units.canSalvage- - abooleanthat indicates if the unit can be salvaged (or cannibalized for spare parts). Iftrue, salvage operations are possible, iffalse, the unit is too badly damaged.- Returns:
- a
VectorofReportobjects 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 unitcondition- int representing the salvage state of destroyed unitssurvivable- boolean indicating whether carried units have any chance to avoid destruction themselvesvDesc- 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 entitypassenger- The unit to be destroyedcondition- IEntityRemovalConditions (which governs if passenger is recoverable)reportId- Which report to usevDesc- 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- DestroyedloadedEntity- Entity trying to escape this calamity.candidateCoords- Pre-determined set of coordinates to disembark into.- Returns:
- Coords, or null if no legal.
-
explodeEquipment
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
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- - theCoordsto be lit.roll- - theTargetRollfor the ignition rollbInferno- -trueif the fire is an inferno fire. If this value isfalsethe 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
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- - theCoordsto be lit.roll- - theinttarget number for the ignition roll
-
ignite
-
ignite
add fire to a hex- Parameters:
c- - theCoordsof the hex to be set on firefireLevel- - The level of fire, see Terrains
-
removeFire
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 (seeFireProcessor), so the board id must be passed through to keep the per-boardBoard.removeFlamerStartedFire(Coords)state and the hex update on the correct board.- Parameters:
boardId- the id of the board the burning hex is onfireCoords-Coordsof the hex on firereason- 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, useremoveFire(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-Coordsof the hex on fire.reason- Reason to remove the fire.
-
addSmoke
Called when a fire is burning. Called 3 times per fire hex.- Parameters:
coords- TheCoordsx-coordinate of the hex
-
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, 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. UsesendNewSpecialReportsTo(int)to send a player only what is new, orcreateSpecialReportPacket(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
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
Creates a packet containing all current and out-of-game entities -
sendSmokeCloudAdded
-
sendTemporaryECMFieldAdded
-
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
Sends notification to clients that the specified hex has changed. LEGACY - replace with the boardId version -
sendChangedHex
-
sendChangedHexes
public void sendChangedHexes()Sends notification to clients that the specified hex has changed. -
sendChangedMines
Sends notification to clients that the specified hex has changed. -
sendVisibilityIndicator
-
sendNovaChange
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
checks for unintended explosion of heavy industrial zone hex and applies damage to entities occupying the hex -
damageInfantryIn
-
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- - theBuildingthat sustained the damage.damage- - theintamount 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 ofEntity'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 benull.positionMap- a map of the Coords positions of each unit in the game to theEntitys at that position. May be empty when no unit is on the board.coords- the Coords of the building hex that is coming downvPhaseReport- 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
-
damageBuilding
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- - theBuildingthat has been damaged. This value should not benull, but no exception will occur.damage- - theintamount of damage.coords- - theCoordsof the building hex to be damagedlevel- - the absolute level where the damage is dealt- Returns:
- a
Reportto be shown to the players.
-
damageBuilding
-
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- - theBuildingthat has been damaged. This value should not benull, but no exception will occur.damage- - theintamount of damage.why- - theStringmessage that describes why the building took the damage.coords- - theCoordsof the building hex to be damagedlevel- - the level at which the damage occurred (defaults to 0)- Returns:
- a
Reportto be shown to the players.
-
sendNewBuildings
-
sendChangedBuildings
-
sendRemovedBuildings
-
creditKill
Credits a Kill for an entity, if the target got killed.- Parameters:
target- TheEntitythat got killed.attacker- TheEntitythat did the killing, which may be null
-
ejectEntity
Eject an Entity.- Parameters:
entity- TheEntityto eject.autoEject- Thebooleanstate of the entity's auto-ejection system- Returns:
- a
Vectorof report objects for the game log.
-
ejectEntity
Eject an Entity.- Parameters:
entity- TheEntityto eject.autoEject- Thebooleanstate of the entity's auto-ejection systemskin_of_the_teeth- Perform a skin of the teeth ejection- Returns:
- a
Vectorof report objects for the game log.
-
ejectSpacecraft
Abandon a spacecraft (large or small).- Parameters:
entity- TheAeroto 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
Vectorof 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
Abandon an Entity.- Parameters:
entity- TheEntityto abandon.- Returns:
- a
Vectorof report objects for the game log.
-
launchCombatVehicleEscapePod
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
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
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
-
addReport
Add a whole lotta Reports to the players report queues as well as the Master report queue vPhaseReport. -
addReport
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
Add a single report to the report queue of all players and the master vPhaseReport queue -
doAssaultDrop
resolve the landing of an assault drop- Parameters:
entity- theEntityfor which to resolve it
-
doMagmaDamage
do damage from magma- Parameters:
en- the affectedEntityeruption-booleanindicating whether this is because of an eruption
-
doHazardousLiquidDamage
do damage from hazardous liquids- Parameters:
en- the affectedEntityeruption-booleanindicating whether this is because of an eruption (geyser)depth- How deep is the hazardous liquid?
-
doUltraSublevelDamage
-
doGreenSmokeDamage
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 hitattackSource- The location the attack came from. For hit table resolutiondamage- Amount of damage to deal to each entityammo- The ammo type being usedsubjectId- Subject for reportskiller- Who should be credited with killsexclude- Entity that should take no damage (used for homing splash)flak- Flak, hits flying units only, instead of flyers being immunealtitude- Absolute altitude for flak attackvPhaseReport- The Vector of Reports for the phase reportasfFlak- Is this flak against ASF?alreadyHit- a vector of unit ids for units that have already been hit that will be ignoredvariableDamage- 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 centredammo- The ammo type doing the damagesubjectId- Subject for reportskiller- Who should be credited with killsflak- Flak, hits flying units only, instead of flyers being immunealtitude- Absolute altitude for flak attackmineClear- Does this clear mines?vPhaseReport- The Vector of Reports for the phase reportasfFlak- Is this flak against ASF?
-
artilleryDamageArea
-
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 centredammo- The ammo type doing the damagesubjectId- Subject for reportskiller- Who should be credited with killsfalloff- Lightweight class describing base damage, falloff per level/ring, cluster y/n, and radiusflak- Flak, hits flying units only, instead of flyers being immunealtitude- Absolute altitude/elevation for flak attackvPhaseReport- The Vector of Reports for the phase reportasfFlak- Is this flak against ASF?
-
deliverBombDamage
-
deliverBombInferno
public Vector<Integer> deliverBombInferno(Coords coords, Entity ae, int subjectId, Vector<Report> vPhaseReport) deliver inferno bomb- Parameters:
coords- theCoordswhere to deliverae- the attackingentitysubjectId- theintid of the target
-
sendToast
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 toastmessage- the (already localized) text to displayentity- the acting unit whose icon should accompany the toast, or null for a text-only toast
-
sendMagneticPulseToast
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 unitimproved- true for the iATM Improved Magnetic Pulse effect, false for the standard MP effectapplied- true when the unit becomes affected, false when the effect wears off
-
sendArtilleryNetToast
Sends a single artillery call-for-fire toast (Shot / Splash / Rounds complete) to the firing player and their teammates only. Delegates toArtilleryNotifications.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 toArtilleryNotifications.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-duplicationtargetGrid- the target grid square to name in the toast (team-only), ornullfor 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 toArtilleryNotifications.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 shotenemyBattery- the off-board enemy battery that was spottedimpactHex- 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 toArtilleryNotifications.remindHomingArtilleryInbound(). -
createSmoke
create aSmokeCloudobject and add it to the server list LEGACY - use real board id- Parameters:
coords- the location to create the smokelevel- 1=Light 2=Heavy Smoke 3:light LI smoke 4: Heavy LI smokeduration- How long the smoke will last.
-
createSmoke
-
createSmoke
create aSmokeCloudobject and add it to the server list- Parameters:
coords- the location to create the smokelevel- 1=Light 2=Heavy Smoke 3:light LI smoke 4: Heavy LI smokeduration- duration How long the smoke will last.
-
removeSmokeTerrain
remove a cloud from the map- Parameters:
cloud- the location to remove the smoke from
-
getSmokeCloudList
-
getAirborneVTOLForSand
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
-
sendGroundObjectUpdate
public void sendGroundObjectUpdate()Convenience function to send a ground object update. -
sendIndustrialElevatorUpdate
public void sendIndustrialElevatorUpdate()Sends industrial elevator state to all clients.
-