mirror of
https://github.com/correl/mage.git
synced 2025-04-09 17:00:09 -09:00
Merge fix
This commit is contained in:
parent
6e5ba7a446
commit
6848626c4b
3 changed files with 28 additions and 36 deletions
Mage/src/main/java/mage/abilities
|
@ -346,6 +346,17 @@ public abstract class AbilityImpl implements Ability {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this is a hack to prevent mana abilities with mana costs from causing endless loops - pay other costs first
|
||||||
|
if (this instanceof ActivatedManaAbilityImpl && !costs.pay(this, game, sourceId, controllerId, noMana, null)) {
|
||||||
|
logger.debug("activate mana ability failed - non mana costs");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//20101001 - 601.2e
|
||||||
|
if (costModificationActive) {
|
||||||
|
|
||||||
|
// TODO: replace all AdjustingSourceCosts abilities to continuus effect, see Affinity example
|
||||||
//20100716 - 601.2e
|
//20100716 - 601.2e
|
||||||
if (sourceObject != null) {
|
if (sourceObject != null) {
|
||||||
sourceObject.adjustCosts(this, game);
|
sourceObject.adjustCosts(this, game);
|
||||||
|
@ -364,14 +375,6 @@ public abstract class AbilityImpl implements Ability {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a hack to prevent mana abilities with mana costs from causing endless loops - pay other costs first
|
|
||||||
if (this instanceof ActivatedManaAbilityImpl && !costs.pay(this, game, sourceId, controllerId, noMana, null)) {
|
|
||||||
logger.debug("activate mana ability failed - non mana costs");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//20101001 - 601.2e
|
|
||||||
if (costModificationActive) {
|
|
||||||
game.getContinuousEffects().costModification(this, game);
|
game.getContinuousEffects().costModification(this, game);
|
||||||
} else {
|
} else {
|
||||||
costModificationActive = true;
|
costModificationActive = true;
|
||||||
|
|
|
@ -7,12 +7,14 @@ import mage.game.Game;
|
||||||
* Interface for abilities that adjust source and only source costs. For the
|
* Interface for abilities that adjust source and only source costs. For the
|
||||||
* cases when some permanent adjusts costs of other spells use
|
* cases when some permanent adjusts costs of other spells use
|
||||||
* {@link mage.abilities.effects.CostModificationEffect}.
|
* {@link mage.abilities.effects.CostModificationEffect}.
|
||||||
*
|
* <p>
|
||||||
* Example of such source costs adjusting:
|
* Example of such source costs adjusting:
|
||||||
* {@link mage.abilities.keyword.AffinityForArtifactsAbility}
|
* {@link mage.abilities.keyword.AffinityForArtifactsAbility}
|
||||||
*
|
*
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
// replace all AdjustingSourceCosts with "extends CostModificationEffectImpl with zone.ALL" (see Affinity example)
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface AdjustingSourceCosts {
|
public interface AdjustingSourceCosts {
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
|
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.SpellAbility;
|
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.AdjustingSourceCosts;
|
|
||||||
import mage.abilities.effects.common.AffinityEffect;
|
import mage.abilities.effects.common.AffinityEffect;
|
||||||
|
import mage.abilities.hint.common.ArtifactsYouControlHint;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.util.CardUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Affinity for artifacts
|
* Affinity for artifacts
|
||||||
*/
|
*/
|
||||||
public class AffinityForArtifactsAbility extends SimpleStaticAbility implements AdjustingSourceCosts {
|
public class AffinityForArtifactsAbility extends SimpleStaticAbility {
|
||||||
|
|
||||||
public AffinityForArtifactsAbility() {
|
public AffinityForArtifactsAbility() {
|
||||||
super(Zone.OUTSIDE, new AffinityEffect(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT));
|
super(Zone.ALL, new AffinityEffect(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT));
|
||||||
setRuleAtTheTop(true);
|
setRuleAtTheTop(true);
|
||||||
|
|
||||||
|
this.addHint(ArtifactsYouControlHint.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AffinityForArtifactsAbility(final AffinityForArtifactsAbility ability) {
|
public AffinityForArtifactsAbility(final AffinityForArtifactsAbility ability) {
|
||||||
|
@ -34,14 +31,4 @@ public class AffinityForArtifactsAbility extends SimpleStaticAbility implements
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "affinity for artifacts <i>(This spell costs {1} less to cast for each artifact you control.)</i>";
|
return "affinity for artifacts <i>(This spell costs {1} less to cast for each artifact you control.)</i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void adjustCosts(Ability ability, Game game) {
|
|
||||||
if (ability instanceof SpellAbility) {
|
|
||||||
int count = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT, ability.getControllerId(), game).size();
|
|
||||||
if (count > 0) {
|
|
||||||
CardUtil.adjustCost((SpellAbility)ability, count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue