mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
* Ulamog, the Infinite Gyre - done some clean up.
This commit is contained in:
parent
25a342a507
commit
3c98258e97
1 changed files with 28 additions and 14 deletions
|
|
@ -28,22 +28,24 @@
|
||||||
package mage.sets.riseoftheeldrazi;
|
package mage.sets.riseoftheeldrazi;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.ZoneChangeTriggeredAbility;
|
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
import mage.abilities.keyword.AnnihilatorAbility;
|
import mage.abilities.keyword.AnnihilatorAbility;
|
||||||
import mage.abilities.keyword.IndestructibleAbility;
|
import mage.abilities.keyword.IndestructibleAbility;
|
||||||
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
@ -54,8 +56,6 @@ import mage.target.TargetPermanent;
|
||||||
*/
|
*/
|
||||||
public class UlamogTheInfiniteGyre extends CardImpl<UlamogTheInfiniteGyre> {
|
public class UlamogTheInfiniteGyre extends CardImpl<UlamogTheInfiniteGyre> {
|
||||||
|
|
||||||
private static final String effectText = "When Ulamog is put into a graveyard from anywhere, its owner shuffles his or her graveyard into his or her library";
|
|
||||||
|
|
||||||
public UlamogTheInfiniteGyre(UUID ownerId) {
|
public UlamogTheInfiniteGyre(UUID ownerId) {
|
||||||
super(ownerId, 12, "Ulamog, the Infinite Gyre", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{11}");
|
super(ownerId, 12, "Ulamog, the Infinite Gyre", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{11}");
|
||||||
this.expansionSetCode = "ROE";
|
this.expansionSetCode = "ROE";
|
||||||
|
|
@ -64,11 +64,15 @@ public class UlamogTheInfiniteGyre extends CardImpl<UlamogTheInfiniteGyre> {
|
||||||
|
|
||||||
this.power = new MageInt(10);
|
this.power = new MageInt(10);
|
||||||
this.toughness = new MageInt(10);
|
this.toughness = new MageInt(10);
|
||||||
|
|
||||||
|
// When you cast Ulamog, the Infinite Gyre, destroy target permanent.
|
||||||
this.addAbility(new UlamogTheInfiniteGyreDestroyOnCastAbility());
|
this.addAbility(new UlamogTheInfiniteGyreDestroyOnCastAbility());
|
||||||
|
// Annihilator 4 (Whenever this creature attacks, defending player sacrifices four permanents.)
|
||||||
this.addAbility(new AnnihilatorAbility(4));
|
this.addAbility(new AnnihilatorAbility(4));
|
||||||
|
// Indestructible
|
||||||
this.addAbility(IndestructibleAbility.getInstance());
|
this.addAbility(IndestructibleAbility.getInstance());
|
||||||
this.addAbility(new ZoneChangeTriggeredAbility(Zone.GRAVEYARD, new UlamogTheInfiniteGyreEnterGraveyardEffect(), effectText, false));
|
// When Ulamog is put into a graveyard from anywhere, its owner shuffles his or her graveyard into his or her library.
|
||||||
|
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new UlamogTheInfiniteGyreEnterGraveyardEffect(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public UlamogTheInfiniteGyre(final UlamogTheInfiniteGyre card) {
|
public UlamogTheInfiniteGyre(final UlamogTheInfiniteGyre card) {
|
||||||
|
|
@ -83,11 +87,9 @@ public class UlamogTheInfiniteGyre extends CardImpl<UlamogTheInfiniteGyre> {
|
||||||
|
|
||||||
class UlamogTheInfiniteGyreDestroyOnCastAbility extends TriggeredAbilityImpl<UlamogTheInfiniteGyreDestroyOnCastAbility> {
|
class UlamogTheInfiniteGyreDestroyOnCastAbility extends TriggeredAbilityImpl<UlamogTheInfiniteGyreDestroyOnCastAbility> {
|
||||||
|
|
||||||
private static final String abilityText = "When you cast {this}, destroy target permanent";
|
|
||||||
|
|
||||||
UlamogTheInfiniteGyreDestroyOnCastAbility ( ) {
|
UlamogTheInfiniteGyreDestroyOnCastAbility ( ) {
|
||||||
super(Zone.STACK, new DestroyTargetEffect());
|
super(Zone.STACK, new DestroyTargetEffect());
|
||||||
this.addTarget(new TargetPermanent());
|
this.addTarget(new TargetPermanent(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
UlamogTheInfiniteGyreDestroyOnCastAbility(UlamogTheInfiniteGyreDestroyOnCastAbility ability) {
|
UlamogTheInfiniteGyreDestroyOnCastAbility(UlamogTheInfiniteGyreDestroyOnCastAbility ability) {
|
||||||
|
|
@ -112,7 +114,7 @@ class UlamogTheInfiniteGyreDestroyOnCastAbility extends TriggeredAbilityImpl<Ula
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return abilityText;
|
return new StringBuilder("When you cast {this}, ").append(super.getRule()).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,6 +122,7 @@ class UlamogTheInfiniteGyreEnterGraveyardEffect extends OneShotEffect<UlamogTheI
|
||||||
|
|
||||||
UlamogTheInfiniteGyreEnterGraveyardEffect ( ) {
|
UlamogTheInfiniteGyreEnterGraveyardEffect ( ) {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
|
staticText = "its owner shuffles his or her graveyard into his or her library";
|
||||||
}
|
}
|
||||||
|
|
||||||
UlamogTheInfiniteGyreEnterGraveyardEffect(UlamogTheInfiniteGyreEnterGraveyardEffect effect) {
|
UlamogTheInfiniteGyreEnterGraveyardEffect(UlamogTheInfiniteGyreEnterGraveyardEffect effect) {
|
||||||
|
|
@ -128,7 +131,18 @@ class UlamogTheInfiniteGyreEnterGraveyardEffect extends OneShotEffect<UlamogTheI
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
UUID ownerId = null;
|
||||||
|
Card card = game.getCard(source.getSourceId());
|
||||||
|
if (card != null) {
|
||||||
|
ownerId = card.getOwnerId();
|
||||||
|
}
|
||||||
|
if (ownerId == null) {
|
||||||
|
Permanent permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||||
|
if (permanent != null) {
|
||||||
|
ownerId = permanent.getOwnerId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Player player = game.getPlayer(ownerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.getLibrary().addAll(player.getGraveyard().getCards(game), game);
|
player.getLibrary().addAll(player.getGraveyard().getCards(game), game);
|
||||||
player.getGraveyard().clear();
|
player.getGraveyard().clear();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue