mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08: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
|
|
@ -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…
Add table
Add a link
Reference in a new issue