- Added Life from the Loam (based on Ranger of Eos code). - Some other fixes (can't remember exactly).

This commit is contained in:
jendave
2011-08-06 04:41:36 +00:00
parent e2a5d87045
commit 226e335aac
5 changed files with 136 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
Life from the Loam
1 G
Sorcery
Return up to three target land cards from your graveyard to your hand.
Dredge 3
Sedraxis Specter
U B R
Creature Specter

View File

@@ -20895,6 +20895,105 @@ public class CardFactory implements NewConstants {
}//*************** END ************ END **************************
//*************** START *********** START **************************
if(cardName.equals("Life from the Loam")) {
final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = 9071771496065272936L;
@Override
public void resolve() {
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
CardList cards = new CardList(grave.getCards());
CardList lands = new CardList();
for(int i = 0; i < cards.size(); i++) {
if(cards.get(i).getType().contains("Land")) {
lands.add(cards.get(i));
}
}
String controller = card.getController();
if(lands.size() == 0) return;
if(controller.equals(Constant.Player.Human)) {
Object o = AllZone.Display.getChoiceOptional("Select First Land", lands.toArray());
if(o != null) {
//ability.setTargetCard((Card)o);
//AllZone.Stack.add(ability);
Card c1 = (Card) o;
grave.remove(c1);
hand.add(c1);
lands.remove(c1);
if(lands.size() == 0) return;
o = AllZone.Display.getChoiceOptional("Select Second Land", lands.toArray());
if(o != null) {
Card c2 = (Card) o;
grave.remove(c2);
hand.add(c2);
lands.remove(c2);
if(lands.size() == 0) return;
o = AllZone.Display.getChoiceOptional("Select Third Land", lands.toArray());
if(o != null) {
Card c3 = (Card) o;
grave.remove(c3);
hand.add(c3);
lands.remove(c3);
}
}
}
AllZone.GameAction.shuffle(controller);
} else //computer
{
lands.shuffle();
if(lands.size() >= 1) {
Card c1 = lands.getCard(0);
grave.remove(c1);
hand.add(c1);
lands.remove(c1);
if(lands.size() >= 1) {
Card c2 = lands.getCard(0);
grave.remove(c2);
hand.add(c2);
lands.remove(c2);
if(lands.size() >= 1) {
Card c3 = lands.getCard(0);
grave.remove(c3);
hand.add(c3);
lands.remove(c3);
}
}
}
//ability.setTargetCard(powerTwoCreatures.get(0));
//AllZone.Stack.add(ability);
AllZone.GameAction.shuffle(controller);
}
//...
}//resolve()
};
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
// Cards with Cycling abilities
// -1 means keyword "Cycling" not found
if(hasKeyword(card, "Cycling") != -1) {

View File

@@ -940,6 +940,7 @@ class CardFactory_Lands {
return c.getType().contains(land1[0]) || c.getType().contains(land2[0]);
}
});
if(super.canPlay() && list.size() > 0 && AllZone.GameAction.isCardInPlay(card)) return true;
else return false;
@@ -964,6 +965,12 @@ class CardFactory_Lands {
}
});
CardListUtil.sortBySelectable(full, land1[0]);
for (Card c:full)
System.out.println(c);
Object o = AllZone.Display.getChoiceOptional("Choose a " + land1[0] + " or " + land2[0],
full.toArray());
if(o != null) {

View File

@@ -208,6 +208,27 @@ public class CardListUtil
list.sort(com);
}
public static void sortBySelectable(CardList list, String type)
{
final String t = type;
Comparator<Card> com = new Comparator<Card>()
{
public int compare(Card a, Card b)
{
if( a.getType().contains(t) && b.getType().contains(t))
return 0;
else if(a.getKeyword().contains(t))
return 1;
else if(b.getKeyword().contains(t))
return -1;
return 0;
}
};
list.sort(com);
}
//Sorts from high to low
public static void sortCMC(CardList list)
{

View File

@@ -23,6 +23,8 @@ public class Input_Mulligan extends Input {
@Override
public void selectButtonCancel() {
AllZone.GameInfo.setHumanMulliganedToZero(false);
Card[] hand = AllZone.Human_Hand.getCards();
for(int i = 0; i < hand.length; i++) {
AllZone.Human_Library.add(hand[i]);
@@ -34,6 +36,7 @@ public class Input_Mulligan extends Input {
int newHand = hand.length - 1;
AllZone.GameInfo.addHumanNumberOfTimesMulliganed(1);
//System.out.println("Mulliganed this turn:" + AllZone.GameInfo.getHumanNumberOfTimesMulliganed());