Implemented Sunder Shaman

This commit is contained in:
Evan Kranzler 2019-01-09 23:33:37 -05:00
parent da2cd9ddc6
commit 5bf0fd89c2
2 changed files with 93 additions and 0 deletions

View file

@ -0,0 +1,92 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByMoreThanOneSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SunderShaman extends CardImpl {
public SunderShaman(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{R}{G}{G}");
this.subtype.add(SubType.GIANT);
this.subtype.add(SubType.SHAMAN);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Sunder Shaman can't be blocked by more than one creature.
this.addAbility(new SimpleStaticAbility(new CantBeBlockedByMoreThanOneSourceEffect()));
// Whenever Sunder Shaman deals combat damage to a player, destroy target artifact or enchantment that player controls.
this.addAbility(new SunderShamanTriggeredAbility());
}
private SunderShaman(final SunderShaman card) {
super(card);
}
@Override
public SunderShaman copy() {
return new SunderShaman(this);
}
}
class SunderShamanTriggeredAbility extends TriggeredAbilityImpl {
SunderShamanTriggeredAbility() {
super(Zone.BATTLEFIELD, new DestroyTargetEffect(), false);
}
private SunderShamanTriggeredAbility(final SunderShamanTriggeredAbility ability) {
super(ability);
}
@Override
public SunderShamanTriggeredAbility copy() {
return new SunderShamanTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null && event.getSourceId().equals(this.sourceId)) {
FilterPermanent filter = StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT.copy();
filter.setMessage("artifact or enchantment controlled by" + opponent.getLogName());
filter.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetPermanent(filter));
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} deals combat damage to a player, "
+ "destroy target artifact or enchantment that player controls.";
}
}

View file

@ -161,6 +161,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("Sphinx's Insight", 209, Rarity.COMMON, mage.cards.s.SphinxsInsight.class));
cards.add(new SetCardInfo("Spirit of the Spires", 23, Rarity.UNCOMMON, mage.cards.s.SpiritOfTheSpires.class));
cards.add(new SetCardInfo("Stomping Ground", 259, Rarity.RARE, mage.cards.s.StompingGround.class));
cards.add(new SetCardInfo("Sunder Shaman", 210, Rarity.UNCOMMON, mage.cards.s.SunderShaman.class));
cards.add(new SetCardInfo("Syndicate Guildmage", 211, Rarity.UNCOMMON, mage.cards.s.SyndicateGuildmage.class));
cards.add(new SetCardInfo("Teysa Karlov", 212, Rarity.RARE, mage.cards.t.TeysaKarlov.class));
cards.add(new SetCardInfo("The Haunt of Hightower", 273, Rarity.MYTHIC, mage.cards.t.TheHauntOfHightower.class));