From 096b54305d0d75a003b8dc3104aea47b49c342d7 Mon Sep 17 00:00:00 2001 From: genNAowl <68400583+genNAowl@users.noreply.github.com> Date: Wed, 10 Mar 2021 09:04:09 -0800 Subject: [PATCH] Add Status Effect Stats to Core Database (#4883) * Status Effect Stats * import cleanup * Add Sk7725's icons Tinting still a WIP Co-authored-by: Leonwang4234 <62972692+Leonwang4234@users.noreply.github.com> --- core/assets-raw/sprites/status/burning.png | Bin 0 -> 276 bytes core/assets-raw/sprites/status/disarmed.png | Bin 0 -> 343 bytes core/assets-raw/sprites/status/freezing.png | Bin 0 -> 329 bytes core/assets-raw/sprites/status/melting.png | Bin 0 -> 304 bytes core/assets-raw/sprites/status/muddy.png | Bin 0 -> 286 bytes core/assets-raw/sprites/status/overclock.png | Bin 0 -> 387 bytes core/assets-raw/sprites/status/overdrive.png | Bin 0 -> 387 bytes .../sprites/status/spore-slowed.png | Bin 0 -> 322 bytes core/assets-raw/sprites/status/wet.png | Bin 0 -> 283 bytes core/assets/bundles/bundle.properties | 21 ++++++ core/src/mindustry/content/StatusEffects.java | 12 ++-- core/src/mindustry/core/ContentLoader.java | 4 ++ core/src/mindustry/type/StatusEffect.java | 61 +++++++++++++++++- core/src/mindustry/world/meta/Stat.java | 9 ++- 14 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 core/assets-raw/sprites/status/burning.png create mode 100644 core/assets-raw/sprites/status/disarmed.png create mode 100644 core/assets-raw/sprites/status/freezing.png create mode 100644 core/assets-raw/sprites/status/melting.png create mode 100644 core/assets-raw/sprites/status/muddy.png create mode 100644 core/assets-raw/sprites/status/overclock.png create mode 100644 core/assets-raw/sprites/status/overdrive.png create mode 100644 core/assets-raw/sprites/status/spore-slowed.png create mode 100644 core/assets-raw/sprites/status/wet.png diff --git a/core/assets-raw/sprites/status/burning.png b/core/assets-raw/sprites/status/burning.png new file mode 100644 index 0000000000000000000000000000000000000000..7e82dd44823d8fa5fe3042f00b7c178652228eaa GIT binary patch literal 276 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}w>@1PLn1iOUcSiHY#_oM zAo~CRbZaKN7`N*xxm~;Yov)}ZpE`H#*2iae-qUd}7cwZF;>lo^qI`)#dLwg!Vi{w@ zgfy{)`q%NZBpuesXow5wmNR}V5^wna_;FnmSI3+aTnsZ(k7y-GE@Zml_wi55F$_N*rYRe8PT<dF(xJvLoacs@nY8s&J)}`+)GhrhtbUD;TdFS{bQg@%)d?|G7(48zz28 zsnhRzXpzof&#ljR=Rwx0y3U~2W&)i18MSQ8)9?A5O3?LaPdTWt$Nck#uS^RfoOoIf zuVGhk;%Psu@!!6|R^s&fBlk`u#BuH`VfHkbl(SNoaY32rk;B{BHZVOB>|^-Gwn4vL xYf^ik>DP@67Dg+ku(_wMW)0k)bC2%>YfY!T=UUOm&kPI<44$rjF6*2UngGDciw*z) literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/status/freezing.png b/core/assets-raw/sprites/status/freezing.png new file mode 100644 index 0000000000000000000000000000000000000000..5be529ab127affb3e458e0ac9996f3e0a5201878 GIT binary patch literal 329 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANNf0-i38ArYKMCr67lEAY5v z`+wh`n)Rh6$U|*?*w26?Depu}v)9_blR0nw@W?u@3*V-0+n{97bi6Vncr%kwK$LN+ z5fewtyH2A(M*aiAms6FPCMJ}x4QF7@`&+nAeZ}(dDwco=Z0QWIY_oJ2MG_9i3Qc2Z zKa;Ls^DcUwF_V4sWZw`4=62h_##HX_t(VG!L>&q|%OY2E=`{P`dA9~UO??GaNQq?}k2#I0Bt zvUoVIVB|^4I?J>qDb2;0p{SU-o2llg4cCD)k^QRmUlwu7FkkIYExvq;$>YpshBGzQ zotySm&I>bZoP6TxO=egSwOD*Th$A)3~eh~o(1x%G4Lx*cjSF(Vmig) z#V4LKd;ezM$WUgG&g0wl=n$W&yo&(egwHF(^c$x{q`lyr*PyI(;QfT}3=9kmp00i_ I>zopr06t!OBme*a literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/status/muddy.png b/core/assets-raw/sprites/status/muddy.png new file mode 100644 index 0000000000000000000000000000000000000000..41946e670d823ccd9195a9221e536e7be7606347 GIT binary patch literal 286 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}Pd!~6Ln1ie24CblqQJ9T z_WS?+Zyq|jU&y!|Sjc|6+x51}u{Rn^_mtJWpZjF$Z@~pt0nM9Kbh;Q+j#;VNbv1}A z5hA zh&BXGxRLwnEW;&+z@F2IZeMsclE3B6Jb!J4|6B&{jj3>%r6fAnJ2o* z^!n-7vJERVs@xRQ7`0eM&$1eG7f8;R`p3GV-{e<7@VR=14HD0{h_IG3Mkq!f*0V}y zc+=d~b;EdC;lUIJwId8+1+8~?RFS@4PL$~15HHD~ti`@^zt&0claA9aUUF)%PNc)I$ztaD0e0ss;{rZfNm literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/status/overdrive.png b/core/assets-raw/sprites/status/overdrive.png new file mode 100644 index 0000000000000000000000000000000000000000..79a4d561c3a730546c08888c00cfd80a79f8e494 GIT binary patch literal 387 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANNfUY;(FArYK!rv&mhEAX^D z-}L|g^ttIe2aB$YZEl(VQz7Ek`#z^T-)igE*4)!Rx^VBE1L=#HH>Yn6y>XTAOqcWS zkYK|Arp~*|w$5x6QE2&HaH8W~gVvdI)2=GIy$)fQVA;KBLfvjhzEmS-6GH~;zn_C8 zWpCU&Frnb0=!DK_pR0FF7FipxT1}d%kYw)IeCvgELZP&zNH))@q!Xb$YixgsYAb$N zWV(jm{~BX_fZ&QJChyiXhW%K5^8SGw_CwOOvfir8=RR1&DB{L+F-rKY`b@^s#WMxE z9lZ_x-4 su>X1HFVdQ&MBb@092Erod5s; literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/status/spore-slowed.png b/core/assets-raw/sprites/status/spore-slowed.png new file mode 100644 index 0000000000000000000000000000000000000000..939584437d393e1bbab1709d460a682456f941a6 GIT binary patch literal 322 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANNfoSrU@ArYKMr$+NN8}P6! zeD!y|PpYW0^0kw{7(ZNG^56}R+S1qCa!=1b{@i!RhW(C>9=pTTtS>ck#M}t6)plrY zw4S#vnPr(GLykZ1b@%TLyl&@jG@q;t*>51bAzuSl;d zGz(+(Dww#MW6DFN2|q=*G_dNqFJ=DU^60tGg0FcKUwb?#+rd%E)PKOX(fZ-^=`*e~ ze%Z0=xn99~=1_qs{)hgYJ3d&mv>9BPbOSUoP?hxJ%eE3>U|?YIboFyt=akR{0L18pWB>pF literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/status/wet.png b/core/assets-raw/sprites/status/wet.png new file mode 100644 index 0000000000000000000000000000000000000000..3a26c4974a541f3edb50b12bd72f4245a54a85f7 GIT binary patch literal 283 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}k33x*Ln1iePJ77JY{1j< z{KoJ7MPD5hTiWg%6_I=)pF8{6Z=0#P(#bXRZ1(vdI`~e&q2;NBHOo2yZ=tzN0uxnt zv92?D@i{*z^L^6nHQW7uvgpVt*ypt_o+;XqaIr>3`D%3Iip11;(;`$EGQAFQx#-83 zoL8Cb6~Soo#lSvoLD1PZ#vuz{%BGnaH|CtrUBUXpJ>h!V^|b{IB8_D`ls2%OgTe~DWM4f1RZnh literal 0 HcmV?d00001 diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 408f63bc72..b9dd75fe05 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -620,6 +620,20 @@ sector.extractionOutpost.description = A remote outpost, constructed by the enem sector.impact0078.description = Here lie remnants of the interstellar transport vessel that first entered this system.\n\nSalvage as much as possible from the wreckage. Research any intact technology. sector.planetaryTerminal.description = The final target.\n\nThis coastal base contains a structure capable of launching Cores to local planets. It is extremely well guarded.\n\nProduce naval units. Eliminate the enemy as quickly as possible. Research the launch structure. +status.burning.name = Burning +status.freezing.name = Freezing +status.wet.name = Wet +status.muddy.name = Muddy +status.melting.name = Melting +status.sapped.name = Sapped +status.spore-slowed.name = Spore Slowed +status.tarred.name = Tarred +status.overdrive.name = Overdrive +status.overclock.name = Overclock +status.shocked.name = Shocked +status.blasted.name = Blasted +status.disarmed.name = Disarmed + settings.language = Language settings.data = Game Data settings.reset = Reset to Defaults @@ -656,6 +670,7 @@ stat.output = Output stat.booster = Booster stat.tiles = Required Tiles stat.affinities = Affinities +stat.opposites = Opposites stat.powercapacity = Power Capacity stat.powershot = Power/Shot stat.damage = Damage @@ -717,6 +732,11 @@ stat.abilities = Abilities stat.canboost = Can Boost stat.flying = Flying stat.ammouse = Ammo Use +stat.damagemultiplier = Damage Multiplier +stat.healthmultiplier = Health Multiplier +stat.speedmultiplier = Speed Multiplier +stat.reloadmultiplier = Reload Multiplier +stat.buildspeedmultiplier = Build Speed Multiplier ability.forcefield = Force Field ability.repairfield = Repair Field @@ -992,6 +1012,7 @@ content.item.name = Items content.liquid.name = Liquids content.unit.name = Units content.block.name = Blocks +content.status.name = Status Effects content.sector.name = Sectors item.copper.name = Copper diff --git a/core/src/mindustry/content/StatusEffects.java b/core/src/mindustry/content/StatusEffects.java index e0de7ede42..798adb92db 100644 --- a/core/src/mindustry/content/StatusEffects.java +++ b/core/src/mindustry/content/StatusEffects.java @@ -26,7 +26,7 @@ public class StatusEffects implements ContentList{ init(() -> { opposite(wet, freezing); - trans(tarred, ((unit, time, newTime, result) -> { + affinity(tarred, ((unit, time, newTime, result) -> { unit.damagePierce(8f); Fx.burning.at(unit.x + Mathf.range(unit.bounds() / 2f), unit.y + Mathf.range(unit.bounds() / 2f)); result.set(burning, Math.min(time + newTime, 300f)); @@ -43,7 +43,7 @@ public class StatusEffects implements ContentList{ init(() -> { opposite(melting, burning); - trans(blasted, ((unit, time, newTime, result) -> { + affinity(blasted, ((unit, time, newTime, result) -> { unit.damagePierce(18f); result.set(freezing, time); })); @@ -67,7 +67,7 @@ public class StatusEffects implements ContentList{ effectChance = 0.09f; init(() -> { - trans(shocked, ((unit, time, newTime, result) -> { + affinity(shocked, ((unit, time, newTime, result) -> { unit.damagePierce(14f); if(unit.team == state.rules.waveTeam){ Events.fire(Trigger.shock); @@ -94,7 +94,7 @@ public class StatusEffects implements ContentList{ init(() -> { opposite(wet, freezing); - trans(tarred, ((unit, time, newTime, result) -> { + affinity(tarred, ((unit, time, newTime, result) -> { unit.damagePierce(8f); Fx.burning.at(unit.x + Mathf.range(unit.bounds() / 2f), unit.y + Mathf.range(unit.bounds() / 2f)); result.set(melting, Math.min(time + newTime, 200f)); @@ -123,8 +123,8 @@ public class StatusEffects implements ContentList{ effect = Fx.oily; init(() -> { - trans(melting, ((unit, time, newTime, result) -> result.set(melting, newTime + time))); - trans(burning, ((unit, time, newTime, result) -> result.set(burning, newTime + time))); + affinity(melting, ((unit, time, newTime, result) -> result.set(melting, newTime + time))); + affinity(burning, ((unit, time, newTime, result) -> result.set(burning, newTime + time))); }); }}; diff --git a/core/src/mindustry/core/ContentLoader.java b/core/src/mindustry/core/ContentLoader.java index fef7cc528b..582bbd8bf8 100644 --- a/core/src/mindustry/core/ContentLoader.java +++ b/core/src/mindustry/core/ContentLoader.java @@ -278,6 +278,10 @@ public class ContentLoader{ return getByID(ContentType.bullet, id); } + public Seq statusEffects(){ + return getBy(ContentType.status); + } + public Seq sectors(){ return getBy(ContentType.sector); } diff --git a/core/src/mindustry/type/StatusEffect.java b/core/src/mindustry/type/StatusEffect.java index 3e260bb975..015b79abfb 100644 --- a/core/src/mindustry/type/StatusEffect.java +++ b/core/src/mindustry/type/StatusEffect.java @@ -1,6 +1,7 @@ package mindustry.type; import arc.graphics.*; +import arc.graphics.g2d.*; import arc.math.*; import arc.struct.*; import arc.util.*; @@ -9,8 +10,10 @@ import mindustry.ctype.*; import mindustry.entities.*; import mindustry.entities.units.*; import mindustry.gen.*; +import mindustry.world.meta.*; +import mindustry.ui.*; -public class StatusEffect extends MappableContent{ +public class StatusEffect extends UnlockableContent{ /** Damage dealt by the unit with the effect. */ public float damageMultiplier = 1f; /** Unit health multiplier. */ @@ -40,6 +43,9 @@ public class StatusEffect extends MappableContent{ /** Called on init. */ protected Runnable initblock = () -> {}; + public ObjectSet affinities = new ObjectSet<>(); + public ObjectSet opposites = new ObjectSet<>(); + public StatusEffect(String name){ super(name); } @@ -53,6 +59,46 @@ public class StatusEffect extends MappableContent{ this.initblock = run; } + @Override + public boolean isHidden(){ + return localizedName.equals(name); + } + + @Override + public void setStats(){ + if(damageMultiplier != 1){ + stats.addPercent(Stat.damageMultiplier, damageMultiplier); + } + + if(healthMultiplier != 1){ + stats.addPercent(Stat.healthMultiplier, healthMultiplier); + } + + if(speedMultiplier != 1){ + stats.addPercent(Stat.speedMultiplier, speedMultiplier); + } + + if(reloadMultiplier != 1){ + stats.addPercent(Stat.reloadMultiplier, reloadMultiplier); + } + + if(buildSpeedMultiplier != 1){ + stats.addPercent(Stat.buildSpeedMultiplier, buildSpeedMultiplier); + } + + if(damage > 0){ + stats.add(Stat.damage, damage * 60f, StatUnit.perSecond); + } + + for(StatusEffect e : affinities){ + stats.add(Stat.affinities, e.toString(), StatUnit.none); + } + + for(StatusEffect e : opposites){ + stats.add(Stat.opposites, e.toString(), StatUnit.none); + } + } + /** Runs every tick on the affected unit while time is greater than 0. */ public void update(Unit unit, float time){ if(damage > 0){ @@ -72,8 +118,16 @@ public class StatusEffect extends MappableContent{ effect.transitions.put(this, handler); } + protected void affinity(StatusEffect effect, TransitionHandler handler){ + affinities.add(effect); + effect.affinities.add(this); + trans(effect, handler); + } + protected void opposite(StatusEffect... effect){ + opposites.addAll(effect); for(StatusEffect sup : effect){ + sup.opposites.add(this); trans(sup, (unit, time, newTime, result) -> { time -= newTime * 0.5f; if(time > 0){ @@ -108,6 +162,11 @@ public class StatusEffect extends MappableContent{ return result.set(to, newTime); } + @Override + public String toString(){ + return localizedName; + } + @Override public ContentType getContentType(){ return ContentType.status; diff --git a/core/src/mindustry/world/meta/Stat.java b/core/src/mindustry/world/meta/Stat.java index 24e96fcaf8..d9defaefb3 100644 --- a/core/src/mindustry/world/meta/Stat.java +++ b/core/src/mindustry/world/meta/Stat.java @@ -34,6 +34,12 @@ public enum Stat{ canBoost, maxUnits, + damageMultiplier, + healthMultiplier, + speedMultiplier, + reloadMultiplier, + buildSpeedMultiplier, + itemCapacity(StatCat.items), itemsMoved(StatCat.items), launchTime(StatCat.items), @@ -78,7 +84,8 @@ public enum Stat{ booster(StatCat.optional), boostEffect(StatCat.optional), - affinities(StatCat.optional); + affinities(StatCat.optional), + opposites(StatCat.optional); public final StatCat category;