mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-10 04:40:10 +07:00
Fix point defense weapons ignore damage multiplier (#8922)
This commit is contained in:
parent
7999eb4c4d
commit
a7e8dd126e
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user