Class StratConScenarioTempo
Each Monday, the contract rolls 1 time per point of
Scale (rounded normally, never below once). Each roll picks a random sector and rolls against that sector's threat
(see StratConRulesManager.calculateScenarioOdds(mekhq.campaign.digitalGM.stratCon.StratConTrackState, mekhq.campaign.mission.contract.AbstractContract, boolean)); a hit brings a normal scenario to that sector on a random day
of the week (see rollWeeklyScenarios(mekhq.campaign.mission.contract.AbstractContract, mekhq.campaign.digitalGM.stratCon.StratConCampaignState, java.time.LocalDate)). A peaceful contract's threat is nothing, so it rolls no scenarios.
Single Drop play keeps its own pace of one scenario a week. A contract accepted before normal scenarios were rolled each week keeps the schedule it was given up front until it is edited or extended.
- Since:
- 0.51.01
-
Method Summary
Modifier and TypeMethodDescriptionstatic intgetDaysLeftInWeek(LocalDate date) static booleanisWeeklyRollDue(StratConCampaignState campaignState, LocalDate today) Decides whether a contract's weekly scenario roll is due: it has not been made yet this week, Monday to Sunday.static voidregenerateSchedules(Campaign campaign, AbstractContract contract, StratConCampaignState campaignState) Lays a contract's pre-rolled schedules out again from today, after an edit to something they were laid out from - the contract's Scale, length, or dates - or an emergency extension.static introllWeeklyScenarios(AbstractContract contract, StratConCampaignState campaignState, LocalDate today) Makes the week's normal scenario rolls for a contract: 1 per point of Scale, rounded normally, never below one.static inttakeDueScenarioDates(List<LocalDate> scheduledDates, LocalDate today) Takes every date on or before today off a schedule and counts how many are now due.static List<StratConScheduledScenario> takeDueScheduledScenarios(List<StratConScheduledScenario> scheduledScenarios, LocalDate today) Takes every scheduled normal scenario due on or before today off the schedule, astakeDueScenarioDates(java.util.List<java.time.LocalDate>, java.time.LocalDate)does for dates alone.
-
Method Details
-
takeDueScenarioDates
Takes every date on or before today off a schedule and counts how many are now due.A date is due if it falls today, or at most
MAXIMUM_SCENARIO_CATCH_UP_DAYSdays before. That way a date set for a day the new day has already processed - by editing or extending the contract - still brings what it is for the next day, instead of sitting on the schedule forever. Older dates are discarded.Used for ordinary scenario dates, enemy engineers, and facility attacks alike.
- Parameters:
scheduledDates- the schedule; due and stale dates are removed from ittoday- the current campaign date- Returns:
- how many are due today
- Since:
- 0.51.01
-
takeDueScheduledScenarios
public static List<StratConScheduledScenario> takeDueScheduledScenarios(List<StratConScheduledScenario> scheduledScenarios, LocalDate today) Takes every scheduled normal scenario due on or before today off the schedule, astakeDueScenarioDates(java.util.List<java.time.LocalDate>, java.time.LocalDate)does for dates alone.- Parameters:
scheduledScenarios- the contract's scheduled normal scenarios; due and stale ones are removed from ittoday- the current campaign date- Returns:
- the scenarios due today, at most
MAXIMUM_SCENARIO_CATCH_UP_DAYSdays late - Since:
- 0.51.01
-
isWeeklyRollDue
Decides whether a contract's weekly scenario roll is due: it has not been made yet this week, Monday to Sunday. Ordinarily that is on Monday; but a contract that starts midweek, or a week whose Monday was skipped, still rolls on the first day of the week that is processed.- Parameters:
campaignState- the contract's StratCon campaign statetoday- the current campaign date- Returns:
trueif this week's roll is still to be made- Since:
- 0.51.01
-
getDaysLeftInWeek
- Parameters:
date- a day- Returns:
- how many days are left in the day's week, counting the day itself: 7 on a Monday, 1 on a Sunday
- Since:
- 0.51.01
-
rollWeeklyScenarios
public static int rollWeeklyScenarios(AbstractContract contract, StratConCampaignState campaignState, LocalDate today) Makes the week's normal scenario rolls for a contract: 1 per point of Scale, rounded normally, never below one. Each roll picks a random sector and rolls d100 against its threat - the chance shown on the sector's threat bar (seeStratConRulesManager.calculateScenarioOdds(mekhq.campaign.digitalGM.stratCon.StratConTrackState, mekhq.campaign.mission.contract.AbstractContract, boolean)). A hit schedules a normal scenario in that sector on a random day of what is left of the week, today included. One that would fall on or after the contract's last day is not scheduled.- Parameters:
contract- the contractcampaignState- the contract's StratCon campaign statetoday- the day of the rolls: ordinarily a Monday (seeisWeeklyRollDue(mekhq.campaign.digitalGM.stratCon.StratConCampaignState, java.time.LocalDate))- Returns:
- how many normal scenarios were scheduled
- Since:
- 0.51.01
-
regenerateSchedules
public static void regenerateSchedules(Campaign campaign, AbstractContract contract, StratConCampaignState campaignState) Lays a contract's pre-rolled schedules out again from today, after an edit to something they were laid out from - the contract's Scale, length, or dates - or an emergency extension. Everything scheduled from today on is replaced; what has already happened, and anything already overdue, is left alone.- A contract still on the up-front schedule of normal scenarios it was given before they were rolled each
week drops what remains of it and moves onto the weekly rolls (see
rollWeeklyScenarios(mekhq.campaign.mission.contract.AbstractContract, mekhq.campaign.digitalGM.stratCon.StratConCampaignState, java.time.LocalDate)), except in Single Drop play, which keeps its own weekly pace. - The contract's Essential scenarios are laid out again (see
AbstractContractGeneration.rollScenarioSchedule(mekhq.campaign.Campaign, mekhq.campaign.mission.contract.AbstractContract, int)), if it fights any (seeStratConContractInitializer.usesEssentialScenarios(mekhq.campaign.mission.contract.AbstractContract, boolean)). - Points of interest are scheduled again (see
StratConContractInitializer.schedulePointsOfInterest(AbstractContract, StratConContractDefinition, StratConCampaignState, boolean, LocalDate, int, Map)). Those already placed, or due and waiting for room, count against the contract's share, as do the marks they carry (seeStratConCampaignState.recordPlacedPointOfInterest(mekhq.campaign.digitalGM.stratCon.pointOfInterest.StratConScheduledPointOfInterest)). - Outside Single Drop play, enemy engineers and facility attacks are scheduled again (see
StratConEnemyFacilityActivity.scheduleEnemyEngineers(mekhq.campaign.mission.contract.AbstractContract, mekhq.campaign.digitalGM.stratCon.StratConCampaignState, java.time.LocalDate)andStratConFacilityAttacks.scheduleFacilityAttacks(mekhq.campaign.mission.contract.AbstractContract, mekhq.campaign.digitalGM.stratCon.StratConCampaignState, java.time.LocalDate)).
Mapless play has no Essential scenarios, points of interest, or facilities, so only its normal scenarios are affected.
- Parameters:
campaign- the current campaigncontract- the edited contractcampaignState- the contract's StratCon campaign state- Since:
- 0.51.01
- A contract still on the up-front schedule of normal scenarios it was given before they were rolled each
week drops what remains of it and moves onto the weekly rolls (see
-