* 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:
bobwoco 2023-03-05 01:29:46 -06:00 committed by GitHub
parent 1b54659c7d
commit 6102ccee53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 62 deletions

View file

@ -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;
}
}