Added difficulty modifier for clearing sectors upon loss

This commit is contained in:
Anuken 2025-09-29 08:47:59 -04:00
parent 72ce49a753
commit 32b9ff9f5d
6 changed files with 17 additions and 5 deletions

View file

@ -1450,6 +1450,8 @@ rules.buildaitier = Builder AI Tier
rules.rtsai = RTS AI
rules.rtsai.campaign = RTS Attack AI
rules.rtsai.campaign.info = In attack maps, makes units group up and attack player bases in a more intelligent manner.
rules.clearsectoronloss = Clear Sector On Loss
rules.clearsectoronloss.info = When the sector is lost, player buildings from the previous attempt will not carry over.
rules.rtsminsquadsize = Min Squad Size
rules.rtsmaxsquadsize = Max Squad Size
rules.rtsminattackweight = Min Attack Weight

View file

@ -420,7 +420,10 @@ public class Control implements ApplicationListener, Loadable{
ui.planet.hide();
SaveSlot slot = sector.save;
sector.planet.setLastSector(sector);
if(slot != null && !clearSectors && (!sector.planet.clearSectorOnLose || sector.info.hasCore)){
boolean clearSave = sector.planet.clearSectorOnLose || sector.planet.campaignRules.clearSectorOnLose;
if(slot != null && !clearSectors && (!clearSave || sector.info.hasCore)){
try{
boolean hadNoCore = !sector.info.hasCore;
@ -435,7 +438,7 @@ public class Control implements ApplicationListener, Loadable{
if(state.rules.defaultTeam.cores().isEmpty() || hadNoCore){
//don't carry over the spawn position and plans if the sector preset name or map size changed
if(sector.planet.clearSectorOnLose || sector.info.spawnPosition == 0 || !sector.info.sectorDataMatches(sector)){
if(clearSave || sector.info.spawnPosition == 0 || !sector.info.sectorDataMatches(sector)){
playNewSector(origin, sector, reloader);
}else{
int spawnPos = sector.info.spawnPosition;

View file

@ -12,6 +12,7 @@ public class CampaignRules{
public boolean randomWaveAI;
public boolean legacyLaunchPads;
public boolean rtsAI;
public boolean clearSectorOnLose;
public void apply(Planet planet, Rules rules){
rules.staticFog = rules.fog = fog;

View file

@ -74,6 +74,10 @@ public class CampaignRulesDialog extends BaseDialog{
check("@rules.rtsai.campaign", b -> rules.rtsAI = b, () -> rules.rtsAI);
}
if(!planet.clearSectorOnLose){
check("@rules.clearsectoronloss", b -> rules.clearSectorOnLose = b, () -> rules.clearSectorOnLose);
}
//TODO: this is intentionally hidden until the new mechanics have been well-tested. I don't want people immediately switching to the old mechanics
if(planet.allowLegacyLaunchPads){
// check("@rules.legacylaunchpads", b -> rules.legacyLaunchPads = b, () -> rules.legacyLaunchPads);

View file

@ -603,13 +603,15 @@ public class ApplicationTests{
entities.each(Building::updateProximity);
final int iterations = 100_000;
//warmup
for(int i = 0; i < 100000; i++){
for(int i = 0; i < iterations; i++){
entities.each(Building::update);
}
Time.mark();
for(int i = 0; i < 200000; i++){
for(int i = 0; i < iterations*2; i++){
entities.each(Building::update);
}
Log.info(Time.elapsed() + "ms to process " + itemsa[0] + " items");

View file

@ -17,7 +17,7 @@ public class ModTestAllure extends GenericModTest{
@Test
public void begin(){
grabMod("https://github.com/LixieWulf/Allure/archive/4150f74db1ea6058dc090959cf0fe5dc9d239e37.zip");
grabMod("https://github.com/LixieWulf/Allure/archive/7dff39df9b07719315a8379a88542fa0fe80fd30.zip");
checkExistence("allure");
UnitType type = Vars.content.unit("allure-0b11-exodus");