diff --git a/res/cardsfolder/l/lord_of_the_undead.txt b/res/cardsfolder/l/lord_of_the_undead.txt index 3f1134cae27..4e7385d01e9 100644 --- a/res/cardsfolder/l/lord_of_the_undead.txt +++ b/res/cardsfolder/l/lord_of_the_undead.txt @@ -4,9 +4,8 @@ Types:Creature Zombie Text:no text PT:2/2 S:Mode$ Continuous | Affected$ Creature.Zombie+Other | AddPower$ 1 | AddToughness$ 1 | Description$ Other Zombie creatures get +1/+1. -A:AB$ ChangeZone | Cost$ 1 B T | TgtPrompt$ Choose target Zombie card in your graveyard | ValidTgts$ Zombie.YouCtrl | Origin$ Graveyard | Destination$ Hand | SpellDescription$ Return target Zombie card from your graveyard to your hand. +A:AB$ ChangeZone | Cost$ 1 B T | TgtPrompt$ Choose target Zombie card in your graveyard | ValidTgts$ Zombie.YouOwn | Origin$ Graveyard | Destination$ Hand | SpellDescription$ Return target Zombie card from your graveyard to your hand. SVar:PlayMain1:TRUE -SVar:RemRandomDeck:True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/lord_of_the_undead.jpg SetInfo:8ED|Rare|http://magiccards.info/scans/en/8e/141.jpg diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java index fe0cbce094b..603373b9036 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java @@ -1446,8 +1446,6 @@ public final class AbilityFactoryChangeZone { final ZoneType origin = ZoneType.smartValueOf(params.get("Origin")); final ZoneType destination = ZoneType.smartValueOf(params.get("Destination")); - float pct = origin.equals(ZoneType.Battlefield) ? .8f : .667f; - final Random r = MyRandom.getRandom(); if (abCost != null) { @@ -1512,24 +1510,39 @@ public final class AbilityFactoryChangeZone { } final ArrayList objects = AbilityFactory.predictThreatenedObjects(af); - + boolean contains = false; for (final Card c : retrieval) { if (objects.contains(c)) { - pct = 1; + contains = true; } } - if (pct < 1) { + if (!contains) { return false; } } } + // don't return something to your hand if your hand is full of good stuff + if (destination.equals(ZoneType.Hand) && origin.equals(ZoneType.Graveyard)) { + int handSize = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand).size(); + if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN1)) { + return false; + } + if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) + && handSize > 1) { + return false; + } + if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(AllZone.getComputerPlayer()) + && handSize >= AllZone.getComputerPlayer().getMaxHandSize()) { + return false; + } + } final AbilitySub subAb = sa.getSubAbility(); if (subAb != null) { chance &= subAb.chkAIDrawback(); } - return ((r.nextFloat() < pct) && chance); + return (chance); } /** @@ -1583,6 +1596,7 @@ public final class AbilityFactoryChangeZone { subAffected = subParams.get("Defined"); } } + System.out.println("changeZone: " + origin + destination + source); if (tgt != null) { tgt.resetTargets(); @@ -1590,7 +1604,9 @@ public final class AbilityFactoryChangeZone { CardList list = AllZoneUtil.getCardsIn(origin); list = list.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), source); - list = list.getNotName(source.getName()); // Don't get the same card back. + if (source.isInZone(ZoneType.Hand)) { + list = list.getNotName(source.getName()); // Don't get the same card back. + } if (list.size() < tgt.getMinTargets(sa.getSourceCard(), sa)) { return false; @@ -1672,6 +1688,7 @@ public final class AbilityFactoryChangeZone { if (destination.equals(ZoneType.Hand)) { // only retrieve cards from computer graveyard list = list.getController(AllZone.getComputerPlayer()); + System.out.println("changeZone:" + list); } }