From 1ccaa2cc9b0fcccdab4090a88e520449a9396ee8 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 4 Feb 2015 17:30:27 +0100 Subject: [PATCH] * Pride of the Clouds fixed boost ability not counting only other creatures with flying (fixes #705). --- .../sets/dissension/PrideOfTheClouds.java | 58 ++++++------------- .../sets/urzaslegacy/RadiantArchangel.java | 49 +++------------- 2 files changed, 26 insertions(+), 81 deletions(-) diff --git a/Mage.Sets/src/mage/sets/dissension/PrideOfTheClouds.java b/Mage.Sets/src/mage/sets/dissension/PrideOfTheClouds.java index 844853d512..2253407d6b 100644 --- a/Mage.Sets/src/mage/sets/dissension/PrideOfTheClouds.java +++ b/Mage.Sets/src/mage/sets/dissension/PrideOfTheClouds.java @@ -29,31 +29,36 @@ package mage.sets.dissension; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.ForecastAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.SubLayer; import mage.constants.Zone; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.filter.predicate.permanent.AnotherPredicate; /** * * @author fireshoes */ public class PrideOfTheClouds extends CardImpl { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("other creature with flying on the battlefield"); + + static { + filter.add(new AnotherPredicate()); + filter.add(new AbilityPredicate(FlyingAbility.class)); + } + public PrideOfTheClouds(UUID ownerId) { super(ownerId, 125, "Pride of the Clouds", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{W}{U}"); this.expansionSetCode = "DIS"; @@ -64,8 +69,11 @@ public class PrideOfTheClouds extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); + // Pride of the Clouds gets +1/+1 for each other creature with flying on the battlefield. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PrideOfTheCloudsEffect())); + DynamicValue xValue = new PermanentsOnBattlefieldCount(filter); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(xValue, xValue, Duration.WhileOnBattlefield))); + // Forecast - {2}{W}{U}, Reveal Pride of the Clouds from your hand: Put a 1/1 white and blue Bird creature token with flying onto the battlefield. this.addAbility(new ForecastAbility(new CreateTokenEffect(new BirdToken()), new ManaCostsImpl("{2}{W}{U}"))); } @@ -82,7 +90,7 @@ public class PrideOfTheClouds extends CardImpl { private class BirdToken extends Token { public BirdToken() { - super("Bird", "1/1 white snf blue Bird creature token with flying"); + super("Bird", "1/1 white and blue Bird creature token with flying"); cardType.add(CardType.CREATURE); color.setWhite(true); color.setBlue(true); @@ -93,36 +101,4 @@ public class PrideOfTheClouds extends CardImpl { } } - -class PrideOfTheCloudsEffect extends ContinuousEffectImpl { - - public PrideOfTheCloudsEffect() { - super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature); - staticText = "{this} gets +1/+1 for each other creature with flying on the battlefield"; - } - - public PrideOfTheCloudsEffect(final PrideOfTheCloudsEffect effect) { - super(effect); - } - - @Override - public PrideOfTheCloudsEffect copy() { - return new PrideOfTheCloudsEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - FilterCreaturePermanent filter = new FilterCreaturePermanent(); - int count = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) - 1; - if (count > 0) { - Permanent target = (Permanent) game.getPermanent(source.getSourceId()); - if (target != null) { - target.addPower(count); - target.addToughness(count); - return true; - } - } - return false; - } - } } diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/RadiantArchangel.java b/Mage.Sets/src/mage/sets/urzaslegacy/RadiantArchangel.java index 3822a0efd7..e13b893be7 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/RadiantArchangel.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/RadiantArchangel.java @@ -30,22 +30,19 @@ package mage.sets.urzaslegacy; import java.util.UUID; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.SubLayer; import mage.constants.Zone; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.AbilityPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; +import mage.filter.predicate.permanent.AnotherPredicate; /** * @@ -53,9 +50,10 @@ import mage.game.permanent.Permanent; */ public class RadiantArchangel extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("other creature with flying on the battlefield"); static { + filter.add(new AnotherPredicate()); filter.add(new AbilityPredicate(FlyingAbility.class)); } @@ -74,8 +72,10 @@ public class RadiantArchangel extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Vigilance this.addAbility(VigilanceAbility.getInstance()); + // Radiant, Archangel gets +1/+1 for each other creature with flying on the battlefield. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RadiantArchangelEffect())); + DynamicValue xValue = new PermanentsOnBattlefieldCount(filter); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(xValue, xValue, Duration.WhileOnBattlefield))); } public RadiantArchangel(final RadiantArchangel card) { @@ -86,35 +86,4 @@ public class RadiantArchangel extends CardImpl { public RadiantArchangel copy() { return new RadiantArchangel(this); } - class RadiantArchangelEffect extends ContinuousEffectImpl { - - public RadiantArchangelEffect() { - super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature); - staticText = "{this} gets +1/+1 for each other creature with flying on the battlefield"; - } - - public RadiantArchangelEffect(final RadiantArchangelEffect effect) { - super(effect); - } - - @Override - public RadiantArchangelEffect copy() { - return new RadiantArchangelEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - int count = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) - 1; - if (count > 0) { - Permanent target = (Permanent) game.getPermanent(source.getSourceId()); - if (target != null) { - target.addPower(count); - target.addToughness(count); - return true; - } - } - return false; - } - - } }