mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Reworked Mulch.
This commit is contained in:
parent
804e0e93b8
commit
dc6c706145
1 changed files with 17 additions and 19 deletions
|
@ -28,16 +28,17 @@
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
import mage.MageObject;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
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.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
@ -85,28 +86,25 @@ class MulchEffect 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) {
|
||||||
int count = Math.min(player.getLibrary().size(), 4);
|
Cards cards = new CardsImpl();
|
||||||
for (int i = 0; i < count; i++) {
|
int count = Math.min(controller.getLibrary().size(), 4);
|
||||||
Card card = player.getLibrary().removeFromTop(game);
|
cards.addAll(controller.getLibrary().getTopCards(game, count));
|
||||||
if (card != null) {
|
if (!cards.isEmpty()) {
|
||||||
|
for (Card card: cards.getCards(game)) {
|
||||||
cards.add(card);
|
cards.add(card);
|
||||||
game.setZone(card.getId(), Zone.PICK);
|
|
||||||
if (card.getCardType().contains(CardType.LAND)) {
|
if (card.getCardType().contains(CardType.LAND)) {
|
||||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||||
} else {
|
} else {
|
||||||
card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, false);
|
controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
controller.revealCards(sourceObject.getLogName(), cards, game);
|
||||||
}
|
}
|
||||||
Card sourceCard = game.getCard(source.getSourceId());
|
|
||||||
if (!cards.isEmpty() && sourceCard != null) {
|
|
||||||
player.revealCards(sourceCard.getName(), cards, game);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue