Neoplasm regen ability

This commit is contained in:
Anuken
2021-09-23 17:34:19 -04:00
parent 01f06cd0f7
commit de7dfc75f9
4 changed files with 31 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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

View File

@ -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){

View File

@ -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