diff --git a/Mage.Sets/src/mage/cards/r/RhythmOfTheWild.java b/Mage.Sets/src/mage/cards/r/RhythmOfTheWild.java index 5a9238f5a8..33e59fb241 100644 --- a/Mage.Sets/src/mage/cards/r/RhythmOfTheWild.java +++ b/Mage.Sets/src/mage/cards/r/RhythmOfTheWild.java @@ -1,34 +1,37 @@ package mage.cards.r; +import java.util.UUID; +import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.CantBeCounteredControlledEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect; import mage.abilities.keyword.RiotAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.TargetController; import mage.filter.FilterPermanent; import mage.filter.FilterSpell; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreatureSpell; import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.TokenPredicate; -import java.util.UUID; - /** * @author TheElk801 */ public final class RhythmOfTheWild extends CardImpl { private static final FilterSpell filter - = new FilterSpell("Creature spells you control"); + = new FilterCreatureSpell("Creature spells you control"); private static final FilterPermanent filter2 - = new FilterControlledCreaturePermanent("Nontoken creatures"); + = new FilterControlledCreaturePermanent(); static { - filter.add(new CardTypePredicate(CardType.CREATURE)); + filter.add(new ControllerPredicate(TargetController.YOU)); filter2.add(Predicates.not(new TokenPredicate())); } @@ -41,9 +44,12 @@ public final class RhythmOfTheWild extends CardImpl { ))); // Nontoken creatures you control have riot. - this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect( + Ability ability = new SimpleStaticAbility(new GainAbilityControlledSpellsEffect( + new RiotAbility(), new FilterCreatureSpell()).setText("Nontoken creatures you control have riot. (They enter the battlefield with your choice of a +1/+1 counter or haste.)")); + ability.addEffect(new GainAbilityControlledEffect( new RiotAbility(), Duration.WhileOnBattlefield, filter2 - ))); + ).setText("")); + this.addAbility(ability); } private RhythmOfTheWild(final RhythmOfTheWild card) { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/RiotTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/RiotTest.java new file mode 100644 index 0000000000..9503cd5388 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/RiotTest.java @@ -0,0 +1,112 @@ +package org.mage.test.cards.abilities.keywords; + +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.RiotAbility; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ +public class RiotTest extends CardTestPlayerBase { + + /** + * A creature with riot enters the battlefield with a +1/+1 counter on it or + * with haste, its controller's choice. This choice is made as the creature + * enters the battlefield, so no one can respond to the choice. + * + * The creature will have the chosen bonus the moment it enters the + * battlefield. If you choose to have the creature gain haste, it keeps + * haste even after the turn ends. This could matter if another player gains + * control of the creature later. + */ + @Test + public void RiotBoost() { + addCard(Zone.BATTLEFIELD, playerA, "Forest", 5); + + // Riot (This creature enters the battleifled with your choice of a +1/+1 counter or haste.) + addCard(Zone.HAND, playerA, "Rampaging Rendhorn", 1); // Creature {4}{G} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rampaging Rendhorn"); + setChoice(playerA, "Yes"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + + execute(); + + assertPermanentCount(playerA, "Rampaging Rendhorn", 1); + assertPowerToughness(playerA, "Rampaging Rendhorn", 5, 5); + assertAbility(playerA, "Rampaging Rendhorn", HasteAbility.getInstance(), false); + + } + + @Test + public void RiotHaste() { + addCard(Zone.BATTLEFIELD, playerA, "Forest", 5); + + // Riot (This creature enters the battlefield with your choice of a +1/+1 counter or haste.) + addCard(Zone.HAND, playerA, "Rampaging Rendhorn", 1); // Creature {4}{G} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rampaging Rendhorn"); + setChoice(playerA, "No"); + + setStopAt(2, PhaseStep.BEGIN_COMBAT); + + execute(); + + assertPermanentCount(playerA, "Rampaging Rendhorn", 1); + assertPowerToughness(playerA, "Rampaging Rendhorn", 4, 4); + assertAbility(playerA, "Rampaging Rendhorn", HasteAbility.getInstance(), true); + } + + @Test + public void RiotRhythmOfTheWildBoost() { + addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); + + // Creature spells you control can't be countered. + // Nontoken creatures you control have riot. + addCard(Zone.BATTLEFIELD, playerA, "Rhythm of the Wild", 1); + + // Riot (This creature enters the battleifled with your choice of a +1/+1 counter or haste.) + addCard(Zone.HAND, playerA, "Silvercoat Lion", 1); // Creature {1}{W} 2/2 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion"); + setChoice(playerA, "Yes"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + + execute(); + + assertPermanentCount(playerA, "Silvercoat Lion", 1); + assertPowerToughness(playerA, "Silvercoat Lion", 3, 3); + assertAbility(playerA, "Silvercoat Lion", HasteAbility.getInstance(), false); + assertAbility(playerA, "Silvercoat Lion", new RiotAbility(), true); + } + + @Test + public void RiotRhythmOfTheWildHaste() { + addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); + + // Creature spells you control can't be countered. + // Nontoken creatures you control have riot. + addCard(Zone.BATTLEFIELD, playerA, "Rhythm of the Wild", 1); + + // Riot (This creature enters the battleifled with your choice of a +1/+1 counter or haste.) + addCard(Zone.HAND, playerA, "Silvercoat Lion", 1); // Creature {1}{W} 2/2 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion"); + setChoice(playerA, "No"); + + setStopAt(2, PhaseStep.BEGIN_COMBAT); + + execute(); + + assertPermanentCount(playerA, "Silvercoat Lion", 1); + assertPowerToughness(playerA, "Silvercoat Lion", 2, 2); + assertAbility(playerA, "Silvercoat Lion", HasteAbility.getInstance(), true); + assertAbility(playerA, "Silvercoat Lion", new RiotAbility(), true); + } +}