Package megamek.common

Examples of megamek.common.Targetable


                    return "Attacks send to the server";
                } else if (args.length > 2) {
                    if (args[1].equalsIgnoreCase("TARGET")) {
                        String str = "";
                        try {
                            Targetable target = client.getEntity(Integer
                                    .parseInt(args[2]));
                            if (args.length == 4
                                    && args[3].equalsIgnoreCase("ALL")) {
                                for (Mounted weapon : ce().getWeaponList()) {
                                    if (weapon.canFire() && !weapon.isFired()) {
                                        fire(ce().getEquipmentNum(weapon),
                                                target);
                                    }
                                }
                                return "Fireing all remaining weapons at "
                                        + target.toString() + ".";
                            } else {
                                for (int i = 3; i < args.length; i++) {
                                    fire(Integer.parseInt(args[i]), target);
                                    str += "Firing weapon " + args[i] + " at "
                                            + target.toString() + "\n";
                                }
                            }
                        } catch (NumberFormatException nfe) {
                        }

                        return str + " Invalid arguments.";
                    } else if (args[1].equalsIgnoreCase("LIST")) {
                        try {
                            Targetable target = client.getEntity(Integer
                                    .parseInt(args[2]));
                            if (target != null) {
                                String str = " Weapons for " + ce() + " at "
                                        + target.toString() + ":\n";

                                for (Mounted weapon : ce().getWeaponList()) {
                                    str += "("
                                            + ce().getEquipmentNum(weapon)
                                            + ") "
View Full Code Here


                .hasMoreElements();) {
            AbstractEntityAction o = e.nextElement();
            if (o instanceof WeaponAttackAction) {
                WeaponAttackAction waa = (WeaponAttackAction) o;
                Entity attacker = waa.getEntity(client.game);
                Targetable target = waa.getTarget(client.game);
                boolean curInFrontArc = Compute.isInArc(attacker.getPosition(),
                        attacker.getSecondaryFacing(), target.getPosition(),
                        Compute.ARC_FORWARD);
                if (curInFrontArc) {
                    WeaponAttackAction waa2 = new WeaponAttackAction(waa
                            .getEntityId(), waa.getTargetType(), waa
                            .getTargetId(), waa.getWeaponId());
                    waa2.setAimedLocation(waa.getAimedLocation());
                    waa2.setAimingMode(waa.getAimingMode());
                    waa2.setOtherAttackInfo(waa.getOtherAttackInfo());
                    newAttacks.addElement(waa2);
                }
            } else {
                newAttacks.addElement(o);
            }
        }
        for (Enumeration<AbstractEntityAction> e = attacks.elements(); e
                .hasMoreElements();) {
            Object o = e.nextElement();
            if (o instanceof WeaponAttackAction) {
                WeaponAttackAction waa = (WeaponAttackAction) o;
                Entity attacker = waa.getEntity(client.game);
                Targetable target = waa.getTarget(client.game);
                boolean curInFrontArc = Compute.isInArc(attacker.getPosition(),
                        attacker.getSecondaryFacing(), target.getPosition(),
                        Compute.ARC_FORWARD);
                if (!curInFrontArc) {
                    WeaponAttackAction waa2 = new WeaponAttackAction(waa
                            .getEntityId(), waa.getTargetType(), waa
                            .getTargetId(), waa.getWeaponId());
View Full Code Here

    int getPhysicalTargetId() {
        MoveStep step = getLastStep();
        if (step == null) {
            return -1;
        }
        Targetable target = step.getTarget(game);
        if (target == null) {
            return -1;
        }
        return target.getTargetId();
    }
View Full Code Here

        if (aa instanceof ArtilleryAttackAction) {
            add((ArtilleryAttackAction)aa);
            return;
        }
        Entity ae = game.getEntity(aa.getEntityId());
        Targetable t = game.getTarget(aa.getTargetType(), aa.getTargetId());
        if (ae == null || t == null
                || t.getTargetType() == Targetable.TYPE_INARC_POD
                || t.getPosition() == null
                || ae.getPosition() == null
                || !game.getBoard().contains(ae.getPosition())
                || !game.getBoard().contains(t.getPosition())) {
            return;
        }
       
        AttackModel attack = null;
View Full Code Here

TOP

Related Classes of megamek.common.Targetable

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.