diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 16a7d5d3df..c3aaf98400 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -5968,6 +5968,7 @@ public class Blocks{ ); size = 3; consumePower(1.2f); + researchCostMultiplier = 0.5f; }}; airFactory = new UnitFactory("air-factory"){{ @@ -5978,6 +5979,7 @@ public class Blocks{ ); size = 3; consumePower(1.2f); + researchCostMultiplier = 0.5f; }}; navalFactory = new UnitFactory("naval-factory"){{ diff --git a/core/src/mindustry/content/Planets.java b/core/src/mindustry/content/Planets.java index def60e56d6..4770dc038b 100644 --- a/core/src/mindustry/content/Planets.java +++ b/core/src/mindustry/content/Planets.java @@ -87,6 +87,7 @@ public class Planets{ }; campaignRuleDefaults.fog = true; campaignRuleDefaults.showSpawns = true; + campaignRuleDefaults.rtsAI = true; unlockedOnLand.add(Blocks.coreBastion); }}; @@ -148,6 +149,7 @@ public class Planets{ r.showSpawns = false; r.coreDestroyClear = true; }; + showRtsAIRule = true; iconColor = Color.valueOf("7d4dff"); atmosphereColor = Color.valueOf("3c1b8f"); atmosphereRadIn = 0.02f; diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 47d4cf92be..c95f75068e 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -98,6 +98,7 @@ public class UnitTypes{ //region ground attack dagger = new UnitType("dagger"){{ + researchCostMultiplier = 0.5f; speed = 0.5f; hitSize = 8f; health = 150; @@ -606,6 +607,7 @@ public class UnitTypes{ //region ground legs crawler = new UnitType("crawler"){{ + researchCostMultiplier = 0.5f; aiController = SuicideAI::new; speed = 1f; @@ -977,6 +979,7 @@ public class UnitTypes{ //region air attack flare = new UnitType("flare"){{ + researchCostMultiplier = 0.5f; speed = 2.7f; accel = 0.08f; drag = 0.04f; diff --git a/core/src/mindustry/game/CampaignRules.java b/core/src/mindustry/game/CampaignRules.java index 0ff9a7122c..4395e08828 100644 --- a/core/src/mindustry/game/CampaignRules.java +++ b/core/src/mindustry/game/CampaignRules.java @@ -1,5 +1,7 @@ package mindustry.game; +import mindustry.*; +import mindustry.gen.*; import mindustry.type.*; public class CampaignRules{ @@ -9,12 +11,26 @@ public class CampaignRules{ public boolean sectorInvasion; public boolean randomWaveAI; public boolean legacyLaunchPads; + public boolean rtsAI; public void apply(Planet planet, Rules rules){ rules.staticFog = rules.fog = fog; rules.showSpawns = showSpawns; rules.randomWaveAI = randomWaveAI; rules.objectiveTimerMultiplier = difficulty.waveTimeMultiplier; + if(planet.showRtsAIRule && rules.attackMode){ + boolean swapped = rules.teams.get(rules.waveTeam).rtsAi != rtsAI; + rules.teams.get(rules.waveTeam).rtsAi = rtsAI; + rules.teams.get(rules.waveTeam).rtsMinWeight = 1.2f * difficulty.enemyHealthMultiplier; + + if(swapped && Vars.state.isGame()){ + Groups.unit.each(u -> { + if(u.team == rules.waveTeam && !u.isPlayer()){ + u.resetController(); + } + }); + } + } rules.teams.get(rules.waveTeam).blockHealthMultiplier = difficulty.enemyHealthMultiplier; rules.teams.get(rules.waveTeam).unitHealthMultiplier = difficulty.enemyHealthMultiplier; rules.teams.get(rules.waveTeam).unitCostMultiplier = 1f / difficulty.enemySpawnMultiplier; diff --git a/core/src/mindustry/type/Planet.java b/core/src/mindustry/type/Planet.java index ae19a02995..e607481bb1 100644 --- a/core/src/mindustry/type/Planet.java +++ b/core/src/mindustry/type/Planet.java @@ -165,7 +165,8 @@ public class Planet extends UnlockableContent{ public CampaignRules campaignRuleDefaults = new CampaignRules(); /** Sets up rules on game load for any sector on this planet. */ public Cons ruleSetter = r -> {}; - + /** If true, RTS AI can be customized. */ + public boolean showRtsAIRule = false; public Planet(String name, Planet parent, float radius){ super(name); diff --git a/core/src/mindustry/ui/dialogs/CampaignRulesDialog.java b/core/src/mindustry/ui/dialogs/CampaignRulesDialog.java index cebe4c72b3..0082c2a552 100644 --- a/core/src/mindustry/ui/dialogs/CampaignRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CampaignRulesDialog.java @@ -69,6 +69,10 @@ public class CampaignRulesDialog extends BaseDialog{ check("@rules.showspawns", b -> rules.showSpawns = b, () -> rules.showSpawns); check("@rules.randomwaveai", b -> rules.randomWaveAI = b, () -> rules.randomWaveAI); + if(planet.showRtsAIRule){ + check("@rules.rtsai.campaign", b -> rules.rtsAI = b, () -> rules.rtsAI); + } + //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);