Neoplasm regen ability
This commit is contained in:
16
core/src/mindustry/entities/abilities/RegenAbility.java
Normal file
16
core/src/mindustry/entities/abilities/RegenAbility.java
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user