Shield absorption support for flame/point laser bullets

This commit is contained in:
Anuken
2026-09-21 19:32:52 -04:00
parent 8396d5c9fa
commit 0011a1503a
3 changed files with 15 additions and 2 deletions

View File

@@ -298,7 +298,7 @@ public class Damage{
* If the shields only absorb part of the damage, the bullet's damage is reduced accordingly.
* @return the length of the laser, cut short if a shield absorbed it.
*/
private static float findShieldLength(Bullet b, float length, boolean laser, boolean absorb){
public static float findShieldLength(Bullet b, float length, boolean laser, boolean absorb){
float damage = b.type.shieldDamage(b);
if(!(laser || b.type.shieldAbsorb) || length <= 0f || damage <= 0f) return length;

View File

@@ -50,7 +50,7 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
hitColor = colors[1].cpy().a(1f);
lightColor = hitColor;
lightOpacity = 0.7f;
laserAbsorb = false;
laserAbsorb = true;
ammoMultiplier = 1f;
pierceArmor = true;
}

View File

@@ -79,6 +79,14 @@ public class PointLaserBulletType extends BulletType{
updateTrailEffects(b);
updateBulletInterval(b);
float dst = b.dst(b.aimX, b.aimY);
float length = Damage.findShieldLength(b, dst, true, laserAbsorb);
if(length < dst){
Tmp.v1.set(b.aimX - b.x, b.aimY - b.y).setLength(length);
b.aimX = Tmp.v1.x + b.x;
b.aimY = Tmp.v1.y + b.y;
}
if(b.timer.get(0, damageInterval)){
Damage.collidePoint(b, b.team, hitEffect, b.aimX, b.aimY);
}
@@ -92,6 +100,11 @@ public class PointLaserBulletType extends BulletType{
}
}
@Override
public float shieldDamage(Bullet b){
return b.damage / damageInterval * Time.delta;
}
@Override
public void updateTrailEffects(Bullet b){
if(trailChance > 0){