Added difficulty grace period scaling
This commit is contained in:
@@ -90,7 +90,7 @@ public class Vars{
|
|||||||
//whether turrets have infinite ammo (only with debug)
|
//whether turrets have infinite ammo (only with debug)
|
||||||
public static boolean infiniteAmmo = true;
|
public static boolean infiniteAmmo = true;
|
||||||
//whether to show paths of enemies
|
//whether to show paths of enemies
|
||||||
public static boolean showPaths = true;
|
public static boolean showPaths = false;
|
||||||
//if false, player is always hidden
|
//if false, player is always hidden
|
||||||
public static boolean showPlayer = true;
|
public static boolean showPlayer = true;
|
||||||
//whether to hide ui, only on debug
|
//whether to hide ui, only on debug
|
||||||
|
|||||||
@@ -3,34 +3,21 @@ package io.anuke.mindustry.game;
|
|||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
|
|
||||||
public enum Difficulty{
|
public enum Difficulty{
|
||||||
easy(4f, 2f, 1f),
|
easy(2f, 1.5f),
|
||||||
normal(2f, 1f, 1f),
|
normal(1f, 1f),
|
||||||
hard(1.5f, 0.5f, 0.75f),
|
hard(0.5f, 0.75f),
|
||||||
insane(0.5f, 0.25f, 0.5f);
|
insane(0.25f, 0.5f);
|
||||||
//purge removed due to new wave system
|
|
||||||
/*purge(0.25f, 0.01f, 0.25f)*/;
|
|
||||||
|
|
||||||
/**
|
/**Multiplier of the time between waves.*/
|
||||||
* The scaling of how many waves it takes for one more enemy of a type to appear.
|
|
||||||
* For example: with enemeyScaling = 2 and the default scaling being 2, it would take 4 waves for
|
|
||||||
* an enemy spawn to go from 1->2 enemies.
|
|
||||||
*/
|
|
||||||
public final float enemyScaling;
|
|
||||||
/**
|
|
||||||
* Multiplier of the time between waves.
|
|
||||||
*/
|
|
||||||
public final float timeScaling;
|
public final float timeScaling;
|
||||||
/**
|
/**Multiplier of spawner grace period.*/
|
||||||
* Scaling of max time between waves. Default time is 4 minutes.
|
public final float spawnerScaling;
|
||||||
*/
|
|
||||||
public final float maxTimeScaling;
|
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
Difficulty(float enemyScaling, float timeScaling, float maxTimeScaling){
|
Difficulty(float timeScaling, float spawnerScaling){
|
||||||
this.enemyScaling = enemyScaling;
|
|
||||||
this.timeScaling = timeScaling;
|
this.timeScaling = timeScaling;
|
||||||
this.maxTimeScaling = maxTimeScaling;
|
this.spawnerScaling = spawnerScaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import java.io.DataOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class UnitPad extends Block{
|
public class UnitPad extends Block{
|
||||||
protected float gracePeriodMultiplier = 15f;
|
protected float gracePeriodMultiplier = 20f;
|
||||||
protected float speedupTime = 60f * 60f * 16;
|
protected float speedupTime = 60f * 60f * 16;
|
||||||
|
|
||||||
protected UnitType type;
|
protected UnitType type;
|
||||||
@@ -164,8 +164,8 @@ public class UnitPad extends Block{
|
|||||||
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
|
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
|
||||||
}
|
}
|
||||||
//check if grace period had passed
|
//check if grace period had passed
|
||||||
}else if(entity.warmup > produceTime*gracePeriodMultiplier){
|
}else if(entity.warmup > produceTime*gracePeriodMultiplier * Vars.state.difficulty.spawnerScaling){
|
||||||
float speedMultiplier = Math.min(0.1f + (entity.warmup - produceTime * gracePeriodMultiplier) / speedupTime, 4f);
|
float speedMultiplier = Math.min(0.1f + (entity.warmup - produceTime * gracePeriodMultiplier * Vars.state.difficulty.spawnerScaling) / speedupTime, 4f);
|
||||||
//otherwise, it's an enemy, cheat by not requiring resources
|
//otherwise, it's an enemy, cheat by not requiring resources
|
||||||
entity.buildTime += Timers.delta() * speedMultiplier;
|
entity.buildTime += Timers.delta() * speedMultiplier;
|
||||||
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
|
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
|
||||||
|
|||||||
Reference in New Issue
Block a user