Thread: [Essentials script] Pokémon TCG mod
View Single Post
  #42    
Old September 25th, 2012 (02:26 PM).
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Quote:
Originally Posted by the__end View Post
i have to apologize!
i just realized that the features i mentioned are nice and all but they are a pain to script right?
i will remove the "seen" marks from the card dex screen...
that the new cards are marked as "new" should be enough!
and the sorting system is unnecessary if its possible for you to make the filters you mentioned...


should the completion value shown in percent?
it would definitely look better and save some space...
Adding filters is the thing I'm not sure I'm able to do. A "seen" counter and list sorting are doable, and probably not too difficult. As I said, it's about deciding what's needed, and what people just want for the sake of wanting things. I don't think a "seen" counter is needed; you just want it because the Pokédex has it.

Completion should be in the form 86/102 rather than a percentage.

I've attached my tweaking to your design. I'm not sure about having the card icons there (which mean the same as in the GBC game; element symbols are for energy cards only), but it's a thought. I hope there's enough space for all possible card names.


Quote:
Originally Posted by the__end View Post
yeah i meant filters!
they are much better then just sorting the cards...
hope you will find a way to add this feature...

filters are often used in TCG video games like "Yu-Gi-Oh! 5D's World Championship 2011" to sort your cards in your library and find the one you want to have in your deck...
here is a screen:
Spoiler:

i thought we could do the library something like this...
not as complicated but the structure should look similar...
of course we have to implement the top ds screen (where the card image is) to the bottom one...
maybe make it pop up if you click a button?
That's a huge mass of information there. I notice it just has the one pocket for cards, and displays the deck in a separate tab. That's why the filters are so important in the Yu-Gi-Oh! game: all the cards are shown at once, and only 4 are visible at a time. My game will separate owned cards into pockets (and show more cards at once), which drastically reduces the huge card lists. Large lists will still be a problem, but not as soon (for example, having all cards from Base Set, Jungle and Fossil make the biggest pocket the Grass Pokémon one, with 40-odd cards, which isn't that big considering). Basically, I'm trying to ignore the issue.

One of the things to decide upon when designing the Library is which pockets to have. I've just been assuming one per Pokémon card element plus the others (see my sketch). There may be alternatives.

Another thing to remember is that the player will be using the keyboard. This will affect the design. Remember also that, if possible, the game should fit a screen size of 256x192.

The top screen in your screenshot is simply the card summary screen, which is a separate screen to be designed.


Quote:
Originally Posted by hansiec View Post
Alright, I did understand what you said there.

I prefer a signle class (PokeBattle_Effects) with different variables that will in the outcome suit every needed situation
and to make it more flexible add a custom_code segment which allows you to evaluate a custom code just for incase there are
some un-defined methods required within the effect

OR

We can do something simmilar to Essentials where we must create a code for every move (which is time more time consuming in
my opinion)

the PokeBattle_Effects class can store any type of effect: Move/Ability/Card and can be activated at selected points:
Turn Started/Turn Ended/Coin Flipped/Coin Heads/Coin Tales/Your Turn/Enemy Turn/ect. using an array you can select multiple
points to activate this at. I also did create a sample of what I mean (I only spent about 5 minutes or so on this so it's
not perfect and may seem a little confusing) but this is what I made:

Spoiler:

Code:
=begin
  This is an example of what I would do for Effects, I can make any changes you wish
  You can add to this as you wish and or modify it. If you don't like this system,
  I can completely reconstruct this to Essential's style.
=end
class PokeBattle_Effects

  attr_accessor :type            # Integer -- 0 = card, 1 = move, 2 = ability
  attr_accessor :activation_type # Integer -- when to activate the effect (0= your turn, 1= enemy's turn, 2= coin flip, 3= before attack, 4= during attack, ect.)
  attr_accessor :hold_effect     # Integer -- how many turns to hold the effect
  attr_accessor :effect          # Integer -- 0 = damage, 1 = status, and so forth
  attr_accessor :effect_attribute# Integer -- how much damage?, which status?, ect.
  attr_accessor :chance          # Integer -- Percentage chance of the succes of the effect
  attr_accessor :custom_function # String  -- A string containing ruby code on what to execute (executes every time called)
  attr_accessor :activated       # Boolean -- Is this effect active?
  attr_accessor :turns           # Integer -- Maximum turns to hold the effect (auto selected by hold_effect)
  
  # startup of the class
  def initialize(type, activation_type, effect, hold_effect = 1, custom_function = "")
    @type = type
    @activation_type = activation_type
    @effect = effect
    @hold_effect = hold_effect
    @custom_function = custom_function
    @turns = hold_effect
  end
  
  # returns wether the ability is avaible to activate
  # if it is activatable it reset the activation turns (unless already active)
  def activatable?(a_type)
    @hold_effect = @turns if @activation_type == a_type && !@activated
    @activated = true if @activation_type == a_type && !@activated
    return @activation_type == a_type
  end
  
  # returns if the effect is currently active
  def updatable?
    return @activated
  end
  
  # updates and returns an array (the length will be 1 if it did not do anything)
  def update
    @hold_effect -= 1
    destroy = @hold_effect > 0
    ret = [destroy]
    if rand(100-@chance) == 0
      ret.push(effect)
      ret.push(effect_attributes)
      ret.push(eval(@custom_function)) if @custom_function != ""
    end
    return ret
  end
    
end
Your first suggestion is meaningless, since it isn't a solution in itself but just a restating of the problem. The only relevant part is where you imply that there's only one kind of function code, which covers any and all possible effects of anything.

Basically, how do you know which effect a particular card has? You can either code in an effect which happens only when the card is XYZ, or you can define the card to have a function code and then code in an effect which happens for any card with that function code. I'm suggesting the latter, since it allows for reusing of some common card effects (e.g. "Flip a coin and paralyse the target if Heads.").

There will be an equivalent of PokeBattle_Effects, which contains some of the more common effects that can happen (e.g. paralysing a Pokémon). However, putting every single possible effect in here is pointless, as most will only be used for one card and may as well go in PokeBattle_MoveEffects under the appropriate function code.

No, I think having a PokeBattle_MoveEffects for card effects (probably one for an attack's effect and one for any other kind of effect), plus creating a PokeBattle_Move entity for each attack and effect when the card is played (and remaining while the card is still in play) is the best option I can think of. It may use elements of your code.

I'm sure I'm not explaining this fully enough, but I have a vague picture in my head. It's a complicated picture. It'd be easier if there were no effects in the game.


Quote:
Originally Posted by hansiec View Post
also, if you are going to read data ini-style like essentials does I made a small tool for this too:

Spoiler:


Code:
=begin
  Just a handy tool for reading ini files
  
  Reads ini files and stores them in data.
  
  You can get values like so:
  ini.read_value(section(string or int), variable(string or int), default(anything))
  returns the value of the ini you set, but returns default if it does not exist
=end


class IniReader
  attr_accessor :data
  def initialize(ini)
    array = IO.readlines(ini)
    @data = {}
    startoff_section = "["
    
    section_name = ""
    section_hash = {}
    for i in 0..array.length-1
      if array[i][0] == startoff_section[0]
        if i != 0
          @data[section_name] = section_hash
        end
        section_name = array[i].split("[")[1].split("]")[0]
      elsif array[i].count("=") != 0
        tary = array[i].split("=")
        value = ""
        for i in 0..tary.length-2
          value+=tary[i+1]
        end
        section_hash[tary[0]]=value
      end
    end
    @data[section_name] = section_hash
  end
  
  def read_value(section, variable, default=-1)
    section = "#{section}"
    variable = "#{variable}"
    if @data[section][variable] == nil
      ret = default
    else
      ret = @data[section][variable]
    end
    return ret
  end
  
end


n = IniReader.new("Game.ini")
print n.read_value("Game", "Title")


so if you have a different idea or have improvements for the PokeBattle_Effects class, let me know.
I've already made scripts which compile the new PBS files and access that data, so I don't think I need to muck around with any ini files. I'm not sure why you mentioned this.
Attached Thumbnails
Card Dex concept.png‎  
__________________