Package mage

Examples of mage.MageObjectReference


    }

    @Override
    public void watch(GameEvent event, Game game) {
        if (event.getType() == EventType.DAMAGED_CREATURE && sourceId.equals(event.getSourceId())) {
            MageObjectReference mor = new MageObjectReference(event.getTargetId(), game);
            if (!damagedCreatures.contains(mor)) {
                damagedCreatures.add(mor);
            }
        }
    }
View Full Code Here


        }
        return false;
    }

    public boolean wasDamaged(Permanent permanent) {
        return damagedCreatures.contains(new MageObjectReference(permanent));
    }
View Full Code Here

    }

    @Override
    public void watch(GameEvent event, Game game) {
        if (event.getType() == EventType.BLOCKER_DECLARED) {
            MageObjectReference blocker = new MageObjectReference(event.getSourceId(), game);
            Set<MageObjectReference> blockedAttackers = blockData.get(blocker);
            if (blockedAttackers != null) {
                blockedAttackers.add(new MageObjectReference(event.getTargetId(), game));
            } else {
                blockedAttackers = new HashSet<>();
                blockedAttackers.add(new MageObjectReference(event.getTargetId(), game));
                blockData.put(blocker, blockedAttackers);
            }
        }
    }
View Full Code Here

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

    public boolean creatureHasBlockedAttacker(Permanent attacker, Permanent blocker) {
        Set<MageObjectReference> blockedAttackers = blockData.get(new MageObjectReference(blocker));
        return blockedAttackers != null && blockedAttackers.contains(new MageObjectReference(attacker));
    }
View Full Code Here

        if (cardInGraveyard != null) {
            Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
            effect.setTargetPointer(getTargetPointer());
            effect.apply(game, source);

            game.getState().setValue(source.getSourceId().toString() + "returnedCreature", new MageObjectReference(cardInGraveyard.getId(), game));

            return true;
        }
        return false;
    }
View Full Code Here

    public void watch(GameEvent event, Game game) {
        if (event.getType() == EventType.DAMAGED_CREATURE) {
            Permanent enchantment = game.getPermanent(this.getSourceId());
            if (enchantment != null && enchantment.getAttachedTo() != null) {
                if (enchantment.getAttachedTo().equals(event.getSourceId())) {
                    MageObjectReference mor = new MageObjectReference(event.getTargetId(), game);
                    if (!damagedCreatures.contains(mor)) {
                        damagedCreatures.add(mor);
                    }
                }
            }
View Full Code Here

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

    public boolean wasDamaged(Permanent permanent) {
        return damagedCreatures.contains(new MageObjectReference(permanent));
    }
View Full Code Here

TOP

Related Classes of mage.MageObjectReference

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.