It is currently 25 Apr 2024, 10:12
   
Text Size

Get ready for some fun. Necropotence

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Get ready for some fun. Necropotence

Postby jpb » 06 Oct 2008, 03:38

This is the code for both Yawgmoth's Bargain and Necropotence. I know we don't have Donate and Illusions Of Grandeur in MTG Forge to complete the combo, but this card is fun anyways.

Add this in CardFactory.java

Code: Select all
    else if(cardName.equals("Yawgmoth's Bargain")){                 
        final SpellAbility ability = new Ability(card, "0")
        {
          public void resolve()
          {
             PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController());
             PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
            if(library.size() != 0)
            {
              AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(1);
              Card c = library.get(0);
              library.remove(0);
              hand.add(c);
            }
          }
         
         public boolean canPlayAI()
          {
            return false;
          }
        };//SpellAbility

        ability.setDescription("Pay 1 life: Draw a card.");
        ability.setStackDescription(card.getName() +" - Pay 1 life: Draw a card.");

        card.addSpellAbility(ability);
      }//*************** END ************ END **************************
   
   
    //*************** START *********** START **************************
    else if(cardName.equals("Necropotence"))
    {
      final CardList necroCards = new CardList();
     
      final Command necro = new Command()
      {
        public void execute()
        {
          if(AllZone.GameAction.isCardInPlay(card))
          {
            //put cards removed by Necropotence into player's hand
           if(necroCards.size() > 0){
             PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
               
             for(int i = 0;i<necroCards.size();i++){
               hand.add(necroCards.get(i));
             }
             necroCards.clear();
           }
          }
        }
      };
             
      final SpellAbility ability = new Ability(card, "0")
      {
        public void resolve()
        {
          PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController());
           
          if(library.size() != 0)
          {
            AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(1);
            Card c = library.get(0);
            library.remove(0);
            necroCards.add(c); //add card to necro so that it goes into hand at end of turn
            AllZone.EndOfTurn.addAt(necro);
          }
        }
       
        public boolean canPlayAI()
        {
          return false;
        }
      };//SpellAbility

      ability.setDescription("1 life: Set aside the top card of your library face down. At the end of your turn, put that card into your hand.");
      ability.setStackDescription(card.getName() +" - 1 life: Set aside the top card of your library face down. At the end of your turn, put that card into your hand.");

      card.addSpellAbility(ability);
    }//*************** END ************ END **************************
Replace the Input_Draw.java file with this one
Code: Select all
import java.util.*;

public class Input_Draw extends Input
{
    public void showMessage()
    {
   if(AllZone.Phase.getActivePlayer().equals(Constant.Player.Computer))
   {
       AllZone.GameAction.drawCard(Constant.Player.Computer);
      
       //AllZone.Phase.nextPhase();
       //for debugging: System.out.println("need to nextPhase(from Input_Draw on computer's draw) = true");
       AllZone.Phase.setNeedToNextPhase(true);
       return;
   }
   
   //check if human should skip their draw phase
   CardList humanCards = new CardList();
    humanCards.addAll(AllZone.Human_Play.getCards());
    boolean humanSkipsDrawPhase = humanCards.containsName("Necropotence") || humanCards.containsName("Yawgmoth's Bargain");
   
   if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw) && humanSkipsDrawPhase){
      AllZone.Phase.setNeedToNextPhase(true);
   }
   else{ //continue with draw phase
      boolean drawCard = true;
      if(0 < getDredge().size())
      {
          String choices[] = {"Yes", "No"};
          Object o = AllZone.Display.getChoice("Do you want to dredge?", choices);
          if(o.equals("Yes"))
          {
         drawCard = false;
         Card c = (Card) AllZone.Display.getChoice("Select card to dredge", getDredge().toArray());
         
         //might have to make this more sophisticated
         //dredge library, put card in hand
         AllZone.Human_Hand.add(c);
         AllZone.Human_Graveyard.remove(c);
         
         for(int i = 0; i < getDredgeNumber(c); i++)
         {
             Card c2 = AllZone.Human_Library.get(0);
             AllZone.Human_Library.remove(0);
             AllZone.Human_Graveyard.add(c2);
         }
          }
      }//if(0 < getDredge().size())
      
      if(drawCard)
          AllZone.GameAction.drawCard(Constant.Player.Human);
      
      if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw))
      {
          Input_Main.canPlayLand = true;
         
          //AllZone.Phase.nextPhase();
          //for debugging: System.out.println("need to nextPhase(from Input_Draw on human's draw) = true");
          AllZone.Phase.setNeedToNextPhase(true);
      }
      else
          stop();
       }
    } //end necro check
   
    public ArrayList getDredge()
    {
   ArrayList dredge = new ArrayList();
   Card c[] = AllZone.Human_Graveyard.getCards();

   for(int outer = 0; outer < c.length; outer++)
   {
       ArrayList a = c[outer].getKeyword();
       for(int i = 0; i < a.size(); i++)
      if(a.get(i).toString().startsWith("Dredge"))
      {
          if(AllZone.Human_Library.size() >= getDredgeNumber(c[outer]))
         dredge.add(c[outer]);
      }
   }
   return dredge;
    }//hasDredge()
    public int getDredgeNumber(Card c)
    {
   ArrayList a = c.getKeyword();
   for(int i = 0; i < a.size(); i++)
       if(a.get(i).toString().startsWith("Dredge"))
       {
      String s = a.get(i).toString();
      return Integer.parseInt("" +s.charAt(s.length() -1));
       }
   
   throw new RuntimeException("Input_Draw : getDredgeNumber() card doesn't have dredge - " +c.getName());
    }//getDredgeNumber()
}
Add this to cards.txt
Code: Select all
Necropotence
B B B
Enchantment
Skip your draw step. If you would discard a card from your hand, remove that card from the game instead. Pay 1 life: Set aside the top card of your library face down. At the end of your turn, put that card into your hand.

Yawgmoth's Bargain
4 B B
Enchantment
Skip your draw step. Pay 1 life: Draw a card.
jpb
 
Posts: 132
Joined: 05 Sep 2008, 13:12
Has thanked: 0 time
Been thanked: 0 time

Re: Get ready for some fun. Necropotence

Postby jpb » 06 Oct 2008, 03:50

One minor irritation is that when you click on either of these cards to activate their abilities MTG Forge will ask you to pay a mana cost, even though they are 0. You just need to click anywhere in the game and it will put the ability on the stack. I am not aware of a way in MTG Forge to avoid this. If anyone knows please fix this. Also there is no AI or card image URL yet.
jpb
 
Posts: 132
Joined: 05 Sep 2008, 13:12
Has thanked: 0 time
Been thanked: 0 time

Re: Get ready for some fun. Necropotence

Postby DennisBergkamp » 06 Oct 2008, 04:15

jpb, AWESOME! I was just thinking a few days ago how cool Necropotence would be in MTGForge. You should definitely submit this card (and all your other additions) to Forge.

I, by the way, have been having the same problem with some of my spells (Hunting Grounds, for instance), and I have no clue how to fix it. I think it should be possible though with the methods available....
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Get ready for some fun. Necropotence

Postby GandoTheBard » 06 Oct 2008, 05:35

I know people thought of Trix as a combo deck and technically it was but that wasnt really the idea. At least according to Dr. Bush whom I used to talk with on IRC a bit. Donate was good for lots of things but the deck still worked after the bans in the extended season that year. Anyway good job on the necro/bargain code...imho those card will be too easily broken for Forge but *shrugs* Im sure it will be fun to see the ai bungle them. :D
visit my personal homepage here: http://outofthebrokensky.com

Listen to my podcast with famed AJ_Impy "Freed from the Real" on http://puremtgo.com
User avatar
GandoTheBard
Tester
 
Posts: 1043
Joined: 06 Sep 2008, 18:43
Has thanked: 0 time
Been thanked: 0 time

Re: Get ready for some fun. Necropotence

Postby jpb » 20 Oct 2008, 19:48

There is a problem where you sometimes cannot lay a land down after you have Necropotence in play.
jpb
 
Posts: 132
Joined: 05 Sep 2008, 13:12
Has thanked: 0 time
Been thanked: 0 time

Re: Get ready for some fun. Necropotence

Postby GandoTheBard » 21 Oct 2008, 17:48

Yeah I reported this. Initially I thought it had something to do with the interaction of disk and potence but it has happened when it was just the necropotence out. All the text must have confused MTGForge :)
visit my personal homepage here: http://outofthebrokensky.com

Listen to my podcast with famed AJ_Impy "Freed from the Real" on http://puremtgo.com
User avatar
GandoTheBard
Tester
 
Posts: 1043
Joined: 06 Sep 2008, 18:43
Has thanked: 0 time
Been thanked: 0 time

Re: Get ready for some fun. Necropotence

Postby jpb » 21 Oct 2008, 19:21

Here is the fix for Necropotence not allowing you to play a land. In Input_Draw.java add the following line "Input_Main.canPlayLand = true;" to the if block.

Code: Select all
if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw) && humanSkipsDrawPhase){
     Input_Main.canPlayLand = true;
     AllZone.Phase.setNeedToNextPhase(true);
   }
jpb
 
Posts: 132
Joined: 05 Sep 2008, 13:12
Has thanked: 0 time
Been thanked: 0 time


Return to Forge

Who is online

Users browsing this forum: No registered users and 177 guests


Who is online

In total there are 177 users online :: 0 registered, 0 hidden and 177 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 177 guests

Login Form