mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08:00
Fixed #13064
This commit is contained in:
parent
d2e7d100ee
commit
5df9127e01
1 changed files with 10 additions and 2 deletions
|
|
@ -16,8 +16,10 @@ import mage.constants.*;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.TokenImpl;
|
import mage.game.permanent.token.TokenImpl;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -78,13 +80,18 @@ class ElvishBranchbenderEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int xValue = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this);
|
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(
|
ContinuousEffect effect = new BecomesCreatureTargetEffect(
|
||||||
new ElvishBranchbenderToken(xValue),
|
new ElvishBranchbenderToken(xValue),
|
||||||
false, false, Duration.EndOfTurn)
|
false, false, Duration.EndOfTurn)
|
||||||
.withDurationRuleAtStart(true);
|
.withDurationRuleAtStart(true);
|
||||||
effect.setTargetPointer(this.getTargetPointer().copy());
|
// works well with blinked effects
|
||||||
|
effect.setTargetPointer(new FixedTarget(targetForest, game));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,6 +108,7 @@ class ElvishBranchbenderToken extends TokenImpl {
|
||||||
super(token);
|
super(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ElvishBranchbenderToken copy() {
|
public ElvishBranchbenderToken copy() {
|
||||||
return new ElvishBranchbenderToken(this);
|
return new ElvishBranchbenderToken(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue