It is currently 09 Sep 2025, 11:38
   
Text Size

Rampant Growth

Post MTG Forge Related Programming Questions Here

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

Rampant Growth

Postby Beached As » 18 Apr 2010, 05:55

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.
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Rampant Growth

Postby Huggybaby » 18 Apr 2010, 05:58

I hope it works, Rampant Growth is an old favorite.
User avatar
Huggybaby
Administrator
 
Posts: 3228
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 753 times
Been thanked: 601 times

Re: Rampant Growth

Postby DennisBergkamp » 18 Apr 2010, 06:17

Wow, this is some strange coincidence... I've just finished coding Rampant Growth myself and uploaded it to SVN like 15 minutes ago!
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Rampant Growth

Postby Beached As » 18 Apr 2010, 06:26

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.
Last edited by Beached As on 19 Apr 2010, 08:18, edited 2 times in total.
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Rampant Growth

Postby Rob Cashwalker » 18 Apr 2010, 06:29

I've been considering a generic library search keyword as of late too.... Anyone playing lotto too?
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Rampant Growth

Postby jim » 18 Apr 2010, 10:25

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. :-)
jim
 
Posts: 46
Joined: 19 Feb 2010, 01:46
Location: Sunny New England
Has thanked: 0 time
Been thanked: 0 time

Re: Rampant Growth

Postby DennisBergkamp » 18 Apr 2010, 16:40

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/
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Rampant Growth

Postby Chris H. » 18 Apr 2010, 16:54

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
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Rampant Growth

Postby Beached As » 18 Apr 2010, 20:02

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?
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Rampant Growth

Postby Chris H. » 18 Apr 2010, 20:37

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. :)

`
Attachments
forge.properties.zip
(1.53 KiB) Downloaded 249 times
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Rampant Growth

Postby silly freak » 18 Apr 2010, 20:40

you beat me! but it looks like forge.properties is in place, but the res folder (or at least main.properties) not...
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: Rampant Growth

Postby Chris H. » 18 Apr 2010, 20:54

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.


`
Attachments
main.properties.zip
(728 Bytes) Downloaded 255 times
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Rampant Growth

Postby Beached As » 19 Apr 2010, 05:50

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
Last edited by Beached As on 19 Apr 2010, 08:18, edited 1 time in total.
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Rampant Growth

Postby silly freak » 19 Apr 2010, 07:44

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
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: Rampant Growth

Postby Beached As » 19 Apr 2010, 08:07

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;
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 20 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 20 users online :: 0 registered, 0 hidden and 20 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 20 guests

Login Form