mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 15:32:08 -08:00
- LoseAbilityAllEffect() now works with rule 611.2c.
This commit is contained in:
parent
c4dc0222d8
commit
aa81a6d663
6 changed files with 160 additions and 73 deletions
|
|
@ -29,6 +29,7 @@ package mage.cards.g;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.LoseAbilityAllEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -36,7 +37,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -44,12 +46,21 @@ import mage.filter.common.FilterCreaturePermanent;
|
|||
*/
|
||||
public class GravitySphere extends CardImpl {
|
||||
|
||||
final static private FilterPermanent filter = new FilterPermanent("All creatures");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
||||
public GravitySphere(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
|
||||
this.supertype.add("World");
|
||||
|
||||
// All creatures lose flying.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LoseAbilityAllEffect(new FilterCreaturePermanent("All creatures"), FlyingAbility.getInstance(), Duration.WhileOnBattlefield)));
|
||||
Effect effect = new LoseAbilityAllEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield, filter);
|
||||
effect.setText("All creatures lose flying");
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
|
||||
}
|
||||
|
||||
public GravitySphere(final GravitySphere card) {
|
||||
|
|
|
|||
|
|
@ -27,51 +27,58 @@
|
|||
*/
|
||||
package mage.cards.i;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.condition.common.ManaWasSpentCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.effects.common.continuous.LoseAbilityAllEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.AbilityPredicate;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.watchers.common.ManaSpentToCastWatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
|
||||
*
|
||||
*/
|
||||
public class InvertTheSkies extends CardImpl {
|
||||
|
||||
public InvertTheSkies(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{G/U}");
|
||||
private static final FilterPermanent filter = new FilterPermanent();
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
filter.add(new AbilityPredicate(FlyingAbility.class));
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
||||
public InvertTheSkies(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G/U}");
|
||||
|
||||
// Creatures your opponents control lose flying until end of turn if {G} was spent to cast Invert the Skies, and creatures you control gain flying until end of turn if {U} was spent to cast it.
|
||||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
|
||||
new InvertTheSkiesEffect(),
|
||||
new LoseAbilityAllEffect(FlyingAbility.getInstance(), Duration.EndOfTurn, filter),
|
||||
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.G)),
|
||||
"Creatures your opponents control lose flying until end of turn if {G} was spent to cast {this},"));
|
||||
|
||||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
|
||||
new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.EndOfTurn),
|
||||
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.U)),
|
||||
"and creatures you control gain flying until end of turn if {U} was spent to cast it"));
|
||||
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<i>(Do both if {G}{U} was spent.)</i>"));
|
||||
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||
|
||||
}
|
||||
|
||||
public InvertTheSkies(final InvertTheSkies card) {
|
||||
|
|
@ -83,33 +90,3 @@ public class InvertTheSkies extends CardImpl {
|
|||
return new InvertTheSkies(this);
|
||||
}
|
||||
}
|
||||
|
||||
class InvertTheSkiesEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
|
||||
public InvertTheSkiesEffect() {
|
||||
super(Duration.EndOfTurn, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.LoseAbility);
|
||||
}
|
||||
|
||||
public InvertTheSkiesEffect(final InvertTheSkiesEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvertTheSkiesEffect copy() {
|
||||
return new InvertTheSkiesEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (opponents.contains(perm.getControllerId())) {
|
||||
perm.getAbilities().remove(FlyingAbility.getInstance());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -48,13 +48,13 @@ import mage.filter.common.FilterCreaturePermanent;
|
|||
public class MysticDecree extends CardImpl {
|
||||
|
||||
public MysticDecree(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
|
||||
this.supertype.add("World");
|
||||
|
||||
// All creatures lose flying and islandwalk.
|
||||
Effect effect = new LoseAbilityAllEffect(new FilterCreaturePermanent("All creatures"), FlyingAbility.getInstance(), Duration.WhileOnBattlefield);
|
||||
Effect effect = new LoseAbilityAllEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent("All creatures"));
|
||||
effect.setText("All creatures lose flying");
|
||||
Effect effect2 = new LoseAbilityAllEffect(new FilterCreaturePermanent("all creatures"), new IslandwalkAbility(), Duration.WhileOnBattlefield);
|
||||
Effect effect2 = new LoseAbilityAllEffect(new IslandwalkAbility(), Duration.WhileOnBattlefield, new FilterCreaturePermanent("all creatures"));
|
||||
effect2.setText("and islandwalk");
|
||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
|
||||
ability.addEffect(effect2);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.TapAllEffect;
|
||||
import mage.abilities.effects.common.continuous.LoseAbilityAllEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
|
@ -49,7 +50,7 @@ import mage.filter.predicate.permanent.AnotherPredicate;
|
|||
* @author fireshoes
|
||||
*/
|
||||
public class ThundercloudElemental extends CardImpl {
|
||||
|
||||
|
||||
private static final FilterCreaturePermanent toughnessFilter = new FilterCreaturePermanent("creatures with toughness 2 or less");
|
||||
private static final FilterCreaturePermanent flyingFilter = new FilterCreaturePermanent("All other creatures");
|
||||
|
||||
|
|
@ -59,19 +60,22 @@ public class ThundercloudElemental extends CardImpl {
|
|||
}
|
||||
|
||||
public ThundercloudElemental(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}");
|
||||
this.subtype.add("Elemental");
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
|
||||
// {3}{U}: Tap all creatures with toughness 2 or less.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapAllEffect(toughnessFilter), new ManaCostsImpl("{3}{U}")));
|
||||
|
||||
|
||||
// {3}{U}: All other creatures lose flying until end of turn.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LoseAbilityAllEffect(flyingFilter, FlyingAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{3}{U}")));
|
||||
Effect effect = new LoseAbilityAllEffect(FlyingAbility.getInstance(), Duration.EndOfTurn, flyingFilter);
|
||||
effect.setText("All other creatures lose flying until end of turn");
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{3}{U}")));
|
||||
|
||||
}
|
||||
|
||||
public ThundercloudElemental(final ThundercloudElemental card) {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.cards.w;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.LoseAbilityAllEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
|
@ -48,7 +49,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
* @author fireshoes
|
||||
*/
|
||||
public class Whiteout extends CardImpl {
|
||||
|
||||
|
||||
private static final FilterControlledLandPermanent filter = new FilterControlledLandPermanent("a snow land");
|
||||
|
||||
static {
|
||||
|
|
@ -56,11 +57,13 @@ public class Whiteout extends CardImpl {
|
|||
}
|
||||
|
||||
public Whiteout(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}");
|
||||
|
||||
// All creatures lose flying until end of turn.
|
||||
this.getSpellAbility().addEffect(new LoseAbilityAllEffect(new FilterCreaturePermanent(), FlyingAbility.getInstance(), Duration.EndOfTurn));
|
||||
|
||||
Effect effect = new LoseAbilityAllEffect(FlyingAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent());
|
||||
effect.setText("All creatures lose flying until end of turn");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
|
||||
// Sacrifice a snow land: Return Whiteout from your graveyard to your hand.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.GRAVEYARD, new ReturnToHandSourceEffect(), new SacrificeTargetCost(new TargetControlledPermanent(filter))));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue