Fix point defense weapons ignore damage multiplier (#8922)

This commit is contained in:
南门阳德 2023-08-12 23:40:25 +08:00 committed by GitHub
parent 7999eb4c4d
commit a7e8dd126e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -9,6 +9,8 @@ import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.type.*;
import static mindustry.Vars.*;
/**
* Note that this requires several things:
* - A bullet with positive maxRange
@ -49,8 +51,10 @@ public class PointDefenseWeapon extends Weapon{
protected void shoot(Unit unit, WeaponMount mount, float shootX, float shootY, float rotation){
if(!(mount.target instanceof Bullet target)) return;
if(target.damage() > bullet.damage){
target.damage(target.damage() - bullet.damage);
// not sure whether it should multiply by the damageMultiplier of the unit
float bulletDamage = bullet.damage * unit.damageMultiplier() * state.rules.unitDamage(unit.team);
if(target.damage() > bulletDamage){
target.damage(target.damage() - bulletDamage);
}else{
target.remove();
}

View File

@ -14,6 +14,8 @@ import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
public class PointDefenseTurret extends ReloadTurret{
public final int timerTarget = timers++;
public float retargetTime = 5f;
@ -80,8 +82,9 @@ public class PointDefenseTurret extends ReloadTurret{
//shoot when possible
if(Angles.within(rotation, dest, shootCone) && reloadCounter >= reload){
if(target.damage() > bulletDamage){
target.damage(target.damage() - bulletDamage);
float realDamage = bulletDamage * state.rules.blockDamage(team);
if(target.damage() > realDamage){
target.damage(target.damage() - realDamage);
}else{
target.remove();
}