Skip to content

Commit

Permalink
202402241650
Browse files Browse the repository at this point in the history
  • Loading branch information
PiggyChu620 committed Feb 24, 2024
1 parent e3454b2 commit 7486d20
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 28 deletions.
4 changes: 2 additions & 2 deletions mod.hjson
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#the mod name as displayed in-game
displayName: "Random Planet v0.4.7.4"
displayName: "Random Planet v0.4.7.12"

repo: "PiggyChu620/MindustryRandomPlanet"

Expand All @@ -16,7 +16,7 @@ main: "ec620.EC620JavaMod"
description: "Randomly generate a planet and its sectors.\nIt's a mixtech mod, I myself don't like the idea of \"Oh, you can only use these things here, and you can only use those things there, bruh, bruh, bruh!\", so I make one myself, if you don't like mixtech and think it's \"unbalanced\" and \"boring\", then please go away, much appreciated!"

#the mod version
version: 0.4.7.4
version: 0.4.7.12

#the minimum game build required to run this mod
minGameVersion: 140
Expand Down
8 changes: 7 additions & 1 deletion src/ec620/content/EC620Blocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ public static void load()
//region Unlock hidden items
Blocks.slagCentrifuge.requirements(Category.crafting, with(Items.carbide, 70, Items.graphite, 60, Items.silicon, 40, Items.oxide, 40));
Blocks.heatReactor.requirements(Category.crafting, with(Items.oxide, 70, Items.graphite, 20, Items.carbide, 10, Items.thorium, 80));
UnitTypes.renale.hidden=false;
UnitTypes.latum.hidden=false;
Blocks.itemSource.requirements(Category.distribution, ItemStack.with(new Object[0]));
Blocks.liquidSource.requirements(Category.liquid, ItemStack.with(new Object[0]));
Blocks.powerSource.requirements(Category.power, ItemStack.with(new Object[0]));

//content.blocks().forEach(b->b.buildVisibility=BuildVisibility.shown);
//endregion
//region Ores
Expand Down Expand Up @@ -131,7 +135,9 @@ public static void load()
// //endregion
//
// //region Factories
launchPadController=new EC620Classes.LauchPadController("launch-pad-controller");

//launchPadController=new EC620Classes.LauchPadController("launch-pad-controller");

// duraluminFactory = new GenericCrafter("duralumin-factory"){{
// requirements(Category.crafting, with(Items.copper, 5, EC620Items.aluminum,95));
// craftEffect = Fx.smeltsmoke;
Expand Down
5 changes: 3 additions & 2 deletions src/ec620/content/EC620TechTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -1701,10 +1701,11 @@ public static void load()
root.planet= EC620Planets.ec620;
root.children.each(c -> c.planet =EC620Planets.ec620);

mergeNode(launchPad,()->
/*mergeNode(launchPad,()->
{
node(EC620Blocks.launchPadController);
});
});*/

/*mergeNode(Liquids.water, () -> {
node(Liquids.ozone,()->{
node(Liquids.hydrogen);
Expand Down
82 changes: 59 additions & 23 deletions src/ec620/content/EC620Waves.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,20 @@ public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean atta
}

public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean attack, boolean airOnly, boolean naval){
UnitType[][] species = {
UnitType[][] species =
{
{dagger, mace, fortress, scepter, reign},
{nova, pulsar, quasar, vela, corvus},
{crawler, atrax, spiroct, arkyid, toxopid},
{risso, minke, bryde, sei, omura},
{risso, oxynoe, cyerce, aegires, navanax}, //retusa intentionally left out as it cannot damage the core properly
{flare, horizon, zenith, rand.chance(0.5) ? quad : antumbra, rand.chance(0.1) ? quad : eclipse},
{flare, horizon, zenith, antumbra, eclipse},
{stell,locus, precept, vanquish,conquer},
{ merui, cleroi, anthicus, tecta,collaris},
{ elude, avert, obviate, quell,disrupt}
{ elude, avert, obviate, quell,disrupt},
{renale,renale,renale,renale,latum} //Should ALWAYS be the last one!
};
UnitType[] repairUnits={mono, poly, mega, quad, oct};

if(airOnly)
{
Expand Down Expand Up @@ -348,20 +351,28 @@ public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean atta
//main sequence
UnitType[] curSpecies = Structs.random(fspec);
int curTier = 0;
int curI;
UnitType curUnit;

for(int i = start; i < cap;)
{
int f = i;
int next = rand.random(8, 16) + (int)Mathf.lerp(5f, 0f, difficulty) + curTier * 4;
//int next = rand.random(8, 16) + (int)Mathf.lerp(5f, 0f, difficulty) + curTier * 4;
int next=rand.random(8,16) + (int)((1-difficulty)*Math.pow(3.5,curTier+1));

float shieldAmount = Math.max((i - shieldStart) * shieldsPerWave, 0);
int space = start == 0 ? 1 : rand.random(1, 2);
int ctier = curTier;

if(ctier>0 && ctier<4) curI=rand.random(fspec.length-2);
else curI=rand.random(fspec.length-1);
curUnit=fspec[curI][ctier];

//main progression
out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)])
//out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)])
out.add(new SpawnGroup(curUnit)
{{
unitAmount = f == start ? 1 : 6 / (int)scaling[ctier];
unitAmount = f == start ? 1 : Math.max(6 / (int)scaling[ctier],1);
begin = f;
end = f + next >= cap ? never : f + next;
max = 13;
Expand All @@ -372,9 +383,10 @@ public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean atta
}});

//extra progression that tails out, blends in
out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)])
//out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)])
out.add(new SpawnGroup(curUnit)
{{
unitAmount = 3 / (int)scaling[ctier];
unitAmount = Math.max(1, 3 / (int)scaling[ctier]);
begin = f + next - 1;
end = f + next + rand.random(6, 10);
max = 6;
Expand All @@ -384,19 +396,20 @@ public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean atta
shieldScaling = shieldsPerWave;
}});

i += next + 1;
if(curTier < 3 || (rand.chance(0.05) && difficulty > 0.8))
i = next + 1;
//if(curTier < 3 || (rand.chance(0.05) && difficulty > 0.8))
if(curTier<4)
{
curTier ++;
}

//do not spawn bosses
curTier = Math.min(curTier, 3);
//curTier = Math.min(curTier, 3);

//small chance to switch species
if(rand.chance(0.3)){
curSpecies = Structs.random(fspec);
}
// if(rand.chance(0.3)){
// curSpecies = Structs.random(fspec);
// }
}
};

Expand All @@ -415,8 +428,15 @@ public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean atta

int bossTier = difficulty < 0.6 ? 3 : 4;

int curI;
UnitType curBoss;

//main boss progression
out.add(new SpawnGroup(Structs.random(species)[bossTier])
if(bossTier==4) curI=rand.random(species.length-1);
else curI=rand.random(species.length-2);
curBoss=species[curI][bossTier];
//out.add(new SpawnGroup(Structs.random(species)[bossTier])
out.add(new SpawnGroup(curBoss)
{{
unitAmount = 1;
begin = bossWave;
Expand All @@ -429,7 +449,11 @@ public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean atta
}});

//alt boss progression
out.add(new SpawnGroup(Structs.random(species)[bossTier])
if(bossTier==4) curI=rand.random(species.length-1);
else curI=rand.random(species.length-2);
curBoss=species[curI][bossTier];
//out.add(new SpawnGroup(Structs.random(species)[bossTier])
out.add(new SpawnGroup(curBoss)
{{
unitAmount = 1;
begin = bossWave + rand.random(3, 5) * bossSpacing;
Expand All @@ -444,7 +468,11 @@ public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean atta
int finalBossStart = 120 + rand.random(30);

//final boss waves
out.add(new SpawnGroup(Structs.random(species)[bossTier])
if(bossTier==4) curI=rand.random(species.length-1);
else curI=rand.random(species.length-2);
curBoss=species[curI][bossTier];
//out.add(new SpawnGroup(Structs.random(species)[bossTier])
out.add(new SpawnGroup(curBoss)
{{
unitAmount = 1;
begin = finalBossStart;
Expand All @@ -457,7 +485,11 @@ public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean atta
}});

//final boss waves (alt)
out.add(new SpawnGroup(Structs.random(species)[bossTier])
if(bossTier==4) curI=rand.random(species.length-1);
else curI=rand.random(species.length-2);
curBoss=species[curI][bossTier];
//out.add(new SpawnGroup(Structs.random(species)[bossTier])
out.add(new SpawnGroup(curBoss)
{{
unitAmount = 1;
begin = finalBossStart + 15;
Expand All @@ -470,13 +502,16 @@ public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean atta
}});

//add megas to heal the base.
if(attack && difficulty >= 0.5)
//if(attack && difficulty >= 0.5)
if(attack)
{
int amount = Mathf.random(1, 3 + (int)(difficulty*2));

for(int i = 0; i < amount; i++){
int wave = Mathf.random(3, 20);
out.add(new SpawnGroup(mega){{
for(int i = 0; i < amount; i++)
{
int wave = (int)(20*difficulty); //Mathf.random(3, 20);
out.add(new SpawnGroup(repairUnits[(int)(5*difficulty)])
{{
unitAmount = 1;
begin = wave;
end = wave;
Expand All @@ -488,7 +523,8 @@ public static Seq<SpawnGroup> generate(float difficulty, Rand rand, boolean atta
//shift back waves on higher difficulty for a harder start
int shift = Math.max((int)(difficulty * 14 - 5), 0);

for(SpawnGroup group : out){
for(SpawnGroup group : out)
{
group.begin -= shift;
group.end -= shift;
}
Expand Down

0 comments on commit 7486d20

Please sign in to comment.