mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
Fixed faulty token generation (fixes #4755)
This commit is contained in:
parent
a6ec7d8ee8
commit
c303f429bd
1 changed files with 12 additions and 14 deletions
|
@ -34,7 +34,7 @@ import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.common.TapTargetCost;
|
import mage.abilities.costs.common.TapTargetCost;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -51,6 +51,7 @@ import mage.game.permanent.token.SpiritWhiteToken;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author noxx
|
* @author noxx
|
||||||
|
@ -103,20 +104,17 @@ class GallowsAtWillowHillEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int affectedTargets = 0;
|
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||||
if (!targetPointer.getTargets(game, source).isEmpty()) {
|
if (permanent != null) {
|
||||||
for (UUID permanentId : targetPointer.getTargets(game, source)) {
|
Player controller = game.getPlayer(permanent.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(permanentId);
|
permanent.destroy(source.getSourceId(), game, false);
|
||||||
if (permanent != null) {
|
if (controller != null) {
|
||||||
Player controller = game.getPlayer(permanent.getControllerId());
|
CreateTokenTargetEffect effect = new CreateTokenTargetEffect(new SpiritWhiteToken());
|
||||||
permanent.destroy(source.getSourceId(), game, false);
|
effect.setTargetPointer(new FixedTarget(controller.getId()));
|
||||||
if (controller != null) {
|
effect.apply(game, source);
|
||||||
new CreateTokenEffect(new SpiritWhiteToken()).apply(game, source);
|
|
||||||
}
|
|
||||||
affectedTargets++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return affectedTargets > 0;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue