mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
- Fixed #8186 - Did not test it yet, but it should work fine. In the middle of a large refactor.
This commit is contained in:
parent
0ee1d428e1
commit
842e9bb30e
1 changed files with 19 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.n;
|
package mage.cards.n;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -8,14 +9,11 @@ import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
||||||
import mage.abilities.keyword.LifelinkAbility;
|
import mage.abilities.keyword.LifelinkAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.StaticFilters;
|
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.token.ZombieToken;
|
import mage.game.permanent.token.ZombieToken;
|
||||||
|
@ -23,6 +21,10 @@ import mage.players.Player;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.filter.common.FilterCreatureCard;
|
||||||
|
import mage.game.ExileZone;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
@ -60,8 +62,8 @@ class NecromancersConvenantEffect extends OneShotEffect {
|
||||||
|
|
||||||
NecromancersConvenantEffect() {
|
NecromancersConvenantEffect() {
|
||||||
super(Outcome.PutCreatureInPlay);
|
super(Outcome.PutCreatureInPlay);
|
||||||
staticText = "exile all creature cards from target player's graveyard, " +
|
staticText = "exile all creature cards from target player's graveyard, "
|
||||||
"then create a 2/2 black Zombie creature token for each card exiled this way";
|
+ "then create a 2/2 black Zombie creature token for each card exiled this way";
|
||||||
}
|
}
|
||||||
|
|
||||||
private NecromancersConvenantEffect(NecromancersConvenantEffect effect) {
|
private NecromancersConvenantEffect(NecromancersConvenantEffect effect) {
|
||||||
|
@ -72,12 +74,20 @@ class NecromancersConvenantEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player player = game.getPlayer(source.getFirstTarget());
|
Player player = game.getPlayer(source.getFirstTarget());
|
||||||
if (controller == null || player == null) {
|
if (controller == null
|
||||||
|
|| player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Cards cards = new CardsImpl(player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game));
|
Set<Card> cards = player.getGraveyard().getCards(new FilterCreatureCard(), game);
|
||||||
int count = cards.size();
|
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
||||||
return count > 0 && new ZombieToken().putOntoBattlefield(count, game, source, controller.getId());
|
controller.moveCardsToExile(cards, source, game, true, exileId, "Necromancer's Convenant"); // a previous refactor removed the exile code. Just putting it back.
|
||||||
|
ExileZone exileZone = game.getState().getExile().getExileZone(exileId);
|
||||||
|
if (exileZone != null) {
|
||||||
|
int count = exileZone.getCards(game).size();
|
||||||
|
return count > 0
|
||||||
|
&& new ZombieToken().putOntoBattlefield(count, game, source, controller.getId());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue