mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -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
|
|
@ -49,7 +49,7 @@ public class CreateDelayedTriggeredAbilityEffect extends OneShotEffect {
|
|||
DelayedTriggeredAbility delayedAbility = ability.copy();
|
||||
if (this.copyTargets) {
|
||||
if (source.getTargets().isEmpty()) {
|
||||
delayedAbility.getEffects().setTargetPointer(targetPointer);
|
||||
delayedAbility.getEffects().setTargetPointer(this.getTargetPointer().copy());
|
||||
} else {
|
||||
delayedAbility.getTargets().addAll(source.getTargets());
|
||||
for (Effect effect : delayedAbility.getEffects()) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class DoWhenCostPaid extends OneShotEffect {
|
|||
int bookmark = game.bookmarkState();
|
||||
if (cost.pay(source, game, source, player.getId(), false)) {
|
||||
if (ability.getTargets().isEmpty()) {
|
||||
ability.getEffects().setTargetPointer(getTargetPointer());
|
||||
ability.getEffects().setTargetPointer(this.getTargetPointer().copy());
|
||||
}
|
||||
game.fireReflexiveTriggeredAbility(ability, source);
|
||||
player.resetStoredBookmark(game);
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ public class ExileUntilSourceLeavesEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
ExileTargetEffect effect = new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName());
|
||||
if (targetPointer != null) { // Grasping Giant
|
||||
effect.setTargetPointer(targetPointer);
|
||||
if (this.getTargetPointer() != null) { // Grasping Giant
|
||||
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||
}
|
||||
if (effect.apply(game, source)) {
|
||||
game.addDelayedTriggeredAbility(new OnLeaveReturnExiledAbility(returnToZone), source);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class ScavengeEffect extends OneShotEffect {
|
|||
int count = card.getPower().getValue();
|
||||
if (count > 0) {
|
||||
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(count));
|
||||
effect.setTargetPointer(getTargetPointer());
|
||||
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
}
|
||||
|
|
@ -84,4 +84,4 @@ class ScavengeEffect extends OneShotEffect {
|
|||
public ScavengeEffect copy() {
|
||||
return new ScavengeEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue