mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
Merge pull request #3702 from spjspj/master
Fix Magnetic Mountain (ARN)
This commit is contained in:
commit
c76b6ece7b
1 changed files with 46 additions and 49 deletions
|
|
@ -27,32 +27,31 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.common.DoIfCostPaid;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DontUntapInControllersUntapStepAllEffect;
|
import mage.abilities.effects.common.DontUntapInControllersUntapStepAllEffect;
|
||||||
import mage.abilities.effects.common.UntapEnchantedEffect;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
import static mage.cards.m.MagneticMountain.filter;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.ObjectPlayer;
|
|
||||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
|
||||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||||
|
import mage.filter.predicate.permanent.TappedPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
import mage.target.Target;
|
||||||
import java.util.UUID;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -67,11 +66,11 @@ public class MagneticMountain extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MagneticMountain(UUID ownerId, CardSetInfo setInfo) {
|
public MagneticMountain(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}{R}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{R}");
|
||||||
|
|
||||||
// Blue creatures don't untap during their controllers' untap steps.
|
// Blue creatures don't untap during their controllers' untap steps.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepAllEffect(Duration.WhileOnBattlefield, TargetController.ANY, filter)));
|
||||||
new DontUntapInControllersUntapStepAllEffect(Duration.WhileOnBattlefield, TargetController.ANY, filter)));
|
|
||||||
// At the beginning of each player's upkeep, that player may choose any number of tapped blue creatures he or she controls and pay {4} for each creature chosen this way. If the player does, untap those creatures.
|
// At the beginning of each player's upkeep, that player may choose any number of tapped blue creatures he or she controls and pay {4} for each creature chosen this way. If the player does, untap those creatures.
|
||||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new MagneticMountainEffect(), TargetController.ANY, false));
|
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new MagneticMountainEffect(), TargetController.ANY, false));
|
||||||
}
|
}
|
||||||
|
|
@ -85,13 +84,22 @@ public class MagneticMountain extends CardImpl {
|
||||||
return new MagneticMountain(this);
|
return new MagneticMountain(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class MagneticMountainEffect extends DoIfCostPaid {
|
|
||||||
|
|
||||||
public MagneticMountainEffect(){
|
class MagneticMountainEffect extends OneShotEffect {
|
||||||
super(new UntapEnchantedEffect(), new GenericManaCost(4));
|
|
||||||
|
private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("tapped blue creature");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter2.add(new ColorPredicate(ObjectColor.BLUE));
|
||||||
|
filter2.add(new TappedPredicate());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MagneticMountainEffect(final MagneticMountainEffect effect) {
|
MagneticMountainEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "that player may choose any number of tapped blue creatures he or she controls and pay {4} for each creature chosen this way. If the player does, untap those creatures.";
|
||||||
|
}
|
||||||
|
|
||||||
|
MagneticMountainEffect(MagneticMountainEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,38 +108,27 @@ class MagneticMountainEffect extends DoIfCostPaid {
|
||||||
return new MagneticMountainEffect(this);
|
return new MagneticMountainEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Player getPayingPlayer(Game game, Ability source) {
|
|
||||||
return game.getPlayer(game.getActivePlayerId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(Mode mode) {
|
|
||||||
return new StringBuilder("that player may ").append(getCostText())
|
|
||||||
.append(". If he or she does, ").append(executingEffects.getText(mode)).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("blue creatures");
|
|
||||||
filter.add(new ColorPredicate(ObjectColor.BLUE));
|
|
||||||
filter.add(new MagneticMountainPredicate());
|
|
||||||
|
|
||||||
if (!game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).isEmpty()){
|
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||||
this.copy();
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
|
if (player != null && sourcePermanent != null) {
|
||||||
|
int countBattlefield = game.getBattlefield().getAllActivePermanents(filter2, game.getActivePlayerId(), game).size();
|
||||||
|
while (player.canRespond() && countBattlefield > 0 && player.chooseUse(Outcome.AIDontUseIt, "Pay {4} and untap a tapped blue creature under your control?", source, game)) {
|
||||||
|
Target tappedCreatureTarget = new TargetControlledCreaturePermanent(1, 1, filter2, true);
|
||||||
|
if (player.choose(Outcome.Detriment, tappedCreatureTarget, source.getSourceId(), game)) {
|
||||||
|
GenericManaCost cost = new GenericManaCost(4);
|
||||||
|
Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget());
|
||||||
|
|
||||||
|
if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
|
||||||
|
tappedCreature.untap(game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
countBattlefield = game.getBattlefield().getAllActivePermanents(filter2, game.getActivePlayerId(), game).size();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
static class MagneticMountainPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
return false;
|
||||||
@Override
|
|
||||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
|
||||||
return input.getObject().isTapped();
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Tapped";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue