Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2024-01-28 15:50:10 -05:00
2 changed files with 16 additions and 6 deletions

View File

@@ -387,14 +387,14 @@ public class BulletType extends Content implements Cloneable{
if(entity instanceof Healthc h){ if(entity instanceof Healthc h){
float damage = b.damage; float damage = b.damage;
float shield = entity instanceof Shieldc s ? Math.max(s.shield(), 0f) : 0f;
if(maxDamageFraction > 0){ if(maxDamageFraction > 0){
float cap = h.maxHealth() * maxDamageFraction; float cap = h.maxHealth() * maxDamageFraction + shield;
if(entity instanceof Shieldc s){
cap += Math.max(s.shield(), 0f);
}
damage = Math.min(damage, cap); damage = Math.min(damage, cap);
//cap health to effective health for handlePierce to handle it properly //cap health to effective health for handlePierce to handle it properly
health = Math.min(health, cap); health = Math.min(health, cap);
}else{
health += shield;
} }
if(pierceArmor){ if(pierceArmor){
h.damagePierce(damage); h.damagePierce(damage);

View File

@@ -85,7 +85,9 @@ public abstract class DrawPart{
/** Weapon heat, 1 when just fired, 0, when it has cooled down (duration depends on weapon) */ /** Weapon heat, 1 when just fired, 0, when it has cooled down (duration depends on weapon) */
heat = p -> p.heat, heat = p -> p.heat,
/** Lifetime fraction, 0 to 1. Only for missiles. */ /** Lifetime fraction, 0 to 1. Only for missiles. */
life = p -> p.life; life = p -> p.life,
/** Current unscaled value of Time.time. */
time = p -> Time.time;
float get(PartParams p); float get(PartParams p);
@@ -168,6 +170,14 @@ public abstract class DrawPart{
return p -> get(p) + Mathf.absin(scl, mag); return p -> get(p) + Mathf.absin(scl, mag);
} }
default PartProgress mod(float amount){
return p -> Mathf.mod(get(p), amount);
}
default PartProgress loop(float time){
return p -> Mathf.mod(get(p)/time, 1);
}
default PartProgress apply(PartProgress other, PartFunc func){ default PartProgress apply(PartProgress other, PartFunc func){
return p -> func.get(get(p), other.get(p)); return p -> func.get(get(p), other.get(p));
} }