Advertisement
marlosgama

Untitled

Apr 22nd, 2020
958
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.90 KB | None | 0 0
  1. class Sprite_Desc
  2.  
  3.   attr_writer :z
  4.  
  5.   def visible=(visible)
  6.     dispose
  7.   end
  8.  
  9.   def bitmap
  10.     self
  11.   end
  12.  
  13.   def dispose
  14.     @bitmap.dispose if @bitmap
  15.   end
  16.  
  17.   def refresh(item)
  18.     x = Mouse.x + 12 + 200 > Graphics.width ? Graphics.width - 200 : Mouse.x + 12
  19.     y = Mouse.y + 12 + 170 > Graphics.height ? Graphics.height - 170 : Mouse.y + 12
  20.     position = Display::Position.new x, y
  21.     if item.is_a?(RPG::Item)
  22.       i = Display::Consumable::Data.new
  23.       i.name = item.name
  24.       i.description = item.description
  25.       i.level = item.level
  26.       i.consumable = item.consumable
  27.       i.key_item = item.key_item?
  28.       @bitmap = Display::Consumable::Renderer.new(position, i)
  29.     elsif item.is_a?(RPG::EquipItem)
  30.       i = Display::Equippable::Data.new
  31.       i.name = item.name
  32.       i.description = item.description
  33.       i.level = item.level
  34.       i.equippable = $game_actors[1].equippable?(item)
  35.       i.attributes = {
  36.         'atk' => item.params[0],
  37.         'def' => item.params[1],
  38.         'matk' => item.params[2],
  39.         'mdef' => item.params[3],
  40.         'agi' => item.params[4],
  41.         'luck' => item.params[5],
  42.         'mhp' => item.params[6],
  43.         'mmp' => item.params[7]
  44.       }
  45.       i.price = item.price
  46.       x = Mouse.x + 12 + 200 > Graphics.width ? Graphics.width - 200 : Mouse.x + 12
  47.       y = Mouse.y + 12 + 255 > Graphics.height ? Graphics.height - 255 : Mouse.y + 12
  48.       position = Display::Position.new x, y
  49.       @bitmap = Display::Equippable::Renderer.new(position, i)
  50.     else
  51.       i = Display::Skill::Data.new
  52.       i.name = item.name
  53.       i.description = item.description
  54.       i.base_damage = item.damage.eval($game_actors[1], Game_Battler.new, $game_variables).abs
  55.       i.mp_cost = item.mp_cost
  56.       i.precision = item.success_rate
  57.       @bitmap = Display::Skill::Renderer.new(position, i)
  58.     end
  59.     @bitmap.render
  60.   end
  61.  
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement