Skip to content

Commit

Permalink
Merge pull request #3670 from cjdhein/ForceRegenFix
Browse files Browse the repository at this point in the history
Fix #3600
  • Loading branch information
NickAragua committed May 17, 2023
2 parents f7c2078 + d3f3f54 commit e073215
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ public static AtBDynamicScenario initializeScenarioFromTemplate(ScenarioTemplate
* @param campaign Current campaign.
*/
public static void finalizeScenario(AtBDynamicScenario scenario, AtBContract contract, Campaign campaign) {
// if scenario already had bots, then we need to reset the briefing to remove text related to old scenario modifiers
if (scenario.getNumBots() > 0) {
scenario.setDesc(String.format("%s", scenario.getTemplate().detailedBriefing));
}
// just in case, clear old bot forces.
for (int x = scenario.getNumBots() - 1; x >= 0; x--) {
scenario.removeBotForce(x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,16 @@ public static void appendScenarioBriefingText(AtBDynamicScenario scenario, Strin
* Applies an objective to the scenario.
*/
public static void applyObjective(AtBDynamicScenario scenario, Campaign campaign, ScenarioObjective objective, EventTiming timing) {
// if we're doing this before force generation, just add the objective for future translation
scenario.getTemplate().scenarioObjectives.add(objective);

// if we're doing it after, we have to translate it individually
if (timing == EventTiming.PostForceGeneration) {
ScenarioObjective actualObjective = AtBDynamicScenarioFactory.translateTemplateObjective(scenario, campaign, objective);
scenario.getScenarioObjectives().add(actualObjective);
// Only apply objective if it isn't already added
if (!scenario.getTemplate().scenarioObjectives.contains(objective)) {
// if we're doing this before force generation, just add the objective for future translation
scenario.getTemplate().scenarioObjectives.add(objective);

// if we're doing it after, we have to translate it individually
if (timing == EventTiming.PostForceGeneration) {
ScenarioObjective actualObjective = AtBDynamicScenarioFactory.translateTemplateObjective(scenario, campaign, objective);
scenario.getScenarioObjectives().add(actualObjective);
}
}
}

Expand Down

0 comments on commit e073215

Please sign in to comment.