Implemented Rysorian Badger

This commit is contained in:
Evan Kranzler 2018-06-23 22:38:04 -04:00
parent 2a704784cb
commit 595ead66a7
2 changed files with 106 additions and 0 deletions

View file

@ -0,0 +1,105 @@
package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksAndIsNotBlockedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.AssignNoCombatDamageSourceEffect;
import mage.cards.Card;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.permanent.DefendingPlayerOwnsCardPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInGraveyard;
/**
*
* @author TheElk801
*/
public final class RysorianBadger extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("creature cards from defending player's graveyard");
static {
filter.add(new DefendingPlayerOwnsCardPredicate());
}
public RysorianBadger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.subtype.add(SubType.BADGER);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever Rysorian Badger attacks and isn't blocked, you may exile up to two target creature cards from defending player's graveyard. If you do, you gain 1 life for each card exiled this way and Rysorian Badger assigns no combat damage this turn.
Ability ability = new AttacksAndIsNotBlockedTriggeredAbility(
new RysorianBadgerEffect(), true
);
ability.addTarget(new TargetCardInGraveyard(0, 2, filter));
this.addAbility(ability);
}
public RysorianBadger(final RysorianBadger card) {
super(card);
}
@Override
public RysorianBadger copy() {
return new RysorianBadger(this);
}
}
class RysorianBadgerEffect extends OneShotEffect {
public RysorianBadgerEffect() {
super(Outcome.Benefit);
this.staticText = "you may exile up to two target creature cards "
+ "from defending player's graveyard. If you do, "
+ "you gain 1 life for each card exiled this way "
+ "and {this} assigns no combat damage this turn.";
}
public RysorianBadgerEffect(final RysorianBadgerEffect effect) {
super(effect);
}
@Override
public RysorianBadgerEffect copy() {
return new RysorianBadgerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cardsToExile = new CardsImpl();
for (UUID cardId : this.getTargetPointer().getTargets(game, source)) {
Card card = game.getCard(cardId);
if (card != null) {
cardsToExile.add(card);
}
}
int cardsExiled = 0;
player.moveCardsToExile(cardsToExile.getCards(game), source, game, false, null, null);
for (Card card : cardsToExile.getCards(game)) {
if (game.getState().getZone(card.getId()) == Zone.EXILED) {
cardsExiled++;
}
}
player.gainLife(cardsExiled, game, source);
game.addEffect(new AssignNoCombatDamageSourceEffect(Duration.EndOfTurn), source);
return true;
}
}

View file

@ -142,6 +142,7 @@ public final class Homelands extends ExpansionSet {
cards.add(new SetCardInfo("Root Spider", 94, Rarity.UNCOMMON, mage.cards.r.RootSpider.class)); cards.add(new SetCardInfo("Root Spider", 94, Rarity.UNCOMMON, mage.cards.r.RootSpider.class));
cards.add(new SetCardInfo("Roots", 95, Rarity.UNCOMMON, mage.cards.r.Roots.class)); cards.add(new SetCardInfo("Roots", 95, Rarity.UNCOMMON, mage.cards.r.Roots.class));
cards.add(new SetCardInfo("Roterothopter", 109, Rarity.COMMON, mage.cards.r.Roterothopter.class)); cards.add(new SetCardInfo("Roterothopter", 109, Rarity.COMMON, mage.cards.r.Roterothopter.class));
cards.add(new SetCardInfo("Rysorian Badger", 96, Rarity.RARE, mage.cards.r.RysorianBadger.class));
cards.add(new SetCardInfo("Samite Alchemist", 117, Rarity.COMMON, mage.cards.s.SamiteAlchemist.class)); cards.add(new SetCardInfo("Samite Alchemist", 117, Rarity.COMMON, mage.cards.s.SamiteAlchemist.class));
cards.add(new SetCardInfo("Sea Sprite", 38, Rarity.UNCOMMON, mage.cards.s.SeaSprite.class)); cards.add(new SetCardInfo("Sea Sprite", 38, Rarity.UNCOMMON, mage.cards.s.SeaSprite.class));
cards.add(new SetCardInfo("Sengir Autocrat", 56, Rarity.UNCOMMON, mage.cards.s.SengirAutocrat.class)); cards.add(new SetCardInfo("Sengir Autocrat", 56, Rarity.UNCOMMON, mage.cards.s.SengirAutocrat.class));