1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-02 17:00:11 -09:00

ONE: Added card "Capricious Hellraiser" and its abilities and effects ()

Co-authored-by: Daniel Eberhard <daniel.h.e@gmx.de>
This commit is contained in:
Merlingilb 2023-04-19 15:36:11 +02:00 committed by GitHub
parent e71aea90e8
commit c99350554e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 116 additions and 0 deletions

View file

@ -0,0 +1,112 @@
package mage.cards.c;
import mage.ApprovingObject;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID;
public class CapriciousHellraiser extends CardImpl {
public CapriciousHellraiser(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}{R}");
this.addSubType(SubType.PHYREXIAN);
this.addSubType(SubType.DRAGON);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
//This spell costs {3} less to cast if you have nine or more cards in your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SpellCostReductionSourceEffect(3,
new CardsInControllerGraveyardCondition(9)
)));
//Flying
this.addAbility(FlyingAbility.getInstance());
//When Capricious Hellraiser enters the battlefield, exile three cards at random from your graveyard. Choose a
//noncreature, nonland card from among them and copy it. You may cast the copy without paying its mana cost.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CapriciousHellraiserEffect()));
}
private CapriciousHellraiser(final CapriciousHellraiser card) {
super(card);
}
@Override
public CapriciousHellraiser copy() {
return new CapriciousHellraiser(this);
}
}
class CapriciousHellraiserEffect extends OneShotEffect {
public CapriciousHellraiserEffect() {
super(Outcome.Benefit);
this.staticText = "exile three cards at random from your graveyard. Choose a noncreature, nonland card from " +
"among them and copy it. You may cast the copy without paying its mana cost";
}
private CapriciousHellraiserEffect(final CapriciousHellraiserEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cardsInGraveyard = new CardsImpl(controller.getGraveyard().getCards(game));
Cards toExile = new CardsImpl();
Cards cardsToChooseFrom = new CardsImpl();
for (int i = 0; i < 3; i++) {
Card card = cardsInGraveyard.getRandom(game);
if (card != null) {
toExile.add(card);
cardsInGraveyard.remove(card);
if (!card.isCreature() && !card.isLand()) {
cardsToChooseFrom.add(card);
}
}
}
controller.moveCards(toExile, Zone.EXILED, source, game);
if (cardsToChooseFrom.size() > 0) {
TargetCard targetCard = new TargetCard(1, Zone.EXILED, StaticFilters.FILTER_CARD);
controller.choose(Outcome.Copy, cardsToChooseFrom, targetCard, game);
Card cardToCopy = game.getCard(targetCard.getTargets().get(0));
if (cardToCopy == null) {
return true;
}
if (!controller.chooseUse(outcome, "Cast copy of " + cardToCopy.getName() + " without paying its mana cost?", source, game)) {
return true;
}
Card copiedCard = game.copyCard(cardToCopy, source, controller.getId());
game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), Boolean.TRUE);
controller.cast(
controller.chooseAbilityForCast(copiedCard, game, true),
game, true, new ApprovingObject(source, game)
);
game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), null);
}
return true;
}
return false;
}
@Override
public CapriciousHellraiserEffect copy() {
return new CapriciousHellraiserEffect(this);
}
}

View file

@ -54,6 +54,10 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
cards.add(new SetCardInfo("Bring the Ending", 44, Rarity.COMMON, mage.cards.b.BringTheEnding.class));
cards.add(new SetCardInfo("Cacophony Scamp", 124, Rarity.UNCOMMON, mage.cards.c.CacophonyScamp.class));
cards.add(new SetCardInfo("Cankerbloom", 161, Rarity.UNCOMMON, mage.cards.c.Cankerbloom.class));
cards.add(new SetCardInfo("Capricious Hellraiser", 125, Rarity.MYTHIC, mage.cards.c.CapriciousHellraiser.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Capricious Hellraiser", 310, Rarity.MYTHIC, mage.cards.c.CapriciousHellraiser.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Capricious Hellraiser", 353, Rarity.MYTHIC, mage.cards.c.CapriciousHellraiser.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Capricious Hellraiser", 444, Rarity.MYTHIC, mage.cards.c.CapriciousHellraiser.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Cephalopod Sentry", 198, Rarity.UNCOMMON, mage.cards.c.CephalopodSentry.class));
cards.add(new SetCardInfo("Charforger", 199, Rarity.UNCOMMON, mage.cards.c.Charforger.class));
cards.add(new SetCardInfo("Chimney Rabble", 126, Rarity.COMMON, mage.cards.c.ChimneyRabble.class));