The preference attribute is really very simple if you know SQL. It is not as powerful as I would like it to be, which is why I have been planning a rewrite of the application. So far I have only done the army management rewrite, and have not started a rewrite of the generator.
I think the best way to explain it is with a simple example, so I will jump right in the middle of a generation. Say a player already has a few amy cards that have been selected, and has 200 points left in his pool.
Among his army cards are:
Marro Drones with a preference attribute of: (name = 'Marro Drones')
and
Nerak the Glacian Swog Rider with a preference of: (species = 'Orc')
The player may have other army cards selected already, but none have preferences. If preferences are being used, the generator goes through each army card the player has already, and builds a query to get a list of army cards to choose from. In this case the query WHERE clause would look like this:
count > 0 AND points <= 200 AND ((species = 'Orc') OR (name = 'Marro Drones'));
count > 0 : is to only select army cards that are still left in the pool.
points <= 200 : is to select only army cards that this player can afford.
The AND clause is to select only army cards that match atleast one of the preferences (each preference is separated by an OR, so only one preference has to be met).
An army card is then chosen at random to add to the player's selected cards. If no army cards were returned by the query, then a query without preferences is done:
count > 0 AND points <= 200
If no armies are returned from this query, then the player is done selecting.
There may be a few other things added to the query depending upon what other settings you have. This has to do with what uniqueness level you selected, and whether you require a hero. But this really isn't important to this discussion.
Here is a list of available columns and their type:
column - type
---------------------
count - int
name - string
general - string
uniqueness - string
points - int
species - string
type - string
classification - string
personality - string
size - string
height - int
quantity - int
I believe I turned off case sensativity on the column names, so case shouldn't matter in the query. (species = 'Orc') should be the same as (Species = 'Orc').
Enjoy!
By the way, I LOVE your country. My wife and I took a vacation there a couple years back. We flew into Sydney and spent a night there, then drove to the Melbourne area. Stayed at a little resort in Kynton for a week before coming home. The Great Ocean Road was a wonderful drive. The wife had to drive, because I just didn't even want to think of driving on the left side