Package megamek.common

Examples of megamek.common.MiscType


    /**
     * Damage that the specified mech does with a club attack
     */
    public static int getDamageFor(Entity entity, Mounted club,
            boolean targetInfantry) {
        MiscType mType = (MiscType) (club.getType());
        int nDamage = (int) Math.floor(entity.getWeight() / 5.0);
        if (mType.hasSubType(MiscType.S_SWORD)) {
            nDamage = (int) (Math.ceil(entity.getWeight() / 10.0) + 1.0);
        } else if (mType.hasSubType(MiscType.S_MACE_THB)) {
            nDamage *= 2;
        } else if (mType.hasSubType(MiscType.S_RETRACTABLE_BLADE)) {
            nDamage = (int) Math.ceil(entity.getWeight() / 10.0);
        } else if (mType.hasSubType(MiscType.S_MACE)) {
            nDamage = (int) Math.floor(entity.getWeight() / 4.0);
        } else if (mType.hasSubType(MiscType.S_PILE_DRIVER)) {
            // Pile Drivers have constant damage, not variable like most.
            nDamage = 10;
        } else if (mType.hasSubType(MiscType.S_FLAIL)) {
            // Flails have constant damage, not variable like most.
            nDamage = 9;
        } else if (mType.hasSubType(MiscType.S_DUAL_SAW)) {
            // Saws have constant damage, not variable like most.
            nDamage = 7;
        } else if (mType.hasSubType(MiscType.S_CHAINSAW)) {
            // Saws have constant damage, not variable like most.
            nDamage = 5;
        } else if (mType.hasSubType(MiscType.S_BACKHOE)) {
            // Backhoes have constant damage, not variable like most.
            nDamage = 6;
        } else if (mType.isShield()) {
            nDamage = club.getDamageAbsorption(entity, club.getLocation());
        } else if (mType.hasSubType(MiscType.S_WRECKING_BALL)) {
            // Wrecking Balls have constant damage, not variable like most.
            nDamage = 8;
        } else if (mType.hasSubType(MiscType.S_BUZZSAW)) {
            // buzzsaw does 2d6 damage, not weight dependant
            nDamage = Compute.d6(2);
        } else if (mType.isVibroblade()) {
            if (club.curMode().equals("Active")) {
                if (mType.hasSubType(MiscType.S_VIBRO_LARGE)) {
                    nDamage = 14;
                } else if (mType.hasSubType(MiscType.S_VIBRO_MEDIUM)) {
                    nDamage = 10;
                } else {
                    nDamage = 7;
                }
            } else {
                // when not active a vibro blade does normal sword damage
                nDamage = (int) (Math.ceil(entity.getWeight() / 10.0) + 1.0);
            }
        }else if (mType.hasSubType(MiscType.S_CHAIN_WHIP)){
            nDamage = 3;
        } else if (mType.hasSubType(MiscType.S_ROCK_CUTTER)) {
            nDamage = 5;
        }

        // TSM doesn't apply to some weapons, including Saws.
        if (entity.heat >= 9
                && !(mType.hasSubType(MiscType.S_DUAL_SAW)
                        || mType.hasSubType(MiscType.S_CHAINSAW)
                        || mType.hasSubType(MiscType.S_PILE_DRIVER)
                        || mType.isShield()
                        || mType.hasSubType(MiscType.S_WRECKING_BALL)
                        || mType.hasSubType(MiscType.S_FLAIL)
                        || (mType.isVibroblade() && club.curMode().equals("Active"))
                        || mType.hasSubType(MiscType.S_BUZZSAW)
                        || mType.hasSubType(MiscType.S_CHAIN_WHIP))
                && ((Mech) entity).hasTSM()) {
            nDamage *= 2;
        }
        int clubLocation = club.getLocation();
        // tree clubs don't have a location--use right arm (is this okay?)
View Full Code Here


                }
                if (!(m.getType() instanceof MiscType)) {
                    unallocated.addElement(m);
                    continue;
                }
                MiscType mt = (MiscType) m.getType();
                if (mt.hasFlag(MiscType.F_HEAT_SINK)
                        || mt.hasFlag(MiscType.F_DOUBLE_HEAT_SINK)) {
                    countInternalHeatSinks++;
                } else {
                    unallocated.addElement(m);
                    continue;
                }
View Full Code Here

    }

    public float getWeightMiscEquip() {
        float weightSum = 0.0f;
        for (Mounted m : getEntity().getMisc()) {
            MiscType mt = (MiscType) m.getType();
            weightSum += getWeightMiscEquip(mt);
        }
        return weightSum;
    }
View Full Code Here

    }

    public StringBuffer printMiscEquip(StringBuffer buff, int posLoc,
            int posWeight) {
        for (Mounted m : getEntity().getMisc()) {
            MiscType mt = (MiscType) m.getType();

            if (m.getLocation() == Entity.LOC_NONE) {
                continue;
            }

            if (getWeightMiscEquip(mt) == 0f) {
                continue;
            }

            buff.append(StringUtil.makeLength(mt.getName(), 20));
            buff.append(
                    StringUtil.makeLength(getLocationAbbr(m.getLocation()),
                            getPrintSize() - 5 - 20)).append(
                    makeWeightString(getWeightMiscEquip(mt)));
            buff.append("\n");
View Full Code Here

        // If unit has stealth armor, turn it on
        if (getEntity(entNum) instanceof Mech
                && getEntity(entNum).getArmorType() == EquipmentType.T_ARMOR_STEALTH) {
            for (Mounted test_equip : getEntity(entNum).getMisc()) {
                MiscType test_type = (MiscType) test_equip.getType();
                if (test_type.hasFlag(MiscType.F_STEALTH)) {
                    if (test_equip.curMode().getName() != "On") {
                        test_equip.setMode("On");
                        super.sendModeChange(entNum, getEntity(entNum).getEquipmentNum(test_equip),
                                1);
                    }
View Full Code Here

            Entity check_ent = i.nextElement();
            if ((check_ent.getOwnerId() == local_pn)
                    && (check_ent instanceof Mech)) {
                if (((Mech) check_ent).hasStealth()) {
                    for (Mounted mEquip : check_ent.getMisc()) {
                        MiscType mtype = (MiscType) mEquip.getType();
                        if (mtype.hasFlag(MiscType.F_STEALTH)) {

                            // If the Mech is in danger of shutting down (14+
                            // heat), consider shutting
                            // off the armor
View Full Code Here

TOP

Related Classes of megamek.common.MiscType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.