@@ -4210,7 +4210,7 @@ else if ((atype != null)
4210
4210
4211
4211
// Aerospace target modifiers
4212
4212
if (te != null && te .isAero () && te .isAirborne ()) {
4213
- IAero a = (IAero ) te ;
4213
+ final IAero a = (IAero ) te ;
4214
4214
4215
4215
// is the target at zero velocity
4216
4216
if ((a .getCurrentVelocity () == 0 ) && !(a .isSpheroid () && !game .getBoard ().inSpace ())) {
@@ -4234,19 +4234,24 @@ else if ((atype != null)
4234
4234
// Target hidden in the sensor shadow of a larger spacecraft
4235
4235
if (game .getOptions ().booleanOption (OptionsConstants .ADVAERORULES_STRATOPS_SENSOR_SHADOW )
4236
4236
&& game .getBoard ().inSpace ()) {
4237
- for (Entity en : Compute .getAdjacentEntitiesAlongAttack (ae .getPosition (), target .getPosition (), game )) {
4238
- if (!en .isEnemyOf (te ) && en .isLargeCraft ()
4239
- && ((en .getWeight () - te .getWeight ()) >= -STRATOPS_SENSOR_SHADOW_WEIGHT_DIFF )) {
4240
- toHit .addModifier (+1 , Messages .getString ("WeaponAttackAction.SensorShadow" ));
4241
- break ;
4242
- }
4243
- }
4244
- for (Entity en : game .getEntitiesVector (target .getPosition ())) {
4245
- if (!en .isEnemyOf (te ) && en .isLargeCraft () && !en .equals ((Entity ) a )
4246
- && ((en .getWeight () - te .getWeight ()) >= -STRATOPS_SENSOR_SHADOW_WEIGHT_DIFF )) {
4247
- toHit .addModifier (+1 , Messages .getString ("WeaponAttackAction.SensorShadow" ));
4248
- break ;
4249
- }
4237
+ if (Compute .getAdjacentEntitiesAlongAttack (ae .getPosition (), target .getPosition (), game ).stream ()
4238
+ .anyMatch (en ->
4239
+ !en .isEnemyOf (a )
4240
+ && en .isLargeCraft ()
4241
+ && en .getWeight () - a .getWeight () >= -STRATOPS_SENSOR_SHADOW_WEIGHT_DIFF
4242
+ )
4243
+ ) {
4244
+ toHit .addModifier (+1 , Messages .getString ("WeaponAttackAction.SensorShadow" ));
4245
+ }
4246
+ if (game .getEntitiesVector (target .getPosition ()).stream ()
4247
+ .anyMatch (en ->
4248
+ !en .isEnemyOf (a )
4249
+ && en .isLargeCraft ()
4250
+ && !en .equals (a )
4251
+ && en .getWeight () - a .getWeight () >= -STRATOPS_SENSOR_SHADOW_WEIGHT_DIFF
4252
+ )
4253
+ ) {
4254
+ toHit .addModifier (+1 , Messages .getString ("WeaponAttackAction.SensorShadow" ));
4250
4255
}
4251
4256
}
4252
4257
}
0 commit comments