diff options
author | David Gay <david@davidgay.org> | 2021-04-07 22:20:14 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-04-07 22:20:14 -0400 |
commit | b1d335e65bfcd813c3565257f8c18f22cdac08dc (patch) | |
tree | 90746516cc5fda892345a38a60d66c8b4da19fe2 /app/controllers/games/ptu/encounters_controller.rb | |
parent | 5fc450ebd4249efc15e41b1b152a214697f5f415 (diff) |
Hacked together Pokemon generator
Diffstat (limited to 'app/controllers/games/ptu/encounters_controller.rb')
-rw-r--r-- | app/controllers/games/ptu/encounters_controller.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/games/ptu/encounters_controller.rb b/app/controllers/games/ptu/encounters_controller.rb new file mode 100644 index 0000000..a7da852 --- /dev/null +++ b/app/controllers/games/ptu/encounters_controller.rb @@ -0,0 +1,13 @@ +class Games::Ptu::EncountersController < ApplicationController + def index + @pokemons = PtuPokemon.all + if params[:commit] + @results = [] + pokemon = PtuPokemon.find(params[:pokemon]) + params[:count].to_i.times do + level = rand(params[:min_level].to_i..params[:max_level].to_i) + @results.push(pokemon.random_stat_hash(level: level)) + end + end + end +end |