diff --git a/Mage.Sets/src/mage/cards/r/RapidAugmenter.java b/Mage.Sets/src/mage/cards/r/RapidAugmenter.java new file mode 100644 index 00000000000..5eb5962a0ec --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RapidAugmenter.java @@ -0,0 +1,68 @@ +package mage.cards.r; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldCastTriggeredAbility; +import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; +import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.constants.*; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.filter.predicate.mageobject.BasePowerPredicate; + +/** + * + * @author jimga150 + */ +public final class RapidAugmenter extends CardImpl { + + private static final FilterPermanent filterBP1 = new FilterControlledCreaturePermanent("another creature you control with base power 1"); + + static { + filterBP1.add(AnotherPredicate.instance); + filterBP1.add(new BasePowerPredicate(ComparisonType.EQUAL_TO, 1)); + } + + public RapidAugmenter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{R}"); + + this.subtype.add(SubType.OTTER); + this.subtype.add(SubType.ARTIFICER); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // Whenever another creature you control with base power 1 enters, it gains haste until end of turn. + Ability ability = new EntersBattlefieldControlledTriggeredAbility( + Zone.BATTLEFIELD, new GainAbilityTargetEffect(HasteAbility.getInstance()), filterBP1, false, SetTargetPointer.PERMANENT); + this.addAbility(ability); + + // Whenever another creature you control enters, if it wasn't cast, put a +1/+1 counter on Rapid Augmenter + // and Rapid Augmenter can't be blocked this turn. + Ability ability2 = new EntersBattlefieldCastTriggeredAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect( + CounterType.P1P1.createInstance()), StaticFilters.FILTER_ANOTHER_CREATURE_YOU_CONTROL, + false, SetTargetPointer.PERMANENT, false); + ability2.addEffect(new CantBeBlockedSourceEffect(Duration.EndOfTurn).concatBy(" and ")); + this.addAbility(ability2); + } + + private RapidAugmenter(final RapidAugmenter card) { + super(card); + } + + @Override + public RapidAugmenter copy() { + return new RapidAugmenter(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/BloomburrowCommander.java b/Mage.Sets/src/mage/sets/BloomburrowCommander.java index 9f5e5b6136b..3875aff37fb 100644 --- a/Mage.Sets/src/mage/sets/BloomburrowCommander.java +++ b/Mage.Sets/src/mage/sets/BloomburrowCommander.java @@ -212,6 +212,7 @@ public final class BloomburrowCommander extends ExpansionSet { cards.add(new SetCardInfo("Rain of Riches", 200, Rarity.RARE, mage.cards.r.RainOfRiches.class)); cards.add(new SetCardInfo("Rampaging Baloths", 233, Rarity.MYTHIC, mage.cards.r.RampagingBaloths.class)); cards.add(new SetCardInfo("Rampant Growth", 234, Rarity.COMMON, mage.cards.r.RampantGrowth.class)); + cards.add(new SetCardInfo("Rapid Augmenter", 38, Rarity.RARE, mage.cards.r.RapidAugmenter.class)); cards.add(new SetCardInfo("Rapid Hybridization", 111, Rarity.UNCOMMON, mage.cards.r.RapidHybridization.class)); cards.add(new SetCardInfo("Ravenous Squirrel", 258, Rarity.UNCOMMON, mage.cards.r.RavenousSquirrel.class)); cards.add(new SetCardInfo("Razorverge Thicket", 325, Rarity.RARE, mage.cards.r.RazorvergeThicket.class)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/blc/RapidAugmenterTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/blc/RapidAugmenterTest.java new file mode 100644 index 00000000000..14a755f7eb0 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/blc/RapidAugmenterTest.java @@ -0,0 +1,156 @@ +package org.mage.test.cards.single.blc; + +import mage.abilities.keyword.HasteAbility; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.permanent.Permanent; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +import static junit.framework.TestCase.assertEquals; +import static org.junit.Assert.fail; + +/** + * @author Susucr + */ +public class RapidAugmenterTest extends CardTestPlayerBase { + + /** + * {@link mage.cards.r.RapidAugmenter Rapid Augmenter} {1}{U}{R} + * Creature — Otter Artificer + * Haste + * Whenever another creature you control with base power 1 enters, it gains haste until end of turn. + * Whenever another creature you control enters, if it wasn’t cast, put a +1/+1 counter on Rapid Augmenter and + * Rapid Augmenter can’t be blocked this turn. + */ + private static final String rapidAugmenter = "Rapid Augmenter"; + + @Test + public void test_Cast21() { + // Tests that casting a 2/1 does not trigger Rapid Augmenter + addCard(Zone.BATTLEFIELD, playerA, rapidAugmenter); + addCard(Zone.BATTLEFIELD, playerA, "Island", 2); + addCard(Zone.HAND, playerA, "Air Marshal", 1); + addCard(Zone.BATTLEFIELD, playerB, "Alpine Watchdog", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Air Marshal", true); + + attack(1, playerA, rapidAugmenter, playerB); + // Rapid Augmenter can still be blocked + block(1, playerB, "Alpine Watchdog", rapidAugmenter); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + // First ability did not trigger + assertAbility(playerA, "Air Marshal", HasteAbility.getInstance(), false); + + // Second ability did not trigger + assertPowerToughness(playerA, rapidAugmenter, 1, 3); + assertCounterCount(playerA, rapidAugmenter, CounterType.P1P1, 0); + + // Rapid Augmenter was blocked + assertLife(playerB, currentGame.getStartingLife()); + + } + + @Test + public void test_Cast11() { + // Tests that casting a 1/1 triggers Rapid Augmenter + addCard(Zone.BATTLEFIELD, playerA, rapidAugmenter); + addCard(Zone.HAND, playerA, "Memnite", 1); + addCard(Zone.BATTLEFIELD, playerB, "Alpine Watchdog", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Memnite", true); + + attack(1, playerA, rapidAugmenter, playerB); + // 1/1 has haste so this will work + attack(1, playerA, "Memnite", playerB); + // Rapid Augmenter can still be blocked + block(1, playerB, "Alpine Watchdog", rapidAugmenter); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + // First ability triggered + assertAbility(playerA, "Memnite", HasteAbility.getInstance(), true); + + // Second ability did not trigger + assertPowerToughness(playerA, rapidAugmenter, 1, 3); + assertCounterCount(playerA, rapidAugmenter, CounterType.P1P1, 0); + + // Rapid Augmenter was blocked, Memnite was not + assertLife(playerB, currentGame.getStartingLife() - 1); + + } + + @Test + public void test_Bounce21() { + // Tests that bouncing a 2/1 triggers Rapid Augmenter's second ability, but not the first + addCard(Zone.BATTLEFIELD, playerA, rapidAugmenter); + addCard(Zone.BATTLEFIELD, playerA, "Air Marshal", 1); + addCard(Zone.HAND, playerA, "Ephemerate", 1); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); + addCard(Zone.BATTLEFIELD, playerB, "Alpine Watchdog", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ephemerate", true); + addTarget(playerA, "Air Marshal"); + + attack(1, playerA, rapidAugmenter, playerB); + // Rapid Augmenter can't be blocked, Alpine Watchdog wont take damage + block(1, playerB, "Alpine Watchdog", rapidAugmenter); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + // First ability did not trigger + assertAbility(playerA, "Air Marshal", HasteAbility.getInstance(), false); + + // Second ability triggered + assertPowerToughness(playerA, rapidAugmenter, 1 + 1, 3 + 1); + assertCounterCount(playerA, rapidAugmenter, CounterType.P1P1, 1); + + assertPermanentCount(playerB, "Alpine Watchdog", 1); + assertLife(playerB, currentGame.getStartingLife() - 2); + + } + + @Test + public void test_Bounce11() { + // Tests that bouncing a 2/1 triggers both of Rapid Augmenter's abilities + addCard(Zone.BATTLEFIELD, playerA, rapidAugmenter); + addCard(Zone.BATTLEFIELD, playerA, "Memnite", 1); + addCard(Zone.HAND, playerA, "Ephemerate", 1); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); + addCard(Zone.BATTLEFIELD, playerB, "Alpine Watchdog", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ephemerate", true); + addTarget(playerA, "Memnite"); + setChoice(playerA, "Whenever another creature you control you control enters"); // order triggers (doesnt matter the order but a choice must be made) + + attack(1, playerA, rapidAugmenter, playerB); + // Rapid Augmenter can't be blocked, Alpine Watchdog wont take damage + block(1, playerB, "Alpine Watchdog", rapidAugmenter); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + // First ability triggered + assertAbility(playerA, "Memnite", HasteAbility.getInstance(), true); + + // Second ability triggered + assertPowerToughness(playerA, rapidAugmenter, 1 + 1, 3 + 1); + assertCounterCount(playerA, rapidAugmenter, CounterType.P1P1, 1); + + assertPermanentCount(playerB, "Alpine Watchdog", 1); + assertLife(playerB, currentGame.getStartingLife() - 2); + + } + +}