mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Merge pull request #5728 from antoni-g/master
Implemented and test Ugin's Conjurant, Finale of Devastation
This commit is contained in:
commit
323e3f544d
5 changed files with 357 additions and 0 deletions
80
Mage.Sets/src/mage/cards/f/FinaleOfDevastation.java
Normal file
80
Mage.Sets/src/mage/cards/f/FinaleOfDevastation.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.abilities.effects.common.search.SearchLibraryGraveyardWithLessCMCPutIntoPlay;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author antoni-g
|
||||
*/
|
||||
public final class FinaleOfDevastation extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("creature");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
||||
public FinaleOfDevastation(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{G}{G}");
|
||||
// Search your library and/or graveyard for a creature card with converted mana cost X or less and put it onto the battlefield. If you search your library this way, shuffle it.
|
||||
this.getSpellAbility().addEffect(new SearchLibraryGraveyardWithLessCMCPutIntoPlay(filter));
|
||||
// If X is 10 or more, creatures you control get +X/+X and gain haste until end of turn.
|
||||
this.getSpellAbility().addEffect(new FinaleOfDevastationEffect());
|
||||
}
|
||||
|
||||
private FinaleOfDevastation(final FinaleOfDevastation card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FinaleOfDevastation copy() {
|
||||
return new FinaleOfDevastation(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FinaleOfDevastationEffect extends OneShotEffect {
|
||||
|
||||
FinaleOfDevastationEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "If X is 10 or more, creatures you control get +X/+X and gain haste until end of turn.";
|
||||
}
|
||||
|
||||
private FinaleOfDevastationEffect(final FinaleOfDevastationEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FinaleOfDevastationEffect copy() {
|
||||
return new FinaleOfDevastationEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int xValue = source.getManaCostsToPay().getX();
|
||||
if (xValue >= 10) {
|
||||
ContinuousEffect effect1 = new BoostControlledEffect(xValue, xValue, Duration.EndOfTurn);
|
||||
game.addEffect(effect1, source);
|
||||
ContinuousEffect effect2 = new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent());
|
||||
game.addEffect(effect2, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
97
Mage.Sets/src/mage/cards/u/UginsConjurant.java
Normal file
97
Mage.Sets/src/mage/cards/u/UginsConjurant.java
Normal file
|
@ -0,0 +1,97 @@
|
|||
package mage.cards.u;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.counters.CounterType;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author antoni-g
|
||||
*/
|
||||
public final class UginsConjurant extends CardImpl {
|
||||
|
||||
public UginsConjurant(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}");
|
||||
|
||||
this.subtype.add(SubType.SPIRIT);
|
||||
this.subtype.add(SubType.MONK);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
||||
// Ugin’s Conjurant enters the battlefield with X +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance())));
|
||||
// If damage would be dealt to Ugin’s Conjurant while it has a +1/+1 counter on it, prevent that damage and remove that many +1/+1 counters from Ugin’s Conjurant.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new UginsConjurantPrevention()));
|
||||
}
|
||||
|
||||
private UginsConjurant(final UginsConjurant card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UginsConjurant copy() {
|
||||
return new UginsConjurant(this);
|
||||
}
|
||||
|
||||
static class UginsConjurantPrevention extends PreventionEffectImpl {
|
||||
|
||||
public UginsConjurantPrevention() {
|
||||
super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, false, false);
|
||||
staticText = "If damage would be dealt to {this}, prevent that damage and remove that many +1/+1 counters from it";
|
||||
}
|
||||
|
||||
public UginsConjurantPrevention(final UginsConjurantPrevention effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UginsConjurantPrevention copy() {
|
||||
return new UginsConjurantPrevention(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
int damage = event.getAmount();
|
||||
preventDamageAction(event, source, game);
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.removeCounters(CounterType.P1P1.createInstance(damage), game); //MTG ruling Protean Hydra loses counters even if the damage isn't prevented
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game)) {
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -102,6 +102,7 @@ public final class WarOfTheSpark extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Evolution Sage", 159, Rarity.UNCOMMON, mage.cards.e.EvolutionSage.class));
|
||||
cards.add(new SetCardInfo("Fblthp, the Lost", 50, Rarity.RARE, mage.cards.f.FblthpTheLost.class));
|
||||
cards.add(new SetCardInfo("Feather, the Redeemed", 197, Rarity.RARE, mage.cards.f.FeatherTheRedeemed.class));
|
||||
cards.add(new SetCardInfo("Finale of Devastation", 160, Rarity.MYTHIC, mage.cards.f.FinaleOfDevastation.class));
|
||||
cards.add(new SetCardInfo("Finale of Eternity", 91, Rarity.MYTHIC, mage.cards.f.FinaleOfEternity.class));
|
||||
cards.add(new SetCardInfo("Finale of Glory", 12, Rarity.MYTHIC, mage.cards.f.FinaleOfGlory.class));
|
||||
cards.add(new SetCardInfo("Finale of Revelation", 51, Rarity.MYTHIC, mage.cards.f.FinaleOfRevelation.class));
|
||||
|
@ -280,6 +281,7 @@ public final class WarOfTheSpark extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Trusted Pegasus", 36, Rarity.COMMON, mage.cards.t.TrustedPegasus.class));
|
||||
cards.add(new SetCardInfo("Turret Ogre", 148, Rarity.COMMON, mage.cards.t.TurretOgre.class));
|
||||
cards.add(new SetCardInfo("Tyrant's Scorn", 225, Rarity.UNCOMMON, mage.cards.t.TyrantsScorn.class));
|
||||
cards.add(new SetCardInfo("Ugin's Conjurant", 3, Rarity.UNCOMMON, mage.cards.u.UginsConjurant.class));
|
||||
cards.add(new SetCardInfo("Ugin, the Ineffable", 2, Rarity.RARE, mage.cards.u.UginTheIneffable.class));
|
||||
cards.add(new SetCardInfo("Unlikely Aid", 109, Rarity.COMMON, mage.cards.u.UnlikelyAid.class));
|
||||
cards.add(new SetCardInfo("Vampire Opportunist", 110, Rarity.COMMON, mage.cards.v.VampireOpportunist.class));
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package mage.abilities.effects.common.search;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public class SearchLibraryGraveyardPutOntoBattlefieldEffect extends OneShotEffect {
|
||||
|
||||
private FilterCard filter;
|
||||
private boolean forceToSearchBoth;
|
||||
|
||||
public SearchLibraryGraveyardPutOntoBattlefieldEffect(FilterCard filter) {
|
||||
this(filter, false);
|
||||
}
|
||||
|
||||
public SearchLibraryGraveyardPutOntoBattlefieldEffect(FilterCard filter, boolean forceToSearchBoth) {
|
||||
this(filter, forceToSearchBoth, false);
|
||||
}
|
||||
|
||||
public SearchLibraryGraveyardPutOntoBattlefieldEffect(FilterCard filter, boolean forceToSearchBoth, boolean youMay) {
|
||||
super(Outcome.Benefit);
|
||||
this.filter = filter;
|
||||
this.forceToSearchBoth = forceToSearchBoth;
|
||||
staticText = (youMay ? "You may" : "") + " search your library and" + (forceToSearchBoth ? "" : "/or") + " graveyard for a card named " + filter.getMessage()
|
||||
+ ", reveal it, and put it into your hand. " + (forceToSearchBoth ? "Then shuffle your library" : "If you search your library this way, shuffle it");
|
||||
}
|
||||
|
||||
public SearchLibraryGraveyardPutOntoBattlefieldEffect(final SearchLibraryGraveyardPutOntoBattlefieldEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
this.forceToSearchBoth = effect.forceToSearchBoth;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchLibraryGraveyardPutOntoBattlefieldEffect copy() {
|
||||
return new SearchLibraryGraveyardPutOntoBattlefieldEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
Card cardFound = null;
|
||||
if (controller != null && sourceObject != null) {
|
||||
if (forceToSearchBoth || controller.chooseUse(outcome, "Search your library for a card named " + filter.getMessage() + '?', source, game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
|
||||
target.clearChosen();
|
||||
if (controller.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
cardFound = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
}
|
||||
controller.shuffleLibrary(source, game);
|
||||
}
|
||||
|
||||
if (cardFound == null && controller.chooseUse(outcome, "Search your graveyard for a card named " + filter.getMessage() + '?', source, game)) {
|
||||
TargetCard target = new TargetCard(0, 1, Zone.GRAVEYARD, filter);
|
||||
target.clearChosen();
|
||||
if (controller.choose(outcome, controller.getGraveyard(), target, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
cardFound = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cardFound != null) {
|
||||
controller.revealCards(sourceObject.getIdName(), new CardsImpl(cardFound), game);
|
||||
controller.moveCards(cardFound, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package mage.abilities.effects.common.search;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author antoni-g
|
||||
*/
|
||||
public class SearchLibraryGraveyardWithLessCMCPutIntoPlay extends OneShotEffect {
|
||||
|
||||
private final FilterCard filter;
|
||||
|
||||
public SearchLibraryGraveyardWithLessCMCPutIntoPlay() {
|
||||
this(new FilterCard());
|
||||
}
|
||||
|
||||
public SearchLibraryGraveyardWithLessCMCPutIntoPlay(FilterCard filter) {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.filter = filter;
|
||||
staticText = "Search your library or graveyard for a " + filter.getMessage() + " with converted mana cost X or less, put it onto the battlefield, then shuffle your library";
|
||||
}
|
||||
|
||||
public SearchLibraryGraveyardWithLessCMCPutIntoPlay(final SearchLibraryGraveyardWithLessCMCPutIntoPlay effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchLibraryGraveyardWithLessCMCPutIntoPlay copy() {
|
||||
return new SearchLibraryGraveyardWithLessCMCPutIntoPlay(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
Card cardFound = null;
|
||||
if (controller != null && sourceObject != null) {
|
||||
// create x cost filter
|
||||
FilterCard advancedFilter = filter.copy(); // never change static objects so copy the object here before
|
||||
advancedFilter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, source.getManaCostsToPay().getX() + 1));
|
||||
|
||||
if (controller.chooseUse(outcome, "Search your library for a " + filter.getMessage() + " with CMC X or less" + '?', source, game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(advancedFilter);
|
||||
target.clearChosen();
|
||||
if (controller.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
cardFound = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
}
|
||||
controller.shuffleLibrary(source, game);
|
||||
}
|
||||
|
||||
if (cardFound == null && controller.chooseUse(outcome, "Search your graveyard for a " + filter.getMessage() + " with CMC X or less" + '?', source, game)) {
|
||||
TargetCard target = new TargetCard(0, 1, Zone.GRAVEYARD, advancedFilter);
|
||||
target.clearChosen();
|
||||
if (controller.choose(outcome, controller.getGraveyard(), target, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
cardFound = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cardFound != null) {
|
||||
controller.revealCards(sourceObject.getIdName(), new CardsImpl(cardFound), game);
|
||||
controller.moveCards(cardFound, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue