@@ -456,24 +456,19 @@ private static ToHitData toHitCalc(Game game, int attackerId, Targetable target,
456
456
&& (munition .contains (AmmoType .Munitions .M_FOLLOW_THE_LEADER )
457
457
&& !ComputeECM .isAffectedByECM (ae , ae .getPosition (), target .getPosition ()));
458
458
459
- Mounted mLinker = weapon . getLinkedBy () ;
459
+ Mounted mLinker ;
460
460
461
- boolean bApollo = ((mLinker != null ) && (mLinker .getType () instanceof MiscType ) && !mLinker .isDestroyed ()
462
- && !mLinker .isMissing () && !mLinker .isBreached () && mLinker .getType ().hasFlag (MiscType .F_APOLLO ))
463
- && (atype != null ) && (atype .getAmmoType () == AmmoType .T_MRM );
461
+ boolean bApollo ;
464
462
465
- boolean bArtemisV = ((mLinker != null ) && (mLinker .getType () instanceof MiscType ) && !mLinker .isDestroyed ()
466
- && !mLinker .isMissing () && !mLinker .isBreached () && mLinker .getType ().hasFlag (MiscType .F_ARTEMIS_V )
467
- && !isECMAffected && !bMekTankStealthActive && (atype != null )
468
- && (munition .contains (AmmoType .Munitions .M_ARTEMIS_V_CAPABLE )));
463
+ boolean bArtemisV ;
469
464
470
465
if (ae .usesWeaponBays ()) {
471
- for ( WeaponMounted bayW : weapon . getBayWeapons ()) {
466
+ ( ae . usesWeaponBays () ? weapon . streamBayWeapons () : Stream . of ( weapon )). forEach ( bayW ->
472
467
Mounted <?> bayWAmmo = bayW .getLinked ();
473
468
474
469
if (bayWAmmo == null ) {
475
470
//At present, all weapons below using mLinker use ammo, so this won't be a problem
476
- continue ;
471
+ return ;
477
472
}
478
473
AmmoType bAmmo = (AmmoType ) bayWAmmo .getType ();
479
474
@@ -496,7 +491,7 @@ private static ToHitData toHitCalc(Game game, int attackerId, Targetable target,
496
491
&& !mLinker .isMissing () && !mLinker .isBreached () && mLinker .getType ().hasFlag (MiscType .F_ARTEMIS_V )
497
492
&& !isECMAffected && !bMekTankStealthActive && (atype != null )
498
493
&& (bAmmo != null ) && (bAmmo .getMunitionType ().contains (AmmoType .Munitions .M_ARTEMIS_V_CAPABLE )));
499
- }
494
+ )
500
495
}
501
496
502
497
boolean inSameBuilding = Compute .isInSameBuilding (game , ae , te );
0 commit comments