It is currently 27 Apr 2024, 06:37
   
Text Size

Masticore

Post MTG Forge Related Programming Questions Here

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

Masticore

Postby zen » 13 Feb 2010, 19:37

Hi Everyone,
This is my debut onto the Forge seen, so be gentile please. Anyways, I'm trying to implement Masticore and need a little help with the discard part.
I dropped this first bit into cards.txt

Masticore
4
Artifact Creature Masticore
During your upkeep discard a card at random or sacrafice Masticore.
4/4
RegenerateMe:2
abDamageC 2:1


and the following into GameActionUtil.java:

I added 'upkeep_Masticore();' into the UpkeepEffects like so:

public static void executeUpkeepEffects(){ upkeep_Masticore(); }

and the rest down below:

private static void upkeep_Masticore()
{
final String player = AllZone.Phase.getActivePlayer();
PlayerZone playZone = AllZone.getZone(Constant.Zone.Play, player);

CardList list = new CardList(playZone.getCards());
list = list.getName("Masticore");

Ability ability;
for (int i = 0; i < list.size(); i++)
{
ability = new Ability(list.get(i), "0")
{
public void resolve()
{
AllZone.GameAction.discardRandom(player);
}
};// Ability
ability.setStackDescription(player + "discards a card at random");

AllZone.Stack.add(ability);
}// for
}//upkeep_Masticore

Any help with the discarding bit would be great. I tried to simplify his effect by just having him making you discard every upkeep, but even that hasn't worked so far.
zen
 
Posts: 27
Joined: 13 Feb 2010, 19:21
Has thanked: 0 time
Been thanked: 0 time

Re: Masticore

Postby Marek14 » 13 Feb 2010, 19:58

"Sacrifice", not "sacrafice"...

Also, Masticore does NOT make you discard at random.
Marek14
Tester
 
Posts: 2761
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 297 times

Re: Masticore

Postby zen » 13 Feb 2010, 20:16

Right, thanks. Even so, I think I'm really having problems compiling in eclipse. Is there a thread on that somewhere?
zen
 
Posts: 27
Joined: 13 Feb 2010, 19:21
Has thanked: 0 time
Been thanked: 0 time

Re: Masticore

Postby DennisBergkamp » 13 Feb 2010, 20:18

Zen,

Yes, what Marek said.
Anyway, Masticore is a bit of a tricky card. But it should be doable, you're putting the code in the right place (upkeep_Masticore() in GameActionUtil.java).

First of all, you'll need to use GameAction.discard(String player, int numDiscard) instead of discardRandom.

To help you in the right direction, have a look at the code of Drekavac found in CardFactory_Creature.java (starting around line 2770).
After all what needs to happen is that Masticore has to be sacrificed unless a card is discarded.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Masticore

Postby DennisBergkamp » 13 Feb 2010, 20:22

What happens when you try compiling?

I'm guessing you need to add some of the libraries to your Build Path.
These libraries should be in /res/lib.

Add them to your build path by:
Right clicking your project in the Package Explorer -> Build Path -> Add External Archives, now just add all of the JARs found in /res/lib.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Masticore

Postby zen » 14 Feb 2010, 08:09

Thanks for the help on the discard code. I'll definitely use that.

As for the compiling, I think I could use some guidance on compiling forge in eclipse.
Last edited by zen on 14 Feb 2010, 12:31, edited 1 time in total.
zen
 
Posts: 27
Joined: 13 Feb 2010, 19:21
Has thanked: 0 time
Been thanked: 0 time

Re: Masticore

Postby Chris H. » 14 Feb 2010, 11:26

Is zen downloading the most recent version of Forge. The most recent version is r377 located at:

https://cardforge.googlecode.com/svn


The /res/lib/ folder should contain:

google-collect-1.0.jar
jdom-1.0.jar
jl1.0.1.jar
jsr305.jar
napkinlaf-1.2.jar
napkinlaf-swingset-1.2.jar
nimrodlf.jar
substance.jar
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: Masticore

Postby zen » 14 Feb 2010, 12:34

Hi Chris H.
I just downloaded forge 01-01 from:
http://forge-card-game.googlecode.com/f ... -forge.zip

there was only a single file in the res/lib folder:
jl1.0.1.jar

I tried clicking on Chris' link, but it asks for a username and password.. I tried loging into google code first too, but this didn't seem to help. How do I get a user/pass?
zen
 
Posts: 27
Joined: 13 Feb 2010, 19:21
Has thanked: 0 time
Been thanked: 0 time

Re: Masticore

Postby DennisBergkamp » 14 Feb 2010, 13:19

Zen,

What you will need is Subclipse (a plugin for Eclipse), to grab the latest stuff from the SVN. I just installed it again recently on my Linux machine, and I think I ended up grabbing version 1.6.

Check this website for instructions: http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA

AFTER installing subclipse, in Eclipse, hit File -> Import -> Other -> Checkout projects from SVN -> Next. Then Create New Repository Location -> Next.
Use "https://cardforge.googlecode.com/svn" as the location. It should then fetch the remote directories on that location, select the "src" directory to check out.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Masticore

Postby Chris H. » 14 Feb 2010, 15:59

If I remember correctly, Subversion is also needed. I think that Subversion is included with many *nix variants.

It looks like I installed Subversion 1.6.6 on my Mac along with the Subclipse 1.6.5 plugin. :)
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: Masticore

Postby zen » 14 Feb 2010, 21:23

Thanks for the help thusfar Dennis and Chris. I downloaded SVN 1.6.9 and Subclipse 1.6.7 and installed them. Next I followed Dennis' suggestion of:

hit File -> Import -> Other -> Checkout projects from SVN -> Next. Then Create New Repository Location -> Next.
Use "https://cardforge.googlecode.com/svn"

It says "Pending" for a minute or so, and then I get an error message on the "Checkout from SVN" screen saying "Unable to load default SVN Client". This happens right before it seems like I should select the 'src' directory to checkout. Could the problem be with me not having permissions to access the SVN site? I emailed mtgrares already, asking him to add me as a contributor to the site. Any ideas?
Last edited by zen on 15 Feb 2010, 12:05, edited 1 time in total.
zen
 
Posts: 27
Joined: 13 Feb 2010, 19:21
Has thanked: 0 time
Been thanked: 0 time

Re: Masticore

Postby zen » 14 Feb 2010, 21:41

Why is the source code so hard to come by? It came default with the earlier versions of Forge I believe
zen
 
Posts: 27
Joined: 13 Feb 2010, 19:21
Has thanked: 0 time
Been thanked: 0 time

Re: Masticore

Postby silly freak » 15 Feb 2010, 00:01

zen, i agree with you. i think the source should be available even without SVN; we should include it again in the releases, hear me dennis? (at least as a separate download) but also think of it this way: the SVN allows you to have the latest sources even when the last beta was a month ago.

for your problem: this sounds like your SVN client was not found or is not compatible. look in window/preferences for your subclipse setup, maybe that gives you some hints. if not, first try to use SVN on the commandline. there's a mass of tutorials on the web on how to do that. another tip: try http instead of https for anonymous access. maybe the error was with your authentication?
___

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: Masticore

Postby DennisBergkamp » 15 Feb 2010, 00:27

Hm, yeah it might be a good thing as a separate download, I will do so the next Beta release.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Masticore

Postby zen » 15 Feb 2010, 00:43

Thanks for the tips Silly Freak,
I'm thinking the problem is with my access. Do you guys have special permissions to the https://cardforge.googlecode.com/svn site?

Is there a way to determine if Subclipse is playing nicely with SVN or not?
zen
 
Posts: 27
Joined: 13 Feb 2010, 19:21
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 98 guests


Who is online

In total there are 98 users online :: 0 registered, 0 hidden and 98 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 98 guests

Login Form