[AFR] Implemented Dragon's Disciple (#7965)

This commit is contained in:
Daniel Bomar 2021-07-04 09:08:37 -05:00 committed by GitHub
parent fc5e096ebf
commit 01c51f6939
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 109 additions and 0 deletions

View file

@ -0,0 +1,108 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.WardAbility;
import mage.cards.*;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
* @author weirddan455
*/
public final class DragonsDisciple extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent(SubType.DRAGON, "Dragons");
public DragonsDisciple(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.MONK);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// As Dragon's Disciple enters the battlefield, you may reveal a Dragon card from your hand. If you do, or if you control a Dragon, Dragon's Disciple enters the battlefield with a +1/+1 counter on it.
this.addAbility(new AsEntersBattlefieldAbility(new DragonsDiscipleEffect()));
// Dragons you control have ward {1}.
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
new WardAbility(new GenericManaCost(1)), Duration.WhileOnBattlefield, filter
)));
}
private DragonsDisciple(final DragonsDisciple card) {
super(card);
}
@Override
public DragonsDisciple copy() {
return new DragonsDisciple(this);
}
}
class DragonsDiscipleEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("Dragon card from your hand");
static {
filter.add(SubType.DRAGON.getPredicate());
}
public DragonsDiscipleEffect() {
super(Outcome.Benefit);
this.staticText = "you may reveal a Dragon card from your hand. If you do, or if you control a Dragon, {this} enters the battlefield with a +1/+1 counter on it";
}
private DragonsDiscipleEffect(final DragonsDiscipleEffect effect) {
super(effect);
}
@Override
public DragonsDiscipleEffect copy() {
return new DragonsDiscipleEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId());
if (controller != null && sourcePermanent != null) {
TargetCardInHand target = new TargetCardInHand(filter);
if (!target.possibleTargets(source.getSourceId(), source.getControllerId(), game).isEmpty()
&& controller.chooseUse(outcome, "Reveal a Dragon card from your hand?", source, game)
&& controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
Cards revealedCards = new CardsImpl(card);
controller.revealCards(source, sourcePermanent.getIdName(), revealedCards, game);
sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game);
return true;
}
}
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
if (permanent != null && permanent.hasSubtype(SubType.DRAGON, game)) {
sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game);
return true;
}
}
}
return false;
}
}

View file

@ -53,6 +53,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet {
cards.add(new SetCardInfo("Displacer Beast", 54, Rarity.UNCOMMON, mage.cards.d.DisplacerBeast.class));
cards.add(new SetCardInfo("Djinni Windseeker", 55, Rarity.COMMON, mage.cards.d.DjinniWindseeker.class));
cards.add(new SetCardInfo("Dragon Turtle", 56, Rarity.RARE, mage.cards.d.DragonTurtle.class));
cards.add(new SetCardInfo("Dragon's Disciple", 13, Rarity.UNCOMMON, mage.cards.d.DragonsDisciple.class));
cards.add(new SetCardInfo("Drizzt Do'Urden", 220, Rarity.RARE, mage.cards.d.DrizztDoUrden.class));
cards.add(new SetCardInfo("Dueling Rapier", 140, Rarity.COMMON, mage.cards.d.DuelingRapier.class));
cards.add(new SetCardInfo("Dungeon Crawler", 99, Rarity.UNCOMMON, mage.cards.d.DungeonCrawler.class));