mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Clean up the deprecated moveCards methods in Player
This commit is contained in:
parent
bec11804f5
commit
ef5ed5256a
97 changed files with 108 additions and 200 deletions
|
|
@ -84,7 +84,7 @@ public class EnvoyEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
cards.removeAll(cardsToHand);
|
||||
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class ExileCardsFromTopOfLibraryTargetEffect extends OneShotEffect {
|
|||
if (targetPlayer != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(targetPlayer.getLibrary().getTopCards(game, amount));
|
||||
return targetPlayer.moveCards(cards, null, Zone.EXILED, source, game);
|
||||
return targetPlayer.moveCards(cards, Zone.EXILED, source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ public class LookLibraryControllerEffect extends OneShotEffect {
|
|||
}
|
||||
break;
|
||||
case GRAVEYARD:
|
||||
player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
break;
|
||||
default:
|
||||
// not supported yet
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class ReturnToHandChosenPermanentEffect extends OneShotEffect {
|
|||
if (available > 0) {
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(Math.min(number, available), number, filter, true);
|
||||
if (player.chooseTarget(this.outcome, target, source, game)) {
|
||||
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, Zone.HAND, source, game);
|
||||
player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class RevealLibraryPutIntoHandEffect extends OneShotEffect {
|
|||
cards.remove(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
controller.putCardsOnBottomOfLibrary(cards, game, source, anyOrder);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class ShuffleIntoLibraryGraveOfSourceOwnerEffect extends OneShotEffect {
|
|||
}
|
||||
Player owner = game.getPlayer(ownerId);
|
||||
if (owner != null) {
|
||||
owner.moveCards(owner.getGraveyard(), null, Zone.LIBRARY, source, game);
|
||||
owner.moveCards(owner.getGraveyard(), Zone.LIBRARY, source, game);
|
||||
owner.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect {
|
|||
cards.add(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(cards, null, Zone.HAND, source, game);
|
||||
controller.moveCards(cards, Zone.HAND, source, game);
|
||||
if (revealCards) {
|
||||
String name = "Reveal";
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class SweepEffect extends OneShotEffect {
|
|||
Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
|
||||
if (controller.chooseTarget(outcome, target, source, game)) {
|
||||
game.getState().setValue(CardUtil.getCardZoneString("sweep", source.getSourceId(), game), target.getTargets().size());
|
||||
controller.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game);
|
||||
controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class TransmuteEffect extends OneShotEffect {
|
|||
if (target.getTargets().size() > 0) {
|
||||
Cards revealed = new CardsImpl(target.getTargets());
|
||||
controller.revealCards(sourceObject.getIdName(), revealed, game);
|
||||
controller.moveCards(revealed, null, Zone.HAND, source, game);
|
||||
controller.moveCards(revealed, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
controller.shuffleLibrary(source, game);
|
||||
|
|
|
|||
|
|
@ -141,6 +141,8 @@ public interface Card extends MageObject {
|
|||
|
||||
boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, ArrayList<UUID> appliedEffects);
|
||||
|
||||
void setZone(Zone zone, Game game);
|
||||
|
||||
List<Mana> getMana();
|
||||
|
||||
void build();
|
||||
|
|
@ -172,6 +174,4 @@ public interface Card extends MageObject {
|
|||
* returned
|
||||
*/
|
||||
Card getMainCard();
|
||||
|
||||
void setZone(Zone zone, Game game);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -654,27 +654,17 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
* Moves cards from one zone to another
|
||||
*
|
||||
* @param cards
|
||||
* @param fromZone
|
||||
* @param toZone
|
||||
* @param source
|
||||
* @param game
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game);
|
||||
|
||||
@Deprecated
|
||||
boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game);
|
||||
|
||||
@Deprecated
|
||||
boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game);
|
||||
boolean moveCards(Cards cards, Zone toZone, Ability source, Game game);
|
||||
|
||||
boolean moveCards(Card card, Zone toZone, Ability source, Game game);
|
||||
|
||||
boolean moveCards(Card card, Zone toZone, Ability source, Game game, boolean tapped, boolean faceDown, boolean byOwner, ArrayList<UUID> appliedEffects);
|
||||
|
||||
boolean moveCards(Cards cards, Zone toZone, Ability source, Game game);
|
||||
|
||||
boolean moveCards(Set<Card> cards, Zone toZone, Ability source, Game game);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3116,55 +3116,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return this.commanderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) {
|
||||
if (cards.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
Set<Card> cardList = new HashSet<>();
|
||||
for (UUID cardId : cards) {
|
||||
fromZone = game.getState().getZone(cardId);
|
||||
if (Zone.BATTLEFIELD.equals(fromZone)) {
|
||||
Permanent permanent = game.getPermanent(cardId);
|
||||
if (permanent != null) {
|
||||
cardList.add(permanent);
|
||||
}
|
||||
} else {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card == null) {
|
||||
Spell spell = game.getState().getStack().getSpell(cardId);
|
||||
if (spell != null) {
|
||||
if (!spell.isCopy()) {
|
||||
card = spell.getCard();
|
||||
} else {
|
||||
// If a spell is returned to its owner's hand, it's removed from the stack and thus will not resolve
|
||||
game.getStack().remove(spell);
|
||||
game.informPlayers(spell.getLogName() + " was removed from the stack");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (card != null) {
|
||||
cardList.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
return moveCards(cardList, toZone, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) {
|
||||
Set<Card> cardList = new HashSet<>();
|
||||
if (card != null) {
|
||||
cardList.add(card);
|
||||
}
|
||||
return moveCards(cardList, toZone, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game) {
|
||||
return moveCards(cards, toZone, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Card card, Zone toZone, Ability source, Game game) {
|
||||
return moveCards(card, toZone, source, game, false, false, false, null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue