- Added Defiler of Souls.

This commit is contained in:
jendave
2011-08-06 09:45:10 +00:00
parent c962ec38ac
commit 5157fcef23
4 changed files with 66 additions and 53 deletions

1
.gitattributes vendored
View File

@@ -1032,6 +1032,7 @@ res/cardsfolder/defense_grid.txt -text svneol=native#text/plain
res/cardsfolder/defense_of_the_heart.txt -text svneol=native#text/plain
res/cardsfolder/defiant_elf.txt -text svneol=native#text/plain
res/cardsfolder/defiant_falcon.txt -text svneol=native#text/plain
res/cardsfolder/defiler_of_souls.txt -text svneol=native#text/plain
res/cardsfolder/deft_duelist.txt -text svneol=native#text/plain
res/cardsfolder/deglamer.txt -text svneol=native#text/plain
res/cardsfolder/dehydration.txt -text svneol=native#text/plain

View File

@@ -0,0 +1,9 @@
Name:Defiler of Souls
ManaCost:3 B B R
Types:Creature Demon
Text:At the beginning of each player's upkeep, that player sacrifices a monocolored creature.
PT:5/5
K:Flying
SVar:Rarity:Mythic
SVar:Picture:http://www.wizards.com/global/images/magic/general/defiler_of_souls.jpg
End

View File

@@ -339,59 +339,6 @@ public class CardList implements Iterable<Card> {
});
}//getValidCards
/* public CardList getValidCards(String Restrictions[]) {
CardList tmpList = new CardList(toArray());
CardList retList = new CardList();
for(int i = 0; i < Restrictions.length; i++) {
String incR[] = Restrictions[i].split("\\."); // Inclusive restrictions are Card types
if(!incR[0].equals("Permanent")) // Since the cards don't actually say "Permanent"
tmpList = getType(incR[0]); else tmpList = new CardList(toArray());
if(incR.length > 1) {
final String excR = incR[1];
tmpList = tmpList.filter(new CardListFilter() {
public boolean addCard(Card c) {
boolean r = true;
String exR[] = excR.split("\\+"); // Exclusive Restrictions are ...
for(int j = 0; j < exR.length; j++) {
if(exR[j].contains("White")
|| // ... Card colors
exR[j].contains("Blue") || exR[j].contains("Black") || exR[j].contains("Red")
|| exR[j].contains("Green") || exR[j].contains("Colorless")) if(exR[j].startsWith("non")) r = r
&& (!CardUtil.getColors(c).contains(exR[j].substring(3).toLowerCase()));
else r = r && (CardUtil.getColors(c).contains(exR[j].toLowerCase()));
else if(exR[j].contains("MultiColor")) // ... Card is multicolored
if(exR[j].startsWith("non")) r = r && (CardUtil.getColors(c).size() == 1);
else r = r && (CardUtil.getColors(c).size() > 1);
else if(exR[j].contains("with")) // ... Card keywords
if(exR[j].startsWith("without")) r = r
&& (!c.getKeyword().contains(exR[j].substring(7)));
else r = r && (c.getKeyword().contains(exR[j].substring(4)));
else if(exR[j].startsWith("tapped")) r = r && (c.isTapped());
else if(exR[j].startsWith("enchanted")) r = r && (c.isEnchanted());
else if(exR[j].startsWith("unenchanted")) r = r && (!c.isEnchanted());
else if(exR[j].startsWith("token")) r = r && (c.isToken());
//TODO: converted mana cost
//TODO: enchanting
//TODO: counters
else if(exR[j].startsWith("named")) //by name
r = r && (c.getName().equals(exR[j].substring(6)));
else if(exR[j].startsWith("non")) // ... Other Card types
r = r && (!c.getType().contains(exR[j].substring(3)));
else r = r && (c.getType().contains(exR[j]));
}
return r;
}
});
}
retList.addAll(tmpList.toArray());
}
if(retList.containsName("Mana Pool")) retList.remove("Mana Pool");
return retList;
}//getValidCards
*/
public CardList getEquipMagnets() {
return this.filter(new CardListFilter() {

View File

@@ -24,6 +24,7 @@ public class GameActionUtil {
AllZone.GameAction.CheckWheneverKeyword(AllZone.CardFactory.HumanNullCard, "BeginningOfUpkeep", null);
upkeep_The_Abyss();
upkeep_Defiler_of_Souls();
upkeep_Yawgmoth_Demon();
upkeep_Lord_of_the_Pit();
upkeep_Drop_of_Honey();
@@ -3468,6 +3469,61 @@ public class GameActionUtil {
return creats;
}
private static void upkeep_Defiler_of_Souls() {
/*
* At the beginning of each player's upkeep, destroy target
* nonartifact creature that player controls of his or her
* choice. It can't be regenerated.
*/
final Player player = AllZone.Phase.getActivePlayer();
final CardList defilers = AllZoneUtil.getCardsInPlay("Defiler of Souls");
for(Card c:defilers) {
final Card defiler = c;
final Ability sacrificeCreature = new Ability(defiler, "") {
@Override
public void resolve() {
if(player.equals(AllZone.HumanPlayer)) {
AllZone.InputControl.setInput( new Input() {
private static final long serialVersionUID = 8013298767165776609L;
public void showMessage() {
AllZone.Display.showMessage("Defiler of Souls - Select a monocolored creature to sacrifice");
ButtonUtil.disableAll();
}
public void selectCard(Card selected, PlayerZone zone) {
//probably need to restrict by controller also
if(selected.isCreature() && CardUtil.getColors(selected).size() == 1 && !selected.isColorless()
&& zone.is(Constant.Zone.Play) && zone.getPlayer().equals(AllZone.HumanPlayer)) {
AllZone.GameAction.sacrificeDestroy(selected);
stop();
}
}//selectCard()
});//Input
}
else { //computer
CardList targets = Defiler_of_Souls_getTargets(player,defiler);
Card target = CardFactoryUtil.AI_getWorstCreature(targets);
if(null == target) {
//must be nothing valid to destroy
}
else AllZone.GameAction.sacrificeDestroy(target);
}
}//resolve
};//sacrificeCreature
sacrificeCreature.setStackDescription("Defiler of Souls - Select a monocolored creature to sacrifice");
if(Defiler_of_Souls_getTargets(player,defiler).size() > 0)
AllZone.Stack.add(sacrificeCreature);
}//end for
}//The Abyss
private static CardList Defiler_of_Souls_getTargets(final Player player, Card card) {
CardList creats = AllZoneUtil.getCreaturesInPlay(player);
String mono[] = {"Creature.MonoColor"};
creats = creats.getValidCards(mono);
return creats;
}
private static void upkeep_Yawgmoth_Demon() {
/*
* At the beginning of your upkeep, you may sacrifice an artifact. If