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>
This commit is contained in:
genNAowl
2021-03-10 09:04:09 -08:00
committed by GitHub
parent 8b52561a31
commit 096b54305d
14 changed files with 99 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

View File

@@ -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.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. 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.language = Language
settings.data = Game Data settings.data = Game Data
settings.reset = Reset to Defaults settings.reset = Reset to Defaults
@@ -656,6 +670,7 @@ stat.output = Output
stat.booster = Booster stat.booster = Booster
stat.tiles = Required Tiles stat.tiles = Required Tiles
stat.affinities = Affinities stat.affinities = Affinities
stat.opposites = Opposites
stat.powercapacity = Power Capacity stat.powercapacity = Power Capacity
stat.powershot = Power/Shot stat.powershot = Power/Shot
stat.damage = Damage stat.damage = Damage
@@ -717,6 +732,11 @@ stat.abilities = Abilities
stat.canboost = Can Boost stat.canboost = Can Boost
stat.flying = Flying stat.flying = Flying
stat.ammouse = Ammo Use 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.forcefield = Force Field
ability.repairfield = Repair Field ability.repairfield = Repair Field
@@ -992,6 +1012,7 @@ content.item.name = Items
content.liquid.name = Liquids content.liquid.name = Liquids
content.unit.name = Units content.unit.name = Units
content.block.name = Blocks content.block.name = Blocks
content.status.name = Status Effects
content.sector.name = Sectors content.sector.name = Sectors
item.copper.name = Copper item.copper.name = Copper

View File

@@ -26,7 +26,7 @@ public class StatusEffects implements ContentList{
init(() -> { init(() -> {
opposite(wet, freezing); opposite(wet, freezing);
trans(tarred, ((unit, time, newTime, result) -> { affinity(tarred, ((unit, time, newTime, result) -> {
unit.damagePierce(8f); unit.damagePierce(8f);
Fx.burning.at(unit.x + Mathf.range(unit.bounds() / 2f), unit.y + Mathf.range(unit.bounds() / 2f)); 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)); result.set(burning, Math.min(time + newTime, 300f));
@@ -43,7 +43,7 @@ public class StatusEffects implements ContentList{
init(() -> { init(() -> {
opposite(melting, burning); opposite(melting, burning);
trans(blasted, ((unit, time, newTime, result) -> { affinity(blasted, ((unit, time, newTime, result) -> {
unit.damagePierce(18f); unit.damagePierce(18f);
result.set(freezing, time); result.set(freezing, time);
})); }));
@@ -67,7 +67,7 @@ public class StatusEffects implements ContentList{
effectChance = 0.09f; effectChance = 0.09f;
init(() -> { init(() -> {
trans(shocked, ((unit, time, newTime, result) -> { affinity(shocked, ((unit, time, newTime, result) -> {
unit.damagePierce(14f); unit.damagePierce(14f);
if(unit.team == state.rules.waveTeam){ if(unit.team == state.rules.waveTeam){
Events.fire(Trigger.shock); Events.fire(Trigger.shock);
@@ -94,7 +94,7 @@ public class StatusEffects implements ContentList{
init(() -> { init(() -> {
opposite(wet, freezing); opposite(wet, freezing);
trans(tarred, ((unit, time, newTime, result) -> { affinity(tarred, ((unit, time, newTime, result) -> {
unit.damagePierce(8f); unit.damagePierce(8f);
Fx.burning.at(unit.x + Mathf.range(unit.bounds() / 2f), unit.y + Mathf.range(unit.bounds() / 2f)); 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)); result.set(melting, Math.min(time + newTime, 200f));
@@ -123,8 +123,8 @@ public class StatusEffects implements ContentList{
effect = Fx.oily; effect = Fx.oily;
init(() -> { init(() -> {
trans(melting, ((unit, time, newTime, result) -> result.set(melting, newTime + time))); affinity(melting, ((unit, time, newTime, result) -> result.set(melting, newTime + time)));
trans(burning, ((unit, time, newTime, result) -> result.set(burning, newTime + time))); affinity(burning, ((unit, time, newTime, result) -> result.set(burning, newTime + time)));
}); });
}}; }};

View File

@@ -278,6 +278,10 @@ public class ContentLoader{
return getByID(ContentType.bullet, id); return getByID(ContentType.bullet, id);
} }
public Seq<StatusEffect> statusEffects(){
return getBy(ContentType.status);
}
public Seq<SectorPreset> sectors(){ public Seq<SectorPreset> sectors(){
return getBy(ContentType.sector); return getBy(ContentType.sector);
} }

View File

@@ -1,6 +1,7 @@
package mindustry.type; package mindustry.type;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
@@ -9,8 +10,10 @@ import mindustry.ctype.*;
import mindustry.entities.*; import mindustry.entities.*;
import mindustry.entities.units.*; import mindustry.entities.units.*;
import mindustry.gen.*; 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. */ /** Damage dealt by the unit with the effect. */
public float damageMultiplier = 1f; public float damageMultiplier = 1f;
/** Unit health multiplier. */ /** Unit health multiplier. */
@@ -40,6 +43,9 @@ public class StatusEffect extends MappableContent{
/** Called on init. */ /** Called on init. */
protected Runnable initblock = () -> {}; protected Runnable initblock = () -> {};
public ObjectSet<StatusEffect> affinities = new ObjectSet<>();
public ObjectSet<StatusEffect> opposites = new ObjectSet<>();
public StatusEffect(String name){ public StatusEffect(String name){
super(name); super(name);
} }
@@ -53,6 +59,46 @@ public class StatusEffect extends MappableContent{
this.initblock = run; 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. */ /** Runs every tick on the affected unit while time is greater than 0. */
public void update(Unit unit, float time){ public void update(Unit unit, float time){
if(damage > 0){ if(damage > 0){
@@ -72,8 +118,16 @@ public class StatusEffect extends MappableContent{
effect.transitions.put(this, handler); 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){ protected void opposite(StatusEffect... effect){
opposites.addAll(effect);
for(StatusEffect sup : effect){ for(StatusEffect sup : effect){
sup.opposites.add(this);
trans(sup, (unit, time, newTime, result) -> { trans(sup, (unit, time, newTime, result) -> {
time -= newTime * 0.5f; time -= newTime * 0.5f;
if(time > 0){ if(time > 0){
@@ -108,6 +162,11 @@ public class StatusEffect extends MappableContent{
return result.set(to, newTime); return result.set(to, newTime);
} }
@Override
public String toString(){
return localizedName;
}
@Override @Override
public ContentType getContentType(){ public ContentType getContentType(){
return ContentType.status; return ContentType.status;

View File

@@ -34,6 +34,12 @@ public enum Stat{
canBoost, canBoost,
maxUnits, maxUnits,
damageMultiplier,
healthMultiplier,
speedMultiplier,
reloadMultiplier,
buildSpeedMultiplier,
itemCapacity(StatCat.items), itemCapacity(StatCat.items),
itemsMoved(StatCat.items), itemsMoved(StatCat.items),
launchTime(StatCat.items), launchTime(StatCat.items),
@@ -78,7 +84,8 @@ public enum Stat{
booster(StatCat.optional), booster(StatCat.optional),
boostEffect(StatCat.optional), boostEffect(StatCat.optional),
affinities(StatCat.optional); affinities(StatCat.optional),
opposites(StatCat.optional);
public final StatCat category; public final StatCat category;