mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[STX] Implemented Bury in Books
This commit is contained in:
parent
fa6fbf1b78
commit
4cd50cf4e8
2 changed files with 79 additions and 0 deletions
78
Mage.Sets/src/mage/cards/b/BuryInBooks.java
Normal file
78
Mage.Sets/src/mage/cards/b/BuryInBooks.java
Normal file
|
@ -0,0 +1,78 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.SourceTargetsPermanentCondition;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterAttackingCreature;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BuryInBooks extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterAttackingCreature("an attacking creature");
|
||||
private static final Condition condition = new SourceTargetsPermanentCondition(filter);
|
||||
|
||||
public BuryInBooks(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{U}");
|
||||
|
||||
// This spell costs {2} less to cast if it targets an attacking creature.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.ALL, new SpellCostReductionSourceEffect(2, condition).setCanWorksOnStackOnly(true)
|
||||
).setRuleAtTheTop(true));
|
||||
|
||||
// Put target creature into its owner's library second from the top.
|
||||
this.getSpellAbility().addEffect(new BuryInBooksEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
private BuryInBooks(final BuryInBooks card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuryInBooks copy() {
|
||||
return new BuryInBooks(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BuryInBooksEffect extends OneShotEffect {
|
||||
|
||||
BuryInBooksEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "put target creature into its owner's library second from the top";
|
||||
}
|
||||
|
||||
private BuryInBooksEffect(final BuryInBooksEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuryInBooksEffect copy() {
|
||||
return new BuryInBooksEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
return player != null
|
||||
&& permanent != null
|
||||
&& player.putCardOnTopXOfLibrary(permanent, game, source, 2, true);
|
||||
}
|
||||
}
|
|
@ -36,6 +36,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Archmage Emeritus", 37, Rarity.RARE, mage.cards.a.ArchmageEmeritus.class));
|
||||
cards.add(new SetCardInfo("Beaming Defiance", 9, Rarity.COMMON, mage.cards.b.BeamingDefiance.class));
|
||||
cards.add(new SetCardInfo("Blade Historian", 165, Rarity.RARE, mage.cards.b.BladeHistorian.class));
|
||||
cards.add(new SetCardInfo("Bury in Books", 39, Rarity.COMMON, mage.cards.b.BuryInBooks.class));
|
||||
cards.add(new SetCardInfo("Combat Professor", 11, Rarity.COMMON, mage.cards.c.CombatProfessor.class));
|
||||
cards.add(new SetCardInfo("Dragonsguard Elite", 127, Rarity.RARE, mage.cards.d.DragonsguardElite.class));
|
||||
cards.add(new SetCardInfo("Dueling Coach", 15, Rarity.UNCOMMON, mage.cards.d.DuelingCoach.class));
|
||||
|
|
Loading…
Reference in a new issue