Masticore
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Masticore
by 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.
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
by 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
by 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.
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.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Masticore
by 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.
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.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Masticore
by 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.
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
by 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
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
-
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
by 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?
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
by 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.
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.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Masticore
by 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.
It looks like I installed Subversion 1.6.6 on my Mac along with the Subclipse 1.6.5 plugin.
-
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
by 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?
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
by 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
by 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?
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!
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
by 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.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Masticore
by 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?
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
56 posts
• Page 1 of 4 • 1, 2, 3, 4
Who is online
Users browsing this forum: No registered users and 98 guests