Fixed some missing sourceIds.

This commit is contained in:
LevelX2 2017-09-02 00:44:52 +02:00
parent 5bf12d227c
commit 5bf1741656
11 changed files with 104 additions and 97 deletions

View file

@ -55,8 +55,7 @@ import mage.watchers.common.CardsAmountDrawnThisTurnWatcher;
public class ArchmageAscension extends CardImpl {
public ArchmageAscension(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
// At the beginning of each end step, if you drew two or more cards this turn, you may put a quest counter on Archmage Ascension.
this.addAbility(new ArchmageAscensionTriggeredAbility(), new CardsAmountDrawnThisTurnWatcher());
@ -64,7 +63,7 @@ public class ArchmageAscension extends CardImpl {
// As long as Archmage Ascension has six or more quest counters on it, if you would draw a card,
// you may instead search your library for a card, put that card into your hand, then shuffle your library.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ArchmageAscensionReplacementEffect()));
}
public ArchmageAscension(final ArchmageAscension card) {
@ -91,17 +90,17 @@ class ArchmageAscensionTriggeredAbility extends TriggeredAbilityImpl {
public ArchmageAscensionTriggeredAbility copy() {
return new ArchmageAscensionTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent archmage = game.getPermanent(super.getSourceId());
CardsAmountDrawnThisTurnWatcher watcher =
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
CardsAmountDrawnThisTurnWatcher watcher
= (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
return archmage != null && watcher != null && watcher.getAmountCardsDrawn(this.getControllerId()) >= 2;
}
@ -115,8 +114,8 @@ class ArchmageAscensionReplacementEffect extends ReplacementEffectImpl {
public ArchmageAscensionReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "As long as {this} has six or more quest counters on it, if you would draw a card, " +
"you may instead search your library for a card, put that card into your hand, then shuffle your library";
staticText = "As long as {this} has six or more quest counters on it, if you would draw a card, "
+ "you may instead search your library for a card, put that card into your hand, then shuffle your library";
}
public ArchmageAscensionReplacementEffect(final ArchmageAscensionReplacementEffect effect) {
@ -141,19 +140,19 @@ class ArchmageAscensionReplacementEffect extends ReplacementEffectImpl {
if (player.searchLibrary(target, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
card.moveToZone(Zone.HAND, id, game, false);
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
player.shuffleLibrary(source, game);
}
}
}
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DRAW_CARD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent archmage = game.getPermanent(source.getSourceId());

View file

@ -82,7 +82,7 @@ public class CurseOfTheCabal extends CardImpl {
}
}
class CurseOfTheCabalSacrificeEffect extends OneShotEffect{
class CurseOfTheCabalSacrificeEffect extends OneShotEffect {
private static final FilterControlledPermanent FILTER = new FilterControlledPermanent(); // ggf filter.FilterPermanent
@ -103,10 +103,11 @@ class CurseOfTheCabalSacrificeEffect extends OneShotEffect{
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if(targetPlayer != null) {
if (targetPlayer != null) {
int amount = game.getBattlefield().countAll(FILTER, targetPlayer.getId(), game) / 2;
if(amount < 1)
if (amount < 1) {
return true;
}
Target target = new TargetControlledPermanent(amount, amount, FILTER, true);
if (target.canChoose(targetPlayer.getId(), game)) {
while (!target.isChosen() && target.canChoose(targetPlayer.getId(), game) && targetPlayer.canRespond()) {
@ -129,9 +130,9 @@ class CurseOfTheCabalTriggeredAbility extends ConditionalTriggeredAbility {
public CurseOfTheCabalTriggeredAbility() {
super(new BeginningOfUpkeepTriggeredAbility(
Zone.EXILED, new CurseOfTheCabalTriggeredAbilityConditionalDelay(),
TargetController.ANY, false, true
),
Zone.EXILED, new CurseOfTheCabalTriggeredAbilityConditionalDelay(),
TargetController.ANY, false, true
),
SuspendedCondition.instance,
"At the beginning of each player's upkeep, if {this} is suspended, that player may sacrifice a permanent. If he or she does, put two time counters on {this}."
);
@ -149,21 +150,22 @@ class CurseOfTheCabalTriggeredAbility extends ConditionalTriggeredAbility {
}
}
class CurseOfTheCabalTriggeredAbilityConditionalDelay extends AddCountersSourceEffect{
class CurseOfTheCabalTriggeredAbilityConditionalDelay extends AddCountersSourceEffect {
public CurseOfTheCabalTriggeredAbilityConditionalDelay(){
public CurseOfTheCabalTriggeredAbilityConditionalDelay() {
super(CounterType.TIME.createInstance(), new StaticValue(2), false, true);
}
public boolean apply(Game game, Ability source) {
UUID id = game.getActivePlayerId();
Player target = game.getPlayer(id);
UUID activePlayerId = game.getActivePlayerId();
Player target = game.getPlayer(activePlayerId);
Cost cost = new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledPermanent()));
if(target == null)
if (target == null) {
return false;
if (cost.canPay(source, source.getSourceId(), id, game)
}
if (cost.canPay(source, source.getSourceId(), activePlayerId, game)
&& target.chooseUse(Outcome.Sacrifice, "Sacrifice a permanent to delay Curse of the Cabal?", source, game)
&& cost.pay(source, game, source.getSourceId(), id, true, null)) {
&& cost.pay(source, game, source.getSourceId(), activePlayerId, true, null)) {
return super.apply(game, source);
}
return true;

View file

@ -50,7 +50,7 @@ import mage.target.common.TargetCreaturePermanent;
public class DeadReckoning extends CardImpl {
public DeadReckoning(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
// You may put target creature card from your graveyard on top of your library. If you do, Dead Reckoning deals damage equal to that card's power to target creature.
this.getSpellAbility().addEffect(new DeadReckoningEffect());
@ -96,7 +96,7 @@ class DeadReckoningEffect extends OneShotEffect {
&& you.choose(Outcome.Damage, target2, source.getSourceId(), game)) {
Card creatureInGraveyard = game.getCard(target1.getFirstTarget());
if (creatureInGraveyard != null) {
if (creatureInGraveyard.moveToZone(Zone.LIBRARY, id, game, true)) {
if (creatureInGraveyard.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true)) {
int power = creatureInGraveyard.getPower().getValue();
Permanent creature = game.getPermanent(target2.getFirstTarget());
if (creature != null) {

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
@ -27,7 +27,7 @@
*/
package mage.cards.d;
import java.util.UUID;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.CycleTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -54,14 +54,14 @@ import mage.players.Player;
public class DecreeOfAnnihilation extends CardImpl {
public DecreeOfAnnihilation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{8}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{8}{R}{R}");
// Exile all artifacts, creatures, and lands from the battlefield, all cards from all graveyards, and all cards from all hands.
this.getSpellAbility().addEffect(new DecreeOfAnnihilationEffect());
// Cycling {5}{R}{R}
this.addAbility(new CyclingAbility(new ManaCostsImpl("{5}{R}{R}")));
// When you cycle Decree of Annihilation, destroy all lands.
Ability ability = new CycleTriggeredAbility(new DestroyAllEffect(StaticFilters.FILTER_LANDS), false);
this.addAbility(ability);
@ -78,16 +78,16 @@ public class DecreeOfAnnihilation extends CardImpl {
}
class DecreeOfAnnihilationEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent("");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE),
new CardTypePredicate(CardType.LAND)));
}
public DecreeOfAnnihilationEffect() {
super(Outcome.Detriment);
staticText = "Exile all artifacts, creatures, and lands from the battlefield, all cards from all graveyards, and all cards from all hands";
@ -105,7 +105,7 @@ class DecreeOfAnnihilationEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
permanent.moveToExile(id, "all artifacts, creatures, and land", id, game);
permanent.moveToExile(null, "", source.getSourceId(), game);
}
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);

View file

@ -151,19 +151,19 @@ class ElsewhereFlaskContinuousEffect extends ContinuousEffectImpl {
if (sublayer == SubLayer.NA) {
land.getAbilities().clear();
if (choice.equals("Forest")) {
land.addAbility(new GreenManaAbility(), id, game);
land.addAbility(new GreenManaAbility(), source.getSourceId(), game);
}
if (choice.equals("Plains")) {
land.addAbility(new WhiteManaAbility(), id, game);
land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
}
if (choice.equals("Mountain")) {
land.addAbility(new RedManaAbility(), id, game);
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
}
if (choice.equals("Island")) {
land.addAbility(new BlueManaAbility(), id, game);
land.addAbility(new BlueManaAbility(), source.getSourceId(), game);
}
if (choice.equals("Swamp")) {
land.addAbility(new BlackManaAbility(), id, game);
land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
}
}
break;

View file

@ -28,6 +28,7 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -50,8 +51,7 @@ import mage.target.common.TargetCreatureOrPlayer;
public class ExplosiveRevelation extends CardImpl {
public ExplosiveRevelation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}{R}");
// Choose target creature or player. Reveal cards from the top of your library until you reveal a nonland card. Explosive Revelation deals damage equal to that card's converted mana cost to that creature or player. Put the nonland card into your hand and the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new ExplosiveRevelationEffect());
@ -86,42 +86,46 @@ class ExplosiveRevelationEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.getLibrary().hasCards()) {
CardsImpl cards = new CardsImpl();
Library library = player.getLibrary();
Card card = null;
do {
card = library.removeFromTop(game);
if (card != null) {
cards.add(card);
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
if (controller.getLibrary().hasCards()) {
CardsImpl cards = new CardsImpl();
Library library = controller.getLibrary();
Card card = null;
do {
card = library.removeFromTop(game);
if (card != null) {
cards.add(card);
}
} while (library.hasCards() && card != null && card.isLand());
// reveal cards
if (!cards.isEmpty()) {
controller.revealCards(sourceObject.getIdName(), cards, game);
}
} while (library.hasCards() && card != null && card.isLand());
// reveal cards
if (!cards.isEmpty()) {
player.revealCards("Explosive Revelation", cards, game);
}
// the nonland card
int damage = card.getConvertedManaCost();
// assign damage to target
for (UUID targetId: targetPointer.getTargets(game, source)) {
Permanent targetedCreature = game.getPermanent(targetId);
if (targetedCreature != null) {
targetedCreature.damage(damage, source.getSourceId(), game, false, true);
}
else {
Player targetedPlayer = game.getPlayer(targetId);
if (targetedPlayer != null) {
targetedPlayer.damage(damage, source.getSourceId(), game, false, true);
// the nonland card
int damage = card.getConvertedManaCost();
// assign damage to target
for (UUID targetId : targetPointer.getTargets(game, source)) {
Permanent targetedCreature = game.getPermanent(targetId);
if (targetedCreature != null) {
targetedCreature.damage(damage, source.getSourceId(), game, false, true);
} else {
Player targetedPlayer = game.getPlayer(targetId);
if (targetedPlayer != null) {
targetedPlayer.damage(damage, source.getSourceId(), game, false, true);
}
}
}
// move nonland card to hand
card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
// remove nonland card from revealed card list
cards.remove(card);
// put the rest of the cards on the bottom of the library in any order
return controller.putCardsOnBottomOfLibrary(cards, game, source, true);
}
// move nonland card to hand
card.moveToZone(Zone.HAND, id, game, true);
// remove nonland card from revealed card list
cards.remove(card);
// put the rest of the cards on the bottom of the library in any order
return player.putCardsOnBottomOfLibrary(cards, game, source, true);
return true;
}
return false;
}

View file

@ -28,6 +28,7 @@
package mage.cards.i;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.StormAbility;
@ -49,8 +50,7 @@ import mage.target.TargetPlayer;
public class IgniteMemories extends CardImpl {
public IgniteMemories(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{R}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}");
// Target player reveals a card at random from his or her hand. Ignite Memories deals damage to that player equal to that card's converted mana cost.
this.getSpellAbility().addTarget(new TargetPlayer());
@ -69,7 +69,6 @@ public class IgniteMemories extends CardImpl {
}
}
class IgniteMemoriesEffect extends OneShotEffect {
public IgniteMemoriesEffect() {
@ -83,13 +82,17 @@ class IgniteMemoriesEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player != null && !player.getHand().isEmpty()) {
Cards revealed = new CardsImpl();
Card card = player.getHand().getRandom(game);
revealed.add(card);
player.revealCards("Ignite Memories", revealed, game);
player.damage(card.getConvertedManaCost(), id, game, false, true);
Player controller = game.getPlayer(targetPointer.getFirst(game, source));
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
if (!controller.getHand().isEmpty()) {
Cards revealed = new CardsImpl();
Card card = controller.getHand().getRandom(game);
revealed.add(card);
controller.revealCards(sourceObject.getIdName(), revealed, game);
controller.damage(card.getConvertedManaCost(), source.getSourceId(), game, false, true);
}
return true;
}
return false;
@ -100,4 +103,4 @@ class IgniteMemoriesEffect extends OneShotEffect {
return new IgniteMemoriesEffect(this);
}
}
}

View file

@ -96,7 +96,7 @@ class MeglonothEffect extends OneShotEffect {
Permanent meglonoth = game.getPermanent(source.getSourceId());
Permanent blocked = game.getPermanent(targetPointer.getFirst(game, source));
if (blocked != null && meglonoth != null) {
game.getPlayer(blocked.getControllerId()).damage(meglonoth.getPower().getValue(), id, game, false, true);
game.getPlayer(blocked.getControllerId()).damage(meglonoth.getPower().getValue(), source.getSourceId(), game, false, true);
return true;
}
return false;

View file

@ -49,8 +49,7 @@ import mage.target.common.TargetOpponent;
public class PerishTheThought extends CardImpl {
public PerishTheThought(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{B}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}");
// Target opponent reveals his or her hand. You choose a card from it. That player shuffles that card into his or her library.
this.getSpellAbility().addEffect(new PerishTheThoughtEffect());
@ -68,9 +67,9 @@ public class PerishTheThought extends CardImpl {
}
class PerishTheThoughtEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("card in target opponent's hand");
public PerishTheThoughtEffect() {
super(Outcome.Neutral);
this.staticText = "Target opponent reveals his or her hand. You choose a card from it. That player shuffles that card into his or her library";
@ -99,7 +98,7 @@ class PerishTheThoughtEffect extends OneShotEffect {
Card chosenCard = targetOpponent.getHand().get(target.getFirstTarget(), game);
if (chosenCard != null) {
if (targetOpponent != null) {
chosenCard.moveToZone(Zone.LIBRARY, id, game, false);
chosenCard.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
targetOpponent.shuffleLibrary(source, game);
}
}

View file

@ -52,7 +52,7 @@ import mage.target.common.TargetCreatureOrPlayer;
public class RazorBoomerang extends CardImpl {
public RazorBoomerang(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
this.subtype.add("Equipment");
// Equipped creature has "{tap}, Unattach Razor Boomerang: Razor Boomerang deals 1 damage to target creature or player. Return Razor Boomerang to its owner's hand."
@ -105,7 +105,7 @@ class RazorBoomerangEffect extends OneShotEffect {
}
Permanent razor = game.getPermanent(attachmentid);
if (razor != null) {
razor.moveToZone(Zone.HAND, id, game, true);
razor.moveToZone(Zone.HAND, source.getSourceId(), game, true);
}
return true;
}

View file

@ -64,13 +64,14 @@ import mage.util.CardUtil;
public class ShellOfTheLastKappa extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell that targets you");
static {
filter.add(new TargetYouPredicate());
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
}
public ShellOfTheLastKappa(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
addSuperType(SuperType.LEGENDARY);
// {3}, {tap}: Exile target instant or sorcery spell that targets you.
@ -117,14 +118,14 @@ class ShellOfTheLastKappaEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
if (spell != null) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent == null) {
sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
}
if (sourcePermanent != null) {
game.getStack().counter(spell.getId(), source.getSourceId(), game);
Card card = spell.getCard();
card.moveToExile(CardUtil.getCardExileZoneId(game, source), sourcePermanent.getName(), id, game);
card.moveToExile(CardUtil.getCardExileZoneId(game, source), sourcePermanent.getName(), source.getSourceId(), game);
}
}
return false;
@ -164,7 +165,6 @@ class ShellOfTheLastKappaCastEffect extends OneShotEffect {
}
}
class TargetYouPredicate implements ObjectPlayerPredicate<ObjectPlayer<StackObject>> {
@Override