Shield health should also be factored in pierce factor when maxDamageFraction is 0 (#9486)

This commit is contained in:
MEEPofFaith
2024-01-27 18:24:48 -08:00
committed by GitHub
parent 8aa7e8b930
commit 1b14a09f1c

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