mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
- Fixed #5925 and related issues.
This commit is contained in:
parent
b2e4e950d0
commit
ca22a7750a
3 changed files with 34 additions and 26 deletions
|
@ -36,7 +36,7 @@ public final class SidisiUndeadVizier extends CardImpl {
|
|||
this.addAbility(new ExploitAbility());
|
||||
|
||||
// When Sidisi, Undead Vizier exploits a creature, you may search your library for a card, put it into your hand, then shuffle your library.
|
||||
this.addAbility(new ExploitCreatureTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterCard("a card")), false, true), false));
|
||||
this.addAbility(new ExploitCreatureTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterCard("card")), false, true), false));
|
||||
}
|
||||
|
||||
public SidisiUndeadVizier(final SidisiUndeadVizier card) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.MageObject;
|
||||
|
@ -8,6 +7,7 @@ import mage.constants.SetTargetPointer;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
|
@ -44,14 +44,18 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
if (event.getTargetId().equals(getSourceId()) && event.getSourceId().equals(getSourceId())) {
|
||||
if (!this.hasSourceObjectAbility(game, source, event)) {
|
||||
return false;
|
||||
Permanent sourcePermanent = null;
|
||||
if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
|
||||
sourcePermanent = game.getPermanent(getSourceId());
|
||||
} else {
|
||||
if (game.getShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
|
||||
sourcePermanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD);
|
||||
}
|
||||
this.setControllerId(event.getPlayerId());
|
||||
return true; // if Exploits creature sacrifices itself, exploit triggers
|
||||
}
|
||||
return super.isInUseableZone(game, source, event);
|
||||
if (sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
return hasSourceObjectAbility(game, sourcePermanent, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
@ -17,8 +18,6 @@ import mage.players.Player;
|
|||
* @author TheElk801
|
||||
*/
|
||||
public class GodEternalDiesTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
Boolean applied;
|
||||
|
||||
public GodEternalDiesTriggeredAbility() {
|
||||
super(Zone.ALL, null, true);
|
||||
|
@ -33,7 +32,7 @@ public class GodEternalDiesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
return zEvent.getFromZone() == Zone.BATTLEFIELD
|
||||
&& (zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& (zEvent.getToZone() == Zone.GRAVEYARD
|
||||
|| zEvent.getToZone() == Zone.EXILED);
|
||||
}
|
||||
return false;
|
||||
|
@ -41,24 +40,29 @@ public class GodEternalDiesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
applied = false;
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getTargetId().equals(this.getSourceId())) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(this.getSourceId());
|
||||
// for cases where its triggered ability is removed, ex: Kasmina's Transmutation
|
||||
if (permanent != null) {
|
||||
for (Ability a : permanent.getAbilities()) {
|
||||
if (a instanceof GodEternalDiesTriggeredAbility) {
|
||||
applied = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (applied) {
|
||||
this.getEffects().clear();
|
||||
this.addEffect(new GodEternalEffect(new MageObjectReference(zEvent.getTarget(), game)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
Permanent sourcePermanent = null;
|
||||
if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
|
||||
sourcePermanent = game.getPermanent(getSourceId());
|
||||
} else {
|
||||
if (game.getShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
|
||||
sourcePermanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD);
|
||||
}
|
||||
}
|
||||
return applied;
|
||||
if (sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
return hasSourceObjectAbility(game, sourcePermanent, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,8 +72,8 @@ public class GodEternalDiesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When {this} dies or is put into exile from the battlefield, " +
|
||||
"you may put it into its owner's library third from the top.";
|
||||
return "When {this} dies or is put into exile from the battlefield, "
|
||||
+ "you may put it into its owner's library third from the top.";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,4 +108,4 @@ class GodEternalEffect extends OneShotEffect {
|
|||
}
|
||||
return player.putCardOnTopXOfLibrary(card, game, source, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue