diff --git a/core/src/mindustry/entities/abilities/RegenAbility.java b/core/src/mindustry/entities/abilities/RegenAbility.java new file mode 100644 index 0000000000..65f4a54e65 --- /dev/null +++ b/core/src/mindustry/entities/abilities/RegenAbility.java @@ -0,0 +1,16 @@ +package mindustry.entities.abilities; + +import arc.util.*; +import mindustry.gen.*; + +public class RegenAbility extends Ability{ + /** Amount healed as percent per tick. */ + public float percentAmount = 0f; + /** Amount healed as a flat amount per tick. */ + public float amount = 0f; + + @Override + public void update(Unit unit){ + unit.heal((unit.maxHealth * percentAmount / 100f + amount) * Time.delta); + } +} diff --git a/core/src/mindustry/type/NeoplasmUnitType.java b/core/src/mindustry/type/NeoplasmUnitType.java index c403b49047..dd43246ae4 100644 --- a/core/src/mindustry/type/NeoplasmUnitType.java +++ b/core/src/mindustry/type/NeoplasmUnitType.java @@ -1,6 +1,7 @@ package mindustry.type; import mindustry.content.*; +import mindustry.entities.abilities.*; import mindustry.graphics.*; /** This is just a preset. Contains no new behavior. */ @@ -12,6 +13,14 @@ public class NeoplasmUnitType extends UnitType{ outlineColor = Pal.neoplasmOutline; immunities.addAll(StatusEffects.burning, StatusEffects.melting); + abilities.add(new RegenAbility(){{ + //fully regen in 30 seconds + percentAmount = 1f / (30f * 60f) * 100f; + }}); + + //green flashing is unnecessary since they always regen + showHeal = false; + //TODO //- liquid regen ability //- liquid/neoplasm explode ability diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 4031332720..540d1236eb 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -76,6 +76,8 @@ public class UnitType extends UnlockableContent{ /** If true, this unit cannot drown, and will not be affected by the floor under it. */ public boolean hovering = false; public boolean omniMovement = true; + public boolean showHeal = true; + public Color healColor = Pal.heal; public Effect fallEffect = Fx.fallSmoke; public Effect fallThrusterEffect = Fx.fallSmoke; public Effect deathExplosionEffect = Fx.dynamicExplosion; @@ -985,7 +987,9 @@ public class UnitType extends UnlockableContent{ public void applyColor(Unit unit){ Draw.color(); - Tmp.c1.set(Color.white).lerp(Pal.heal, Mathf.clamp(unit.healTime - unit.hitTime)); + if(showHeal){ + Tmp.c1.set(Color.white).lerp(healColor, Mathf.clamp(unit.healTime - unit.hitTime)); + } Draw.mixcol(Tmp.c1, Math.max(unit.hitTime, Mathf.clamp(unit.healTime))); if(unit.drownTime > 0 && unit.lastDrownFloor != null){ diff --git a/gradle.properties b/gradle.properties index ddfe321771..207d12d1ab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,4 +11,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works http.socketTimeout=80000 http.connectionTimeout=80000 -archash=3400de3323150ba91c94fc07a6d4ca1958f4d943 +archash=e4ec2880dfdd5739ec75b5904d97ed3309c225d8