Package mage

Examples of mage.MageObject


                    log.error(uuid+"        instanceof StaticAbility: " + (ability instanceof StaticAbility) + ", ability=" + ability);
                    log.error(uuid+"        usable zone: " + usable + ", ability=" + ability);
                    if (!usable) {
                        Zone zone = ability.getZone();
                        log.error(uuid+"        zone: " + zone);
                        MageObject object = game.getObject(ability.getSourceId());
                        log.error(uuid+"        object: " + object);
                        if (object != null) {
                            log.error(uuid + "        contains ability: " + object.getAbilities().contains(ability));
                        }
                        Zone test = game.getState().getZone(ability.getSourceId());
                        log.error(uuid+"        test_zone: " + test);
                    }
                }
View Full Code Here


        super.reset();
        damagedCreatures.clear();
    }

    public boolean wasDamaged(UUID sourceId, Game game) {
        MageObject mageObject = game.getObject(sourceId);
        if (mageObject instanceof Permanent) {
            return wasDamaged((Permanent) mageObject);
        }
        return false;
    }
View Full Code Here

            if (spell != null && spell.getControllerId().equals(source.getControllerId())
                    && filterTarget.match(spell, game)) {
                if (filterSource == null) {
                    return true;
                } else {
                    MageObject sourceObject = game.getObject(source.getSourceId());
                    if (sourceObject != null && filterSource.match(sourceObject, game)) {
                        return true;
                    }
                }
            }
View Full Code Here

    }

    @Override
    public boolean isInUseableZone(Game game, MageObject source, boolean checkLKI) {
        // check it was previously on battlefield
        MageObject before = game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD);
        // check now it is in graveyard
        Zone after = game.getState().getZone(sourceId);
        return before != null && after != null && Zone.GRAVEYARD.match(after);
    }
View Full Code Here

        return false;
    }

    @Override
    public String getInfoMessage(Ability source, GameEvent event, Game game) {
        MageObject mageObject = game.getObject(source.getSourceId());
        if (mageObject != null) {
            return "{this} doesn't untap (" + mageObject.getLogName() + ")";
        }
        return null;
    }
View Full Code Here

    }

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = getPayingPlayer(game, source);
        MageObject mageObject = game.getObject(source.getSourceId());
        if (player != null && mageObject != null) {
            String message = null;
            if (chooseUseText != null) {
                message = chooseUseText;
                message = CardUtil.replaceSourceName(message, mageObject.getLogName());
            }
           
            if (chooseUseText == null || player.chooseUse(executingEffect.getOutcome(), message, game)) {
                if (ClashEffect.getInstance().apply(game, source)) {
                    if (setTargetPointerToClashedOpponent) {
View Full Code Here

                        while (isInGame() && leftForUntap.size() > 0 && numberToUntap > 0) {
                            // player has to select the permanent he wants to untap for this restriction
                            Ability ability = handledEntry.getKey().getValue().iterator().next();
                            if (ability != null) {
                                StringBuilder sb = new StringBuilder(message).append(" to untap").append(" (").append(Math.min(leftForUntap.size(), numberToUntap)).append(" in total");
                                MageObject effectSource = game.getObject(ability.getSourceId());
                                if (effectSource != null) {
                                    sb.append(" from ").append(effectSource.getName()).toString();
                                }
                                sb.append(")");
                                filter.setMessage(sb.toString());
                                Target target = new TargetPermanent(filter);
                                if (!this.chooseTarget(Outcome.Untap, target, ability, game)) {
View Full Code Here

            if (!game.replaceEvent(event)) {
                int actualDamage = event.getAmount();
                if (actualDamage > 0) {
                    Permanent source = game.getPermanent(sourceId);
                    if(source == null){
                        MageObject lastKnownInformation = game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD);
                        if(lastKnownInformation != null &&  lastKnownInformation instanceof Permanent){
                            source = (Permanent) lastKnownInformation;
                        }
                    }
                    if (source != null && (source.getAbilities().containsKey(InfectAbility.getInstance().getId()))) {
View Full Code Here

                        }
                    }
                }
            }

            MageObject object = game.getObject(ability.getSourceId());
            for (Ability objectAbility :object.getAbilities()) {
                if (objectAbility instanceof AlternativeCostSourceAbility) {
                    if (objectAbility.getCosts().canPay(ability, ability.getSourceId(), playerId, game)) {
                        return true;
                    }
                }               
View Full Code Here

            }
            // get cast commander if available
            if (!(this.getCommanderId() == null)) {
                Zone zone = game.getState().getZone(this.getCommanderId());
                if (zone != null && zone.equals(Zone.COMMAND)) {
                    MageObject object = game.getObject(this.getCommanderId());
                    if (object != null) {
                        for (ActivatedAbility ability : ((Commander) object).getAbilities().getActivatedAbilities(Zone.COMMAND)) {
                            if (canPlay(ability, availableMana, object, game)) {
                                playableActivated.put(ability.toString(), ability);
                            }
View Full Code Here

TOP

Related Classes of mage.MageObject

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.