Skip to content

Commit

Permalink
feat: Added check for academy destruction based on system population …
Browse files Browse the repository at this point in the history
…on EducationController

- Included a check for system depopulation, implying academy destruction in EducationController
- Modified checkForAcademyDestruction to take into account system's population depletion
  • Loading branch information
IllianiCBT committed Jun 23, 2024
1 parent d9aaa59 commit 84716b6
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,13 @@ private static void processNewWeekChecks(Campaign campaign, Academy academy, Per
}
}

// has the system been depopulated? Nominally similar to the above, but here we use actual system data, so it's more dynamic.
if (campaign.getSystemById(person.getEduAcademySystem()).getPopulation(campaign.getLocalDate()) == 0) {
if (checkForAcademyDestruction(campaign, academy, person, resources)) {
return;
}
}

// is the academy faction at war with person faction, or the campaign faction?
if (checkForAcademyFactionConflict(campaign, academy, person, resources)) {
return;
Expand Down Expand Up @@ -658,7 +665,9 @@ private static boolean checkForAcademyClosure(Campaign campaign, Academy academy
* @return true if the academy has been destroyed, false otherwise
*/
private static boolean checkForAcademyDestruction(Campaign campaign, Academy academy, Person person, ResourceBundle resources) {
if (campaign.getLocalDate().getYear() >= academy.getDestructionYear()) {
// we assume that if the system's population has been depleted, the academy has been destroyed too.
if ((campaign.getLocalDate().getYear() >= academy.getDestructionYear())
|| (campaign.getSystemById(person.getEduAcademySystem()).getPopulation(campaign.getLocalDate()) == 0)) {
if ((!person.isChild(campaign.getLocalDate())) || (campaign.getCampaignOptions().isAllAges())) {
if (Compute.d6(2) >= 5) {
campaign.addReport(person.getHyperlinkedName() + ' ' + resources.getString("eventDestruction.text"));
Expand Down

0 comments on commit 84716b6

Please sign in to comment.