From 36dc0e9e3e27fdd8806f86a93e95bc266b712cf8 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 8 Dec 2021 20:19:46 -0500 Subject: [PATCH] Fracture impl --- .../sprites/blocks/turrets/fracture.png | Bin 1002 -> 998 bytes core/src/mindustry/content/Blocks.java | 26 +++++++++++------- core/src/mindustry/content/Fx.java | 14 ++++++++++ core/src/mindustry/core/Logic.java | 10 +++++++ .../entities/bullet/ContinuousBulletType.java | 19 ++++++++++++- .../bullet/ContinuousFlameBulletType.java | 2 +- .../ui/dialogs/CustomRulesDialog.java | 14 ---------- 7 files changed, 59 insertions(+), 26 deletions(-) diff --git a/core/assets-raw/sprites/blocks/turrets/fracture.png b/core/assets-raw/sprites/blocks/turrets/fracture.png index 5c46f0e78c3dd20a2538bcdaf056751b5ec67525..93294ce85bfe0c2bece37a9d2d011f0b01233383 100644 GIT binary patch delta 963 zcmaFG{)~NsVf_M67srr_Id5m}_meRcIF`QHhJ}AZ$rD~Bm0Q-cUQ{rj@{kD+Dm3xr zbXnwmkHO_|pjyxo=?Q#t3i%I3F3yp;-;;h!PFm@$y5h!rd++|Ollw1O&FI!EWx8sj z+T}FfOztLXhd9$qvmxL)X0|NfPg5a)vWu*-Y@_KMHb_q(c= z^m#>?z#YbbXMs{2Qz}EaIo2^0J!52;CntZTdQatVz3O|?PLtIfJd@>A9Y2JKGl+d& z5hpNb+s%N3S9uGi-{%UF;o z@BBc`-d15x-oKWfXWf?#>Svyt_gVB5)E!D~J zE?@6varABLo3q${h&%E02Ish~db#`R*9rB;_VIJN&Ih|Pus{5f5H8!5@$YYY{~J^B zbajS=)q(4Jv(GR~%yQsbc*Lfwso`0mslb+Jj4TY9`P~9K&vwpHY@0C4J@Qy_%Y<3e z&4O~aiV>SN1hdbW?%iN@9gi#n$zbhuDkX= zUvKl{eV^`0r`}3i75KTfahAu1p65$nZ88jETG(F6z}#?a&t0a4*Y>2&%w=Yn+OXiK zoWPzl!2&Bz3P>`3^wBq6+xlSV{^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WM4fDl*AG diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 1c23c8691c..9740adedd6 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -2,6 +2,7 @@ package mindustry.content; import arc.graphics.*; import arc.math.*; +import arc.math.Interp.*; import arc.struct.*; import mindustry.*; import mindustry.entities.*; @@ -2863,20 +2864,24 @@ public class Blocks{ fracture = new ItemTurret("fracture"){{ requirements(Category.turret, with(Items.tungsten, 35, Items.silicon, 35)); ammo( - Items.tungsten, new ContinuousFlameBulletType(20f){{ - length = 90f; - shootEffect = Fx.colorSpark; + Items.tungsten, new ContinuousFlameBulletType(45f){{ + length = 105f; + shootEffect = Fx.randLifeSpark; + width = 4.5f; + colors = new Color[]{Color.valueOf("e8e6ff").a(0.55f), Color.valueOf("819aeb").a(0.7f), Color.valueOf("786bed").a(0.8f), Color.valueOf("c3cdfa"), Color.white}; smokeEffect = Fx.shootBigSmoke; + continuous = false; ammoMultiplier = 2; pierce = true; knockback = 4f; status = StatusEffects.slow; hitColor = Items.tungsten.color; - lifetime = 16f; + lifetime = 19f; despawnEffect = Fx.none; drawFlare = false; - lengthInterp = f -> Interp.pow2In.apply(1f - f); - //TODO different effect? + collidesAir = true; + Interp in = new PowIn(1.6f); + lengthInterp = f -> in.apply(1f - f); hitEffect = Fx.hitBulletColor; }} ); @@ -2887,13 +2892,14 @@ public class Blocks{ //TODO cool reload animation draw = new DrawTurret("reinforced-"); - shootShake = 2f; - shootLength = 6f; + shootShake = 1f; + shootLength = 5f; outlineColor = Pal.darkOutline; size = 2; envEnabled |= Env.space; - reloadTime = 30f; - restitution = 0.03f; + reloadTime = 25f; + restitution = 0.1f; + recoilAmount = 2.5f; range = 90; shootCone = 15f; inaccuracy = 0f; diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 3dc5ee97e1..9496ccab85 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -1458,6 +1458,20 @@ public class Fx{ }); }), + randLifeSpark = new Effect(24f, e -> { + color(Color.white, e.color, e.fin()); + stroke(e.fout() * 1.5f + 0.5f); + + rand.setSeed(e.id); + for(int i = 0; i < 15; i++){ + float ang = e.rotation + rand.range(9f), len = rand.random(90f * e.finpow()); + e.scaled(e.lifetime * rand.random(0.5f, 1f), p -> { + v.trns(ang, len); + lineAngle(e.x + v.x, e.y + v.y, ang, p.fout() * 7f + 0.5f); + }); + } + }), + //TODO just make it properly colored... tungstenSpark = new Effect(23f, e -> { color(Color.white, Pal.tungstenShot, e.fin()); diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index 8fb03afe27..45d8121bcf 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -95,6 +95,16 @@ public class Logic implements ApplicationListener{ } }); + Events.on(PlayEvent.class, e -> { + //reset weather on play + var randomWeather = state.rules.weather.copy().shuffle(); + float sum = 0f; + for(var weather : randomWeather){ + weather.cooldown = sum + Mathf.random(weather.maxFrequency); + sum += weather.cooldown; + } + }); + Events.on(WorldLoadEvent.class, e -> { //enable infinite ammo for wave team by default state.rules.waveTeam.rules().infiniteAmmo = true; diff --git a/core/src/mindustry/entities/bullet/ContinuousBulletType.java b/core/src/mindustry/entities/bullet/ContinuousBulletType.java index 91b3e69905..9e00cef2c0 100644 --- a/core/src/mindustry/entities/bullet/ContinuousBulletType.java +++ b/core/src/mindustry/entities/bullet/ContinuousBulletType.java @@ -10,6 +10,7 @@ public class ContinuousBulletType extends BulletType{ public float shake = 0f; public float damageInterval = 5f; public boolean largeHit = false; + public boolean continuous = true; public boolean laserAbsorb = true; /** can't use pierceCap here for... many reasons. DO NOT USE, BUGGY */ public int pierceMax = -1; @@ -29,11 +30,13 @@ public class ContinuousBulletType extends BulletType{ @Override public float continuousDamage(){ + if(!continuous) return -1f; return damage / damageInterval * 60f; } @Override public float estimateDPS(){ + if(!continuous) return super.estimateDPS(); //assume firing duration is about 100 by default, may not be accurate there's no way of knowing in this method //assume it pierces 3 blocks/units return damage * 100f / damageInterval * 3f; @@ -51,12 +54,22 @@ public class ContinuousBulletType extends BulletType{ drawSize = Math.max(drawSize, length*2f); } + @Override + public void init(Bullet b){ + super.init(b); + + if(!continuous){ + applyDamage(b); + } + } + @Override public void update(Bullet b){ + if(!continuous) return; //damage every 5 ticks if(b.timer(1, damageInterval)){ - Damage.collideLine(b, b.team, hitEffect, b.x, b.y, b.rotation(), currentLength(b), largeHit, laserAbsorb, pierceMax); + applyDamage(b); } if(shake > 0){ @@ -64,6 +77,10 @@ public class ContinuousBulletType extends BulletType{ } } + public void applyDamage(Bullet b){ + Damage.collideLine(b, b.team, hitEffect, b.x, b.y, b.rotation(), currentLength(b), largeHit, laserAbsorb, pierceMax); + } + public float currentLength(Bullet b){ return length; } diff --git a/core/src/mindustry/entities/bullet/ContinuousFlameBulletType.java b/core/src/mindustry/entities/bullet/ContinuousFlameBulletType.java index 228fe9d457..9270be2a6b 100644 --- a/core/src/mindustry/entities/bullet/ContinuousFlameBulletType.java +++ b/core/src/mindustry/entities/bullet/ContinuousFlameBulletType.java @@ -91,7 +91,7 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{ @Override public float currentLength(Bullet b){ - return length * b.fslope(); + return length * b.fin(lengthInterp); } @Override diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index 4cbeb02a46..271d80d2a2 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -3,7 +3,6 @@ package mindustry.ui.dialogs; import arc.*; import arc.func.*; import arc.graphics.*; -import arc.math.*; import arc.scene.style.*; import arc.scene.ui.*; import arc.scene.ui.ImageButton.*; @@ -411,19 +410,6 @@ public class CustomRulesDialog extends BaseDialog{ add.show(); }).width(170f); - //reset cooldown to random number - dialog.hidden(() -> { - float sum = 0; - Seq sh = rules.weather.copy(); - sh.shuffle(); - - for(WeatherEntry w : sh){ - //add the previous cooldowns to the sum so weather events are staggered and don't happen all at once. - w.cooldown = sum + Mathf.random(w.minFrequency, w.maxFrequency); - sum += w.cooldown; - } - }); - dialog.show(); } }