Search code examples
actionscript-3playing-cards

simulating a trading card game in actionscript


More specifically, I'm trying to simulate the Pokemon TCG, if that helps.

Currently, I have a handle on the basic elements of the game, like drawing cards and shuffling. However, I am lost on how to implement the functionalities unique to certain cards.

To simplify things, I have a deck class and a card class. The card class includes variables like a card's name and type, and it gets their values by extracting them from a database. But say, if I'm trying to create a Base Set Charizard, how would I store and call his poke-power (read:ability), as it has effects beyond the normal rules of the game and needs its own code.

Would it be efficient (or is it even possible) to store the code for the ability into a database and call it when needed? If not, what are the best alternatives to attack this situation?


Solution

  • I don't think you would store the code in a database, or even against the card. I think you need to separate out the code that does the abilities, and the defining of the ability for each card.

    You probably need to abstract out each effect, and an ability/poke-power will be a collection of different "effect" with different values. This could get pretty complicated, and is not a simple task. There will be abilities that share the same effects, so abstracting these out will make sure you don't repeat yourself.