mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
[STX] Implemented Quandrix Command
This commit is contained in:
parent
4db47adc19
commit
223c576359
10 changed files with 209 additions and 428 deletions
|
|
@ -0,0 +1,55 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class TargetPlayerShufflesTargetCardsEffect extends OneShotEffect {
|
||||
|
||||
public TargetPlayerShufflesTargetCardsEffect() {
|
||||
super(Outcome.Neutral);
|
||||
}
|
||||
|
||||
private TargetPlayerShufflesTargetCardsEffect(final TargetPlayerShufflesTargetCardsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetPlayerShufflesTargetCardsEffect copy() {
|
||||
return new TargetPlayerShufflesTargetCardsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
Cards cards = new CardsImpl(source.getTargets().get(1).getTargets());
|
||||
if (targetPlayer != null && !cards.isEmpty()) {
|
||||
return targetPlayer.shuffleCardsToLibrary(cards, game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
String rule = "target player shuffles ";
|
||||
int targetNumber = mode.getTargets().get(1).getMaxNumberOfTargets();
|
||||
if (targetNumber == Integer.MAX_VALUE) {
|
||||
rule += "any number of target cards";
|
||||
} else {
|
||||
rule += "up to " + CardUtil.numberToText(targetNumber, "one") + " target card" + (targetNumber > 1 ? "s" : "");
|
||||
}
|
||||
return rule + " from their graveyard into their library";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package mage.target.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class TargetCardInTargetPlayersGraveyard extends TargetCardInGraveyard {
|
||||
|
||||
public TargetCardInTargetPlayersGraveyard(int targets) {
|
||||
super(0, targets, StaticFilters.FILTER_CARD);
|
||||
}
|
||||
|
||||
private TargetCardInTargetPlayersGraveyard(final TargetCardInTargetPlayersGraveyard target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
if (!super.canTarget(id, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Card card = game.getCard(id);
|
||||
return card != null && card.isOwnedBy(source.getFirstTarget());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetCardInTargetPlayersGraveyard copy() {
|
||||
return new TargetCardInTargetPlayersGraveyard(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue