Spoofus

Spoof Window_skill RO required

Jul 15th, 2013
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 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. if $game_temp.in_battle
  71. x = 4 + index % 1 * (288 + 32)
  72. y = index / 1 * 32
  73. else
  74. x = 4 + index % 2 * (288 + 32)
  75. y = index / 2 * 32
  76. end
  77. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  78. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  79. bitmap = RPG::Cache.icon(skill.icon_name)
  80. opacity = self.contents.font.color == normal_color ? 255 : 128
  81. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  82. self.contents.font.size = 14
  83. self.contents.font.bold = true
  84. self.contents.draw_text(x + 28, y, 200, 32, skill.name, 0)
  85. skill = @data[index]
  86. # decide color depending on the fact if currently usable
  87. if @actor.skill_can_use?(skill.id)
  88. self.contents.font.color = normal_color
  89. else
  90. self.contents.font.color = disabled_color
  91. end
  92. # remove old SP display
  93. self.contents.fill_rect(236 + index % 1 * 320, index / 1 * 32, 48, 32,
  94. Color.new(0, 0, 0, 0))
  95. # calculate SP cost considering skill level
  96. sp_cost = (skill.sp_cost * @actor.get_skill_sp_cost_factor(skill.id)).to_i
  97. # draw SP cost
  98. self.contents.draw_text(107 + index % 1 * 320, index / 1 * 32, 48, 32,
  99. sp_cost.to_s, 2)
  100. #self.contents.draw_text(x + 100, y, 48, 32, skill.sp_cost.to_s, 2)
  101. end
  102. #--------------------------------------------------------------------------
  103. # * Help Text Update
  104. #--------------------------------------------------------------------------
  105. def update_help
  106. @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  107. end
  108. end
Advertisement
Add Comment
Please, Sign In to add comment