mirror of
https://github.com/correl/mage.git
synced 2025-04-10 09:11:04 -09:00
updated Mistveil Plains implementation
This commit is contained in:
parent
b82df08a80
commit
c303b5adf8
5 changed files with 128 additions and 133 deletions
Mage.Sets/src/mage/cards/m
Mage.Tests/src/test/java/org/mage/test
Mage/src/main/java/mage/players
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||||
|
@ -14,29 +13,28 @@ import mage.abilities.mana.WhiteManaAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.ComparisonType;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class MistveilPlains extends CardImpl {
|
public final class MistveilPlains extends CardImpl {
|
||||||
|
|
||||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("you control two or more white permanents");
|
private static final FilterControlledPermanent filter = new FilterControlledPermanent("you control two or more white permanents");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(new ColorPredicate(ObjectColor.WHITE));
|
filter.add(new ColorPredicate(ObjectColor.WHITE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MistveilPlains(UUID ownerId, CardSetInfo setInfo) {
|
public MistveilPlains(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
|
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||||
this.subtype.add(SubType.PLAINS);
|
this.subtype.add(SubType.PLAINS);
|
||||||
|
|
||||||
// <i>({tap}: Add {W}.)</i>
|
// <i>({tap}: Add {W}.)</i>
|
||||||
|
@ -47,10 +45,11 @@ public final class MistveilPlains extends CardImpl {
|
||||||
|
|
||||||
// {W}, {tap}: Put target card from your graveyard on the bottom of your library. Activate this ability only if you control two or more white permanents.
|
// {W}, {tap}: Put target card from your graveyard on the bottom of your library. Activate this ability only if you control two or more white permanents.
|
||||||
Ability ability = new ActivateIfConditionActivatedAbility(
|
Ability ability = new ActivateIfConditionActivatedAbility(
|
||||||
Zone.BATTLEFIELD,
|
Zone.BATTLEFIELD,
|
||||||
new MistveilPlainsGraveyardToLibraryEffect(),
|
new MistveilPlainsGraveyardToLibraryEffect(),
|
||||||
new ManaCostsImpl("{W}"),
|
new ManaCostsImpl("{W}"),
|
||||||
new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1));
|
new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1)
|
||||||
|
);
|
||||||
ability.addTarget(new TargetCardInYourGraveyard());
|
ability.addTarget(new TargetCardInYourGraveyard());
|
||||||
ability.addCost(new TapSourceCost());
|
ability.addCost(new TapSourceCost());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
@ -85,10 +84,12 @@ class MistveilPlainsGraveyardToLibraryEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
Card card = game.getCard(source.getFirstTarget());
|
||||||
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
return card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
|
if (card == null || player == null ||
|
||||||
|
game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return player.putCardsOnBottomOfLibrary(card, game, source, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package org.mage.test.player;
|
package org.mage.test.player;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
|
@ -52,6 +48,12 @@ import mage.target.*;
|
||||||
import mage.target.common.*;
|
import mage.target.common.*;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl.*;
|
import static org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,7 +128,7 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param maxCallsWithoutAction max number of priority passes a player may
|
* @param maxCallsWithoutAction max number of priority passes a player may
|
||||||
* have for this test (default = 100)
|
* have for this test (default = 100)
|
||||||
*/
|
*/
|
||||||
public void setMaxCallsWithoutAction(int maxCallsWithoutAction) {
|
public void setMaxCallsWithoutAction(int maxCallsWithoutAction) {
|
||||||
this.maxCallsWithoutAction = maxCallsWithoutAction;
|
this.maxCallsWithoutAction = maxCallsWithoutAction;
|
||||||
|
@ -771,7 +773,7 @@ public class TestPlayer implements Player {
|
||||||
// Loop through players and validate can attack/block this turn
|
// Loop through players and validate can attack/block this turn
|
||||||
UUID defenderId = null;
|
UUID defenderId = null;
|
||||||
//List<PlayerAction>
|
//List<PlayerAction>
|
||||||
for (Iterator<org.mage.test.player.PlayerAction> it = actions.iterator(); it.hasNext();) {
|
for (Iterator<org.mage.test.player.PlayerAction> it = actions.iterator(); it.hasNext(); ) {
|
||||||
PlayerAction action = it.next();
|
PlayerAction action = it.next();
|
||||||
if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("attack:")) {
|
if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("attack:")) {
|
||||||
String command = action.getAction();
|
String command = action.getAction();
|
||||||
|
@ -1590,6 +1592,11 @@ public class TestPlayer implements Player {
|
||||||
return computerPlayer.removeFromGraveyard(card, game);
|
return computerPlayer.removeFromGraveyard(card, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean putCardsOnBottomOfLibrary(Card card, Game game, Ability source, boolean anyOrder) {
|
||||||
|
return computerPlayer.putCardsOnBottomOfLibrary(card, game, source, anyOrder);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
|
public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
|
||||||
return computerPlayer.putCardsOnBottomOfLibrary(cards, game, source, anyOrder);
|
return computerPlayer.putCardsOnBottomOfLibrary(cards, game, source, anyOrder);
|
||||||
|
@ -2454,7 +2461,7 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean choose(Outcome outcome, Target target,
|
public boolean choose(Outcome outcome, Target target,
|
||||||
UUID sourceId, Game game
|
UUID sourceId, Game game
|
||||||
) {
|
) {
|
||||||
// needed to call here the TestPlayer because it's overwitten
|
// needed to call here the TestPlayer because it's overwitten
|
||||||
return choose(outcome, target, sourceId, game, null);
|
return choose(outcome, target, sourceId, game, null);
|
||||||
|
@ -2462,7 +2469,7 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean choose(Outcome outcome, Cards cards,
|
public boolean choose(Outcome outcome, Cards cards,
|
||||||
TargetCard target, Game game
|
TargetCard target, Game game
|
||||||
) {
|
) {
|
||||||
if (!choices.isEmpty()) {
|
if (!choices.isEmpty()) {
|
||||||
for (String choose2 : choices) {
|
for (String choose2 : choices) {
|
||||||
|
@ -2494,7 +2501,7 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseTargetAmount(Outcome outcome, TargetAmount target,
|
public boolean chooseTargetAmount(Outcome outcome, TargetAmount target,
|
||||||
Ability source, Game game
|
Ability source, Game game
|
||||||
) {
|
) {
|
||||||
return computerPlayer.chooseTargetAmount(outcome, target, source, game);
|
return computerPlayer.chooseTargetAmount(outcome, target, source, game);
|
||||||
}
|
}
|
||||||
|
@ -2507,15 +2514,15 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean choosePile(Outcome outcome, String message,
|
public boolean choosePile(Outcome outcome, String message,
|
||||||
List<? extends Card> pile1, List<? extends Card> pile2,
|
List<? extends Card> pile1, List<? extends Card> pile2,
|
||||||
Game game
|
Game game
|
||||||
) {
|
) {
|
||||||
return computerPlayer.choosePile(outcome, message, pile1, pile2, game);
|
return computerPlayer.choosePile(outcome, message, pile1, pile2, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playMana(Ability ability, ManaCost unpaid,
|
public boolean playMana(Ability ability, ManaCost unpaid,
|
||||||
String promptText, Game game
|
String promptText, Game game
|
||||||
) {
|
) {
|
||||||
groupsForTargetHandling = null;
|
groupsForTargetHandling = null;
|
||||||
return computerPlayer.playMana(ability, unpaid, promptText, game);
|
return computerPlayer.playMana(ability, unpaid, promptText, game);
|
||||||
|
@ -2529,15 +2536,15 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID chooseBlockerOrder(List<Permanent> blockers, CombatGroup combatGroup,
|
public UUID chooseBlockerOrder(List<Permanent> blockers, CombatGroup combatGroup,
|
||||||
List<UUID> blockerOrder, Game game
|
List<UUID> blockerOrder, Game game
|
||||||
) {
|
) {
|
||||||
return computerPlayer.chooseBlockerOrder(blockers, combatGroup, blockerOrder, game);
|
return computerPlayer.chooseBlockerOrder(blockers, combatGroup, blockerOrder, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assignDamage(int damage, List<UUID> targets,
|
public void assignDamage(int damage, List<UUID> targets,
|
||||||
String singleTargetName, UUID sourceId,
|
String singleTargetName, UUID sourceId,
|
||||||
Game game
|
Game game
|
||||||
) {
|
) {
|
||||||
computerPlayer.assignDamage(damage, targets, singleTargetName, sourceId, game);
|
computerPlayer.assignDamage(damage, targets, singleTargetName, sourceId, game);
|
||||||
}
|
}
|
||||||
|
@ -2556,14 +2563,14 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void pickCard(List<Card> cards, Deck deck,
|
public void pickCard(List<Card> cards, Deck deck,
|
||||||
Draft draft
|
Draft draft
|
||||||
) {
|
) {
|
||||||
computerPlayer.pickCard(cards, deck, draft);
|
computerPlayer.pickCard(cards, deck, draft);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean scry(int value, Ability source,
|
public boolean scry(int value, Ability source,
|
||||||
Game game
|
Game game
|
||||||
) {
|
) {
|
||||||
// Don't scry at the start of the game.
|
// Don't scry at the start of the game.
|
||||||
if (game.getTurnNum() == 1 && game.getStep() == null) {
|
if (game.getTurnNum() == 1 && game.getStep() == null) {
|
||||||
|
@ -2574,44 +2581,44 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean surveil(int value, Ability source,
|
public boolean surveil(int value, Ability source,
|
||||||
Game game
|
Game game
|
||||||
) {
|
) {
|
||||||
return computerPlayer.surveil(value, source, game);
|
return computerPlayer.surveil(value, source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Card card, Zone toZone,
|
public boolean moveCards(Card card, Zone toZone,
|
||||||
Ability source, Game game
|
Ability source, Game game
|
||||||
) {
|
) {
|
||||||
return computerPlayer.moveCards(card, toZone, source, game);
|
return computerPlayer.moveCards(card, toZone, source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Card card, Zone toZone,
|
public boolean moveCards(Card card, Zone toZone,
|
||||||
Ability source, Game game,
|
Ability source, Game game,
|
||||||
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
||||||
) {
|
) {
|
||||||
return computerPlayer.moveCards(card, toZone, source, game, tapped, faceDown, byOwner, appliedEffects);
|
return computerPlayer.moveCards(card, toZone, source, game, tapped, faceDown, byOwner, appliedEffects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Cards cards, Zone toZone,
|
public boolean moveCards(Cards cards, Zone toZone,
|
||||||
Ability source, Game game
|
Ability source, Game game
|
||||||
) {
|
) {
|
||||||
return computerPlayer.moveCards(cards, toZone, source, game);
|
return computerPlayer.moveCards(cards, toZone, source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Set<Card> cards, Zone toZone,
|
public boolean moveCards(Set<Card> cards, Zone toZone,
|
||||||
Ability source, Game game
|
Ability source, Game game
|
||||||
) {
|
) {
|
||||||
return computerPlayer.moveCards(cards, toZone, source, game);
|
return computerPlayer.moveCards(cards, toZone, source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Set<Card> cards, Zone toZone,
|
public boolean moveCards(Set<Card> cards, Zone toZone,
|
||||||
Ability source, Game game,
|
Ability source, Game game,
|
||||||
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
||||||
) {
|
) {
|
||||||
return computerPlayer.moveCards(cards, toZone, source, game, tapped, faceDown, byOwner, appliedEffects);
|
return computerPlayer.moveCards(cards, toZone, source, game, tapped, faceDown, byOwner, appliedEffects);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package org.mage.test.stub;
|
package org.mage.test.stub;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.*;
|
import mage.abilities.*;
|
||||||
|
@ -40,8 +38,10 @@ import mage.target.TargetAmount;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Quercitron
|
* @author Quercitron
|
||||||
*/
|
*/
|
||||||
public class PlayerStub implements Player {
|
public class PlayerStub implements Player {
|
||||||
|
@ -882,6 +882,11 @@ public class PlayerStub implements Player {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean putCardsOnBottomOfLibrary(Card card, Game game, Ability source, boolean anyOrder) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
|
public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,22 +1,9 @@
|
||||||
package mage.players;
|
package mage.players;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageItem;
|
import mage.MageItem;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Abilities;
|
import mage.abilities.*;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.ActivatedAbility;
|
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.Modes;
|
|
||||||
import mage.abilities.SpellAbility;
|
|
||||||
import mage.abilities.TriggeredAbility;
|
|
||||||
import mage.abilities.costs.AlternativeSourceCosts;
|
import mage.abilities.costs.AlternativeSourceCosts;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
import mage.abilities.costs.Costs;
|
import mage.abilities.costs.Costs;
|
||||||
|
@ -28,13 +15,7 @@ import mage.cards.Card;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
import mage.choices.Choice;
|
import mage.choices.Choice;
|
||||||
import mage.constants.AbilityType;
|
import mage.constants.*;
|
||||||
import mage.constants.ManaType;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.PlanarDieRoll;
|
|
||||||
import mage.constants.PlayerAction;
|
|
||||||
import mage.constants.RangeOfInfluence;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.counters.Counter;
|
import mage.counters.Counter;
|
||||||
import mage.counters.Counters;
|
import mage.counters.Counters;
|
||||||
import mage.designations.Designation;
|
import mage.designations.Designation;
|
||||||
|
@ -56,8 +37,10 @@ import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
import mage.util.Copyable;
|
import mage.util.Copyable;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public interface Player extends MageItem, Copyable<Player> {
|
public interface Player extends MageItem, Copyable<Player> {
|
||||||
|
@ -91,8 +74,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
void setLife(int life, Game game, UUID sourceId);
|
void setLife(int life, Game game, UUID sourceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @param amount amount of life loss
|
||||||
* @param amount amount of life loss
|
|
||||||
* @param game
|
* @param game
|
||||||
* @param atCombat was the source combat damage
|
* @param atCombat was the source combat damage
|
||||||
* @return
|
* @return
|
||||||
|
@ -289,7 +271,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns false in case player don't control the game.
|
* Returns false in case player don't control the game.
|
||||||
*
|
* <p>
|
||||||
* Note: For effects like "You control target player during that player's
|
* Note: For effects like "You control target player during that player's
|
||||||
* next turn".
|
* next turn".
|
||||||
*
|
*
|
||||||
|
@ -299,7 +281,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns false in case you don't control the game.
|
* Returns false in case you don't control the game.
|
||||||
*
|
* <p>
|
||||||
* Note: For effects like "You control target player during that player's
|
* Note: For effects like "You control target player during that player's
|
||||||
* next turn".
|
* next turn".
|
||||||
*
|
*
|
||||||
|
@ -360,11 +342,10 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId);
|
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param target
|
* @param target
|
||||||
* @param game
|
* @param game
|
||||||
* @param targetPlayerId player whose library will be searched
|
* @param targetPlayerId player whose library will be searched
|
||||||
* @param triggerEvents whether searching will trigger any game events
|
* @param triggerEvents whether searching will trigger any game events
|
||||||
* @return true if search was successful
|
* @return true if search was successful
|
||||||
*/
|
*/
|
||||||
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId, boolean triggerEvents);
|
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId, boolean triggerEvents);
|
||||||
|
@ -374,23 +355,22 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
/**
|
/**
|
||||||
* Plays a card if possible
|
* Plays a card if possible
|
||||||
*
|
*
|
||||||
* @param card the card that can be cast
|
* @param card the card that can be cast
|
||||||
* @param game
|
* @param game
|
||||||
* @param noMana if it's a spell i can be cast without paying mana
|
* @param noMana if it's a spell i can be cast without paying mana
|
||||||
* @param ignoreTiming if it's cast during the resolution of another spell
|
* @param ignoreTiming if it's cast during the resolution of another spell
|
||||||
* no sorcery or play land timing restriction are checked. For a land it has
|
* no sorcery or play land timing restriction are checked. For a land it has
|
||||||
* to be the turn of the player playing that card.
|
* to be the turn of the player playing that card.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean playCard(Card card, Game game, boolean noMana, boolean ignoreTiming, MageObjectReference reference);
|
boolean playCard(Card card, Game game, boolean noMana, boolean ignoreTiming, MageObjectReference reference);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @param card the land card to play
|
||||||
* @param card the land card to play
|
|
||||||
* @param game
|
* @param game
|
||||||
* @param ignoreTiming false - it won't be checked if the stack is empty and
|
* @param ignoreTiming false - it won't be checked if the stack is empty and
|
||||||
* you are able to play a Sorcery. It's still checked, if you are able to
|
* you are able to play a Sorcery. It's still checked, if you are able to
|
||||||
* play a land concerning the numner of lands you already played.
|
* play a land concerning the numner of lands you already played.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean playLand(Card card, Game game, boolean ignoreTiming);
|
boolean playLand(Card card, Game game, boolean ignoreTiming);
|
||||||
|
@ -536,15 +516,17 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
/**
|
/**
|
||||||
* Moves the cards from cards to the bottom of the players library.
|
* Moves the cards from cards to the bottom of the players library.
|
||||||
*
|
*
|
||||||
* @param cards - list of cards that have to be moved
|
* @param cards - list of cards that have to be moved
|
||||||
* @param game - game
|
* @param game - game
|
||||||
* @param anyOrder - true if player can determine the order of the cards
|
* @param anyOrder - true if player can determine the order of the cards
|
||||||
* else random order
|
* else random order
|
||||||
* @param source - source ability
|
* @param source - source ability
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder);
|
boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder);
|
||||||
|
|
||||||
|
boolean putCardsOnBottomOfLibrary(Card card, Game game, Ability source, boolean anyOrder);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves the card to the top x position of the library
|
* Moves the card to the top x position of the library
|
||||||
*
|
*
|
||||||
|
@ -559,10 +541,10 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
/**
|
/**
|
||||||
* Moves the cards from cards to the top of players library.
|
* Moves the cards from cards to the top of players library.
|
||||||
*
|
*
|
||||||
* @param cards - list of cards that have to be moved
|
* @param cards - list of cards that have to be moved
|
||||||
* @param game - game
|
* @param game - game
|
||||||
* @param anyOrder - true if player can determine the order of the cards
|
* @param anyOrder - true if player can determine the order of the cards
|
||||||
* @param source - source ability
|
* @param source - source ability
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean putCardsOnTopOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder);
|
boolean putCardsOnTopOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder);
|
||||||
|
@ -588,8 +570,8 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
/**
|
/**
|
||||||
* Choose the order in which blockers get damage assigned to
|
* Choose the order in which blockers get damage assigned to
|
||||||
*
|
*
|
||||||
* @param blockers list of blockers where to choose the next one from
|
* @param blockers list of blockers where to choose the next one from
|
||||||
* @param combatGroup the concerning combat group
|
* @param combatGroup the concerning combat group
|
||||||
* @param blockerOrder the already set order of blockers
|
* @param blockerOrder the already set order of blockers
|
||||||
* @param game
|
* @param game
|
||||||
* @return blocker next to add to the blocker order
|
* @return blocker next to add to the blocker order
|
||||||
|
@ -728,11 +710,11 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
* @param toZone
|
* @param toZone
|
||||||
* @param source
|
* @param source
|
||||||
* @param game
|
* @param game
|
||||||
* @param tapped the cards are tapped on the battlefield
|
* @param tapped the cards are tapped on the battlefield
|
||||||
* @param faceDown the cards are face down in the to zone
|
* @param faceDown the cards are face down in the to zone
|
||||||
* @param byOwner the card is moved (or put onto battlefield) by the owner
|
* @param byOwner the card is moved (or put onto battlefield) by the owner
|
||||||
* of the card and if target zone is battlefield controls the permanent
|
* of the card and if target zone is battlefield controls the permanent
|
||||||
* (instead of the controller of the source)
|
* (instead of the controller of the source)
|
||||||
* @param appliedEffects
|
* @param appliedEffects
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -759,7 +741,6 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
* @param game
|
* @param game
|
||||||
* @param withName show the card name in the log
|
* @param withName show the card name in the log
|
||||||
* @return
|
* @return
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName);
|
boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName);
|
||||||
|
|
||||||
|
@ -769,7 +750,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
* list of applied effects is not saved
|
* list of applied effects is not saved
|
||||||
*
|
*
|
||||||
* @param card
|
* @param card
|
||||||
* @param exileId exile zone id (optional)
|
* @param exileId exile zone id (optional)
|
||||||
* @param exileName name of exile zone (optional)
|
* @param exileName name of exile zone (optional)
|
||||||
* @param sourceId
|
* @param sourceId
|
||||||
* @param game
|
* @param game
|
||||||
|
@ -811,7 +792,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
* @param sourceId
|
* @param sourceId
|
||||||
* @param game
|
* @param game
|
||||||
* @param fromZone if null, this info isn't postet
|
* @param fromZone if null, this info isn't postet
|
||||||
* @param toTop to the top of the library else to the bottom
|
* @param toTop to the top of the library else to the bottom
|
||||||
* @param withName show the card name in the log
|
* @param withName show the card name in the log
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -836,10 +817,10 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
* without mana (null) or the mana set to manaCosts instead of its normal
|
* without mana (null) or the mana set to manaCosts instead of its normal
|
||||||
* mana costs.
|
* mana costs.
|
||||||
*
|
*
|
||||||
* @param sourceId the source that can be cast without mana
|
* @param sourceId the source that can be cast without mana
|
||||||
* @param manaCosts alternate ManaCost, null if it can be cast without mana
|
* @param manaCosts alternate ManaCost, null if it can be cast without mana
|
||||||
* cost
|
* cost
|
||||||
* @param costs alternate other costs you need to pay
|
* @param costs alternate other costs you need to pay
|
||||||
*/
|
*/
|
||||||
void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts<ManaCost> manaCosts, Costs<Cost> costs);
|
void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts<ManaCost> manaCosts, Costs<Cost> costs);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package mage.players;
|
package mage.players;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import mage.ConditionalMana;
|
import mage.ConditionalMana;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
|
@ -31,11 +27,6 @@ import mage.cards.SplitCard;
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
import mage.choices.ChoiceImpl;
|
import mage.choices.ChoiceImpl;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import static mage.constants.Zone.BATTLEFIELD;
|
|
||||||
import static mage.constants.Zone.EXILED;
|
|
||||||
import static mage.constants.Zone.GRAVEYARD;
|
|
||||||
import static mage.constants.Zone.HAND;
|
|
||||||
import static mage.constants.Zone.LIBRARY;
|
|
||||||
import mage.counters.Counter;
|
import mage.counters.Counter;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.counters.Counters;
|
import mage.counters.Counters;
|
||||||
|
@ -77,6 +68,11 @@ import mage.util.GameLog;
|
||||||
import mage.util.RandomUtil;
|
import mage.util.RandomUtil;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public abstract class PlayerImpl implements Player, Serializable {
|
public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
|
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
|
||||||
|
@ -878,6 +874,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean putCardsOnBottomOfLibrary(Card card, Game game, Ability source, boolean anyOrder) {
|
||||||
|
return putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, anyOrder);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putCardsOnBottomOfLibrary(Cards cardsToLibrary, Game game, Ability source, boolean anyOrder) {
|
public boolean putCardsOnBottomOfLibrary(Cards cardsToLibrary, Game game, Ability source, boolean anyOrder) {
|
||||||
if (!cardsToLibrary.isEmpty()) {
|
if (!cardsToLibrary.isEmpty()) {
|
||||||
|
@ -2562,7 +2563,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
/**
|
/**
|
||||||
* @param game
|
* @param game
|
||||||
* @param appliedEffects
|
* @param appliedEffects
|
||||||
* @param numSides Number of sides the dice has
|
* @param numSides Number of sides the dice has
|
||||||
* @return the number that the player rolled
|
* @return the number that the player rolled
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -2596,10 +2597,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
/**
|
/**
|
||||||
* @param game
|
* @param game
|
||||||
* @param appliedEffects
|
* @param appliedEffects
|
||||||
* @param numberChaosSides The number of chaos sides the planar die
|
* @param numberChaosSides The number of chaos sides the planar die
|
||||||
* currently has (normally 1 but can be 5)
|
* currently has (normally 1 but can be 5)
|
||||||
* @param numberPlanarSides The number of chaos sides the planar die
|
* @param numberPlanarSides The number of chaos sides the planar die
|
||||||
* currently has (normally 1)
|
* currently has (normally 1)
|
||||||
* @return the outcome that the player rolled. Either ChaosRoll, PlanarRoll
|
* @return the outcome that the player rolled. Either ChaosRoll, PlanarRoll
|
||||||
* or NilRoll
|
* or NilRoll
|
||||||
*/
|
*/
|
||||||
|
@ -2756,7 +2757,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ability
|
* @param ability
|
||||||
* @param available if null, it won't be checked if enough mana is available
|
* @param available if null, it won't be checked if enough mana is available
|
||||||
* @param sourceObject
|
* @param sourceObject
|
||||||
* @param game
|
* @param game
|
||||||
* @return
|
* @return
|
||||||
|
@ -3308,7 +3309,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPaySacrificeCost(Permanent permanent, UUID sourceId,
|
public boolean canPaySacrificeCost(Permanent permanent, UUID sourceId,
|
||||||
UUID controllerId, Game game
|
UUID controllerId, Game game
|
||||||
) {
|
) {
|
||||||
return sacrificeCostFilter == null || !sacrificeCostFilter.match(permanent, sourceId, controllerId, game);
|
return sacrificeCostFilter == null || !sacrificeCostFilter.match(permanent, sourceId, controllerId, game);
|
||||||
}
|
}
|
||||||
|
@ -3456,8 +3457,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Card card, Zone toZone,
|
public boolean moveCards(Card card, Zone toZone,
|
||||||
Ability source, Game game,
|
Ability source, Game game,
|
||||||
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
||||||
) {
|
) {
|
||||||
Set<Card> cardList = new HashSet<>();
|
Set<Card> cardList = new HashSet<>();
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
@ -3468,22 +3469,22 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Cards cards, Zone toZone,
|
public boolean moveCards(Cards cards, Zone toZone,
|
||||||
Ability source, Game game
|
Ability source, Game game
|
||||||
) {
|
) {
|
||||||
return moveCards(cards.getCards(game), toZone, source, game);
|
return moveCards(cards.getCards(game), toZone, source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Set<Card> cards, Zone toZone,
|
public boolean moveCards(Set<Card> cards, Zone toZone,
|
||||||
Ability source, Game game
|
Ability source, Game game
|
||||||
) {
|
) {
|
||||||
return moveCards(cards, toZone, source, game, false, false, false, null);
|
return moveCards(cards, toZone, source, game, false, false, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Set<Card> cards, Zone toZone,
|
public boolean moveCards(Set<Card> cards, Zone toZone,
|
||||||
Ability source, Game game,
|
Ability source, Game game,
|
||||||
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
||||||
) {
|
) {
|
||||||
if (cards.isEmpty()) {
|
if (cards.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -3569,8 +3570,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardsToExile(Card card, Ability source,
|
public boolean moveCardsToExile(Card card, Ability source,
|
||||||
Game game, boolean withName, UUID exileId,
|
Game game, boolean withName, UUID exileId,
|
||||||
String exileZoneName
|
String exileZoneName
|
||||||
) {
|
) {
|
||||||
Set<Card> cards = new HashSet<>();
|
Set<Card> cards = new HashSet<>();
|
||||||
cards.add(card);
|
cards.add(card);
|
||||||
|
@ -3579,8 +3580,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardsToExile(Set<Card> cards, Ability source,
|
public boolean moveCardsToExile(Set<Card> cards, Ability source,
|
||||||
Game game, boolean withName, UUID exileId,
|
Game game, boolean withName, UUID exileId,
|
||||||
String exileZoneName
|
String exileZoneName
|
||||||
) {
|
) {
|
||||||
if (cards.isEmpty()) {
|
if (cards.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -3595,14 +3596,14 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId,
|
public boolean moveCardToHandWithInfo(Card card, UUID sourceId,
|
||||||
Game game
|
Game game
|
||||||
) {
|
) {
|
||||||
return this.moveCardToHandWithInfo(card, sourceId, game, true);
|
return this.moveCardToHandWithInfo(card, sourceId, game, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId,
|
public boolean moveCardToHandWithInfo(Card card, UUID sourceId,
|
||||||
Game game, boolean withName
|
Game game, boolean withName
|
||||||
) {
|
) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
Zone fromZone = game.getState().getZone(card.getId());
|
Zone fromZone = game.getState().getZone(card.getId());
|
||||||
|
@ -3627,7 +3628,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Card> moveCardsToGraveyardWithInfo(Set<Card> allCards, Ability source,
|
public Set<Card> moveCardsToGraveyardWithInfo(Set<Card> allCards, Ability source,
|
||||||
Game game, Zone fromZone
|
Game game, Zone fromZone
|
||||||
) {
|
) {
|
||||||
UUID sourceId = source == null ? null : source.getSourceId();
|
UUID sourceId = source == null ? null : source.getSourceId();
|
||||||
Set<Card> movedCards = new LinkedHashSet<>();
|
Set<Card> movedCards = new LinkedHashSet<>();
|
||||||
|
@ -3635,7 +3636,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// identify cards from one owner
|
// identify cards from one owner
|
||||||
Cards cards = new CardsImpl();
|
Cards cards = new CardsImpl();
|
||||||
UUID ownerId = null;
|
UUID ownerId = null;
|
||||||
for (Iterator<Card> it = allCards.iterator(); it.hasNext();) {
|
for (Iterator<Card> it = allCards.iterator(); it.hasNext(); ) {
|
||||||
Card card = it.next();
|
Card card = it.next();
|
||||||
if (cards.isEmpty()) {
|
if (cards.isEmpty()) {
|
||||||
ownerId = card.getOwnerId();
|
ownerId = card.getOwnerId();
|
||||||
|
@ -3696,7 +3697,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId,
|
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId,
|
||||||
Game game, Zone fromZone
|
Game game, Zone fromZone
|
||||||
) {
|
) {
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -3725,8 +3726,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId,
|
public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId,
|
||||||
Game game, Zone fromZone,
|
Game game, Zone fromZone,
|
||||||
boolean toTop, boolean withName
|
boolean toTop, boolean withName
|
||||||
) {
|
) {
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -3760,7 +3761,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId,
|
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId,
|
||||||
Game game, Zone fromZone, boolean withName) {
|
Game game, Zone fromZone, boolean withName) {
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue