Cards in JPortal are not hardcoded. In its bare form (binary, just compiled source code), not one card is known by the program.
The only thing known by the main program is, that there are different kinds of cards. At the moment of writing following types of cards are supported:
lands
creatures
sorceries
instant
Now that I think of it - it would have been even better not to make these assumptions. If I hadn't enchantments and artifacts would not require me to touch any class. Be it as it may - that is only of small concern...
What kind of "influence" a card can have on a game is completely and alone handled by each card itself.
A card in JPortal consists of several parts:
a) an instant of a java class called "Card", here all fixed informations are stored, once a card is instantiated
card information gotten from the "Gatherer"-spoiler text file (name, set, ID, mana, color, etc.)
b) an image either loaded from "Gatherer" or built
c) volatile data, which is stored in "Card", this holds all volatile information of a card, like current "health", tap-state etc
d) and last, but certainly not least, an xml file (found under "xml/scripts/carddata/SETNAME/CARDID.xml") which holds all information how a card should "behave"
e) (additionally there are hint information for a card, so that AI can handle the card well enough)
First you should identify the card you would like to implement. Than you have to get the corresponding spoiler from gatherer. Easiest way is to download the set the card is in using JPortals import feature. (Actually you also could create a new set and/or add new cards to an existing set, but this is left as an excerise to the reader)
After importing the complete set you have your card "in the system". You could actually now use it already, and if it is a simple creature or a basic land - that will work just fine. If it is anything else you need to do some manual work.
If it has another type as the above mentioned ones forget it for now. Or if you are feeling you are up to it - go ahead an modify the sources. And build your own version of JPortal - with any luck you only have to change some lines in "Match.java".
Otherwise go to Edit Set:
Card scripting
This will be your "playground" now - to implement all features a card may have.
(How to open that window:
menu "Cards"
chose menuitem "Edit Set"
look for the set the card you want to edit is in and chose the one in the combobox
a list of all cards of that set will be shown
double click the card you want to edit
and go to the second tab
HERE is your playground :)
)
Here we go now, let us talk about sitations.
All things a card can do are scripted. Scripted in "java" (more or less, more more than less :-) ). These scripts are saved in the above mentioned "xml" file. Each card can have different scripts, depending on what a card can do and under what circumstances that doing will be required.
These "circumstances" when a card may "react" to something I call a "situations". Within a typical match many different situations may occur.
The match (the actual java-instance of the class Match) calls each card with so called "Situation key"s. And depending on the situations key the corresponding script is called.
Implementing a new card thus means:
figure out what kind of situations are there, that need special attention
after figuring that out, implement a java script (in the above shown editor) regarding every found situation
press "Save Card Scripts"
(after that - implement AI-Hints, so the AI may know what to do with the card)
test the card, on error - do some debuging - and correct the errors
(Note: I usually do a bunch of cards in a go and test them later - in order not to forget the cards I have to test I mark them! On the first tab there is a field "OK" right at the bottom. You can enter any text you like there - if you press save - it will be saved. If a set is loaded from gatherer the field is left blank. The first thing I do when I implement a new set is fill all entries with N (Not implemented), after implementing a card I fill it with U (Untested), after testing the card and knowing it works all right I fill it with Y (Yes the card is Ok) that way I can keep track of the state of the cards. You may even sort and filter with the given "tags" in the above list)
Goto: Card Situations