forked from External/mage
Affinity for artifacts
This commit is contained in:
parent
50fda0f7f4
commit
69ebe9aa24
5 changed files with 64 additions and 9 deletions
|
|
@ -31,7 +31,7 @@ import java.util.UUID;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author anonymous
|
||||
* @author Loki
|
||||
*/
|
||||
public class MyrEnforcer extends mage.sets.planechase.MyrEnforcer {
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import mage.cards.CardImpl;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author anonymous
|
||||
* @author Loki
|
||||
*/
|
||||
public class MyrEnforcer extends CardImpl<MyrEnforcer> {
|
||||
|
||||
|
|
|
|||
|
|
@ -36,10 +36,7 @@ import mage.Constants.AbilityType;
|
|||
import mage.Constants.EffectType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.costs.AlternativeCost;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
import mage.abilities.costs.CostsImpl;
|
||||
import mage.abilities.costs.*;
|
||||
import mage.abilities.costs.mana.KickerManaCost;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
|
|
@ -180,8 +177,14 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
|
|||
//20100716 - 601.2e
|
||||
if (game.getObject(sourceId) != null) {
|
||||
//game.getObject(sourceId).adjustCosts(this, game);
|
||||
if (game.getCard(sourceId) != null)
|
||||
if (game.getCard(sourceId) != null) {
|
||||
game.getCard(sourceId).adjustCosts(this, game);
|
||||
for (Ability ability : game.getCard(sourceId).getAbilities()) {
|
||||
if (ability instanceof AdjustingSourceCosts) {
|
||||
((AdjustingSourceCosts)ability).adjustCosts(this, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!useAlternativeCost(game)) {
|
||||
|
|
|
|||
43
Mage/src/mage/abilities/costs/AdjustingSourceCosts.java
Normal file
43
Mage/src/mage/abilities/costs/AdjustingSourceCosts.java
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.abilities.costs;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* Interface for abilities that adjust source and only source costs.
|
||||
* For the cases when some permanent adjusts costs of other spells use {@link mage.abilities.effects.CostModificationEffect}.
|
||||
*
|
||||
* Example of such source costs adjusting: {@link mage.abilities.keyword.AffinityForArtifactsAbility}
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public interface AdjustingSourceCosts {
|
||||
void adjustCosts(Ability ability, Game game);
|
||||
}
|
||||
|
|
@ -1,15 +1,19 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.AdjustingSourceCosts;
|
||||
import mage.abilities.effects.CostModificationEffect;
|
||||
import mage.abilities.effects.common.AffinityEffect;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* Affinity for artifacts
|
||||
*/
|
||||
public class AffinityForArtifactsAbility extends SimpleStaticAbility {
|
||||
public class AffinityForArtifactsAbility extends SimpleStaticAbility implements AdjustingSourceCosts {
|
||||
private static FilterControlledPermanent filter = new FilterControlledPermanent();
|
||||
|
||||
static {
|
||||
|
|
@ -18,7 +22,7 @@ public class AffinityForArtifactsAbility extends SimpleStaticAbility {
|
|||
}
|
||||
|
||||
public AffinityForArtifactsAbility() {
|
||||
super(Constants.Zone.ALL, new AffinityEffect(filter));
|
||||
super(Constants.Zone.OUTSIDE, new AffinityEffect(filter));
|
||||
}
|
||||
|
||||
public AffinityForArtifactsAbility(final AffinityForArtifactsAbility ability) {
|
||||
|
|
@ -34,4 +38,9 @@ public class AffinityForArtifactsAbility extends SimpleStaticAbility {
|
|||
public String getRule() {
|
||||
return "Affinity for artifacts";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
((CostModificationEffect)getEffects().get(0)).apply(game, this, ability);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue