mirror of
https://github.com/correl/mage.git
synced 2025-04-10 01:01:05 -09:00
* Shallow Grave - Fixed that the delayed triggered ability did also effect the target if it changed zone meanwhile (fixes #1262).
This commit is contained in:
parent
7639f1bc6d
commit
63e25cf132
3 changed files with 58 additions and 52 deletions
Mage.Sets/src/mage/sets/mirage
Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords
Mage/src/mage/abilities/effects/common
|
@ -44,6 +44,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
|
@ -57,7 +58,6 @@ public class ShallowGrave extends CardImpl {
|
|||
super(ownerId, 39, "Shallow Grave", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{1}{B}");
|
||||
this.expansionSetCode = "MIR";
|
||||
|
||||
|
||||
// Return the top creature card of your graveyard to the battlefield. That creature gains haste until end of turn. Exile it at the beginning of the next end step.
|
||||
this.getSpellAbility().addEffect(new ShallowGraveEffect());
|
||||
|
||||
|
@ -101,7 +101,9 @@ class ShallowGraveEffect extends OneShotEffect {
|
|||
}
|
||||
if (lastCreatureCard != null) {
|
||||
if (controller.putOntoBattlefieldWithInfo(lastCreatureCard, game, Zone.GRAVEYARD, source.getSourceId())) {
|
||||
FixedTarget fixedTarget = new FixedTarget(lastCreatureCard.getId());
|
||||
Permanent returnedCreature = game.getPermanent(lastCreatureCard.getId());
|
||||
if (returnedCreature != null) {
|
||||
FixedTarget fixedTarget = new FixedTarget(returnedCreature, game);
|
||||
// Gains Haste
|
||||
ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
|
||||
hasteEffect.setTargetPointer(fixedTarget);
|
||||
|
@ -116,6 +118,7 @@ class ShallowGraveEffect extends OneShotEffect {
|
|||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -69,8 +69,8 @@ public class PersistTest extends CardTestPlayerBase {
|
|||
// Persist
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Safehold Elite");
|
||||
|
||||
// Exile target card from a graveyard. You gain 3 life.
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
// Exile target card from a graveyard. You gain 3 life.
|
||||
addCard(Zone.HAND, playerB, "Shadowfeed", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
|
||||
|
|
|
@ -25,15 +25,16 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -85,23 +86,25 @@ public class ExileTargetEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Set<Card> toExile = new LinkedHashSet<>();
|
||||
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
Zone currentZone = game.getState().getZone(permanent.getId());
|
||||
if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(Zone.BATTLEFIELD))) {
|
||||
controller.moveCardToExileWithInfo(permanent, exileId, exileZone, source.getSourceId(), game, currentZone, true);
|
||||
toExile.add(permanent);
|
||||
}
|
||||
} else {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
Zone currentZone = game.getState().getZone(card.getId());
|
||||
if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(currentZone))) {
|
||||
controller.moveCardToExileWithInfo(card, exileId, exileZone, source.getSourceId(), game, currentZone, true);
|
||||
toExile.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
controller.moveCardsToExile(toExile, source, game, true, exileId, exileZone);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue