[ALA] Sacellum Godspeaker - fixed wrong reveal ability, refactor related cards (#11102)

* Sacellum Godspeaker needs to reveal the cards
* Use CardsImpl constructor rather than looping through all cards
* Remove unneeded check from Arsenal Thresher
* added source to Phosphorescent Feast's reveal
* Add null check for controller
This commit is contained in:
ssk97 2023-09-03 21:33:50 -07:00 committed by GitHub
parent 4ad92d0a35
commit 025ebee026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 37 deletions

View file

@ -77,18 +77,13 @@ class ArsenalThresherEffect extends OneShotEffect {
FilterArtifactCard filter = new FilterArtifactCard();
filter.add(AnotherPredicate.instance);
if (controller.chooseUse(Outcome.Benefit, "Reveal other artifacts in your hand?", source, game)) {
Cards cards = new CardsImpl();
if (controller.getHand().count(filter, source.getControllerId(), source, game) > 0) {
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);
if (controller.choose(Outcome.Benefit, target, source, game)) {
for (UUID uuid : target.getTargets()) {
cards.add(controller.getHand().get(uuid, game));
}
if (arsenalThresher != null) {
controller.revealCards(arsenalThresher.getIdName(), cards, game);
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
arsenalThresher.addCounters(CounterType.P1P1.createInstance(cards.size()), source.getControllerId(), source, game, appliedEffects);
}
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);
if (controller.choose(Outcome.Benefit, target, source, game)) {
Cards cards = new CardsImpl(target.getTargets());
if (arsenalThresher != null) {
controller.revealCards(arsenalThresher.getIdName(), cards, game);
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
arsenalThresher.addCounters(CounterType.P1P1.createInstance(cards.size()), source.getControllerId(), source, game, appliedEffects);
}
}
return true;

View file

@ -63,12 +63,8 @@ class PhosphorescentFeastEffect extends OneShotEffect {
if (player.getHand().count(new FilterCard(), game) > 0) {
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, new FilterCard());
if (player.choose(Outcome.Benefit, target, source, game)) {
Cards cards = new CardsImpl();
for (UUID uuid : target.getTargets()) {
cards.add(player.getHand().get(uuid, game));
}
player.revealCards("cards", cards, game);
Cards cards = new CardsImpl(target.getTargets());
player.revealCards(source, cards, game);
for (Card card : cards.getCards(game)) {
chroma += card.getManaCost().getMana().getGreen();
}

View file

@ -73,27 +73,15 @@ class RofellossGiftEffect extends OneShotEffect {
if (!player.choose(outcome, player.getHand(), targetCardInHand, source, game)) {
return false;
}
Cards cards = new CardsImpl();
for (UUID cardId : targetCardInHand.getTargets()) {
Card card = game.getCard(cardId);
if (card != null) {
cards.add(card);
}
}
player.revealCards(source, cards, game);
Cards revealedCards = new CardsImpl(targetCardInHand.getTargets());
player.revealCards(source, revealedCards, game);
int enchantmentsToReturn = Math.min(player.getGraveyard().count(filter2, game), targetCardInHand.getTargets().size());
TargetCardInYourGraveyard targetCardInYourGraveyard = new TargetCardInYourGraveyard(enchantmentsToReturn, filter2);
targetCardInYourGraveyard.setNotTarget(true);
if (!player.choose(outcome, targetCardInYourGraveyard, source, game)) {
return false;
}
cards = new CardsImpl();
for (UUID cardId : targetCardInYourGraveyard.getTargets()) {
Card card = game.getCard(cardId);
if (card != null) {
cards.add(card);
}
}
return player.moveCards(cards, Zone.HAND, source, game);
Cards returnedCards = new CardsImpl(targetCardInYourGraveyard.getTargets());
return player.moveCards(returnedCards, Zone.HAND, source, game);
}
}

View file

@ -8,6 +8,7 @@ import mage.abilities.effects.mana.ManaEffect;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.PowerPredicate;
@ -88,9 +89,13 @@ class SacellumGodspeakerEffect extends ManaEffect {
@Override
public Mana produceMana(Game game, Ability source) {
if (game != null) {
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);
if (target.choose(Outcome.Benefit, source.getControllerId(), source.getSourceId(), source, game)) {
return Mana.GreenMana(target.getTargets().size());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);
if (target.choose(Outcome.Benefit, source.getControllerId(), source.getSourceId(), source, game)) {
controller.revealCards(source, new CardsImpl(target.getTargets()), game);
return Mana.GreenMana(target.getTargets().size());
}
}
}
return new Mana();