[CMR] Implemented Bladegriff Prototype

This commit is contained in:
Evan Kranzler 2020-10-26 19:47:15 -04:00
parent de01517210
commit ac6577eafe
3 changed files with 106 additions and 1 deletions

View file

@ -0,0 +1,104 @@
package mage.cards.b;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.FlyingAbility;
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.common.FilterNonlandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author TheElk801
*/
public final class BladegriffPrototype extends CardImpl {
public BladegriffPrototype(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}");
this.subtype.add(SubType.GRIFFIN);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Bladegriff Prototype deals combat damage to a player, destroy target nonland permanent of that player's choice that one of your opponents controls.
this.addAbility(new BladegriffPrototypeAbility());
}
private BladegriffPrototype(final BladegriffPrototype card) {
super(card);
}
@Override
public BladegriffPrototype copy() {
return new BladegriffPrototype(this);
}
}
class BladegriffPrototypeAbility extends TriggeredAbilityImpl {
BladegriffPrototypeAbility() {
super(Zone.BATTLEFIELD, new DestroyTargetEffect(), false);
}
private BladegriffPrototypeAbility(final BladegriffPrototypeAbility ability) {
super(ability);
}
@Override
public BladegriffPrototypeAbility copy() {
return new BladegriffPrototypeAbility(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 player = game.getPlayer(getControllerId());
if (player == null
|| !event.getSourceId().equals(this.sourceId)
|| !((DamagedEvent) event).isCombatDamage()) {
return false;
}
FilterPermanent filter = new FilterNonlandPermanent(
"nonland permanent controlled by an opponent of " + player.getName()
);
filter.add(Predicates.or(
game.getOpponents(getControllerId())
.stream()
.map(ControllerIdPredicate::new)
.collect(Collectors.toSet())
));
TargetPermanent target = new TargetPermanent(filter);
target.setTargetController(event.getPlayerId());
this.getTargets().clear();
this.addTarget(target);
return true;
}
@Override
public String getRule() {
return "Whenever {this} deals combat damage to a player, " +
"destroy target nonland permanent of that player's choice " +
"that one of your opponents controls.";
}
}

View file

@ -91,6 +91,6 @@ class BlindZealotTriggeredAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
return "Whenever {this} deals combat damage to a player, you may sacrifice it. "
+ "If you do, destroy target creature that player controls";
+ "If you do, destroy target creature that player controls.";
}
}

View file

@ -28,6 +28,7 @@ public final class CommanderLegends extends ExpansionSet {
this.maxCardNumberInBooster = 361;
cards.add(new SetCardInfo("Alena, Kessig Trapper", 160, Rarity.UNCOMMON, mage.cards.a.AlenaKessigTrapper.class));
cards.add(new SetCardInfo("Bladegriff Prototype", 300, Rarity.RARE, mage.cards.b.BladegriffPrototype.class));
cards.add(new SetCardInfo("Briarblade Adept", 111, Rarity.COMMON, mage.cards.b.BriarbladeAdept.class));
cards.add(new SetCardInfo("Command Tower", 350, Rarity.COMMON, mage.cards.c.CommandTower.class));
cards.add(new SetCardInfo("Commander's Sphere", 306, Rarity.COMMON, mage.cards.c.CommandersSphere.class));