mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Implemented Sinister Sabotage
This commit is contained in:
parent
087b6126a0
commit
22585729c4
6 changed files with 117 additions and 5 deletions
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
package mage.abilities.effects.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
|
@ -15,8 +13,6 @@ import mage.util.CardUtil;
|
|||
*/
|
||||
public class ScryEffect extends OneShotEffect {
|
||||
|
||||
protected static FilterCard filter1 = new FilterCard("card to put on the bottom of your library");
|
||||
|
||||
protected int scryNumber;
|
||||
|
||||
public ScryEffect(int scryNumber) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package mage.abilities.effects.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class SurveilEffect extends OneShotEffect {
|
||||
|
||||
protected int surveilNumber;
|
||||
|
||||
public SurveilEffect(int scryNumber) {
|
||||
super(Outcome.Benefit);
|
||||
this.surveilNumber = scryNumber;
|
||||
this.setText();
|
||||
}
|
||||
|
||||
public SurveilEffect(final SurveilEffect effect) {
|
||||
super(effect);
|
||||
this.surveilNumber = effect.surveilNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
return player.surveil(surveilNumber, source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurveilEffect copy() {
|
||||
return new SurveilEffect(this);
|
||||
}
|
||||
|
||||
private void setText() {
|
||||
StringBuilder sb = new StringBuilder("surveil ").append(surveilNumber);
|
||||
if (surveilNumber == 1) {
|
||||
sb.append(". <i>(Look at the top card of your library. You may put that card into your graveyard.)</i>");
|
||||
} else {
|
||||
sb.append(". <i>(Look at the top ");
|
||||
sb.append(CardUtil.numberToText(surveilNumber));
|
||||
sb.append(" cards of your library, then put any number of them into your graveyard and the rest on top in any order.)</i>");
|
||||
}
|
||||
staticText = sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -870,6 +870,8 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
|
||||
boolean scry(int value, Ability source, Game game);
|
||||
|
||||
boolean surveil(int value, Ability source, Game game);
|
||||
|
||||
/**
|
||||
* Only used for test player for pre-setting targets
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3898,7 +3898,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (!cards.isEmpty()) {
|
||||
String text;
|
||||
if (cards.size() == 1) {
|
||||
text = "card if you want to put it to the bottom of your library (Scry)";
|
||||
text = "card if you want to put it on the bottom of your library (Scry)";
|
||||
} else {
|
||||
text = "cards you want to put on the bottom of your library (Scry)";
|
||||
}
|
||||
|
|
@ -3912,6 +3912,29 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean surveil(int value, Ability source, Game game) {
|
||||
game.informPlayers(getLogName() + " surveils " + value);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(getLibrary().getTopCards(game, value));
|
||||
if (!cards.isEmpty()) {
|
||||
String text;
|
||||
if (cards.size() == 1) {
|
||||
text = "card if you want to put it into your graveyard (Surveil)";
|
||||
} else {
|
||||
text = "cards you want to put into your graveyard (Surveil)";
|
||||
}
|
||||
TargetCard target = new TargetCard(0, cards.size(), Zone.LIBRARY, new FilterCard(text));
|
||||
chooseTarget(Outcome.Benefit, cards, target, source, game);
|
||||
moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game);
|
||||
cards.removeAll(target.getTargets());
|
||||
putCardsOnTopOfLibrary(cards, game, source, true);
|
||||
}
|
||||
// Waiting to see if this event is needed - TheElk801
|
||||
// game.fireEvent(new GameEvent(GameEvent.EventType.SURVEIL, getId(), source == null ? null : source.getSourceId(), getId(), value, true));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addTargets(Ability ability, Game game
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue