Results 1 to 9 of 9
  1. #1
    magichaxx is offline Member
    Join Date
    Nov 2013
    Posts
    27
    Rep Power
    0

    Default Tournament Program Help

    Well hey there code peeps! I'm making a program for a tournament, and it's a very special tournament. It's a Legendary Pokemon tournament! Tada! Now, I'm off to a fairly slow start; I can't figure out the best way to input the Pokemon data. Here's how the tournament works:

    • There are 32 Legendaries and they're all from the first four generations.
    • The order of Pokemon in the tourney tree is randomized for the first battles and then follow sequentially in the following battles like an actual tournament.
    • Each Pokemon has data ranges based on its Level 100 stats for HP, Attack, Defense, Sp. Atk, Sp. Def, and Speed.
    • HP has a set stat based on the range high.
    • Pokemon with multiple forms have stat ranges based on the lowest and highest ranges of each stat, i.e. one stat with an Attack range of 10-50 and another with a range of 30 - 80 would mesh together to make a range of 10-80.
    • Battles are turn-based and each stat (except HP) is randomized.
    • The percentage of moves that are physical or special for each type determines how often attacks are Attack or Sp. Atk-based and whether Defense or Sp. Def is applied.
    • Damage is based on the difference of Attack and Defense or Sp. Atk and Sp. Def. If Defense or Sp. Def is higher, the attack fails.
    • Speed determines which Pokemon will strike first. The difference in Speed stats determines the hit/miss ratio of an attack.
    • HP falls depending on damage. When HP=0, the Pokemon faints and loses.
    • No abilities or actual moves will be used, and battles will be determined on stats alone.


    What I need to get a good jumpstart on this is to figure out the best way to code the Pokemon stats. I'm thinking of using either an enum, separate classes for each Pokemon, or separate methods in the main class whose ranges can be applied universally to each Pokemon. What do you think?

  2. #2
    superhaNds is offline Senior Member
    Join Date
    Apr 2013
    Location
    Sweden
    Posts
    268
    Rep Power
    2

    Default Re: Tournament Program Help

    seems to me you only need one pokemon class and if necessary some specialized pokemon classes.

  3. #3
    magichaxx is offline Member
    Join Date
    Nov 2013
    Posts
    27
    Rep Power
    0

    Default Re: Tournament Program Help

    ok so im curious as to what else i would need in the pokemon class aside from all the getters and setters and basic stats as well as a bunch of equation methods for hit/miss, Attack and Sp. Atk, etc. (which i think would be easier to do with if-else statements). would i have to make a method for the stat ranges in the pokemon class and then make the 6 stats for all 32 pokemon?

  4. #4
    superhaNds is offline Senior Member
    Join Date
    Apr 2013
    Location
    Sweden
    Posts
    268
    Rep Power
    2

    Default Re: Tournament Program Help

    It is up to you I suppose. You would want to set up everything in the Pokemon class.
    When you create a pokemon instance, you would pass the data necessary for the ranges and everything else to work and validate them (potentially).
    Ultimately, yes, each instance has a different state (values of attributes) than the other, but the same behavior (methods).

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,357
    Rep Power
    6

    Default Re: Tournament Program Help

    Behavior is a bit of a confusing term in the case of game development, since living entities in the game tend to also exhibit behavior that is in fact unique to the entity itself. But in code that would translate into one particular method that controls the behavior of that entity is specifically implemented for an entity; I like to call that one method think(). So you'd get something like:

    Java Code:
    public abstract class Pokemon {
    
      // ...
    
      public abstract void think();
      public void move() {
        // implement some basic move stuff that will be the same for all living entities
      }
    }
    Java Code:
    public class Pikachu extends Pokemon {
      public void think(){
        // implement behavior specific to Pikachu here
      } 
    
      public void move(){
    
        // perhaps do movement related things specific to Pikachu here, if any
      }
    }
    Simple example, its usually more complex than this depending on the type of game.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    magichaxx is offline Member
    Join Date
    Nov 2013
    Posts
    27
    Rep Power
    0

    Default Re: Tournament Program Help

    im still pretty new to this so i was actually gonna use artificial behavior by using the random number generator. im not using nature or size or weight, just pure stats. the only thing really influenced by "behavior" is whether an attack is Attack or Sp. Atk, which, as i said, is a usage ratio based on the ratio of physical to special moves in that Pokemon's type(s). i was thinking i would make a few groups of if-else statements in a while loop to determine the outcome. again, im not sure where to place all the info.

  7. #7
    superhaNds is offline Senior Member
    Join Date
    Apr 2013
    Location
    Sweden
    Posts
    268
    Rep Power
    2

    Default Re: Tournament Program Help

    Then a generic Pokemon class with the stats as data fields would serve you fine.

    Everything that concerns a pokemon should be in the class; your stats and the operations necessary.

    Do you mean that you will use a loop to determine the outcome of a battle?

    well, the use of if-else statements is something rudimentary and not so much a design choice. Check the switch statement as well.

  8. #8
    magichaxx is offline Member
    Join Date
    Nov 2013
    Posts
    27
    Rep Power
    0

    Default Re: Tournament Program Help

    i want a loop for when HP > 0, that way both Pokemon will battle until one reaches 0 and faints. also, i cant figure out how to prevent ambiguity among Pokemon with similar data fields, i.e. in a formula where when Articuno's Attack > Zapdos' Defense, i dont want the program to think Zapdos' Defense is Articuno's Defense.

  9. #9
    Daryn is offline Senior Member
    Join Date
    Oct 2012
    Posts
    176
    Rep Power
    3

    Default Re: Tournament Program Help

    Create Two Class one that is the game function and one to store pokemons Info
    Java Code:
    public class attack{
               Pokemon zapatos = new Pokemon();
               Pokemon pickachu = new Pokemon();
               public void attack(Pokemon pokemon1,Pokemon pokemon2){
    
               }
    }
    class Pokemon{
            int health;
            int attack;
        public void set stats(int health,int attack){
             this.health=health;
             this.attack = attack;
       }
    
    }

Similar Threads

  1. Replies: 4
    Last Post: 12-18-2013, 10:07 PM
  2. Running a game tournament
    By Hazza in forum New To Java
    Replies: 6
    Last Post: 04-27-2013, 09:25 PM
  3. Tournament Pool and Bracket Tracker 0.6.1
    By java software in forum Java Software
    Replies: 0
    Last Post: 03-22-2013, 11:22 PM
  4. Help With Tournament Trees
    By wiggsfly in forum New To Java
    Replies: 2
    Last Post: 10-26-2008, 10:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •