Package mage.game.permanent

Examples of mage.game.permanent.PermanentCard


            game.getPlayer(ownerId).getLibrary().putOnTop(this, game);
          else
            game.getPlayer(ownerId).getLibrary().putOnBottom(this, game);
          break;
        case BATTLEFIELD:
          PermanentCard permanent = new PermanentCard(this, ownerId);
          game.getBattlefield().addPermanent(permanent);
          permanent.entersBattlefield(sourceId, game);
          game.applyEffects();
          if (flag)
            permanent.setTapped(true);
          break;
      }
      game.setZone(objectId, event.getToZone());
      game.fireEvent(event);
      return game.getZone(objectId) == toZone;
View Full Code Here


    return false;
  }

  @Override
  public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) {
    PermanentCard permanent = new PermanentCard(this, controllerId);
    game.getBattlefield().addPermanent(permanent);
    game.setZone(objectId, Zone.BATTLEFIELD);
    game.applyEffects();
    permanent.entersBattlefield(sourceId, game);
    game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD));
    return true;
  }
View Full Code Here

                player.getGraveyard().add(card);
            }
            for (PermanentCard card : battlefield) {
                setZone(card.getId(), Zone.BATTLEFIELD);
                card.setOwnerId(ownerId);
                PermanentCard permanent = new PermanentCard(card.getCard(), ownerId);
                getBattlefield().addPermanent(permanent);
                permanent.entersBattlefield(permanent.getId(), this, Zone.OUTSIDE, false);
                ((PermanentImpl)permanent).removeSummoningSickness();
                if (card.isTapped()) {
                    permanent.setTapped(true);
                }
            }
            applyEffects();
        }
    }
View Full Code Here

                    else {
                        game.getPlayer(ownerId).getLibrary().putOnBottom(this, game);
                    }
                    break;
                case BATTLEFIELD:
                    PermanentCard permanent = new PermanentCard(this, ownerId);
                    game.resetForSourceId(permanent.getId());
                    game.addPermanent(permanent);
                    game.setZone(objectId, Zone.BATTLEFIELD);
                    game.setScopeRelevant(true);
                    game.applyEffects();
                    permanent.entersBattlefield(sourceId, game, event.getFromZone(), true);
                    game.setScopeRelevant(false);
                    game.applyEffects();
                    if (flag) {
                        permanent.setTapped(true);
                    }
                    event.setTarget(permanent);
                    break;
                default:
                    Card sourceCard = game.getCard(sourceId);
View Full Code Here

                if (!removed) {
                    logger.warn("Couldn't find card in fromZone, card=" + getName() + ", fromZone=" + fromZone);
                }
            }
            updateZoneChangeCounter();
            PermanentCard permanent = new PermanentCard(this, controllerId);
            // reset is done to end continuous effects from previous instances of that permanent (e.g undying)
            game.resetForSourceId(permanent.getId());
            // make sure the controller of all continuous effects of this card are switched to the current controller
            game.getContinuousEffects().setController(objectId, controllerId);
            game.addPermanent(permanent);
            game.setZone(objectId, Zone.BATTLEFIELD);
            game.setScopeRelevant(true);
            permanent.setTapped(tapped);
            permanent.entersBattlefield(sourceId, game, event.getFromZone(), true);
            game.setScopeRelevant(false);
            game.applyEffects();
            game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD));
            return true;
        }
View Full Code Here

        if (object != null && !object.getAbilities().contains(this)) {
            boolean found = false;
            // unfortunately we need to handle double faced cards separately and only this way
            if (object instanceof PermanentCard && ((PermanentCard)object).canTransform()) {
                PermanentCard permanent = (PermanentCard)object;
                found = permanent.getSecondCardFace().getAbilities().contains(this) || permanent.getCard().getAbilities().contains(this);
            }
            if (!found) {
                return false;
            }
        }
View Full Code Here

                    break;
                default:
            }
            game.rememberLKI(card.getId(), fromZone, card);

            PermanentCard permanent = new PermanentCard(card, card.getOwnerId());
            game.getBattlefield().addPermanent(permanent);
            game.setZone(card.getId(), Zone.BATTLEFIELD);
            game.applyEffects();
            permanent.entersBattlefield(event.getSourceId(), game, fromZone, true);
            game.applyEffects();
            game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD));

            if (targetPermanent != null) {
                targetPermanent.addAttachment(permanent.getId(), game);
            }
            if (targetPlayer != null) {
                targetPlayer.addAttachment(permanent.getId(), game);
            }
        }
        return true;
    }
View Full Code Here

    private boolean checkAbilityStillExists(TriggeredAbility ability, GameEvent event, MageObject object) {
        boolean exists = true;
        if (!object.getAbilities().contains(ability)) {
            exists = false;
            if (object instanceof PermanentCard) {
                PermanentCard permanent = (PermanentCard)object;
                if (permanent.canTransform() && event.getType() == GameEvent.EventType.TRANSFORMED) {
                    exists = permanent.getCard().getAbilities().contains(ability);
                }
            }
        }
        return exists;
    }
View Full Code Here

    public void filter(Game game, List<Ability> actions) {
        for (Ability ability : actions) {
            if (ability instanceof LevelUpAbility) {
                Permanent permanent = game.getPermanent(ability.getSourceId());
                if (permanent != null && permanent instanceof PermanentCard) {
                    PermanentCard leveler = (PermanentCard) permanent;
                    // check already existing Level counters and compare to maximum that make sense
                    if (permanent.getCounters().getCount(CounterType.LEVEL) >= leveler.getMaxLevelCounters()) {
                        removeAbility(ability);
                    }
                }
            }
        }
View Full Code Here

                CardInfo cardInfo = CardRepository.instance.findCard(cardName);
                Card card = cardInfo != null ? cardInfo.getCard() : null;
                if (card == null) {
                    throw new IllegalArgumentException("[TEST] Couldn't find a card: " + cardName);
                }
                PermanentCard p = new PermanentCard(card, null);
                p.setTapped(tapped);
                getBattlefieldCards(player).add(p);
            }
        } else {
            if (tapped) {
                throw new IllegalArgumentException("Parameter tapped=true can be used only for Zone.BATTLEFIELD.");
View Full Code Here

TOP

Related Classes of mage.game.permanent.PermanentCard

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.