Package megamek.common.actions

Examples of megamek.common.actions.BrushOffAttackAction


            dlg.setVisible(true);
            if (dlg.getAnswer()) {
                disableButtons();
                switch (dlg.getChoice()) {
                case 0:
                    attacks.addElement(new BrushOffAttackAction(cen, target
                            .getTargetType(), target.getTargetId(),
                            BrushOffAttackAction.LEFT));
                    break;
                case 1:
                    attacks.addElement(new BrushOffAttackAction(cen, target
                            .getTargetType(), target.getTargetId(),
                            BrushOffAttackAction.RIGHT));
                    break;
                case 2:
                    attacks.addElement(new BrushOffAttackAction(cen, target
                            .getTargetType(), target.getTargetId(),
                            BrushOffAttackAction.BOTH));
                    break;
                }
                ready();

            } // End not-cancel

        } // End choose-attack(s)

        // If only the left arm is available, confirm that choice.
        else if (canHitLeft) {
            choices = new String[1];
            choices[0] = left;
            dlg = new SingleChoiceDialog(clientgui.frame, title, warn
                    .toString(), choices);
            dlg.setVisible(true);
            if (dlg.getAnswer()) {
                disableButtons();
                attacks.addElement(new BrushOffAttackAction(cen, target
                        .getTargetType(), target.getTargetId(),
                        BrushOffAttackAction.LEFT));
                ready();

            } // End not-cancel

        } // End confirm-left

        // If only the right arm is available, confirm that choice.
        else if (canHitRight) {
            choices = new String[1];
            choices[0] = right;
            dlg = new SingleChoiceDialog(clientgui.frame, title, warn
                    .toString(), choices);
            dlg.setVisible(true);
            if (dlg.getAnswer()) {
                disableButtons();
                attacks.addElement(new BrushOffAttackAction(cen, target
                        .getTargetType(), target.getTargetId(),
                        BrushOffAttackAction.RIGHT));
                ready();

            } // End not-cancel
View Full Code Here


            dlg.setVisible(true);
            if (dlg.getAnswer()) {
                disableButtons();
                switch (dlg.getChoice()) {
                    case 0:
                        attacks.addElement(new BrushOffAttackAction(cen, target
                                .getTargetType(), target.getTargetId(),
                                BrushOffAttackAction.LEFT));
                        break;
                    case 1:
                        attacks.addElement(new BrushOffAttackAction(cen, target
                                .getTargetType(), target.getTargetId(),
                                BrushOffAttackAction.RIGHT));
                        break;
                    case 2:
                        attacks.addElement(new BrushOffAttackAction(cen, target
                                .getTargetType(), target.getTargetId(),
                                BrushOffAttackAction.BOTH));
                        break;
                }
                ready();

            } // End not-cancel

        } // End choose-attack(s)

        // If only the left arm is available, confirm that choice.
        else if (canHitLeft) {
            choices = new String[1];
            choices[0] = left;
            dlg = new SingleChoiceDialog(clientgui.frame, title, warn
                    .toString(), choices);
            dlg.setVisible(true);
            if (dlg.getAnswer()) {
                disableButtons();
                attacks.addElement(new BrushOffAttackAction(cen, target
                        .getTargetType(), target.getTargetId(),
                        BrushOffAttackAction.LEFT));
                ready();

            } // End not-cancel

        } // End confirm-left

        // If only the right arm is available, confirm that choice.
        else if (canHitRight) {
            choices = new String[1];
            choices[0] = right;
            dlg = new SingleChoiceDialog(clientgui.frame, title, warn
                    .toString(), choices);
            dlg.setVisible(true);
            if (dlg.getAnswer()) {
                disableButtons();
                attacks.addElement(new BrushOffAttackAction(cen, target
                        .getTargetType(), target.getTargetId(),
                        BrushOffAttackAction.RIGHT));
                ready();

            } // End not-cancel
View Full Code Here

                        target.getPosition());
            case TRIP_ATTACK:
                return null; // Trip attack not implemented yet
            case BRUSH_LEFT:
                if (target == null) {
                    return new BrushOffAttackAction(attacker.getId(), i_target
                            .getTargetType(), i_target.getTargetId(),
                            BrushOffAttackAction.LEFT);
                }
                return new BrushOffAttackAction(attacker.getId(), target
                        .getTargetType(), target.getId(),
                        BrushOffAttackAction.LEFT);
            case BRUSH_RIGHT:
                if (target == null) {
                    return new BrushOffAttackAction(attacker.getId(), i_target
                            .getTargetType(), i_target.getTargetId(),
                            BrushOffAttackAction.RIGHT);
                }
                return new BrushOffAttackAction(attacker.getId(), target
                        .getTargetType(), target.getId(),
                        BrushOffAttackAction.RIGHT);
            case BRUSH_BOTH:
                if (target == null) {
                    return new BrushOffAttackAction(attacker.getId(), i_target
                            .getTargetType(), i_target.getTargetId(),
                            BrushOffAttackAction.BOTH);
                }
                return new BrushOffAttackAction(attacker.getId(), target
                        .getTargetType(), target.getId(),
                        BrushOffAttackAction.BOTH);
                /*
                 * case THRASH_INF : return new
                 * ThrashAttackAction(attacker.getId(), target.getId());
View Full Code Here

    /**
     * Handle a brush off attack
     */
    private void resolveBrushOffAttack(PhysicalResult pr, int lastEntityId) {
        final BrushOffAttackAction baa = (BrushOffAttackAction) pr.aaa;
        final Entity ae = game.getEntity(baa.getEntityId());
        // PLEASE NOTE: buildings are *never* the target
        // of a "brush off", but iNarc pods **are**.
        Targetable target = game.getTarget(baa.getTargetType(), baa.getTargetId());
        Entity te = null;
        final String armName = baa.getArm() == BrushOffAttackAction.LEFT ? "Left Arm" : "Right Arm";
        Report r;

        if (target.getTargetType() == Targetable.TYPE_ENTITY) {
            te = game.getEntity(baa.getTargetId());
        }

        // get damage, ToHitData and roll from the PhysicalResult
        // ASSUMPTION: buildings can't absorb *this* damage.
        int damage = baa.getArm() == BrushOffAttackAction.LEFT ? pr.damage : pr.damageRight;
        final ToHitData toHit = baa.getArm() == BrushOffAttackAction.LEFT ? pr.toHit : pr.toHitRight;
        int roll = baa.getArm() == BrushOffAttackAction.LEFT ? pr.roll : pr.rollRight;

        if (lastEntityId != baa.getEntityId()) {
            // who is making the attacks
            r = new Report(4005);
            r.subject = ae.getId();
            r.addDesc(ae);
            addReport(r);
View Full Code Here

        PhysicalResult pr = new PhysicalResult();
        ToHitData toHit = new ToHitData();
        pr.roll = Compute.d6(2);
        pr.aaa = aaa;
        if (aaa instanceof BrushOffAttackAction) {
            BrushOffAttackAction baa = (BrushOffAttackAction) aaa;
            int arm = baa.getArm();
            baa.setArm(BrushOffAttackAction.LEFT);
            toHit = BrushOffAttackAction.toHit(game, aaa.getEntityId(), aaa.getTarget(game), BrushOffAttackAction.LEFT);
            baa.setArm(BrushOffAttackAction.RIGHT);
            pr.toHitRight = BrushOffAttackAction.toHit(game, aaa.getEntityId(), aaa.getTarget(game), BrushOffAttackAction.RIGHT);
            damage = BrushOffAttackAction.getDamageFor(ae, BrushOffAttackAction.LEFT);
            pr.damageRight = BrushOffAttackAction.getDamageFor(ae, BrushOffAttackAction.RIGHT);
            baa.setArm(arm);
            pr.rollRight = Compute.d6(2);
        } else if (aaa instanceof ChargeAttackAction) {
            ChargeAttackAction caa = (ChargeAttackAction) aaa;
            toHit = caa.toHit(game);
            if (caa.getTarget(game) instanceof Entity) {
View Full Code Here

            }
        } else if (aaa instanceof KickAttackAction) {
            resolveKickAttack(pr, cen);
            cen = aaa.getEntityId();
        } else if (aaa instanceof BrushOffAttackAction) {
            BrushOffAttackAction baa = (BrushOffAttackAction) aaa;
            if (baa.getArm() == BrushOffAttackAction.BOTH) {
                baa.setArm(BrushOffAttackAction.LEFT);
                pr.aaa = baa;
                resolveBrushOffAttack(pr, cen);
                cen = baa.getEntityId();
                baa.setArm(BrushOffAttackAction.RIGHT);
                pr.aaa = baa;
                resolveBrushOffAttack(pr, cen);
            } else {
                resolveBrushOffAttack(pr, cen);
                cen = baa.getEntityId();
            }
        } else if (aaa instanceof ThrashAttackAction) {
            resolveThrashAttack(pr, cen);
            cen = aaa.getEntityId();
        } else if (aaa instanceof ProtomechPhysicalAttackAction) {
View Full Code Here

TOP

Related Classes of megamek.common.actions.BrushOffAttackAction

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.