mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented Diviner's Lockbox
This commit is contained in:
parent
b770c63fb3
commit
52e8f9bcfc
2 changed files with 93 additions and 0 deletions
92
Mage.Sets/src/mage/cards/d/DivinersLockbox.java
Normal file
92
Mage.Sets/src/mage/cards/d/DivinersLockbox.java
Normal file
|
@ -0,0 +1,92 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class DivinersLockbox extends CardImpl {
|
||||
|
||||
public DivinersLockbox(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||
|
||||
// {1}, {T}: Choose a card name, then reveal the top card of your library. If that card has the chosen name, sacrifice Diviner's Lockbox and draw three cards. Activate this ability only any time you could cast a sorcery.
|
||||
Ability ability = new ActivateAsSorceryActivatedAbility(
|
||||
Zone.BATTLEFIELD, new DivinersLockboxEffect(), new GenericManaCost(1)
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private DivinersLockbox(final DivinersLockbox card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DivinersLockbox copy() {
|
||||
return new DivinersLockbox(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DivinersLockboxEffect extends OneShotEffect {
|
||||
|
||||
private static final Effect sacEffect = new SacrificeSourceEffect();
|
||||
|
||||
DivinersLockboxEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Choose a card name, then reveal the top card of your library. " +
|
||||
"If that card has the chosen name, sacrifice {this} and draw three cards. " +
|
||||
"Activate this ability only any time you could cast a sorcery.";
|
||||
}
|
||||
|
||||
private DivinersLockboxEffect(final DivinersLockboxEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DivinersLockboxEffect copy() {
|
||||
return new DivinersLockboxEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Choice choice = new ChoiceImpl();
|
||||
choice.setChoices(CardRepository.instance.getNames());
|
||||
choice.setMessage("Choose a card name");
|
||||
if (!player.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers(source.getSourceObject(game).getLogName() + ", chosen name: [" + choice.getChoice() + ']');
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
player.revealCards(source, new CardsImpl(card), game);
|
||||
if (choice.getChoice().equals(card.getName())) {
|
||||
sacEffect.apply(game, source);
|
||||
player.drawCards(3, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -58,6 +58,7 @@ public final class CoreSet2020 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Disenchant", 14, Rarity.COMMON, mage.cards.d.Disenchant.class));
|
||||
cards.add(new SetCardInfo("Disfigure", 95, Rarity.UNCOMMON, mage.cards.d.Disfigure.class));
|
||||
cards.add(new SetCardInfo("Dismal Backwater", 245, Rarity.COMMON, mage.cards.d.DismalBackwater.class));
|
||||
cards.add(new SetCardInfo("Diviner's Lockbox", 225, Rarity.UNCOMMON, mage.cards.d.DivinersLockbox.class));
|
||||
cards.add(new SetCardInfo("Dragon Mage", 135, Rarity.UNCOMMON, mage.cards.d.DragonMage.class));
|
||||
cards.add(new SetCardInfo("Drawn from Dreams", 56, Rarity.RARE, mage.cards.d.DrawnFromDreams.class));
|
||||
cards.add(new SetCardInfo("Dread Presence", 96, Rarity.RARE, mage.cards.d.DreadPresence.class));
|
||||
|
|
Loading…
Reference in a new issue