mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[M12] Consume Spirit
This commit is contained in:
parent
2e0662e295
commit
0df1e17820
14 changed files with 532 additions and 9 deletions
112
Mage.Sets/src/mage/sets/magic2010/ConsumeSpirit.java
Normal file
112
Mage.Sets/src/mage/sets/magic2010/ConsumeSpirit.java
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* 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.magic2010;
|
||||||
|
|
||||||
|
import mage.Constants;
|
||||||
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Rarity;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.filter.FilterMana;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.common.TargetCreatureOrPlayer;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author nantuko
|
||||||
|
*/
|
||||||
|
public class ConsumeSpirit extends CardImpl<ConsumeSpirit> {
|
||||||
|
|
||||||
|
public static final FilterMana filterBlack = new FilterMana();
|
||||||
|
|
||||||
|
static {
|
||||||
|
filterBlack.setBlack(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeSpirit(UUID ownerId) {
|
||||||
|
super(ownerId, 89, "Consume Spirit", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{X}{1}{B}");
|
||||||
|
this.expansionSetCode = "M10";
|
||||||
|
|
||||||
|
this.color.setBlack(true);
|
||||||
|
|
||||||
|
// Spend only black mana on X.
|
||||||
|
// Consume Spirit deals X damage to target creature or player and you gain X life.
|
||||||
|
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
||||||
|
this.getSpellAbility().addEffect(new ConsumeSpiritEffect());
|
||||||
|
this.getSpellAbility().getManaCostsToPay().getVariableCosts().get(0).setFilter(filterBlack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeSpirit(final ConsumeSpirit card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsumeSpirit copy() {
|
||||||
|
return new ConsumeSpirit(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConsumeSpiritEffect extends OneShotEffect<ConsumeSpiritEffect> {
|
||||||
|
|
||||||
|
public ConsumeSpiritEffect() {
|
||||||
|
super(Constants.Outcome.Damage);
|
||||||
|
staticText = "Consume Spirit deals X damage to target creature or player and you gain X life.Spend only black mana on X";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeSpiritEffect(final ConsumeSpiritEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
int damage = source.getManaCostsToPay().getVariableCosts().get(0).getAmount();
|
||||||
|
if (damage > 0) {
|
||||||
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(source));
|
||||||
|
if (permanent != null) {
|
||||||
|
permanent.damage(damage, source.getSourceId(), game, true, false);
|
||||||
|
} else {
|
||||||
|
Player player = game.getPlayer(getTargetPointer().getFirst(source));
|
||||||
|
if (player != null) {
|
||||||
|
player.damage(damage, source.getSourceId(), game, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsumeSpiritEffect copy() {
|
||||||
|
return new ConsumeSpiritEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
52
Mage.Sets/src/mage/sets/magic2012/ConsumeSpirit.java
Normal file
52
Mage.Sets/src/mage/sets/magic2012/ConsumeSpirit.java
Normal 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.magic2012;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author nantuko
|
||||||
|
*/
|
||||||
|
public class ConsumeSpirit extends mage.sets.magic2010.ConsumeSpirit {
|
||||||
|
|
||||||
|
public ConsumeSpirit(UUID ownerId) {
|
||||||
|
super(ownerId);
|
||||||
|
this.cardNumber = 88;
|
||||||
|
this.expansionSetCode = "M12";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeSpirit(final ConsumeSpirit card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsumeSpirit copy() {
|
||||||
|
return new ConsumeSpirit(this);
|
||||||
|
}
|
||||||
|
}
|
54
Mage.Sets/src/mage/sets/mirrodin/ConsumeSpirit.java
Normal file
54
Mage.Sets/src/mage/sets/mirrodin/ConsumeSpirit.java
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* 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.mirrodin;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.Constants.Rarity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author nantuko
|
||||||
|
*/
|
||||||
|
public class ConsumeSpirit extends mage.sets.magic2010.ConsumeSpirit {
|
||||||
|
|
||||||
|
public ConsumeSpirit(UUID ownerId) {
|
||||||
|
super(ownerId);
|
||||||
|
this.cardNumber = 60;
|
||||||
|
this.expansionSetCode = "MRD";
|
||||||
|
this.rarity = Rarity.COMMON;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeSpirit(final ConsumeSpirit card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsumeSpirit copy() {
|
||||||
|
return new ConsumeSpirit(this);
|
||||||
|
}
|
||||||
|
}
|
52
Mage.Sets/src/mage/sets/planechase/ConsumeSpirit.java
Normal file
52
Mage.Sets/src/mage/sets/planechase/ConsumeSpirit.java
Normal 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.planechase;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author nantuko
|
||||||
|
*/
|
||||||
|
public class ConsumeSpirit extends mage.sets.magic2010.ConsumeSpirit {
|
||||||
|
|
||||||
|
public ConsumeSpirit(UUID ownerId) {
|
||||||
|
super(ownerId);
|
||||||
|
this.cardNumber = 21;
|
||||||
|
this.expansionSetCode = "HOP";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeSpirit(final ConsumeSpirit card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsumeSpirit copy() {
|
||||||
|
return new ConsumeSpirit(this);
|
||||||
|
}
|
||||||
|
}
|
52
Mage.Sets/src/mage/sets/tenth/ConsumeSpirit.java
Normal file
52
Mage.Sets/src/mage/sets/tenth/ConsumeSpirit.java
Normal 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.tenth;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author nantuko
|
||||||
|
*/
|
||||||
|
public class ConsumeSpirit extends mage.sets.magic2010.ConsumeSpirit {
|
||||||
|
|
||||||
|
public ConsumeSpirit(UUID ownerId) {
|
||||||
|
super(ownerId);
|
||||||
|
this.cardNumber = 131;
|
||||||
|
this.expansionSetCode = "10E";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsumeSpirit(final ConsumeSpirit card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsumeSpirit copy() {
|
||||||
|
return new ConsumeSpirit(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,6 +31,7 @@ package mage;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import mage.Constants.ColoredManaSymbol;
|
import mage.Constants.ColoredManaSymbol;
|
||||||
|
import mage.filter.FilterMana;
|
||||||
import mage.util.Copyable;
|
import mage.util.Copyable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -168,6 +169,20 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
|
||||||
return red + green + blue + white + black + colorless + any;
|
return red + green + blue + white + black + colorless + any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int count(FilterMana filter) {
|
||||||
|
if (filter == null) {
|
||||||
|
return count();
|
||||||
|
}
|
||||||
|
int count = 0;
|
||||||
|
if (filter.isBlack()) count += black;
|
||||||
|
if (filter.isBlue()) count += blue;
|
||||||
|
if (filter.isWhite()) count += white;
|
||||||
|
if (filter.isGreen()) count += green;
|
||||||
|
if (filter.isRed()) count += red;
|
||||||
|
if (filter.isColorless()) count += colorless;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
red = 0;
|
red = 0;
|
||||||
green = 0;
|
green = 0;
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
package mage.abilities.costs;
|
package mage.abilities.costs;
|
||||||
|
|
||||||
|
import mage.filter.FilterMana;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
@ -35,5 +37,5 @@ package mage.abilities.costs;
|
||||||
public interface VariableCost {
|
public interface VariableCost {
|
||||||
|
|
||||||
public int getAmount();
|
public int getAmount();
|
||||||
|
public void setFilter(FilterMana filter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.CostImpl;
|
import mage.abilities.costs.CostImpl;
|
||||||
import mage.abilities.costs.VariableCost;
|
import mage.abilities.costs.VariableCost;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
|
import mage.filter.FilterMana;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
@ -87,6 +88,10 @@ public class PayVariableLoyaltyCost extends CostImpl<PayVariableLoyaltyCost> imp
|
||||||
return amountPaid;
|
return amountPaid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFilter(FilterMana filter) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PayVariableLoyaltyCost copy() {
|
public PayVariableLoyaltyCost copy() {
|
||||||
return new PayVariableLoyaltyCost(this);
|
return new PayVariableLoyaltyCost(this);
|
||||||
|
|
|
@ -33,6 +33,7 @@ import mage.Constants.Outcome;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.CostImpl;
|
import mage.abilities.costs.CostImpl;
|
||||||
import mage.abilities.costs.VariableCost;
|
import mage.abilities.costs.VariableCost;
|
||||||
|
import mage.filter.FilterMana;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
@ -92,6 +93,10 @@ public class TapVariableTargetCost extends CostImpl<TapVariableTargetCost> imple
|
||||||
return amountPaid;
|
return amountPaid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFilter(FilterMana filter) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TapVariableTargetCost copy() {
|
public TapVariableTargetCost copy() {
|
||||||
return new TapVariableTargetCost(this);
|
return new TapVariableTargetCost(this);
|
||||||
|
|
|
@ -182,7 +182,7 @@ public abstract class ManaCostImpl<T extends ManaCostImpl<T>> extends CostImpl<T
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean assignColorless(Ability ability, Game game, ManaPool pool, int mana) {
|
protected boolean assignColorless(Ability ability, Game game, ManaPool pool, int mana) {
|
||||||
int conditionalCount = pool.getConditionalCount(ability, game);
|
int conditionalCount = pool.getConditionalCount(ability, game, null);
|
||||||
while (mana > payment.count() && (pool.count() > 0 || conditionalCount > 0)) {
|
while (mana > payment.count() && (pool.count() > 0 || conditionalCount > 0)) {
|
||||||
if (payConditionalColorless(ability, game, pool)) continue;
|
if (payConditionalColorless(ability, game, pool)) continue;
|
||||||
if (payConditionalBlack(ability, game, pool)) continue;
|
if (payConditionalBlack(ability, game, pool)) continue;
|
||||||
|
|
|
@ -31,6 +31,7 @@ package mage.abilities.costs.mana;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.VariableCost;
|
import mage.abilities.costs.VariableCost;
|
||||||
|
import mage.filter.FilterMana;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.ManaPool;
|
import mage.players.ManaPool;
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ import mage.players.ManaPool;
|
||||||
public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements VariableCost {
|
public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements VariableCost {
|
||||||
|
|
||||||
protected int multiplier;
|
protected int multiplier;
|
||||||
|
protected FilterMana filter;
|
||||||
|
|
||||||
public VariableManaCost() {
|
public VariableManaCost() {
|
||||||
this(1);
|
this(1);
|
||||||
|
@ -55,6 +57,7 @@ public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements
|
||||||
public VariableManaCost(VariableManaCost manaCost) {
|
public VariableManaCost(VariableManaCost manaCost) {
|
||||||
super(manaCost);
|
super(manaCost);
|
||||||
this.multiplier = manaCost.multiplier;
|
this.multiplier = manaCost.multiplier;
|
||||||
|
if (manaCost.filter != null) this.filter = manaCost.filter.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,9 +67,9 @@ public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assignPayment(Game game, Ability ability, ManaPool pool) {
|
public void assignPayment(Game game, Ability ability, ManaPool pool) {
|
||||||
payment.add(pool.getMana());
|
payment.add(pool.getMana(filter));
|
||||||
payment.add(pool.getAllConditionalMana(ability, game));
|
payment.add(pool.getAllConditionalMana(ability, game, filter));
|
||||||
pool.emptyPoolConditional(ability, game);
|
pool.emptyPoolConditional(ability, game, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,6 +101,11 @@ public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFilter(FilterMana filter) {
|
||||||
|
this.filter = filter;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VariableManaCost copy() {
|
public VariableManaCost copy() {
|
||||||
return new VariableManaCost(this);
|
return new VariableManaCost(this);
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class LoseAllAbilitiesTargetEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public String getText(Mode mode) {
|
public String getText(Mode mode) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Target ").append(mode.getTargets().get(0).getTargetName()).append(" loses all abilities").append(duration.toString());
|
sb.append("Target ").append(mode.getTargets().get(0).getTargetName()).append(" loses all abilities ").append(duration.toString());
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
105
Mage/src/mage/filter/FilterMana.java
Normal file
105
Mage/src/mage/filter/FilterMana.java
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
* 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.filter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author nantuko
|
||||||
|
*/
|
||||||
|
public class FilterMana {
|
||||||
|
|
||||||
|
protected boolean black;
|
||||||
|
protected boolean green;
|
||||||
|
protected boolean white;
|
||||||
|
protected boolean red;
|
||||||
|
protected boolean blue;
|
||||||
|
protected boolean colorless;
|
||||||
|
|
||||||
|
public FilterMana() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterMana(FilterMana filter) {
|
||||||
|
black = filter.black;
|
||||||
|
green = filter.green;
|
||||||
|
white = filter.white;
|
||||||
|
red = filter.red;
|
||||||
|
blue = filter.blue;
|
||||||
|
colorless = filter.colorless;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBlack() {
|
||||||
|
return black;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlack(boolean black) {
|
||||||
|
this.black = black;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGreen() {
|
||||||
|
return green;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGreen(boolean green) {
|
||||||
|
this.green = green;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWhite() {
|
||||||
|
return white;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWhite(boolean white) {
|
||||||
|
this.white = white;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRed() {
|
||||||
|
return red;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRed(boolean red) {
|
||||||
|
this.red = red;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBlue() {
|
||||||
|
return blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlue(boolean blue) {
|
||||||
|
this.blue = blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isColorless() {
|
||||||
|
return colorless;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColorless(boolean colorless) {
|
||||||
|
this.colorless = colorless;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterMana copy() {
|
||||||
|
return new FilterMana(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,6 +36,8 @@ import java.util.List;
|
||||||
import mage.ConditionalMana;
|
import mage.ConditionalMana;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.filter.Filter;
|
||||||
|
import mage.filter.FilterMana;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -268,14 +270,14 @@ public class ManaPool implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getConditionalCount(Ability ability, Game game) {
|
public int getConditionalCount(Ability ability, Game game, FilterMana filter) {
|
||||||
if (ability == null || conditionalMana.size() == 0) {
|
if (ability == null || conditionalMana.size() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (ConditionalMana mana : conditionalMana) {
|
for (ConditionalMana mana : conditionalMana) {
|
||||||
if (mana.apply(ability, game)) {
|
if (mana.apply(ability, game)) {
|
||||||
count += mana.count();
|
count += mana.count(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
@ -329,6 +331,31 @@ public class ManaPool implements Serializable {
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int emptyPoolConditional(Ability ability, Game game, FilterMana filter) {
|
||||||
|
if (filter == null) {
|
||||||
|
return emptyPoolConditional(ability, game);
|
||||||
|
}
|
||||||
|
int total = count(filter);
|
||||||
|
if (filter.isBlack()) black = 0;
|
||||||
|
if (filter.isBlue()) blue = 0;
|
||||||
|
if (filter.isWhite()) white = 0;
|
||||||
|
if (filter.isRed()) red = 0;
|
||||||
|
if (filter.isGreen()) green = 0;
|
||||||
|
if (filter.isColorless()) colorless = 0;
|
||||||
|
// remove only those mana that can be spent for ability
|
||||||
|
Iterator<ConditionalMana> it = conditionalMana.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
ConditionalMana mana = it.next();
|
||||||
|
if (mana.apply(ability, game)) {
|
||||||
|
if (mana.count(filter) > 0) {
|
||||||
|
total += mana.count();
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
public Mana getMana() {
|
public Mana getMana() {
|
||||||
Mana mana = new Mana();
|
Mana mana = new Mana();
|
||||||
mana.setBlack(black);
|
mana.setBlack(black);
|
||||||
|
@ -340,9 +367,29 @@ public class ManaPool implements Serializable {
|
||||||
return mana;
|
return mana;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Mana getMana(FilterMana filter) {
|
||||||
|
if (filter == null) {
|
||||||
|
return getMana();
|
||||||
|
}
|
||||||
|
Mana mana = new Mana();
|
||||||
|
if (filter.isBlack()) mana.setBlack(black);
|
||||||
|
if (filter.isBlue()) mana.setBlue(blue);
|
||||||
|
if (filter.isColorless()) mana.setColorless(colorless);
|
||||||
|
if (filter.isGreen()) mana.setGreen(green);
|
||||||
|
if (filter.isRed()) mana.setRed(red);
|
||||||
|
if (filter.isWhite()) mana.setWhite(white);
|
||||||
|
return mana;
|
||||||
|
}
|
||||||
|
|
||||||
public Mana getAllConditionalMana(Ability ability, Game game) {
|
public Mana getAllConditionalMana(Ability ability, Game game) {
|
||||||
Mana mana = new Mana();
|
Mana mana = new Mana();
|
||||||
mana.setColorless(getConditionalCount(ability, game));
|
mana.setColorless(getConditionalCount(ability, game, null));
|
||||||
|
return mana;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mana getAllConditionalMana(Ability ability, Game game, FilterMana filter) {
|
||||||
|
Mana mana = new Mana();
|
||||||
|
mana.setColorless(getConditionalCount(ability, game, filter));
|
||||||
return mana;
|
return mana;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,6 +432,20 @@ public class ManaPool implements Serializable {
|
||||||
return red + green + blue + white + black + colorless;
|
return red + green + blue + white + black + colorless;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int count(FilterMana filter) {
|
||||||
|
if (filter == null) {
|
||||||
|
return count();
|
||||||
|
}
|
||||||
|
int count = 0;
|
||||||
|
if (filter.isBlack()) count += black;
|
||||||
|
if (filter.isBlue()) count += blue;
|
||||||
|
if (filter.isWhite()) count += white;
|
||||||
|
if (filter.isGreen()) count += green;
|
||||||
|
if (filter.isRed()) count += red;
|
||||||
|
if (filter.isColorless()) count += colorless;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
public ManaPool copy() {
|
public ManaPool copy() {
|
||||||
return new ManaPool(this);
|
return new ManaPool(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue