[MID] Implement Ominous Roost

This commit is contained in:
ciaccona007 2021-09-15 12:50:30 -04:00 committed by ciaccona007
parent 0fc29302f4
commit 08e8a34e8b
3 changed files with 112 additions and 0 deletions

View file

@ -0,0 +1,80 @@
package mage.cards.o;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.OminousRoostToken;
import mage.game.stack.Spell;
import mage.target.common.TargetNonlandPermanent;
import java.util.UUID;
/**
* @author ciaccona007
*/
public final class OminousRoost extends CardImpl {
public OminousRoost(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
// When Ominous Roost enters the battlefield or whenever you cast a spell from your graveyard, create a 1/1 blue Bird creature token with flying and "This creature can block only creatures with flying."
this.addAbility(new OminousRoostTriggeredAbility());
}
private OminousRoost(final OminousRoost card) {
super(card);
}
@Override
public OminousRoost copy() {
return new OminousRoost(this);
}
}
class OminousRoostTriggeredAbility extends TriggeredAbilityImpl {
OminousRoostTriggeredAbility() {
super(Zone.ALL, new CreateTokenEffect(new OminousRoostToken()));
}
private OminousRoostTriggeredAbility(final OminousRoostTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST
|| event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
switch (event.getType()) {
case SPELL_CAST:
if (event.getPlayerId().equals(controllerId) && event.getZone() == Zone.GRAVEYARD) {
return true;
}
case ENTERS_THE_BATTLEFIELD:
return event.getTargetId().equals(getSourceId());
default:
return false;
}
}
@Override
public String getRule() {
return "When {this} enters the battlefield or whenever you cast a spell from your graveyard, create a " +
"1/1 blue Bird creature token with flying and \"This creature can block only creatures with flying.\"";
}
@Override
public OminousRoostTriggeredAbility copy() {
return new OminousRoostTriggeredAbility(this);
}
}

View file

@ -218,6 +218,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Obsessive Astronomer", 152, Rarity.UNCOMMON, mage.cards.o.ObsessiveAstronomer.class));
cards.add(new SetCardInfo("Odric's Outrider", 29, Rarity.UNCOMMON, mage.cards.o.OdricsOutrider.class));
cards.add(new SetCardInfo("Olivia's Midnight Ambush", 118, Rarity.COMMON, mage.cards.o.OliviasMidnightAmbush.class));
cards.add(new SetCardInfo("Ominous Roost", 65, Rarity.UNCOMMON, mage.cards.o.OminousRoost.class));
cards.add(new SetCardInfo("Organ Hoarder", 66, Rarity.COMMON, mage.cards.o.OrganHoarder.class));
cards.add(new SetCardInfo("Otherworldly Gaze", 67, Rarity.COMMON, mage.cards.o.OtherworldlyGaze.class));
cards.add(new SetCardInfo("Outland Liberator", 190, Rarity.UNCOMMON, mage.cards.o.OutlandLiberator.class));

View file

@ -0,0 +1,31 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.common.CanBlockOnlyFlyingAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.CardType;
import mage.constants.SubType;
public class OminousRoostToken extends TokenImpl {
public OminousRoostToken() {
super("Bird", "1/1 blue Bird creature token with flying and \"This creature can block only creatures with flying\"");
cardType.add(CardType.CREATURE);
color.setBlue(true);
subtype.add(SubType.BIRD);
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(FlyingAbility.getInstance());
this.addAbility(new CanBlockOnlyFlyingAbility());
}
public OminousRoostToken(final OminousRoostToken token) {
super(token);
}
@Override
public Token copy() {
return new OminousRoostToken(this);
}
}