Here is a run down of exactly how the current ingame battle system and buying cards work. I've already started to make modifications and more are coming later .

Basics of the Duel System
Basically a duel is invoke with a single line of code that stats 2 things: The name of the opponent and also its level (ranging from 0-10). Cards are randomly picked depending on the level and obviously stronger pokemon are picked as well.
After the duel ends, in true spirit of a collectible card game, the victor gains a random card from the loser. Moreover you can do different events depending on the outcome of the duel

Breakdown of Stat and other Rule Calculations
As you may know, each card has directional values determining it's power. This number ranges from 1-A where A is the highest. It finds these values by doing a simple conditional statement to the following base stats:

North Power: SP ATK
South Power: SP DEF
East Power: DEF
West Power: ATK

A if stat>=200
9 if stat>=150
8 if stat>=125
7 if stat>=100
6 if stat>=80
5 if stat>=70
4 if stat>=60
3 if stat>=45
2 if stat>=30
1 if stat is smaller than 30

Another thing involved in this version of Triple Triad is that the types come into play as well. An attacking pokemon will gain the following boosts/deboosts on the stat facing the pokemon depending on the effectiveness of the type.
+1 if your type is Super Effective
-1 if your type is Not Very Effective
-2 if the opposing type is Immune

Buying and Selling
How the current system works is that the person can buy a card from a card NPC as long as the corresponding pokemon has already been caught. The value of the card takes into account the pokemon's rarity and it's base stats. The player can also sell rare cards earned by other players for some extra money if they are low.

Modifications I've Coded So Far
  • The ability to hide certain caught pokemon from the shop (e.g. Legendaries)
  • TODO: Allow to create a list of cards to be sold in the shop.
  • Overworld Card Collecting (e.g. Finding cards on the floor)
  • The ability to modify stats of individual pokemon if required
  • some tweaks to support a tournament system

Of course more can be done when I have time to play with the system more and develop some more addons and other aspects to the system