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;
|
package mindustry.type;
|
||||||
|
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
|
import mindustry.entities.abilities.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
|
||||||
/** This is just a preset. Contains no new behavior. */
|
/** This is just a preset. Contains no new behavior. */
|
||||||
@@ -12,6 +13,14 @@ public class NeoplasmUnitType extends UnitType{
|
|||||||
outlineColor = Pal.neoplasmOutline;
|
outlineColor = Pal.neoplasmOutline;
|
||||||
immunities.addAll(StatusEffects.burning, StatusEffects.melting);
|
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
|
//TODO
|
||||||
//- liquid regen ability
|
//- liquid regen ability
|
||||||
//- liquid/neoplasm explode 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. */
|
/** If true, this unit cannot drown, and will not be affected by the floor under it. */
|
||||||
public boolean hovering = false;
|
public boolean hovering = false;
|
||||||
public boolean omniMovement = true;
|
public boolean omniMovement = true;
|
||||||
|
public boolean showHeal = true;
|
||||||
|
public Color healColor = Pal.heal;
|
||||||
public Effect fallEffect = Fx.fallSmoke;
|
public Effect fallEffect = Fx.fallSmoke;
|
||||||
public Effect fallThrusterEffect = Fx.fallSmoke;
|
public Effect fallThrusterEffect = Fx.fallSmoke;
|
||||||
public Effect deathExplosionEffect = Fx.dynamicExplosion;
|
public Effect deathExplosionEffect = Fx.dynamicExplosion;
|
||||||
@@ -985,7 +987,9 @@ public class UnitType extends UnlockableContent{
|
|||||||
|
|
||||||
public void applyColor(Unit unit){
|
public void applyColor(Unit unit){
|
||||||
Draw.color();
|
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)));
|
Draw.mixcol(Tmp.c1, Math.max(unit.hitTime, Mathf.clamp(unit.healTime)));
|
||||||
|
|
||||||
if(unit.drownTime > 0 && unit.lastDrownFloor != null){
|
if(unit.drownTime > 0 && unit.lastDrownFloor != null){
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ android.useAndroidX=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
http.socketTimeout=80000
|
http.socketTimeout=80000
|
||||||
http.connectionTimeout=80000
|
http.connectionTimeout=80000
|
||||||
archash=3400de3323150ba91c94fc07a6d4ca1958f4d943
|
archash=e4ec2880dfdd5739ec75b5904d97ed3309c225d8
|
||||||
|
|||||||
Reference in New Issue
Block a user