@@ -456,24 +456,19 @@ private static ToHitData toHitCalc(Game game, int attackerId, Targetable target,
456456 && (munition .contains (AmmoType .Munitions .M_FOLLOW_THE_LEADER )
457457 && !ComputeECM .isAffectedByECM (ae , ae .getPosition (), target .getPosition ()));
458458
459- Mounted mLinker = weapon . getLinkedBy () ;
459+ Mounted mLinker ;
460460
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 ;
464462
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 ;
469464
470465 if (ae .usesWeaponBays ()) {
471- for ( WeaponMounted bayW : weapon . getBayWeapons ()) {
466+ ( ae . usesWeaponBays () ? weapon . streamBayWeapons () : Stream . of ( weapon )). forEach ( bayW ->
472467 Mounted <?> bayWAmmo = bayW .getLinked ();
473468
474469 if (bayWAmmo == null ) {
475470 //At present, all weapons below using mLinker use ammo, so this won't be a problem
476- continue ;
471+ return ;
477472 }
478473 AmmoType bAmmo = (AmmoType ) bayWAmmo .getType ();
479474
@@ -496,7 +491,7 @@ private static ToHitData toHitCalc(Game game, int attackerId, Targetable target,
496491 && !mLinker .isMissing () && !mLinker .isBreached () && mLinker .getType ().hasFlag (MiscType .F_ARTEMIS_V )
497492 && !isECMAffected && !bMekTankStealthActive && (atype != null )
498493 && (bAmmo != null ) && (bAmmo .getMunitionType ().contains (AmmoType .Munitions .M_ARTEMIS_V_CAPABLE )));
499- }
494+ )
500495 }
501496
502497 boolean inSameBuilding = Compute .isInSameBuilding (game , ae , te );
0 commit comments