* Necropotence - Fixed that card name was shown as target for face down cards on stack or if player selects order of triggered effects.

This commit is contained in:
LevelX2 2014-06-20 01:04:28 +02:00
parent c08d266fce
commit e57aee7fcb
3 changed files with 19 additions and 9 deletions

View file

@ -28,18 +28,27 @@
package mage.view;
import mage.constants.Zone;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.cards.Card;
import mage.constants.Zone;
import static mage.constants.Zone.ALL;
import static mage.constants.Zone.BATTLEFIELD;
import static mage.constants.Zone.COMMAND;
import static mage.constants.Zone.EXILED;
import static mage.constants.Zone.GRAVEYARD;
import static mage.constants.Zone.STACK;
import mage.game.Game;
import mage.game.GameState;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.TargetPointer;
import java.util.*;
/**
*
* @author BetaSteward_at_googlemail.com
@ -81,11 +90,11 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
break;
}
if (sourceCard != null) {
AbilityView abilityView = new AbilityView(ability, sourceCard.getName(), new CardView(sourceCard));
AbilityView abilityView = new AbilityView(ability, sourceCard.getLogName(), new CardView(sourceCard));
if (ability.getTargets().size() > 0) {
abilityView.setTargets(ability.getTargets());
} else {
List<UUID> abilityTargets = new ArrayList<UUID>();
List<UUID> abilityTargets = new ArrayList<>();
for (Effect effect : ability.getEffects()) {
TargetPointer targetPointer = effect.getTargetPointer();
if (targetPointer != null) {
@ -95,11 +104,11 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
}
if (!abilityTargets.isEmpty()) {
abilityView.overrideTargets(abilityTargets);
List<String> names = new ArrayList<String>();
List<String> names = new ArrayList<>();
for (UUID uuid : abilityTargets) {
MageObject mageObject = game.getObject(uuid);
if (mageObject != null) {
names.add(mageObject.getName());
names.add(mageObject.getLogName());
}
}
if (!names.isEmpty()) {
@ -116,7 +125,7 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
for (Ability ability: abilities) {
Card sourceCard = state.getPermanent(ability.getSourceId());
if (sourceCard != null) {
this.put(ability.getId(), new AbilityView(ability, sourceCard.getName(), new CardView(sourceCard)));
this.put(ability.getId(), new AbilityView(ability, sourceCard.getLogName(), new CardView(sourceCard)));
}
}
}

View file

@ -90,7 +90,7 @@ public class StackAbilityView extends CardView {
for (UUID uuid : targetList) {
MageObject mageObject = game.getObject(uuid);
if (mageObject != null) {
names.add(mageObject.getName());
names.add(mageObject.getLogName());
}
}

View file

@ -139,6 +139,7 @@ class NecropotenceEffect extends OneShotEffect {
card.setFaceDown(true);
if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY)) {
Effect returnToHandeffect = new ReturnToHandTargetEffect();
returnToHandeffect.setText("put that face down card into your hand");
returnToHandeffect.setTargetPointer(new FixedTarget(card.getId()));
DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(returnToHandeffect, TargetController.YOU);
delayedAbility.setSourceId(source.getSourceId());