[KHM] Implemented Rampage of the Valkyries

This commit is contained in:
Evan Kranzler 2020-12-20 13:41:06 -05:00
parent d3f30e43aa
commit c06e29c4e4
2 changed files with 95 additions and 0 deletions

View file

@ -0,0 +1,94 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.AngelVigilanceToken;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RampageOfTheValkyries extends CardImpl {
private static final FilterPermanent filter
= new FilterControlledPermanent(SubType.ANGEL, "an Angel you control");
public RampageOfTheValkyries(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{B}");
// When Rampage of the Valkyries enters the battlefield, create a 4/4 white Angel token with flying and vigilance.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new AngelVigilanceToken())));
// Whenever an Angel you control dies, each other player sacrifices a creature.
this.addAbility(new DiesCreatureTriggeredAbility(new RampageOfTheValkyriesEffect(), false, filter));
}
private RampageOfTheValkyries(final RampageOfTheValkyries card) {
super(card);
}
@Override
public RampageOfTheValkyries copy() {
return new RampageOfTheValkyries(this);
}
}
class RampageOfTheValkyriesEffect extends OneShotEffect {
RampageOfTheValkyriesEffect() {
super(Outcome.Benefit);
staticText = "each other player sacrifices a creature";
}
private RampageOfTheValkyriesEffect(final RampageOfTheValkyriesEffect effect) {
super(effect);
}
@Override
public RampageOfTheValkyriesEffect copy() {
return new RampageOfTheValkyriesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
List<UUID> perms = new ArrayList<>();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player == null || player.getId().equals(source.getControllerId())) {
continue;
}
TargetPermanent target = new TargetControlledCreaturePermanent();
target.setNotTarget(true);
if (!target.canChoose(source.getSourceId(), playerId, game)) {
continue;
}
player.choose(outcome, target, source.getSourceId(), game);
perms.add(target.getFirstTarget());
}
for (UUID permID : perms) {
Permanent permanent = game.getPermanent(permID);
if (permanent != null) {
permanent.sacrifice(source, game);
}
}
return true;
}
}

View file

@ -41,6 +41,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Gilded Assault Cart", 390, Rarity.UNCOMMON, mage.cards.g.GildedAssaultCart.class));
cards.add(new SetCardInfo("Gladewalker Ritualist", 392, Rarity.UNCOMMON, mage.cards.g.GladewalkerRitualist.class));
cards.add(new SetCardInfo("Hengegate Pathway", 260, Rarity.RARE, mage.cards.h.HengegatePathway.class));
cards.add(new SetCardInfo("Rampage of the Valkyries", 393, Rarity.UNCOMMON, mage.cards.r.RampageOfTheValkyries.class));
cards.add(new SetCardInfo("Renegade Reaper", 386, Rarity.UNCOMMON, mage.cards.r.RenegadeReaper.class));
cards.add(new SetCardInfo("Showdown of the Skalds", 229, Rarity.RARE, mage.cards.s.ShowdownOfTheSkalds.class));
cards.add(new SetCardInfo("Starnheim Aspirant", 380, Rarity.UNCOMMON, mage.cards.s.StarnheimAspirant.class));