diff --git a/.gitattributes b/.gitattributes index c7b267179af..e3435243cf8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4521,6 +4521,7 @@ res/cardsfolder/sunweb.txt -text svneol=native#text/plain res/cardsfolder/supreme_exemplar.txt -text svneol=native#text/plain res/cardsfolder/suqata_assassin.txt -text svneol=native#text/plain res/cardsfolder/suqata_lancer.txt -text svneol=native#text/plain +res/cardsfolder/surge_of_strength.txt -text svneol=native#text/plain res/cardsfolder/surging_aether.txt -text svneol=native#text/plain res/cardsfolder/surging_dementia.txt -text svneol=native#text/plain res/cardsfolder/surging_flame.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/braingeyser.txt b/res/cardsfolder/braingeyser.txt index fa9cde5b2cb..e171e85ae16 100644 --- a/res/cardsfolder/braingeyser.txt +++ b/res/cardsfolder/braingeyser.txt @@ -4,6 +4,7 @@ Types:Sorcery Text:no text A:SP$Draw | Cost$ X U U | NumCards$ X | ValidTgts$ Player | TgtPrompt$ Choose a player to draw X cards | SpellDescription$ Target player draws X cards. SVar:X:Count$xPaid +SVar:RemAIDeck:True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/braingeyser.jpg SetInfo:LEB|Rare|http://magiccards.info/scans/en/be/51.jpg diff --git a/res/cardsfolder/surge_of_strength.txt b/res/cardsfolder/surge_of_strength.txt new file mode 100644 index 00000000000..c582a3ab566 --- /dev/null +++ b/res/cardsfolder/surge_of_strength.txt @@ -0,0 +1,11 @@ +Name:Surge of Strength +ManaCost:R G +Types:Instant +Text:no text +A:SP$Pump | Cost$ R G Discard<1/Card.Green,Card.Red>| ValidTgts$ Creature | NumAtt$ +X | KW$ Trample | CostDesc$ As an additional cost to cast Surge of Strength, discard a red or green card.\n | SpellDescription$ Target creature gains trample and gets +X/+0 until end of turn, where X is that creature's converted mana cost. +SVar:X:Targeted$CardManaCost +SVar:RemAIDeck:True +SVar:Rarity:Uncommon +SVar:Picture:http://www.wizards.com/global/images/magic/general/surge_of_strength.jpg +SetInfo:ALL|Uncommon|http://magiccards.info/scans/en/ai/197.jpg +End \ No newline at end of file diff --git a/res/setInfoScript.py b/res/setInfoScript.py index d2d5c9ce206..630a2310c4e 100644 --- a/res/setInfoScript.py +++ b/res/setInfoScript.py @@ -199,6 +199,9 @@ cardDict = {} setStr = 'SetInfo:' for fileName in os.listdir(folder): + if fileName.startswith('.'): + continue + # parse cardsfolder for Card Lines and Rarity/Picture SVars. Filling in any gaps file = open(folder + '\\' + fileName) cleanName = fileName.replace('.txt', '') @@ -239,14 +242,14 @@ for fileName in os.listdir(folder): addSets(card) card.hasSet = True - file = open(folder + "/" + fileName, 'w') - file.write(card.lines) - if card.hasSet: - for s in card.sets.values(): - file.write('SetInfo:'+ s.set + '|' + s.rarity + '|' + s.image + '\n') - - file.write('End') - file.close() - err.write(card.name + '... Updated\n') + file = open(folder + "/" + fileName, 'w') + file.write(card.lines) + if card.hasSet: + for s in card.sets.values(): + file.write('SetInfo:'+ s.set + '|' + s.rarity + '|' + s.image + '\n') + + file.write('End') + file.close() + err.write(card.name + '... Updated\n') err.close() \ No newline at end of file diff --git a/src/forge/AbilityFactory.java b/src/forge/AbilityFactory.java index da021ec9a79..5bcf2ffa939 100644 --- a/src/forge/AbilityFactory.java +++ b/src/forge/AbilityFactory.java @@ -432,7 +432,8 @@ public class AbilityFactory { } public static int calculateAmount(Card card, String amount, SpellAbility ability){ - if (amount.matches("X")) + // amount can be anything, not just 'X' as long as sVar exists + if (!card.getSVar(amount).equals("")) { String calcX[] = card.getSVar(amount).split("\\$"); if (calcX.length == 1 || calcX[1].equals("none")) @@ -450,6 +451,11 @@ public class AbilityFactory { { return CardFactoryUtil.handlePaid(ability.getDiscardedCost(), calcX[1]); } + else if (ability != null && calcX[0].startsWith("Targeted")) + { + CardList list = new CardList(ability.getTarget().getTargetCards().toArray()); + return CardFactoryUtil.handlePaid(list, calcX[1]); + } else return 0; } diff --git a/src/forge/AbilityFactory_Pump.java b/src/forge/AbilityFactory_Pump.java index dd484e2d31e..ea77a7aa083 100644 --- a/src/forge/AbilityFactory_Pump.java +++ b/src/forge/AbilityFactory_Pump.java @@ -6,12 +6,11 @@ import java.util.Random; public class AbilityFactory_Pump { - private final int NumAttack[] = {-1138}; - private final int NumDefense[] = {-1138}; - private final String AttackX[] = {"none"}; - private final String DefenseX[] = {"none"}; private final ArrayList Keywords = new ArrayList(); + private String numAttack; + private String numDefense; + private AbilityFactory AF = null; private HashMap params = null; private Card hostCard = null; @@ -23,55 +22,15 @@ public class AbilityFactory_Pump { hostCard = AF.getHostCard(); - if (params.containsKey("NumAtt")) - { - String tmp = params.get("NumAtt"); - if(tmp.matches("[\\+\\-][XY]")) - { - String xy = hostCard.getSVar(tmp.replaceAll("[\\+\\-]", "")); - if(xy.startsWith("Count$")) { - String kk[] = xy.split("\\$"); - AttackX[0] = kk[1]; - - if(tmp.contains("-")) - { - if(AttackX[0].contains("/")) - AttackX[0] = AttackX[0].replace("/", "/Negative"); - else - AttackX[0] += "/Negative"; - } - } - } - else if(tmp.matches("[\\+\\-][0-9]")) - NumAttack[0] = Integer.parseInt(tmp.replace("+", "")); - - } + numAttack = (params.containsKey("NumAtt")) ? params.get("NumAtt") : "0"; + numDefense = (params.containsKey("NumDef")) ? params.get("NumDef") : "0"; - if (params.containsKey("NumDef")) - { - String tmp = params.get("NumDef"); - if(tmp.matches("[\\+\\-][XY]")) - { - String xy = hostCard.getSVar(tmp.replaceAll("[\\+\\-]", "")); - if(xy.startsWith("Count$")) { - String kk[] = xy.split("\\$"); - DefenseX[0] = kk[1]; - - if(tmp.contains("-")) - { - if(DefenseX[0].contains("/")) - DefenseX[0] = DefenseX[0].replace("/", "/Negative"); - else - DefenseX[0] += "/Negative"; - } - } - } - else if(tmp.matches("[\\+\\-][0-9]")) - NumDefense[0] = Integer.parseInt(tmp.replace("+", "")); - - } + // Start with + sign now optional + if (numAttack.startsWith("+")) + numAttack = numAttack.substring(1); + if (numDefense.startsWith("+")) + numDefense = numDefense.substring(1); - Keywords.add("none"); if (params.containsKey("KW")) { String tmp = params.get("KW"); @@ -81,6 +40,8 @@ public class AbilityFactory_Pump { for (int i=0; i params = af.getMapParams(); @@ -173,10 +173,11 @@ public class AbilityFactory_ZoneAffecting { int computerLibrarySize = AllZoneUtil.getCardsInZone(Constant.Zone.Library, AllZone.ComputerPlayer).size(); int computerMaxHandSize = AllZone.ComputerPlayer.getMaxHandSize(); - // todo: handle deciding what X would be around here for Braingeyser type cards + // todo: handle deciding what X would be around here for Braingeyser type cards int numCards = 1; if (params.containsKey("NumCards")) - numCards = Integer.parseInt(params.get("NumCards")); + numCards = AbilityFactory.calculateAmount(sa.getSourceCard(), params.get("NumCards"), sa); + if (tgt != null) { // ability is targeted @@ -218,7 +219,7 @@ public class AbilityFactory_ZoneAffecting { HashMap params = af.getMapParams(); Card source = sa.getSourceCard(); - int numCards = Integer.parseInt(params.get("NumCards")); + int numCards = AbilityFactory.calculateAmount(sa.getSourceCard(), params.get("NumCards"), sa); ArrayList tgtPlayers; diff --git a/src/forge/CardFactory_Sorceries.java b/src/forge/CardFactory_Sorceries.java index 4689ec123e4..24b32faba84 100644 --- a/src/forge/CardFactory_Sorceries.java +++ b/src/forge/CardFactory_Sorceries.java @@ -5113,35 +5113,6 @@ public class CardFactory_Sorceries { } //*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Braingeyser")) - { - final SpellAbility spell = new Spell(card){ - private static final long serialVersionUID = -7141472916367953810L; - - public void resolve() - { - Player player = getTargetPlayer(); - player.drawCards(card.getXManaCostPaid()); - card.setXManaCostPaid(0); - } - - public boolean canPlayAI() - { - final int maxX = ComputerUtil.getAvailableMana().size() - 1; - return maxX > 3 && AllZone.Computer_Hand.size() <= 3; - } - }; - spell.setDescription("Target player draws X cards."); - spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell)); - spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman()); - - card.clearSpellAbility(); - card.addSpellAbility(spell); - } - //*************** END ************ END ************************** - //*************** START *********** START ************************** else if (cardName.equals("Beacon of Creation"))