diff --git a/Mage.Sets/src/mage/sets/gatecrash/GideonChampionOfJustice.java b/Mage.Sets/src/mage/sets/gatecrash/GideonChampionOfJustice.java index c28565c4edc..75875b97e91 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/GideonChampionOfJustice.java +++ b/Mage.Sets/src/mage/sets/gatecrash/GideonChampionOfJustice.java @@ -32,13 +32,11 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; -import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.PermanentsTargetOpponentControlsCount; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.PreventAllDamageToSourceEffect; import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; -import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.IndestructibleAbility; import mage.cards.CardImpl; @@ -46,7 +44,6 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; @@ -74,7 +71,9 @@ public class GideonChampionOfJustice extends CardImpl { this.addAbility(ability1); // 0: Until end of turn, Gideon becomes an indestructible Human Soldier creature with power and toughness each equal to the number of loyalty counters on him. He's still a planeswalker. Prevent all damage that would be dealt to him this turn. - LoyaltyAbility ability2 = new LoyaltyAbility(new BecomesCreatureSourceEffect(new GideonChampionOfJusticeToken(), "planeswalker", Duration.EndOfTurn, false, false), 0); + CountersCount loyaltyCount = new CountersCount(CounterType.LOYALTY); + LoyaltyAbility ability2 = new LoyaltyAbility(new BecomesCreatureSourceEffect( + new GideonChampionOfJusticeToken(), "planeswalker", Duration.EndOfTurn, false, false, loyaltyCount, loyaltyCount), 0); ability2.addEffect(new PreventAllDamageToSourceEffect(Duration.EndOfTurn)); this.addAbility(ability2); @@ -129,11 +128,9 @@ class GideonChampionOfJusticeToken extends Token { subtype.add("Soldier"); power = new MageInt(0); toughness = new MageInt(0); - + this.addAbility(IndestructibleAbility.getInstance()); - - CountersCount loyaltyCount = new CountersCount(CounterType.LOYALTY); - this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(loyaltyCount, Duration.WhileOnBattlefield))); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/GideonTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/GideonTest.java index 4518ae54d70..78d4d81a443 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/GideonTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/GideonTest.java @@ -75,31 +75,36 @@ public class GideonTest extends CardTestPlayerBase { assertPermanentCount(playerB, "Silvercoat Lion", 1); assertAbility(playerB, "Silvercoat Lion", IndestructibleAbility.getInstance(), false); } - + /* * Reported bug: When Gideon, Champion of Justice uses his +0 ability to become a creature, * he is immediately sent to the grave instead. - */ + */ @Test public void testGideonChampionOfJusticeSecondAbility() { - + /* Gideon, Champion of Justice {2}{W}{W} - 4 Loyalty - 0: Until end of turn, Gideon, Champion of Justice becomes a Human Soldier creature with power and toughness - each equal to the number of loyalty counters on him and gains indestructible. He's still a planeswalker. + +1: Put a loyalty counter on Gideon, Champion of Justice for each creature target opponent controls. + + 0: Until end of turn, Gideon, Champion of Justice becomes a Human Soldier creature with power and toughness + each equal to the number of loyalty counters on him and gains indestructible. He's still a planeswalker. Prevent all damage that would be dealt to him this turn. - */ + LoyaltyAbility ability1 = new LoyaltyAbility( + + -15: Exile all other permanents. + */ addCard(Zone.BATTLEFIELD, playerA, "Gideon, Champion of Justice", 1); - + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+0: Until end of turn"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - + assertGraveyardCount(playerA, "Gideon, Champion of Justice", 0); assertPermanentCount(playerA, "Gideon, Champion of Justice", 1); assertPowerToughness(playerA, "Gideon, Champion of Justice", 4, 4); assertCounterCount(playerA, "Gideon, Champion of Justice", CounterType.LOYALTY, 4); - + } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java index c8606d07b8b..507fa018039 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java @@ -27,9 +27,9 @@ */ package mage.abilities.effects.common.continuous; -import mage.MageInt; import mage.MageObjectReference; import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.ContinuousEffectImpl; import mage.cards.repository.CardRepository; import mage.constants.CardType; @@ -50,17 +50,25 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements protected Token token; protected String type; protected boolean losePreviousTypes; + protected DynamicValue power; + protected DynamicValue toughness; public BecomesCreatureSourceEffect(Token token, String type, Duration duration) { this(token, type, duration, false, false); } public BecomesCreatureSourceEffect(Token token, String type, Duration duration, boolean losePreviousTypes, boolean characterDefining) { + this(token, type, duration, losePreviousTypes, characterDefining, null, null); + } + + public BecomesCreatureSourceEffect(Token token, String type, Duration duration, boolean losePreviousTypes, boolean characterDefining, DynamicValue power, DynamicValue toughness) { super(duration, Outcome.BecomeCreature); this.characterDefining = characterDefining; this.token = token; this.type = type; this.losePreviousTypes = losePreviousTypes; + this.power = power; + this.toughness = toughness; setText(); } @@ -69,6 +77,8 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements this.token = effect.token.copy(); this.type = effect.type; this.losePreviousTypes = effect.losePreviousTypes; + this.power = effect.power; + this.toughness = effect.toughness; } @Override @@ -133,19 +143,21 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements case PTChangingEffects_7: if ((sublayer == SubLayer.CharacteristicDefining_7a && isCharacterDefining()) || (sublayer == SubLayer.SetPT_7b && !isCharacterDefining())) { - MageInt power = token.getPower(); - MageInt toughness = token.getToughness(); - if (power != null && toughness != null) { - permanent.getPower().setValue(power.getValue()); - permanent.getToughness().setValue(toughness.getValue()); + if (power != null) { + permanent.getPower().setValue(power.calculate(game, source, this)); + } else if (token.getPower() != null) { + permanent.getPower().setValue(token.getPower().getValue()); + } + if (toughness != null) { + permanent.getToughness().setValue(toughness.calculate(game, source, this)); + } else if (token.getToughness() != null) { + permanent.getToughness().setValue(token.getToughness().getValue()); } } } return true; - } else { - if (duration.equals(Duration.Custom)) { - this.discard(); - } + } else if (duration.equals(Duration.Custom)) { + this.discard(); } return false; }