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

@@ -1142,6 +1142,7 @@ bullet.interval = [stat]{0}/sec[lightgray] interval bullets:
bullet.frags = [stat]{0}x[lightgray] frag bullets: bullet.frags = [stat]{0}x[lightgray] frag bullets:
bullet.lightning = [stat]{0}x[lightgray] lightning ~ [stat]{1}[lightgray] damage bullet.lightning = [stat]{0}x[lightgray] lightning ~ [stat]{1}[lightgray] damage
bullet.buildingdamage = [stat]{0}%[lightgray] building damage bullet.buildingdamage = [stat]{0}%[lightgray] building damage
bullet.shielddamage = [stat]{0}%[lightgray] shield damage
bullet.knockback = [stat]{0}[lightgray] knockback bullet.knockback = [stat]{0}[lightgray] knockback
bullet.pierce = [stat]{0}x[lightgray] pierce bullet.pierce = [stat]{0}x[lightgray] pierce
bullet.infinitepierce = [stat]pierce bullet.infinitepierce = [stat]pierce

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){ 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(); trait.absorb();
Fx.absorb.at(trait); Fx.absorb.at(trait);
paramUnit.shield -= trait.type().shieldDamage(trait);
paramUnit.shield -= trait.damage();
paramField.alpha = 1f; paramField.alpha = 1f;
} }
}; };

View File

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

View File

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

View File

@@ -55,7 +55,7 @@ public class ForceProjector extends Block{
bullet.absorb(); bullet.absorb();
paramEffect.at(bullet); paramEffect.at(bullet);
paramEntity.hit = 1f; 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))); 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){ if(type.splashDamage > 0){
sep(bt, Core.bundle.format("bullet.splashdamage", (int)type.splashDamage, Strings.fixed(type.splashDamageRadius / tilesize, 1))); sep(bt, Core.bundle.format("bullet.splashdamage", (int)type.splashDamage, Strings.fixed(type.splashDamageRadius / tilesize, 1)));
} }