1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-12 17:00:08 -09:00

add Accelerated Mutation, Torrent of Fire, et al.

using new HighestConvertedManaCostValue
This commit is contained in:
Neil Gentleman 2015-11-22 23:46:58 -08:00
parent bfb428b13a
commit 7996d02b1a
8 changed files with 400 additions and 57 deletions

View file

@ -29,13 +29,13 @@ package mage.sets.battleforzendikar;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.HighestConvertedManaCostValue;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
@ -82,15 +82,7 @@ class UginsInsightEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int highCMC = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(controller.getId())) {
if (permanent.getSpellAbility() != null) {
int cmc = permanent.getSpellAbility().getManaCosts().convertedManaCost();
if (cmc > highCMC) {
highCMC = cmc;
}
}
}
int highCMC = new HighestConvertedManaCostValue().calculate(game, source, this);
if (highCMC > 0) {
controller.scry(highCMC, source, game);
}

View file

@ -28,15 +28,11 @@
package mage.sets.commander2014;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.dynamicvalue.common.HighestConvertedManaCostValue;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
@ -48,10 +44,10 @@ public class RushOfKnowledge extends CardImpl {
super(ownerId, 123, "Rush of Knowledge", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{4}{U}");
this.expansionSetCode = "C14";
// Draw cards equal to the highest converted mana cost among permanents you control.
this.getSpellAbility().addEffect(new RushOfKnowledgeEffect());
DrawCardSourceControllerEffect effect = new DrawCardSourceControllerEffect(new HighestConvertedManaCostValue());
effect.setText("Draw cards equal to the highest converted mana cost among permanents you control");
this.getSpellAbility().addEffect(effect);
}
public RushOfKnowledge(final RushOfKnowledge card) {
@ -63,41 +59,3 @@ public class RushOfKnowledge extends CardImpl {
return new RushOfKnowledge(this);
}
}
class RushOfKnowledgeEffect extends OneShotEffect {
public RushOfKnowledgeEffect() {
super(Outcome.DrawCard);
this.staticText = "Draw cards equal to the highest converted mana cost among permanents you control";
}
public RushOfKnowledgeEffect(final RushOfKnowledgeEffect effect) {
super(effect);
}
@Override
public RushOfKnowledgeEffect copy() {
return new RushOfKnowledgeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int highCMC = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(controller.getId())) {
if (permanent.getSpellAbility() != null) {
int cmc = permanent.getSpellAbility().getManaCosts().convertedManaCost();
if (cmc > highCMC) {
highCMC = cmc;
}
}
}
if (highCMC > 0) {
controller.drawCards(highCMC, game);
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,65 @@
/*
* 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.scourge;
import java.util.UUID;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.HighestConvertedManaCostValue;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author nigelzor
*/
public class AcceleratedMutation extends CardImpl {
public AcceleratedMutation(UUID ownerId) {
super(ownerId, 109, "Accelerated Mutation", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{G}{G}");
this.expansionSetCode = "SCG";
// Target creature gets +X/+X until end of turn, where X is the highest converted mana cost among permanents you control.
DynamicValue amount = new HighestConvertedManaCostValue();
this.getSpellAbility().addEffect(new BoostTargetEffect(amount, amount, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public AcceleratedMutation(final AcceleratedMutation card) {
super(card);
}
@Override
public AcceleratedMutation copy() {
return new AcceleratedMutation(this);
}
}

View file

@ -0,0 +1,62 @@
/*
* 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.scourge;
import java.util.UUID;
import mage.abilities.dynamicvalue.common.HighestConvertedManaCostValue;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.TargetPlayer;
/**
*
* @author nigelzor
*/
public class CabalConditioning extends CardImpl {
public CabalConditioning(UUID ownerId) {
super(ownerId, 56, "Cabal Conditioning", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{6}{B}");
this.expansionSetCode = "SCG";
// Any number of target players each discard a number of cards equal to the highest converted mana cost among permanents you control.
this.getSpellAbility().addEffect(new DiscardTargetEffect(new HighestConvertedManaCostValue()));
this.getSpellAbility().addTarget(new TargetPlayer(0, Integer.MAX_VALUE, false));
}
public CabalConditioning(final CabalConditioning card) {
super(card);
}
@Override
public CabalConditioning copy() {
return new CabalConditioning(this);
}
}

View file

@ -0,0 +1,95 @@
/*
* 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.scourge;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.HighestConvertedManaCostValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.target.TargetSpell;
/**
*
* @author nigelzor
*/
public class DispersalShield extends CardImpl {
public DispersalShield(UUID ownerId) {
super(ownerId, 33, "Dispersal Shield", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
this.expansionSetCode = "SCG";
// Counter target spell if its converted mana cost is less than or equal to the highest converted mana cost among permanents you control.
this.getSpellAbility().addEffect(new DispersalShieldEffect());
this.getSpellAbility().addTarget(new TargetSpell());
}
public DispersalShield(final DispersalShield card) {
super(card);
}
@Override
public DispersalShield copy() {
return new DispersalShield(this);
}
}
class DispersalShieldEffect extends OneShotEffect {
public DispersalShieldEffect() {
super(Outcome.Detriment);
staticText = "Counter target spell if its converted mana cost is less than or equal to the highest converted mana cost among permanents you control";
}
public DispersalShieldEffect(DispersalShieldEffect effect) {
super(effect);
}
@Override
public Effect copy() {
return new DispersalShieldEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
DynamicValue amount = new HighestConvertedManaCostValue();
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
if (spell != null && spell.getConvertedManaCost() <= amount.calculate(game, source, this)) {
return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
}
return false;
}
}

View file

@ -0,0 +1,62 @@
/*
* 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.scourge;
import java.util.UUID;
import mage.abilities.dynamicvalue.common.HighestConvertedManaCostValue;
import mage.abilities.effects.common.GainLifeTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.TargetPlayer;
/**
*
* @author nigelzor
*/
public class RewardTheFaithful extends CardImpl {
public RewardTheFaithful(UUID ownerId) {
super(ownerId, 22, "Reward the Faithful", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{W}");
this.expansionSetCode = "SCG";
// Any number of target players each gain life equal to the highest converted mana cost among permanents you control.
this.getSpellAbility().addEffect(new GainLifeTargetEffect(new HighestConvertedManaCostValue()));
this.getSpellAbility().addTarget(new TargetPlayer(0, Integer.MAX_VALUE, false));
}
public RewardTheFaithful(final RewardTheFaithful card) {
super(card);
}
@Override
public RewardTheFaithful copy() {
return new RewardTheFaithful(this);
}
}

View file

@ -0,0 +1,62 @@
/*
* 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.scourge;
import java.util.UUID;
import mage.abilities.dynamicvalue.common.HighestConvertedManaCostValue;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.common.TargetCreatureOrPlayer;
/**
*
* @author nigelzor
*/
public class TorrentOfFire extends CardImpl {
public TorrentOfFire(UUID ownerId) {
super(ownerId, 107, "Torrent of Fire", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{R}{R}");
this.expansionSetCode = "SCG";
// Torrent of Fire deals damage equal to the highest converted mana cost among permanents you control to target creature or player.
this.getSpellAbility().addEffect(new DamageTargetEffect(new HighestConvertedManaCostValue()));
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
}
public TorrentOfFire(final TorrentOfFire card) {
super(card);
}
@Override
public TorrentOfFire copy() {
return new TorrentOfFire(this);
}
}

View file

@ -0,0 +1,47 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author nigelzor
*/
public class HighestConvertedManaCostValue implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int highCMC = 0;
Player controller = game.getPlayer(sourceAbility.getControllerId());
if (controller != null) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(controller.getId())) {
if (permanent.getSpellAbility() != null) {
int cmc = permanent.getSpellAbility().getManaCosts().convertedManaCost();
if (cmc > highCMC) {
highCMC = cmc;
}
}
}
}
return highCMC;
}
@Override
public DynamicValue copy() {
return new HighestConvertedManaCostValue();
}
@Override
public String getMessage() {
return "the highest converted mana cost among permanents you control";
}
@Override
public String toString() {
return "X";
}
}