- Added Sac-<Type> and Sac-CARDNAME to abPump keyword as a cost.

- Some of the inputs will now check if an ability has AfterPayMana for Sacrifice effects before putting the ability on the stack.
- Added Atog, Auratog, Foratog, Lithatog, Thaumatog, Megatog, Goblin Sledder, Need for Speed, Gruul Guildmage, Marsh Lurker, Plagued Rusalka, Deathspore Thallid, Thallid Devourer, Thallid Germinator, Vitaspore Thallid
- Updated Phyrexian Plaguelord to use updated abPump keyword
- Added rarity and pictures grabbed from Python Script
- Note: Deja Vu picture failed.
This commit is contained in:
jendave
2011-08-06 05:35:18 +00:00
parent 66acc22e4f
commit 12dbf81dae
13 changed files with 303 additions and 171 deletions

View File

@@ -951,14 +951,28 @@ public class CardFactory implements NewConstants {
if(Tgt[0]) tmpCost = k[0].substring(9);
else tmpCost = k[0].substring(6);
final boolean sacCost[] = {false};
boolean sacFirstCost = false;
final String sacType[] = {""};
boolean sacThis = false;
if(tmpCost.contains("Sac-")) {
sacCost[0] = true;
int sacPos = tmpCost.indexOf("Sac-");
sacType[0] = tmpCost.substring(sacPos).replace("Sac-", "").trim();
sacThis = (sacType[0].equals("CARDNAME"));
tmpCost = tmpCost.substring(0,sacPos-1).trim();
sacFirstCost = (tmpCost.length() == 0);
}
boolean tapCost = false;
boolean tapOnlyCost = false;
boolean tapFirstCost = false;
if(tmpCost.contains("T")) {
tapCost = true;
tmpCost = tmpCost.replace("T", "");
tmpCost = tmpCost.trim();
if(tmpCost.length() == 0) tapOnlyCost = true;
tapFirstCost = tmpCost.length() == 0;
}
final String manaCost = tmpCost.trim();
@@ -1097,10 +1111,28 @@ public class CardFactory implements NewConstants {
}
if(!d.equals("none")) {
if(tapOnlyCost == true) spDesc[0] = "Tap: " + d;
else if(tapCost == true) spDesc[0] = manaCost + ", tap: " + d;
else spDesc[0] = manaCost + ": " + d;
StringBuilder abCost = new StringBuilder();
abCost.append(manaCost);
if (tapCost){
if (tapFirstCost)
abCost.append("T");
else
abCost.append(", t");
abCost.append("ap");
}
if (sacCost[0]){
if (sacFirstCost)
abCost.append("S");
else
abCost.append(", s");
abCost.append("acrifice ");
if (!sacThis)
abCost.append("a ");
abCost.append(sacType[0]);
}
abCost.append(": ");
spDesc[0] = abCost + d;
stDesc[0] = d;
}
@@ -1129,6 +1161,8 @@ public class CardFactory implements NewConstants {
@Override
public boolean canPlayAI() {
if (sacCost[0]) return false;
defense = getNumDefense();
keyword = Keyword[0];
@@ -1192,7 +1226,8 @@ public class CardFactory implements NewConstants {
return false;
}
});
// list.remove(card); // if mana-only cost, allow self-target
if (sacCost[0] && sacType[0].equals("CARDNAME")) // if sacrifice <this>, don't self-target
list.remove(card);
return list;
}//getCreatures()
@@ -1251,6 +1286,12 @@ public class CardFactory implements NewConstants {
if(Tgt[0] == true) ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability));
else ability.setTargetCard(card);
if(sacCost[0]){
if (sacType[0].equals("CARDNAME"))
ability.setAfterPayMana(CardFactoryUtil.input_sacrificeThis(ability));
else
ability.setAfterPayMana(CardFactoryUtil.input_sacrificeType(ability, sacType[0], "Sacrifice a "+sacType[0]));
}
card.addSpellAbility(ability);
}
if(tapCost) {
@@ -1278,6 +1319,7 @@ public class CardFactory implements NewConstants {
@Override
public boolean canPlayAI() {
if (sacCost[0]) return false;
defense = getNumDefense();
keyword = Keyword[0];
@@ -1386,8 +1428,14 @@ public class CardFactory implements NewConstants {
if(Tgt[0] == true) ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability));
else ability.setTargetCard(card);
if(sacCost[0]){
if (sacType[0].equals("CARDNAME") || sacType[0].equals(card.getName()))
ability.setAfterPayMana(CardFactoryUtil.input_sacrificeThis(ability));
else
ability.setAfterPayMana(CardFactoryUtil.input_sacrificeType(ability, sacType[0], "Sacrifice a "+sacType[0]));
}
if(!tapOnlyCost) ability.setManaCost(manaCost);
if(!tapFirstCost && !sacFirstCost) ability.setManaCost(manaCost);
card.addSpellAbility(ability);
}

View File

@@ -518,6 +518,36 @@ public class CardFactoryUtil {
return target;
}//input_sacrifice()
public static Input input_sacrificeThis(final SpellAbility spell) {
Input target = new Input() {
private static final long serialVersionUID = 2685832214519141903L;
@Override
public void showMessage() {
Card card = spell.getSourceCard();
String[] choices = {"Yes", "No"};
if(card.getController().equals(Constant.Player.Human)) {
Object o = AllZone.Display.getChoice("Sacrifice " + card.getName() + " ?", choices);
if(o.equals("Yes")) {
sacrifice(card);
}
else{
//undo?
stop();
}
}
}
public void sacrifice(Card card)
{
AllZone.GameAction.sacrifice(card);
stop();
AllZone.Stack.add(spell);
}
};
return target;
}//input_sacrifice()
public static Input input_sacrificeType(final SpellAbility spell, final String type, final String message) {
// This input should be setAfterManaPaid so it can add the spell to the stack
Input target = new Input() {
@@ -2582,13 +2612,18 @@ public class CardFactoryUtil {
}
void done() {
if(spell instanceof Ability_Tap && spell.getManaCost().equals("0")) stopSetNext(new Input_NoCost_TapAbility(
(Ability_Tap) spell));
if(spell instanceof Ability_Tap && spell.getManaCost().equals("0"))
stopSetNext(new Input_NoCost_TapAbility((Ability_Tap) spell));
else if(spell.getManaCost().equals("0") || this.isFree())//for "sacrifice this card" abilities
{
this.setFree(false);
AllZone.Stack.add(spell, spell.getSourceCard().getManaCost().contains("X"));
stop();
if (spell.getAfterPayMana() == null){
this.setFree(false);
AllZone.Stack.add(spell, spell.getSourceCard().getManaCost().contains("X"));
stop();
}
else{
stopSetNext(spell.getAfterPayMana());
}
} else stopSetNext(new Input_PayManaCost(spell));
paid.execute();

View File

@@ -2213,150 +2213,6 @@ public class CardFactory_Creatures {
card.addComesIntoPlayCommand(intoPlay);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Phyrexian Plaguelord")) {
final SpellAbility negMajorBoost = new Ability_Tap(card, "0") {
private static final long serialVersionUID = -7797077528670642603L;
@Override
public void resolve() {
final Card[] target = new Card[1];
final Command untilEOT = new Command() {
private static final long serialVersionUID = 723868397363666853L;
public void execute() {
if(AllZone.GameAction.isCardInPlay(target[0])) {
target[0].addTempAttackBoost(4);
target[0].addTempDefenseBoost(4);
}
}
};
target[0] = getTargetCard();
if(AllZone.GameAction.isCardInPlay(target[0]) && CardFactoryUtil.canTarget(card, target[0])) {
target[0].addTempAttackBoost(-4);
target[0].addTempDefenseBoost(-4);
AllZone.EndOfTurn.addUntil(untilEOT);
}
}
@Override
public boolean canPlayAI() {
return false; // todo: don't want the AI just sacrificing creatures without a strong plan in place
}//canPlayAI()
};
Input majorTarget = new Input() {
private static final long serialVersionUID = 607823017778070255L;
@Override
public void showMessage() {
AllZone.Display.showMessage("Select target creature for " + card.getName());
ButtonUtil.enableOnlyCancel();
}
@Override
public void selectButtonCancel() {
stop();
}
@Override
public void selectCard(Card target, PlayerZone zone) {
// Choose a legal target, then sacrifice a creature
if (card.isUntapped()){
if(!CardFactoryUtil.canTarget(negMajorBoost, target)) {
AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?).");
}
else if(target.isCreature() && zone.is(Constant.Zone.Play)) {
card.tap();
AllZone.GameAction.sacrifice(card);
negMajorBoost.setTargetCard(target);
AllZone.Stack.add(negMajorBoost);
}
}
stop();
}
};//Input
negMajorBoost.setDescription("T, Sacrifice CARDNAME: Target creature gets -4/-4 until end of turn");
negMajorBoost.setBeforePayMana(majorTarget);
final SpellAbility negMinorBoost = new Ability(card, "0") {
@Override
public void resolve() {
final Card[] target = new Card[1];
final Command untilEOT = new Command() {
private static final long serialVersionUID = 723868397363666853L;
public void execute() {
if(AllZone.GameAction.isCardInPlay(target[0])) {
target[0].addTempAttackBoost(1);
target[0].addTempDefenseBoost(1);
}
}
};
target[0] = getTargetCard();
if(AllZone.GameAction.isCardInPlay(target[0]) && CardFactoryUtil.canTarget(card, target[0])) {
target[0].addTempAttackBoost(-1);
target[0].addTempDefenseBoost(-1);
AllZone.EndOfTurn.addUntil(untilEOT);
}
}
@Override
public boolean canPlayAI() {
return false; // todo: don't want the AI just sacrificing creatures without a strong plan in place
}//canPlayAI()
};
Input target = new Input() {
private static final long serialVersionUID = -5404464532726469761L;
@Override
public void showMessage() {
AllZone.Display.showMessage("Select target creature for " + card.getName());
ButtonUtil.enableOnlyCancel();
}
@Override
public void selectButtonCancel() {
stop();
}
@Override
public void selectCard(Card target, PlayerZone zone) {
// Choose a legal target, then sacrifice a creature
if(!CardFactoryUtil.canTarget(negMinorBoost, target)) {
AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?).");
} else if(target.isCreature() && zone.is(Constant.Zone.Play)) {
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
CardList creatures = new CardList(play.getCards());
creatures = creatures.getType("Creature");
if (creatures.size() == 0) stop();
Object choice = AllZone.Display.getChoiceOptional("Select Creature to Sacrifice", creatures.toArray());
if (choice == null) stop();
Card sac = (Card) choice;
if(AllZone.GameAction.isCardInPlay(sac)) {
AllZone.GameAction.sacrifice(sac);
negMinorBoost.setTargetCard(target);
AllZone.Stack.add(negMinorBoost);
}
stop();
}
}
};//Input
negMinorBoost.setDescription("Sacrifice a creature: Target creature gets -1/-1 until end of turn");
negMinorBoost.setBeforePayMana(target);
card.addSpellAbility(negMajorBoost);
card.addSpellAbility(negMinorBoost);
} //*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Cao Ren, Wei Commander")) {
final SpellAbility ability = new Ability(card, "0") {

View File

@@ -3325,14 +3325,18 @@ public class GameAction {
manaCost = GetSpellCostChange(sa);
}
if(manaCost.isPaid() && sa.getBeforePayMana() == null) {
CardList HHandList = new CardList(AllZone.getZone(Constant.Zone.Hand, Constant.Player.Human).getCards());
if(HHandList.contains(sa.getSourceCard())) AllZone.Human_Hand.remove(sa.getSourceCard());
AllZone.Stack.add(sa);
if(sa.isTapAbility() && !sa.wasCancelled()) sa.getSourceCard().tap();
if(sa.isUntapAbility()) sa.getSourceCard().untap();
return;
if (sa.getAfterPayMana() == null){
CardList HHandList = new CardList(AllZone.getZone(Constant.Zone.Hand, Constant.Player.Human).getCards());
if(HHandList.contains(sa.getSourceCard())) AllZone.Human_Hand.remove(sa.getSourceCard());
AllZone.Stack.add(sa);
if(sa.isTapAbility() && !sa.wasCancelled()) sa.getSourceCard().tap();
if(sa.isUntapAbility()) sa.getSourceCard().untap();
return;
}
else
AllZone.InputControl.setInput(sa.getAfterPayMana());
}
if(sa.getBeforePayMana() == null) AllZone.InputControl.setInput(new Input_PayManaCost(sa));
else if(sa.getBeforePayMana() == null) AllZone.InputControl.setInput(new Input_PayManaCost(sa));
else AllZone.InputControl.setInput(sa.getBeforePayMana());
}

View File

@@ -16,8 +16,13 @@ public class Input_NoCost_TapAbility extends Input {
//prevents this from running multiple times, which it is for some reason
if(ability.getSourceCard().isUntapped()) {
ability.getSourceCard().tap();
AllZone.Stack.add(ability);
stopSetNext(new ComputerAI_StackNotEmpty());
if (ability.getAfterPayMana() == null)
{
AllZone.Stack.add(ability);
stopSetNext(new ComputerAI_StackNotEmpty());
}
else
stopSetNext(ability.getAfterPayMana());
}
}
}