Page 1 of 1

New card question

PostPosted: 22 Dec 2010, 00:54
by Kite
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

Re: New card question

PostPosted: 22 Dec 2010, 01:58
by Chris H.
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.

Re: New card question

PostPosted: 22 Dec 2010, 03:08
by Kite
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?

Re: New card question

PostPosted: 22 Dec 2010, 03:50
by friarsol
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.

Re: New card question

PostPosted: 22 Dec 2010, 15:16
by Chris H.
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.

Re: New card question

PostPosted: 22 Dec 2010, 16:56
by Sloth
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.