ShieldDamageMultiplier for bullets (#6331)

* ShieldDamageMultiplier + Dynamic damage multipliers

* Add to stats

* That's not right

* merge typo

---------

Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
MEEPofFaith
2025-02-06 13:57:17 -08:00
committed by GitHub
parent 5f1271e659
commit ed42bcb4f6
6 changed files with 18 additions and 4 deletions

View File

@@ -41,8 +41,7 @@ public class ForceFieldAbility extends Ability{
if(trait.team != paramUnit.team && trait.type.absorbable && Intersector.isInRegularPolygon(paramField.sides, paramUnit.x, paramUnit.y, realRad, paramField.rotation, trait.x(), trait.y()) && paramUnit.shield > 0){
trait.absorb();
Fx.absorb.at(trait);
paramUnit.shield -= trait.damage();
paramUnit.shield -= trait.type().shieldDamage(trait);
paramField.alpha = 1f;
}
};

View File

@@ -84,6 +84,8 @@ public class BulletType extends Content implements Cloneable{
public float reloadMultiplier = 1f;
/** Multiplier of how much base damage is done to tiles. */
public float buildingDamageMultiplier = 1f;
/** Multiplier of how much base damage is done to force shields. */
public float shieldDamageMultiplier = 1f;
/** Recoil from shooter entities. */
public float recoil;
/** Whether to kill the shooter when this is shot. For suicide bombers. */
@@ -569,6 +571,14 @@ public class BulletType extends Content implements Cloneable{
}
}
public float buildingDamage(Bullet b){
return b.damage() * buildingDamageMultiplier;
}
public float shieldDamage(Bullet b){
return b.damage() * shieldDamageMultiplier;
}
public void draw(Bullet b){
drawTrail(b);
drawParts(b);

View File

@@ -1645,7 +1645,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
public boolean collision(Bullet other){
boolean wasDead = health <= 0;
float damage = other.damage() * other.type().buildingDamageMultiplier;
float damage = other.type.buildingDamage(other);
if(!other.type.pierceArmor){
damage = Damage.applyArmor(damage, block.armor);
}

View File

@@ -55,7 +55,7 @@ public class ForceProjector extends Block{
bullet.absorb();
paramEffect.at(bullet);
paramEntity.hit = 1f;
paramEntity.buildup += bullet.damage;
paramEntity.buildup += bullet.type.shieldDamage(bullet);
}
};

View File

@@ -644,6 +644,10 @@ public class StatValues{
sep(bt, Core.bundle.format("bullet.range", ammoStat(type.rangeChange / tilesize)));
}
if(type.shieldDamageMultiplier != 1){
sep(bt, Core.bundle.format("bullet.shielddamage", (int)(type.shieldDamageMultiplier * 100)));
}
if(type.splashDamage > 0){
sep(bt, Core.bundle.format("bullet.splashdamage", (int)type.splashDamage, Strings.fixed(type.splashDamageRadius / tilesize, 1)));
}