Package mage.players

Examples of mage.players.Player.cast()


  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Card target = (Card) game.getObject(source.getFirstTarget());
    return controller.cast(target.getSpellAbility(), game, true);
  }

  @Override
  public String getText(Ability source) {
    return "you may put " + source.getTargets().get(0).getTargetName() + " from your hand onto the battlefield";
View Full Code Here


      card.moveToExile(exile.getId(), exile.getName(), source.getId(), game);
    } while (card.getCardType().contains(CardType.LAND) || card.getManaCost().convertedManaCost() >= sourceCost);

    if (card != null) {
      if (player.chooseUse(outcome, "Use cascade effect on " + card.getName() + "?", game)) {
        player.cast(card.getSpellAbility(), game, true);
        exile.remove(card.getId());
      }
    }

    while (exile.size() > 0) {
View Full Code Here

      player.revealCards(cards, game);
      if (card.getCardType().contains(CardType.LAND)) {
        card.putOntoBattlefield(game, Zone.HAND, source.getId(), player.getId());
      }
      else {
        player.cast(card.getSpellAbility(), game, true);
      }
      return true;
    }
    return false;
  }
View Full Code Here

            while (!cards.isEmpty() && player.chooseUse(outcome, message, game)) {
                target.clearChosen();
                if (player.choose(outcome, target, source.getSourceId(), game)) {
                    Card card = game.getCard(target.getFirstTarget());
                    if (card != null) {
                        player.cast(card.getSpellAbility(), game, true);
                        player.getGraveyard().remove(card);
                        cards.remove(card);
                    }
                }
            }
View Full Code Here

                    // The land's last ability allows you to play the removed card as part of the resolution of that ability.
                    // Timing restrictions based on the card's type are ignored (for instance, if it's a creature or sorcery).
                    // Other play restrictions are not (such as "Play [this card] only during combat").
                    if (controller.chooseUse(Outcome.Benefit, new StringBuilder("Cast ").append(card.getName()).append(" without paying it's mana cost?").toString(), game)) {
                        card.setFaceDown(false);
                        return controller.cast(card.getSpellAbility(), game, true);
                    }
                } else {
                    Logger.getLogger(HideawayPlayEffect.class).error("Non land card had no spell ability: " + card.getName());
                    return false;
                }
View Full Code Here

        if (controller != null && card != null) {
            ManaCosts<ManaCost> costRef = card.getSpellAbility().getManaCostsToPay();
            // replace with the new cost
            costRef.clear();
            costRef.add(miracleCosts);
            controller.cast(card.getSpellAbility(), game, false);

            // Reset the casting costs (in case the player cancels cast and plays the card later)
            costRef.clear();
            for (ManaCost manaCost : card.getSpellAbility().getManaCosts()) {
                costRef.add(manaCost);
View Full Code Here

                game.getState().getContinuousEffects().removeGainedEffectsForSource(card.getId());
                // remove the abilities from the card
                card.getAbilities().removeAll(abilitiesToRemove);
            }
            // cast the card for free
            return player.cast(card.getSpellAbility(), game, true);
        }
        return false;
    }
}
View Full Code Here

            TargetCard target = new TargetCard(Zone.PICK, filterCard);
            if (player.choose(Outcome.Benefit, filteredCards, target, game)) {
                Card card = player.getSideboard().get(target.getFirstTarget(), game);
                if (card != null) {
                    player.cast(card.getSpellAbility(), game, true);
                }
            }
        }

        return true;
View Full Code Here

            Player controller = game.getPlayer(source.getControllerId());
            if (controller != null) {
                card.getSpellAbility().clear();
                int amount = source.getManaCostsToPay().getX();
                card.getSpellAbility().getManaCostsToPay().setX(amount);
                return controller.cast(card.getSpellAbility(), game, true);
            }
        }
        return false;
    }
}
View Full Code Here

                    }
                    spellAbility.getManaCostsToPay().setX(amount);
                }
                game.informPlayers(new StringBuilder(controller.getName()).append(" flashbacks ").append(card.getName()).toString());
                spellAbility.setCostModificationActive(false); // prevents to apply cost modification twice for flashbacked spells
                return controller.cast(spellAbility, game, true);
            }
        }
        return false;
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.