mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
Used framework method instead of individual method.
This commit is contained in:
parent
cd0941739d
commit
d6a88a442d
3 changed files with 6 additions and 69 deletions
|
|
@ -36,6 +36,7 @@ import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.PutTopCardOfYourLibraryIntoGraveEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
@ -57,7 +58,7 @@ public class ScreechingSkaab extends CardImpl<ScreechingSkaab> {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
// When Screeching Skaab enters the battlefield, put the top two cards of your library into your graveyard.
|
// When Screeching Skaab enters the battlefield, put the top two cards of your library into your graveyard.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new ScreechingSkaabEffect()));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new PutTopCardOfYourLibraryIntoGraveEffect(2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScreechingSkaab(final ScreechingSkaab card) {
|
public ScreechingSkaab(final ScreechingSkaab card) {
|
||||||
|
|
@ -69,36 +70,3 @@ public class ScreechingSkaab extends CardImpl<ScreechingSkaab> {
|
||||||
return new ScreechingSkaab(this);
|
return new ScreechingSkaab(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ScreechingSkaabEffect extends OneShotEffect<ScreechingSkaabEffect> {
|
|
||||||
|
|
||||||
public ScreechingSkaabEffect() {
|
|
||||||
super(Outcome.Discard);
|
|
||||||
this.staticText = "put the top two cards of your library into your graveyard";
|
|
||||||
}
|
|
||||||
|
|
||||||
public ScreechingSkaabEffect(final ScreechingSkaabEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ScreechingSkaabEffect copy() {
|
|
||||||
return new ScreechingSkaabEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
|
||||||
if (player != null) {
|
|
||||||
int cardsCount = Math.min(2, player.getLibrary().size());
|
|
||||||
for (int i = 0; i < cardsCount; i++) {
|
|
||||||
Card card = player.getLibrary().removeFromTop(game);
|
|
||||||
if (card != null) {
|
|
||||||
card.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.PutTopCardOfYourLibraryIntoGraveEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
@ -58,7 +59,7 @@ public class ArmoredSkaab extends CardImpl<ArmoredSkaab> {
|
||||||
this.toughness = new MageInt(4);
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
// When Armored Skaab enters the battlefield, put the top four cards of your library into your graveyard.
|
// When Armored Skaab enters the battlefield, put the top four cards of your library into your graveyard.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new ArmoredSkaabEffect()));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new PutTopCardOfYourLibraryIntoGraveEffect(4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArmoredSkaab(final ArmoredSkaab card) {
|
public ArmoredSkaab(final ArmoredSkaab card) {
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import mage.abilities.common.OnEventTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
|
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.PutTopCardOfYourLibraryIntoGraveEffect;
|
||||||
import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect;
|
import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect;
|
||||||
import mage.abilities.keyword.TrampleAbility;
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
|
@ -68,7 +69,7 @@ public class Splinterfright extends CardImpl<Splinterfright> {
|
||||||
CardsInControllerGraveyardCount count = new CardsInControllerGraveyardCount(new FilterCreatureCard("creature cards"));
|
CardsInControllerGraveyardCount count = new CardsInControllerGraveyardCount(new FilterCreatureCard("creature cards"));
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(count, Duration.EndOfGame)));
|
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(count, Duration.EndOfGame)));
|
||||||
// At the beginning of your upkeep, put the top two cards of your library into your graveyard.
|
// At the beginning of your upkeep, put the top two cards of your library into your graveyard.
|
||||||
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new SplinterfrightEffect(), false));
|
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new PutTopCardOfYourLibraryIntoGraveEffect(2), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Splinterfright(final Splinterfright card) {
|
public Splinterfright(final Splinterfright card) {
|
||||||
|
|
@ -80,36 +81,3 @@ public class Splinterfright extends CardImpl<Splinterfright> {
|
||||||
return new Splinterfright(this);
|
return new Splinterfright(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SplinterfrightEffect extends OneShotEffect<SplinterfrightEffect> {
|
|
||||||
|
|
||||||
public SplinterfrightEffect() {
|
|
||||||
super(Outcome.Discard);
|
|
||||||
this.staticText = "put the top two cards of your library into your graveyard";
|
|
||||||
}
|
|
||||||
|
|
||||||
public SplinterfrightEffect(final SplinterfrightEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SplinterfrightEffect copy() {
|
|
||||||
return new SplinterfrightEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
|
||||||
if (player != null) {
|
|
||||||
int cardsCount = Math.min(2, player.getLibrary().size());
|
|
||||||
for (int i = 0; i < cardsCount; i++) {
|
|
||||||
Card card = player.getLibrary().removeFromTop(game);
|
|
||||||
if (card != null) {
|
|
||||||
card.moveToZone(Zone.GRAVEYARD, source.getId(), game, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue