mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
more refactors
This commit is contained in:
parent
f4c55dfc45
commit
e0f031801d
20 changed files with 348 additions and 555 deletions
|
|
@ -1,21 +1,17 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cbt33, Ad Nauseum (North), Izzet Staticaster (LevelX2), Bane Alley
|
||||
* Broker (LevelX2)
|
||||
*/
|
||||
|
|
@ -56,30 +52,28 @@ class TaintedPactEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null
|
||||
|| sourceCard == null) {
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Set<String> names = new HashSet<>();
|
||||
while (controller.canRespond()
|
||||
&& controller.getLibrary().hasCards()) {
|
||||
Cards cards = new CardsImpl();
|
||||
while (controller.canRespond() && controller.getLibrary().hasCards()) {
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
// the card move is sequential, not all at once.
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
game.processAction(); // Laelia, the Blade Reforged
|
||||
// Checks if there was already exiled a card with the same name
|
||||
if (names.contains(card.getName())) {
|
||||
break;
|
||||
}
|
||||
names.add(card.getName());
|
||||
if (controller.chooseUse(outcome, "Put " + card.getName() + " into your hand?", source, game)) {
|
||||
//Adds the current card to hand if it is chosen.
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
break;
|
||||
}
|
||||
if (card == null) {
|
||||
continue;
|
||||
}
|
||||
// the card move is sequential, not all at once.
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
game.processAction(); // Laelia, the Blade Reforged
|
||||
// Checks if there was already exiled a card with the same name
|
||||
if (cards.getCards(game).stream().anyMatch(c -> c.sharesName(card, game))) {
|
||||
break;
|
||||
}
|
||||
cards.add(card);
|
||||
if (controller.chooseUse(outcome, "Put " + card.getName() + " into your hand?", source, game)) {
|
||||
//Adds the current card to hand if it is chosen.
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue