Advertisement
Spoofus

Spoof Window_skill non RO

Jul 15th, 2013
165
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. 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. x = 4 + index % 2 * (288 + 32)
  72. y = index / 2 * 32
  73. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  74. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  75. bitmap = RPG::Cache.icon(skill.icon_name)
  76. opacity = self.contents.font.color == normal_color ? 255 : 128
  77. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  78. self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  79. self.contents.draw_text(x + 100, y, 48, 32, skill.sp_cost.to_s, 2)
  80. end
  81. #--------------------------------------------------------------------------
  82. # * Help Text Update
  83. #--------------------------------------------------------------------------
  84. def update_help
  85. @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  86. end
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement