mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
[STX] Implemented Pop Quiz
This commit is contained in:
parent
4e4bc6de7a
commit
6d99f28bef
5 changed files with 132 additions and 49 deletions
34
Mage.Sets/src/mage/cards/p/PopQuiz.java
Normal file
34
Mage.Sets/src/mage/cards/p/PopQuiz.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.LearnEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PopQuiz extends CardImpl {
|
||||
|
||||
public PopQuiz(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}");
|
||||
|
||||
// Draw a card.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
|
||||
|
||||
// Learn.
|
||||
this.getSpellAbility().addEffect(new LearnEffect().concatBy("<br>"));
|
||||
}
|
||||
|
||||
private PopQuiz(final PopQuiz card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PopQuiz copy() {
|
||||
return new PopQuiz(this);
|
||||
}
|
||||
}
|
|
@ -31,6 +31,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Eager First-Year", 16, Rarity.COMMON, mage.cards.e.EagerFirstYear.class));
|
||||
cards.add(new SetCardInfo("Kasmina, Enigma Sage", 196, Rarity.MYTHIC, mage.cards.k.KasminaEnigmaSage.class));
|
||||
cards.add(new SetCardInfo("Lorehold Command", 199, Rarity.RARE, mage.cards.l.LoreholdCommand.class));
|
||||
cards.add(new SetCardInfo("Pop Quiz", 49, Rarity.COMMON, mage.cards.p.PopQuiz.class));
|
||||
cards.add(new SetCardInfo("Prismari Command", 214, Rarity.RARE, mage.cards.p.PrismariCommand.class));
|
||||
cards.add(new SetCardInfo("Professor Onyx", 83, Rarity.MYTHIC, mage.cards.p.ProfessorOnyx.class));
|
||||
cards.add(new SetCardInfo("Quandrix Command", 217, Rarity.RARE, mage.cards.q.QuandrixCommand.class));
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.common.DiscardCardCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class LearnEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("Lesson card");
|
||||
|
||||
static {
|
||||
filter.add(SubType.LESSON.getPredicate());
|
||||
}
|
||||
|
||||
public LearnEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "learn. <i>(You may reveal a Lesson card you own from outside the game " +
|
||||
"and put it into your hand, or discard a card to draw a card.)</i>";
|
||||
}
|
||||
|
||||
private LearnEffect(final LearnEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
return new WishEffect(filter, true).apply(game, source)
|
||||
|| new DoIfCostPaid(
|
||||
new DrawCardSourceControllerEffect(1), new DiscardCardCost()
|
||||
).apply(game, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LearnEffect copy() {
|
||||
return new LearnEffect(this);
|
||||
}
|
||||
}
|
|
@ -84,57 +84,58 @@ public class WishEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null && sourceObject != null) {
|
||||
if (controller.chooseUse(Outcome.Benefit, choiceText, source, game)) {
|
||||
Cards cards = controller.getSideboard();
|
||||
List<Card> exile = game.getExile().getAllCards(game);
|
||||
boolean noTargets = cards.isEmpty() && (!alsoFromExile || exile.isEmpty());
|
||||
if (noTargets) {
|
||||
game.informPlayer(controller, "You have no cards outside the game" + (alsoFromExile ? " or in exile" : "") + '.');
|
||||
return true;
|
||||
}
|
||||
|
||||
Set<Card> filtered = cards.getCards(filter, game);
|
||||
Cards filteredCards = new CardsImpl();
|
||||
for (Card card : filtered) {
|
||||
filteredCards.add(card.getId());
|
||||
}
|
||||
if (alsoFromExile) {
|
||||
for (Card exileCard : exile) {
|
||||
if (exileCard.isOwnedBy(source.getControllerId()) && filter.match(exileCard, game)) {
|
||||
filteredCards.add(exileCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (filteredCards.isEmpty()) {
|
||||
game.informPlayer(controller, "You don't have " + filter.getMessage() + " outside the game" + (alsoFromExile ? " or in exile" : "") + '.');
|
||||
return true;
|
||||
}
|
||||
|
||||
TargetCard target = new TargetCard(Zone.ALL, filter);
|
||||
target.setNotTarget(true);
|
||||
if (controller.choose(Outcome.Benefit, filteredCards, target, game)) {
|
||||
Card card = controller.getSideboard().get(target.getFirstTarget(), game);
|
||||
if (card == null && alsoFromExile) {
|
||||
card = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
if (card != null) {
|
||||
if (topOfLibrary) {
|
||||
controller.putCardsOnTopOfLibrary(card, game, source, true);
|
||||
} else {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
if (reveal) {
|
||||
Cards revealCard = new CardsImpl();
|
||||
revealCard.add(card);
|
||||
controller.revealCards(sourceObject.getIdName(), revealCard, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.chooseUse(Outcome.Benefit, choiceText, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = controller.getSideboard();
|
||||
List<Card> exile = game.getExile().getAllCards(game);
|
||||
boolean noTargets = cards.isEmpty() && (!alsoFromExile || exile.isEmpty());
|
||||
if (noTargets) {
|
||||
game.informPlayer(controller, "You have no cards outside the game" + (alsoFromExile ? " or in exile" : "") + '.');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Set<Card> filtered = cards.getCards(filter, game);
|
||||
Cards filteredCards = new CardsImpl();
|
||||
for (Card card : filtered) {
|
||||
filteredCards.add(card.getId());
|
||||
}
|
||||
if (alsoFromExile) {
|
||||
for (Card exileCard : exile) {
|
||||
if (exileCard.isOwnedBy(source.getControllerId()) && filter.match(exileCard, game)) {
|
||||
filteredCards.add(exileCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (filteredCards.isEmpty()) {
|
||||
game.informPlayer(controller, "You don't have " + filter.getMessage() + " outside the game" + (alsoFromExile ? " or in exile" : "") + '.');
|
||||
return true;
|
||||
}
|
||||
|
||||
TargetCard target = new TargetCard(Zone.ALL, filter);
|
||||
target.setNotTarget(true);
|
||||
if (controller.choose(Outcome.Benefit, filteredCards, target, game)) {
|
||||
Card card = controller.getSideboard().get(target.getFirstTarget(), game);
|
||||
if (card == null && alsoFromExile) {
|
||||
card = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
if (card != null) {
|
||||
if (topOfLibrary) {
|
||||
controller.putCardsOnTopOfLibrary(card, game, source, true);
|
||||
} else {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
if (reveal) {
|
||||
Cards revealCard = new CardsImpl();
|
||||
revealCard.add(card);
|
||||
controller.revealCards(sourceObject.getIdName(), revealCard, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ public enum SubType {
|
|||
//205.3k Instants and sorceries share their lists of subtypes; these subtypes are called spell types.
|
||||
ADVENTURE("Adventure", SubTypeSet.SpellType),
|
||||
ARCANE("Arcane", SubTypeSet.SpellType),
|
||||
LESSON("Lesson", SubTypeSet.SpellType),
|
||||
TRAP("Trap", SubTypeSet.SpellType),
|
||||
// 205.3i: Lands have their own unique set of subtypes; these subtypes are called land types.
|
||||
// Of that list, Forest, Island, Mountain, Plains, and Swamp are the basic land types.
|
||||
|
|
Loading…
Reference in a new issue