Skip to content

Commit

Permalink
Remove extraneous calls, add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleet01 committed Sep 18, 2023
1 parent 44348b6 commit 7b896e1
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions megamek/src/megamek/common/actions/WeaponAttackAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3075,12 +3075,7 @@ private static ToHitData compileWeaponToHitMods(Game game, Entity ae, Entity spo
}

// VSP Lasers

// Quirks and SPAs now handled in toHit
processAttackerQuirks(toHit, ae, target, weapon);

// SPAs
processAttackerSPAs(toHit, ae, target, weapon, game);

return toHit;
}
Expand Down Expand Up @@ -3495,9 +3490,6 @@ private static ToHitData compileAttackerToHitMods(Game game, Entity ae, Targetab
}
}

// Quirks
processAttackerQuirks(toHit, ae, target, weapon);

return toHit;
}

Expand Down Expand Up @@ -3938,19 +3930,14 @@ private static ToHitData compileCrewToHitMods(Game game, Entity ae, Entity te, T
}
}

// Attacker SPAs
processAttackerSPAs(toHit, ae, te, weapon, game);

// Target SPAs
processDefenderSPAs(toHit, ae, te, weapon, game);

return toHit;
}

/**
* Convenience method that compiles the ToHit modifiers applicable to the defender's condition and actions
* -4 for shooting at an immobile target? You'll find that here.
* Attacker strafing? Using a weapon with a TH penalty? Those are in other methods.
* For simplicity's sake, Quirks and SPAs now get applied here for general cases (elsewhere for Artillery or ADA)
*
* @param game The current {@link Game}
* @param ae The Entity making this attack
Expand Down Expand Up @@ -4872,6 +4859,7 @@ private static ToHitData artilleryDirectToHit(Game game, Entity ae, Targetable t
int distance = Compute.effectiveDistance(game, ae, target);
toHit = new ToHitData(ae.getCrew().getGunnery(), Messages.getString("WeaponAttackAction.GunSkill"));

/// Re-apply quirks and SPAs after wiping out toHit
// Quirks
processAttackerQuirks(toHit, ae, te, weapon);

Expand Down

0 comments on commit 7b896e1

Please sign in to comment.