forked from External/mage
* Fixed spell cost reduction for bestow not working during calculation of castable spells (#6698).
This commit is contained in:
parent
a90dbd8533
commit
98ebcc07ca
19 changed files with 132 additions and 94 deletions
|
|
@ -18,7 +18,7 @@ import mage.util.CardUtil;
|
|||
*/
|
||||
public class AbilitiesCostReductionControllerEffect extends CostModificationEffectImpl {
|
||||
|
||||
private Class activatedAbility;
|
||||
private final Class activatedAbility;
|
||||
|
||||
public AbilitiesCostReductionControllerEffect(Class activatedAbility, String activatedAbilityName) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class CostModificationSourceEffect extends CostModificationEffectImpl {
|
||||
|
||||
private final Class<? extends Ability> abilityType;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import mage.util.CardUtil;
|
|||
public class SpellCostReductionForEachSourceEffect extends CostModificationEffectImpl {
|
||||
|
||||
private final DynamicValue eachAmount;
|
||||
private ManaCosts<ManaCost> reduceManaCosts;
|
||||
private final ManaCosts<ManaCost> reduceManaCosts;
|
||||
private final int reduceGenericMana;
|
||||
|
||||
public SpellCostReductionForEachSourceEffect(int reduceGenericMana, DynamicValue eachAmount) {
|
||||
|
|
@ -50,7 +50,6 @@ public class SpellCostReductionForEachSourceEffect extends CostModificationEffec
|
|||
this.staticText = sb.toString();
|
||||
}
|
||||
|
||||
|
||||
protected SpellCostReductionForEachSourceEffect(final SpellCostReductionForEachSourceEffect effect) {
|
||||
super(effect);
|
||||
this.eachAmount = effect.eachAmount;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class SpellsCostIncreasingAllEffect extends CostModificationEffectImpl {
|
|||
private final FilterCard filter;
|
||||
private final TargetController targetController;
|
||||
private final int increaseGenericCost;
|
||||
private ManaCosts<ManaCost> increaseManaCosts;
|
||||
private final ManaCosts<ManaCost> increaseManaCosts;
|
||||
|
||||
public SpellsCostIncreasingAllEffect(int increaseGenericCost, FilterCard filter, TargetController targetController) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.INCREASE_COST);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package mage.abilities.effects.common.cost;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.constants.CostModificationType;
|
||||
|
|
@ -12,9 +14,6 @@ import mage.game.stack.Spell;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
|
|
@ -23,7 +22,7 @@ public class SpellsCostModificationThatTargetSourceEffect extends CostModificati
|
|||
private final FilterCard spellFilter;
|
||||
private final int modificationAmount;
|
||||
private String targetName = "{this}";
|
||||
private TargetController targetController;
|
||||
private final TargetController targetController;
|
||||
|
||||
public SpellsCostModificationThatTargetSourceEffect(int modificationAmount, FilterCard spellFilter, TargetController targetController) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Neutral, modificationAmount < 0 ? CostModificationType.REDUCE_COST : CostModificationType.INCREASE_COST);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package mage.abilities.effects.common.cost;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
|
@ -8,16 +11,12 @@ import mage.choices.ChoiceImpl;
|
|||
import mage.constants.CostModificationType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SpellAbilityCastMode;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
|
@ -123,15 +122,12 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
|
|||
return false;
|
||||
}
|
||||
if (abilityToModify instanceof SpellAbility) {
|
||||
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
|
||||
if (spell != null) {
|
||||
// real cast with put on stack
|
||||
return this.filter.match(spell, game) && selectedByRuntimeData(spell, source, game);
|
||||
} else {
|
||||
// get playable and other staff without put on stack
|
||||
// used at least for flashback ability because Flashback ability doesn't use stack
|
||||
Card sourceCard = game.getCard(abilityToModify.getSourceId());
|
||||
return sourceCard != null && this.filter.match(sourceCard, game) && selectedByRuntimeData(sourceCard, source, game);
|
||||
Card spellCard = ((SpellAbility) abilityToModify).getCharacteristics(game);
|
||||
if (spellCard != null) {
|
||||
if (((SpellAbility) abilityToModify).getSpellAbilityCastMode() != SpellAbilityCastMode.NORMAL) {
|
||||
spellCard = ((SpellAbility) abilityToModify).getSpellAbilityCastMode().getTypeModifiedCardObjectCopy(spellCard, game);
|
||||
}
|
||||
return this.filter.match(spellCard, game) && selectedByRuntimeData(spellCard, source, game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package mage.abilities.effects.common.cost;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -11,15 +13,12 @@ import mage.choices.ChoiceImpl;
|
|||
import mage.constants.CostModificationType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SpellAbilityCastMode;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author North
|
||||
*/
|
||||
|
|
@ -114,15 +113,12 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
|
|||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify instanceof SpellAbility) {
|
||||
if (abilityToModify.isControlledBy(source.getControllerId())) {
|
||||
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
|
||||
if (spell != null) {
|
||||
// real cast with put on stack
|
||||
return this.filter.match(spell, source.getSourceId(), source.getControllerId(), game);
|
||||
} else {
|
||||
// get playable and other staff without put on stack
|
||||
// used at least for flashback ability because Flashback ability doesn't use stack
|
||||
Card sourceCard = game.getCard(abilityToModify.getSourceId());
|
||||
return sourceCard != null && this.filter.match(sourceCard, source.getSourceId(), source.getControllerId(), game);
|
||||
Card spellCard = ((SpellAbility) abilityToModify).getCharacteristics(game);;
|
||||
if (spellCard != null) {
|
||||
if (((SpellAbility) abilityToModify).getSpellAbilityCastMode() != SpellAbilityCastMode.NORMAL) {
|
||||
spellCard = ((SpellAbility) abilityToModify).getSpellAbilityCastMode().getTypeModifiedCardObjectCopy(spellCard, game);
|
||||
}
|
||||
return this.filter.match(spellCard, source.getSourceId(), source.getControllerId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.keyword;
|
||||
|
||||
import mage.MageObject;
|
||||
|
|
@ -138,6 +137,14 @@ public class BestowAbility extends SpellAbility {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
static public void becomeAura(Card card) {
|
||||
if (card != null) {
|
||||
card.getSubtype(null).add(SubType.AURA);
|
||||
card.getCardType().remove(CardType.CREATURE);
|
||||
card.getCardType().add(CardType.ENCHANTMENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class BestowEntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue