diff --git a/Mage.Sets/src/mage/cards/b/BoilingRockRioter.java b/Mage.Sets/src/mage/cards/b/BoilingRockRioter.java new file mode 100644 index 00000000000..3c703be49a6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BoilingRockRioter.java @@ -0,0 +1,104 @@ +package mage.cards.b; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapTargetCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTargetForSourceEffect; +import mage.abilities.keyword.FirebendingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterCard; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.permanent.TappedPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInGraveyard; +import mage.util.CardUtil; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BoilingRockRioter extends CardImpl { + + private static final FilterControlledPermanent filter + = new FilterControlledPermanent(SubType.ALLY, "untaped Ally you control"); + + static { + filter.add(TappedPredicate.UNTAPPED); + } + + public BoilingRockRioter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ROGUE); + this.subtype.add(SubType.ALLY); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Firebending 1 + this.addAbility(new FirebendingAbility(1)); + + // Tap an untapped Ally you control: Exile target card from a graveyard. + Ability ability = new SimpleActivatedAbility(new ExileTargetForSourceEffect(), new TapTargetCost(filter)); + ability.addTarget(new TargetCardInGraveyard()); + this.addAbility(ability); + + // Whenever this creature attacks, you may cast an Ally spell from among cards you own exiled with this creature. + this.addAbility(new AttacksTriggeredAbility(new BoilingRockRioterEffect())); + } + + private BoilingRockRioter(final BoilingRockRioter card) { + super(card); + } + + @Override + public BoilingRockRioter copy() { + return new BoilingRockRioter(this); + } +} + +class BoilingRockRioterEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard(SubType.ALLY); + + BoilingRockRioterEffect() { + super(Outcome.Benefit); + staticText = "you may cast an Ally spell from among cards you own exiled with this creature"; + } + + private BoilingRockRioterEffect(final BoilingRockRioterEffect effect) { + super(effect); + } + + @Override + public BoilingRockRioterEffect copy() { + return new BoilingRockRioterEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = Optional + .ofNullable(CardUtil.getExileZoneId(game, source)) + .map(game.getExile()::getExileZone) + .map(CardsImpl::new) + .orElseGet(CardsImpl::new); + cards.removeIf(uuid -> !source.isControlledBy(game.getOwnerId(uuid))); + return CardUtil.castSpellWithAttributesForFree(player, source, game, cards, filter); + } +} diff --git a/Mage.Sets/src/mage/sets/AvatarTheLastAirbender.java b/Mage.Sets/src/mage/sets/AvatarTheLastAirbender.java index 896c281f1a4..9f816c5bd48 100644 --- a/Mage.Sets/src/mage/sets/AvatarTheLastAirbender.java +++ b/Mage.Sets/src/mage/sets/AvatarTheLastAirbender.java @@ -64,6 +64,8 @@ public final class AvatarTheLastAirbender extends ExpansionSet { cards.add(new SetCardInfo("Benevolent River Spirit", 45, Rarity.UNCOMMON, mage.cards.b.BenevolentRiverSpirit.class)); cards.add(new SetCardInfo("Boar-q-pine", 124, Rarity.COMMON, mage.cards.b.BoarQPine.class)); cards.add(new SetCardInfo("Boiling Rock Prison", 267, Rarity.COMMON, mage.cards.b.BoilingRockPrison.class)); + cards.add(new SetCardInfo("Boiling Rock Rioter", 372, Rarity.RARE, mage.cards.b.BoilingRockRioter.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Boiling Rock Rioter", 87, Rarity.RARE, mage.cards.b.BoilingRockRioter.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Boomerang Basics", 46, Rarity.UNCOMMON, mage.cards.b.BoomerangBasics.class)); cards.add(new SetCardInfo("Bumi Bash", 125, Rarity.COMMON, mage.cards.b.BumiBash.class)); cards.add(new SetCardInfo("Bumi, Unleashed", 211, Rarity.MYTHIC, mage.cards.b.BumiUnleashed.class, NON_FULL_USE_VARIOUS));