From 0993be4de3eb92f3e3769c91fe310bf0c0dec5c7 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 03:07:44 +0000 Subject: [PATCH] - Fixed some upkeep cards (didn't turn them into keywords for some reason). - Added Force of Nature, Cosmic Horror, Child of Gaea, Hungry Mist, Junun Efreet, Kami of the Tended Garden, Krosan Cloudshaper. --- res/cards.txt | 61 ++++++++++++- src/forge/Card.java | 5 ++ src/forge/GameActionUtil.java | 158 +++++++++++++++++++++++++++++++++- 3 files changed, 220 insertions(+), 4 deletions(-) diff --git a/res/cards.txt b/res/cards.txt index d3443fbd7a1..af9f80a173b 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,58 @@ +Cosmic Horror +3 B B B +Creature +If Cosmic is destroyed this way, it deals 7 damage to you. +7/7 +First Strike +At the beginning of your upkeep, destroy Cosmic Horror unless you pay:3 B B B + +Force of Nature +2 G G G G +Creature +no text +8/8 +Trample +At the beginning of your upkeep, Force of Nature deals 8 damage to you unless you pay:G G G G + +Krosan Cloudshaper +7 G G G +Creature Beast Mutant +no text +13/13 +At the beginning of your upkeep, sacrifice Krosan Cloudshaper unless you pay:G G +Morph:7 G G + +Kami of the Tended Garden +3 G +Creature Spirit +no text +4/4 +At the beginning of your upkeep, sacrifice Kami of the Tended Garden unless you pay:G +Soulshift:3 + +Junun Efreet +1 B B +Creature +no text +3/3 +Flying +At the beginning of your upkeep, sacrifice Junun Efreet unless you pay:B B + +Hungry Mist +2 G G +Creature Elemental +no text +6/2 +At the beginning of your upkeep, sacrifice Hungry Mist unless you pay:G G + +Child of Gaea +3 G G G +Creature Elemental +no text +7/7 +Trample +At the beginning of your upkeep, sacrifice Child of Gaea unless you pay:G G + Burning Fields 4 R Sorcery @@ -147,16 +202,18 @@ Cumulative upkeep:2 Drifting Djinn 4 U U Creature Djinn -At the beginning of your upkeep, sacrifice Drifting Djinn unless you pay:1 U +no text 5/5 Flying Cycling:2 +At the beginning of your upkeep, sacrifice Drifting Djinn unless you pay:1 U Drifter il-Dal U Creature Human Wizard -At the beginning of your upkeep, sacrifice Drifter il-Dal unless you pay:U +no text 2/1 +At the beginning of your upkeep, sacrifice Drifter il-Dal unless you pay:U Shadow Karmic Guide diff --git a/src/forge/Card.java b/src/forge/Card.java index 9b54815a6b5..35fd1f1a23e 100644 --- a/src/forge/Card.java +++ b/src/forge/Card.java @@ -71,6 +71,8 @@ public class Card extends MyObservable private int randomPicture = 0; + private int upkeepDamage = 0; + private int X = 0; private String owner = ""; @@ -795,6 +797,9 @@ public class Card extends MyObservable public void setRandomPicture(int n) { randomPicture = n; } public int getRandomPicture() { return randomPicture; } + public void setUpkeepDamage(int n) { upkeepDamage = n;} + public int getUpkeepDamage() { return upkeepDamage ;} + //public int getAttack(){return attack;} //for cards like Giant Growth, etc. diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 36256ebea00..78e511fd009 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -8,8 +8,10 @@ public class GameActionUtil { upkeep_removeDealtDamageToOppThisTurn(); - upkeep_UpkeepCost(); - upkeep_CumulativeUpkeepCost(); + upkeep_UpkeepCost(); //sacrifice unless upkeep cost is paid + upkeep_DestroyUpkeepCost(); //destroy unless upkeep cost is paid + upkeep_DamageUpkeepCost(); //deal damage unless upkeep cost is paid + upkeep_CumulativeUpkeepCost(); //sacrifice unless cumulative upkeep cost is paid upkeep_Echo(); upkeep_TabernacleUpkeepCost(); upkeep_MagusTabernacleUpkeepCost(); @@ -2812,7 +2814,159 @@ public class GameActionUtil } }//upkeepCost + public static void upkeep_DestroyUpkeepCost() + { + String player = AllZone.Phase.getActivePlayer(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + CardList list = new CardList(); + list.addAll(play.getCards()); + //list = list.getType("Creature"); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + ArrayList a = c.getKeyword(); + for (int i = 0; i < a.size(); i++) + { + if (a.get(i).toString().startsWith("At the beginning of your upkeep, destroy " +c.getName())) + { + String k[] = a.get(i).toString().split(":"); + c.setUpkeepCost(k[1]); + return true; + } + } + return false; + } + }); + + for (int i=0; i a = c.getKeyword(); + for (int i = 0; i < a.size(); i++) + { + if (a.get(i).toString().startsWith("At the beginning of your upkeep, " +c.getName() + " deals ")) + { + String k[] = a.get(i).toString().split("deals "); + String s1 = k[1].substring(0, 2); + s1 = s1.trim(); + c.setUpkeepDamage(Integer.parseInt(s1)); + System.out.println(k[1]); + String l[] = k[1].split("pay:"); + System.out.println(l[1]); + c.setUpkeepCost(l[1]); + + return true; + } + } + return false; + } + }); + + for (int i=0; i