Navanax buff (#8925)
* Update UnitTypes.java its late at night imma just commit changes and pray i didnt fuck up anywhere * Allow changing suppress effect color * Fx.regenSuppressParticle and Fx.regenSuppressSeek now color-aware - regenSuppressParticle's color handling changed, allows changing the from color intead of the to color * Damage.applySuppression accepts color as an argument, old method signature still exists * SuppressionFieldAbility has a new field allowing to specify the color for effect particles * BulletType has a new field allowing to specify the color for suppress effect particles * BuildingComp has a new field storing the color to be used for suppression effect * name --------- Co-authored-by: BalaM314 <71201189+BalaM314@users.noreply.github.com>
This commit is contained in:
@@ -1710,7 +1710,7 @@ public class Fx{
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
regenSuppressParticle = new Effect(35f, e -> {
|
regenSuppressParticle = new Effect(35f, e -> {
|
||||||
color(Pal.sapBullet, e.color, e.fin());
|
color(e.color, Color.white, e.fin());
|
||||||
stroke(e.fout() * 1.4f + 0.5f);
|
stroke(e.fout() * 1.4f + 0.5f);
|
||||||
|
|
||||||
randLenVectors(e.id, 4, 17f * e.fin(), (x, y) -> {
|
randLenVectors(e.id, 4, 17f * e.fin(), (x, y) -> {
|
||||||
@@ -1729,7 +1729,7 @@ public class Fx{
|
|||||||
|
|
||||||
Tmp.bz2.valueAt(Tmp.v4, e.fout());
|
Tmp.bz2.valueAt(Tmp.v4, e.fout());
|
||||||
|
|
||||||
color(Pal.sapBullet);
|
color(e.color);
|
||||||
Fill.circle(Tmp.v4.x, Tmp.v4.y, e.fslope() * 2f + 0.1f);
|
Fill.circle(Tmp.v4.x, Tmp.v4.y, e.fslope() * 2f + 0.1f);
|
||||||
}).followParent(false).rotWithParent(false),
|
}).followParent(false).rotWithParent(false),
|
||||||
|
|
||||||
|
|||||||
@@ -2243,7 +2243,13 @@ public class UnitTypes{
|
|||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
abilities.add(new SuppressionFieldAbility(){{
|
||||||
|
orbRadius = 5;
|
||||||
|
particleSize = 3;
|
||||||
|
y = -10f;
|
||||||
|
particles = 10;
|
||||||
|
color = particleColor = effectColor = Pal.heal;
|
||||||
|
}});
|
||||||
weapons.add(new Weapon("emp-cannon-mount"){{
|
weapons.add(new Weapon("emp-cannon-mount"){{
|
||||||
rotate = true;
|
rotate = true;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package mindustry.entities;
|
|||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
|
import arc.graphics.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
@@ -38,10 +39,13 @@ public class Damage{
|
|||||||
private static Unit tmpUnit;
|
private static Unit tmpUnit;
|
||||||
|
|
||||||
public static void applySuppression(Team team, float x, float y, float range, float reload, float maxDelay, float applyParticleChance, @Nullable Position source){
|
public static void applySuppression(Team team, float x, float y, float range, float reload, float maxDelay, float applyParticleChance, @Nullable Position source){
|
||||||
|
applySuppression(team, x, y, range, reload, maxDelay, applyParticleChance, source, Pal.sapBullet);
|
||||||
|
}
|
||||||
|
public static void applySuppression(Team team, float x, float y, float range, float reload, float maxDelay, float applyParticleChance, @Nullable Position source, Color effectColor){
|
||||||
builds.clear();
|
builds.clear();
|
||||||
indexer.eachBlock(null, x, y, range, build -> build.team != team, build -> {
|
indexer.eachBlock(null, x, y, range, build -> build.team != team, build -> {
|
||||||
float prev = build.healSuppressionTime;
|
float prev = build.healSuppressionTime;
|
||||||
build.applyHealSuppression(reload + 1f);
|
build.applyHealSuppression(reload + 1f, effectColor);
|
||||||
|
|
||||||
//TODO maybe should be block field instead of instanceof check
|
//TODO maybe should be block field instead of instanceof check
|
||||||
if(build.wasRecentlyHealed(60f * 12f) || build.block.suppressable){
|
if(build.wasRecentlyHealed(60f * 12f) || build.block.suppressable){
|
||||||
@@ -58,7 +62,7 @@ public class Damage{
|
|||||||
for(var build : builds){
|
for(var build : builds){
|
||||||
if(Mathf.chance(scaledChance)){
|
if(Mathf.chance(scaledChance)){
|
||||||
Time.run(Mathf.random(maxDelay), () -> {
|
Time.run(Mathf.random(maxDelay), () -> {
|
||||||
Fx.regenSuppressSeek.at(build.x + Mathf.range(build.block.size * tilesize / 2f), build.y + Mathf.range(build.block.size * tilesize / 2f), 0f, source);
|
Fx.regenSuppressSeek.at(build.x + Mathf.range(build.block.size * tilesize / 2f), build.y + Mathf.range(build.block.size * tilesize / 2f), 0f, effectColor, source);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class SuppressionFieldAbility extends Ability{
|
|||||||
public boolean active = true;
|
public boolean active = true;
|
||||||
public Interp particleInterp = f -> Interp.circleOut.apply(Interp.slope.apply(f));
|
public Interp particleInterp = f -> Interp.circleOut.apply(Interp.slope.apply(f));
|
||||||
public Color particleColor = Pal.sap.cpy();
|
public Color particleColor = Pal.sap.cpy();
|
||||||
|
public Color effectColor = Pal.sapBullet;
|
||||||
|
|
||||||
public float applyParticleChance = 13f;
|
public float applyParticleChance = 13f;
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ public class SuppressionFieldAbility extends Ability{
|
|||||||
|
|
||||||
if((timer += Time.delta) >= reload){
|
if((timer += Time.delta) >= reload){
|
||||||
Tmp.v1.set(x, y).rotate(unit.rotation - 90f).add(unit);
|
Tmp.v1.set(x, y).rotate(unit.rotation - 90f).add(unit);
|
||||||
Damage.applySuppression(unit.team, Tmp.v1.x, Tmp.v1.y, range, reload, reload, applyParticleChance, unit);
|
Damage.applySuppression(unit.team, Tmp.v1.x, Tmp.v1.y, range, reload, reload, applyParticleChance, unit, effectColor);
|
||||||
timer = 0f;
|
timer = 0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,6 +255,8 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
public float suppressionDuration = 60f * 8f;
|
public float suppressionDuration = 60f * 8f;
|
||||||
/** Chance of suppression effect occurring on block, scaled down by number of blocks. */
|
/** Chance of suppression effect occurring on block, scaled down by number of blocks. */
|
||||||
public float suppressionEffectChance = 50f;
|
public float suppressionEffectChance = 50f;
|
||||||
|
/** Color used for the regenSuppressSeek effect. */
|
||||||
|
public Color suppressColor = Pal.sapBullet;
|
||||||
|
|
||||||
/** Color of lightning created by bullet. */
|
/** Color of lightning created by bullet. */
|
||||||
public Color lightningColor = Pal.surge;
|
public Color lightningColor = Pal.surge;
|
||||||
@@ -440,7 +442,7 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
|
|
||||||
if(suppressionRange > 0){
|
if(suppressionRange > 0){
|
||||||
//bullets are pooled, require separate Vec2 instance
|
//bullets are pooled, require separate Vec2 instance
|
||||||
Damage.applySuppression(b.team, b.x, b.y, suppressionRange, suppressionDuration, 0f, suppressionEffectChance, new Vec2(b.x, b.y));
|
Damage.applySuppression(b.team, b.x, b.y, suppressionRange, suppressionDuration, 0f, suppressionEffectChance, new Vec2(b.x, b.y), suppressColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
createSplashDamage(b, x, y);
|
createSplashDamage(b, x, y);
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
|
|
||||||
transient float healSuppressionTime = -1f;
|
transient float healSuppressionTime = -1f;
|
||||||
transient float lastHealTime = -120f * 10f;
|
transient float lastHealTime = -120f * 10f;
|
||||||
|
transient Color suppressColor = Pal.sapBullet;
|
||||||
|
|
||||||
private transient float lastDamageTime = -recentDamageTime;
|
private transient float lastDamageTime = -recentDamageTime;
|
||||||
private transient float timeScale = 1f, timeScaleDuration;
|
private transient float timeScale = 1f, timeScaleDuration;
|
||||||
@@ -438,7 +439,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void applyHealSuppression(float amount){
|
public void applyHealSuppression(float amount){
|
||||||
|
applyHealSuppression(amount, Pal.sapBullet);
|
||||||
|
}
|
||||||
|
public void applyHealSuppression(float amount, Color suppressColor){
|
||||||
healSuppressionTime = Math.max(healSuppressionTime, Time.time + amount);
|
healSuppressionTime = Math.max(healSuppressionTime, Time.time + amount);
|
||||||
|
this.suppressColor = suppressColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHealSuppressed(){
|
public boolean isHealSuppressed(){
|
||||||
@@ -1242,7 +1247,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
public boolean checkSuppression(){
|
public boolean checkSuppression(){
|
||||||
if(isHealSuppressed()){
|
if(isHealSuppressed()){
|
||||||
if(Mathf.chanceDelta(0.03)){
|
if(Mathf.chanceDelta(0.03)){
|
||||||
Fx.regenSuppressParticle.at(x + Mathf.range(block.size * tilesize/2f - 1f), y + Mathf.range(block.size * tilesize/2f - 1f));
|
Fx.regenSuppressParticle.at(x + Mathf.range(block.size * tilesize/2f - 1f), y + Mathf.range(block.size * tilesize/2f - 1f), suppressColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user