From 8a9b123b8133174ee935320b7c0da66566d08946 Mon Sep 17 00:00:00 2001 From: Zerenta <80897573+Zerenta@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:31:38 -0400 Subject: [PATCH] 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> --- core/src/mindustry/content/Fx.java | 4 ++-- core/src/mindustry/content/UnitTypes.java | 8 +++++++- core/src/mindustry/entities/Damage.java | 8 ++++++-- .../entities/abilities/SuppressionFieldAbility.java | 3 ++- core/src/mindustry/entities/bullet/BulletType.java | 4 +++- core/src/mindustry/entities/comp/BuildingComp.java | 7 ++++++- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 1d1301abaf..09b7574775 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -1710,7 +1710,7 @@ public class Fx{ }), 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); randLenVectors(e.id, 4, 17f * e.fin(), (x, y) -> { @@ -1729,7 +1729,7 @@ public class Fx{ 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); }).followParent(false).rotWithParent(false), diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index e5145be5b8..a72a14ef90 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -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"){{ rotate = true; diff --git a/core/src/mindustry/entities/Damage.java b/core/src/mindustry/entities/Damage.java index f36f66df87..2c2426deba 100644 --- a/core/src/mindustry/entities/Damage.java +++ b/core/src/mindustry/entities/Damage.java @@ -2,6 +2,7 @@ package mindustry.entities; import arc.*; import arc.func.*; +import arc.graphics.*; import arc.math.*; import arc.math.geom.*; import arc.struct.*; @@ -38,10 +39,13 @@ public class Damage{ 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){ + 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(); indexer.eachBlock(null, x, y, range, build -> build.team != team, build -> { float prev = build.healSuppressionTime; - build.applyHealSuppression(reload + 1f); + build.applyHealSuppression(reload + 1f, effectColor); //TODO maybe should be block field instead of instanceof check if(build.wasRecentlyHealed(60f * 12f) || build.block.suppressable){ @@ -58,7 +62,7 @@ public class Damage{ for(var build : builds){ if(Mathf.chance(scaledChance)){ 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); }); } } diff --git a/core/src/mindustry/entities/abilities/SuppressionFieldAbility.java b/core/src/mindustry/entities/abilities/SuppressionFieldAbility.java index 7c3f56b53c..d421ebf848 100644 --- a/core/src/mindustry/entities/abilities/SuppressionFieldAbility.java +++ b/core/src/mindustry/entities/abilities/SuppressionFieldAbility.java @@ -27,6 +27,7 @@ public class SuppressionFieldAbility extends Ability{ public boolean active = true; public Interp particleInterp = f -> Interp.circleOut.apply(Interp.slope.apply(f)); public Color particleColor = Pal.sap.cpy(); + public Color effectColor = Pal.sapBullet; public float applyParticleChance = 13f; @@ -38,7 +39,7 @@ public class SuppressionFieldAbility extends Ability{ if((timer += Time.delta) >= reload){ 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; } } diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 780978e408..c0966d48b3 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -255,6 +255,8 @@ public class BulletType extends Content implements Cloneable{ public float suppressionDuration = 60f * 8f; /** Chance of suppression effect occurring on block, scaled down by number of blocks. */ public float suppressionEffectChance = 50f; + /** Color used for the regenSuppressSeek effect. */ + public Color suppressColor = Pal.sapBullet; /** Color of lightning created by bullet. */ public Color lightningColor = Pal.surge; @@ -440,7 +442,7 @@ public class BulletType extends Content implements Cloneable{ if(suppressionRange > 0){ //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); diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 9bbf357eae..7e9ed1175b 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -90,6 +90,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, transient float healSuppressionTime = -1f; transient float lastHealTime = -120f * 10f; + transient Color suppressColor = Pal.sapBullet; private transient float lastDamageTime = -recentDamageTime; private transient float timeScale = 1f, timeScaleDuration; @@ -438,7 +439,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, } public void applyHealSuppression(float amount){ + applyHealSuppression(amount, Pal.sapBullet); + } + public void applyHealSuppression(float amount, Color suppressColor){ healSuppressionTime = Math.max(healSuppressionTime, Time.time + amount); + this.suppressColor = suppressColor; } public boolean isHealSuppressed(){ @@ -1242,7 +1247,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, public boolean checkSuppression(){ if(isHealSuppressed()){ 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;