Class ContractCharacteristics
java.lang.Object
mekhq.campaign.mission.contract.utilities.ContractCharacteristics
Rolls and applies a contract's random
ContractCharacteristics. This is the single home for characteristic
mechanics: the roll, the generation-time effects that are baked straight into the contract's stored data, and the
derived values (bonus payments and reputation/standing multipliers) that the accept, completion, and negotiation
hooks read at their own point in the contract lifecycle.
Characteristics obey a strict grammar: each acts on exactly one lever, at most one characteristic per
ContractCharacteristic.Category is ever present, and the magnitude on each constant is interpreted per category.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MoneybakeCombatPay(Money base, AbstractContract contract) Applies the combat-pay characteristic (ContractCharacteristic.Category.COMBAT_PAY) to a freshly-computed combat pay.static intbakeLength(int base, AbstractContract contract) Applies the length characteristic (ContractCharacteristic.Category.LENGTH) to a freshly-computed contract length.static MoneybakeMonthlyPay(Money base, AbstractContract contract) Applies the pay characteristic (ContractCharacteristic.Category.PAY) to a freshly-computed monthly pay.static intbakeRequiredVictoryPoints(int base, AbstractContract contract) Applies the objectives characteristic (ContractCharacteristic.Category.OBJECTIVES) to a freshly-computed required victory-point count.static intbakeTrackCount(int base, AbstractContract contract) Applies the intensity characteristic (ContractCharacteristic.Category.INTENSITY) to a freshly-computed track count.static doublegetEmployerRegardMultiplier(AbstractContract contract) The multiplier to apply to the employer faction-standing change from this contract.static doublegetEnemyRegardMultiplier(AbstractContract contract) The multiplier to apply to the enemy faction-standing loss taken for this contract.static megamek.common.enums.SkillLevelgetNegotiatorSkillOverride(AbstractContract contract) The enemy negotiator's skill-tier override.static doublegetUnitReputationMultiplier(AbstractContract contract, MissionStatus status) The multiplier to apply to a unit-reputation change from this contract, given how the contract ended.static voidpayCompletionBonus(Campaign campaign, AbstractContract contract, MissionStatus status) Credits the completion bonus, if the contract carries one and was completed successfully.static voidpaySigningBonus(Campaign campaign, AbstractContract contract) Credits the signing bonus, if the contract carries one.static voidrollAndApply(AbstractContract contract, Campaign campaign) If the campaign opts in, rolls this contract's characteristics, stores them, and applies the ones that are baked into the contract at generation (pay, combat pay, length, objectives).static voidsyncNegotiatorTier(AbstractContract contract, Campaign campaign) Sets the employer negotiator's tier to match the contract's negotiator characteristic: Elite forContractCharacteristic.ELITE_NEGOTIATOR, Regular forContractCharacteristic.NOVICE_NEGOTIATOR, or Veteran (the baseline) when neither is present.
-
Method Details
-
rollAndApply
If the campaign opts in, rolls this contract's characteristics, stores them, and applies the ones that are baked into the contract at generation (pay, combat pay, length, objectives). The lifecycle characteristics - the negotiator tier, the bonus payments, and the reputation/standing multipliers - are left for their own hooks to read. Does nothing if the option is off.- Parameters:
contract- the freshly generated contract to characterizecampaign- the campaign, consulted forUSE_RANDOM_CONTRACT_CHARACTERISTICSand used to re-tier the employer negotiator
-
paySigningBonus
Credits the signing bonus, if the contract carries one.ContractCharacteristic.SIGNING_BONUSshifts 5% of total pay up front; that 5% was removed from monthly pay at generation and is handed over now, on acceptance. Does nothing if there is no signing bonus. Call this from the contract-acceptance flow. -
payCompletionBonus
public static void payCompletionBonus(Campaign campaign, AbstractContract contract, MissionStatus status) Credits the completion bonus, if the contract carries one and was completed successfully.ContractCharacteristic.COMPLETION_BONUSpays a bonus worth a fraction of total pay on top of the contract. Does nothing otherwise. Call this from the contract-completion flow. -
getUnitReputationMultiplier
The multiplier to apply to a unit-reputation change from this contract, given how the contract ended.- A breach penalty is never scaled by a reputation characteristic.
- A success reputation gain is scaled by all four characteristics
(
ContractCharacteristic.HIGH_PROFILE/ContractCharacteristic.CAREER_MAKERdouble it,ContractCharacteristic.MEDIA_BLACKOUT/ContractCharacteristic.THANKLESSremove it). - A non-breach loss (a failed contract, only meaningful when the Hinterlands failure-loss option is
on) is scaled only by the "gains and losses" pair -
ContractCharacteristic.HIGH_PROFILEandContractCharacteristic.MEDIA_BLACKOUT. The "gains only" pair (ContractCharacteristic.CAREER_MAKER/ContractCharacteristic.THANKLESS) leaves it alone.
- Returns:
- the multiplier, or
1.0when no unit-reputation characteristic applies to this outcome
-
getEmployerRegardMultiplier
The multiplier to apply to the employer faction-standing change from this contract.- Returns:
- the multiplier, or
1.0when no employer-standing characteristic applies
-
getEnemyRegardMultiplier
The multiplier to apply to the enemy faction-standing loss taken for this contract.- Returns:
- the multiplier, or
1.0when no enemy-standing characteristic applies
-
getNegotiatorSkillOverride
@Nullable public static megamek.common.enums.SkillLevel getNegotiatorSkillOverride(AbstractContract contract) The enemy negotiator's skill-tier override.- Returns:
SkillLevel.ELITEforContractCharacteristic.ELITE_NEGOTIATOR,SkillLevel.REGULARforContractCharacteristic.NOVICE_NEGOTIATOR, ornullto keep the default tier
-
bakeMonthlyPay
Applies the pay characteristic (ContractCharacteristic.Category.PAY) to a freshly-computed monthly pay. Used by the GM editor when monthly pay is on "Automatic": the base is recomputed from the generator each commit, so multiplying the characteristic on top stays idempotent.- Returns:
basescaled by the pay characteristic, orbaseunchanged if the contract has none
-
bakeCombatPay
Applies the combat-pay characteristic (ContractCharacteristic.Category.COMBAT_PAY) to a freshly-computed combat pay. AsbakeMonthlyPay(mekhq.campaign.finances.Money, mekhq.campaign.mission.contract.AbstractContract), for use when combat pay is on "Automatic".- Returns:
basescaled by the combat-pay characteristic, orbaseunchanged if the contract has none
-
bakeRequiredVictoryPoints
Applies the objectives characteristic (ContractCharacteristic.Category.OBJECTIVES) to a freshly-computed required victory-point count. AsbakeMonthlyPay(mekhq.campaign.finances.Money, mekhq.campaign.mission.contract.AbstractContract), for use when the victory points are on "Automatic".- Returns:
basestepped by the objectives characteristic (never below 1), orbaseif there is none
-
bakeTrackCount
Applies the intensity characteristic (ContractCharacteristic.Category.INTENSITY) to a freshly-computed track count. AsbakeMonthlyPay(mekhq.campaign.finances.Money, mekhq.campaign.mission.contract.AbstractContract), for use when the track count is on "Automatic".- Returns:
basestepped by the intensity characteristic (never below 1), orbaseif there is none
-
bakeLength
Applies the length characteristic (ContractCharacteristic.Category.LENGTH) to a freshly-computed contract length. AsbakeMonthlyPay(mekhq.campaign.finances.Money, mekhq.campaign.mission.contract.AbstractContract), for use when the length is on "Automatic".- Returns:
basescaled by the length characteristic (never below 1 month), orbaseif there is none
-
syncNegotiatorTier
Sets the employer negotiator's tier to match the contract's negotiator characteristic: Elite forContractCharacteristic.ELITE_NEGOTIATOR, Regular forContractCharacteristic.NOVICE_NEGOTIATOR, or Veteran (the baseline) when neither is present. Used by the GM editor so a change of selection is reflected on the negotiator; safe to call repeatedly.
-