Bugfixes & balancing

This commit is contained in:
Anuken
2021-12-28 16:00:25 -05:00
parent ad42861daf
commit 4fa88296a7
20 changed files with 84 additions and 34 deletions

View File

@@ -271,6 +271,8 @@ public class Block extends UnlockableContent{
public Effect destroyEffect = Fx.dynamicExplosion;
/** Multiplier for cost of research in tech tree. */
public float researchCostMultiplier = 1;
/** Multipliers for research costs on a per-item basis. Format: ID to multiplier. */
public ObjectFloatMap<Item> researchCostMultipliers = new ObjectFloatMap<>();
/** Whether this block has instant transfer.*/
public boolean instantTransfer = false;
/** Whether you can rotate this block after it is placed. */
@@ -867,7 +869,7 @@ public class Block extends UnlockableContent{
public ItemStack[] researchRequirements(){
ItemStack[] out = new ItemStack[requirements.length];
for(int i = 0; i < out.length; i++){
int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.1f) * 20 * researchCostMultiplier, 10);
int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.1f) * 20 * researchCostMultiplier * researchCostMultipliers.get(requirements[i].item, 1f), 10);
out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity));
}
@@ -925,9 +927,6 @@ public class Block extends UnlockableContent{
scaling += stack.item.healthScaling;
}
if(scaling > 1){
Log.info("@: @ -> @", name, scaledHealth * size * size, (Mathf.round(scaledHealth * scaling, 5) * size * size));
}
scaledHealth *= scaling;
round = true;
}

View File

@@ -1,11 +1,13 @@
package mindustry.world.blocks.defense.turrets;
import arc.struct.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.consumers.*;
import mindustry.world.meta.*;
@@ -22,6 +24,8 @@ public class BaseTurret extends Block{
public Effect coolEffect = Fx.fuelburn;
/** How much reload is lowered by for each unit of liquid of heat capacity. */
public float coolantMultiplier = 5f;
/** Liquid that is used by coolant; null to use default. */
public @Nullable Liquid coolantOverride;
public BaseTurret(String name){
super(name);
@@ -39,7 +43,7 @@ public class BaseTurret extends Block{
public void init(){
if(acceptCoolant && !consumes.has(ConsumeType.liquid)){
hasLiquids = true;
consumes.add(new ConsumeCoolant(coolantUsage)).update(false).boost();
consumes.add(coolantOverride != null ? new ConsumeLiquid(coolantOverride, coolantUsage) : new ConsumeCoolant(coolantUsage)).update(false).boost();
}
super.init();

View File

@@ -199,7 +199,7 @@ public class ItemTurret extends Turret{
}
public class ItemEntry extends AmmoEntry{
protected Item item;
public Item item;
ItemEntry(Item item, int amount){
this.item = item;
@@ -210,5 +210,13 @@ public class ItemTurret extends Turret{
public BulletType type(){
return ammoTypes.get(item);
}
@Override
public String toString(){
return "ItemEntry{" +
"item=" + item +
", amount=" + amount +
'}';
}
}
}

View File

@@ -20,7 +20,7 @@ public class ReloadTurret extends BaseTurret{
super.setStats();
if(acceptCoolant){
stats.add(Stat.booster, StatValues.boosters(reloadTime, consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount, coolantMultiplier, true, l -> consumes.liquidfilters.get(l.id)));
stats.add(Stat.booster, StatValues.boosters(reloadTime, consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount, coolantMultiplier, true, l -> l.coolant && consumes.liquidfilters.get(l.id)));
}
}

View File

@@ -466,8 +466,8 @@ public class Turret extends ReloadTurret{
/** @return whether the turret has ammo. */
public boolean hasAmmo(){
//skip first entry if it has less than the required amount of ammo
if(ammo.size >= 2 && ammo.peek().amount < ammoPerShot){
ammo.pop();
if(ammo.size >= 2 && ammo.peek().amount < ammoPerShot && ammo.get(ammo.size - 2).amount >= ammoPerShot){
totalAmmo -= ammo.pop().amount;
}
return ammo.size > 0 && ammo.peek().amount >= ammoPerShot;
}

View File

@@ -171,7 +171,7 @@ public class DirectionBridge extends Block{
Draw.rect(dirRegion, x, y, rotdeg());
var link = findLink();
if(link != null){
Draw.z(Layer.power);
Draw.z(Layer.power - 1);
drawBridge(rotation, x, y, link.x, link.y, null);
}
}

View File

@@ -48,7 +48,7 @@ public class DirectionLiquidBridge extends DirectionBridge{
Draw.rect(dirRegion, x, y, rotdeg());
var link = findLink();
if(link != null){
Draw.z(Layer.power);
Draw.z(Layer.power - 1);
drawBridge(rotation, x, y, link.x, link.y, Tmp.c1.set(liquids.current().color).a(liquids.currentAmount() / liquidCapacity * liquids.current().color.a));
}
}

View File

@@ -25,6 +25,11 @@ public class BeamDrill extends Block{
public @Load("drill-laser") TextureRegion laser;
public @Load("drill-laser-end") TextureRegion laserEnd;
public @Load("drill-laser-center") TextureRegion laserCenter;
public @Load("drill-laser-boost") TextureRegion laserBoost;
public @Load("drill-laser-boost-end") TextureRegion laserEndBoost;
public @Load("drill-laser-boost-center") TextureRegion laserCenterBoost;
public @Load("@-top") TextureRegion topRegion;
public @Load("@-glow") TextureRegion glowRegion;
@@ -33,7 +38,7 @@ public class BeamDrill extends Block{
public int tier = 1;
public float laserWidth = 0.65f;
/** How many times faster the drill will progress when boosted by an optional consumer. */
public float optionalBoostIntensity = 2.5f; //TODO would be nice to change laser color when this is active.
public float optionalBoostIntensity = 2.5f;
public Color sparkColor = Color.valueOf("fd9e81"), glowColor = Color.white;
public float glowIntensity = 0.2f, pulseIntensity = 0.07f;
@@ -41,6 +46,7 @@ public class BeamDrill extends Block{
public int sparks = 7;
public float sparkRange = 10f, sparkLife = 27f, sparkRecurrence = 4f, sparkSpread = 45f, sparkSize = 3.5f;
public Color boostHeatColor = Color.sky.cpy().mul(0.87f);
public Color heatColor = new Color(1f, 0.35f, 0.35f, 0.9f);
public float heatPulse = 0.3f, heatPulseScl = 7f;
@@ -185,7 +191,7 @@ public class BeamDrill extends Block{
public @Nullable Item lastItem;
public float time;
public float warmup;
public float warmup, boostWarmup;
public float lastDrillSpeed;
@Override
@@ -245,7 +251,10 @@ public class BeamDrill extends Block{
float multiplier = 1f;
if(cons.optionalValid()){
boostWarmup = Mathf.lerpDelta(boostWarmup, 1f, 0.1f);
multiplier *= optionalBoostIntensity;
}else{
boostWarmup = Mathf.lerpDelta(boostWarmup, 0f, 0.1f);
}
lastDrillSpeed = (facingAmount * multiplier * timeScale) / drillTime;
@@ -291,26 +300,46 @@ public class BeamDrill extends Block{
Draw.z(Layer.power - 1);
Draw.mixcol(glowColor, Mathf.absin(Time.time + i*5 + id*9, glowScl, glowIntensity));
if(Math.abs(p.x - face.x) + Math.abs(p.y - face.y) == 0){
Draw.rect(laserCenter, lx, ly, width * laserCenter.width * Draw.scl, width * laserCenter.height * Draw.scl);
Draw.scl(width);
if(boostWarmup < 0.99f){
Draw.alpha(1f - boostWarmup);
Draw.rect(laserCenter, lx, ly);
}
if(boostWarmup > 0.01f){
Draw.alpha(boostWarmup);
Draw.rect(laserCenterBoost, lx, ly);
}
Draw.scl();
}else{
Drawf.laser(team, laser, laserEnd,
(p.x - dir.x/2f) * tilesize,
(p.y - dir.y/2f) * tilesize,
lx, ly,
width);
float lsx = (p.x - dir.x/2f) * tilesize, lsy = (p.y - dir.y/2f) * tilesize;
if(boostWarmup < 0.99f){
Draw.alpha(1f - boostWarmup);
Drawf.laser(team, laser, laserEnd, lsx, lsy, lx, ly, width);
}
if(boostWarmup > 0.001f){
Draw.alpha(boostWarmup);
Drawf.laser(team, laserBoost, laserEndBoost, lsx, lsy, lx, ly, width);
}
}
Draw.color();
Draw.mixcol();
Draw.z(Layer.effect);
Lines.stroke(warmup);
rand.setState(i, id);
Color col = face.wallDrop().color;
Color spark = Tmp.c3.set(sparkColor).lerp(boostHeatColor, boostWarmup);
for(int j = 0; j < sparks; j++){
float fin = (Time.time / sparkLife + rand.random(sparkRecurrence + 1f)) % sparkRecurrence;
float or = rand.range(2f);
Tmp.v1.set(sparkRange * fin, 0).rotate(rotdeg() + rand.range(sparkSpread));
Draw.color(sparkColor, col, fin);
Draw.color(spark, col, fin);
float px = Tmp.v1.x, py = Tmp.v1.y;
if(fin <= 1f) Lines.lineAngle(lx + px + or * ddx, ly + py + or * ddy, Angles.angle(px, py), Mathf.slope(fin) * sparkSize);
}
@@ -321,7 +350,7 @@ public class BeamDrill extends Block{
if(glowRegion.found()){
Draw.z(Layer.blockAdditive);
Draw.blend(Blending.additive);
Draw.color(heatColor, warmup * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse))));
Draw.color(Tmp.c1.set(heatColor).lerp(boostHeatColor, boostWarmup), warmup * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse))));
Draw.rect(glowRegion, x, y, rotdeg());
Draw.blend();
Draw.color();