mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Reworked Goblin Ringleader effect.
This commit is contained in:
parent
d0b304856b
commit
319d3add72
1 changed files with 16 additions and 34 deletions
|
@ -28,10 +28,8 @@
|
||||||
package mage.sets.apocalypse;
|
package mage.sets.apocalypse;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
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;
|
||||||
|
@ -40,13 +38,14 @@ import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -102,38 +101,21 @@ class GoblinRingleaderEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
Cards cards = new CardsImpl(Zone.PICK);
|
if (controller == null || sourceObject == null) {
|
||||||
Cards cards2 = new CardsImpl(Zone.PICK);
|
return false;
|
||||||
int count = Math.min(player.getLibrary().size(), 4);
|
}
|
||||||
for (int i = 0; i < count; i++) {
|
Cards cards = new CardsImpl();
|
||||||
Card card = player.getLibrary().removeFromTop(game);
|
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||||
if (card != null) {
|
controller.revealCards(sourceObject.getLogName(), cards, game);
|
||||||
cards.add(card);
|
for (Card card: cards.getCards(game)) {
|
||||||
game.setZone(card.getId(), Zone.PICK);
|
|
||||||
if (filter.match(card, game)) {
|
if (filter.match(card, game)) {
|
||||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||||
} else {
|
cards.remove(card);
|
||||||
cards2.add(card);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Card sourceCard = game.getCard(source.getSourceId());
|
|
||||||
if (!cards.isEmpty() && sourceCard != null) {
|
|
||||||
player.revealCards(sourceCard.getName(), cards, game);
|
|
||||||
}
|
|
||||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library"));
|
|
||||||
while (player.isInGame() && cards2.size() > 0 && player.choose(Outcome.Detriment, cards2, target, game)) {
|
|
||||||
Card card = cards.get(target.getFirstTarget(), game);
|
|
||||||
if (card != null) {
|
|
||||||
cards2.remove(card);
|
|
||||||
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
|
|
||||||
}
|
|
||||||
target.clearChosen();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue