add Mulch (from Stronghold) with a few tweaks to AF_Dig

This commit is contained in:
jendave
2011-08-06 23:12:44 +00:00
parent 705cd77566
commit bda7efc11a
3 changed files with 86 additions and 26 deletions

1
.gitattributes vendored
View File

@@ -4537,6 +4537,7 @@ res/cardsfolder/mudbutton_clanger.txt -text svneol=native#text/plain
res/cardsfolder/mudbutton_torchrunner.txt -text svneol=native#text/plain res/cardsfolder/mudbutton_torchrunner.txt -text svneol=native#text/plain
res/cardsfolder/muddle_the_mixture.txt -text svneol=native#text/plain res/cardsfolder/muddle_the_mixture.txt -text svneol=native#text/plain
res/cardsfolder/mul_daya_channelers.txt -text svneol=native#text/plain res/cardsfolder/mul_daya_channelers.txt -text svneol=native#text/plain
res/cardsfolder/mulch.txt svneol=native#text/plain
res/cardsfolder/mulldrifter.txt -text svneol=native#text/plain res/cardsfolder/mulldrifter.txt -text svneol=native#text/plain
res/cardsfolder/multani_maro_sorcerer.txt -text svneol=native#text/plain res/cardsfolder/multani_maro_sorcerer.txt -text svneol=native#text/plain
res/cardsfolder/multanis_acolyte.txt -text svneol=native#text/plain res/cardsfolder/multanis_acolyte.txt -text svneol=native#text/plain

View File

@@ -0,0 +1,8 @@
Name:Mulch
ManaCost:1 G
Types:Sorcery
Text:no text
A:SP$Dig | Cost$ 1 G | DigNum$ 4 | Reveal$ True | ChangeNum$ All | ChangeValid$ Land | DestinationZone2$ Graveyard | SpellDescription$ Reveal the top four cards of your library. Put all land cards revealed this way into your hand and the rest into your graveyard.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/mulch.jpg
End

View File

@@ -152,7 +152,33 @@ public class AbilityFactory_Reveal {
} }
private static boolean digCanPlayAI(final AbilityFactory af, final SpellAbility sa) { private static boolean digCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
HashMap<String,String> params = af.getMapParams();
Card source = sa.getSourceCard();
if (!ComputerUtil.canPayCost(sa))
return false; return false;
//currently to restrict everything except Mulch
if(!params.get("ChangeNum").equalsIgnoreCase("All")) return false;
double chance = .4; // 40 percent chance with instant speed stuff
if (AbilityFactory.isSorcerySpeed(sa))
chance = .667; // 66.7% chance for sorcery speed (since it will never activate EOT)
Random r = MyRandom.random;
boolean randomReturn = r.nextFloat() <= Math.pow(chance, source.getAbilityUsed() + 1);
if (AbilityFactory.playReusable(sa))
randomReturn = true;
if (af.hasSubAbility()){
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null){
return randomReturn && abSub.chkAI_Drawback();
}
}
return randomReturn;
/* /*
if (!ComputerUtil.canPayCost(sa)) if (!ComputerUtil.canPayCost(sa))
return false; return false;
@@ -200,7 +226,7 @@ public class AbilityFactory_Reveal {
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;
int destZone1ChangeNum = params.containsKey("ChangeNum") ? Integer.parseInt(params.get("ChangeNum")) : 1; int destZone1ChangeNum = 1;
boolean mitosis = params.containsKey("Mitosis"); boolean mitosis = params.containsKey("Mitosis");
String changeValid = params.containsKey("ChangeValid") ? params.get("ChangeValid") : ""; String changeValid = params.containsKey("ChangeValid") ? params.get("ChangeValid") : "";
boolean anyNumber = params.containsKey("AnyNumber"); boolean anyNumber = params.containsKey("AnyNumber");
@@ -208,6 +234,12 @@ public class AbilityFactory_Reveal {
int libraryPosition2 = params.containsKey("LibraryPosition2") ? Integer.parseInt(params.get("LibraryPosition2")) : -1; int libraryPosition2 = params.containsKey("LibraryPosition2") ? Integer.parseInt(params.get("LibraryPosition2")) : -1;
boolean optional = params.containsKey("Optional"); boolean optional = params.containsKey("Optional");
boolean noMove = params.containsKey("NoMove"); boolean noMove = params.containsKey("NoMove");
boolean changeAll = false;
if(params.containsKey("ChangeNum")) {
if(params.get("ChangeNum").equalsIgnoreCase("All")) changeAll = true;
else destZone1ChangeNum = Integer.parseInt(params.get("ChangeNum"));
}
ArrayList<Player> tgtPlayers; ArrayList<Player> tgtPlayers;
@@ -234,8 +266,14 @@ public class AbilityFactory_Reveal {
Card dummy = new Card(); Card dummy = new Card();
dummy.setName("[No valid cards]"); dummy.setName("[No valid cards]");
if(params.containsKey("Reveal")) {
GuiUtils.getChoice("Revealing cards from library", top.toArray());
//AllZone.GameAction.revealToCopmuter(top.toArray()); - for when it exists
}
else {
//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());
}
if(!noMove) { if(!noMove) {
if(mitosis) { if(mitosis) {
@@ -257,6 +295,18 @@ public class AbilityFactory_Reveal {
valid = top; valid = top;
} }
if(changeAll) {
for(Card c:valid) {
PlayerZone zone = AllZone.getZone(destZone1, c.getOwner());
if(zone.is("Library")) {
AllZone.GameAction.moveToLibrary(c, libraryPosition);
}
else {
AllZone.GameAction.moveTo(zone, c);
}
}
}
else {
int j = 0; int j = 0;
while(j < destZone1ChangeNum || (anyNumber && j < numToDig)) { while(j < destZone1ChangeNum || (anyNumber && j < numToDig)) {
//let user get choice //let user get choice
@@ -280,9 +330,10 @@ public class AbilityFactory_Reveal {
//AllZone.GameAction.revealToComputer() - for when this exists //AllZone.GameAction.revealToComputer() - for when this exists
j++; j++;
} }
}
//dump anything not selected from valid back into the rest //dump anything not selected from valid back into the rest
rest.addAll(valid.toArray()); if(!changeAll) rest.addAll(valid.toArray());
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