mirror of
https://github.com/correl/mage.git
synced 2024-12-29 03:00:15 +00:00
Merge pull request #10212 from Grath/master
[MOC] Implement Deluxe Dragster, fix Rashmi and Ragavan.
This commit is contained in:
commit
cfa1dffc1e
1 changed files with 10 additions and 13 deletions
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import mage.ApprovingObject;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -13,8 +12,11 @@ import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffec
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
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.
|
||||
// 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.
|
||||
// If you don't cast it this way, you may cast it this turn.
|
||||
Ability ability = new RashmiAndRagavanTriggeredAbility();
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability, new SpellsCastWatcher());
|
||||
// If you don’t cast it this way, you may cast it this turn.
|
||||
this.addAbility(new RashmiAndRagavanTriggeredAbility());
|
||||
}
|
||||
|
||||
private RashmiAndRagavan(final RashmiAndRagavan card) {
|
||||
|
@ -68,6 +68,8 @@ class RashmiAndRagavanTriggeredAbility extends SpellCastControllerTriggeredAbili
|
|||
|
||||
RashmiAndRagavanTriggeredAbility() {
|
||||
super(new CreateTokenEffect(new TreasureToken()), false);
|
||||
this.addTarget(new TargetOpponent());
|
||||
this.addWatcher(new SpellsCastWatcher());
|
||||
this.addEffect(new RashmiAndRagavanEffect());
|
||||
}
|
||||
|
||||
|
@ -125,7 +127,6 @@ class RashmiAndRagavanEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Boolean cardWasCast = false;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (controller == null || player == null) {
|
||||
|
@ -149,13 +150,9 @@ class RashmiAndRagavanEffect extends OneShotEffect {
|
|||
int artifactCount = new PermanentsOnBattlefieldCount(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT
|
||||
).calculate(game, source, this);
|
||||
if (!card.isLand() && card.getManaValue() < artifactCount && controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getName()
|
||||
+ " without paying its mana cost?", source, game)) {
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||
cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
||||
game, true, new ApprovingObject(source, game));
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||
}
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, artifactCount));
|
||||
Boolean cardWasCast = CardUtil.castSpellWithAttributesForFree(controller, source, game, new CardsImpl(card), filter);
|
||||
if (!cardWasCast) {
|
||||
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.EndOfTurn, false, true);
|
||||
effect.setTargetPointer(new FixedTargets(cards, game));
|
||||
|
|
Loading…
Reference in a new issue