- Deleted the old spRaiseDead keyword code.

This commit is contained in:
jendave
2011-08-06 08:55:15 +00:00
parent 1243c45d42
commit ca2ba50e6a

View File

@@ -5474,170 +5474,7 @@ public class CardFactory implements NewConstants {
card.addSpellAbility(bbPump);
}
}
if(hasKeyword(card, "spRaiseDead") != -1) {
int n = hasKeyword(card, "spRaiseDead");
if(n != -1) {
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
String k[] = parse.split(":"); // charm descriptions will appear at k[2] and k[3]
final String kk[] = k[1].split("/"); // numCreatures = kk[0], other fields = kk[1] through kk[2]
int numFieldsKK = kk.length;
final int numCreatures = Integer.parseInt(kk[0]);
boolean quantifier = false;
String tmpTgt = "Creature";
for(int i = 2; i <= numFieldsKK; i++) {
if(kk[(i - 1)].equals("Some")) {
quantifier = true;
} else // can only be a specific creature type at his time, Goblin for goblin creatures and Tarfire
{
tmpTgt = kk[i - 1];
}
}
final String targetTypeToReturn = tmpTgt;
final boolean weReturnUpTo = quantifier;
final String spDesc[] = {"none"};
final String stDesc[] = {"none"};
if(k.length > 2) spDesc[0] = k[2];
if(k.length > 3) stDesc[0] = k[3];
final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = 6938982619919149188L;
@Override
public boolean canPlayAI() {
return getGraveCreatures().size() >= numCreatures;
}
CardList targets;
@Override
public void chooseTargetAI() {
CardList grave = getGraveCreatures();
targets = new CardList();
if(targetTypeToReturn.equals("Creature")) {
for(int i = 0; i < numCreatures; i++) {
Card c = CardFactoryUtil.AI_getBestCreature(grave);
targets.add(c);
grave.remove(c);
}
} else // this is for returning Goblins and Tarfire (and Changelings ?)
{
for(int i = 0; i < numCreatures; i++) {
Card c = CardFactoryUtil.getRandomCard(grave); // getRandomCard(grave);
targets.add(c);
grave.remove(c);
}
}
}
@Override
public void resolve() {
if(card.getController().equals(Constant.Player.Human)) {
CardList grave = getGraveCreatures();
targets = new CardList();
if(weReturnUpTo) // this is for spells which state Return up to X target creature card
{
for(int i = 0; i < numCreatures; i++) {
Card c = AllZone.Display.getChoiceOptional("Select card", grave.toArray());
targets.add(c);
grave.remove(c);
}
}
else if(grave.size() > numCreatures) // this is for spells which state Return target creature card
for(int i = 0; i < numCreatures; i++) {
Card c = AllZone.Display.getChoice("Select card", grave.toArray());
targets.add(c);
grave.remove(c);
}
else targets = grave;
}
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
for(Card c:targets)
if(AllZone.GameAction.isCardInZone(c, grave)) AllZone.GameAction.moveTo(hand, c);
}//resolve()
@Override
public boolean canPlay() {
if (weReturnUpTo) return true;
return getGraveCreatures().size() >= numCreatures;
}
CardList getGraveCreatures() {
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
CardList list = new CardList(grave.getCards());
String cardController = card.getController();
if(cardController.equals("Human") || (cardController.equals("Computer"))
&& (targetTypeToReturn.equals("Creature"))) {
list = list.getType(targetTypeToReturn);
} else // prevent the computer from using a Boggart Birth Rite to return a Boggart Birth Rite
{
CardList tempList;
tempList = list.getType(targetTypeToReturn);
list = new CardList();
for(int i = 0; i < tempList.size(); i++) {
if(!cardName.equals(tempList.get(i).getName())) {
list.add(tempList.get(i));
}
}
}
return list;
}
};//SpellAbility
if(spDesc[0].equals("none")) // create the card descriptiopn
{
spDesc[0] = ("Return ");
if(weReturnUpTo) {
spDesc[0] = (spDesc[0] + "up to ");
}
if(numCreatures > 1) {
spDesc[0] = (spDesc[0] + numCreatures + " ");
}
spDesc[0] = (spDesc[0] + "target ");
if(targetTypeToReturn.equals("Creature")) {
spDesc[0] = (spDesc[0] + "creature");
} else {
spDesc[0] = (spDesc[0] + targetTypeToReturn);
}
if(numCreatures > 1) {
spDesc[0] = (spDesc[0] + "s");
}
spDesc[0] = (spDesc[0] + " card");
if(numCreatures > 1) {
spDesc[0] = (spDesc[0] + "s");
}
spDesc[0] = (spDesc[0] + " from your graveyard to your hand.");
}
if(stDesc[0].equals("none")) // create the card stack descriptiopn
{
stDesc[0] = (card.getName() + " - returns target card");
if(numCreatures > 1) {
stDesc[0] = (stDesc[0] + "s");
}
stDesc[0] = (stDesc[0] + " from " + card.getController() + "'s graveyard to "
+ card.getController() + "'s hand.");
}
spell.setDescription(spDesc[0]);
spell.setStackDescription(stDesc[0]);
card.clearSpellAbility();
card.addSpellAbility(spell);
card.setSVar("PlayMain1", "TRUE");
}
}// spRaiseDead
}// spPumpTgt
while(shouldManaAbility(card) != -1) {