From 775b3276c98f5e7ee2879217f480900b0b6bb746 Mon Sep 17 00:00:00 2001 From: North Date: Wed, 28 Mar 2012 22:18:33 +0300 Subject: [PATCH] Fixed Chimeric Mass. Also fixed the BecomesCreature effects. In case the token had another ability with a SetPT effect there would have been two effects on the same layer and the outcome would not be predictable. --- .../sets/scarsofmirrodin/ChimericMass.java | 49 ++++--------------- .../BecomesCreatureSourceEffect.java | 15 +++--- .../BecomesCreatureTargetEffect.java | 20 ++++---- 3 files changed, 28 insertions(+), 56 deletions(-) diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/ChimericMass.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/ChimericMass.java index d44b6d5428..389246cc82 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/ChimericMass.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/ChimericMass.java @@ -27,27 +27,29 @@ */ package mage.sets.scarsofmirrodin; -import mage.Constants.*; +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Duration; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.CountersCount; -import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.EntersBattlefieldEffect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.BecomesCreatureSourceEffect; +import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.cards.CardImpl; import mage.counters.CounterType; import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; -import java.util.UUID; - /** * * @author BetaSteward_at_googlemail.com @@ -109,39 +111,8 @@ class ChimericMassToken extends Token { super("", "Construct artifact creature with \"This creature's power and toughness are each equal to the number of charge counters on it.\""); cardType.add(CardType.CREATURE); subtype.add("Construct"); - power = MageInt.EmptyMageInt; - toughness = MageInt.EmptyMageInt; - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ChimericMassTokenEffect())); + power = new MageInt(0); + toughness = new MageInt(0); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(new CountersCount(CounterType.CHARGE), Duration.WhileOnBattlefield))); } } - -class ChimericMassTokenEffect extends ContinuousEffectImpl { - - private DynamicValue counters = new CountersCount(CounterType.CHARGE); - - public ChimericMassTokenEffect() { - super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature); - } - - public ChimericMassTokenEffect(final ChimericMassTokenEffect effect) { - super(effect); - } - - @Override - public ChimericMassTokenEffect copy() { - return new ChimericMassTokenEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent token = game.getPermanent(source.getSourceId()); - if (token != null) { - int count = counters.calculate(game, source); - token.getPower().setValue(count); - token.getToughness().setValue(count); - return true; - } - return false; - } - -} \ No newline at end of file diff --git a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureSourceEffect.java b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureSourceEffect.java index 81c2691f17..82d7fb50ff 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureSourceEffect.java @@ -33,7 +33,6 @@ import mage.Constants.Duration; import mage.Constants.Layer; import mage.Constants.Outcome; import mage.Constants.SubLayer; -import mage.MageInt; import mage.abilities.Ability; import mage.abilities.effects.ContinuousEffectImpl; import mage.game.Game; @@ -81,7 +80,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl 0) { @@ -106,10 +105,12 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl 0) { - for (Constants.CardType t : token.getCardType()) { + for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); } @@ -108,10 +106,12 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl