This commit is contained in:
Anuken
2025-04-04 13:18:15 -04:00
parent bd0436bbff
commit c2de9170dd
2 changed files with 8 additions and 2 deletions

View File

@@ -161,6 +161,8 @@ public class BulletType extends Content implements Cloneable{
public float healPercent = 0f; public float healPercent = 0f;
/** flat amount of block health healed */ /** flat amount of block health healed */
public float healAmount = 0f; public float healAmount = 0f;
/** Fraction of bullet damage that heals that shooter. */
public float lifesteal = 0f;
/** Whether to make fire on impact */ /** Whether to make fire on impact */
public boolean makeFire = false; public boolean makeFire = false;
/** Whether this bullet will always hit blocks under it. */ /** Whether this bullet will always hit blocks under it. */
@@ -450,6 +452,10 @@ public class BulletType extends Content implements Cloneable{
}else{ }else{
health += shield; health += shield;
} }
if(lifesteal > 0f && b.owner instanceof Healthc o){
float result = Math.max(Math.min(h.health(), damage), 0);
o.heal(result * lifesteal);
}
if(pierceArmor){ if(pierceArmor){
h.damagePierce(damage); h.damagePierce(damage);
}else{ }else{

View File

@@ -35,7 +35,7 @@ public class LAssembler{
Seq<LStatement> st = read(data, privileged); Seq<LStatement> st = read(data, privileged);
asm.privileged = privileged; asm.privileged = privileged;
asm.instructions = st.map(l -> l.build(asm)).retainAll(l -> l != null).toArray(LInstruction.class); asm.instructions = st.map(l -> l.build(asm)).retainAll(l -> l != null).toArray(LInstruction.class);
return asm; return asm;
} }
@@ -74,7 +74,7 @@ public class LAssembler{
symbol = symbol.replace(' ', '_'); symbol = symbol.replace(' ', '_');
//use a positive invalid number if number might be negative, else use a negative invalid number //use a positive invalid number if number might be negative, else use a negative invalid number
int usedInvalidNum = symbol.startsWith("-") ? invalidNumPositive : invalidNumNegative; int usedInvalidNum = symbol.length() > 0 && symbol.charAt(0) == '-' ? invalidNumPositive : invalidNumNegative;
double value = parseDouble(symbol, usedInvalidNum); double value = parseDouble(symbol, usedInvalidNum);
if(value == usedInvalidNum){ if(value == usedInvalidNum){