summaryrefslogtreecommitdiff
path: root/app/models/equipment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/equipment.rb')
-rw-r--r--app/models/equipment.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/app/models/equipment.rb b/app/models/equipment.rb
index e1dc7a3..12e8ae7 100644
--- a/app/models/equipment.rb
+++ b/app/models/equipment.rb
@@ -5,6 +5,17 @@ class Equipment < ApplicationRecord
:left_ring, :right_ring, :waist, :legs, :feet, :curio]
validates :slot, presence: true, uniqueness: { scope: :character }
+ def self.random_break_slot
+ roll = rand
+ if roll >= 0.99933333
+ [:neck, :left_ring, :right_ring].sample
+ elsif roll >= 0.999
+ [:back, :waist, :curio].sample
+ elsif roll >= 0.998
+ [:mainhand, :offhand, :head, :torso, :grip, :legs, :feet].sample
+ end
+ end
+
def slot
self[:slot].to_sym
end
@@ -14,14 +25,6 @@ class Equipment < ApplicationRecord
end
def break_check
- roll = rand
- if [:neck, :left_ring, :right_ring].include?(slot)
- destroy and return true if roll > 0.9998
- elsif [:back, :waist, :curio].include?(slot)
- destroy and return true if roll > 0.9996
- else
- destroy and return true if roll > 0.999
- end
false
end
end