Disabled spawnpoints during ongoing attack maps

This commit is contained in:
Anuken
2020-10-17 19:49:13 -04:00
parent 4ab0c8a1ca
commit 521d44714d
6 changed files with 13 additions and 6 deletions

View File

@@ -49,7 +49,7 @@ public class WaveSpawner{
/** @return true if the player is near a ground spawn point. */
public boolean playerNear(){
return state.rules.waves && !player.dead() && spawns.contains(g -> Mathf.dst(g.x * tilesize, g.y * tilesize, player.x, player.y) < state.rules.dropZoneRadius && player.team() != state.rules.waveTeam);
return state.hasSpawns() && !player.dead() && spawns.contains(g -> Mathf.dst(g.x * tilesize, g.y * tilesize, player.x, player.y) < state.rules.dropZoneRadius && player.team() != state.rules.waveTeam);
}
public void spawnEnemies(){
@@ -105,8 +105,10 @@ public class WaveSpawner{
}
private void eachGroundSpawn(SpawnConsumer cons){
for(Tile spawn : spawns){
cons.accept(spawn.worldx(), spawn.worldy(), true);
if(state.hasSpawns()){
for(Tile spawn : spawns){
cons.accept(spawn.worldx(), spawn.worldy(), true);
}
}
if(state.rules.attackMode && state.teams.isActive(state.rules.waveTeam) && !state.teams.playerCores().isEmpty()){

View File

@@ -48,6 +48,10 @@ public class GameState{
state = astate;
}
public boolean hasSpawns(){
return rules.waves && !(isCampaign() && rules.attackMode);
}
/** Note that being in a campaign does not necessarily mean having a sector. */
public boolean isCampaign(){
return rules.sector != null;

View File

@@ -277,7 +277,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
drag = type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f);
//apply knockback based on spawns
if(team != state.rules.waveTeam && state.rules.waves){
if(team != state.rules.waveTeam && state.hasSpawns()){
float relativeSize = state.rules.dropZoneRadius + hitSize/2f + 1f;
for(Tile spawn : spawner.getSpawns()){
if(within(spawn.worldx(), spawn.worldy(), relativeSize)){

View File

@@ -121,7 +121,7 @@ public class OverlayRenderer{
Lines.stroke(2f);
Draw.color(Color.gray, Color.lightGray, Mathf.absin(Time.time(), 8f, 1f));
if(state.rules.waves){
if(state.hasSpawns()){
for(Tile tile : spawner.getSpawns()){
if(tile.within(player.x, player.y, state.rules.dropZoneRadius + spawnerMargin)){
Draw.alpha(Mathf.clamp(1f - (player.dst(tile) - state.rules.dropZoneRadius) / spawnerMargin));

View File

@@ -303,7 +303,8 @@ public class SectorDamage{
//enemy units like to aim for a lot of non-essential things, so increase resulting health slightly
info.sumHealth = sumHealth * 1.2f;
info.sumDps = sumDps;
//players tend to have longer range units/turrets, so assume DPS is higher
info.sumDps = sumDps * 1.2f;
info.sumRps = sumRps;
//finally, find an equation to put it all together and produce a 0-1 number