diff --git a/res/card-pictures.txt b/res/card-pictures.txt index c6f1ee7efb1..496c78fc37a 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 +kresh_the_bloodbraided.jpg http://www.wizards.com/global/images/magic/general/kresh_the_bloodbraided.jpg mind_peel.jpg http://www.wizards.com/global/images/magic/general/mind_peel.jpg grave_titan.jpg http://www.wizards.com/global/images/magic/general/grave_titan.jpg aether_adept.jpg http://www.wizards.com/global/images/magic/general/aether_adept.jpg diff --git a/res/cards.txt b/res/cards.txt index 13ab788a5ff..e26c8e61706 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,18 @@ +Soulcatcher +1 W +Creature Bird Soldier +no text +1/1 +WheneverKeyword:PermanentIntoGraveyard:Type/Creature:Play:+1+1 Counters/1:Self:ASAP:No_Condition:Initator - Has Keyword/Flying:Whenever a creature with flying is put into a graveyard from the battlefield, put a +1/+1 counter on Soulcatcher. +Flying + +Kresh the Bloodbraided +2 B R G +Legendary Creature Human Warrior +no text +3/3 +WheneverKeyword:PermanentIntoGraveyard:Type/Creature:Play:+1+1 Counters/Power:Self:ASAP:Yes_No:Initator - Other than Self:Whenever another creature is put into a graveyard from the battlefield, you may put X +1/+1 counters on Kresh the Bloodbraided, where X is that creature's power. + Mind Peel B Sorcery @@ -9871,14 +9886,6 @@ Enchantment no text Whenever a creature is put into a graveyard from the battlefield, that creature's controller may draw a card. -Soulcatcher -1 W -Creature Bird Soldier -no text -1/1 -Whenever a creature with flying is put into a graveyard from the battlefield, put a +1/+1 counter on Soulcatcher. -Flying - Dauthi Ghoul 1 B Creature Dauthi Zombie diff --git a/src/forge/Card.java b/src/forge/Card.java index 7695856f6c2..16c6b6a450a 100644 --- a/src/forge/Card.java +++ b/src/forge/Card.java @@ -537,7 +537,22 @@ public class Card extends MyObservable { for(int i = 0; i < keyword.size(); i++) { if(!keyword.get(i).toString().contains("CostChange")) { if(i != 0) sb.append(", "); - sb.append(keyword.get(i).toString()); + if(!keyword.get(i).toString().contains("WheneverKeyword")) sb.append(keyword.get(i).toString()); + else { + ArrayList a = getKeyword(); + int WheneverKeywords = 0; + int WheneverKeyword_Number[] = new int[a.size()]; + for(int x = 0; x < a.size(); x++) + if(a.get(x).toString().startsWith("WheneverKeyword")) { + WheneverKeyword_Number[WheneverKeywords] = x; + WheneverKeywords = WheneverKeywords + 1; + } + for(int CKeywords = 0; CKeywords < WheneverKeywords; CKeywords++) { + String parse = getKeyword().get(WheneverKeyword_Number[CKeywords]).toString(); + String k[] = parse.split(":"); + sb.append(k[9]); + } + } } } sb.append("\r\n"); diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index 2a93e72a3aa..55194af5853 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -718,7 +718,95 @@ public class GameAction { } }); + // Whenever Keyword + CardList Cards_In_Play = new CardList(); + Cards_In_Play.addAll(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards()); + Cards_In_Play.addAll(AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer).getCards()); + Cards_In_Play = Cards_In_Play.filter(new CardListFilter() { + public boolean addCard(Card c) { + if(c.getKeyword().toString().contains("WheneverKeyword")) return true; + return false; + } + }); + for(int i = 0; i < Cards_In_Play.size() ; i++) { + Card card = Cards_In_Play.get(i); + ArrayList a = card.getKeyword(); + int WheneverKeywords = 0; + int WheneverKeyword_Number[] = new int[a.size()]; + for(int x = 0; x < a.size(); x++) + if(a.get(x).toString().startsWith("WheneverKeyword")) { + WheneverKeyword_Number[WheneverKeywords] = x; + WheneverKeywords = WheneverKeywords + 1; + } + for(int CKeywords = 0; CKeywords < WheneverKeywords; CKeywords++) { + String parse = card.getKeyword().get(WheneverKeyword_Number[CKeywords]).toString(); + String k[] = parse.split(":"); + final String F_k[] = k; + if((k[1].equals("PermanentIntoGraveyard"))) // No Check Necessary as it is in GameAction + { + if(k[2].contains("Type")) { + String TypeParse = k[2]; + String Type[] = TypeParse.split("/"); + for(int z = 0; z < Type.length - 1; z++) if(!(c.getType()).contains(Type[z + 1])) k[4] = "Null"; + } + if(k[8].contains("Initator - Other than Self")) { + if(card.equals(c)) k[4] = "Null"; + } + if(k[8].contains("Initator - Has Keyword")) { + boolean Nullified = true; + String KeywordParse = k[8]; + String Keyword[] = KeywordParse.split("/"); + for(int z = 0; z < Keyword.length - 1; z++) if((c.getKeyword()).contains(Keyword[z + 1])) Nullified = false; + if(Nullified == true) k[4] = "Null"; + } + final Card crd = card; + final Card Destroyed = c; + if(k[4].contains("+1+1 Counters")) { + Card Target = null; + if(k[5].equals("Self")) Target = crd; + final Card F_Target = Target; + String AmountParse = k[4]; + String S_Amount = AmountParse.split("/")[1]; + int I_Amount = 0; + if(S_Amount.equals("Power")) I_Amount = Destroyed.getNetAttack(); + else I_Amount = Integer.valueOf(S_Amount); + final int F_Amount = I_Amount; + Ability ability = new Ability(Target, "0") { + @Override + public void resolve() { + boolean Go = true; + if(F_k[3].equals("Play")) { + PlayerZone Required_Zone = AllZone.getZone(Constant.Zone.Play, F_Target.getController()); + if(AllZone.GameAction.isCardInZone(F_Target,Required_Zone)) { + if(F_k[7].equals("Yes_No")) { + if(F_Target.getController().equals("Human")) { + Object[] possibleValues = {"Yes", "No"}; + Object q = JOptionPane.showOptionDialog(null, "Activate - " + F_Target.getName(),F_Target.getName() + " Ability", + JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, + null, possibleValues, possibleValues[0]); + if(q.equals(1)) { + Go = false; + } + } + } + if(Go == true) if(AllZone.GameAction.isCardInPlay(F_Target)) F_Target.addCounter(Counters.P1P1, F_Amount); + } + } + } + }; + ability.setStackDescription(Target.getName() + " - gets " + F_Amount + " +1/+1 counters."); + if(k[3].equals("Play")) { + PlayerZone Required_Zone = AllZone.getZone(Constant.Zone.Play, Target.getController()); + if(AllZone.GameAction.isCardInZone(Target,Required_Zone)) { + if(k[6].equals("ASAP")) AllZone.Stack.add(ability); + } + } + } + } + } + } + // Whenever Keyword for(int i = 0; i < list.size(); i++) GameActionUtil.executeDestroyCardEffects(list.get(i), c); for(int i = 0; i < grv.size(); i++) diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index bccd2f43197..984327ba50d 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -4205,8 +4205,6 @@ public class GameActionUtil { else if(c.getName().equals("Dingus Staff")) destroyCreature_Dingus_Staff(c, destroyed); else if(c.getName().equals("Dauthi Ghoul") && destroyed.getKeyword().contains("Shadow")) destroyCreature_Dauthi_Ghoul( c, destroyed); - else if(c.getName().equals("Soulcatcher") && destroyed.getKeyword().contains("Flying")) destroyCreature_Soulcatcher( - c, destroyed); else if(c.getName().equals("Prowess of the Fair") && destroyed.getType().contains("Elf") && !destroyed.isToken() && !c.equals(destroyed) && destroyed.getController().equals(c.getController())) destroyCreature_Prowess_of_the_Fair(c, @@ -4254,19 +4252,6 @@ public class GameActionUtil { AllZone.Stack.add(ability); } - private static void destroyCreature_Soulcatcher(Card c, Card destroyed) { - final Card crd = c; - Ability ability = new Ability(c, "0") { - @Override - public void resolve() { - if(AllZone.GameAction.isCardInPlay(crd)) crd.addCounter(Counters.P1P1, 1); - } - }; - - ability.setStackDescription("Soulcatcher - gets a +1/+1 counter."); - if(AllZone.GameAction.isCardInPlay(c)) AllZone.Stack.add(ability); - } - private static void destroyCreature_Prowess_of_the_Fair(Card c, Card destroyed) { final Card crd = c; final Card crd2 = c;