Package mage.game.permanent

Examples of mage.game.permanent.Permanent


    return new SacrificeSourceEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (permanent != null) {
      return permanent.sacrifice(source.getSourceId(), game);
    }
    return false;
  }
View Full Code Here


    return new AddPlusOneCountersAttachedEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent enchantment = game.getPermanent(source.getSourceId());
    if (enchantment != null && enchantment.getAttachedTo() != null) {
      Permanent creature = game.getPermanent(enchantment.getAttachedTo());
      if (creature != null) {
        creature.addCounters(new PlusOneCounter(amount));
      }
    }
    return true;
  }
View Full Code Here

    if (player != null) {
      TargetControlledPermanent target = new TargetControlledPermanent(filter);
      if (target.canChoose(null, source.getControllerId(), game)) {
        target.setRequired(true);
        if (player.choose(Outcome.Neutral, target, game)) {
          Permanent permanent = game.getPermanent(target.getFirstTarget());
          if (permanent != null) {
            permanent.addCounters("phylactery", 1);
          }
        }
      }
    }
    return false;
View Full Code Here

      return new PalaceGuardEffect(this);
    }

    @Override
    public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
      Permanent perm = game.getPermanent(source.getSourceId());
      if (perm != null) {
        switch (layer) {
          case RulesEffects:
            perm.setMaxBlocks(0);
            break;
        }
        return true;
      }
      return false;
View Full Code Here

    return new ArmoredAscensionEffect(this);
  }

  @Override
  public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    Permanent enchantment = game.getPermanent(source.getSourceId());
    if (enchantment != null && enchantment.getAttachedTo() != null) {
      Permanent creature = game.getPermanent(enchantment.getAttachedTo());
      if (creature != null) {
        switch (layer) {
          case PTChangingEffects_7:
            if (sublayer == SubLayer.ModifyPT_7c) {
              int amount = game.getBattlefield().countAll(filter, source.getControllerId());
              creature.addPower(amount);
              creature.addToughness(amount);
            }
            break;
          case AbilityAddingRemovingEffects_6:
            if (sublayer == SubLayer.NA) {
              creature.addAbility(FlyingAbility.getInstance());
            }
            break;
        }
        return true;
      }
View Full Code Here

        target2.setRequired(true);
        player.choose(revealed, target2, game);
        Card card = revealed.get(target2.getFirstTarget(), game);
        card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
        revealed.remove(card);
        Permanent permanent = game.getPermanent(card.getId());
        if (permanent != null)
          permanent.setTapped(true);
        card = revealed.getCards(game).iterator().next();
        card.moveToZone(Zone.HAND, source.getId(), game, false);
      }
      else if (target.getTargets().size() == 1) {
        Card card = revealed.getCards(game).iterator().next();
        card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
        Permanent permanent = game.getPermanent(card.getId());
        if (permanent != null)
          permanent.setTapped(true);
      }

      player.shuffleLibrary(game);
    }
    return true;
View Full Code Here

    return new RiseFromTheGraveEffect(this);
  }

  @Override
  public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    Permanent creature = game.getPermanent(source.getFirstTarget());
    if (creature != null) {
      switch (layer) {
        case TypeChangingEffects_4:
          if (sublayer == SubLayer.NA) {
            creature.getSubtype().add("Zombie");
          }
          break;
        case ColorChangingEffects_5:
          if (sublayer == SubLayer.NA) {
            creature.getColor().setBlack(true);
          }
          break;
      }
      return true;
    }
View Full Code Here

  }

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (player != null && permanent != null) {
      player.gainLife(5, game);
      permanent.moveToZone(Zone.LIBRARY, source.getId(), game, true);
      player.getLibrary().addAll(player.getGraveyard().getCards(game), game);
      player.getGraveyard().clear();
      player.getLibrary().shuffle();
      return true;
    }
View Full Code Here

  }

  @Override
  public boolean checkTrigger(GameEvent event, Game game) {
    if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.BATTLEFIELD) {
      Permanent permanent = game.getPermanent(event.getTargetId());
      if (permanent.getCardType().contains(CardType.CREATURE) && !permanent.getId().equals(this.getSourceId())) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

  }

  @Override
  public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    if (((ZoneChangeEvent)event).getFromZone() == Zone.BATTLEFIELD) {
      Permanent permanent = ((ZoneChangeEvent)event).getTarget();
      if (permanent != null) {
        return permanent.moveToExile(null, "", source.getId(), game);
      }
    }
    else {
      Card card = game.getCard(event.getTargetId());
      if (card != null) {
View Full Code Here

TOP

Related Classes of mage.game.permanent.Permanent

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.