Skip to content

GameLogic Package

AmitSheer edited this page Dec 16, 2020 · 12 revisions

GameLogic Package

Holds classes that communicate with the server and control the game flow.

GameLogic Package Classes

  • Game
    control games flow, communicates with the server and updates relevant classes with data from server
  • GameManager
    organizes data from server
  • Pokemon
    Holds data for location and value of pokemon to catch
  • PokemonTrainer
    Holds data for location, current value and path to nearest pokemon

General Description of Methods, Divided by Class

  • Game

    • getKey()
      returns the key
    • _getLocation()
      returns node currents location
    • getWeight()
      returns the weight of the edge
    • setLocation(geo_location p)
      sets node current location
    • setWeight(double w)
      sets the node current weight
    • getInfo()
      returns the info held on graph
    • setInfo(String s)
      sets the info held in graph
    • getTag()
      returns current graph tag
    • setTag(int t)
      sets current graph tag
    • toString()
      return the node in string form
  • GameManager

    • getTime()
      returns time until game ends
    • setTime(Date time)
      sets time until game ends
    • updateTrainerPath(List<node_data> pathToPokemon, int trainerId)
      updates the path a trainer needs to follow to catch a pokemon
    • getPokemons()
      returns a list of all pokemons
    • setPokemons(HashSet pokemons)
      sets a new set of pokemons
    • setPokemons(String pokemons)
      sets a new set of pokemons
    • getAlgo()
      returns current algo used
    • setAlgo(dw_graph_algorithms _algo)
      sets a new algo to use
    • getTrainers()
      returns trainers
    • getTrainer(int id)
      returns a specific trainer with given id
    • setTrainers(List trainers)
      sets new trainers
    • getGraph()
      return current graph used
    • setGraph(directed_weighted_graph _graph)
      sets graph to be used
    • getGameStatus()
      returns current game status
    • setGameStatus()
      sets a new game status
    • updateEdge(Pokemon fr, directed_weighted_graph g)
      find and updates edge for a pokemon
    • json2Pokemons(String fs, directed_weighted_graph graph)
      converts JSON string of pokemons to a Pokemon Object
    • getTrainers(String aa, directed_weighted_graph gg)
      converts a JSON and updates the current trainers held in GameManager
    • w2f(directed_weighted_graph g, Range2D frame)
      converts game to size to fit new panel size
    • toString()
      return the node in string form
  • Pokemon_

    • getType()
      converts text in JSON format to Graph and returns it
    • setType(int _type)
      sets the pokemon type
    • getEdge()
      gets current edge
    • setEdge(edge_data _edge)
      sets the current edge
    • getLocation()
      return current location
    • setLocation(geo_location _pos)
      updates current location
  • PokemonTrainer

    • getPathToPokemon()
      returns list of nodes the trainer needs to go through
    • getNextPoke()
      return the next pokemon the trainer needs to eat
    • setNextPoke(Pokemon nextPoke)
      sets the next pokemon the trainer needs to eat
    • setPathToPokemon(List<node_data> pathToPokemon)
      sets the new path the trainer needs to follow
    • update(String json)
      updates all of the data of the trainer from JSON format string
    • getID()
      return trainers id
    • setID(int ID)
      sets trainers id
    • get_curr_node()
      return current node trainer is on
    • set_curr_node(int _curr_node)
      sets new node trainer is on
    • set_speed(double _speed)
      sets the trainer current travel speed
    • get_money()
      return the total value of pokemons the trainer collected
    • set_money(double _value)
      sets new total value of pokemons the trainer collected
    • set_next_node(int _next_node)
      sets next node to visit
      • getLocation()
        return returns trainer current location
    • setLocation(geo_location _pos)
      sets trainer new location
      • get_dest()
        returns trainer destination
    • getEndNodeId()
      the last node trainer needs to go to
    • get_curr_edge()
      returns current edge trainer is on
    • set_curr_edge(edge_data _curr_edge)
      sets a new edge the agent is on
Clone this wiki locally