mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 23:12:10 -08: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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue