Zada, Hedron Grinder - Fixed some problems with targeting handling (fixes #1790).

This commit is contained in:
LevelX2 2016-04-06 21:10:40 +02:00
parent 74c310de3e
commit c12157962d
2 changed files with 5 additions and 4 deletions

View file

@ -183,19 +183,20 @@ class ZadaHedronGrinderEffect extends OneShotEffect {
for (Permanent creature : game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { for (Permanent creature : game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
if (!creature.getId().equals(source.getSourceId()) && usedTarget.canTarget(source.getControllerId(), creature.getId(), source, game)) { if (!creature.getId().equals(source.getSourceId()) && usedTarget.canTarget(source.getControllerId(), creature.getId(), source, game)) {
Spell copy = spell.copySpell(source.getControllerId()); Spell copy = spell.copySpell(source.getControllerId());
game.getStack().push(copy);
setTarget: setTarget:
for (Mode mode : spell.getSpellAbility().getModes().getSelectedModes()) { for (Mode mode : copy.getSpellAbility().getModes().getSelectedModes()) {
for (Target target : mode.getTargets()) { for (Target target : mode.getTargets()) {
if (target.getClass().equals(usedTarget.getClass())) { if (target.getClass().equals(usedTarget.getClass())) {
target.clearChosen(); // For targets with Max > 1 we need to clear before the text is comapred target.clearChosen(); // For targets with Max > 1 we need to clear before the text is comapred
if (target.getMessage().equals(usedTarget.getMessage())) { if (target.getMessage().equals(usedTarget.getMessage())) {
target.add(creature.getId(), game); target.addTarget(creature.getId(), copy.getSpellAbility(), game, false);
break setTarget; break setTarget;
} }
} }
} }
} }
game.getStack().push(copy);
String activateMessage = copy.getActivatedMessage(game); String activateMessage = copy.getActivatedMessage(game);
if (activateMessage.startsWith(" casts ")) { if (activateMessage.startsWith(" casts ")) {
activateMessage = activateMessage.substring(6); activateMessage = activateMessage.substring(6);

View file

@ -105,7 +105,7 @@ class CreaturesYouControlBecomesTargetTriggeredAbility extends TriggeredAbilityI
if (object != null && object instanceof Spell) { if (object != null && object instanceof Spell) {
Card c = (Spell) object; Card c = (Spell) object;
if (c.getCardType().contains(CardType.INSTANT) || c.getCardType().contains(CardType.SORCERY)) { if (c.getCardType().contains(CardType.INSTANT) || c.getCardType().contains(CardType.SORCERY)) {
if (getTargets().size() == 0) { if (getTargets().isEmpty()) {
for (Effect effect : getEffects()) { for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId())); effect.setTargetPointer(new FixedTarget(event.getTargetId()));
} }