mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-13 11:29:48 +07:00
Fixed #3053
This commit is contained in:
parent
87dda1ba4b
commit
a80d0cc457
@ -640,6 +640,15 @@ stat.speed = Speed
|
||||
stat.buildspeed = Build Speed
|
||||
stat.minespeed = Mine Speed
|
||||
stat.minetier = Mine Tier
|
||||
stat.payloadcapacity = Payload Capacity
|
||||
stat.commandlimit = Command Limit
|
||||
stat.abilities = Abilities
|
||||
|
||||
ability.forcefield = Force Field
|
||||
ability.repairfield = Repair Field
|
||||
ability.statusfield = Status Field
|
||||
ability.unitspawn = {0} Factory
|
||||
ability.shieldregenfield = Shield Regen Field
|
||||
|
||||
bar.drilltierreq = Better Drill Required
|
||||
bar.noresources = Missing Resources
|
||||
@ -680,6 +689,7 @@ bullet.multiplier = [stat]{0}[lightgray]x ammo multiplier
|
||||
bullet.reload = [stat]{0}[lightgray]x fire rate
|
||||
|
||||
unit.blocks = blocks
|
||||
unit.blockssquared = blocks²
|
||||
unit.powersecond = power units/second
|
||||
unit.liquidsecond = liquid units/second
|
||||
unit.itemssecond = items/second
|
||||
|
@ -276,7 +276,7 @@ public class UnitTypes implements ContentList{
|
||||
armor = 1f;
|
||||
commandLimit = 8;
|
||||
|
||||
abilities.add(new HealFieldAbility(10f, 60f * 4, 60f));
|
||||
abilities.add(new RepairFieldAbility(10f, 60f * 4, 60f));
|
||||
ammoType = AmmoTypes.power;
|
||||
|
||||
weapons.add(new Weapon("heal-weapon"){{
|
||||
@ -305,7 +305,7 @@ public class UnitTypes implements ContentList{
|
||||
mineSpeed = 5f;
|
||||
commandLimit = 8;
|
||||
|
||||
abilities.add(new ShieldFieldAbility(20f, 40f, 60f * 5, 60f));
|
||||
abilities.add(new ShieldRegenFieldAbility(20f, 40f, 60f * 5, 60f));
|
||||
ammoType = AmmoTypes.power;
|
||||
|
||||
weapons.add(new Weapon("heal-shotgun-weapon"){{
|
||||
@ -1161,7 +1161,7 @@ public class UnitTypes implements ContentList{
|
||||
mineTier = 2;
|
||||
mineSpeed = 3.5f;
|
||||
|
||||
abilities.add(new HealFieldAbility(5f, 60f * 5, 50f));
|
||||
abilities.add(new RepairFieldAbility(5f, 60f * 5, 50f));
|
||||
|
||||
weapons.add(new Weapon("heal-weapon-mount"){{
|
||||
top = false;
|
||||
@ -1318,7 +1318,7 @@ public class UnitTypes implements ContentList{
|
||||
ammoCapacity = 1300;
|
||||
ammoResupplyAmount = 20;
|
||||
|
||||
abilities.add(new ForceFieldAbility(140f, 4f, 7000f, 60f * 8), new HealFieldAbility(130f, 60f * 2, 140f));
|
||||
abilities.add(new ForceFieldAbility(140f, 4f, 7000f, 60f * 8), new RepairFieldAbility(130f, 60f * 2, 140f));
|
||||
}};
|
||||
|
||||
//endregion
|
||||
@ -1430,7 +1430,7 @@ public class UnitTypes implements ContentList{
|
||||
trailY = -9f;
|
||||
trailScl = 1.5f;
|
||||
|
||||
abilities.add(new ShieldFieldAbility(20f, 40f, 60f * 4, 60f));
|
||||
abilities.add(new ShieldRegenFieldAbility(20f, 40f, 60f * 4, 60f));
|
||||
|
||||
weapons.add(new Weapon("large-artillery"){{
|
||||
reload = 65f;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mindustry.entities.abilities;
|
||||
|
||||
import arc.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
public abstract class Ability implements Cloneable{
|
||||
@ -14,4 +15,9 @@ public abstract class Ability implements Cloneable{
|
||||
throw new RuntimeException("java sucks", e);
|
||||
}
|
||||
}
|
||||
|
||||
/** @return localized ability name; mods should override this. */
|
||||
public String localized(){
|
||||
return Core.bundle.get("ability." + getClass().getSimpleName().replace("Ability", "").toLowerCase());
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
public class HealFieldAbility extends Ability{
|
||||
public class RepairFieldAbility extends Ability{
|
||||
public float amount = 1, reload = 100, range = 60;
|
||||
public Effect healEffect = Fx.heal;
|
||||
public Effect activeEffect = Fx.healWaveDynamic;
|
||||
@ -13,9 +13,9 @@ public class HealFieldAbility extends Ability{
|
||||
protected float timer;
|
||||
protected boolean wasHealed = false;
|
||||
|
||||
HealFieldAbility(){}
|
||||
RepairFieldAbility(){}
|
||||
|
||||
public HealFieldAbility(float amount, float reload, float range){
|
||||
public RepairFieldAbility(float amount, float reload, float range){
|
||||
this.amount = amount;
|
||||
this.reload = reload;
|
||||
this.range = range;
|
@ -5,7 +5,7 @@ import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
public class ShieldFieldAbility extends Ability{
|
||||
public class ShieldRegenFieldAbility extends Ability{
|
||||
public float amount = 1, max = 100f, reload = 100, range = 60;
|
||||
public Effect applyEffect = Fx.shieldApply;
|
||||
public Effect activeEffect = Fx.shieldWave;
|
||||
@ -13,9 +13,9 @@ public class ShieldFieldAbility extends Ability{
|
||||
protected float timer;
|
||||
protected boolean applied = false;
|
||||
|
||||
ShieldFieldAbility(){}
|
||||
ShieldRegenFieldAbility(){}
|
||||
|
||||
public ShieldFieldAbility(float amount, float max, float reload, float range){
|
||||
public ShieldRegenFieldAbility(float amount, float max, float reload, float range){
|
||||
this.amount = amount;
|
||||
this.max = max;
|
||||
this.reload = reload;
|
@ -1,5 +1,6 @@
|
||||
package mindustry.entities.abilities;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
@ -56,4 +57,9 @@ public class UnitSpawnAbility extends Ability{
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String localized(){
|
||||
return Core.bundle.format("ability.unitspawn", type.localizedName);
|
||||
}
|
||||
}
|
||||
|
@ -437,8 +437,9 @@ public class LExecutor{
|
||||
ai.plan.set(x, y, rot, block);
|
||||
ai.plan.config = null;
|
||||
|
||||
builder.clearBuilding();
|
||||
|
||||
if(ai.plan.tile() != null){
|
||||
builder.clearBuilding();
|
||||
builder.updateBuilding(true);
|
||||
builder.addBuild(ai.plan);
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ public class SectorDamage{
|
||||
|
||||
sumHealth += unit.health*healthMult + unit.shield;
|
||||
sumDps += unit.type.dpsEstimate;
|
||||
if(unit.abilities.find(a -> a instanceof HealFieldAbility) instanceof HealFieldAbility h){
|
||||
if(unit.abilities.find(a -> a instanceof RepairFieldAbility) instanceof RepairFieldAbility h){
|
||||
sumRps += h.amount / h.reload * 60f;
|
||||
}
|
||||
}else{
|
||||
|
@ -199,13 +199,29 @@ public class UnitType extends UnlockableContent{
|
||||
stats.add(Stat.speed, speed);
|
||||
stats.add(Stat.itemCapacity, health);
|
||||
stats.add(Stat.range, (int)(maxRange / tilesize), StatUnit.blocks);
|
||||
stats.add(Stat.commandLimit, commandLimit);
|
||||
//TODO abilities, maybe try something like DPS
|
||||
|
||||
if(abilities.any()){
|
||||
var unique = new ObjectSet<String>();
|
||||
|
||||
for(Ability a : abilities){
|
||||
if(unique.add(a.localized())){
|
||||
stats.add(Stat.abilities, a.localized());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(inst instanceof Minerc && mineTier >= 1){
|
||||
stats.addPercent(Stat.mineSpeed, mineSpeed);
|
||||
stats.add(Stat.mineTier, new BlockFilterValue(b -> b instanceof Floor f && f.itemDrop != null && f.itemDrop.hardness <= mineTier && !f.playerUnmineable));
|
||||
}
|
||||
if(inst instanceof Builderc) stats.addPercent(Stat.buildSpeed, buildSpeed);
|
||||
if(inst instanceof Builderc){
|
||||
stats.addPercent(Stat.buildSpeed, buildSpeed);
|
||||
}
|
||||
if(inst instanceof Payloadc){
|
||||
stats.add(Stat.payloadCapacity, (payloadCapacity / (tilesize * tilesize)), StatUnit.blocksSquared);
|
||||
}
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@ -231,10 +247,17 @@ public class UnitType extends UnlockableContent{
|
||||
//set up default range
|
||||
if(range < 0){
|
||||
range = Float.MAX_VALUE;
|
||||
maxRange = 0f;
|
||||
for(Weapon weapon : weapons){
|
||||
range = Math.min(range, weapon.bullet.range() + hitSize /2f);
|
||||
maxRange = Math.max(maxRange, weapon.bullet.range() + hitSize /2f);
|
||||
range = Math.min(range, weapon.bullet.range() + hitSize / 2f);
|
||||
maxRange = Math.max(maxRange, weapon.bullet.range() + hitSize / 2f);
|
||||
}
|
||||
}
|
||||
|
||||
if(maxRange < 0){
|
||||
maxRange = 0f;
|
||||
|
||||
for(Weapon weapon : weapons){
|
||||
maxRange = Math.max(maxRange, weapon.bullet.range() + hitSize / 2f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
boolean canSelect(Sector sector){
|
||||
if(mode == select) return sector.hasBase();
|
||||
|
||||
return sector.near().contains(Sector::hasBase)//(sector.tile.v.within(launchSector.tile.v, (launchRange + 0.5f) * planets.planet.sectorApproxRadius*2) //within range
|
||||
return sector.hasBase() || sector.near().contains(Sector::hasBase)//(sector.tile.v.within(launchSector.tile.v, (launchRange + 0.5f) * planets.planet.sectorApproxRadius*2) //within range
|
||||
|| (sector.preset != null && sector.preset.unlocked()); //is an unlocked preset
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,12 @@ public enum Stat{
|
||||
buildSpeed,
|
||||
mineSpeed,
|
||||
mineTier,
|
||||
payloadCapacity,
|
||||
commandLimit,
|
||||
baseDeflectChance,
|
||||
lightningChance,
|
||||
lightningDamage,
|
||||
abilities,
|
||||
|
||||
itemCapacity(StatCat.items),
|
||||
itemsMoved(StatCat.items),
|
||||
|
@ -9,6 +9,7 @@ import java.util.*;
|
||||
*/
|
||||
public enum StatUnit{
|
||||
blocks,
|
||||
blocksSquared,
|
||||
powerSecond,
|
||||
liquidSecond,
|
||||
itemsSecond,
|
||||
|
Loading…
Reference in New Issue
Block a user