Fixed shields not blocking blast compound explosions
This commit is contained in:
@@ -1042,7 +1042,7 @@ public class UnitTypes{
|
|||||||
|
|
||||||
status = StatusEffects.blasted;
|
status = StatusEffects.blasted;
|
||||||
statusDuration = 60f;
|
statusDuration = 60f;
|
||||||
damage = splashDamage * 0.75f;
|
damage = splashDamage * 0.7f;
|
||||||
}};
|
}};
|
||||||
}});
|
}});
|
||||||
}};
|
}};
|
||||||
@@ -1447,7 +1447,7 @@ public class UnitTypes{
|
|||||||
healPercent = 15f;
|
healPercent = 15f;
|
||||||
splashDamage = 220f;
|
splashDamage = 220f;
|
||||||
splashDamageRadius = 80f;
|
splashDamageRadius = 80f;
|
||||||
damage = splashDamage * 0.75f;
|
damage = splashDamage * 0.7f;
|
||||||
}};
|
}};
|
||||||
}});
|
}});
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import mindustry.gen.*;
|
|||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.blocks.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -101,9 +103,13 @@ public class Damage{
|
|||||||
float damagePerWave = explosiveness / 2f;
|
float damagePerWave = explosiveness / 2f;
|
||||||
|
|
||||||
for(int i = 0; i < waves; i++){
|
for(int i = 0; i < waves; i++){
|
||||||
|
var shields = ignoreTeam == null ? null : indexer.getEnemy(ignoreTeam, BlockFlag.shield);
|
||||||
int f = i;
|
int f = i;
|
||||||
Time.run(i * 2f, () -> {
|
Time.run(i * 2f, () -> {
|
||||||
|
if(shields == null || shields.isEmpty() || !shields.contains(b -> b instanceof ExplosionShield s && s.absorbExplosion(x, y, damagePerWave))){
|
||||||
damage(ignoreTeam, x, y, Mathf.clamp(radius + explosiveness, 0, 50f) * ((f + 1f) / waves), damagePerWave, false);
|
damage(ignoreTeam, x, y, Mathf.clamp(radius + explosiveness, 0, 50f) * ((f + 1f) / waves), damagePerWave, false);
|
||||||
|
}
|
||||||
|
|
||||||
Fx.blockExplosionSmoke.at(x + Mathf.range(radius), y + Mathf.range(radius));
|
Fx.blockExplosionSmoke.at(x + Mathf.range(radius), y + Mathf.range(radius));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -717,7 +717,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
if(type.flying && !spawnedByCore && type.createWreck && state.rules.unitCrashDamage(team) > 0){
|
if(type.flying && !spawnedByCore && type.createWreck && state.rules.unitCrashDamage(team) > 0){
|
||||||
var shields = indexer.getEnemy(team, BlockFlag.shield);
|
var shields = indexer.getEnemy(team, BlockFlag.shield);
|
||||||
float crashDamage = Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f * state.rules.unitCrashDamage(team);
|
float crashDamage = Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f * state.rules.unitCrashDamage(team);
|
||||||
if(shields.isEmpty() || !shields.contains(b -> b instanceof UnitWreckShield s && s.absorbWreck(self(), crashDamage))){
|
if(shields.isEmpty() || !shields.contains(b -> b instanceof ExplosionShield s && s.absorbExplosion(x, y, crashDamage))){
|
||||||
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, crashDamage, true, false, true);
|
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, crashDamage, true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,11 @@ public class CampaignRules{
|
|||||||
rules.showSpawns = showSpawns;
|
rules.showSpawns = showSpawns;
|
||||||
rules.randomWaveAI = randomWaveAI;
|
rules.randomWaveAI = randomWaveAI;
|
||||||
if(planet.showRtsAIRule && rules.attackMode){
|
if(planet.showRtsAIRule && rules.attackMode){
|
||||||
|
boolean swapped = rules.teams.get(rules.waveTeam).rtsAi != rtsAI;
|
||||||
rules.teams.get(rules.waveTeam).rtsAi = rtsAI;
|
rules.teams.get(rules.waveTeam).rtsAi = rtsAI;
|
||||||
rules.teams.get(rules.waveTeam).rtsMinWeight = 1.2f * difficulty.enemyHealthMultiplier;
|
rules.teams.get(rules.waveTeam).rtsMinWeight = 1.2f * difficulty.enemyHealthMultiplier;
|
||||||
|
|
||||||
if(Vars.state.isGame()){
|
if(swapped && Vars.state.isGame()){
|
||||||
Groups.unit.each(u -> {
|
Groups.unit.each(u -> {
|
||||||
if(u.team == rules.waveTeam && !u.isPlayer()){
|
if(u.team == rules.waveTeam && !u.isPlayer()){
|
||||||
u.resetController();
|
u.resetController();
|
||||||
|
|||||||
7
core/src/mindustry/world/blocks/ExplosionShield.java
Normal file
7
core/src/mindustry/world/blocks/ExplosionShield.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package mindustry.world.blocks;
|
||||||
|
|
||||||
|
//TODO: horrible API design, but I'm not sure of a better way to do this right now. please don't use this class
|
||||||
|
public interface ExplosionShield{
|
||||||
|
/** @return whether the shield was able to absorb the explosion; this should apply damage to the shield if true is returned. */
|
||||||
|
boolean absorbExplosion(float x, float y, float damage);
|
||||||
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package mindustry.world.blocks;
|
|
||||||
|
|
||||||
import mindustry.gen.*;
|
|
||||||
|
|
||||||
//TODO: horrible API design, but I'm not sure of a better way to do this right now. please don't use this class
|
|
||||||
public interface UnitWreckShield{
|
|
||||||
/** @return whether the shield was able to absorb the unit wreck; this should apply damage to the shield if true is returned. */
|
|
||||||
boolean absorbWreck(Unit unit, float damage);
|
|
||||||
}
|
|
||||||
@@ -40,7 +40,7 @@ public class ForceProjector extends Block{
|
|||||||
public float cooldownBrokenBase = 0.35f;
|
public float cooldownBrokenBase = 0.35f;
|
||||||
public float coolantConsumption = 0.1f;
|
public float coolantConsumption = 0.1f;
|
||||||
public boolean consumeCoolant = true;
|
public boolean consumeCoolant = true;
|
||||||
public float crashDamageMultiplier = 2.5f;
|
public float crashDamageMultiplier = 2f;
|
||||||
public Effect absorbEffect = Fx.absorb;
|
public Effect absorbEffect = Fx.absorb;
|
||||||
public Effect shieldBreakEffect = Fx.shieldBreak;
|
public Effect shieldBreakEffect = Fx.shieldBreak;
|
||||||
public @Load("@-top") TextureRegion topRegion;
|
public @Load("@-top") TextureRegion topRegion;
|
||||||
@@ -123,7 +123,7 @@ public class ForceProjector extends Block{
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ForceBuild extends Building implements Ranged, UnitWreckShield{
|
public class ForceBuild extends Building implements Ranged, ExplosionShield{
|
||||||
public boolean broken = true;
|
public boolean broken = true;
|
||||||
public float buildup, radscl, hit, warmup, phaseHeat;
|
public float buildup, radscl, hit, warmup, phaseHeat;
|
||||||
|
|
||||||
@@ -218,10 +218,10 @@ public class ForceProjector extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean absorbWreck(Unit unit, float damage){
|
public boolean absorbExplosion(float ex, float ey, float damage){
|
||||||
boolean absorb = !broken && Intersector.isInRegularPolygon(sides, x, y, realRadius(), shieldRotation, unit.x, unit.y);
|
boolean absorb = !broken && Intersector.isInRegularPolygon(sides, x, y, realRadius(), shieldRotation, ex, ey);
|
||||||
if(absorb){
|
if(absorb){
|
||||||
absorbEffect.at(unit);
|
absorbEffect.at(ex, ey);
|
||||||
hit = 1f;
|
hit = 1f;
|
||||||
buildup += damage * crashDamageMultiplier;
|
buildup += damage * crashDamageMultiplier;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user