* Fixed spell cost reduction for bestow not working during calculation of castable spells (#6698).

This commit is contained in:
LevelX2 2020-07-24 16:04:52 +02:00
parent a90dbd8533
commit 98ebcc07ca
19 changed files with 132 additions and 94 deletions

View file

@ -1,5 +1,7 @@
package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Ability;
@ -29,9 +31,6 @@ import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil;
import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/**
* @author spjspj
*/
@ -52,9 +51,9 @@ public class FeedingGroundsPlane extends Plane {
Effect chaosEffect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(), TargetConvertedManaCost.instance);
Target chaosTarget = new TargetCreaturePermanent(1, 1, filter, false);
List<Effect> chaosEffects = new ArrayList<Effect>();
List<Effect> chaosEffects = new ArrayList<>();
chaosEffects.add(chaosEffect);
List<Target> chaosTargets = new ArrayList<Target>();
List<Target> chaosTargets = new ArrayList<>();
chaosTargets.add(chaosTarget);
ActivateIfConditionActivatedAbility chaosAbility = new ActivateIfConditionActivatedAbility(Zone.COMMAND, new RollPlanarDieEffect(chaosEffects, chaosTargets), new GenericManaCost(0), MainPhaseStackEmptyCondition.instance);

View file

@ -17,7 +17,6 @@ import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.command.Plane;
import mage.game.stack.Spell;
import mage.target.Target;
import mage.util.CardUtil;
import mage.watchers.common.PlanarRollWatcher;
@ -42,9 +41,9 @@ public class TurriIslandPlane extends Plane {
Effect chaosEffect = new RevealLibraryPutIntoHandEffect(3, new FilterCreatureCard("creature cards"), Zone.GRAVEYARD);
Target chaosTarget = null;
List<Effect> chaosEffects = new ArrayList<Effect>();
List<Effect> chaosEffects = new ArrayList<>();
chaosEffects.add(chaosEffect);
List<Target> chaosTargets = new ArrayList<Target>();
List<Target> chaosTargets = new ArrayList<>();
chaosTargets.add(chaosTarget);
ActivateIfConditionActivatedAbility chaosAbility = new ActivateIfConditionActivatedAbility(Zone.COMMAND, new RollPlanarDieEffect(chaosEffects, chaosTargets), new GenericManaCost(0), MainPhaseStackEmptyCondition.instance);
@ -110,14 +109,12 @@ class TurriIslandEffect extends CostModificationEffectImpl {
if (!cPlane.getPlaneType().equals(Planes.PLANE_TURRI_ISLAND)) {
return false;
}
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
if (spell != null) {
return filter.match(spell, game) && selectedByRuntimeData(spell, source, game);
} else {
// used at least for flashback ability because Flashback ability doesn't use stack
Card sourceCard = game.getCard(abilityToModify.getSourceId());
return sourceCard != null && 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 filter.match(spellCard, game) && selectedByRuntimeData(spellCard, source, game);
}
}
return false;