* Pride of the Clouds fixed boost ability not counting only other creatures with flying (fixes #705).

This commit is contained in:
LevelX2 2015-02-04 17:30:27 +01:00
parent 2e38bf007a
commit 1ccaa2cc9b
2 changed files with 26 additions and 81 deletions

View file

@ -29,31 +29,36 @@ package mage.sets.dissension;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; 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.CreateTokenEffect;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.ForecastAbility; import mage.abilities.keyword.ForecastAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
/** /**
* *
* @author fireshoes * @author fireshoes
*/ */
public class PrideOfTheClouds extends CardImpl { 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) { public PrideOfTheClouds(UUID ownerId) {
super(ownerId, 125, "Pride of the Clouds", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{W}{U}"); super(ownerId, 125, "Pride of the Clouds", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{W}{U}");
this.expansionSetCode = "DIS"; this.expansionSetCode = "DIS";
@ -64,8 +69,11 @@ public class PrideOfTheClouds extends CardImpl {
// Flying // Flying
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Pride of the Clouds gets +1/+1 for each other creature with flying on the battlefield. // 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. // 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}"))); 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 { private class BirdToken extends Token {
public BirdToken() { 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); cardType.add(CardType.CREATURE);
color.setWhite(true); color.setWhite(true);
color.setBlue(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;
}
}
} }

View file

@ -30,22 +30,19 @@ package mage.sets.urzaslegacy;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; 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.FlyingAbility;
import mage.abilities.keyword.VigilanceAbility; import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game; import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.permanent.Permanent;
/** /**
* *
@ -53,9 +50,10 @@ import mage.game.permanent.Permanent;
*/ */
public class RadiantArchangel extends CardImpl { 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 { static {
filter.add(new AnotherPredicate());
filter.add(new AbilityPredicate(FlyingAbility.class)); filter.add(new AbilityPredicate(FlyingAbility.class));
} }
@ -74,8 +72,10 @@ public class RadiantArchangel extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Vigilance // Vigilance
this.addAbility(VigilanceAbility.getInstance()); this.addAbility(VigilanceAbility.getInstance());
// Radiant, Archangel gets +1/+1 for each other creature with flying on the battlefield. // 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) { public RadiantArchangel(final RadiantArchangel card) {
@ -86,35 +86,4 @@ public class RadiantArchangel extends CardImpl {
public RadiantArchangel copy() { public RadiantArchangel copy() {
return new RadiantArchangel(this); 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;
}
}
} }