diff --git a/Mage.Sets/src/mage/cards/l/LightFromWithin.java b/Mage.Sets/src/mage/cards/l/LightFromWithin.java index 7a19196c811..61459f9f54e 100644 --- a/Mage.Sets/src/mage/cards/l/LightFromWithin.java +++ b/Mage.Sets/src/mage/cards/l/LightFromWithin.java @@ -1,49 +1,28 @@ - package mage.cards.l; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.ContinuousEffectImpl; -import mage.abilities.effects.Effect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; -import mage.constants.TargetController; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterCreaturePermanent; +import mage.constants.*; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.players.Player; /** * - * @author jeffwadsworth + * @author awjackson * */ public final class LightFromWithin extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control"); - - static { - filter.add(TargetController.YOU.getControllerPredicate()); - } - public LightFromWithin(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}{W}"); - // Chroma - Each creature you control gets +1/+1 for each white mana symbol in its mana cost. - Effect effect = new LightFromWithinEffect(); - effect.setText("Chroma — Each creature you control gets +1/+1 for each white mana symbol in its mana cost."); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); - + this.addAbility(new SimpleStaticAbility(new LightFromWithinEffect()).setAbilityWord(AbilityWord.CHROMA)); } private LightFromWithin(final LightFromWithin card) { @@ -58,10 +37,9 @@ public final class LightFromWithin extends CardImpl { class LightFromWithinEffect extends ContinuousEffectImpl { - boolean boosted = false; - public LightFromWithinEffect() { - super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature); + super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature); + staticText = "Each creature you control gets +1/+1 for each white mana symbol in its mana cost"; } public LightFromWithinEffect(final LightFromWithinEffect effect) { @@ -75,51 +53,13 @@ class LightFromWithinEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterControlledCreaturePermanent(), source.getControllerId(), game)) { - if (creature != null) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - creature.addPower(new ChromaLightFromWithinCount(creature).calculate(game, source, this)); - creature.addToughness(new ChromaLightFromWithinCount(creature).calculate(game, source, this)); - boosted = true; - } + for (Permanent creature : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), game)) { + int chroma = creature.getManaCost().getMana().getWhite(); + if (chroma > 0) { + creature.addPower(chroma); + creature.addToughness(chroma); } } - return boosted; - } -} - -class ChromaLightFromWithinCount implements DynamicValue { - - private Permanent permanent; - - public ChromaLightFromWithinCount(Permanent permanent) { - this.permanent = permanent; - } - - public ChromaLightFromWithinCount(final ChromaLightFromWithinCount dynamicValue) { - this.permanent = dynamicValue.permanent; - } - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - int chroma = 0; - chroma += permanent.getManaCost().getMana().getWhite(); - return chroma; - } - - @Override - public DynamicValue copy() { - return new ChromaLightFromWithinCount(this); - } - - @Override - public String toString() { - return "1"; - } - - @Override - public String getMessage() { - return ""; + return true; } }