summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/game_controller.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb
index b0fdaea..dcfc3a3 100644
--- a/app/controllers/game_controller.rb
+++ b/app/controllers/game_controller.rb
@@ -32,6 +32,14 @@ class GameController < ApplicationController
when "monster"
raise TooManyWoundsError unless current_char.can_fight?
next if rand > (result[:chance] || 1)
+
+ if result[:table].pluck(:gid).include?(current_char.trophy_monster_gid)
+ monster = Monster.find_by_gid(current_char.trophy_monster_gid)
+ @results.push({ type: type, monster: monster })
+ resolve_combat_with(monster)
+ break
+ end
+
table_roll = rand
result[:table].sort_by { |t| -t[:score] }.each do |table_entry|
score = table_entry[:score]