diff --git a/core/assets-raw/sprites/status/burning.png b/core/assets-raw/sprites/status/burning.png new file mode 100644 index 0000000000..7e82dd4482 Binary files /dev/null and b/core/assets-raw/sprites/status/burning.png differ diff --git a/core/assets-raw/sprites/status/disarmed.png b/core/assets-raw/sprites/status/disarmed.png new file mode 100644 index 0000000000..c1cfb764ba Binary files /dev/null and b/core/assets-raw/sprites/status/disarmed.png differ diff --git a/core/assets-raw/sprites/status/freezing.png b/core/assets-raw/sprites/status/freezing.png new file mode 100644 index 0000000000..5be529ab12 Binary files /dev/null and b/core/assets-raw/sprites/status/freezing.png differ diff --git a/core/assets-raw/sprites/status/melting.png b/core/assets-raw/sprites/status/melting.png new file mode 100644 index 0000000000..e3b4e54b54 Binary files /dev/null and b/core/assets-raw/sprites/status/melting.png differ diff --git a/core/assets-raw/sprites/status/muddy.png b/core/assets-raw/sprites/status/muddy.png new file mode 100644 index 0000000000..41946e670d Binary files /dev/null and b/core/assets-raw/sprites/status/muddy.png differ diff --git a/core/assets-raw/sprites/status/overclock.png b/core/assets-raw/sprites/status/overclock.png new file mode 100644 index 0000000000..ede85bb8e9 Binary files /dev/null and b/core/assets-raw/sprites/status/overclock.png differ diff --git a/core/assets-raw/sprites/status/overdrive.png b/core/assets-raw/sprites/status/overdrive.png new file mode 100644 index 0000000000..79a4d561c3 Binary files /dev/null and b/core/assets-raw/sprites/status/overdrive.png differ 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 0000000000..939584437d Binary files /dev/null and b/core/assets-raw/sprites/status/spore-slowed.png differ diff --git a/core/assets-raw/sprites/status/wet.png b/core/assets-raw/sprites/status/wet.png new file mode 100644 index 0000000000..3a26c4974a Binary files /dev/null and b/core/assets-raw/sprites/status/wet.png differ 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;