Skip to content

Commit

Permalink
Fix for MegaMek#4796: NPE in Princess off-board artillery targeting
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleet01 committed Sep 20, 2023
1 parent d9667e4 commit f508935
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,14 @@ public void initializeForTargetingPhase() {
private boolean getADAAvailable(Entity shooter){
boolean available = false;
for (Mounted weapon: shooter.getWeaponList()){
if(((AmmoType) weapon.getLinked().getType()).getMunitionType().contains(AmmoType.Munitions.M_ADA)
&& !weapon.isFired() && weapon.getLinked().getUsableShotsLeft() > 0){
available = true;
break;
if (weapon.getType().hasFlag(WeaponType.F_ARTILLERY)){
if(((AmmoType) weapon.getLinked().getType()).getMunitionType().contains(AmmoType.Munitions.M_ADA)
&& !weapon.isFired() && weapon.getLinked().getUsableShotsLeft() > 0) {
available = true;
break;
}
}
}

return available;
}
/**
Expand Down

0 comments on commit f508935

Please sign in to comment.