Startup

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:

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:

What is needed to implement new cards?

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:

)

Situations

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:

(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