[BFZ] Added Oblivion Sower and Titan's Presence.

This commit is contained in:
LevelX2 2015-09-05 00:13:11 +02:00
parent 5d51615eab
commit c7e64ac9fe
6 changed files with 361 additions and 41 deletions

View file

@ -0,0 +1,119 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.battleforzendikar;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.abilities.effects.common.ExileCardsFromTopOfLibraryTargetEffect;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterLandCard;
import mage.filter.predicate.other.OwnerIdPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetOpponent;
/**
*
* @author LevelX2
*/
public class OblivionSower extends CardImpl {
public OblivionSower(UUID ownerId) {
super(ownerId, 11, "Oblivion Sower", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{6}");
this.expansionSetCode = "BFZ";
this.subtype.add("Eldrazi");
this.power = new MageInt(5);
this.toughness = new MageInt(8);
// When you cast Oblivion Sower, target opponent exiles the top four cards of his or her library, then you may put any number of land cards that player owns from exile onto the battlefield under your control.
Ability ability = new CastSourceTriggeredAbility(new ExileCardsFromTopOfLibraryTargetEffect(4, "target opponent"), false);
ability.addEffect(new OblivionSowerEffect());
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
public OblivionSower(final OblivionSower card) {
super(card);
}
@Override
public OblivionSower copy() {
return new OblivionSower(this);
}
}
class OblivionSowerEffect extends OneShotEffect {
public OblivionSowerEffect() {
super(Outcome.PutLandInPlay);
this.staticText = ", then you may put any number of land cards that player owns from exile onto the battlefield under your control";
}
public OblivionSowerEffect(final OblivionSowerEffect effect) {
super(effect);
}
@Override
public OblivionSowerEffect copy() {
return new OblivionSowerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (controller != null && targetPlayer != null) {
FilterLandCard filter = new FilterLandCard();
filter.add(new OwnerIdPredicate(targetPlayer.getId()));
Cards exiledCards = new CardsImpl();
exiledCards.addAll(game.getExile().getAllCards(game));
Cards exiledLands = new CardsImpl();
exiledLands.addAll(exiledCards.getCards(filter, source.getSourceId(), controller.getId(), game));
if (!exiledLands.isEmpty() && controller.chooseUse(outcome, "Put lands into play?", source, game)) {
FilterCard filterToPlay = new FilterCard("Lands owned by " + targetPlayer.getName() + " to put into play under your control");
TargetCard targetCards = new TargetCard(0, exiledLands.size(), Zone.EXILED, filterToPlay);
if (controller.chooseTarget(outcome, exiledLands, targetCards, source, game)) {
controller.moveCards(new CardsImpl(targetCards.getTargets()), null, Zone.BATTLEFIELD, source, game);
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,117 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.battleforzendikar;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.common.RevealTargetFromHandCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.ColorlessPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class TitansPresence extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("a colorless creature card from your hand to reveal");
static {
filter.add(new ColorlessPredicate());
}
public TitansPresence(UUID ownerId) {
super(ownerId, 14, "Titan's Presence", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{3}");
this.expansionSetCode = "BFZ";
// As an additional cost to cast Titan's Presence, reveal a colorless creature card from your hand.
this.getSpellAbility().addCost(new RevealTargetFromHandCost(new TargetCardInHand(filter)));
// Exile target creature if its power is less than or equal to the revealed card's power.
this.getSpellAbility().addEffect(new TitansPresenceEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public TitansPresence(final TitansPresence card) {
super(card);
}
@Override
public TitansPresence copy() {
return new TitansPresence(this);
}
}
class TitansPresenceEffect extends OneShotEffect {
public TitansPresenceEffect() {
super(Outcome.Exile);
staticText = "Exile target creature if its power is less than or equal to the revealed card's power";
}
public TitansPresenceEffect(TitansPresenceEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
RevealTargetFromHandCost cost = (RevealTargetFromHandCost) source.getCosts().get(0);
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
if (cost != null && creature != null && controller != null) {
List<Card> revealedCards = cost.getRevealedCards();
if (!revealedCards.isEmpty()) {
Card card = revealedCards.iterator().next();
if (card != null && card.getPower().getValue() >= creature.getPower().getValue()) {
controller.moveCards(creature, null, Zone.EXILED, source, game);
}
}
return true;
}
return false;
}
@Override
public TitansPresenceEffect copy() {
return new TitansPresenceEffect(this);
}
}

View file

@ -29,18 +29,13 @@ package mage.sets.scourge;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileCardsFromTopOfLibraryTargetEffect;
import mage.abilities.keyword.MorphAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.players.Player;
/**
*
@ -58,8 +53,8 @@ public class RavenGuildMaster extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Raven Guild Master deals combat damage to a player, that player exiles the top ten cards of his or her library.
this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new RavenGuildMasterEffect(), false, true));
this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new ExileCardsFromTopOfLibraryTargetEffect(10, "that player"), false, true));
// Morph {2}{U}{U}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}{U}{U}")));
}
@ -73,36 +68,3 @@ public class RavenGuildMaster extends CardImpl {
return new RavenGuildMaster(this);
}
}
class RavenGuildMasterEffect extends OneShotEffect {
public RavenGuildMasterEffect() {
super(Outcome.Exile);
this.staticText = "that player exiles the top ten cards of his or her library";
}
public RavenGuildMasterEffect(final RavenGuildMasterEffect effect) {
super(effect);
}
@Override
public RavenGuildMasterEffect copy() {
return new RavenGuildMasterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player != null) {
int count = Math.min(player.getLibrary().size(), 10);
for (int i = 0; i < count; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToExile(id, "", source.getSourceId(), game);
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.zendikarvseldrazi;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class OblivionSower extends mage.sets.battleforzendikar.OblivionSower {
public OblivionSower(UUID ownerId) {
super(ownerId);
this.cardNumber = 41;
this.expansionSetCode = "DDP";
}
public OblivionSower(final OblivionSower card) {
super(card);
}
@Override
public OblivionSower copy() {
return new OblivionSower(this);
}
}

View file

@ -28,6 +28,8 @@
// author jeffwadsworth
package mage.abilities.costs.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
@ -44,16 +46,19 @@ public class RevealTargetFromHandCost extends CostImpl {
public int convertedManaCosts = 0;
protected int numberCardsRevealed = 0;
protected List<Card> revealedCards;
public RevealTargetFromHandCost(TargetCardInHand target) {
this.addTarget(target);
this.text = (target.getNumberOfTargets() == 0 ? "you may " : "") + "reveal " + target.getTargetName();
this.revealedCards = new ArrayList<>();
}
public RevealTargetFromHandCost(final RevealTargetFromHandCost cost) {
super(cost);
this.convertedManaCosts = cost.convertedManaCosts;
this.numberCardsRevealed = cost.numberCardsRevealed;
this.revealedCards = new ArrayList<>(cost.revealedCards);
}
@Override
@ -69,6 +74,7 @@ public class RevealTargetFromHandCost extends CostImpl {
convertedManaCosts += card.getManaCost().convertedManaCost();
numberCardsRevealed++;
cards.add(card);
revealedCards.add(card);
}
}
if (numberCardsRevealed > 0) {
@ -92,6 +98,10 @@ public class RevealTargetFromHandCost extends CostImpl {
return numberCardsRevealed;
}
public List<Card> getRevealedCards() {
return revealedCards;
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
return targets.canChoose(controllerId, game);

View file

@ -0,0 +1,60 @@
/*
* 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.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class ExileCardsFromTopOfLibraryTargetEffect extends OneShotEffect {
int amount;
String targetName;
public ExileCardsFromTopOfLibraryTargetEffect(int amount) {
this(amount, null);
}
public ExileCardsFromTopOfLibraryTargetEffect(int amount, String targetName) {
super(Outcome.Exile);
this.amount = amount;
this.staticText = (targetName == null ? "that player" : targetName) + " exiles the top "
+ CardUtil.numberToText(amount, "")
+ (amount == 1 ? "card" : " cards") + " of his or her library";
}
public ExileCardsFromTopOfLibraryTargetEffect(final ExileCardsFromTopOfLibraryTargetEffect effect) {
super(effect);
this.amount = effect.amount;
}
@Override
public ExileCardsFromTopOfLibraryTargetEffect copy() {
return new ExileCardsFromTopOfLibraryTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (targetPlayer != null) {
Cards cards = new CardsImpl();
cards.addAll(targetPlayer.getLibrary().getTopCards(game, amount));
return targetPlayer.moveCards(cards, null, Zone.EXILED, source, game);
}
return false;
}
}