Package megamek.common

Examples of megamek.common.ToHitData.addModifier()


                toHit.addModifier(-1, "Weight Class Attack Modifier");
            }
        }

        if (((Mech)ae).hasIndustrialTSM()) {
            toHit.addModifier(2, "industrial TSM");
        }

        // done!
        return toHit;
    }
View Full Code Here


            }
           
            // The base night penalty
            int night_modifier = 0;  
            night_modifier = game.getPlanetaryConditions().getLightHitPenalty(isWeapon);
            toHit.addModifier(night_modifier, game.getPlanetaryConditions().getLightCurrentName());

            boolean illuminated = false;
            if (te != null) {
                illuminated = te.isIlluminated();
                // hack for unresolved actions so client shows right BTH
View Full Code Here

            }
            // Searchlights reduce the penalty to zero (or 1 for pitch-black) (except for dusk/dawn)
            int searchlightMod = Math.min(3, night_modifier);
            if(te != null && lightCond > PlanetaryConditions.L_DUSK) {
                if (te.isUsingSpotlight()) {
                    toHit.addModifier(-searchlightMod, "target using searchlight");
                    night_modifier = night_modifier - searchlightMod;
                } else if (illuminated) {
                    toHit.addModifier(-searchlightMod,"target illuminated by searchlight");
                    night_modifier = night_modifier - searchlightMod;
                }
View Full Code Here

            if(te != null && lightCond > PlanetaryConditions.L_DUSK) {
                if (te.isUsingSpotlight()) {
                    toHit.addModifier(-searchlightMod, "target using searchlight");
                    night_modifier = night_modifier - searchlightMod;
                } else if (illuminated) {
                    toHit.addModifier(-searchlightMod,"target illuminated by searchlight");
                    night_modifier = night_modifier - searchlightMod;
                }
            }
            /*
            // Ignored with EI system & implants
View Full Code Here

                night_modifier = 0;
            }
            */
            // So do flares
            else if (game.isPositionIlluminated(target.getPosition())) {
                toHit.addModifier(-night_modifier,
                        "target illuminated by flare");
                night_modifier = 0;
            }
            // Certain ammunitions reduce the penalty
            else if (atype != null) {
View Full Code Here

            else if (atype != null) {
                if ((atype.getAmmoType() == AmmoType.T_AC || atype
                        .getAmmoType() == AmmoType.T_LAC)
                        && (atype.getMunitionType() == AmmoType.M_INCENDIARY_AC || atype
                                .getMunitionType() == AmmoType.M_TRACER)) {
                    toHit.addModifier(-1, "incendiary/tracer ammo");
                    night_modifier--;
                }
            }
            // Laser heatsinks
            if (night_modifier > 0 && te != null && te instanceof Mech
View Full Code Here

            // Laser heatsinks
            if (night_modifier > 0 && te != null && te instanceof Mech
                    && ((Mech) te).hasLaserHeatSinks()) {
                boolean lhsused = false;
                if (te.heat > 0) {
                    toHit.addModifier(-night_modifier,
                            "target overheated with laser heatsinks");
                    night_modifier = 0;
                }
                // actions that generate heat give a -1 modifier
                else if (te.heatBuildup > 0 || te.isStealthActive()) {
View Full Code Here

                        }
                    }
                }

                if (lhsused) {
                    toHit.addModifier(-1, "target uses laser heatsinks");
                }
            }
           
           
            //now check for general hit bonuses for heat
View Full Code Here

           
            //now check for general hit bonuses for heat
            if(te != null && !(attacker instanceof Infantry && !(attacker instanceof BattleArmor))) {                
                int heatBonus = game.getPlanetaryConditions().getLightHeatBonus(te.heat);
                if(heatBonus < 0) {
                    toHit.addModifier(heatBonus, "target excess heat at night");
                }
            }
           
        return toHit;
    }
View Full Code Here

    private static ToHitData getLimbModifier(int loc, Entity ae) {
        ToHitData toHit = new ToHitData();
        // damaged or missing actuators
        if (!ae.hasWorkingSystem(Mech.ACTUATOR_UPPER_LEG, loc)) {
            toHit.addModifier(2, "Upper leg actuator destroyed");
        }
        if (!ae.hasWorkingSystem(Mech.ACTUATOR_LOWER_LEG, loc)) {
            toHit.addModifier(2, "Lower leg actuator destroyed");
        }
        if (!ae.hasWorkingSystem(Mech.ACTUATOR_FOOT, loc)) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.