fixed Ob-Nixilis, Unshackled triggering when a player searches a library that isn't theirs (fixes #5303)

This commit is contained in:
Evan Kranzler 2018-09-25 11:27:37 -04:00
parent a41324b330
commit e63a00d6a4

View file

@ -1,7 +1,6 @@
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -25,14 +24,15 @@ import mage.game.events.GameEvent.EventType;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
*
* @author emerald000 * @author emerald000
*/ */
public final class ObNixilisUnshackled extends CardImpl { public final class ObNixilisUnshackled extends CardImpl {
public ObNixilisUnshackled(UUID ownerId, CardSetInfo setInfo) { public ObNixilisUnshackled(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.DEMON); this.subtype.add(SubType.DEMON);
@ -64,11 +64,11 @@ public final class ObNixilisUnshackled extends CardImpl {
class ObNixilisUnshackledTriggeredAbility extends TriggeredAbilityImpl { class ObNixilisUnshackledTriggeredAbility extends TriggeredAbilityImpl {
ObNixilisUnshackledTriggeredAbility() { public ObNixilisUnshackledTriggeredAbility() {
super(Zone.BATTLEFIELD, new ObNixilisUnshackledEffect(), false); super(Zone.BATTLEFIELD, new ObNixilisUnshackledEffect(), false);
} }
ObNixilisUnshackledTriggeredAbility(final ObNixilisUnshackledTriggeredAbility ability) { public ObNixilisUnshackledTriggeredAbility(final ObNixilisUnshackledTriggeredAbility ability) {
super(ability); super(ability);
} }
@ -85,7 +85,8 @@ class ObNixilisUnshackledTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Player controller = game.getPlayer(this.getControllerId()); Player controller = game.getPlayer(this.getControllerId());
if (controller != null && game.isOpponent(controller, event.getTargetId())) { if (controller != null && game.isOpponent(controller, event.getTargetId())
&& event.getTargetId().equals(event.getPlayerId())) {
getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
return true; return true;
} }
@ -102,12 +103,12 @@ class ObNixilisUnshackledEffect extends SacrificeEffect {
static private final FilterPermanent filter = new FilterControlledCreaturePermanent("creature"); static private final FilterPermanent filter = new FilterControlledCreaturePermanent("creature");
ObNixilisUnshackledEffect() { public ObNixilisUnshackledEffect() {
super(filter, 1, "that player"); super(filter, 1, "that player");
this.staticText = "that player sacrifices a creature and loses 10 life"; this.staticText = "that player sacrifices a creature and loses 10 life";
} }
ObNixilisUnshackledEffect(final ObNixilisUnshackledEffect effect) { public ObNixilisUnshackledEffect(final ObNixilisUnshackledEffect effect) {
super(effect); super(effect);
} }