mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
Refactor: extract card names compare logic (is empty name, is same name)
Fixed last broken tests
This commit is contained in:
parent
96187ad3c0
commit
02b7e2cf10
63 changed files with 614 additions and 466 deletions
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.common.continuous.BoostAllEffect;
|
||||
|
@ -12,15 +10,17 @@ import mage.constants.Duration;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Quercitron
|
||||
*/
|
||||
public final class BileBlight extends CardImpl {
|
||||
|
||||
public BileBlight(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}{B}");
|
||||
|
||||
|
||||
// Target creature and all creatures with the same name as that creature get -3/-3 until end of turn.
|
||||
|
@ -56,12 +56,12 @@ class BileBlightEffect extends BoostAllEffect {
|
|||
if (this.affectedObjectsSet) {
|
||||
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (target != null) {
|
||||
if (target.getName().isEmpty()) { // face down creature
|
||||
if (CardUtil.haveEmptyName(target)) { // face down creature
|
||||
affectedObjectList.add(new MageObjectReference(target, game));
|
||||
} else {
|
||||
String name = target.getName();
|
||||
for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
|
||||
if (perm.getName().equals(name)) {
|
||||
if (CardUtil.haveSameNames(perm.getName(), name)) {
|
||||
affectedObjectList.add(new MageObjectReference(perm, game));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -14,15 +12,17 @@ import mage.constants.Outcome;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public final class BrainPry extends CardImpl {
|
||||
|
||||
public BrainPry(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}");
|
||||
|
||||
//Name a nonland card. Target player reveals their hand. That player discards a card with that name. If he or she can't, you draw a card.
|
||||
this.getSpellAbility().addEffect((new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.NON_LAND_NAME)));
|
||||
|
@ -60,7 +60,7 @@ class BrainPryEffect extends OneShotEffect {
|
|||
if (targetPlayer != null && controller != null && sourceObject != null && cardName != null) {
|
||||
boolean hasDiscarded = false;
|
||||
for (Card card : targetPlayer.getHand().getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
targetPlayer.discard(card, source, game);
|
||||
hasDiscarded = true;
|
||||
break;
|
||||
|
|
|
@ -15,11 +15,11 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jonubuu
|
||||
*/
|
||||
public final class CabalTherapy extends CardImpl {
|
||||
|
@ -71,13 +71,13 @@ class CabalTherapyEffect extends OneShotEffect {
|
|||
for (Card card : hand.getCards(game)) {
|
||||
if (card.isSplitCard()) {
|
||||
SplitCard splitCard = (SplitCard) card;
|
||||
if (splitCard.getLeftHalfCard().getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(splitCard.getLeftHalfCard().getName(), cardName)) {
|
||||
targetPlayer.discard(card, source, game);
|
||||
} else if (splitCard.getRightHalfCard().getName().equals(cardName)) {
|
||||
} else if (CardUtil.haveSameNames(splitCard.getRightHalfCard().getName(), cardName)) {
|
||||
targetPlayer.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
targetPlayer.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -17,9 +15,11 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public final class CandlesOfLeng extends CardImpl {
|
||||
|
@ -73,7 +73,7 @@ class CandlesOfLengEffect extends OneShotEffect {
|
|||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
boolean hasTheSameName = false;
|
||||
for (UUID uuid : controller.getGraveyard()) {
|
||||
if (card.getName().equals(game.getCard(uuid).getName())) {
|
||||
if (CardUtil.haveSameNames(card, game.getCard(uuid))) {
|
||||
hasTheSameName = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
|
@ -136,7 +135,7 @@ class CircuDimirLobotomistRuleModifyingEffect extends ContinuousRuleModifyingEff
|
|||
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
|
||||
if ((exileZone != null)) {
|
||||
for (Card card : exileZone.getCards(game)) {
|
||||
if ((card.getName().equals(object.getName()))) {
|
||||
if (CardUtil.haveSameNames(card, object)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -18,9 +16,11 @@ import mage.constants.SubType;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public final class ConundrumSphinx extends CardImpl {
|
||||
|
@ -85,7 +85,7 @@ class ConundrumSphinxEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
Cards cards = new CardsImpl(card);
|
||||
player.revealCards(source, player.getName(), cards, game);
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
player.moveCards(cards, Zone.HAND, source, game);
|
||||
} else {
|
||||
player.putCardsOnBottomOfLibrary(cards, game, source, false);
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -18,12 +10,7 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TurnPhase;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.EquippedPredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -31,10 +18,12 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author rscoates
|
||||
*/
|
||||
public final class CorrosiveOoze extends CardImpl {
|
||||
|
@ -156,7 +145,7 @@ class CorrosiveOozeCombatWatcher extends Watcher {
|
|||
if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) {
|
||||
Permanent attacker = game.getPermanent(event.getTargetId());
|
||||
Permanent blocker = game.getPermanent(event.getSourceId());
|
||||
if (attacker != null && attacker.getName().equals("Corrosive Ooze")) { // To check for name is not working if Ooze is copied but name changed
|
||||
if (attacker != null && CardUtil.haveSameNames(attacker.getName(), "Corrosive Ooze")) { // To check for name is not working if Ooze is copied but name changed
|
||||
if (blocker != null && hasAttachedEquipment(game, blocker)) {
|
||||
MageObjectReference oozeMor = new MageObjectReference(attacker, game);
|
||||
HashSet<MageObjectReference> relatedCreatures = oozeBlocksOrBlocked.getOrDefault(oozeMor, new HashSet<>());
|
||||
|
@ -164,7 +153,7 @@ class CorrosiveOozeCombatWatcher extends Watcher {
|
|||
oozeBlocksOrBlocked.put(oozeMor, relatedCreatures);
|
||||
}
|
||||
}
|
||||
if (blocker != null && blocker.getName().equals("Corrosive Ooze")) {
|
||||
if (blocker != null && CardUtil.haveSameNames(blocker.getName(), "Corrosive Ooze")) {
|
||||
if (attacker != null && hasAttachedEquipment(game, attacker)) {
|
||||
MageObjectReference oozeMor = new MageObjectReference(blocker, game);
|
||||
HashSet<MageObjectReference> relatedCreatures = oozeBlocksOrBlocked.getOrDefault(oozeMor, new HashSet<>());
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -19,8 +18,9 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class CouncilOfTheAbsolute extends CardImpl {
|
||||
|
@ -92,7 +92,8 @@ class CouncilOfTheAbsoluteReplacementEffect extends ContinuousRuleModifyingEffec
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY))) {
|
||||
String needName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
||||
if (object != null && CardUtil.haveSameNames(object.getName(), needName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +123,8 @@ class CouncilOfTheAbsoluteCostReductionEffect extends CostModificationEffectImpl
|
|||
if ((abilityToModify instanceof SpellAbility)
|
||||
&& abilityToModify.isControlledBy(source.getControllerId())) {
|
||||
Card card = game.getCard(abilityToModify.getSourceId());
|
||||
return card.getName().equals(game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY));
|
||||
String needName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
||||
return CardUtil.haveSameNames(card.getName(), needName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -17,6 +15,9 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
|
@ -24,7 +25,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public final class CrownOfEmpires extends CardImpl {
|
||||
|
||||
public CrownOfEmpires(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
// {3}, {tap}: Tap target creature. Gain control of that creature instead if you control artifacts named Scepter of Empires and Throne of Empires.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CrownOfEmpiresEffect(), new GenericManaCost(3));
|
||||
|
@ -60,9 +61,9 @@ class CrownOfEmpiresEffect extends OneShotEffect {
|
|||
boolean scepter = false;
|
||||
boolean throne = false;
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
|
||||
if (permanent.getName().equals("Scepter of Empires")) {
|
||||
if (CardUtil.haveSameNames(permanent.getName(), "Scepter of Empires")) {
|
||||
scepter = true;
|
||||
} else if (permanent.getName().equals("Throne of Empires")) {
|
||||
} else if (CardUtil.haveSameNames(permanent.getName(), "Throne of Empires")) {
|
||||
throne = true;
|
||||
}
|
||||
if (scepter && throne) break;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -16,11 +15,12 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*
|
||||
*/
|
||||
public final class CursedScroll extends CardImpl {
|
||||
|
||||
|
@ -70,7 +70,7 @@ class CursedScrollEffect extends OneShotEffect {
|
|||
}
|
||||
revealed.add(card);
|
||||
controller.revealCards(sourceObject.getIdName(), revealed, game);
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (creature != null) {
|
||||
creature.damage(2, source.getSourceId(), game, false, true);
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -20,9 +16,13 @@ import mage.game.permanent.PermanentToken;
|
|||
import mage.game.permanent.token.ClueArtifactToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||
*/
|
||||
public final class DeclarationInStone extends CardImpl {
|
||||
|
@ -66,7 +66,7 @@ class DeclarationInStoneEffect extends OneShotEffect {
|
|||
if (targetPermanent != null) {
|
||||
Set<Card> cardsToExile = new HashSet<>();
|
||||
int nonTokenCount = 0;
|
||||
if (targetPermanent.getName().isEmpty()) { // face down creature
|
||||
if (CardUtil.haveEmptyName(targetPermanent)) { // face down creature
|
||||
cardsToExile.add(targetPermanent);
|
||||
if (!(targetPermanent instanceof PermanentToken)) {
|
||||
nonTokenCount++;
|
||||
|
@ -78,7 +78,7 @@ class DeclarationInStoneEffect extends OneShotEffect {
|
|||
}
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, targetPermanent.getControllerId(), game)) {
|
||||
if (!permanent.getId().equals(targetPermanent.getId())
|
||||
&& permanent.getName().equals(targetPermanent.getName())) {
|
||||
&& CardUtil.haveSameNames(permanent, targetPermanent)) {
|
||||
cardsToExile.add(permanent);
|
||||
// exiled count only matters for non-tokens
|
||||
if (!(permanent instanceof PermanentToken)) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -18,9 +17,11 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class DementiaSliver extends CardImpl {
|
||||
|
@ -44,9 +45,9 @@ public final class DementiaSliver extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
||||
new GainAbilityAllEffect(gainedAbility, Duration.WhileOnBattlefield, filter,
|
||||
"All Slivers have \"{T}: Choose a card name. "
|
||||
+ "Target opponent reveals a card at random from their hand."
|
||||
+ " If that card has the chosen name, that player discards it."
|
||||
+ " Activate this ability only during your turn.\""
|
||||
+ "Target opponent reveals a card at random from their hand."
|
||||
+ " If that card has the chosen name, that player discards it."
|
||||
+ " Activate this ability only during your turn.\""
|
||||
)
|
||||
));
|
||||
}
|
||||
|
@ -84,7 +85,7 @@ class DementiaSliverEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
revealed.add(card);
|
||||
opponent.revealCards(sourceObject.getName(), revealed, game);
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
opponent.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
|
@ -11,19 +9,21 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetSpell;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
public final class Denied extends CardImpl {
|
||||
|
||||
public Denied(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
|
||||
|
||||
// Choose a card name, then target spell's controller reveals their hand. If a card with the chosen name is revealed this way, counter that spell.
|
||||
this.getSpellAbility().addEffect(new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.ALL));
|
||||
this.getSpellAbility().addEffect(new DeniedEffect());
|
||||
|
@ -63,7 +63,7 @@ class DeniedEffect extends OneShotEffect {
|
|||
player.revealCards("Denied!", player.getHand(), game, true);
|
||||
String namedCard = (String) object;
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
if (card != null && card.getName().equals(namedCard)) {
|
||||
if (card != null && CardUtil.haveSameNames(card.getName(), namedCard)) {
|
||||
game.getStack().counter(targetSpell.getId(), source.getSourceId(), game);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -25,8 +23,9 @@ import mage.target.TargetPermanent;
|
|||
import mage.util.CardUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class DetentionSphere extends CardImpl {
|
||||
|
@ -81,12 +80,12 @@ class DetentionSphereEntersEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && exileId != null && targetPermanent != null && controller != null) {
|
||||
|
||||
if (targetPermanent.getName().isEmpty()) { // face down creature
|
||||
if (CardUtil.haveEmptyName(targetPermanent)) { // face down creature
|
||||
controller.moveCardToExileWithInfo(targetPermanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true);
|
||||
} else {
|
||||
String name = targetPermanent.getName();
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
|
||||
if (permanent != null && permanent.getName().equals(name)) {
|
||||
if (permanent != null && CardUtil.haveSameNames(permanent.getName(), name)) {
|
||||
controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -21,9 +19,11 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author maxlebedev
|
||||
*/
|
||||
public final class DiviningWitch extends CardImpl {
|
||||
|
@ -92,7 +92,7 @@ public final class DiviningWitch extends CardImpl {
|
|||
if (card != null) {
|
||||
cardsToReaveal.add(card);
|
||||
// Put that card into your hand
|
||||
if (card.getName().equals(name)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), name)) {
|
||||
cardToHand = card;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -13,20 +11,18 @@ import mage.abilities.keyword.HasteAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class DragonlordKolaghan extends CardImpl {
|
||||
|
@ -95,7 +91,7 @@ class DragonlordKolaghanTriggeredAbility extends TriggeredAbilityImpl {
|
|||
Player opponent = game.getPlayer(event.getPlayerId());
|
||||
boolean sameName = false;
|
||||
for (Card graveCard : opponent.getGraveyard().getCards(game)) {
|
||||
if (graveCard.getName().equals(spell.getName())) {
|
||||
if (CardUtil.haveSameNames(graveCard, spell)) {
|
||||
sameName = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -12,6 +10,9 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetEnchantmentPermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Loki
|
||||
|
@ -19,7 +20,7 @@ import mage.target.common.TargetEnchantmentPermanent;
|
|||
public final class EchoingCalm extends CardImpl {
|
||||
|
||||
public EchoingCalm(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
|
||||
|
||||
|
||||
// Destroy target enchantment and all other enchantments with the same name as that enchantment.
|
||||
|
@ -58,9 +59,9 @@ class EchoingCalmEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && permanent != null) {
|
||||
permanent.destroy(source.getSourceId(), game, false);
|
||||
if (!permanent.getName().isEmpty()) { // in case of face down enchantment creature
|
||||
if (!CardUtil.haveEmptyName(permanent)) { // in case of face down enchantment creature
|
||||
for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
|
||||
if (!perm.getId().equals(permanent.getId()) && perm.getName().equals(permanent.getName()) && perm.isEnchantment()) {
|
||||
if (!perm.getId().equals(permanent.getId()) && CardUtil.haveSameNames(perm, permanent) && perm.isEnchantment()) {
|
||||
perm.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -17,15 +15,17 @@ import mage.filter.predicate.permanent.PermanentIdPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class EchoingCourage extends CardImpl {
|
||||
|
||||
public EchoingCourage(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}");
|
||||
|
||||
|
||||
// Target creature and all other creatures with the same name as that creature get +2/+2 until end of turn.
|
||||
|
@ -64,12 +64,12 @@ class EchoingCourageEffect extends OneShotEffect {
|
|||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (targetPermanent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
if (targetPermanent.getName().isEmpty()) {
|
||||
if (CardUtil.haveEmptyName(targetPermanent)) {
|
||||
filter.add(new PermanentIdPredicate(targetPermanent.getId())); // if no name (face down creature) only the creature itself is selected
|
||||
} else {
|
||||
filter.add(new NamePredicate(targetPermanent.getName()));
|
||||
}
|
||||
ContinuousEffect effect = new BoostAllEffect(2,2, Duration.EndOfTurn, filter, false);
|
||||
ContinuousEffect effect = new BoostAllEffect(2, 2, Duration.EndOfTurn, filter, false);
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -17,15 +15,17 @@ import mage.filter.predicate.permanent.PermanentIdPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class EchoingDecay extends CardImpl {
|
||||
|
||||
public EchoingDecay(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
|
||||
|
||||
// Target creature and all other creatures with the same name as that creature get -2/-2 until end of turn.
|
||||
this.getSpellAbility().addEffect(new EchoingDecayEffect());
|
||||
|
@ -63,12 +63,12 @@ class EchoingDecayEffect extends OneShotEffect {
|
|||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (targetPermanent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
if (targetPermanent.getName().isEmpty()) {
|
||||
if (CardUtil.haveEmptyName(targetPermanent)) {
|
||||
filter.add(new PermanentIdPredicate(targetPermanent.getId())); // if no name (face down creature) only the creature itself is selected
|
||||
} else {
|
||||
filter.add(new NamePredicate(targetPermanent.getName()));
|
||||
}
|
||||
ContinuousEffect effect = new BoostAllEffect(-2,-2, Duration.EndOfTurn, filter, false);
|
||||
ContinuousEffect effect = new BoostAllEffect(-2, -2, Duration.EndOfTurn, filter, false);
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -14,21 +12,23 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class EchoingRuin extends CardImpl {
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifact");
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifact");
|
||||
|
||||
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.ARTIFACT));
|
||||
}
|
||||
|
||||
public EchoingRuin(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}");
|
||||
|
||||
// Destroy target artifact and all other artifacts with the same name as that artifact.
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(filter));
|
||||
|
@ -66,9 +66,9 @@ class EchoingRuinEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && permanent != null) {
|
||||
permanent.destroy(source.getSourceId(), game, false);
|
||||
if (!permanent.getName().isEmpty()) { // in case of face down artifact creature
|
||||
if (!CardUtil.haveEmptyName(permanent)) { // in case of face down artifact creature
|
||||
for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
|
||||
if (!perm.getId().equals(permanent.getId()) && perm.getName().equals(permanent.getName()) && perm.isArtifact()) {
|
||||
if (!perm.getId().equals(permanent.getId()) && CardUtil.haveSameNames(perm, permanent) && perm.isArtifact()) {
|
||||
perm.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -20,15 +18,17 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetNonlandPermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class EchoingTruth extends CardImpl {
|
||||
|
||||
public EchoingTruth(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||
|
||||
// Return target nonland permanent and all other permanents with the same name as that permanent to their owners' hands.
|
||||
Target target = new TargetNonlandPermanent();
|
||||
|
@ -67,7 +67,7 @@ class ReturnToHandAllNamedPermanentsEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (controller != null && permanent != null) {
|
||||
FilterPermanent filter = new FilterPermanent();
|
||||
if (permanent.getName().isEmpty()) {
|
||||
if (CardUtil.haveEmptyName(permanent)) {
|
||||
filter.add(new PermanentIdPredicate(permanent.getId())); // if no name (face down creature) only the creature itself is selected
|
||||
} else {
|
||||
filter.add(new NamePredicate(permanent.getName()));
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -24,10 +22,12 @@ import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward
|
||||
*/
|
||||
public final class EvilTwin extends CardImpl {
|
||||
|
@ -90,7 +90,7 @@ class EvilTwinPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlaye
|
|||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent permanent = input.getObject();
|
||||
Permanent twin = game.getPermanent(input.getSourceId());
|
||||
return permanent != null && twin != null && !twin.getName().isEmpty() && permanent.getName().equals(twin.getName());
|
||||
return CardUtil.haveSameNames(permanent, twin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -17,21 +15,23 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Quercitron & L_J
|
||||
*/
|
||||
public final class Foreshadow extends CardImpl {
|
||||
|
||||
public Foreshadow(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||
|
||||
// Choose a card name, then target opponent puts the top card of their library into their graveyard. If that card has the chosen name, you draw a card.
|
||||
this.getSpellAbility().addEffect(new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.ALL));
|
||||
this.getSpellAbility().addEffect(new ForeshadowEffect());
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
|
||||
|
||||
// Draw a card at the beginning of the next turn's upkeep.
|
||||
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(
|
||||
new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(1)), false));
|
||||
|
@ -72,8 +72,8 @@ class ForeshadowEffect extends OneShotEffect {
|
|||
Card card = targetPlayer.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
if (card.getName().equals(cardName)) {
|
||||
controller.drawCards(1, game);
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
controller.drawCards(1, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -14,15 +12,17 @@ import mage.filter.predicate.permanent.PermanentIdPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class HomingLightning extends CardImpl {
|
||||
|
||||
public HomingLightning(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{R}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}{R}");
|
||||
|
||||
|
||||
// Homing Lightning deals 4 damage to target creature and each other creature with the same name as that creature.
|
||||
|
@ -58,7 +58,7 @@ class HomingLightningEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
if (targetPermanent.getName().isEmpty()) {
|
||||
if (CardUtil.haveEmptyName(targetPermanent)) {
|
||||
filter.add(new PermanentIdPredicate(targetPermanent.getId())); // if no name (face down creature) only the creature itself is selected
|
||||
} else {
|
||||
filter.add(new NamePredicate(targetPermanent.getName()));
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -12,8 +10,8 @@ import mage.abilities.keyword.HasteAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
|
@ -21,15 +19,17 @@ import mage.filter.predicate.permanent.PermanentIdPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class IzzetStaticaster extends CardImpl {
|
||||
|
||||
public IzzetStaticaster(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{R}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
|
||||
|
@ -79,7 +79,7 @@ class IzzetStaticasterDamageEffect extends OneShotEffect {
|
|||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (targetPermanent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
if (targetPermanent.getName().isEmpty()) {
|
||||
if (CardUtil.haveEmptyName(targetPermanent)) {
|
||||
filter.add(new PermanentIdPredicate(targetPermanent.getId())); // if no name (face down creature) only the creature itself is selected
|
||||
} else {
|
||||
filter.add(new NamePredicate(targetPermanent.getName()));
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -14,9 +13,11 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public final class LammastideWeave extends CardImpl {
|
||||
|
@ -70,7 +71,7 @@ class LammastideWeaveEffect extends OneShotEffect {
|
|||
Card card = targetPlayer.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
controller.gainLife(card.getConvertedManaCost(), game, source);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
|
@ -20,9 +18,11 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
public final class LiarsPendulum extends CardImpl {
|
||||
|
@ -93,7 +93,7 @@ class LiarsPendulumEffect extends OneShotEffect {
|
|||
rightGuess = opponentGuess;
|
||||
}
|
||||
}
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
rightGuess = opponentGuess;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -10,11 +8,7 @@ import mage.abilities.costs.common.TapSourceCost;
|
|||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
|
@ -23,9 +17,11 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class MagusOfTheScroll extends CardImpl {
|
||||
|
@ -80,7 +76,7 @@ class MagusOfTheScrollEffect extends OneShotEffect {
|
|||
}
|
||||
revealed.add(card);
|
||||
you.revealCards(sourceObject.getName(), revealed, game);
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (creature != null) {
|
||||
creature.damage(2, source.getSourceId(), game, false, true);
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
|
@ -43,7 +40,7 @@ import mage.players.Player;
|
|||
public final class PalisadeGiant extends CardImpl {
|
||||
|
||||
public PalisadeGiant(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}");
|
||||
this.subtype.add(SubType.GIANT);
|
||||
this.subtype.add(SubType.SOLDIER);
|
||||
|
||||
|
@ -51,7 +48,7 @@ public final class PalisadeGiant extends CardImpl {
|
|||
this.toughness = new MageInt(7);
|
||||
|
||||
// All damage that would be dealt to you or another permanent you control is dealt to Palisade Giant instead.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PalisadeGiantReplacementEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PalisadeGiantReplacementEffect()));
|
||||
}
|
||||
|
||||
public PalisadeGiant(final PalisadeGiant card) {
|
||||
|
@ -77,7 +74,7 @@ class PalisadeGiantReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
switch(event.getType()) {
|
||||
switch (event.getType()) {
|
||||
case DAMAGE_CREATURE:
|
||||
case DAMAGE_PLAYER:
|
||||
case DAMAGE_PLANESWALKER:
|
||||
|
@ -89,17 +86,15 @@ class PalisadeGiantReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER && event.getPlayerId().equals(source.getControllerId()))
|
||||
{
|
||||
return true;
|
||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER && event.getPlayerId().equals(source.getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER)
|
||||
{
|
||||
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER) {
|
||||
Permanent targetPermanent = game.getPermanent(event.getTargetId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (targetPermanent != null &&
|
||||
if (targetPermanent != null &&
|
||||
targetPermanent.isControlledBy(source.getControllerId()) &&
|
||||
!targetPermanent.getName().equals(sourcePermanent.getName())) { // no redirection from or to other Palisade Giants
|
||||
!CardUtil.haveSameNames(targetPermanent, sourcePermanent)) { // no redirection from or to other Palisade Giants
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +103,7 @@ class PalisadeGiantReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
DamageEvent damageEvent = (DamageEvent)event;
|
||||
DamageEvent damageEvent = (DamageEvent) event;
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
// get name of old target
|
||||
|
@ -118,13 +113,11 @@ class PalisadeGiantReplacementEffect extends ReplacementEffectImpl {
|
|||
message.append(damageEvent.getAmount()).append(" damage redirected from ");
|
||||
if (targetPermanent != null) {
|
||||
message.append(targetPermanent.getName());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Player targetPlayer = game.getPlayer(event.getTargetId());
|
||||
if (targetPlayer != null) {
|
||||
message.append(targetPlayer.getLogName());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
message.append("unknown");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -20,8 +18,9 @@ import mage.players.Player;
|
|||
import mage.target.TargetPlayer;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com & L_J
|
||||
*/
|
||||
public final class PetraSphinx extends CardImpl {
|
||||
|
@ -79,7 +78,7 @@ class PetraSphinxEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
Cards cards = new CardsImpl(card);
|
||||
player.revealCards(source, cards, game);
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
player.moveCards(cards, Zone.HAND, source, game);
|
||||
} else {
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
|
@ -13,9 +12,11 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Quercitron
|
||||
*/
|
||||
public final class Predict extends CardImpl {
|
||||
|
@ -66,7 +67,7 @@ class PredictEffect extends OneShotEffect {
|
|||
Card card = targetPlayer.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
amount = 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.CopyTargetSpellEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
|
@ -17,19 +14,21 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public final class PyromancerAscension extends CardImpl {
|
||||
|
||||
public PyromancerAscension(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
|
||||
// Whenever you cast an instant or sorcery spell that has the same name as a card in your graveyard, you may put a quest counter on Pyromancer Ascension.
|
||||
this.addAbility(new PyromancerAscensionQuestTriggeredAbility());
|
||||
|
||||
|
||||
// Whenever you cast an instant or sorcery spell while Pyromancer Ascension has two or more quest counters on it, you may copy that spell. You may choose new targets for the copy.
|
||||
this.addAbility(new PyromancerAscensionCopyTriggeredAbility());
|
||||
}
|
||||
|
@ -75,21 +74,21 @@ class PyromancerAscensionQuestTriggeredAbility extends TriggeredAbilityImpl {
|
|||
for (UUID uuid : game.getPlayer(this.getControllerId()).getGraveyard()) {
|
||||
if (!uuid.equals(sourceCard.getId())) {
|
||||
Card card = game.getCard(uuid);
|
||||
if (card != null && card.getName().equals(sourceCard.getName())) {
|
||||
if (CardUtil.haveSameNames(card, sourceCard)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isControlledInstantOrSorcery(Spell spell) {
|
||||
return spell != null &&
|
||||
(spell.isControlledBy(this.getControllerId())) &&
|
||||
(spell.isInstant() || spell.isSorcery());
|
||||
return spell != null &&
|
||||
(spell.isControlledBy(this.getControllerId())) &&
|
||||
(spell.isInstant() || spell.isSorcery());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -112,12 +111,12 @@ class PyromancerAscensionCopyTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public PyromancerAscensionCopyTriggeredAbility copy() {
|
||||
return new PyromancerAscensionCopyTriggeredAbility(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.SPELL_CAST;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||
|
@ -134,9 +133,9 @@ class PyromancerAscensionCopyTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
|
||||
private boolean isControlledInstantOrSorcery(Spell spell) {
|
||||
return spell != null &&
|
||||
(spell.isControlledBy(this.getControllerId())) &&
|
||||
(spell.isInstant() || spell.isSorcery());
|
||||
return spell != null &&
|
||||
(spell.isControlledBy(this.getControllerId())) &&
|
||||
(spell.isInstant() || spell.isSorcery());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -11,12 +8,7 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -25,9 +17,12 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class ReflectorMage extends CardImpl {
|
||||
|
@ -84,7 +79,7 @@ class ReflectorMageEffect extends OneShotEffect {
|
|||
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (targetCreature != null) {
|
||||
controller.moveCards(targetCreature, Zone.HAND, source, game);
|
||||
if (!targetCreature.getName().isEmpty()) { // if the creature had no name, no restrict effect will be created
|
||||
if (!CardUtil.haveEmptyName(targetCreature)) { // if the creature had no name, no restrict effect will be created
|
||||
game.addEffect(new ExclusionRitualReplacementEffect(targetCreature.getName(), targetCreature.getOwnerId()), source);
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +120,7 @@ class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl
|
|||
if (spell != null && spell.isFaceDown(game)) {
|
||||
return false; // Face Down cast spell (Morph creature) has no name
|
||||
}
|
||||
return card.getName().equals(creatureName) && Objects.equals(ownerId, card.getOwnerId());
|
||||
return CardUtil.haveSameNames(card.getName(), creatureName) && Objects.equals(ownerId, card.getOwnerId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -22,9 +20,11 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.game.turn.TurnMod;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class SearchTheCity extends CardImpl {
|
||||
|
@ -157,7 +157,7 @@ class SearchTheCityExiledCardToHandEffect extends OneShotEffect {
|
|||
ExileZone searchTheCityExileZone = game.getExile().getExileZone(source.getSourceId());
|
||||
if (cardName != null && searchTheCityExileZone != null) {
|
||||
for (Card card : searchTheCityExileZone.getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
if (card.moveToZone(Zone.HAND, source.getSourceId(), game, true)) {
|
||||
game.informPlayers("Search the City: put " + card.getName() + " into owner's hand");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -19,15 +17,17 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class SeverTheBloodline extends CardImpl {
|
||||
|
||||
public SeverTheBloodline(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
|
||||
|
||||
|
||||
// Exile target creature and all other creatures with the same name as that creature.
|
||||
|
@ -69,7 +69,7 @@ class SeverTheBloodlineEffect extends OneShotEffect {
|
|||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (controller != null && targetPermanent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
if (targetPermanent.getName().isEmpty()) {
|
||||
if (CardUtil.haveEmptyName(targetPermanent)) {
|
||||
filter.add(new PermanentIdPredicate(targetPermanent.getId())); // if no name (face down creature) only the creature itself is selected
|
||||
} else {
|
||||
filter.add(new NamePredicate(targetPermanent.getName()));
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
*/
|
||||
public final class SpoilsOfTheVault extends CardImpl {
|
||||
|
@ -71,7 +68,7 @@ class SpoilsOfTheVaultEffect extends OneShotEffect {
|
|||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
if (card != null) {
|
||||
cardsToReveal.add(card);
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
break;
|
||||
} else {
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -21,9 +17,14 @@ import mage.players.Player;
|
|||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class ThoughtHemorrhage extends CardImpl {
|
||||
|
@ -74,7 +75,7 @@ class ThoughtHemorrhageEffect extends OneShotEffect {
|
|||
targetPlayer.revealCards("hand of " + targetPlayer.getName(), targetPlayer.getHand(), game);
|
||||
int cardsFound = 0;
|
||||
for (Card card : targetPlayer.getHand().getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
cardsFound++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||
*/
|
||||
public final class TunnelVision extends CardImpl {
|
||||
|
@ -76,7 +73,7 @@ class TunnelVisionEffect extends OneShotEffect {
|
|||
|
||||
for (Card card : targetPlayer.getLibrary().getCards(game)) {
|
||||
cardsToReveal.add(card);
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
namedCard = card;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.v;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -18,9 +16,11 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com & L_J
|
||||
*/
|
||||
public final class VexingArcanix extends CardImpl {
|
||||
|
@ -74,7 +74,7 @@ class VexingArcanixEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
Cards cards = new CardsImpl(card);
|
||||
player.revealCards(sourceObject.getIdName(), cards, game);
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
player.moveCards(cards, Zone.HAND, source, game);
|
||||
} else {
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
package org.mage.test.clientside.base;
|
||||
|
||||
import java.rmi.NotBoundException;
|
||||
import java.rmi.RemoteException;
|
||||
import java.rmi.registry.LocateRegistry;
|
||||
import java.rmi.registry.Registry;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import mage.constants.MultiplayerAttackOption;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.game.match.MatchOptions;
|
||||
|
@ -20,7 +12,15 @@ import mage.interfaces.callback.ClientCallback;
|
|||
import mage.server.Main;
|
||||
import mage.sets.Sets;
|
||||
import mage.util.Logging;
|
||||
import mage.view.*;
|
||||
|
||||
import java.rmi.NotBoundException;
|
||||
import java.rmi.RemoteException;
|
||||
import java.rmi.registry.LocateRegistry;
|
||||
import java.rmi.registry.Registry;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Base for starting Mage server. Controls interactions between MageAPI and Mage
|
||||
|
@ -205,7 +205,7 @@ public class MageBase {
|
|||
}
|
||||
gameView = server.getGameView(gameId, sessionId, playerId);
|
||||
for (CardView card : gameView.getHand().values()) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class MageBase {
|
|||
CardsView cards = gameView.getHand();
|
||||
CardView cardToPlay = null;
|
||||
for (CardView card : cards.values()) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName)) {
|
||||
cardToPlay = card;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -10,7 +10,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ManifestTest extends CardTestPlayerBase {
|
||||
|
@ -34,15 +33,16 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
// not tapped
|
||||
assertTapped("", false);
|
||||
assertTapped(EmptyNames.FACE_DOWN_CREATURE.toString(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,13 +66,14 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
// PlayerB's Silvercoat Lion should not have get -1/-1/
|
||||
assertPermanentCount(playerB, "Silvercoat Lion", 1);
|
||||
assertPowerToughness(playerB, "Silvercoat Lion", 2, 2);
|
||||
|
@ -101,6 +102,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
@ -108,8 +110,8 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Reality Shift", 1);
|
||||
assertExileCount("Silvercoat Lion", 1);
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
// PlayerA's Pillarfield Ox should not have get -1/-1/
|
||||
assertPermanentCount(playerB, "Pillarfield Ox", 1);
|
||||
assertPowerToughness(playerB, "Pillarfield Ox", 2, 4);
|
||||
|
@ -137,6 +139,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
@ -144,8 +147,8 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Reality Shift", 1);
|
||||
assertExileCount("Silvercoat Lion", 1);
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
|
||||
}
|
||||
|
||||
|
@ -173,6 +176,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
@ -180,8 +184,8 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Reality Shift", 1);
|
||||
assertExileCount("Silvercoat Lion", 1);
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
assertPowerToughness(playerA, "Foundry Street Denizen", 1, 1);
|
||||
|
||||
}
|
||||
|
@ -199,7 +203,6 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
// Strive — Silence the Believers costs more to cast for each target beyond the first.
|
||||
// Exile any number of target creatures and all Auras attached to them.
|
||||
addCard(Zone.HAND, playerB, "Silence the Believers");
|
||||
addTarget(playerB, "");
|
||||
// Gore Swine {2}{R}
|
||||
// 4/1
|
||||
addCard(Zone.LIBRARY, playerA, "Gore Swine");
|
||||
|
@ -210,10 +213,13 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
skipInitShuffling();
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Reality Shift", "Silvercoat Lion");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Silence the Believers", "");
|
||||
showBattlefield("A battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerA);
|
||||
showBattlefield("B battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerB);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Silence the Believers", EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
@ -222,7 +228,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertExileCount("Silvercoat Lion", 1);
|
||||
assertExileCount("Gore Swine", 1);
|
||||
// no facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
|
||||
for (Card card : currentGame.getExile().getAllCards(currentGame)) {
|
||||
if (card.getName().equals("Gore Swine")) {
|
||||
|
@ -248,10 +254,11 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
skipInitShuffling();
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}{B}, {T}, Sacrifice another creature");
|
||||
addTarget(playerB, "Silvercoat Lion");
|
||||
setChoice(playerB, "Silvercoat Lion");
|
||||
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
@ -261,7 +268,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerB, "", 1);
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
}
|
||||
|
||||
|
@ -284,12 +291,13 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
skipInitShuffling();
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}{B}, {T}, Sacrifice another creature");
|
||||
addTarget(playerB, "Silvercoat Lion");
|
||||
setChoice(playerB, "Silvercoat Lion");
|
||||
|
||||
activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "{5}{G}: Turn");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
@ -297,7 +305,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||
|
||||
assertPermanentCount(playerB, "", 0);
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerB, "Aerie Bowmasters", 1);
|
||||
assertPowerToughness(playerB, "Aerie Bowmasters", 4, 5); // 3/4 and the +1/+1 counter from Megamorph
|
||||
Permanent aerie = getPermanent("Aerie Bowmasters", playerB);
|
||||
|
@ -308,7 +316,6 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
/**
|
||||
* When a Forest came manifested into play my Courser of Kruphix gained me a
|
||||
* life.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testManifestForest() {
|
||||
|
@ -328,10 +335,11 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
skipInitShuffling();
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}{B}, {T}, Sacrifice another creature");
|
||||
addTarget(playerB, "Silvercoat Lion");
|
||||
setChoice(playerB, "Silvercoat Lion");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
@ -339,13 +347,12 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||
|
||||
assertPermanentCount(playerB, "", 1);
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Whisperwood Elemental - Its sacrifice ability doesn't work..
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testWhisperwoodElemental() {
|
||||
|
@ -365,6 +372,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
@ -374,14 +382,13 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Whisperwood Elemental", 1);
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 2);
|
||||
|
||||
assertPermanentCount(playerB, "", 2);
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 2);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* I sacrificed a manifested face-down Smothering Abomination to Nantuko
|
||||
* Husk and it made me draw a card.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testDiesTriggeredAbilitiesOfManifestedCreatures() {
|
||||
|
@ -409,10 +416,11 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
setChoice(playerB, "Silvercoat Lion");
|
||||
|
||||
activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Sacrifice a creature");
|
||||
setChoice(playerB, "");
|
||||
setChoice(playerB, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.Filter;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
|
@ -57,8 +54,8 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
|
||||
}
|
||||
|
||||
|
@ -73,7 +70,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{4}{G}: Turn this face-down permanent face up.");
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
|
@ -81,7 +78,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerB, 18);
|
||||
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerA, "Pine Walker", 1);
|
||||
assertPowerToughness(playerA, "Pine Walker", 5, 5);
|
||||
assertTapped("Pine Walker", false);
|
||||
|
@ -106,8 +103,8 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Icefeather Aven", NO_TARGET, "Pine Walker", StackClause.WHILE_NOT_ON_STACK);
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
attack(3, playerA, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
activateAbility(3, PhaseStep.DECLARE_BLOCKERS, playerA, "{1}{G}{U}: Turn this face-down permanent face up.");
|
||||
setChoice(playerA, "No"); // Don't use return permanent to hand effect
|
||||
|
||||
|
@ -119,7 +116,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertHandCount(playerA, "Pine Walker", 0);
|
||||
assertHandCount(playerA, "Icefeather Aven", 0);
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPermanentCount(playerA, "Icefeather Aven", 1);
|
||||
assertTapped("Icefeather Aven", true);
|
||||
|
||||
|
@ -151,7 +148,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerB, 20); // and not 21
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPermanentCount(playerB, "Soldier of the Pantheon", 1);
|
||||
|
||||
}
|
||||
|
@ -176,22 +173,21 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Clever Impersonator");
|
||||
setChoice(playerB, "Yes"); // use to copy a nonland permanent
|
||||
addTarget(playerB, ""); // Morphed creature
|
||||
addTarget(playerB, EmptyNames.FACE_DOWN_CREATURE.toString()); // Morphed creature
|
||||
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerB, "", 1);
|
||||
assertPowerToughness(playerB, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
|
@ -223,7 +219,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertHandCount(playerA, "Pine Walker", 0);
|
||||
assertHandCount(playerB, "Doomwake Giant", 0);
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerB, "Doomwake Giant", 1);
|
||||
assertPermanentCount(playerA, "Pine Walker", 1);
|
||||
assertPowerToughness(playerA, "Pine Walker", 4, 4);
|
||||
|
@ -264,7 +260,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertHandCount(playerA, "Ponyback Brigade", 0);
|
||||
assertHandCount(playerB, "Doomwake Giant", 0);
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerA, "Goblin", 3);
|
||||
assertPowerToughness(playerA, "Goblin", 1, 1, Filter.ComparisonScope.Any);
|
||||
assertPermanentCount(playerB, "Doomwake Giant", 1);
|
||||
|
@ -337,7 +333,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
assertHandCount(playerA, "Sagu Mauler", 0);
|
||||
assertHandCount(playerB, "Disdainful Stroke", 1); // can't be cast
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
}
|
||||
|
||||
|
@ -366,18 +362,23 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sagu Mauler", NO_TARGET, "Sagu Mauler", StackClause.WHILE_NOT_ON_STACK);
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Echoing Decay", "");
|
||||
showBattlefield("A battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Echoing Decay", EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
showBattlefield("A battle after", 1, PhaseStep.END_TURN, playerA);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertHandCount(playerB, "Echoing Decay", 0);
|
||||
assertGraveyardCount(playerB, "Echoing Decay", 1);
|
||||
|
||||
assertHandCount(playerA, "Sagu Mauler", 0);
|
||||
assertHandCount(playerB, "Echoing Decay", 0);
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertGraveyardCount(playerA, "Sagu Mauler", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -462,7 +463,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ashcloud Phoenix");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
@ -503,7 +504,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(2, playerB, "Mirri, Cat Warrior");
|
||||
block(2, playerA, "", "Mirri, Cat Warrior");
|
||||
block(2, playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), "Mirri, Cat Warrior");
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
@ -539,20 +540,27 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Fury");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Supplant Form", "");
|
||||
showBattlefield("A battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerA);
|
||||
showBattlefield("B battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerB);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Supplant Form");
|
||||
addTarget(playerB, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
showBattlefield("A battle end", 1, PhaseStep.END_TURN, playerA);
|
||||
showBattlefield("B battle end", 1, PhaseStep.END_TURN, playerB);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertGraveyardCount(playerB, "Supplant Form", 1);
|
||||
assertHandCount(playerA, "Akroma, Angel of Fury", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerA, "Akroma, Angel of Fury", 0);
|
||||
assertGraveyardCount(playerB, "Supplant Form", 1);
|
||||
|
||||
assertPermanentCount(playerB, "Akroma, Angel of Fury", 0);
|
||||
assertPermanentCount(playerB, "", 1);
|
||||
assertPowerToughness(playerB, "", 2, 2);
|
||||
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_TOKEN.toString(), 1);
|
||||
assertPowerToughness(playerB, EmptyNames.FACE_DOWN_TOKEN.toString(), 2, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -578,7 +586,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
}
|
||||
|
||||
|
@ -603,7 +611,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{4}{G}: Turn this face-down permanent face up.");
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
|
@ -611,7 +619,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerB, 18);
|
||||
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerA, "Pine Walker", 1);
|
||||
assertPowerToughness(playerA, "Pine Walker", 5, 5);
|
||||
assertTapped("Pine Walker", false);
|
||||
|
@ -656,7 +664,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Reflector Mage", 1);
|
||||
assertPermanentCount(playerB, "Rattleclaw Mystic", 0);
|
||||
assertHandCount(playerB, "Rattleclaw Mystic", 0); // should have been replayed
|
||||
assertPermanentCount(playerB, "", 1); // Rattleclaw played as a morph
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 1); // Rattleclaw played as a morph
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -779,7 +787,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertGraveyardCount(playerB, "Fatal Push", 1);
|
||||
assertGraveyardCount(playerA, "Pine Walker", 1);
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
|
||||
}
|
||||
|
||||
|
@ -813,7 +821,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertHandCount(playerA, 0);
|
||||
|
||||
assertTappedCount("Island", true, 3);
|
||||
|
@ -848,7 +856,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Quicksilver Dragon");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.mage.test.cards.control;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Assert;
|
||||
|
@ -9,7 +10,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
/**
|
||||
* Tests the effect: - Exile target creature you control, then return that card
|
||||
* to the battlefield under your control
|
||||
*
|
||||
* <p>
|
||||
* This effect grants you permanent control over the returned creature. So you
|
||||
* mail steal opponent's creature with "Act of Treason" and then use this effect
|
||||
* for permanent control effect.
|
||||
|
@ -103,8 +104,8 @@ public class ExileAndReturnUnderYourControl extends CardTestPlayerBase {
|
|||
assertExileCount("Secret Plans", 0);
|
||||
assertPermanentCount(playerA, "Secret Plans", 1);
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 3);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
package org.mage.test.cards.copy;
|
||||
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.player.TestPlayer;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CopySpellTest extends CardTestPlayerBase {
|
||||
|
@ -17,29 +16,38 @@ public class CopySpellTest extends CardTestPlayerBase {
|
|||
public void copyChainOfVapor() {
|
||||
// Return target nonland permanent to its owner's hand. Then that permanent's controller may sacrifice a land. If the player does, he or she may copy this spell and may choose a new target for that copy.
|
||||
addCard(Zone.HAND, playerA, "Chain of Vapor", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 10);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 10);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox", 10);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 10);
|
||||
|
||||
// start chain from A - return pillar to hand
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chain of Vapor", "Pillarfield Ox");
|
||||
//setChoice(playerB, "Yes"); // want to sacrifice
|
||||
// chain 1 - B can return
|
||||
addTarget(playerB, "Island"); // select a land to sacrifice
|
||||
setChoice(playerB, "Yes"); // want to copy spell
|
||||
setChoice(playerB, "Yes"); // want to change target
|
||||
addTarget(playerB, "Silvercoat Lion"); // new target after copy
|
||||
// stop the chain on 0 land
|
||||
addTarget(playerB, "");
|
||||
// chain 2 - A can return
|
||||
addTarget(playerA, "Island"); // select a land to sacrifice
|
||||
setChoice(playerA, "Yes"); // want to copy spell
|
||||
setChoice(playerA, "Yes"); // want to change target
|
||||
addTarget(playerA, "Pillarfield Ox"); // new target after copy
|
||||
// stop the chain by B
|
||||
addTarget(playerB, TestPlayer.TARGET_SKIP);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerB, "Island", 1);
|
||||
assertHandCount(playerB, "Pillarfield Ox", 1);
|
||||
assertHandCount(playerA, "Silvercoat Lion", 1);
|
||||
assertHandCount(playerB, "Pillarfield Ox", 2);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 10 - 1);
|
||||
assertPermanentCount(playerB, "Pillarfield Ox", 10 - 2);
|
||||
assertGraveyardCount(playerA, "Island", 1);
|
||||
assertGraveyardCount(playerB, "Island", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -141,7 +149,7 @@ public class CopySpellTest extends CardTestPlayerBase {
|
|||
* before it is cast and therefore before Zada's ability triggers, e.g.
|
||||
* Desperate Ritual spliced onto Into the Fray should generate 3 red mana
|
||||
* for every creature i control.
|
||||
*
|
||||
* <p>
|
||||
* 702.46a Splice is a static ability that functions while a card is in your
|
||||
* hand. “Splice onto [subtype] [cost]” means “You may reveal this card from
|
||||
* your hand as you cast a [subtype] spell. If you do, copy this card's text
|
||||
|
@ -190,7 +198,7 @@ public class CopySpellTest extends CardTestPlayerBase {
|
|||
* {4}{U} Enchantment (Enchant Player) Whenever enchanted player casts an
|
||||
* instant or sorcery spell, each other player may copy that spell and may
|
||||
* choose new targets for the copy he or she controls.
|
||||
*
|
||||
* <p>
|
||||
* Reported bug: "A player with Curse of Echoes attached to them played
|
||||
* Bribery and the player who controlled the curse had control of all 3
|
||||
* copies. This seems to be the case for all spells."
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.mage.test.cards.dynamicvalue;
|
|||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.player.TestPlayer;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
|
@ -80,10 +81,11 @@ public class SweepTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plow Through Reito");
|
||||
addTarget(playerA, "Raging Goblin"); // target to boost
|
||||
addTarget(playerA, ""); // targets to sweep (zero)
|
||||
addTarget(playerA, TestPlayer.TARGET_SKIP); // targets to sweep (zero)
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Raging Goblin", 1);
|
||||
assertPermanentCount(playerA, "Plains", 5);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
package org.mage.test.cards.enchantments;
|
||||
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
|
@ -11,7 +11,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
||||
|
@ -22,7 +21,6 @@ public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
|||
* Starfield of Nyx not only turned both of them into creatures (it
|
||||
* shouldn't, because they're auras), but it also destroyed them. The
|
||||
* manifests stayed on the battlefield without Flying or Hexproof.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testCloudform() {
|
||||
|
@ -49,7 +47,7 @@ public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Thopter Spy Network", 0);
|
||||
assertPowerToughness(playerA, "", 2, 2, Filter.ComparisonScope.All); // the manifested cards
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2, Filter.ComparisonScope.All); // the manifested cards
|
||||
assertPermanentCount(playerA, "Starfield of Nyx", 1);
|
||||
assertPowerToughness(playerA, "Thopter Spy Network", 4, 4, Filter.ComparisonScope.All);
|
||||
assertPermanentCount(playerA, "Cloudform", 2);
|
||||
|
@ -97,19 +95,19 @@ public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
|||
Assert.assertEquals("Singing Bell Strike not on the battlefield", false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testStarfieldOfNyxLayers() {
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Starfield of Nyx"); // enchantments you control become creatures
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Humility"); // creatures lose all abilities and are 1/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Pharika, God of Affliction"); // enchantment
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Emrakul, the Aeons Torn"); //15/15 creature
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Crusade", 4); // enchantments to fulfill requirement of Starfield of Nyx
|
||||
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
|
||||
assertPowerToughness(playerA, "Pharika, God of Affliction", 3, 3, Filter.ComparisonScope.All);
|
||||
assertPowerToughness(playerA, "Humility", 4, 4, Filter.ComparisonScope.All);
|
||||
// Humility loses its ability in layer 6. Layer 7 never gets Humility's effect
|
||||
|
@ -117,6 +115,6 @@ public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
|||
Permanent emrakul = getPermanent("Emrakul, the Aeons Torn", playerA.getId());
|
||||
Assert.assertNotNull(emrakul);
|
||||
Assert.assertFalse(emrakul.getAbilities().contains(FlyingAbility.getInstance())); // loses flying though
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.mage.test.cards.facedown;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
|
@ -13,13 +14,12 @@ public class GhastlyConscriptionTest extends CardTestPlayerBase {
|
|||
/**
|
||||
* Ghastly Conscription
|
||||
* Sorcery, 5BB (7)
|
||||
* Exile all creature cards from target player's graveyard in a face-down pile,
|
||||
* shuffle that pile, then manifest those cards. (To manifest a card, put it
|
||||
* onto the battlefield face down as a 2/2 creature. Turn it face up any time
|
||||
* Exile all creature cards from target player's graveyard in a face-down pile,
|
||||
* shuffle that pile, then manifest those cards. (To manifest a card, put it
|
||||
* onto the battlefield face down as a 2/2 creature. Turn it face up any time
|
||||
* for its mana cost if it's a creature card.)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// test that cards exiled using Ghastly Conscription return face down
|
||||
@Test
|
||||
public void testGhastlyConscription() {
|
||||
|
@ -36,9 +36,9 @@ public class GhastlyConscriptionTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
|
||||
assertGraveyardCount(playerA, 2);
|
||||
assertPermanentCount(playerA, "", 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
|
||||
package org.mage.test.cards.facedown;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ObscuringAetherTest extends CardTestPlayerBase {
|
||||
|
@ -15,7 +14,6 @@ public class ObscuringAetherTest extends CardTestPlayerBase {
|
|||
/**
|
||||
* Obscuring Aether cannot turn into a face down 2/2 like it should. When
|
||||
* activating the ability to turn it over it, it dies immediately.
|
||||
*
|
||||
*/
|
||||
// test that cards exiled using Ghastly Conscription return face down
|
||||
@Test
|
||||
|
@ -35,8 +33,8 @@ public class ObscuringAetherTest extends CardTestPlayerBase {
|
|||
assertHandCount(playerA, "Obscuring Aether", 0);
|
||||
assertGraveyardCount(playerA, "Obscuring Aether", 0);
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package org.mage.test.cards.rules;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
|
@ -8,7 +8,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CantCastTest extends CardTestPlayerBase {
|
||||
|
@ -113,7 +112,7 @@ public class CantCastTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertHandCount(playerA, "Pine Walker", 1);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.mage.test.cards.single.fut;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
|
@ -50,8 +51,8 @@ public class MuragandaPetroglyphsTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 4, 4);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 4, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -69,8 +70,8 @@ public class MuragandaPetroglyphsTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -155,7 +156,7 @@ public class MuragandaPetroglyphsTest extends CardTestPlayerBase {
|
|||
// Enchanted creature doesn't untap during itscontroller's untap step.
|
||||
addCard(Zone.HAND, playerA, "Dehydration");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA,"Rancor", "Grizzly Bears");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rancor", "Grizzly Bears");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dehydration", "Runeclaw Bear");
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
package org.mage.test.cards.single.ths;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -10,26 +10,25 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class PurphorosGodOfTheForgeTest extends CardTestPlayerBase {
|
||||
/**
|
||||
* I had a situation come up today where I had a Purphoros on the field
|
||||
* and 5 devotion with an Eidolon and Phoenix. My opponent killed the
|
||||
* and 5 devotion with an Eidolon and Phoenix. My opponent killed the
|
||||
* Phoenix, but Purphoros still was "turned on".
|
||||
*/
|
||||
@Test
|
||||
public void testFacedownNotCountedForDevotion1() {
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 5);
|
||||
addCard(Zone.HAND, playerB, "Reach of Shadows");
|
||||
|
||||
|
||||
// Indestructible
|
||||
// As long as your devotion to red is less than five, Purphoros isn't a creature.
|
||||
// Whenever another creature enters the battlefield under your control, Purphoros deals 2 damage to each opponent.
|
||||
// {2}{R}: Creatures you control get +1/+0 until end of turn.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Purphoros, God of the Forge");
|
||||
|
||||
|
||||
// Whenever a player casts a spell with converted mana cost 3 or less,
|
||||
// Eidolon of the Great Revel deals 2 damage to that player.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Eidolon of the Great Revel");
|
||||
|
@ -46,24 +45,24 @@ public class PurphorosGodOfTheForgeTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 18); // 2 damage from the returning Phoenix
|
||||
|
||||
|
||||
assertGraveyardCount(playerB, "Reach of Shadows", 1);
|
||||
assertPermanentCount(playerA, "Ashcloud Phoenix", 0);
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
Permanent purphorosGodOfTheForge = getPermanent("Purphoros, God of the Forge", playerA);
|
||||
Assert.assertFalse("Purphoros may not be a creature but it is", purphorosGodOfTheForge.getCardType().contains(CardType.CREATURE));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testFacedownNotCountedForDevotion2() {
|
||||
public void testFacedownNotCountedForDevotion2() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
// Indestructible
|
||||
// As long as your devotion to red is less than five, Purphoros isn't a creature.
|
||||
// Whenever another creature enters the battlefield under your control, Purphoros deals 2 damage to each opponent.
|
||||
// {2}{R}: Creatures you control get +1/+0 until end of turn.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Purphoros, God of the Forge");
|
||||
|
||||
|
||||
// Whenever a player casts a spell with converted mana cost 3 or less,
|
||||
// Eidolon of the Great Revel deals 2 damage to that player.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Eidolon of the Great Revel");
|
||||
|
@ -81,18 +80,18 @@ public class PurphorosGodOfTheForgeTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Ashcloud Phoenix", 0);
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
assertLife(playerA, 18); // 2 damage from Eidolon of the Great Revel
|
||||
assertLife(playerB, 18); // 2 damage from Purphoros for the morphed Phoenix
|
||||
|
||||
|
||||
Permanent purphorosGodOfTheForge = getPermanent("Purphoros, God of the Forge", playerA);
|
||||
Assert.assertFalse("Purphoros may not be a creature but it is", purphorosGodOfTheForge.getCardType().contains(CardType.CREATURE));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHybridManaCostsForDevotion() {
|
||||
|
||||
|
||||
// Indestructible
|
||||
// As long as your devotion to red is less than five, Purphoros isn't a creature.
|
||||
// Whenever another creature enters the battlefield under your control, Purphoros deals 2 damage to each opponent.
|
||||
|
@ -101,11 +100,11 @@ public class PurphorosGodOfTheForgeTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerA, "Goblin Guide", 1); // {R}
|
||||
addCard(Zone.HAND, playerA, "Boros Reckoner", 1); // {R/W}{R/W}{R/W}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Boros Reckoner");
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertLife(playerB, 18);
|
||||
Permanent purphorosGodOfTheForge = getPermanent("Purphoros, God of the Forge", playerA);
|
||||
Assert.assertTrue("Purphoros should be a creature now but is not", purphorosGodOfTheForge.getCardType().contains(CardType.CREATURE));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package org.mage.test.cards.triggers.dies;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
|
@ -18,7 +18,6 @@ public class WhisperwoodElementalTest extends CardTestPlayerBase {
|
|||
/**
|
||||
* Tests that the dies triggered ability of silvercoat lion (gained by sacrificed Whisperwood Elemental)
|
||||
* triggers as he dies from Ligning Bolt
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testDiesTriggeredAbility() {
|
||||
|
@ -30,17 +29,20 @@ public class WhisperwoodElementalTest extends CardTestPlayerBase {
|
|||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice {this}: Until end of turn, face-up, nontoken creatures you control gain \"When this creature dies, manifest the top card of your library.");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Silvercoat Lion");
|
||||
|
||||
showBattlefield("A battle", 1, PhaseStep.END_TURN, playerA);
|
||||
showGraveyard("A grave", 1, PhaseStep.END_TURN, playerA);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
|
||||
assertGraveyardCount(playerA, "Whisperwood Elemental", 1);
|
||||
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
|
||||
|
||||
// Manifested creature from dying Silvercoat Lion
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ import mage.players.Player;
|
|||
import mage.players.net.UserData;
|
||||
import mage.target.*;
|
||||
import mage.target.common.*;
|
||||
import mage.util.CardUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
|
@ -69,6 +70,8 @@ public class TestPlayer implements Player {
|
|||
|
||||
private static final Logger logger = Logger.getLogger(TestPlayer.class);
|
||||
|
||||
public static final String TARGET_SKIP = "[skip]";
|
||||
|
||||
private int maxCallsWithoutAction = 100;
|
||||
private int foundNoAction = 0;
|
||||
private boolean AIPlayer;
|
||||
|
@ -218,7 +221,7 @@ public class TestPlayer implements Player {
|
|||
filteredName = indexedMatcher.group(1);
|
||||
index = Integer.valueOf(indexedMatcher.group(2));
|
||||
}
|
||||
filter.add(new NamePredicate(filteredName));
|
||||
filter.add(new NamePredicate(filteredName, true)); // must find any cards even without names
|
||||
List<Permanent> allPermanents = game.getBattlefield().getAllActivePermanents(filter, controllerID, game);
|
||||
if (allPermanents.isEmpty()) {
|
||||
if (failOnNotFound) {
|
||||
|
@ -350,7 +353,8 @@ public class TestPlayer implements Player {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (nameOrAliase.isEmpty() && object.getName().isEmpty()) {
|
||||
// must search any names, even empty
|
||||
if (CardUtil.haveSameNames(nameOrAliase, object.getName(), true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1519,7 +1523,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
// do not select
|
||||
if (targets.get(0).equals("")) {
|
||||
if (targets.get(0).equals(TARGET_SKIP)) {
|
||||
Assert.assertEquals("found empty choice, but target is not support 0 choice", 0, target.getMinNumberOfTargets());
|
||||
targets.remove(0);
|
||||
return true;
|
||||
|
|
|
@ -24,6 +24,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.PermanentCard;
|
||||
import mage.players.ManaPool;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.mage.test.player.PlayerAction;
|
||||
|
@ -267,6 +268,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void checkPT(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, Integer power, Integer toughness) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_PT, permanentName, power.toString(), toughness.toString());
|
||||
}
|
||||
|
||||
|
@ -275,14 +277,17 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void checkAbility(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, Class<?> abilityClass, Boolean mustHave) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_ABILITY, permanentName, abilityClass.getName(), mustHave.toString());
|
||||
}
|
||||
|
||||
public void checkPermanentCount(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, Integer count) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_PERMANENT_COUNT, permanentName, count.toString());
|
||||
}
|
||||
|
||||
public void checkExileCount(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, Integer count) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_EXILE_COUNT, permanentName, count.toString());
|
||||
}
|
||||
|
||||
|
@ -291,14 +296,17 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void checkHandCardCount(String checkName, int turnNum, PhaseStep step, TestPlayer player, String cardName, Integer count) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_HAND_CARD_COUNT, cardName, count.toString());
|
||||
}
|
||||
|
||||
public void checkColor(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, String colors, Boolean mustHave) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_COLOR, permanentName, colors, mustHave.toString());
|
||||
}
|
||||
|
||||
public void checkSubType(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, SubType subType, Boolean mustHave) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_SUBTYPE, permanentName, subType.toString(), mustHave.toString());
|
||||
}
|
||||
|
||||
|
@ -494,7 +502,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
*/
|
||||
@Override
|
||||
public void setLife(TestPlayer player, int life) {
|
||||
getCommands(player).put(Zone.OUTSIDE, "life:" + String.valueOf(life));
|
||||
getCommands(player).put(Zone.OUTSIDE, "life:" + life);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -596,6 +604,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
@Override
|
||||
public void assertPowerToughness(Player player, String cardName, int power, int toughness, Filter.ComparisonScope scope)
|
||||
throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int count = 0;
|
||||
int fit = 0;
|
||||
int foundPower = 0;
|
||||
|
@ -650,6 +659,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
@Override
|
||||
public void assertAbilities(Player player, String cardName, List<Ability> abilities)
|
||||
throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int count = 0;
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(player.getId())) {
|
||||
|
@ -685,6 +695,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @throws AssertionError
|
||||
*/
|
||||
public void assertAbility(Player player, String cardName, Ability ability, boolean mustHave, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int foundCount = 0;
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(player.getId())) {
|
||||
|
@ -735,6 +746,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
*/
|
||||
@Override
|
||||
public void assertPermanentCount(Player player, String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actualCount = 0;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getControllerId().equals(player.getId())) {
|
||||
|
@ -748,6 +760,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
|
||||
@Override
|
||||
public void assertCommandZoneCount(Player player, String commandZoneObjectName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", commandZoneObjectName);
|
||||
int actualCount = 0;
|
||||
for (CommandObject commandObject : currentGame.getState().getCommand()) {
|
||||
if (commandObject.getControllerId().equals(player.getId()) && commandObject.getName().equals(commandZoneObjectName)) {
|
||||
|
@ -787,6 +800,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void assertCounterCount(Player player, String cardName, CounterType type, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(cardName) && (player == null || permanent.getControllerId().equals(player.getId()))) {
|
||||
|
@ -806,11 +820,12 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertCounterOnExiledCardCount(String cardName, CounterType type, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Card found = null;
|
||||
|
||||
if (found == null) {
|
||||
for (Card card : currentGame.getExile().getAllCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
|
||||
found = card;
|
||||
break;
|
||||
}
|
||||
|
@ -840,6 +855,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param mustHave true if creature should have type, false if it should not
|
||||
*/
|
||||
public void assertType(String cardName, CardType type, boolean mustHave) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(cardName)) {
|
||||
|
@ -862,6 +878,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param subType a subtype to test for
|
||||
*/
|
||||
public void assertType(String cardName, CardType type, SubType subType) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = getPermanent(cardName);
|
||||
Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', found.getCardType().contains(type));
|
||||
if (subType != null) {
|
||||
|
@ -876,6 +893,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param type A type to test for
|
||||
*/
|
||||
public void assertNotType(String cardName, CardType type) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = getPermanent(cardName);
|
||||
Assert.assertFalse("(Battlefield) card type found (" + cardName + ':' + type + ')', found.getCardType().contains(type));
|
||||
}
|
||||
|
@ -887,6 +905,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param subType a subtype to test for
|
||||
*/
|
||||
public void assertNotSubtype(String cardName, SubType subType) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = getPermanent(cardName);
|
||||
if (subType != null) {
|
||||
Assert.assertFalse("(Battlefield) card sub-type equal (" + cardName + ':' + subType.getDescription() + ')', found.getSubtype(currentGame).contains(subType));
|
||||
|
@ -902,6 +921,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param mustHave must or not must have that colors
|
||||
*/
|
||||
public void assertColor(Player player, String cardName, ObjectColor searchColors, boolean mustHave) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Assert.assertNotEquals("must setup colors to search", 0, searchColors.getColorCount());
|
||||
|
||||
Permanent card = getPermanent(cardName, player);
|
||||
|
@ -936,6 +956,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param tapped Whether the permanent is tapped or not
|
||||
*/
|
||||
public void assertTapped(String cardName, boolean tapped) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(cardName)) {
|
||||
|
@ -961,6 +982,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count The amount of this permanents that should be tapped
|
||||
*/
|
||||
public void assertTappedCount(String cardName, boolean tapped, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int tappedAmount = 0;
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
|
@ -982,6 +1004,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param attacking Whether the permanent is attacking or not
|
||||
*/
|
||||
public void assertAttacking(String cardName, boolean attacking) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(cardName)) {
|
||||
|
@ -1013,17 +1036,18 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertHandCount(Player player, String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actual;
|
||||
if (cardName.contains("//")) { // special logic for cheched split cards, because in game logic of card name filtering is different than for test
|
||||
actual = 0;
|
||||
for (Card card : currentGame.getPlayer(player.getId()).getHand().getCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
|
||||
actual++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new NamePredicate(cardName));
|
||||
filter.add(new NamePredicate(cardName, true)); // must find any cards even without names
|
||||
actual = currentGame.getPlayer(player.getId()).getHand().count(filter, player.getId(), currentGame);
|
||||
}
|
||||
Assert.assertEquals("(Hand) Card counts for card " + cardName + " for " + player.getName() + " are not equal ", count, actual);
|
||||
|
@ -1072,10 +1096,11 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertExileCount(String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actualCount = 0;
|
||||
for (ExileZone exile : currentGame.getExile().getExileZones()) {
|
||||
for (Card card : exile.getCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
|
||||
actualCount++;
|
||||
}
|
||||
}
|
||||
|
@ -1111,6 +1136,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertExileCount(Player owner, String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actualCount = 0;
|
||||
for (ExileZone exile : currentGame.getExile().getExileZones()) {
|
||||
for (Card card : exile.getCards(currentGame)) {
|
||||
|
@ -1130,9 +1156,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertGraveyardCount(Player player, String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actualCount = 0;
|
||||
for (Card card : player.getGraveyard().getCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
|
||||
actualCount++;
|
||||
}
|
||||
}
|
||||
|
@ -1147,7 +1174,6 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertLibraryCount(Player player, int count) throws AssertionError {
|
||||
|
||||
List<Card> libraryList = player.getLibrary().getCards(currentGame);
|
||||
int actualCount = libraryList != null && !libraryList.isEmpty() ? libraryList.size() : 0;
|
||||
Assert.assertEquals("(Library " + player.getName() + ") counts are not equal", count, actualCount);
|
||||
|
@ -1161,9 +1187,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertLibraryCount(Player player, String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actualCount = 0;
|
||||
for (Card card : player.getLibrary().getCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
|
||||
actualCount++;
|
||||
}
|
||||
}
|
||||
|
@ -1232,18 +1259,22 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void playLand(int turnNum, PhaseStep step, TestPlayer player, String cardName) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "activate:Play " + cardName);
|
||||
}
|
||||
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName);
|
||||
}
|
||||
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, Player target) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$targetPlayer=" + target.getName());
|
||||
}
|
||||
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, Player target, int manaInPool) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$targetPlayer=" + target.getName() + "$manaInPool=" + manaInPool);
|
||||
}
|
||||
|
||||
|
@ -1280,6 +1311,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* multiple targets can be seperated by ^
|
||||
*/
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$target=" + targetName);
|
||||
}
|
||||
|
||||
|
@ -1318,6 +1350,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param clause
|
||||
*/
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName, String spellOnStack, StackClause clause) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
if (StackClause.WHILE_ON_STACK == clause) {
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName
|
||||
+ '$' + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName)
|
||||
|
@ -1330,6 +1363,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName, String spellOnStack, String spellOnTopOfStack) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
String action = "activate:Cast " + cardName + "$target=" + targetName;
|
||||
if (spellOnStack != null && !spellOnStack.isEmpty()) {
|
||||
action += "$spellOnStack=" + spellOnStack;
|
||||
|
@ -1398,22 +1432,28 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void addCounters(int turnNum, PhaseStep step, TestPlayer player, String cardName, CounterType type, int count) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "addCounters:" + cardName + '$' + type.getName() + '$' + count);
|
||||
}
|
||||
|
||||
public void attack(int turnNum, TestPlayer player, String attacker) {
|
||||
//Assert.assertNotEquals("", attacker);
|
||||
player.addAction(turnNum, PhaseStep.DECLARE_ATTACKERS, "attack:" + attacker);
|
||||
}
|
||||
|
||||
public void attack(int turnNum, TestPlayer player, String attacker, TestPlayer defendingPlayer) {
|
||||
//Assert.assertNotEquals("", attacker);
|
||||
player.addAction(turnNum, PhaseStep.DECLARE_ATTACKERS, "attack:" + attacker + "$defendingPlayer=" + defendingPlayer.getName());
|
||||
}
|
||||
|
||||
public void attack(int turnNum, TestPlayer player, String attacker, String planeswalker) {
|
||||
//Assert.assertNotEquals("", attacker);
|
||||
player.addAction(turnNum, PhaseStep.DECLARE_ATTACKERS, new StringBuilder("attack:").append(attacker).append("$planeswalker=").append(planeswalker).toString());
|
||||
}
|
||||
|
||||
public void block(int turnNum, TestPlayer player, String blocker, String attacker) {
|
||||
//Assert.assertNotEquals("", blocker);
|
||||
//Assert.assertNotEquals("", attacker);
|
||||
player.addAction(turnNum, PhaseStep.DECLARE_BLOCKERS, "block:" + blocker + '$' + attacker);
|
||||
}
|
||||
|
||||
|
@ -1507,6 +1547,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void assertDamageReceived(Player player, String cardName, int expected) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent p = getPermanent(cardName, player.getId());
|
||||
if (p != null) {
|
||||
Assert.assertEquals("Wrong damage received: ", expected, p.getDamage());
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package org.mage.test.testapi;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.util.CardUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
@ -11,6 +14,39 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
|
||||
public class TestAliases extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void test_NamesEquals() {
|
||||
// empty names for face down cards
|
||||
Assert.assertTrue(CardUtil.haveEmptyName(""));
|
||||
Assert.assertTrue(CardUtil.haveEmptyName(EmptyNames.FACE_DOWN_CREATURE.toString()));
|
||||
Assert.assertFalse(CardUtil.haveEmptyName(" "));
|
||||
Assert.assertFalse(CardUtil.haveEmptyName("123"));
|
||||
Assert.assertFalse(CardUtil.haveEmptyName("Sample Name"));
|
||||
|
||||
// same names (empty names can't be same)
|
||||
Assert.assertFalse(CardUtil.haveSameNames("", ""));
|
||||
Assert.assertFalse(CardUtil.haveSameNames(EmptyNames.FACE_DOWN_CREATURE.toString(), ""));
|
||||
Assert.assertFalse(CardUtil.haveSameNames(EmptyNames.FACE_DOWN_CREATURE.toString(), EmptyNames.FACE_DOWN_CREATURE.toString()));
|
||||
Assert.assertFalse(CardUtil.haveSameNames(EmptyNames.FACE_DOWN_TOKEN.toString(), ""));
|
||||
Assert.assertFalse(CardUtil.haveSameNames(EmptyNames.FACE_DOWN_TOKEN.toString(), EmptyNames.FACE_DOWN_CREATURE.toString()));
|
||||
Assert.assertTrue(CardUtil.haveSameNames("Name", "Name"));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", ""));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", " "));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", "123"));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", EmptyNames.FACE_DOWN_CREATURE.toString()));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name1", "Name2"));
|
||||
|
||||
// ignore mtg rules (empty names must be same)
|
||||
Assert.assertTrue(CardUtil.haveSameNames("", "", true));
|
||||
Assert.assertTrue(CardUtil.haveSameNames(EmptyNames.FACE_DOWN_CREATURE.toString(), EmptyNames.FACE_DOWN_CREATURE.toString(), true));
|
||||
Assert.assertTrue(CardUtil.haveSameNames("Name", "Name", true));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", "", true));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", " ", true));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", "123", true));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", EmptyNames.FACE_DOWN_CREATURE.toString(), true));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name1", "Name2", true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DifferentZones() {
|
||||
addCard(Zone.LIBRARY, playerA, "Swamp@lib", 1);
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -11,9 +9,9 @@ import mage.filter.predicate.mageobject.NamePredicate;
|
|||
import mage.filter.predicate.permanent.PermanentIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class DestroyAllNamedPermanentsEffect extends OneShotEffect {
|
||||
|
@ -38,12 +36,12 @@ public class DestroyAllNamedPermanentsEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
FilterPermanent filter = new FilterPermanent();
|
||||
if (targetPermanent.getName().isEmpty()) {
|
||||
if (CardUtil.haveEmptyName(targetPermanent)) {
|
||||
filter.add(new PermanentIdPredicate(targetPermanent.getId())); // if no name (face down creature) only the creature itself is selected
|
||||
} else {
|
||||
filter.add(new NamePredicate(targetPermanent.getName()));
|
||||
}
|
||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||
perm.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -327,7 +327,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
return spellAbility;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @Override
|
||||
// public void adjustCosts(Ability ability, Game game) {
|
||||
// }
|
||||
@Override
|
||||
|
@ -720,7 +720,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
@Override
|
||||
public String getLogName() {
|
||||
if (name.isEmpty()) {
|
||||
return GameLog.getNeutralColoredText("face down card");
|
||||
return GameLog.getNeutralColoredText(EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
} else {
|
||||
return GameLog.getColoredObjectIdName(this);
|
||||
}
|
||||
|
|
24
Mage/src/main/java/mage/constants/EmptyNames.java
Normal file
24
Mage/src/main/java/mage/constants/EmptyNames.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package mage.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JayDi85
|
||||
*/
|
||||
public enum EmptyNames {
|
||||
|
||||
// TODO: make names for that cards and enable Assert.assertNotEquals("", permanentName); for assertXXX tests
|
||||
// TODO: replace all getName().equals to haveSameNames and haveEmptyName
|
||||
FACE_DOWN_CREATURE(""), // "Face down creature"
|
||||
FACE_DOWN_TOKEN(""); // "Face down token"
|
||||
|
||||
private final String cardName;
|
||||
|
||||
EmptyNames(String cardName) {
|
||||
this.cardName = cardName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return cardName;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.filter.predicate.mageobject;
|
||||
|
||||
import mage.MageObject;
|
||||
|
@ -7,17 +6,23 @@ import mage.constants.SpellAbilityType;
|
|||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class NamePredicate implements Predicate<MageObject> {
|
||||
|
||||
private final String name;
|
||||
private final Boolean ignoreMtgRuleForEmptyNames; // NamePredicate uses at test and checks, it's must ignore that rules (empty names is not equals in mtg)
|
||||
|
||||
public NamePredicate(String name) {
|
||||
this(name, false);
|
||||
}
|
||||
|
||||
public NamePredicate(String name, Boolean ignoreMtgRuleForEmptyNames) {
|
||||
this.name = name;
|
||||
this.ignoreMtgRuleForEmptyNames = ignoreMtgRuleForEmptyNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,17 +30,20 @@ public class NamePredicate implements Predicate<MageObject> {
|
|||
// If a player names a card, the player may name either half of a split card, but not both.
|
||||
// A split card has the chosen name if one of its two names matches the chosen name.
|
||||
if (input instanceof SplitCard) {
|
||||
return name.equals(((SplitCard)input).getLeftHalfCard().getName()) || name.equals(((SplitCard)input).getRightHalfCard().getName());
|
||||
} else if (input instanceof Spell && ((Spell) input).getSpellAbility().getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED){
|
||||
SplitCard card = (SplitCard) ((Spell)input).getCard();
|
||||
return name.equals(card.getLeftHalfCard().getName()) || name.equals(card.getRightHalfCard().getName());
|
||||
return CardUtil.haveSameNames(name, ((SplitCard) input).getLeftHalfCard().getName(), this.ignoreMtgRuleForEmptyNames) ||
|
||||
CardUtil.haveSameNames(name, ((SplitCard) input).getRightHalfCard().getName(), this.ignoreMtgRuleForEmptyNames);
|
||||
} else if (input instanceof Spell && ((Spell) input).getSpellAbility().getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) {
|
||||
SplitCard card = (SplitCard) ((Spell) input).getCard();
|
||||
return CardUtil.haveSameNames(name, card.getLeftHalfCard().getName(), this.ignoreMtgRuleForEmptyNames) ||
|
||||
CardUtil.haveSameNames(name, card.getRightHalfCard().getName(), this.ignoreMtgRuleForEmptyNames);
|
||||
} else {
|
||||
if (name.contains(" // ")) {
|
||||
String leftName = name.substring(0, name.indexOf(" // "));
|
||||
String rightName = name.substring(name.indexOf(" // ") + 4, name.length());
|
||||
return leftName.equals(input.getName()) || rightName.equals(input.getName());
|
||||
return CardUtil.haveSameNames(leftName, input.getName(), this.ignoreMtgRuleForEmptyNames) ||
|
||||
CardUtil.haveSameNames(rightName, input.getName(), this.ignoreMtgRuleForEmptyNames);
|
||||
} else {
|
||||
return name.equals(input.getName());
|
||||
return CardUtil.haveSameNames(name, input.getName(), this.ignoreMtgRuleForEmptyNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.game.command.emblems;
|
||||
|
||||
import java.util.List;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
|
||||
import mage.abilities.costs.common.DiscardCardCost;
|
||||
|
@ -13,19 +11,16 @@ import mage.cards.Sets;
|
|||
import mage.cards.repository.CardCriteria;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SetType;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.permanent.token.EmptyToken;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.RandomUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public final class MomirEmblem extends Emblem {
|
||||
|
@ -70,7 +65,7 @@ class MomirEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
EmptyToken token = new EmptyToken(); // search for a non custom set creature
|
||||
while (token.getName().isEmpty() && !options.isEmpty()) {
|
||||
while (!options.isEmpty()) {
|
||||
int index = RandomUtil.nextInt(options.size());
|
||||
ExpansionSet expansionSet = Sets.findSet(options.get(index).getSetCode());
|
||||
if (expansionSet == null || expansionSet.getSetType() == SetType.CUSTOM_SET) {
|
||||
|
@ -79,6 +74,7 @@ class MomirEffect extends OneShotEffect {
|
|||
Card card = options.get(index).getCard();
|
||||
if (card != null) {
|
||||
CardUtil.copyTo(token).from(card);
|
||||
break;
|
||||
} else {
|
||||
options.remove(index);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.game.permanent;
|
||||
|
||||
import mage.MageObject;
|
||||
|
@ -50,6 +49,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
this.counter = counter;
|
||||
this.sourceObject = sourceObject;
|
||||
}
|
||||
|
||||
Counter counter;
|
||||
MageObject sourceObject;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = threadLocalBuilder.get();
|
||||
sb.append(this.name).append('-').append(this.expansionSetCode);
|
||||
sb.append(this.getName()).append('-').append(this.expansionSetCode);
|
||||
if (copy) {
|
||||
sb.append(" [Copy]");
|
||||
}
|
||||
|
@ -195,10 +195,23 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (name.isEmpty()) {
|
||||
if (faceDown) {
|
||||
return EmptyNames.FACE_DOWN_CREATURE.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(GameState state) {
|
||||
StringBuilder sb = threadLocalBuilder.get();
|
||||
sb.append(controllerId).append(name).append(tapped).append(damage);
|
||||
sb.append(controllerId).append(getName()).append(tapped).append(damage);
|
||||
sb.append(subtype).append(supertype).append(power.getValue()).append(toughness.getValue());
|
||||
sb.append(abilities.getValue());
|
||||
for (Counter counter : getCounters(state).values()) {
|
||||
|
@ -245,7 +258,6 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ability
|
||||
* @param game
|
||||
*/
|
||||
|
@ -665,7 +677,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
this.attachedTo = attachToObjectId;
|
||||
this.attachedToZoneChangeCounter = game.getState().getZoneChangeCounter(attachToObjectId);
|
||||
for (Ability ability : this.getAbilities()) {
|
||||
for (Iterator<Effect> ite = ability.getEffects(game, EffectType.CONTINUOUS).iterator(); ite.hasNext();) {
|
||||
for (Iterator<Effect> ite = ability.getEffects(game, EffectType.CONTINUOUS).iterator(); ite.hasNext(); ) {
|
||||
ContinuousEffect effect = (ContinuousEffect) ite.next();
|
||||
game.getContinuousEffects().setOrder(effect);
|
||||
// It's important to update the timestamp of the copied effect in ContinuousEffects because it does the action
|
||||
|
@ -715,8 +727,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
* @param game
|
||||
* @param preventable
|
||||
* @param combat
|
||||
* @param markDamage If true, damage will be dealt later in applyDamage
|
||||
* method
|
||||
* @param markDamage If true, damage will be dealt later in applyDamage
|
||||
* method
|
||||
* @return
|
||||
*/
|
||||
private int damage(int damageAmount, UUID sourceId, Game game, boolean preventable, boolean combat, boolean markDamage, List<UUID> appliedEffects) {
|
||||
|
@ -1441,20 +1453,20 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
//If an object leaves the zone it's in, all attached permanents become unattached
|
||||
//note that this code doesn't actually detach anything, and is a bit of a bandaid
|
||||
public void detachAllAttachments(Game game) {
|
||||
for(UUID attachmentId : getAttachments()) {
|
||||
for (UUID attachmentId : getAttachments()) {
|
||||
Permanent attachment = game.getPermanent(attachmentId);
|
||||
Card attachmentCard = game.getCard(attachmentId);
|
||||
if(attachment != null && attachmentCard != null) {
|
||||
if (attachment != null && attachmentCard != null) {
|
||||
//make bestow cards and licids into creatures
|
||||
//aura test to stop bludgeon brawl shenanigans from using this code
|
||||
//consider adding code to handle that case?
|
||||
if(attachment.hasSubtype(SubType.AURA, game) && attachmentCard.isCreature()) {
|
||||
if (attachment.hasSubtype(SubType.AURA, game) && attachmentCard.isCreature()) {
|
||||
BestowAbility.becomeCreature(attachment, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, List<UUID> appliedEffects) {
|
||||
Zone fromZone = game.getState().getZone(objectId);
|
||||
|
@ -1480,7 +1492,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
Zone fromZone = game.getState().getZone(objectId);
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(this, sourceId, ownerId, fromZone, Zone.EXILED, appliedEffects);
|
||||
ZoneChangeInfo.Exile info = new ZoneChangeInfo.Exile(event, exileId, name);
|
||||
|
||||
|
||||
boolean successfullyMoved = ZonesHandler.moveCard(info, game);
|
||||
//20180810 - 701.3d
|
||||
detachAllAttachments(game);
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
|
||||
package mage.game.permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class PermanentToken extends PermanentImpl {
|
||||
|
@ -42,6 +42,15 @@ public class PermanentToken extends PermanentImpl {
|
|||
this.toughness.resetToBaseValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (name.isEmpty()) {
|
||||
return EmptyNames.FACE_DOWN_TOKEN.toString();
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
private void copyFromToken(Token token, Game game, boolean reset) {
|
||||
this.name = token.getName();
|
||||
this.abilities.clear();
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
package mage.util;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -12,11 +8,14 @@ import mage.abilities.SpellAbility;
|
|||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.mana.*;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.util.functions.CopyTokenFunction;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
|
@ -25,10 +24,10 @@ public final class CardUtil {
|
|||
private static final String SOURCE_EXILE_ZONE_TEXT = "SourceExileZone";
|
||||
|
||||
static final String[] numberStrings = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
|
||||
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty"};
|
||||
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty"};
|
||||
|
||||
static final String[] ordinalStrings = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eightth", "ninth",
|
||||
"tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth", "twentieth"};
|
||||
"tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth", "twentieth"};
|
||||
|
||||
/**
|
||||
* Increase spell or ability cost to be paid.
|
||||
|
@ -129,8 +128,8 @@ public final class CardUtil {
|
|||
*
|
||||
* @param spellAbility
|
||||
* @param manaCostsToReduce costs to reduce
|
||||
* @param convertToGeneric colored mana does reduce generic mana if no
|
||||
* appropriate colored mana is in the costs included
|
||||
* @param convertToGeneric colored mana does reduce generic mana if no
|
||||
* appropriate colored mana is in the costs included
|
||||
*/
|
||||
public static void adjustCost(SpellAbility spellAbility, ManaCosts<ManaCost> manaCostsToReduce, boolean convertToGeneric) {
|
||||
ManaCosts<ManaCost> previousCost = spellAbility.getManaCostsToPay();
|
||||
|
@ -315,7 +314,7 @@ public final class CardUtil {
|
|||
*
|
||||
* @param number number to convert to text
|
||||
* @param forOne if the number is 1, this string will be returnedinstead of
|
||||
* "one".
|
||||
* "one".
|
||||
* @return
|
||||
*/
|
||||
public static String numberToText(int number, String forOne) {
|
||||
|
@ -346,7 +345,7 @@ public final class CardUtil {
|
|||
if (number >= 1 && number < 21) {
|
||||
return ordinalStrings[number - 1];
|
||||
}
|
||||
return Integer.toString(number) + "th";
|
||||
return number + "th";
|
||||
}
|
||||
|
||||
public static String replaceSourceName(String message, String sourceName) {
|
||||
|
@ -388,7 +387,7 @@ public final class CardUtil {
|
|||
/**
|
||||
* Creates and saves a (card + zoneChangeCounter) specific exileId.
|
||||
*
|
||||
* @param game the current game
|
||||
* @param game the current game
|
||||
* @param source source ability
|
||||
* @return the specific UUID
|
||||
*/
|
||||
|
@ -423,9 +422,9 @@ public final class CardUtil {
|
|||
* be specific to a permanent instance. So they won't match, if a permanent
|
||||
* was e.g. exiled and came back immediately.
|
||||
*
|
||||
* @param text short value to describe the value
|
||||
* @param text short value to describe the value
|
||||
* @param cardId id of the card
|
||||
* @param game the game
|
||||
* @param game the game
|
||||
* @return
|
||||
*/
|
||||
public static String getCardZoneString(String text, UUID cardId, Game game) {
|
||||
|
@ -525,9 +524,39 @@ public final class CardUtil {
|
|||
title = textSuffix == null ? "" : textSuffix;
|
||||
}
|
||||
} else {
|
||||
title = textSuffix == null ? "" : textSuffix;;
|
||||
title = textSuffix == null ? "" : textSuffix;
|
||||
;
|
||||
}
|
||||
return title;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Face down cards and their copy tokens don't have names and that's "empty" names is not equals
|
||||
*/
|
||||
public static boolean haveSameNames(String name1, String name2, Boolean ignoreMtgRuleForEmptyNames) {
|
||||
if (ignoreMtgRuleForEmptyNames) {
|
||||
// simple compare for tests and engine
|
||||
return name1 != null && name2 != null && name1.equals(name2);
|
||||
} else {
|
||||
// mtg logic compare for game (empty names can't be same)
|
||||
return !haveEmptyName(name1) && !haveEmptyName(name2) && name1.equals(name2);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean haveSameNames(String name1, String name2) {
|
||||
return haveSameNames(name1, name2, false);
|
||||
}
|
||||
|
||||
public static boolean haveSameNames(MageObject object1, MageObject object2) {
|
||||
return object1 != null && object2 != null && haveSameNames(object1.getName(), object2.getName());
|
||||
}
|
||||
|
||||
public static boolean haveEmptyName(String name) {
|
||||
return name == null || name.isEmpty() || name.equals(EmptyNames.FACE_DOWN_CREATURE.toString()) || name.equals(EmptyNames.FACE_DOWN_TOKEN.toString());
|
||||
}
|
||||
|
||||
public static boolean haveEmptyName(MageObject object) {
|
||||
return object == null || haveEmptyName(object.getName());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue