Search in sources :

Example 1 with ISBALaserPulseSmall

use of megamek.common.weapons.battlearmor.ISBALaserPulseSmall in project megameklab by MegaMek.

the class StringUtils method getEquipmentInfo.

public static String getEquipmentInfo(Entity unit, Mounted mount) {
    String info = "";
    if (mount.getType() instanceof WeaponType) {
        WeaponType weapon = (WeaponType) mount.getType();
        if (weapon instanceof InfantryWeapon) {
            info = Integer.toString(weapon.getDamage());
            if (weapon.hasFlag(WeaponType.F_BALLISTIC)) {
                info += " (B)";
            } else if (weapon.hasFlag(WeaponType.F_ENERGY)) {
                info += " (E)";
            } else if (weapon.hasFlag(WeaponType.F_MISSILE)) {
                info += " (M)";
            } else if (weapon.hasFlag(WeaponType.F_INF_POINT_BLANK)) {
                info += " (P)";
            }
            if (weapon.hasFlag(WeaponType.F_INF_BURST)) {
                info += "B";
            }
            if (weapon.hasFlag(WeaponType.F_INF_AA)) {
                info += "A";
            }
            if (weapon.hasFlag(WeaponType.F_FLAMER)) {
                info += "F";
            }
            if (weapon.hasFlag(WeaponType.F_INF_NONPENETRATING)) {
                info += "N";
            }
        } else if (weapon.hasFlag(WeaponType.F_MGA)) {
            info = "  [T]";
        } else if ((weapon instanceof ISC3M) || (weapon instanceof TAGWeapon)) {
            info = "  [E]";
        } else if (weapon instanceof ISC3RemoteSensorLauncher) {
            info = "  [M,E]";
        } else if (weapon.getDamage() < 0) {
            if (weapon instanceof StreakSRMWeapon) {
                info = "2/Msl [M,C]";
            } else if ((weapon instanceof SRMWeapon) || (weapon instanceof MekMortarWeapon)) {
                info = "2/Msl [M,C,S]";
            } else if ((weapon instanceof StreakLRMWeapon)) {
                info = "1/Msl [M,C]";
            } else if ((weapon instanceof LRMWeapon)) {
                info = "1/Msl [M,C,S]";
            } else if ((weapon instanceof MRMWeapon) || (weapon instanceof RLWeapon)) {
                info = "1/Msl [M,C]";
            } else if (weapon instanceof ISSnubNosePPC) {
                info = "10/8/5 [DE,V]";
            } else if ((weapon instanceof ISBALaserVSPSmall) || (weapon instanceof ISBALaserVSPSmall)) {
                info = "5/4/3 [P,V]";
            } else if ((weapon instanceof ISBALaserVSPMedium) || (weapon instanceof ISBALaserVSPMedium)) {
                info = "9/7/5 [P,V]";
            } else if (weapon instanceof ISVariableSpeedPulseLaserLarge) {
                info = "11/9/7 [P,V]";
            } else if (weapon instanceof ISHGaussRifle) {
                info = "25/20/10 [DB,X]";
            } else if (weapon instanceof ISPlasmaRifle) {
                info = "10 [DE,H,AI]";
            } else if (weapon instanceof CLPlasmaCannon) {
                info = "[DE,H,AI]";
            } else if (weapon instanceof HAGWeapon) {
                info = Integer.toString(weapon.getRackSize());
                info += " [C,F,X]";
            } else if (weapon instanceof ArtilleryWeapon) {
                info = Integer.toString(weapon.getRackSize());
                info += "[AE,S,F]";
            } else if (weapon instanceof ArtilleryCannonWeapon) {
                info = Integer.toString(weapon.getRackSize());
                info += "[DB,AE]";
            } else if (weapon instanceof ThunderBoltWeapon) {
                if (weapon instanceof ISThunderBolt5) {
                    info = "5";
                } else if (weapon instanceof ISThunderBolt10) {
                    info = "10";
                } else if (weapon instanceof ISThunderBolt15) {
                    info = "15";
                } else if (weapon instanceof ISThunderBolt20) {
                    info = "20";
                }
                info += "[M]";
            } else if (weapon instanceof NarcWeapon) {
                info = "[M]";
            } else if (weapon instanceof ISBAPopUpMineLauncher) {
                info = "4";
            } else {
                info = Integer.toString(weapon.getRackSize());
            }
        } else if (weapon instanceof UACWeapon) {
            info = Integer.toString(weapon.getDamage());
            info += "/Sht [DB,R/C]";
        } else if ((weapon instanceof ISVehicularGrenadeLauncher) || (weapon instanceof CLVehicularGrenadeLauncher)) {
            info = "[AE,OS]";
        } else {
            if (!UnitUtil.isAMS(weapon)) {
                info = Integer.toString(weapon.getDamage());
            }
            info += " [";
            if (weapon.hasFlag(WeaponType.F_BALLISTIC) && !UnitUtil.isAMS(weapon)) {
                info += "DB,";
            }
            if (UnitUtil.isAMS(weapon) || (weapon.hasFlag(WeaponType.F_B_POD))) {
                info += "PD,";
            } else if (weapon.hasFlag(WeaponType.F_PULSE)) {
                info += "P,";
            } else if (weapon.hasFlag(WeaponType.F_ENERGY) || weapon.hasFlag(WeaponType.F_PLASMA)) {
                info += "DE,";
            }
            if (weapon instanceof ISBombastLaser) {
                info += "V,";
            }
            if ((weapon instanceof LBXACWeapon) || (weapon instanceof ISSilverBulletGauss)) {
                info += "C/F/";
            }
            if (weapon instanceof CLBALBX) {
                info += "C,F,";
            }
            if (UnitUtil.hasSwitchableAmmo(weapon)) {
                info += "S,";
            }
            if (weapon.hasFlag(WeaponType.F_FLAMER) || weapon.hasFlag(WeaponType.F_PLASMA)) {
                info += "H,";
            }
            if ((weapon instanceof MGWeapon) || (weapon instanceof BPodWeapon) || (weapon instanceof CLERPulseLaserSmall) || (weapon instanceof CLBAERPulseLaserSmall) || (weapon instanceof ISXPulseLaserSmall) || (weapon instanceof ISPulseLaserSmall) || (weapon instanceof ISBALaserPulseSmall) || (weapon instanceof CLPulseLaserSmall) || (weapon instanceof CLBAPulseLaserSmall) || (weapon instanceof CLPulseLaserMicro) || (weapon instanceof CLBAPulseLaserMicro) || (weapon.hasFlag(WeaponType.F_FLAMER) || (weapon.hasFlag(WeaponType.F_BURST_FIRE)))) {
                info += "AI,";
            }
            if (weapon.isExplosive(mount) && !(weapon instanceof ACWeapon) && (!(weapon instanceof PPCWeapon) || ((mount.getLinkedBy() != null) && mount.getLinkedBy().getType().hasFlag(MiscType.F_PPC_CAPACITOR)))) {
                info += "X,";
            }
            if (weapon.hasFlag(WeaponType.F_ONESHOT)) {
                info += "OS,";
            }
            info = info.substring(0, info.length() - 1) + "]";
        }
    } else if ((mount.getType() instanceof MiscType) && (mount.getType().hasFlag(MiscType.F_CLUB) || mount.getType().hasFlag(MiscType.F_HAND_WEAPON))) {
        if (mount.getType().hasSubType(MiscType.S_VIBRO_LARGE) || mount.getType().hasSubType(MiscType.S_VIBRO_MEDIUM) || mount.getType().hasSubType(MiscType.S_VIBRO_SMALL)) {
            // manually set vibros to active to get correct damage
            mount.setMode(1);
        }
        if (mount.getType().hasSubType(MiscType.S_CLAW) || mount.getType().hasSubType(MiscType.S_CLAW_THB)) {
            info = Integer.toString((int) Math.ceil(unit.getWeight() / 7.0));
        } else {
            info = Integer.toString(ClubAttackAction.getDamageFor(unit, mount, false));
        }
    } else if ((mount.getType() instanceof MiscType) && (mount.getType().hasFlag(MiscType.F_AP_POD))) {
        info = "[PD,OS,AI]";
    } else if ((mount.getType() instanceof MiscType) && mount.getType().hasFlag(MiscType.F_TALON)) {
        info = Integer.toString(KickAttackAction.getDamageFor(unit, Mech.LOC_LLEG, false));
    } else {
        info = "  [E]";
    }
    return info;
}
Also used : ISBALaserPulseSmall(megamek.common.weapons.battlearmor.ISBALaserPulseSmall) StreakSRMWeapon(megamek.common.weapons.srms.StreakSRMWeapon) ISC3RemoteSensorLauncher(megamek.common.weapons.other.ISC3RemoteSensorLauncher) ISThunderBolt5(megamek.common.weapons.missiles.ISThunderBolt5) CLBALBX(megamek.common.weapons.battlearmor.CLBALBX) ISSnubNosePPC(megamek.common.weapons.ppc.ISSnubNosePPC) BPodWeapon(megamek.common.weapons.defensivepods.BPodWeapon) PPCWeapon(megamek.common.weapons.ppc.PPCWeapon) ISBAPopUpMineLauncher(megamek.common.weapons.battlearmor.ISBAPopUpMineLauncher) CLBAPulseLaserMicro(megamek.common.weapons.battlearmor.CLBAPulseLaserMicro) CLBAPulseLaserSmall(megamek.common.weapons.battlearmor.CLBAPulseLaserSmall) MGWeapon(megamek.common.weapons.mgs.MGWeapon) ArtilleryWeapon(megamek.common.weapons.artillery.ArtilleryWeapon) CLERPulseLaserSmall(megamek.common.weapons.lasers.CLERPulseLaserSmall) CLPlasmaCannon(megamek.common.weapons.ppc.CLPlasmaCannon) ISPulseLaserSmall(megamek.common.weapons.lasers.ISPulseLaserSmall) TAGWeapon(megamek.common.weapons.tag.TAGWeapon) InfantryWeapon(megamek.common.weapons.infantry.InfantryWeapon) ISVariableSpeedPulseLaserLarge(megamek.common.weapons.lasers.ISVariableSpeedPulseLaserLarge) CLPulseLaserMicro(megamek.common.weapons.lasers.CLPulseLaserMicro) MRMWeapon(megamek.common.weapons.missiles.MRMWeapon) ISBALaserVSPMedium(megamek.common.weapons.battlearmor.ISBALaserVSPMedium) ISThunderBolt20(megamek.common.weapons.missiles.ISThunderBolt20) ISXPulseLaserSmall(megamek.common.weapons.lasers.ISXPulseLaserSmall) WeaponType(megamek.common.WeaponType) ISC3M(megamek.common.weapons.other.ISC3M) ThunderBoltWeapon(megamek.common.weapons.missiles.ThunderBoltWeapon) CLVehicularGrenadeLauncher(megamek.common.weapons.mortars.CLVehicularGrenadeLauncher) StreakSRMWeapon(megamek.common.weapons.srms.StreakSRMWeapon) SRMWeapon(megamek.common.weapons.srms.SRMWeapon) CLPulseLaserSmall(megamek.common.weapons.lasers.CLPulseLaserSmall) ISVehicularGrenadeLauncher(megamek.common.weapons.mortars.ISVehicularGrenadeLauncher) ISThunderBolt15(megamek.common.weapons.missiles.ISThunderBolt15) ISThunderBolt10(megamek.common.weapons.missiles.ISThunderBolt10) NarcWeapon(megamek.common.weapons.other.NarcWeapon) HAGWeapon(megamek.common.weapons.gaussrifles.HAGWeapon) ISHGaussRifle(megamek.common.weapons.gaussrifles.ISHGaussRifle) RLWeapon(megamek.common.weapons.missiles.RLWeapon) ISPlasmaRifle(megamek.common.weapons.ppc.ISPlasmaRifle) StreakLRMWeapon(megamek.common.weapons.lrms.StreakLRMWeapon) LRMWeapon(megamek.common.weapons.lrms.LRMWeapon) ISBombastLaser(megamek.common.weapons.lasers.ISBombastLaser) ISBALaserVSPSmall(megamek.common.weapons.battlearmor.ISBALaserVSPSmall) ISSilverBulletGauss(megamek.common.weapons.gaussrifles.ISSilverBulletGauss) MiscType(megamek.common.MiscType) StreakLRMWeapon(megamek.common.weapons.lrms.StreakLRMWeapon) UACWeapon(megamek.common.weapons.autocannons.UACWeapon) CLBAERPulseLaserSmall(megamek.common.weapons.battlearmor.CLBAERPulseLaserSmall) MekMortarWeapon(megamek.common.weapons.mortars.MekMortarWeapon) ArtilleryCannonWeapon(megamek.common.weapons.artillery.ArtilleryCannonWeapon) LBXACWeapon(megamek.common.weapons.autocannons.LBXACWeapon) LBXACWeapon(megamek.common.weapons.autocannons.LBXACWeapon) UACWeapon(megamek.common.weapons.autocannons.UACWeapon) ACWeapon(megamek.common.weapons.autocannons.ACWeapon)

Aggregations

MiscType (megamek.common.MiscType)1 WeaponType (megamek.common.WeaponType)1 ArtilleryCannonWeapon (megamek.common.weapons.artillery.ArtilleryCannonWeapon)1 ArtilleryWeapon (megamek.common.weapons.artillery.ArtilleryWeapon)1 ACWeapon (megamek.common.weapons.autocannons.ACWeapon)1 LBXACWeapon (megamek.common.weapons.autocannons.LBXACWeapon)1 UACWeapon (megamek.common.weapons.autocannons.UACWeapon)1 CLBAERPulseLaserSmall (megamek.common.weapons.battlearmor.CLBAERPulseLaserSmall)1 CLBALBX (megamek.common.weapons.battlearmor.CLBALBX)1 CLBAPulseLaserMicro (megamek.common.weapons.battlearmor.CLBAPulseLaserMicro)1 CLBAPulseLaserSmall (megamek.common.weapons.battlearmor.CLBAPulseLaserSmall)1 ISBALaserPulseSmall (megamek.common.weapons.battlearmor.ISBALaserPulseSmall)1 ISBALaserVSPMedium (megamek.common.weapons.battlearmor.ISBALaserVSPMedium)1 ISBALaserVSPSmall (megamek.common.weapons.battlearmor.ISBALaserVSPSmall)1 ISBAPopUpMineLauncher (megamek.common.weapons.battlearmor.ISBAPopUpMineLauncher)1 BPodWeapon (megamek.common.weapons.defensivepods.BPodWeapon)1 HAGWeapon (megamek.common.weapons.gaussrifles.HAGWeapon)1 ISHGaussRifle (megamek.common.weapons.gaussrifles.ISHGaussRifle)1 ISSilverBulletGauss (megamek.common.weapons.gaussrifles.ISSilverBulletGauss)1 InfantryWeapon (megamek.common.weapons.infantry.InfantryWeapon)1