Added difficulty grace period scaling

This commit is contained in:
Anuken 2018-08-06 22:58:22 -04:00
parent 85b077b5c5
commit b76cd558aa
3 changed files with 13 additions and 26 deletions

View file

@ -90,7 +90,7 @@ public class Vars{
//whether turrets have infinite ammo (only with debug)
public static boolean infiniteAmmo = true;
//whether to show paths of enemies
public static boolean showPaths = true;
public static boolean showPaths = false;
//if false, player is always hidden
public static boolean showPlayer = true;
//whether to hide ui, only on debug

View file

@ -3,34 +3,21 @@ package io.anuke.mindustry.game;
import io.anuke.ucore.util.Bundles;
public enum Difficulty{
easy(4f, 2f, 1f),
normal(2f, 1f, 1f),
hard(1.5f, 0.5f, 0.75f),
insane(0.5f, 0.25f, 0.5f);
//purge removed due to new wave system
/*purge(0.25f, 0.01f, 0.25f)*/;
easy(2f, 1.5f),
normal(1f, 1f),
hard(0.5f, 0.75f),
insane(0.25f, 0.5f);
/**
* 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.
*/
/**Multiplier of the time between waves.*/
public final float timeScaling;
/**
* Scaling of max time between waves. Default time is 4 minutes.
*/
public final float maxTimeScaling;
/**Multiplier of spawner grace period.*/
public final float spawnerScaling;
private String value;
Difficulty(float enemyScaling, float timeScaling, float maxTimeScaling){
this.enemyScaling = enemyScaling;
Difficulty(float timeScaling, float spawnerScaling){
this.timeScaling = timeScaling;
this.maxTimeScaling = maxTimeScaling;
this.spawnerScaling = spawnerScaling;
}
@Override

View file

@ -38,7 +38,7 @@ import java.io.DataOutputStream;
import java.io.IOException;
public class UnitPad extends Block{
protected float gracePeriodMultiplier = 15f;
protected float gracePeriodMultiplier = 20f;
protected float speedupTime = 60f * 60f * 16;
protected UnitType type;
@ -164,8 +164,8 @@ public class UnitPad extends Block{
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
}
//check if grace period had passed
}else if(entity.warmup > produceTime*gracePeriodMultiplier){
float speedMultiplier = Math.min(0.1f + (entity.warmup - produceTime * gracePeriodMultiplier) / speedupTime, 4f);
}else if(entity.warmup > produceTime*gracePeriodMultiplier * Vars.state.difficulty.spawnerScaling){
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
entity.buildTime += Timers.delta() * speedMultiplier;
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);