Page 1 of 2

Rampant Growth

PostPosted: 18 Apr 2010, 05:55
by Beached As
I'm new to programming in java, i barely managed to load an old version of forge into eclipse. I cant seem to get the new version in there atm. but yeh
Rampant Growth copied from Kodama's Reach with slight editing:

add to CardFactory.java:
Code: Select all
//*************** START *********** START **************************
    if(cardName.equals("Rampant Growth"))
    {
      SpellAbility spell = new Spell(card)
      {
      private static final long serialVersionUID = -8788464272892423520L;

      public void resolve()
        {
          String player = card.getController();

          if(player.equals(Constant.Player.Human))
            humanResolve();
          else
            computerResolve();
        }
        public void computerResolve()
        {
          CardList land = new CardList(AllZone.Computer_Library.getCards());
          land = land.getType("Basic");

          //just to make the computer a little less predictable
          land.shuffle();

          //Checking if there's a land in the deck
          if(land.size() != 0)
          {
            Card tapped = land.remove(0);
            tapped.tap();

            AllZone.Computer_Play.add(tapped);
            AllZone.Computer_Library.remove(tapped);
          }
        }//computerResolve()

        public void humanResolve()
        {
          PlayerZone play    = AllZone.getZone(Constant.Zone.Play   , card.getController());
          PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController());

          CardList list = new CardList(library.getCards());
          list = list.getType("Basic");

          //Checking if there's a land in the deck

          //No Lands
          if(list.size() == 0)
            return;

          //1 or more lands
          Object o = AllZone.Display.getChoiceOptional("Put into play tapped", list.toArray());
          if(o != null)
          {
            Card c = (Card)o;
            c.tap();
            list.remove(c);

            library.remove(c);
            play.add(c);

            AllZone.GameAction.shuffle(card.getController());
          }//if
        }//resolve()
      };//SpellAbility
      card.clearSpellAbility();
      card.addSpellAbility(spell);
    }//*************** END ************ END **************************
add to cards.txt:
Code: Select all
Rampant Growth
1 G
Sorcery
Search your library for a basic land card and put that card onto the battlefield tapped. Then shuffle your library.
I wish i knew how to test so i could confirm the card working before posting.

Re: Rampant Growth

PostPosted: 18 Apr 2010, 05:58
by Huggybaby
I hope it works, Rampant Growth is an old favorite.

Re: Rampant Growth

PostPosted: 18 Apr 2010, 06:17
by DennisBergkamp
Wow, this is some strange coincidence... I've just finished coding Rampant Growth myself and uploaded it to SVN like 15 minutes ago!

Re: Rampant Growth

PostPosted: 18 Apr 2010, 06:26
by Beached As
I would use your version of it lol. I would like to know how to put the most recent version into eclipse and how to test cards.
and what is this svn that everyone keeps mentioning, i think i've been there before but i cant find the link anymore.

Re: Rampant Growth

PostPosted: 18 Apr 2010, 06:29
by Rob Cashwalker
I've been considering a generic library search keyword as of late too.... Anyone playing lotto too?

Re: Rampant Growth

PostPosted: 18 Apr 2010, 10:25
by jim
Rob Cashwalker wrote:I've been considering a generic library search keyword as of late too.... Anyone playing lotto too?
Yeah, this is almost too funny. I started a version of this card in my local copy yesterday, with the idea of sharing code between Rampant Growth and Harrow, and eventually turning it into a keyword to search your library for land.

I guess what we're saying is that that there's an obvious need for this card. :-)

Re: Rampant Growth

PostPosted: 18 Apr 2010, 16:40
by DennisBergkamp
Beached As,

I guess we'll use my version (although they look basically identical because I also used Kodama's Reach). But it's good you posted yours, since I messed up on the card.txt entry initially :)

The SVN is a repository where we post all of our code (the latest version can be grabbed from there using an SVN client - Subclipse might be a good one for you since you're using eclipse). Here's the URL : http://code.google.com/p/cardforge/

Re: Rampant Growth

PostPosted: 18 Apr 2010, 16:54
by Chris H.
DennisBergkamp wrote:The SVN is a repository where we post all of our code (the latest version can be grabbed from there using an SVN client - Subclipse might be a good one for you since you're using eclipse). Here's the URL : http://code.google.com/p/cardforge/
`
Subclipse also needs Subversion installed in order for Eclipse to handle the SVN. Once you get everything set up Dennis can give you commiter status once you feel ready.

There are several older topic threads in the Developer's Corner section which provide introductory info about Eclipse, Subclipse, Subversion and the SVN. There is a lot of good info there. :D

Re: Rampant Growth

PostPosted: 18 Apr 2010, 20:02
by Beached As
Thanks for all the support people, but trying to get forge into eclipse has been very frustrating.
What i've done so far:
Installed eclipse
Downloaded 2 - 14 source code
Extracted into a project folder
Downloaded and added all libraries in res/lib in svn to a folder res/lib in the project folder
Created a java project from this project folder in eclipse

I run gui_newgame.java and i get this message:
Code: Select all
java.io.IOException: The following exceptions occured:
File 'forge.properties', Property 'main--transparent-properties':
    res\main.properties (The system cannot find the file specified)
   at treeProperties.TreeProperties.rethrow(TreeProperties.java:213)
   at forge.properties.ForgeProps.<clinit>(ForgeProps.java:29)
   at forge.Gui_NewGame.<clinit>(Gui_NewGame.java:88)
java.lang.ExceptionInInitializerError
   at forge.Gui_NewGame.<clinit>(Gui_NewGame.java:88)
Caused by: java.lang.NullPointerException
   at java.util.regex.Matcher.getTextLength(Unknown Source)
   at java.util.regex.Matcher.reset(Unknown Source)
   at java.util.regex.Matcher.<init>(Unknown Source)
   at java.util.regex.Pattern.matcher(Unknown Source)
   at java.util.Formatter.parse(Unknown Source)
   at java.util.Formatter.format(Unknown Source)
   at java.io.PrintWriter.format(Unknown Source)
   at java.io.PrintWriter.printf(Unknown Source)
   at forge.error.ErrorViewer.printError(ErrorViewer.java:128)
   at forge.error.ErrorViewer.showError(ErrorViewer.java:66)
   at forge.error.ErrorViewer.showError(ErrorViewer.java:47)
   at forge.properties.ForgeProps.<clinit>(ForgeProps.java:31)
   ... 1 more
Exception in thread "main"
and i cant seem to avoid this message, any ideas?

Re: Rampant Growth

PostPosted: 18 Apr 2010, 20:37
by Chris H.
Beached As wrote:Thanks for all the support people, but trying to get forge into eclipse has been very frustrating.
What i've done so far:
Installed eclipse
Downloaded 2 - 14 source code
Extracted into a project folder
Downloaded and added all libraries in res/lib in svn to a folder res/lib in the project folder
Created a java project from this project folder in eclipse

and i cant seem to avoid this message, any ideas?
`
This problem has come up several times for various people. Forge is looking for a file named "forge.properties" and it is not in your project folder. Download this archive, un-zip and place the "forge.properties" file into the root folder of your Forge project folder located in your workspace. :)

`

Re: Rampant Growth

PostPosted: 18 Apr 2010, 20:40
by silly freak
you beat me! but it looks like forge.properties is in place, but the res folder (or at least main.properties) not...

Re: Rampant Growth

PostPosted: 18 Apr 2010, 20:54
by Chris H.
silly freak wrote:you beat me! but it looks like forge.properties is in place, but the res folder (or at least main.properties) not...
`
I see, yeah ... I guess that he is missing at least that file if not more of the res folder. Here is the main.properties file. Place it inside of your /res/ folder. Let's hope that this will fix the problem.


`

Re: Rampant Growth

PostPosted: 19 Apr 2010, 05:50
by Beached As
Alrite, i added all files in the res folder from the most recent version of forge and imported it into eclipse. I can now run forge in eclipse but whenever i try to start a game i obtain this error:

Code: Select all
An error has occured. You can copy/paste this message or save it to a file.
Please report this, plus what you tried to do, to:
   http://www.slightlymagic.net/forum/viewforum.php?f=26
If you don't want to register an account, you can mail it directly to
   mtgerror@yahoo.com


Unresolved compilation problem:



Version:
Forge -- official beta: $Date: 2010-04-06 17:06:37 -0400 (Tue, 06 Apr 2010) $, SVN revision: $Revision: 632 $

Detailed error trace:
java.lang.Error: Unresolved compilation problem:

   at forge.ImageCache.getImage(ImageCache.java:98)
   at forge.gui.game.CardPanel.addComponents(CardPanel.java:32)
   at forge.gui.game.CardPanel.setCard(CardPanel.java:59)
   at forge.gui.game.CardPanel.<init>(CardPanel.java:27)
   at forge.GuiDisplay3$19.update(GuiDisplay3.java:576)
   at java.util.Observable.notifyObservers(Unknown Source)
   at java.util.Observable.notifyObservers(Unknown Source)
   at forge.MyObservable.updateObservers(MyObservable.java:10)
   at forge.DefaultPlayerZone.update(DefaultPlayerZone.java:111)
   at forge.DefaultPlayerZone.add(DefaultPlayerZone.java:41)
   at forge.GameAction.drawCard(GameAction.java:777)
   at forge.GameAction.newGame(GameAction.java:962)
   at forge.Gui_NewGame.startButton_actionPerformed(Gui_NewGame.java:497)
   at forge.Gui_NewGame$5.actionPerformed(Gui_NewGame.java:316)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
I can try selecting a card in the deck editor and obtain this error:

Code: Select all
An error has occured. You can copy/paste this message or save it to a file.
Please report this, plus what you tried to do, to:
   http://www.slightlymagic.net/forum/viewforum.php?f=26
If you don't want to register an account, you can mail it directly to
   mtgerror@yahoo.com


Unresolved compilation problem:



Version:
Forge -- official beta: $Date: 2010-04-06 17:06:37 -0400 (Tue, 06 Apr 2010) $, SVN revision: $Revision: 632 $

Detailed error trace:
java.lang.Error: Unresolved compilation problem:

   at forge.ImageCache.getImage(ImageCache.java:108)
   at forge.gui.game.CardPicturePanel.setCard(CardPicturePanel.java:74)
   at forge.Gui_DeckEditor.setCard(Gui_DeckEditor.java:466)
   at forge.TableModel$2.mousePressed(TableModel.java:218)
   at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
I also get these notifications in eclipse but these errors don't stop forge from running:
Code: Select all
Error handling registered!
java.lang.Exception: TreeProperties returns null for removed-cards--file
java.lang.Exception: TreeProperties returns null for removed-cards--file
java.lang.Exception: TreeProperties returns null for removed-cards--file

Re: Rampant Growth

PostPosted: 19 Apr 2010, 07:44
by silly freak
are there any files marked red in your eclipse? i guess you have still some missing libraries, maybe GoogleCollect, or you're using an old java version?

the last output you posted, although it says "Exception", is harmless debug output

Re: Rampant Growth

PostPosted: 19 Apr 2010, 08:07
by Beached As
imagecache.java is red
GUI_filter.java is yellow

In imagecache.java the follow lines of code in the import section are red:
import com.google.common.base.Function;
import com.google.common.collect.ComputationException;
import com.google.common.collect.MapMaker;
import com.mortennobel.imagescaling.ResampleOp;