mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Clash ability - fixed that some clash cards can broke the server (#10097)
Co-authored-by: Ethan Ward <ethanandrewward@gmail.com>
This commit is contained in:
parent
1b54659c7d
commit
6102ccee53
7 changed files with 23 additions and 62 deletions
|
@ -2,7 +2,9 @@
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.effects.common.ClashWinReturnToHandSpellEffect;
|
|
||||||
|
import mage.abilities.effects.common.DoIfClashWonEffect;
|
||||||
|
import mage.abilities.effects.common.ReturnToHandSpellEffect;
|
||||||
import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
|
import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
@ -23,7 +25,7 @@ public final class RecrossThePaths extends CardImpl {
|
||||||
this.getSpellAbility().addEffect(new RevealCardsFromLibraryUntilEffect(new FilterLandCard(), Zone.BATTLEFIELD, Zone.LIBRARY, false, true));
|
this.getSpellAbility().addEffect(new RevealCardsFromLibraryUntilEffect(new FilterLandCard(), Zone.BATTLEFIELD, Zone.LIBRARY, false, true));
|
||||||
|
|
||||||
// Clash with an opponent. If you win, return Recross the Paths to its owner's hand.
|
// Clash with an opponent. If you win, return Recross the Paths to its owner's hand.
|
||||||
this.getSpellAbility().addEffect(ClashWinReturnToHandSpellEffect.getInstance());
|
this.getSpellAbility().addEffect(new DoIfClashWonEffect(ReturnToHandSpellEffect.getInstance()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private RecrossThePaths(final RecrossThePaths card) {
|
private RecrossThePaths(final RecrossThePaths card) {
|
||||||
|
|
|
@ -2,14 +2,15 @@
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.effects.common.ClashWinReturnToHandSpellEffect;
|
|
||||||
|
import mage.abilities.effects.common.DoIfClashWonEffect;
|
||||||
|
import mage.abilities.effects.common.ReturnToHandSpellEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainProtectionFromColorTargetEffect;
|
import mage.abilities.effects.common.continuous.GainProtectionFromColorTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.target.common.TargetControlledCreaturePermanent;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -24,7 +25,7 @@ public final class RedeemTheLost extends CardImpl {
|
||||||
this.getSpellAbility().addEffect(new GainProtectionFromColorTargetEffect(Duration.EndOfTurn));
|
this.getSpellAbility().addEffect(new GainProtectionFromColorTargetEffect(Duration.EndOfTurn));
|
||||||
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
|
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
|
||||||
// Clash with an opponent. If you win, return Redeem the Lost to its owner's hand.
|
// Clash with an opponent. If you win, return Redeem the Lost to its owner's hand.
|
||||||
this.getSpellAbility().addEffect(ClashWinReturnToHandSpellEffect.getInstance());
|
this.getSpellAbility().addEffect(new DoIfClashWonEffect(ReturnToHandSpellEffect.getInstance()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private RedeemTheLost(final RedeemTheLost card) {
|
private RedeemTheLost(final RedeemTheLost card) {
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.effects.common.ClashWinReturnToHandSpellEffect;
|
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
|
import mage.abilities.effects.common.DoIfClashWonEffect;
|
||||||
|
import mage.abilities.effects.common.ReturnToHandSpellEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -22,7 +24,7 @@ public final class ReleaseTheAnts extends CardImpl {
|
||||||
// Release the Ants deals 1 damage to any target. Clash with an opponent. If you win, return Release the Ants to its owner's hand.
|
// Release the Ants deals 1 damage to any target. Clash with an opponent. If you win, return Release the Ants to its owner's hand.
|
||||||
this.getSpellAbility().addEffect(new DamageTargetEffect(1));
|
this.getSpellAbility().addEffect(new DamageTargetEffect(1));
|
||||||
this.getSpellAbility().addTarget(new TargetAnyTarget());
|
this.getSpellAbility().addTarget(new TargetAnyTarget());
|
||||||
this.getSpellAbility().addEffect(ClashWinReturnToHandSpellEffect.getInstance());
|
this.getSpellAbility().addEffect(new DoIfClashWonEffect(ReturnToHandSpellEffect.getInstance()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReleaseTheAnts(final ReleaseTheAnts card) {
|
private ReleaseTheAnts(final ReleaseTheAnts card) {
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.effects.common.ClashWinReturnToHandSpellEffect;
|
|
||||||
|
import mage.abilities.effects.common.DoIfClashWonEffect;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
import mage.abilities.effects.common.ReturnToHandSpellEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -20,7 +22,7 @@ public final class ResearchTheDeep extends CardImpl {
|
||||||
// Draw a card.
|
// Draw a card.
|
||||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
|
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
|
||||||
// Clash with an opponent. If you win, return Research the Deep to its owner's hand.
|
// Clash with an opponent. If you win, return Research the Deep to its owner's hand.
|
||||||
this.getSpellAbility().addEffect(ClashWinReturnToHandSpellEffect.getInstance());
|
this.getSpellAbility().addEffect(new DoIfClashWonEffect(ReturnToHandSpellEffect.getInstance()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResearchTheDeep(final ResearchTheDeep card) {
|
private ResearchTheDeep(final ResearchTheDeep card) {
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.effects.common.ClashWinReturnToHandSpellEffect;
|
|
||||||
|
import mage.abilities.effects.common.DoIfClashWonEffect;
|
||||||
|
import mage.abilities.effects.common.ReturnToHandSpellEffect;
|
||||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
@ -23,7 +25,7 @@ public final class ReviveTheFallen extends CardImpl {
|
||||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
|
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card from a graveyard")));
|
this.getSpellAbility().addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card from a graveyard")));
|
||||||
// Clash with an opponent. If you win, return Revive the Fallen to its owner's hand.
|
// Clash with an opponent. If you win, return Revive the Fallen to its owner's hand.
|
||||||
this.getSpellAbility().addEffect(ClashWinReturnToHandSpellEffect.getInstance());
|
this.getSpellAbility().addEffect(new DoIfClashWonEffect(ReturnToHandSpellEffect.getInstance()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReviveTheFallen(final ReviveTheFallen card) {
|
private ReviveTheFallen(final ReviveTheFallen card) {
|
||||||
|
|
|
@ -3,8 +3,9 @@ package mage.cards.t;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||||
import mage.abilities.effects.common.ClashWinReturnToHandSpellEffect;
|
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
|
import mage.abilities.effects.common.DoIfClashWonEffect;
|
||||||
|
import mage.abilities.effects.common.ReturnToHandSpellEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -23,7 +24,7 @@ public final class TitansRevenge extends CardImpl {
|
||||||
// Titan's Revenge deals X damage to any target. Clash with an opponent. If you win, return Titan's Revenge to its owner's hand.
|
// Titan's Revenge deals X damage to any target. Clash with an opponent. If you win, return Titan's Revenge to its owner's hand.
|
||||||
this.getSpellAbility().addEffect(new DamageTargetEffect(ManacostVariableValue.REGULAR));
|
this.getSpellAbility().addEffect(new DamageTargetEffect(ManacostVariableValue.REGULAR));
|
||||||
this.getSpellAbility().addTarget(new TargetAnyTarget());
|
this.getSpellAbility().addTarget(new TargetAnyTarget());
|
||||||
this.getSpellAbility().addEffect(ClashWinReturnToHandSpellEffect.getInstance());
|
this.getSpellAbility().addEffect(new DoIfClashWonEffect(ReturnToHandSpellEffect.getInstance()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private TitansRevenge(final TitansRevenge card) {
|
private TitansRevenge(final TitansRevenge card) {
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.MageSingleton;
|
|
||||||
import mage.abilities.effects.OneShotEffect;
|
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author LevelX2
|
|
||||||
*/
|
|
||||||
public class ClashWinReturnToHandSpellEffect extends OneShotEffect implements MageSingleton {
|
|
||||||
|
|
||||||
private static final ClashWinReturnToHandSpellEffect instance = new ClashWinReturnToHandSpellEffect();
|
|
||||||
|
|
||||||
public static ClashWinReturnToHandSpellEffect getInstance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ClashWinReturnToHandSpellEffect() {
|
|
||||||
super(Outcome.ReturnToHand);
|
|
||||||
staticText = "Clash with an opponent. If you win, return {this} to its owner's hand";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null) {
|
|
||||||
if (ClashEffect.getInstance().apply(game, source)) {
|
|
||||||
Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard();
|
|
||||||
if (spellCard != null) {
|
|
||||||
controller.moveCards(spellCard, Zone.HAND, source, game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ClashWinReturnToHandSpellEffect copy() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue