mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Added AI to AF Dig.
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -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_belly_chimera.txt 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_myr.txt -text svneol=native#text/plain
|
||||
res/cardsfolder/leaf_arrow.txt svneol=native#text/plain
|
||||
|
||||
@@ -3,7 +3,6 @@ ManaCost:2 G
|
||||
Types:Sorcery
|
||||
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.
|
||||
SVar:RemAIDeck:True
|
||||
SVar:Rarity:Uncommon
|
||||
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
|
||||
|
||||
@@ -178,26 +178,6 @@ public class AbilityFactory_Reveal {
|
||||
}
|
||||
}
|
||||
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) {
|
||||
@@ -223,6 +203,7 @@ public class AbilityFactory_Reveal {
|
||||
private static void digResolve(final AbilityFactory af, final SpellAbility sa) {
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
Card host = af.getHostCard();
|
||||
Player player = sa.getActivatingPlayer();
|
||||
int numToDig = AbilityFactory.calculateAmount(af.getHostCard(), params.get("DigNum"), sa);
|
||||
String destZone1 = params.containsKey("DestinationZone") ? params.get("DestinationZone") : "Hand";
|
||||
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());
|
||||
//AllZone.GameAction.revealToCopmuter(top.toArray()); - for when it exists
|
||||
}
|
||||
else {
|
||||
else if (player.isHuman()){
|
||||
//show the user the revealed cards
|
||||
GuiUtils.getChoice("Looking at cards from library", top.toArray());
|
||||
}
|
||||
@@ -312,6 +293,7 @@ public class AbilityFactory_Reveal {
|
||||
}
|
||||
else {
|
||||
int j = 0;
|
||||
if (player.isHuman()) {
|
||||
while(j < destZone1ChangeNum || (anyNumber && j < numToDig)) {
|
||||
//let user get choice
|
||||
Card chosen = null;
|
||||
@@ -334,6 +316,19 @@ public class AbilityFactory_Reveal {
|
||||
//AllZone.GameAction.revealToComputer() - for when this exists
|
||||
j++;
|
||||
}
|
||||
}//human
|
||||
else { //computer (pick the first cards)
|
||||
int changeNum = Math.min(destZone1ChangeNum, valid.size());
|
||||
if(anyNumber) changeNum = valid.size();//always take all
|
||||
for (j=0;j<changeNum;j++) {
|
||||
Card chosen = valid.get(0);
|
||||
if(chosen.equals(dummy)) continue;
|
||||
PlayerZone zone = AllZone.getZone(destZone1, chosen.getOwner());
|
||||
AllZone.GameAction.moveTo(zone, chosen);
|
||||
GuiUtils.getChoice("Computer picked: ", chosen);
|
||||
valid.remove(chosen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//dump anything not selected from valid back into the rest
|
||||
@@ -341,7 +336,7 @@ public class AbilityFactory_Reveal {
|
||||
if(rest.contains(dummy)) rest.remove(dummy);
|
||||
|
||||
//now, move the rest to destZone2
|
||||
if(destZone2.equals("Library")) {
|
||||
if(destZone2.equals("Library") && player.isHuman()) {
|
||||
//put them in any order
|
||||
while(rest.size() > 0) {
|
||||
Card chosen;
|
||||
|
||||
Reference in New Issue
Block a user