Merge pull request #10212 from Grath/master

[MOC] Implement Deluxe Dragster, fix Rashmi and Ragavan.
This commit is contained in:
Grath 2023-04-12 11:12:48 -04:00 committed by GitHub
commit cfa1dffc1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,5 @@
package mage.cards.r; package mage.cards.r;
import mage.ApprovingObject;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -13,8 +12,11 @@ import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffec
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.*; import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.token.TreasureToken; import mage.game.permanent.token.TreasureToken;
@ -48,10 +50,8 @@ public final class RashmiAndRagavan extends CardImpl {
// exile the top card of target opponent's library and create a Treasure token. // exile the top card of target opponent's library and create a Treasure token.
// Then you may cast the exiled card without paying its mana cost if it's a spell with mana value // Then you may cast the exiled card without paying its mana cost if it's a spell with mana value
// less than the number of artifacts you control. // less than the number of artifacts you control.
// If you don't cast it this way, you may cast it this turn. // If you dont cast it this way, you may cast it this turn.
Ability ability = new RashmiAndRagavanTriggeredAbility(); this.addAbility(new RashmiAndRagavanTriggeredAbility());
ability.addTarget(new TargetOpponent());
this.addAbility(ability, new SpellsCastWatcher());
} }
private RashmiAndRagavan(final RashmiAndRagavan card) { private RashmiAndRagavan(final RashmiAndRagavan card) {
@ -68,6 +68,8 @@ class RashmiAndRagavanTriggeredAbility extends SpellCastControllerTriggeredAbili
RashmiAndRagavanTriggeredAbility() { RashmiAndRagavanTriggeredAbility() {
super(new CreateTokenEffect(new TreasureToken()), false); super(new CreateTokenEffect(new TreasureToken()), false);
this.addTarget(new TargetOpponent());
this.addWatcher(new SpellsCastWatcher());
this.addEffect(new RashmiAndRagavanEffect()); this.addEffect(new RashmiAndRagavanEffect());
} }
@ -125,7 +127,6 @@ class RashmiAndRagavanEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Boolean cardWasCast = false;
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (controller == null || player == null) { if (controller == null || player == null) {
@ -149,13 +150,9 @@ class RashmiAndRagavanEffect extends OneShotEffect {
int artifactCount = new PermanentsOnBattlefieldCount( int artifactCount = new PermanentsOnBattlefieldCount(
StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT
).calculate(game, source, this); ).calculate(game, source, this);
if (!card.isLand() && card.getManaValue() < artifactCount && controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getName() FilterCard filter = new FilterCard();
+ " without paying its mana cost?", source, game)) { filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, artifactCount));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE); Boolean cardWasCast = CardUtil.castSpellWithAttributesForFree(controller, source, game, new CardsImpl(card), filter);
cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
game, true, new ApprovingObject(source, game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
}
if (!cardWasCast) { if (!cardWasCast) {
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.EndOfTurn, false, true); ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.EndOfTurn, false, true);
effect.setTargetPointer(new FixedTargets(cards, game)); effect.setTargetPointer(new FixedTargets(cards, game));