Class Campaign
- All Implemented Interfaces:
megamek.common.ITechManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Represents the different types of administrative specializations. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
acquireEquipment
(IAcquisitionWork acquisition, Person person) Attempt to acquire a givenIAcquisitionWork
object.void
Performs work to activate a unit from its mothballed state.void
addCampaignTransport
(CampaignTransportType campaignTransportType, Unit unit) Adds a transport (Unit) to the list specified transporters map.void
addCombatTeam
(CombatTeam combatTeam) void
void
Add force to an existing superforce.void
addFunds
(TransactionType type, Money quantity, String description) void
void
void
addMission
(Mission mission) Add a mission to the campaignaddNewUnit
(megamek.common.Entity en, boolean allowNewPilots, int days) Add a new unit to the campaign and set its quality to D.addNewUnit
(megamek.common.Entity en, boolean allowNewPilots, int days, PartQuality quality) Add a new unit to the campaign and set its quality.void
Adds a report to the daily logvoid
Formats and then adds a report to the daily logvoid
addScenario
(Scenario s, Mission m) Adds scenario to existing mission, generating a report.void
addScenario
(Scenario s, Mission m, boolean suppressReport) Add scenario to an existing mission.void
addTestUnit
(TestUnit testUnit) This is for adding a TestUnit that was previously created and had parts added to it.void
addUnitsToNetwork
(Vector<Unit> addedUnits, String netid) void
addUnitToForce
(Unit unit, int id) Add unit to an existing force.void
addUnitToForce
(Unit unit, Force force) void
applyInitiativeBonus
(int bonus) boolean
applyRetirement
(Money totalPayout, Map<UUID, UUID> unitAssignments) Process retirements for retired personnel, if any.void
assignRandomOriginFor
(Person person) Assigns a random origin to aPerson
.void
assignRandomPortraitFor
(Person person) Assigns a random portrait to aPerson
.void
Starts a new day for the daily logcalculateCostPerJump
(boolean excludeOwnTransports, boolean campaignOpsCosts) This method calculates the cost per jump for interstellar travel.calculateJumpPath
(PlanetarySystem start, PlanetarySystem end) Calculates and returns aJumpPath
between two planetary systems, using default parameters for jump range and travel safety.calculateJumpPath
(PlanetarySystem start, PlanetarySystem end, boolean skipAccessCheck, boolean skipEmptySystemCheck) Calculates the optimal jump path between two planetary systems using the A* algorithm.int
calculatePartTransitTime
(int availability) Calculates the transit time for the arrival of parts or supplies based on the availability of the item, a random roll, and campaign-specific transit time settings.int
calculatePartTransitTime
(megamek.common.ITechnology.AvailabilityValue availability) Calculates the transit time for the arrival of parts or supplies based on the availability of the item, a random roll, and campaign-specific transit time settings.int
Calculate transit time for supplies based on what planet they are shipping from.boolean
canAcquireParts
(Person person) Gets a value indicating ifperson
can acquire parts.boolean
canPayFor
(IAcquisitionWork acquisition) Checks whether the campaign can pay for a givenIAcquisitionWork
item.void
changeCrimePirateModifier
(int change) Updates the crime pirate modifier by the specified change.void
changeCrimeRating
(int change) Updates the crime rating by the specified change.void
changeTemporaryPrisonerCapacity
(int delta) Adjusts the temporary prisoner capacity by the specified delta value.void
checkBloodnameAdd
(Person person, boolean ignoreDice) If the person does not already have a bloodname, assigns a chance of having one based on skill and rank.void
checkForNewMercenaryOrganizationStartUp
(boolean bypassStartYear) Checks if a new mercenary organization is starting up in the current game year, and, if so, triggers a welcome dialog introducing the organization's representative.boolean
checkLinkedScenario
(int scenarioID) Checks if another active scenario has this scenarioID as it's linkedScenarioID and returns true if it finds one.boolean
Checks if there are any scenarios that are due based on the current date.int
Checks if an employee turnover prompt should be displayed based on campaign options, current date, and other conditions (like transit status and campaign start date).void
cleanUp()
Cleans incongruent data present in the campaignvoid
clearGameData
(megamek.common.Entity entity) Clears Transient Game Data for an Entityvoid
completeMission
(Mission mission, MissionStatus status) void
decreaseAstechPool
(int i) void
decreaseMedicPool
(int i) void
void
doMaintenance
(Unit unit) void
void
int
findBestAtSkill
(String skillName) Finds and returns thePerson
with the highest total skill level for a specified skill.findBestInRole
(PersonnelRole role, String skill) findBestInRole
(PersonnelRole role, String primary, String secondary) Finds the active person in a particular role with the highest level in a given, with an optional secondary skill to break ties.findContactForAcquisition
(IAcquisitionWork acquisition, Person person, PlanetarySystem system) Make an acquisition roll for a given planet to see if you can identify a contact.Attempt to fix a part, which may have all kinds of effect depending on part type.fixWarehousePart
(Part part, Person tech) Repairs a specified part from the warehouse by creating a clone of it, decrementing the quantity in stock, repairing the cloned part, and optionally adding the repaired part back to the warehouse inventory.getActiveAtBContracts
(boolean excludeEndDateCheck) Retrieves a filtered list of personnel who have at least one combat profession.Retrieves a list of currently active contracts.getActiveContracts
(boolean includeFutureContracts) Retrieves a list of active contracts, with an option to include future contracts.Provides a filtered list of personnel including only active Dependents.getActiveMissions
(boolean excludeEndDateCheck) getActivePersonnel
(boolean includePrisoners) Retrieves a list of active personnel in the campaign, optionally including prisoners.Retrieves a collection of units that are not mothballed or being salvaged.int
Calculates the adjusted crime rating by adding the crime rating with the pirate modifier.List<megamek.common.Entity>
Returns a list of entities (units) from all combat forces.getAllUnitsInTheTOE
(boolean standardForcesOnly) Retrieves all units in the Table of Organization and Equipment (TOE).getApp()
int
int
int
int
int
Retrieves the unit rating modifier based on campaign options.Retrieves the list of units that are configured for automated mothballing.megamek.client.bot.princess.BehaviorSettings
int
getAvailableAstechs
(int minutes, boolean alreadyOvertime) megamek.common.icons.Camouflage
Retrieves the campaign faction icon for the specifiedCampaign
.Gets statistics related to cargo in the hangar.megamek.client.ui.util.PlayerColour
Returns theHashtable
using the combatTeam'sforceId
as the key and containing all theCombatTeam
objects after removing the ineligible ones.Retrieves the current campaign commander.Retrieves the address or form of address for the commander.getCommanderAddress
(boolean isInformal) Retrieves the address or title for the commanding officer, either in a formal or informal format.int
Returns the Strategy skill of the designated commander in the campaign.int
megamek.common.planetaryconditions.PlanetaryConditions
getCurrentPlanetaryConditions
(Scenario scenario) Provides a filtered list of personnel including only active prisoners.int
getDeploymentDeficit
(AtBContract contract) TODO : I should be part of AtBContract, not CampaignList<megamek.common.Entity>
getEra()
Gets theAbstractFactionSelector
to use with this campaign.getFactionSelector
(RandomOriginOptions options) Gets theAbstractFactionSelector
to useDeprecated, for removal: This API element is subject to removal in a future version.Retrieves the flagged commander from the personnel list.getForce
(int id) getForceFor
(Person person) getForceFor
(Unit unit) Provides a filtered list of personnel including only friendly PoWs.getFunds()
Retrieves a list of future contracts.megamek.common.Game
getGame()
megamek.common.options.GameOptions
Vector<megamek.common.options.IBasicOption>
int
Gets statistics related to units in the hangar.getId()
boolean
int
int
getKills()
getKillsFor
(UUID pid) Retrieves the best logistics person based on the acquisition skill, personnel category, and maximum acquisitions allowed for the campaign.Retrieves a list of eligible logistics personnel who can perform procurement actions based on the current campaign options.int
int
int
getMission
(int id) getName()
Determines the appropriate starting planet for a new campaign based on campaign type, faction, and various fallback scenarios.getNews()
int
int
int
Returns the total number of primary astechs available.int
Returns the total number of secondary astechs available.getPart
(int id) getPartInventory
(Part part) This returns a PartInventory object detailing the current count for a part on hand, in transit, and ordered.getParts()
getPartsInUse
(boolean ignoreMothballedUnits, boolean isResupply, PartQuality ignoreSparesUnderQuality) Analyzes the warehouse inventory and returns a data set that summarizes the usage state of all parts, including their use counts, store counts, and planned counts, while filtering based on specific conditions.int
getPatientsFor
(Person doctor) Retrieves a list of personnel, excluding those whose status indicates they have left the unit.getPersonnelGenerator
(AbstractFactionSelector factionSelector, AbstractPlanetSelector planetSelector) Gets theAbstractPersonnelGenerator
to use with this campaign.Retrieves the list of personnel who have advanced in experience points (XP) via vocational xp.Gets theAbstractPlanetSelector
to use with this campaign.getPlanetSelector
(RandomOriginOptions options) Gets theAbstractPlanetSelector
to usemegamek.common.Player
int
int
Provides a filtered list of personnel including only active prisoners who are willing to defect.int
getScenario
(int id) Retrieves the second-in-command among the unit's active personnel.Finds and returns the most senior administrator for a specific type of administrative role.Deprecated, for removal: This API element is subject to removal in a future version.List of all units that can show up in the repair bay.int
getShorthandedMod
(int availableHelp, boolean medicalStaff) int
getShorthandedModForCrews
(megamek.common.Crew crew) int
getSimplifiedTravelTime
(PlanetarySystem destination) Calculates simplified travel time.Provides a filtered list of personnel including only Persons with the Student status.getSystemById
(String id) getSystemByName
(String name) Returns the Hiring Hall level from the force's current system on the current date.megamek.common.TargetRoll
getTargetFor
(IPartWork partWork, Person tech) Calculates theTargetRoll
required for a technician to work on a specific part task.megamek.common.TargetRoll
getTargetForAcquisition
(IAcquisitionWork acquisition) megamek.common.TargetRoll
getTargetForAcquisition
(IAcquisitionWork acquisition, Person person) megamek.common.TargetRoll
getTargetForAcquisition
(IAcquisitionWork acquisition, Person person, boolean checkDaysToWait) Determines the target roll required for successfully acquiring a specific part or unit based on various campaign settings, the acquisition details, and the person attempting the acquisition.megamek.common.TargetRoll
getTargetForMaintenance
(IPartWork partWork, Person tech, int asTechsUsed) megamek.common.ITechnology.Faction
int
megamek.common.SimpleTechLevel
getTechs()
getTechs
(boolean noZeroMinute) getTechs
(boolean noZeroMinute, boolean eliteFirst) getTechsExpanded
(boolean noZeroMinute, boolean eliteFirst, boolean expanded) Retrieves a list of active technicians, with options to include only those with time remaining, prioritize elite technicians, and expand the search to include technicians with additional roles.int
getTitle()
boolean
getTransports
(CampaignTransportType campaignTransportType) Returns a Map that maps Transporter types to another Map that maps capacity (Double) to UUID of transports for the specific TransportedUnitSummary typegetTransportsByType
(CampaignTransportType campaignTransportType, TransporterType transporterType) Returns list of transports that have the provided TransporterType and CampaignTransportTypegetTransportsByType
(CampaignTransportType campaignTransportType, TransporterType transporterType, double unitSize) Returns list of transports for the specified AbstractTransportedUnitSummary class/subclass that has transport capacity for the Transporter class/subclass For example, getTransportsByType(SHIP_TRANSPORT, MEK_BAY, 3.0) would return all transports that have 3 or more Mek Bay slots open for the SHIP_TRANSPORT type of assignment.Returns the type of rating method as selected in the Campaign Options dialog.Returns the text representation of the unit rating based on the selected unit rating method.getUnits()
megamek.Version
Gets the Warehouse which stores parts.goShopping
(ShoppingList sList) This is the main function for getting stuff (parts, units, etc.) All non-GM acquisition should go through this function to ensure the campaign rules for acquisition are followed.boolean
Checks if there is at least one active AtB (Against the Bot) contract, using the default search parameters.boolean
hasActiveAtBContract
(boolean includeFutureContracts) Determines whether there is an active AtB (Against the Bot) contract.boolean
boolean
Determines whether there are any future AtB (Against the Bot) contracts.boolean
hasTransports
(CampaignTransportType campaignTransportType) Do we have transports for the kind of transport?void
importForce
(Force force) This is used by the XML loader.void
importKill
(Kill k) Imports aKill
into a campaign.void
importMission
(Mission mission) Imports aMission
into a campaign.void
importParts
(Collection<Part> newParts) Imports a collection of parts into the campaign.void
importPerson
(Person person) Imports aPerson
into a campaign.void
importScenario
(Scenario scenario) This is used by the XML loader.void
importUnit
(Unit unit) Imports aUnit
into a campaign.void
increaseAstechPool
(int i) void
increaseMedicPool
(int i) void
initAtB
(boolean newCampaign) void
initiativeBonusIncrement
(boolean change) void
Deprecated, for removal: This API element is subject to removal in a future version.void
Deprecated, for removal: This API element is subject to removal in a future version.void
void
Initializes the unit generator based on the method chosen in campaignOptions.boolean
boolean
Determines whether the current campaign is a clan campaign.boolean
boolean
isGM()
boolean
Determines whether the current campaign is a mercenary campaign.boolean
boolean
boolean
Determines whether the current campaign is a pirate campaign.boolean
boolean
isWorkingOnRefit
(Person person) void
Performs work to mothball a unit, preparing it for long-term storage.void
void
Moves immediately to aPlanetarySystem
.boolean
newDay()
newDependent
(megamek.common.enums.Gender gender) Creates a new dependent with given gender.newDependent
(megamek.common.enums.Gender gender, Faction originFaction, Planet originPlanet) Creates a new dependent with the given gender, origin faction, and origin planet.newPerson
(PersonnelRole role) Generate a new Person of the given role using whatever randomization options have been given in the CampaignOptionsnewPerson
(PersonnelRole primaryRole, String factionCode, megamek.common.enums.Gender gender) Generate a new Person of the given role using whatever randomization options have been given in the CampaignOptionsnewPerson
(PersonnelRole primaryRole, PersonnelRole secondaryRole) Generate a new Person of the given role using whatever randomization options have been given in the CampaignOptionsnewPerson
(PersonnelRole primaryRole, PersonnelRole secondaryRole, AbstractPersonnelGenerator personnelGenerator, megamek.common.enums.Gender gender) Generate a newPerson
of the given role, using the suppliedAbstractPersonnelGenerator
newPerson
(PersonnelRole primaryRole, PersonnelRole secondaryRole, AbstractFactionSelector factionSelector, AbstractPlanetSelector planetSelector, megamek.common.enums.Gender gender) Generate a new Person of the given role using whatever randomization options have been given in the CampaignOptionsnewPerson
(PersonnelRole primaryRole, AbstractPersonnelGenerator personnelGenerator) Generate a newPerson
of the given role, using the suppliedAbstractPersonnelGenerator
void
payOffLoan
(Loan loan) void
payPersonnel
(TransactionType type, Money quantity, String description, Map<Person, Money> individualPayouts) Generic method for paying Personnel (Person) in the company.void
personUpdated
(Person person) void
Processes the daily activities and updates for all personnel that haven't already left the campaign.void
void
void
readNews()
Checks for a news item for the current date.boolean
recruitPerson
(Person person) Recruits a person into the campaign roster using their current prisoner status, assuming recruitment is not performed by a game master that recruitment actions should be logged, and the character should be employed.boolean
recruitPerson
(Person person, boolean gmAdd) Deprecated, for removal: This API element is subject to removal in a future version.boolean
recruitPerson
(Person person, boolean gmAdd, boolean employ) Recruits a person into the campaign roster using their current prisoner status, allowing specification of both game master and employment flags.boolean
recruitPerson
(Person person, PrisonerStatus prisonerStatus) Deprecated, for removal: This API element is subject to removal in a future version.userecruitPerson(Person, PrisonerStatus, boolean)
insteadboolean
recruitPerson
(Person person, PrisonerStatus prisonerStatus, boolean employ) Recruits a person into the campaign roster with default parameters for game master and logging options.boolean
recruitPerson
(Person person, PrisonerStatus prisonerStatus, boolean gmAdd, boolean log) Deprecated, for removal: This API element is subject to removal in a future version.boolean
recruitPerson
(Person person, PrisonerStatus prisonerStatus, boolean gmAdd, boolean log, boolean employ) Recruits a person into the campaign roster, handling employment status, prisoner status, finances, logging, and optional relationship simulation.void
void
void
void
This function reloads the game entities into the game at the end of scenario resolution, so that entities are properly updated and destroyed ones removedvoid
Parses news file and loads news items for the current year.void
removeAllPatientsFor
(Person doctor) void
removeCampaignTransporter
(CampaignTransportType campaignTransportType, Unit unit) Deletes an entry from the list of specified list of transports.void
removeCombatTeam
(int forceId) void
removeForce
(Force force) void
removeFunds
(TransactionType type, Money quantity, String description) void
removeKill
(Kill k) void
removeKillsFor
(UUID personID) void
removeMission
(Mission mission) void
removePerson
(Person person) void
removePerson
(Person person, boolean log) void
removeScenario
(Scenario scenario) void
removeUnit
(UUID id) void
void
removeUnitsFromC3Master
(Unit master) void
removeUnitsFromNetwork
(Vector<Unit> removedUnits) boolean
boolean
void
void
void
restore()
void
void
setAstechPool
(int size) void
setAstechPoolMinutes
(int minutes) void
setAstechPoolOvertime
(int overtime) void
setAtBConfig
(AtBConfiguration config) void
setAtBEventProcessor
(AtBEventProcessor processor) void
setAutomatedMothballUnits
(List<UUID> automatedMothballUnits) Sets the list of units that are configured for automated mothballing.void
setAutoResolveBehaviorSettings
(megamek.client.bot.princess.BehaviorSettings settings) void
setCamouflage
(megamek.common.icons.Camouflage camouflage) void
setCampaignOptions
(CampaignOptions options) void
setCampaignStartDate
(LocalDate campaignStartDate) void
setColour
(megamek.client.ui.util.PlayerColour colour) void
setContractMarket
(AbstractContractMarket contractMarket) void
setCrimePirateModifier
(int crimePirateModifier) void
setCrimeRating
(int crimeRating) void
setCurrentReportHTML
(String html) void
setDateOfLastCrime
(LocalDate dateOfLastCrime) void
setDivorce
(AbstractDivorce divorce) void
setFaction
(Faction faction) void
setFactionDirect
(Faction faction) void
setFactionStandings
(FactionStandings factionStandings) void
void
void
setGameOptions
(Vector<megamek.common.options.IBasicOption> options) void
setGameOptions
(megamek.common.options.GameOptions gameOptions) void
setGMMode
(boolean b) void
This is used to check if the current campaign has one or more active contacts, and sets the value of hasActiveContract based on that check.void
void
setIgnoreMothballed
(boolean ignoreMothballed) void
setIgnoreSparesUnderQuality
(PartQuality ignoreSparesUnderQuality) void
setInitiativeBonus
(int bonus) void
setInitiativeMaxBonus
(int bonus) void
setIsAvoidingEmptySystems
(boolean isAvoidingEmptySystems) void
setIsOverridingCommandCircuitRequirements
(boolean isOverridingCommandCircuitRequirements) void
setLocalDate
(LocalDate currentDay) void
void
setMarriage
(AbstractMarriage marriage) void
setMedicPool
(int size) void
void
setNewPersonnelMarket
(NewPersonnelMarket newPersonnelMarket) void
setNewReports
(List<String> reports) void
setOvertime
(boolean b) void
setOverviewLoadingValue
(boolean overviewLoadingValue) void
setPartsInUseRequestedStockMap
(Map<String, Double> partsInUseRequestedStockMap) void
setPersonnelMarket
(PersonnelMarket personnelMarket) void
setPersonnelWhoAdvancedInXP
(List<Person> personnelWhoAdvancedInXP) Sets the list of personnel who have advanced in experience points (XP) via vocational xp.void
setProcessProcurement
(boolean processProcurement) void
setProcreation
(AbstractProcreation procreation) void
void
setRankSystem
(RankSystem rankSystem) void
setRankSystemDirect
(RankSystem rankSystem) void
setReputation
(ReputationController reputation) void
void
setRetainerStartDate
(LocalDate retainerStartDate) void
void
setShipSearchExpiration
(LocalDate shipSearchExpiration) void
setShipSearchResult
(String result) Sets the lookup name of the available ship, or null if none were found.void
setShipSearchStart
(LocalDate shipSearchStart) Sets the date a ship search was started, or null if no search is in progress.void
setShipSearchType
(int unitType) Sets the unit type to search for.void
void
setStartingSystem
(Planet planet) void
setTemporaryPrisonerCapacity
(int temporaryPrisonerCapacity) void
setTopUpWeekly
(boolean topUpWeekly) void
setUnitIcon
(StandardForceIcon unitIcon) void
setUnitMarket
(AbstractUnitMarket unitMarket) void
setUnitRating
(IUnitRating rating) Sets the type of rating method used.void
setVersion
(megamek.Version version) void
setWarehouse
(Warehouse warehouse) Sets the Warehouse which stores parts for the campaign.boolean
void
Stop processing AtB events and release memory.void
startShipSearch
(int unitType) int
stockUpPartsInUse
(Set<PartInUse> partsInUse) void
stockUpPartsInUseGM
(Set<PartInUse> partsInUse) void
boolean
void
updatePartInUse
(PartInUse partInUse, boolean ignoreMothballedUnits, PartQuality ignoreSparesUnderQuality) Find all the parts that match this PartInUse and update their datavoid
void
updateTransportInTransports
(CampaignTransportType campaignTransportType, Unit transport) This will update the transport in the transports list with current capacities.void
updateTransportInTransports
(Unit transport) This will update the transport in the transports list with current capacities.boolean
boolean
void
useStoryArc
(StoryArc arc, boolean initiate) boolean
void
Wipes the Parts in use map for the purpose of resetting all values to their defaultvoid
Performs work to either mothball or activate a unit.void
writePartInUseMapToXML
(PrintWriter pw, int indent) void
writePartInUseToXML
(PrintWriter pw, int indent) void
writeToXML
(PrintWriter writer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface megamek.common.ITechManager
isLegal
-
Field Details
-
REPORT_LINEBREAK
- See Also:
-
inMemoryLogHistory
-
-
Constructor Details
-
Campaign
public Campaign()
-
-
Method Details
-
getApp
- Returns:
- the app
-
setApp
- Parameters:
app
- the app to set
-
setOverviewLoadingValue
public void setOverviewLoadingValue(boolean overviewLoadingValue) - Parameters:
overviewLoadingValue
- the overviewLoadingValue to set
-
getGame
public megamek.common.Game getGame() -
getPlayer
public megamek.common.Player getPlayer() -
setId
-
getId
-
setVersion
public void setVersion(megamek.Version version) -
getVersion
@Nullable public megamek.Version getVersion() -
getName
-
setName
-
getEra
-
getTitle
-
getLocalDate
-
setLocalDate
-
getCampaignStartDate
-
setCampaignStartDate
-
getCurrentSystem
-
isAvoidingEmptySystems
public boolean isAvoidingEmptySystems() -
setIsAvoidingEmptySystems
public void setIsAvoidingEmptySystems(boolean isAvoidingEmptySystems) -
isOverridingCommandCircuitRequirements
public boolean isOverridingCommandCircuitRequirements() -
setIsOverridingCommandCircuitRequirements
public void setIsOverridingCommandCircuitRequirements(boolean isOverridingCommandCircuitRequirements) -
getSystemHiringHallLevel
Returns the Hiring Hall level from the force's current system on the current date. If there is no hiring hall present, the level is HiringHallLevel.NONE.- Returns:
- The Hiring Hall level of the current system at the present date.
-
getFunds
-
setForces
-
getForces
-
getAllForces
-
getAllUnitsInTheTOE
Retrieves all units in the Table of Organization and Equipment (TOE).This method provides a list of unique identifiers for all units currently included in the force's TOE structure.
- Parameters:
standardForcesOnly
- iftrue
, returns only units inForceType.STANDARD
forces; iffalse
, returns all units.- Returns:
- a List of UUID objects representing all units in the TOE according to the specified filter
- Since:
- 0.50.05
-
addCombatTeam
- Parameters:
combatTeam
- theCombatTeam
to be added to theHashtable
-
removeCombatTeam
public void removeCombatTeam(int forceId) - Parameters:
forceId
- the key of theCombatTeam
to be removed from theHashtable
-
getCombatTeamsTable
Returns theHashtable
using the combatTeam'sforceId
as the key and containing all theCombatTeam
objects after removing the ineligible ones. Although sanitization might not be necessary, it ensures that there is no need forisEligible()
checks when fetching theHashtable
.- Returns:
- the sanitized
Hashtable
ofCombatTeam
objects stored in the current campaign.
-
getAllCombatTeams
Returns anArrayList
of allCombatTeam
objects in thecombatTeams
Hashtable
. Calls thegetCombatTeamsTable()
method to sanitize theHashtable
before conversion toArrayList
.- Returns:
- an
ArrayList
of all theCombatTeam
objects in thecombatTeams
Hashtable
-
setShoppingList
-
getShoppingList
-
getPersonnelMarket
-
setPersonnelMarket
-
getContractMarket
-
setContractMarket
-
getUnitMarket
-
setUnitMarket
-
getNewPersonnelMarket
-
setNewPersonnelMarket
-
resetRandomDeath
public void resetRandomDeath() -
getDivorce
-
setDivorce
-
getMarriage
-
setMarriage
-
getProcreation
-
setProcreation
-
setRetirementDefectionTracker
-
getRetirementDefectionTracker
-
setPersonnelWhoAdvancedInXP
Sets the list of personnel who have advanced in experience points (XP) via vocational xp. -
getPersonnelWhoAdvancedInXP
Retrieves the list of personnel who have advanced in experience points (XP) via vocational xp. -
initUnitGenerator
public void initUnitGenerator()Initializes the unit generator based on the method chosen in campaignOptions. Called when the unit generator is first used or when the method has been changed in campaignOptions. -
getUnitGenerator
- Returns:
- - the class responsible for generating random units
-
setAtBEventProcessor
-
setAtBConfig
-
getAtBConfig
-
setShipSearchStart
Sets the date a ship search was started, or null if no search is in progress. -
getShipSearchStart
- Returns:
- The date a ship search was started, or null if none is in progress.
-
setShipSearchResult
Sets the lookup name of the available ship, or null if none were found. -
getShipSearchResult
- Returns:
- The lookup name of the available ship, or null if none is available
-
getShipSearchExpiration
- Returns:
- The date the ship is no longer available, if there is one.
-
setShipSearchExpiration
-
setShipSearchType
public void setShipSearchType(int unitType) Sets the unit type to search for. -
startShipSearch
public void startShipSearch(int unitType) -
purchaseShipSearchResult
public void purchaseShipSearchResult() -
applyRetirement
Process retirements for retired personnel, if any.- Parameters:
totalPayout
- The total retirement payout.unitAssignments
- List of unit assignments.- Returns:
- False if there were payments AND they were unable to be processed, true otherwise.
-
getCampaignSummary
-
getNews
-
addForce
Add force to an existing superforce. This method will also assign the force an id and place it in the forceId hash- Parameters:
force
- - the Force to addsuperForce
- - the superforce to add the new force to
-
moveForce
-
importForce
This is used by the XML loader. The id should already be set for this force so don't increment- Parameters:
force
- Force to add
-
importScenario
This is used by the XML loader. The id should already be set for this scenario so don't increment- Parameters:
scenario
- Scenario to Add.
-
addUnitToForce
-
addUnitToForce
Add unit to an existing force. This method will also assign that force's id to the unit.- Parameters:
unit
- Unit to add to the existing force.id
- Force ID to add unit to
-
addMission
Add a mission to the campaign- Parameters:
mission
- The mission to be added
-
importMission
Imports aMission
into a campaign.- Parameters:
mission
- Mission to import into the campaign.
-
getMission
- Parameters:
id
- the mission's id- Returns:
- the mission in question
-
getMissions
- Returns:
- an
Collection
of missions in the campaign
-
getSortedMissions
- Returns:
- missions List sorted with complete missions at the bottom
-
getActiveMissions
-
getCompletedMissions
-
getActiveContracts
Retrieves a list of currently active contracts.This method is a shorthand for
getActiveContracts(boolean)
withincludeFutureContracts
set tofalse
. It fetches all contracts from the list of missions and filters them for those that are currently active on the current local date.- Returns:
- A list of
Contract
objects that are currently active.
-
getActiveContracts
Retrieves a list of active contracts, with an option to include future contracts.This method iterates through all missions and checks if they are instances of
Contract
. If so, it filters them based on their active status, as determined by theContract.isActiveOn(LocalDate, boolean)
method.- Parameters:
includeFutureContracts
- Iftrue
, contracts that are scheduled to start in the future will also be included in the final result. Iffalse
, only contracts active on the current local date are included.- Returns:
- A list of
Contract
objects that match the active criteria.
-
getFutureContracts
Retrieves a list of future contracts.This method fetches all missions and checks if they are instances of
Contract
. It filters the contracts where the start date is after the current day.- Returns:
- A list of
Contract
objects whose start dates are in the future.
-
getAtBContracts
-
hasActiveAtBContract
public boolean hasActiveAtBContract(boolean includeFutureContracts) Determines whether there is an active AtB (Against the Bot) contract. This method checks if there are contracts currently active. Optionally, it can also consider future contracts that have been accepted but have not yet started.- Parameters:
includeFutureContracts
- a boolean indicating whether contracts that have been accepted but have not yet started should also be considered as active.- Returns:
true
if there is any currently active AtB contract, or ifincludeFutureContracts
istrue
and there are future contracts starting after the current date. Otherwise,false
.- See Also:
-
hasActiveAtBContract
public boolean hasActiveAtBContract()Checks if there is at least one active AtB (Against the Bot) contract, using the default search parameters.- Returns:
true
if an active AtB contract exists;false
otherwise- Since:
- 0.50.06
-
hasFutureAtBContract
public boolean hasFutureAtBContract()Determines whether there are any future AtB (Against the Bot) contracts. A future contract is defined as a contract that has been accepted but has a start date later than the current day.- Returns:
- true if there is at least one future AtB contract (accepted but starting after the current date). Otherwise, false.
-
getActiveAtBContracts
-
getActiveAtBContracts
-
getCompletedAtBContracts
-
hasActiveContract
public boolean hasActiveContract()- Returns:
- whether the current campaign has an active contract for the current date
-
setHasActiveContract
public void setHasActiveContract()This is used to check if the current campaign has one or more active contacts, and sets the value of hasActiveContract based on that check. This value should not be set elsewhere -
addScenario
Adds scenario to existing mission, generating a report. -
addScenario
Add scenario to an existing mission. This method will also assign the scenario an id, provided that it is a new scenario. It then adds the scenario to the scenarioId hash.Scenarios with previously set ids can be sent to this mission, allowing one to remove and then re-add scenarios if needed. This functionality is used in the
AtBScenarioFactory
class in methodcreateScenariosForNewWeek
to ensure that scenarios are generated properly.- Parameters:
s
- - the Scenario to addm
- - the mission to add the new scenario tosuppressReport
- - whether to suppress the campaign report
-
getScenario
-
getScenarios
-
setLocation
-
moveToPlanetarySystem
Moves immediately to aPlanetarySystem
.- Parameters:
s
- ThePlanetarySystem
the campaign has been moved to.
-
getLocation
-
importUnit
Imports aUnit
into a campaign.- Parameters:
unit
- AUnit
to import into the campaign.
-
addCampaignTransport
Adds a transport (Unit) to the list specified transporters map. This transporters map is used to store transports, the kinds of transporters they have, and their remaining capacity. The transporters map is meant to be utilized by the GUI.- Parameters:
campaignTransportType
- Transport Type (enum) we're adding tounit
- unit with transport capabilities- See Also:
-
updateTransportInTransports
This will update the transport in the transports list with current capacities. When a unit is added or removed from a transport, that information needs updated in the campaign transport map. This method will update the map for everyCampaignTransportType
for the given transport.- Parameters:
transport
- Unit- See Also:
-
updateTransportInTransports
public void updateTransportInTransports(CampaignTransportType campaignTransportType, Unit transport) This will update the transport in the transports list with current capacities. When a unit is added or removed from a transport, that information needs updated in the campaign transport map. This method takes the CampaignTransportType and transport as inputs and updates the map with the current capacities of the transport.- Parameters:
campaignTransportType
- type (Enum) of TransportedUnitsSummary we're interested intransport
- Unit
-
removeCampaignTransporter
Deletes an entry from the list of specified list of transports. This gets updated when the transport should no longer be in the CampaignTransporterMap, such as when Transport is mothballed or removed from the campaign.- Parameters:
campaignTransportType
- Transport Type (enum) we're checkingunit
- - The ship we want to remove from this Set- See Also:
-
addTestUnit
This is for adding a TestUnit that was previously created and had parts added to it. We need to do the normal stuff, but we also need to take the existing parts and add them to the campaign.- Parameters:
testUnit
- TestUnit to add.
-
addNewUnit
Add a new unit to the campaign and set its quality to D.- Parameters:
en
- AnEntity
object that the new unit will be wrapped aroundallowNewPilots
- A boolean indicating whether to add new pilots for the unitdays
- The number of days for the new unit to arrive- Returns:
- The newly added unit
-
addNewUnit
public Unit addNewUnit(megamek.common.Entity en, boolean allowNewPilots, int days, PartQuality quality) Add a new unit to the campaign and set its quality.- Parameters:
en
- AnEntity
object that the new unit will be wrapped aroundallowNewPilots
- A boolean indicating whether to add new pilots for the unitdays
- The number of days for the new unit to arrivequality
- The quality of the new unit (0-5)- Returns:
- The newly added unit
- Throws:
IllegalArgumentException
- If the quality is not within the valid range (0-5)
-
getHangar
- Returns:
- the current hangar containing the player's units.
-
getHangarStatistics
Gets statistics related to units in the hangar. -
getCargoStatistics
Gets statistics related to cargo in the hangar. -
getUnits
-
getActiveUnits
Retrieves a collection of units that are not mothballed or being salvaged.- Returns:
- a collection of active units
-
getEntities
-
getUnit
-
newDependent
Creates a new dependent with given gender. The origin faction and planet are set to null.- Parameters:
gender
- TheGender
of the new dependent.- Returns:
- Return a
Person
object representing the new dependent.
-
newDependent
public Person newDependent(megamek.common.enums.Gender gender, @Nullable Faction originFaction, @Nullable Planet originPlanet) Creates a new dependent with the given gender, origin faction, and origin planet.- Parameters:
gender
- TheGender
of the new dependent.originFaction
- TheFaction
that represents the origin faction for the new dependent. This can be null, suggesting the faction will be chosen based on campaign options.originPlanet
- ThePlanet
that represents the origin planet for the new dependent. This can be null, suggesting the planet will be chosen based on campaign options.- Returns:
- Return a
Person
object representing the new dependent.
-
newPerson
Generate a new Person of the given role using whatever randomization options have been given in the CampaignOptions- Parameters:
role
- The primary role- Returns:
- A new
Person
.
-
newPerson
Generate a new Person of the given role using whatever randomization options have been given in the CampaignOptions- Parameters:
primaryRole
- The primary rolesecondaryRole
- A secondary role- Returns:
- A new
Person
.
-
newPerson
public Person newPerson(PersonnelRole primaryRole, String factionCode, megamek.common.enums.Gender gender) Generate a new Person of the given role using whatever randomization options have been given in the CampaignOptions- Parameters:
primaryRole
- The primary rolefactionCode
- The code for the faction this person is to be generated fromgender
- The gender of the person to be generated, or a randomize it value- Returns:
- A new
Person
.
-
newPerson
public Person newPerson(PersonnelRole primaryRole, PersonnelRole secondaryRole, AbstractFactionSelector factionSelector, AbstractPlanetSelector planetSelector, megamek.common.enums.Gender gender) Generate a new Person of the given role using whatever randomization options have been given in the CampaignOptions- Parameters:
primaryRole
- The primary rolesecondaryRole
- A secondary rolefactionSelector
- The faction selector to use for the person.planetSelector
- The planet selector for the person.gender
- The gender of the person to be generated, or a randomize it value- Returns:
- A new
Person
.
-
newPerson
Generate a newPerson
of the given role, using the suppliedAbstractPersonnelGenerator
- Parameters:
primaryRole
- The primary role of thePerson
.personnelGenerator
- TheAbstractPersonnelGenerator
to use when creating thePerson
.- Returns:
- A new
Person
configured usingpersonnelGenerator
.
-
newPerson
public Person newPerson(PersonnelRole primaryRole, PersonnelRole secondaryRole, AbstractPersonnelGenerator personnelGenerator, megamek.common.enums.Gender gender) Generate a newPerson
of the given role, using the suppliedAbstractPersonnelGenerator
- Parameters:
primaryRole
- The primary role of thePerson
.secondaryRole
- The secondary role of thePerson
.personnelGenerator
- TheAbstractPersonnelGenerator
to use when creating thePerson
.gender
- The gender of the person to be generated, or a randomize it value- Returns:
- A new
Person
configured usingpersonnelGenerator
.
-
getFieldKitchenWithinCapacity
-
recruitPerson
Recruits a person into the campaign roster using their current prisoner status, assuming recruitment is not performed by a game master that recruitment actions should be logged, and the character should be employed.- Parameters:
person
- the person to recruit; must not benull
- Returns:
true
if recruitment was successful and the person was added or employed;false
otherwise- See Also:
-
recruitPerson
@Deprecated(since="0.50.06", forRemoval=true) public boolean recruitPerson(Person person, boolean gmAdd) Deprecated, for removal: This API element is subject to removal in a future version.userecruitPerson(Person, boolean, boolean)
instead -
recruitPerson
Recruits a person into the campaign roster using their current prisoner status, allowing specification of both game master and employment flags.This is a convenience overload that enables logging and allows caller to choose whether the person is employed upon recruitment.
- Parameters:
person
- the person to recruit; must not benull
gmAdd
- iftrue
, recruitment is performed by a game master (bypassing funds check)employ
- iftrue
, the person is marked as employed in the campaign- Returns:
true
if recruitment was successful and personnel was added or employed;false
otherwise- See Also:
-
recruitPerson
@Deprecated(since="0.50.06", forRemoval=true) public boolean recruitPerson(Person person, PrisonerStatus prisonerStatus) Deprecated, for removal: This API element is subject to removal in a future version.userecruitPerson(Person, PrisonerStatus, boolean)
instead -
recruitPerson
Recruits a person into the campaign roster with default parameters for game master and logging options.This is a convenience overload that assumes recruitment is not performed by a game master and that recruitment actions should be logged. If successful, the person is marked as employed based on the given flag.
- Parameters:
person
- the person to recruit; must not benull
prisonerStatus
- the prison status to assign to the personemploy
- iftrue
, the person is marked as employed in the campaign- Returns:
true
if recruitment was successful and personnel was added or employed;false
otherwise- See Also:
-
recruitPerson
@Deprecated(since="0.50.06", forRemoval=true) public boolean recruitPerson(Person person, PrisonerStatus prisonerStatus, boolean gmAdd, boolean log) Deprecated, for removal: This API element is subject to removal in a future version. -
recruitPerson
public boolean recruitPerson(Person person, PrisonerStatus prisonerStatus, boolean gmAdd, boolean log, boolean employ) Recruits a person into the campaign roster, handling employment status, prisoner status, finances, logging, and optional relationship simulation.If the
employ
parameter istrue
and the person is not already employed, this method optionally deducts recruitment costs from campaign finances (unless performed by a game master). The person's status and campaign logs are updated accordingly.If the person is a new recruit, their joining date and personnel entry are initialized, and relationship history may be simulated based on campaign options and role.
The method also manages staff role-specific timing pools and can log recruitment events.
- Parameters:
person
- the person to recruit; must not benull
prisonerStatus
- the prison status to assign to the persongmAdd
- iftrue
, indicates the recruitment is being performed by a game master (bypassing funds check)log
- iftrue
, a record of the recruitment will be added to campaign logsemploy
- iftrue
, the person is marked as employed in the campaign- Returns:
true
if recruitment was successful and personnel was added or employed;false
on failure or insufficient funds
-
checkBloodnameAdd
If the person does not already have a bloodname, assigns a chance of having one based on skill and rank. If the roll indicates there should be a bloodname, one is assigned as appropriate to the person's phenotype and the player's faction.- Parameters:
person
- The Bloodname candidateignoreDice
- If true, skips the random roll and assigns a Bloodname automatically
-
importPerson
Imports aPerson
into a campaign.- Parameters:
person
- APerson
to import into the campaign.
-
getPerson
-
getPersonnel
-
getPersonnelFilteringOutDeparted
Retrieves a list of personnel, excluding those whose status indicates they have left the unit.This method filters the personnel collection to only include individuals who are still part of the unit, as determined by their status.
- Returns:
- a
List
ofPerson
objects who have not left the unit
-
getActivePersonnel
Retrieves a list of active personnel in the campaign, optionally including prisoners.This method iterates through all personnel and filters out inactive members. It then further filters prisoners based on the provided parameter:
- If
includePrisoners
istrue
, all active personnel, including prisoners, are included in the result. - If
includePrisoners
isfalse
, only active personnel who are either free or classified as bondsmen are included.
- If
-
getSalaryEligiblePersonnel
- Returns:
- a list of people who are currently eligible to receive a salary.
- Since:
- 0.50.06
-
getActiveCombatPersonnel
Retrieves a filtered list of personnel who have at least one combat profession.This method filters the list of all personnel to include only those whose primary or secondary role is designated as a combat role.
-
getActiveDependents
Provides a filtered list of personnel including only active Dependents.- Returns:
- a
Person
List
containing all active personnel
-
getCurrentPrisoners
Provides a filtered list of personnel including only active prisoners.- Returns:
- a
Person
List
containing all active personnel
-
getPrisonerDefectors
Provides a filtered list of personnel including only active prisoners who are willing to defect.- Returns:
- a
Person
List
containing all active personnel
-
getFriendlyPrisoners
Provides a filtered list of personnel including only friendly PoWs.- Returns:
- a
Person
List
containing all active personnel
-
getStudents
Provides a filtered list of personnel including only Persons with the Student status.- Returns:
- a
Person
List
containing all active personnel
-
getFactionSelector
Gets theAbstractFactionSelector
to use with this campaign.- Returns:
- An
AbstractFactionSelector
to use when selecting aFaction
.
-
getFactionSelector
Gets theAbstractFactionSelector
to use- Parameters:
options
- the random origin options to use- Returns:
- An
AbstractFactionSelector
to use when selecting aFaction
.
-
getPlanetSelector
Gets theAbstractPlanetSelector
to use with this campaign.- Returns:
- An
AbstractPlanetSelector
to use when selecting aPlanet
.
-
getPlanetSelector
Gets theAbstractPlanetSelector
to use- Parameters:
options
- the random origin options to use- Returns:
- An
AbstractPlanetSelector
to use when selecting aPlanet
.
-
getPersonnelGenerator
public AbstractPersonnelGenerator getPersonnelGenerator(AbstractFactionSelector factionSelector, AbstractPlanetSelector planetSelector) Gets theAbstractPersonnelGenerator
to use with this campaign.- Parameters:
factionSelector
- TheAbstractFactionSelector
to use when choosing aFaction
.planetSelector
- TheAbstractPlanetSelector
to use when choosing aPlanet
.- Returns:
- An
AbstractPersonnelGenerator
to use when creating new personnel.
-
getPatients
-
getServiceableUnits
List of all units that can show up in the repair bay. -
importParts
Imports a collection of parts into the campaign.- Parameters:
newParts
- The collection ofPart
instances to import into the campaign.
-
getWarehouse
Gets the Warehouse which stores parts. -
setWarehouse
Sets the Warehouse which stores parts for the campaign.- Parameters:
warehouse
- The warehouse in which to store parts.
-
getQuartermaster
-
getParts
- Returns:
- A collection of parts in the Warehouse.
-
updatePartInUse
public void updatePartInUse(PartInUse partInUse, boolean ignoreMothballedUnits, PartQuality ignoreSparesUnderQuality) Find all the parts that match this PartInUse and update their data- Parameters:
partInUse
- part in use record to updateignoreMothballedUnits
- don't count parts in mothballed unitsignoreSparesUnderQuality
- don't count spare parts lower than this quality
-
getPartsInUse
public Set<PartInUse> getPartsInUse(boolean ignoreMothballedUnits, boolean isResupply, PartQuality ignoreSparesUnderQuality) Analyzes the warehouse inventory and returns a data set that summarizes the usage state of all parts, including their use counts, store counts, and planned counts, while filtering based on specific conditions.This method aggregates all parts currently in use or available as spares, while taking into account constraints like ignoring mothballed units or filtering spares below a specific quality. It uses a map structure to efficiently track and update parts during processing.
- Parameters:
ignoreMothballedUnits
- Iftrue
, parts from mothballed units will not be included in the results.isResupply
- Iftrue
, specific units (e.g., prohibited unit types) are skipped based on the current context as defined inResupply.isProhibitedUnitType()
.ignoreSparesUnderQuality
- Spare parts of a lower quality than the specified value will be excluded from the results.- Returns:
- A
Set
ofPartInUse
objects detailing the state of each relevant part, including:- Use count: How many of this part are currently in use.
- Store count: How many of this part are available as spares in the warehouse.
- Planned count: The quantity of this part included in acquisition orders or planned procurement.
- Requested stock: The target or default quantity to maintain, as derived from settings or requests.
-
getPart
-
getForce
-
getCurrentReport
-
setCurrentReportHTML
-
getCurrentReportHTML
-
setNewReports
-
fetchAndClearNewReports
-
findBestInRole
Finds the active person in a particular role with the highest level in a given, with an optional secondary skill to break ties.- Parameters:
role
- One of the PersonnelRole enum valuesprimary
- The skill to use for comparison.secondary
- If not null and there is more than one person tied for the most the highest, preference will be given to the one with a higher level in the secondary skill.- Returns:
- The person in the designated role with the most experience.
-
findBestInRole
-
findBestAtSkill
Finds and returns thePerson
with the highest total skill level for a specified skill.This method iterates over all active personnel, calculates each individual's total skill level for the given skill (taking into account campaign options, reputation modifiers, and attributes), and determines who possesses the highest skill value. If none are found,
null
is returned.- Parameters:
skillName
- the name of the skill to evaluate among all active personnel- Returns:
- the
Person
with the highest calculated total skill level in the specified skill, ornull
if no qualifying person is found
-
getTechs
- Returns:
- The list of all active
Person
s who qualify as technicians (Person.isTech()
);
-
getTechs
-
getTechsExpanded
-
getTechs
-
getTechsExpanded
Retrieves a list of active technicians, with options to include only those with time remaining, prioritize elite technicians, and expand the search to include technicians with additional roles.The resulting list includes
Person
objects who qualify as technicians (Person.isTech()
) or, if specified, as expanded technicians (Person.isTechExpanded()
). If the person is part of a self-crewed unit (e.g., an engineer on a self-crewed vessel), they are also included in the list.The returned list can be customized and sorted based on a variety of criteria:
- Technicians with no remaining available time can be excluded if
noZeroMinute
is set totrue
. - The list can be sorted from elite (best) to least skilled if
eliteFirst
is set totrue
. - When
expanded
is set totrue
, technicians with expanded roles (e.g., dual skill sets) are included in addition to regular technicians. - The list is further sorted in the following order:
- By skill level (default: lowest to highest, or highest to lowest if elite-first enabled).
- By available daily tech time (highest to lowest).
- By rank (lowest to highest).
- Parameters:
noZeroMinute
- Iftrue
, excludes technicians with no remaining available minutes.eliteFirst
- Iftrue
, sorts the list to place the most skilled technicians at the top.expanded
- Iftrue
, includes technicians with expanded roles (e.g., those qualifying underPerson.isTechExpanded()
).- Returns:
- A list of active
Person
objects who qualify as technicians or expanded technicians, sorted by skill, available time, and rank as specified by the input parameters.
- Technicians with no remaining available time can be excluded if
-
getAdmins
-
isWorkingOnRefit
-
getDoctors
-
getPatientsFor
-
getLogisticsPerson
Retrieves the best logistics person based on the acquisition skill, personnel category, and maximum acquisitions allowed for the campaign.This method evaluates all active personnel to determine the most suitable candidate for logistics tasks, depending on the specified acquisition skill and rules. The determination is made according to the following logic:
- If the skill is
S_AUTO
, the method immediately returnsnull
. - If the skill is
S_TECH
, the method evaluates personnel based on their technical skill level, ignoring those who are ineligible for procurement or who exceed the maximum acquisition limit. - For all other skills, the method evaluates personnel who possess the specified skill, ensuring their eligibility for procurement and checking that they have not exceeded the maximum acquisition limit.
The "best" logistics person is selected as the one with the highest skill level (based on the skill being evaluated). If no suitable candidate is found, the method returns
null
.- Returns:
- The
Person
representing the best logistics character, ornull
if no suitable person is found.
- If the skill is
-
getSeniorAdminPerson
Finds and returns the most senior administrator for a specific type of administrative role. Seniority is determined using thePerson.outRanksUsingSkillTiebreaker(mekhq.campaign.Campaign, mekhq.campaign.personnel.Person)
method when there are multiple eligible administrators for the specified role.The method evaluates both the primary and secondary roles of each administrator against the provided
Campaign.AdministratorSpecialization
type.The valid types of administrative roles are represented by the
Campaign.AdministratorSpecialization
enum:Campaign.AdministratorSpecialization.COMMAND
- Command AdministratorCampaign.AdministratorSpecialization.LOGISTICS
- Logistics AdministratorCampaign.AdministratorSpecialization.TRANSPORT
- Transport AdministratorCampaign.AdministratorSpecialization.HR
- HR Administrator
- Parameters:
type
- theCampaign.AdministratorSpecialization
representing the administrative role to check for. Passing anull
type will result in anIllegalStateException
.- Returns:
- the most senior
Person
with the specified administrative role, ornull
if no eligible administrator is found.Behavior:
- The method iterates through all administrators retrieved by
getAdmins()
. - For each
Person
, it checks if their primary or secondary role matches the specified type via utility methods likeAdministratorRole#isAdministratorCommand
. - If no eligible administrators exist, the method returns
null
. - If multiple administrators are eligible, the one with the highest seniority is returned.
- Seniority is determined by the
Person.outRanksUsingSkillTiebreaker(mekhq.campaign.Campaign, mekhq.campaign.personnel.Person)
method, which uses a skill-based tiebreaker when necessary.
- The method iterates through all administrators retrieved by
- Throws:
IllegalStateException
- iftype
is null or an unsupported value.
-
getCommander
Retrieves the current campaign commander.If a commander is specifically flagged, that person will be returned. Otherwise, the highest-ranking member among the unit's active personnel is selected.
- Returns:
- the
Person
who is the commander, ornull
if there are no suitable candidates. - Since:
- 0.50.07
-
getSecondInCommand
Retrieves the second-in-command among the unit's active personnel.The second-in-command is determined as the highest-ranking active personnel member who is not the flagged commander (if one exists). If multiple candidates have the same rank, a skill-based tiebreaker is used.
- Returns:
- the
Person
who is considered the second-in-command, ornull
if there are no suitable candidates. - Since:
- 0.50.07
-
getLogisticsPersonnel
Retrieves a list of eligible logistics personnel who can perform procurement actions based on the current campaign options. If acquisitions are set to automatically succeed, an empty list is returned.This method evaluates active personnel to determine who is eligible for procurement actions under the current campaign configuration. Personnel are filtered and sorted based on specific criteria:
- Automatic Success: If the acquisition skill equals
S_AUTO
, an empty list is immediately returned. - Eligibility Filtering: The following checks are applied to filter personnel:
- Personnel must not be ineligible based on the
ProcurementPersonnelPick
category. - Personnel must not have exceeded the maximum acquisition limit, if specified.
- If the skill is
S_TECH
, the person must have a valid technical skill. - For other skills, the person must have the specified skill.
- Personnel must not be ineligible based on the
- Sorting: The resulting list is sorted in descending order by skill level:
- When the skill is
S_TECH
, sorting is based on the person's best technical skill level. - For other skills, sorting is based on the level of the specified skill.
- When the skill is
- Automatic Success: If the acquisition skill equals
-
goShopping
This is the main function for getting stuff (parts, units, etc.) All non-GM acquisition should go through this function to ensure the campaign rules for acquisition are followed.- Parameters:
sList
- - AShoppingList
object including items that need to be purchased- Returns:
- A
ShoppingList
object that includes all items that were not successfully acquired
-
canAcquireParts
Gets a value indicating ifperson
can acquire parts.- Parameters:
person
- ThePerson
to check if they have remaining time to perform acquisitions.- Returns:
- True if
person
could acquire another part, otherwise false.
-
canPayFor
Checks whether the campaign can pay for a givenIAcquisitionWork
item. This will check both whether the campaign is required to pay for a given type of acquisition by the options and if so whether it has enough money to afford it.- Parameters:
acquisition
- - AnIAcquisitionWork
object- Returns:
- true if the campaign can pay for the acquisition; false if it cannot.
-
findContactForAcquisition
public Quartermaster.PartAcquisitionResult findContactForAcquisition(IAcquisitionWork acquisition, Person person, PlanetarySystem system) Make an acquisition roll for a given planet to see if you can identify a contact. Used for planetary based acquisition.- Parameters:
acquisition
- - TheIAcquisitionWork
being acquired.person
- - ThePerson
object attempting to do the acquiring. may be null if no one on the force has the skill or the user is using automatic acquisition.system
- - ThePlanetarySystem
object where the acquisition is being attempted. This may be null if the user is not using planetary acquisition.- Returns:
- The result of the rolls.
-
acquireEquipment
Attempt to acquire a givenIAcquisitionWork
object. This is the default method used by for non-planetary based acquisition.- Parameters:
acquisition
- - TheIAcquisitionWork
being acquired.person
- - ThePerson
object attempting to do the acquiring. may be null if no one on the force has the skill or the user is using automatic acquisition.- Returns:
- a boolean indicating whether the attempt to acquire equipment was successful.
-
workOnMothballingOrActivation
Performs work to either mothball or activate a unit.- Parameters:
unit
- The unit to either work towards mothballing or activation.
-
mothball
Performs work to mothball a unit, preparing it for long-term storage.Mothballing process varies based on unit type:
- Non-Infantry Units:
- Requires an assigned tech
- Consumes tech work minutes
- Requires astech support time (6 minutes per tech minute)
- Infantry Units:
- Uses standard work day time
- No tech required
The process tracks progress and can span multiple work periods until complete.
- Parameters:
unit
- The unit to mothball. Must be active (not already mothballed)
- Non-Infantry Units:
-
activate
Performs work to activate a unit from its mothballed state. This process requires either:- A tech and sufficient astech support time for non-self-crewed units
- Only time for self-crewed units
The activation process:
- Verifies the unit is mothballed
- For non-self-crewed units:
- Checks for assigned tech
- Verifies sufficient tech and astech time
- Consumes tech and astech time
- For self-crewed units:
- Uses standard work day time
- Updates mothball status
- Reports progress or completion
- Parameters:
unit
- The unit to activate. Must be mothballed for activation to proceed.
-
refit
-
fixWarehousePart
Repairs a specified part from the warehouse by creating a clone of it, decrementing the quantity in stock, repairing the cloned part, and optionally adding the repaired part back to the warehouse inventory.If the original part's quantity drops to zero or below, no event notification is triggered. Otherwise, an event is triggered to update the system about changes in the spare part's stock.
-
fixPart
Attempt to fix a part, which may have all kinds of effect depending on part type. -
reloadNews
public void reloadNews()Parses news file and loads news items for the current year. -
readNews
public void readNews()Checks for a news item for the current date. If found, adds it to the daily report. -
getDeploymentDeficit
TODO : I should be part of AtBContract, not Campaign- Parameters:
contract
- an active AtBContract- Returns:
- the current deployment deficit for the contract
-
processNewDayPersonnel
public void processNewDayPersonnel()Processes the daily activities and updates for all personnel that haven't already left the campaign.This method iterates through all personnel and performs various daily updates, including health checks, status updates, relationship events, and other daily or periodic tasks.
The following tasks are performed for each person:
- Death Handling: If the person has died, their processing is skipped for the day.
- Relationship Events: Processes relationship-related events, such as marriage or divorce.
- Reset Actions: Resets the person's minutes left for work and sets acquisitions made to 0.
- Medical Events:
- - If advanced medical care is available, processes the person's daily healing.
- - If advanced medical care is unavailable, decreases the healing wait time and applies natural or doctor-assisted healing.
- Weekly Edge Resets: Resets edge points to their purchased value weekly (applies to support personnel).
- Vocational XP: Awards monthly vocational experience points to the person where applicable.
- Anniversaries: Checks for birthdays or significant anniversaries and announces them as needed.
- autoAwards: On the first day of every month, calculates and awards support points based on roles and experience levels.
Concurrency Note: A separate filtered list of personnel is used to avoid concurrent modification issues during iteration.
This method relies on several helper methods to perform specific tasks for each person, separating the responsibilities for modularity and readability.
-
processNewDayUnits
public void processNewDayUnits() -
newDay
public boolean newDay()- Returns:
true
if the new day arrived
-
checkForNewMercenaryOrganizationStartUp
public void checkForNewMercenaryOrganizationStartUp(boolean bypassStartYear) Checks if a new mercenary organization is starting up in the current game year, and, if so, triggers a welcome dialog introducing the organization's representative.This method examines a prioritized list of known mercenary-related factions for their respective founding (start) years matching the current year. The list is evaluated in the following order: Mercenary Review Board (MRB), Mercenary Review Bonding Commission (MRBC), Mercenary Bonding Authority (MBA), and Mercenary Guild (MG), with MG as the default fallback. If a matching faction is found (and is recognized as a mercenary organization), it generates an appropriate speaker (as either a merchant or military liaison, depending on the faction) and opens a welcome dialog for the player.
The dialog serves to introduce the player to the new mercenary organization, using an in-universe character as the spokesperson.
- Parameters:
bypassStartYear
-true
if the method should be checking if the mercenary organization is currently active, rather than just checking whether it was founded in the current game year.- Since:
- 0.50.07
-
refreshPersonnelMarkets
public void refreshPersonnelMarkets() -
getInitiativeBonus
public int getInitiativeBonus() -
setInitiativeBonus
public void setInitiativeBonus(int bonus) -
applyInitiativeBonus
public void applyInitiativeBonus(int bonus) -
initiativeBonusIncrement
public void initiativeBonusIncrement(boolean change) -
getInitiativeMaxBonus
public int getInitiativeMaxBonus() -
setInitiativeMaxBonus
public void setInitiativeMaxBonus(int bonus) -
getFlaggedCommander
Retrieves the flagged commander from the personnel list. If no flagged commander is found returnsnull
.Usage: consider using
getCommander()
instead.- Returns:
- the flagged commander if present, otherwise
null
-
getSeniorCommander
Deprecated, for removal: This API element is subject to removal in a future version.UsegetCommander()
instead -
removeUnit
-
removePerson
-
removePerson
-
removeAllPatientsFor
-
removeScenario
-
removeMission
-
removeKill
-
removeKillsFor
-
removeForce
-
removeUnitFromForce
-
getForceFor
-
getForceFor
-
restore
public void restore() -
cleanUp
public void cleanUp()Cleans incongruent data present in the campaign -
isOvertimeAllowed
public boolean isOvertimeAllowed() -
setOvertime
public void setOvertime(boolean b) -
isGM
public boolean isGM() -
setGMMode
public void setGMMode(boolean b) -
getFaction
-
isClanCampaign
public boolean isClanCampaign()Determines whether the current campaign is a clan campaign.This method checks if the faction associated with the campaign is a clan, returning
true
if it is, andfalse
otherwise.- Returns:
true
if the campaign belongs to a clan faction,false
otherwise.- Since:
- 0.50.05
-
isPirateCampaign
public boolean isPirateCampaign()Determines whether the current campaign is a pirate campaign.This method checks if the faction associated with the campaign is Pirates, returning
true
if it is, andfalse
otherwise.- Returns:
true
if the campaign is Pirates,false
otherwise.- Since:
- 0.50.07
-
isMercenaryCampaign
public boolean isMercenaryCampaign()Determines whether the current campaign is a mercenary campaign.This method checks if the faction associated with the campaign is Mercenary, returning
true
if it is, andfalse
otherwise.- Returns:
true
if the campaign is Mercenary,false
otherwise.- Since:
- 0.50.07
-
setFaction
-
setFactionDirect
-
getRetainerEmployerCode
-
setRetainerEmployerCode
-
getRetainerStartDate
-
setRetainerStartDate
-
getRawCrimeRating
public int getRawCrimeRating() -
setCrimeRating
public void setCrimeRating(int crimeRating) -
changeCrimeRating
public void changeCrimeRating(int change) Updates the crime rating by the specified change. If improving crime rating, use a positive number, otherwise negative- Parameters:
change
- the change to be applied to the crime rating
-
getCrimePirateModifier
public int getCrimePirateModifier() -
setCrimePirateModifier
public void setCrimePirateModifier(int crimePirateModifier) -
changeCrimePirateModifier
public void changeCrimePirateModifier(int change) Updates the crime pirate modifier by the specified change. If improving the modifier, use a positive number, otherwise negative- Parameters:
change
- the change to be applied to the crime modifier
-
getAdjustedCrimeRating
public int getAdjustedCrimeRating()Calculates the adjusted crime rating by adding the crime rating with the pirate modifier.- Returns:
- The adjusted crime rating.
-
getDateOfLastCrime
-
setDateOfLastCrime
-
getReputation
-
setReputation
-
getFactionStandings
-
setFactionStandings
-
beginReport
Starts a new day for the daily log- Parameters:
r
- - the report String
-
addReport
Formats and then adds a report to the daily log- Parameters:
format
- String with format markers.objects
- Variable list of objects to format intoformat
-
addReport
Adds a report to the daily log- Parameters:
r
- - the report String
-
getCamouflage
public megamek.common.icons.Camouflage getCamouflage() -
setCamouflage
public void setCamouflage(megamek.common.icons.Camouflage camouflage) -
getColour
public megamek.client.ui.util.PlayerColour getColour() -
setColour
public void setColour(megamek.client.ui.util.PlayerColour colour) -
getUnitIcon
-
setUnitIcon
-
addFunds
-
removeFunds
-
payPersonnel
public void payPersonnel(TransactionType type, Money quantity, String description, Map<Person, Money> individualPayouts) Generic method for paying Personnel (Person) in the company. Debits money from the campaign and if the campaign tracks total earnings it will account for that.- Parameters:
type
- TransactionType being debitedquantity
- total money - it's usually displayed outside of this methoddescription
- String displayed in the ledger and reportindividualPayouts
- Map of Person to the Money they're owed
-
getCampaignOptions
-
setCampaignOptions
-
getStoryArc
-
useStoryArc
-
unloadStoryArc
public void unloadStoryArc() -
getCurrentObjectives
-
getFameAndInfamy
Deprecated, for removal: This API element is subject to removal in a future version. -
getAutomatedMothballUnits
Retrieves the list of units that are configured for automated mothballing.Automated mothballing is a mechanism where certain units are automatically placed into a mothballed state, reducing their active maintenance costs and operational demands over time.
-
setAutomatedMothballUnits
Sets the list of units that are configured for automated mothballing.Replaces the current list of units that have undergone automated mothballing.
-
getTemporaryPrisonerCapacity
public int getTemporaryPrisonerCapacity() -
setTemporaryPrisonerCapacity
public void setTemporaryPrisonerCapacity(int temporaryPrisonerCapacity) -
changeTemporaryPrisonerCapacity
public void changeTemporaryPrisonerCapacity(int delta) Adjusts the temporary prisoner capacity by the specified delta value.he new capacity is constrained to be at least the minimum allowed temporary capacity, as defined by
TPrisonerEventManager.MINIMUM_TEMPORARY_CAPACITY
.- Parameters:
delta
- the amount by which to change the temporary prisoner capacity. A positive value increases the capacity, while a negative value decreases it.
-
getRandomEventLibraries
-
getFactionStandingUltimatumsLibrary
-
writeToXML
-
getSystems
-
getSystemById
-
getSystemNames
-
getSystemByName
-
getRankSystem
-
setRankSystem
-
setRankSystemDirect
-
setFinances
-
getFinances
-
getAccountant
-
calculateJumpPath
Calculates and returns aJumpPath
between two planetary systems, using default parameters for jump range and travel safety.This method provides a convenient way to compute the most likely or optimal jump path from the specified starting system to the destination system. Internal behavior and constraints are determined by the method's default parameter settings.
- Parameters:
start
- the startingPlanetarySystem
end
- the destinationPlanetarySystem
- Returns:
- the calculated
JumpPath
between the two systems
-
calculateJumpPath
public JumpPath calculateJumpPath(PlanetarySystem start, PlanetarySystem end, boolean skipAccessCheck, boolean skipEmptySystemCheck) Calculates the optimal jump path between two planetary systems using the A* algorithm.This implementation minimizes a combination of jump counts and recharge times to find the most efficient route between systems. The algorithm uses a heuristic based on straight-line distance combined with actual path costs from the starting system.
The algorithm will optionally avoid systems without population when the
isAvoidingEmptySystems
flag equalstrue
.Implementation is based on: Policy Almanac A* Tutorial
- Parameters:
start
- The starting planetary systemend
- The destination planetary systemskipAccessCheck
-true
to skip checking for Outlaw status in system,false
otherwise. Should befalse
when determining contract-related jump paths as system access is guaranteed for contract target systems.skipEmptySystemCheck
-true
to skip checking for empty system status,false
otherwise. Should befalse
when determining contract-related jump paths.- Returns:
- A
JumpPath
containing the sequence of systems to traverse, ornull
if no valid path exists between the systems. If start and end are the same system, returns a path containing only that system.
-
calculateCostPerJump
This method calculates the cost per jump for interstellar travel. It operates by fitting the part of the force not transported in owned DropShips into a number of prototypical DropShips of a few standard configurations, then adding the JumpShip charges on top. It remains fairly hacky, but improves slightly on the prior implementation as far as following the rulebooks goes.It can be used to calculate total travel costs in the style of FM:Mercs (excludeOwnTransports and campaignOpsCosts set to false), to calculate leased/rented travel costs only in the style of FM:Mercs (excludeOwnTransports true, campaignOpsCosts false), or to calculate travel costs for CampaignOps-style costs (excludeOwnTransports true, campaignOpsCosts true).
- Parameters:
excludeOwnTransports
- If true, do not display maintenance costs in the calculated travel cost.campaignOpsCosts
- If true, use the Campaign Ops method for calculating travel cost. (DropShip monthly fees of 0.5% of purchase cost, 100,000 C-bills per collar.)
-
getSimplifiedTravelTime
Calculates simplified travel time. Travel time is calculated by dividing distance (in LY) by 20 and multiplying the result by 7.- Parameters:
destination
- the planetary system being traveled to- Returns:
- the simplified travel time in days
-
personUpdated
-
getTargetFor
Calculates theTargetRoll
required for a technician to work on a specific part task.This method determines task difficulty and eligibility by evaluating the technician's skills, penalties due to work mode, unit and part constraints, time availability, helper modifiers, and campaign options. It produces context-specific messages when tasks are impossible due to skill, resource, or situation limitations.
The result will reflect all applicable modifiers (such as overtime or era-based penalties) and communicates if a task is impossible, or has automatic success (e.g., for infantry refits).
- Parameters:
partWork
- the part work task to be performedtech
- the technician assigned to the task- Returns:
- a
TargetRoll
capturing the total target value and reason for success or impossibility
-
getTargetForMaintenance
-
getTargetForAcquisition
-
getTargetForAcquisition
public megamek.common.TargetRoll getTargetForAcquisition(IAcquisitionWork acquisition, @Nullable Person person) -
getCurrentPlanetaryConditions
public megamek.common.planetaryconditions.PlanetaryConditions getCurrentPlanetaryConditions(Scenario scenario) -
getTargetForAcquisition
public megamek.common.TargetRoll getTargetForAcquisition(IAcquisitionWork acquisition, @Nullable Person person, boolean checkDaysToWait) Determines the target roll required for successfully acquiring a specific part or unit based on various campaign settings, the acquisition details, and the person attempting the acquisition.This method evaluates multiple conditions and factors to calculate the target roll, returning one of the following outcomes:
TargetRoll.AUTOMATIC_SUCCESS
if acquisitions are set to be automatic in the campaign options.TargetRoll.IMPOSSIBLE
if the acquisition is not permitted based on campaign settings, such as missing personnel, parts restrictions, or unavailable technology.- A calculated target roll value based on the skill of the assigned person,
acquisition modifiers,
and adjustments for specific campaign rules (e.g.,
AtB
restrictions).
- Parameters:
acquisition
- theIAcquisitionWork
object containing details about the requested part or supply, such as tech base, technology level, and availability.- Returns:
- a
TargetRoll
object representing the roll required to successfully acquire the requested item, or an impossible/automatic result under specific circumstances.
-
findAtBPartsAvailabilityLevel
public int findAtBPartsAvailabilityLevel() -
resetAstechMinutes
public void resetAstechMinutes() -
setAstechPoolMinutes
public void setAstechPoolMinutes(int minutes) -
getAstechPoolMinutes
public int getAstechPoolMinutes() -
setAstechPoolOvertime
public void setAstechPoolOvertime(int overtime) -
getAstechPoolOvertime
public int getAstechPoolOvertime() -
getPossibleAstechPoolMinutes
public int getPossibleAstechPoolMinutes() -
getPossibleAstechPoolOvertime
public int getPossibleAstechPoolOvertime() -
setAstechPool
public void setAstechPool(int size) -
getAstechPool
public int getAstechPool() -
setMedicPool
public void setMedicPool(int size) -
getMedicPool
public int getMedicPool() -
requiresAdditionalAstechs
public boolean requiresAdditionalAstechs() -
getAstechNeed
public int getAstechNeed() -
increaseAstechPool
public void increaseAstechPool(int i) -
fillAstechPool
public void fillAstechPool() -
decreaseAstechPool
public void decreaseAstechPool(int i) -
getNumberAstechs
public int getNumberAstechs() -
getNumberPrimaryAstechs
public int getNumberPrimaryAstechs()Returns the total number of primary astechs available.This method calculates the number of astechs by adding the base astech pool to the count of active personnel whose primary role is an astech, who are not currently deployed, and are employed.
- Returns:
- the total number of primary astechs
-
getNumberSecondaryAstechs
public int getNumberSecondaryAstechs()Returns the total number of secondary astechs available.This method calculates the number of astechs by adding the base astech pool to the count of active personnel whose secondary role is an astech, who are not currently deployed, and are employed.
- Returns:
- the total number of secondary astechs
-
getAvailableAstechs
public int getAvailableAstechs(int minutes, boolean alreadyOvertime) -
getShorthandedMod
public int getShorthandedMod(int availableHelp, boolean medicalStaff) -
getShorthandedModForCrews
public int getShorthandedModForCrews(@Nullable megamek.common.Crew crew) -
getMedicsPerDoctor
public int getMedicsPerDoctor() -
getNumberMedics
public int getNumberMedics()- Returns:
- the number of medics in the campaign including any in the temporary medic pool
-
requiresAdditionalMedics
public boolean requiresAdditionalMedics() -
getMedicsNeed
public int getMedicsNeed() -
increaseMedicPool
public void increaseMedicPool(int i) -
fillMedicPool
public void fillMedicPool() -
decreaseMedicPool
public void decreaseMedicPool(int i) -
getGameOptions
public megamek.common.options.GameOptions getGameOptions() -
getGameOptionsVector
-
setGameOptions
public void setGameOptions(megamek.common.options.GameOptions gameOptions) -
setGameOptions
-
importKill
Imports aKill
into a campaign.- Parameters:
k
- AKill
to import into the campaign.
-
addKill
-
getKills
-
getKillsFor
-
getPartsStore
-
addCustom
-
isCustom
-
getUnitRatingText
Returns the text representation of the unit rating based on the selected unit rating method. If the unit rating method is FMMR, the unit rating value is returned. If the unit rating method is Campaign Operations, the reputation rating and unit rating modification are combined and returned. If the unit rating method is neither FMMR nor Campaign Operations, "N/A" is returned.- Returns:
- The text representation of the unit rating
-
getAtBUnitRatingMod
public int getAtBUnitRatingMod()Retrieves the unit rating modifier based on campaign options. If the unit rating method is not enabled, it returns the default value of IUnitRating.DRAGOON_C. If the unit rating method uses FMMR, it returns the unit rating as an integer. Otherwise, it calculates the modifier using the getAtBModifier method.- Returns:
- The unit rating modifier based on the campaign options.
-
getCommanderStrategy
public int getCommanderStrategy()Returns the Strategy skill of the designated commander in the campaign.- Returns:
- The value of the commander's strategy skill if a commander exists, otherwise 0.
-
getRandomSkillPreferences
-
setRandomSkillPreferences
-
setStartingSystem
- Parameters:
planet
- the starting planet, or null to use the faction default
-
assignRandomPortraitFor
Assigns a random portrait to aPerson
.- Parameters:
person
- ThePerson
who should receive a randomized portrait.
-
assignRandomOriginFor
Assigns a random origin to aPerson
.- Parameters:
person
- ThePerson
who should receive a randomized origin.
-
clearGameData
public void clearGameData(megamek.common.Entity entity) Clears Transient Game Data for an Entity- Parameters:
entity
- the entity to clear the game data for
-
refreshNetworks
public void refreshNetworks() -
disbandNetworkOf
-
removeUnitsFromNetwork
-
addUnitsToNetwork
-
getAvailableC3iNetworks
-
getAvailableNC3Networks
- Returns:
- returns a Vector of the unique name Strings of all Naval C3 networks that have at least 1 free node Adapted from getAvailableC3iNetworks() as the two technologies have very similar workings
-
getAvailableC3MastersForSlaves
-
getAvailableC3MastersForMasters
-
removeUnitsFromC3Master
-
reloadGameEntities
public void reloadGameEntities()This function reloads the game entities into the game at the end of scenario resolution, so that entities are properly updated and destroyed ones removed -
completeMission
-
calculatePartTransitTime
Calculate transit time for supplies based on what planet they are shipping from. To prevent extra computation. This method does not calculate an exact jump path but rather determines the number of jumps crudely by dividing distance in light years by 30 and then rounding up. Total part-time is determined by several by adding the following: - (number of jumps - 1) * 7 days with a minimum value of zero. - transit times from current planet and planet of supply origins in cases where the supply planet is not the same as current planet. - a random 1d6 days for each jump plus 1d6 to simulate all the other logistics of delivery.- Parameters:
system
- - APlanetarySystem
object where the supplies are shipping from- Returns:
- the number of days that supplies will take to arrive.
-
calculatePartTransitTime
public int calculatePartTransitTime(int availability) Calculates the transit time for the arrival of parts or supplies based on the availability of the item, a random roll, and campaign-specific transit time settings.The transit time is calculated using the following factors:
- A fixed base modifier value defined by campaign rules.
- A random roll of 1d6 to add variability to the calculation.
- The availability value of the requested parts or supplies from the acquisition details.
The calculated duration is applied in units (days, weeks, or months) based on the campaign's configuration for transit time.
- Parameters:
availability
- the availability code of the part or unit being acquired as an integer.- Returns:
- the number of days required for the parts or units to arrive based on the calculated transit time.
-
calculatePartTransitTime
public int calculatePartTransitTime(megamek.common.ITechnology.AvailabilityValue availability) Calculates the transit time for the arrival of parts or supplies based on the availability of the item, a random roll, and campaign-specific transit time settings.The transit time is calculated using the following factors:
- A fixed base modifier value defined by campaign rules.
- A random roll of 1d6 to add variability to the calculation.
- The availability value of the requested parts or supplies from the acquisition details.
The calculated duration is applied in units (days, weeks, or months) based on the campaign's configuration for transit time.
- Parameters:
availability
- the Availability of the part- Returns:
- the number of days required for the parts or units to arrive based on the calculated transit time.
-
getPartInventory
This returns a PartInventory object detailing the current count for a part on hand, in transit, and ordered.- Parameters:
part
- A part to look up its current inventory.- Returns:
- A PartInventory object detailing the current counts of the part on hand, in transit, and ordered.
- See Also:
-
addLoan
-
payOffLoan
-
getTransports
public Map<TransporterType,Map<Double, getTransportsSet<UUID>>> (CampaignTransportType campaignTransportType) Returns a Map that maps Transporter types to another Map that maps capacity (Double) to UUID of transports for the specific TransportedUnitSummary type- Parameters:
campaignTransportType
- type (Enum) of TransportedUnitSummary- Returns:
- the full map for that campaign transport type
-
getTransportsByType
public Set<Unit> getTransportsByType(CampaignTransportType campaignTransportType, TransporterType transporterType) Returns list of transports that have the provided TransporterType and CampaignTransportType- Parameters:
campaignTransportType
- type of campaign transporttransporterType
- type of Transporter- Returns:
- units that have that transport type
-
getTransportsByType
public Set<Unit> getTransportsByType(CampaignTransportType campaignTransportType, TransporterType transporterType, double unitSize) Returns list of transports for the specified AbstractTransportedUnitSummary class/subclass that has transport capacity for the Transporter class/subclass For example, getTransportsByType(SHIP_TRANSPORT, MEK_BAY, 3.0) would return all transports that have 3 or more Mek Bay slots open for the SHIP_TRANSPORT type of assignment.- Parameters:
campaignTransportType
- type (Enum) of TransportedUnitSummarytransporterType
- type (Enum) of TransporterunitSize
- capacity that the transport must be capable of- Returns:
- units that have that transport type
-
hasTransports
Do we have transports for the kind of transport?- Parameters:
campaignTransportType
- class of the TransportDetail- Returns:
- true if it has transporters, false otherwise
-
doMaintenance
-
initTimeInService
Deprecated, for removal: This API element is subject to removal in a future version.No longer in use -
initTimeInRank
Deprecated, for removal: This API element is subject to removal in a future version.No longer in use -
initTurnover
public void initTurnover() -
initAtB
public void initAtB(boolean newCampaign) -
shutdownAtB
public void shutdownAtB()Stop processing AtB events and release memory. -
checkTurnoverPrompt
public int checkTurnoverPrompt()Checks if an employee turnover prompt should be displayed based on campaign options, current date, and other conditions (like transit status and campaign start date).The turnover prompt is triggered based on the configured turnover frequency (weekly, monthly, quarterly, or annually), but only after the campaign has been running for at least 6 days and when not in transit.
The dialog will show different messages depending on whether there are pending retirees.
- Returns:
- An integer representing the outcome: -1 if turnover prompt should not be displayed, 0 if user selected "Employee Turnover", 1 if user selected "Advance Day Regardless", 2 if user selected "Cancel Advance Day"
-
checkScenariosDue
public boolean checkScenariosDue()Checks if there are any scenarios that are due based on the current date.- Returns:
true
if there are scenarios due,false
otherwise
-
setUnitRating
Sets the type of rating method used. -
getUnitRating
Returns the type of rating method as selected in the Campaign Options dialog. Lazy-loaded for performance. Default is CampaignOpsReputation -
getTechIntroYear
public int getTechIntroYear()- Specified by:
getTechIntroYear
in interfacemegamek.common.ITechManager
-
getGameYear
public int getGameYear()- Specified by:
getGameYear
in interfacemegamek.common.ITechManager
-
getTechFaction
public megamek.common.ITechnology.Faction getTechFaction()- Specified by:
getTechFaction
in interfacemegamek.common.ITechManager
-
updateTechFactionCode
public void updateTechFactionCode() -
useClanTechBase
public boolean useClanTechBase()- Specified by:
useClanTechBase
in interfacemegamek.common.ITechManager
-
useMixedTech
public boolean useMixedTech()- Specified by:
useMixedTech
in interfacemegamek.common.ITechManager
-
getTechLevel
public megamek.common.SimpleTechLevel getTechLevel()- Specified by:
getTechLevel
in interfacemegamek.common.ITechManager
-
unofficialNoYear
public boolean unofficialNoYear()- Specified by:
unofficialNoYear
in interfacemegamek.common.ITechManager
-
useVariableTechLevel
public boolean useVariableTechLevel()- Specified by:
useVariableTechLevel
in interfacemegamek.common.ITechManager
-
showExtinct
public boolean showExtinct()- Specified by:
showExtinct
in interfacemegamek.common.ITechManager
-
getAutoResolveBehaviorSettings
public megamek.client.bot.princess.BehaviorSettings getAutoResolveBehaviorSettings() -
setAutoResolveBehaviorSettings
public void setAutoResolveBehaviorSettings(megamek.client.bot.princess.BehaviorSettings settings) -
getCommanderAddress
Retrieves the address or form of address for the commander.This method determines the appropriate address based on whether the campaign is considered a pirate campaign. It delegates to
getCommanderAddress(boolean)
with the result ofisPirateCampaign()
.- Returns:
- the string used to address the commander
-
getCommanderAddress
Retrieves the address or title for the commanding officer, either in a formal or informal format.This method checks for the presence of a flagged commander. If no commander is found, a general fallback address is returned based on the specified formality. If a commander is present, it further tailors the address based on the gender of the commander (for informal styles) or their rank and surname (for formal styles).
- Parameters:
isInformal
- A boolean flag indicating whether the address should be informal (true for informal, false for formal).- Returns:
- A
String
representing the appropriate address for the commander, either formal or informal.
-
stockUpPartsInUse
-
stockUpPartsInUseGM
-
isProcessProcurement
public boolean isProcessProcurement() -
setProcessProcurement
public void setProcessProcurement(boolean processProcurement) -
getPartsInUseRequestedStockMap
-
setPartsInUseRequestedStockMap
-
getIgnoreMothballed
public boolean getIgnoreMothballed() -
setIgnoreMothballed
public void setIgnoreMothballed(boolean ignoreMothballed) -
getTopUpWeekly
public boolean getTopUpWeekly() -
setTopUpWeekly
public void setTopUpWeekly(boolean topUpWeekly) -
getIgnoreSparesUnderQuality
-
setIgnoreSparesUnderQuality
-
writePartInUseToXML
-
writePartInUseMapToXML
-
wipePartsInUseMap
public void wipePartsInUseMap()Wipes the Parts in use map for the purpose of resetting all values to their default -
getCampaignFactionIcon
Retrieves the campaign faction icon for the specifiedCampaign
. If a custom icon is defined in the campaign's unit icon configuration, that icon is used. Otherwise, a default faction logo is fetched based on the campaign's faction short name.- Returns:
- An
ImageIcon
representing the faction icon for the given campaign.
-
checkLinkedScenario
public boolean checkLinkedScenario(int scenarioID) Checks if another active scenario has this scenarioID as it's linkedScenarioID and returns true if it finds one. -
getAllCombatEntities
Returns a list of entities (units) from all combat forces.- Returns:
- a list of entities representing all combat units in the player force
-
getNewCampaignStartingPlanet
Determines the appropriate starting planet for a new campaign based on campaign type, faction, and various fallback scenarios.This method first checks if the campaign is classified as a mercenary or pirate campaign. If so, it delegates responsibility to
getMercenaryOrPirateStartingPlanet(Factions, String)
, which implements special logic to handle those campaign types.For all other campaign types, it uses the current campaign's faction to attempt to retrieve that faction’s canonical starting system for the current game date. If no valid system can be found (due to, for example, the faction not having a valid capital), the logic falls back to a default faction’s starting planet, and, if necessary, ultimately falls back to the planet Terra as a default universal location.
The method also includes special handling for Clan campaigns: if the fallback logic would result in the campaign starting on Terra but the campaign is clan-based, it attempts to relocate the starting planet to Strana Mechty.
- Returns:
- the
Planet
instance where the campaign should start - Since:
- 0.50.07
-
recruitPerson(Person, boolean, boolean)
instead