New Testing Facility: Setup Battlefield
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
26 posts
• Page 2 of 2 • 1, 2
Re: New Testing Facility: Setup Battlefield
by Agetian » 05 Jun 2011, 07:06
UPDATE 5 JUN 2011:
- Added the ActivePhase option that allows to change the current phase. See the first post
for valid values and an example.
- Agetian
- Added the ActivePhase option that allows to change the current phase. See the first post
for valid values and an example.
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: New Testing Facility: Setup Battlefield
by Agetian » 05 Jun 2011, 09:23
UPDATE 5 JUN 2011:
- The state setup files no longer need an END tag.
- The state setup files can contain empty lines and comments beginning with the pound sign (#).
- Agetian
- The state setup files no longer need an END tag.
- The state setup files can contain empty lines and comments beginning with the pound sign (#).
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: New Testing Facility: Setup Battlefield
by Agetian » 05 Jun 2011, 18:00
UPDATE 6 JUN 2011:
- Added a possibility to change cards in Exile areas for Human and AI.
- Added an optional ability to specify a specific set for cards spawned through Setup Game State.
- Agetian
- Added a possibility to change cards in Exile areas for Human and AI.
- Added an optional ability to specify a specific set for cards spawned through Setup Game State.
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: New Testing Facility: Setup Battlefield
by Rob Cashwalker » 05 Jun 2011, 18:24
Check out how the loading and saving of decks handles the set code. (Gui_DeckEditor)Added an optional ability to specify a specific set for cards spawned through Setup Game State.
Each card is listed as {CardName}|{SetCode}
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: New Testing Facility: Setup Battlefield
by Agetian » 05 Jun 2011, 18:55
Yep, I saw that, but for some reason the Java parser I wrote does not want to recognize the "|" symbol when splitting the string (it just returns an empty string when splitting using the "|"), so I had to resort to using a different custom symbol in the state setup files. If I (or someone else) figure out how to make it work with the "|" symbol, I'll definitely make it consistent, but for the time being it'll have to work with the "@" symbol in the state setup files. Amazingly enough, just changing split("@") into split("|") makes the code fail to work, while the one with @ (or pretty much any other symbol) works OK... Does anyone have any ideas why this might be the case?Rob Cashwalker wrote:Check out how the loading and saving of decks handles the set code. (Gui_DeckEditor)Added an optional ability to specify a specific set for cards spawned through Setup Game State.
Each card is listed as {CardName}|{SetCode}
- Agetian
Last edited by Agetian on 05 Jun 2011, 19:05, edited 1 time in total.
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: New Testing Facility: Setup Battlefield
by lazylockie » 05 Jun 2011, 19:01
nice work Agetian! This should really save up some time when scripting new cards. Any plans to extend this setup thing for Quest mode? That way the quest-quests become more dynamic and even normal opponents could have a starting battlefield as well.
- lazylockie
- Posts: 508
- Joined: 13 Jul 2010, 22:44
- Has thanked: 74 times
- Been thanked: 15 times
Re: New Testing Facility: Setup Battlefield
by Agetian » 05 Jun 2011, 19:06
Yep, actually I might extend this to a Puzzle mode or something like that, and I don't mind if anyone else adapts the code for other uses as well, such as Quest mode needs.lazylockie wrote:nice work Agetian! This should really save up some time when scripting new cards. Any plans to extend this setup thing for Quest mode? That way the quest-quests become more dynamic and even normal opponents could have a starting battlefield as well.

- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: New Testing Facility: Setup Battlefield
by Chris H. » 05 Jun 2011, 19:44
`Agetian wrote:Yep, I saw that, but for some reason the Java parser I wrote does not want to recognize the "|" symbol when splitting the string (it just returns an empty string when splitting using the "|")
Check out the forge.card.abilityFactory class. On line 108 this class parses a string on the "|" character:
- Code: Select all
String a[] = abString.split("\\|");
-
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: New Testing Facility: Setup Battlefield
by Agetian » 06 Jun 2011, 03:44
Thanks, that sure helped! I updated the code to use the pipe symbol now (|) for consistency.Chris H. wrote:Check out the forge.card.abilityFactory class. On line 108 this class parses a string on the "|" character:
- Code: Select all
String a[] = abString.split("\\|");
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: New Testing Facility: Setup Battlefield
by Braids » 01 Jul 2011, 02:14
ah, String.split uses regular expressions? if that's so, that explains why the pipe character needs to be escaped with backslashes.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: New Testing Facility: Setup Battlefield
by Hellfish » 14 Aug 2011, 20:34
Necroing a bit to inform people that I've extended this feature in a way that breaks set assignment for old state files.New named parameters could be added for things like attacking creatures and such.A complete rewrite could concievably allow attaching cards to eachother and the like.
- Log msg | Open
- *Extended Setup Game State - Added named parameters.
-Tapped = If this is True,well... the card is tapped, ofc.
-SummonSick = If this is True, the card has Summoning Sickness.
-Counters = A comma-separated list of counters on the card.
-Morphed = If this is True, the card is facedown. (It must have the morph keyword for this to work)
-Set = Like you previously set SetCode.If absent, the latest printing is used.
Ex. "AICardsInPlay=Aphetto Alchemist|Set:ONS|Tapped:True|SummonSick:True|Counters:P1P1,P1P1,M0M2|Morphed:True; Memnite"
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
26 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 31 guests