forked from External/mage
Reworking effects which allow casting spells from a selection of cards (ready for review) (#8136)
* added function for casting spells with specific attributes from a selection of cards * updated cascade to use new method * refactored various cards to use new methods * added TestPlayer method * fixed a small error * text fix * broke out some repeated code * added missing notTarget setting * add additional retain zone check * some more cards refactored * more refactoring * added interface for split/modal cards * reworked spell casting methods * reworked multiple cast to prevent unnecessary dialogs * fixed test failures due to change in functionality * add AI code * small nonfunctional change * reworked Kaya, the Inexorable * added currently failing test * added more tests * updated Geode Golem implementation * fixed adventure/cascade interaction, added/updated tests * some nonfunctional refactoring * added interface for subcards * [AFC] Implemented Fevered Suspicion * [AFC] Implemented Extract Brain * [AFC] updated Arcane Endeavor implementation * [C17] reworked implementation of Izzet Chemister * [ZEN] reworked implemented of Chandra Ablaze * additional merge fix * [SLD] updated Eleven, the Mage * [NEO] Implemented Discover the Impossible * [NEO] Implemented The Dragon-Kami Reborn / Dragon-Kami's Egg * [NEO] Implemented Invoke Calamity * [AFR] Implemented Rod of Absorption * [VOC] Implemented Spectral Arcanist * [VOC] added additional printings * [NEO] added all variants * [SLD] updated implementation of Ken, Burning Brawler
This commit is contained in:
parent
7fb089db48
commit
bbb9382150
83 changed files with 2551 additions and 2059 deletions
|
|
@ -1,48 +1,51 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.ApprovingObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.*;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterOwnedCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInExile;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public class KayaTheInexorableEmblem extends Emblem {
|
||||
public class KayaTheInexorableEmblem extends Emblem {
|
||||
|
||||
// −7: You get an emblem with "At the beginning of your upkeep, you may cast a legendary spell from your hand, from your graveyard, or from among cards you own in exile without paying its mana cost."
|
||||
public KayaTheInexorableEmblem() {
|
||||
|
||||
this.setName("Emblem Kaya");
|
||||
this.setExpansionSetCodeForImage("KHM");
|
||||
this.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(Zone.COMMAND, new KayaTheInexorableEmblemEffect(), TargetController.YOU, true, false));
|
||||
this.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(
|
||||
Zone.COMMAND, new KayaTheInexorableEmblemEffect(),
|
||||
TargetController.YOU, true, false
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
class KayaTheInexorableEmblemEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterOwnedCard filter = new FilterOwnedCard();
|
||||
private static final FilterCard filter = new FilterOwnedCard();
|
||||
private static final FilterCard filter2 = new FilterCard();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
filter.add(SuperType.LEGENDARY.getPredicate());
|
||||
filter.add(Predicates.not(CardType.LAND.getPredicate()));
|
||||
filter2.add(SuperType.LEGENDARY.getPredicate());
|
||||
choices.add("Hand");
|
||||
choices.add("Graveyard");
|
||||
choices.add("Exile");
|
||||
|
|
@ -50,7 +53,8 @@ class KayaTheInexorableEmblemEffect extends OneShotEffect {
|
|||
|
||||
public KayaTheInexorableEmblemEffect() {
|
||||
super(Outcome.PlayForFree);
|
||||
this.staticText = "cast a legendary spell from your hand, from your graveyard, or from among cards you own in exile without paying its mana cost";
|
||||
this.staticText = "cast a legendary spell from your hand, from your graveyard, " +
|
||||
"or from among cards you own in exile without paying its mana cost";
|
||||
}
|
||||
|
||||
private KayaTheInexorableEmblemEffect(final KayaTheInexorableEmblemEffect effect) {
|
||||
|
|
@ -65,40 +69,26 @@ class KayaTheInexorableEmblemEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Choice zoneChoice = new ChoiceImpl(true);
|
||||
zoneChoice.setMessage("Cast a legendary spell from hand, graveyard, or exile");
|
||||
zoneChoice.setChoices(choices);
|
||||
zoneChoice.clearChoice();
|
||||
if (player.choose(Outcome.PlayForFree, zoneChoice, game)) {
|
||||
TargetCard target = null;
|
||||
switch (zoneChoice.getChoice()) {
|
||||
case "Hand":
|
||||
target = new TargetCardInHand(0, 1, filter);
|
||||
target.setTargetName("legendary spell from your hand");
|
||||
break;
|
||||
case "Graveyard":
|
||||
target = new TargetCardInYourGraveyard(0, 1, filter, true);
|
||||
target.setTargetName("legendary spell from your graveyard");
|
||||
break;
|
||||
case "Exile":
|
||||
target = new TargetCardInExile(0, 1, filter, null, true);
|
||||
target.setNotTarget(true);
|
||||
target.setTargetName("legendary spell you own in exile");
|
||||
break;
|
||||
}
|
||||
if (target != null && player.chooseTarget(Outcome.PlayForFree, target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||
boolean cardWasCast = player.cast(player.chooseAbilityForCast(card, game, true),
|
||||
game, true, new ApprovingObject(source, game));
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||
return cardWasCast;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
Choice zoneChoice = new ChoiceImpl(true);
|
||||
zoneChoice.setMessage("Cast a legendary spell from hand, graveyard, or exile");
|
||||
zoneChoice.setChoices(choices);
|
||||
zoneChoice.clearChoice();
|
||||
player.choose(Outcome.PlayForFree, zoneChoice, game);
|
||||
Cards cards = new CardsImpl();
|
||||
switch (zoneChoice.getChoice()) {
|
||||
case "Hand":
|
||||
cards.addAll(player.getHand());
|
||||
break;
|
||||
case "Graveyard":
|
||||
cards.addAll(player.getGraveyard());
|
||||
break;
|
||||
case "Exile":
|
||||
cards.addAll(game.getExile().getCards(filter, game));
|
||||
break;
|
||||
}
|
||||
return CardUtil.castSpellWithAttributesForFree(player, source, game, cards, filter2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue