From 4f7d13ccbc1f2b9ab6db80a941bf282fde745c14 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 04:40:38 +0000 Subject: [PATCH] Added Sovereigns of Lost Alara and fixed AI targeting for Temporal Fissure --- res/card-pictures.txt | 1 + res/cards.txt | 7 +++++ res/gui/display_layout.xml | 34 +++++++++++------------ src/forge/CardFactory.java | 4 +-- src/forge/CombatUtil.java | 51 +++++++++++++++++++++++++++++++++++ src/forge/GameActionUtil.java | 15 +++++++++-- 6 files changed, 91 insertions(+), 21 deletions(-) diff --git a/res/card-pictures.txt b/res/card-pictures.txt index a4e9eaca3bd..72dafe4f816 100644 --- a/res/card-pictures.txt +++ b/res/card-pictures.txt @@ -38,6 +38,7 @@ snow_covered_mountain.jpg http://www.wizards.com/global/images/magic/gene snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg +sovereigns_of_lost_alara.jpg http://www.wizards.com/global/images/magic/general/sovereigns_of_lost_alara.jpg avatar_of_will.jpg http://www.wizards.com/global/images/magic/general/avatar_of_will.jpg minds_desire.jpg http://www.wizards.com/global/images/magic/general/minds_desire.jpg wing_shards.jpg http://www.wizards.com/global/images/magic/general/wing_shards.jpg diff --git a/res/cards.txt b/res/cards.txt index dc256316da5..252efef1397 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,10 @@ +Sovereigns of Lost Alara +4 W U +Creature Spirit +Whenever a creature you control attacks alone, you may search your library for an Aura card that could enchant that creature, put it into play attached to that creature, then shuffle your library. +4/5 +Exalted + Avatar of Will 6 U U Creature Avatar diff --git a/res/gui/display_layout.xml b/res/gui/display_layout.xml index 898a9aef01e..472862a85b6 100644 --- a/res/gui/display_layout.xml +++ b/res/gui/display_layout.xml @@ -28,7 +28,7 @@ 0 0 306 - 179 + 147 @@ -47,7 +47,7 @@ 0 - 179 + 147 306 10 @@ -62,9 +62,9 @@ 0 - 189 + 157 306 - 210 + 307 @@ -83,7 +83,7 @@ 0 - 399 + 464 306 10 @@ -98,9 +98,9 @@ 0 - 409 + 474 306 - 156 + 124 @@ -119,7 +119,7 @@ 0 - 565 + 598 306 10 @@ -134,9 +134,9 @@ 0 - 575 + 608 306 - 190 + 158 @@ -155,7 +155,7 @@ 0 - 765 + 766 306 10 @@ -170,9 +170,9 @@ 0 - 775 + 776 306 - 220 + 219 @@ -437,7 +437,7 @@ 1580 0 340 - 444 + 445 @@ -456,7 +456,7 @@ 1580 - 444 + 445 340 10 @@ -471,9 +471,9 @@ 1580 - 454 + 455 340 - 541 + 540 diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 460732e00d7..a1be8428b2c 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -7362,8 +7362,8 @@ public class CardFactory implements NewConstants { CardList human3 = CardFactoryUtil.AI_getHumanEnchantment(card, true); CardList human4 = CardFactoryUtil.getLandsInPlay(player); if(human != null) setTargetCard(CardFactoryUtil.AI_getBestCreature(human)); - else if(human2 != null) setTargetCard(CardFactoryUtil.AI_getBestArtifact(human)); - else if(human3 != null) setTargetCard(CardFactoryUtil.AI_getBestEnchantment(human,card, true)); + else if(human2 != null) setTargetCard(CardFactoryUtil.AI_getBestArtifact(human2)); + else if(human3 != null) setTargetCard(CardFactoryUtil.AI_getBestEnchantment(human3,card, true)); else if(human4 != null) setTargetCard(CardFactoryUtil.AI_getBestLand(human4)); } diff --git a/src/forge/CombatUtil.java b/src/forge/CombatUtil.java index 4ca9269dbef..4d96ccc273c 100644 --- a/src/forge/CombatUtil.java +++ b/src/forge/CombatUtil.java @@ -2225,8 +2225,59 @@ public class CombatUtil { ability3.setStackDescription(c + " - (Exalted) gets Lifelink until EOT."); AllZone.Stack.add(ability3); } + if(GameActionUtil.get_Sovereigns_of_Lost_Alaras(phasingPlayer) > 0) { + for(int i = 0; i < GameActionUtil.get_Sovereigns_of_Lost_Alaras(phasingPlayer); i++) { + final Card attacker = c; + Ability ability4 = new Ability(c, "0") { + @Override + public void resolve() { + PlayerZone library = AllZone.getZone(Constant.Zone.Library, attacker.getController()); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, attacker.getController()); + + CardList enchantments = new CardList(library.getCards()); + + enchantments = enchantments.filter(new CardListFilter() { + public boolean addCard(Card c) { + ArrayList keywords = c.getKeyword(); + for(String keyword:keywords) { + if(keyword.startsWith("Enchant " + "creature")) { + if(c.isEnchantment()) return true; + } + } + return false; + } + }); + String player = attacker.getController(); + Card Enchantment = null; + if(player == "Human"){ + Card[] Target = new Card[enchantments.size()]; + for(int i = 0; i < enchantments.size(); i++) { + Card crd = enchantments.get(i); + Target[i] = crd; + } + Object check = AllZone.Display.getChoiceOptional("Select enchantment to enchant exalted creature", Target); + if(check != null) { + Enchantment = ((Card) check); + } + } else { + Enchantment = CardFactoryUtil.AI_getBestEnchantment(enchantments,attacker, false); + } + if(Enchantment != null && AllZone.GameAction.isCardInPlay(attacker)){ + library.remove(Enchantment); + play.add(Enchantment); + Enchantment.enchantCard(attacker); + if(player == "Human") AllZone.GameAction.shuffle(attacker.getController()); + } + + }//resolve + };// ability4 + ability4.setStackDescription(c + " - (Exalted) searches library for an Aura card that could enchant that creature, put it into play attached to that creature, then shuffles library. "); + AllZone.Stack.add(ability4); + } // For + } } + /////////////////////////Rampage /** * executes rampage abilities for a given card diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 8fdc87de78b..22b18c96665 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -742,8 +742,8 @@ public class GameActionUtil { CardList human3 = CardFactoryUtil.AI_getHumanEnchantment(StormCard, true); CardList human4 = CardFactoryUtil.getLandsInPlay(player); if(human != null) setTargetCard(CardFactoryUtil.AI_getBestCreature(human)); - else if(human2 != null) setTargetCard(CardFactoryUtil.AI_getBestArtifact(human)); - else if(human3 != null) setTargetCard(CardFactoryUtil.AI_getBestEnchantment(human,StormCard, true)); + else if(human2 != null) setTargetCard(CardFactoryUtil.AI_getBestArtifact(human2)); + else if(human3 != null) setTargetCard(CardFactoryUtil.AI_getBestEnchantment(human3,StormCard, true)); else if(human4 != null) setTargetCard(CardFactoryUtil.AI_getBestLand(human4)); } @@ -3664,7 +3664,18 @@ public class GameActionUtil { return cards.size(); } + + public static int get_Sovereigns_of_Lost_Alaras(String player) { + PlayerZone playerZone = AllZone.getZone(Constant.Zone.Play, player); + CardList cards = new CardList(); + cards.addAll(playerZone.getCards()); + + cards = cards.getName("Sovereigns of Lost Alara"); + + return cards.size(); + } + public static int countFinestHours(String controller) { PlayerZone playerZone = AllZone.getZone(Constant.Zone.Play, controller);