This commit is contained in:
Anuken
2019-08-28 13:18:27 -04:00
parent 3d69e9c763
commit 05c0fd2f40
4 changed files with 20 additions and 33 deletions

View File

@@ -5,6 +5,7 @@ import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*; import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.*; import io.anuke.arc.math.*;
import io.anuke.arc.util.*; import io.anuke.arc.util.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.entities.*; import io.anuke.mindustry.entities.*;
import io.anuke.mindustry.entities.bullet.*; import io.anuke.mindustry.entities.bullet.*;
import io.anuke.mindustry.entities.effect.*; import io.anuke.mindustry.entities.effect.*;
@@ -85,7 +86,7 @@ public class Mechs implements ContentList{
Effects.shake(1f, 1f, player); Effects.shake(1f, 1f, player);
Effects.effect(Fx.landShock, player); Effects.effect(Fx.landShock, player);
for(int i = 0; i < 8; i++){ for(int i = 0; i < 8; i++){
Time.run(Mathf.random(8f), () -> Lightning.create(player.getTeam(), Pal.lancerLaser, 17f, player.x, player.y, Mathf.random(360f), 14)); Time.run(Mathf.random(8f), () -> Lightning.create(player.getTeam(), Pal.lancerLaser, 17f * Vars.state.rules.playerDamageMultiplier, player.x, player.y, Mathf.random(360f), 14));
} }
} }
} }
@@ -286,7 +287,7 @@ public class Mechs implements ContentList{
float scl = scld(player); float scl = scld(player);
if(Mathf.chance(Time.delta() * (0.15 * scl))){ if(Mathf.chance(Time.delta() * (0.15 * scl))){
Effects.effect(Fx.hitLancer, Pal.lancerLaser, player.x, player.y); Effects.effect(Fx.hitLancer, Pal.lancerLaser, player.x, player.y);
Lightning.create(player.getTeam(), Pal.lancerLaser, 10f, Lightning.create(player.getTeam(), Pal.lancerLaser, 10f * Vars.state.rules.playerDamageMultiplier,
player.x + player.velocity().x, player.y + player.velocity().y, player.rotation, 14); player.x + player.velocity().x, player.y + player.velocity().y, player.rotation, 14);
} }
} }

View File

@@ -20,7 +20,6 @@ public enum Gamemode{
rules.respawnTime = 0f; rules.respawnTime = 0f;
}), }),
attack(rules -> { attack(rules -> {
rules.enemyCheat = true;
rules.unitDrops = true; rules.unitDrops = true;
rules.attackMode = true; rules.attackMode = true;
rules.waves = true; rules.waves = true;

View File

@@ -1,23 +1,20 @@
package io.anuke.mindustry.world.blocks.defense; package io.anuke.mindustry.world.blocks.defense;
import io.anuke.arc.Core; import io.anuke.arc.*;
import io.anuke.arc.function.Consumer; import io.anuke.arc.function.*;
import io.anuke.arc.graphics.Blending; import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.*; import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.Mathf; import io.anuke.arc.math.*;
import io.anuke.arc.util.Time; import io.anuke.arc.util.*;
import io.anuke.mindustry.content.Fx; import io.anuke.mindustry.content.*;
import io.anuke.mindustry.entities.*; import io.anuke.mindustry.entities.*;
import io.anuke.mindustry.entities.impl.BaseEntity; import io.anuke.mindustry.entities.impl.*;
import io.anuke.mindustry.entities.traits.*; import io.anuke.mindustry.entities.traits.*;
import io.anuke.mindustry.entities.type.TileEntity; import io.anuke.mindustry.entities.type.*;
import io.anuke.mindustry.graphics.Pal; import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.consumers.*; import io.anuke.mindustry.world.consumers.*;
import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.*;
import io.anuke.mindustry.world.meta.StatUnit;
import java.io.*; import java.io.*;
@@ -94,7 +91,6 @@ public class ForceProjector extends Block{
@Override @Override
public void update(Tile tile){ public void update(Tile tile){
ForceEntity entity = tile.entity(); ForceEntity entity = tile.entity();
boolean cheat = tile.isEnemyCheat();
if(entity.shield == null){ if(entity.shield == null){
entity.shield = new ShieldEntity(tile); entity.shield = new ShieldEntity(tile);
@@ -109,21 +105,15 @@ public class ForceProjector extends Block{
entity.cons.trigger(); entity.cons.trigger();
} }
entity.radscl = Mathf.lerpDelta(entity.radscl, entity.broken ? 0f : 1f, 0.05f); entity.radscl = Mathf.lerpDelta(entity.radscl, entity.broken ? 0f : entity.warmup, 0.05f);
if(Mathf.chance(Time.delta() * entity.buildup / breakage * 0.1f)){ if(Mathf.chance(Time.delta() * entity.buildup / breakage * 0.1f)){
Effects.effect(Fx.reactorsmoke, tile.drawx() + Mathf.range(tilesize / 2f), tile.drawy() + Mathf.range(tilesize / 2f)); Effects.effect(Fx.reactorsmoke, tile.drawx() + Mathf.range(tilesize / 2f), tile.drawy() + Mathf.range(tilesize / 2f));
} }
//use cases: entity.warmup = Mathf.lerpDelta(entity.warmup, entity.power.satisfaction, 0.1f);
// - There is enough power in the buffer, and there are no shots fired => Draw base power and keep shield up
// - There is enough power in the buffer, but not enough power to cope for shots being fired => Draw all power and break shield
// - There is enough power in the buffer and enough power to cope for shots being fired => Draw base power + additional power based on shots absorbed
// - There is not enough base power in the buffer => Draw all power and break shield
// - The generator is in the AI base and uses cheat mode => Only draw power from shots being absorbed
float relativePowerDraw = cheat ? 0f : 1f;
/*
if(entity.power.satisfaction < relativePowerDraw){ if(entity.power.satisfaction < relativePowerDraw){
entity.warmup = Mathf.lerpDelta(entity.warmup, 0f, 0.15f); entity.warmup = Mathf.lerpDelta(entity.warmup, 0f, 0.15f);
entity.power.satisfaction = 0f; entity.power.satisfaction = 0f;
@@ -132,7 +122,7 @@ public class ForceProjector extends Block{
} }
}else{ }else{
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.1f); entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.1f);
} }*/
if(entity.buildup > 0){ if(entity.buildup > 0){
float scale = !entity.broken ? cooldownNormal : cooldownBrokenBase; float scale = !entity.broken ? cooldownNormal : cooldownBrokenBase;
@@ -145,7 +135,7 @@ public class ForceProjector extends Block{
entity.buildup -= Time.delta() * scale; entity.buildup -= Time.delta() * scale;
} }
if(entity.broken && entity.buildup <= 0 && entity.warmup >= 0.9f){ if(entity.broken && entity.buildup <= 0){
entity.broken = false; entity.broken = false;
} }

View File

@@ -109,10 +109,7 @@ public class PowerGraph{
for(Tile battery : batteries){ for(Tile battery : batteries){
Consumers consumes = battery.block().consumes; Consumers consumes = battery.block().consumes;
if(consumes.hasPower()){ if(consumes.hasPower()){
ConsumePower consumePower = consumes.getPower(); battery.entity.power.satisfaction *= (1f-consumedPowerPercentage);
if(consumePower.capacity > 0f){
battery.entity.power.satisfaction = Math.max(0.0f, battery.entity.power.satisfaction - consumedPowerPercentage);
}
} }
} }
return used; return used;