Package mekhq.campaign.mission
Class AtBDynamicScenario
java.lang.Object
mekhq.campaign.mission.Scenario
mekhq.campaign.mission.AtBScenario
mekhq.campaign.mission.AtBDynamicScenario
- All Implemented Interfaces:
IAtBScenario,IPlayerSettings
Data structure intended to hold data relevant to AtB Dynamic Scenarios (AtB 3.0)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classData relevant to an entity that was swapped out in a "player or fixed unit count" force. -
Field Summary
FieldsFields inherited from class mekhq.campaign.mission.AtBScenario
ACE_DUEL, ALLIED_TRAITORS, ALLY_RESCUE, AMBUSH, antiRiotWeapons, BASE_ATTACK, BREAKTHROUGH, CHASE, CIVILIAN_HELP, CIVILIAN_RIOT, CONVOY_ATTACK, CONVOY_RESCUE, defaultResourceBundle, DYNAMIC, EXTRACTION, FORCE_AERO, FORCE_BA, FORCE_INFANTRY, FORCE_MEK, FORCE_MIXED, FORCE_NOVA, FORCE_PROTOMEK, FORCE_VEE_NOVA, FORCE_VEHICLE, forceTypeNames, HIDE_AND_SEEK, HOLD_THE_LINE, NO_COMBAT_TEAM, OFFICER_DUEL, PIRATE_FREE_FOR_ALL, PRISON_BREAK, PROBE, RECON_RAID, STANDUP, STAR_LEAGUE_CACHE_1, STAR_LEAGUE_CACHE_2, startPosFields inherited from class mekhq.campaign.mission.Scenario
atmosphere, botForces, botForcesStubs, fog, gravity, light, S_DEFAULT_ID, T_ATMOSPHERE, T_GROUND, T_SPACE, weather, wind -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBotForce(BotForce botForce, ScenarioForceTemplate forceTemplate, Campaign c) Adds a bot force to this scenario.voidAdd a force to the scenario, explicitly linked to the given template.voidaddForces(int forceID) voidaddScenarioModifier(AtBScenarioModifier modifier) Adds a scenario modifier and any linked modifiers to this scenario, provided that the modifier exists and can be applied to the scenario (e.g.voidbooleanalreadyHasModifier(AtBScenarioModifier modifier) Check if the modifier list already has a modifier with the given modifier's name.voidclearAllForcesAndPersonnel(Campaign campaign) getDesc()intmegamek.common.enums.SkillLeveldoubledoubleintintgetLanceCommander(Campaign campaign) Convenience method that returns the commander of the first force assigned to this scenario.intgetLanceCommanderSkill(String skillType, Campaign campaign) Convenience method to return the int value of the lance commander's skill in the specified area.intgetMapX()Horizontal map size.intgetMapY()Vertical map size.A list of all the force IDs associated with pre-defined scenario templatesintintThe Board.START_X constant representing the starting zone for the player's primary forceintgetTeamTotalBattleValue(Campaign campaign, boolean isAllied) Returns the total battle value (BV) either for allied forces or opposing forces in a given contract campaign, as per the parameterisAllied.booleanThis is used to indicate that player forces have been assigned to this scenario and that AtBDynamicScenarioFactory.finalizeScenario() has been called on this scenario to generate opposing forces and their bots, apply any present scenario modifiers, set up deployment turns, calculate which units belong to which objectives, and many other things.protected voidloadFieldsFromXmlNode(Node wn, megamek.Version version, Campaign campaign) voidCorrects the enemy (special scenarios) and allies (big battles) as necessary based on player deployments.voidremoveBotForce(int x) Removes a bot force from this dynamic scenario, and its associated template as well.voidremoveForce(int fid) voidremoveUnit(UUID unitID) voidsetBotForceTemplates(Map<BotForce, ScenarioForceTemplate> botForceTemplates) voidsetBotUnitTemplates(Map<UUID, ScenarioForceTemplate> botUnitTemplates) voidsetEffectiveOpForQuality(int qualityLevel) voidsetEffectiveOpForSkill(megamek.common.enums.SkillLevel skillLevel) voidsetEffectivePlayerBVMultiplier(double multiplier) voidsetEffectivePlayerUnitCountMultiplier(double multiplier) voidsetFinalized(boolean finalized) voidsetFriendlyDelayedReinforcements(List<UUID> friendlyDelayedReinforcements) voidsetFriendlyInstantReinforcements(List<UUID> friendlyInstantReinforcements) voidsetFriendlyReinforcementDelayReduction(int friendlyReinforcementDelayReduction) voidsetHostileReinforcementDelayReduction(int hostileReinforcementDelayReduction) voidvoidsetPlayerForceTemplates(Map<Integer, ScenarioForceTemplate> playerForceTemplates) voidsetPlayerUnitSwaps(Map<UUID, AtBDynamicScenario.BenchedEntityData> playerUnitSwaps) voidsetPlayerUnitTemplates(Map<UUID, ScenarioForceTemplate> playerUnitTemplates) voidsetScenarioModifiers(List<AtBScenarioModifier> scenarioModifiers) voidsetTemplate(ScenarioTemplate template) protected voidwriteToXMLEnd(PrintWriter pw, int indent) Methods inherited from class mekhq.campaign.mission.AtBScenario
addAeroReinforcements, addCivilianUnits, addDropship, addEnemyForce, addEnemyForce, addLance, addLance, addScrubReinforcements, addTransportRelationship, addTurrets, canAddDropShips, canDeploy, canDeploy, canDeployForces, canDeployUnits, canRerollLight, canRerollMap, canRerollMapSize, canRerollTerrain, canRerollWeather, canStartScenario, filterUntransportedUnits, generateStub, getAlliesPlayer, getAlliesPlayerStub, getAllyBotForce, getAttachedUnitIds, getBaseMapX, getBaseMapY, getCombatRole, getCombatTeamById, getCombatTeamId, getContract, getCsvFromList, getDeploymentDelay, getDeploymentInstructions, getEnemyBotForce, getEnemyBotForce, getEnemyHome, getEntity, getEntity, getForceCount, getModifiedTemperature, getNumPlayerMinefields, getRerollsRemaining, getResourceBundle, getSpecialScenarioEnemies, getStratconScenario, getSurvivalBonusIds, getTerrainType, getTransportLinkages, initialize, isAttacker, isBigBattle, isFriendlyUnit, isSpecialScenario, isStandardScenario, selectBotTeamCommanders, setAttacker, setCombatTeam, setDeploymentDelay, setEnemyHome, setExtraScenarioForces, setForceCount, setForces, setLightConditions, setMapFile, setMapFile, setModifiedTemperature, setNumPlayerMinefields, setObjectives, setPlanetaryConditions, setRerolls, setScenarioMap, setTerrain, setTerrainType, setTransportLinkages, setWeatherConditions, useRerollMethods inherited from class mekhq.campaign.mission.Scenario
addBotForce, addLoot, addPlayerTransportRelationship, addSalvageForce, addSalvageTech, addUnit, canWindShiftDirection, canWindShiftStrength, clearSalvageForces, clearSalvageTechs, containsPlayerUnit, convertToStub, createPlanetaryConditions, generateInstanceFromXML, getAtmosphere, getBlowingSand, getBoardType, getBoardTypeName, getBotForce, getBotForces, getBotForcesStubs, getDate, getDeploymentLimit, getDescription, getEMI, getEntityStub, getExternalIDLookup, getFog, getForceIDs, getForces, getForceStub, getGravity, getHasTrack, getHyperlinkedName, getId, getIndividualUnitIDs, getLight, getLinkedScenario, getLoot, getMap, getMapForDisplay, getMapSizeX, getMapSizeY, getMaxWindStrength, getMinWindStrength, getMissionId, getName, getNumBots, getPlayerTransportLinkages, getReport, getSalvageForces, getSalvageTechs, getScenarioObjectives, getStartingAnyNWx, getStartingAnyNWy, getStartingAnySEx, getStartingAnySEy, getStartOffset, getStartWidth, getStatus, getStratConScenarioType, getTemperature, getTraitorUnits, getWeather, getWind, hasObjectives, includesRequiredPersonnel, includesRequiredUnits, isAssigned, isCloaked, isCrisis, isTraitor, isTraitor, isUsingFixedMap, readPlanetaryConditions, removeSalvageForce, removeSalvageTechs, resetLoot, setAtmosphere, setBlowingSand, setBoardType, setBotForces, setCloaked, setDate, setDeploymentLimit, setDesc, setEMI, setExternalIDLookup, setFog, setGravity, setHasTrack, setId, setIsCrisis, setLight, setLinkedScenarioID, setMap, setMapSizeX, setMapSizeY, setMaxWindStrength, setMinWindStrength, setMissionId, setName, setReport, setScenarioObjectives, setShiftWindDirection, setShiftWindStrength, setStartingAnyNWx, setStartingAnyNWy, setStartingAnySEx, setStartingAnySEy, setStartingPos, setStartOffset, setStartWidth, setStatus, setStratConScenarioType, setTemperature, setUsingFixedMap, setWeather, setWind, writeToXML, writeToXMLBegin
-
Field Details
-
PRIMARY_PLAYER_FORCE_ID
- See Also:
-
-
Constructor Details
-
AtBDynamicScenario
public AtBDynamicScenario()
-
-
Method Details
-
addForces
public void addForces(int forceID) -
addForce
Add a force to the scenario, explicitly linked to the given template.- Parameters:
forceID- ID of the force to add.templateName- Name of the force template.
-
addUnit
-
removeForce
public void removeForce(int fid) - Overrides:
removeForcein classScenario
-
removeUnit
- Overrides:
removeUnitin classScenario
-
getStartingPos
public int getStartingPos()The Board.START_X constant representing the starting zone for the player's primary force- Specified by:
getStartingPosin interfaceIPlayerSettings- Overrides:
getStartingPosin classScenario
-
getMapX
public int getMapX()Horizontal map size. Unlike the AtBScenario, we only perform map size calculations once (once all primary forces are committed), so we don't re-calculate the map size each time.- Overrides:
getMapXin classAtBScenario
-
getMapY
public int getMapY()Vertical map size. Unlike the AtBScenario, we only perform map size calculations once (once all primary forces are committed), so we don't re-calculate the map size each time.- Overrides:
getMapYin classAtBScenario
-
setMapSize
public void setMapSize()- Overrides:
setMapSizein classAtBScenario
-
addBotForce
Adds a bot force to this scenario. -
removeBotForce
public void removeBotForce(int x) Removes a bot force from this dynamic scenario, and its associated template as well.- Overrides:
removeBotForcein classScenario
-
getEffectivePlayerUnitCountMultiplier
public double getEffectivePlayerUnitCountMultiplier() -
setEffectivePlayerUnitCountMultiplier
public void setEffectivePlayerUnitCountMultiplier(double multiplier) -
getEffectivePlayerBVMultiplier
public double getEffectivePlayerBVMultiplier() -
setEffectivePlayerBVMultiplier
public void setEffectivePlayerBVMultiplier(double multiplier) -
getTemplate
-
setTemplate
-
getPlayerForceTemplates
-
setPlayerForceTemplates
-
getPlayerUnitTemplates
-
setPlayerUnitTemplates
-
getBotForceTemplates
-
setBotForceTemplates
-
getBotUnitTemplates
-
setBotUnitTemplates
-
getPlayerUnitSwaps
-
setPlayerUnitSwaps
-
getEffectiveOpForSkill
public megamek.common.enums.SkillLevel getEffectiveOpForSkill() -
setEffectiveOpForSkill
public void setEffectiveOpForSkill(megamek.common.enums.SkillLevel skillLevel) -
getEffectiveOpForQuality
public int getEffectiveOpForQuality() -
setEffectiveOpForQuality
public void setEffectiveOpForQuality(int qualityLevel) -
getFriendlyDelayedReinforcements
-
setFriendlyDelayedReinforcements
-
getFriendlyInstantReinforcements
-
setFriendlyInstantReinforcements
-
getFriendlyReinforcementDelayReduction
public int getFriendlyReinforcementDelayReduction() -
setFriendlyReinforcementDelayReduction
public void setFriendlyReinforcementDelayReduction(int friendlyReinforcementDelayReduction) -
getHostileReinforcementDelayReduction
public int getHostileReinforcementDelayReduction() -
setHostileReinforcementDelayReduction
public void setHostileReinforcementDelayReduction(int hostileReinforcementDelayReduction) -
isFinalized
public boolean isFinalized()This is used to indicate that player forces have been assigned to this scenario and that AtBDynamicScenarioFactory.finalizeScenario() has been called on this scenario to generate opposing forces and their bots, apply any present scenario modifiers, set up deployment turns, calculate which units belong to which objectives, and many other things.Further "post-force-generation" modifiers can be applied to this scenario, but calling finalizeScenario() on it again will lead to "unsupported" behavior.
Can be called as a shorthand way of telling "is this scenario ready to play".
-
setFinalized
public void setFinalized(boolean finalized) -
getPlayerTemplateForceIDs
A list of all the force IDs associated with pre-defined scenario templates -
getLanceCommander
Convenience method that returns the commander of the first force assigned to this scenario. -
getLanceCommanderSkill
Convenience method to return the int value of the lance commander's skill in the specified area. Encapsulates a fairly obnoxious number of null checks and other safety code.- Parameters:
skillType- The type of skill to checkcampaign- The campaign the lance commander is a part of- Returns:
- The skill level. SKILL_NONE (0) if not present.
-
setScenarioModifiers
-
getScenarioModifiers
-
addScenarioModifier
Adds a scenario modifier and any linked modifiers to this scenario, provided that the modifier exists and can be applied to the scenario (e.g. ground units on air map) -
alreadyHasModifier
Check if the modifier list already has a modifier with the given modifier's name. -
getScenarioType
public int getScenarioType() -
getDesc
- Overrides:
getDescin classAtBScenario
-
getScenarioTypeDescription
-
getResourceKey
-
writeToXMLEnd
- Overrides:
writeToXMLEndin classAtBScenario
-
loadFieldsFromXmlNode
protected void loadFieldsFromXmlNode(Node wn, megamek.Version version, Campaign campaign) throws ParseException - Overrides:
loadFieldsFromXmlNodein classAtBScenario- Throws:
ParseException
-
refresh
Description copied from class:AtBScenarioCorrects the enemy (special scenarios) and allies (big battles) as necessary based on player deployments. This ought to be called when the scenario details are displayed or the scenario is started.- Overrides:
refreshin classAtBScenario
-
clearAllForcesAndPersonnel
- Overrides:
clearAllForcesAndPersonnelin classScenario
-
getBattlefieldControlDescription
- Overrides:
getBattlefieldControlDescriptionin classAtBScenario
-
getTeamTotalBattleValue
Returns the total battle value (BV) either for allied forces or opposing forces in a given contract campaign, as per the parameterisAllied.If
isAlliedistrue, the method calculates the total BV for the allied forces inclusive of player forces. IfisAlliedisfalse, the total BV for opposing forces is calculated.The calculation is done based on Bot forces attributed to each side. In the case of PlanetOwner, the alignment of the owner faction is considered to determine the ownership of Bot forces.
- Parameters:
campaign- The campaign in which the forces are participating.isAllied- A boolean value indicating whether to calculate the total BV for allied forces (if true) or opposing forces (if false).- Returns:
- The total battle value (BV) either for the allied forces or opposing forces, as specified by the parameter isAllied.
-