IceDragon200

DD Stuff Thing Ma Jig

Mar 12th, 2012
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.52 KB | None | 0 0
  1. # // By IceDragon && Nelderson
  2. class RPG::UsableItem::Damage
  3.   def dice(x,y)
  4.     x + rand((x*y) + 1)
  5.   end
  6. end
  7. module DataManager
  8.   class << self
  9.     alias :it_load_database :load_database
  10.     def load_database(*args,&block)
  11.       it_load_database(*args,&block)
  12.       ($data_items+$data_skills).compact.each do |obj|
  13.         s = obj.damage.formula
  14.         s = s.gsub(/(\-?\d+)[d](\-?\d+)/i) do
  15.           a,b = $1,$2
  16.           "dice(#{a},#{b})"
  17.         end
  18.         obj.damage.formula = s
  19.       end
  20.     end
  21.   end  
  22. end
Advertisement
Add Comment
Please, Sign In to add comment