mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
fixed bug #3279
This commit is contained in:
parent
b8b4eb3b46
commit
358d496803
1 changed files with 34 additions and 22 deletions
|
@ -40,18 +40,17 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -59,11 +58,16 @@ import java.util.UUID;
|
|||
*/
|
||||
public class QuicksilverFountain extends CardImpl {
|
||||
|
||||
public final UUID originalId;
|
||||
|
||||
public QuicksilverFountain(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player puts a flood counter on target non-Island land he or she controls of his or her choice. That land is an Island for as long as it has a flood counter on it.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new QuicksilverFountainEffect(), TargetController.ANY, false, true));
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new QuicksilverFountainEffect(), TargetController.ANY, false, true);
|
||||
ability.addTarget(new TargetLandPermanent());
|
||||
originalId = ability.getOriginalId();
|
||||
this.addAbility(ability);
|
||||
|
||||
// At the beginning of each end step, if all lands on the battlefield are Islands, remove all flood counters from them.
|
||||
Condition condition = new AllLandsAreSubtypeCondition(SubType.ISLAND);
|
||||
|
@ -71,8 +75,25 @@ public class QuicksilverFountain extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
FilterLandPermanent filter = new FilterLandPermanent();
|
||||
filter.add(Predicates.not(new SubtypePredicate(SubType.ISLAND)));
|
||||
filter.add(new ControllerPredicate(TargetController.ACTIVE));
|
||||
TargetLandPermanent target = new TargetLandPermanent(1, 1, filter, false);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public QuicksilverFountain(final QuicksilverFountain card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,12 +104,6 @@ public class QuicksilverFountain extends CardImpl {
|
|||
|
||||
class QuicksilverFountainEffect extends OneShotEffect {
|
||||
|
||||
static final private FilterControlledLandPermanent filterNonIslandLand = new FilterControlledLandPermanent("non-Island land");
|
||||
|
||||
static {
|
||||
filterNonIslandLand.add(Predicates.not(new SubtypePredicate(SubType.ISLAND)));
|
||||
}
|
||||
|
||||
public QuicksilverFountainEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "that player puts a flood counter on target non-Island land he or she controls of his or her choice. That land is an Island for as long as it has a flood counter on it";
|
||||
|
@ -101,19 +116,16 @@ class QuicksilverFountainEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Target targetNonIslandLand = new TargetPermanent(filterNonIslandLand);
|
||||
if (player != null) {
|
||||
if (player.choose(Outcome.Neutral, targetNonIslandLand, source.getId(), game)) {
|
||||
Permanent landChosen = game.getPermanent(targetNonIslandLand.getFirstTarget());
|
||||
landChosen.addCounters(CounterType.FLOOD.createInstance(), source, game);
|
||||
ContinuousEffect becomesBasicLandTargetEffect = new BecomesBasicLandTargetEffect(Duration.OneUse, SubType.ISLAND);
|
||||
becomesBasicLandTargetEffect.addDependencyType(DependencyType.BecomeIsland);
|
||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(becomesBasicLandTargetEffect, new LandHasFloodCounterCondition(this), staticText);
|
||||
this.setTargetPointer(new FixedTarget(landChosen, game));
|
||||
effect.setTargetPointer(new FixedTarget(landChosen, game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
Permanent landChosen = game.getPermanent(source.getFirstTarget());
|
||||
landChosen.addCounters(CounterType.FLOOD.createInstance(), source, game);
|
||||
ContinuousEffect becomesBasicLandTargetEffect = new BecomesBasicLandTargetEffect(Duration.OneUse, SubType.ISLAND);
|
||||
becomesBasicLandTargetEffect.addDependencyType(DependencyType.BecomeIsland);
|
||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(becomesBasicLandTargetEffect, new LandHasFloodCounterCondition(this), staticText);
|
||||
this.setTargetPointer(new FixedTarget(landChosen, game));
|
||||
effect.setTargetPointer(new FixedTarget(landChosen, game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue