diff options
author | David Gay <david@davidgay.org> | 2021-05-06 09:42:43 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-06 09:42:43 -0400 |
commit | 25c499ae942086b460b886e3d79dc5a55e5f1214 (patch) | |
tree | 42c4f62fdbfce959537806d4e8ddc25ade341b29 /app/controllers | |
parent | 82fa2b72be613713d42b451e0d1801904b4580e8 (diff) |
Implement drop table scaling
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/game_controller.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb index 4e55924..d69645f 100644 --- a/app/controllers/game_controller.rb +++ b/app/controllers/game_controller.rb @@ -13,7 +13,15 @@ class GameController < ApplicationController result[:table].sort_by { |_, v| -v[:score] }.each do |item_gid, item_data| quantity = item_data[:quantity] || 1 - if table_roll >= item_data[:score] + + score = item_data[:score] + if result[:table_scaling] + result[:table_scaling][:skills]&.each do |skill_gid, scale_value| + score = score**(1 + (scale_value * current_char.skill_level(skill_gid))) + end + end + + if table_roll >= score item = Item.find_by_gid(item_gid) xp_awards = {} if item.whatnot && item.whatnot.key?(:xp_value) |