mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Merge origin/master
This commit is contained in:
commit
38a5a0e6b1
2 changed files with 36 additions and 31 deletions
|
@ -40,14 +40,11 @@ import mage.cards.CardsImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterArtifactCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
|
@ -135,30 +132,9 @@ class DrafnasRestorationEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (controller != null && targetPlayer != null) {
|
||||
Cards cards = new CardsImpl(source.getTargets().get(1).getTargets()); // prevent possible ConcurrentModificationException
|
||||
cards.addAll(source.getTargets().get(1).getTargets());
|
||||
if (!cards.isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the top of the library (last one chosen will be topmost)"));
|
||||
target.setRequired(true);
|
||||
while (controller.isInGame() && cards.size() > 1) {
|
||||
controller.choose(Outcome.Neutral, cards, target, game);
|
||||
UUID targetId = target.getFirstTarget();
|
||||
cards.remove(targetId);
|
||||
target.clearChosen();
|
||||
Card card = targetPlayer.getGraveyard().get(targetId, game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.GRAVEYARD, Zone.LIBRARY, source, game);
|
||||
}
|
||||
}
|
||||
if (cards.size() == 1) {
|
||||
Card card = targetPlayer.getGraveyard().get(cards.iterator().next(), game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.GRAVEYARD, Zone.LIBRARY, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (controller != null) {
|
||||
Cards cards = new CardsImpl(source.getTargets().get(1).getTargets());
|
||||
controller.putCardsOnTopOfLibrary(cards, game, source, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -30,17 +30,21 @@ package mage.sets.onslaught;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -53,9 +57,7 @@ public class BlatantThievery extends CardImpl {
|
|||
this.expansionSetCode = "ONS";
|
||||
|
||||
// For each opponent, gain control of target permanent that player controls.
|
||||
Effect effect = new GainControlTargetEffect(Duration.EndOfGame);
|
||||
effect.setText("For each opponent, gain control of target permanent that player controls");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new BlatantThieveryEffect());
|
||||
}
|
||||
|
||||
public BlatantThievery(final BlatantThievery card) {
|
||||
|
@ -82,3 +84,30 @@ public class BlatantThievery extends CardImpl {
|
|||
return new BlatantThievery(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BlatantThieveryEffect extends OneShotEffect {
|
||||
|
||||
BlatantThieveryEffect() {
|
||||
super(Outcome.GainControl);
|
||||
this.staticText = "For each opponent, gain control of target permanent that player controls";
|
||||
}
|
||||
|
||||
BlatantThieveryEffect(final BlatantThieveryEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlatantThieveryEffect copy() {
|
||||
return new BlatantThieveryEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Target target : source.getTargets()) {
|
||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
|
||||
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue