查看: 935|回复: 0

[已经过期] ATB脚本二次行动的问题

[复制链接]
梦石
0
星屑
536
在线时间
69 小时
注册时间
2016-5-5
回帖
16
发表于 2018-2-25 23:40:12 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
我用了ATB系统的一个脚本发现

在主角可二次行动的条件下 分别使用对敌方和对我方(攻击或物品)

最后都会变成对敌方使用(或我方)

举个例
在同一回合我能做两次行动
我先攻击敌方再给自己吃药
最后卻变成 我攻击到敌方了  但敌方吃到药....

可否解答下 附上脚本

  1. #==============================================================================
  2. # +++ MOG - Battler Motion (v3.6) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]https://atelierrgss.wordpress.com/[/url]
  6. #==============================================================================
  7. # Adiciona efeitos de animações nos sprites dos battlers.
  8. # ● Animação inicial (entrada)de batalha.
  9. # ● Animação de espera.
  10. # ● Animação de ação.
  11. # ● Animação de dano.
  12. # ● Animação de colapso.
  13. #==============================================================================

  14. #==============================================================================
  15. # ● Histórico (Version History)
  16. #==============================================================================
  17. # v3.6 - Melhoria na compatibilidade com MOG Battle Camera.
  18. # v3.5 - Possibilidade de desabilitar o efeito "blinking"
  19. #      - Melhoria no tempo de execução do efeito slice
  20. # v3.4 - Adição da função SLICE.
  21. #==============================================================================

  22. $imported = {} if $imported.nil?
  23. $imported[:mog_battler_motion] = true

  24. #==============================================================================
  25. # ● CONFIGURAÇÃO
  26. #==============================================================================
  27. # ■ Animação inicial de entrada ao começar a batalha.
  28. #==============================================================================
  29. # Coloque as seguintes Tags na caixa de notas dos inimigos ou personagens.
  30. #
  31. # <Motion Appear = X>
  32. #
  33. # X = 0
  34. # Battler desliza horizontalmente.
  35. #
  36. # X = 1
  37. # Battler desliza verticalmente.
  38. #
  39. # X = 2
  40. # Battler rola (Cambalhota O_o) pela tela.
  41. #
  42. # X = 3
  43. # Zoom IN
  44. #
  45. # X = 4
  46. # Zoom Out
  47. #
  48. # X = 5
  49. # Efeito de emergir do solo.
  50. #
  51. #==============================================================================
  52. # ■ Animações dos battlers em modo espera.
  53. #==============================================================================
  54. # Coloque as seguintes Tags na caixa de notas dos inimigos ou personagens.
  55. #
  56. # <Motion Standby = X>
  57. #
  58. # X = 0
  59. # Ativa o efeito do battler respirando.
  60. #
  61. # X = 1
  62. # Ativa o efeito do battler levitando.
  63. #
  64. # X = 2
  65. # Ativa o efeito do battler movimentando para os lados.
  66. #
  67. #==============================================================================
  68. # ■ Animações dos battlers em modo de ação.
  69. #==============================================================================
  70. # Coloque as seguintes Tags na caixa de notas de itens ou habilidades.
  71. #
  72. # <Motion Action = X>
  73. #
  74. # X = 0
  75. # Ativa o efeito de ação de zoom.
  76. #
  77. # X = 1
  78. # Ativa o efeito de ação de pular.
  79. #
  80. # X = 2
  81. # Ativa o efeito de girar para a esquerda.
  82. #
  83. # X = 3
  84. # Ativa o efeito de girar para a direita.
  85. #
  86. # X = 4
  87. # Ativa o efeito de tremer.
  88. #
  89. # X = 5
  90. # Ativa o efeito de ação frontal.
  91. #
  92. # X = 6
  93. # Ativa o efeito de dar um passo para esquerda.
  94. #
  95. # X = 7
  96. # Ativa o efeito de de dar um passo para direita.
  97. #
  98. #==============================================================================
  99. # ■ Animações dos battlers em Colapso.
  100. #==============================================================================
  101. # Coloque as seguintes Tags na caixa de notas dos inimigos ou personagens.
  102. #
  103. # <Motion Collapse = X>
  104. #
  105. # X = 0
  106. # Ativa colapso na vertical.
  107. #
  108. # X = 1
  109. # Ativa o colapso na horizontal.
  110. #
  111. # X = 2
  112. # Ativa o colapso em Zoom OUT.
  113. #
  114. # X = 3
  115. # Ativa o colapso em Zoom IN.
  116. #
  117. # X = 4
  118. # Ativa o colapso em Zoom IN e Zoom OUT.
  119. #
  120. # X = 5
  121. # Ativa o colapso em Modo Boss.
  122. #
  123. # X = 6
  124. # Não ativa colapso.(Do nothing)
  125. #
  126. # X = 7
  127. # Ativa o collapse em Slice.
  128. #
  129. #==============================================================================
  130. # ■ Forçar o collapso Slice
  131. #==============================================================================
  132. # Coloque a Tag abaixo na caixa de notas da habilidade.
  133. #
  134. # <Slice>
  135. #
  136. #==============================================================================
  137. # ■ Ativar animação de dano em condições maléficas.
  138. #==============================================================================
  139. # Coloque a seguinte Tag na caixa de notas de condições para ativar o efeito
  140. # de dano.
  141. #
  142. # <Bad State>
  143. #
  144. #==============================================================================
  145. # ■ Definir uma posição específica do battler inimigo
  146. #==============================================================================
  147. # Para definir uma posição do inimigo na tela use a Tag abaixo na caixa
  148. # dos inimigos
  149. #
  150. # <Screen X Y = 150 - 400>
  151. #
  152. #==============================================================================
  153. module MOG_BATTLER_MOTION

  154.   #============================================================================
  155.   #Ativar o efeito no aliados.
  156.   #============================================================================
  157.   ENABLE_ACTOR_MOTION = true
  158.   
  159.   #============================================================================
  160.   #Ativar o efeito nos inimigos
  161.   #============================================================================
  162.   ENABLE_ENEMY_MOTION = true
  163.   
  164.   #============================================================================
  165.   #Definição da velocidade do efeito de respirar.
  166.   #============================================================================
  167.   BREATH_EFFECT_SPEED = 4  #Default 1
  168.   
  169.   #============================================================================
  170.   #Definição do limite de zoom do efeito de respirar.
  171.   #============================================================================
  172.   BREATH_EFFECT_RANGE = [0.98, 1.00] #Default [0.92, 1.00]
  173.   
  174.   #============================================================================
  175.   # Ativar a função mirror dependendo do lado do oponente.
  176.   #============================================================================
  177.   BATTLER_MIRROR_DIRECTION = true
  178.   
  179.   #============================================================================
  180.   # Ativar o efeito Blink ao receber dano.
  181.   #============================================================================
  182.   ENABLE_DAMAGE_BLINK_EFFECT = false
  183. end

  184. #==============================================================================
  185. # ■ Game_Temp
  186. #==============================================================================
  187. class Game_Temp
  188.   
  189.   attr_accessor :battler_in_motion
  190.   attr_accessor :bact_wait_d
  191.   attr_accessor :bact_phase
  192.   
  193.   #--------------------------------------------------------------------------
  194.   # ● Initialize
  195.   #--------------------------------------------------------------------------      
  196.   alias mog_battler_motion_initialize initialize
  197.   def initialize
  198.       @battler_in_motion = false ; @bact_wait_d = 0 ; @bact_phase = [0,0]
  199.       mog_battler_motion_initialize
  200.   end  
  201.   
  202. end

  203. #==============================================================================
  204. # ■ Game_Battler
  205. #==============================================================================
  206. class Game_Battler < Game_BattlerBase
  207.   
  208.    attr_accessor :motion_start
  209.    attr_accessor :motion_stand
  210.    attr_accessor :motion_action
  211.    attr_accessor :motion_damage
  212.    attr_accessor :motion_collapse
  213.    attr_accessor :motion_slice
  214.    attr_accessor :motion_move
  215.    attr_accessor :motion_org_pos
  216.    attr_accessor :motion_bms
  217.    attr_accessor :bact_action
  218.    attr_accessor :bact_skill
  219.    attr_accessor :primary_target
  220.    
  221.   #--------------------------------------------------------------------------
  222.   # ● Initialize
  223.   #--------------------------------------------------------------------------      
  224.    alias mog_motion_animation_initialize initialize
  225.    def initialize
  226.        mog_motion_animation_initialize
  227.        @motion_start = -1
  228.        @motion_stand = [-1,0]
  229.        @motion_action = [-1,0]
  230.        @motion_collapse = [99,0]
  231.        @motion_damage = [0,0]
  232.        @motion_move = [false,0,0]
  233.        @motion_org_pos = [0,0]
  234.        @motion_bms = [0,false]
  235.        @motion_slice = [false,0,0]
  236.        bact_action_clear
  237.    end     

  238.   #--------------------------------------------------------------------------
  239.   # ● Bact Action Clear
  240.   #--------------------------------------------------------------------------      
  241.   def bact_action_clear
  242.       @bact_action = [false,0,0] ; @bact_skill = nil
  243.   end   

  244.   #--------------------------------------------------------------------------
  245.   # ● Added New State
  246.   #--------------------------------------------------------------------------  
  247.   alias mog_motion_animation_add_new_state add_new_state
  248.   def add_new_state(state_id)
  249.       mog_motion_animation_add_new_state(state_id)
  250.       self.motion_damage[0] = 1 if $data_states[state_id].note =~ /<Bad State>/
  251.   end   

  252.   #--------------------------------------------------------------------------
  253.   # ● Move To
  254.   #--------------------------------------------------------------------------  
  255.   def move_to(x,y)
  256.       return if self.dead?
  257.       @motion_move = [true,x,y]
  258.   end
  259.   
  260.   #--------------------------------------------------------------------------
  261.   # ● Set Original Position
  262.   #--------------------------------------------------------------------------  
  263.   def set_org_pos
  264.       scx = self.screen_x rescue 0
  265.       scy = self.screen_y rescue 0   
  266.       @motion_opos = [scx,scy]
  267.   end
  268.   
  269.   #--------------------------------------------------------------------------
  270.   # ● Return Org
  271.   #--------------------------------------------------------------------------  
  272.   def return_org
  273.       return if self.dead?
  274.       @motion_move = [true,@motion_opos[0],@motion_opos[1]]   
  275.   end
  276.    
  277.   #--------------------------------------------------------------------------
  278.   # ● Item Apply
  279.   #--------------------------------------------------------------------------  
  280.   alias mog_bactmotion_item_apply item_apply
  281.   def item_apply(user, item)
  282.       return if self.motion_slice[0]
  283.       mog_bactmotion_item_apply(user, item)
  284.       unless self.is_a?(Game_Actor)
  285.          self.motion_collapse[0] = 7 if self.dead? and item.note =~ /<Slice>/
  286.       end
  287.   end
  288.   
  289. end

  290. #==============================================================================
  291. # ■ Game_Enemy
  292. #==============================================================================
  293. class Game_Enemy < Game_Battler
  294.    
  295.   #--------------------------------------------------------------------------
  296.   # ● Initialize
  297.   #--------------------------------------------------------------------------
  298.   alias mog_motion_animation_enemy_initialize initialize
  299.   def initialize(index, enemy_id)
  300.       mog_motion_animation_enemy_initialize(index, enemy_id)
  301.       setup_motion_animation(enemy_id)
  302.   end
  303.   
  304.   #--------------------------------------------------------------------------
  305.   # ● Setup Motion Animation
  306.   #--------------------------------------------------------------------------  
  307.   def setup_motion_animation(enemy_id)
  308.       self.motion_stand[0] = $1.to_i if  enemy.note =~ /<Motion Standby = (\d+)>/i
  309.       self.motion_collapse[0] = $1.to_i if  enemy.note =~ /<Motion Collapse = (\d+)>/i
  310.       self.motion_start =  $1.to_i if  enemy.note =~ /<Motion Appear = (\d+)>/i
  311.   end
  312. end

  313. #==============================================================================
  314. # ■ Game Actor
  315. #==============================================================================
  316. class Game_Actor < Game_Battler

  317.   #--------------------------------------------------------------------------
  318.   # ● Setup
  319.   #--------------------------------------------------------------------------
  320.   alias mog_motion_animation_actor_setup setup
  321.   def setup(actor_id)
  322.       mog_motion_animation_actor_setup(actor_id)
  323.       self.motion_stand[0] = $1.to_i if  actor.note =~ /<Motion Standby = (\d+)>/i
  324.       self.motion_collapse[0] = $1.to_i if  actor.note =~ /<Motion Collapse = (\d+)>/i      
  325.       self.motion_start =  $1.to_i if  actor.note =~ /<Motion Appear = (\d+)>/i  
  326.   end

  327. end

  328. #==============================================================================
  329. # ■ Game_Battler
  330. #==============================================================================
  331. class Game_Battler < Game_BattlerBase
  332.   
  333.   #--------------------------------------------------------------------------
  334.   # ● Execute Damage
  335.   #--------------------------------------------------------------------------  
  336.   alias mog_battler_motion_execute_damage execute_damage
  337.   def execute_damage(user)
  338.       mog_battler_motion_execute_damage(user)
  339.       self.motion_damage[0] = 1 if @result.hp_damage > 0
  340.   end
  341.   
  342. end

  343. #==============================================================================
  344. # ■ Spriteset Battle
  345. #==============================================================================
  346. class Spriteset_Battle
  347.   
  348.   #--------------------------------------------------------------------------
  349.   # * Update
  350.   #--------------------------------------------------------------------------
  351.   alias mog_battler_motion_update update
  352.   def update
  353.       $game_temp.battler_in_motion = false
  354.       mog_battler_motion_update
  355.   end
  356.   
  357.   #--------------------------------------------------------------------------
  358.   # * Animation?
  359.   #--------------------------------------------------------------------------
  360.   alias mog_battler_motion_animation? animation?
  361.   def animation?
  362.       return true if $game_temp.battler_in_motion
  363.       mog_battler_motion_animation?
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # * Effect?
  367.   #--------------------------------------------------------------------------
  368.   alias mog_battler_motion_effect? effect?
  369.   def effect?
  370.       return true if $game_temp.battler_in_motion
  371.       mog_battler_motion_effect?
  372.   end
  373.   
  374. end


  375. #==============================================================================
  376. #==============================================================================
  377. # ● INITIAL ●
  378. #==============================================================================
  379. #==============================================================================

  380. #==============================================================================
  381. # ■ Sprite Battler
  382. #==============================================================================
  383. class Sprite_Battler < Sprite_Base

  384.   #--------------------------------------------------------------------------
  385.   # ● Update Bitmap
  386.   #--------------------------------------------------------------------------   
  387.   alias mog_bactmotion_update_bitmap update_bitmap
  388.   def update_bitmap
  389.       return if @battler.motion_slice[0]
  390.       mog_bactmotion_update_bitmap
  391.   end   
  392.       
  393.   #--------------------------------------------------------------------------
  394.   # ● Can Update Motion?
  395.   #--------------------------------------------------------------------------   
  396.   def can_update_motion?
  397.       return true
  398.   end   
  399.   
  400.   #--------------------------------------------------------------------------
  401.   # ● Update Position
  402.   #--------------------------------------------------------------------------  
  403.   alias mog_motion_animation_update_position update_position
  404.   def update_position
  405.       active_battler_motion      
  406.       if @battler_motion_active
  407.          update_motion_animation
  408.          self.z = @battler.screen_z rescue nil
  409.          self.z += 20 if @battler.bact_data[1] != nil and !@battler.bact_data[6]
  410.          return
  411.       end      
  412.       mog_motion_animation_update_position
  413.       self.z += 20 if @battler.bact_data[1] != nil and !@battler.bact_data[6]
  414.   end  
  415.   
  416.   #--------------------------------------------------------------------------
  417.   # ● Active Battler Motion
  418.   #--------------------------------------------------------------------------   
  419.   def active_battler_motion
  420.       return if @motion_initial_base != nil or bitmap == nil
  421.       return if @battler == nil
  422.       return if !@battler.exist?
  423.       @motion_initial_base = true
  424.       @battler_motion_active = true if can_update_battler_motion?
  425.   end  
  426.   
  427.   #--------------------------------------------------------------------------
  428.   # ● Can Update Battler Motion
  429.   #--------------------------------------------------------------------------      
  430.   def can_update_battler_motion?
  431.       return false if @battler.is_a?(Game_Actor)
  432.       return false if @battler == nil
  433.       return false if @battler.dead?
  434.       return false if !@battler.use_sprite?
  435.       return false if @battler.screen_x == nil
  436.       return false if @battler.is_a?(Game_Actor) and !MOG_BATTLER_MOTION::ENABLE_ACTOR_MOTION
  437.       return false if @battler.is_a?(Game_Enemy) and !MOG_BATTLER_MOTION::ENABLE_ENEMY_MOTION
  438.       return false if $imported[:mog_sprite_actor] and @battler.is_a?(Game_Actor)
  439.       return true
  440.   end
  441.    
  442.   #--------------------------------------------------------------------------
  443.   # ● Update Motion Animation
  444.   #--------------------------------------------------------------------------   
  445.   def update_motion_animation
  446.       setup_initial_motion
  447.       execute_start_animation
  448.       return if @wait_motion_start
  449.       if can_execute_collapse?
  450.          execute_motion_collapse
  451.       else
  452.          if can_update_motion?
  453.             execute_motion_move_to if can_update_move_to?
  454.             execute_motion_damage
  455.             execute_motion_idle if can_update_idle?
  456.             execute_motion_action if can_update_action?
  457.          end
  458.       end
  459.   end
  460.   
  461.   #--------------------------------------------------------------------------
  462.   # ● Setup Initial Motion
  463.   #--------------------------------------------------------------------------      
  464.   def setup_initial_motion
  465.       return if @motion_initial != nil
  466.       @motion_initial = true
  467.       @collapse_done = false
  468.       @motion_speed = 0
  469.       @start_speed = [0,0]      
  470.       @battler.motion_collapse[1] = 0
  471.       self.x = @battler.screen_x rescue 0
  472.       self.y = @battler.screen_y rescue 0
  473.       self.z = @battler.screen_z rescue 100
  474.       @battler.motion_bms = [0,false]
  475.       @battler.set_org_pos      
  476.       setup_motion_stand
  477.       @original_set = [self.x, self.y, self.zoom_x,self.zoom_y,self.mirror,self.angle,255]
  478.       setup_motion_start
  479.       setup_motion_damage            
  480.       setup_motion_action
  481.   end  

  482.   #--------------------------------------------------------------------------
  483.   # ● Return Set
  484.   #--------------------------------------------------------------------------         
  485.   def return_set(value)
  486.       self.x = value[0]
  487.       self.y = value[1]
  488.       self.zoom_x = value[2]
  489.       self.zoom_y = value[3]
  490.       self.mirror = value[4]
  491.       self.angle = value[5]
  492.       self.opacity = value[6]      
  493.   end  

  494.   #--------------------------------------------------------------------------
  495.   # ● setup_motion_start
  496.   #--------------------------------------------------------------------------            
  497.   def setup_motion_start
  498.       @wait_motion_start = true
  499.       @scr_rect_speed = 1      
  500.       case @battler.motion_start
  501.          when 0  
  502.             self.x = 0 - (self.bitmap.width + rand(100))
  503.          when 1
  504.             self.y = 0 - (self.bitmap.height + rand(100))
  505.          when 2   
  506.             self.angle = 360
  507.             self.x = 0 - self.bitmap.width
  508.          when 3   
  509.             self.zoom_x = 1.5 + (rand(10) / 100.0)
  510.             self.zoom_y = self.zoom_x
  511.             self.opacity = 0
  512.          when 4
  513.             self.zoom_x = 0.2 + (rand(10) / 100.0)
  514.             self.zoom_y = self.zoom_x
  515.             self.opacity = 0
  516.          when 5   
  517.             self.src_rect.y = -self.bitmap.height
  518.             @scr_rect_speed = self.bitmap.height / 40
  519.             @scr_rect_speed = 1 if @scr_rect_speed <= 0
  520.          else   
  521.            @wait_motion_start = false
  522.       end   
  523.   end  
  524.   
  525.   #--------------------------------------------------------------------------
  526.   # ● Execute Start Animation
  527.   #--------------------------------------------------------------------------         
  528.   def execute_start_animation
  529.       return if !@wait_motion_start
  530.       $game_temp.battler_in_motion = true
  531.       s_x = 1 + ((self.x - @original_set[0]).abs / (20 + @start_speed[0]))
  532.       s_y = 1 + ((self.y - @original_set[1]).abs / (20 + @start_speed[1]))      
  533.       if self.x < @original_set[0]
  534.          self.x += s_x
  535.          self.x = @original_set[0] if self.x >= @original_set[0]
  536.       elsif self.x > @original_set[0]
  537.          self.x -= s_x
  538.          self.x = @original_set[0] if self.x <= @original_set[0]
  539.       end
  540.       if self.y < @original_set[1]
  541.          self.y += s_y
  542.          self.y = @original_set[1] if self.y > @original_set[1]
  543.       elsif self.y > @original_set[1]
  544.          self.y -= s_y
  545.          self.y = @original_set[1] if self.y < @original_set[1]
  546.       end
  547.       if self.zoom_x != @original_set[2]
  548.          if self.zoom_x > @original_set[2]
  549.             self.zoom_x -= 0.01
  550.             self.zoom_x = @original_set[2] if self.zoom_x < @original_set[2]
  551.          elsif self.zoom_x < @original_set[2]
  552.             self.zoom_x += 0.01
  553.             self.zoom_x = @original_set[2] if self.zoom_x > @original_set[2]
  554.          end         
  555.       end  
  556.       if self.zoom_y != @original_set[3]
  557.          if self.zoom_y > @original_set[3]
  558.             self.zoom_y -= 0.01
  559.             self.zoom_y = @original_set[3] if self.zoom_y < @original_set[3]
  560.          elsif self.zoom_y < @original_set[3]
  561.             self.zoom_y += 0.01
  562.             self.zoom_y = @original_set[3] if self.zoom_y > @original_set[3]
  563.          end         
  564.       end        
  565.       self.opacity += 10
  566.       if self.angle > 0
  567.          self.angle -= 5
  568.          self.angle = @original_set[5] if self.angle < @original_set[5]
  569.       end
  570.       if self.src_rect.y != 0
  571.          self.src_rect.y += @scr_rect_speed
  572.          self.src_rect.y = 0 if self.src_rect.y > 0
  573.       end
  574.       if sprite_original_set?  
  575.          @wait_motion_start = false
  576.          @battler.motion_bms[1] = true
  577.          self.src_rect.y = 0
  578.       end   
  579.   end  
  580.   
  581.   #--------------------------------------------------------------------------
  582.   # ● Sprite original Set?
  583.   #--------------------------------------------------------------------------         
  584.   def sprite_original_set?
  585.       return false if self.x != @original_set[0]
  586.       return false if self.y != @original_set[1]   
  587.       return false if self.zoom_x != @original_set[2]
  588.       return false if self.zoom_y != @original_set[3]        
  589.       return false if self.mirror != @original_set[4]
  590.       return false if self.angle != @original_set[5]
  591.       return false if self.opacity != @original_set[6]     
  592.       return false if self.src_rect.y != 0      
  593.       return true
  594.   end  
  595.    
  596. end

  597. #==============================================================================
  598. #==============================================================================
  599. # ● MOVE TO ●
  600. #==============================================================================
  601. #==============================================================================

  602. #==============================================================================
  603. # ■ Sprite Battler
  604. #==============================================================================
  605. class Sprite_Battler < Sprite_Base
  606.   
  607.   #--------------------------------------------------------------------------
  608.   # ● Can Update Move_to
  609.   #--------------------------------------------------------------------------   
  610.   def can_update_move_to?
  611.       return false if !@battler.motion_move[0]
  612.       return true
  613.   end  
  614.   
  615.   #--------------------------------------------------------------------------
  616.   # ● Execute Motion Move_to
  617.   #--------------------------------------------------------------------------        
  618.   def execute_motion_move_to      
  619.       $game_temp.battler_in_motion = true
  620.       execute_motion_mv(0,self.x,@battler.motion_move[1])
  621.       execute_motion_mv(1,self.y,@battler.motion_move[2])
  622.       mv_clear
  623.   end
  624.    
  625.   #--------------------------------------------------------------------------
  626.   # ● MV Clear
  627.   #--------------------------------------------------------------------------      
  628.   def mv_clear
  629.       return if self.x != @battler.motion_move[1]
  630.       return if self.y != @battler.motion_move[2]
  631.       @battler.motion_move[0] = false
  632.   end
  633.       
  634.   #--------------------------------------------------------------------------
  635.   # ● Execute Motion Mv
  636.   #--------------------------------------------------------------------------      
  637.   def execute_motion_mv(type,cp,np)
  638.       sp = 2 + ((cp - np).abs / 20)
  639.       if cp > np
  640.          cp -= sp
  641.          cp = np if cp < np
  642.       elsif cp < np
  643.          cp += sp
  644.          cp = np if cp > np
  645.       end     
  646.       self.x = cp if type == 0
  647.       self.y = cp if type == 1
  648.   end   
  649.   
  650. end

  651. #==============================================================================
  652. #==============================================================================
  653. # ● DAMAGE ●
  654. #==============================================================================
  655. #==============================================================================

  656. #==============================================================================
  657. # ■ Sprite Battler
  658. #==============================================================================
  659. class Sprite_Battler < Sprite_Base

  660.   #--------------------------------------------------------------------------
  661.   # ● Can Update Damage
  662.   #--------------------------------------------------------------------------   
  663.   def can_update_damage?
  664.       return false if @battler.motion_damage[1] == 0
  665.       return false if @battler.motion_move[0]
  666.       return false if $imported[:mog_battle_camera] and $game_temp.bc_wait_cp[0] > 0
  667.       return true
  668.   end   
  669.   
  670.   #--------------------------------------------------------------------------
  671.   # ● Setup Initial Motion
  672.   #--------------------------------------------------------------------------        
  673.   def execute_motion_damage
  674.       damage_refresh
  675.       update_motion_damage if can_update_damage?
  676.   end

  677.   #--------------------------------------------------------------------------
  678.   # ● Setup Motion Damage
  679.   #--------------------------------------------------------------------------        
  680.   def setup_motion_damage     
  681.       @battler.motion_damage = [0,0]
  682.       @damage_pre_set = [self.x, self.y, self.zoom_x,self.zoom_y,self.mirror,self.angle,self.opacity]
  683.   end  
  684.   
  685.   #--------------------------------------------------------------------------
  686.   # ● Damage Refresh
  687.   #--------------------------------------------------------------------------         
  688.   def damage_refresh
  689.       return if @battler.motion_damage[0] == 0
  690.       if @battler.motion_damage[1] == 0
  691.          @damage_pre_set = [self.x, self.y, self.zoom_x,self.zoom_y,self.mirror,self.angle,self.opacity]
  692.       end
  693.       @battler.motion_damage[0] = 0
  694.       @battler.motion_damage[1] = 45
  695.   end
  696.   
  697.   #--------------------------------------------------------------------------
  698.   # ● Update Motion Damage
  699.   #--------------------------------------------------------------------------            
  700.   def update_motion_damage
  701.       return if @damage_pre_set.nil?
  702.       self.x = @damage_pre_set[0] + rand(@battler.motion_damage[1])
  703.       @battler.motion_damage[1] -= 1
  704.       if @battler.motion_damage[1] == 0
  705.          if $imported[:mog_battle_hud_ex] != nil and @battler.is_a?(Game_Actor)
  706.             return_set(@original_set)
  707.          else  
  708.             return_set(@damage_pre_set)
  709.          end   
  710.       end  
  711.   end
  712.    
  713. end

  714. #==============================================================================
  715. #==============================================================================
  716. # ● IDLE ●
  717. #==============================================================================
  718. #==============================================================================


  719. #==============================================================================
  720. # ■ Sprite Battler
  721. #==============================================================================
  722. class Sprite_Battler < Sprite_Base
  723.   
  724.   #--------------------------------------------------------------------------
  725.   # ● Can Update idle
  726.   #--------------------------------------------------------------------------   
  727.   def can_update_idle?
  728.       return false if @old_motion_action != -1
  729.       return false if @battler.motion_damage[1] > 0
  730.       return false if @battler.motion_move[0]
  731.       return false if $imported[:mog_battle_camera] and $game_temp.bc_wait_cp[0] > 0
  732.       return true
  733.   end      

  734.   #--------------------------------------------------------------------------
  735.   # ● Setup Motion Stand
  736.   #--------------------------------------------------------------------------        
  737.   def setup_motion_stand
  738.       @breath_range = [MOG_BATTLER_MOTION::BREATH_EFFECT_RANGE[0],
  739.                        MOG_BATTLER_MOTION::BREATH_EFFECT_RANGE[1],0,
  740.                        MOG_BATTLER_MOTION::BREATH_EFFECT_SPEED]
  741.       @float_range = [@battler.screen_y - 10, @battler.screen_y + 10]
  742.       @side_range = [@battler.screen_x - 10, @battler.screen_x + 10]
  743.       @battler.motion_stand[1] = 0
  744.       case @battler.motion_stand[0]
  745.          when 0
  746.              self.zoom_y = @breath_range[0] + (rand(10) / 100.0)
  747.              @battler.motion_stand[1] = rand(2)
  748.          when 1
  749.              self.y += 10 - rand(20)
  750.              @battler.motion_stand[1] = rand(2)
  751.          when 2
  752.              self.x += 10 - rand(20)
  753.              @battler.motion_stand[1] = rand(2)            
  754.       end
  755.   end
  756.    
  757.   #--------------------------------------------------------------------------
  758.   # ● Execute Motion Animation
  759.   #--------------------------------------------------------------------------        
  760.   def execute_motion_idle
  761.       case @battler.motion_stand[0]
  762.          when 0
  763.              update_motion_breath
  764.          when 1  
  765.              update_motion_float
  766.          when 2
  767.              update_motion_side
  768.       end        
  769.   end  
  770.   
  771.   #--------------------------------------------------------------------------
  772.   # ● Update Motion Breath
  773.   #--------------------------------------------------------------------------         
  774.   def update_motion_breath  
  775.       @breath_range[2] += 1
  776.       return if @breath_range[2] < @breath_range[3]
  777.       @breath_range[2] = 0
  778.       case @battler.motion_stand[1]
  779.          when 0
  780.            self.zoom_y -= 0.002
  781.            if self.zoom_y <= @breath_range[0]
  782.               @battler.motion_stand[1] = 1
  783.               self.zoom_y = @breath_range[0]
  784.            end   
  785.          when 1  
  786.            self.zoom_y += 0.002
  787.            if self.zoom_y >= @breath_range[1]
  788.               @battler.motion_stand[1] = 0
  789.               self.zoom_y = @breath_range[1]
  790.            end   
  791.       end
  792.   end  
  793.   
  794.   #--------------------------------------------------------------------------
  795.   # ● Update Motion Float
  796.   #--------------------------------------------------------------------------         
  797.   def update_motion_float
  798.       @motion_speed += 1
  799.       return if @motion_speed < 5
  800.       @motion_speed = 0
  801.       case @battler.motion_stand[1]
  802.            when 0
  803.                 self.y -= 1
  804.                 @battler.motion_bms[0] -= 1
  805.                 if self.y < @float_range[0]
  806.                    self.y = @float_range[0]
  807.                    @battler.motion_bms[0] += 1
  808.                    @battler.motion_stand[1] = 1
  809.                 end   
  810.            when 1  
  811.                 self.y += 1
  812.                 @battler.motion_bms[0] += 1
  813.                 if self.y > @float_range[1]
  814.                    self.y = @float_range[1]
  815.                    @battler.motion_bms[0] -= 1
  816.                    @battler.motion_stand[1] = 0
  817.                 end                  
  818.       end
  819.   end   
  820.   
  821.   #--------------------------------------------------------------------------
  822.   # ● Update Motion Side
  823.   #--------------------------------------------------------------------------         
  824.   def update_motion_side
  825.       @motion_speed += 1
  826.       return if @motion_speed < 5
  827.       @motion_speed = 0
  828.       case @battler.motion_stand[1]
  829.            when 0
  830.                 self.x -= 1
  831.                 if self.x < @side_range[0]
  832.                    self.x = @side_range[0]
  833.                    @battler.motion_stand[1] = 1
  834.                 end   
  835.            when 1  
  836.                 self.x += 1
  837.                 if self.x > @side_range[1]
  838.                    self.x = @side_range[1]
  839.                    @battler.motion_stand[1] = 0
  840.                 end                  
  841.       end
  842.   end     
  843.   
  844. end

  845. #==============================================================================
  846. #==============================================================================
  847. # ● ACTION ●
  848. #==============================================================================
  849. #==============================================================================

  850. #==============================================================================
  851. # ■ Game Action
  852. #==============================================================================
  853. class Game_Action
  854.   
  855.   #--------------------------------------------------------------------------
  856.   # ● Prepare
  857.   #--------------------------------------------------------------------------                  
  858.   alias mog_motion_action_prepare prepare
  859.   def prepare
  860.       mog_motion_action_prepare   
  861.       set_motion_action
  862.   end
  863.    
  864.   #--------------------------------------------------------------------------
  865.   # ● Set Motion Action
  866.   #--------------------------------------------------------------------------                    
  867.   def set_motion_action
  868.       return if @item.object == nil or subject == nil
  869.       subject.motion_action[0] = $1.to_i if @item.object.note =~ /<Motion Action = (\d+)>/i
  870.   end
  871.   
  872. end

  873. #==============================================================================
  874. # ■ Sprite Battler
  875. #==============================================================================
  876. class Sprite_Battler < Sprite_Base
  877.   
  878.   #--------------------------------------------------------------------------
  879.   # ● Can Update Action
  880.   #--------------------------------------------------------------------------   
  881.   def can_update_action?
  882.       return false if @battler.motion_damage[1] > 0
  883.       return false if @battler.motion_move[0]
  884.       return false if $imported[:mog_battle_camera] and $game_temp.bc_wait_cp[0] > 0
  885.       return true
  886.   end      
  887.   
  888.   #--------------------------------------------------------------------------
  889.   # ● Setup Motion Action
  890.   #--------------------------------------------------------------------------        
  891.   def setup_motion_action
  892.       @battler.motion_action = [-1,0]
  893.       @old_motion_action = @battler.motion_action[0]
  894.       @pre_set = [self.x, self.y, self.zoom_x,self.zoom_y,self.mirror,self.angle,self.opacity]
  895.   end

  896.   #--------------------------------------------------------------------------
  897.   # ● Refresh Action
  898.   #--------------------------------------------------------------------------         
  899.   def refresh_action
  900.       return if @old_motion_action == @battler.motion_action[0]
  901.       if @old_motion_action == -1
  902.          @pre_set = [self.x, self.y, self.zoom_x,self.zoom_y,self.mirror,self.angle,self.opacity]
  903.       end
  904.       @battler.motion_action[1] = 0  
  905.       return_set(@pre_set)
  906.       @old_motion_action = @battler.motion_action[0]
  907.       self.src_rect.y =  0
  908.   end  
  909.   
  910.   #--------------------------------------------------------------------------
  911.   # ● Execute Motion Action
  912.   #--------------------------------------------------------------------------            
  913.   def execute_motion_action
  914.       refresh_action
  915.       update_motion_action
  916.   end  
  917.   
  918.   #--------------------------------------------------------------------------
  919.   # ● Update Motion Action
  920.   #--------------------------------------------------------------------------              
  921.   def update_motion_action
  922.       return if @battler.motion_action[0] == -1
  923.       $game_temp.battler_in_motion = true
  924.       @battler.motion_action[1] += 1
  925.       case @battler.motion_action[0]
  926.            when -2
  927.               end_action
  928.            when 0
  929.               update_motion_zoom
  930.            when 1
  931.               update_motion_jump
  932.            when 2  
  933.               update_motion_round_right
  934.            when 3
  935.               update_motion_round_left
  936.            when 4
  937.               update_motion_shake
  938.            when 5
  939.               update_motion_front
  940.            when 6   
  941.               update_motion_step_left
  942.            when 7
  943.               update_motion_step_right              
  944.       end
  945.   end
  946.   
  947.   #--------------------------------------------------------------------------
  948.   # ● Update Motion Step Left
  949.   #--------------------------------------------------------------------------                  
  950.   def update_motion_step_left
  951.       case @battler.motion_action[1]
  952.            when 1..20
  953.                 self.x -= 2
  954.            when 21..40  
  955.                 self.x += 2           
  956.            else
  957.            end_action
  958.       end   
  959.    
  960.   end  
  961.   
  962.   #--------------------------------------------------------------------------
  963.   # ● Update Motion Step Right
  964.   #--------------------------------------------------------------------------                  
  965.   def update_motion_step_right
  966.       case @battler.motion_action[1]
  967.            when 1..20
  968.                 self.x += 2
  969.            when 21..40  
  970.                 self.x -= 2           
  971.            else
  972.         end_action   
  973.       end   
  974.   end   
  975.   
  976.   #--------------------------------------------------------------------------
  977.   # ● Update Motion Shake
  978.   #--------------------------------------------------------------------------               
  979.   def update_motion_shake      
  980.       self.x = @pre_set[0] + rand(@battler.motion_action[1]) if can_update_motion_shake?
  981.       end_action if @battler.motion_action[1] > 40
  982.   end   
  983.   
  984.   #--------------------------------------------------------------------------
  985.   # ● Can Update Motion Shake?
  986.   #--------------------------------------------------------------------------                  
  987.   def can_update_motion_shake?
  988.       if $imported[:mog_battle_hud_ex] !=nil
  989.          return false if @battler.is_a?(Game_Actor)
  990.       end
  991.       return true  
  992.   end  
  993.   
  994.   #--------------------------------------------------------------------------
  995.   # ● Update Motion Zoom
  996.   #--------------------------------------------------------------------------               
  997.   def update_motion_zoom
  998.       case @battler.motion_action[1]
  999.         when 1..20
  1000.            self.zoom_x += 0.01
  1001.            self.zoom_y += 0.01
  1002.         when 21..40
  1003.            self.zoom_x -= 0.01
  1004.            self.zoom_y -= 0.01         
  1005.         else  
  1006.         end_action   
  1007.       end
  1008.   end
  1009.   
  1010.   #--------------------------------------------------------------------------
  1011.   # ● Update Motion Jump
  1012.   #--------------------------------------------------------------------------                  
  1013.   def update_motion_jump
  1014.       case @battler.motion_action[1]
  1015.         when 1..20
  1016.             self.y -= 9
  1017.             self.zoom_x += 0.01
  1018.             self.zoom_y += 0.01
  1019.             self.mirror = true
  1020.             self.angle += 9
  1021.         when 21..40
  1022.             self.y += 9
  1023.             self.zoom_x -= 0.01
  1024.             self.zoom_y -= 0.01            
  1025.             self.mirror = false
  1026.             self.angle += 9
  1027.         else  
  1028.         self.angle = 0
  1029.         end_action   
  1030.       end      
  1031.   end
  1032.   
  1033.   #--------------------------------------------------------------------------
  1034.   # ● Update Motion Front
  1035.   #--------------------------------------------------------------------------                  
  1036.   def update_motion_front
  1037.       case @battler.motion_action[1]
  1038.         when 1..20
  1039.             self.y += 3
  1040.             self.zoom_x += 0.02
  1041.             self.zoom_y += 0.02
  1042.         when 21..40
  1043.             self.y -= 3
  1044.             self.zoom_x -= 0.02
  1045.             self.zoom_y -= 0.02            
  1046.         else  
  1047.         end_action   
  1048.       end      
  1049.   end
  1050.   
  1051.   #--------------------------------------------------------------------------
  1052.   # ● Update Motion Round Left
  1053.   #--------------------------------------------------------------------------                    
  1054.   def update_motion_round_left
  1055.       case @battler.motion_action[1]
  1056.         when 1..15
  1057.             self.y += 3
  1058.             self.x -= 3
  1059.             self.mirror = false
  1060.         when 16..30
  1061.             self.x += 6
  1062.             self.mirror = true
  1063.         when 31..45
  1064.             self.y -= 3
  1065.             self.x -= 3
  1066.             self.mirror = false
  1067.         else  
  1068.         end_action  
  1069.       end        
  1070.   end
  1071.   
  1072.   #--------------------------------------------------------------------------
  1073.   # ● Update Motion Round Right
  1074.   #--------------------------------------------------------------------------                    
  1075.   def update_motion_round_right
  1076.       case @battler.motion_action[1]
  1077.         when 1..15
  1078.             self.y += 3
  1079.             self.x += 3
  1080.             self.mirror = true
  1081.         when 16..30
  1082.             self.x -= 6
  1083.              self.mirror = false
  1084.         when 31..45
  1085.             self.y -= 3
  1086.             self.x += 3
  1087.             self.mirror = true
  1088.         else  
  1089.         end_action   
  1090.       end   
  1091.   end  
  1092.   
  1093.   #--------------------------------------------------------------------------
  1094.   # ● End Action
  1095.   #--------------------------------------------------------------------------                     
  1096.   def end_action
  1097.       if $imported[:mog_battle_hud_ex] != nil and @battler.is_a?(Game_Actor)
  1098.          return_set(@original_set)
  1099.       else  
  1100.          return_set(@pre_set)  
  1101.       end
  1102.       @battler.motion_action = [-1,0]
  1103.   end  
  1104.   
  1105. end

  1106. #==============================================================================
  1107. #==============================================================================
  1108. # ● COLLAPSE ●
  1109. #==============================================================================
  1110. #==============================================================================

  1111. #==============================================================================
  1112. # ■ Sprite Battler
  1113. #==============================================================================
  1114. class Sprite_Battler < Sprite_Base

  1115.   #--------------------------------------------------------------------------
  1116.   # ● Dispose
  1117.   #--------------------------------------------------------------------------   
  1118.   alias mog_bact_motion_dispose dispose
  1119.   def dispose   
  1120.       @pre_image.dispose rescue nil if !@pre_image.nil?
  1121.       mog_bact_motion_dispose
  1122.   end   
  1123.   
  1124.   #--------------------------------------------------------------------------
  1125.   # ● Can Update Action
  1126.   #--------------------------------------------------------------------------   
  1127.   def can_update_collapse?
  1128.       return true
  1129.   end      
  1130.   
  1131.   #--------------------------------------------------------------------------
  1132.   # ● Update Blink
  1133.   #--------------------------------------------------------------------------      
  1134.   alias mog_motion_animation_update_blink update_blink
  1135.   def update_blink
  1136.       return if @battler.dead? or !MOG_BATTLER_MOTION::ENABLE_DAMAGE_BLINK_EFFECT
  1137.       mog_motion_animation_update_blink
  1138.   end
  1139.   
  1140.   #--------------------------------------------------------------------------
  1141.   # ● Update Collapse
  1142.   #--------------------------------------------------------------------------
  1143.   def update_collapse
  1144.   end
  1145.   
  1146.   #--------------------------------------------------------------------------
  1147.   # ● Execute Motion Collapse
  1148.   #--------------------------------------------------------------------------   
  1149.   def execute_motion_collapse
  1150.       collapse_end if self.opacity == 0
  1151.       @battler.motion_collapse[1] += 1      
  1152.       case @battler.motion_collapse[0]
  1153.            when 0;     update_collapse_vertical
  1154.            when 1;     update_collapse_horizontal
  1155.            when 2;     update_collapse_zoom_out
  1156.            when 3;     update_collapse_zoom_in
  1157.            when 4;     update_collapse_zoom_in_out
  1158.            when 5;     update_collapse_boss_2
  1159.            when 6;     update_collpase_do_nothing
  1160.            when 7;     update_collpase_slice
  1161.            else ;      update_collapse_normal
  1162.       end
  1163.         
  1164.   end
  1165.    
  1166.   #--------------------------------------------------------------------------
  1167.   # ● Can Execute Collapse
  1168.   #--------------------------------------------------------------------------      
  1169.   def can_execute_collapse?
  1170.       return false if !@battler.dead?
  1171.       return false if @collapse_done
  1172.       return true
  1173.   end
  1174.   
  1175.   #--------------------------------------------------------------------------
  1176.   # ● Update Collapse Vertical
  1177.   #--------------------------------------------------------------------------        
  1178.   def update_collapse_vertical
  1179.       self.zoom_y += 0.1
  1180.       self.zoom_x -= 0.02         
  1181.       self.opacity -= 3   
  1182.   end
  1183.   
  1184.   #--------------------------------------------------------------------------
  1185.   # ● Update Collapse Horizontal
  1186.   #--------------------------------------------------------------------------         
  1187.   def update_collapse_horizontal
  1188.       self.zoom_x += 0.1
  1189.       self.zoom_y -= 0.02      
  1190.       self.opacity -= 3      
  1191.   end
  1192.      
  1193.   #--------------------------------------------------------------------------
  1194.   # ● Update Collapse Zoom Out
  1195.   #--------------------------------------------------------------------------            
  1196.   def update_collapse_zoom_out     
  1197.       self.zoom_x += 0.02
  1198.       self.zoom_y += 0.02     
  1199.       self.opacity -= 4   
  1200.   end
  1201.       
  1202.   #--------------------------------------------------------------------------
  1203.   # ● Update Collapse Zoom IN
  1204.   #--------------------------------------------------------------------------              
  1205.   def update_collapse_zoom_in
  1206.       self.zoom_x -= 0.01
  1207.       self.zoom_y -= 0.01      
  1208.       self.opacity -= 4            
  1209.   end
  1210.   
  1211.   #--------------------------------------------------------------------------
  1212.   # ● Update Collapse Zoom IN OUT
  1213.   #--------------------------------------------------------------------------               
  1214.   def update_collapse_zoom_in_out
  1215.       case @battler.motion_collapse[1]
  1216.            when 0..30
  1217.                 self.zoom_x += 0.1
  1218.                 self.zoom_y -= 0.02
  1219.                 self.opacity -= 2
  1220.            else  
  1221.                 self.zoom_y += 0.5
  1222.                 self.zoom_x -= 0.2
  1223.                 self.opacity -= 10
  1224.       end      
  1225.   end
  1226.      
  1227.   #--------------------------------------------------------------------------
  1228.   # ● Update Collapse Boss 2
  1229.   #--------------------------------------------------------------------------                  
  1230.   def update_collapse_boss_2
  1231.       self.x = @original_set[0] + rand(10)
  1232.       self.src_rect.y -= 1
  1233.       self.opacity = 0 if self.src_rect.y < -self.bitmap.height
  1234.   end
  1235.       
  1236.   #--------------------------------------------------------------------------
  1237.   # ● Update Collapse do nothing
  1238.   #--------------------------------------------------------------------------                    
  1239.   def update_collpase_do_nothing
  1240.   end  
  1241.   
  1242.   #--------------------------------------------------------------------------
  1243.   # ● Update Collpase Slice
  1244.   #--------------------------------------------------------------------------      
  1245.   def update_collpase_slice   
  1246.       return if !self.visible
  1247.       if !@battler.motion_slice[0] ; @battler.motion_slice[0] = true
  1248.           @pre_image = self.bitmap
  1249.           @cw_2s = @pre_image.width ; @ch_2s = @pre_image.height
  1250.           self.bitmap = Bitmap.new(@pre_image.width * 2,@pre_image.height)
  1251.           self.ox = self.bitmap.width / 2
  1252.       end
  1253.       @battler.motion_slice[1] += 1
  1254.       @battler.motion_slice[2] += 1
  1255.       if @battler.motion_slice[2] < 60 and @battler.motion_slice[2] < @cw_2s / 2
  1256.          self.bitmap.clear
  1257.          scr_rect_1 = Rect.new(0,0,@cw_2s,@ch_2s / 2)
  1258.          self.bitmap.blt((@cw_2s / 2) - @battler.motion_slice[1],0,@pre_image,scr_rect_1)
  1259.          scr_rect_2 = Rect.new(0,@ch_2s / 2,@cw_2s,@ch_2s / 2)
  1260.          self.bitmap.blt((@cw_2s / 2) + @battler.motion_slice[1],@ch_2s / 2,@pre_image,scr_rect_2)   
  1261.       else
  1262.          self.opacity -= 3
  1263.          if self.opacity == 0 ; self.visible = false ; collapse_end ; end
  1264.       end   
  1265.   end  
  1266.   
  1267.   #--------------------------------------------------------------------------
  1268.   # ● Update Collapse Normal
  1269.   #--------------------------------------------------------------------------                    
  1270.   def update_collapse_normal
  1271.       self.opacity -= 3
  1272.       self.blend_type = 1
  1273.   end  
  1274.   
  1275.   #--------------------------------------------------------------------------
  1276.   # ● Collapse End
  1277.   #--------------------------------------------------------------------------      
  1278.   def collapse_end
  1279.       return if @battler.motion_slice[0]
  1280.       @collapse_done = true
  1281.       return_set(@original_set)
  1282.       self.src_rect.y = -self.bitmap.height unless @battler.motion_collapse[0] == 6
  1283.       if @battler.is_a?(Game_Enemy) and @battler.dead?
  1284.          self.visible = false ; self.opacity = 0
  1285.       end   
  1286.   end  

  1287.   #--------------------------------------------------------------------------
  1288.   # ● Revert to Normal
  1289.   #--------------------------------------------------------------------------        
  1290.   alias mog_battler_motion_revert_to_normal revert_to_normal
  1291.   def revert_to_normal
  1292.       return if @battler.motion_slice[0]
  1293.       if @collapse_done
  1294.          @collapse_done = false
  1295.          return_set(@original_set)
  1296.       end
  1297.       mog_battler_motion_revert_to_normal
  1298.   end  
  1299.   
  1300. end

  1301. #===============================================================================
  1302. # ■ Game Battler
  1303. #===============================================================================
  1304. class Game_Battler < Game_BattlerBase
  1305.   
  1306.   attr_accessor :bact_data
  1307.   attr_accessor :bact_sprite
  1308.   attr_accessor :pre_target
  1309.   
  1310.   #--------------------------------------------------------------------------
  1311.   # ● Initialize
  1312.   #--------------------------------------------------------------------------      
  1313.   alias mog_bact_data_motion_initialize initialize
  1314.   def initialize
  1315.       bact_clear
  1316.       mog_bact_data_motion_initialize
  1317.   end
  1318.   
  1319.   #--------------------------------------------------------------------------
  1320.   # ● Bact Clear
  1321.   #--------------------------------------------------------------------------      
  1322.   def bact_clear
  1323.       @bact_data = [0,nil,nil,nil,false,false,0,0] ; @pre_target = nil  
  1324.   end
  1325.   
  1326. end

  1327. #==============================================================================
  1328. # ■ Sprite Battler
  1329. #==============================================================================
  1330. class Sprite_Battler < Sprite_Base
  1331.   
  1332.   #--------------------------------------------------------------------------
  1333.   # ● Initialize
  1334.   #--------------------------------------------------------------------------      
  1335.   alias mog_bact_motion_initialize initialize
  1336.   def initialize(viewport, battler = nil)
  1337.       @jump_count = 0 ; @jump_peak = 0 ; @move_wait_d = 0 ; @battler_dir = [false,0]
  1338.       mog_bact_motion_initialize(viewport, battler)
  1339.       if @battler.is_a?(Game_Enemy) and @battler.enemy.note =~ /<Screen X Y = \s*(\-*\d+)\s* - \s*(\-*\d+)\s*>/
  1340.          @battler.screen_x = $1.to_i ; @battler.screen_y = $2.to_i
  1341.       end        
  1342.   end   
  1343.       
  1344.   #--------------------------------------------------------------------------
  1345.   # ● Update Position
  1346.   #--------------------------------------------------------------------------  
  1347.   alias mog_bact_motion_update_position update_position
  1348.   def update_position     
  1349.       if battler_in_motion? ; battler_in_motion ; return ; end
  1350.       if escape_phase? ; update_escape_phase ; return ; end
  1351.       mog_bact_motion_update_position   
  1352.   end
  1353.   
  1354.   #--------------------------------------------------------------------------
  1355.   # ● Battler In Motion
  1356.   #--------------------------------------------------------------------------      
  1357.   def battler_in_motion?
  1358.       return false if @battler == nil
  1359.       return false if @battler.bact_data[0] == 0
  1360.       return false if $imported[:mog_animation_plus] and $game_temp.ani_plus_wait
  1361.       return true
  1362.   end
  1363.   
  1364.   #--------------------------------------------------------------------------
  1365.   # ● Escape Phase
  1366.   #--------------------------------------------------------------------------  
  1367.   def escape_phase?
  1368.       return false if !$imported[:mog_sprite_actor]
  1369.       return false if !MOG_SPRITE_ACTOR::ESCAPE_ANIMATION
  1370.       return false if @battler == nil
  1371.       return false if @battler.is_a?(Game_Enemy)
  1372.       return false if @battler.dead?
  1373.       return false if $game_temp.bact_phase[0] != 1
  1374.       return true
  1375.   end  

  1376.   #--------------------------------------------------------------------------
  1377.   # ● Battler In Motion
  1378.   #--------------------------------------------------------------------------      
  1379.   def battler_in_motion
  1380.       old_x = self.x ; old_y = self.y
  1381.       np = [@battler.bact_data[1],@battler.bact_data[2]]
  1382.       set_move_duration(np) if @battler.bact_data[5]
  1383.       update_jump(np)
  1384.       if @pre_set != nil and @battler.is_a?(Game_Enemy) and @battler.bact_data[0] == 2
  1385.          self.zoom_x -= 0.01 if self.zoom_x > @pre_set[2]
  1386.          self.zoom_y -= 0.01 if self.zoom_y > @pre_set[3]   
  1387.       end   
  1388.       if @move_wait_d == 0
  1389.          end_bact_move(np) if self.x == np[0] and self.y == np[1]
  1390.          if $imported[:mog_sprite_actor] and !@battler.dead?
  1391.             @battler.step_animation if @battler.bact_data[6] if (old_x != self.x) or (old_y != self.y)
  1392.             @battler.bact_sprite[3] = 2 if @wp_index > 0
  1393.          end
  1394.       end
  1395.       self.z = @battler.screen_z
  1396.       self.z += 20 if !@battler.bact_data[6]
  1397.       update_in_motion_end
  1398.   end

  1399.   #--------------------------------------------------------------------------
  1400.   # ● Update In Motion End
  1401.   #--------------------------------------------------------------------------      
  1402.   def update_in_motion_end
  1403.       return if @move_wait_d == 0
  1404.       @move_wait_d -= 1
  1405.       return if @move_wait_d > 0
  1406.       @battler.bact_data[0] = 0      
  1407.   end
  1408.   
  1409.   #--------------------------------------------------------------------------
  1410.   # ● End Bact Move
  1411.   #--------------------------------------------------------------------------      
  1412.   def end_bact_move(np)   
  1413.       self.angle = 0 unless @battler.dead?
  1414.       @battler.screen_x = np[0] ; @battler.screen_y = np[1]
  1415.       if @battler.motion_damage[1] > 0
  1416.          @battler.motion_damage = [0,0] ; update_motion_damage               
  1417.       end  
  1418.       if @pre_set != nil
  1419.          @pre_set[0] = self.x ; @pre_set[1] = self.y
  1420.          end_action if @battler.bact_data[0] == 2
  1421.          self.angle = 0
  1422.       end   
  1423.       @move_wait_d = (@battler.bact_data[6] or @battler.bact_data[0] == 2) ? 10 : 1
  1424.       @battler.bact_sprite[3] = 0 if $imported[:mog_sprite_actor]
  1425.       if @battler.bact_data[0] == 1
  1426.          @battler.bact_action[0] = true
  1427.       elsif @battler.bact_data[0] == 2
  1428.          @battler.bact_action_clear
  1429.          self.mirror = @battler_dir[0]
  1430.          @battler.bact_sprite[0] = @battler_dir[1]
  1431.          @battler_dir = [false,4]
  1432.          @battler.bact_sprite_need_refresh = true if @battler.is_a?(Game_Actor)
  1433.       end         
  1434.   end
  1435.         
  1436.   #--------------------------------------------------------------------------
  1437.   # ● Set Move Duration
  1438.   #--------------------------------------------------------------------------      
  1439.   def set_move_duration(np)      
  1440.       set_bact_angle_m      
  1441.       self.mirror = false if @battler.bact_data[0] == 2
  1442.       if @battler.motion_damage[1] > 0
  1443.          @battler.motion_damage = [0,0] ; update_motion_damage   
  1444.       end
  1445.       @battler.motion_damage = [0,0]
  1446.       @battler.bact_data[5] = false
  1447.       x_plus = (self.x - np[0]).abs ; y_plus = (self.y - np[1]).abs
  1448.       p = 0
  1449.       p = @battler.is_a?(Game_Actor) ? 500 : 0 if $imported[:mog_sprite_actor]
  1450.       e = @battler.bact_data[6] ? 200 + p : 5
  1451.       distance = Math.sqrt(x_plus + y_plus + e).round
  1452.       @jump_peak = (distance * 80 / 100).truncate
  1453.       @jump_count = @jump_peak * 2
  1454.       if @pre_set != nil
  1455.          @pre_set[0] = self.x ; @pre_set[1] = self.y ; @pre_set[4] = self.mirror
  1456.       end   
  1457.       @battler.bact_sprite[3] = 2 if $imported[:mog_sprite_actor]  
  1458.       @battler.bact_action_clear if @battler.bact_data[0] == 2
  1459.       @move_wait_d = 0
  1460.       @wp_index = 0 if @battler.bact_data[0] == 1      
  1461.   end
  1462.   
  1463.   #--------------------------------------------------------------------------
  1464.   # ● Set Bact Angle M
  1465.   #--------------------------------------------------------------------------      
  1466.   def set_bact_angle_m
  1467.       @battler_dir = [self.mirror,@battler.bact_sprite[0]] if @battler.bact_data[0] == 1  
  1468.       return if @battler.bact_data[6] and [2,4].include?(@battler.bact_sprite[5])
  1469.       if @battler.bact_data[7] >= 0 ; else
  1470.          self.angle = @battler.bact_data[0] == 2 ? 350 : 5
  1471.          self.mirror = true if @battler.is_a?(Game_Enemy) and MOG_BATTLER_MOTION::BATTLER_MIRROR_DIRECTION
  1472.          @battler.bact_sprite[0] = 4 unless [2,8].include?( @battler.bact_sprite[0])
  1473.       end
  1474.   end
  1475.   
  1476.   #--------------------------------------------------------------------------
  1477.   # ● Update Jump
  1478.   #--------------------------------------------------------------------------      
  1479.   def update_jump(np)
  1480.       return if $game_temp.bc_target_dmg[1] > 0
  1481.       @jump_count -= 1 if @jump_count > 0
  1482.       self.x = (self.x * @jump_count + np[0]) / (@jump_count + 1.0)
  1483.       self.y = ((self.y * @jump_count + np[1]) / (@jump_count + 1.0)) - jump_height
  1484.   end
  1485.   
  1486.   #--------------------------------------------------------------------------
  1487.   # ● Jump Height
  1488.   #--------------------------------------------------------------------------      
  1489.   def jump_height
  1490.       return 0 if @battler.bact_data[6]
  1491.       return (@jump_peak * @jump_peak - (@jump_count - @jump_peak).abs ** 2) / 40
  1492.   end
  1493.   

  1494.   #--------------------------------------------------------------------------
  1495.   # ● Can Update Battler Motion
  1496.   #--------------------------------------------------------------------------      
  1497.   alias mog_bact_can_update_battler_motion? can_update_battler_motion?
  1498.   def can_update_battler_motion?
  1499.       return false if @battler.bact_data[0] != 0
  1500.       mog_bact_can_update_battler_motion?
  1501.   end
  1502.    
  1503.   #--------------------------------------------------------------------------
  1504.   # ● Can Update idle
  1505.   #--------------------------------------------------------------------------   
  1506.   alias mog_bact_can_update_idle? can_update_idle?
  1507.   def can_update_idle?
  1508.       return false if @battler.bact_data[1] != nil
  1509.       mog_bact_can_update_idle?
  1510.   end   

  1511. end  

  1512. #===============================================================================
  1513. # ■ Scene Battle
  1514. #===============================================================================
  1515. class Scene_Battle < Scene_Base
  1516.   
  1517.   #--------------------------------------------------------------------------
  1518.   # ● Execute Action
  1519.   #--------------------------------------------------------------------------      
  1520.   alias mog_bact_execute_action execute_action
  1521.   def execute_action
  1522.       @cp_members = []
  1523.       if @subject != nil
  1524.          @subject.bact_action_clear
  1525.          item = @subject.current_action.item rescue nil
  1526.          @subject.bact_skill = item if item != nil
  1527.          if $imported[:mog_atb_system] and execute_cooperation_skill?
  1528.             @cp_members = current_cp_members
  1529.             for battler in @cp_members
  1530.                 battler.bact_skill = item if item != nil
  1531.            end
  1532.          end         
  1533.       end
  1534.       execute_bact_move if execute_bact_move?
  1535.       if $imported[:mog_sprite_actor] and $imported[:mog_animation_plus]
  1536.          $game_temp.ani_plus_wait = false  ; execute_cast_animation
  1537.       end
  1538.       mog_bact_execute_action
  1539.   end
  1540.   
  1541.   #--------------------------------------------------------------------------
  1542.   # ● Execute Bact Move
  1543.   #--------------------------------------------------------------------------      
  1544.   def execute_bact_move?
  1545.       item = @subject.current_action.item rescue nil
  1546.       return false if item == nil
  1547.       return false if item.is_a?(RPG::Skill) and @subject.is_a?(Game_Actor) and item.id == @subject.guard_skill_id
  1548.       targets = @subject.current_action.make_targets.compact rescue nil
  1549.       @subject.pre_target = targets
  1550.       for battler in @cp_members ; battler.pre_target = targets ; end      
  1551.       scy = @subject.screen_x rescue nil ; scx = targets[0].screen_x rescue nil
  1552.       return false if scx == nil or scy == nil
  1553.       return false if $imported[:mog_battle_hud_ex] and SceneManager.face_battler?
  1554.       return false if @act_enabled != nil
  1555.       return true
  1556.   end

  1557.   #--------------------------------------------------------------------------
  1558.   # ● Long Range?
  1559.   #--------------------------------------------------------------------------      
  1560.   def long_range?(item)
  1561.       return false if item == nil
  1562.       if @subject.is_a?(Game_Actor) and item.is_a?(RPG::Skill) and
  1563.          item.id == @subject.attack_skill_id and  @subject.equips[0] != nil
  1564.       return true if @subject.equips[0].note =~ /<Icon Angle = (\d+)>/i
  1565.       end  
  1566.       return false if item.note =~ /<Move to Target>/
  1567.       return false if item.note =~ /<Move to Target x\s*(\-*\d+)\s* y\s*(\-*\d+)\s*>/
  1568.       return true if [2,8,10].include?(item.scope)      
  1569.       return true
  1570.   end

  1571.   #--------------------------------------------------------------------------
  1572.   # ● Set BC Skill Type
  1573.   #--------------------------------------------------------------------------   
  1574.   def set_bc_skill_type
  1575.       item = @subject.current_action.item rescue nil
  1576.       return if item == nil
  1577.       return if item.is_a?(RPG::Skill) and item.stype_id != 1
  1578.       return if item.is_a?(RPG::Item) and item.itype_id != 1
  1579.       targets = @subject.current_action.make_targets.compact
  1580.       set_battle_camera_animation(targets, item.animation_id)
  1581.   end
  1582.   #--------------------------------------------------------------------------
  1583.   # ● Execute Bact Move
  1584.   #--------------------------------------------------------------------------      
  1585.   def execute_bact_move
  1586.       return if @subject.bact_skill == nil
  1587.       @act_enabled = true
  1588.       item = @subject.bact_skill
  1589.       if $imported[:mog_sprite_actor] and @subject.is_a?(Game_Actor) and long_range?(item)
  1590.           execute_bact_move_sprite_actor
  1591.       else   
  1592.          unless @subject.is_a?(Game_Enemy) and long_range?(item)
  1593.          targets = @subject.current_action.make_targets.compact
  1594.          targets[0] = @subject.primary_target if !@subject.primary_target.nil?
  1595.          exy = [0,0]
  1596.          if item.note =~ /<Move to Target x\s*(\-*\d+)\s* y\s*(\-*\d+)\s*>/
  1597.             exy = [$1.to_i,$2.to_i]
  1598.          end
  1599.          @subject.bact_data = [1,targets[0].screen_x + exy[0],targets[0].screen_y + exy[1],@subject.screen_x,@subject.screen_y,0,0,0]
  1600.          @subject.bact_data[5] = true
  1601.          @subject.bact_data[6] = false
  1602.          @subject.bact_data[7] = targets[0].screen_x - @subject.screen_x
  1603.          if @cp_members != nil
  1604.          for battler in @cp_members            
  1605.              battler.bact_data = [1,targets[0].screen_x,targets[0].screen_y,battler.screen_x,battler.screen_y,0,0,0]
  1606.              battler.bact_data[5] = true
  1607.              battler.bact_data[6] = false
  1608.              battler.bact_data[7] = targets[0].screen_x - battler.screen_x
  1609.           end         
  1610.           end
  1611.           execute_action_bact
  1612.          end
  1613.       end      
  1614.   end   
  1615.   
  1616.   #--------------------------------------------------------------------------
  1617.   # ● Execute Bact Move Sprite Actor
  1618.   #--------------------------------------------------------------------------      
  1619.   def execute_bact_move_sprite_actor
  1620.       ns = $imported[:mog_sprite_actor] ? $game_party.battlers_m_steps : 32
  1621.       if @subject.is_a?(Game_Enemy)
  1622.          targets = @subject.pre_target rescue nil
  1623.          targets = @subject.current_action.make_targets.compact if targets == nil
  1624.          if [2,8].include?($game_party.battle_members[0].bact_sprite[0])
  1625.             if targets[0].screen_y >= @subject.screen_y ; @subject.bact_sprite[0] = 2; end
  1626.             if targets[0].screen_y < @subject.screen_y ; @subject.bact_sprite[0] = 8; end
  1627.          else  
  1628.             if targets[0].screen_x >= @subject.screen_x ; @subject.bact_sprite[0] = 6; end
  1629.             if targets[0].screen_x < @subject.screen_x ; @subject.bact_sprite[0] = 4; end
  1630.          end
  1631.       end
  1632.       case @subject.bact_sprite[0]
  1633.            when 2 ; x = @subject.screen_x ; y = @subject.screen_y + ns
  1634.            when 4 ; x = @subject.screen_x - ns ; y = @subject.screen_y            
  1635.            when 6 ; x = @subject.screen_x + ns ; y = @subject.screen_y            
  1636.            when 8 ; x = @subject.screen_x ; y = @subject.screen_y - ns
  1637.       end      
  1638.       @subject.bact_data = [1,x,y,@subject.screen_x,@subject.screen_y,0,0,0,0]
  1639.       @subject.bact_data[5] = true ; @subject.bact_data[6] = true  
  1640.       for battler in @cp_members
  1641.           case battler.bact_sprite[0]
  1642.                when 2 ; x = battler.screen_x ; y = battler.screen_y + ns
  1643.                when 4 ; x = battler.screen_x - ns ; y = battler.screen_y            
  1644.                when 6 ; x = battler.screen_x + ns ; y = battler.screen_y            
  1645.                when 8 ; x = battler.screen_x ; y = battler.screen_y - ns
  1646.           end         
  1647.           battler.bact_data = [1,x,y,battler.screen_x,battler.screen_y,0,0,0,0]
  1648.           battler.bact_data[5] = true
  1649.           battler.bact_data[6] = true   
  1650.       end
  1651.       execute_action_bact  
  1652.   end
  1653.          
  1654.   #--------------------------------------------------------------------------
  1655.   # ● Process Action End
  1656.   #--------------------------------------------------------------------------      
  1657.   alias mog_bact_f_use_item use_item
  1658.   def use_item
  1659.       mog_bact_f_use_item
  1660.       motion_move_to_origin if @act_enabled
  1661.   end
  1662.   
  1663.   #--------------------------------------------------------------------------
  1664.   # ● Process Turn End
  1665.   #--------------------------------------------------------------------------      
  1666.   alias mog_bact_f_turn_end turn_end
  1667.   def turn_end
  1668.       motion_move_to_origin if @act_enabled
  1669.       mog_bact_f_turn_end
  1670.   end
  1671.   
  1672.   #--------------------------------------------------------------------------
  1673.   # ● Motion Move to Origin
  1674.   #--------------------------------------------------------------------------      
  1675.   def motion_move_to_origin
  1676.       if $imported[:mog_battle_camera]         
  1677.          $game_temp.bc_in_action[3] = false
  1678.          $game_temp.bc_in_turn = false ; clear_target_camera
  1679.       end
  1680.       process_wait_end
  1681.       process_bact_end if @subject.bact_data[1] != nil
  1682.       @subject.bact_action_clear
  1683.       @subject.pre_target = nil
  1684.       if @cp_members != nil
  1685.       for battler in @cp_members
  1686.           battler.bact_action_clear
  1687.           battler.pre_target = nil
  1688.       end
  1689.       end
  1690.       @act_enabled = nil  
  1691.   end
  1692.       
  1693.   #--------------------------------------------------------------------------
  1694.   # ● Turn End
  1695.   #--------------------------------------------------------------------------
  1696.   alias mog_bact_turn_end turn_end
  1697.   def turn_end
  1698.       @subject.return_to_orign if @subject.is_a?(Game_Actor) and $imported[:mog_sprite_actor]
  1699.       if @cp_members != nil
  1700.       for battler in @cp_members
  1701.           battler.return_to_orign if $imported[:mog_sprite_actor]
  1702.       end
  1703.       end      
  1704.       mog_bact_turn_end
  1705.   end
  1706.   
  1707.   #--------------------------------------------------------------------------
  1708.   # ● Process Wait End
  1709.   #--------------------------------------------------------------------------      
  1710.   def process_wait_end
  1711.       return if $game_temp.bact_wait_d == 0
  1712.       loop do ; update_basic ; $game_temp.bact_wait_d -= 1 ; break if $game_temp.bact_wait_d == 0
  1713.       end   
  1714.   end
  1715.   
  1716.   #--------------------------------------------------------------------------
  1717.   # ● Process Bact End
  1718.   #--------------------------------------------------------------------------      
  1719.   def process_bact_end      
  1720.       $game_temp.bc_in_action[6] = false if $imported[:mog_battle_camera]
  1721.       @subject.bact_data[0] = 2
  1722.       @subject.bact_data[1] = @subject.bact_data[3]
  1723.       @subject.bact_data[2] = @subject.bact_data[4]
  1724.       @subject.bact_data[5] = true
  1725.       @subject.wp_animation = [false,false] if $imported[:mog_sprite_actor]
  1726.       if @cp_members != nil
  1727.       for battler in @cp_members
  1728.           battler.bact_data[0] = 2
  1729.           battler.bact_data[1] = battler.bact_data[3]
  1730.           battler.bact_data[2] = battler.bact_data[4]
  1731.           battler.bact_data[5] = true
  1732.           battler..wp_animation = [false,false] if $imported[:mog_sprite_actor]
  1733.           battler.bact_sprite_need_refresh = true
  1734.       end      
  1735.       end
  1736.       execute_action_bact unless @subject.is_a?(Game_Actor) and $game_party.all_dead?
  1737.       @subject.bact_clear
  1738.       if @cp_members != nil
  1739.       for battler in @cp_members ; battler.bact_clear ; end
  1740.       end
  1741.   end     
  1742.       
  1743.   #--------------------------------------------------------------------------
  1744.   # ● Execute Action Bact
  1745.   #--------------------------------------------------------------------------      
  1746.   def execute_action_bact
  1747.       return if @subject == nil      
  1748.       loop do ; update_basic ; break if @subject.bact_data[0] == 0 ; end
  1749.   end
  1750.   
  1751.   #--------------------------------------------------------------------------
  1752.   # ● Execute Cooperation Skill?
  1753.   #--------------------------------------------------------------------------  
  1754.   def execute_cooperation_skill?
  1755.       return false if !@subject.is_a?(Game_Actor)
  1756.       item = @subject.bact_skill rescue nil
  1757.       return false if item == nil
  1758.       return false if !BattleManager.cskill_usable?(item.id,@subject.id)
  1759.       return true
  1760.   end  

  1761.   #--------------------------------------------------------------------------
  1762.   # ● Use Item
  1763.   #--------------------------------------------------------------------------  
  1764.   alias mog_bact2_use_item use_item
  1765.   def use_item
  1766.       if $imported[:mog_sprite_actor]
  1767.       target = @subject.pre_target[0] rescue nil
  1768.       if target != nil and target.dead?
  1769.          if @subject.is_a?(Game_Actor) ; return unless target.is_a?(Game_Actor)
  1770.          else ; return unless target.is_a?(Game_Enemy)
  1771.          end   
  1772.       end
  1773.       end
  1774.       mog_bact2_use_item
  1775.       @subject.wp_animation = [false,false] if $imported[:mog_sprite_actor]
  1776.   end  
  1777.   
  1778. end

  1779. #===============================================================================
  1780. # ■ Game Action
  1781. #===============================================================================
  1782. class Game_Action

  1783.   #--------------------------------------------------------------------------
  1784.   # ● Clear
  1785.   #--------------------------------------------------------------------------
  1786.   alias mog_bact_clear clear
  1787.   def clear
  1788.       @subject.pre_target = nil rescue nil
  1789.       mog_bact_clear
  1790.   end  
  1791.    
  1792.   #--------------------------------------------------------------------------
  1793.   # ● Make Targets
  1794.   #--------------------------------------------------------------------------
  1795.   alias mog_bact_make_targets make_targets
  1796.   def make_targets
  1797.       return @subject.pre_target if @subject != nil and @subject.pre_target != nil
  1798.       mog_bact_make_targets
  1799.   end

  1800. end
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部