mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
add Mulch (from Stronghold) with a few tweaks to AF_Dig
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -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/muddle_the_mixture.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/multani_maro_sorcerer.txt -text svneol=native#text/plain
|
||||
res/cardsfolder/multanis_acolyte.txt -text svneol=native#text/plain
|
||||
|
||||
8
res/cardsfolder/mulch.txt
Normal file
8
res/cardsfolder/mulch.txt
Normal 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
|
||||
@@ -152,7 +152,33 @@ public class AbilityFactory_Reveal {
|
||||
}
|
||||
|
||||
private static boolean digCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
|
||||
return false;
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
Card source = sa.getSourceCard();
|
||||
|
||||
if (!ComputerUtil.canPayCost(sa))
|
||||
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))
|
||||
return false;
|
||||
@@ -200,7 +226,7 @@ public class AbilityFactory_Reveal {
|
||||
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;
|
||||
int destZone1ChangeNum = params.containsKey("ChangeNum") ? Integer.parseInt(params.get("ChangeNum")) : 1;
|
||||
int destZone1ChangeNum = 1;
|
||||
boolean mitosis = params.containsKey("Mitosis");
|
||||
String changeValid = params.containsKey("ChangeValid") ? params.get("ChangeValid") : "";
|
||||
boolean anyNumber = params.containsKey("AnyNumber");
|
||||
@@ -208,6 +234,12 @@ public class AbilityFactory_Reveal {
|
||||
int libraryPosition2 = params.containsKey("LibraryPosition2") ? Integer.parseInt(params.get("LibraryPosition2")) : -1;
|
||||
boolean optional = params.containsKey("Optional");
|
||||
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;
|
||||
|
||||
@@ -234,8 +266,14 @@ public class AbilityFactory_Reveal {
|
||||
Card dummy = new Card();
|
||||
dummy.setName("[No valid cards]");
|
||||
|
||||
//show the user the revealed cards
|
||||
GuiUtils.getChoice("Looking at cards from library", top.toArray());
|
||||
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
|
||||
GuiUtils.getChoice("Looking at cards from library", top.toArray());
|
||||
}
|
||||
|
||||
if(!noMove) {
|
||||
if(mitosis) {
|
||||
@@ -256,33 +294,46 @@ public class AbilityFactory_Reveal {
|
||||
else {
|
||||
valid = top;
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
while(j < destZone1ChangeNum || (anyNumber && j < numToDig)) {
|
||||
//let user get choice
|
||||
Card chosen = null;
|
||||
if(anyNumber || optional) {
|
||||
chosen = GuiUtils.getChoiceOptional("Choose a card to put into "+destZone1, valid.toArray());
|
||||
|
||||
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 {
|
||||
chosen = GuiUtils.getChoice("Choose a card to put into "+destZone1, valid.toArray());
|
||||
}
|
||||
else {
|
||||
int j = 0;
|
||||
while(j < destZone1ChangeNum || (anyNumber && j < numToDig)) {
|
||||
//let user get choice
|
||||
Card chosen = null;
|
||||
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++;
|
||||
}
|
||||
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++;
|
||||
}
|
||||
|
||||
//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);
|
||||
|
||||
//now, move the rest to destZone2
|
||||
|
||||
Reference in New Issue
Block a user