Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShieldDamageMultiplier for bullets #6331

Merged
merged 5 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,7 @@ bullet.interval = [stat]{0}/sec[lightgray] interval bullets:
bullet.frags = [stat]{0}x[lightgray] frag bullets:
bullet.lightning = [stat]{0}x[lightgray] lightning ~ [stat]{1}[lightgray] damage
bullet.buildingdamage = [stat]{0}%[lightgray] building damage
bullet.shielddamage = [stat]{0}%[lightgray] shield damage
bullet.knockback = [stat]{0}[lightgray] knockback
bullet.pierce = [stat]{0}x[lightgray] pierce
bullet.infinitepierce = [stat]pierce
Expand Down
3 changes: 1 addition & 2 deletions core/src/mindustry/entities/abilities/ForceFieldAbility.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
Expand Down
10 changes: 10 additions & 0 deletions core/src/mindustry/entities/bullet/BulletType.java
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -569,6 +571,14 @@ public void removed(Bullet b){
}
}

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);
Expand Down
2 changes: 1 addition & 1 deletion core/src/mindustry/entities/comp/BuildingComp.java
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ public boolean collide(Bullet other){
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
4 changes: 4 additions & 0 deletions core/src/mindustry/world/meta/StatValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,10 @@ public static <T extends UnlockableContent> StatValue ammo(ObjectMap<T, BulletTy
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)));
}
Expand Down