diff --git a/.gitattributes b/.gitattributes index 903a51818d9..04990a7af7a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2918,6 +2918,7 @@ res/cardsfolder/mox_sapphire.txt -text svneol=native#text/plain res/cardsfolder/mtenda_herder.txt -text svneol=native#text/plain res/cardsfolder/muck_rats.txt -text svneol=native#text/plain res/cardsfolder/mudbrawler_cohort.txt -text svneol=native#text/plain +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 diff --git a/res/cardsfolder/mudbutton_clanger.txt b/res/cardsfolder/mudbutton_clanger.txt new file mode 100644 index 00000000000..56326d15230 --- /dev/null +++ b/res/cardsfolder/mudbutton_clanger.txt @@ -0,0 +1,9 @@ +Name:Mudbutton Clanger +ManaCost:R +Types:Creature Goblin Warrior +Text:Kinship - At the beginning of your upkeep, you may look at the top card of your library. If it shares a creature type with Mudbutton Clanger, you may reveal it. If you do, Mudbutton Clanger gets +1/+1 until end of turn. +PT:1/1 +SVar:RemAIDeck:True +SVar:Rarity:Common +SVar:Picture:http://www.wizards.com/global/images/magic/general/mudbutton_clanger.jpg +End diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 39665c1ab4f..f0ba508b6bc 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -69,15 +69,18 @@ public class GameActionUtil { upkeep_Nath(); upkeep_Anowon(); upkeep_Cunning_Lethemancer(); - upkeep_Sensation_Gorger(); - upkeep_Winnower_Patrol(); - upkeep_Nightshade_Schemers(); - upkeep_Wandering_Graybeard(); - upkeep_Wolf_Skull_Shaman(); - upkeep_Leaf_Crowned_Elder(); + upkeep_Ink_Dissolver(); - upkeep_Squeaking_Pie_Grubfellows(); upkeep_Kithkin_Zephyrnaut(); + upkeep_Leaf_Crowned_Elder(); + upkeep_Mudbutton_Clanger(); + upkeep_Nightshade_Schemers(); + upkeep_Sensation_Gorger(); + upkeep_Squeaking_Pie_Grubfellows(); + upkeep_Wandering_Graybeard(); + upkeep_Winnower_Patrol(); + upkeep_Wolf_Skull_Shaman(); + upkeep_Debtors_Knell(); upkeep_Reya(); upkeep_Emeria(); @@ -7497,6 +7500,89 @@ public class GameActionUtil { }// upkeep_Leaf_Crowned_Elder() + private static void upkeep_Mudbutton_Clanger() { + final Player player = AllZone.Phase.getPlayerTurn(); + CardList kinship = AllZoneUtil.getPlayerCardsInPlay(player, "Mudbutton Clanger"); + + PlayerZone library = AllZone.getZone(Constant.Zone.Library, player); + // Players would not choose to trigger Kinship ability if library is empty. + // Useful for games when the "Milling = Loss Condition" check box is unchecked. + + if (kinship.size() == 0 || library.size() <= 0) + return; + + final String[] shareTypes = { "Goblin", "Warrior" }; + final Card[] prevCardShown = { null }; + final Card peek[] = { null }; + + for (final Card k : kinship) { + Ability ability = new Ability(k, "0") { // change to triggered abilities when ready + @Override + public void resolve() { + PlayerZone library = AllZone.getZone(Constant.Zone.Library, player); + if (library.size() <= 0) + return; + + peek[0] = library.get(0); + boolean wantGoblinBuff = false; + + // We assume that both players will want to peek, ask if they want to reveal. + // We do not want to slow down the pace of the game by asking too many questions. + // Dialogs outside of the Ability appear at the previous end of turn phase !!! + + if (peek[0].isValidCard(shareTypes)) { + if (player.isHuman()) { + StringBuilder question = new StringBuilder(); + question.append("Your top card is ").append(peek[0].getName()); + question.append(". Reveal card and Mudbutton Clanger gets +1/+1 until end of turn?"); + if (showYesNoDialog(k, question.toString())) { + wantGoblinBuff = true; + } + } + // player isComputer() + else { + String title = "Computer reveals"; + revealTopCard(title); + wantGoblinBuff = true; + } + } else if (player.isHuman()) { + String title = "Your top card is"; + revealTopCard(title); + } + + if (wantGoblinBuff) { + k.addTempAttackBoost(1); + k.addTempDefenseBoost(1); + + final Command untilEOT = new Command() { + private static final long serialVersionUID = -103560515951630426L; + + public void execute() { + k.addTempAttackBoost(-1); + k.addTempDefenseBoost(-1); + } + }; + AllZone.EndOfTurn.addUntil(untilEOT); + } + }// resolve() + + private void revealTopCard(String title) { + if (peek[0] != prevCardShown[0]) { + AllZone.Display.getChoice(title, peek[0]); + prevCardShown[0] = peek[0]; + } + }// revealTopCard() + };// ability + + StringBuilder sb = new StringBuilder(); + sb.append("Mudbutton Clanger - ").append(player); + sb.append(" triggers Kinship"); + ability.setStackDescription(sb.toString()); + AllZone.Stack.add(ability); + }// for + }// upkeep_Mudbutton_Clanger() + + private static void upkeep_Nightshade_Schemers() { final Player player = AllZone.Phase.getPlayerTurn(); CardList kinship = AllZoneUtil.getPlayerCardsInPlay(player, "Nightshade Schemers");