Package mage.game.permanent

Examples of mage.game.permanent.Permanent.removeAttachment()


            if (player.choose(Outcome.Benefit, targetAura, source.getSourceId(), game)) {
                Permanent aura = game.getPermanent(targetAura.getFirstTarget());
                if (aura != null) {
                    Permanent attachedTo = game.getPermanent(aura.getAttachedTo());
                    if (attachedTo != null) {
                        attachedTo.removeAttachment(aura.getId(), game);
                    }
                    permanent.addAttachment(aura.getId(), game);
                }
            }
        }
View Full Code Here


        if (you != null && opponentCreature != null && prisonTerm != null) {
            Permanent oldCreature = game.getPermanent(prisonTerm.getAttachedTo());
            if (oldCreature == null) {
                return false;
            }
            if (oldCreature.removeAttachment(prisonTerm.getId(), game)) {
                return opponentCreature.addAttachment(prisonTerm.getId(), game);
            }
        }
        return false;
    }
View Full Code Here

            Permanent attachment = game.getPermanent(source.getSourceId());
            if (permanent != null && attachment != null) {
                if (attachment.getAttachedTo() != null) {
                    Permanent oldTarget = game.getPermanent(attachment.getAttachedTo());
                    if (oldTarget != null) {
                        oldTarget.removeAttachment(source.getSourceId(), game);
                    }
                }
                boolean result;
                result = permanent.addAttachment(source.getSourceId(), game);
                return result;
View Full Code Here

        if (aura != null && creature != null) {
            Permanent oldCreature = game.getPermanent(aura.getAttachedTo());
            if (oldCreature == null || oldCreature.equals(creature)) {
                return false;
            }
            if (oldCreature.removeAttachment(aura.getId(), game)) {
                return creature.addAttachment(aura.getId(), game);
            }
        }
        return false;
    }
View Full Code Here

        if (equipmentId != null) {
            Permanent equipment = game.getPermanent(equipmentId);
            if (equipment != null && equipment.getAttachedTo() != null) {
                Permanent attachedTo = game.getPermanent(equipment.getAttachedTo());
                if (attachedTo != null) {
                    attachedTo.removeAttachment(equipmentId, game);
                }
            }
            return true;
        }
        return false;
View Full Code Here

    @Override
    public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
        Permanent attachment = game.getPermanent(sourceId);
        Permanent permanent = game.getPermanent(attachment.getAttachedTo());
        if (permanent != null) {
            paid = permanent.removeAttachment(attachment.getId(), game);
            if (paid) {
                game.fireEvent(GameEvent.getEvent(GameEvent.EventType.UNATTACHED, sourceId, sourceId, controllerId));
            }
        }
        return paid;
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Permanent equipment = game.getPermanent(source.getSourceId());
        if (equipment != null && equipment.getAttachedTo() != null) {
            Permanent attachedTo = game.getPermanent(equipment.getAttachedTo());
            if (attachedTo != null) {
                attachedTo.removeAttachment(equipment.getId(), game);
                equipment.transform(game);
            }
        }
        return false;
    }
View Full Code Here

                Permanent oldCreature = game.getPermanent(aura.getAttachedTo());
                if (oldCreature != null && !oldCreature.equals(creature)) {
                    Target auraTarget = aura.getSpellAbility().getTargets().get(0);
                    if (!auraTarget.canTarget(creature.getId(), game))  {
                        game.informPlayers(aura.getLogName() + " was not attched to " +creature.getLogName() + " because it's no legal target for the aura" );
                    } else if (oldCreature.removeAttachment(aura.getId(), game)) {
                        game.informPlayers(aura.getLogName() + " was unattached from " + oldCreature.getLogName() + " and attached to " + creature.getLogName());
                        creature.addAttachment(aura.getId(), game);
                    }
                }
            }           
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.