It is currently 29 Oct 2025, 11:45
   
Text Size

New card question

Post MTG Forge Related Programming Questions Here

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

New card question

Postby Kite » 22 Dec 2010, 00:54

Hi,

I looked at some of the cards and tried making one I like playing with:preordain.
This is what I think the code should be

Name:Preordain
ManaCost:U
Types:Sorcery
Text:no text
K:Scry 2
K:Draw a card.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/preordain.jpg
SetInfo:M11|Common|http://magiccards.info/scans/en/m11/70.jpg
End

now for the question
where do I have to add this? I made a txt file called preordain and saved it in the cards folder.
I also added the name Preordain to the common.txt file but the deck editor still won't find it.
Should I put it anywhere else?
also I looked at the code for ponder:

Name:Ponder
ManaCost:U
Types:Sorcery
Text:Look at the top three cards of your library, then put them back in any order. You may shuffle your library.
K:Draw a card.
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/ponder.jpg
SetInfo:M10|Common|http://magiccards.info/scans/en/m10/68.jpg
SetInfo:LRW|Common|http://magiccards.info/scans/en/lw/79.jpg
End

could someone point out to me the part where he reveals the 3 cards? All I see is draw a card
and I spose the remAIDeck is that the AI should point the ponder on itself as target?

Any help is appreciated
hope to contribute more cards to this awesome project, also if I do manage to write some where should I contribute them?

Cheers
Kite
Kite
 
Posts: 7
Joined: 18 Dec 2010, 21:41
Has thanked: 0 time
Been thanked: 0 time

Re: New card question

Postby Chris H. » 22 Dec 2010, 01:58

Kite wrote:also I looked at the code for ponder:

Name:Ponder
ManaCost:U
Types:Sorcery
Text:Look at the top three cards of your library, then put them back in any order. You may shuffle your library.
K:Draw a card.
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/ponder.jpg
SetInfo:M10|Common|http://magiccards.info/scans/en/m10/68.jpg
SetInfo:LRW|Common|http://magiccards.info/scans/en/lw/79.jpg
End

could someone point out to me the part where he reveals the 3 cards? All I see is draw a card and I spose the remAIDeck is that the AI should point the ponder on itself as target?
`
Hello Kite. :D

Some of the cards in forge require not only the data contained in the card file found in the cardsfolder, but they also require additional code located in one of the java class files.

The additional code for Ponder can be found in CardFactory_Sorceries.java and the code looks like this:

Code: Select all
        //*************** START *********** START **************************
        else if(cardName.equals("Ponder") || cardName.equals("Omen")) {
            /*
             * Look at the top three cards of your library, then put them back
             * in any order. You may shuffle your library.  Draw a card.
             */
            final SpellAbility spell = new Spell(card) {
                private static final long serialVersionUID = 484615053209732769L;
               
                @Override
                public void resolve() {
                    Player player = card.getController();
                    AllZoneUtil.rearrangeTopOfLibrary(player, 3, false);
                    AllZone.GameAction.promptForShuffle(player);
                }
               
                @Override
                public boolean canPlayAI() {
                    //basically the same reason as Sensei's Diving Top
                    return false;
                }
            };//spell
           
            StringBuilder sb = new StringBuilder();
            sb.append(cardName).append(" - Rearrange the top 3 cards in your library in any order. ");
            sb.append("You may shuffle you library. Draw a card.");
            spell.setStackDescription(sb.toString());
           
            card.clearSpellAbility();
            card.addSpellAbility(spell);
        }//*************** END ************ END **************************
`
The remAIDeck SVar prevents this card from being included in a randomly generated deck. Some cards are currently very buggy and or broken. Some cards have an ability that the computer can not use. Other cards are special combo cards and are of no use in a randomly generated deck since the support cards will likely be missing.
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: New card question

Postby Kite » 22 Dec 2010, 03:08

thx for the info.
I got the preordain to show up in the deck editor.
only thing is, it draws the card before (or probably simultaneously with) the scry.
is there any way to make him wait with that via the txt file or would this also require added java code.
I study programming so I understand the java and can write it but it would probably take me alot of time to familiarize myself with all the methods and classes.
I'd like to help adding cards to this game though would prefer doing so only via the txt files. Would you say this is possible or do most cards require additional programming?
Kite
 
Posts: 7
Joined: 18 Dec 2010, 21:41
Has thanked: 0 time
Been thanked: 0 time

Re: New card question

Postby friarsol » 22 Dec 2010, 03:50

Yep. Check out the wiki: http://www.slightlymagic.net/wiki/Forge ... Structures

The new structures would be the place that I would concentrate the most on. Specifically Ability Factory, but AFs use the others. Between that and existing data files in other cards you should be able to figure things out. If you need any help just ask.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: New card question

Postby Chris H. » 22 Dec 2010, 15:16

Kite wrote:thx for the info.
I got the preordain to show up in the deck editor.
only thing is, it draws the card before (or probably simultaneously with) the scry.
is there any way to make him wait with that via the txt file or would this also require added java code.
I study programming so I understand the java and can write it but it would probably take me alot of time to familiarize myself with all the methods and classes.
I'd like to help adding cards to this game though would prefer doing so only via the txt files. Would you say this is possible or do most cards require additional programming?
`
Slapshot5 just added an AbilityFactory version of Scry and the card Preordain as an example of SP$Scry. =D>

I am learning to program with the work that I do in forge. I will always be a jr. coder and not a project leader and that is fine by me. :D

Over the last two years members of the dev team has written a large number of keywords and now the new AbilityFactory AB$ and SP$ form of AFs. More than half of the cards in forge use a combination of these keywords and AFs.

It is possible to add cards via the txt files located in cardsfolder. You will need to study the various keywords and AFs to see how they are used. The next time a new card set comes out there may be a 100 or so cards that can be added via the txt files.
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: New card question

Postby Sloth » 22 Dec 2010, 16:56

A big number of auras with activated abilities are still unimplemented but entirely possible with card text alone. Just look at the text files of Armor of Faith, Blessing, Cage of Hands, Briar Shield or Firebreathing.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 6 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 6 users online :: 0 registered, 0 hidden and 6 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 6 guests

Login Form