- Added Oath of Ghouls

- Cleaned up Code for Oversold Cemetery
This commit is contained in:
jendave
2011-08-06 05:03:50 +00:00
parent ad5e404068
commit 1811cbbfb6
5 changed files with 92 additions and 24 deletions

View File

@@ -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_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_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 snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg
oath_of_ghouls.jpg http://www.wizards.com/global/images/magic/general/oath_of_ghouls.jpg
darba.jpg http://www.wizards.com/global/images/magic/general/darba.jpg darba.jpg http://www.wizards.com/global/images/magic/general/darba.jpg
molting_harpy.jpg http://www.wizards.com/global/images/magic/general/molting_harpy.jpg molting_harpy.jpg http://www.wizards.com/global/images/magic/general/molting_harpy.jpg
phantasmal_forces.jpg http://www.wizards.com/global/images/magic/general/phantasmal_forces.jpg phantasmal_forces.jpg http://www.wizards.com/global/images/magic/general/phantasmal_forces.jpg

View File

@@ -1,3 +1,8 @@
Oath of Ghouls
1 B
Enchantment
At the beginning of each player's upkeep, that player chooses target player whose graveyard has fewer creature cards in it than his or her graveyard does and is his or her opponent. The first player may return a creature card from his or her graveyard to his or her hand.
Darba Darba
3 G 3 G
Creature Bird Beast Creature Bird Beast

View File

@@ -555,6 +555,7 @@ Noble Panther
Nova Chaser Nova Chaser
Novablast Wurm Novablast Wurm
Nyxathid Nyxathid
Oath of Ghouls
Oath of Druids Oath of Druids
Ob Nixilis, the Fallen Ob Nixilis, the Fallen
Obliterate Obliterate

View File

@@ -303,6 +303,18 @@ public class AllZoneUtil {
return cards; return cards;
} }
/**
* gets a list of all cards of a certain type that a given player has in graveyard
* @param player the player to check for cards in play
* @param cardType the card type to check for
* @return a CardList with all cards of a certain type the player has in graveyard
*/
public static CardList getPlayerTypeInGraveyard(final String player, final String cardType) {
CardList cards = getPlayerGraveyard(player);
cards = cards.getType(cardType);
return cards;
}
////////////// cardListFilter for different types ////////////// cardListFilter for different types
public static CardListFilter artifacts = new CardListFilter() { public static CardListFilter artifacts = new CardListFilter() {
public boolean addCard(Card c) { public boolean addCard(Card c) {
@@ -369,6 +381,25 @@ public class AllZoneUtil {
} }
} }
public static int CompareTypeAmountInPlay(final String player, String type)
{
// returns the difference between player's
String opponent = AllZone.GameAction.getOpponent(player);
CardList playerList = getPlayerTypeInPlay(player, type);
CardList opponentList = getPlayerTypeInPlay(opponent, type);
return (playerList.size() - opponentList.size());
}
public static int CompareTypeAmountInGraveyard(final String player, String type)
{
// returns the difference between player's
String opponent = AllZone.GameAction.getOpponent(player);
CardList playerList = getPlayerTypeInGraveyard(player, type);
CardList opponentList = getPlayerTypeInGraveyard(opponent, type);
return (playerList.size() - opponentList.size());
}
/** /**
* a CardListFilter to get all cards that are tapped * a CardListFilter to get all cards that are tapped
*/ */

View File

@@ -104,6 +104,7 @@ public class GameActionUtil {
upkeep_Karma(); upkeep_Karma();
upkeep_Defense_of_the_Heart(); upkeep_Defense_of_the_Heart();
upkeep_Oath_of_Druids(); upkeep_Oath_of_Druids();
upkeep_Oath_of_Ghouls();
upkeep_Mycoloth(); upkeep_Mycoloth();
upkeep_Spore_Counters(); upkeep_Spore_Counters();
upkeep_Vanishing(); upkeep_Vanishing();
@@ -4794,7 +4795,7 @@ public class GameActionUtil {
life.setLife(lifeGain); life.setLife(lifeGain);
} }
}; };
ability.setStackDescription("Landfall <20> Whenever a land enters the battlefield under your control, you may have your life total become the number of charge counters on Eternity Vessel."); ability.setStackDescription("Landfall: Whenever a land enters the battlefield under your control, you may have your life total become the number of charge counters on Eternity Vessel.");
if(c.getController().equals(Constant.Player.Human)) { if(c.getController().equals(Constant.Player.Human)) {
if(showLandfallDialog(c)) AllZone.Stack.add(ability); if(showLandfallDialog(c)) AllZone.Stack.add(ability);
@@ -6929,51 +6930,41 @@ public class GameActionUtil {
private static void upkeep_Oversold_Cemetery() { private static void upkeep_Oversold_Cemetery() {
final String player = AllZone.Phase.getActivePlayer(); final String player = AllZone.Phase.getActivePlayer();
PlayerZone playZone = AllZone.getZone(Constant.Zone.Play, player);
PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, player);
CardList creatures = new CardList(graveyard.getCards()); CardList graveyardCreatures = AllZoneUtil.getPlayerTypeInGraveyard(player, "Creature");
creatures = creatures.getType("Creature"); CardList cemeteryList = AllZoneUtil.getCardsInPlay("Oversold Cemetery");
CardList list = new CardList(playZone.getCards()); if(graveyardCreatures.size() >= 4) {
list = list.getName("Oversold Cemetery"); for(int i = 0; i < cemeteryList.size(); i++) {
Ability ability = new Ability(cemeteryList.get(0), "0") {
if(creatures.size() >= 4) {
for(int i = 0; i < list.size(); i++) {
Ability ability = new Ability(list.get(0), "0") {
@Override @Override
public void resolve() { public void resolve() {
CardList graveyardCreatures = AllZoneUtil.getPlayerTypeInGraveyard(player, "Creature");
PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, player); PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, player);
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player); PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player);
CardList creatures = new CardList(graveyard.getCards()); if(graveyardCreatures.size() >= 4) {
creatures = creatures.getType("Creature");
if(creatures.size() >= 4) {
if(player.equals("Human")) { if(player.equals("Human")) {
Object o = AllZone.Display.getChoiceOptional("Pick a creature to return to hand", Object o = AllZone.Display.getChoiceOptional("Pick a creature to return to hand",
creatures.toArray()); graveyardCreatures.toArray());
if(o != null) { if(o != null) {
Card card = (Card) o; Card card = (Card) o;
graveyard.remove(card); graveyard.remove(card);
hand.add(card); hand.add(card);
} }
} else if(player.equals("Computer")) { }
Card card = creatures.get(0); else if(player.equals("Computer")) {
Card card = graveyardCreatures.get(0);
graveyard.remove(card); graveyard.remove(card);
hand.add(card); hand.add(card);
} }
} }
} }
};// Ability };// Ability
ability.setStackDescription("Oversold Cemetary returns creature from the graveyard to its owner's hand."); ability.setStackDescription("Oversold Cemetary returns creature from the graveyard to its owner's hand.");
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
} }
}//Oversold Cemetery }//Oversold Cemetery
private static void upkeep_Reya() { private static void upkeep_Reya() {
@@ -7450,6 +7441,45 @@ public class GameActionUtil {
}// if }// if
}// upkeep_Oath of Druids() }// upkeep_Oath of Druids()
private static void upkeep_Oath_of_Ghouls() {
final String player = AllZone.Phase.getActivePlayer();
CardList oathList = AllZoneUtil.getCardsInPlay("Oath of Ghouls");
if (AllZoneUtil.CompareTypeAmountInGraveyard(player, "Creature") > 0)
{
for(int i = 0; i < oathList.size(); i++)
{
Ability ability = new Ability(oathList.get(0), "0") {
@Override
public void resolve() {
CardList graveyardCreatures = AllZoneUtil.getPlayerTypeInGraveyard(player, "Creature");
PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, player);
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player);
if(AllZoneUtil.CompareTypeAmountInGraveyard(player, "Creature") > 0) {
if(player.equals("Human")) {
Object o = AllZone.Display.getChoiceOptional("Pick a creature to return to hand",
graveyardCreatures.toArray());
if(o != null) {
Card card = (Card) o;
graveyard.remove(card);
hand.add(card);
}
}
else if(player.equals("Computer")) {
Card card = graveyardCreatures.get(0);
graveyard.remove(card);
hand.add(card);
}
}
}
};// Ability
ability.setStackDescription("At the beginning of each player's upkeep, Oath of Ghouls returns a creature from their graveyard to owner's hand if they have more than an opponent.");
AllZone.Stack.add(ability);
}
}
}//Oath of Ghouls
private static void upkeep_Karma() { private static void upkeep_Karma() {
final String player = AllZone.Phase.getActivePlayer(); final String player = AllZone.Phase.getActivePlayer();
String opponent = AllZone.GameAction.getOpponent(player); String opponent = AllZone.GameAction.getOpponent(player);