Spoofus

Spoof Window_skill RO required

Jul 15th, 2013
59
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. for i in 0...@actor.skills.size
  46. skill = $data_skills[@actor.skills[i]]
  47. if skill != nil
  48. @data.push(skill)
  49. end
  50. end
  51. # If item count is not 0, make a bit map and draw all items
  52. @item_max = @data.size
  53. if @item_max > 0
  54. self.contents = Bitmap.new(width - 32, row_max * 32)
  55. for i in 0...@item_max
  56. draw_item(i)
  57. end
  58. end
  59. end
  60. #--------------------------------------------------------------------------
  61. # * Draw Item
  62. # index : item number
  63. #--------------------------------------------------------------------------
  64. def draw_item(index)
  65. skill = @data[index]
  66. if @actor.skill_can_use?(skill.id)
  67. self.contents.font.color = normal_color
  68. else
  69. self.contents.font.color = disabled_color
  70. end
  71. if $game_temp.in_battle
  72. x = 4 + index % 1 * (288 + 32)
  73. y = index / 1 * 32
  74. else
  75. x = 4 + index % 2 * (288 + 32)
  76. y = index / 2 * 32
  77. end
  78. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  79. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  80. bitmap = RPG::Cache.icon(skill.icon_name)
  81. opacity = self.contents.font.color == normal_color ? 255 : 128
  82. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  83. self.contents.font.size = 14
  84. self.contents.font.bold = true
  85. self.contents.draw_text(x + 28, y, 200, 32, skill.name, 0)
  86. skill = @data[index]
  87. # decide color depending on the fact if currently usable
  88. if @actor.skill_can_use?(skill.id)
  89. self.contents.font.color = normal_color
  90. else
  91. self.contents.font.color = disabled_color
  92. end
  93. # remove old SP display
  94. self.contents.fill_rect(236 + index % 1 * 320, index / 1 * 32, 48, 32,
  95. Color.new(0, 0, 0, 0))
  96. # calculate SP cost considering skill level
  97. sp_cost = (skill.sp_cost * @actor.get_skill_sp_cost_factor(skill.id)).to_i
  98. # draw SP cost
  99. self.contents.draw_text(107 + index % 1 * 320, index / 1 * 32, 48, 32,
  100. sp_cost.to_s, 2)
  101. #self.contents.draw_text(x + 100, y, 48, 32, skill.sp_cost.to_s, 2)
  102. end
  103. #--------------------------------------------------------------------------
  104. # * Help Text Update
  105. #--------------------------------------------------------------------------
  106. def update_help
  107. @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  108. end
  109. end
RAW Paste Data