mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 23:12:10 -08:00
[BFZ] Added Conduit of Ruin, Exert Influence and March from the Tomb.
This commit is contained in:
parent
04738515df
commit
12d584ebd1
8 changed files with 462 additions and 98 deletions
|
|
@ -56,17 +56,16 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
|
|||
private final boolean upTo;
|
||||
private ManaCosts<ManaCost> manaCostsToReduce = null;
|
||||
|
||||
|
||||
public SpellsCostReductionControllerEffect(FilterCard filter, ManaCosts<ManaCost> manaCostsToReduce) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
this.filter = filter;
|
||||
this.amount = 0;
|
||||
this.manaCostsToReduce = manaCostsToReduce;
|
||||
this.upTo = false;
|
||||
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(filter.getMessage()).append(" you cast cost ");
|
||||
for (String manaSymbol :manaCostsToReduce.getSymbols()) {
|
||||
for (String manaSymbol : manaCostsToReduce.getSymbols()) {
|
||||
sb.append(manaSymbol);
|
||||
}
|
||||
sb.append(" less to cast. This effect reduces only the amount of colored mana you pay.");
|
||||
|
|
@ -81,8 +80,8 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
|
|||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
this.filter = filter;
|
||||
this.amount = amount;
|
||||
this.upTo = upTo;
|
||||
this.staticText = filter.getMessage() + " you cast cost " + (upTo ?"up to " :"") + "{" +amount + "} less to cast";
|
||||
this.upTo = upTo;
|
||||
this.staticText = filter.getMessage() + " you cast cost " + (upTo ? "up to " : "") + "{" + amount + "} less to cast";
|
||||
}
|
||||
|
||||
protected SpellsCostReductionControllerEffect(final SpellsCostReductionControllerEffect effect) {
|
||||
|
|
@ -95,28 +94,28 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
if (manaCostsToReduce != null){
|
||||
if (manaCostsToReduce != null) {
|
||||
CardUtil.adjustCost((SpellAbility) abilityToModify, manaCostsToReduce, false);
|
||||
} else {
|
||||
if (upTo) {
|
||||
Mana mana = abilityToModify.getManaCostsToPay().getMana();
|
||||
int reduceMax = mana.getColorless();
|
||||
if (reduceMax > 2){
|
||||
if (reduceMax > 2) {
|
||||
reduceMax = 2;
|
||||
}
|
||||
if (reduceMax > 0) {
|
||||
Player controller = game.getPlayer(abilityToModify.getControllerId());
|
||||
if (controller == null){
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
ChoiceImpl choice = new ChoiceImpl(true);
|
||||
Set<String> set = new LinkedHashSet<>();
|
||||
for(int i = 0; i <= reduceMax; i++){
|
||||
for (int i = 0; i <= reduceMax; i++) {
|
||||
set.add(String.valueOf(i));
|
||||
}
|
||||
choice.setChoices(set);
|
||||
choice.setMessage("Reduce cost of " + filter);
|
||||
if(controller.choose(Outcome.Benefit, choice, game)){
|
||||
if (controller.choose(Outcome.Benefit, choice, game)) {
|
||||
int reduce = Integer.parseInt(choice.getChoice());
|
||||
CardUtil.reduceCost(abilityToModify, reduce);
|
||||
}
|
||||
|
|
@ -134,11 +133,11 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
|
|||
if (abilityToModify.getControllerId().equals(source.getControllerId())) {
|
||||
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
|
||||
if (spell != null) {
|
||||
return this.filter.match(spell, game);
|
||||
return this.filter.match(spell, source.getSourceId(), source.getControllerId(), game);
|
||||
} else {
|
||||
// used at least for flashback ability because Flashback ability doesn't use stack or for getPlayables where spell is not cast yet
|
||||
Card sourceCard = game.getCard(abilityToModify.getSourceId());
|
||||
return sourceCard != null && this.filter.match(sourceCard, game);
|
||||
return sourceCard != null && this.filter.match(sourceCard, source.getSourceId(), source.getControllerId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* 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
|
||||
|
|
@ -20,25 +20,19 @@
|
|||
* 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.abilities.effects.common.search;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.SearchEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
|
@ -48,7 +42,7 @@ import mage.target.common.TargetCardInLibrary;
|
|||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class SearchLibraryPutOnLibraryEffect extends SearchEffect {
|
||||
|
||||
|
||||
private boolean reveal;
|
||||
private boolean forceShuffle;
|
||||
|
||||
|
|
@ -56,7 +50,7 @@ public class SearchLibraryPutOnLibraryEffect extends SearchEffect {
|
|||
this(target, false, true);
|
||||
setText();
|
||||
}
|
||||
|
||||
|
||||
public SearchLibraryPutOnLibraryEffect(TargetCardInLibrary target, boolean reveal, boolean forceShuffle) {
|
||||
super(target, Outcome.DrawCard);
|
||||
this.reveal = reveal;
|
||||
|
|
@ -83,27 +77,14 @@ public class SearchLibraryPutOnLibraryEffect extends SearchEffect {
|
|||
return false;
|
||||
}
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
List<Card> cards = new ArrayList<>();
|
||||
for (UUID cardId: target.getTargets()) {
|
||||
Card card = controller.getLibrary().remove(cardId, game);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
}
|
||||
}
|
||||
Cards foundCards = new CardsImpl();
|
||||
foundCards.addAll(target.getTargets());
|
||||
if (reveal) {
|
||||
Cards foundCards = new CardsImpl(target.getTargets());
|
||||
if (reveal && !foundCards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getIdName(), foundCards, game);
|
||||
}
|
||||
if (forceShuffle) {
|
||||
controller.shuffleLibrary(game);
|
||||
}
|
||||
if (cards.size() > 0 && !game.isSimulation()) {
|
||||
game.informPlayers(controller.getLogName() + " moves " + cards.size() + " card" + (cards.size() == 1 ? " ":"s ") + "on top of his or her library");
|
||||
}
|
||||
for (Card card: cards) {
|
||||
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||
}
|
||||
controller.putCardsOnTopOfLibrary(foundCards, game, source, reveal);
|
||||
return true;
|
||||
}
|
||||
// shuffle
|
||||
|
|
@ -115,7 +96,7 @@ public class SearchLibraryPutOnLibraryEffect extends SearchEffect {
|
|||
|
||||
private void setText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Search your library for a ").append(target.getTargetName());
|
||||
sb.append("search your library for a ").append(target.getTargetName());
|
||||
if (reveal) {
|
||||
sb.append(" and reveal that card. Shuffle");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -877,7 +877,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
public boolean putCardsOnTopOfLibrary(Cards cardsToLibrary, Game game, Ability source, boolean anyOrder) {
|
||||
Cards cards = new CardsImpl(cardsToLibrary); // prevent possible ConcurrentModificationException
|
||||
cards.addAll(cardsToLibrary);
|
||||
if (cards.size() != 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
UUID sourceId = (source == null ? null : source.getSourceId());
|
||||
if (!anyOrder) {
|
||||
for (UUID cardId : cards) {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* 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
|
||||
|
|
@ -20,12 +20,11 @@
|
|||
* 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.target.common;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
|
@ -106,13 +105,14 @@ public class TargetCardInYourGraveyard extends TargetCard {
|
|||
public Set<UUID> possibleTargets(UUID sourceControllerId, Cards cards, Game game) {
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
Player player = game.getPlayer(sourceControllerId);
|
||||
for (Card card: cards.getCards(filter, game)) {
|
||||
for (Card card : cards.getCards(filter, game)) {
|
||||
if (player.getGraveyard().getCards(game).contains(card)) {
|
||||
possibleTargets.add(card.getId());
|
||||
}
|
||||
}
|
||||
return possibleTargets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if there are enough {@link Card} that can be selected.
|
||||
*
|
||||
|
|
@ -127,6 +127,7 @@ public class TargetCardInYourGraveyard extends TargetCard {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Player player = game.getPlayer(sourceControllerId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue