mirror of
https://github.com/correl/mage.git
synced 2025-04-12 17:00:08 -09:00
[STX] Implemented Elite Spellbinder
This commit is contained in:
parent
29f7555ac3
commit
c112fffadf
3 changed files with 164 additions and 1 deletions
Mage.Sets/src/mage
162
Mage.Sets/src/mage/cards/e/EliteSpellbinder.java
Normal file
162
Mage.Sets/src/mage/cards/e/EliteSpellbinder.java
Normal file
|
@ -0,0 +1,162 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class EliteSpellbinder extends CardImpl {
|
||||
|
||||
public EliteSpellbinder(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.CLERIC);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Elite Spellbinder enters the battlefield, look at target opponent's hand. You may exile a nonland card from it. For as long as that card remains exiled, its owner may play it. A spell cast this way costs {2} more to cast.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new EliteSpellbinderEffect());
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private EliteSpellbinder(final EliteSpellbinder card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EliteSpellbinder copy() {
|
||||
return new EliteSpellbinder(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EliteSpellbinderEffect extends OneShotEffect {
|
||||
|
||||
EliteSpellbinderEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "look at target opponent's hand. You may exile a nonland card from it. " +
|
||||
"For as long as that card remains exiled, its owner may play it. " +
|
||||
"A spell cast this way costs {2} more to cast";
|
||||
}
|
||||
|
||||
private EliteSpellbinderEffect(final EliteSpellbinderEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EliteSpellbinderEffect copy() {
|
||||
return new EliteSpellbinderEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player opponent = game.getPlayer(source.getFirstTarget());
|
||||
if (controller == null || opponent == null || opponent.getHand().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
TargetCard target = new TargetCardInHand(
|
||||
0, 1, StaticFilters.FILTER_CARD_A_NON_LAND
|
||||
);
|
||||
controller.choose(outcome, opponent.getHand(), target, game);
|
||||
Card card = opponent.getHand().get(target.getFirstTarget(), game);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
game.addEffect(new EliteSpellbinderCastEffect(card, game), source);
|
||||
game.addEffect(new EliteSpellbinderCostEffect(card, game), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class EliteSpellbinderCastEffect extends AsThoughEffectImpl {
|
||||
|
||||
private final MageObjectReference mor;
|
||||
|
||||
public EliteSpellbinderCastEffect(Card card, Game game) {
|
||||
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
|
||||
this.mor = new MageObjectReference(card, game);
|
||||
}
|
||||
|
||||
private EliteSpellbinderCastEffect(final EliteSpellbinderCastEffect effect) {
|
||||
super(effect);
|
||||
this.mor = effect.mor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EliteSpellbinderCastEffect copy() {
|
||||
return new EliteSpellbinderCastEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||
Card card = mor.getCard(game);
|
||||
if (card == null) {
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
return mor.refersTo(CardUtil.getMainCardId(game, sourceId), game)
|
||||
&& card.isOwnedBy(affectedControllerId);
|
||||
}
|
||||
}
|
||||
|
||||
class EliteSpellbinderCostEffect extends CostModificationEffectImpl {
|
||||
|
||||
private final MageObjectReference mor;
|
||||
|
||||
EliteSpellbinderCostEffect(Card card, Game game) {
|
||||
super(Duration.Custom, Outcome.Benefit, CostModificationType.INCREASE_COST);
|
||||
mor = new MageObjectReference(card, game, 1);
|
||||
}
|
||||
|
||||
private EliteSpellbinderCostEffect(EliteSpellbinderCostEffect effect) {
|
||||
super(effect);
|
||||
this.mor = effect.mor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
CardUtil.increaseCost(abilityToModify, 2);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
return mor.refersTo(CardUtil.getMainCardId(game, abilityToModify.getSourceId()), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EliteSpellbinderCostEffect copy() {
|
||||
return new EliteSpellbinderCostEffect(this);
|
||||
}
|
||||
}
|
|
@ -118,7 +118,7 @@ class MavindaStudentsAdvocateCostEffect extends CostModificationEffectImpl {
|
|||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
return abilityToModify instanceof SpellAbility
|
||||
&& abilityToModify.isControlledBy(source.getControllerId())
|
||||
&& mor.refersTo(((SpellAbility) abilityToModify).getCharacteristics(game), game)
|
||||
&& mor.refersTo(CardUtil.getMainCardId(game, abilityToModify.getSourceId()), game)
|
||||
&& abilityToModify
|
||||
.getTargets()
|
||||
.stream()
|
||||
|
|
|
@ -102,6 +102,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Elemental Expressionist", 181, Rarity.RARE, mage.cards.e.ElementalExpressionist.class));
|
||||
cards.add(new SetCardInfo("Elemental Masterpiece", 182, Rarity.COMMON, mage.cards.e.ElementalMasterpiece.class));
|
||||
cards.add(new SetCardInfo("Elemental Summoning", 183, Rarity.COMMON, mage.cards.e.ElementalSummoning.class));
|
||||
cards.add(new SetCardInfo("Elite Spellbinder", 17, Rarity.RARE, mage.cards.e.EliteSpellbinder.class));
|
||||
cards.add(new SetCardInfo("Emergent Sequence", 129, Rarity.UNCOMMON, mage.cards.e.EmergentSequence.class));
|
||||
cards.add(new SetCardInfo("Enthusiastic Study", 99, Rarity.COMMON, mage.cards.e.EnthusiasticStudy.class));
|
||||
cards.add(new SetCardInfo("Environmental Sciences", 1, Rarity.COMMON, mage.cards.e.EnvironmentalSciences.class));
|
||||
|
|
Loading…
Add table
Reference in a new issue