mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
[LTR] Implement One Ring to Rule Them All
This commit is contained in:
parent
f2925237fb
commit
4f62890cae
2 changed files with 135 additions and 0 deletions
134
Mage.Sets/src/mage/cards/o/OneRingToRuleThemAll.java
Normal file
134
Mage.Sets/src/mage/cards/o/OneRingToRuleThemAll.java
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
package mage.cards.o;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.SagaAbility;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DestroyAllEffect;
|
||||||
|
import mage.abilities.effects.common.MillCardsEachPlayerEffect;
|
||||||
|
import mage.abilities.effects.keyword.TheRingTemptsYouEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.Predicates;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class OneRingToRuleThemAll extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterPermanent filter = new FilterCreaturePermanent("nonlegendary creatures");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public OneRingToRuleThemAll(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.SAGA);
|
||||||
|
|
||||||
|
// (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)
|
||||||
|
SagaAbility sagaAbility = new SagaAbility(this);
|
||||||
|
|
||||||
|
// I -- The Ring tempts you, then each player mills cards equal to your Ring-bearer's power.
|
||||||
|
sagaAbility.addChapterEffect(
|
||||||
|
this, SagaChapter.CHAPTER_I, new TheRingTemptsYouEffect(),
|
||||||
|
new MillCardsEachPlayerEffect(
|
||||||
|
OneRingToRuleThemAllValue.instance, TargetController.EACH_PLAYER
|
||||||
|
).setText(", then each player mills cards equal to your Ring-bearer's power")
|
||||||
|
);
|
||||||
|
|
||||||
|
// II -- Destroy all nonlegendary creatures.
|
||||||
|
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_II, new DestroyAllEffect(filter));
|
||||||
|
|
||||||
|
// III -- Each opponent loses 1 life for each creature card in that player's graveyard.
|
||||||
|
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, new OneRingToRuleThemAllEffect());
|
||||||
|
|
||||||
|
this.addAbility(sagaAbility);
|
||||||
|
}
|
||||||
|
|
||||||
|
private OneRingToRuleThemAll(final OneRingToRuleThemAll card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OneRingToRuleThemAll copy() {
|
||||||
|
return new OneRingToRuleThemAll(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum OneRingToRuleThemAllValue implements DynamicValue {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
|
return Optional
|
||||||
|
.ofNullable(game.getPlayer(sourceAbility.getControllerId()))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(player -> player.getRingBearer(game))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(MageObject::getPower)
|
||||||
|
.map(MageInt::getValue)
|
||||||
|
.orElse(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OneRingToRuleThemAllValue copy() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OneRingToRuleThemAllEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
OneRingToRuleThemAllEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "each opponent loses 1 life for each creature card in that player's graveyard";
|
||||||
|
}
|
||||||
|
|
||||||
|
private OneRingToRuleThemAllEffect(final OneRingToRuleThemAllEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OneRingToRuleThemAllEffect copy() {
|
||||||
|
return new OneRingToRuleThemAllEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||||
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player != null) {
|
||||||
|
player.loseLife(
|
||||||
|
player.getGraveyard()
|
||||||
|
.count(StaticFilters.FILTER_CARD_CREATURE, game),
|
||||||
|
game, source, false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -83,6 +83,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Nazgul", 100, Rarity.UNCOMMON, mage.cards.n.Nazgul.class));
|
cards.add(new SetCardInfo("Nazgul", 100, Rarity.UNCOMMON, mage.cards.n.Nazgul.class));
|
||||||
cards.add(new SetCardInfo("Oliphaunt", 139, Rarity.COMMON, mage.cards.o.Oliphaunt.class));
|
cards.add(new SetCardInfo("Oliphaunt", 139, Rarity.COMMON, mage.cards.o.Oliphaunt.class));
|
||||||
cards.add(new SetCardInfo("Olog-hai Crusher", 140, Rarity.COMMON, mage.cards.o.OlogHaiCrusher.class));
|
cards.add(new SetCardInfo("Olog-hai Crusher", 140, Rarity.COMMON, mage.cards.o.OlogHaiCrusher.class));
|
||||||
|
cards.add(new SetCardInfo("One Ring to Rule Them All", 102, Rarity.RARE, mage.cards.o.OneRingToRuleThemAll.class));
|
||||||
cards.add(new SetCardInfo("Pippin's Bravery", 182, Rarity.COMMON, mage.cards.p.PippinsBravery.class));
|
cards.add(new SetCardInfo("Pippin's Bravery", 182, Rarity.COMMON, mage.cards.p.PippinsBravery.class));
|
||||||
cards.add(new SetCardInfo("Plains", 262, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Plains", 262, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Prince Imrahil the Fair", 219, Rarity.UNCOMMON, mage.cards.p.PrinceImrahilTheFair.class));
|
cards.add(new SetCardInfo("Prince Imrahil the Fair", 219, Rarity.UNCOMMON, mage.cards.p.PrinceImrahilTheFair.class));
|
||||||
|
|
Loading…
Reference in a new issue