forked from External/mage
* Added logic to check if a card had a triggered ability in the graveyard if it was moved from graveyard to a hidden zone. Because if not, the ability does not trigger.
This commit is contained in:
parent
9110f70e2d
commit
ebdba3c57e
7 changed files with 173 additions and 32 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package mage.abilities;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.AbilityType;
|
||||
|
|
@ -10,9 +12,7 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -158,6 +158,17 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
|
|||
if (event != null && event.getTargetId() != null && event.getTargetId().equals(getSourceId())) {
|
||||
switch (event.getType()) {
|
||||
case ZONE_CHANGE:
|
||||
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
||||
if (event.getTargetId().equals(getSourceId()) && !zce.getToZone().isPublicZone()) {
|
||||
// If an ability triggers when the object that has it is put into a hidden zone from a graveyard,
|
||||
// that ability triggers from the graveyard, (such as Golgari Brownscale),
|
||||
// Yixlid Jailer will prevent that ability from triggering.
|
||||
if (zce.getFromZone().match(Zone.GRAVEYARD)) {
|
||||
if (!CardUtil.cardHadAbility(this, game.getLastKnownInformationCard(getSourceId(), zce.getFromZone()), getSourceId(), game)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
case DESTROYED_PERMANENT:
|
||||
if (isLeavesTheBattlefieldTrigger()) {
|
||||
if (event.getType() == EventType.DESTROYED_PERMANENT) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ class DredgeEffect extends ReplacementEffectImpl {
|
|||
public DredgeEffect(int value) {
|
||||
super(Duration.WhileInGraveyard, Outcome.AIDontUseIt);
|
||||
this.amount = value;
|
||||
this.staticText = new StringBuilder("Dredge ").append(Integer.toString(value)).append(" <i>(If you would draw a card, instead you may put exactly ").append(value).append(" card(s) from the top of your library into your graveyard. If you do, return this card from your graveyard to your hand. Otherwise, draw a card.)</i>").toString();
|
||||
this.staticText = ("Dredge ") + Integer.toString(value) + " <i>(If you would draw a card, instead you may put exactly "
|
||||
+ value + " card(s) from the top of your library into your graveyard. If you do, return this card from "
|
||||
+ "your graveyard to your hand. Otherwise, draw a card.)</i>";
|
||||
}
|
||||
|
||||
public DredgeEffect(final DredgeEffect effect) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue