mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- SetInfo Script will now skip .svn file it will also only overwrite data files that it has grabbed Set Info for.
- Pump and Draw can now handle variable Amounts for attack/defense boost or cards drawn. - Removed Braingeyser from AI Decks until AF_Draw can learn how to play it better. (The Code block was forcing the Human to draw anyway) - Added Targeted to AF.calculateAmount() - Added Surge of Strength
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
11
res/cardsfolder/surge_of_strength.txt
Normal file
11
res/cardsfolder/surge_of_strength.txt
Normal file
@@ -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
|
||||
@@ -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()
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<String> Keywords = new ArrayList<String>();
|
||||
|
||||
private String numAttack;
|
||||
private String numDefense;
|
||||
|
||||
private AbilityFactory AF = null;
|
||||
private HashMap<String,String> 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<kk.length; i++)
|
||||
Keywords.add(kk[i]);
|
||||
}
|
||||
else
|
||||
Keywords.add("none");
|
||||
}
|
||||
|
||||
public SpellAbility getSpell()
|
||||
@@ -137,7 +98,7 @@ public class AbilityFactory_Pump {
|
||||
if (!ComputerUtil.canPayCost(this))
|
||||
return false;
|
||||
|
||||
int defense = getNumDefense();
|
||||
int defense = getNumDefense(this);
|
||||
|
||||
if(AllZone.Phase.getPhase().equals(Constant.Phase.Main2)) return false;
|
||||
|
||||
@@ -189,24 +150,12 @@ public class AbilityFactory_Pump {
|
||||
return abPump;
|
||||
}
|
||||
|
||||
private int getNumAttack() {
|
||||
if(NumAttack[0] != -1138)
|
||||
return NumAttack[0];
|
||||
|
||||
if(!AttackX[0].equals("none"))
|
||||
return CardFactoryUtil.xCount(hostCard, AttackX[0]);
|
||||
|
||||
return 0;
|
||||
private int getNumAttack(SpellAbility sa) {
|
||||
return AbilityFactory.calculateAmount(hostCard, numAttack, sa);
|
||||
}
|
||||
|
||||
private int getNumDefense() {
|
||||
if(NumDefense[0] != -1138)
|
||||
return NumDefense[0];
|
||||
|
||||
if(!DefenseX[0].equals("none"))
|
||||
return CardFactoryUtil.xCount(hostCard, DefenseX[0]);
|
||||
|
||||
return 0;
|
||||
private int getNumDefense(SpellAbility sa) {
|
||||
return AbilityFactory.calculateAmount(hostCard, numDefense, sa);
|
||||
}
|
||||
|
||||
private CardList getPumpCreatures() {
|
||||
@@ -239,9 +188,9 @@ public class AbilityFactory_Pump {
|
||||
return list;
|
||||
}
|
||||
|
||||
private CardList getCurseCreatures()
|
||||
private CardList getCurseCreatures(SpellAbility sa)
|
||||
{
|
||||
final int defense = getNumDefense();
|
||||
final int defense = getNumDefense(sa);
|
||||
|
||||
CardList list = new CardList(AllZone.Human_Play.getCards());
|
||||
list = list.filter(new CardListFilter() {
|
||||
@@ -280,7 +229,7 @@ public class AbilityFactory_Pump {
|
||||
|
||||
private boolean doTgtAI(SpellAbility sa)
|
||||
{
|
||||
int defense = getNumDefense();
|
||||
int defense = getNumDefense(sa);
|
||||
|
||||
String curPhase = AllZone.Phase.getPhase();
|
||||
if(curPhase.equals(Constant.Phase.Main2) && !(AF.isCurse() && defense < 0))
|
||||
@@ -289,7 +238,7 @@ public class AbilityFactory_Pump {
|
||||
Target tgt = AF.getAbTgt();
|
||||
CardList list;
|
||||
if (AF.isCurse()) // Curse means spells with negative effect
|
||||
list = getCurseCreatures();
|
||||
list = getCurseCreatures(sa);
|
||||
else
|
||||
list = getPumpCreatures();
|
||||
|
||||
@@ -340,7 +289,7 @@ public class AbilityFactory_Pump {
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -363,8 +312,8 @@ public class AbilityFactory_Pump {
|
||||
sb.append(c.getName());
|
||||
sb.append(" ");
|
||||
}
|
||||
final int atk = getNumAttack();
|
||||
final int def = getNumDefense();
|
||||
final int atk = getNumAttack(sa);
|
||||
final int def = getNumDefense(sa);
|
||||
|
||||
sb.append("gains ");
|
||||
if (atk != 0 || def != 0){
|
||||
@@ -388,6 +337,14 @@ public class AbilityFactory_Pump {
|
||||
}
|
||||
|
||||
sb.append("until end of turn.");
|
||||
|
||||
|
||||
Ability_Sub abSub = sa.getSubAbility();
|
||||
if (abSub != null) {
|
||||
abSub.setParent(sa);
|
||||
sb.append(abSub.getStackDescription());
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -414,8 +371,8 @@ public class AbilityFactory_Pump {
|
||||
if (tgt != null && !CardFactoryUtil.canTarget(AF.getHostCard(), tgtC))
|
||||
continue;
|
||||
|
||||
final int a = getNumAttack();
|
||||
final int d = getNumDefense();
|
||||
final int a = getNumAttack(sa);
|
||||
final int d = getNumDefense(sa);
|
||||
|
||||
final Command untilEOT = new Command() {
|
||||
private static final long serialVersionUID = -42244224L;
|
||||
@@ -453,12 +410,22 @@ public class AbilityFactory_Pump {
|
||||
|
||||
}
|
||||
|
||||
Card first = tgtCards.get(0);
|
||||
|
||||
if(AF.hasSubAbility())
|
||||
CardFactoryUtil.doDrawBack(params.get("SubAbility"), 0,
|
||||
hostCard.getController(), hostCard.getController().getOpponent(),
|
||||
first.getController(), hostCard, first, sa);
|
||||
|
||||
if (AF.hasSubAbility()){
|
||||
Ability_Sub abSub = sa.getSubAbility();
|
||||
if (abSub != null){
|
||||
if (abSub.getParent() == null)
|
||||
abSub.setParent(sa);
|
||||
abSub.resolve();
|
||||
}
|
||||
else{
|
||||
Card first = tgtCards.get(0);
|
||||
CardFactoryUtil.doDrawBack(params.get("SubAbility"), 0,
|
||||
hostCard.getController(), hostCard.getController().getOpponent(),
|
||||
first.getController(), hostCard, first, sa);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class AbilityFactory_ZoneAffecting {
|
||||
|
||||
@Override
|
||||
public boolean chkAI_Drawback() {
|
||||
return drawTargetAI(af);
|
||||
return drawTargetAI(af, this);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -104,7 +104,7 @@ public class AbilityFactory_ZoneAffecting {
|
||||
|
||||
sb.append(player.toString());
|
||||
sb.append(" draws (");
|
||||
sb.append(af.getMapParams().get("NumCards"));
|
||||
sb.append(AbilityFactory.calculateAmount(sa.getSourceCard(), af.getMapParams().get("NumCards"), sa));
|
||||
sb.append(").");
|
||||
|
||||
Ability_Sub abSub = sa.getSubAbility();
|
||||
@@ -142,7 +142,7 @@ public class AbilityFactory_ZoneAffecting {
|
||||
|
||||
}
|
||||
|
||||
boolean bFlag = drawTargetAI(af);
|
||||
boolean bFlag = drawTargetAI(af, sa);
|
||||
|
||||
if (!bFlag)
|
||||
return false;
|
||||
@@ -164,7 +164,7 @@ public class AbilityFactory_ZoneAffecting {
|
||||
return randomReturn;
|
||||
}
|
||||
|
||||
public static boolean drawTargetAI(AbilityFactory af) {
|
||||
public static boolean drawTargetAI(AbilityFactory af, SpellAbility sa) {
|
||||
Target tgt = af.getAbTgt();
|
||||
HashMap<String,String> 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<String,String> 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<Player> tgtPlayers;
|
||||
|
||||
|
||||
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user