mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
Untapping lands in response to a trigger is somewhat painful. Allow lands to be targeted automatically.
This commit is contained in:
parent
fa53e1ef6f
commit
3953ad8b0b
1 changed files with 5 additions and 6 deletions
|
@ -64,15 +64,14 @@ public class UntapLandsEffect extends OneShotEffect {
|
||||||
TargetLandPermanent target = new TargetLandPermanent(0, amount, new FilterLandPermanent(), true);
|
TargetLandPermanent target = new TargetLandPermanent(0, amount, new FilterLandPermanent(), true);
|
||||||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
||||||
|
|
||||||
// UI Shortcut: Check if any lands are already tapped. If there are equal/fewer than amount, give the option to untap those ones now.
|
// UI Shortcut: Check if any lands are already tapped. If there are equal/fewer than amount, give the option to add those in to be untapped now.
|
||||||
FilterPermanent filter = new FilterLandPermanent();
|
FilterPermanent filter = new FilterLandPermanent();
|
||||||
filter.add(new TappedPredicate());
|
filter.add(new TappedPredicate());
|
||||||
Player player = game.getPlayer(game.getActivePlayerId());
|
int tappedLands = game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game).size();
|
||||||
int tappedLands = game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size();
|
|
||||||
|
|
||||||
if (player != null && tappedLands <= amount) {
|
if (tappedLands <= amount) {
|
||||||
if (player.chooseUse(outcome, "Include your tapped lands to untap?", source, game)) {
|
if (controller.chooseUse(outcome, "Include your tapped lands to untap?", source, game)) {
|
||||||
for (Permanent land : game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
|
for (Permanent land : game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) {
|
||||||
target.addTarget(land.getId(), source, game);
|
target.addTarget(land.getId(), source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue