Project1

标题: 技能脚本出错,求助。 [打印本页]

作者: 江南小帅瓜    时间: 2014-5-17 20:23
标题: 技能脚本出错,求助。
本帖最后由 江南小帅瓜 于 2014-5-18 16:00 编辑

使用技能是出错,提示:


提示的出错脚本为:
    @skill_window = Window_Skill2.new(@active_actor, skill_kind)
作者: 芯☆淡茹水    时间: 2014-5-17 21:50
参数错误,请帖上脚本:Window_Skill2
作者: 江南小帅瓜    时间: 2014-5-17 22:26
芯☆淡茹水 发表于 2014-5-17 21:50
参数错误,请帖上脚本:Window_Skill2
  1. #==============================================================================
  2. # ■ Window_Skill 2
  3. #################################################################
  4. class Window_Skill2 < Window_Selectable
  5.   def initialize(actor, skill_kind)
  6.     super(0, 328, 460, 352)
  7.     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  8.     @skill_kind = skill_kind
  9.     @column_max = 2
  10.     refresh
  11.     self.index = 0
  12.     if $game_temp.in_battle
  13.       self.y = 343
  14.       self.z = 99999
  15.       self.height = 137
  16.       self.contents.font.size = 20
  17.       self.back_opacity = 230
  18.     self.contents.font.name = "Georgia"
  19.     self.contents.font.bold   = true            
  20.     self.contents.font.italic = true

  21.       end
  22.   end
  23.   def skill
  24.     return @data[self.index]
  25.   end
  26.   def refresh
  27.     if self.contents != nil
  28.       self.contents.dispose
  29.       self.contents = nil
  30.     end
  31.     @data = []
  32.     for i in [email protected]
  33.       skill = $data_skills[@actor.skills[i]]
  34.       if skill != nil and skill.element_set.include?(@skill_kind)
  35.         @data.push(skill)
  36.       end
  37.     end
  38.     @item_max = @data.size
  39.     if @item_max > 0
  40.       self.contents = Bitmap.new(width - 32, row_max * 32)
  41.       for i in 0...@item_max
  42.         draw_item(i)
  43.       end
  44.     end
  45.   end
  46.   def draw_item(index)
  47.     skill = @data[index]
  48.     if @actor.skill_can_use?(skill.id)
  49.       self.contents.font.color = normal_color
  50.     else
  51.       self.contents.font.color = disabled_color
  52.     end
  53.     x = 2 + index % 2 * (180 + 32)
  54.     y = index / 2 * 32
  55.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  56.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  57.     bitmap = RPG::Cache.icon(skill.icon_name)
  58.     opacity = self.contents.font.color == normal_color ? 255 : 128
  59.         self.contents.font.bold   = true            
  60.     self.contents.font.italic = true

  61.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  62.     self.contents.draw_text(x + 28, y, 120, 32, skill.name, 0)
  63.     self.contents.font.name = "Georgia"
  64.     self.contents.font.color = Color.new(  50,  160,  255, 192)
  65.     self.contents.font.name = "Arial"
  66.     self.contents.draw_text(x + 155, y,48, 32, skill.sp_cost.to_s, 2)
  67.     self.contents.font.name = "Georgia"
  68.     self.contents.font.color = text_color(5)
  69.    ##############Mogslayer########################################
  70.    #Nota caso você não quiser desenho do SP na janela, apague
  71.    #a linha abaixo.
  72.    draw_sp (x +163,y +23)
  73.    ###############################################################
  74.       end
  75.     def update_help
  76.     @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  77.   end
  78. end
复制代码
会不会是脚本排序问题,我是整合系统的。
作者: 江南小帅瓜    时间: 2014-5-17 22:57
江南小帅瓜 发表于 2014-5-17 22:26
会不会是脚本排序问题,我是整合系统的。

把系统菜单技能脚本:
  1. #_______________________________________________________________________________
  2. # MOG Scene Skill Nami V2.0            
  3. #_______________________________________________________________________________
  4. # By Moghunter   
  5. # http://www.atelier-rgss.com
  6. #_______________________________________________________________________________
  7. module MOG
  8. #Transition Time.
  9. MSK_TT = 20
  10. #Transition Type(Name).
  11. MSK_TTT = "004-Blind04"  
  12. end
  13. $mogscript = {} if $mogscript == nil
  14. $mogscript["menu_nami"] = true
  15. ##############
  16. # Game_Actor #
  17. ##############
  18. class Game_Actor < Game_Battler
  19. def now_exp
  20. return [url=home.php?mod=space&uid=13302]@exp[/url] - @exp_list[@level]
  21. end
  22. def next_exp
  23. return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  24. end
  25. end
  26. ###############
  27. # Window_Base #
  28. ###############
  29. class Window_Base < Window
  30. def nada
  31. face = RPG::Cache.picture("")
  32. end   
  33. def drw_face(actor,x,y)
  34. face = RPG::Cache.picture(actor.name + "_fc") rescue nada
  35. cw = face.width
  36. ch = face.height
  37. src_rect = Rect.new(0, 0, cw, ch)
  38. self.contents.blt(x , y - ch, face, src_rect)   
  39. end     
  40. def draw_lay(x,y)
  41. lay = RPG::Cache.picture("MSK_Status")
  42. cw = lay.width
  43. ch = lay.height
  44. src_rect = Rect.new(0, 0, cw, ch)
  45. self.contents.blt(x , y - ch, lay, src_rect)   
  46. end  
  47. def nada
  48. face = RPG::Cache.picture("")
  49. end  
  50. def draw_heroface3(actor,x,y)
  51. face = RPG::Cache.picture(actor.name + "_fc3") rescue nada
  52. cw = face.width
  53. ch = face.height
  54. src_rect = Rect.new(0, 0, cw, ch)
  55. self.contents.blt(x , y - ch, face, src_rect)   
  56. end
  57. def draw_maphp3(actor, x, y)
  58. back = RPG::Cache.picture("BAR0")   
  59. cw = back.width  
  60. ch = back.height
  61. src_rect = Rect.new(0, 0, cw, ch)   
  62. self.contents.blt(x + 65, y - ch + 30, back, src_rect)
  63. meter = RPG::Cache.picture("HP_Bar")   
  64. cw = meter.width  * actor.hp / actor.maxhp
  65. ch = meter.height
  66. src_rect = Rect.new(0, 0, cw, ch)
  67. self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
  68. text = RPG::Cache.picture("HP_Tx")   
  69. cw = text.width  
  70. ch = text.height
  71. src_rect = Rect.new(0, 0, cw, ch)
  72. self.contents.blt(x + 35, y - ch + 30, text, src_rect)
  73. self.contents.font.color = Color.new(0,0,0,255)
  74. self.contents.draw_text(x + 81, y - 1, 48, 32, actor.hp.to_s, 2)
  75. self.contents.font.color = Color.new(255,255,255,255)
  76. self.contents.draw_text(x + 80, y - 2, 48, 32, actor.hp.to_s, 2)   
  77. end  
  78. def draw_mapsp3(actor, x, y)
  79. back = RPG::Cache.picture("BAR0")   
  80. cw = back.width  
  81. ch = back.height
  82. src_rect = Rect.new(0, 0, cw, ch)   
  83. self.contents.blt(x + 65, y - ch + 30, back, src_rect)
  84. meter = RPG::Cache.picture("SP_Bar")   
  85. cw = meter.width  * actor.sp / actor.maxsp
  86. ch = meter.height
  87. src_rect = Rect.new(0, 0, cw, ch)
  88. self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
  89. text = RPG::Cache.picture("SP_Tx")   
  90. cw = text.width  
  91. ch = text.height
  92. src_rect = Rect.new(0, 0, cw, ch)
  93. self.contents.blt(x + 35, y - ch + 30, text, src_rect)
  94. self.contents.font.color = Color.new(0,0,0,255)
  95. self.contents.draw_text(x + 81, y - 1, 48, 32, actor.sp.to_s, 2)
  96. self.contents.font.color = Color.new(255,255,255,255)
  97. self.contents.draw_text(x + 80, y - 2, 48, 32, actor.sp.to_s, 2)   
  98. end  
  99. def draw_maphp4(actor, x, y)
  100. back = RPG::Cache.picture("BAR")   
  101. cw = back.width  
  102. ch = back.height
  103. src_rect = Rect.new(0, 0, cw, ch)   
  104. self.contents.blt(x + 65, y - ch + 30, back, src_rect)
  105. meter = RPG::Cache.picture("HP_Bar2")   
  106. cw = meter.width  * actor.hp / actor.maxhp
  107. ch = meter.height
  108. src_rect = Rect.new(0, 0, cw, ch)
  109. self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
  110. self.contents.font.color = Color.new(0,0,0,255)
  111. self.contents.draw_text(x + 66, y - 1, 100, 32, actor.hp.to_s + "/" + actor.maxhp.to_s, 1)  
  112. self.contents.font.color = Color.new(250,255,255,255)
  113. self.contents.draw_text(x + 65, y - 2, 100, 32, actor.hp.to_s + "/" + actor.maxhp.to_s, 1)  
  114. end  
  115. def draw_mapsp4(actor, x, y)
  116. back = RPG::Cache.picture("BAR")   
  117. cw = back.width  
  118. ch = back.height
  119. src_rect = Rect.new(0, 0, cw, ch)   
  120. self.contents.blt(x + 65 , y - ch + 30, back, src_rect)
  121. meter = RPG::Cache.picture("SP_Bar2")   
  122. cw = meter.width  * actor.sp / actor.maxsp
  123. ch = meter.height
  124. src_rect = Rect.new(0, 0, cw, ch)
  125. self.contents.blt(x + 65 , y - ch + 30, meter, src_rect)
  126. self.contents.font.color = Color.new(0,0,0,255)
  127. self.contents.draw_text(x + 66, y - 1, 100, 32, actor.sp.to_s + "/" + actor.maxsp.to_s, 1)  
  128. self.contents.font.color = Color.new(250,255,255,255)
  129. self.contents.draw_text(x + 65, y - 2, 100, 32, actor.sp.to_s + "/" + actor.maxsp.to_s, 1)  
  130. end
  131. def draw_mexp4(actor, x, y)
  132. actor = $game_party.actors[0]
  133. bitmap2 = RPG::Cache.picture("Exp_Back")
  134. cw = bitmap2.width
  135. ch = bitmap2.height
  136. src_rect = Rect.new(0, 0, cw, ch)
  137. self.contents.blt(x + 60 , y - ch + 30, bitmap2, src_rect)
  138. if actor.next_exp != 0
  139. rate = actor.now_exp.to_f / actor.next_exp
  140. else
  141. rate = 1
  142. end
  143. bitmap = RPG::Cache.picture("Exp_Meter")
  144. if actor.level < 99
  145. cw = bitmap.width * rate
  146. else
  147. cw = bitmap.width
  148. end   
  149. ch = bitmap.height
  150. src_rect = Rect.new(0, 0, cw, ch)
  151. self.contents.blt(x + 60 , y - ch + 30, bitmap, src_rect)
  152. self.contents.font.color = Color.new(0,0,0,255)
  153. self.contents.draw_text(x + 55, y + 1, 84, 32, "Exp",0)
  154. self.contents.font.color = Color.new(255,255,255,255)
  155. self.contents.draw_text(x + 54, y, 84, 32, "Exp",0)
  156. self.contents.font.color = Color.new(0,0,0,255)
  157. self.contents.draw_text(x + 190, y - 125, 60, 32,"LV " +  actor.level.to_s, 1)
  158. self.contents.font.color = Color.new(255,255,255,255)   
  159. self.contents.draw_text(x + 191, y - 124, 60, 32,"LV " + actor.level.to_s, 1)   
  160. end
  161. def draw_mexp_it(actor, x, y)
  162. lv_tx = RPG::Cache.picture("LV_tx")
  163. cw = lv_tx.width
  164. ch = lv_tx.height
  165. src_rect = Rect.new(0, 0, cw, ch)
  166. self.contents.blt(x + 60 , y - ch + 32, lv_tx, src_rect)
  167. self.contents.font.color = Color.new(0,0,0,255)
  168. self.contents.draw_text(x + 101, y + 5, 24, 32, actor.level.to_s, 1)
  169. self.contents.font.color = Color.new(255,255,255,255)
  170. self.contents.draw_text(x + 100, y + 4, 24, 32, actor.level.to_s, 1)
  171. end
  172. def draw_actor_state_it(actor, x, y, width = 80)
  173. text = make_battler_state_text(actor, width, true)
  174. self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
  175. self.contents.draw_text(x, y, width, 32, text,1)
  176. end
  177. end
  178. ######################
  179. # Window_Target_Item #
  180. ######################
  181. class Window_Target_face < Window_Selectable
  182. def initialize
  183. super(0, 130, 280, 300)
  184. self.contents = Bitmap.new(width - 32, height - 32)
  185. #self.contents.font.name = "Georgia"
  186. self.z += 10
  187. @item_max = $game_party.actors.size
  188. refresh
  189. end
  190. def refresh
  191. self.contents.clear
  192. for i in 0...$game_party.actors.size
  193. x = 4
  194. y = i * 65
  195. actor = $game_party.actors[i]
  196. drw_face(actor,x,y + 55)
  197. if $mogscript["TP_System"] == true
  198. draw_actor_tp(actor, x + 168, y + 27 ,4)
  199. else
  200. draw_mexp_it(actor, x + 110, y + 25 )
  201. end
  202. draw_actor_state_it(actor, x + 165, y )
  203. draw_maphp3(actor, x + 20, y + 0)
  204. draw_mapsp3(actor, x + 20, y + 32)
  205. end
  206. end
  207. def update_cursor_rect
  208. if [url=home.php?mod=space&uid=370741]@Index[/url] <= -2
  209. self.cursor_rect.set(0, (@index + 10) * 65, self.width - 32, 60)
  210. elsif @index == -1
  211. self.cursor_rect.set(0, 0, self.width - 32, @item_max * 64 )
  212. else
  213. self.cursor_rect.set(0, @index * 65, self.width - 32, 60)
  214. end
  215. end
  216. end
  217. #######################
  218. # Window_SkillStatus2 #
  219. #######################
  220. class Window_SkillStatus2 < Window_Base
  221. def initialize(actor)
  222. super(350, 75, 290, 340)
  223. self.contents = Bitmap.new(width - 32, height - 32)
  224. [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  225. self.opacity = 0
  226. #self.contents.font.name = "Georgia"
  227. refresh
  228. end

  229. def refresh
  230. self.contents.clear
  231. draw_lay(0,300)
  232. draw_heroface3(@actor,50,140)
  233. draw_actor_name(@actor, 15, 10)
  234. draw_actor_state(@actor, 120, 140)
  235. draw_mexp4(@actor, -30, 135)
  236. draw_maphp4(@actor, 5, 195)
  237. draw_mapsp4(@actor, 5, 240)
  238. if $mogscript["TP_System"] == true
  239. draw_actor_tp(@actor, 40, 265,1)
  240. end
  241. end
  242. end
  243. #################
  244. # Window_Skill2 #
  245. #################
  246. class Window_Skill2 < Window_Selectable
  247. def initialize(actor)
  248. super(0, 95, 335, 290)
  249. @actor = actor
  250. @column_max = 1
  251. refresh
  252. self.index = 0
  253. end
  254. def skill
  255. return @data[self.index]
  256. end
  257. def refresh
  258. if self.contents != nil
  259. self.contents.dispose
  260. self.contents = nil
  261. end
  262. @data = []
  263. for i in [email protected]
  264. skill = $data_skills[@actor.skills[i]]
  265. if skill != nil
  266. @data.push(skill)
  267. end
  268. end
  269. @item_max = @data.size
  270. if @item_max > 0
  271. self.contents = Bitmap.new(width - 32, row_max * 32)
  272. for i in 0...@item_max
  273. draw_item(i)
  274. end
  275. end
  276. end
  277. def draw_item(index)
  278. skill = @data[index]
  279. if @actor.skill_can_use?(skill.id)
  280. self.contents.font.color = normal_color
  281. else
  282. self.contents.font.color = disabled_color
  283. end
  284. #self.contents.font.name = "Georgia"
  285. x = index % 1 * (288)
  286. y = index / 1 * 32
  287. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  288. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  289. bitmap = RPG::Cache.icon(skill.icon_name)
  290. opacity = self.contents.font.color == normal_color ? 255 : 128
  291. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  292. self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  293. self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  294. if $mogscript["TP_System"] == true
  295. tp_cost = MOG::TP_COST[skill.id]
  296. if tp_cost != nil   
  297. self.contents.font.color = Color.new(50,250,150,255)
  298. self.contents.draw_text(x + 170, y, 48, 32, MOG::TP_NAME, 2)   
  299. else
  300. self.contents.font.color = Color.new(200,200,0,255)
  301. self.contents.draw_text(x + 170, y, 48, 32, $data_system.words.sp, 2)      
  302. end
  303. else
  304. self.contents.font.color = Color.new(200,200,0,255)
  305. self.contents.draw_text(x + 170, y, 48, 32, $data_system.words.sp, 2)   
  306. end
  307. end
  308. def update_help
  309. @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  310. end
  311. end
  312. ###############
  313. # Scene_Skill #
  314. ###############
  315. class Scene_Skill
  316. def initialize(actor_index = 0, equip_index = 0)
  317. @actor_index = actor_index
  318. end
  319. def main
  320. @actor = $game_party.actors[@actor_index]
  321. @msk_lay = Sprite.new
  322. @msk_lay.bitmap = RPG::Cache.picture("MSK_Lay")
  323. @msk_lay.z = 100
  324. @msk_back1 = Plane.new
  325. @msk_back1.bitmap = RPG::Cache.picture("MN_BK")
  326. @msk_back1.z = 10
  327. @help_window = Window_Help.new
  328. @help_window.y = 500
  329. @status_window = Window_SkillStatus2.new(@actor)
  330. @status_window.z = 110
  331. @status_window.x = 640
  332. @skill_window = Window_Skill2.new(@actor)
  333. @skill_window.help_window = @help_window
  334. @skill_window.help_window.y = 500
  335. @target_window = Window_Target_face.new
  336. @target_window.x = 640
  337. @target_window.y = 100
  338. @target_window.opacity = 0
  339. @target_window.visible = false
  340. @target_window.active = false
  341. @skill_window.opacity = 0
  342. @help_window.opacity = 0
  343. @slide = true
  344. Graphics.transition(MOG::MSK_TT, "Graphics/Transitions/" + MOG::MSK_TTT)
  345. loop do
  346. Graphics.update
  347. Input.update
  348. update
  349. if $scene != self
  350. break
  351. end
  352. end
  353. for i in 0..30
  354. @status_window.x += 25
  355. @target_window.x += 25
  356. Graphics.update  
  357. end  
  358. Graphics.freeze
  359. @help_window.dispose
  360. @status_window.dispose
  361. @skill_window.dispose
  362. @target_window.dispose
  363. @msk_lay.dispose
  364. @msk_back1.dispose
  365. end
  366. def update
  367. if @target_window.active == true
  368. @target_window.visible = true
  369. if @target_window.x > 340
  370. @target_window.x -= 15
  371. elsif @target_window.x <= 340
  372. @target_window.x = 340
  373. end
  374. else   
  375. if @target_window.x < 640
  376. @target_window.x += 15
  377. elsif @target_window.x >= 640
  378. @target_window.x = 640
  379. @target_window.visible = false
  380. end
  381. end  
  382. if @slide == true
  383. @status_window.visible = true
  384. if @status_window.x > 350
  385. @status_window.x -= 15
  386. elsif @status_window.x <= 350
  387. @status_window.x = 350
  388. end      
  389. else
  390. if @status_window.x < 640
  391. @status_window.x += 15
  392. elsif @status_window.x >= 640
  393. @status_window.x = 640
  394. @status_window.visible = false
  395. end  
  396. end
  397. @help_window.update
  398. @status_window.update
  399. @skill_window.update
  400. @target_window.update
  401. @msk_back1.ox += 1
  402. @msk_back1.oy += 1
  403. if @skill_window.help_window.y > 425
  404. @skill_window.help_window.y -= 5
  405. elsif @skill_window.help_window.y <= 425  
  406. @skill_window.help_window.y = 425
  407. end   
  408. if @skill_window.active
  409. update_skill
  410. return
  411. end
  412. if @target_window.active  
  413. update_target
  414. return
  415. end
  416. end
  417. def update_skill
  418. if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  419. @help_window.y = 500  
  420. end  
  421. if Input.trigger?(Input::B)
  422. $game_system.se_play($data_system.cancel_se)
  423. $scene = Scene_Menu.new(1)
  424. return
  425. end
  426. if Input.trigger?(Input::C)
  427. [url=home.php?mod=space&uid=260100]@skill[/url] = @skill_window.skill
  428. if @skill == nil or not @actor.skill_can_use?(@skill.id)
  429. $game_system.se_play($data_system.buzzer_se)
  430. return
  431. end
  432. $game_system.se_play($data_system.decision_se)
  433. if @skill.scope >= 3
  434. @skill_window.active = false
  435. @target_window.active = true
  436. @slide = false
  437. if @skill.scope == 4 || @skill.scope == 6
  438. @target_window.index = -1
  439. elsif @skill.scope == 7
  440. @target_window.index = @actor_index - 10
  441. else
  442. @target_window.index = 0
  443. end
  444. else
  445. if @skill.common_event_id > 0
  446. $game_temp.common_event_id = @skill.common_event_id
  447. $game_system.se_play(@skill.menu_se)
  448. @actor.sp -= @skill.sp_cost
  449. @status_window.refresh
  450. @skill_window.refresh
  451. @target_window.refresh
  452. $scene = Scene_Map.new
  453. return
  454. end
  455. end
  456. return
  457. end
  458. if Input.trigger?(Input::R) or Input.trigger?(Input::RIGHT)
  459. $game_system.se_play($data_system.cursor_se)
  460. @actor_index += 1
  461. @actor_index %= $game_party.actors.size
  462. $scene = Scene_Skill.new(@actor_index)
  463. return
  464. end
  465. if Input.trigger?(Input::L) or Input.trigger?(Input::LEFT)
  466. $game_system.se_play($data_system.cursor_se)
  467. @actor_index += $game_party.actors.size - 1
  468. @actor_index %= $game_party.actors.size
  469. $scene = Scene_Skill.new(@actor_index)
  470. return
  471. end
  472. end
  473. def update_target
  474. if Input.trigger?(Input::B)
  475. $game_system.se_play($data_system.cancel_se)
  476. @skill_window.active = true
  477. @target_window.active = false
  478. @slide = true
  479. return
  480. end
  481. if Input.trigger?(Input::C)
  482. unless @actor.skill_can_use?(@skill.id)
  483. $game_system.se_play($data_system.buzzer_se)
  484. return
  485. end
  486. if @target_window.index == -1
  487. used = false
  488. for i in $game_party.actors
  489. used |= i.skill_effect(@actor, @skill)
  490. end
  491. end
  492. if @target_window.index <= -2
  493. target = $game_party.actors[@target_window.index + 10]
  494. used = target.skill_effect(@actor, @skill)
  495. end
  496. if @target_window.index >= 0
  497. target = $game_party.actors[@target_window.index]
  498. used = target.skill_effect(@actor, @skill)
  499. end
  500. if used
  501. $game_system.se_play(@skill.menu_se)
  502. @actor.sp -= @skill.sp_cost
  503. @status_window.refresh
  504. @skill_window.refresh
  505. @target_window.refresh
  506. if $game_party.all_dead?
  507. $scene = Scene_Gameover.new
  508. return
  509. end
  510. if @skill.common_event_id > 0
  511. $game_temp.common_event_id = @skill.common_event_id
  512. $scene = Scene_Map.new
  513. return
  514. end
  515. end
  516. unless used
  517. $game_system.se_play($data_system.buzzer_se)
  518. end
  519. return
  520. end
  521. end
  522. end
复制代码
放在战斗技能脚本:
  1. class Scene_Battle
  2.   attr_reader   :status_window            
  3.   attr_accessor :force                  
  4.   attr_writer   :external_wait           
  5.   def update
  6.     if $game_system.battle_interpreter.running?
  7.       $game_system.battle_interpreter.update
  8.       if $game_temp.forcing_battler == nil
  9.         unless $game_system.battle_interpreter.running?
  10.           unless judge
  11.             setup_battle_event
  12.           end
  13.         end
  14.         if @phase != 5
  15.           @status_window.refresh
  16.         end
  17.       end
  18.     end
  19.     $game_system.update
  20.     $game_screen.update
  21.     if $game_system.timer_working and $game_system.timer == 0
  22.       $game_temp.battle_abort = true
  23.     end
  24.     @help_window.update
  25.     @party_command_window.update
  26.     @actor_command_window.update
  27.     @status_window.update
  28.    @message_window.update
  29.     @spriteset.update
  30.     if $game_temp.transition_processing
  31.       $game_temp.transition_processing = false
  32.       if $game_temp.transition_name == ""
  33.         Graphics.transition(20)
  34.       else
  35.         Graphics.transition(40, "Graphics/Transitions/" +
  36.           $game_temp.transition_name)
  37.       end
  38.     end
  39.     if $game_temp.message_window_showing
  40.       return
  41.     end
  42.     if @spriteset.effect?
  43.       return
  44.     end
  45.     if $game_temp.gameover
  46.       $scene = Scene_Gameover.new
  47.       return
  48.     end
  49.     if $game_temp.to_title
  50.       $scene = Scene_Title.new
  51.       return
  52.     end
  53.     if $game_temp.battle_abort
  54.       $game_system.bgm_play($game_temp.map_bgm)
  55.       battle_end(1)
  56.       return
  57.     end
  58.     if @external_wait = true
  59.       return
  60.     end
  61.     if @wait_count > 0
  62.       @wait_count -= 1
  63.       return
  64.     end
  65.     if $game_temp.forcing_battler == nil and
  66.        $game_system.battle_interpreter.running?
  67.       return
  68.     end
  69.     case @phase
  70.     when 1
  71.       update_phase1
  72.     when 2  
  73.       update_phase2
  74.     when 3  
  75.       update_phase3
  76.     when 4  
  77.       update_phase4
  78.     when 5
  79.       update_phase5
  80.     end
  81.   end
  82.   def update_phase4
  83.     if @external_wait
  84.       return
  85.     end
  86.     case @phase4_step
  87.     when 1
  88.       update_phase4_step1
  89.     when 2
  90.       update_phase4_step2
  91.     when 3
  92.       update_phase4_step3
  93.     when 4
  94.       update_phase4_step4
  95.     when 5
  96.       update_phase4_step5
  97.     when 6
  98.       update_phase4_step6

  99.     end
  100.   end
  101.   
  102.   def atb_setup
  103. ##########################################################################
  104. ###################### CUSTOMIZAÇÃO ######################################   
  105. ##########################################################################
  106.     speed = 100 #Velocidade da batalha.
  107.     @active = 0 #Definição do sistema de turnos
  108.     #0 = ESPERA
  109.     #  Os inimigos não atacam quando o battler estiver ativo
  110.     #  Os inimigos não atacam quando estiver acessando os menus
  111.     #  Os inimigos não atacam quando estiver posicionando o cursor
  112.     #     sobre o alvo.
  113.     #1 = SEMI ATIVO 1
  114.     #  Os inimigos não atacam quando estiver acessando os menus.
  115.     #  Os inimigos não atacam quando estiver posicionando o cursor
  116.     #     sobre o alvo.
  117.     #2 = SEMI ATIVO 2
  118.     #  Os inimigos não atacam quando estiver posicionando o cursor
  119.     #     sobre o alvo.
  120.     #3 = ATIVO
  121.     #  Ação tota.  
  122.     @anime_wait = true
  123.     # Sistema de tempo real vai esperar a animação.
  124.     @damage_wait = 3
  125.     # Tempo para acionar a próxima ação apos o dano.
  126. ##########################################################################
  127.     [url=home.php?mod=space&uid=316545]@force[/url] = 2
  128.     @escape == false
  129.     [url=home.php?mod=space&uid=25307]@Max[/url] = 0
  130.     @turn_cnt = 0
  131.     @action_battlers = []
  132.     @synthe = []
  133.     @spell_p = {}
  134.     @spell_e = {}
  135.     @command_a = false
  136.     @command = []
  137.     @party = false
  138.     @phase4_step = 1
  139.     $game_troop.setup(@troop_id)
  140.     for battler in $game_party.actors + $game_troop.enemies
  141.       battler.at = battler.agi * rand(speed / 2)
  142.       if battler.is_a?(Game_Actor)
  143.         @max += battler.agi
  144.       end
  145.       spell_reset(battler)
  146.     end
  147.     @max *= speed
  148.     @max /= $game_party.actors.size
  149.     for battler in $game_party.actors + $game_troop.enemies
  150.       battler.atp = 100 * battler.at / @max
  151.     end
  152.   end
  153.   
  154.   def battle_end(result)
  155.     $game_temp.in_battle = false
  156.     $game_party.clear_actions
  157.     for actor in $game_party.actors
  158.       actor.remove_states_battle
  159.     end

  160.     $game_troop.enemies.clear
  161.     if $game_temp.battle_proc != nil
  162.       $game_temp.battle_proc.call(result)
  163.       $game_temp.battle_proc = nil
  164.     end
  165.     $scene = Scene_Map.new
  166.         

  167.     @status_window.visible = false
  168. #    @spriteset.dispose
  169.     Graphics.transition

  170.    
  171.    
  172.     if result == 0
  173.       display_lv_up(@exp, @gold, @treasures)
  174.       loop do
  175.         Graphics.update
  176.         Input.update
  177.         if Input.trigger?(Input::C)
  178.            break

  179.            end
  180.          Audio.me_stop
  181.            end
  182.       trash_lv_up
  183.     end
  184.   end
  185.   def main
  186.    
  187.     if $data_system.battle_transition == ""
  188.       Graphics.transition(20)
  189.     else
  190.      Graphics.transition(60, "Graphics/Transitions/" + "gradation16")

  191.     end
  192.     Graphics.freeze
  193.    
  194.    
  195.     @lvup_window = []
  196.     @show_dummies = true
  197.     $game_temp.in_battle = true
  198.     $game_temp.battle_turn = 0
  199.     $game_temp.battle_event_flags.clear
  200.     $game_temp.battle_abort = false
  201.     $game_temp.battle_main_phase = false
  202.     $game_temp.battleback_name = $game_map.battleback_name
  203.     $game_temp.forcing_battler = nil
  204.     $game_system.battle_interpreter.setup(nil, 0)
  205.     @troop_id = $game_temp.battle_troop_id
  206.     $game_troop.setup(@troop_id)
  207.     atb_setup
  208.     @actor_command_windows = []
  209.     setup_actor_command_windows
  210.     @party_command_window = Window_PartyCommand.new
  211.     @help_window = Window_Help3.new
  212.     @help_window.back_opacity = 255
  213.     @help_window.opacity = 255
  214.     @help_window.visible = false
  215.     #-------------------------------------------
  216.     @help_window2 = Window_Help2.new
  217.     @help_window2.opacity = 0
  218.     @help_window2.visible = false
  219.     @help_window3 = Window_Help4.new
  220.     @help_window3.opacity = 0
  221.     @help_window3.visible = false
  222.     @status_window = Window_BattleStatus.new
  223.     @status_window.y = 130
  224.     @status_window.contents_opacity = 0

  225.    
  226. #-----------------------------------------------------------------
  227.    if ($luz != nil)
  228.     @luz = Plane.new
  229.     @luz.z = -10
  230.     @luz.bitmap = RPG::Cache.picture($luz)
  231.    end
  232. #-----------------------------------------------------------------

  233.    
  234.    @message_window = Window_Message.new
  235.     @spriteset = Spriteset_Battle.new
  236.     @wait_count = 0
  237.     if $data_system.battle_transition == ""
  238.       Graphics.transition(20)
  239.     else
  240.       Graphics.transition(60, "Graphics/Transitions/" +
  241.         $data_system.battle_transition)
  242.     end
  243.     start_phase1
  244.     loop do
  245.       Graphics.update
  246.       
  247.       
  248.       

  249.      if @status_window.y > -25
  250.         @status_window.y -= 4
  251.         @status_window.contents_opacity += 4
  252.      end   
  253.      #-----------------------------------------------   
  254.      
  255.      
  256.      
  257.      
  258.       Input.update
  259.       update
  260.       if $scene != self
  261.         break
  262.       end
  263.     end
  264.     $game_map.refresh
  265.     Graphics.freeze
  266.     for i in 0..$game_party.actors.size - 1
  267.         @actor_command_windows[i].dispose
  268.       end
  269.       
  270.       
  271.       
  272.       
  273.    #--------------------------------------------------------------------------
  274.    if ($luz != nil)
  275.    @luz.dispose
  276.    end
  277.    #--------------------------------------------------------------------------
  278.          if (@vitoria != nil)
  279.        @vitoria.dispose
  280.      end
  281.          if (@vitoria2 != nil)
  282.        @vitoria2.dispose
  283.      end
  284.     @help_window2.dispose
  285.     @help_window3.dispose
  286.     #---------------------------------------------------------------------------

  287.    
  288.    
  289.    
  290.     @help_window.dispose
  291.     @party_command_window.dispose
  292.     @status_window.dispose
  293.     @message_window.dispose
  294.     @spriteset.dispose
  295.     @lvup_window = nil
  296.     @level_up = nil
  297.     @ch_stats = nil
  298.     @ch_compare_stats = nil
  299.     if @skill_window != nil
  300.       @skill_window.dispose
  301.     end
  302.    
  303.    
  304.     #----------------------------
  305.     if @skill_window2 != nil
  306.       @skill_window2.dispose
  307.     end
  308.     #----------------------------

  309.    
  310.     if @item_window != nil
  311.       @item_window.dispose
  312.     end
  313.     if @result_window != nil
  314.       @result_window.dispose
  315.     end
  316.     if $scene.is_a?(Scene_Title)
  317.       Graphics.transition
  318.       Graphics.freeze
  319.     end
  320.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  321.       $scene = nil
  322.     end
  323.   end
  324.   def update

  325.    
  326. #-------------------------------
  327.    if ($luz_x != nil)
  328.    @luz.ox += $luz_x
  329.    end
  330.    if ($luz_y != nil)
  331.    @luz.oy += $luz_y
  332.    end
  333. #-------------------------------


  334.     if $game_system.battle_interpreter.running?
  335.       if @command.size > 0
  336.         @command_a = false
  337.         @command = []
  338.         command_delete
  339.       end
  340.       @status_window.at_refresh
  341.       $game_system.battle_interpreter.update
  342.       if $game_temp.forcing_battler == nil
  343.         unless $game_system.battle_interpreter.running?
  344.           unless judge
  345.             @status_window.refresh
  346.             setup_battle_event
  347.           end
  348.         end
  349.       end
  350.     end
  351.     $game_system.update
  352.     $game_screen.update
  353.     if $game_system.timer_working and $game_system.timer == 0
  354.       $game_temp.battle_abort = true
  355.     end
  356.     @help_window.update
  357.     @help_window2.update
  358.     @help_window3.update
  359.     @party_command_window.update
  360.     for i in 0..$game_party.actors.size - 1
  361.       member = $game_party.actors[i]
  362.       if member.battle_commands != @actor_command_windows[i].commands
  363.         setup_actor_command_windows
  364.       end
  365.       if member != nil
  366.         @actor_command_windows[i].update
  367.       end
  368.     end
  369.     @status_window.update
  370.    @message_window.update
  371.     @spriteset.update
  372.     if $game_temp.transition_processing
  373.       $game_temp.transition_processing = false
  374.       if $game_temp.transition_name == ""
  375.         Graphics.transition(20)
  376.       else
  377.         Graphics.transition(80, "Graphics/Transitions/" +
  378.           $game_temp.transition_name)
  379.       end
  380.     end
  381.     if $game_temp.message_window_showing
  382.       return
  383.     end
  384.     if $game_temp.gameover
  385.       $scene = Scene_Gameover.new
  386.       return
  387.     end
  388.     if $game_temp.to_title
  389.       $scene = Scene_Title.new
  390.       return
  391.     end
  392.     if $game_temp.battle_abort
  393.       $game_system.bgm_play($game_temp.map_bgm)
  394.       battle_end(1)
  395.       return
  396.     end
  397.     case @phase
  398.     when 0  
  399.       if anime_wait_return
  400.         update_phase0
  401.       end
  402.     when 1  
  403.       update_phase1
  404.       return
  405.     when 2  
  406.       update_phase2
  407.       return
  408.     when 5  
  409.       update_phase5
  410.       return
  411.     end
  412.     if $scene != self
  413.       return
  414.     end
  415.     if @phase == 0
  416.       if @command.size != 0
  417.         if @command_a == false
  418.           start_phase3
  419.         end
  420.         update_phase3
  421.       end
  422.       if @wait_count > 0
  423.         @wait_count -= 1
  424.         return
  425.       end
  426.      
  427.       update_phase4
  428.     end
  429.   end
  430.   def update_phase0
  431.     if $game_temp.battle_turn == 0
  432.       $game_temp.battle_turn = 1
  433.     end
  434.     if @command_a == false and @party == false
  435.       if Input.trigger?(Input::B)
  436.         $game_system.se_play($data_system.cancel_se)
  437.         @party = true
  438.       end
  439.     end
  440.     if @party == true and @phase4_step == 1
  441.       start_phase2
  442.       return
  443.     end
  444.     cnt = 0
  445.     for battler in $game_party.actors + $game_troop.enemies
  446.       active?(battler)
  447.       if battler.rtp == 0
  448.         if battler.at >= @max
  449.           if battler.is_a?(Game_Actor)
  450.             if battler.inputable?
  451.               unless @action_battlers.include?(battler) or
  452.                   @command.include?(battler) or @escape == true
  453.                 if battler.current_action.forcing
  454.                   @action_battlers.push(battler)
  455.                 else
  456.                   @command.push(battler)
  457.                 end
  458.               end
  459.             else
  460.               unless @action_battlers.include?(battler) or
  461.                   battler == @command[0]
  462.                 battler.current_action.clear
  463.                 @command.delete(battler)
  464.                 @action_battlers.push(battler)
  465.               end
  466.             end
  467.           else
  468.             unless @action_battlers.include?(battler)
  469.               number = cnt - $game_party.actors.size
  470.               enemy_action(number)
  471.             end
  472.           end
  473.         else
  474.           battler.at += battler.agi
  475.           if battler.guarding?
  476.             battler.at += battler.agi
  477.           end
  478.           if battler.movable?
  479.             battler.atp = 100 * battler.at / @max
  480.           end
  481.         end
  482.       else
  483.         if battler.rt >= battler.rtp
  484.           speller = synthe?(battler)
  485.           if speller != nil
  486.             battler = speller[0]
  487.           end
  488.           unless @action_battlers.include?(battler)
  489.             battler.rt = battler.rtp
  490.             @action_battlers.push(battler)
  491.           end
  492.         else
  493.           battler.rt += battler.agi
  494.           speller = synthe?(battler)
  495.           if speller != nil
  496.             for spell in speller
  497.               if spell != battler
  498.                 spell.rt += battler.agi
  499.               end
  500.             end
  501.           end
  502.         end
  503.       end
  504.       cnt += 1
  505.     end
  506.     @status_window.at_refresh
  507.     if @escape == true and @phase4_step == 1
  508.       temp = false
  509.       for battler in $game_party.actors
  510.         if battler.inputable?
  511.           temp = true
  512.         end
  513.       end
  514.       if temp == true
  515.         for battler in $game_party.actors
  516.           if battler.at < @max and battler.inputable?
  517.             temp = false
  518.             break
  519.           end
  520.         end
  521.         if temp == true
  522.           @escape = false
  523.           for battler in $game_party.actors
  524.             battler.at %= @max
  525.           end
  526.           $game_temp.battle_main_phase = false
  527.           update_phase2_escape
  528.         end
  529.       end
  530.     end
  531.   end
  532.   def start_phase2
  533.     @phase = 2
  534.     @party = false
  535.     @actor_index = -1
  536.     for i in 0..3
  537.       if $game_party.actors[i] != nil
  538.         @actor_command_windows[i].active = false
  539.         @actor_command_windows[i].visible = false
  540.       end
  541.     end
  542.     if @command.size != 0
  543.       if @active_actor != nil
  544.         @active_actor.blink = false
  545.       end
  546.     end
  547.     $game_temp.battle_main_phase = false
  548.   end
  549.   def update_phase2
  550.     @escape = false
  551.     @phase = 0
  552.     if $game_temp.battle_turn == 0
  553.       $game_temp.battle_turn = 1
  554.     end
  555.     if @command_a == true
  556.       start_phase3
  557.     else
  558.       $game_temp.battle_main_phase = true
  559.     end
  560.   end
  561.   
  562.   
  563. #-------Tela de Vitória-----------------  
  564.   def start_phase5
  565.     for actor in $game_party.actors
  566.       actor.victory = true
  567.     end
  568.     @phase = 5

  569. case rand(2)
  570. when 0
  571. Audio.me_play("Audio/me/Vit02", 100, 100)
  572. when 1
  573. Audio.me_play("Audio/me/Vit03", 100, 100)
  574. end

  575.   $game_system.bgm_play($game_temp.map_bgm)
  576.     exp = 0
  577.     gold = 0
  578.     treasures = []
  579.     if @active_actor != nil
  580.       @active_actor.blink = false
  581.     end
  582.     $game_temp.battle_main_phase = true
  583.     @party_command_window.active = false
  584.     @party_command_window.visible = false
  585.     for i in 0..$game_party.actors.size - 1
  586.       if $game_party.actors[i] != nil
  587.         @actor_command_windows[i].active = false
  588.         @actor_command_windows[i].visible = false
  589.       end
  590.     end
  591.     if @skill_window != nil
  592.       @skill_window.dispose
  593.       @skill_window = nil
  594.     end
  595.     if @item_window != nil
  596.       @item_window.dispose
  597.       @item_window = nil
  598.     end
  599.     @help_window.visible = false
  600.     @help_window2.visible = false
  601.     @help_window3.visible = false
  602.     for enemy in $game_troop.enemies
  603.       unless enemy.hidden
  604.         exp += enemy.exp
  605.         gold += enemy.gold
  606.         if rand(100) < enemy.treasure_prob
  607.           if enemy.item_id > 0
  608.             treasures.push($data_items[enemy.item_id])
  609.           end
  610.           if enemy.weapon_id > 0
  611.             treasures.push($data_weapons[enemy.weapon_id])
  612.           end
  613.           if enemy.armor_id > 0
  614.             treasures.push($data_armors[enemy.armor_id])
  615.           end
  616.         end
  617.       end
  618.     end
  619.     @treasures = treasures
  620.     @exp  = exp
  621.     @gold = gold
  622.     for item in treasures
  623.       case item
  624.       when RPG::Item
  625.         $game_party.gain_item(item.id, 1)
  626.       when RPG::Weapon
  627.         $game_party.gain_weapon(item.id, 1)
  628.       when RPG::Armor
  629.         $game_party.gain_armor(item.id, 1)
  630.       end
  631.     end
  632.     @phase5_wait_count = 130
  633.    
  634.   end
  635.   def update_phase5
  636.     if @phase5_wait_count > 0
  637.       @phase5_wait_count -= 1
  638.       if @phase5_wait_count == 0
  639.         $game_temp.battle_main_phase = false
  640.       end
  641.       return
  642.     end
  643.     battle_end(0)
  644.   end
  645.   def display_lv_up(exp, gold, treasures)
  646.     $d_dum = false
  647.     d_extra = 0
  648.     i = 0
  649.     for actor in $game_party.actors
  650.        @lvup_window[i] = Window_LevelUp.new($game_party.actors[i], i)
  651.         i += 1
  652.     end
  653.         if @show_dummies == true
  654.       $d_dum = true
  655.       for m in i..3
  656.         @lvup_window[m] = Window_LevelUp.new(m, m)
  657.       end
  658.     end
  659.    
  660.    
  661. ###### #inicio da tela de Vitória

  662.     @vitoria = Plane.new   
  663.    @vitoria.bitmap = RPG::Cache.picture("menu_vit")
  664.    @vitoria.opacity = 255
  665.    @vitoria.z = 9999
  666.    @vitoria2 = Window_Sup.new
  667.     @exp_window = Window_EXP.new(exp)
  668.     @exp_window.z = 10000
  669.     @exp_window.x = 600
  670.     @exp_window.y = 315
  671.     @exp_window.opacity = 0
  672.     @m_i_window = Window_Money_Items.new(gold, treasures)
  673.      @m_i_window.z = 111000
  674.      @m_i_window.visible = true
  675.      @m_i_window.opacity = 0
  676.    

  677.     @press_enter = nil
  678.     gainedexp = exp
  679.     @level_up = [0, 0, 0, 0]
  680.     @d_new_skill = ["", "", "", ""]
  681.     @d_breakout = false
  682.     @m_i_window.refresh(gold)
  683.     wait_for_OK
  684.     @d_remember = $game_system.bgs_memorize
  685.    
  686.    
  687.     for i in 0..50

  688.     if @exp_window.x > 260
  689.        @exp_window.x -= 10
  690.     end
  691.   
  692.     Graphics.update
  693.     end
  694.     Audio.bgs_play("Audio/SE/032-Switch01.ogg", 100, 300)

  695.    
  696.    
  697.    
  698.     for n in 0..gainedexp - 1
  699.       exp -= 1
  700.       if @d_breakout == false
  701.         Input.update
  702.       end
  703.       
  704.       for i in 0...$game_party.actors.size
  705.         actor = $game_party.actors[i]
  706.         
  707.         if actor.cant_get_exp? == false
  708.           last_level = actor.level
  709.           actor.exp += 1
  710.       
  711.           if @d_breakout == false
  712.             @lvup_window[i].refresh
  713.             @exp_window.refresh(exp)
  714.           end
  715.          
  716.           if actor.level > last_level
  717.             @level_up[i] = 15
  718.             Audio.se_play("Audio/SE/056-Right02.ogg", 70, 150)
  719.             
  720.             if $d_new_skill
  721.               @d_new_skill[i] = $d_new_skill
  722.             end
  723.           end
  724.          
  725.           if @level_up[i] == 0
  726.             @d_new_skill[i] = ""
  727.           end
  728.          
  729.           if @level_up[i] > 0
  730.             @lvup_window[i].level_up
  731.             if @d_new_skill[i] != ""
  732.               @lvup_window[i].learn_skill(@d_new_skill[i])
  733.             end
  734.           end
  735.          
  736.           if Input.trigger?(Input::C)
  737.             @d_breakout = true
  738.                 Audio.me_stop

  739.           end
  740.         end
  741.         
  742.         if @d_breakout == false
  743.           if @level_up[i] > 0
  744.             #@level_up[i] -= 1
  745.           end
  746.           Graphics.update
  747.         end
  748.       end
  749.       
  750.       if @d_breakout == true
  751.         for i in 0...$game_party.actors.size
  752.           actor = $game_party.actors[i]
  753.           actor.exp += exp
  754.         end
  755.         exp = 0
  756.         break
  757.       end
  758.     end
  759.    
  760.     Audio.bgs_stop
  761.     @d_remember = $game_system.bgs_restore
  762.    
  763.     for i in 0...$game_party.actors.size
  764.       @lvup_window[i].refresh
  765.     end
  766.    
  767.     @exp_window.refresh(exp)
  768.     Audio.se_play("Audio/SE/006-System06.ogg", 70, 150)
  769.     $game_party.gain_gold(gold)
  770.     @m_i_window.refresh(0)
  771.    
  772.     Graphics.update
  773.   end
  774.   
  775.   def trash_lv_up
  776.       i=0
  777.       for i in 0 ... 4
  778.         @lvup_window[i].visible = false
  779.       end
  780.       @exp_window.visible = false
  781.       @m_i_window.visible = false
  782.       @lvup_window = nil
  783.       @exp_window = nil
  784.       @m_i_window = nil
  785.     end
  786.    
  787.   def wait_for_OK
  788.     loop do
  789.       Input.update
  790.       Graphics.update
  791.       if Input.trigger?(Input::C)
  792.    #     Audio.me_fade(800)
  793.    #     Audio.me_stop
  794.         break
  795.       end
  796.     end

  797.   end
  798. ##Fim da tela de Vitória###############################################################  
  799.   
  800.   
  801.   
  802.   
  803.   def start_phase3
  804.     $game_temp.battle_main_phase = false
  805.     @command_a = true
  806.     @active_actor = @command[0]
  807.     cnt = 0
  808.     for actor in $game_party.actors
  809.       if actor == @active_actor
  810.         @actor_index = cnt
  811.       end
  812.       cnt += 1
  813.     end
  814.     @active_actor.blink = true
  815.     unless @active_actor.inputable?
  816.       @active_actor.current_action.clear
  817.       phase3_next_actor
  818.       return
  819.     end
  820.     phase3_setup_command_window
  821.   end
  822.   def phase3_setup_command_window
  823.     @party_command_window.active = false
  824.     @party_command_window.visible = false
  825.     for i in 0..$game_party.actors.size - 1
  826.       if $game_party.actors[i] != nil
  827.         @actor_command_windows[i].active = false
  828.         @actor_command_windows[i].visible = false
  829.       end
  830.     end
  831.     @actor_command_windows[@actor_index].active = true
  832.     @actor_command_windows[@actor_index].visible = true
  833.     @actor_command_windows[@actor_index].index = 0
  834.   end
  835.   def phase3_next_actor
  836.     @command.shift
  837.     @command_a = false
  838.     $game_temp.battle_main_phase = true
  839.     for i in 0..$game_party.actors.size - 1
  840.       if $game_party.actors[i] != nil
  841.         @actor_command_windows[i].active = false
  842.         @actor_command_windows[i].visible = false
  843.       end
  844.     end
  845.     if @active_actor != nil
  846.       @active_actor.blink = false
  847.     end
  848.     @action_battlers.push(@active_actor)
  849.     return
  850.   end
  851.   def enemy_action(number)
  852.     enemy = $game_troop.enemies[number]
  853.     unless enemy.current_action.forcing
  854.       enemy.make_action
  855.     end
  856.     @action_battlers.push(enemy)
  857.   end
  858.   def update_phase3
  859.     if @enemy_arrow != nil
  860.       update_phase3_enemy_select
  861.       return
  862.     elsif @actor_arrow != nil
  863.       update_phase3_actor_select
  864.       return
  865.     elsif @skill_window != nil
  866.       update_phase3_skill_select
  867.       return
  868.     elsif @item_window != nil
  869.       update_phase3_item_select
  870.       return
  871.     end
  872.     for i in 0..$game_party.actors.size - 1
  873.       if @actor_command_windows[i].active
  874.         update_phase3_basic_command
  875.         return
  876.       end
  877.     end
  878.   end
  879.   def start_skill_select_for_type(skill_kind)
  880.     @skill_window = Window_Skill2.new(@active_actor, skill_kind)
  881.     @skill_window2 = Window_Skill3.new(@active_actor)
  882.     @skill_window.help_window = @help_window
  883.     for i in 0..$game_party.actors.size - 1
  884.       if $game_party.actors[i] != nil
  885.         @actor_command_windows[i].active = false
  886.         @actor_command_windows[i].visible = false
  887.         

  888.       end
  889.     end
  890.   end
  891.   def update_phase3_basic_command
  892.     unless @active_actor.inputable?
  893.       @active_actor.current_action.clear
  894.       phase3_next_actor
  895.       return
  896.     end
  897.     if Input.trigger?(Input::B) and @party == false
  898.       $game_system.se_play($data_system.cancel_se)
  899.       @party = true
  900.     end
  901.     if @party == true and @phase4_step == 1
  902.       start_phase2
  903.       return
  904.     end
  905.     if Input.trigger?(Input::C)
  906.       y = @active_actor.battle_commands
  907.       x = y[@actor_command_windows[@actor_index].index]
  908.       case x
  909.       when "Atacar"
  910.         $game_system.se_play($data_system.decision_se)
  911.         @active_actor.current_action.kind = 0
  912.         @active_actor.current_action.basic = 0
  913.         start_enemy_select
  914.       when "Habilidade"
  915.         $game_system.se_play($data_system.decision_se)
  916.         @active_actor.current_action.kind = 1
  917.         @active_actor.skill_kind = "Skill"
  918.         start_skill_select_for_type(-1)
  919.       when "Defender"
  920.         $game_system.se_play($data_system.decision_se)
  921.         @active_actor.current_action.kind = 0
  922.         @active_actor.current_action.basic = 1
  923.         phase3_next_actor
  924.       when "Item"
  925.         $game_system.se_play($data_system.decision_se)
  926.         @active_actor.current_action.kind = 2
  927.         start_item_select
  928.       when "Fugir"
  929.         if $game_temp.battle_can_escape == false
  930.           @help_window.set_text("Não pode escapar!")
  931.         else
  932.           $game_system.se_play($data_system.decision_se)
  933.           @active_actor.current_action.kind = 3
  934.           phase3_next_actor
  935.         end
  936.       when $SKILL_KINDS[0]
  937.         $game_system.se_play($data_system.decision_se)
  938.         @active_actor.current_action.kind = 1
  939.         @active_actor.skill_kind = $SKILL_KINDS[0]
  940.         start_skill_select_for_type(0 + $SKILL_OFFSET)
  941.       when $SKILL_KINDS[1]
  942.         $game_system.se_play($data_system.decision_se)
  943.         @active_actor.current_action.kind = 1
  944.         @active_actor.skill_kind = $SKILL_KINDS[1]
  945.         start_skill_select_for_type(1 + $SKILL_OFFSET)        
  946.       when $SKILL_KINDS[2]
  947.         $game_system.se_play($data_system.decision_se)
  948.         @active_actor.current_action.kind = 1
  949.         @active_actor.skill_kind = $SKILL_KINDS[2]
  950.         start_skill_select_for_type(2 + $SKILL_OFFSET)        
  951.       when $SKILL_KINDS[3]
  952.         $game_system.se_play($data_system.decision_se)
  953.         @active_actor.current_action.kind = 1
  954.         @active_actor.skill_kind = $SKILL_KINDS[3]
  955.         start_skill_select_for_type(3 + $SKILL_OFFSET)
  956.       when $SKILL_KINDS[4]
  957.         $game_system.se_play($data_system.decision_se)
  958.         @active_actor.current_action.kind = 1
  959.         @active_actor.skill_kind = $SKILL_KINDS[4]
  960.         start_skill_select_for_type(4 + $SKILL_OFFSET)
  961.       # Caso quiser mais comandos, copie os códigos acima
  962.       #e cole aqui
  963.       end
  964.       return
  965.     end
  966.     if Input.trigger?(Input::R)
  967.       $game_system.se_play($data_system.cursor_se)
  968.       @party = false
  969.       if @active_actor != nil
  970.         @active_actor.blink = false
  971.       end
  972.       @command.push(@command[0])
  973.       @command.shift
  974.       @command_a = false
  975.       $game_temp.battle_main_phase = true
  976.       for i in 0..$game_party.actors.size - 1
  977.         if $game_party.actors[i] != nil
  978.           @actor_command_windows[i].active = false
  979.           @actor_command_windows[i].visible = false

  980.         end
  981.       end
  982.     end
  983.     if Input.trigger?(Input::L)
  984.       $game_system.se_play($data_system.cursor_se)
  985.       @party = false
  986.       if @active_actor != nil
  987.         @active_actor.blink = false
  988.       end
  989.       @command.unshift(@command[@command.size - 1])
  990.       @command.delete_at(@command.size - 1)
  991.       @command_a = false
  992.       $game_temp.battle_main_phase = true
  993.       for i in 0..$game_party.actors.size - 1
  994.         if $game_party.actors[i] != nil
  995.           @actor_command_windows[i].active = false
  996.           @actor_command_windows[i].visible = false
  997.         end
  998.       end
  999.     end
  1000.     if Input.trigger?(Input::DOWN)
  1001.       $game_system.se_play($data_system.cursor_se)
  1002.       @party = false
  1003.       if @active_actor != nil
  1004.         @active_actor.blink = false
  1005.       end
  1006.       actor = $game_party.actors[@actor_index]
  1007.       while actor == @command[0] or (not @command.include?(actor))
  1008.         @actor_index += 1
  1009.         actor = $game_party.actors[@actor_index]
  1010.         if actor == nil
  1011.           @actor_index = 0
  1012.           actor = $game_party.actors[@actor_index]
  1013.         end
  1014.         if actor == @command[0]
  1015.           break
  1016.         end
  1017.       end
  1018.       while actor != @command[0]
  1019.         @command.push(@command[0])
  1020.         @command.shift
  1021.       end
  1022.       @command_a = false
  1023.       $game_temp.battle_main_phase = true
  1024.       for i in 0..$game_party.actors.size - 1
  1025.         if $game_party.actors[i] != nil
  1026.           @actor_command_windows[i].active = false
  1027.           @actor_command_windows[i].visible = false
  1028.            end
  1029.       end
  1030.     end
  1031.     if Input.trigger?(Input::UP)
  1032.       $game_system.se_play($data_system.cursor_se)
  1033.       @party = false
  1034.       if @active_actor != nil
  1035.         @active_actor.blink = false
  1036.       end
  1037.       actor = $game_party.actors[@actor_index]
  1038.       while actor == @command[0] or (not @command.include?(actor))
  1039.         @actor_index -= 1
  1040.         actor = $game_party.actors[@actor_index]
  1041.         if actor == nil
  1042.           @actor_index = $game_party.actors.size - 1
  1043.           actor = $game_party.actors[@actor_index]
  1044.         end
  1045.         if actor == @command[0]
  1046.           break
  1047.         end
  1048.       end
  1049.       while actor != @command[0]
  1050.         @command.push(@command[0])
  1051.         @command.shift
  1052.       end
  1053.       @command_a = false
  1054.       $game_temp.battle_main_phase = true
  1055.       for i in 0..$game_party.actors.size - 1
  1056.         if $game_party.actors[i] != nil
  1057.           @actor_command_windows[i].active = false
  1058.           @actor_command_windows[i].visible = false
  1059.         end
  1060.       end
  1061.     end
  1062.   end
  1063.   def start_enemy_select
  1064.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
  1065.     @enemy_arrow.help_window = @help_window
  1066.     for i in 0..$game_party.actors.size - 1
  1067.       if $game_party.actors[i] != nil
  1068.         @actor_command_windows[i].active = false
  1069.         @actor_command_windows[i].visible = false
  1070.       end
  1071.     end
  1072.   end
  1073.   def end_enemy_select
  1074.     @enemy_arrow.dispose
  1075.     @enemy_arrow = nil
  1076.     y = @active_actor.battle_commands
  1077.     x = y[@actor_command_windows[@actor_index].index]
  1078.     if x == "Atacar"
  1079.       @actor_command_windows[@actor_index].active = true
  1080.       @actor_command_windows[@actor_index].visible = true
  1081.       @help_window.visible = false
  1082.       @help_window2.visible = false
  1083.     end
  1084.   end
  1085.   def start_actor_select
  1086.     @actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
  1087.     @actor_arrow.index = @actor_index
  1088.     @actor_arrow.help_window = @help_window
  1089.     for i in 0..$game_party.actors.size - 1
  1090.       if $game_party.actors[i] != nil
  1091.         @actor_command_windows[i].active = false
  1092.         @actor_command_windows[i].visible = false
  1093.       end
  1094.     end
  1095.   end
  1096.   def end_skill_select
  1097.     @skill_window.dispose
  1098.     @skill_window2.dispose
  1099.     @skill_window2 = nil
  1100.     @skill_window = nil
  1101.     @help_window.visible = false
  1102.     @help_window2.visible = false
  1103.     @help_window3.visible = false
  1104.     @actor_command_windows[@actor_index].active = true
  1105.     @actor_command_windows[@actor_index].visible = true
  1106.   end
  1107.   def start_item_select
  1108.     @item_window = Window_Item2.new
  1109.     @item_window.help_window = @help_window
  1110.     for i in 0..$game_party.actors.size - 1
  1111.       if $game_party.actors[i] != nil
  1112.         @actor_command_windows[i].active = false
  1113.         @actor_command_windows[i].visible = false
  1114.       end
  1115.     end
  1116.   end
  1117.   def end_item_select
  1118.     @item_window.dispose
  1119.     @item_window = nil
  1120.     @help_window.visible = false
  1121.     @help_window2.visible = false
  1122.     @help_window3.visible = false
  1123.     @actor_command_windows[@actor_index].active = true
  1124.     @actor_command_windows[@actor_index].visible = true
  1125.   end
  1126.   def setup_actor_command_windows
  1127.     if @actor_command_windows != []
  1128.       for i in 0..@actor_command_windows.size - 1
  1129.         @actor_command_windows[i].dispose
  1130.       end
  1131.     end
  1132.     @actor_command_windows = []
  1133.     for i in 0..$game_party.actors.size - 1
  1134.       member = $game_party.actors[i]
  1135.       if member != nil
  1136.         @actor_command_windows[i] = Window_BattleCommand.new(member, 640)
  1137.         @actor_command_windows[i].x = 0
  1138.         @actor_command_windows[i].y = 0
  1139.         @actor_command_windows[i].back_opacity = 160
  1140.         @actor_command_windows[i].active = false
  1141.         @actor_command_windows[i].visible = false
  1142.         @actor_command_windows[i].height = 320 + member.battle_commands.length * 32 + 50
  1143. #        @actor_command_windows[i].height = member.battle_commands.length * 32 + 32
  1144.       end
  1145.     end
  1146.   end
  1147.   def update_phase3_skill_select
  1148.     unless @active_actor.inputable?
  1149.       @active_actor.current_action.clear
  1150.       command_delete
  1151.       phase3_next_actor
  1152.       return
  1153.     end
  1154.     @skill_window.visible = true
  1155.     @skill_window.update
  1156.     @skill_window2.update
  1157.     @skill_window2.visible = true
  1158.     if Input.trigger?(Input::B)
  1159.       $game_system.se_play($data_system.cancel_se)
  1160.       end_skill_select
  1161.       return
  1162.     end
  1163.     if Input.trigger?(Input::C)
  1164.       @skill = @skill_window.skill
  1165.       if @skill == nil or not @active_actor.skill_can_use?(@skill.id)
  1166.         $game_system.se_play($data_system.buzzer_se)
  1167.         return
  1168.       end
  1169.       if @skill.scope == 1 or @skill.scope == 2
  1170.         if fin?
  1171.           $game_system.se_play($data_system.buzzer_se)
  1172.           return
  1173.         end
  1174.       end        
  1175.       $game_system.se_play($data_system.decision_se)
  1176.       @active_actor.current_action.skill_id = @skill.id
  1177.       #@skill_window.visible = false
  1178.       if @skill.scope == 1
  1179.         start_enemy_select
  1180.       elsif @skill.scope == 3 or @skill.scope == 5
  1181.         start_actor_select
  1182.       else
  1183.         @active_actor.current_action.kind = 1
  1184.         end_skill_select
  1185.         phase3_next_actor
  1186.       end
  1187.       return
  1188.     end
  1189.   end
  1190.   def update_phase3_item_select
  1191.     unless @active_actor.inputable?
  1192.       @active_actor.current_action.clear
  1193.       command_delete
  1194.       phase3_next_actor
  1195.       return
  1196.     end
  1197.     @item_window.visible = true
  1198.     @item_window.update
  1199.     if Input.trigger?(Input::B)
  1200.       $game_system.se_play($data_system.cancel_se)
  1201.       end_item_select
  1202.       return
  1203.     end
  1204.     if Input.trigger?(Input::C)
  1205.       @item = @item_window.item
  1206.       unless $game_party.item_can_use?(@item.id)
  1207.         $game_system.se_play($data_system.buzzer_se)
  1208.         return
  1209.       end
  1210.       if @item.scope == 1 or @item.scope == 2
  1211.         if fin?
  1212.           $game_system.se_play($data_system.buzzer_se)
  1213.           return
  1214.         end
  1215.       end
  1216.       $game_system.se_play($data_system.decision_se)
  1217.       @active_actor.current_action.item_id = @item.id
  1218.       @item_window.visible = true#false
  1219.       if @item.scope == 1
  1220.         start_enemy_select
  1221.       elsif @item.scope == 3 or @item.scope == 5
  1222.         start_actor_select
  1223.       else
  1224.         @active_actor.current_action.kind = 2
  1225.         end_item_select
  1226.         phase3_next_actor
  1227.       end
  1228.       return
  1229.     end
  1230.   end
  1231.   def update_phase3_enemy_select
  1232.     if fin?
  1233.       end_enemy_select
  1234.       return
  1235.     end
  1236.     unless @active_actor.inputable?
  1237.       @active_actor.current_action.clear
  1238.       command_delete
  1239.       phase3_next_actor
  1240.       return
  1241.     end
  1242.     @enemy_arrow.update
  1243.     if Input.trigger?(Input::B)
  1244.       $game_system.se_play($data_system.cancel_se)
  1245.       end_enemy_select
  1246.       return
  1247.     end
  1248.     if Input.trigger?(Input::C)
  1249.       $game_system.se_play($data_system.decision_se)
  1250.       @active_actor.current_action.kind = 0
  1251.       @active_actor.current_action.basic = 0
  1252.       @active_actor.current_action.target_index = @enemy_arrow.index
  1253.       end_enemy_select
  1254.       if @skill_window != nil
  1255.         @active_actor.current_action.kind = 1
  1256.         end_skill_select
  1257.       end
  1258.       if @item_window != nil
  1259.         @active_actor.current_action.kind = 2
  1260.         end_item_select
  1261.       end
  1262.       phase3_next_actor
  1263.     end
  1264.   end
  1265.   def update_phase3_actor_select
  1266.    
  1267.         
  1268.    
  1269.     unless @active_actor.inputable?
  1270.       @active_actor.current_action.clear
  1271.       command_delete
  1272.       phase3_next_actor
  1273.       return
  1274.     end
  1275.     @actor_arrow.update
  1276.     if Input.trigger?(Input::B)
  1277.       $game_system.se_play($data_system.cancel_se)
  1278.       end_actor_select
  1279.       return
  1280.     end
  1281.     if Input.trigger?(Input::C)
  1282.       $game_system.se_play($data_system.decision_se)
  1283.       @active_actor.current_action.kind = 0
  1284.       @active_actor.current_action.basic = 0
  1285.       @active_actor.current_action.target_index = @actor_arrow.index
  1286.       end_actor_select
  1287.       if @skill_window != nil
  1288.         @active_actor.current_action.kind = 1
  1289.         end_skill_select
  1290.       end
  1291.       if @item_window != nil
  1292.         @active_actor.current_action.kind = 2
  1293.         end_item_select
  1294.       end
  1295.       phase3_next_actor
  1296.     end
  1297.   end
  1298.   def start_skill_select
  1299.     @skill_window = Window_Skill.new(@active_actor)
  1300.     @skill_window.help_window = @help_window
  1301.     @actor_command_window.active = false
  1302.     @actor_command_window.visible = false
  1303.   end
  1304.   def start_phase4
  1305.     $game_temp.battle_main_phase = true
  1306.   end
  1307.   def update_phase4_step1
  1308.     if judge
  1309.       return
  1310.     end
  1311.     if $game_temp.forcing_battler == nil
  1312.       setup_battle_event
  1313.       if $game_system.battle_interpreter.running?
  1314.         return
  1315.       end
  1316.     end
  1317.     if $game_temp.forcing_battler != nil
  1318.       battler = $game_temp.forcing_battler
  1319.       @action_battlers.delete(battler)
  1320.       @action_battlers.unshift(battler)
  1321.       battler.at = @max
  1322.       battler.atp = 100 * battler.at / @max
  1323.     end
  1324.     if @action_battlers.size == 0
  1325.       return
  1326.     end
  1327.     @animation1_id = 0
  1328.     @animation2_id = 0
  1329.     @common_event_id = 0
  1330.     @active_battler = @action_battlers[0]
  1331.     if @active_battler.index == nil
  1332.       @action_battlers.shift
  1333.       anime_wait_return
  1334.       return
  1335.     end
  1336.     unless active?(@active_battler)
  1337.       unless @active_battler.inputable?
  1338.         @phase4_step = 6
  1339.         return
  1340.       end
  1341.     end
  1342.     if @active_battler.current_action.kind == 1 and
  1343.       (not @active_battler.current_action.forcing or @force < 2)
  1344.       if @active_battler.rtp == 0
  1345.         skill_reset(@active_battler)
  1346.         recite_time(@active_battler)
  1347.         if @active_battler.rtp > 0
  1348.           @action_battlers.shift
  1349.         end
  1350.         synthe_spell(@active_battler)
  1351.         if @active_battler.rtp > 0 and
  1352.             (not @active_battler.current_action.forcing or
  1353.             (@force < 1 or not synthe?(@active_battler)))
  1354.           @active_battler.blink = true
  1355.           anime_wait_return
  1356.           if @active_battler.current_action.forcing
  1357.             $game_temp.forcing_battler = nil
  1358.             @active_battler.current_action.forcing = false
  1359.           end
  1360.           return
  1361.         end
  1362.       end
  1363.     end
  1364.     if @active_battler != nil
  1365.       @active_battler.blink = false
  1366.     end
  1367.     @phase4_step = 2
  1368.   end
  1369.   def update_phase4_step2

  1370.         
  1371.     unless @active_battler.current_action.forcing
  1372.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  1373.         @active_battler.current_action.kind = 0
  1374.         @active_battler.current_action.basic = 0
  1375.       end
  1376.     end
  1377.     @target_battlers = []
  1378.     case @active_battler.current_action.kind
  1379.     when 0  
  1380.       make_basic_action_result
  1381.     when 1  
  1382.       make_skill_action_result
  1383.     when 2  
  1384.       make_item_action_result
  1385.     when 3
  1386.       @phase4_step = 6
  1387.       update_phase2_escape
  1388.       @wait_count = 5
  1389.     end

  1390.     if @phase4_step == 2
  1391.       @phase4_step = 3
  1392.     end
  1393.   end
  1394.   def make_basic_action_result
  1395.     if @active_battler.current_action.basic == 0
  1396.       @animation1_id = @active_battler.animation1_id
  1397.       @animation2_id = @active_battler.animation2_id
  1398.       if @active_battler.is_a?(Game_Enemy)
  1399.         if @active_battler.restriction == 3
  1400.           target = $game_troop.random_target_enemy
  1401.         elsif @active_battler.restriction == 2
  1402.           target = $game_party.random_target_actor
  1403.         else
  1404.           index = @active_battler.current_action.target_index
  1405.           target = $game_party.smooth_target_actor(index)
  1406.         end
  1407.       end
  1408.       if @active_battler.is_a?(Game_Actor)
  1409.         if @active_battler.restriction == 3
  1410.           target = $game_party.random_target_actor
  1411.         elsif @active_battler.restriction == 2
  1412.           target = $game_troop.random_target_enemy
  1413.         else
  1414.           index = @active_battler.current_action.target_index
  1415.           target = $game_troop.smooth_target_enemy(index)
  1416.         end
  1417.       end
  1418.       @active_battler.target_x = target.screen_x
  1419.       @active_battler.target_y = target.screen_y
  1420.       @active_battler.target = target
  1421.       @target_battlers = [target]
  1422.       return
  1423.     end
  1424.     if @active_battler.current_action.basic == 1
  1425.       @help_window.set_text($data_system.words.guard, 1)
  1426.       return
  1427.     end
  1428.     if @active_battler.is_a?(Game_Enemy) and
  1429.        @active_battler.current_action.basic == 2
  1430.       @help_window.set_text("“¦‚°‚é", 1)
  1431.       @active_battler.escape
  1432.       return
  1433.     end
  1434.     if @active_battler.current_action.basic == 3
  1435.       $game_temp.forcing_battler = nil
  1436.       @phase4_step = 6
  1437.       return
  1438.     end
  1439.   end
  1440.   def make_skill_action_result
  1441.     @skill = $data_skills[@active_battler.current_action.skill_id]
  1442.     speller = synthe?(@active_battler)
  1443.     unless @active_battler.current_action.forcing
  1444.       if speller != nil
  1445.         for battler in speller
  1446.           if battler.current_action.spell_id == 0
  1447.             unless battler.skill_can_use?(@skill.id)
  1448.               $game_temp.forcing_battler = nil
  1449.               @phase4_step = 6
  1450.               return
  1451.             end
  1452.           else
  1453.             unless battler.skill_can_use?(battler.current_action.spell_id)
  1454.               $game_temp.forcing_battler = nil
  1455.               @phase4_step = 6
  1456.               return
  1457.             end
  1458.           end
  1459.         end
  1460.       else
  1461.         unless @active_battler.skill_can_use?(@skill.id)
  1462.           $game_temp.forcing_battler = nil
  1463.           @phase4_step = 6
  1464.          return
  1465.         end
  1466.       end
  1467.     end
  1468.     temp = false
  1469.     if speller != nil
  1470.       for battler in speller
  1471.         if battler.current_action.spell_id == 0
  1472.           battler.sp -= @skill.sp_cost
  1473.         else
  1474.           battler.sp -= $data_skills[battler.current_action.spell_id].sp_cost
  1475.         end
  1476.       end
  1477.     else
  1478.       @active_battler.sp -= @skill.sp_cost
  1479.     end
  1480.     @status_window.refresh
  1481.     @help_window2.set_text(@skill.name, 1)
  1482.     @animation1_id = @skill.animation1_id
  1483.     @animation2_id = @skill.animation2_id
  1484.     @common_event_id = @skill.common_event_id
  1485.     set_target_battlers(@skill.scope)
  1486.     for target in @target_battlers
  1487.       if speller != nil
  1488.         damage = 0
  1489.         effective = false
  1490.         for battler in speller
  1491.           if battler.current_action.spell_id != 0
  1492.             @skill = $data_skills[battler.current_action.spell_id]
  1493.           end
  1494.           effective |= target.skill_effect(battler, @skill)
  1495.           if target.damage.class != String
  1496.             damage += target.damage
  1497.           elsif effective == true
  1498.             effect = target.damage
  1499.           end
  1500.         end
  1501.         if damage != 0
  1502.           target.damage = damage
  1503.         elsif effective = true
  1504.           target.damage = effect
  1505.         end
  1506.       else
  1507.         target.skill_effect(@active_battler, @skill)
  1508.       end
  1509.     end
  1510.   end
  1511.   def make_item_action_result
  1512.     @item = $data_items[@active_battler.current_action.item_id]
  1513.     unless $game_party.item_can_use?(@item.id)
  1514.       @phase4_step = 6
  1515.       return
  1516.     end
  1517.     if @item.consumable
  1518.       $game_party.lose_item(@item.id, 1)
  1519.     end
  1520.     @help_window3.set_text(@item.name, 1)
  1521.     @animation1_id = @item.animation1_id
  1522.     @animation2_id = @item.animation2_id
  1523.     @common_event_id = @item.common_event_id
  1524.     index = @active_battler.current_action.target_index
  1525.     target = $game_party.smooth_target_actor(index)
  1526.     set_target_battlers(@item.scope)
  1527.     for target in @target_battlers
  1528.       target.item_effect(@item)
  1529.     end
  1530.   end
  1531.   def update_phase4_step3
  1532.     if @animation1_id == 0
  1533.       if (@active_battler.current_action.basic == 0) and
  1534.          (@active_battler.current_action.kind == 0)
  1535.         @active_battler.moving = true
  1536.         @active_battler.move_init = true
  1537.         @external_wait = true
  1538.       end
  1539.       @wait_count = 15
  1540.     else
  1541.       if (@active_battler.current_action.basic == 0) and
  1542.          (@active_battler.current_action.kind == 0)
  1543.         @active_battler.attack = true
  1544.       elsif @active_battler.current_action.kind == 2
  1545.         @active_battler.item = true
  1546.       else
  1547.         @active_battler.skill = true
  1548.       end
  1549.       @active_battler.animation_id = @animation1_id
  1550.       @active_battler.animation_hit = true
  1551.       speller = synthe?(@active_battler)
  1552.       if speller != nil
  1553.         for battler in speller
  1554.           if battler != @active_battler
  1555.             if battler.current_action.spell_id == 0
  1556.               battler.animation_id = @animation1_id
  1557.               battler.animation_hit = true
  1558.             else
  1559.               spell = battler.current_action.spell_id
  1560.               battler.animation_id = $data_skills[spell].animation1_id
  1561.               battler.animation_hit = true
  1562.               battler.current_action.spell_id = 0
  1563.             end
  1564.           end
  1565.         end
  1566.       end
  1567.       @wait_count = 2 * $data_animations[@animation1_id].frame_max - 10
  1568.     end
  1569.     @phase4_step = 4
  1570.   end
  1571.   def update_phase4_step4
  1572.     for target in @target_battlers
  1573.       target.animation_id = @animation2_id
  1574.       target.animation_hit = (target.damage != "Miss")
  1575.       unless @animation2_id == 0
  1576.         @wait_count = 2 * $data_animations[@animation2_id].frame_max - 10
  1577.       end
  1578. #
  1579.   if @active_battler.current_action.kind == 0
  1580.       if target.damage != nil
  1581.         target.damage_pop = true
  1582.         $active_battler = @active_battler  
  1583.         target.damage_effect(@active_battler.current_action.kind)
  1584.         @wait_count = @damage_wait
  1585.       end
  1586.   end
  1587. #      
  1588.       
  1589.     end
  1590.     @phase4_step = 5
  1591.   end
  1592.   def update_phase4_step5
  1593.     @help_window.visible = false
  1594.     @help_window2.visible = false
  1595.     @help_window3.visible = false
  1596.     for target in @target_battlers
  1597.       if target.damage != nil and
  1598.         @active_battler.current_action.kind != 0
  1599.         target.damage_pop = true
  1600.         $active_battler = @active_battler  
  1601.         target.damage_effect(@active_battler.current_action.kind)
  1602.         @wait_count = @damage_wait
  1603.       end
  1604.    end
  1605.     @status_window.refresh
  1606.     @phase4_step = 6
  1607.   end
  1608.   def update_phase4_step6
  1609.     $game_temp.forcing_battler = nil
  1610.     @active_battler.current_action.forcing = false
  1611.     refresh_phase(@active_battler)
  1612.     @action_battlers.shift
  1613.     unless @active_battler.movable?
  1614.       @phase4_step = 1
  1615.       return
  1616.     end
  1617.     speller = synthe?(@active_battler)
  1618.     if speller != nil
  1619.       for battler in speller
  1620.         if battler != @active_battler
  1621.           refresh_phase(battler)
  1622.         end
  1623.       end
  1624.       synthe_delete(speller)
  1625.     end
  1626.     @status_window.refresh
  1627.     if @common_event_id > 0
  1628.       common_event = $data_common_events[@common_event_id]
  1629.       $game_system.battle_interpreter.setup(common_event.list, 0)
  1630.     end
  1631.     act = 0
  1632.     for battler in $game_party.actors + $game_troop.enemies
  1633.       if battler.movable?
  1634.         act += 1
  1635.       end
  1636.     end
  1637.     if @turn_cnt >= act
  1638.       @turn_cnt %= act
  1639.       $game_temp.battle_turn += 1
  1640.       for index in 0...$data_troops[@troop_id].pages.size
  1641.         page = $data_troops[@troop_id].pages[index]
  1642.         if page.span == 1
  1643.           $game_temp.battle_event_flags[index] = false
  1644.         end
  1645.       end
  1646.     end
  1647.     @phase4_step = 1
  1648.   end
  1649.   def refresh_phase(battler)
  1650.     battler.at %= @max
  1651.     if battler.movable?
  1652.       battler.atp = 100 * @active_battler.at / @max
  1653.     end
  1654.     spell_reset(battler)
  1655.     if battler.hp > 0 and battler.slip_damage?
  1656.       battler.slip_damage_effect
  1657.       battler.damage_pop = true
  1658.     end
  1659.     battler.remove_states_auto
  1660.     unless battler.movable?
  1661.       return
  1662.     end
  1663.     @turn_cnt += 1
  1664.   end
  1665.   def anime_wait_return
  1666.     if (@action_battlers.size == 0 or @anime_wait == false) and
  1667.         not $game_system.battle_interpreter.running?
  1668.       if @enemy_arrow != nil
  1669.         return [@active - 2, 0].min == 0
  1670.       elsif @actor_arrow != nil
  1671.         return [@active - 2, 0].min == 0
  1672.       elsif @skill_window != nil
  1673.         return [@active - 3, 0].min == 0
  1674.       elsif @item_window != nil
  1675.         return [@active - 3, 0].min == 0
  1676.       else
  1677.         for i in 0..$game_party.actors.size - 1
  1678.           if @actor_command_windows[i].active
  1679.             return [@active - 1, 0].min == 0
  1680.           end
  1681.         end
  1682.         return true
  1683.       end
  1684.     else
  1685.       return false
  1686.     end
  1687.   end
  1688.   def command_delete
  1689.     if @enemy_arrow != nil
  1690.       end_enemy_select
  1691.     elsif @actor_arrow != nil
  1692.       end_actor_select
  1693.     end
  1694.     if @skill_window != nil
  1695.       end_skill_select
  1696.     elsif @item_window != nil
  1697.       end_item_select
  1698.     end
  1699.     for i in 0..$game_party.actors.size - 1
  1700.       if @actor_command_windows[i].active
  1701.         @command.shift
  1702.         @command_a = false
  1703.         $game_temp.battle_main_phase = true
  1704.         for i in 0..$game_party.actors.size - 1
  1705.           if $game_party.actors[i] != nil
  1706.             @actor_command_windows[i].active = false
  1707.             @actor_command_windows[i].visible = false
  1708.           end
  1709.         end
  1710.         if @active_actor != nil
  1711.           @active_actor.blink = false
  1712.         end
  1713.       end
  1714.     end
  1715.   end
  1716.   def recite_time(battler)
  1717.   end
  1718.   def synthe_spell(battler)
  1719.   end
  1720.   def active?(battler)
  1721.     speller = synthe?(battler)
  1722.     if speller != nil
  1723.       if synthe_delete?(speller)
  1724.         return false
  1725.       end
  1726.     else
  1727.       unless battler.inputable?
  1728.         spell_reset(battler)
  1729.         unless battler.movable?
  1730.           battler.atp = 0
  1731.           return false
  1732.         end
  1733.       end
  1734.       if battler.current_action.forcing
  1735.         spell_reset(battler)
  1736.       end
  1737.     end
  1738.     return true
  1739.   end
  1740.   def synthe?(battler)
  1741.     for speller in @synthe
  1742.       if speller.include?(battler)
  1743.         return speller
  1744.       end
  1745.     end
  1746.     return nil
  1747.   end
  1748.   def synthe_delete?(speller)
  1749.     for battler in speller
  1750.       unless battler.inputable?
  1751.         synthe_delete(speller)
  1752.         return true
  1753.       end
  1754.     end
  1755.     return false
  1756.   end
  1757.   def synthe_delete(speller)
  1758.     for battler in speller
  1759.       spell_reset(battler)
  1760.       @action_battlers.delete(battler)
  1761.     end
  1762.     @synthe.delete(speller)
  1763.   end
  1764.   def skill_reset(battler)
  1765.     speller = synthe?(battler)
  1766.     if speller != nil
  1767.       synthe_delete(speller)
  1768.     else
  1769.       spell_reset(battler)
  1770.     end
  1771.   end
  1772.   def spell_reset(battler)
  1773.     battler.rt = 0
  1774.     battler.rtp = 0
  1775.     battler.blink = false
  1776.     battler.spell = false
  1777.     battler.current_action.spell_id = 0
  1778.     @spell_p.delete(battler)
  1779.     @spell_e.delete(battler)
  1780.   end
  1781.   def fin?
  1782.     for battler in $game_troop.enemies
  1783.       if battler.hp != 0
  1784.         return false
  1785.       end
  1786.     end
  1787.     return true
  1788.   end
  1789. end
复制代码
上面的话,战斗技能菜单正常,系统技能菜单出错,放在下面的话,系统技能菜单正常,战斗技能菜单出错。
作者: 江南小帅瓜    时间: 2014-5-17 23:44
芯☆淡茹水 发表于 2014-5-17 21:50
参数错误,请帖上脚本:Window_Skill2

自己解决了,还是要谢谢你。。。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1