Package mage.abilities

Examples of mage.abilities.Ability.newId()


    @Override
    public void addAbility(Ability ability, UUID sourceId, Game game) {
        if (!abilities.containsKey(ability.getId())) {
            Ability copyAbility = ability.copy();
            copyAbility.newId(); // needed so that source can get an ability multiple times (e.g. Raging Ravine)
            copyAbility.setControllerId(controllerId);
            copyAbility.setSourceId(objectId);
            game.getState().addAbility(copyAbility, sourceId, this);
            abilities.add(copyAbility);
        }
View Full Code Here


        target.getAbilities().clear();

        for (Ability ability0 : sourceObj.getAbilities()) {
            Ability ability = ability0.copy();
            ability.newId();
            ability.setSourceId(target.getId());
            target.addAbility(ability);
        }
        // Needed to do it this way because only the cardValue does not include the increased value from cards like "Intangible Virtue" will be copied.
        target.getPower().initValue(Integer.parseInt(sourceObj.getPower().toString()));
View Full Code Here

        target.setExpansionSetCode(source.getExpansionSetCode());
        target.getAbilities().clear();

        for (Ability ability0 : source.getAbilities()) {
            Ability ability = ability0.copy();
            ability.newId();
            ability.setSourceId(target.getId());
            if(target instanceof Permanent) {
                ((Permanent)target).addAbility(ability, game);
            } else {
                target.addAbility(ability);
View Full Code Here

            Ability ability = (Ability) stackAbility.getStackAbility();
            Player controller = game.getPlayer(source.getControllerId());
            Permanent sourcePermanent = game.getPermanent(source.getSourceId());
            if (ability != null && controller != null && sourcePermanent != null) {
                Ability newAbility = ability.copy();
                newAbility.newId();
                game.getStack().push(new StackAbility(newAbility, source.getControllerId()));
                if (newAbility.getTargets().size() > 0) {
                    if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", game)) {
                        newAbility.getTargets().clearChosen();
                        if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) {
View Full Code Here

        Ability ability = (Ability) getValue("stackAbility");
        Player controller = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanent(source.getSourceId());
        if (ability != null && controller != null && sourcePermanent != null) {
            Ability newAbility = ability.copy();
            newAbility.newId();
            game.getStack().push(new StackAbility(newAbility, source.getControllerId()));
            if (newAbility.getTargets().size() > 0) {
                if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", game)) {
                    newAbility.getTargets().clearChosen();
                    if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) {
View Full Code Here

                    Ability ability = (Ability) getValue("stackAbility");
                    Player controller = game.getPlayer(source.getControllerId());
                    Permanent sourcePermanent = game.getPermanent(source.getSourceId());
                    if (ability != null && controller != null) {
                        Ability newAbility = ability.copy();
                        newAbility.newId();
                        game.getStack().push(new StackAbility(newAbility, source.getControllerId()));
                        if (newAbility.getTargets().size() > 0) {
                            if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", game)) {
                                newAbility.getTargets().clearChosen();
                                if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) {
View Full Code Here

                    Ability ability = (Ability) getValue("stackAbility");
                    Player controller = game.getPlayer(source.getControllerId());
                    Permanent sourcePermanent = game.getPermanent(source.getSourceId());
                    if (ability != null && controller != null) {
                        Ability newAbility = ability.copy();
                        newAbility.newId();
                        game.getStack().push(new StackAbility(newAbility, source.getControllerId()));
                        if (newAbility.getTargets().size() > 0) {
                            if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", game)) {
                                newAbility.getTargets().clearChosen();
                                if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) {
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.