From a20bae461a0a28ee715f0ce7ab5ad2ec71c7227b Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 05:07:23 +0000 Subject: [PATCH] 1) Added Ancient Runes. 2) Changed the code for Karma. --- res/card-pictures.txt | 1 + res/cards.txt | 5 +++ src/forge/GameActionUtil.java | 79 ++++++++++++++++++++++++++++++++++- 3 files changed, 83 insertions(+), 2 deletions(-) diff --git a/res/card-pictures.txt b/res/card-pictures.txt index a011b1148ec..d5dcf7d9092 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 +ancient_runes.jpg http://www.wizards.com/global/images/magic/general/ancient_runes.jpg vivid_crag.jpg http://www.wizards.com/global/images/magic/general/vivid_crag.jpg vivid_creek.jpg http://www.wizards.com/global/images/magic/general/vivid_creek.jpg vivid_grove.jpg http://www.wizards.com/global/images/magic/general/vivid_grove.jpg diff --git a/res/cards.txt b/res/cards.txt index f14f1547cbf..0a3e527558b 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,8 @@ +Ancient Runes +2 R +Enchantment +At the beginning of each player's upkeep, Ancient Runes deals damage to that player equal to the number of artifacts he or she controls. + Vivid Crag no cost Land diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index b07dca8edb4..146e677824a 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -101,6 +101,7 @@ public class GameActionUtil { upkeep_Convalescence(); upkeep_Convalescent_Care(); + upkeep_Ancient_Runes(); upkeep_Karma(); upkeep_Defense_of_the_Heart(); upkeep_Oath_of_Druids(); @@ -7431,7 +7432,80 @@ public class GameActionUtil { } } }//Oath of Ghouls - + + private static void upkeep_Ancient_Runes() { + final String player = AllZone.Phase.getActivePlayer(); + + CardList ancient_runes = new CardList(); + ancient_runes.addAll(AllZone.Human_Play.getCards()); + ancient_runes.addAll(AllZone.Computer_Play.getCards()); + ancient_runes = ancient_runes.getName("Ancient Runes"); + + PlayerZone activePlayZone = AllZone.getZone(Constant.Zone.Play, player); + CardList artifacts = new CardList(activePlayZone.getCards()); + artifacts = artifacts.getType("Artifact"); + + // determine how much damage to deal the current player + final int damage = artifacts.size(); + + // if there are 1 or more Ancient Runes on the + // battlefield have each of them deal damage. + if(0 < ancient_runes.size()) { + for(int i = 0; i < ancient_runes.size(); i++) { + Ability ability = new Ability(ancient_runes.get(0), "0") { + @Override + public void resolve() { + if(damage>0){ + PlayerLife life = AllZone.GameAction.getPlayerLife(player); + life.setLife(life.getLife() - damage); + } + } + };// Ability + if(damage>0){ + ability.setStackDescription("Ancient Runes deals " + damage + " damage to " + player); + AllZone.Stack.add(ability); + } + } + }// if + }// upkeep_Ancient_Runes() + + private static void upkeep_Karma() { + final String player = AllZone.Phase.getActivePlayer(); + + CardList karma = new CardList(); + karma.addAll(AllZone.Human_Play.getCards()); + karma.addAll(AllZone.Computer_Play.getCards()); + karma = karma.getName("Karma"); + + PlayerZone activePlayZone = AllZone.getZone(Constant.Zone.Play, player); + CardList swamps = new CardList(activePlayZone.getCards()); + swamps = swamps.getType("Swamp"); + + // determine how much damage to deal the current player + final int damage = swamps.size(); + + // if there are 1 or more Karmas on the + // battlefield have each of them deal damage. + if(0 < karma.size()) { + for(int i = 0; i < karma.size(); i++) { + Ability ability = new Ability(karma.get(0), "0") { + @Override + public void resolve() { + if(damage>0){ + PlayerLife life = AllZone.GameAction.getPlayerLife(player); + life.setLife(life.getLife() - damage); + } + } + };// Ability + if(damage>0){ + ability.setStackDescription("Karma deals " + damage + " damage to " + player); + AllZone.Stack.add(ability); + } + } + }// if + }// upkeep_Karma() + +/* private static void upkeep_Karma() { final String player = AllZone.Phase.getActivePlayer(); String opponent = AllZone.GameAction.getOpponent(player); @@ -7468,7 +7542,8 @@ public class GameActionUtil { } }// if }// upkeep_Karma() - +*/ + private static void upkeep_Convalescence() { final String player = AllZone.Phase.getActivePlayer(); PlayerZone playZone = AllZone.getZone(Constant.Zone.Play, player);