mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Implemented Cauldron's Gift
This commit is contained in:
parent
8429e7b2fa
commit
73a9111555
2 changed files with 93 additions and 0 deletions
92
Mage.Sets/src/mage/cards/c/CauldronsGift.java
Normal file
92
Mage.Sets/src/mage/cards/c/CauldronsGift.java
Normal file
|
@ -0,0 +1,92 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.AdamantCondition;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class CauldronsGift extends CardImpl {
|
||||
|
||||
public CauldronsGift(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}");
|
||||
|
||||
// Adamant — If at least three black mana was spent to cast this spell, put the top four cards of your library into your graveyard.
|
||||
// You may choose a creature card in your graveyard. If you do, return it to the battlefield with an additional +1/+1 counter on it.
|
||||
this.getSpellAbility().addEffect(new CauldronsGiftEffect());
|
||||
}
|
||||
|
||||
private CauldronsGift(final CauldronsGift card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CauldronsGift copy() {
|
||||
return new CauldronsGift(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CauldronsGiftEffect extends OneShotEffect {
|
||||
|
||||
CauldronsGiftEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "<i>Adamant</i> — If at least three black mana was spent to cast this spell, " +
|
||||
"put the top four cards of your library into your graveyard." +
|
||||
"<br>You may choose a creature card in your graveyard. " +
|
||||
"If you do, return it to the battlefield with an additional +1/+1 counter on it.";
|
||||
}
|
||||
|
||||
private CauldronsGiftEffect(final CauldronsGiftEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CauldronsGiftEffect copy() {
|
||||
return new CauldronsGiftEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (AdamantCondition.BLACK.apply(game, source)) {
|
||||
player.moveCards(player.getLibrary().getTopCards(game, 4), Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
if (player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game) == 0
|
||||
|| !player.chooseUse(outcome, "Choose a creature card in your graveyard to return to the battlefield?", source, game)) {
|
||||
return true;
|
||||
}
|
||||
TargetCard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
|
||||
target.setNotTarget(true);
|
||||
if (!player.choose(outcome, player.getGraveyard(), target, game)) {
|
||||
return false;
|
||||
}
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card == null || player.moveCards(card, Zone.BATTLEFIELD, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -59,6 +59,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Castle Locthwain", 241, Rarity.RARE, mage.cards.c.CastleLocthwain.class));
|
||||
cards.add(new SetCardInfo("Castle Vantress", 242, Rarity.RARE, mage.cards.c.CastleVantress.class));
|
||||
cards.add(new SetCardInfo("Cauldron Familiar", 81, Rarity.UNCOMMON, mage.cards.c.CauldronFamiliar.class));
|
||||
cards.add(new SetCardInfo("Cauldron's Gift", 83, Rarity.UNCOMMON, mage.cards.c.CauldronsGift.class));
|
||||
cards.add(new SetCardInfo("Charming Prince", 8, Rarity.RARE, mage.cards.c.CharmingPrince.class));
|
||||
cards.add(new SetCardInfo("Chittering Witch", 319, Rarity.RARE, mage.cards.c.ChitteringWitch.class));
|
||||
cards.add(new SetCardInfo("Chulane, Teller of Tales", 326, Rarity.MYTHIC, mage.cards.c.ChulaneTellerOfTales.class));
|
||||
|
|
Loading…
Reference in a new issue