mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Implemented Underworld Breach
This commit is contained in:
parent
83e23b8e64
commit
a7c2f6d22b
2 changed files with 83 additions and 0 deletions
82
Mage.Sets/src/mage/cards/u/UnderworldBreach.java
Normal file
82
Mage.Sets/src/mage/cards/u/UnderworldBreach.java
Normal file
|
@ -0,0 +1,82 @@
|
|||
package mage.cards.u;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.abilities.keyword.EscapeAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class UnderworldBreach extends CardImpl {
|
||||
|
||||
public UnderworldBreach(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
|
||||
// Each nonland card in your graveyard has escape. The escape cost is equal to the card's mana cost plus exile three other cards from your graveyard.
|
||||
this.addAbility(new SimpleStaticAbility(new UnderworldBreachEffect()));
|
||||
|
||||
// At the beginning of the end step, sacrifice Underworld Breach.
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
||||
new SacrificeSourceEffect(), TargetController.NEXT, false
|
||||
));
|
||||
}
|
||||
|
||||
private UnderworldBreach(final UnderworldBreach card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnderworldBreach copy() {
|
||||
return new UnderworldBreach(this);
|
||||
}
|
||||
}
|
||||
|
||||
class UnderworldBreachEffect extends ContinuousEffectImpl {
|
||||
|
||||
UnderworldBreachEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
staticText = "Each nonland card in your graveyard has escape. " +
|
||||
"The escape cost is equal to the card's mana cost plus exile three other cards from your graveyard.";
|
||||
}
|
||||
|
||||
private UnderworldBreachEffect(final UnderworldBreachEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
controller
|
||||
.getGraveyard()
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(card -> !card.isLand())
|
||||
.forEach(card -> {
|
||||
Ability ability = new EscapeAbility(card, card.getManaCost().getText(), 3);
|
||||
ability.setSourceId(card.getId());
|
||||
ability.setControllerId(card.getOwnerId());
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnderworldBreachEffect copy() {
|
||||
return new UnderworldBreachEffect(this);
|
||||
}
|
||||
}
|
|
@ -77,6 +77,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Thirst for Meaning", 74, Rarity.COMMON, mage.cards.t.ThirstForMeaning.class));
|
||||
cards.add(new SetCardInfo("Treeshaker Chimera", 297, Rarity.RARE, mage.cards.t.TreeshakerChimera.class));
|
||||
cards.add(new SetCardInfo("Tymaret Calls the Dead", 118, Rarity.RARE, mage.cards.t.TymaretCallsTheDead.class));
|
||||
cards.add(new SetCardInfo("Underworld Breach", 161, Rarity.RARE, mage.cards.u.UnderworldBreach.class));
|
||||
cards.add(new SetCardInfo("Underworld Rage-Hound", 163, Rarity.COMMON, mage.cards.u.UnderworldRageHound.class));
|
||||
cards.add(new SetCardInfo("Underworld Sentinel", 293, Rarity.RARE, mage.cards.u.UnderworldSentinel.class));
|
||||
cards.add(new SetCardInfo("Victory's Envoy", 289, Rarity.RARE, mage.cards.v.VictorysEnvoy.class));
|
||||
|
|
Loading…
Reference in a new issue