Spoofus

Spoof Window_skill non RO

Jul 15th, 2013
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. #==============================================================================
  2. # ** Window_Skill
  3. #------------------------------------------------------------------------------
  4. # This window displays usable skills on the skill and battle screens.
  5. #==============================================================================
  6.  
  7. class Window_Skill < Window_Selectable
  8. #--------------------------------------------------------------------------
  9. # * Object Initialization
  10. # actor : actor
  11. #--------------------------------------------------------------------------
  12. def initialize(actor)
  13. super(120, 128, 190, 90)
  14. @actor = actor
  15. if $game_temp.in_battle
  16. @column_max = 1
  17. else
  18. @column_max = 2
  19. end
  20. refresh
  21. self.index = 0
  22. # If in battle, move window to center of screen
  23. # and make it semi-transparent
  24. if $game_temp.in_battle
  25. self.y = 320
  26. self.height = 160
  27. self.back_opacity = $game_system.window_opacity #**
  28. end
  29. end
  30. #--------------------------------------------------------------------------
  31. # * Acquiring Skill
  32. #--------------------------------------------------------------------------
  33. def skill
  34. return @data[self.index]
  35. end
  36. #--------------------------------------------------------------------------
  37. # * Refresh
  38. #--------------------------------------------------------------------------
  39. def refresh
  40. if self.contents != nil
  41. self.contents.dispose
  42. self.contents = nil
  43. end
  44. @data = []
  45. skill = $data_skills[@actor.skills[i]]
  46. if skill != nil
  47. @data.push(skill)
  48. end
  49. end
  50. # If item count is not 0, make a bit map and draw all items
  51. @item_max = @data.size
  52. if @item_max > 0
  53. self.contents = Bitmap.new(width - 32, row_max * 32)
  54. for i in 0...@item_max
  55. draw_item(i)
  56. end
  57. end
  58. end
  59. #--------------------------------------------------------------------------
  60. # * Draw Item
  61. # index : item number
  62. #--------------------------------------------------------------------------
  63. def draw_item(index)
  64. skill = @data[index]
  65. if @actor.skill_can_use?(skill.id)
  66. self.contents.font.color = normal_color
  67. else
  68. self.contents.font.color = disabled_color
  69. end
  70. x = 4 + index % 2 * (288 + 32)
  71. y = index / 2 * 32
  72. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  73. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  74. bitmap = RPG::Cache.icon(skill.icon_name)
  75. opacity = self.contents.font.color == normal_color ? 255 : 128
  76. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  77. self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  78. self.contents.draw_text(x + 100, y, 48, 32, skill.sp_cost.to_s, 2)
  79. end
  80. #--------------------------------------------------------------------------
  81. # * Help Text Update
  82. #--------------------------------------------------------------------------
  83. def update_help
  84. @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  85. end
  86. end
Advertisement
Add Comment
Please, Sign In to add comment