Advertisement
TmanDaCool1

Untitled

Apr 15th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.09 KB | None | 0 0
  1. #================================================
  2. # Level Up Box
  3. #================================================
  4. #V 2
  5. #By Akxiv
  6. #Modified at 27. June 2006
  7. #==============================================================================
  8. # ย Class Scene Battle
  9. #==============================================================================
  10. class Scene_Battle
  11. LEVEL_UP_SE = "" # Soundeffect for Level UP
  12. LEVEL_UP_ME = "Audio/ME/join" # Audio Sound for Level UP
  13. end
  14. class Window_SkillLearning < Window_Base
  15. SKILLLEARN_SE = "Audio/SE/itemobtained" # Soundeffect if Skill learning
  16. end
  17. #==============================================================================
  18. # Window_LevelUpWindow
  19. #------------------------------------------------------------------------------
  20. #==============================================================================
  21. class Window_LevelUpWindow < Window_Base
  22. #--------------------------------------------------------------------------
  23. def initialize(x, y, actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
  24. # super(x, y, 160, 192)
  25.  
  26. # super(x-x, y-64, 160, 192+64)
  27.  
  28. super(x-x, y-128, 320, 320)
  29.  
  30. self.contents = Bitmap.new(width - 32, height - 32)
  31. self.visible = false
  32. self.back_opacity = 160
  33. refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
  34. end
  35. #--------------------------------------------------------------------------
  36. def refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
  37. self.contents.clear
  38. self.contents.font.color = system_color
  39. self.contents.font.size = 25
  40. self.contents.font.name = "EsbeltaINTL"
  41. self.contents.draw_text( 20, 0, 160, 24, " Level UP!")
  42. self.contents.font.size = 25
  43. self.contents.font.name = "EsbeltaINTL"
  44. self.contents.draw_text( 0, 28+64, 160, 24, $data_system.words.hp)
  45. self.contents.draw_text( 0, 50+64, 160, 24, $data_system.words.sp)
  46. self.contents.font.size = 25
  47. self.contents.font.name = "EsbeltaINTL"
  48. self.contents.draw_text( 0, 0+64, 128, 24, "Level")
  49. self.contents.draw_text( 0, 72+64, 144, 24, "Strength")
  50. self.contents.draw_text( 0, 94+64, 144, 24, "Dexterity")
  51. self.contents.draw_text( 0, 116+64, 144, 24, "Agility")
  52. self.contents.draw_text( 0, 138+64, 144, 24, "Intelligence")
  53. self.contents.font.size = 25
  54. self.contents.font.color = normal_color
  55. #self.contents.draw_text( 0, 0+64, 72, 24, "+" + (actor.level-last_lv).to_s, 2)
  56. self.contents.draw_text( 96, 28+64, 72, 24, "+" + up_hp.to_s, 2)
  57. self.contents.draw_text( 96, 50+64, 72, 24, "+" + up_sp.to_s, 2)
  58. self.contents.draw_text( 96, 72+64, 72, 24, "+" + up_str.to_s, 2)
  59. self.contents.draw_text( 96, 94+64, 72, 24, "+" + up_dex.to_s, 2)
  60. self.contents.draw_text( 96, 116+64, 72, 24, "+" + up_agi.to_s, 2)
  61. self.contents.draw_text( 96, 138+64, 72, 24, "+" + up_int.to_s, 2)
  62. self.contents.font.size = 25
  63. self.contents.font.name = "EsbeltaINTL"
  64. self.contents.draw_text( 96, 0+64, 128, 24, actor.level.to_s, 2)
  65. self.contents.draw_text( 96, 26+64, 128, 24, actor.maxhp.to_s, 2)
  66. self.contents.draw_text( -40, 26, 128, 24, actor.name, 2)
  67. self.contents.draw_text( 96, 48+64, 128, 24, actor.maxsp.to_s, 2)
  68. self.contents.draw_text( 96, 70+64, 128, 24, actor.str.to_s, 2)
  69. self.contents.draw_text( 96, 92+64, 128, 24, actor.dex.to_s, 2)
  70. self.contents.draw_text( 96, 114+64, 128, 24, actor.agi.to_s, 2)
  71. self.contents.draw_text( 96, 136+64, 128, 24, actor.int.to_s, 2)
  72. # Make actor graphic
  73. @sprite = Sprite.new
  74. @sprite.bitmap = RPG::Cache.picture(actor.name)
  75. end
  76. end
  77. #==============================================================================
  78. # ยยก Window_SkillLearning
  79. #==============================================================================
  80. class Window_SkillLearning < Window_Base
  81. #--------------------------------------------------------------------------
  82. attr_reader :learned
  83. #--------------------------------------------------------------------------
  84.  
  85. def initialize(class_id, last_lv, now_lv)
  86. # super(160, 64-32, 320, 64)
  87. super(320, 0, 320, 64)
  88. self.contents = Bitmap.new(width - 32, height - 28)
  89. self.visible = false
  90. self.back_opacity = 160
  91. @learned = false
  92. refresh(class_id, last_lv, now_lv)
  93. # Dispose of actor graphic
  94.   @sprite.bitmap.dispose
  95.   @sprite.dispose
  96. end
  97. #--------------------------------------------------------------------------
  98.  
  99. def refresh(class_id, last_lv, now_lv)
  100. for i in 0...$data_classes[class_id].learnings.size
  101. learn_lv = $data_classes[class_id].learnings[i].level
  102. if learn_lv > last_lv and learn_lv <= now_lv
  103. @learned = true
  104. if SKILLLEARN_SE != "" #SE for Skilllearning
  105. Audio.se_play(SKILLLEARN_SE)
  106. end
  107. skill_name = $data_skills[$data_classes[class_id].learnings[i].skill_id].name
  108. self.contents.clear
  109. self.contents.font.name = "EsbeltaINTL"
  110. self.contents.draw_text(0,0,448,32, "Learned " + skill_name + "! (Press Z)") #Skillname and then your text (here is for example Cut learned !!)
  111. self.visible = true
  112. loop do
  113. Graphics.update
  114. Input.update
  115. update
  116. if @learned == false
  117. break
  118. end
  119. end
  120. end
  121. end
  122. end
  123. #--------------------------------------------------------------------------
  124. def update
  125. if Input.trigger?(Input::A)
  126. @learned = false
  127. self.visible = false
  128. end
  129. end
  130. end
  131. #==============================================================================
  132. # Window_BattleStatus
  133. #==============================================================================
  134. class Window_BattleStatus < Window_Base
  135. #--------------------------------------------------------------------------
  136. attr_accessor :level_up_flags # LEVEL UP!
  137. end
  138. #==============================================================================
  139. # Scene_Battle
  140. #==============================================================================
  141. class Scene_Battle
  142. #--------------------------------------------------------------------------
  143. alias xrxs_bp10_start_phase5 start_phase5
  144. def start_phase5
  145. xrxs_bp10_start_phase5
  146. @exp_gained = battle_exp
  147. for i in 0...$game_party.actors.size
  148. actor = $game_party.actors[i]
  149. if actor.cant_get_exp? == false
  150. last_level = actor.level
  151. actor.exp -= @exp_gained
  152. if actor.level < last_level
  153. @status_window.level_up_flags[i] = false
  154. end
  155. end
  156. end
  157. @exp_gain_actor = -1
  158. @result_window.visible = true
  159. end
  160. #--------------------------------------------------------------------------
  161. alias xrxs_bp10_update_phase5 update_phase5
  162. def update_phase5
  163. @level_up_phase_done = false if @level_up_phase_done != true
  164. if Input.trigger?(Input::A)
  165. @levelup_window.visible = false if @levelup_window != nil
  166. @status_window.level_up_flags[@exp_gain_actor] = false
  167. @level_up_phase_done = phase5_next_levelup
  168. end
  169. if @level_up_phase_done
  170. if @phase5_wait_count < 2
  171. @result_window.opacity = 0
  172. @result_window.back_opacity = 0
  173. @result_window.contents_opacity = 0
  174. end
  175. xrxs_bp10_update_phase5
  176. battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0
  177. end
  178. end
  179. #--------------------------------------------------------------------------
  180. def phase5_next_levelup
  181. begin
  182. @exp_gain_actor += 1
  183. if @exp_gain_actor >= $game_party.actors.size
  184. return true
  185. end
  186. actor = $game_party.actors[@exp_gain_actor]
  187. if actor.cant_get_exp? == false
  188. last_level = actor.level
  189. last_maxhp = actor.maxhp
  190. last_maxsp = actor.maxsp
  191. last_str = actor.str
  192. last_dex = actor.dex
  193. last_agi = actor.agi
  194. last_int = actor.int
  195. actor.exp += @exp_gained
  196. if actor.level > last_level
  197. @status_window.level_up(@exp_gain_actor)
  198. @result_window.visible = false
  199. if LEVEL_UP_SE != ""
  200. Audio.se_play(LEVEL_UP_SE)
  201. end
  202. if LEVEL_UP_ME != ""
  203. Audio.me_stop
  204. Audio.me_play(LEVEL_UP_ME)
  205. end
  206. actors_size = [$game_party.actors.size, 4].max
  207. x_shift = 160 + (640 - 160*actors_size)/(actors_size - 1)
  208. x = x_shift * @exp_gain_actor
  209. y = 128
  210. @levelup_window = Window_LevelUpWindow.new(x, y, actor, last_level,
  211. actor.maxhp - last_maxhp, actor.maxsp - last_maxsp, actor.str - last_str,
  212. actor.dex - last_dex, actor.agi - last_agi, actor.int - last_int)
  213. @levelup_window.visible = true
  214. @status_window.refresh
  215. @skilllearning_window = Window_SkillLearning.new(actor.class_id, last_level, actor.level)
  216. @phase5_wait_count = 40
  217. return false
  218. end
  219. end
  220. end until false
  221. end
  222.  
  223. def battle_exp
  224. bexp = 0
  225. for enemy in $game_troop.enemies
  226. unless enemy.hidden
  227. bexp += enemy.exp
  228. end
  229. end
  230. return bexp
  231. end
  232.  
  233. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement