From 5c377de2652c199e1e048bf672e4ad7326989558 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 21 Sep 2024 13:49:58 +0200 Subject: [PATCH] comment and some code cleanup --- .../common/weapons/ACCaselessHandler.java | 41 +++++------- .../common/weapons/ACIncendiaryHandler.java | 30 +++++---- .../common/weapons/ACTracerHandler.java | 36 +++++----- .../common/weapons/ACWeaponHandler.java | 41 ++++++------ .../weapons/ADAMissileWeaponHandler.java | 38 +++++------ .../weapons/ASEWMissileWeaponHandler.java | 39 +++++------ .../megamek/common/weapons/ATMHandler.java | 65 ++++++------------- .../common/weapons/AdvancedSRMHandler.java | 45 ++++++------- .../common/weapons/AltitudeBombAttack.java | 15 ++--- .../common/weapons/AmmoWeaponHandler.java | 49 +++++++------- .../weapons/ArtilleryCannonWeaponHandler.java | 7 -- .../ArtilleryWeaponIndirectFireHandler.java | 7 -- .../common/weapons/HVACWeaponHandler.java | 23 +------ .../common/weapons/LRMAntiTSMHandler.java | 38 +++++------ .../common/weapons/LRMDeadFireHandler.java | 51 ++++++--------- .../weapons/LRMFollowTheLeaderHandler.java | 54 ++++++--------- .../common/weapons/LRMFragHandler.java | 40 ++++++------ .../megamek/common/weapons/LRMHandler.java | 45 +++++-------- .../common/weapons/LRMScatterableHandler.java | 61 +++++++---------- .../weapons/LRMSmokeWarheadHandler.java | 17 +---- .../common/weapons/LRMSwarmHandler.java | 60 ++++++----------- .../common/weapons/LRMSwarmIHandler.java | 38 ++++++----- .../common/weapons/MekTaserHandler.java | 41 +++++------- .../common/weapons/MissileWeaponHandler.java | 39 ++++++----- .../weapons/PrimitiveACWeaponHandler.java | 34 +++++----- .../weapons/PrototypeACWeaponHandler.java | 6 +- .../weapons/PrototypeStreakHandler.java | 5 +- .../weapons/RapidfireACWeaponHandler.java | 39 +++++------ .../megamek/common/weapons/SRMAXHandler.java | 5 +- .../common/weapons/SRMAntiTSMHandler.java | 44 ++++++------- .../common/weapons/SRMDeadFireHandler.java | 7 +- .../common/weapons/SRMFragHandler.java | 37 ++++++----- .../megamek/common/weapons/SRMHandler.java | 9 ++- .../common/weapons/SRMInfernoHandler.java | 41 +++++------- .../weapons/SRMSmokeWarheadHandler.java | 37 +++++------ .../weapons/SRMTandemChargeHandler.java | 43 +++++------- .../common/weapons/UltraWeaponHandler.java | 31 ++------- .../common/weapons/VGLWeaponHandler.java | 36 +++++----- .../common/weapons/autocannons/ACWeapon.java | 51 +++++++-------- .../weapons/autocannons/HVACWeapon.java | 40 ++++++------ .../weapons/battlearmor/BATaserHandler.java | 41 +++++------- 41 files changed, 600 insertions(+), 826 deletions(-) diff --git a/megamek/src/megamek/common/weapons/ACCaselessHandler.java b/megamek/src/megamek/common/weapons/ACCaselessHandler.java index db4314f7ac..c552a8e449 100644 --- a/megamek/src/megamek/common/weapons/ACCaselessHandler.java +++ b/megamek/src/megamek/common/weapons/ACCaselessHandler.java @@ -1,22 +1,25 @@ -/** +/* * MegaMek - Copyright (C) 2004 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ -/* - * Created on Oct 15, 2017 + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.*; @@ -26,19 +29,11 @@ /** * @author Dave Nawton */ - - public class ACCaselessHandler extends ACWeaponHandler { - + @Serial private static final long serialVersionUID = -6614562346449113878L; - /** - * @param t - * @param w - * @param g - */ - public ACCaselessHandler (ToHitData t, WeaponAttackAction w, - Game g, TWGameManager m) { + public ACCaselessHandler (ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } @@ -47,7 +42,7 @@ protected boolean doChecks(Vector vPhaseReport) { if (doAmmoFeedProblemCheck(vPhaseReport)) { return true; } - + if ((roll.getIntValue() <= 2) && !(ae instanceof Infantry)) { Roll diceRoll = Compute.rollD6(2); diff --git a/megamek/src/megamek/common/weapons/ACIncendiaryHandler.java b/megamek/src/megamek/common/weapons/ACIncendiaryHandler.java index cb95d152ee..29ba247ad9 100644 --- a/megamek/src/megamek/common/weapons/ACIncendiaryHandler.java +++ b/megamek/src/megamek/common/weapons/ACIncendiaryHandler.java @@ -1,15 +1,21 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -18,18 +24,16 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Sebastian Brocks * @since Sep 5, 2004 */ public class ACIncendiaryHandler extends ACWeaponHandler { + @Serial private static final long serialVersionUID = 3301631731286472616L; - /** - * @param t - * @param w - * @param g - */ public ACIncendiaryHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); damageType = DamageType.INCENDIARY; diff --git a/megamek/src/megamek/common/weapons/ACTracerHandler.java b/megamek/src/megamek/common/weapons/ACTracerHandler.java index 19f25938a5..1db05eb34c 100644 --- a/megamek/src/megamek/common/weapons/ACTracerHandler.java +++ b/megamek/src/megamek/common/weapons/ACTracerHandler.java @@ -1,15 +1,21 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -18,27 +24,19 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Sebastian Brocks */ public class ACTracerHandler extends ACWeaponHandler { + @Serial private static final long serialVersionUID = 7326881584091651519L; - /** - * @param t - * @param w - * @param g - * @param m - */ public ACTracerHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcDamagePerHit() - */ @Override protected int calcDamagePerHit() { return super.calcDamagePerHit() - 1; diff --git a/megamek/src/megamek/common/weapons/ACWeaponHandler.java b/megamek/src/megamek/common/weapons/ACWeaponHandler.java index 8bfc096ab0..4c5a59f1c7 100644 --- a/megamek/src/megamek/common/weapons/ACWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/ACWeaponHandler.java @@ -1,15 +1,21 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -18,32 +24,23 @@ import megamek.common.options.OptionsConstants; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Jason Tighe */ public class ACWeaponHandler extends AmmoWeaponHandler { + @Serial private static final long serialVersionUID = 7326881584091651519L; - /** - * @param t - * @param w - * @param g - * @param m - */ public ACWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcDamagePerHit() - */ @Override protected int calcDamagePerHit() { double toReturn = wtype.getDamage(); - // during a swarm, all damage gets applied as one block to one - // location + // during a swarm, all damage gets applied as one block to one location if ((ae instanceof BattleArmor) && (weapon.getLocation() == BattleArmor.LOC_SQUAD) && !(weapon.isSquadSupportWeapon()) @@ -69,7 +66,7 @@ protected int calcDamagePerHit() { if (game.getOptions().booleanOption(OptionsConstants.ADVCOMBAT_TACOPS_LOS_RANGE) && (nRange > wtype.getRanges(weapon)[RangeType.RANGE_EXTREME])) { toReturn = (int) Math.floor(toReturn * .5); - } + } return (int) toReturn; } diff --git a/megamek/src/megamek/common/weapons/ADAMissileWeaponHandler.java b/megamek/src/megamek/common/weapons/ADAMissileWeaponHandler.java index 9c6c0c7c4b..779652f18a 100644 --- a/megamek/src/megamek/common/weapons/ADAMissileWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/ADAMissileWeaponHandler.java @@ -1,15 +1,21 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -17,6 +23,7 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; import java.util.Vector; /** @@ -29,24 +36,13 @@ * AE damage and without rolling on the cluster table. */ public class ADAMissileWeaponHandler extends MissileWeaponHandler { + @Serial private static final long serialVersionUID = 6329291710822071023L; - /** - * @param t - * @param w - * @param g - * @param m - */ - public ADAMissileWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, - TWGameManager m) { + public ADAMissileWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcDamagePerHit() - */ @Override protected int calcDamagePerHit() { return 20; diff --git a/megamek/src/megamek/common/weapons/ASEWMissileWeaponHandler.java b/megamek/src/megamek/common/weapons/ASEWMissileWeaponHandler.java index 5e09db13c3..2d41c2a703 100644 --- a/megamek/src/megamek/common/weapons/ASEWMissileWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/ASEWMissileWeaponHandler.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org) - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * * This file is part of MegaMek. * @@ -23,12 +23,14 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; import java.util.Vector; /** * @author MKerensky */ public class ASEWMissileWeaponHandler extends ThunderBoltWeaponHandler { + @Serial private static final long serialVersionUID = 6359291710822171023L; /** @@ -42,14 +44,7 @@ public class ASEWMissileWeaponHandler extends ThunderBoltWeaponHandler { public ASEWMissileWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } - - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.WeaponHandler#handleEntityDamage(megamek.common - * .Entity, java.util.Vector, megamek.common.Building, int, int, int, int) - */ + @Override protected void handleEntityDamage(Entity entityTarget, Vector vPhaseReport, Building bldg, int hits, int nCluster, @@ -88,24 +83,22 @@ protected void handleEntityDamage(Entity entityTarget, r = new Report(3470); r.subject = subjectId; r.addDesc(entityTarget); - vPhaseReport.add(r); + vPhaseReport.add(r); } - //Large craft suffer a to-hit penalty for the location struck. - if (entityTarget instanceof Dropship) { - Dropship d = (Dropship) entityTarget; + //Large craft suffer a to-hit penalty for the location struck. + if (entityTarget instanceof Dropship d) { int loc = hit.getLocation(); d.setASEWAffected(loc, 2); //Report the arc affected by the attack and the duration of the effects r = new Report(3472); r.subject = subjectId; r.add(entityTarget.getLocationAbbr(hit)); - vPhaseReport.add(r); - } else if (entityTarget instanceof Jumpship) { - Jumpship j = (Jumpship) entityTarget; + vPhaseReport.add(r); + } else if (entityTarget instanceof Jumpship j) { int loc = hit.getLocation(); j.setASEWAffected(loc, 2); //If a Warship is hit in the fore or aft side, the broadside arc is also affected - if ((j instanceof Warship) + if ((j instanceof Warship) && (loc == Jumpship.LOC_FLS || loc == Jumpship.LOC_ALS)) { j.setASEWAffected(Warship.LOC_LBS, 2); //Report the arc hit by the attack and the associated broadside and the duration of the effects @@ -114,7 +107,7 @@ protected void handleEntityDamage(Entity entityTarget, r.add(entityTarget.getLocationAbbr(hit)); r.add("LBS"); vPhaseReport.add(r); - } else if ((j instanceof Warship) + } else if ((j instanceof Warship) && (loc == Jumpship.LOC_FRS || loc == Jumpship.LOC_ARS)) { j.setASEWAffected(Warship.LOC_RBS, 2); //Report the arc hit by the attack and the associated broadside and the duration of the effects @@ -139,7 +132,7 @@ protected void handleEntityDamage(Entity entityTarget, vPhaseReport.add(r); } } - + /** * Calculate the attack value based on range * @@ -148,8 +141,6 @@ protected void handleEntityDamage(Entity entityTarget, @Override protected int calcAttackValue() { calcCounterAV(); - int av = 0; - return av; + return 0; } - -} \ No newline at end of file +} diff --git a/megamek/src/megamek/common/weapons/ATMHandler.java b/megamek/src/megamek/common/weapons/ATMHandler.java index 9eae4df0ec..374e0cf612 100644 --- a/megamek/src/megamek/common/weapons/ATMHandler.java +++ b/megamek/src/megamek/common/weapons/ATMHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.ArrayList; import java.util.Enumeration; import java.util.Vector; @@ -43,23 +50,13 @@ * @author Sebastian Brocks */ public class ATMHandler extends MissileWeaponHandler { + @Serial private static final long serialVersionUID = -2536312899803153911L; - /** - * @param t - * @param w - * @param g - * @param m - */ public ATMHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcDamagePerHit() - */ @Override protected int calcDamagePerHit() { double toReturn; @@ -85,21 +82,6 @@ protected int calcDamagePerHit() { return (int) toReturn; } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcnCluster() - */ - @Override - protected int calcnCluster() { - return 5; - } - - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcHits(java.util.Vector) - */ @Override protected int calcHits(Vector vPhaseReport) { // conventional infantry gets hit in one lump @@ -129,7 +111,7 @@ protected int calcHits(Vector vPhaseReport) { @Override protected int calcAttackValue() { int av = 0; - int counterAV = 0; + int counterAV; int range = RangeType.rangeBracket(nRange, wtype.getATRanges(), true, false); AmmoType atype = (AmmoType) ammo.getType(); if (atype.getMunitionType().contains(AmmoType.Munitions.M_HIGH_EXPLOSIVE)) { @@ -163,11 +145,6 @@ protected int calcAttackValue() { return av; } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcHits(java.util.Vector) - */ protected int calcStandardAndExtendedAmmoHits(Vector vPhaseReport) { // conventional infantry gets hit in one lump // BAs do one lump of damage per BA suit @@ -206,12 +183,9 @@ protected int calcStandardAndExtendedAmmoHits(Vector vPhaseReport) { atype.getMunitionType().contains(AmmoType.Munitions.M_HIGH_EXPLOSIVE)); // is any hex in the flight path of the missile ECM affected? - boolean bECMAffected = false; + boolean bECMAffected = ComputeECM.isAffectedByECM(ae, ae.getPosition(), target.getPosition()); // if the attacker is affected by ECM or the target is protected by ECM // then act as if affected. - if (ComputeECM.isAffectedByECM(ae, ae.getPosition(), target.getPosition())) { - bECMAffected = true; - } if (((mLinker != null) && (mLinker.getType() instanceof MiscType) && !mLinker.isDestroyed() && !mLinker.isMissing() @@ -332,8 +306,7 @@ protected int calcStandardAndExtendedAmmoHits(Vector vPhaseReport) { } @Override - protected boolean specialResolution(Vector vPhaseReport, - Entity entityTarget) { + protected boolean specialResolution(Vector vPhaseReport, Entity entityTarget) { if (!bMissed && (target.getTargetType() == Targetable.TYPE_MINEFIELD_CLEAR)) { Report r = new Report(3255); diff --git a/megamek/src/megamek/common/weapons/AdvancedSRMHandler.java b/megamek/src/megamek/common/weapons/AdvancedSRMHandler.java index e7fa34f429..5d46401ccb 100644 --- a/megamek/src/megamek/common/weapons/AdvancedSRMHandler.java +++ b/megamek/src/megamek/common/weapons/AdvancedSRMHandler.java @@ -1,15 +1,21 @@ -/** +/* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * + * This file is part of MegaMek. + * + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -18,26 +24,17 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Sebastian Brocks */ public class AdvancedSRMHandler extends SRMHandler { - - /** - * - */ + @Serial private static final long serialVersionUID = -1688593262282782251L; - /** - * @param t - * @param w - * @param g - * @param m - */ - public AdvancedSRMHandler(ToHitData t, WeaponAttackAction w, Game g, - TWGameManager m) { + public AdvancedSRMHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); nSalvoBonus = 1; } - } diff --git a/megamek/src/megamek/common/weapons/AltitudeBombAttack.java b/megamek/src/megamek/common/weapons/AltitudeBombAttack.java index f7103969c8..9d619e271a 100644 --- a/megamek/src/megamek/common/weapons/AltitudeBombAttack.java +++ b/megamek/src/megamek/common/weapons/AltitudeBombAttack.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org) - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * * This file is part of MegaMek. * @@ -26,10 +26,13 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Jay Lawson */ public class AltitudeBombAttack extends Weapon { + @Serial private static final long serialVersionUID = 1837670588683382376L; public AltitudeBombAttack() { @@ -53,16 +56,8 @@ public AltitudeBombAttack() { capital = true; } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.Weapon#getCorrectHandler(megamek.common.ToHitData, - * megamek.common.actions.WeaponAttackAction, megamek.common.Game) - */ @Override - protected AttackHandler getCorrectHandler(ToHitData toHit, - WeaponAttackAction waa, Game game, TWGameManager manager) { + protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, Game game, TWGameManager manager) { return new BombAttackHandler(toHit, waa, game, manager); } } diff --git a/megamek/src/megamek/common/weapons/AmmoWeaponHandler.java b/megamek/src/megamek/common/weapons/AmmoWeaponHandler.java index eeebc23ae3..fb936f097c 100644 --- a/megamek/src/megamek/common/weapons/AmmoWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/AmmoWeaponHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2004, 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.Compute; @@ -31,18 +38,15 @@ /** * @author Andrew Hunter - * @since Sep 24, 2004 */ public class AmmoWeaponHandler extends WeaponHandler { + @Serial + private static final long serialVersionUID = -4934490646657484486L; + private static final MMLogger logger = MMLogger.create(AmmoWeaponHandler.class); - private static final long serialVersionUID = -4934490646657484486L; Mounted ammo; - protected AmmoWeaponHandler() { - // deserialization only - } - public AmmoWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); generalDamageType = HitData.DAMAGE_BALLISTIC; @@ -79,11 +83,9 @@ protected void checkAmmo() { } /** - * For ammo weapons, this number can be less than the full number if the - * amount of ammo is not high enough + * For ammo weapons, this number can be less than the full number if the amount of ammo is not high enough. * - * @return the number of weapons of this type firing (for squadron weapon - * groups) + * @return the number of weapons of this type firing (for squadron weapon groups) */ @Override protected int getNumberWeapons() { @@ -92,10 +94,7 @@ protected int getNumberWeapons() { return weapon.getNWeapons(); } int totalShots = ae.getTotalAmmoOfType(ammo.getType()); - return Math.min( - weapon.getNWeapons(), - (int) Math.floor((double) totalShots - / (double) weapon.getCurrentShots())); + return Math.min(weapon.getNWeapons(), (int) Math.floor((double) totalShots / (double) weapon.getCurrentShots())); } @Override @@ -104,8 +103,7 @@ protected boolean doChecks(Vector vPhaseReport) { } /** - * Carry out an 'ammo feed problems' check on the weapon. Return true if it blew - * up. + * Carry out an 'ammo feed problems' check on the weapon. Return true if it blew up. */ @Override protected boolean doAmmoFeedProblemCheck(Vector vPhaseReport) { @@ -170,8 +168,7 @@ protected void explodeRoundInBarrel(Vector vPhaseReport) { } } - // if we're here, the weapon is going to explode whether it's flagged as - // explosive or not + // if we're here, the weapon is going to explode whether it's flagged as explosive or not vPhaseReport.addAll(gameManager.explodeEquipment(ae, wloc, weapon, true)); } } diff --git a/megamek/src/megamek/common/weapons/ArtilleryCannonWeaponHandler.java b/megamek/src/megamek/common/weapons/ArtilleryCannonWeaponHandler.java index 12c0322162..f020e3811d 100644 --- a/megamek/src/megamek/common/weapons/ArtilleryCannonWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/ArtilleryCannonWeaponHandler.java @@ -31,13 +31,6 @@ public class ArtilleryCannonWeaponHandler extends AmmoWeaponHandler { private static final long serialVersionUID = 1L; boolean handledAmmoAndReport = false; - /** - * This constructor can only be used for deserialization. - */ - protected ArtilleryCannonWeaponHandler() { - super(); - } - public ArtilleryCannonWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } diff --git a/megamek/src/megamek/common/weapons/ArtilleryWeaponIndirectFireHandler.java b/megamek/src/megamek/common/weapons/ArtilleryWeaponIndirectFireHandler.java index c5229dc608..e8e2c29d5f 100644 --- a/megamek/src/megamek/common/weapons/ArtilleryWeaponIndirectFireHandler.java +++ b/megamek/src/megamek/common/weapons/ArtilleryWeaponIndirectFireHandler.java @@ -39,13 +39,6 @@ public class ArtilleryWeaponIndirectFireHandler extends AmmoWeaponHandler { boolean handledAmmoAndReport = false; private int shootingBA = -1; - /** - * This constructor can only be used for deserialization. - */ - protected ArtilleryWeaponIndirectFireHandler() { - super(); - } - public ArtilleryWeaponIndirectFireHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); if (w.getEntity(g) instanceof BattleArmor) { diff --git a/megamek/src/megamek/common/weapons/HVACWeaponHandler.java b/megamek/src/megamek/common/weapons/HVACWeaponHandler.java index 45383ce3c4..a4f5c4a72f 100644 --- a/megamek/src/megamek/common/weapons/HVACWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/HVACWeaponHandler.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org) - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * * This file is part of MegaMek. * @@ -19,6 +19,7 @@ */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.*; @@ -33,25 +34,13 @@ * @author Jason Tighe */ public class HVACWeaponHandler extends ACWeaponHandler { + @Serial private static final long serialVersionUID = 7326881584091651519L; - /** - * @param t - * @param w - * @param g - * @param m - */ public HVACWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.WeaponHandler#handle(megamek.common.Game.Phase, - * java.util.Vector) - */ @Override public boolean handle(GamePhase phase, Vector vPhaseReport) { PlanetaryConditions conditions = game.getPlanetaryConditions(); @@ -80,11 +69,6 @@ public boolean handle(GamePhase phase, Vector vPhaseReport) { return super.handle(phase, vPhaseReport); } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#doChecks(java.util.Vector) - */ @Override protected boolean doChecks(Vector vPhaseReport) { if (doAmmoFeedProblemCheck(vPhaseReport)) { @@ -117,5 +101,4 @@ protected boolean doChecks(Vector vPhaseReport) { return super.doChecks(vPhaseReport); } } - } diff --git a/megamek/src/megamek/common/weapons/LRMAntiTSMHandler.java b/megamek/src/megamek/common/weapons/LRMAntiTSMHandler.java index ee7a09f95f..927bfe6c53 100644 --- a/megamek/src/megamek/common/weapons/LRMAntiTSMHandler.java +++ b/megamek/src/megamek/common/weapons/LRMAntiTSMHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.*; @@ -24,26 +31,15 @@ * @author Sebastian Brocks */ public class LRMAntiTSMHandler extends LRMSmokeWarheadHandler { + @Serial private static final long serialVersionUID = 5702089152489814687L; - /** - * @param t - * @param w - * @param g - * @param m - */ - public LRMAntiTSMHandler(ToHitData t, WeaponAttackAction w, Game g, - TWGameManager m) { + public LRMAntiTSMHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); sSalvoType = " anti-TSM missile(s) "; damageType = DamageType.ANTI_TSM; } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcHits(java.util.Vector) - */ @Override protected int calcHits(Vector vPhaseReport) { // conventional infantry gets hit in one lump diff --git a/megamek/src/megamek/common/weapons/LRMDeadFireHandler.java b/megamek/src/megamek/common/weapons/LRMDeadFireHandler.java index 5c54f589ec..310a35fa80 100644 --- a/megamek/src/megamek/common/weapons/LRMDeadFireHandler.java +++ b/megamek/src/megamek/common/weapons/LRMDeadFireHandler.java @@ -1,15 +1,21 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * + * This file is part of MegaMek. + * + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -19,31 +25,21 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; import java.util.Vector; /** * @author Jason Tighe */ public class LRMDeadFireHandler extends LRMHandler { + @Serial private static final long serialVersionUID = 9200751420492807777L; - /** - * @param t - * @param w - * @param g - * @param m - */ - public LRMDeadFireHandler(ToHitData t, WeaponAttackAction w, Game g, - TWGameManager m) { + public LRMDeadFireHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); sSalvoType = " dead fire missile(s) "; } - - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcHits(java.util.Vector) - */ + @Override protected int calcHits(Vector vPhaseReport) { // Per IntOps p. 132, dead-fire missiles do 2 damage per missile, but still in 5 point clusters @@ -59,12 +55,7 @@ protected int calcHits(Vector vPhaseReport) { protected int getClusterModifiers(boolean clusterRangePenalty) { return super.getClusterModifiers(clusterRangePenalty) - 3; } - - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcDamagePerHit() - */ + @Override protected int calcDamagePerHit() { return 2; diff --git a/megamek/src/megamek/common/weapons/LRMFollowTheLeaderHandler.java b/megamek/src/megamek/common/weapons/LRMFollowTheLeaderHandler.java index 5c0830ae0d..26a4aaca46 100644 --- a/megamek/src/megamek/common/weapons/LRMFollowTheLeaderHandler.java +++ b/megamek/src/megamek/common/weapons/LRMFollowTheLeaderHandler.java @@ -1,15 +1,21 @@ -/** +/* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * + * This file is part of MegaMek. + * + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -19,24 +25,16 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Jason Tighe */ public class LRMFollowTheLeaderHandler extends LRMHandler { - - /** - * - */ + @Serial private static final long serialVersionUID = 1740643533757582922L; - /** - * @param t - * @param w - * @param g - * @param m - */ - public LRMFollowTheLeaderHandler(ToHitData t, WeaponAttackAction w, - Game g, TWGameManager m) { + public LRMFollowTheLeaderHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); sSalvoType = " FTL missile(s) "; nSalvoBonus = 1; @@ -51,11 +49,6 @@ public int getSalvoBonus() { } } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcnCluster() - */ @Override protected int calcnCluster() { if (ComputeECM.isAffectedByECM(ae, ae.getPosition(), target.getPosition())) { @@ -65,11 +58,6 @@ protected int calcnCluster() { } } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcDamagePerHit() - */ @Override protected int calcDamagePerHit() { return 1; diff --git a/megamek/src/megamek/common/weapons/LRMFragHandler.java b/megamek/src/megamek/common/weapons/LRMFragHandler.java index f5f819d971..e0d8876b96 100644 --- a/megamek/src/megamek/common/weapons/LRMFragHandler.java +++ b/megamek/src/megamek/common/weapons/LRMFragHandler.java @@ -1,16 +1,21 @@ /* - * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org). - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -18,20 +23,16 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; import java.util.Vector; /** * @author Sebastian Brocks */ public class LRMFragHandler extends LRMHandler { + @Serial private static final long serialVersionUID = 2308151080895016663L; - /** - * @param t - * @param w - * @param g - * @param m - */ public LRMFragHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); sSalvoType = " fragmentation missile(s) "; @@ -40,7 +41,7 @@ public LRMFragHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m /** * Calculate the damage per hit. - * + * * @return an int representing the damage dealt per hit. */ @Override @@ -108,8 +109,5 @@ protected void handleClearDamage(Vector vPhaseReport, } @Override - protected void handleBuildingDamage(Vector vPhaseReport, Building bldg, int nDamage, - Coords coords) { - - } + protected void handleBuildingDamage(Vector vPhaseReport, Building bldg, int nDamage, Coords coords) { } } diff --git a/megamek/src/megamek/common/weapons/LRMHandler.java b/megamek/src/megamek/common/weapons/LRMHandler.java index 8d43e79532..43b2ac615a 100644 --- a/megamek/src/megamek/common/weapons/LRMHandler.java +++ b/megamek/src/megamek/common/weapons/LRMHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2007 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.ArrayList; import java.util.Enumeration; import java.util.Vector; @@ -41,31 +48,18 @@ * @author Sebastian Brocks */ public class LRMHandler extends MissileWeaponHandler { + @Serial private static final long serialVersionUID = -9160255801810263821L; - /** - * @param t - * @param w - * @param g - * @param m - */ public LRMHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { this(t, w, g, m, 0); } - public LRMHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m, - int salvoMod) { + public LRMHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m, int salvoMod) { super(t, w, g, m); nSalvoBonus = salvoMod; } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.WeaponHandler#specialResolution(java.util.Vector, - * megamek.common.Entity, boolean) - */ @Override protected boolean specialResolution(Vector vPhaseReport, Entity entityTarget) { @@ -97,11 +91,6 @@ protected boolean specialResolution(Vector vPhaseReport, return false; } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcHits(java.util.Vector) - */ @Override protected int calcHits(Vector vPhaseReport) { // conventional infantry gets hit in one lump diff --git a/megamek/src/megamek/common/weapons/LRMScatterableHandler.java b/megamek/src/megamek/common/weapons/LRMScatterableHandler.java index 8ef80a3e20..cd8fc114e0 100644 --- a/megamek/src/megamek/common/weapons/LRMScatterableHandler.java +++ b/megamek/src/megamek/common/weapons/LRMScatterableHandler.java @@ -1,18 +1,25 @@ -/** +/* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * + * This file is part of MegaMek. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.EnumSet; import java.util.Vector; @@ -30,30 +37,13 @@ * @author Sebastian Brocks */ public class LRMScatterableHandler extends MissileWeaponHandler { - - /** - * - */ + @Serial private static final long serialVersionUID = -3661776853552779877L; - /** - * @param t - * @param w - * @param g - * @param m - */ - public LRMScatterableHandler(ToHitData t, WeaponAttackAction w, Game g, - TWGameManager m) { + public LRMScatterableHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.WeaponHandler#specialResolution(java.util.Vector, - * megamek.common.Entity, boolean) - */ @Override protected boolean specialResolution(Vector vPhaseReport, Entity entityTarget) { @@ -116,20 +106,15 @@ protected boolean specialResolution(Vector vPhaseReport, // Handle the thunder munitions. if (atype.getMunitionType().contains(AmmoType.Munitions.M_THUNDER_AUGMENTED)) { - gameManager.deliverThunderAugMinefield(coords, ae.getOwner().getId(), - density, ae.getId()); + gameManager.deliverThunderAugMinefield(coords, ae.getOwner().getId(), density, ae.getId()); } else if (atype.getMunitionType().contains(AmmoType.Munitions.M_THUNDER)) { - gameManager.deliverThunderMinefield(coords, ae.getOwner().getId(), - density, ae.getId()); + gameManager.deliverThunderMinefield(coords, ae.getOwner().getId(), density, ae.getId()); } else if (atype.getMunitionType().contains(AmmoType.Munitions.M_THUNDER_INFERNO)) { - gameManager.deliverThunderInfernoMinefield(coords, ae.getOwner().getId(), - density, ae.getId()); + gameManager.deliverThunderInfernoMinefield(coords, ae.getOwner().getId(), density, ae.getId()); } else if (atype.getMunitionType().contains(AmmoType.Munitions.M_THUNDER_VIBRABOMB)) { - gameManager.deliverThunderVibraMinefield(coords, ae.getOwner().getId(), - density, waa.getOtherAttackInfo(), ae.getId()); + gameManager.deliverThunderVibraMinefield(coords, ae.getOwner().getId(), density, waa.getOtherAttackInfo(), ae.getId()); } else if (atype.getMunitionType().contains(AmmoType.Munitions.M_THUNDER_ACTIVE)) { - gameManager.deliverThunderActiveMinefield(coords, ae.getOwner().getId(), - density, ae.getId()); + gameManager.deliverThunderActiveMinefield(coords, ae.getOwner().getId(), density, ae.getId()); } return true; } diff --git a/megamek/src/megamek/common/weapons/LRMSmokeWarheadHandler.java b/megamek/src/megamek/common/weapons/LRMSmokeWarheadHandler.java index 27ddc7fe6d..bbae3a0fde 100644 --- a/megamek/src/megamek/common/weapons/LRMSmokeWarheadHandler.java +++ b/megamek/src/megamek/common/weapons/LRMSmokeWarheadHandler.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org) - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * * This file is part of MegaMek. * @@ -24,31 +24,20 @@ import megamek.server.totalwarfare.TWGameManager; import megamek.server.SmokeCloud; +import java.io.Serial; import java.util.Vector; /** * @author FogHat */ public class LRMSmokeWarheadHandler extends LRMHandler { + @Serial private static final long serialVersionUID = -30934685350251837L; - /** - * @param t - * @param w - * @param g - * @param m - */ public LRMSmokeWarheadHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.WeaponHandler#specialResolution(java.util.Vector, - * megamek.common.Entity, boolean) - */ @Override protected boolean specialResolution(Vector vPhaseReport, Entity entityTarget) { Coords coords = target.getPosition(); diff --git a/megamek/src/megamek/common/weapons/LRMSwarmHandler.java b/megamek/src/megamek/common/weapons/LRMSwarmHandler.java index 2728a294e7..4f88de95f5 100644 --- a/megamek/src/megamek/common/weapons/LRMSwarmHandler.java +++ b/megamek/src/megamek/common/weapons/LRMSwarmHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.BattleArmor; @@ -37,26 +44,17 @@ * @author Sebastian Brocks */ public class LRMSwarmHandler extends LRMHandler { + @Serial private static final long serialVersionUID = 7962873403915683220L; + private int swarmMissilesNowLeft = 0; private boolean handledHeat = false; - /** - * @param t - * @param w - * @param g - * @param m - */ public LRMSwarmHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); sSalvoType = " swarm missile(s) "; } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.AttackHandler#handle(int, java.util.Vector) - */ @Override public boolean handle(GamePhase phase, Vector vPhaseReport) { if (!cares(phase)) { @@ -317,17 +315,11 @@ public boolean handle(GamePhase phase, Vector vPhaseReport) { return false; } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcDamagePerHit() - * - * This needs to override the superclass method because in case of swarm - * the damage to adjacent infantry should be based on the missiles left over, - * not the total rack size. - */ @Override protected int calcDamagePerHit() { + // This needs to override the superclass method because in case of swarm + // the damage to adjacent infantry should be based on the missiles left over, + // not the total rack size. if (target.isConventionalInfantry()) { int missiles = waa.isSwarmingMissiles() ? waa.getSwarmMissiles() : wtype.getRackSize(); @@ -343,13 +335,6 @@ protected int calcDamagePerHit() { return 1; } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.WeaponHandler#handleSpecialMiss(megamek.common - * .Entity, boolean, megamek.common.Building, java.util.Vector) - */ protected boolean handleSpecialMiss(Entity entityTarget, boolean bldgDamagedOnMiss, Building bldg, Vector vPhaseReport, GamePhase phase) { @@ -416,11 +401,6 @@ protected boolean handleSpecialMiss(Entity entityTarget, return false; } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcHits(java.util.Vector) - */ @Override protected int calcHits(Vector vPhaseReport) { // conventional infantry gets hit in one lump diff --git a/megamek/src/megamek/common/weapons/LRMSwarmIHandler.java b/megamek/src/megamek/common/weapons/LRMSwarmIHandler.java index 6f96a6ce4e..b4059fac4c 100644 --- a/megamek/src/megamek/common/weapons/LRMSwarmIHandler.java +++ b/megamek/src/megamek/common/weapons/LRMSwarmIHandler.java @@ -1,15 +1,21 @@ -/** +/* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * + * This file is part of MegaMek. + * + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -18,19 +24,15 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Sebastian Brocks */ public class LRMSwarmIHandler extends LRMSwarmHandler { - + @Serial private static final long serialVersionUID = 6522069260223528740L; - /** - * @param t - * @param w - * @param g - * @param m - */ public LRMSwarmIHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); sSalvoType = " swarm-i missile(s) "; diff --git a/megamek/src/megamek/common/weapons/MekTaserHandler.java b/megamek/src/megamek/common/weapons/MekTaserHandler.java index 7084cf434f..3a61ae84d9 100644 --- a/megamek/src/megamek/common/weapons/MekTaserHandler.java +++ b/megamek/src/megamek/common/weapons/MekTaserHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2004, 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.*; @@ -20,30 +27,14 @@ import megamek.server.totalwarfare.TWGameManager; public class MekTaserHandler extends AmmoWeaponHandler { - + @Serial private static final long serialVersionUID = 1308895663099714573L; - protected MekTaserHandler() { - // deserialization only - } - - /** - * @param t - * @param w - * @param g - */ public MekTaserHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); generalDamageType = HitData.DAMAGE_ENERGY; } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.WeaponHandler#specialResolution(java.util.Vector, - * megamek.common.Entity, boolean) - */ @Override protected boolean specialResolution(Vector vPhaseReport, Entity entityTarget) { boolean done = false; diff --git a/megamek/src/megamek/common/weapons/MissileWeaponHandler.java b/megamek/src/megamek/common/weapons/MissileWeaponHandler.java index f55a1ae73b..70919c43fc 100644 --- a/megamek/src/megamek/common/weapons/MissileWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/MissileWeaponHandler.java @@ -1,19 +1,25 @@ /* - * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org). - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Enumeration; import java.util.List; import java.util.Vector; @@ -30,10 +36,11 @@ * @author Sebastian Brocks */ public class MissileWeaponHandler extends AmmoWeaponHandler { + @Serial private static final long serialVersionUID = -4801130911083653548L; - boolean advancedAMS = false; - boolean advancedPD = false; - boolean multiAMS = false; + boolean advancedAMS; + boolean advancedPD; + boolean multiAMS; public MissileWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); @@ -356,8 +363,7 @@ protected int calcAttackValue() { } /** - * Sets the appropriate AMS Bay reporting flag depending on what type of missile - * this is + * Sets the appropriate AMS Bay reporting flag depending on what type of missile this is */ @Override protected void setAMSBayReportingFlag() { @@ -365,8 +371,7 @@ protected void setAMSBayReportingFlag() { } /** - * Sets the appropriate PD Bay reporting flag depending on what type of missile - * this is + * Sets the appropriate PD Bay reporting flag depending on what type of missile this is */ @Override protected void setPDBayReportingFlag() { diff --git a/megamek/src/megamek/common/weapons/PrimitiveACWeaponHandler.java b/megamek/src/megamek/common/weapons/PrimitiveACWeaponHandler.java index 1a27128453..e636c1ea31 100644 --- a/megamek/src/megamek/common/weapons/PrimitiveACWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/PrimitiveACWeaponHandler.java @@ -1,19 +1,25 @@ /* - * MegaMek - - * Copyright (C) 2000-2007 Ben Mazur (bmazur@sev.org) + * MegaMek - Copyright (C) 2000-2007 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.Game; @@ -26,13 +32,9 @@ * Deric "Netzilla" Page (deric dot page at usa dot net) */ public class PrimitiveACWeaponHandler extends ACWeaponHandler { + @Serial private static final long serialVersionUID = -3686194077871525280L; - /** - * @param t - * @param w - * @param g - */ public PrimitiveACWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } @@ -42,7 +44,7 @@ protected boolean doChecks(Vector vPhaseReport) { if (doAmmoFeedProblemCheck(vPhaseReport)) { return true; } - + if (roll.getIntValue() == 2) { Report r = new Report(3161); r.subject = subjectId; diff --git a/megamek/src/megamek/common/weapons/PrototypeACWeaponHandler.java b/megamek/src/megamek/common/weapons/PrototypeACWeaponHandler.java index 1ad1058684..d44bdba0f7 100644 --- a/megamek/src/megamek/common/weapons/PrototypeACWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/PrototypeACWeaponHandler.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org) - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * * This file is part of MegaMek. * @@ -19,6 +19,7 @@ */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.Game; @@ -31,6 +32,7 @@ * @author Sebastian Brocks */ public class PrototypeACWeaponHandler extends ACWeaponHandler { + @Serial private static final long serialVersionUID = 1562727719699124106L; public PrototypeACWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { @@ -42,7 +44,7 @@ protected boolean doChecks(Vector vPhaseReport) { if (doAmmoFeedProblemCheck(vPhaseReport)) { return true; } - + if (roll.getIntValue() == 2) { Report r = new Report(3165); r.subject = subjectId; diff --git a/megamek/src/megamek/common/weapons/PrototypeStreakHandler.java b/megamek/src/megamek/common/weapons/PrototypeStreakHandler.java index 6f5b31ba21..8f9e77028e 100644 --- a/megamek/src/megamek/common/weapons/PrototypeStreakHandler.java +++ b/megamek/src/megamek/common/weapons/PrototypeStreakHandler.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org) - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * * This file is part of MegaMek. * @@ -24,10 +24,13 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Sebastian Brocks */ public class PrototypeStreakHandler extends SRMHandler { + @Serial private static final long serialVersionUID = -6640810158443025266L; public PrototypeStreakHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { diff --git a/megamek/src/megamek/common/weapons/RapidfireACWeaponHandler.java b/megamek/src/megamek/common/weapons/RapidfireACWeaponHandler.java index 00684ffbd7..e1380830fc 100644 --- a/megamek/src/megamek/common/weapons/RapidfireACWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/RapidfireACWeaponHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2004 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.Game; @@ -25,31 +32,21 @@ /** * @author Andrew Hunter - * @since Sept 29, 2004 */ public class RapidfireACWeaponHandler extends UltraWeaponHandler { + @Serial private static final long serialVersionUID = -1770392652874842106L; - /** - * @param t - * @param w - * @param g - */ public RapidfireACWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.UltraWeaponHandler#doChecks(java.util.Vector) - */ @Override protected boolean doChecks(Vector vPhaseReport) { if (doAmmoFeedProblemCheck(vPhaseReport)) { return true; } - + int jamLevel = 4; boolean kindRapidFire = game.getOptions().booleanOption(OptionsConstants.ADVCOMBAT_KIND_RAPID_AC); if (kindRapidFire) { @@ -68,7 +65,7 @@ protected boolean doChecks(Vector vPhaseReport) { r.choose(false); r.indent(); vPhaseReport.addElement(r); - + explodeRoundInBarrel(vPhaseReport); } return false; diff --git a/megamek/src/megamek/common/weapons/SRMAXHandler.java b/megamek/src/megamek/common/weapons/SRMAXHandler.java index 65cf3c018b..e047b52aee 100644 --- a/megamek/src/megamek/common/weapons/SRMAXHandler.java +++ b/megamek/src/megamek/common/weapons/SRMAXHandler.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org) - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * * This file is part of MegaMek. * @@ -24,10 +24,13 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Sebastian Brocks */ public class SRMAXHandler extends SRMHandler { + @Serial private static final long serialVersionUID = 8049199984294733124L; public SRMAXHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { diff --git a/megamek/src/megamek/common/weapons/SRMAntiTSMHandler.java b/megamek/src/megamek/common/weapons/SRMAntiTSMHandler.java index 94d87084d3..b1d4811e56 100644 --- a/megamek/src/megamek/common/weapons/SRMAntiTSMHandler.java +++ b/megamek/src/megamek/common/weapons/SRMAntiTSMHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.*; @@ -24,26 +31,15 @@ * @author Sebastian Brocks */ public class SRMAntiTSMHandler extends SRMSmokeWarheadHandler { + @Serial private static final long serialVersionUID = 6380017303917455020L; - /** - * @param t - * @param w - * @param g - * @param m - */ - public SRMAntiTSMHandler(ToHitData t, WeaponAttackAction w, Game g, - TWGameManager m) { + public SRMAntiTSMHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); sSalvoType = " anti-TSM missile(s) "; damageType = DamageType.ANTI_TSM; } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcHits(java.util.Vector) - */ @Override protected int calcHits(Vector vPhaseReport) { // conventional infantry gets hit in one lump @@ -57,10 +53,10 @@ protected int calcHits(Vector vPhaseReport) { } int missilesHit; int nMissilesModifier = getClusterModifiers(true); - + // Add ams mod nMissilesModifier += getAMSHitsMod(vPhaseReport); - + if (game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_AERO_SANITY)) { Entity entityTarget = (target.getTargetType() == Targetable.TYPE_ENTITY) ? (Entity) target : null; @@ -68,7 +64,7 @@ protected int calcHits(Vector vPhaseReport) { nMissilesModifier -= getAeroSanityAMSHitsMod(); } } - + if (allShotsHit()) { // We want buildings and large craft to be able to affect this number with AMS // treat as a Streak launcher (cluster roll 11) to make this happen diff --git a/megamek/src/megamek/common/weapons/SRMDeadFireHandler.java b/megamek/src/megamek/common/weapons/SRMDeadFireHandler.java index a4d2c5b45d..aaaf7d3e25 100644 --- a/megamek/src/megamek/common/weapons/SRMDeadFireHandler.java +++ b/megamek/src/megamek/common/weapons/SRMDeadFireHandler.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org) - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * * This file is part of MegaMek. * @@ -26,10 +26,13 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Jason Tighe */ public class SRMDeadFireHandler extends SRMHandler { + @Serial private static final long serialVersionUID = -1511452503641090393L; public SRMDeadFireHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { @@ -50,7 +53,7 @@ protected int calcDamagePerHit() { wtype.getInfantryDamageClass(), ((Infantry) target).isMechanized(), toHit.getThruBldg() != null, ae.getId(), calcDmgPerHitReport); - + toReturn = applyGlancingBlowModifier(toReturn, true); return (int) toReturn; } diff --git a/megamek/src/megamek/common/weapons/SRMFragHandler.java b/megamek/src/megamek/common/weapons/SRMFragHandler.java index c6940c72d4..db8ebab51f 100644 --- a/megamek/src/megamek/common/weapons/SRMFragHandler.java +++ b/megamek/src/megamek/common/weapons/SRMFragHandler.java @@ -1,15 +1,21 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -17,20 +23,16 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; import java.util.Vector; /** * @author Sebastian Brocks */ public class SRMFragHandler extends SRMHandler { + @Serial private static final long serialVersionUID = -2281133981582906299L; - /** - * @param t - * @param w - * @param g - * @param m - */ public SRMFragHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); sSalvoType = " fragmentation missile(s) "; @@ -39,7 +41,7 @@ public SRMFragHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m /** * Calculate the damage per hit. - * + * * @return an int representing the damage dealt per hit. */ @Override @@ -58,7 +60,7 @@ protected int calcDamagePerHit() { if (bDirect) { toReturn += toHit.getMoS() / 3.0; } - + toReturn = applyGlancingBlowModifier(toReturn, true); } @@ -106,7 +108,6 @@ protected void handleClearDamage(Vector vPhaseReport, Building bldg, int } @Override - protected void handleBuildingDamage(Vector vPhaseReport, Building bldg, int nDamage, - Coords coords) { + protected void handleBuildingDamage(Vector vPhaseReport, Building bldg, int nDamage, Coords coords) { } } diff --git a/megamek/src/megamek/common/weapons/SRMHandler.java b/megamek/src/megamek/common/weapons/SRMHandler.java index e2f63a247c..b584912c0a 100644 --- a/megamek/src/megamek/common/weapons/SRMHandler.java +++ b/megamek/src/megamek/common/weapons/SRMHandler.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 - Ben Mazur (bmazur@sev.org) - * Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. + * Copyright (c) 2022-2024 - The MegaMek Team. All Rights Reserved. * * This file is part of MegaMek. * @@ -26,10 +26,13 @@ import megamek.common.actions.WeaponAttackAction; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Sebastian Brocks */ public class SRMHandler extends MissileWeaponHandler { + @Serial private static final long serialVersionUID = -1618484541772117621L; public SRMHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { @@ -49,9 +52,9 @@ protected int calcDamagePerHit() { wtype.getInfantryDamageClass(), ((Infantry) target).isMechanized(), toHit.getThruBldg() != null, ae.getId(), calcDmgPerHitReport); - + toReturn = applyGlancingBlowModifier(toReturn, true); - + return (int) toReturn; } return 2; diff --git a/megamek/src/megamek/common/weapons/SRMInfernoHandler.java b/megamek/src/megamek/common/weapons/SRMInfernoHandler.java index 7294753740..506f7e5adb 100644 --- a/megamek/src/megamek/common/weapons/SRMInfernoHandler.java +++ b/megamek/src/megamek/common/weapons/SRMInfernoHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.BattleArmor; @@ -34,14 +41,9 @@ * @author Sebastian Brocks */ public class SRMInfernoHandler extends SRMHandler { + @Serial private static final long serialVersionUID = 826674238068613732L; - /** - * @param t - * @param w - * @param g - * @param m - */ public SRMInfernoHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); damageType = DamageType.INFERNO; @@ -165,19 +167,10 @@ public boolean handle(GamePhase phase, Vector vPhaseReport) { } // End missed-target // light inferno missiles all at once, if not missed - if (!bMissed) { - vPhaseReport.addAll(gameManager.deliverInfernoMissiles(ae, target, hits, - weapon.getCalledShot().getCall())); - } + vPhaseReport.addAll(gameManager.deliverInfernoMissiles(ae, target, hits, weapon.getCalledShot().getCall())); return false; } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.MissileWeaponHandler#calcHits(java.util.Vector) - */ @Override protected int calcHits(Vector vPhaseReport) { // conventional infantry gets hit with all missiles diff --git a/megamek/src/megamek/common/weapons/SRMSmokeWarheadHandler.java b/megamek/src/megamek/common/weapons/SRMSmokeWarheadHandler.java index f6f1bd4302..8dd559bcfd 100644 --- a/megamek/src/megamek/common/weapons/SRMSmokeWarheadHandler.java +++ b/megamek/src/megamek/common/weapons/SRMSmokeWarheadHandler.java @@ -1,15 +1,21 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; @@ -18,31 +24,20 @@ import megamek.server.totalwarfare.TWGameManager; import megamek.server.SmokeCloud; +import java.io.Serial; import java.util.Vector; /** * @author FogHat */ public class SRMSmokeWarheadHandler extends SRMHandler { + @Serial private static final long serialVersionUID = -40939686257250837L; - /** - * @param t - * @param w - * @param g - * @param m - */ public SRMSmokeWarheadHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.WeaponHandler#specialResolution(java.util.Vector, - * megamek.common.Entity, boolean) - */ @Override protected boolean specialResolution(Vector vPhaseReport, Entity entityTarget) { Coords coords = target.getPosition(); diff --git a/megamek/src/megamek/common/weapons/SRMTandemChargeHandler.java b/megamek/src/megamek/common/weapons/SRMTandemChargeHandler.java index 986a35bff4..f12c55246b 100644 --- a/megamek/src/megamek/common/weapons/SRMTandemChargeHandler.java +++ b/megamek/src/megamek/common/weapons/SRMTandemChargeHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.*; @@ -23,31 +30,15 @@ * @author Jason Tighe */ public class SRMTandemChargeHandler extends SRMHandler { + @Serial private static final long serialVersionUID = 6292692766500970690L; - /** - * @param t - * @param w - * @param g - * @param m - */ - public SRMTandemChargeHandler(ToHitData t, WeaponAttackAction w, Game g, - TWGameManager m) { + public SRMTandemChargeHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); sSalvoType = " tandem charge missile(s) "; generalDamageType = HitData.DAMAGE_ARMOR_PIERCING_MISSILE; } - /** - * Handle damage against an entity, called once per hit by default. - * - * @param entityTarget - * @param vPhaseReport - * @param bldg - * @param hits - * @param nCluster - * @param bldgAbsorbs - */ @Override protected void handleEntityDamage(Entity entityTarget, Vector vPhaseReport, Building bldg, int hits, int nCluster, diff --git a/megamek/src/megamek/common/weapons/UltraWeaponHandler.java b/megamek/src/megamek/common/weapons/UltraWeaponHandler.java index f755b3ec82..a836d57b36 100644 --- a/megamek/src/megamek/common/weapons/UltraWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/UltraWeaponHandler.java @@ -14,6 +14,7 @@ */ package megamek.common.weapons; +import java.io.Serial; import java.util.Vector; import megamek.common.AmmoType; @@ -34,18 +35,14 @@ * @since Sept 29, 2004 */ public class UltraWeaponHandler extends AmmoWeaponHandler { + @Serial private static final long serialVersionUID = 7551194199079004134L; + int howManyShots; private final boolean twoRollsUltra; // Tracks whether this is an - // ultra AC using the unofficial "two rolls" rule. Can be final because // this isn't really going to change over the course of a game. - /** - * @param t - * @param w - * @param g - */ public UltraWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); twoRollsUltra = game.getOptions().booleanOption(OptionsConstants.ADVCOMBAT_UAC_TWOROLLS) @@ -53,18 +50,13 @@ public UltraWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManag || (wtype.getAmmoType() == AmmoType.T_AC_ULTRA_THB)); } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#addHeatUseAmmo() - */ @Override protected void useAmmo() { setDone(); checkAmmo(); howManyShots = (weapon.curMode().equals(Weapon.MODE_AC_SINGLE) ? 1 : 2); int total = ae.getTotalAmmoOfType(ammo.getType()); - if (total > 1 ) { + if (total > 1) { // No need to change howManyShots } else if (total == 1) { howManyShots = 1; @@ -95,11 +87,6 @@ protected void reduceShotsLeft(int shotsNeedFiring) { ammo.setShotsLeft(ammo.getBaseShotsLeft() - shotsNeedFiring); } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcHits(java.util.Vector) - */ @Override protected int calcHits(Vector vPhaseReport) { // conventional infantry gets hit in one lump BAs can't mount UACS/RACs @@ -144,11 +131,6 @@ protected int calcHits(Vector vPhaseReport) { return shotsHit; } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#doChecks(java.util.Vector) - */ @Override protected boolean doChecks(Vector vPhaseReport) { if (super.doChecks(vPhaseReport)) { @@ -171,11 +153,6 @@ protected boolean doChecks(Vector vPhaseReport) { return false; } - /* - * (non-Javadoc) - * - * @see megamek.common.weapons.WeaponHandler#calcDamagePerHit() - */ @Override protected int calcDamagePerHit() { double toReturn = wtype.getDamage(); diff --git a/megamek/src/megamek/common/weapons/VGLWeaponHandler.java b/megamek/src/megamek/common/weapons/VGLWeaponHandler.java index 4aa453d9f1..b3411aa68c 100644 --- a/megamek/src/megamek/common/weapons/VGLWeaponHandler.java +++ b/megamek/src/megamek/common/weapons/VGLWeaponHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2004, 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons; +import java.io.Serial; import java.util.ArrayList; import java.util.Vector; @@ -41,19 +48,10 @@ * @author arlith */ public class VGLWeaponHandler extends AmmoWeaponHandler { - + @Serial private static final long serialVersionUID = -4934490646657484486L; - protected VGLWeaponHandler() { - } - - /** - * @param t - * @param w - * @param g - */ - public VGLWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, - TWGameManager m) { + public VGLWeaponHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); generalDamageType = HitData.DAMAGE_NONE; } diff --git a/megamek/src/megamek/common/weapons/autocannons/ACWeapon.java b/megamek/src/megamek/common/weapons/autocannons/ACWeapon.java index 8f4e039706..838d394218 100644 --- a/megamek/src/megamek/common/weapons/autocannons/ACWeapon.java +++ b/megamek/src/megamek/common/weapons/autocannons/ACWeapon.java @@ -1,15 +1,21 @@ /* * MegaMek - Copyright (C) 2004, 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons.autocannons; @@ -26,42 +32,29 @@ import megamek.server.Server; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** - * N.B. This class is overridden for AC/2, AC/5, AC/10, AC/10, NOT - * ultras/LB/RAC. - * (No difference between ACWeapon and AmmoWeapon except the ability to use - * special ammos - * (precision, AP, etc.)) + * N.B. This class is overridden for AC/2, AC/5, AC/10, AC/10, NOT ultras/LB/RAC. (No difference between ACWeapon and + * AmmoWeapon except the ability to use special ammos (precision, AP, etc.)) * * @author Andrew Hunter - * @since Sep 25, 2004 */ public abstract class ACWeapon extends AmmoWeapon { + @Serial private static final long serialVersionUID = 1537808266032711407L; public ACWeapon() { super(); - - flags = flags.or(F_DIRECT_FIRE).or(F_BALLISTIC).or(F_MEK_WEAPON) - .or(F_AERO_WEAPON).or(F_TANK_WEAPON); + flags = flags.or(F_DIRECT_FIRE).or(F_BALLISTIC).or(F_MEK_WEAPON).or(F_AERO_WEAPON).or(F_TANK_WEAPON); ammoType = AmmoType.T_AC; explosive = true; // when firing incendiary ammo atClass = CLASS_AC; } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.Weapon#getCorrectHandler(megamek.common.ToHitData, - * megamek.common.actions.WeaponAttackAction, megamek.common.Game, - * megamek.server.Server) - */ @Override - protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, Game game, - TWGameManager gameManager) { - AmmoType atype = (AmmoType) game.getEntity(waa.getEntityId()).getEquipment(waa.getWeaponId()).getLinked() - .getType(); + protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, Game game, TWGameManager gameManager) { + AmmoType atype = (AmmoType) game.getEntity(waa.getEntityId()).getEquipment(waa.getWeaponId()).getLinked().getType(); Mounted weapon = game.getEntity(waa.getEntityId()).getEquipment(waa.getWeaponId()); diff --git a/megamek/src/megamek/common/weapons/autocannons/HVACWeapon.java b/megamek/src/megamek/common/weapons/autocannons/HVACWeapon.java index 45a66eed06..83e9354f9a 100644 --- a/megamek/src/megamek/common/weapons/autocannons/HVACWeapon.java +++ b/megamek/src/megamek/common/weapons/autocannons/HVACWeapon.java @@ -1,15 +1,21 @@ /* * MegaMek - Copyright (C) 2004, 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons.autocannons; @@ -23,11 +29,13 @@ import megamek.common.weapons.RapidfireHVACWeaponHandler; import megamek.server.totalwarfare.TWGameManager; +import java.io.Serial; + /** * @author Jason Tighe - * @since Sep 25, 2004 */ public abstract class HVACWeapon extends ACWeapon { + @Serial private static final long serialVersionUID = 4958849713169213573L; public HVACWeapon() { @@ -35,22 +43,14 @@ public HVACWeapon() { ammoType = AmmoType.T_HYPER_VELOCITY; } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.ACWeapon#getCorrectHandler(megamek.common.ToHitData - * , megamek.common.actions.WeaponAttackAction, megamek.common.Game, - * megamek.server.Server) - */ @Override - protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, Game game, - TWGameManager manager) { + protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, Game game, TWGameManager manager) { Mounted weapon = game.getEntity(waa.getEntityId()).getEquipment(waa.getWeaponId()); if (weapon.curMode().equals("Rapid")) { return new RapidfireHVACWeaponHandler(toHit, waa, game, manager); + } else { + return new HVACWeaponHandler(toHit, waa, game, manager); } - return new HVACWeaponHandler(toHit, waa, game, manager); } @Override diff --git a/megamek/src/megamek/common/weapons/battlearmor/BATaserHandler.java b/megamek/src/megamek/common/weapons/battlearmor/BATaserHandler.java index 6d87a6b1d6..1c7e3af920 100644 --- a/megamek/src/megamek/common/weapons/battlearmor/BATaserHandler.java +++ b/megamek/src/megamek/common/weapons/battlearmor/BATaserHandler.java @@ -1,18 +1,25 @@ /* * MegaMek - Copyright (C) 2004, 2005 Ben Mazur (bmazur@sev.org) + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * This file is part of MegaMek. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . */ package megamek.common.weapons.battlearmor; +import java.io.Serial; import java.util.Vector; import megamek.common.*; @@ -21,30 +28,14 @@ import megamek.server.totalwarfare.TWGameManager; public class BATaserHandler extends AmmoWeaponHandler { - + @Serial private static final long serialVersionUID = 1308895663099714573L; - protected BATaserHandler() { - // deserialization only - } - - /** - * @param t - * @param w - * @param g - */ public BATaserHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) { super(t, w, g, m); generalDamageType = HitData.DAMAGE_ENERGY; } - /* - * (non-Javadoc) - * - * @see - * megamek.common.weapons.WeaponHandler#specialResolution(java.util.Vector, - * megamek.common.Entity, boolean) - */ @Override protected boolean specialResolution(Vector vPhaseReport, Entity entityTarget) { boolean done = false;