mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
[STX] Implemented Ingenious Mastery
This commit is contained in:
parent
f37628c5cb
commit
63ae80c711
2 changed files with 91 additions and 0 deletions
90
Mage.Sets/src/mage/cards/i/IngeniousMastery.java
Normal file
90
Mage.Sets/src/mage/cards/i/IngeniousMastery.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.TreasureToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class IngeniousMastery extends CardImpl {
|
||||
|
||||
public IngeniousMastery(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{2}{U}");
|
||||
|
||||
// You may pay {2}{U} rather than pay this spell's mana cost.
|
||||
Ability costAbility = new AlternativeCostSourceAbility(new ManaCostsImpl<>("{2}{U}"));
|
||||
this.addAbility(costAbility);
|
||||
|
||||
// If the {2}{U} cost was paid, you draw three cards, then an opponent creates two Treasure tokens and they scry 2. If that cost wasn't paid, you draw X cards.
|
||||
this.getSpellAbility().addEffect(new IngeniousMasteryEffect(costAbility.getOriginalId()));
|
||||
}
|
||||
|
||||
private IngeniousMastery(final IngeniousMastery card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IngeniousMastery copy() {
|
||||
return new IngeniousMastery(this);
|
||||
}
|
||||
}
|
||||
|
||||
class IngeniousMasteryEffect extends OneShotEffect {
|
||||
|
||||
private final UUID alternativeCostOriginalID;
|
||||
|
||||
IngeniousMasteryEffect(UUID alternativeCostOriginalID) {
|
||||
super(Outcome.Detriment);
|
||||
staticText = "if the {2}{U} cost was paid, you draw three cards, then an opponent creates " +
|
||||
"two Treasure tokens and they scry 2. If that cost wasn't paid, you draw X cards";
|
||||
this.alternativeCostOriginalID = alternativeCostOriginalID;
|
||||
}
|
||||
|
||||
private IngeniousMasteryEffect(IngeniousMasteryEffect effect) {
|
||||
super(effect);
|
||||
this.alternativeCostOriginalID = effect.alternativeCostOriginalID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IngeniousMasteryEffect copy() {
|
||||
return new IngeniousMasteryEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (!AlternativeCostSourceAbility.getActivatedStatus(
|
||||
game, source, this.alternativeCostOriginalID, false
|
||||
)) {
|
||||
return player.drawCards(source.getManaCostsToPay().getX(), source, game) > 0;
|
||||
}
|
||||
|
||||
player.drawCards(3, source, game);
|
||||
TargetOpponent targetOpponent = new TargetOpponent(true);
|
||||
if (!player.chooseTarget(Outcome.DrawCard, targetOpponent, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Player opponent = game.getPlayer(targetOpponent.getFirstTarget());
|
||||
if (opponent == null) {
|
||||
return false;
|
||||
}
|
||||
new TreasureToken().putOntoBattlefield(2, game, source, opponent.getId());
|
||||
opponent.scry(2, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -141,6 +141,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Illuminate History", 108, Rarity.RARE, mage.cards.i.IlluminateHistory.class));
|
||||
cards.add(new SetCardInfo("Illustrious Historian", 109, Rarity.COMMON, mage.cards.i.IllustriousHistorian.class));
|
||||
cards.add(new SetCardInfo("Infuse with Vitality", 194, Rarity.COMMON, mage.cards.i.InfuseWithVitality.class));
|
||||
cards.add(new SetCardInfo("Ingenious Mastery", 44, Rarity.RARE, mage.cards.i.IngeniousMastery.class));
|
||||
cards.add(new SetCardInfo("Inkling Summoning", 195, Rarity.COMMON, mage.cards.i.InklingSummoning.class));
|
||||
cards.add(new SetCardInfo("Introduction to Annihilation", 3, Rarity.COMMON, mage.cards.i.IntroductionToAnnihilation.class));
|
||||
cards.add(new SetCardInfo("Introduction to Prophecy", 4, Rarity.COMMON, mage.cards.i.IntroductionToProphecy.class));
|
||||
|
|
Loading…
Reference in a new issue