Skip to content

Commit

Permalink
Merge pull request #6025 from SJuliez/equipment-clean
Browse files Browse the repository at this point in the history
Weapon Handler Comment cleanup
  • Loading branch information
rjhancock authored Sep 22, 2024
2 parents 982c7f5 + b8ce280 commit 629c004
Show file tree
Hide file tree
Showing 41 changed files with 607 additions and 840 deletions.
41 changes: 18 additions & 23 deletions megamek/src/megamek/common/weapons/ACCaselessHandler.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
/**
/*
* MegaMek - Copyright (C) 2004 Ben Mazur ([email protected])
* 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 <http://www.gnu.org/licenses/>.
*/
package megamek.common.weapons;

import java.io.Serial;
import java.util.Vector;

import megamek.common.*;
Expand All @@ -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);
}

Expand All @@ -47,7 +42,7 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
if (doAmmoFeedProblemCheck(vPhaseReport)) {
return true;
}

if ((roll.getIntValue() <= 2) && !ae.isConventionalInfantry()) {
Roll diceRoll = Compute.rollD6(2);

Expand Down
30 changes: 17 additions & 13 deletions megamek/src/megamek/common/weapons/ACIncendiaryHandler.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
/*
* MegaMek - Copyright (C) 2005 Ben Mazur ([email protected])
* 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 <http://www.gnu.org/licenses/>.
*/
package megamek.common.weapons;

Expand All @@ -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;
Expand Down
36 changes: 17 additions & 19 deletions megamek/src/megamek/common/weapons/ACTracerHandler.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
/*
* MegaMek - Copyright (C) 2005 Ben Mazur ([email protected])
* 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 <http://www.gnu.org/licenses/>.
*/
package megamek.common.weapons;

Expand All @@ -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;
Expand Down
41 changes: 19 additions & 22 deletions megamek/src/megamek/common/weapons/ACWeaponHandler.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
/*
* MegaMek - Copyright (C) 2005 Ben Mazur ([email protected])
* 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 <http://www.gnu.org/licenses/>.
*/
package megamek.common.weapons;

Expand All @@ -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())
Expand All @@ -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;
}
Expand Down
38 changes: 17 additions & 21 deletions megamek/src/megamek/common/weapons/ADAMissileWeaponHandler.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
/*
* MegaMek - Copyright (C) 2005 Ben Mazur ([email protected])
* 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 <http://www.gnu.org/licenses/>.
*/
package megamek.common.weapons;

import megamek.common.*;
import megamek.common.actions.WeaponAttackAction;
import megamek.server.totalwarfare.TWGameManager;

import java.io.Serial;
import java.util.Vector;

/**
Expand All @@ -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;
Expand Down
Loading

0 comments on commit 629c004

Please sign in to comment.