Fix game copy error with manifested non-creatures.

This commit is contained in:
Myrd
2015-02-16 07:43:34 +00:00
parent cbdfea1749
commit 4ac5d67a02
3 changed files with 86 additions and 24 deletions

View File

@@ -211,11 +211,14 @@ public class GameCopier {
newCard.setTapped(true);
}
if (c.isFaceDown()) {
boolean isCreature = newCard.isCreature();
newCard.setState(CardStateName.FaceDown, true);
if (c.isManifested()) {
newCard.setManifested(true);
// TODO: Should be able to copy other abilities...
newCard.addSpellAbility(CardFactoryUtil.abilityManifestFaceUp(newCard, newCard.getManaCost()));
if (isCreature) {
newCard.addSpellAbility(CardFactoryUtil.abilityManifestFaceUp(newCard, newCard.getManaCost()));
}
}
}
if (c.isMonstrous()) {

View File

@@ -18,7 +18,6 @@ import forge.game.player.Player;
import forge.game.spellability.Ability;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetChoices;
import forge.game.zone.ZoneType;
public class GameSimulator {
private static int MAX_DEPTH = 5;
@@ -120,17 +119,12 @@ public class GameSimulator {
private SpellAbility findSaInSimGame(SpellAbility sa) {
Card origHostCard = sa.getHostCard();
ZoneType zone = origHostCard.getZone().getZoneType();
for (Card c : simGame.getCardsIn(zone)) {
if (c.getController() != aiPlayer) {
continue;
}
if (c.getName().equals(origHostCard.getName())) {
for (SpellAbility cSa : c.getSpellAbilities()) {
if (cSa.getDescription().equals(sa.getDescription())) {
return cSa;
}
}
Card hostCard = (Card) copier.find(origHostCard);
// FIXME: This is a hack that makes testManifest pass - figure out why it's needed.
String desc = sa.getDescription().replace("Unmanifest {0}", "Unmanifest no cost");
for (SpellAbility cSa : hostCard.getSpellAbilities()) {
if (desc.equals(cSa.getDescription())) {
return cSa;
}
}
return null;