Implemented Sorcerer's Broom

This commit is contained in:
Evan Kranzler 2019-09-16 19:54:10 -04:00
parent 7a43bbd5a9
commit 1f8924c2a2
2 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,75 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.CreateTokenCopySourceEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SorcerersBroom extends CardImpl {
public SorcerersBroom(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Whenever you sacrifice another permanent, you may pay {3}. If you do, create a token that's a copy of Sorcerer's Broom.
this.addAbility(new SorcerersBroomTriggeredAbility());
}
private SorcerersBroom(final SorcerersBroom card) {
super(card);
}
@Override
public SorcerersBroom copy() {
return new SorcerersBroom(this);
}
}
class SorcerersBroomTriggeredAbility extends TriggeredAbilityImpl {
SorcerersBroomTriggeredAbility() {
super(Zone.BATTLEFIELD, new DoIfCostPaid(new CreateTokenCopySourceEffect(), new GenericManaCost(3)));
}
private SorcerersBroomTriggeredAbility(final SorcerersBroomTriggeredAbility ability) {
super(ability);
}
@Override
public SorcerersBroomTriggeredAbility copy() {
return new SorcerersBroomTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.getControllerId())
&& !event.getTargetId().equals(sourceId);
}
@Override
public String getRule() {
return "Whenever you sacrifice another permanent, you may pay {3}. " +
"If you do, create a token that's a copy of {this}";
}
}

View file

@ -179,6 +179,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Skullknocker Ogre", 142, Rarity.UNCOMMON, mage.cards.s.SkullknockerOgre.class));
cards.add(new SetCardInfo("Slaying Fire", 143, Rarity.UNCOMMON, mage.cards.s.SlayingFire.class));
cards.add(new SetCardInfo("Smitten Swordmaster", 105, Rarity.COMMON, mage.cards.s.SmittenSwordmaster.class));
cards.add(new SetCardInfo("Sorcerer's Broom", 232, Rarity.UNCOMMON, mage.cards.s.SorcerersBroom.class));
cards.add(new SetCardInfo("Sorcerous Spyglass", 233, Rarity.RARE, mage.cards.s.SorcerousSpyglass.class));
cards.add(new SetCardInfo("Specter's Shriek", 106, Rarity.UNCOMMON, mage.cards.s.SpectersShriek.class));
cards.add(new SetCardInfo("Spinning Wheel", 234, Rarity.UNCOMMON, mage.cards.s.SpinningWheel.class));