[MOM] fix Heliod, the Radiant Dawn targeting all graveyards

This commit is contained in:
theelk801 2023-04-20 18:41:28 -04:00
parent c8866dca7b
commit 8013f4909b
2 changed files with 19 additions and 23 deletions

View file

@ -1,6 +1,7 @@
package mage.cards.h;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -12,19 +13,18 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterEnchantmentCard;
import mage.filter.predicate.Predicates;
import mage.target.TargetCard;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
public class HeliodTheRadiantDawn extends CardImpl {
private static final FilterCard filter = new FilterCard("enchantment card that isn't a God");
private static final FilterCard filter = new FilterEnchantmentCard("enchantment card that isn't a God");
static {
filter.add(CardType.ENCHANTMENT.getPredicate());
filter.add(Predicates.not(SubType.GOD.getPredicate()));
}
@ -36,14 +36,12 @@ public class HeliodTheRadiantDawn extends CardImpl {
this.toughness = new MageInt(4);
this.secondSideCardClazz = mage.cards.h.HeliodTheWarpedEclipse.class;
//When Heliod, the Radiant Dawn enters the battlefield, return target enchantment card that isn't a God from
//your graveyard to your hand.
EntersBattlefieldTriggeredAbility entersBattlefieldTriggeredAbility =
new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect());
entersBattlefieldTriggeredAbility.addTarget(new TargetCard(Zone.GRAVEYARD, filter));
this.addAbility(entersBattlefieldTriggeredAbility);
// When Heliod, the Radiant Dawn enters the battlefield, return target enchantment card that isn't a God from your graveyard to your hand.
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect());
ability.addTarget(new TargetCardInYourGraveyard(filter));
this.addAbility(ability);
//{3}{U/P}: Transform Heliod, the Radiant Dawn. Activate only as a sorcery.
// {3}{U/P}: Transform Heliod, the Radiant Dawn. Activate only as a sorcery.
this.addAbility(new TransformAbility());
this.addAbility(new ActivateAsSorceryActivatedAbility(new TransformSourceEffect(), new ManaCostsImpl<>("{3}{U/P}")));
}

View file

@ -6,7 +6,6 @@ import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
@ -33,10 +32,10 @@ public class HeliodTheWarpedEclipse extends CardImpl {
this.toughness = new MageInt(6);
this.nightCard = true;
//You may cast spells as though they had flash.
// You may cast spells as though they had flash.
this.addAbility(new SimpleStaticAbility(new CastAsThoughItHadFlashAllEffect(Duration.WhileOnBattlefield, filter)));
//Spells you cast cost {1} less to cast for each card your opponents have drawn this turn.
// Spells you cast cost {1} less to cast for each card your opponents have drawn this turn.
this.addAbility(new SimpleStaticAbility(new HeliodTheWarpedEclipseEffect()));
}
@ -67,10 +66,11 @@ class HeliodTheWarpedEclipseEffect extends CostModificationEffectImpl {
if (watcher == null) {
return false;
}
int amount = 0;
for (UUID playerID : game.getOpponents(source.getControllerId())) {
amount = amount + watcher.getCardsDrawnThisTurn(playerID);
}
int amount = game
.getOpponents(source.getControllerId())
.stream()
.mapToInt(watcher::getCardsDrawnThisTurn)
.sum();
if (amount < 1) {
return false;
}
@ -80,11 +80,9 @@ class HeliodTheWarpedEclipseEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (!(abilityToModify instanceof SpellAbility)) {
return false;
}
Card sourceCard = game.getCard(abilityToModify.getSourceId());
return sourceCard != null && abilityToModify.isControlledBy(source.getControllerId());
return abilityToModify instanceof SpellAbility
&& game.getCard(abilityToModify.getSourceId()) != null
&& abilityToModify.isControlledBy(source.getControllerId());
}
@Override