Skip to content

Commit

Permalink
Don't apply FTL cluster hit bonus when affected by ECM.
Browse files Browse the repository at this point in the history
  • Loading branch information
neoancient committed Aug 22, 2023
1 parent 514d947 commit ddadba0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ public LRMFollowTheLeaderHandler(ToHitData t, WeaponAttackAction w,
nSalvoBonus = 1;
}

@Override
public int getSalvoBonus() {
if (ComputeECM.isAffectedByECM(ae, ae.getPosition(), target.getPosition())) {
return 0;
} else {
return nSalvoBonus;
}
}

/*
* (non-Javadoc)
*
Expand Down
8 changes: 6 additions & 2 deletions megamek/src/megamek/common/weapons/WeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ public class WeaponHandler implements AttackHandler, Serializable {

protected boolean amsEngaged = false;
protected boolean apdsEngaged = false;


public int getSalvoBonus() {
return nSalvoBonus;
}

/**
* Returns the heat generated by a large craft's weapons fire declarations during the round
* Used to determine whether point defenses can engage.
Expand Down Expand Up @@ -2022,7 +2026,7 @@ public void restore() {
}

protected int getClusterModifiers(boolean clusterRangePenalty) {
int nMissilesModifier = nSalvoBonus;
int nMissilesModifier = getSalvoBonus();

int[] ranges = wtype.getRanges(weapon);
if (clusterRangePenalty && game.getOptions().booleanOption(OptionsConstants.ADVCOMBAT_TACOPS_CLUSTERHITPEN)) {
Expand Down

0 comments on commit ddadba0

Please sign in to comment.