- Added AI to AF Dig.

This commit is contained in:
jendave
2011-08-07 00:18:52 +00:00
parent d92b7bbd7f
commit 7ea6ebb1fc
3 changed files with 44 additions and 50 deletions

2
.gitattributes vendored
View File

@@ -3953,7 +3953,7 @@ res/cardsfolder/lay_waste.txt -text svneol=native#text/plain
res/cardsfolder/lead_astray.txt -text svneol=native#text/plain res/cardsfolder/lead_astray.txt -text svneol=native#text/plain
res/cardsfolder/lead_belly_chimera.txt svneol=native#text/plain res/cardsfolder/lead_belly_chimera.txt svneol=native#text/plain
res/cardsfolder/lead_golem.txt -text svneol=native#text/plain res/cardsfolder/lead_golem.txt -text svneol=native#text/plain
res/cardsfolder/lead_the_stampede.txt svneol=native#text/plain res/cardsfolder/lead_the_stampede.txt -text svneol=native#text/plain
res/cardsfolder/leaden_fists.txt -text svneol=native#text/plain res/cardsfolder/leaden_fists.txt -text svneol=native#text/plain
res/cardsfolder/leaden_myr.txt -text svneol=native#text/plain res/cardsfolder/leaden_myr.txt -text svneol=native#text/plain
res/cardsfolder/leaf_arrow.txt svneol=native#text/plain res/cardsfolder/leaf_arrow.txt svneol=native#text/plain

View File

@@ -1,10 +1,9 @@
Name:Lead the Stampede Name:Lead the Stampede
ManaCost:2 G ManaCost:2 G
Types:Sorcery Types:Sorcery
Text:no text Text:no text
A:SP$ Dig | Cost$ 2 G | DigNum$ 5 | ChangeValid$ Creature | AnyNumber$ True | SpellDescription$ Look at the top five cards of your library. You may reveal any number of creature cards from among them and put the revealed cards into your hand. Put the rest on the bottom of your library in any order. A:SP$ Dig | Cost$ 2 G | DigNum$ 5 | ChangeValid$ Creature | AnyNumber$ True | SpellDescription$ Look at the top five cards of your library. You may reveal any number of creature cards from among them and put the revealed cards into your hand. Put the rest on the bottom of your library in any order.
SVar:RemAIDeck:True SVar:Rarity:Uncommon
SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/lead_the_stampede.jpg
SVar:Picture:http://www.wizards.com/global/images/magic/general/lead_the_stampede.jpg SetInfo:MBS|Uncommon|http://magiccards.info/scans/en/mbs/82.jpg
SetInfo:MBS|Uncommon|http://magiccards.info/scans/en/mbs/82.jpg
End End

View File

@@ -178,26 +178,6 @@ public class AbilityFactory_Reveal {
} }
} }
return randomReturn; return randomReturn;
/*
if (!ComputerUtil.canPayCost(sa))
return false;
Target tgt = sa.getTarget();
if (sa.getTarget() != null){
tgt.resetTargets();
sa.getTarget().addTarget(AllZone.ComputerPlayer);
}
else{
ArrayList<Player> tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
for (Player p : tgtPlayers)
if (p.isHuman())
return false;
// not sure if the AI should be playing with cards that give the Human more turns.
}
return true;
*/
} }
private static boolean digTriggerAI(final AbilityFactory af, final SpellAbility sa, boolean mandatory) { private static boolean digTriggerAI(final AbilityFactory af, final SpellAbility sa, boolean mandatory) {
@@ -223,6 +203,7 @@ public class AbilityFactory_Reveal {
private static void digResolve(final AbilityFactory af, final SpellAbility sa) { private static void digResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String,String> params = af.getMapParams(); HashMap<String,String> params = af.getMapParams();
Card host = af.getHostCard(); Card host = af.getHostCard();
Player player = sa.getActivatingPlayer();
int numToDig = AbilityFactory.calculateAmount(af.getHostCard(), params.get("DigNum"), sa); int numToDig = AbilityFactory.calculateAmount(af.getHostCard(), params.get("DigNum"), sa);
String destZone1 = params.containsKey("DestinationZone") ? params.get("DestinationZone") : "Hand"; String destZone1 = params.containsKey("DestinationZone") ? params.get("DestinationZone") : "Hand";
int libraryPosition = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : -1; int libraryPosition = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : -1;
@@ -270,7 +251,7 @@ public class AbilityFactory_Reveal {
GuiUtils.getChoice("Revealing cards from library", top.toArray()); GuiUtils.getChoice("Revealing cards from library", top.toArray());
//AllZone.GameAction.revealToCopmuter(top.toArray()); - for when it exists //AllZone.GameAction.revealToCopmuter(top.toArray()); - for when it exists
} }
else { else if (player.isHuman()){
//show the user the revealed cards //show the user the revealed cards
GuiUtils.getChoice("Looking at cards from library", top.toArray()); GuiUtils.getChoice("Looking at cards from library", top.toArray());
} }
@@ -312,27 +293,41 @@ public class AbilityFactory_Reveal {
} }
else { else {
int j = 0; int j = 0;
while(j < destZone1ChangeNum || (anyNumber && j < numToDig)) { if (player.isHuman()) {
//let user get choice while(j < destZone1ChangeNum || (anyNumber && j < numToDig)) {
Card chosen = null; //let user get choice
if(anyNumber || optional) { Card chosen = null;
chosen = GuiUtils.getChoiceOptional("Choose a card to put into "+destZone1, valid.toArray()); if(anyNumber || optional) {
chosen = GuiUtils.getChoiceOptional("Choose a card to put into "+destZone1, valid.toArray());
}
else {
chosen = GuiUtils.getChoice("Choose a card to put into "+destZone1, valid.toArray());
}
if(chosen == null || chosen.getName().equals("[No valid cards]")) break;
valid.remove(chosen);
PlayerZone zone = AllZone.getZone(destZone1, chosen.getOwner());
if(zone.is("Library")) {
//System.out.println("Moving to lib position: "+libraryPosition);
AllZone.GameAction.moveToLibrary(chosen, libraryPosition);
}
else {
AllZone.GameAction.moveTo(zone, chosen);
}
//AllZone.GameAction.revealToComputer() - for when this exists
j++;
} }
else { }//human
chosen = GuiUtils.getChoice("Choose a card to put into "+destZone1, valid.toArray()); else { //computer (pick the first cards)
} int changeNum = Math.min(destZone1ChangeNum, valid.size());
if(chosen == null || chosen.getName().equals("[No valid cards]")) break; if(anyNumber) changeNum = valid.size();//always take all
valid.remove(chosen); for (j=0;j<changeNum;j++) {
PlayerZone zone = AllZone.getZone(destZone1, chosen.getOwner()); Card chosen = valid.get(0);
if(zone.is("Library")) { if(chosen.equals(dummy)) continue;
//System.out.println("Moving to lib position: "+libraryPosition); PlayerZone zone = AllZone.getZone(destZone1, chosen.getOwner());
AllZone.GameAction.moveToLibrary(chosen, libraryPosition);
}
else {
AllZone.GameAction.moveTo(zone, chosen); AllZone.GameAction.moveTo(zone, chosen);
GuiUtils.getChoice("Computer picked: ", chosen);
valid.remove(chosen);
} }
//AllZone.GameAction.revealToComputer() - for when this exists
j++;
} }
} }
@@ -341,7 +336,7 @@ public class AbilityFactory_Reveal {
if(rest.contains(dummy)) rest.remove(dummy); if(rest.contains(dummy)) rest.remove(dummy);
//now, move the rest to destZone2 //now, move the rest to destZone2
if(destZone2.equals("Library")) { if(destZone2.equals("Library") && player.isHuman()) {
//put them in any order //put them in any order
while(rest.size() > 0) { while(rest.size() > 0) {
Card chosen; Card chosen;