[MKM] Implement Worldsoul's Rage (#11754)

---------

Co-authored-by: Matthew Wilson <matthew_w@vaadin.com>
This commit is contained in:
Matthew Wilson 2024-02-03 23:46:46 +02:00 committed by GitHub
parent cac2b70c92
commit 739d3b13b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 106 additions and 0 deletions

View file

@ -0,0 +1,105 @@
package mage.cards.w;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterLandCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetAnyTarget;
/**
*
* @author DominionSpy
*/
public final class WorldsoulsRage extends CardImpl {
public WorldsoulsRage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}{G}");
// Worldsoul's Rage deals X damage to any target. Put up to X land cards from your hand and/or graveyard onto the battlefield tapped.
this.getSpellAbility().addEffect(new DamageTargetEffect(ManacostVariableValue.REGULAR));
this.getSpellAbility().addEffect(new WorldsoulsRageEffect());
this.getSpellAbility().addTarget(new TargetAnyTarget());
}
private WorldsoulsRage(final WorldsoulsRage card) {
super(card);
}
@Override
public WorldsoulsRage copy() {
return new WorldsoulsRage(this);
}
}
class WorldsoulsRageEffect extends OneShotEffect {
WorldsoulsRageEffect() {
super(Outcome.PutLandInPlay);
staticText = "put up to X land cards from your hand and/or graveyard onto the battlefield tapped.";
}
private WorldsoulsRageEffect(final WorldsoulsRageEffect effect) {
super(effect);
}
@Override
public WorldsoulsRageEffect copy() {
return new WorldsoulsRageEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
FilterCard filter = new FilterLandCard();
Cards landCards = new CardsImpl();
landCards.addAllCards(controller.getHand().getCards(filter, source.getControllerId(), source, game));
landCards.addAllCards(controller.getGraveyard().getCards(filter, source.getControllerId(), source, game));
if (landCards.isEmpty()) {
return false;
}
int maxTargets = source.getManaCostsToPay().getX();
if (maxTargets == 0) {
return false;
}
TargetCard target = new TargetCard(0, maxTargets, Zone.ALL, filter);
target.withNotTarget(true);
controller.chooseTarget(outcome, landCards, target, source, game);
Set<Card> chosenCards = target.getTargets()
.stream()
.map(game::getCard)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
if (chosenCards.isEmpty()) {
return false;
}
controller.moveCards(chosenCards, Zone.BATTLEFIELD, source, game, true, false, false, null);
return true;
}
}

View file

@ -235,6 +235,7 @@ public final class MurdersAtKarlovManor extends ExpansionSet {
cards.add(new SetCardInfo("Warleader's Call", 242, Rarity.RARE, mage.cards.w.WarleadersCall.class));
cards.add(new SetCardInfo("Wispdrinker Vampire", 243, Rarity.UNCOMMON, mage.cards.w.WispdrinkerVampire.class));
cards.add(new SetCardInfo("Wojek Investigator", 36, Rarity.RARE, mage.cards.w.WojekInvestigator.class));
cards.add(new SetCardInfo("Worldsoul's Rage", 244, Rarity.RARE, mage.cards.w.WorldsoulsRage.class));
cards.add(new SetCardInfo("Wrench", 37, Rarity.UNCOMMON, mage.cards.w.Wrench.class));
cards.add(new SetCardInfo("Yarus, Roar of the Old Gods", 245, Rarity.RARE, mage.cards.y.YarusRoarOfTheOldGods.class));