mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
refactor: use copy() for targetPointer (#11751)
This commit is contained in:
parent
da2466d87d
commit
6cf05a554c
42 changed files with 52 additions and 55 deletions
|
|
@ -85,7 +85,7 @@ class ApostlesBlessingEffect extends OneShotEffect {
|
||||||
protectionFilter.setMessage(choice.getChoice());
|
protectionFilter.setMessage(choice.getChoice());
|
||||||
ProtectionAbility protectionAbility = new ProtectionAbility(protectionFilter);
|
ProtectionAbility protectionAbility = new ProtectionAbility(protectionFilter);
|
||||||
ContinuousEffect effect = new GainAbilityTargetEffect(protectionAbility, Duration.EndOfTurn);
|
ContinuousEffect effect = new GainAbilityTargetEffect(protectionAbility, Duration.EndOfTurn);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class BrambleSovereignEffect extends OneShotEffect {
|
||||||
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(permanent.getControllerId());
|
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(permanent.getControllerId());
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,10 @@ class BringTheEndingCounterEffect extends OneShotEffect {
|
||||||
Player player = game.getPlayer(controllerId);
|
Player player = game.getPlayer(controllerId);
|
||||||
|
|
||||||
if (player != null && player.getCounters().getCount(CounterType.POISON) >= 3) {
|
if (player != null && player.getCounters().getCount(CounterType.POISON) >= 3) {
|
||||||
hardCounterEffect.setTargetPointer(this.getTargetPointer());
|
hardCounterEffect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
return hardCounterEffect.apply(game, source);
|
return hardCounterEffect.apply(game, source);
|
||||||
} else {
|
} else {
|
||||||
softCounterEffect.setTargetPointer(this.getTargetPointer());
|
softCounterEffect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
return softCounterEffect.apply(game, source);
|
return softCounterEffect.apply(game, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ class ChampionsOfMinasTirithEffect extends OneShotEffect {
|
||||||
new TargetPlayerCantAttackYouEffect(Duration.EndOfCombat),
|
new TargetPlayerCantAttackYouEffect(Duration.EndOfCombat),
|
||||||
ManaUtil.createManaCost(CardsInTargetPlayerHandCount.instance, game, source, this),
|
ManaUtil.createManaCost(CardsInTargetPlayerHandCount.instance, game, source, this),
|
||||||
"Pay to be able to attack " + player.getName() + " this combat?"
|
"Pay to be able to attack " + player.getName() + " this combat?"
|
||||||
).setTargetPointer(targetPointer).apply(game, source);
|
).setTargetPointer(this.getTargetPointer().copy()).apply(game, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.ZombieToken;
|
import mage.game.permanent.token.ZombieToken;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
@ -120,7 +119,7 @@ class CurseOfShallowEffect extends OneShotEffect {
|
||||||
Player attacker = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
Player attacker = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||||
if (attacker != null && attacker.chooseUse(outcome, "create a tapped 2/2 black Zombie creature token?", source, game)) {
|
if (attacker != null && attacker.chooseUse(outcome, "create a tapped 2/2 black Zombie creature token?", source, game)) {
|
||||||
Effect effect = new CreateTokenTargetEffect(new ZombieToken(), StaticValue.get(1), true, false);
|
Effect effect = new CreateTokenTargetEffect(new ZombieToken(), StaticValue.get(1), true, false);
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
return effect.apply(game, source);
|
return effect.apply(game, source);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class DebtOfLoyaltyEffect extends RegenerateTargetEffect {
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||||
if (super.replaceEvent(event, source, game) && permanent != null) {
|
if (super.replaceEvent(event, source, game) && permanent != null) {
|
||||||
GainControlTargetEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
|
GainControlTargetEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class DecimatorBeetleEffect extends OneShotEffect {
|
||||||
if (targetCreature != null
|
if (targetCreature != null
|
||||||
&& targetCreature.getCounters(game).containsKey(CounterType.M1M1)) {
|
&& targetCreature.getCounters(game).containsKey(CounterType.M1M1)) {
|
||||||
Effect effect = new RemoveCounterTargetEffect(CounterType.M1M1.createInstance(1));
|
Effect effect = new RemoveCounterTargetEffect(CounterType.M1M1.createInstance(1));
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
}
|
}
|
||||||
targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class DelayEffect extends OneShotEffect {
|
||||||
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null && spell != null) {
|
if (controller != null && spell != null) {
|
||||||
Effect effect = new CounterTargetWithReplacementEffect(PutCards.EXILED);
|
Effect effect = new CounterTargetWithReplacementEffect(PutCards.EXILED);
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
Card card = game.getCard(spell.getSourceId());
|
Card card = game.getCard(spell.getSourceId());
|
||||||
if (card != null && effect.apply(game, source) && game.getState().getZone(card.getId()) == Zone.EXILED) {
|
if (card != null && effect.apply(game, source) && game.getState().getZone(card.getId()) == Zone.EXILED) {
|
||||||
boolean hasSuspend = card.getAbilities(game).containsClass(SuspendAbility.class);
|
boolean hasSuspend = card.getAbilities(game).containsClass(SuspendAbility.class);
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ class DelinaWildMageEffect extends OneShotEffect {
|
||||||
effect.addAdditionalAbilities(new EndOfCombatTriggeredAbility(
|
effect.addAdditionalAbilities(new EndOfCombatTriggeredAbility(
|
||||||
new ExileSourceEffect(), false, "Exile this creature at end of combat."
|
new ExileSourceEffect(), false, "Exile this creature at end of combat."
|
||||||
));
|
));
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
while (true) {
|
while (true) {
|
||||||
int result = player.rollDice(outcome, source, game, 20);
|
int result = player.rollDice(outcome, source, game, 20);
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class DiabolicServitudeReturnCreatureEffect extends OneShotEffect {
|
||||||
Card cardInGraveyard = game.getCard(getTargetPointer().getFirst(game, source));
|
Card cardInGraveyard = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
if (cardInGraveyard != null) {
|
if (cardInGraveyard != null) {
|
||||||
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
|
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
|
|
||||||
game.getState().setValue(source.getSourceId().toString() + "returnedCreature", new MageObjectReference(cardInGraveyard.getId(), game));
|
game.getState().setValue(source.getSourceId().toString() + "returnedCreature", new MageObjectReference(cardInGraveyard.getId(), game));
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class DualNatureCreateTokenEffect extends OneShotEffect {
|
||||||
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(permanent.getControllerId());
|
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(permanent.getControllerId());
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
Object object = game.getState().getValue(CardUtil.getCardZoneString("_tokensCreated", source.getSourceId(), game));
|
Object object = game.getState().getValue(CardUtil.getCardZoneString("_tokensCreated", source.getSourceId(), game));
|
||||||
Set<UUID> tokensCreated;
|
Set<UUID> tokensCreated;
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class ElvishBranchbenderEffect extends OneShotEffect {
|
||||||
new ElvishBranchbenderToken(xValue),
|
new ElvishBranchbenderToken(xValue),
|
||||||
false, false, Duration.EndOfTurn)
|
false, false, Duration.EndOfTurn)
|
||||||
.withDurationRuleAtStart(true);
|
.withDurationRuleAtStart(true);
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ class FelhideSpiritbinderEffect extends OneShotEffect {
|
||||||
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, CardType.ENCHANTMENT, true);
|
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, CardType.ENCHANTMENT, true);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
if (effect.apply(game, source)) {
|
if (effect.apply(game, source)) {
|
||||||
for (Permanent tokenPermanent : effect.getAddedPermanents()) {
|
for (Permanent tokenPermanent : effect.getAddedPermanents()) {
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class FlameKinWarScourEffect extends OneShotEffect {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (permanent.sacrifice(source, game)) {
|
if (permanent.sacrifice(source, game)) {
|
||||||
Effect effect = new DamageTargetEffect(4).setText("{this} deals 4 damage to it");
|
Effect effect = new DamageTargetEffect(4).setText("{this} deals 4 damage to it");
|
||||||
effect.setTargetPointer(this.getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
return effect.apply(game, source);
|
return effect.apply(game, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ class FlameshadowConjuringEffect extends OneShotEffect {
|
||||||
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, null, true);
|
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, null, true);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
if (effect.apply(game, source)) {
|
if (effect.apply(game, source)) {
|
||||||
for (Permanent tokenPermanent : effect.getAddedPermanents()) {
|
for (Permanent tokenPermanent : effect.getAddedPermanents()) {
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class GildedDrakeEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
ContinuousEffect effect = new ExchangeControlTargetEffect(Duration.EndOfGame, "", true);
|
ContinuousEffect effect = new ExchangeControlTargetEffect(Duration.EndOfGame, "", true);
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class GravePerilEffect extends OneShotEffect {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (permanent.sacrifice(source, game)) {
|
if (permanent.sacrifice(source, game)) {
|
||||||
Effect effect = new DestroyTargetEffect();
|
Effect effect = new DestroyTargetEffect();
|
||||||
effect.setTargetPointer(this.getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
return effect.apply(game, source);
|
return effect.apply(game, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ import mage.constants.Duration;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetAnyTarget;
|
import mage.target.common.TargetAnyTarget;
|
||||||
|
|
@ -80,10 +79,10 @@ class GuardianAngelEffect extends OneShotEffect {
|
||||||
targetName = "player " + targetPlayer.getName();
|
targetName = "player " + targetPlayer.getName();
|
||||||
}
|
}
|
||||||
ContinuousEffect effect = new PreventDamageToTargetEffect(Duration.EndOfTurn, source.getManaCostsToPay().getX(), false);
|
ContinuousEffect effect = new PreventDamageToTargetEffect(Duration.EndOfTurn, source.getManaCostsToPay().getX(), false);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
SpecialAction specialAction = new GuardianAngelAction();
|
SpecialAction specialAction = new GuardianAngelAction();
|
||||||
specialAction.getEffects().get(0).setTargetPointer(getTargetPointer());
|
specialAction.getEffects().get(0).setTargetPointer(this.getTargetPointer().copy());
|
||||||
specialAction.getEffects().get(0).setText("Prevent the next 1 damage that would be dealt to any target this turn (" + targetName + ").");
|
specialAction.getEffects().get(0).setText("Prevent the next 1 damage that would be dealt to any target this turn (" + targetName + ").");
|
||||||
new CreateSpecialActionEffect(specialAction).apply(game, source);
|
new CreateSpecialActionEffect(specialAction).apply(game, source);
|
||||||
// Create a hidden delayed triggered ability to remove the special action at end of turn.
|
// Create a hidden delayed triggered ability to remove the special action at end of turn.
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class HollowSpecterEffect extends OneShotEffect {
|
||||||
if (targetPlayer != null && controller != null && controller.chooseUse(Outcome.Benefit, "Pay {X}?", source, game)) {
|
if (targetPlayer != null && controller != null && controller.chooseUse(Outcome.Benefit, "Pay {X}?", source, game)) {
|
||||||
int payCount = ManaUtil.playerPaysXGenericMana(true, "Hollow Specter", controller, source, game);
|
int payCount = ManaUtil.playerPaysXGenericMana(true, "Hollow Specter", controller, source, game);
|
||||||
if (payCount > 0) {
|
if (payCount > 0) {
|
||||||
return new DiscardCardYouChooseTargetEffect(payCount).setTargetPointer(targetPointer).apply(game, source);
|
return new DiscardCardYouChooseTargetEffect(payCount).setTargetPointer(this.getTargetPointer().copy()).apply(game, source);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class ImpulsiveWagerEffect extends OneShotEffect {
|
||||||
List<Card> cards = cost.getCards();
|
List<Card> cards = cost.getCards();
|
||||||
if (cards.size() == 1 && cards.get(0).isLand(game)) {
|
if (cards.size() == 1 && cards.get(0).isLand(game)) {
|
||||||
Effect effect = new AddCountersTargetEffect(CounterType.BOUNTY.createInstance());
|
Effect effect = new AddCountersTargetEffect(CounterType.BOUNTY.createInstance());
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
} else {
|
} else {
|
||||||
player.drawCards(2, source, game);
|
player.drawCards(2, source, game);
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ class InallaArchmageRitualistEffect extends OneShotEffect {
|
||||||
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, null, true);
|
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, null, true);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
if (effect.apply(game, source)) {
|
if (effect.apply(game, source)) {
|
||||||
for (Permanent tokenPermanent : effect.getAddedPermanents()) {
|
for (Permanent tokenPermanent : effect.getAddedPermanents()) {
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class InameLifeAspectEffect extends OneShotEffect {
|
||||||
if (controller != null && sourceObject != null) {
|
if (controller != null && sourceObject != null) {
|
||||||
if (controller.chooseUse(outcome, "Exile " + sourceObject.getLogName() + " to return Spirit cards?", source, game)) {
|
if (controller.chooseUse(outcome, "Exile " + sourceObject.getLogName() + " to return Spirit cards?", source, game)) {
|
||||||
Effect effect = new ReturnToHandTargetEffect();
|
Effect effect = new ReturnToHandTargetEffect();
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.getTargetPointer().init(game, source);
|
effect.getTargetPointer().init(game, source);
|
||||||
new ExileSourceEffect().apply(game, source);
|
new ExileSourceEffect().apply(game, source);
|
||||||
return effect.apply(game, source);
|
return effect.apply(game, source);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class InvokePrejudiceEffect extends CounterUnlessPaysEffect {
|
||||||
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
CounterUnlessPaysEffect effect = new CounterUnlessPaysEffect(new GenericManaCost(spell.getManaValue()));
|
CounterUnlessPaysEffect effect = new CounterUnlessPaysEffect(new GenericManaCost(spell.getManaValue()));
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
result = effect.apply(game, source);
|
result = effect.apply(game, source);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class JarJarBinksEffect extends OneShotEffect {
|
||||||
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null && jarJar != null && opponent != null) {
|
if (player != null && jarJar != null && opponent != null) {
|
||||||
ContinuousEffect effect = new JarJarBinksGainControlSourceEffect();
|
ContinuousEffect effect = new JarJarBinksGainControlSourceEffect();
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
game.informPlayers(jarJar.getName() + " is now controlled by " + opponent.getLogName());
|
game.informPlayers(jarJar.getName() + " is now controlled by " + opponent.getLogName());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ class LandsEdgeEffect extends OneShotEffect {
|
||||||
List<Card> cards = cost.getCards();
|
List<Card> cards = cost.getCards();
|
||||||
if (cards.size() == 1 && cards.get(0).isLand(game)) {
|
if (cards.size() == 1 && cards.get(0).isLand(game)) {
|
||||||
Effect effect = new DamageTargetEffect(2);
|
Effect effect = new DamageTargetEffect(2);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ class LiesaForgottenArchangelReturnToHandEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Effect effect = new ReturnToHandTargetEffect();
|
Effect effect = new ReturnToHandTargetEffect();
|
||||||
effect.setText("return that card to its owner's hand");
|
effect.setText("return that card to its owner's hand");
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
DelayedTriggeredAbility ability = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
DelayedTriggeredAbility ability = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||||
game.addDelayedTriggeredAbility(ability, source);
|
game.addDelayedTriggeredAbility(ability, source);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ class MarchesaTheBlackRoseEffect extends OneShotEffect {
|
||||||
Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect();
|
Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect();
|
||||||
effect.setText("return that card to the battlefield under your control at the beginning of the next end step");
|
effect.setText("return that card to the battlefield under your control at the beginning of the next end step");
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||||
delayedAbility.getEffects().get(0).setTargetPointer(getTargetPointer());
|
delayedAbility.getEffects().get(0).setTargetPointer(this.getTargetPointer().copy());
|
||||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class MirrorMarchEffect extends OneShotEffect {
|
||||||
CreateTokenCopyTargetEffect effect
|
CreateTokenCopyTargetEffect effect
|
||||||
= new CreateTokenCopyTargetEffect(player.getId(), null, true, counter);
|
= new CreateTokenCopyTargetEffect(player.getId(), null, true, counter);
|
||||||
effect.setUseLKI(true);
|
effect.setUseLKI(true);
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
effect.exileTokensCreatedAtNextEndStep(game, source);
|
effect.exileTokensCreatedAtNextEndStep(game, source);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ class MoggInfestationEffect extends OneShotEffect {
|
||||||
|| (game.getLastKnownInformation(uuid, Zone.BATTLEFIELD) instanceof PermanentToken
|
|| (game.getLastKnownInformation(uuid, Zone.BATTLEFIELD) instanceof PermanentToken
|
||||||
&& !game.getBattlefield().containsPermanent(uuid))) {
|
&& !game.getBattlefield().containsPermanent(uuid))) {
|
||||||
Effect effect = new CreateTokenTargetEffect(new GoblinToken(), 2);
|
Effect effect = new CreateTokenTargetEffect(new GoblinToken(), 2);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ class MoltenEchoesEffect extends OneShotEffect {
|
||||||
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, null, true);
|
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, null, true);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
if (effect.apply(game, source)) {
|
if (effect.apply(game, source)) {
|
||||||
for (Permanent tokenPermanent : effect.getAddedPermanents()) {
|
for (Permanent tokenPermanent : effect.getAddedPermanents()) {
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ class NightshadeAssassinEffect extends OneShotEffect {
|
||||||
controller.revealCards(sourceObject.getIdName(), new CardsImpl(target.getTargets()), game);
|
controller.revealCards(sourceObject.getIdName(), new CardsImpl(target.getTargets()), game);
|
||||||
int unboost = target.getTargets().size() * -1;
|
int unboost = target.getTargets().size() * -1;
|
||||||
ContinuousEffect effect = new BoostTargetEffect(unboost, unboost, Duration.EndOfTurn);
|
ContinuousEffect effect = new BoostTargetEffect(unboost, unboost, Duration.EndOfTurn);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ class ProfaneProcessionEffect extends OneShotEffect {
|
||||||
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
||||||
MageObject sourceObject = source.getSourceObject(game);
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
if (controller != null && exileId != null && sourceObject != null) {
|
if (controller != null && exileId != null && sourceObject != null) {
|
||||||
new ExileTargetEffect(exileId, sourceObject.getIdName()).setTargetPointer(targetPointer).apply(game, source);
|
new ExileTargetEffect(exileId, sourceObject.getIdName()).setTargetPointer(this.getTargetPointer().copy()).apply(game, source);
|
||||||
game.getState().processAction(game);
|
game.getState().processAction(game);
|
||||||
ExileZone exileZone = game.getExile().getExileZone(exileId);
|
ExileZone exileZone = game.getExile().getExileZone(exileId);
|
||||||
if (exileZone != null && exileZone.size() > 2) {
|
if (exileZone != null && exileZone.size() > 2) {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ class ServantOfTheScaleEffect extends OneShotEffect {
|
||||||
int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
|
int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(amount));
|
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(amount));
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||||
import mage.abilities.costs.common.ExileSourceFromGraveCost;
|
import mage.abilities.costs.common.ExileSourceFromGraveCost;
|
||||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DoIfCostPaid;
|
import mage.abilities.effects.common.DoIfCostPaid;
|
||||||
|
|
@ -102,10 +101,10 @@ class SinisterConciergeEffect extends OneShotEffect {
|
||||||
|
|
||||||
// Exile, put time counters, and give suspend for target
|
// Exile, put time counters, and give suspend for target
|
||||||
Effect exileTarget = new ExileTargetEffect();
|
Effect exileTarget = new ExileTargetEffect();
|
||||||
exileTarget.setTargetPointer(this.getTargetPointer());
|
exileTarget.setTargetPointer(this.getTargetPointer().copy());
|
||||||
if (exileTarget.apply(game, source)) {
|
if (exileTarget.apply(game, source)) {
|
||||||
Effect addCountersTargetEffect = new AddCountersTargetEffect(CounterType.TIME.createInstance(3));
|
Effect addCountersTargetEffect = new AddCountersTargetEffect(CounterType.TIME.createInstance(3));
|
||||||
addCountersTargetEffect.setTargetPointer(this.getTargetPointer());
|
addCountersTargetEffect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
boolean targetCardShouldGetSuspend = addCountersTargetEffect.apply(game, source);
|
boolean targetCardShouldGetSuspend = addCountersTargetEffect.apply(game, source);
|
||||||
|
|
||||||
if (targetCardShouldGetSuspend && !targetCreature.getAbilities(game).containsClass(SuspendAbility.class)) {
|
if (targetCardShouldGetSuspend && !targetCreature.getAbilities(game).containsClass(SuspendAbility.class)) {
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class TemptWithReflectionsEffect extends OneShotEffect {
|
||||||
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Effect effect = new CreateTokenCopyTargetEffect();
|
Effect effect = new CreateTokenCopyTargetEffect();
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
|
|
||||||
Set<UUID> playersSaidYes = new HashSet<>();
|
Set<UUID> playersSaidYes = new HashSet<>();
|
||||||
|
|
@ -85,12 +85,12 @@ class TemptWithReflectionsEffect extends OneShotEffect {
|
||||||
|
|
||||||
for (UUID playerId : playersSaidYes) {
|
for (UUID playerId : playersSaidYes) {
|
||||||
effect = new CreateTokenCopyTargetEffect(playerId);
|
effect = new CreateTokenCopyTargetEffect(playerId);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
|
|
||||||
// create a token for the source controller as well
|
// create a token for the source controller as well
|
||||||
effect = new CreateTokenCopyTargetEffect();
|
effect = new CreateTokenCopyTargetEffect();
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class VastwoodAnimistEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int amount = new PermanentsOnBattlefieldCount(filterAllies).calculate(game, source, this);
|
int amount = new PermanentsOnBattlefieldCount(filterAllies).calculate(game, source, this);
|
||||||
ContinuousEffect effect = new BecomesCreatureTargetEffect(new VastwoodAnimistElementalToken(amount), false, true, Duration.EndOfTurn);
|
ContinuousEffect effect = new BecomesCreatureTargetEffect(new VastwoodAnimistElementalToken(amount), false, true, Duration.EndOfTurn);
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class VenarianGlimmerEffect extends OneShotEffect {
|
||||||
FilterCard filter = new FilterNonlandCard();
|
FilterCard filter = new FilterNonlandCard();
|
||||||
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, source.getManaCostsToPay().getX() + 1));
|
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, source.getManaCostsToPay().getX() + 1));
|
||||||
Effect effect = new DiscardCardYouChooseTargetEffect(filter);
|
Effect effect = new DiscardCardYouChooseTargetEffect(filter);
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class XenagosGodOfRevelsEffect extends OneShotEffect {
|
||||||
int power = targetCreature.getPower().getValue();
|
int power = targetCreature.getPower().getValue();
|
||||||
game.addEffect(new BoostTargetEffect(
|
game.addEffect(new BoostTargetEffect(
|
||||||
power, power, Duration.EndOfTurn
|
power, power, Duration.EndOfTurn
|
||||||
).setTargetPointer(this.getTargetPointer()), source);
|
).setTargetPointer(this.getTargetPointer().copy()), source);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class CreateDelayedTriggeredAbilityEffect extends OneShotEffect {
|
||||||
DelayedTriggeredAbility delayedAbility = ability.copy();
|
DelayedTriggeredAbility delayedAbility = ability.copy();
|
||||||
if (this.copyTargets) {
|
if (this.copyTargets) {
|
||||||
if (source.getTargets().isEmpty()) {
|
if (source.getTargets().isEmpty()) {
|
||||||
delayedAbility.getEffects().setTargetPointer(targetPointer);
|
delayedAbility.getEffects().setTargetPointer(this.getTargetPointer().copy());
|
||||||
} else {
|
} else {
|
||||||
delayedAbility.getTargets().addAll(source.getTargets());
|
delayedAbility.getTargets().addAll(source.getTargets());
|
||||||
for (Effect effect : delayedAbility.getEffects()) {
|
for (Effect effect : delayedAbility.getEffects()) {
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class DoWhenCostPaid extends OneShotEffect {
|
||||||
int bookmark = game.bookmarkState();
|
int bookmark = game.bookmarkState();
|
||||||
if (cost.pay(source, game, source, player.getId(), false)) {
|
if (cost.pay(source, game, source, player.getId(), false)) {
|
||||||
if (ability.getTargets().isEmpty()) {
|
if (ability.getTargets().isEmpty()) {
|
||||||
ability.getEffects().setTargetPointer(getTargetPointer());
|
ability.getEffects().setTargetPointer(this.getTargetPointer().copy());
|
||||||
}
|
}
|
||||||
game.fireReflexiveTriggeredAbility(ability, source);
|
game.fireReflexiveTriggeredAbility(ability, source);
|
||||||
player.resetStoredBookmark(game);
|
player.resetStoredBookmark(game);
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@ public class ExileUntilSourceLeavesEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExileTargetEffect effect = new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName());
|
ExileTargetEffect effect = new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName());
|
||||||
if (targetPointer != null) { // Grasping Giant
|
if (this.getTargetPointer() != null) { // Grasping Giant
|
||||||
effect.setTargetPointer(targetPointer);
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
}
|
}
|
||||||
if (effect.apply(game, source)) {
|
if (effect.apply(game, source)) {
|
||||||
game.addDelayedTriggeredAbility(new OnLeaveReturnExiledAbility(returnToZone), source);
|
game.addDelayedTriggeredAbility(new OnLeaveReturnExiledAbility(returnToZone), source);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ class ScavengeEffect extends OneShotEffect {
|
||||||
int count = card.getPower().getValue();
|
int count = card.getPower().getValue();
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(count));
|
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(count));
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
return effect.apply(game, source);
|
return effect.apply(game, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue