[OTJ] Implement Riku of Many Paths (#12060)

This commit is contained in:
Evan Kranzler 2024-04-04 11:12:26 -04:00 committed by GitHub
parent 7f791fab3e
commit f0307394e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 139 additions and 0 deletions

View file

@ -0,0 +1,92 @@
package mage.cards.r;
import mage.MageInt;
import mage.abilities.Mode;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ExileTopXMayPlayUntilEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.BlueBirdToken;
import mage.game.stack.Spell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RikuOfManyPaths extends CardImpl {
public RikuOfManyPaths(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{U}{R}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Whenever you cast a modal spell, choose up to X, where X is the number of times you chose a mode for that spell --
// * Exile the top card of your library. Until the end of your next turn, you may play it.
// * Put a +1/+1 counter on Riku of Many Paths. It gains trample until end of turn.
// * Create a 1/1 blue Bird creature token with flying.
this.addAbility(new RikuOfManyPathsTriggeredAbility());
}
private RikuOfManyPaths(final RikuOfManyPaths card) {
super(card);
}
@Override
public RikuOfManyPaths copy() {
return new RikuOfManyPaths(this);
}
}
class RikuOfManyPathsTriggeredAbility extends TriggeredAbilityImpl {
RikuOfManyPathsTriggeredAbility() {
super(Zone.BATTLEFIELD, new ExileTopXMayPlayUntilEffect(1, Duration.UntilEndOfYourNextTurn));
this.setTriggerPhrase("Whenever you cast a modal spell, ");
this.getModes().setChooseText("choose up to X, where X is the number of times you chose a mode for that spell —");
this.addMode(new Mode(new AddCountersSourceEffect(CounterType.P1P1.createInstance()))
.addEffect(new GainAbilitySourceEffect(
TrampleAbility.getInstance(), Duration.EndOfTurn
).setText("it gains trample until end of turn")));
this.addMode(new Mode(new CreateTokenEffect(new BlueBirdToken())));
this.getModes().setMinModes(0);
}
private RikuOfManyPathsTriggeredAbility(final RikuOfManyPathsTriggeredAbility ability) {
super(ability);
}
@Override
public RikuOfManyPathsTriggeredAbility copy() {
return new RikuOfManyPathsTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Spell spell = game.getSpell(event.getTargetId());
if (spell == null
|| !spell.isControlledBy(getControllerId())
|| spell.getSpellAbility().getModes().size() < 2) {
return false;
}
this.getModes().setMaxModes(spell.getSpellAbility().getModes().getSelectedModes().size());
return true;
}
}

View file

@ -219,6 +219,7 @@ public final class OutlawsOfThunderJunction extends ExpansionSet {
cards.add(new SetCardInfo("Resilient Roadrunner", 141, Rarity.UNCOMMON, mage.cards.r.ResilientRoadrunner.class));
cards.add(new SetCardInfo("Return the Favor", 142, Rarity.UNCOMMON, mage.cards.r.ReturnTheFavor.class));
cards.add(new SetCardInfo("Rictus Robber", 102, Rarity.UNCOMMON, mage.cards.r.RictusRobber.class));
cards.add(new SetCardInfo("Riku of Many Paths", 227, Rarity.RARE, mage.cards.r.RikuOfManyPaths.class));
cards.add(new SetCardInfo("Rise of the Varmints", 179, Rarity.UNCOMMON, mage.cards.r.RiseOfTheVarmints.class));
cards.add(new SetCardInfo("Rodeo Pyromancers", 143, Rarity.COMMON, mage.cards.r.RodeoPyromancers.class));
cards.add(new SetCardInfo("Rooftop Assassin", 103, Rarity.COMMON, mage.cards.r.RooftopAssassin.class));

View file

@ -0,0 +1,46 @@
package org.mage.test.cards.single.otj;
import mage.abilities.keyword.TrampleAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author TheElk801
*/
public class RikuOfManyPathsTest extends CardTestPlayerBase {
private static final String riku = "Riku of Many Paths";
private static final String takedown = "Artful Takedown";
private static final String bear = "Grizzly Bears";
private static final String lion = "Silvercoat Lion";
@Test
public void testModeChoice() {
addCard(Zone.BATTLEFIELD, playerA, "Underground Sea", 4);
addCard(Zone.BATTLEFIELD, playerA, riku);
addCard(Zone.BATTLEFIELD, playerA, bear);
addCard(Zone.BATTLEFIELD, playerA, lion);
addCard(Zone.HAND, playerA, takedown);
setModeChoice(playerA, "1");
setModeChoice(playerA, "2");
addTarget(playerA, lion);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, takedown, bear);
setModeChoice(playerA, "2");
setModeChoice(playerA, "3");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertTapped(bear, true);
assertGraveyardCount(playerA, lion, 1);
assertCounterCount(playerA, riku, CounterType.P1P1, 1);
assertAbility(playerA, riku, TrampleAbility.getInstance(), true);
assertPermanentCount(playerA, "Bird Token", 1);
}
}