Package mage.game.permanent

Examples of mage.game.permanent.Permanent


  @Override
  public String getTargetedName(Game game) {
    StringBuilder sb = new StringBuilder();
    for (UUID targetId: getTargets()) {
      Permanent permanent = game.getPermanent(targetId);
      if (permanent != null) {
        sb.append(permanent.getName()).append(" ");
      }
      else {
        Player player = game.getPlayer(targetId);
        sb.append(player.getName()).append(" ");
      }
View Full Code Here


  public boolean canTarget(UUID id, Game game) {
    Player player = game.getPlayer(id);
    if (player != null) {
      return filter.match(player);
    }
    Permanent permanent = game.getPermanent(id);
    if (permanent != null) {
      return filter.match(permanent);
    }
    return false;
  }
View Full Code Here

    Player player = game.getPlayer(id);
    MageObject targetSource = game.getObject(attackerId);
    if (player != null) {
      return player.canBeTargetedBy(targetSource) && filter.match(player);
    }
    Permanent permanent = game.getPermanent(id);
    if (permanent != null) {
      return permanent.canBeTargetedBy(targetSource) && filter.match(permanent);
    }
    return false;
  }
View Full Code Here

    Card card = player.getGraveyard().get(source.getSourceId(), game);
    if (card != null) {
      player.removeFromGraveyard(card, game);
      if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) {
        if (tapped) {
          Permanent permanent = game.getPermanent(card.getId());
          if (permanent != null)
            permanent.setTapped(true);
        }
        return true;
      }
    }
    return false;
View Full Code Here

    return new SetPowerToughnessTargetEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent target = (Permanent) game.getPermanent(source.getFirstTarget());
    if (target != null) {
      target.getPower().setValue(power);
      target.getToughness().setValue(toughness);
      return true;
    }
    return false;
  }
View Full Code Here

    return new DestroyNoRegenTargetEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    permanent.destroy(source.getId(), game, true);
    return true;
  }
View Full Code Here

  @Override
  public boolean apply(Game game, Ability source) {
    switch (source.getTargets().get(0).getZone()) {
      case BATTLEFIELD:
        Permanent permanent = game.getPermanent(source.getFirstTarget());
        if (permanent != null) {
          return permanent.moveToZone(Zone.LIBRARY, source.getId(), game, onTop);
        }
      case GRAVEYARD:
        Card card = game.getCard(source.getFirstTarget());
        for (Player player: game.getPlayers().values()) {
          if (player.getGraveyard().contains(card.getId())) {
View Full Code Here

  @Override
  public boolean apply(Game game, Ability source) {
    ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
    protectionFilter.setColor(choice.getColor());
    protectionFilter.setMessage(choice.getChoice());
    Permanent creature = game.getPermanent(source.getFirstTarget());
    if (creature != null) {
      creature.addAbility(ability);
      return true;
    }
    return false;
  }
View Full Code Here

    return new DestroyAllNamedPermanentsEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    String name = permanent.getName();

    permanent.destroy(source.getSourceId(), game, false);
    for (Permanent perm: game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
      if (perm.getName().equals(name))
        perm.destroy(source.getId(), game, false);
    }
View Full Code Here

  }

  @Override
  public boolean apply(Game game, Ability source) {
    int amount = source.getManaCosts().getVariableCosts().get(0).getAmount();
    Permanent target = (Permanent) game.getPermanent(source.getSourceId());
    if (target != null) {
      target.addPower(amount);
      return true;
    }
    return false;
  }
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.