Fixed a bug in EntersTheBattlefield event of PermanentImpl using ownerId instead controller id. Fixes issue #133. Some minor formating.

This commit is contained in:
LevelX2 2013-02-14 12:58:04 +01:00
parent 58a05970e8
commit 1121c7c562
3 changed files with 14 additions and 8 deletions

View file

@ -29,9 +29,8 @@
package mage.sets.newphyrexia; package mage.sets.newphyrexia;
import java.util.UUID; import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -51,9 +50,13 @@ public class GitaxianProbe extends CardImpl<GitaxianProbe> {
super(ownerId, 35, "Gitaxian Probe", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{UP}"); super(ownerId, 35, "Gitaxian Probe", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{UP}");
this.expansionSetCode = "NPH"; this.expansionSetCode = "NPH";
this.color.setBlue(true); this.color.setBlue(true);
// Look at target player's hand.
this.getSpellAbility().addEffect(new GitaxianProbeEffect()); this.getSpellAbility().addEffect(new GitaxianProbeEffect());
this.getSpellAbility().addEffect(new DrawCardControllerEffect(1));
this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addTarget(new TargetPlayer());
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardControllerEffect(1));
} }
public GitaxianProbe (final GitaxianProbe card) { public GitaxianProbe (final GitaxianProbe card) {
@ -69,7 +72,7 @@ public class GitaxianProbe extends CardImpl<GitaxianProbe> {
class GitaxianProbeEffect extends OneShotEffect<GitaxianProbeEffect> { class GitaxianProbeEffect extends OneShotEffect<GitaxianProbeEffect> {
GitaxianProbeEffect() { GitaxianProbeEffect() {
super(Constants.Outcome.Detriment); super(Outcome.DrawCard);
staticText = "Look at target player's hand"; staticText = "Look at target player's hand";
} }

View file

@ -353,8 +353,11 @@ class JaceArchitectOfThoughtEffect3 extends OneShotEffect<JaceArchitectOfThought
Cards playerLibrary = new CardsImpl(); Cards playerLibrary = new CardsImpl();
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
playerLibrary.addAll(player.getLibrary().getCardList()); playerLibrary.addAll(player.getLibrary().getCardList());
String playerName = new StringBuilder(player.getName()).append("'s").toString();
TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard()); if (source.getControllerId().equals(player.getId())) {
playerName = "your";
}
TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard(new StringBuilder("nonland card from ").append(playerName).append(" library").toString()));
if (controller.choose(Constants.Outcome.Benefit, playerLibrary, target, game)) { if (controller.choose(Constants.Outcome.Benefit, playerLibrary, target, game)) {
UUID targetId = target.getFirstTarget(); UUID targetId = target.getFirstTarget();
Card card = player.getLibrary().remove(targetId, game); Card card = player.getLibrary().remove(targetId, game);

View file

@ -727,7 +727,7 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
@Override @Override
public void entersBattlefield(UUID sourceId, Game game) { public void entersBattlefield(UUID sourceId, Game game) {
controlledFromStartOfControllerTurn = false; controlledFromStartOfControllerTurn = false;
game.replaceEvent(GameEvent.getEvent(EventType.ENTERS_THE_BATTLEFIELD, objectId, sourceId, ownerId)); game.replaceEvent(GameEvent.getEvent(EventType.ENTERS_THE_BATTLEFIELD, objectId, sourceId, controllerId));
} }
@Override @Override