Package mage

Examples of mage.MageObject


    for (Player player: state.getPlayers().values()) {
      players.add(new PlayerView(player, game));
    }
    for (StackObject stackObject: state.getStack()) {
      if (stackObject instanceof StackAbility) {
        MageObject object = game.getObject(stackObject.getSourceId());
        Card card = game.getCard(stackObject.getSourceId());
        if (object != null)
          stack.put(stackObject.getId(), new StackAbilityView((StackAbility)stackObject, object.getName(), new CardView(card)));
        else
          stack.put(stackObject.getId(), new StackAbilityView((StackAbility)stackObject, "", new CardView(card)));
      }
      else {
        stack.put(stackObject.getId(), new CardView((Spell)stackObject));
View Full Code Here


    Player player = game.getPlayer(controllerId);
    for (Target target: ability.getTargets()) {
      Target newTarget = target.copy();
      newTarget.clearChosen();
      for (UUID targetId: target.getTargets()) {
        MageObject object = game.getObject(targetId);
        if (player.chooseUse(ability.getEffects().get(0).getOutcome(), "Change target from " + object.getName() + "?", game)) {
          if (!player.chooseTarget(ability.getEffects().get(0).getOutcome(), newTarget, ability, game))
            newTarget.addTarget(targetId, ability, game);
        }
        else {
          newTarget.addTarget(targetId, ability, game);
View Full Code Here

    @Override
    public int calculate(Game game, Ability source, Effect effect) {
        Spell spell = game.getStack().getSpell(source.getSourceId());
        if (spell == null) {
            MageObject mageObject = game.getLastKnownInformation(source.getSourceId(), Zone.STACK);
            if (mageObject instanceof Spell) {
                spell = (Spell) mageObject;
            }
        }
        if (spell != null) {
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
    if (event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT && game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
            MageObject object = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
            if (object instanceof Permanent) {
                for (Effect effect : getEffects()) {
                    effect.setTargetPointer(new FixedTarget(event.getTargetId()));
                }
                return true;
View Full Code Here

    @Override
    public int calculate(Game game, Ability sourceAbility, Effect effect) {
        Permanent p = game.getPermanent(sourceAbility.getSourceId());
        // if permanent already leaves the battlefield, try to find counters count via last known information
        if (p == null) {
            MageObject o = game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD);
            if (o instanceof Permanent) {
                p = (Permanent) o;
            }
        }
        if (p != null) {
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 - true if enough valid {@link mage.game.permanent.Permanent} or {@link mage.game.stack.Spell} exist
     */
    @Override
    public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
        int count = 0;
        MageObject targetSource = game.getObject(sourceId);
        for (StackObject stackObject: game.getStack()) {
            Spell spell = game.getStack().getSpell(stackObject.getId());
            if (spell != null && filter.match(spell, sourceId, sourceControllerId, game)) {
                count++;
                if (count >= this.minNumberOfTargets) {
View Full Code Here

        return false;
    }

    @Override
    public boolean applies(Ability abilityToModify, Ability source, Game game) {
        MageObject object = game.getObject(abilityToModify.getSourceId());
        if (object != null && object.getSubtype().contains("Arcane")) {
            return spliceSpellCanBeActivated(source, game);
        }
        return false;
    }
View Full Code Here

    }

    @Override
    public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
        Set<UUID> possibleTargets = new HashSet<UUID>();
        MageObject targetSource = game.getObject(sourceId);
                for (StackObject stackObject: game.getStack()) {
            Spell spell = game.getStack().getSpell(stackObject.getId());
            if (spell != null && filter.match(spell, null, sourceControllerId, game) && filter.match(spell, game)) {
                possibleTargets.add(spell.getId());
            }
View Full Code Here

                        damage = 0;
                    }
                    damage += damageEvent.getAmount();
                    damageToPlayer.put(playerUUID, damage);
                    Player player = game.getPlayer(playerUUID);
                    MageObject commander = game.getObject(sourceId);
                    if (player != null && commander != null){
                        game.informPlayers(commander.getLogName() + " did " + damage + " combat damage to " + player.getName() + " during the game.");
                        this.addCardInfoToCommander(game);
                    }
                }
            }
        }
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.