mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Deranged Assistant - Disallowed possible undo to prevent cheating with otherwise hidden information (top card of library).
This commit is contained in:
parent
d9883940df
commit
04730e490b
5 changed files with 24 additions and 19 deletions
|
@ -53,13 +53,13 @@ public class RotFarmSkeleton extends CardImpl {
|
|||
this.expansionSetCode = "DGM";
|
||||
this.subtype.add("Plant");
|
||||
this.subtype.add("Skeleton");
|
||||
this.color.setBlack(true);
|
||||
this.color.setGreen(true);
|
||||
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Rot Farm Skeleton can't block.
|
||||
this.addAbility(new CantBlockAbility());
|
||||
|
||||
// 2{B}{G}, Put the top four cards of your library into your graveyard: Return Rot Farm Skeleton from your graveyard to the battlefield. Activate this ability only any time you could cast a sorcery.
|
||||
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), new ManaCostsImpl("{2}{B}{G}"));
|
||||
ability.addCost(new PutTopCardOfYourLibraryToGraveyardCost(4));
|
||||
|
|
|
@ -47,13 +47,13 @@ public class DerangedAssistant extends CardImpl {
|
|||
this.subtype.add("Human");
|
||||
this.subtype.add("Wizard");
|
||||
|
||||
this.color.setBlue(true);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// {tap}, Put the top card of your library into your graveyard: Add {1} to your mana pool.
|
||||
// {T}, Put the top card of your library into your graveyard: Add {1} to your mana pool.
|
||||
ColorlessManaAbility ability = new ColorlessManaAbility();
|
||||
ability.addCost(new PutTopCardOfYourLibraryToGraveyardCost());
|
||||
ability.setUndoPossible(false);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ import mage.constants.Zone;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
@ -65,16 +67,10 @@ public class PutTopCardOfYourLibraryToGraveyardCost extends CostImpl {
|
|||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if (player != null && player.getLibrary().size() >= numberOfCards) {
|
||||
int i = 0;
|
||||
paid = true;
|
||||
while (player.isInGame() && i < numberOfCards) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
// all cards must reach the graveyard to pay the costs
|
||||
paid &= card.moveToZone(Zone.GRAVEYARD, sourceId, game, true);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(player.getLibrary().getTopCards(game, numberOfCards));
|
||||
player.moveCardsToGraveyardWithInfo(cards, ability, game, Zone.LIBRARY);
|
||||
}
|
||||
return paid;
|
||||
}
|
||||
|
@ -82,10 +78,7 @@ public class PutTopCardOfYourLibraryToGraveyardCost extends CostImpl {
|
|||
@Override
|
||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if (player != null && player.getLibrary().size() >= numberOfCards) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return player != null && player.getLibrary().size() >= numberOfCards;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.UUID;
|
|||
import mage.Mana;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.ManaEffect;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.Zone;
|
||||
|
@ -46,10 +47,12 @@ import mage.game.Game;
|
|||
public abstract class ManaAbility extends ActivatedAbilityImpl {
|
||||
|
||||
protected List<Mana> netMana = new ArrayList<>();
|
||||
|
||||
protected boolean undoPossible;
|
||||
|
||||
public ManaAbility(Zone zone, ManaEffect effect, Cost cost) {
|
||||
super(AbilityType.MANA, zone);
|
||||
this.usesStack = false;
|
||||
this.undoPossible = true;
|
||||
if (effect != null) {
|
||||
this.addEffect(effect);
|
||||
}
|
||||
|
@ -92,4 +95,13 @@ public abstract class ManaAbility extends ActivatedAbilityImpl {
|
|||
public boolean definesMana() {
|
||||
return netMana.size() > 0;
|
||||
}
|
||||
|
||||
public boolean isUndoPossible() {
|
||||
return undoPossible;
|
||||
}
|
||||
|
||||
public void setUndoPossible(boolean undoPossible) {
|
||||
this.undoPossible = undoPossible;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1016,7 +1016,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
int bookmark = game.bookmarkState();
|
||||
if (ability.activate(game, false)) {
|
||||
if (ability.resolve(game)) {
|
||||
if (storedBookmark == -1 || storedBookmark > bookmark) { // e.g. usefull for undo Nykthos, Shrine to Nyx
|
||||
if (ability.isUndoPossible() && storedBookmark == -1 || storedBookmark > bookmark) { // e.g. usefull for undo Nykthos, Shrine to Nyx
|
||||
setStoredBookmark(bookmark);
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue