Skip to content

Commit

Permalink
Fixed #13064
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwadsworth committed Dec 3, 2024
1 parent d2e7d10 commit 5df9127
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Mage.Sets/src/mage/cards/e/ElvishBranchbender.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.TokenImpl;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;

/**
*
Expand Down Expand Up @@ -78,13 +80,18 @@ public ElvishBranchbenderEffect copy() {
@Override
public boolean apply(Game game, Ability source) {
int xValue = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this);
Permanent targetForest = game.getPermanent(this.getTargetPointer().copy().getFirst(game, source));
if (targetForest == null) {
return false;
}
ContinuousEffect effect = new BecomesCreatureTargetEffect(
new ElvishBranchbenderToken(xValue),
false, false, Duration.EndOfTurn)
.withDurationRuleAtStart(true);
effect.setTargetPointer(this.getTargetPointer().copy());
// works well with blinked effects
effect.setTargetPointer(new FixedTarget(targetForest, game));
game.addEffect(effect, source);
return false;
return true;
}
}

Expand All @@ -101,6 +108,7 @@ private ElvishBranchbenderToken(final ElvishBranchbenderToken token) {
super(token);
}

@Override
public ElvishBranchbenderToken copy() {
return new ElvishBranchbenderToken(this);
}
Expand Down

0 comments on commit 5df9127

Please sign in to comment.