forked from External/mage
- More fixes related to #6855
This commit is contained in:
parent
51af4e7e1d
commit
92580e480b
2 changed files with 48 additions and 27 deletions
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesTargetTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
|
@ -24,7 +24,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -35,9 +34,13 @@ public final class MakeshiftMannequin extends CardImpl {
|
|||
public MakeshiftMannequin(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B}");
|
||||
|
||||
// Return target creature card from your graveyard to the battlefield with a mannequin counter on it. For as long as that creature has a mannequin counter on it, it has "When this creature becomes the target of a spell or ability, sacrifice it."
|
||||
// Return target creature card from your graveyard to the battlefield
|
||||
// with a mannequin counter on it. For as long as that creature has a
|
||||
// mannequin counter on it, it has "When this creature becomes the target
|
||||
// of a spell or ability, sacrifice it."
|
||||
this.getSpellAbility().addEffect(new MakeshiftMannequinEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(
|
||||
StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
|
||||
}
|
||||
|
||||
public MakeshiftMannequin(final MakeshiftMannequin card) {
|
||||
|
|
@ -54,7 +57,11 @@ class MakeshiftMannequinEffect extends OneShotEffect {
|
|||
|
||||
MakeshiftMannequinEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.staticText = "Return target creature card from your graveyard to the battlefield with a mannequin counter on it. For as long as that creature has a mannequin counter on it, it has \"When this creature becomes the target of a spell or ability, sacrifice it.\"";
|
||||
this.staticText = "Return target creature card from your graveyard "
|
||||
+ "to the battlefield with a mannequin counter on it. "
|
||||
+ "For as long as that creature has a mannequin counter on it, "
|
||||
+ "it has \"When this creature becomes the target of a spell "
|
||||
+ "or ability, sacrifice it.\"";
|
||||
}
|
||||
|
||||
MakeshiftMannequinEffect(final MakeshiftMannequinEffect effect) {
|
||||
|
|
@ -80,11 +87,14 @@ class MakeshiftMannequinEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(cardId);
|
||||
if (permanent != null) {
|
||||
ContinuousEffect gainedEffect = new MakeshiftMannequinGainAbilityEffect();
|
||||
gainedEffect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
game.addEffect(gainedEffect, source);
|
||||
// Bug #6885 Fixed when owner/controller leaves the game the effect still applies
|
||||
SimpleStaticAbility gainAbility = new SimpleStaticAbility(Zone.BATTLEFIELD, gainedEffect);
|
||||
gainAbility.setSourceId(cardId);
|
||||
gainAbility.getTargets().add(source.getTargets().get(0));
|
||||
game.addEffect(gainedEffect, gainAbility);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
@ -105,7 +115,10 @@ class MakeshiftMannequinGainAbilityEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), source.getSourceId(), game);
|
||||
permanent.addAbility(
|
||||
new BecomesTargetTriggeredAbility(
|
||||
new SacrificeSourceEffect()),
|
||||
source.getSourceId(), game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -114,7 +127,8 @@ class MakeshiftMannequinGainAbilityEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
return permanent == null || permanent.getCounters(game).getCount(CounterType.MANNEQUIN) < 1;
|
||||
return permanent == null
|
||||
|| permanent.getCounters(game).getCount(CounterType.MANNEQUIN) < 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ import java.util.UUID;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -26,7 +26,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -37,15 +36,21 @@ public final class QuicksilverFountain extends CardImpl {
|
|||
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 they control of their choice. That land is an Island for as long as it has a flood counter on it.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new QuicksilverFountainEffect(), TargetController.ANY, false, true);
|
||||
// At the beginning of each player's upkeep, that player puts a flood
|
||||
// counter on target non-Island land they control of their choice.
|
||||
// That land is an Island for as long as it has a flood counter on it.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
|
||||
new QuicksilverFountainEffect(), TargetController.ANY, false, true);
|
||||
ability.addTarget(new TargetLandPermanent());
|
||||
ability.setTargetAdjuster(QuicksilverFountainAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
// At the beginning of each end step, if all lands on the battlefield are Islands, remove all flood counters from them.
|
||||
// At the beginning of each end step, if all lands on the battlefield are
|
||||
// Islands, remove all flood counters from them.
|
||||
// Note: This applies only if Quicksilver Fountain is on the battlefield
|
||||
Condition condition = new AllLandsAreSubtypeCondition(SubType.ISLAND);
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new QuicksilverFountainEffect2(), TargetController.ANY, condition, false));
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD,
|
||||
new QuicksilverFountainEffect2(), TargetController.ANY, condition, false));
|
||||
}
|
||||
|
||||
public QuicksilverFountain(final QuicksilverFountain card) {
|
||||
|
|
@ -96,13 +101,16 @@ class QuicksilverFountainEffect extends OneShotEffect {
|
|||
Permanent landChosen = game.getPermanent(source.getFirstTarget());
|
||||
landChosen.addCounters(CounterType.FLOOD.createInstance(), source, game);
|
||||
ContinuousEffect becomesBasicLandTargetEffect
|
||||
= new BecomesBasicLandTargetEffect(Duration.OneUse, false, SubType.ISLAND);
|
||||
= new BecomesBasicLandTargetEffect(Duration.Custom, false, SubType.ISLAND);
|
||||
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);
|
||||
new LandHasFloodCounterCondition(), staticText);
|
||||
// Bug #6885 Fixed when owner/controller leaves the game the effect still applies
|
||||
SimpleStaticAbility gainAbility = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
|
||||
gainAbility.setSourceId(landChosen.getId());
|
||||
gainAbility.getTargets().add(source.getTargets().get(0));
|
||||
System.out.println("The source target in the oneshoteffect? " + source.getTargets().get(0));
|
||||
game.addEffect(effect, gainAbility);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -128,7 +136,8 @@ class QuicksilverFountainEffect2 extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent land : game.getBattlefield().getAllActivePermanents(CardType.LAND)) {
|
||||
land.removeCounters(CounterType.FLOOD.createInstance(land.getCounters(game).getCount(CounterType.FLOOD)), game);
|
||||
land.removeCounters(CounterType.FLOOD.createInstance(
|
||||
land.getCounters(game).getCount(CounterType.FLOOD)), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -163,15 +172,13 @@ class AllLandsAreSubtypeCondition implements Condition {
|
|||
|
||||
class LandHasFloodCounterCondition implements Condition {
|
||||
|
||||
private final Effect effect;
|
||||
|
||||
public LandHasFloodCounterCondition(Effect effect) {
|
||||
this.effect = effect;
|
||||
public LandHasFloodCounterCondition() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(effect.getTargetPointer().getFirst(game, source));
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
System.out.println("The source and its target? " + source.toString() + " " + source.getFirstTarget());
|
||||
return permanent != null
|
||||
&& permanent.getCounters(game).getCount(CounterType.FLOOD) > 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue