- Stronghold Set 100%. Added Hidden Retreat, Ransack, Rebound, and Samite Blessing.

This commit is contained in:
Jeff 2018-12-04 16:32:23 -06:00
parent 6e48b4f954
commit dcec3ad66e
6 changed files with 348 additions and 0 deletions

View file

@ -0,0 +1,76 @@
package mage.cards.h;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.PutCardFromHandOnTopOfLibraryCost;
import mage.abilities.effects.PreventionEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
import mage.filter.StaticFilters;
import mage.game.events.DamageEvent;
import mage.target.TargetSpell;
/**
*
* @author bunchOfDevs
*/
public class HiddenRetreat extends CardImpl {
public HiddenRetreat(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
//Put a card from your hand on top of your library: Prevent all damage that would be dealt by target instant or sorcery spell this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new HiddenRetreatEffect(), new PutCardFromHandOnTopOfLibraryCost());
ability.addTarget(new TargetSpell(StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY));
this.addAbility(ability);
}
public HiddenRetreat(final HiddenRetreat hiddenRetreat) {
super(hiddenRetreat);
}
@Override
public HiddenRetreat copy() {
return new HiddenRetreat(this);
}
}
class HiddenRetreatEffect extends PreventionEffectImpl {
public HiddenRetreatEffect() {
super(Duration.EndOfTurn, Integer.MAX_VALUE, false, false);
this.staticText = "Prevent all damage that would be dealt by target instant or sorcery spell this turn.";
}
public HiddenRetreatEffect(final HiddenRetreatEffect effect) {
super(effect);
}
@Override
public HiddenRetreatEffect copy() {
return new HiddenRetreatEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return (super.applies(event, source, game)
&& event instanceof DamageEvent
&& event.getAmount() > 0
&& game.getObject(source.getFirstTarget()) != null
&& game.getObject(event.getSourceId()) != null
&& game.getObject(source.getFirstTarget()).equals(game.getObject(event.getSourceId()))
&& game.getObject(source.getFirstTarget()).isInstantOrSorcery());
}
}

View file

@ -0,0 +1,87 @@
package mage.cards.r;
import static java.lang.Integer.min;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
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.TargetPlayer;
/**
*
* @author jeffwadsworth
*/
public final class Ransack extends CardImpl {
public Ransack(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}");
// Look at the top five cards of target player's library.
//Put any number of them on the bottom of that library in any order
//and the rest on top of the library in any order.
this.getSpellAbility().addEffect(new RansackEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public Ransack(final Ransack card) {
super(card);
}
@Override
public Ransack copy() {
return new Ransack(this);
}
}
class RansackEffect extends OneShotEffect {
public RansackEffect() {
super(Outcome.Detriment);
this.staticText = "Look at the top five cards of target player's library. "
+ "Put any number of them on the bottom of that library in any order "
+ "and the rest on top of the library in any order";
}
public RansackEffect(final RansackEffect effect) {
super(effect);
}
@Override
public RansackEffect copy() {
return new RansackEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
FilterCard filter = new FilterCard("cards to put on the bottom of your library");
if (player != null) {
int number = min(player.getLibrary().size(), 5);
Set<Card> cards = player.getLibrary().getTopCards(game, number);
Cards cardsRemaining = new CardsImpl();
cardsRemaining.addAll(cards);
TargetCard target = new TargetCard((true ? 0 : number), number, Zone.LIBRARY, filter);
if (player.choose(Outcome.DrawCard, cardsRemaining, target, game)) {
Cards pickedCards = new CardsImpl(target.getTargets());
cardsRemaining.removeAll(pickedCards);
player.putCardsOnBottomOfLibrary(pickedCards, game, source, true);
player.putCardsOnTopOfLibrary(cardsRemaining, game, source, true);
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,75 @@
package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterSpell;
import mage.filter.predicate.other.TargetsPlayerPredicate;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.TargetSpell;
/**
*
* @author jeffwadsworth
*/
public final class Rebound extends CardImpl {
public Rebound(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Change the target of target spell that targets only a player. The new target must be a player.
this.getSpellAbility().addEffect(new ReboundEffect());
FilterSpell filter = new FilterSpell("spell that targets only a player");
filter.add(new TargetsPlayerPredicate());
this.getSpellAbility().addTarget(new TargetSpell(filter));
}
public Rebound(final Rebound card) {
super(card);
}
@Override
public Rebound copy() {
return new Rebound(this);
}
}
class ReboundEffect extends OneShotEffect {
public ReboundEffect() {
super(Outcome.Neutral);
this.staticText = "Change the target of target spell that targets only a player. The new target must be a player";
}
public ReboundEffect(final ReboundEffect effect) {
super(effect);
}
@Override
public ReboundEffect copy() {
return new ReboundEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
if (spell != null
&& controller != null) {
spell.getSpellAbility().getTargets().clear();
TargetPlayer targetPlayer = new TargetPlayer();
if (controller.choose(Outcome.Neutral, targetPlayer, source.getSourceId(), game)) {
spell.getSpellAbility().addTarget(targetPlayer);
}
}
return false;
}
}

View file

@ -0,0 +1,58 @@
package mage.cards.s;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.PreventNextDamageFromChosenSourceToTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
/**
*
* @author jeffwadsworth
*/
public final class SamiteBlessing extends CardImpl {
private static final String rule = "Enchanted creature has \"{T}: The next time a source of your choice would deal damage to target creature this turn, prevent that damage.\"";
public SamiteBlessing(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature has "{tap}: The next time a source of your choice would deal damage to target creature this turn, prevent that damage."
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventNextDamageFromChosenSourceToTargetEffect(Duration.EndOfTurn), new TapSourceCost());
ability2.addTarget(new TargetCreaturePermanent());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ability2, AttachmentType.AURA, Duration.WhileOnBattlefield, rule)));
}
public SamiteBlessing(final SamiteBlessing card) {
super(card);
}
@Override
public SamiteBlessing copy() {
return new SamiteBlessing(this);
}
}

View file

@ -77,6 +77,7 @@ public final class Stronghold extends ExpansionSet {
cards.add(new SetCardInfo("Hermit Druid", 108, Rarity.RARE, mage.cards.h.HermitDruid.class)); cards.add(new SetCardInfo("Hermit Druid", 108, Rarity.RARE, mage.cards.h.HermitDruid.class));
cards.add(new SetCardInfo("Hesitation", 33, Rarity.UNCOMMON, mage.cards.h.Hesitation.class)); cards.add(new SetCardInfo("Hesitation", 33, Rarity.UNCOMMON, mage.cards.h.Hesitation.class));
cards.add(new SetCardInfo("Hibernation Sliver", 128, Rarity.UNCOMMON, mage.cards.h.HibernationSliver.class)); cards.add(new SetCardInfo("Hibernation Sliver", 128, Rarity.UNCOMMON, mage.cards.h.HibernationSliver.class));
cards.add(new SetCardInfo("Hidden Retreat", 106, Rarity.RARE, mage.cards.h.HiddenRetreat.class));
cards.add(new SetCardInfo("Honor Guard", 7, Rarity.COMMON, mage.cards.h.HonorGuard.class)); cards.add(new SetCardInfo("Honor Guard", 7, Rarity.COMMON, mage.cards.h.HonorGuard.class));
cards.add(new SetCardInfo("Horn of Greed", 135, Rarity.RARE, mage.cards.h.HornOfGreed.class)); cards.add(new SetCardInfo("Horn of Greed", 135, Rarity.RARE, mage.cards.h.HornOfGreed.class));
cards.add(new SetCardInfo("Hornet Cannon", 136, Rarity.UNCOMMON, mage.cards.h.HornetCannon.class)); cards.add(new SetCardInfo("Hornet Cannon", 136, Rarity.UNCOMMON, mage.cards.h.HornetCannon.class));
@ -109,11 +110,14 @@ public final class Stronghold extends ExpansionSet {
cards.add(new SetCardInfo("Provoke", 113, Rarity.COMMON, mage.cards.p.Provoke.class)); cards.add(new SetCardInfo("Provoke", 113, Rarity.COMMON, mage.cards.p.Provoke.class));
cards.add(new SetCardInfo("Pursuit of Knowledge", 10, Rarity.RARE, mage.cards.p.PursuitOfKnowledge.class)); cards.add(new SetCardInfo("Pursuit of Knowledge", 10, Rarity.RARE, mage.cards.p.PursuitOfKnowledge.class));
cards.add(new SetCardInfo("Rabid Rats", 67, Rarity.COMMON, mage.cards.r.RabidRats.class)); cards.add(new SetCardInfo("Rabid Rats", 67, Rarity.COMMON, mage.cards.r.RabidRats.class));
cards.add(new SetCardInfo("Ransack", 39, Rarity.UNCOMMON, mage.cards.r.Ransack.class));
cards.add(new SetCardInfo("Rebound", 40, Rarity.UNCOMMON, mage.cards.r.Rebound.class));
cards.add(new SetCardInfo("Reins of Power", 41, Rarity.RARE, mage.cards.r.ReinsOfPower.class)); cards.add(new SetCardInfo("Reins of Power", 41, Rarity.RARE, mage.cards.r.ReinsOfPower.class));
cards.add(new SetCardInfo("Revenant", 68, Rarity.RARE, mage.cards.r.Revenant.class)); cards.add(new SetCardInfo("Revenant", 68, Rarity.RARE, mage.cards.r.Revenant.class));
cards.add(new SetCardInfo("Rolling Stones", 11, Rarity.RARE, mage.cards.r.RollingStones.class)); cards.add(new SetCardInfo("Rolling Stones", 11, Rarity.RARE, mage.cards.r.RollingStones.class));
cards.add(new SetCardInfo("Ruination", 95, Rarity.RARE, mage.cards.r.Ruination.class)); cards.add(new SetCardInfo("Ruination", 95, Rarity.RARE, mage.cards.r.Ruination.class));
cards.add(new SetCardInfo("Sacred Ground", 12, Rarity.RARE, mage.cards.s.SacredGround.class)); cards.add(new SetCardInfo("Sacred Ground", 12, Rarity.RARE, mage.cards.s.SacredGround.class));
cards.add(new SetCardInfo("Samite Blessing", 113, Rarity.COMMON, mage.cards.s.SamiteBlessing.class));
cards.add(new SetCardInfo("Scapegoat", 14, Rarity.UNCOMMON, mage.cards.s.Scapegoat.class)); cards.add(new SetCardInfo("Scapegoat", 14, Rarity.UNCOMMON, mage.cards.s.Scapegoat.class));
cards.add(new SetCardInfo("Seething Anger", 96, Rarity.COMMON, mage.cards.s.SeethingAnger.class)); cards.add(new SetCardInfo("Seething Anger", 96, Rarity.COMMON, mage.cards.s.SeethingAnger.class));
cards.add(new SetCardInfo("Serpent Warrior", 69, Rarity.COMMON, mage.cards.s.SerpentWarrior.class)); cards.add(new SetCardInfo("Serpent Warrior", 69, Rarity.COMMON, mage.cards.s.SerpentWarrior.class));

View file

@ -0,0 +1,48 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.filter.predicate.other;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Mode;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.Target;
/**
*
* @author jeffwadsworth
*/
public class TargetsPlayerPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<MageObject>> {
public TargetsPlayerPredicate() {
}
@Override
public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) {
StackObject object = game.getStack().getStackObject(input.getObject().getId());
if (object != null) {
for (UUID modeId : object.getStackAbility().getModes().getSelectedModes()) {
Mode mode = object.getStackAbility().getModes().get(modeId);
for (Target target : mode.getTargets()) {
for (UUID targetId : target.getTargets()) {
Player player = game.getPlayer(targetId);
return player != null;
}
}
}
}
return false;
}
@Override
public String toString() {
return "that targets a player";
}
}