- Black Lotus will get sacked before its ability resolves.

- Hopefully fixed Thopter Foundry for AI.
This commit is contained in:
jendave
2011-08-06 03:15:49 +00:00
parent f3383fa8c4
commit 6da0ac6b9e
8 changed files with 60 additions and 44 deletions

View File

@@ -1,6 +1,6 @@
program/mail=mtgerror@yahoo.com program/mail=mtgerror@yahoo.com
program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26 program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26
program/version=Forge -- official beta: 10/01/17, SVN revision: 295 program/version=Forge -- official beta: 10/01/17, SVN revision: 297
tokens--file=AllTokens.txt tokens--file=AllTokens.txt

View File

@@ -437,6 +437,19 @@ public class Card extends MyObservable
return res; return res;
} }
public ArrayList<SpellAbility> getAdditionalCostSpells()
{
ArrayList<SpellAbility> s = new ArrayList<SpellAbility>(spellAbility);
ArrayList<SpellAbility> res = new ArrayList<SpellAbility>();
for (SpellAbility sa : s)
{
if (sa.isSpell() && !sa.getAdditionalManaCost().equals("") )
res.add(sa);
}
return res;
}
//shield = regeneration //shield = regeneration
public void setShield(int n) {nShield = n;} public void setShield(int n) {nShield = n;}

View File

@@ -6216,6 +6216,7 @@ public class CardFactory implements NewConstants {
}//resolve() }//resolve()
};//SpellAbility };//SpellAbility
spell_two.setManaCost("4 U U"); spell_two.setManaCost("4 U U");
spell_two.setAdditionalManaCost("3");
spell_one.setDescription("Return target permanent to its owner's hand."); spell_one.setDescription("Return target permanent to its owner's hand.");
spell_two.setDescription("Buyback 3 - Pay 4 U U, put this card into your hand as it resolves."); spell_two.setDescription("Buyback 3 - Pay 4 U U, put this card into your hand as it resolves.");
@@ -6297,6 +6298,7 @@ public class CardFactory implements NewConstants {
} }
};//SpellAbility };//SpellAbility
spell_two.setManaCost("5 U"); spell_two.setManaCost("5 U");
spell_two.setAdditionalManaCost("5");
spell_one.setDescription("Draw a card."); spell_one.setDescription("Draw a card.");
spell_one.setStackDescription(cardName + " - " +card.getController() + " draws a card."); spell_one.setStackDescription(cardName + " - " +card.getController() + " draws a card.");
@@ -6414,6 +6416,7 @@ public class CardFactory implements NewConstants {
}//resolve() }//resolve()
};//SpellAbility };//SpellAbility
spell_two.setManaCost("4 G"); spell_two.setManaCost("4 G");
spell_two.setManaCost("4");
spell_one.setDescription("Target creature gets +2/+2 until end of turn."); spell_one.setDescription("Target creature gets +2/+2 until end of turn.");
spell_two.setDescription("Buyback 4 - Pay 4G, put this card into your hand as it resolves."); spell_two.setDescription("Buyback 4 - Pay 4G, put this card into your hand as it resolves.");
@@ -6494,6 +6497,7 @@ public class CardFactory implements NewConstants {
spell_one.setManaCost("B"); spell_one.setManaCost("B");
spell_two.setManaCost("4 B"); spell_two.setManaCost("4 B");
spell_two.setAdditionalManaCost("4");
spell_one.setDescription("Put a 1/1 black Rat token into play."); spell_one.setDescription("Put a 1/1 black Rat token into play.");
spell_two.setDescription("Buyback 4 - Pay 4B, put this card into your hand as it resolves."); spell_two.setDescription("Buyback 4 - Pay 4B, put this card into your hand as it resolves.");
@@ -6565,6 +6569,7 @@ public class CardFactory implements NewConstants {
spell_one.setManaCost("1 G"); spell_one.setManaCost("1 G");
spell_two.setManaCost("4 G"); spell_two.setManaCost("4 G");
spell_two.setAdditionalManaCost("3");
spell_one.setDescription("Put a 1/1 green Saproling token into play."); spell_one.setDescription("Put a 1/1 green Saproling token into play.");
spell_two.setDescription("Buyback 3 - Pay 4G, put this card into your hand as it resolves."); spell_two.setDescription("Buyback 3 - Pay 4G, put this card into your hand as it resolves.");
@@ -15609,7 +15614,7 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
//*************** START *********** START ************************** //*************** START *********** START **************************
else if (cardName.equals("Black Lotus")) else if (cardName.equals("Black Lotus"))
{ {
final SpellAbility ability = new Ability_Tap(card) final Ability_Tap ability = new Ability_Tap(card, "0")
{ {
private static final long serialVersionUID = 8394047173115959008L; private static final long serialVersionUID = 8394047173115959008L;
@@ -15646,12 +15651,26 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
mp.addExtrinsicKeyword("ManaPool:"+ color); mp.addExtrinsicKeyword("ManaPool:"+ color);
AllZone.GameAction.sacrifice(card); //AllZone.GameAction.sacrifice(card);
} }
} }
}; };
ability.setDescription("tap, Sacrifice Black Lotus: Add three mana of any one color to your mana pool."); ability.setDescription("tap, Sacrifice Black Lotus: Add three mana of any one color to your mana pool.");
ability.setStackDescription("Adds 3 mana of any one color to your mana pool"); ability.setStackDescription("Adds 3 mana of any one color to your mana pool");
Input sac = new Input()
{
private static final long serialVersionUID = -4503945947115838818L;
public void showMessage()
{
AllZone.GameAction.sacrifice(card);
ability.resolve();
stop();
}
};//Input
ability.setBeforePayMana(sac);
card.addSpellAbility(ability); card.addSpellAbility(ability);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -16421,6 +16440,7 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
}; };
kicker.setManaCost("8 W W W"); kicker.setManaCost("8 W W W");
kicker.setAdditionalManaCost("6");
kicker.setDescription("Kicker 6: If Conqueror's Pledge was kicked, put twelve of those tokens onto the battlefield instead."); kicker.setDescription("Kicker 6: If Conqueror's Pledge was kicked, put twelve of those tokens onto the battlefield instead.");
kicker.setStackDescription(card.getName() + " - " + card.getController() + " puts twelve 1/1 white Kor Soldier creature tokens onto the battlefield."); kicker.setStackDescription(card.getName() + " - " + card.getController() + " puts twelve 1/1 white Kor Soldier creature tokens onto the battlefield.");
@@ -16813,6 +16833,7 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
c = meek.get(0); c = meek.get(0);
else else
c = getArtifact(); c = getArtifact();
if (c != null)
setTargetCard(c); setTargetCard(c);
} }
@@ -16827,7 +16848,8 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
{ {
public boolean addCard(Card c) public boolean addCard(Card c)
{ {
return c.isArtifact() && !c.isToken() && (CardUtil.getConvertedManaCost(c.getManaCost()) <= 1 || c.getName().equals("Sword of the Meek")); return c.isArtifact() && !c.isToken() && (CardUtil.getConvertedManaCost(c.getManaCost()) <= 1 && !c.equals(card)
|| c.getName().equals("Sword of the Meek"));
} }
}); });
@@ -16837,13 +16859,13 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
} }
else else
return null; return null;
}//getAttacker() }
public boolean canPlayAI() public boolean canPlayAI()
{ {
String phase = AllZone.Phase.getPhase(); String phase = AllZone.Phase.getPhase();
return phase.equals(Constant.Phase.Main2); return phase.equals(Constant.Phase.Main2) && getArtifact() != null;
} }
public void resolve() public void resolve()

View File

@@ -19497,6 +19497,7 @@ public class CardFactory_Creatures {
}; };
kicker.setManaCost("B B B"); kicker.setManaCost("B B B");
kicker.setAdditionalManaCost("B");
kicker.setDescription("Kicker B"); kicker.setDescription("Kicker B");
kicker.setStackDescription(card.getName() + " - Creature 2/2 (Kicked)"); kicker.setStackDescription(card.getName() + " - Creature 2/2 (Kicked)");
card.addSpellAbility(kicker); card.addSpellAbility(kicker);

View File

@@ -645,39 +645,6 @@ class CardFactory_Lands {
a2[0].setDescription("tap: Target Assembly-Worker gets +1/+1 until end of turn."); a2[0].setDescription("tap: Target Assembly-Worker gets +1/+1 until end of turn.");
@SuppressWarnings("unused") // target unused
final Input target = new Input()
{
private static final long serialVersionUID = 8913477363141356082L;
public void showMessage()
{
ButtonUtil.enableOnlyCancel();
AllZone.Display.showMessage("Select Assembly-Worker to get +1/+1");
}
public void selectCard(Card c, PlayerZone zone)
{
if(!CardFactoryUtil.canTarget(card, c)){
AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?).");
}
else if(c.isCreature() && c.getType().contains("Assembly-Worker"))
{
card.tap();
AllZone.Human_Play.updateObservers();
a2[0].setTargetCard(c);//since setTargetCard() changes stack description
a2[0].setStackDescription(c +" gets +1/+1 until EOT");
AllZone.InputControl.resetInput();
AllZone.Stack.add(a2[0]);
}
}//selectCard()
public void selectButtonCancel()
{
card.untap();
stop();
}
};//Input target
a2[0].setBeforePayMana(CardFactoryUtil.input_targetType(a2[0], "Assembly-Worker")); a2[0].setBeforePayMana(CardFactoryUtil.input_targetType(a2[0], "Assembly-Worker"));
}//*************** END ************ END ************************** }//*************** END ************ END **************************

View File

@@ -1341,6 +1341,13 @@ private int getDifferentLand(CardList list, String land)
//SpellAbility[] choices = (SpellAbility[]) c.getSpells().toArray(); //SpellAbility[] choices = (SpellAbility[]) c.getSpells().toArray();
ArrayList<SpellAbility> choices = c.getBasicSpells(); ArrayList<SpellAbility> choices = c.getBasicSpells();
SpellAbility sa; SpellAbility sa;
//TODO: add Buyback, Kicker, ... , spells here
ArrayList<SpellAbility> additional = c.getAdditionalCostSpells();
for (SpellAbility s : additional)
{
}
/* /*
System.out.println(choices.length); System.out.println(choices.length);
for(int i = 0; i < choices.length; i++) for(int i = 0; i < choices.length; i++)

View File

@@ -147,7 +147,7 @@ public class GameActionUtil
public static void playCard_Cascade(Card c) public static void playCard_Cascade(Card c)
{ {
if (c.getKeyword().contains("Cascade") || c.getName().equals("Bituminous Blast")) if (c.getKeyword().contains("Cascade") || c.getName().equals("Bituminous Blast")) //keyword gets cleared for Bitumonous Blast
{ {
final String controller = c.getController(); final String controller = c.getController();
final PlayerZone lib = AllZone.getZone(Constant.Zone.Library, controller); final PlayerZone lib = AllZone.getZone(Constant.Zone.Library, controller);
@@ -181,7 +181,6 @@ public class GameActionUtil
AllZone.Display.getChoiceOptional("Revealed cards:", revealed.toArray()); AllZone.Display.getChoiceOptional("Revealed cards:", revealed.toArray());
if (cascadedCard != null && !cascadedCard.isUnCastable()) { if (cascadedCard != null && !cascadedCard.isUnCastable()) {
revealed.remove(cascadedCard);
if (cascadedCard.getController().equals(Constant.Player.Human)) if (cascadedCard.getController().equals(Constant.Player.Human))
{ {
@@ -191,8 +190,10 @@ public class GameActionUtil
q = AllZone.Display.getChoiceOptional("Cast " + cascadedCard.getName() + "?", choices); q = AllZone.Display.getChoiceOptional("Cast " + cascadedCard.getName() + "?", choices);
if (q != null) { if (q != null) {
if (q.equals("Yes")) if (q.equals("Yes")) {
AllZone.GameAction.playCardNoCost(cascadedCard); AllZone.GameAction.playCardNoCost(cascadedCard);
revealed.remove(cascadedCard);
}
} }
} }
else else
@@ -204,6 +205,7 @@ public class GameActionUtil
if (sa.canPlayAI()) if (sa.canPlayAI())
{ {
ComputerUtil.playStackFree(sa); ComputerUtil.playStackFree(sa);
revealed.remove(cascadedCard);
break; break;
} }
} }

View File

@@ -14,6 +14,7 @@ public abstract class SpellAbility
private String targetPlayer = ""; private String targetPlayer = "";
private String stackDescription = ""; private String stackDescription = "";
private String manaCost = ""; private String manaCost = "";
private String additionalManaCost= "";
private String type = "Intrinsic"; //set to Intrinsic by default private String type = "Intrinsic"; //set to Intrinsic by default
@@ -82,6 +83,9 @@ public void execute(Object o) {}};
public String getManaCost() {return manaCost;} public String getManaCost() {return manaCost;}
public void setManaCost(String cost) {manaCost = cost;} public void setManaCost(String cost) {manaCost = cost;}
public String getAdditionalManaCost() {return additionalManaCost;}
public void setAdditionalManaCost(String cost) { additionalManaCost = cost; }
public boolean isSpell() {return spell; } public boolean isSpell() {return spell; }
public boolean isAbility() {return ! isSpell(); } public boolean isAbility() {return ! isSpell(); }
public boolean isTapAbility() {return tapAbility;} public boolean isTapAbility() {return tapAbility;}