Advertisement
Guest User

Script LMBS

a guest
May 30th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 257.31 KB | None | 0 0
  1. #==============================================================================
  2. # +++ MOG - LMBS (Linear Motion Battle System) (V0.8 Beta) +++
  3. #==============================================================================
  4. # *(Full Motion Battle System (FMBS) / Tales of Phantasia Battle System)*
  5. #==============================================================================
  6. # By Moghunter
  7. # https://atelierrgss.wordpress.com/
  8. #==============================================================================
  9. # Sistema de batalha linear com movimentação livre onde a ação acontece em
  10. # tempo real.
  11. #==============================================================================
  12.  
  13. #==============================================================================
  14. # ¦ NOTA
  15. #==============================================================================
  16. #
  17. # Este script está em fase de teste (Versão Beta), portanto algumas funções
  18. # ainda não foram implementadas,tais como.
  19. # - Função da condição confusão. (Aliados atacarem entre si)
  20. #
  21. #==============================================================================
  22.  
  23. #==============================================================================
  24. # ¦ HISTÓRICO
  25. #==============================================================================
  26. # v0.8 - Implementação básica do sistema de turnos. (Páginas de Eventos)
  27. #      - Melhoria no sistema de dano.
  28. #      - Melhoria no tempo das poses de vitória.
  29. #      - Melhoria no sistema de dispose de skills.
  30. #      - Correção nas poses dos battlers durante a transição de batalha.
  31. # v0.7 - Melhoria e correção de bugs no sistema de Guard.
  32. #      - Correção de não separar as skills por tipo no modo padrão.
  33. #      - Correção de bugs no sistema de janelas de equipar skills.
  34. # v0.6 - Correção do glitch do sprite do cursor aparecer no canto da tela.
  35. # v0.5 - Versão funcional.
  36. # v0.1..04 - Criação básica do sistema
  37. #==============================================================================
  38.  
  39. #==============================================================================
  40. # ¦ ARQUIVOS DE SISTEMA NECESSÁRIOS
  41. #==============================================================================
  42. # Serão necessários os seguintes arquivos. (GRAPHICS/SYSTEM)
  43. #
  44. # Battle_Cursor.png
  45. # Battle_Cursor_Actor.png
  46. # F_Escape_A.png
  47. # F_Escape_B.png
  48. # F_Iconset.png
  49. # F_Shadow.png
  50. #
  51. #==============================================================================
  52.  
  53. #==============================================================================
  54. # ¦ SISTEMA DE ARQUIVOS DE IMAGES DOS BATTLERS.
  55. #==============================================================================
  56. # 1 - A primeira tarefa é escolher através do banco de dados a imagem padrão do
  57. # battler. É nesta imagem que o cálculo do tamanho do battler é baseado.
  58. # 2 - Após isso você deverá nomear as imagens das poses da sequinte forma.
  59. #
  60. # BATTLER_NAME[POSE_TYPE][F][S][H].png
  61. #
  62. # BATTLER_NAME = Nome do Battler
  63. # POSE = Tipo de pose.
  64. # F = Número de frames da pose.
  65. # S = Velocidade de animação da pose. (Opcional)
  66. # H = Definição da altura da imagem, para fazer ajustes. (Opcional)
  67. #
  68. # Na prática a nomeação é feita da seguinte forma.
  69. #
  70. # Leon.png
  71. # Leon[Cast][F1].png
  72. # Leon[Damage][F1].png
  73. # Leon[Dash][F4][S6].png
  74. # Leon[Dead][F1][H10].png
  75. # Leon[Fall][F1].png
  76. # Leon[Guard][F1].png
  77. # Leon[Idle][F4][S12].png
  78. # Leon[Jump][F1].png
  79. # Leon[Victory][F4][12].png
  80. # Leon[Walk][F4][S8].png
  81. # Leon[Skill_1][F3][S6].png
  82. # Leon[Item_1][F1].png
  83. #
  84. # 3 - Abaixo está a lista completa de poses que podem ser usadas.
  85. #     (Não é obrigatório ter todas as poses.)
  86. #
  87. #   [Cast] [Damage] [Dash] [Dead] [Fall] [Guard] [Idle] [Jump] [Victory]
  88. #   [Walk] [Skill_X] [Item_X]
  89. #
  90. # No caso das habilidades ou itens [Skill_X] [Item_X], o X significa a ID
  91. # da habilidade ou item, no entanto é possível usar a mesma pose em habilidades
  92. # diferentes, evitando de criar uma pose para cada habilidade.
  93. # A função de escolher a ID da pose é feita através do banco de dados na caixa
  94. # de notas. (Use a Tag abaixo se deseja definir a ID da pose em uma habilidade)
  95. #
  96. # <F Pose Index = X>
  97. #
  98. #==============================================================================
  99.  
  100. #==============================================================================
  101. # ¦ SISTEMA DE ARQUIVOS DE IMAGES DOS PROJETEIS.
  102. #==============================================================================
  103. # Basicamente é a mesma dos battlers, com excessão da função de poses.
  104. # As imagens deverão ser gravadas na pasta. /GRAPHICS/Projectile/
  105. #
  106. # Ex - Fire_Ball[F2][S4].png
  107. #
  108. #==============================================================================
  109.  
  110. #==============================================================================
  111. # ¦ DEFININDO PARÂMETROS DOS BATTLES
  112. #==============================================================================
  113. # Use as tags abaixo na caixa de notas para definir os parâmetros dos battlers.
  114. #
  115. # ? <Battler Name = NAME>
  116. # Define o nome do arquivo da imagem do battler.
  117. #
  118. # ? <Move Speed = X>
  119. # Define a velocidade de movimento do battler.
  120. #
  121. # ? <Jump>
  122. # Ativa a função de pulo.
  123. #
  124. # ? <Double Jump>
  125. # Ativa a função de pulo duplo. (É necessário ter a função jump ativada)
  126. #
  127. # ? <Dash>
  128. # Ativa a função Dash.
  129. #
  130. # ? <Air Dash>
  131. # Ativa a função de dash aério.
  132. #
  133. # ? <Flying Height = X>
  134. # Ativa a função flutuar. (X é altura)
  135. #
  136. # ? <Guard Type = X>
  137. # Definine o tipo da função GUARD.
  138. # 0 - Desativa  / 1 - Cancela o impacto do dano. / 2 - Diminue 50% do dano.
  139. #
  140. # ? <Guard Rate = X>
  141. # Ativa a probabilidade do battler ativar a função GUARD.
  142. #
  143. # ? <Super Guard>
  144. # Desativa o Knockback, ou seja, o personagem não recua ao receber dano.
  145. #
  146. # ? <Disable Movement>
  147. # Desativa o movimento do battler.
  148. #
  149. # ? <Disable Action>
  150. # Desativa as ações do battler.
  151. #
  152. # ? <Breath Effect>
  153. # Ativa o efeito de respirar no sprite do battler.
  154. #
  155. # ? <Jump Height = X>
  156. # Define a altura do pulo.
  157. #
  158. # ? <Jump Speed = X>
  159. # Define a velocidade do pulo.
  160. #
  161. #==============================================================================
  162.  
  163. #==============================================================================
  164. # ¦ DEFININDO PARÂMETROS DAS HABILIDADES E ITEMS
  165. #==============================================================================
  166. # Use as tags abaixo na caixa de notas para definir os parâmetros das
  167. # habilidades e itens.
  168. #
  169. # ? <F Skill Type = X>
  170. # Define o tipo de habilidade.
  171. # - Ground   - A habilidade só é ativada se o battler estiver no chão.
  172. # - Aerial   - A habilidade só é ativada se o battler estiver no ar.
  173. # - All      - A habilidade é ativada em qualquer situação.
  174. #
  175. # ? <F Duration = X>
  176. # Define a duração da habilidade.
  177. #
  178. # ? <F Pose Duration = X>
  179. # Define a duração da pose de ação
  180. #
  181. # ? <F Pose Index = X>
  182. # Define a Index da pose da habilidade.
  183. #
  184. # ? <F Sprite = NAME>
  185. # Define o nome do arquivo de sprite da habilidade.
  186. #
  187. # ? <F Blend Type = X>
  188. # Define o tipo de blend do sprite da habilidade.
  189. #
  190. # ? <F Chain Action = X>
  191. # Ativa automaticamente uma habilidade após a primeira ter finalizado.
  192. #
  193. # ? <F Multi Hit>
  194. # A Habilidade causa multiplos acertos.
  195. #
  196. # ? <F Auto Target>
  197. # A Habilidade acerta automaticamente o alvo.
  198. #
  199. # ? <F Auto Target Area>
  200. # A Habilidade acerta automaticamente o alvo e os alvos que estiverem ao redor.
  201. #
  202. # ? <F Wait Collision = X>
  203. # Define X tempo para que a habilidade cause impacto.
  204. #
  205. # ? <F Disable Piercing>
  206. # Desativa a função atravessar o alvo.
  207. #
  208. # ? <F Knockback Stun>
  209. # Faz com que o impacto da habilidade faça o battler cair no chão.
  210. #
  211. # ? <F Disable Knockback>
  212. # Desativa a função knockback da habilidade.
  213. #
  214. # ? <F Super Guard>
  215. # O usuário não recebe knockback durante a ação.
  216. #
  217. # ? <F Invunerable>
  218. # O usuário fica invencível durante a ação.
  219. #
  220. # ? <F Ignore Guard>
  221. # A Habilidade ignora se alvo estiver usando a função Guard.
  222. #
  223. # ? <F Ignore Knockback>
  224. # A Habilidade causa acerto mesmo quando o alvo estiver sobre knockback
  225. #
  226. # ? <F Reflect>
  227. # O usuário reflete a habilidade durante a ação.
  228. #
  229. # ? <F Ignore Reflect>
  230. # A Habilidade ignora a função Reflect.
  231. #
  232. # ? <F Hit Animation = X>
  233. # Define a animação de acerto da habilidade.
  234. #
  235. # ? <F User Animation = X>
  236. # Define a animação de uso da habilidade no usuário.
  237. #
  238. # ? <F Loop Pose>
  239. # Faz a animação da pose dar loop.
  240. #
  241. # ? <F Move Speed = xX yY>
  242. # Faz o usuário se mover durante a ação.
  243. #
  244. # ? <F User Move = xX yY>
  245. # Define uma trajetória de movimento para habilidade. (uso de projéteis)
  246. #
  247. # ? <F Area = X1 - X2 - Y1 - Y2>
  248. # Define a área de impacto da habilidade.
  249. #
  250. #         Y1
  251. #
  252. #
  253. #   X1          X2
  254. #
  255. #
  256. #         Y2
  257. #
  258. #==============================================================================
  259. #==============================================================================
  260. # ¦ EVENT COMMANDS
  261. #==============================================================================
  262. # Use os comandos abaixo através da função chamar script, se deseja modificar
  263. # algum parâmetro no meio do jogo.
  264. #
  265. # ? dash(actor_id,value)
  266. # Ativa ou desativa a função DASH
  267. #
  268. # ? air_dash(actor_id,value)
  269. # Ativa ou desativa a função AIR DASH
  270. #
  271. # ? jump(actor_id,value)
  272. # Ativa ou desativa a função pulo.
  273. #
  274. # ? double_jump(actor_id,value)
  275. # Ativa ou desativa a função pulo duplo.
  276. #
  277. # ? guard_type(actor_id,value)
  278. # Define o tipo de defesa
  279. #
  280. # ? gain_move_speed(actor_id,value)
  281. # Aumenta ou diminui a velocidade de movimento.
  282. #
  283. # ? gain_jump_height(actor_id,value)
  284. # Aumenta ou diminui a altura do pulo.
  285. #
  286. # ? gain_jump_speed(actor_id,value)
  287. # Aumenta ou diminui a velocidade do pulo.
  288. #
  289. # ? set_skill(actor_id,slot_index,skill_id)
  290. # Equipa automaticamente a habilidade no battler. (de 0 a 6)
  291. #
  292. # ? set_ground_height(value)
  293. # Define a altura do chão.
  294. #
  295. # ? auto_adjust_position(value)
  296. # Ajusta automaticamente a posição inicial do battler.
  297. #
  298. #==============================================================================
  299. module MOG_LMBS
  300.  
  301.   #--------------------------------------------------------------------------
  302.   # Definição da velocidade padrão da animação do sprite do battler.
  303.   # É possível definir uma animação específica no sprite adicionando esse
  304.   # sufixo no nome da imagem.
  305.   #
  306.   # SPRITE_NAME[S + Animation Speed].png
  307.   #
  308.   # Athena[S10].png
  309.   #
  310.   #--------------------------------------------------------------------------
  311.   DEFAULT_SPRITE_ANIMATION_SPEED = 8
  312.  
  313.   #--------------------------------------------------------------------------
  314.   # ? Definição Y-axis do chão.
  315.   #--------------------------------------------------------------------------
  316.   GROUND_HEIGHT = 160  
  317.  
  318.   #--------------------------------------------------------------------------
  319.   # ? Definição da duração do turno.
  320.   #--------------------------------------------------------------------------
  321.   TURN_DURATION = 500
  322.  
  323.   #--------------------------------------------------------------------------
  324.   # ? Definição da duração do turno das condições
  325.   #--------------------------------------------------------------------------
  326.   STATES_TURN_DURATION = 200
  327.  
  328.   #--------------------------------------------------------------------------
  329.   # ? Definição do tempo para escapar da batalha.
  330.   # Esse valor é proporcional a média de agilidade de todos os battlers
  331.   # somados.
  332.   #--------------------------------------------------------------------------
  333.   ESCAPE_RATIO = 100
  334.  
  335.   #--------------------------------------------------------------------------
  336.   # ? Definição da velocidade de movimento padrão do Battler.
  337.   #--------------------------------------------------------------------------
  338.   DEFAULT_BATTLER_MOVE_SPEED = 4  
  339.  
  340.   #--------------------------------------------------------------------------
  341.   # ? Definição da altura padrão do pulo do battler.
  342.   #--------------------------------------------------------------------------
  343.   DEFAULT_BATTLER_JUMP_HEIGHT = 150
  344.  
  345.   #--------------------------------------------------------------------------
  346.   # ? Definição da velocidade padrão do pulo do battler. (Gravidade)
  347.   #--------------------------------------------------------------------------
  348.   DEFAULT_BATTLER_JUMP_SPEED = 7
  349.  
  350.   #--------------------------------------------------------------------------
  351.   # ? Definição do tipo de defesa padrão para todos os battlers
  352.   #--------------------------------------------------------------------------
  353.   # 0 - Nada (Desativa a defesa)
  354.   # 1 - Defesa perfeita. (Cancela o impacto da habilidade)
  355.   # 2 - Reduz 50% do dano.
  356.   #--------------------------------------------------------------------------
  357.   DEFAULT_GUARD_TYPE = 1
  358.  
  359.   #--------------------------------------------------------------------------
  360.   # ? Ativar a função Dash em todos os battlers.
  361.   #  É possível usar o código abaixo para ativar o Dash
  362.   #
  363.   # dash(ACTOR_ID,true)
  364.   #
  365.   # ou colocar a tag abaixo na caixa de notas.
  366.   #
  367.   # <Dash>
  368.   #
  369.   #--------------------------------------------------------------------------
  370.   ENABLE_DASH_FOR_ALL = false
  371.  
  372.   #--------------------------------------------------------------------------
  373.   # ? Ativar a função JUMP em todos os battlers.
  374.   #  É possível usar o código abaixo para ativar o Dash
  375.   #
  376.   # jump(ACTOR_ID,true)
  377.   #
  378.   # ou colocar a tag abaixo na caixa de notas.
  379.   #
  380.   # <Jump>
  381.   #
  382.   #--------------------------------------------------------------------------
  383.   ENABLE_JUMP_FOR_ALL = false
  384.  
  385.   #--------------------------------------------------------------------------
  386.   # ? Ativar o pulo duplo em todos os battlers.
  387.   #  É possível usar o código abaixo para ativar o Air Dash
  388.   #
  389.   # double_jump(ACTOR_ID,true)
  390.   #
  391.   # ou colocar a tag abaixo na caixa de notas.
  392.   #
  393.   # <Double Jump>
  394.   #
  395.   #--------------------------------------------------------------------------
  396.   ENABLE_DOUBLE_JUMP_FOR_ALL = false
  397.  
  398.   #--------------------------------------------------------------------------
  399.   # ? Definição da animação do pulo duplo
  400.   #--------------------------------------------------------------------------
  401.   DOUBLE_JUMP_ANIMATION_ID = 126
  402.  
  403.   #--------------------------------------------------------------------------
  404.   # ? Possibilitar o pulo duplo durante o Dash.
  405.   #--------------------------------------------------------------------------
  406.   ALLOW_DOUBLE_JUMP_DURING_DASH_SPEED = false  
  407.  
  408.   #--------------------------------------------------------------------------
  409.   # ? Ativar o movimento Air Dash em todos os battlers.
  410.   #  É possível usar o código abaixo para ativar o Air Dash
  411.   #
  412.   # air_dash(ACTOR_ID,true)
  413.   #
  414.   # ou colocar a tag abaixo na caixa de notas.
  415.   #
  416.   # <Air Dash>
  417.   #
  418.   #--------------------------------------------------------------------------
  419.   ENABLE_AIR_DASH_FOR_ALL = false
  420.  
  421.   #--------------------------------------------------------------------------
  422.   # ? Definição da animação ID do Air Dash.
  423.   #--------------------------------------------------------------------------
  424.   AIR_DASH_ANIMATION_ID = 125  
  425.  
  426.   #--------------------------------------------------------------------------
  427.   # ? Possibilitar o movimento do Air Dash durante o Dash.
  428.   #--------------------------------------------------------------------------
  429.   ALLOW_AIR_DASH_DURING_DASH_SPEED = false
  430.  
  431.   #--------------------------------------------------------------------------
  432.   # ? Ativa sombra nos battlers
  433.   # É necessário ter o arquivo F_Shadow.png na pasta /Graphics/System/
  434.   #--------------------------------------------------------------------------
  435.   SHADOW_ENABLE = true
  436.  
  437.   #--------------------------------------------------------------------------
  438.   # Definição da posição da sombra.
  439.   #--------------------------------------------------------------------------
  440.   SHADOW_POSITION = [0,-5]
  441.  
  442.   #--------------------------------------------------------------------------
  443.   # ? Definir a posição do inimigo automaticamente.
  444.   # É possível ativar ou desativar essa opção no meio do jogo usando o
  445.   # código abaixo.
  446.   #
  447.   # auto_adjuste_position(false)
  448.   #
  449.   #--------------------------------------------------------------------------
  450.   AUTO_ADJUSTE_ENEMY_POSITION = true  
  451.  
  452.   #--------------------------------------------------------------------------
  453.   # ? Definição da posição da janela de comando.
  454.   #--------------------------------------------------------------------------
  455.   COMMAND_WINDOW_POSITION = [0,0]
  456.  
  457.   #--------------------------------------------------------------------------
  458.   # ? Posição da janela de habilidades do LMBS
  459.   #--------------------------------------------------------------------------
  460.   SKILL_LIST_POSITION = [0,96]  
  461.  
  462.   #--------------------------------------------------------------------------
  463.   # ? Definição da posição inicial dos battlers
  464.   #--------------------------------------------------------------------------
  465.   START_POSITION = 150
  466.  
  467.   #--------------------------------------------------------------------------
  468.   # ? Definição dos nomes dos comandos da janela de comandos.
  469.   #--------------------------------------------------------------------------
  470.   COMMAND_WINDOW_LIST_NAME = ["Item","Equip Skill"]  
  471.  
  472.   #--------------------------------------------------------------------------
  473.   # ? Definição do nome da cena de equipar Skill.
  474.   #--------------------------------------------------------------------------
  475.   SCENE_EQUIP_SKILL_NAME = "Equip Skill"
  476.  
  477.   #--------------------------------------------------------------------------
  478.   # ? Definição do som ativado quando battler não tem MP or TP.
  479.   #--------------------------------------------------------------------------
  480.   MP_COST_SE = "Cursor1"
  481.  
  482.   #--------------------------------------------------------------------------
  483.   # ? Definição da posição do cursor.
  484.   #--------------------------------------------------------------------------
  485.   CURSOR_POSITION = [0,0]
  486.   CURSOR_NAME_POSITION = [0,10]  
  487.   CURSOR_ACTOR_POSITION = [0,0]
  488.  
  489.   #--------------------------------------------------------------------------
  490.   # ? Ativar fade no cursor após alguns segundos.
  491.   #--------------------------------------------------------------------------
  492.   CURSOR_ACTOR_FADE_EFFECT = true
  493.  
  494.   #--------------------------------------------------------------------------
  495.   # ? Definição da posição do sprite de escape.
  496.   #--------------------------------------------------------------------------
  497.   ESCAPE_SPRITE_POSITION = [Graphics.width / 2,100]
  498.   ESCAPE_SPRITE_METER_POSITION = [0,17]
  499.  
  500.   #--------------------------------------------------------------------------
  501.   # ? Definição do botão de ataque.
  502.   #--------------------------------------------------------------------------
  503.   ATTACK_BUTTON = :B
  504.   #--------------------------------------------------------------------------
  505.   # ? Definição do botão de habilidade.
  506.   #--------------------------------------------------------------------------
  507.   SKILL_BUTTON = :Z
  508.   #--------------------------------------------------------------------------
  509.   # ? Definição do botão de defesa.
  510.   #--------------------------------------------------------------------------
  511.   GUARD_BUTTON = :C
  512.   #--------------------------------------------------------------------------
  513.   # ? Definição do botão de corrida.
  514.   #--------------------------------------------------------------------------  
  515.   DASH_BUTTON = :X
  516.   #--------------------------------------------------------------------------
  517.   # ? Definição do botão para ativar o menu.
  518.   #--------------------------------------------------------------------------  
  519.   MENU_BUTTON = :Y
  520. end
  521.  
  522. $imported = {} if $imported.nil?
  523. $imported[:mog_lmbs] = true
  524.  
  525. #==============================================================================
  526. # ¦ Game Temp
  527. #==============================================================================
  528. class Game_Temp
  529.  
  530.   attr_accessor :battle_end
  531.   attr_accessor :fmb_arena
  532.   attr_accessor :fmb_phase_data
  533.   attr_accessor :fmb_menu_phase
  534.   attr_accessor :fmb_phase_end
  535.   attr_accessor :f_cursor_target
  536.   attr_accessor :f_cursor_data
  537.   attr_accessor :f_sprite_fade
  538.   attr_accessor :f_escape_phase
  539.   attr_accessor :f_actor_cursor_d
  540.  
  541.   #--------------------------------------------------------------------------
  542.   # ? Initialize
  543.   #--------------------------------------------------------------------------            
  544.   alias mog_fmbs_temp_initialize initialize
  545.   def initialize
  546.       @battle_end = false
  547.       @fmb_arena = [[],1.00]
  548.       @fmb_phase_data = [0,0]
  549.       @fmb_menu_phase = [false,0,false]
  550.       @f_cursor_data  = [nil,nil]
  551.       @f_escape_phase = [false,0,0,0]
  552.       @fmb_phase_end = 0
  553.       @f_actor_cursor_d = 0
  554.       mog_fmbs_temp_initialize
  555.   end
  556.  
  557.   #--------------------------------------------------------------------------
  558.   # ? F Fmbs Clear
  559.   #--------------------------------------------------------------------------            
  560.   def f_fmbs_clear
  561.  @battle_end = false
  562.       @fmb_phase_data = [0,0]
  563.       @fmb_menu_phase = [false,0,false]
  564.       @f_cursor_data  = [nil,nil]
  565.       @f_sprite_fade = [false,0]
  566.       @f_escape_phase = [false,0,0,0]
  567.   end    
  568.  
  569.   #--------------------------------------------------------------------------
  570.   # ? f In Action?
  571.   #--------------------------------------------------------------------------
  572.   def f_in_action?
  573.       return false if $game_troop.interpreter.running?
  574.       return false if $game_temp.battle_end
  575.       return false if $game_temp.fmb_phase_data[1] > 0
  576.       return true
  577.   end
  578.    
  579. end
  580.  
  581. #==============================================================================
  582. # ¦ Game System
  583. #==============================================================================
  584. class Game_System
  585.  
  586.   attr_accessor :fmbs_data
  587.   attr_accessor :f_turn_data
  588.   attr_accessor :f_adjust_position_auto
  589.   attr_accessor :f_collision_effect
  590.  
  591.   #--------------------------------------------------------------------------
  592.   # ? Initialize
  593.   #--------------------------------------------------------------------------            
  594.   alias mog_fmbs_sys_initialize initialize
  595.   def initialize
  596.       @fmbs_data = [true,0]
  597.       @fmbs_data[1] = [[MOG_LMBS::GROUND_HEIGHT, Graphics.height - 32].min, 32].max
  598.       @f_adjust_position_auto = MOG_LMBS::AUTO_ADJUSTE_ENEMY_POSITION
  599.       @f_collision_effect = [true,false]
  600.       @f_turn_data = [0,MOG_LMBS::STATES_TURN_DURATION,0]
  601.       mog_fmbs_sys_initialize
  602.   end
  603.  
  604. end
  605.  
  606. #==============================================================================
  607. # ¦ Cache
  608. #==============================================================================
  609. module Cache
  610.  
  611.   #--------------------------------------------------------------------------
  612.   # ? Projectile
  613.   #--------------------------------------------------------------------------
  614.   def self.projectile(filename)
  615.       load_bitmap("Graphics/Projectile/", filename)    
  616.   end
  617.  
  618. end
  619.  
  620. #==============================================================================
  621. # ¦ Sound
  622. #==============================================================================
  623. module Sound
  624.  
  625.   #--------------------------------------------------------------------------
  626.   # ? Play MP Cost
  627.   #--------------------------------------------------------------------------
  628.   def self.play_mp_cost
  629.      Audio.se_play("Audio/SE/" + MOG_LMBS::MP_COST_SE, 100, 100)
  630.   end
  631.  
  632. end
  633.  
  634. #==============================================================================
  635. # ¦ Game Interpreter
  636. #==============================================================================
  637. class Game_Interpreter
  638.  
  639.   #--------------------------------------------------------------------------
  640.   # ? Dash
  641.   #--------------------------------------------------------------------------            
  642.   def dash(actor_id,value)
  643.       $game_party.all_members.each do |actor|
  644.       actor.f_dash[0] = value if actor.id == actor_id  end
  645.   end
  646.  
  647.   #--------------------------------------------------------------------------
  648.   # ? Jump
  649.   #--------------------------------------------------------------------------            
  650.   def jump(actor_id,value)
  651.       $game_party.all_members.each do |actor|
  652.       actor.f_jump[0] = value if actor.id == actor_id  end
  653.   end  
  654.  
  655.   #--------------------------------------------------------------------------
  656.   # ? Double Jump
  657.   #--------------------------------------------------------------------------            
  658.   def double_jump(actor_id,value)
  659.       $game_party.all_members.each do |actor|
  660.       actor.f_double_jump[0] = value if actor.id == actor_id end
  661.   end  
  662.    
  663.   #--------------------------------------------------------------------------
  664.   # ? Air Dash
  665.   #--------------------------------------------------------------------------            
  666.   def air_dash(actor_id,value)
  667.       $game_party.all_members.each do |actor|
  668.       actor.f_air_dash[0] = value if actor.id == actor_id  end
  669.   end
  670.  
  671.   #--------------------------------------------------------------------------
  672.   # ? Gain Move Speed
  673.   #--------------------------------------------------------------------------            
  674.   def gain_move_speed(actor_id,value)
  675.       $game_party.all_members.each do |actor|
  676.       if actor.id == actor_id
  677.          actor.move_speed += value
  678.          actor.move_speed = 1 if actor.move_speed < 1
  679.       end  
  680.       end
  681.   end    
  682.  
  683.   #--------------------------------------------------------------------------
  684.   # ? Gain Jump Height
  685.   #--------------------------------------------------------------------------            
  686.   def gain_jump_height(actor_id,value)
  687.       $game_party.all_members.each do |actor|
  688.       if actor.id == actor_id
  689.          actor.jump_height += value
  690.          actor.jump_height = 32 if actor.jump_height < 32
  691.       end
  692.       end
  693.   end  
  694.  
  695.   #--------------------------------------------------------------------------
  696.   # ? Gain Jump Speed
  697.   #--------------------------------------------------------------------------            
  698.   def gain_jump_speed(actor_id,value)
  699.       $game_party.all_members.each do |actor|
  700.       if actor.id == actor_id
  701.          actor.jump_speed += value
  702.          actor.jump_speed = 1 if actor.jump_height < 1
  703.       end
  704.       end
  705.   end    
  706.  
  707.   #--------------------------------------------------------------------------
  708.   # ? Guard Type
  709.   #--------------------------------------------------------------------------            
  710.   def guard_type(actor_id,value)
  711.       $game_party.all_members.each do |actor|
  712.       if actor.id == actor_id
  713.          actor.f_guard[0] = [[value, 2].min, 0].max
  714.       end
  715.       end
  716.   end      
  717.  
  718.   #--------------------------------------------------------------------------
  719.   # ? Set skill
  720.   #--------------------------------------------------------------------------            
  721.   def set_skill(actor_id,slot_id,skill_id)
  722.       return if slot_id > 7
  723.       skill = $data_skills[skill_id] rescue nil
  724.       return if skill.nil?
  725.       $game_party.all_members.each do |actor|
  726.       break if slot_id.abs >= actor.f_equipped_skill.size  
  727.       if actor.id == actor_id
  728.          actor.f_equipped_skill[slot_id] = skill_id
  729.       end
  730.       end
  731.   end  
  732.  
  733.   #--------------------------------------------------------------------------
  734.   # ? Auto Adjust Position
  735.   #--------------------------------------------------------------------------            
  736.   def auto_adjust_position(value)
  737.       $game_system.f_adjust_position_auto = value
  738.   end
  739.    
  740.   #--------------------------------------------------------------------------
  741.   # ? Set Ground Height
  742.   #--------------------------------------------------------------------------            
  743.   def set_ground_height(value)
  744.       $game_system.fmbs_data[1] = [[Graphics.height - value, Graphics.height - 32].min, 32].max
  745.   end  
  746.    
  747.   #--------------------------------------------------------------------------
  748.   # ? Command 339
  749.   #--------------------------------------------------------------------------            
  750.   def command_339
  751.       pr_t = nil
  752.       if @params[0] == 0
  753.          enemies = $game_party.battle_members
  754.          allies = $game_troop.alive_members
  755.          batr = $game_troop.members[@params[1] - 1]
  756.       else  
  757.          enemies = $game_troop.alive_members
  758.          allies = $game_party.battle_members
  759.          batr = $game_party.members[@params[1] - 1]
  760.       end  
  761.       return if batr.dead?
  762.       skill_id = @params[2]
  763.       skill = $data_skills[skill_id]
  764.       batr.f_action[1] = nil
  765.       batr.f_action_clear
  766.       if skill.note =~ /<F Auto Target Area>/ or skill.note =~ /<F Auto Target>/
  767.          if skill.for_opponent?
  768.             pr_t = enemies[@params[3]] rescue nil if @params[3] >= 0
  769.             pr_t = batr.f_target if pr_t.nil?
  770.          else  
  771.             pr_t = allies[@params[3]] rescue nil if @params[3] >= 0
  772.             pr_t = batr if pr_t.nil?
  773.          end
  774.          batr.f_execute_skill(skill_id,pr_t,0)
  775.       else
  776.          batr.f_execute_skill(skill_id)
  777.       end  
  778.       Fiber.yield while batr.f_mov_acting?
  779.   end
  780.  
  781. end
  782.  
  783. #==============================================================================
  784. # ¦ BattleManager
  785. #==============================================================================
  786. class << BattleManager
  787.  
  788.   attr_accessor :f_targets
  789.   attr_accessor :escape_ratio
  790.  
  791.   #--------------------------------------------------------------------------
  792.   # ? Init Members
  793.   #--------------------------------------------------------------------------            
  794.   alias mog_fmbs_init_members init_members
  795.   def init_members
  796.       @active_actor = nil ; @active_actor_index = 0 ; next_actor_index(0)
  797.       @f_targets = nil ; @f_cursor_index = 0
  798.       mog_fmbs_init_members
  799.   end
  800.  
  801.   #--------------------------------------------------------------------------
  802.   # ? Actor
  803.   #--------------------------------------------------------------------------            
  804.   alias mog_fmbs_bm_actor actor
  805.   def actor
  806.       return @active_actor if $game_system.fmbs_data[0]
  807.       mog_fmbs_bm_actor
  808.   end  
  809.  
  810.   #--------------------------------------------------------------------------
  811.   # ? Process Victory
  812.   #--------------------------------------------------------------------------            
  813.   alias mog_fmbs_process_victory process_victory
  814.   def process_victory
  815.       $game_temp.fmb_phase_end = 1
  816.       $game_temp.battle_end = true
  817.       mog_fmbs_process_victory
  818.       $game_temp.fmb_phase_end = 4
  819.   end
  820.    
  821.   #--------------------------------------------------------------------------
  822.   # ? Process Defeat
  823.   #--------------------------------------------------------------------------            
  824.   alias mog_fmbs_process_defeat process_defeat
  825.   def process_defeat
  826.       $game_temp.fmb_phase_end = 2
  827.       $game_temp.battle_end = true
  828.       mog_fmbs_process_defeat
  829.       $game_temp.fmb_phase_end = 4
  830.   end
  831.    
  832.   #--------------------------------------------------------------------------
  833.   # ? Process Abort
  834.   #--------------------------------------------------------------------------            
  835.   alias mog_fmbs_process_abort process_abort
  836.   def process_abort
  837.       $game_temp.fmb_phase_end = 3
  838.       $game_temp.battle_end = true
  839.       mog_fmbs_process_abort
  840.       #$game_temp.fmb_phase_end = 4
  841.   end  
  842.  
  843. end
  844.  
  845. #==============================================================================
  846. # ¦ BattleManager
  847. #==============================================================================
  848. module BattleManager
  849.  
  850.   #--------------------------------------------------------------------------
  851.   # ? Self Next Actor Index
  852.   #--------------------------------------------------------------------------            
  853.   def self.next_actor_index(value)
  854.       set_active_actor(nil)
  855.       $game_party.battle_members.size.times do
  856.            @active_actor_index += value
  857.            @active_actor_index = 0 if @active_actor_index >= $game_party.battle_members.size
  858.            @active_actor_index = $game_party.battle_members.size - 1 if @active_actor_index < 0
  859.            act = $game_party.battle_members[@active_actor_index]
  860.            if !act.nil? and !act.dead? and act.restriction == 0
  861.               set_active_actor(act)
  862.               break
  863.            end
  864.       end          
  865.       set_usable_actor if @active_actor.nil?
  866.       $game_temp.f_actor_cursor_d = 120
  867.   end
  868.  
  869.   #--------------------------------------------------------------------------
  870.   # ? Set Usable Actor
  871.   #--------------------------------------------------------------------------            
  872.   def self.set_usable_actor
  873.       $game_party.battle_members.each_with_index do |act,i|
  874.           next if act.dead? or act.restriction != 0
  875.           set_active_actor(act)
  876.           break
  877.       end
  878.   end
  879.  
  880.   #--------------------------------------------------------------------------
  881.   # ? Set Active Actor
  882.   #--------------------------------------------------------------------------            
  883.   def self.set_active_actor(actor)
  884.       @active_actor = actor
  885.   end
  886.  
  887.   #--------------------------------------------------------------------------
  888.   # ? Active Actor
  889.   #--------------------------------------------------------------------------            
  890.   def self.active_actor
  891.       return @active_actor
  892.   end
  893.  
  894.   #--------------------------------------------------------------------------
  895.   # ? Set F Targets
  896.   #--------------------------------------------------------------------------            
  897.   def self.set_f_targets(targets)
  898.       @f_targets = targets
  899.   end
  900.  
  901.   #--------------------------------------------------------------------------
  902.   # ? Cursor Next Target
  903.   #--------------------------------------------------------------------------            
  904.   def self.cursor_next_target(value,type)
  905.       $game_temp.f_cursor_target = nil ; ftrg = []
  906.       trgt = $game_troop.alive_members if type == 0
  907.       trgt = $game_party.battle_members if type == 1
  908.       trgt.each_with_index do |b,i| ; next if b.nil? ; ftrg.push([b,i]) ; end
  909.       ftrg.sort! {|a,b| a[0].screen_x - b[0].screen_x }
  910.       if $game_temp.f_cursor_data[0].nil?
  911.          @f_cursor_index = ftrg[0][1] ; $game_temp.f_cursor_data[0] = true
  912.       end  
  913.       ftrg.size.times do
  914.           @f_cursor_index += value
  915.           @f_cursor_index = 0 if @f_cursor_index >= ftrg.size
  916.           @f_cursor_index = ftrg.size - 1 if @f_cursor_index < 0
  917.           next if ftrg[@f_cursor_index][0].nil?
  918.           $game_temp.f_cursor_target = ftrg[@f_cursor_index][0]
  919.           break
  920.       end
  921.   end
  922.  
  923.   #--------------------------------------------------------------------------
  924.   # ? F Cursor Index
  925.   #--------------------------------------------------------------------------            
  926.   def self.f_cursor_index
  927.       @f_cursor_index
  928.   end
  929.  
  930.   #--------------------------------------------------------------------------
  931.   # ? F Make Targets
  932.   #--------------------------------------------------------------------------            
  933.   def self.f_make_targets(item,user,last_target = nil)      
  934.       targets = []
  935.       return targets if user.nil? or item.nil? or item.scope == 0
  936.       if user.is_a?(Game_Actor)
  937.          allies_targets = $game_party.battle_members
  938.          enemies_targets = $game_troop.alive_members
  939.       else
  940.          allies_targets = $game_troop.alive_members
  941.          enemies_targets = $game_party.battle_members
  942.       end  
  943.       if [1,2,3,4,5,6].include?(item.scope)
  944.          last_target = user.f_target if last_target.nil?
  945.          enemies_targets.each_with_index do |t,i|
  946.            next if t.dead?
  947.            targets.push(t) if [1].include?(item.scope) and t == last_target
  948.            targets.push(t) if [2].include?(item.scope)
  949.            targets.push(t) if [3].include?(item.scope) and i < 1
  950.            targets.push(t) if [4].include?(item.scope) and i < 2
  951.            targets.push(t) if [5].include?(item.scope) and i < 3
  952.            targets.push(t) if [6].include?(item.scope) and i < 4
  953.          end
  954.        elsif [7,8,9,10].include?(item.scope)
  955.           last_target = f_make_p_target(0,allies_targets,item) if last_target.nil?
  956.           allies_targets.each_with_index do |t,i|
  957.             targets.push(t) if [9].include?(item.scope) and t == last_target and t.dead?
  958.             targets.push(t) if [10].include?(item.scope) and t.dead?
  959.             next if t.dead?
  960.             targets.push(t) if [7].include?(item.scope) and t == last_target
  961.             targets.push(t) if [8].include?(item.scope)
  962.            end
  963.        else
  964.             targets.push(user)
  965.        end
  966.        return targets
  967.   end
  968.  
  969.   #--------------------------------------------------------------------------
  970.   # ? F Make P Target
  971.   #--------------------------------------------------------------------------            
  972.   def self.f_make_p_target(type,members,item)
  973.       mb = []
  974.       if [9,10].include?(item.scope)
  975.          members.each do |m| mb.push(m) if m.dead? end  
  976.       else  
  977.          members.each do |m| mb.push(m) if !m.dead? end
  978.       end  
  979.         mb.sort! {|a,b| a.hp - b.hp } if type == 0
  980.         mb.sort! {|a,b| b.hp - a.hp } if type == 1
  981.       return mb[0]
  982.   end
  983.  
  984.   #--------------------------------------------------------------------------
  985.   # ? F Process Escape
  986.   #--------------------------------------------------------------------------            
  987.   def self.f_process_escape
  988.       $game_party.battle_members.each do |actor|
  989.          actor.f_sprite_fade = [true,0]
  990.       end  
  991.       $game_temp.battle_end = true
  992.       $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
  993.       process_abort
  994.       wait_for_message
  995.   end  
  996.  
  997.   #--------------------------------------------------------------------------
  998.   # ? P Target Near
  999.   #--------------------------------------------------------------------------            
  1000.   def self.p_target_near(user)
  1001.       p_index = 0 ; ftrg = []
  1002.       trgt = $game_troop.alive_members if user.is_a?(Game_Actor)
  1003.       trgt = $game_party.battle_members if user.is_a?(Game_Enemy)
  1004.       return if trgt.empty?
  1005.       trgt.each do |b|
  1006.           next if b.nil?
  1007.           next if b.dead?
  1008.           df = (user.screen_x - b.screen_x).abs
  1009.           ftrg.push([b,df])
  1010.       end
  1011.       return if ftrg.empty?
  1012.       ftrg.sort! {|a,b| a[1] - b[1]}
  1013.       user.f_target = ftrg[0][0]
  1014.   end  
  1015.  
  1016.   #--------------------------------------------------------------------------
  1017.   # ? F Execute Action
  1018.   #--------------------------------------------------------------------------
  1019.   def self.f_execute_action(user,item)
  1020.       return if item.nil?
  1021.       execute_auto_target(user,item)
  1022.    end
  1023.    
  1024.   #--------------------------------------------------------------------------
  1025.   # ? Execute Auto Target
  1026.   #--------------------------------------------------------------------------
  1027.   def self.execute_auto_target(user,item)
  1028.       target = $game_temp.f_cursor_target
  1029.       trg = BattleManager.f_make_targets(item,user,target)
  1030.       return if trg.empty?
  1031.       user.f_force_action = [item,trg]
  1032.   end  
  1033.  
  1034.   #--------------------------------------------------------------------------
  1035.   # ? F Clear Command Selection
  1036.   #--------------------------------------------------------------------------
  1037.   def self.f_clear_command_selection
  1038.       $game_temp.fmb_menu_phase = [false,0,false]
  1039.       $game_temp.f_cursor_target = nil
  1040.       $game_temp.f_cursor_data = [nil,nil]      
  1041.   end  
  1042.  
  1043. end
  1044.  
  1045. #==============================================================================
  1046. # ¦ Game_BattlerBase
  1047. #==============================================================================
  1048. class Game_BattlerBase
  1049.  
  1050.   #--------------------------------------------------------------------------
  1051.   # ? Guard?
  1052.   #--------------------------------------------------------------------------
  1053.   alias mog_fmbs_guard? guard?
  1054.   def guard?
  1055.       return true if @f_guard[1]
  1056.       mog_fmbs_guard?
  1057.   end
  1058.    
  1059. end
  1060.  
  1061. #==============================================================================
  1062. # ¦ Game_Battler
  1063. #==============================================================================
  1064. class Game_Battler < Game_BattlerBase
  1065.  
  1066.   attr_accessor :f_action
  1067.   attr_accessor :f_action_m
  1068.   attr_accessor :f_force_action
  1069.   attr_accessor :f_target
  1070.   attr_accessor :f_damage
  1071.   attr_accessor :f_damage_effect  
  1072.   attr_accessor :f_knockback
  1073.   attr_accessor :f_equipped_skill
  1074.   attr_accessor :f_ai_data
  1075.   attr_accessor :f_char_data
  1076.   attr_accessor :f_dash
  1077.   attr_accessor :f_crouch
  1078.   attr_accessor :f_guard
  1079.   attr_accessor :f_air_dash
  1080.   attr_accessor :f_double_jump
  1081.   attr_accessor :f_sprite_fade
  1082.   attr_accessor :f_flying_type
  1083.   attr_accessor :f_breath_effect
  1084.   attr_accessor :f_force_move_to
  1085.   attr_accessor :f_action_time
  1086.   attr_accessor :f_fix_direction
  1087.   attr_accessor :f_air_ground
  1088.   attr_accessor :f_cast_data
  1089.   attr_accessor :f_a_target
  1090.   attr_accessor :f_turn_data
  1091.   attr_accessor :f_action_freq
  1092.   attr_accessor :f_wep_data
  1093.   attr_accessor :f_ai_guard
  1094.   attr_accessor :f_super_guard
  1095.   attr_accessor :f_move
  1096.   attr_accessor :f_e_action
  1097.   attr_accessor :sprite_data
  1098.   attr_accessor :move_speed
  1099.   attr_accessor :jump_height
  1100.   attr_accessor :jump_speed  
  1101.   attr_accessor :skill_list
  1102.   attr_accessor :normal_list
  1103.   attr_accessor :recover_list
  1104.   attr_accessor :revive_list
  1105.  
  1106.   #--------------------------------------------------------------------------
  1107.   # ? Initialize
  1108.   #--------------------------------------------------------------------------
  1109.   alias mog_fmbs_gb_initialize initialize
  1110.   def initialize
  1111.       set_f_basic_parameters
  1112.       mog_fmbs_gb_initialize
  1113.       set_initial_f_data
  1114.   end
  1115.  
  1116.   #--------------------------------------------------------------------------
  1117.   # ? Set F Basic Para
  1118.   #--------------------------------------------------------------------------
  1119.   def set_f_basic_parameters
  1120.       @f_char_data = [false,0,0,false] ; @f_knockback = [true,20,5,0,0]
  1121.       @f_dash = [MOG_LMBS::ENABLE_DASH_FOR_ALL,0]
  1122.       @f_crouch = [false,0]
  1123.       @f_air_dash = [MOG_LMBS::ENABLE_AIR_DASH_FOR_ALL,false,false,0]
  1124.       @f_double_jump = [MOG_LMBS::ENABLE_DOUBLE_JUMP_FOR_ALL,false,false,0]
  1125.       @f_equipped_skill = [nil,nil,nil,nil,nil,nil,nil] ; @f_guard = [0,0]      
  1126.       @f_guard[0] = [[MOG_LMBS::DEFAULT_GUARD_TYPE, 2].min, 0].max
  1127.       @move_speed = [[MOG_LMBS::DEFAULT_BATTLER_MOVE_SPEED, 9999].min, 1].max
  1128.       @jump_height = [[MOG_LMBS::DEFAULT_BATTLER_JUMP_HEIGHT, 9999].min, 30].max
  1129.       @jump_speed = [[MOG_LMBS::DEFAULT_BATTLER_JUMP_SPEED, 9999].min, 1].max
  1130.       @f_jump = [MOG_LMBS::ENABLE_JUMP_FOR_ALL,0]
  1131.       @f_flying_type  = [false,0,0,0,100]
  1132.       @f_breath_effect = [false,0,0,0,0.0015]
  1133.       @f_action_time = [false,0,0]
  1134.       @f_super_guard = [false,0]
  1135.       @f_move = [true,0]
  1136.       @f_e_action = [true,0]
  1137.       #A - Move Freq
  1138.       #B - Move to Target Freq
  1139.       #C - Force Move to Target
  1140.       #D - Jump Enable
  1141.       @f_action_freq = [45,4,false,true,0,90]
  1142.       @f_ai_guard = [false,0,false,0]      
  1143.   end    
  1144.  
  1145.   #--------------------------------------------------------------------------
  1146.   # ? Set Initial F Data
  1147.   #--------------------------------------------------------------------------
  1148.   def set_initial_f_data      
  1149.       @arena_range = [16 ,Graphics.width - 16,0,0]
  1150.       @f_damage = [0,nil,0,false,0,1,7,0,0,0]
  1151.       @f_damage_effect = [0,nil,0,false]
  1152.       @f_action_m = [false,0,0,0]
  1153.       @f_force_action = [nil,[]]
  1154.       @f_force_move_to = [false,0,0]
  1155.       @f_ai_data = [0,
  1156.             rand(f_action_freq) + 10,
  1157.             0,
  1158.             [0,0,0,0,0,0], #3 - Movement
  1159.             0,
  1160.             0]
  1161.       @f_fix_direction = [false,0]
  1162.       @f_air_ground = [false,0]
  1163.       @f_cast_data = [nil,0]
  1164.       @f_ai_guard[0] = false
  1165.       @f_ai_guard[2] = false
  1166.       @f_ai_guard[3] = 0
  1167.       @f_a_target = nil
  1168.       @f_wep_data = nil
  1169.       @normal_list = []
  1170.       @recover_list = []
  1171.       @revive_list = []
  1172.       @skill_list = []
  1173.       @f_turn_data = [0,MOG_LMBS::STATES_TURN_DURATION,0]
  1174.       # @sprite_data = [A,B,C,D,E,F,G[D,P],H....]
  1175.       # A0  - Sprite Index
  1176.       # B1  - Animation Index
  1177.       # C2  - Animation Speed (Current Index)
  1178.       # D3  - Battler Direction (0 - Left , 1 - Right)
  1179.       # E4  - Crouch
  1180.       # F5  - Dash
  1181.       # G6  - Jump (Jumping?, D - Direction / Phase / Jump Height )
  1182.       # H7  - Pressed Key
  1183.       # I8  - Walking? [true,Direction]
  1184.       # J9  - Pressed Direction (0 - Left , 1 - Right)
  1185.       # L10 - Guard
  1186.       # N11 - Skill Action [Skill,Action Duration ]
  1187.       # M12 - Sprite Size [Width,Height,Limit X1, Limit X2, Limit Y1, Limit Y2  ]
  1188.       # O13 - Auto Direction Time
  1189.       # P14 - Sprite Height Fix
  1190.       #               A B C D   E          F              G               H     I                
  1191.       @sprite_data = [0,0,0,0,false,[false,false],[false,0,0,false,false,0],0,[false,0],
  1192.       #               J      L               N                          M      
  1193.                       0,[false,false],[nil,0,0,false,false,false],[0,0,0,0,0,0],
  1194.       #               O P                
  1195.                       0,0]      
  1196.       set_sprite_size      
  1197.       f_action_clear
  1198.       @f_action_freq[4] = rand(@f_action_freq[5] / 2)
  1199.   end
  1200.            
  1201.   #--------------------------------------------------------------------------
  1202.   # ? Set Fmbs Initial Parameters
  1203.   #--------------------------------------------------------------------------            
  1204.   def set_fmbs_initial_parameters(f_battler)
  1205.       @battler_name = $1.to_s if f_battler.note =~ /<Battler Name = (\S+)>/
  1206.       @move_speed = $1.to_i if f_battler.note =~ /<Move Speed = (\d+)>/
  1207.       @jump_height = $1.to_i if f_battler.note =~ /<Jump Height = (\d+)>/
  1208.       @jump_speed = $1.to_i if f_battler.note =~ /<Jump Speed = (\d+)>/
  1209.       @f_dash[0] = true if f_battler.note =~ /<Dash>/
  1210.       @f_air_dash[0] = true if f_battler.note =~ /<Air Dash>/
  1211.       @f_jump[0] = true if f_battler.note =~ /<Jump>/
  1212.       @f_double_jump[0] = true if f_battler.note =~ /<Double Jump>/
  1213.       @f_action_freq[5] = [[$1.to_i, 999].min, 10].max if f_battler.note =~ /<Action Frequence = (\d+)>/
  1214.       if f_battler.note =~ /<Breath Effect>/
  1215.          @f_breath_effect = [false,0,rand(30),0,0.0015]
  1216.          @f_breath_effect[1] = @f_breath_effect[2] * @f_breath_effect[4]        
  1217.          @f_breath_effect[0] = true
  1218.       end  
  1219.       if f_battler.note =~ /<Flying Height = (\d+)>/
  1220.          @f_flying_type  = [false,rand(15),0,rand(4),100] ; @f_flying_type[2] = @f_flying_type[1]
  1221.          @f_flying_type[0] = true
  1222.          @f_flying_type[4] = $1.to_i.abs
  1223.       end  
  1224.       @f_sprite_fade = [false,0] ; @f_escape_ratio = 0
  1225.       @f_ai_guard[1] = $1.to_i if f_battler.note =~ /<Guard Rate = (\d+)>/
  1226.       @f_super_guard[0] = true if f_battler.note =~ /<Super Guard>/
  1227.       @f_move[0] = false if f_battler.note =~ /<Disable Movement>/
  1228.       @f_e_action[0] = false if f_battler.note =~ /<Disable Action>/
  1229.       if f_battler.note =~ /<Guard Type = (\d+)>/
  1230.          @f_guard[0] = [[$1.to_i, 2].min, 0].max
  1231.       end    
  1232.   end  
  1233.  
  1234.   #--------------------------------------------------------------------------
  1235.   # ? Set Sprite Size
  1236.   #--------------------------------------------------------------------------
  1237.   def set_sprite_size
  1238.       return if @f_char_data[0]
  1239.       return if @battler_name.nil? or @battler_name == ""
  1240.       original_sprite = Cache.battler(@battler_name.to_s, 0) rescue nil
  1241.       return if original_sprite.nil?
  1242.       cw = [[original_sprite.width, 999].min, 32].max
  1243.       ch = [[original_sprite.height, 999].min, 32].max
  1244.       @sprite_data[12] = [cw, ch,cw / 2, ch / 2]
  1245.       @f_breath_effect[4] = 0.0030 - (f_body_height * 0.000006) if f_breath_effect?
  1246.       @f_escape_ratio = MOG_LMBS::ESCAPE_RATIO + (MOG_LMBS::ESCAPE_RATIO * ($game_troop.agi / $game_party.agi))
  1247.       @f_action_freq[4] = rand(@f_action_freq[5] / 2)
  1248.   end  
  1249.  
  1250.   #--------------------------------------------------------------------------
  1251.   # ? Set Equip Data
  1252.   #--------------------------------------------------------------------------
  1253.   def set_equip_data
  1254.       return if self.is_a?(Game_Enemy)
  1255.       return if @equips[0].nil?
  1256.       @f_wep_data = @equips[0]
  1257.   end  
  1258.  
  1259.   #--------------------------------------------------------------------------
  1260.   # ? F Set Action
  1261.   #--------------------------------------------------------------------------
  1262.   def f_set_action(skill_id)
  1263.       clear_actions
  1264.       action = Game_Action.new(self, true)
  1265.       action.set_skill(skill_id)
  1266.       @actions.push(action)    
  1267.   end  
  1268.  
  1269.   #--------------------------------------------------------------------------
  1270.   # ? F Clear Poses
  1271.   #--------------------------------------------------------------------------
  1272.   def f_clear_poses
  1273.       @sprite_data[0] = 0
  1274.       @sprite_data[1] = 0
  1275.       @sprite_data[4] = false
  1276.       @sprite_data[5][0] = false
  1277.       @sprite_data[6] = [false,0,0,false,false,0]
  1278.       @sprite_data[8] = false
  1279.       @sprite_data[10][0] = false
  1280.   end  
  1281.  
  1282.   #--------------------------------------------------------------------------
  1283.   # ? F Clear Basic Poses
  1284.   #--------------------------------------------------------------------------
  1285.   def f_clear_basic_poses
  1286.       @sprite_data[5][0] = false
  1287.       @sprite_data[10][0] = false
  1288.       @sprite_data[8] = false
  1289.       @sprite_data[7] = 0
  1290.       @sprite_data[4] = false
  1291.       @sprite_data[9] = -1
  1292.   end
  1293.  
  1294.   #--------------------------------------------------------------------------
  1295.   # ? F Update Animation Mirror
  1296.   #--------------------------------------------------------------------------
  1297.   def f_update_animation_mirror
  1298.       @animation_mirror = f_direction == 0 ? true : false
  1299.   end
  1300.    
  1301.   #--------------------------------------------------------------------------
  1302.   # ? F Execute Chain Action
  1303.   #--------------------------------------------------------------------------
  1304.   def f_execute_chain_action(skill)
  1305.       if !skill.nil? and skill.note =~ /<F Chain Action = (\d+)>/
  1306.          @f_action_time[2] = 0
  1307.          f_execute_skill($1.to_i)
  1308.       end  
  1309.   end
  1310.    
  1311.   #--------------------------------------------------------------------------
  1312.   # ? ATB
  1313.   #--------------------------------------------------------------------------            
  1314.   if $imported[:mog_atb_system]
  1315.   alias mog_fmbs_atb atb
  1316.   def atb
  1317.       return 0 if $game_system.fmbs_data[0]
  1318.       mog_fmbs_atb
  1319.   end  
  1320.   end
  1321.  
  1322.   #--------------------------------------------------------------------------
  1323.   # ? F Move
  1324.   #--------------------------------------------------------------------------            
  1325.   def f_move(type)
  1326.       @sprite_data[7] = type
  1327.       case type
  1328.         when 0 ; f_mov_crouch
  1329.         when 1 ; f_mov_jump
  1330.         when 2 ; f_mov_side(0)
  1331.         when 3 ; f_mov_side(1)
  1332.       end
  1333.   end
  1334.  
  1335.   #--------------------------------------------------------------------------
  1336.   # ? F Mov
  1337.   #--------------------------------------------------------------------------            
  1338.   def f_mov_crouch
  1339.       return if !f_crouch_conditions_met?
  1340.       @sprite_data[4] = true
  1341.       @sprite_data[5][0] = false
  1342.       @sprite_data[8] = false
  1343.   end
  1344.  
  1345.   #--------------------------------------------------------------------------
  1346.   # ? F Crouch Conditions Met?
  1347.   #--------------------------------------------------------------------------            
  1348.   def f_crouch_conditions_met?
  1349.       return false if !f_crouch_usable?
  1350.       return false if f_mov_jumping?
  1351.       return false if f_mov_acting?
  1352.       return false if f_mov_damage?
  1353.       return false if f_force_movement?    
  1354.       return false if f_casting?
  1355.       return false if $game_temp.fmb_phase_data != [0,0]  
  1356.       return true
  1357.   end
  1358.  
  1359.   #--------------------------------------------------------------------------
  1360.   # ? F Mov Speed
  1361.   #--------------------------------------------------------------------------            
  1362.   def f_mov_speed
  1363.       return 2
  1364.   end
  1365.  
  1366.   #--------------------------------------------------------------------------
  1367.   # ? F Mov Jumping?
  1368.   #--------------------------------------------------------------------------            
  1369.   def f_mov_jumping?
  1370.       return @sprite_data[6][0]
  1371.   end
  1372.  
  1373.   #--------------------------------------------------------------------------
  1374.   # ? F Mov Falling
  1375.   #--------------------------------------------------------------------------            
  1376.   def f_mov_falling?
  1377.       return @sprite_data[6][3]
  1378.   end  
  1379.  
  1380.   #--------------------------------------------------------------------------
  1381.   # ? F Mov Victory
  1382.   #--------------------------------------------------------------------------            
  1383.   def f_mov_victory?
  1384.       return $game_temp.fmb_phase_end == 1
  1385.   end
  1386.  
  1387.   #--------------------------------------------------------------------------
  1388.   # ? F Waking
  1389.   #--------------------------------------------------------------------------            
  1390.   def f_walking?
  1391.       return false if $game_temp.fmb_phase_data != [0,0]
  1392.       return false if !f_ground? and !f_flying_type?
  1393.       return false if !f_movable?
  1394.       return false if f_mov_dashing?
  1395.       return false if f_mov_guarding?
  1396.       return true if [2,3].include?(@sprite_data[7])  
  1397.       return false if @sprite_data[9] == -1        
  1398.       return @sprite_data[8]
  1399.   end
  1400.  
  1401.   #--------------------------------------------------------------------------
  1402.   # ? F Mov Crouching
  1403.   #--------------------------------------------------------------------------            
  1404.   def f_mov_crouching?
  1405.       return false if $game_temp.fmb_phase_data != [0,0]
  1406.       return false if !f_ground?
  1407.       return false if !f_movable?
  1408.       return @sprite_data[4]
  1409.   end
  1410.  
  1411.   #--------------------------------------------------------------------------
  1412.   # ? F Mov Guarding
  1413.   #--------------------------------------------------------------------------            
  1414.   def f_mov_guarding?
  1415.       return false if $game_temp.fmb_phase_data != [0,0]
  1416.       return false if !f_movable?
  1417.       return false if !f_ground? and !f_flying_type?
  1418.       return true if @f_knockback[4] > 0
  1419.       return @sprite_data[10][0]
  1420.   end  
  1421.  
  1422.   #--------------------------------------------------------------------------
  1423.   # ? F Force Movement?
  1424.   #--------------------------------------------------------------------------            
  1425.   def f_force_movement?
  1426.       @f_action_m[0]
  1427.   end  
  1428.  
  1429.   #--------------------------------------------------------------------------
  1430.   # ? F Mov Damage
  1431.   #--------------------------------------------------------------------------            
  1432.   def f_mov_damage?
  1433.       return false if dead?
  1434.       return true if f_mov_unconscious?
  1435.       @f_damage[3]
  1436.   end  
  1437.    
  1438.   #--------------------------------------------------------------------------
  1439.   # ? F Movable?
  1440.   #--------------------------------------------------------------------------            
  1441.   def f_movable?      
  1442.       return false if f_mov_damage?
  1443.       return false if f_mov_acting?
  1444.       return false if f_mov_unconscious?
  1445.       return false if restriction == 4
  1446.       return false if @f_action_time[2] > 0
  1447.       return true
  1448.   end
  1449.  
  1450.   #--------------------------------------------------------------------------
  1451.   # ? F Mov Acting
  1452.   #--------------------------------------------------------------------------            
  1453.   def f_mov_acting?
  1454.       return false if f_mov_damage?      
  1455.       return !@sprite_data[11][0].nil?
  1456.   end
  1457.  
  1458.   #--------------------------------------------------------------------------
  1459.   # ? F Mov Unconcious
  1460.   #--------------------------------------------------------------------------            
  1461.   def f_mov_unconscious?
  1462.       return true if dead?
  1463.       @f_knockback[3] > 0
  1464.   end
  1465.  
  1466.   #--------------------------------------------------------------------------
  1467.   # ? F air Knockback?
  1468.   #--------------------------------------------------------------------------            
  1469.   def f_mov_air_knockback?
  1470.       @f_damage_effect[0] == 2
  1471.   end
  1472.  
  1473.   #--------------------------------------------------------------------------
  1474.   # ? F Update Base Pose
  1475.   #--------------------------------------------------------------------------            
  1476.   def f_update_base_pose
  1477.       @f_ai_data[2] -= 1 if @f_ai_data[2] > 0
  1478.       @f_action_time[0] = false if f_ground?  
  1479.       @f_action_time[2] -= 1if @f_action_time[2] > 0
  1480.       @sprite_data[0] = f_set_pose
  1481.       f_clear_basic_poses
  1482.       f_check_screen_xy_limit
  1483.   end
  1484.  
  1485.   #--------------------------------------------------------------------------
  1486.   # ? F Set Pose
  1487.   #--------------------------------------------------------------------------            
  1488.   def f_set_pose
  1489.       return 9 if f_mov_unconscious?
  1490.       return 8 if f_mov_damage?
  1491.       if f_mov_acting?
  1492.          return @sprite_data[11][2] + 1000 if @f_action[4] == 0
  1493.          return @sprite_data[11][2] + 2000 if @f_action[4] == 1
  1494.       end    
  1495.       return 11 if f_mov_victory?
  1496.       return 10 if f_casting?
  1497.       return 1 if f_walking?
  1498.       return 5 if f_mov_air_dash?
  1499.       return 3 if f_mov_falling? and !f_mov_acting?
  1500.       return 2 if f_mov_double_jump? and !f_mov_acting?
  1501.       return 2 if f_mov_jumping? and !f_mov_acting?
  1502.       return 4 if f_mov_crouching? and !f_mov_guarding?
  1503.       return 5 if f_mov_dashing?
  1504.       return 7 if f_mov_guarding? and f_mov_crouching?
  1505.  return 6 if f_mov_guarding?
  1506.       return 0
  1507.   end
  1508.  
  1509.   #--------------------------------------------------------------------------
  1510.   # ? F Noloop Animation
  1511.   #--------------------------------------------------------------------------            
  1512.   def f_noloop_animation?
  1513.       return false if @f_action[6]
  1514.       return true if f_mov_acting?
  1515.       return true if f_mov_victory?
  1516.       return true if f_mov_jumping?
  1517.       return true if f_mov_double_jump?
  1518.       return true if f_mov_crouching?
  1519.       return true if f_mov_guarding?
  1520.       return true if !f_movable?
  1521.       return true if f_mov_air_dash?
  1522.       return true if f_mov_unconscious?
  1523.       return true if @sprite_data[6][3]
  1524.       return false
  1525.   end
  1526.  
  1527. end
  1528.  
  1529. #==============================================================================
  1530. # ¦ Game_Battler
  1531. #==============================================================================
  1532. class Game_Battler < Game_BattlerBase
  1533.  
  1534.   #--------------------------------------------------------------------------
  1535.   # ? F Direction
  1536.   #--------------------------------------------------------------------------            
  1537.   def f_direction
  1538.       @sprite_data[3]
  1539.   end
  1540.  
  1541.   #--------------------------------------------------------------------------
  1542.   # ? F Flying Type?
  1543.   #--------------------------------------------------------------------------            
  1544.   def f_flying_type?
  1545.       @f_flying_type[0]
  1546.   end
  1547.  
  1548.   #--------------------------------------------------------------------------
  1549.   # ? F Casting?
  1550.   #--------------------------------------------------------------------------            
  1551.   def f_casting?
  1552.       !@f_cast_data[0].nil?
  1553.   end    
  1554.  
  1555.   #--------------------------------------------------------------------------
  1556.   # ? F Reflect
  1557.   #--------------------------------------------------------------------------            
  1558.   def f_reflect?
  1559.       return true if @sprite_data[11][5]
  1560.       return false
  1561.   end
  1562.  
  1563.   #--------------------------------------------------------------------------
  1564.   # ? F Invunerable?
  1565.   #--------------------------------------------------------------------------            
  1566.   def f_invunerable?
  1567.       return true if @sprite_data[11][4]
  1568.       return false
  1569.   end  
  1570.  
  1571.   #--------------------------------------------------------------------------
  1572.   # ? F Move Usable?
  1573.   #--------------------------------------------------------------------------            
  1574.   def f_move_usable?
  1575.       @f_move[0]
  1576.   end
  1577.  
  1578.   #--------------------------------------------------------------------------
  1579.   # ? F Action Usable?
  1580.   #--------------------------------------------------------------------------            
  1581.   def f_action_usable?
  1582.       @f_e_action[0]
  1583.   end
  1584.    
  1585.   #--------------------------------------------------------------------------
  1586.   # ? F Breath Effect?
  1587.   #--------------------------------------------------------------------------            
  1588.   def f_breath_effect?
  1589.       f_breath_effect[0]
  1590.   end
  1591.  
  1592.   #--------------------------------------------------------------------------
  1593.   # ? F Guard Usable?
  1594.   #--------------------------------------------------------------------------            
  1595.   def f_guard_usable?
  1596.       @f_guard[0] != 0
  1597.   end    
  1598.      
  1599.   #--------------------------------------------------------------------------
  1600.   # ? F Dash Usable?
  1601.   #--------------------------------------------------------------------------            
  1602.   def f_dash_usable?
  1603.       return @f_dash[0]
  1604.   end
  1605.  
  1606.   #--------------------------------------------------------------------------
  1607.   # ? F Air Dash Usable?
  1608.   #--------------------------------------------------------------------------            
  1609.   def f_air_dash_usable?
  1610.       return @f_air_dash[0]
  1611.   end
  1612.  
  1613.   #--------------------------------------------------------------------------
  1614.   # ? F Jump Usable
  1615.   #--------------------------------------------------------------------------            
  1616.   def f_jump_usable?
  1617.       return @f_jump[0]
  1618.   end
  1619.  
  1620.   #--------------------------------------------------------------------------
  1621.   # ? F Double Jump Usable?
  1622.   #--------------------------------------------------------------------------            
  1623.   def f_dounble_jump_usable?
  1624.       return @f_double_jump[0]
  1625.   end
  1626.  
  1627.   #--------------------------------------------------------------------------
  1628.   # ? F Crouch Usable?
  1629.   #--------------------------------------------------------------------------            
  1630.   def f_crouch_usable?
  1631.       return @f_crouch[0]
  1632.   end
  1633.  
  1634.   #--------------------------------------------------------------------------
  1635.   # ? F Action Freq
  1636.   #--------------------------------------------------------------------------            
  1637.   def f_action_freq
  1638.       return 120
  1639.   end
  1640.  
  1641.   #--------------------------------------------------------------------------
  1642.   # ? F Grv Speed
  1643.   #--------------------------------------------------------------------------            
  1644.   def f_grv_speed
  1645.       return @jump_speed
  1646.   end
  1647.  
  1648.   #--------------------------------------------------------------------------
  1649.   # ? F Base Jh
  1650.   #--------------------------------------------------------------------------            
  1651.   def f_jump_height
  1652.       return @jump_height
  1653.   end
  1654.  
  1655.   #--------------------------------------------------------------------------
  1656.   # ? F Body Width
  1657.   #--------------------------------------------------------------------------            
  1658.   def f_body_width
  1659.       return @sprite_data[12][0]
  1660.   end    
  1661.  
  1662.   #--------------------------------------------------------------------------
  1663.   # ? F Body Width 2
  1664.   #--------------------------------------------------------------------------            
  1665.   def f_body_width2
  1666.       return @sprite_data[12][2]
  1667.   end    
  1668.  
  1669.   #--------------------------------------------------------------------------
  1670.   # ? F Height
  1671.   #--------------------------------------------------------------------------            
  1672.   def f_body_height
  1673.       return f_body_height2 if f_mov_crouching?
  1674.       return @sprite_data[12][1]
  1675.   end
  1676.  
  1677.   #--------------------------------------------------------------------------
  1678.   # ? F Height 2
  1679.   #--------------------------------------------------------------------------            
  1680.   def f_body_height2
  1681.       return @sprite_data[12][3]
  1682.   end  
  1683.  
  1684.   #--------------------------------------------------------------------------
  1685.   # ? F Jump Max
  1686.   #--------------------------------------------------------------------------            
  1687.   def f_jump_max
  1688.       return f_ground - f_jump_height
  1689.   end
  1690.  
  1691.   #--------------------------------------------------------------------------
  1692.   # ? F Super Guard
  1693.   #--------------------------------------------------------------------------            
  1694.   def f_super_guard?
  1695.       return true if @sprite_data[11][3]
  1696.       @f_super_guard[0]
  1697.   end
  1698.    
  1699. end
  1700.  
  1701. #==============================================================================
  1702. # ¦ Game_Battler
  1703. #==============================================================================
  1704. class Game_Battler < Game_BattlerBase
  1705.  
  1706.   #--------------------------------------------------------------------------
  1707.   # ? F Check Screen XY Limit
  1708.   #--------------------------------------------------------------------------            
  1709.   def f_check_screen_xy_limit
  1710.       @screen_x = (@arena_range[0] + bcx1) if @screen_x < f_limit_x1
  1711.       @screen_x = (@arena_range[1] - bcx2) if @screen_x > f_limit_x2
  1712.       if @screen_y < -screen_y_limit
  1713.          @screen_y = -screen_y_limit
  1714.          f_clear_double_jump if f_mov_double_jump?
  1715.       end
  1716.       @screen_y = f_ground if @screen_y > f_ground
  1717.   end
  1718.      
  1719.   #--------------------------------------------------------------------------
  1720.   # ? Bcx1
  1721.   #--------------------------------------------------------------------------            
  1722.   def bcx1
  1723.       return $game_temp.bc_screen_range[0] if !$imported[:mog_battle_camera].nil?
  1724.       return 0
  1725.   end
  1726.  
  1727.   #--------------------------------------------------------------------------
  1728.   # ? Bcx2
  1729.   #--------------------------------------------------------------------------            
  1730.   def bcx2
  1731.       return $game_temp.bc_screen_range[0] if !$imported[:mog_battle_camera].nil?
  1732.       return 0
  1733.   end
  1734.  
  1735.   #--------------------------------------------------------------------------
  1736.   # ? Screen Y Limit
  1737.   #--------------------------------------------------------------------------            
  1738.   def screen_y_limit
  1739.       return -f_body_height2 + $game_temp.bc_screen_range[3] if !$imported[:mog_battle_camera].nil?
  1740.       return -f_body_height2
  1741.   end
  1742.  
  1743.   #--------------------------------------------------------------------------
  1744.   # ? Screen Y Limit2
  1745.   #--------------------------------------------------------------------------            
  1746.   def screen_y_limit2
  1747.   #    return Graphics.height + $game_temp.bc_screen_range[3] if !$imported[:mog_battle_camera].nil?
  1748.       return Graphics.height
  1749.   end  
  1750.  
  1751.   #--------------------------------------------------------------------------
  1752.   # ? F Limit X1
  1753.   #--------------------------------------------------------------------------            
  1754.   def f_limit_x1
  1755.       (@arena_range[0] + bcx1)
  1756.   end
  1757.  
  1758.   #--------------------------------------------------------------------------
  1759.   # ? F Limit X2
  1760.   #--------------------------------------------------------------------------            
  1761.   def f_limit_x2
  1762.       (@arena_range[1] - bcx2)
  1763.   end
  1764.  
  1765.   #--------------------------------------------------------------------------
  1766.   # ? F Limit y1
  1767.   #--------------------------------------------------------------------------            
  1768.   def f_limit_y1
  1769.       return -(32 + $game_temp.bc_screen_range[3]) if !$imported[:mog_battle_camera].nil?
  1770.       return -32
  1771.   end  
  1772.  
  1773.   #--------------------------------------------------------------------------
  1774.   # ? F Ground Limit
  1775.   #--------------------------------------------------------------------------            
  1776.   def f_ground      
  1777.       screen_y_limit2 - $game_system.fmbs_data[1]
  1778.   end
  1779.  
  1780.   #--------------------------------------------------------------------------
  1781.   # ? F Ground ?
  1782.   #--------------------------------------------------------------------------            
  1783.   def f_ground?
  1784.       return true if @f_air_ground[0] and $game_system.f_collision_effect[1]
  1785.       @screen_y >= f_ground
  1786.   end
  1787.  
  1788.   #--------------------------------------------------------------------------
  1789.   # ? F Air Ground H
  1790.   #--------------------------------------------------------------------------            
  1791.   def f_air_ground_h
  1792.       @f_air_ground[1]
  1793.   end    
  1794.  
  1795.   #--------------------------------------------------------------------------
  1796.   # ? F Air Ground?
  1797.   #--------------------------------------------------------------------------            
  1798.   def f_air_ground?
  1799.       @screen_y >= @f_air_ground[1]
  1800.   end
  1801.  
  1802.   #--------------------------------------------------------------------------
  1803.   # ? F Screen Y Limit?
  1804.   #--------------------------------------------------------------------------            
  1805.   def screen_y_limit?
  1806.       @screen_y <= -screen_y_limit
  1807.   end  
  1808.    
  1809. end
  1810.  
  1811. #==============================================================================
  1812. # ¦ Game_Battler
  1813. #==============================================================================
  1814. class Game_Battler < Game_BattlerBase
  1815.  
  1816.   #--------------------------------------------------------------------------
  1817.   # ? F Dash?
  1818.   #--------------------------------------------------------------------------            
  1819.   def f_mov_dashing?
  1820.       return false if $game_temp.fmb_phase_data != [0,0]
  1821.       return false if !f_movable?
  1822.       return false if f_mov_guarding? or f_mov_crouching?
  1823.       return false if (f_mov_jumping? and !@sprite_data[5][1])
  1824.       return false if @sprite_data[9] == -1
  1825.       return @sprite_data[5][0]
  1826.   end  
  1827.  
  1828.   #--------------------------------------------------------------------------
  1829.   # ? F Mov Dash
  1830.   #--------------------------------------------------------------------------            
  1831.   def f_mov_dash
  1832.       return if !f_mov_dash_conditions_met?
  1833.       @sprite_data[10][0] = false
  1834.       @sprite_data[5][0] = true  
  1835.   end  
  1836.  
  1837.   #--------------------------------------------------------------------------
  1838.   # ? F Mov Dash Condition Met?
  1839.   #--------------------------------------------------------------------------            
  1840.   def f_mov_dash_conditions_met?
  1841.       return false if !f_dash_usable?
  1842.       return false if !f_movable?
  1843.       return false if $game_temp.fmb_phase_data != [0,0]
  1844.       return true
  1845.   end
  1846.    
  1847.   #--------------------------------------------------------------------------
  1848.   # ? F Move Speed
  1849.   #--------------------------------------------------------------------------            
  1850.   def f_mov_speed
  1851.       return @move_speed
  1852.   end  
  1853.  
  1854.   #--------------------------------------------------------------------------
  1855.   # ? F Move Side
  1856.   #--------------------------------------------------------------------------            
  1857.   def f_mov_side(type)
  1858.       return if !f_mov_side_conditions_met?
  1859.       @sprite_data[4] = false
  1860.       @sprite_data[8] = true unless f_mov_jumping?
  1861.       @sprite_data[9] = type
  1862.       @sprite_data[3] = type unless f_mov_acting?
  1863.       d = type == 0 ? -f_mov_speed : f_mov_speed
  1864.       d *= 1.5 if f_mov_dashing?
  1865.       f_move_screen_x(d) unless (!f_mov_jumping? and f_mov_acting?)
  1866.       f_update_escape if f_update_escape?
  1867.   end
  1868.    
  1869.   #--------------------------------------------------------------------------
  1870.   # ? F Move screen_x
  1871.   #--------------------------------------------------------------------------            
  1872.   def f_move_screen_x(value)
  1873.       return if !f_move_usable?
  1874.       @screen_x += value
  1875.   end
  1876.  
  1877.   #--------------------------------------------------------------------------
  1878.   # ? F Move screen_x Collision?
  1879.   #--------------------------------------------------------------------------            
  1880.   def f_move_screen_x_collision?(value)
  1881.       return false if !$game_system.f_collision_effect[0]
  1882.       for b in f_all_battlers
  1883.           next if b == self
  1884.           if @screen_x.between?(b.screen_x - b.f_body_width2 - value ,b.screen_x + b.f_body_width2 - value)
  1885.              if @screen_y.between?(b.screen_y - (b.f_body_height - 16),b.screen_y) or
  1886.                 (@screen_y - f_body_height2 - 16).between?(b.screen_y - (b.f_body_height - 16),b.screen_y)
  1887.                 return $game_system.f_collision_effect[1]
  1888.              end
  1889.           end
  1890.       end
  1891.       return false
  1892.   end  
  1893.  
  1894.   #--------------------------------------------------------------------------
  1895.   # ? F Move screen_x
  1896.   #--------------------------------------------------------------------------            
  1897.   def f_move_screen_x2(value)
  1898.       if !f_move_screen_x_collision2?(value)
  1899.           @screen_x += value if !f_move_screen_x_collision2?(value)
  1900.       else    
  1901.           @sprite_data[9] = -1
  1902.       end  
  1903.   end
  1904.  
  1905.   #--------------------------------------------------------------------------
  1906.   # ? F Move screen_x Collision2?
  1907.   #--------------------------------------------------------------------------            
  1908.   def f_move_screen_x_collision2?(value)
  1909.       for b in f_all_battlers
  1910.           next if b == self
  1911.           next if !b.f_movable?
  1912.           if @screen_x.between?(b.screen_x - b.f_body_width2 - value ,b.screen_x + b.f_body_width2 - value)
  1913.              return true if @screen_y.between?(b.screen_y - (b.f_body_height - 16),b.screen_y)
  1914.              return true if (@screen_y - f_body_height2 - 16).between?(b.screen_y - (b.f_body_height - 16),b.screen_y)
  1915.           end
  1916.       end
  1917.       return false
  1918.   end  
  1919.  
  1920.  
  1921.   #--------------------------------------------------------------------------
  1922.   # ? F Move screen_y
  1923.   #--------------------------------------------------------------------------            
  1924.   def f_move_screen_y(value)
  1925.       return if !f_move_usable?
  1926.       @screen_y += value
  1927.   end    
  1928.  
  1929.   #--------------------------------------------------------------------------
  1930.   # ? F Move screen_y Collision?
  1931.   #--------------------------------------------------------------------------            
  1932.   def f_move_screen_y_collision?(value)
  1933.       return false if !$game_system.f_collision_effect[0]
  1934.       return false if value < 0 and !$game_system.f_collision_effect[1]
  1935.       for b in f_all_battlers
  1936.           next if b == self
  1937.           next if !b.f_movable?
  1938.           if (@screen_y.between?(b.screen_y - (b.f_body_height - 16) - value,b.screen_y - value))# or
  1939.              next if !@screen_x.between?(b.screen_x - b.f_body_width2,b.screen_x + b.f_body_width2)
  1940.                 f_clear_col(b,value)
  1941.                 return $game_system.f_collision_effect[1]
  1942.            end
  1943.       end
  1944.       return false
  1945.   end    
  1946.      
  1947.   #--------------------------------------------------------------------------
  1948.   # ? F Clear Col
  1949.   #--------------------------------------------------------------------------            
  1950.   def f_clear_col(b,value)
  1951.       unless value < 0 or f_mov_acting?
  1952.           d = @sprite_data[3] == 1 ? 4 : -4
  1953.           f_move_screen_x(d)
  1954.           b.f_move_screen_x(-d)
  1955.           if $game_system.f_collision_effect[1]
  1956.           f_clear_air_effects unless (f_flying_type? or f_mov_acting?)
  1957.           end
  1958.           @f_air_ground[0] = true
  1959.           @f_air_ground[1] = f_ground - @screen_y      
  1960.       end
  1961.       if $game_system.f_collision_effect[1]
  1962.          f_clear_jump if f_mov_jumping? and !f_force_movement?
  1963.       end    
  1964.       @f_fix_direction[0] = true
  1965.   end    
  1966.  
  1967.   #--------------------------------------------------------------------------
  1968.   # ? F All Battlers Alive
  1969.   #--------------------------------------------------------------------------            
  1970.   def f_all_battlers
  1971.       $game_party.battle_members + $game_troop.alive_members
  1972.   end
  1973.  
  1974.   #--------------------------------------------------------------------------
  1975.   # ? F Update Escape
  1976.   #--------------------------------------------------------------------------            
  1977.   def f_update_escape?
  1978.       return false if self.is_a?(Game_Enemy)
  1979.       return false if !BattleManager.can_escape?
  1980.       return false if !f_ground? and !f_flying_type?
  1981.       return false if self != BattleManager.active_actor
  1982.       return true if f_limit_x1 >= @screen_x and @sprite_data[9] == 0
  1983.       return true if f_limit_x2 <= @screen_x and @sprite_data[9] == 1
  1984.       return false
  1985.   end  
  1986.  
  1987.   #--------------------------------------------------------------------------
  1988.   # ? F Update Escpae
  1989.   #--------------------------------------------------------------------------            
  1990.   def f_update_escape
  1991.       $game_temp.f_escape_phase[1] += 2
  1992.       $game_temp.f_escape_phase[2] = 60
  1993.       BattleManager.f_process_escape if $game_temp.f_escape_phase[1] >= f_espace_duration
  1994.   end
  1995.  
  1996.   #--------------------------------------------------------------------------
  1997.   # ? F Escape Duration
  1998.   #--------------------------------------------------------------------------            
  1999.   def f_espace_duration
  2000.       return @f_escape_ratio
  2001.   end
  2002.  
  2003.   #--------------------------------------------------------------------------
  2004.   # ? F Move Side Condition Met?
  2005.   #--------------------------------------------------------------------------            
  2006.   def f_mov_side_conditions_met?
  2007.       return false if !f_move_usable?
  2008.       return false if f_mov_damage?
  2009.       return false if $game_temp.fmb_phase_data != [0,0]
  2010.       return false if f_mov_guarding?
  2011.       return false if f_force_movement?
  2012.       return false if f_mov_air_dash?
  2013.       return false if f_casting?
  2014.       return false if @f_action_time[2] > 0
  2015.       return true
  2016.   end
  2017.  
  2018. end
  2019.  
  2020. #==============================================================================
  2021. # ¦ Game_Battler
  2022. #==============================================================================
  2023. class Game_Battler < Game_BattlerBase
  2024.  
  2025.   #--------------------------------------------------------------------------
  2026.   # ? F Guard Conditions Met?
  2027.   #--------------------------------------------------------------------------            
  2028.   def f_update_breath_effect
  2029.       @f_breath_effect[3] += 1
  2030.       return if @f_breath_effect[3] < 2
  2031.       @f_breath_effect[3] = 0
  2032.       @f_breath_effect[2] += 1
  2033.       case @f_breath_effect[2]
  2034.         when 0..30 ; @f_breath_effect[1] += @f_breath_effect[4]
  2035.         when 31..60 ; @f_breath_effect[1] -= @f_breath_effect[4]
  2036.         else
  2037.           @f_breath_effect[1] = 0
  2038.           @f_breath_effect[2] = 0
  2039.       end
  2040.   end
  2041.  
  2042. end
  2043.  
  2044. #==============================================================================
  2045. # ¦ Game_Battler
  2046. #==============================================================================
  2047. class Game_Battler < Game_BattlerBase
  2048.  
  2049.   #--------------------------------------------------------------------------
  2050.   # ? F Cast Action?
  2051.   #--------------------------------------------------------------------------            
  2052.   def f_cast_action?(skill,casting)
  2053.       return true if !skill_cost_payable?(skill)
  2054.       return false if casting
  2055.       return false if f_mov_guarding?
  2056.       return true if !@f_cast_data[0].nil?
  2057.       return false if skill.speed == 0      
  2058.       @f_cast_data = [skill,skill.speed]      
  2059.       return true
  2060.   end  
  2061.    
  2062.   #--------------------------------------------------------------------------
  2063.   # ? F Update Cast
  2064.   #--------------------------------------------------------------------------            
  2065.   def f_update_cast?
  2066.       return false if !f_movable?
  2067.       return false if !$game_temp.f_in_action?
  2068.       return f_casting?
  2069.   end
  2070.  
  2071.   #--------------------------------------------------------------------------
  2072.   # ? F Update Cast
  2073.   #--------------------------------------------------------------------------            
  2074.   def f_update_cast
  2075.       @f_cast_data[1] -= 1 if @f_cast_data[1] > 0
  2076.       f_execute_cast_action if f_execute_cast_action?
  2077.   end
  2078.  
  2079.   #--------------------------------------------------------------------------
  2080.   # ? F Execute Cast Action
  2081.   #--------------------------------------------------------------------------            
  2082.   def f_execute_cast_action?
  2083.       return false if @f_cast_data[1] > 0
  2084.       return true      
  2085.   end  
  2086.  
  2087.   #--------------------------------------------------------------------------
  2088.   # ? F Execute Cast Action
  2089.   #--------------------------------------------------------------------------            
  2090.   def f_execute_cast_action
  2091.       BattleManager.p_target_near(self) if @f_target.nil?
  2092.       if self == BattleManager.active_actor
  2093.          f_execute_skill_actor(@f_cast_data[0].id,nil,true)
  2094.       else
  2095.          f_execute_skill_b(@f_cast_data[0].id,nil,true)
  2096.       end
  2097.       f_cast_clear
  2098.   end
  2099.  
  2100.   #--------------------------------------------------------------------------
  2101.   # ? F Execute Cast Action
  2102.   #--------------------------------------------------------------------------            
  2103.   def f_cast_clear
  2104.       @f_cast_data = [nil,0]
  2105.   end
  2106.  
  2107. end
  2108.  
  2109. #==============================================================================
  2110. # ¦ Game_Battler
  2111. #==============================================================================
  2112. class Game_Battler < Game_BattlerBase
  2113.  
  2114.   #--------------------------------------------------------------------------
  2115.   # ? F Mov Guad
  2116.   #--------------------------------------------------------------------------            
  2117.   def f_mov_guard
  2118.       return if !f_mov_guard_conditions_met?
  2119.       @sprite_data[10][0] = true
  2120.   end  
  2121.  
  2122.   #--------------------------------------------------------------------------
  2123.   # ? F Guard Conditions Met?
  2124.   #--------------------------------------------------------------------------            
  2125.   def f_mov_guard_conditions_met?
  2126.       return false if !f_guard_usable?
  2127.       return false if f_mov_jumping?
  2128.       return false if f_mov_acting?
  2129.       return false if !f_movable?
  2130.       return false if $game_temp.fmb_phase_data != [0,0]  
  2131.       return false if f_force_movement?
  2132.       return false if f_casting?
  2133.       return true
  2134.   end
  2135.      
  2136. end
  2137.  
  2138. #==============================================================================
  2139. # ¦ Game_Battler
  2140. #==============================================================================
  2141. class Game_Battler < Game_BattlerBase
  2142.  
  2143.  #--------------------------------------------------------------------------
  2144.  # ? F Update Turn
  2145.  #--------------------------------------------------------------------------            
  2146.  def f_update_turn
  2147.      return if !$game_temp.f_in_action?
  2148.      @f_turn_data[0] += 1
  2149.      return if @f_turn_data[0] < @f_turn_data[1]
  2150.      @f_turn_data[0] = 0    
  2151.      f_on_turn_end
  2152.  end
  2153.  
  2154.  #--------------------------------------------------------------------------
  2155.  # ? Remove States Auto
  2156.  #--------------------------------------------------------------------------            
  2157.  alias mog_fmbs_f_remove_states_auto remove_states_auto
  2158.  def remove_states_auto(timing)
  2159.      if SceneManager.scene_is?(Scene_Battle)
  2160.         states.each do |state|            
  2161.              remove_state(state.id) if @state_turns[state.id] == 0 and state.auto_removal_timing != 0
  2162.         end
  2163.         return
  2164.      end
  2165.      mog_fmbs_f_remove_states_auto(timing)
  2166.  end
  2167.  
  2168.  #--------------------------------------------------------------------------
  2169.  # ? F On Turn End
  2170.  #--------------------------------------------------------------------------
  2171.  def f_on_turn_end
  2172.      regenerate_all
  2173.      update_state_turns
  2174.      update_buff_turns
  2175.      remove_states_auto(1)
  2176.  end
  2177.  
  2178. end
  2179.  
  2180. #==============================================================================
  2181. # ¦ Game_Battler
  2182. #==============================================================================
  2183. class Game_Battler < Game_BattlerBase
  2184.  
  2185.   #--------------------------------------------------------------------------
  2186.   # ? F Mov Jump
  2187.   #--------------------------------------------------------------------------            
  2188.   def f_mov_jump
  2189.       return if !f_jump_conditions_met?
  2190.       @f_air_dash[2] = true unless f_mov_dashing? and !MOG_LMBS::ALLOW_AIR_DASH_DURING_DASH_SPEED
  2191.       @f_double_jump[1] = true unless f_mov_dashing? and !MOG_LMBS::ALLOW_DOUBLE_JUMP_DURING_DASH_SPEED
  2192.       @sprite_data[1] = 0
  2193.       @sprite_data[4] = false
  2194.       @sprite_data[5][1] = true if f_mov_dashing?
  2195.       @sprite_data[8] = false
  2196.       @sprite_data[10][0] = false
  2197.       @sprite_data[6] = [true,0,0,false,false,0]
  2198.       if f_direction == 0
  2199.          @sprite_data[6][1] = 1 if @sprite_data[9] == 0
  2200.          @sprite_data[6][1] = 2 if @sprite_data[9] == 1
  2201.       else
  2202.          @sprite_data[6][1] = 2 if @sprite_data[9] == 0
  2203.          @sprite_data[6][1] = 1 if @sprite_data[9] == 1    
  2204.       end
  2205.   end  
  2206.  
  2207.   #--------------------------------------------------------------------------
  2208.   # ? F Jump Condition Met?
  2209.   #--------------------------------------------------------------------------            
  2210.   def f_jump_conditions_met?
  2211.       return false if !f_jump_usable?
  2212.       return false if !f_ground?
  2213.       return false if f_casting?
  2214.       return false if !f_air_ground[0] and !f_ground?
  2215.       return false if f_mov_guarding?
  2216.       return false if f_mov_acting?
  2217.       return false if !f_movable?
  2218.       return false if f_force_movement?
  2219.       return false if @f_double_jump[2]
  2220.       return false if $game_temp.fmb_phase_data != [0,0]  
  2221.       return true
  2222.   end    
  2223.      
  2224.   #--------------------------------------------------------------------------
  2225.   # ? F Update Jump
  2226.   #--------------------------------------------------------------------------            
  2227.   def f_update_jump
  2228.       @sprite_data[4] = false ; @sprite_data[8] = false
  2229.       if f_mov_air_dash?
  2230.          @sprite_data[6][2] = 1
  2231.          return
  2232.       end      
  2233.       if @sprite_data[6][2] == 0
  2234.          f_move_screen_y(-f_grv_speed) unless f_force_movement?
  2235.          @sprite_data[6][2] = 1 if f_jump_limit?
  2236.       else  
  2237.          f_move_screen_y(f_grv_speed) unless f_force_movement?
  2238.          @sprite_data[6][3] = true
  2239.          if f_ground?
  2240.             f_clear_jump
  2241.             f_clear_double_jump
  2242.             f_clear_air_action
  2243.          end  
  2244.       end  
  2245.   end
  2246.  
  2247.   #--------------------------------------------------------------------------
  2248.   # ? F Jump Limit?
  2249.   #--------------------------------------------------------------------------            
  2250.   def f_jump_limit?
  2251.       return false if @f_action_m[2] != 0
  2252.       return true if @screen_y <= f_jump_max - f_air_ground_h and @f_action_m[2] == 0
  2253.       return true if screen_y_limit?
  2254.       return false
  2255.   end
  2256.  
  2257.   #--------------------------------------------------------------------------
  2258.   # ? F Clear Jump
  2259.   #--------------------------------------------------------------------------            
  2260.   def f_clear_jump
  2261.       @sprite_data[6] = [false,0,0,false,true,0]
  2262.       @sprite_data[5][1] = false
  2263.       f_clear_air_dash
  2264.   end
  2265.  
  2266.   #--------------------------------------------------------------------------
  2267.   # ? F Clear Air Action
  2268.   #--------------------------------------------------------------------------            
  2269.   def f_clear_air_action
  2270.       return if !f_mov_acting?
  2271.       f_action_clear
  2272.       @f_action_time[2] = 10 if @f_action_time[2] == 0
  2273.       @f_ai_data[2] = 5 if @f_ai_data[2] == 0
  2274.   end
  2275.    
  2276.   #--------------------------------------------------------------------------
  2277.   # ? F Update Gravity
  2278.   #--------------------------------------------------------------------------            
  2279.   def f_update_gravity
  2280.       if f_update_flying? ; f_update_flying_gravity ; return ; end
  2281.       return if !f_gravity_conditions_met?  
  2282.       if @screen_y < f_ground
  2283.          f_move_screen_y(f_grv_speed)
  2284.          @sprite_data[6][3] = true
  2285.          @sprite_data[6][4] = true
  2286.          @sprite_data[5][1] = false
  2287.          @sprite_data[4] = false
  2288.          if @f_knockback[3] > 0 and @f_damage[3]
  2289.             d = @f_damage[4] == 0 ? 2 : -2
  2290.             d = 0 if @f_damage[4] == 0 and @screen_x < f_limit_x1 + 16
  2291.             d = 0 if @f_damage[4] == 1 and @screen_x > f_limit_x2 - 16
  2292.             f_move_screen_y(-d)
  2293.           end        
  2294.           if f_ground?
  2295.              f_clear_air_effects
  2296.              f_clear_air_action
  2297.           end
  2298.           return
  2299.       end  
  2300.       @sprite_data[6][3] = false
  2301.   end
  2302.  
  2303.   #--------------------------------------------------------------------------
  2304.   # ? F Clear Air Effects
  2305.   #--------------------------------------------------------------------------            
  2306.   def f_clear_air_effects
  2307.       f_clear_jump
  2308.       f_clear_double_jump
  2309.       f_clear_damage if @f_damage[3]
  2310.   end    
  2311.  
  2312.   #--------------------------------------------------------------------------
  2313.   # ? F Gravity Conditions Met?
  2314.   #--------------------------------------------------------------------------            
  2315.   def f_gravity_conditions_met?
  2316.       return false if f_mov_jumping?
  2317.       return false if f_mov_air_knockback?
  2318.       return false if f_force_movement?
  2319.       return false if f_mov_air_dash?
  2320.       return false if f_mov_double_jump?
  2321.       return false if f_flying_type? and f_mov_acting?
  2322.       return true
  2323.   end
  2324.    
  2325. end
  2326.  
  2327. ==============================================================================
  2328. # ¦ Game_Battler
  2329. #==============================================================================
  2330. class Game_Battler < Game_BattlerBase
  2331.  
  2332.   #--------------------------------------------------------------------------
  2333.   # ? F Update Fying?
  2334.   #--------------------------------------------------------------------------            
  2335.   def f_update_flying?
  2336.       return false if !f_flying_type?
  2337.       return false if !f_movable?
  2338.       return false if f_mov_air_dash?
  2339.       return false if f_mov_double_jump?
  2340.       return false if f_mov_jumping?
  2341.       return false if $game_temp.fmb_phase_end == 4
  2342.       return true
  2343.   end
  2344.  
  2345.   #--------------------------------------------------------------------------
  2346.   # ? F Fying Height?
  2347.   #--------------------------------------------------------------------------            
  2348.   def f_flying_height
  2349.       f_ground - @f_flying_type[4]
  2350.   end
  2351.  
  2352.   #--------------------------------------------------------------------------
  2353.   # ? F Update Flying Gravity
  2354.   #--------------------------------------------------------------------------            
  2355.   def f_update_flying_gravity
  2356.       if @screen_y < f_flying_height
  2357.          f_move_screen_y((f_grv_speed / 2))
  2358.          @sprite_data[6][3] = true
  2359.          @sprite_data[6][4] = true
  2360.          @sprite_data[5][1] = false
  2361.          @sprite_data[4] = false    
  2362.          @screen_y = f_flying_height if @screen_y > f_flying_height
  2363.       elsif @screen_y > f_flying_height
  2364.          f_move_screen_y(-(f_grv_speed / 2))
  2365.          @sprite_data[6][3] = false
  2366.          @screen_y = f_flying_height if @screen_y < f_flying_height
  2367.       end
  2368.   end
  2369.  
  2370.   #--------------------------------------------------------------------------
  2371.   # ? F Update Flying Effect
  2372.   #--------------------------------------------------------------------------            
  2373.   def f_update_fying_effect      
  2374.       if f_ground?
  2375.          @f_flying_type[1] = 0
  2376.          @f_flying_type[2] = 0
  2377.          return
  2378.       end        
  2379.       return if @f_action_m[2] != 0
  2380.       @f_flying_type[3] += 1
  2381.       if @f_flying_type[3] > 4
  2382.          @f_flying_type[3] = 0
  2383.          @f_flying_type[1] += 1
  2384.          case @f_flying_type[1]
  2385.             when 0..15; @f_flying_type[2] += 1
  2386.             when 16..30 ; @f_flying_type[2] -= 1
  2387.             else ; @f_flying_type[1] = 0 ; @f_flying_type[2] = 0
  2388.          end
  2389.       end
  2390.   end  
  2391.    
  2392. end
  2393.  
  2394. #==============================================================================
  2395. # ¦ Game_Battler
  2396. #==============================================================================
  2397. class Game_Battler < Game_BattlerBase
  2398.    
  2399.   #--------------------------------------------------------------------------
  2400.   # ? F Mov Air Dash
  2401.   #--------------------------------------------------------------------------            
  2402.   def f_mov_air_dash
  2403.       return if !f_air_dash_conditions_met?
  2404.       @f_air_dash[1] = true
  2405.       @f_air_dash[3] = 20
  2406.       @f_action = [true,nil,MOG_LMBS::AIR_DASH_ANIMATION_ID,nil,0,nil,false,60]
  2407.   end
  2408.  
  2409.   #--------------------------------------------------------------------------
  2410.   # ? F Air Dash Condition Met?
  2411.   #--------------------------------------------------------------------------            
  2412.   def f_air_dash_conditions_met?
  2413.       return false if !f_air_dash_usable?
  2414.       return false if !f_movable?
  2415.       return false if f_casting?
  2416.       return false if f_force_movement?
  2417.       return false if f_ground? and !f_flying_type?
  2418.       return false if @f_air_dash[1] and !f_flying_type?
  2419.       return true if f_flying_type?
  2420.       return false if !@f_air_dash[2]
  2421.       return false if f_mov_dashing?
  2422.       return false if f_mov_double_jump?
  2423.       return false if @screen_y > f_ground - (f_jump_height / 3)  
  2424.       return true
  2425.   end  
  2426.    
  2427.   #--------------------------------------------------------------------------
  2428.   # ? F Mov Air Dash?
  2429.   #--------------------------------------------------------------------------            
  2430.   def f_mov_air_dash?
  2431.       (@f_air_dash[1] and @f_air_dash[3] > 0)
  2432.   end
  2433.    
  2434.   #--------------------------------------------------------------------------
  2435.   # ? F Update Air Dash
  2436.   #--------------------------------------------------------------------------            
  2437.   def f_update_air_dash
  2438.       @f_air_dash[3] -= 1
  2439.       d = f_direction == 0 ? -f_air_dash_speed : f_air_dash_speed
  2440.       f_move_screen_x(d)
  2441.       f_clear_air_dash if @f_air_dash[3] <= 0
  2442.   end
  2443.  
  2444.   #--------------------------------------------------------------------------
  2445.   # ? F Air Dash Speed
  2446.   #--------------------------------------------------------------------------            
  2447.   def f_air_dash_speed
  2448.       @move_speed + 6
  2449.   end
  2450.  
  2451.   #--------------------------------------------------------------------------
  2452.   # ? F Clear Air Dash
  2453.   #--------------------------------------------------------------------------            
  2454.   def f_clear_air_dash
  2455.       @f_air_dash[1] = false
  2456.       @f_air_dash[2] = false
  2457.       @f_air_dash[3] = 0
  2458.   end  
  2459.  
  2460. end
  2461.  
  2462. #==============================================================================
  2463. # ¦ Game_Battler
  2464. #==============================================================================
  2465. class Game_Battler < Game_BattlerBase
  2466.  
  2467.   #--------------------------------------------------------------------------
  2468.   # ? F Mov Double Jump
  2469.   #--------------------------------------------------------------------------            
  2470.   def f_mov_double_jump
  2471.       return if !f_double_jump_conditions_met?
  2472.       @f_double_jump[2] = true
  2473.       @f_double_jump[3] = 1
  2474.       @sprite_data[1] = 0
  2475.       @sprite_data[6] = [false,0,0,false,true,0] ; @sprite_data[1] = 0
  2476.       @sprite_data[5][1] = false
  2477.       @f_action = [true,nil,MOG_LMBS::DOUBLE_JUMP_ANIMATION_ID,nil,0,nil,false,60]
  2478.   end  
  2479.  
  2480.   #--------------------------------------------------------------------------
  2481.   # ? F Mov Double Jump Condition Met?
  2482.   #--------------------------------------------------------------------------            
  2483.   def f_double_jump_conditions_met?
  2484.       return false if !f_movable?
  2485.       return false if f_casting?
  2486.       return false if f_force_movement?
  2487.       return false if f_mov_dashing?
  2488.       return false if f_ground?
  2489.       return false if !f_dounble_jump_usable?
  2490.       return false if !@f_double_jump[1]
  2491.       return false if @f_double_jump[2]
  2492.       return false if f_mov_air_dash?
  2493.       return false if @screen_y > f_ground - (f_jump_height / 4)    
  2494.       return true  
  2495.   end
  2496.  
  2497.   #--------------------------------------------------------------------------
  2498.   # ? F Mov Double Jump?
  2499.   #--------------------------------------------------------------------------            
  2500.   def f_mov_double_jump?
  2501.       @f_double_jump[3] > 0
  2502.   end
  2503.  
  2504.   #--------------------------------------------------------------------------
  2505.   # ? F Clear Air Dash
  2506.   #--------------------------------------------------------------------------            
  2507.   def f_clear_double_jump
  2508.       @f_double_jump[1] = false
  2509.       @f_double_jump[2] = false
  2510.       @f_double_jump[3] = 0
  2511.   end  
  2512.  
  2513.   #--------------------------------------------------------------------------
  2514.   # ? F Update Double Jump
  2515.   #--------------------------------------------------------------------------            
  2516.   def f_update_double_jump
  2517.       @sprite_data[4] = false ; @sprite_data[8] = false
  2518.       @f_double_jump[3] += 1
  2519.       f_move_screen_y(-f_grv_speed) unless @f_action_m[2] != 0
  2520.       @sprite_data[6][3] = false
  2521.       return if @f_double_jump[3] < (f_jump_height / 8)
  2522.       f_clear_double_jump
  2523.   end
  2524.  
  2525. end
  2526.  
  2527. #==============================================================================
  2528. # ¦ Game_Battler
  2529. #==============================================================================
  2530. class Game_Battler < Game_BattlerBase
  2531.  
  2532.   #--------------------------------------------------------------------------
  2533.   # ? F Update Action
  2534.   #--------------------------------------------------------------------------            
  2535.   def f_update_action
  2536.       @f_action[7] -= 1 if @f_action[7] > 0
  2537.       if (f_flying_type? and @f_action[1].is_a?(RPG::Skill) and @f_action[1].id == attack_skill_id)
  2538.          f_update_flying_attack
  2539.       end
  2540.       return if @sprite_data[11][0].nil?
  2541.       @sprite_data[11][1] -= 1
  2542.       if @sprite_data[11][1] <= 0
  2543.          @sprite_data[1] = 0
  2544.          f_action_clear
  2545.       end
  2546.   end  
  2547.  
  2548.   #--------------------------------------------------------------------------
  2549.   # ? F Update Fying Attack
  2550.   #--------------------------------------------------------------------------            
  2551.   def f_update_flying_attack
  2552.       f_face_to_target
  2553.       f_execute_move(0,@screen_x,@f_target.screen_x)
  2554.       f_execute_move(1,@screen_y,@f_target.screen_y - (@f_target.f_body_height2 / 2))
  2555.   end
  2556.  
  2557.   #--------------------------------------------------------------------------
  2558.   # ? Execute Move
  2559.   #--------------------------------------------------------------------------      
  2560.   def f_execute_move(type,cp,np)
  2561.       sp = 2
  2562.       if cp > np ;    cp -= sp ; cp = np if cp < np
  2563.       elsif cp < np ; cp += sp ; cp = np if cp > np
  2564.       end    
  2565.       @screen_x = cp if type == 0 ; @screen_y = cp if type == 1
  2566.   end  
  2567.  
  2568.   #--------------------------------------------------------------------------
  2569.   # ? F Action Clear
  2570.   #--------------------------------------------------------------------------
  2571.   def f_action_clear
  2572.       skill = @f_action[1] if !@f_action.nil?
  2573.       @f_action = [false,nil,0,nil,0,nil,false,0]      
  2574.       @f_action_m = [false,0,0,0]
  2575.       @sprite_data[11] = [nil,0,0,false,false,false]
  2576.       @sprite_data[1] = 0
  2577.       @sprite_data[13] = 2
  2578.       @f_ai_data[2] = 10
  2579.       @f_a_target = nil    
  2580.       clear_actions if !@actions.nil?
  2581.       f_execute_chain_action(skill) if f_execute_chain_action?(skill)
  2582.       BattleManager.p_target_near(self) rescue nil
  2583.   end    
  2584.  
  2585.   #--------------------------------------------------------------------------
  2586.   # ? F Execute Chain Action
  2587.   #--------------------------------------------------------------------------
  2588.   def f_execute_chain_action?(skill)
  2589.       return false if skill.nil?
  2590.       return false if !f_movable?
  2591.       return true
  2592.   end  
  2593.  
  2594.   #--------------------------------------------------------------------------
  2595.   # ? F Execute Skill Command
  2596.   #--------------------------------------------------------------------------            
  2597.   def f_execute_skill_command
  2598.       if Input.press?(:UP)
  2599.          sk1 = $data_skills[@f_equipped_skill[6]] rescue nil
  2600.          f_execute_skill_actor(@f_equipped_skill[6]) if !sk1.nil? and f_aerial_skill_usable?($data_skills[@f_equipped_skill[6]])
  2601.       elsif Input.press?(:RIGHT) or Input.press?(:LEFT)
  2602.          sk1 = $data_skills[@f_equipped_skill[1]] rescue nil
  2603.          sk2 = $data_skills[@f_equipped_skill[4]] rescue nil    
  2604.          f_execute_skill_actor(@f_equipped_skill[1]) if !sk1.nil? and f_ground_skill_usable?($data_skills[@f_equipped_skill[1]])
  2605.          f_execute_skill_actor(@f_equipped_skill[4]) if !sk2.nil? and f_aerial_skill_usable?($data_skills[@f_equipped_skill[4]])
  2606.       elsif Input.press?(:DOWN)
  2607.          sk1 = $data_skills[@f_equipped_skill[2]] rescue nil
  2608.          sk2 = $data_skills[@f_equipped_skill[5]] rescue nil        
  2609.          f_execute_skill_actor(@f_equipped_skill[2]) if !sk1.nil? and f_ground_skill_usable?($data_skills[@f_equipped_skill[2]])
  2610.          f_execute_skill_actor(@f_equipped_skill[5]) if !sk2.nil? and f_aerial_skill_usable?($data_skills[@f_equipped_skill[5]])
  2611.       else
  2612.          sk1 = $data_skills[@f_equipped_skill[0]] rescue nil
  2613.          sk2 = $data_skills[@f_equipped_skill[3]] rescue nil
  2614.          f_execute_skill_actor(@f_equipped_skill[0]) if !sk1.nil? and f_ground_skill_usable?($data_skills[@f_equipped_skill[0]])
  2615.          f_execute_skill_actor(@f_equipped_skill[3]) if !sk2.nil? and f_aerial_skill_usable?($data_skills[@f_equipped_skill[3]])
  2616.       end
  2617.   end
  2618.    
  2619.   #--------------------------------------------------------------------------
  2620.   # ? F Execute Attack Skill
  2621.   #--------------------------------------------------------------------------            
  2622.   def f_execute_attack_skill
  2623.       if BattleManager.active_actor == self
  2624.          f_execute_skill_actor(attack_skill_id)
  2625.       else
  2626.          f_execute_skill_b(attack_skill_id)
  2627.       end
  2628.   end
  2629.  
  2630.   #--------------------------------------------------------------------------
  2631.   # ? F Skill Usable?
  2632.   #--------------------------------------------------------------------------            
  2633.   def f_skill_usable?(skill)
  2634.       return false if !f_action_usable?
  2635.       return true if self == BattleManager.active_actor
  2636.       return true if skill.id == attack_skill_id
  2637.       return true if f_ground_skill_usable?(skill)
  2638.       return true if f_aerial_skill_usable?(skill)
  2639.       return false
  2640.   end  
  2641.  
  2642.   #--------------------------------------------------------------------------
  2643.   # ? F Ground Skill Usable?
  2644.   #--------------------------------------------------------------------------            
  2645.   def f_ground_skill_usable?(skill)
  2646.       return false if skill.nil?
  2647.       return false if !f_ground?
  2648.       return false if f_flying_type?
  2649.       return true if skill.note =~ /<F Skill Type = All>/
  2650.       return true if skill.note =~ /<F Skill Type = Ground>/      
  2651.       return false
  2652.   end
  2653.  
  2654.   #--------------------------------------------------------------------------
  2655.   # ? F Aerial
  2656.   #--------------------------------------------------------------------------            
  2657.   def f_aerial_skill_usable?(skill)
  2658.       return false if skill.nil?
  2659.       return false if @screen_y > f_ground - (f_jump_height / 4)  
  2660.       return true if skill.note =~ /<F Skill Type = All>/
  2661.       return true if skill.note =~ /<F Skill Type = Aerial>/      
  2662.       return false
  2663.   end  
  2664.    
  2665.   #--------------------------------------------------------------------------
  2666.   # ? F Execute Skill Actor
  2667.   #--------------------------------------------------------------------------            
  2668.   def f_execute_skill_actor(skill_id,target = nil,casting = false)
  2669.       return if !f_action_usable?
  2670.       skill = $data_skills[skill_id] rescue nil
  2671.       return if skill.nil?
  2672.       return if f_cast_action?(skill,casting)
  2673.       type = skill.is_a?(RPG::Skill) ? 0 : 1
  2674.       if [2,3,4,5,6,8,10].include?(skill.scope)
  2675.          BattleManager.f_execute_action(BattleManager.active_actor,skill) if f_execute_skill_conditions_met?(skill,type)
  2676.       elsif (skill.note =~ /<F Auto Target>/ or skill.note =~ /<F Auto Target Area>/) and f_execute_skill_conditions_met?(skill,type)
  2677.          $game_temp.fmb_menu_phase = [true,3,true]
  2678.          $game_temp.f_cursor_data[1] = skill    
  2679.          trg = skill.for_opponent? ? 0 : 1
  2680.          BattleManager.cursor_next_target(0,trg)
  2681.       else  
  2682.          f_execute_skill(skill_id,target)
  2683.       end
  2684.   end
  2685.  
  2686.   #--------------------------------------------------------------------------
  2687.   # ? F Execute Skill B
  2688.   #--------------------------------------------------------------------------            
  2689.   def f_execute_skill_b(skill_id,target = nil,casting = false)
  2690.       return if !f_action_usable?
  2691.       skill = $data_skills[skill_id] rescue nil
  2692.       @f_action_freq[4] = 0
  2693.       return if skill.nil?
  2694.       return if f_cast_action?(skill,casting)
  2695.       f_face_to_target
  2696.       type = skill.is_a?(RPG::Skill) ? 0 : 1
  2697.       if (skill.note =~ /<F Auto Target>/ or skill.note =~ /<F Auto Target Area>/) or [2,3,4,5,6,8,10].include?(skill.scope)
  2698.          BattleManager.f_execute_action(self,skill) if f_execute_skill_conditions_met?(skill,type)
  2699.       else
  2700.          f_execute_skill(skill_id,target)
  2701.       end  
  2702.   end  
  2703.    
  2704.   #--------------------------------------------------------------------------
  2705.   # ? F Execute SKill
  2706.   #--------------------------------------------------------------------------            
  2707.   def f_execute_skill(skill_id,pr_target = nil,type = 0)  
  2708.       skill = $data_skills[skill_id] rescue nil if type == 0
  2709.       skill = $data_items[skill_id] rescue nil if type == 1
  2710.       BattleManager.p_target_near(self) if @f_target.nil?
  2711.       return if !f_skill_usable?(skill)
  2712.       return if !f_execute_skill_conditions_met?(skill,type)
  2713.       return if item_weapon?(skill) and equips[0].nil?      
  2714.       pay_skill_cost(skill) if type == 0
  2715.       pay_item_cost(skill) if type == 1 and !skill.key_item?
  2716.       f_action_clear
  2717.       f_clear_air_dash if f_mov_air_dash?
  2718.       f_set_action_data(skill,pr_target,type)
  2719.   end  
  2720.  
  2721.   #--------------------------------------------------------------------------
  2722.   # ? F Set Action Data
  2723.   #--------------------------------------------------------------------------            
  2724.   def f_set_action_data(skill,pr_target,type)
  2725.       f_set_action(skill.id)
  2726.       @sprite_data[10][0] = false
  2727.       @sprite_data[5][0] = false    
  2728.       @sprite_data[1] = 0
  2729.       item = skill
  2730.       item = equips[0] if item_weapon?(skill) and !equips[0].nil?
  2731.       duration = item.note =~ /<F Duration = (\d+)>/ ? $1.to_i : 60
  2732.       duration = 999 if duration > 999
  2733.       pose_duration = item.note =~ /<F Pose Duration = (\d+)>/ ? $1.to_i : 20
  2734.       pose_duration = 999 if pose_duration > 999
  2735.       pose_index = item.note =~ /<F Pose Index = (\d+)>/ ? $1.to_i : skill.id
  2736.       force_pose = item.note =~ /<F Super Guard>/ ? true : false
  2737.       invn = item.note =~ /<F Invunerable>/ ? true : false
  2738.       refl = item.note =~ /<F Reflect>/ ? true : false
  2739.       @sprite_data[11] = [skill,pose_duration,pose_index,force_pose,invn,refl]
  2740.       @f_action_time[0] = true unless item.note =~ /<F Chain Action = (\d+)>/
  2741.       if item.note =~ /<F User Move = x\s*(\-*\d+)\s* y\s*(\-*\d+)\s*>/
  2742.          xd = f_direction == 0 ? -$1.to_i : $1.to_i
  2743.          yd = $2.to_i
  2744.          @sprite_data[6] = [true,0,0,false,false,0] if yd > 0
  2745.          skill_type = item.note =~ /<F Skill Type = Aerial>/ ? 1 : 0
  2746.          @f_action_m = [true,xd,-yd,skill_type]
  2747.          @sprite_data[6][2] = 1 if skill_type == 1
  2748.        end
  2749.        loop = item.note =~ /<F Loop Pose>/ ? true : false
  2750.        pr_target = @f_a_target if !@f_a_target.nil?
  2751.        @f_action = [true,skill,0,pr_target,type,nil,loop,duration]
  2752.   end
  2753.      
  2754.   #--------------------------------------------------------------------------
  2755.   # ? Item Weapon
  2756.   #--------------------------------------------------------------------------            
  2757.   def item_weapon?(skill)
  2758.       return false if skill.nil?
  2759.       return false if self.is_a?(Game_Enemy)
  2760.       return false if skill.is_a?(RPG::Item)
  2761.       return false if skill.id != attack_skill_id
  2762.       return true
  2763.   end    
  2764.      
  2765.   #--------------------------------------------------------------------------
  2766.   # ? F Execute SKill Condition Met?
  2767.   #--------------------------------------------------------------------------            
  2768.   def f_execute_skill_conditions_met?(skill,type)
  2769.       return false if @f_action_time[0] and !f_flying_type?
  2770.       return false if skill.nil?
  2771.       return false if @f_target.nil?
  2772.       return false if f_mov_acting?
  2773.       return false if !f_movable?
  2774.       return false if $game_temp.fmb_phase_data != [0,0]
  2775.       return false if $game_temp.battle_end
  2776.       return false if f_mov_guarding?
  2777.       if type == 0 and !skill_cost_payable?(skill)
  2778.          Sound.play_mp_cost
  2779.          return false
  2780.       end
  2781.       return true
  2782.   end
  2783.  
  2784.   #--------------------------------------------------------------------------
  2785.   # ? Pay Item Cost
  2786.   #--------------------------------------------------------------------------            
  2787.   def pay_item_cost(item)
  2788.       $game_party.lose_item(item, 1)
  2789.   end
  2790.    
  2791.  #--------------------------------------------------------------------------
  2792.  # ? F Update Force Move
  2793.  #--------------------------------------------------------------------------            
  2794.  def f_update_force_move
  2795.      if @f_action[7] == 0
  2796.         @f_action_m = [false,0,0]
  2797.         @f_action_time[2] = @sprite_data[11][1] + 2
  2798.      end
  2799.      f_move_screen_x(@f_action_m[1])
  2800.      f_move_screen_y(@f_action_m[2])
  2801.      f_clear_jump if f_mov_jumping?
  2802.      if f_ground? and @f_action_m[3] == 1
  2803.         @f_action_time[2] = 10 if @f_action_time[2] == 0
  2804.         f_clear_jump
  2805.         f_action_clear        
  2806.     end
  2807.  end
  2808.  
  2809. end
  2810.  
  2811. #==============================================================================
  2812. # ¦ Game_Battler
  2813. #==============================================================================
  2814. class Game_Battler < Game_BattlerBase
  2815.  
  2816.   #--------------------------------------------------------------------------
  2817.   # ? Update Fmbs Battler Damage
  2818.   #--------------------------------------------------------------------------            
  2819.   def f_update_fmbs_battler_damage
  2820.       @f_damage[0] -= 1
  2821.       @f_damage[2] -= 1
  2822.       @f_damage[7] -= 1
  2823.       f_execute_knockback if f_execute_knokback?
  2824.       return if @f_damage[0] > 0
  2825.       return if @f_knockback[3] > 0
  2826.       f_clear_damage
  2827.   end
  2828.  
  2829.   #--------------------------------------------------------------------------
  2830.   # ? F Clear Damage
  2831.   #--------------------------------------------------------------------------            
  2832.   def f_clear_damage
  2833.       @f_damage = [0,nil,0,false,0,1,7,0,0,0]
  2834.       @f_knockback[2] = 1
  2835.       @f_ai_data[2] = 4 unless f_mov_guarding?
  2836.   end  
  2837.      
  2838.   #--------------------------------------------------------------------------
  2839.   # ? F_execute Knockback?
  2840.   #--------------------------------------------------------------------------            
  2841.   def f_execute_knokback?
  2842.       return false if !f_move_usable?
  2843.       return false if !@f_knockback[0]
  2844.       return false if @f_damage[7] <= 0
  2845.       return false if !@f_damage[3]
  2846.       return false if @f_guard[1]
  2847.       return true
  2848.   end
  2849.    
  2850.   #--------------------------------------------------------------------------
  2851.   # ? F Execute Knockback
  2852.   #--------------------------------------------------------------------------            
  2853.   def f_execute_knockback
  2854.       d = @f_damage[4] == 0 ? @f_damage[5] : -@f_damage[5]
  2855.       d = 0 if @f_damage[4] == 0 and @screen_x < f_limit_x1 + 16
  2856.       d = 0 if @f_damage[4] == 1 and @screen_x > f_limit_x2 - 16
  2857.       if @f_damage[7] > @f_damage[8]
  2858.          f_move_screen_x(-d)
  2859.          f_move_screen_y(-@f_damage[6])
  2860.       else  
  2861.          f_move_screen_y(-f_grv_speed / 2)
  2862.          if @f_knockback[3] > 0
  2863.             f_move_screen_x(-d)
  2864.          else  
  2865.             f_move_screen_x(-(d * 2))
  2866.          end
  2867.       end      
  2868.   end
  2869.  
  2870.   #--------------------------------------------------------------------------
  2871.   # ? Item Apply
  2872.   #--------------------------------------------------------------------------            
  2873.   alias mog_fmbs_item_apply item_apply
  2874.   def item_apply(user, item)
  2875.       return if f_invunerable?
  2876.       return if $game_temp.battle_end
  2877.       de = dead?
  2878.       mog_fmbs_item_apply(user, item)
  2879.       if @result.hit? and $game_system.fmbs_data[0] and SceneManager.scene_is?(Scene_Battle)
  2880.          @f_char_data[3] = true if de != dead? and @f_char_data[0]
  2881.          execute_target_animation(user, item)
  2882.          f_execute_dmg_dead_effect(user,item) if dead?
  2883.          @f_cast_data = [nil,0] if dead? or restriction >= 4
  2884.          @animation_id = $1.to_i if item.note =~ /<F Hit Animation = (\d+)>/
  2885.          if f_execute_knockback?(user,item)
  2886.             f_execute_dmg_effect(user,item)
  2887.             @f_action[1] = nil
  2888.             f_action_clear
  2889.             f_clear_jump if f_mov_jumping?
  2890.             f_clear_air_dash if f_mov_air_dash?
  2891.             f_clear_double_jump if f_mov_double_jump?
  2892.             if item.note =~ /<F Knockback Stun>/
  2893.                @f_knockback[3] = 90
  2894.                @f_damage[5] = 2
  2895.                @f_damage[6] = 5 + f_grv_speed              
  2896.                @f_knockback[3] = @f_damage[0] if @f_knockback[3] < @f_damage[0]
  2897.                $game_temp.f_actor_cursor_d = 90 if self == BattleManager.active_actor
  2898.             end  
  2899.             @f_damage[3] = true if !@f_guard[1]
  2900.          end
  2901.       end
  2902.   end
  2903.  
  2904.   #--------------------------------------------------------------------------
  2905.   # ? F Execute DMG Dead Effect
  2906.   #--------------------------------------------------------------------------            
  2907.   def f_execute_dmg_dead_effect(user,item)
  2908.       BattleManager.p_target_near(user) if self == user.f_target
  2909.       BattleManager.next_actor_index(1) if self == BattleManager.active_actor
  2910.       @f_action[1] = nil
  2911.       f_action_clear
  2912.       f_clear_jump if f_mov_jumping?
  2913.       f_clear_air_dash if f_mov_air_dash?
  2914.       f_clear_double_jump if f_mov_double_jump?
  2915.       if self.is_a?(Game_Enemy)
  2916.          perform_collapse_effect
  2917.       else  
  2918.          Sound.play_actor_collapse
  2919.       end  
  2920.       if user.is_a?(Game_Actor)
  2921.          $game_party.battle_members.each do |bt|
  2922.          next if bt == user  
  2923.          BattleManager.p_target_near(bt) ; end
  2924.       else
  2925.          $game_troop.alive_members.each do |bt|
  2926.          next if bt == user  
  2927.          BattleManager.p_target_near(bt) ; end
  2928.       end
  2929.   end
  2930.  
  2931.   #--------------------------------------------------------------------------
  2932.   # ? F Execute Knockback
  2933.   #--------------------------------------------------------------------------            
  2934.   def f_execute_knockback?(user,item)
  2935.       return false if !f_move_usable?
  2936.       return false if !@f_knockback[0]
  2937.       return false if !item.damage.to_hp?
  2938.       return false if @result.hp_damage <= 0
  2939.       return false if f_super_guard?
  2940.       return false if f_casting?
  2941.       return false if item.note =~ /<F Disable Knockback>/
  2942.       return true
  2943.   end
  2944.  
  2945.   #--------------------------------------------------------------------------
  2946.   # ? F Update Fmbs Battler Inv Duration
  2947.   #--------------------------------------------------------------------------            
  2948.   def f_update_fmbs_battler_inv_duration
  2949.       @f_knockback[1] -= 1 if @f_knockback[1] > 0
  2950.       @f_knockback[2] -= 1 if @f_knockback[2] > 0
  2951.       if @f_knockback[3] > 0
  2952.          @f_knockback[3] -= 1
  2953.          @f_knockback[2] = 5 if @f_knockback[3] == 0
  2954.          @f_ai_data[2] = 4 if @f_knockback[3] == 0
  2955.       end  
  2956.       update_knockback_guard if @f_knockback[4] > 0
  2957.   end
  2958.  
  2959.   #--------------------------------------------------------------------------
  2960.   # ? F Update Knockback Guard
  2961.   #--------------------------------------------------------------------------            
  2962.   def update_knockback_guard
  2963.       @f_knockback[4] -= 1
  2964.       return false if !f_move_usable?
  2965.       d = @f_damage[4] == 0 ? 2 : -2
  2966.       d = 0 if @f_damage[4] == 0 and @screen_x < f_limit_x1 + 16
  2967.       d = 0 if @f_damage[4] == 1 and @screen_x > f_limit_x2 - 16
  2968.       f_move_screen_x(-d)
  2969.   end
  2970.  
  2971.   #--------------------------------------------------------------------------
  2972.   # ? F Execute Dmg Effect
  2973.   #--------------------------------------------------------------------------            
  2974.   def f_execute_dmg_effect(user,item)
  2975.   end  
  2976.    
  2977.   #--------------------------------------------------------------------------
  2978.   # ? Execute Target Animation
  2979.   #--------------------------------------------------------------------------
  2980.   def execute_target_animation(user, item)
  2981.       self.animation_id = @f_damage[9] if @f_damage[9] > 0
  2982.   end  
  2983.  
  2984. end
  2985.  
  2986. #==============================================================================
  2987. # ¦ Game_Battler
  2988. #==============================================================================
  2989. class Game_Battler < Game_BattlerBase
  2990.  
  2991.   #--------------------------------------------------------------------------
  2992.   # ? F Update Fmbs Battler Effect
  2993.   #--------------------------------------------------------------------------            
  2994.   def f_update_fmbs_battler_effect
  2995.       @f_damage_effect[2] += 1
  2996.  
  2997.   end    
  2998.  
  2999. end
  3000.  
  3001. #==============================================================================
  3002. # ¦ Game_Battler
  3003. #==============================================================================
  3004. class Game_Battler < Game_BattlerBase
  3005.  
  3006.   #--------------------------------------------------------------------------
  3007.   # ? F update Ai
  3008.   #--------------------------------------------------------------------------            
  3009.   def f_update_ai?
  3010.      # return false if self.is_a?(Game_Actor)
  3011.      # return false if self.is_a?(Game_Enemy)
  3012.       return false if @f_ai_data[2] > 0
  3013.       return false if self == BattleManager.active_actor
  3014.       return false if @f_target.nil?
  3015.       return false if !f_movable?
  3016.       return false if f_mov_acting?
  3017.       return false if $game_temp.battle_end
  3018.       return false if !$game_temp.f_in_action?
  3019.       return true
  3020.   end  
  3021.  
  3022.   #--------------------------------------------------------------------------
  3023.   # ? F Update AI
  3024.   #--------------------------------------------------------------------------            
  3025.   def f_update_ai
  3026.       f_update_ai_basic_data
  3027.       f_update_ai_guard
  3028.       f_update_ai_movement if f_update_ai_movement?
  3029.   end
  3030.  
  3031.   #--------------------------------------------------------------------------
  3032.   # ? F Update AI Basic Data
  3033.   #--------------------------------------------------------------------------            
  3034.   def f_update_ai_basic_data
  3035.       @f_ai_data[0] -= 1 if @f_ai_data[0] > 0
  3036.       @f_ai_data[1] -= 1 if @f_ai_data[1] > 0  
  3037.   end
  3038.      
  3039. end
  3040.  
  3041. #==============================================================================
  3042. # ¦ Game_Battler
  3043. #==============================================================================
  3044. class Game_Battler < Game_BattlerBase
  3045.  
  3046.   #--------------------------------------------------------------------------
  3047.   # ? F Update Ai Guard
  3048.   #--------------------------------------------------------------------------            
  3049.   def f_update_ai_guard?
  3050.       return false if f_target.f_direction == f_direction
  3051.       return f_target.f_mov_acting?
  3052.   end
  3053.  
  3054.   #--------------------------------------------------------------------------
  3055.   # ? F Update Ai guard
  3056.   #--------------------------------------------------------------------------            
  3057.   def f_update_ai_guard
  3058.       @f_ai_guard[3] -= 1 if @f_ai_guard[3] > 0
  3059.       if f_update_ai_guard?
  3060.          f_set_guard
  3061.          if @f_ai_guard[0]
  3062.             f_face_to_target
  3063.             f_mov_guard
  3064.          end
  3065.        else  
  3066.          @f_ai_guard[0] = false ;  @f_ai_guard[2] = false
  3067.       end
  3068.   end
  3069.  
  3070.   #--------------------------------------------------------------------------
  3071.   # ? F Set Guard
  3072.   #--------------------------------------------------------------------------            
  3073.   def f_set_guard
  3074.       return if @f_ai_guard[2]
  3075.       @f_ai_guard[2] = true
  3076.       @f_ai_guard[0] = rand(100) <= @f_ai_guard[1] ? true : false
  3077.       @f_ai_guard[0] = false if f_ai_guard_exception?
  3078.   end
  3079.  
  3080.   #--------------------------------------------------------------------------
  3081.   # ? F Ai Guarc Exception?
  3082.   #--------------------------------------------------------------------------            
  3083.   def f_ai_guard_exception?
  3084.       return true if @f_ai_guard[1] <= 0
  3085.       return true if !f_on_target_range?(f_distance_dash)
  3086.       return true if f_direction == f_target.f_direction
  3087.       return false
  3088.   end
  3089.      
  3090. end
  3091.  
  3092. #==============================================================================
  3093. # ¦ Game_Battler
  3094. #==============================================================================
  3095. class Game_Battler < Game_BattlerBase
  3096.  
  3097.   #--------------------------------------------------------------------------
  3098.   # ? F Update AI
  3099.   #--------------------------------------------------------------------------            
  3100.   def f_update_ai_movement      
  3101.       if !f_flying_type? and f_mov_jumping? and @screen_y.between?(f_target.screen_y - f_target.f_body_height, f_target.screen_y)
  3102.          type = f_ground? ? 0 : 1
  3103.          skill_id = f_set_action_id(type)
  3104.          f_execute_skill_b(skill_id) if !skill_id.nil?        
  3105.       end
  3106.       f_ai_update_action
  3107.       case @f_ai_data[3][0]
  3108.         when 0 ; f_ai_move_random
  3109.         when 1 ; f_ai_move_to_target
  3110.       end
  3111.   end
  3112.  
  3113.   #--------------------------------------------------------------------------
  3114.   # ? F Update AI Movement?
  3115.   #--------------------------------------------------------------------------            
  3116.   def f_update_ai_movement?
  3117.       return false if @f_ai_data[0] > 0
  3118.       return false if f_mov_guarding?
  3119.       return true      
  3120.   end  
  3121.  
  3122.   #--------------------------------------------------------------------------
  3123.   # ? F Face To Target
  3124.   #--------------------------------------------------------------------------            
  3125.   def f_face_to_target
  3126.       return if !f_move_usable?
  3127.       @sprite_data[3] = @f_target.screen_x > @screen_x ? 1 : 0
  3128.   end  
  3129.  
  3130.   #--------------------------------------------------------------------------
  3131.   # ? F On Target Range
  3132.   #--------------------------------------------------------------------------            
  3133.   def f_on_target_range?(range)
  3134.       range += 32 if @f_target.f_body_width <= 32
  3135.       return false if f_distance_x > range
  3136.       return true
  3137.   end
  3138.  
  3139.   #--------------------------------------------------------------------------
  3140.   # ? F Distance Dash
  3141.   #--------------------------------------------------------------------------            
  3142.   def f_distance_dash
  3143.       240
  3144.   end
  3145.  
  3146.   #--------------------------------------------------------------------------
  3147.   # ? F Distance X
  3148.   #--------------------------------------------------------------------------            
  3149.   def f_distance_x
  3150.       (@f_target.screen_x - @screen_x).abs
  3151.   end
  3152.    
  3153.   #--------------------------------------------------------------------------
  3154.   # ? F Distance Y
  3155.   #--------------------------------------------------------------------------            
  3156.   def f_distance_y
  3157.       (@f_target.screen_y - @screen_y).abs
  3158.   end    
  3159.    
  3160. end
  3161.  
  3162. #==============================================================================
  3163. # ¦ Game_Battler
  3164. #==============================================================================
  3165. class Game_Battler < Game_BattlerBase  
  3166.  
  3167.   #--------------------------------------------------------------------------
  3168.   # ? F A.I Move To Target
  3169.   #--------------------------------------------------------------------------            
  3170.   def f_ai_move_to_target
  3171.       f_face_to_target      
  3172.       if f_move_to_target?
  3173.          f_mov_dash if !f_on_target_range?(f_distance_dash)
  3174.          f_mov_side(@sprite_data[3])
  3175.       else
  3176.          @f_ai_data[3][0] = 0
  3177.          @f_ai_data[3][1] = 0
  3178.          @f_ai_data[3][2] = 2
  3179.       end  
  3180.   end  
  3181.  
  3182.   #--------------------------------------------------------------------------
  3183.   # ? F Move To Target?
  3184.   #--------------------------------------------------------------------------            
  3185.   def f_move_to_target?
  3186.       return true if !f_on_target_range?(@f_target.f_body_width2 + 16)
  3187.       return false
  3188.   end
  3189.    
  3190. end
  3191.  
  3192. #==============================================================================
  3193. # ¦ Game_Battler
  3194. #==============================================================================
  3195. class Game_Battler < Game_BattlerBase
  3196.  
  3197.   #--------------------------------------------------------------------------
  3198.   # ? F Update AI Random
  3199.   #--------------------------------------------------------------------------            
  3200.   def f_ai_move_random
  3201.       @f_ai_data[3][1] += 1
  3202.       @f_ai_data[3][1] = 0 if @f_ai_data[3][1] > @f_action_freq[0]
  3203.       f_ai_set_random_move if @f_ai_data[3][1] == 0
  3204.       f_ai_forward_random
  3205.   end
  3206.      
  3207.   #--------------------------------------------------------------------------
  3208.   # ? F AI Set Random Move
  3209.   #--------------------------------------------------------------------------            
  3210.   def f_ai_set_random_move
  3211.       f_face_to_target
  3212.       @f_ai_data[3][2] = rand(4)
  3213.       @f_ai_data[3][3] += 1
  3214.       if @f_ai_data[3][3] > @f_action_freq[1]
  3215.          @f_ai_data[3][3] = 0
  3216.          @f_ai_data[3][0] = 1
  3217.          BattleManager.p_target_near(self)
  3218.          f_face_to_target
  3219.       end
  3220.   end  
  3221.  
  3222.   #--------------------------------------------------------------------------
  3223.   # ? F Ai Forward Random
  3224.   #--------------------------------------------------------------------------            
  3225.   def f_ai_forward_random
  3226.       unless @f_ai_data[3][2] >= 2
  3227.         f_mov_dash if !f_on_target_range?(f_distance_dash)
  3228.         f_mov_side(@f_ai_data[3][2])
  3229.       end  
  3230.       if (@screen_x <= f_limit_x1 or @screen_x >= f_limit_x2)
  3231.           f_face_to_target
  3232.           @f_ai_data[3][1] = @f_action_freq[0]
  3233.       end    
  3234.   end
  3235.  
  3236. end
  3237.  
  3238. #==============================================================================
  3239. # ¦ Game_Battler
  3240. #==============================================================================
  3241. class Game_Battler < Game_BattlerBase
  3242.  
  3243.   #--------------------------------------------------------------------------
  3244.   # ? F Ai Update Action
  3245.   #--------------------------------------------------------------------------            
  3246.   def f_ai_update_action
  3247.       @f_action_freq[4] += 1
  3248.       return if @f_action_freq[4] < @f_action_freq[5]
  3249.       @f_action_freq[4] = 0
  3250.       f_ai_prepare_action
  3251.   end
  3252.  
  3253.   #--------------------------------------------------------------------------
  3254.   # ? F AI Prepare Action
  3255.   #--------------------------------------------------------------------------            
  3256.   def f_ai_prepare_action
  3257.       f_face_to_target
  3258.       if !f_flying_type? and f_jump_usable? and @f_target.screen_y < (f_ground - @f_target.f_body_height)
  3259.          lskill = f_set_skill_type
  3260.          unless (lskill == @revive_list or lskill == @recover_list)
  3261.            f_mov_jump
  3262.            return
  3263.          end
  3264.       end
  3265.       type = f_ground? ? 0 : 1
  3266.       if f_on_target_range?(@f_target.f_body_width + 16)
  3267.          skill_id = f_set_action_id(type)
  3268.          if skill_id.nil?
  3269.             if f_jump_usable?
  3270.                f_mov_jump if @f_target.screen_y < (f_ground - (@f_target.f_body_height + 24))
  3271.             else
  3272.                return if @f_target.screen_y < (f_ground - (@f_target.f_body_height + 24))
  3273.             end            
  3274.             f_execute_skill_b(attack_skill_id)
  3275.          else  
  3276.             f_atk = rand(100)
  3277.             skid = f_atk < 70 ? skill_id : attack_skill_id
  3278.             f_execute_skill_b(skid)
  3279.          end
  3280.       else    
  3281.          skill_id = f_set_action_id(type)
  3282.          f_execute_skill_b(skill_id) if !skill_id.nil?          
  3283.       end
  3284.   end
  3285.  
  3286.   #--------------------------------------------------------------------------
  3287.   # ? F Set Action ID
  3288.   #--------------------------------------------------------------------------            
  3289.   def f_set_action_id(type)
  3290.       action_list = f_set_skill_type
  3291.       return nil if action_list.empty?
  3292.       r_list = []
  3293.       action_list.each do |s| r_list.push(s) if f_usable_action?(s,type) end
  3294.       return nil if r_list.empty?
  3295.       if self.is_a?(Game_Enemy)
  3296.          action_list = enemy.actions.select {|a| action_valid?(a)}
  3297.          new_r_list = []
  3298.          action_list.sort! {|a,b| b.rating - a.rating }
  3299.          action_list.each do |s|
  3300.                skill = $data_skills[s.skill_id]
  3301.                if r_list.include?(skill)
  3302.                   new_r_list.push(skill)
  3303.                   return skill.id if rand(10) < s.rating
  3304.                end  
  3305.          end
  3306.          r_list = new_r_list
  3307.       end
  3308.       return nil if r_list.empty?
  3309.       sk = rand(r_list.size)
  3310.       return r_list[sk].id
  3311.   end      
  3312.  
  3313. end
  3314.  
  3315. #==============================================================================
  3316. # ¦ Game_Battler
  3317. #==============================================================================
  3318. class Game_Battler < Game_BattlerBase
  3319.  
  3320.   #--------------------------------------------------------------------------
  3321.   # ? F Make Skill List
  3322.   #--------------------------------------------------------------------------            
  3323.   def f_make_skill_list
  3324.       @skill_list = []
  3325.       if self.is_a?(Game_Enemy)
  3326.          enemy.actions.each do |e|
  3327.             next if e.nil?
  3328.             next if e.skill_id == 0          
  3329.             @skill_list.push($data_skills[e.skill_id])
  3330.          end
  3331.       else  
  3332.          @f_equipped_skill.each do |e|
  3333.             next if e.nil?
  3334.             next if e == 0
  3335.             @skill_list.push($data_skills[e])
  3336.          end
  3337.          @skill_list.push($data_skills[attack_skill_id])
  3338.       end    
  3339.       f_make_type_list
  3340.   end
  3341.  
  3342.   #--------------------------------------------------------------------------
  3343.   # ? F Make Type List
  3344.   #--------------------------------------------------------------------------            
  3345.   def f_make_type_list
  3346.       @normal_list = []
  3347.       @recover_list = []
  3348.       @revive_list = []
  3349.       @skill_list.each do |s|
  3350.          rev = false
  3351.          s.effects.each do |e|            
  3352.              if (e.code == 22 and e.data_id == death_state_id)          
  3353.                 @revive_list.push(s)
  3354.                 rev = true
  3355.               end  
  3356.           end
  3357.           next if rev
  3358.           if s.damage.type == 3
  3359.              @recover_list.push(s)                
  3360.           else
  3361.              @normal_list.push(s)
  3362.           end              
  3363.       end
  3364.   end
  3365.  
  3366.   #--------------------------------------------------------------------------
  3367.   # ? F Make Type List
  3368.   #--------------------------------------------------------------------------            
  3369.   def f_set_skill_type
  3370.       n_recover = false ; n_revive = false
  3371.       if self.is_a?(Game_Actor)
  3372.          allies_targets = $game_party.battle_members
  3373.       else
  3374.          allies_targets = $game_troop.alive_members
  3375.       end        
  3376.       allies_targets.each do |b|
  3377.           n_revive = true if b.dead?
  3378.           n_recover = true if !b.dead? and b.hp <= b.mhp * 40 / 100          
  3379.       end
  3380.       return @revive_list if !@revive_list.empty? and n_revive
  3381.       return @recover_list if !@recover_list.empty? and n_recover
  3382.       return @normal_list
  3383.   end
  3384.    
  3385. end
  3386.  
  3387. #==============================================================================
  3388. # ¦ Game_Battler
  3389. #==============================================================================
  3390. class Game_Battler < Game_BattlerBase
  3391.  
  3392.   #--------------------------------------------------------------------------
  3393.   # ? F Usable Action?
  3394.   #--------------------------------------------------------------------------            
  3395.   def f_usable_action?(skill,type)
  3396.       return false if skill.nil?
  3397.       return false if !skill_cost_payable?(skill)
  3398.       return true if skill.note =~ /<F Auto Target Area>/
  3399.       return true if skill.note =~ /<F Auto Target>/
  3400.       unless (skill.id == attack_skill_id or skill.id <= 0)
  3401.           return false if skill.note =~ /<F Skill Type = Aerial>/ and type == 0
  3402.           return false if skill.note =~ /<F Skill Type = Ground>/ and type == 1
  3403.       end
  3404.       return false if !f_target_in_range?(skill,type)
  3405.       return true
  3406.   end
  3407.  
  3408.   #--------------------------------------------------------------------------
  3409.   # ? F Skill Range
  3410.   #--------------------------------------------------------------------------            
  3411.   def f_skill_range(item)
  3412.       sp = [0,0] ; sr = [@screen_x,@screen_y,0,0] ; d = 60
  3413.       if item.note =~ /<F Duration = (\d+)>/
  3414.          d = $1.to_i ; d = 999 if d > 999
  3415.       end
  3416.       d -= 5 ; d = 1 if d < 1
  3417.        if item.note =~ /<F Move Speed = x\s*(\-*\d+)\s* y\s*(\-*\d+)\s*>/        
  3418.          dx = @sprite_data[3] == 0 ? -$1.to_i : $1.to_i
  3419.          dy = $2.to_i
  3420.          pr = [d * dx,d * dy]
  3421.          sr[0] += pr[0]
  3422.          sr[1] += pr[1]
  3423.          sr[2] = $1.to_i.abs
  3424.          sr[3] = $2.to_i.abs
  3425.       elsif item.note =~ /<F User Move = x\s*(\-*\d+)\s* y\s*(\-*\d+)\s*>/
  3426.          dx = @sprite_data[3] == 0 ? -$1.to_i : $1.to_i
  3427.          dy = $2.to_i
  3428.          pr = [d * dx,d * dy]
  3429.          sr[0] += pr[0]
  3430.          sr[1] += -pr[1]
  3431.          sr[2] = $1.to_i.abs
  3432.          sr[3] = $2.to_i.abs        
  3433.       end  
  3434.       return sr    
  3435.   end  
  3436.  
  3437.   #--------------------------------------------------------------------------
  3438.   # ? Target In Range
  3439.   #--------------------------------------------------------------------------            
  3440.   def f_target_in_range?(skill,type)
  3441.       return false if !skill_cost_payable?(skill)
  3442.       item = skill
  3443.       item = self.equips[0] if item_weapon?(skill) and !self.equips[0].nil?
  3444.       # Around --------------------------------------------------------------
  3445.       if (@screen_x.between?(f_target.screen_x - f_target.f_body_width,f_target.screen_x + f_target.f_body_width) and
  3446.          @screen_y.between?(f_target.screen_y - f_target.f_body_height,f_target.screen_y + f_target.f_body_height2))
  3447.          return true
  3448.       end  
  3449.       # ---------------------------------------------------------------------
  3450.       br = f_skill_range(item) ; sr = [0,0,0,0] ; f_range = [0,0,0,0]
  3451.       if br[1].between?(@screen_y - 64,@screen_y)
  3452.       if br[0] >= @screen_x and f_target.screen_x.between?(@screen_x, br[0]) and
  3453.          f_target.screen_y.between?(@screen_y - f_body_height,@screen_y)
  3454.          return true
  3455.       elsif br[0] < @screen_x and f_target.screen_x.between?(br[0],@screen_x) and
  3456.          f_target.screen_y.between?(@screen_y - f_body_height,@screen_y)
  3457.          return true
  3458.       end    
  3459.      end
  3460.       if br[0].between?(@screen_x - f_body_width,@screen_x + f_body_width)
  3461.       if br[1] >= @screen_y and f_target.screen_y.between?(@screen_y + 16, br[1] + f_target.f_body_height) and
  3462.          f_target.screen_x.between?(@screen_x - f_body_width2, @screen_x + f_body_width2)
  3463.          return true
  3464.       elsif br[1] < @screen_y and f_target.screen_y.between?(br[1] + 16, @screen_y + f_target.f_body_height) and
  3465.          f_target.screen_x.between?(@screen_x - f_body_width2, @screen_x + f_body_width2)
  3466.          return true
  3467.       end  
  3468.       end
  3469.       if item.note =~ /<F Area = \s*(\-*\d+)\s* - \s*(\-*\d+)\s* - \s*(\-*\d+)\s* - \s*(\-*\d+)\s*>/
  3470.          f_range = [$1.to_i.abs,$2.to_i.abs,$3.to_i.abs,$4.to_i.abs]  
  3471.       end  
  3472.      
  3473.       if @sprite_data[3] == 0
  3474.          sr[0] = f_target.screen_x - (f_target.f_body_width2 + f_range[1])
  3475.          sr[1] = f_target.screen_x + (f_target.f_body_width2 + f_range[0])
  3476.       else
  3477.          sr[0] = f_target.screen_x - (f_target.f_body_width2 + f_range[0])
  3478.          sr[1] = f_target.screen_x + (f_target.f_body_width2 + f_range[1])
  3479.       end  
  3480.       sr[2] = f_target.screen_y + f_range[2]
  3481.       sr[3] = f_target.screen_y - (f_target.f_body_height + f_range[3])
  3482.      
  3483.       # B Start & End ---------------------------------------------
  3484.       index_range = 0
  3485.       5.times do
  3486.         index_range += 1
  3487.         xr = br[0] / index_range
  3488.         yr = br[1] / index_range
  3489.         return true if xr.between?(sr[0],sr[1]) and yr.between?(sr[3] - 16,sr[2])
  3490.       end  
  3491.       return false
  3492.       # -----------------------------------------------------------
  3493.  
  3494.       # B Real ---------------------------------------------------
  3495.       return false if !br[0].between?(sr[0],sr[1])
  3496.       unless (f_flying_type? and item.is_a?(RPG::Skill) and item.id == attack_skill_id)
  3497.          return false if !br[1].between?(sr[3] - 32,sr[2] + 32)
  3498.       end    
  3499.       return true
  3500.       # -----------------------------------------------------------
  3501.   end      
  3502.  
  3503. end
  3504.  
  3505. #==============================================================================
  3506. # ¦ Game Enemy
  3507. #==============================================================================
  3508. class Game_Enemy < Game_Battler
  3509.  
  3510.   #--------------------------------------------------------------------------
  3511.   # ? Initialize
  3512.   #--------------------------------------------------------------------------            
  3513.   alias mog_fmbs_initialize initialize
  3514.   def initialize(index, enemy_id)
  3515.       mog_fmbs_initialize(index, enemy_id)
  3516.       set_fmbs_initial_parameters(enemy)
  3517.   end
  3518.  
  3519. end
  3520.  
  3521. #==============================================================================
  3522. # ¦ Game Actor
  3523. #==============================================================================
  3524. class Game_Actor < Game_Battler
  3525.  
  3526.   attr_accessor :screen_x
  3527.   attr_accessor :screen_y
  3528.  
  3529.   #--------------------------------------------------------------------------
  3530.   # ? Setup
  3531.   #--------------------------------------------------------------------------            
  3532.   alias mog_fmbs_setup setup
  3533.   def setup(actor_id)
  3534.       mog_fmbs_setup(actor_id)
  3535.       @screen_x = 0 ; @screen_y = 0
  3536.       set_fmbs_initial_parameters(actor)
  3537.   end
  3538.  
  3539.   #--------------------------------------------------------------------------
  3540.   # ? Use Sprite?
  3541.   #--------------------------------------------------------------------------            
  3542.   def use_sprite?
  3543.       return true
  3544.   end
  3545.  
  3546.   #--------------------------------------------------------------------------
  3547.   # ? Screen Z
  3548.   #--------------------------------------------------------------------------            
  3549.   def screen_z
  3550.       return 110
  3551.   end  
  3552.    
  3553.   #--------------------------------------------------------------------------
  3554.   # ? Perform Collapse Effect
  3555.   #--------------------------------------------------------------------------            
  3556.   def perform_collapse_effect
  3557.       if $game_party.in_battle
  3558.          Sound.play_actor_collapse
  3559.       end
  3560.   end  
  3561.  
  3562. end
  3563.  
  3564. #==============================================================================
  3565. # ¦ Scene Battle
  3566. #==============================================================================
  3567. class Scene_Battle < Scene_Base
  3568.  
  3569.   #--------------------------------------------------------------------------
  3570.   # ? Battle Start
  3571.   #--------------------------------------------------------------------------            
  3572.   alias mog_fmbs_battle_start battle_start
  3573.   def battle_start
  3574.       if $game_system.fmbs_data[0] ; setup_fmbs_initial ; return ; end
  3575.       mog_fmbs_battle_start
  3576.   end
  3577.  
  3578.   #--------------------------------------------------------------------------
  3579.   # ? Battle Start
  3580.   #--------------------------------------------------------------------------            
  3581.   def setup_fmbs_initial
  3582.       @f_turn_phase = [0,MOG_LMBS::TURN_DURATION]
  3583.       if $game_party.members.empty?
  3584.          if $BTEST
  3585.             BattleManager.process_abort
  3586.             return
  3587.          end  
  3588.          $game_party.on_battle_end
  3589.          $game_troop.on_battle_end
  3590.          BattleManager.replay_bgm_and_bgs        
  3591.          SceneManager.return
  3592.          return
  3593.       end
  3594.       $game_temp.f_actor_cursor_d = 120
  3595.       $game_temp.battle_end = false
  3596.       $game_party.on_battle_start
  3597.       $game_troop.on_battle_start    
  3598.       $game_system.f_turn_data = [0,MOG_LMBS::STATES_TURN_DURATION,0]
  3599.       BattleManager.next_actor_index(0)
  3600.       $game_temp.f_fmbs_clear
  3601.       $game_temp.fmb_phase_end = 0
  3602.       @spriteset.battler_sprites.each do |battler|
  3603.            next if battler.battler.nil?
  3604.            battler.battler.set_initial_f_data
  3605.            battler.battler.set_equip_data
  3606.            battler.battler.sprite_data[3] = 1 if battler.battler.is_a?(Game_Actor)
  3607.            battler.battler.screen_y = battler.battler.f_ground if battler.battler.f_mov_unconscious?
  3608.            battler.battler.f_sprite_fade = [false,0]
  3609.            battler.battler.f_make_skill_list
  3610.            battler.battler.f_target = $game_troop.alive_members[0] if battler.battler.is_a?(Game_Actor)
  3611.            battler.battler.f_target = BattleManager.active_actor if battler.battler.is_a?(Game_Enemy)
  3612.       end
  3613.       process_event
  3614.       BattleManager.judge_win_loss
  3615.   end
  3616.  
  3617.   #--------------------------------------------------------------------------
  3618.   # ? Terminate
  3619.   #--------------------------------------------------------------------------            
  3620.   alias mog_fmbs_scenebattle_terminate terminate
  3621.   def terminate
  3622.       mog_fmbs_scenebattle_terminate
  3623.       $game_party.battle_members.each do |battler| battler.set_initial_f_data end
  3624.       $game_temp.fmb_phase_end = 0
  3625.   end  
  3626.  
  3627.   #--------------------------------------------------------------------------
  3628.   # ? Actor
  3629.   #--------------------------------------------------------------------------            
  3630.   def actor
  3631.       return BattleManager.active_actor
  3632.   end
  3633.  
  3634.   #--------------------------------------------------------------------------
  3635.   # ? Update Basic
  3636.   #--------------------------------------------------------------------------            
  3637.   alias mog_fmbs_update update
  3638.   def update
  3639.       update_fmbs_turn if update_fmbs_turn?
  3640.       if $game_system.fmbs_data[0] ; update_basic ; return ; end
  3641.       mog_fmbs_update
  3642.   end
  3643.  
  3644.   #--------------------------------------------------------------------------
  3645.   # ? Update Basic
  3646.   #--------------------------------------------------------------------------            
  3647.   alias mog_fmbs_update_basic update_basic
  3648.   def update_basic
  3649.       update_fmbs_update if $game_system.fmbs_data[0]
  3650.       mog_fmbs_update_basic
  3651.   end
  3652.  
  3653.   #--------------------------------------------------------------------------
  3654.   # ? Update FMBS Update
  3655.   #--------------------------------------------------------------------------            
  3656.   def update_fmbs_update
  3657.       if $game_temp.fmb_menu_phase[0]
  3658.          update_fmbs_menu_phase
  3659.       else
  3660.          update_fmbs_commands if update_fmbs_basic_commands?
  3661.          update_fmbs_system
  3662.       end
  3663.   end
  3664.  
  3665.   #--------------------------------------------------------------------------
  3666.   # ? Update FMBS Basic Commands?
  3667.   #--------------------------------------------------------------------------            
  3668.   def update_fmbs_basic_commands?
  3669.       return false if !$game_temp.f_in_action?
  3670.       return false if actor.nil?
  3671.       return false if actor.restriction != 0
  3672.       return false if $game_temp.fmb_phase_data[1] > 0
  3673.       return false if $game_temp.fmb_phase_data[0] != 0
  3674.       return true
  3675.   end
  3676.  
  3677.   #--------------------------------------------------------------------------
  3678.   # ? Update FMBS Commands
  3679.   #--------------------------------------------------------------------------            
  3680.   def update_fmbs_commands
  3681.       if Input.trigger?(MOG_LMBS::MENU_BUTTON)
  3682.          f_active_menu if f_active_menu?
  3683.       else
  3684.          update_fmbs_com_dash
  3685.          update_fmbs_com_guard
  3686.          update_fmbs_com_attack
  3687.          update_fmbs_com_skills
  3688.          update_fmbs_com_movement
  3689.       end
  3690.   end
  3691.  
  3692.   #--------------------------------------------------------------------------
  3693.   # ? Update FMBS Com Attack
  3694.   #--------------------------------------------------------------------------            
  3695.   def update_fmbs_com_attack
  3696.       actor.f_execute_attack_skill if Input.trigger?(MOG_LMBS::ATTACK_BUTTON)  
  3697.   end
  3698.  
  3699.   #--------------------------------------------------------------------------
  3700.   # ? Update FMBS Com Skills
  3701.   #--------------------------------------------------------------------------            
  3702.   def update_fmbs_com_skills
  3703.       actor.f_execute_skill_command if Input.trigger?(MOG_LMBS::SKILL_BUTTON)  
  3704.   end
  3705.  
  3706.   #--------------------------------------------------------------------------
  3707.   # ? Update FMBS Com Guard
  3708.   #--------------------------------------------------------------------------            
  3709.   def update_fmbs_com_guard
  3710.       actor.f_mov_guard if Input.press?(MOG_LMBS::GUARD_BUTTON)    
  3711.   end
  3712.  
  3713.   #--------------------------------------------------------------------------
  3714.   # ? Update Fmbs Com Dash
  3715.   #--------------------------------------------------------------------------            
  3716.   def update_fmbs_com_dash
  3717.        actor.f_mov_air_dash if Input.trigger?(MOG_LMBS::DASH_BUTTON)
  3718.        actor.f_mov_dash if Input.press?(MOG_LMBS::DASH_BUTTON)
  3719.   end
  3720.  
  3721.   #--------------------------------------------------------------------------
  3722.   # ? Update FMBS System
  3723.   #--------------------------------------------------------------------------            
  3724.   def update_fmbs_system
  3725.       return if $game_temp.battle_end
  3726.       $game_temp.f_escape_phase[1] -= 1 if $game_temp.f_escape_phase[1] > 0
  3727.       update_fmbs_phase_temp if $game_temp.fmb_phase_data[1] > 0
  3728.   end
  3729.  
  3730.   #--------------------------------------------------------------------------
  3731.   # ? Update FMBS Phase Temp
  3732.   #--------------------------------------------------------------------------            
  3733.   def update_fmbs_phase_temp
  3734.       $game_temp.fmb_phase_data[1] -= 1
  3735.       return if $game_temp.fmb_phase_data[1] > 0
  3736.       if $game_temp.fmb_phase_data[0] == 1
  3737.           BattleManager.f_targets.each do |sprite|
  3738.               next if sprite.battler.nil?
  3739.               next if sprite.battler.dead?
  3740.               sprite.battler.f_clear_poses
  3741.               sprite.battler.f_action_clear
  3742.           end          
  3743.          $game_temp.battle_end = true ; BattleManager.judge_win_loss
  3744.       end  
  3745.   end
  3746.  
  3747.   #--------------------------------------------------------------------------
  3748.   # ? Update FMBS Com Movement
  3749.   #--------------------------------------------------------------------------            
  3750.   def update_fmbs_com_movement
  3751.       update_fmbs_next_actor
  3752.       if Input.press?(:DOWN)
  3753.          actor.f_move(0)
  3754.       else
  3755.          if Input.press?(:LEFT)
  3756.             actor.f_move(2)      
  3757.          elsif Input.press?(:RIGHT)
  3758.             actor.f_move(3)
  3759.          end
  3760.          actor.f_mov_double_jump if Input.trigger?(:UP)
  3761.          actor.f_move(1) if Input.press?(:UP)
  3762.       end  
  3763.   end
  3764.  
  3765.   #--------------------------------------------------------------------------
  3766.   # ? Update FMBS Next Actor
  3767.   #--------------------------------------------------------------------------            
  3768.   def update_fmbs_next_actor
  3769.       if Input.trigger?(:L)
  3770.          actr = BattleManager.active_actor
  3771.          Sound.play_cursor
  3772.          BattleManager.next_actor_index(-1)
  3773.          next_actor_effect if actr != BattleManager.active_actor
  3774.        elsif Input.trigger?(:R)
  3775.          actr = BattleManager.active_actor
  3776.          Sound.play_cursor  
  3777.          BattleManager.next_actor_index(1)
  3778.          next_actor_effect if actr != BattleManager.active_actor
  3779.       end  
  3780.   end  
  3781.  
  3782.   #--------------------------------------------------------------------------
  3783.   # ? Next Actor Effect
  3784.   #--------------------------------------------------------------------------            
  3785.   def next_actor_effect    
  3786.   end
  3787.  
  3788. end
  3789.  
  3790. #==============================================================================
  3791. # ¦ Game Troop
  3792. #==============================================================================
  3793. class Game_Troop < Game_Unit
  3794.  
  3795.   #--------------------------------------------------------------------------
  3796.   # ? Execute Process Event?
  3797.   #--------------------------------------------------------------------------        
  3798.   def execute_process_event?
  3799.       return true if $game_temp.common_event_reserved?
  3800.       return false if @interpreter.running?      
  3801.       return false if @interpreter.setup_reserved_common_event
  3802.       troop.pages.each do |page|
  3803.          next unless conditions_met?(page)
  3804.          @current_page = page
  3805.          return true
  3806.       end    
  3807.       return false
  3808.     end  
  3809.    
  3810. end
  3811.  
  3812. #==============================================================================
  3813. # ¦ Scene Battle
  3814. #==============================================================================
  3815. class Scene_Battle < Scene_Base
  3816.  
  3817.  #--------------------------------------------------------------------------
  3818.  # ? Update FMBS turn
  3819.  #--------------------------------------------------------------------------            
  3820.  def update_fmbs_turn
  3821.      @f_turn_phase[0] += 1
  3822.      return if @f_turn_phase[0] < @f_turn_phase[1]
  3823.   @f_turn_phase[0] = 0
  3824.      $game_troop.increase_turn
  3825.      return if !$game_troop.execute_process_event?
  3826.      @spriteset.battler_sprites.each do |battler|
  3827.            next if battler.battler.nil?
  3828.            battler.battler.f_action[1] = nil
  3829.            battler.battler.f_action_clear
  3830.            battler.fmbs_skills_clear
  3831.      end    
  3832.      process_event
  3833.  end
  3834.    
  3835.  #--------------------------------------------------------------------------
  3836.  # ? Update FMBS turn?
  3837.  #--------------------------------------------------------------------------            
  3838.  def update_fmbs_turn?
  3839.      return false if @f_turn_phase.nil?
  3840.      return false if actor.nil?
  3841.      return false if $game_temp.fmb_menu_phase[0]
  3842.      return false if !$game_temp.f_in_action?
  3843.      return false if $game_troop.interpreter.running?
  3844.      return true
  3845.  end
  3846.  
  3847. end
  3848.  
  3849. #==============================================================================
  3850. # ¦ Scene Battle
  3851. #==============================================================================
  3852. class Scene_Battle < Scene_Base
  3853.  
  3854.   #--------------------------------------------------------------------------
  3855.   # ? Create All Window
  3856.   #--------------------------------------------------------------------------            
  3857.   alias mog_fmbs_create_all_windows create_all_windows
  3858.   def create_all_windows
  3859.       mog_fmbs_create_all_windows
  3860.       create_fmbs_window
  3861.       create_fmbs_actor_skill_window  
  3862.       create_fmbs_status_skill_window
  3863.   end
  3864.  
  3865.   #--------------------------------------------------------------------------
  3866.   # ? Create All Window
  3867.   #--------------------------------------------------------------------------            
  3868.   def create_fmbs_window
  3869.       @fmbs_window = Fmbs_Window.new
  3870.     # @fmbs_window.set_handler(:f_skill_window, method(:f_active_window_skill))
  3871.       @fmbs_window.set_handler(:f_item_window, method(:f_active_window_item))
  3872.       @fmbs_window.set_handler(:f_equip_skill, method(:f_equip_skill))
  3873.     # @fmbs_window.set_handler(:f_change_target, method(:f_change_target))
  3874.   end
  3875.  
  3876.   #--------------------------------------------------------------------------
  3877.   # ? Create FMBS Actor Skill
  3878.   #--------------------------------------------------------------------------            
  3879.   def create_fmbs_actor_skill_window
  3880.       @fmbs_actor_skill_window = F_Actor_Skill_Window.new(@help_window)
  3881.       wd = Graphics.width - @fmbs_actor_skill_window.width
  3882.       @fmbs_skill_list_window = F_ESkill_List_Window.new(@help_window,@fmbs_actor_skill_window.width,@fmbs_actor_skill_window.y,wd,@fmbs_actor_skill_window.height)
  3883.   end
  3884.  
  3885.   #--------------------------------------------------------------------------
  3886.   # * Create Status Window
  3887.   #--------------------------------------------------------------------------
  3888.   def create_fmbs_status_skill_window
  3889.       @f_status_window = Window_SkillStatus.new(0,0)
  3890.       @f_status_window.z = 300
  3891.       @f_status_window.y = Graphics.height - @f_status_window.height
  3892.       @f_status_window.width = Graphics.width
  3893.       @f_status_window.actor = BattleManager.active_actor
  3894.       @f_status_window.visible = false
  3895.   end    
  3896.  
  3897.   #--------------------------------------------------------------------------
  3898.   # ? F Active Menu?
  3899.   #--------------------------------------------------------------------------            
  3900.   def f_active_menu?
  3901.       return false if !actor.f_movable?
  3902.       return false if actor.f_casting?
  3903.       return true
  3904.   end
  3905.  
  3906.   #--------------------------------------------------------------------------
  3907.   # ? F Active Menu
  3908.   #--------------------------------------------------------------------------            
  3909.   def update_fmbs_menu_phase
  3910.       $game_temp.f_actor_cursor_d = 120
  3911.       case $game_temp.fmb_menu_phase[1]
  3912.          when 0 ; update_menu_selection
  3913.          when 1 ; update_skill_selection
  3914.          when 2 ; update_item_selection
  3915.          when 3 ; update_target_selection_skill
  3916.          when 4 ; update_target_selection_item
  3917.          when 5 ; update_equip_skill
  3918.          when 6 ; update_equip_skill_2
  3919.          when 7 ; update_change_target
  3920.       end
  3921.   end
  3922.  
  3923.   #--------------------------------------------------------------------------
  3924.   # ? Update Menu Selection
  3925.   #--------------------------------------------------------------------------            
  3926.   def update_menu_selection
  3927.       if Input.trigger?(:B)  
  3928.          $game_temp.fmb_menu_phase = [false,0,false]
  3929.          @fmbs_window.end
  3930.          @f_status_window.hide
  3931.       elsif Input.trigger?(:L)
  3932.          Sound.play_cursor
  3933.          BattleManager.next_actor_index(-1)
  3934.          @f_status_window.actor = BattleManager.active_actor
  3935.       elsif Input.trigger?(:R)
  3936.          Sound.play_cursor  
  3937.          BattleManager.next_actor_index(1)
  3938.          @f_status_window.actor = BattleManager.active_actor
  3939.       end
  3940.   end
  3941.  
  3942.   #--------------------------------------------------------------------------
  3943.   # ? CM Picture Visible?
  3944.   #--------------------------------------------------------------------------            
  3945.   if $imported[:actor_picture_cm]
  3946.   alias mog_fmbs_can_cm_picture_visible? can_cm_picture_visible?
  3947.   def can_cm_picture_visible?
  3948.       return false if $game_system.fmbs_data[0]
  3949.       mog_fmbs_can_cm_picture_visible?
  3950.   end
  3951.   end
  3952.  
  3953.   #--------------------------------------------------------------------------
  3954.   # ? F Change Target
  3955.   #--------------------------------------------------------------------------
  3956.   def f_change_target
  3957.       $game_temp.fmb_menu_phase[1] = 7
  3958.       BattleManager.cursor_next_target(0,0)
  3959.       @fmbs_window.end
  3960.   end
  3961.  
  3962.   #--------------------------------------------------------------------------
  3963.   # ? Update Change Target
  3964.   #--------------------------------------------------------------------------
  3965.   def update_change_target
  3966.       if Input.trigger?(:B)
  3967.          $game_temp.fmb_menu_phase = [true,0,false]
  3968.          @fmbs_window.start
  3969.          @fmbs_window.select(3)  
  3970.        elsif Input.trigger?(:C)
  3971.          BattleManager.active_actor.f_target = $game_temp.f_cursor_target
  3972.          BattleManager.f_clear_command_selection
  3973.        else  
  3974.          if Input.trigger?(:LEFT) or Input.trigger?(:UP)
  3975.             BattleManager.cursor_next_target(-1,0)
  3976.          elsif Input.trigger?(:RIGHT) or Input.trigger?(:DOWN)
  3977.             BattleManager.cursor_next_target(1,0)
  3978.          end          
  3979.          
  3980.       end  
  3981.   end
  3982.  
  3983. end
  3984.  
  3985. #==============================================================================
  3986. # ¦ Window BattleSkill
  3987. #==============================================================================
  3988. class Window_BattleSkill < Window_SkillList
  3989.  
  3990.   #--------------------------------------------------------------------------
  3991.   # ? Include?
  3992.   #--------------------------------------------------------------------------            
  3993.   alias mog_fmbs_include? include?
  3994.   def include?(item)
  3995.       if $game_system.fmbs_data[0] and SceneManager.scene_is?(Scene_Battle)
  3996.          return false if item.nil?
  3997.          return true if item.note =~ /<F Skill Type = All>/
  3998.          return true if item.note =~ /<F Skill Type = Ground>/
  3999.          return true if item.note =~ /<F Skill Type = Aerial>/
  4000.          return false
  4001.       end
  4002.       mog_fmbs_include?(item)
  4003.   end
  4004.  
  4005.   #--------------------------------------------------------------------------
  4006.   # ? Enable?
  4007.   #--------------------------------------------------------------------------            
  4008.   alias mog_fmbs_enable? enable?
  4009.   def enable?(item)
  4010.       if $game_system.fmbs_data[0] and SceneManager.scene_is?(Scene_Battle)
  4011.          return false if @actor.nil?
  4012.          return false if !@actor.usable?(item)
  4013.          return false if @actor.f_casting?
  4014.          return false if !@actor.f_movable?
  4015.          return true if @actor.f_ground_skill_usable?(item)
  4016.          return true if @actor.f_aerial_skill_usable?(item)
  4017.          return false
  4018.       end
  4019.       mog_fmbs_enable?(item)
  4020.   end
  4021.  
  4022. end
  4023.  
  4024. #==============================================================================
  4025. # ¦ Scene Battle
  4026. #==============================================================================
  4027. class Scene_Battle < Scene_Base
  4028.  
  4029.  
  4030.   #--------------------------------------------------------------------------
  4031.   # ? Update Skill Selection
  4032.   #--------------------------------------------------------------------------            
  4033.   def update_skill_selection
  4034.       if Input.trigger?(:B)
  4035.          $game_temp.fmb_menu_phase = [true,0,false]
  4036.          @fmbs_window.start
  4037.          @fmbs_window.select(0)
  4038.       end  
  4039.   end    
  4040.  
  4041.   #--------------------------------------------------------------------------
  4042.   # ? F Active Menu
  4043.   #--------------------------------------------------------------------------            
  4044.   def f_active_menu
  4045.       $game_temp.fmb_menu_phase = [true,0,false]
  4046.       @fmbs_window.start
  4047.       @f_status_window.actor = BattleManager.active_actor
  4048.       @f_status_window.refresh
  4049.       @f_status_window.show
  4050.       Sound.play_ok
  4051.   end
  4052.  
  4053.   #--------------------------------------------------------------------------
  4054.   # ? On Skill Cancel
  4055.   #--------------------------------------------------------------------------            
  4056.   alias mog_fmbs_on_skill_cancel on_skill_cancel
  4057.   def on_skill_cancel
  4058.       if $game_system.fmbs_data[0]
  4059.          @skill_window.visible = false
  4060.          @skill_window.active = false
  4061.          @skill_window.help_window.hide
  4062.          @fmbs_window.start
  4063.          @fmbs_window.select(0)
  4064.          $game_temp.fmb_menu_phase = [true,0,false]        
  4065.          return
  4066.       end
  4067.       mog_fmbs_on_skill_cancel
  4068.   end
  4069.  
  4070.   #--------------------------------------------------------------------------
  4071.   # ? On Skill OK
  4072.   #--------------------------------------------------------------------------            
  4073.   alias mog_fmbs_on_skill_ok on_skill_ok
  4074.   def on_skill_ok
  4075.       if $game_system.fmbs_data[0]
  4076.          @skill_window.visible = false
  4077.          @skill_window.active = false
  4078.          @skill_window.help_window.hide
  4079.          item = @skill_window.item rescue nil
  4080.          return if item.nil?
  4081.          type = item.for_opponent? ? 0 : 1
  4082.          if BattleManager.active_actor.f_cast_action?(item,false)
  4083.             BattleManager.f_clear_command_selection
  4084.             return
  4085.          end
  4086.          if [2,3,4,5,6,8,10].include?(item.scope)
  4087.              $game_temp.f_cursor_data[1] = item
  4088.              BattleManager.f_execute_action(BattleManager.active_actor,item)
  4089.              BattleManager.f_clear_command_selection if !BattleManager.active_actor.f_force_action[0].nil?
  4090.          elsif (item.note =~ /<F Auto Target>/ or item.note =~ /<F Auto Target Area>/)
  4091.             $game_temp.fmb_menu_phase[1] = 3
  4092.             $game_temp.f_cursor_data[1] = @skill_window.item          
  4093.             type = item.for_opponent? ? 0 : 1
  4094.             BattleManager.cursor_next_target(0,type)    
  4095.          else
  4096.             type = item.is_a?(RPG::Skill) ? 0 : 1  
  4097.             BattleManager.active_actor.f_execute_skill(item.id,nil,type)
  4098.             BattleManager.f_clear_command_selection
  4099.          end  
  4100.          return
  4101.       end
  4102.       mog_fmbs_on_skill_ok
  4103.   end
  4104.  
  4105.   #--------------------------------------------------------------------------
  4106.   # ? Update Target Selection Skill
  4107.   #--------------------------------------------------------------------------            
  4108.   def update_target_selection_skill
  4109.       if Input.trigger?(:B)
  4110.          Sound.play_cancel
  4111.          if $game_temp.fmb_menu_phase[2]
  4112.             BattleManager.f_clear_command_selection
  4113.          else        
  4114.             @skill_window.visible = true
  4115.             @skill_window.active = true
  4116.             @skill_window.help_window.show
  4117.             $game_temp.fmb_menu_phase[1] = 1
  4118.             $game_temp.f_cursor_target = nil
  4119.             $game_temp.f_cursor_data = [nil,nil]
  4120.          end
  4121.        elsif Input.trigger?(:C)
  4122.           Sound.play_cursor
  4123.           BattleManager.f_execute_action(BattleManager.active_actor,$game_temp.f_cursor_data[1])
  4124.           BattleManager.f_clear_command_selection if !BattleManager.active_actor.f_force_action[0].nil?
  4125.       else
  4126.          if Input.trigger?(:LEFT) or Input.trigger?(:UP)
  4127.             item = $game_temp.f_cursor_data[1]
  4128.             type = item.for_opponent? ? 0 : 1
  4129.             BattleManager.cursor_next_target(-1,type)
  4130.          elsif Input.trigger?(:RIGHT) or Input.trigger?(:DOWN)
  4131.             item = $game_temp.f_cursor_data[1]
  4132.             type = item.for_opponent? ? 0 : 1
  4133.             BattleManager.cursor_next_target(1,type)
  4134.          end        
  4135.       end    
  4136.   end  
  4137.  
  4138.   #--------------------------------------------------------------------------
  4139.   # ? F Active Window Skill
  4140.   #--------------------------------------------------------------------------            
  4141.   def f_active_window_skill
  4142.       $game_temp.fmb_menu_phase[1] = 1
  4143.       @fmbs_window.end
  4144.       command_skill
  4145.   end
  4146.  
  4147. end
  4148.  
  4149. #==============================================================================
  4150. # ¦ Window BattleItem
  4151. #==============================================================================
  4152. class Window_BattleItem < Window_ItemList
  4153.  
  4154.   #--------------------------------------------------------------------------
  4155.   # ? Actor
  4156.   #--------------------------------------------------------------------------            
  4157.   def actor
  4158.       BattleManager.active_actor
  4159.   end
  4160.  
  4161.   #--------------------------------------------------------------------------
  4162.   # ? Enable?
  4163.   #--------------------------------------------------------------------------            
  4164.   alias mog_fmbs_item_enable? enable?
  4165.   def enable?(item)
  4166.       if $game_system.fmbs_data[0]
  4167.          return false if actor.nil?
  4168.          return false if !actor.usable?(item)
  4169.          return false if actor.f_casting?
  4170.          return false if !actor.f_movable?
  4171.          return true if actor.f_ground_skill_usable?(item)
  4172.          return true if actor.f_aerial_skill_usable?(item)
  4173.          return false
  4174.       end
  4175.       mog_fmbs_item_enable?
  4176.   end
  4177.  
  4178. end
  4179.  
  4180. #==============================================================================
  4181. # ¦ Scene Battle
  4182. #==============================================================================
  4183. class Scene_Battle < Scene_Base
  4184.  
  4185.   #--------------------------------------------------------------------------
  4186.   # ? F Active Window Item
  4187.   #--------------------------------------------------------------------------            
  4188.   def f_active_window_item
  4189.       $game_temp.fmb_menu_phase[1] = 2
  4190.       @fmbs_window.end
  4191.       @f_status_window.hide
  4192.       command_item
  4193.   end  
  4194.  
  4195.   #--------------------------------------------------------------------------
  4196.   # ? Update Item Selection
  4197.   #--------------------------------------------------------------------------            
  4198.   def update_item_selection
  4199.       if Input.trigger?(:B)
  4200.          $game_temp.fmb_menu_phase = [true,0,false]
  4201.          @fmbs_window.start
  4202.          @f_status_window.show
  4203.          @fmbs_window.select(0)
  4204.       end  
  4205.   end  
  4206.  
  4207.   #--------------------------------------------------------------------------
  4208.   # ? On Item Cancel
  4209.   #--------------------------------------------------------------------------            
  4210.   alias mog_fmbs_on_item_cancel on_item_cancel
  4211.   def on_item_cancel
  4212.       if $game_system.fmbs_data[0]
  4213.          @item_window.visible = false
  4214.          @item_window.active = false
  4215.          @item_window.help_window.hide
  4216.          @fmbs_window.start
  4217.          @fmbs_window.select(0)
  4218.          @f_status_window.actor = BattleManager.active_actor
  4219.          @f_status_window.show
  4220.          $game_temp.fmb_menu_phase = [true,0,false]
  4221.          return
  4222.       end
  4223.       mog_fmbs_on_item_cancel
  4224.   end  
  4225.  
  4226.   #--------------------------------------------------------------------------
  4227.   # ? On Item OK
  4228.   #--------------------------------------------------------------------------            
  4229.   alias mog_fmbs_on_item_ok on_item_ok
  4230.   def on_item_ok
  4231.       if $game_system.fmbs_data[0]
  4232.          @item_window.visible = false
  4233.          @item_window.active = false
  4234.          @item_window.help_window.hide
  4235.          item = @item_window.item rescue nil
  4236.          return if item.nil?
  4237.          type = item.is_a?(RPG::Skill) ? 0 : 1
  4238.          if [2,3,4,5,6,8,10].include?(item.scope)
  4239.              $game_temp.f_cursor_data[1] = item
  4240.              BattleManager.f_execute_action(BattleManager.active_actor,item)
  4241.              BattleManager.f_clear_command_selection if !BattleManager.active_actor.f_force_action[0].nil?
  4242.          elsif (item.note =~ /<F Auto Target>/ or item.note =~ /<F Auto Target Area>/)
  4243.             $game_temp.fmb_menu_phase[1] = 4
  4244.             $game_temp.f_cursor_data[1] = @item_window.item
  4245.             trg = item.for_opponent? ? 0 : 1
  4246.             BattleManager.cursor_next_target(0,trg)
  4247.           else
  4248.             BattleManager.active_actor.f_execute_skill(item.id,nil,type)
  4249.             BattleManager.f_clear_command_selection                  
  4250.          end
  4251.          return
  4252.       end
  4253.       mog_fmbs_on_item_ok
  4254.   end  
  4255.  
  4256.   #--------------------------------------------------------------------------
  4257.   # ? Update Target Selection Item
  4258.   #--------------------------------------------------------------------------            
  4259.   def update_target_selection_item
  4260.       if Input.trigger?(:B)
  4261.          Sound.play_cancel
  4262.          if $game_temp.fmb_menu_phase[2]
  4263.             BattleManager.f_clear_command_selection
  4264.          else
  4265.             @item_window.visible = true
  4266.             @item_window.active = true  
  4267.             @item_window.refresh
  4268.             @item_window.help_window.show
  4269.             $game_temp.fmb_menu_phase[1] = 2
  4270.             $game_temp.f_cursor_target = nil
  4271.             $game_temp.f_cursor_data = [nil,nil]
  4272.          end  
  4273.        elsif Input.trigger?(:C)
  4274.             Sound.play_cursor
  4275.             BattleManager.f_execute_action(BattleManager.active_actor,$game_temp.f_cursor_data[1])
  4276.             BattleManager.f_clear_command_selection if !BattleManager.active_actor.f_force_action[0].nil?
  4277.        else  
  4278.          if Input.trigger?(:LEFT) or Input.trigger?(:UP)
  4279.             item = $game_temp.f_cursor_data[1]
  4280.             type = item.for_opponent? ? 0 : 1
  4281.             BattleManager.cursor_next_target(-1,type)
  4282.          elsif Input.trigger?(:RIGHT) or Input.trigger?(:DOWN)
  4283.             item = $game_temp.f_cursor_data[1]
  4284.             type = item.for_opponent? ? 0 : 1
  4285.             BattleManager.cursor_next_target(1,type)
  4286.          end  
  4287.       end    
  4288.   end    
  4289.  
  4290. end
  4291.  
  4292. #==============================================================================
  4293. # ¦ Scene Battle
  4294. #==============================================================================
  4295. class Scene_Battle < Scene_Base
  4296.  
  4297.   #--------------------------------------------------------------------------
  4298.   # ? F Equip Skill
  4299.   #--------------------------------------------------------------------------            
  4300.   def f_equip_skill
  4301.       $game_temp.fmb_menu_phase[1] = 5
  4302.       f_equip_start
  4303.       @fmbs_window.end
  4304.   end
  4305.  
  4306.   #--------------------------------------------------------------------------
  4307.   # ? F Equip Start
  4308.   #--------------------------------------------------------------------------            
  4309.   def f_equip_start
  4310.       @fmbs_skill_list_window.actor = BattleManager.active_actor
  4311.       @fmbs_actor_skill_window.actor = BattleManager.active_actor
  4312.       @f_status_window.actor = BattleManager.active_actor
  4313.       @fmbs_skill_list_window.refresh
  4314.       @fmbs_actor_skill_window.update_help
  4315.       @f_status_window.refresh
  4316.       @f_status_window.visible = true
  4317.       @fmbs_skill_list_window.active = false  
  4318.   end    
  4319.  
  4320.   #--------------------------------------------------------------------------
  4321.   # ? F Update Equip Skill
  4322.   #--------------------------------------------------------------------------            
  4323.   def update_equip_skill
  4324.       skill_type = @fmbs_actor_skill_window.index < 3 ? 0 : 1
  4325.       update_fmbs_next_actor
  4326.       f_equip_start if @fmbs_actor_skill_window.actor != BattleManager.active_actor
  4327.       if skill_type != @fmbs_skill_list_window.stype_id
  4328.          @fmbs_skill_list_window.stype_id = skill_type
  4329.          @fmbs_skill_list_window.index = 0
  4330.          @fmbs_skill_list_window.refresh
  4331.       end
  4332.       if Input.trigger?(:B)
  4333.          $game_temp.fmb_menu_phase = [true,0,false]
  4334.          @fmbs_window.start
  4335.          @fmbs_window.select(1)
  4336.          @fmbs_actor_skill_window.hide
  4337.          @fmbs_skill_list_window.hide
  4338.          Sound.play_cancel
  4339.       elsif Input.trigger?(:C)  
  4340.          @fmbs_actor_skill_window.active = false
  4341.          @fmbs_skill_list_window.active = true
  4342.          $game_temp.fmb_menu_phase[1] = 6
  4343.          Sound.play_ok
  4344.       end      
  4345.   end
  4346.  
  4347.   #--------------------------------------------------------------------------
  4348.   # ? F Update Equip Skill 2
  4349.   #--------------------------------------------------------------------------            
  4350.   def update_equip_skill_2
  4351.       if Input.trigger?(:B)
  4352.          @fmbs_actor_skill_window.active = true
  4353.          @fmbs_skill_list_window.active = false
  4354.          $game_temp.fmb_menu_phase[1] = 5
  4355.          Sound.play_cancel
  4356.        elsif Input.trigger?(:C)  
  4357.          skill_id =  @fmbs_skill_list_window.item.id rescue nil
  4358.          if !skill_id.nil?
  4359.             BattleManager.active_actor.f_equipped_skill[@fmbs_actor_skill_window.index] = skill_id
  4360.             BattleManager.active_actor.f_make_skill_list
  4361.             @fmbs_actor_skill_window.refresh
  4362.          end  
  4363.          Sound.play_equip
  4364.          @fmbs_actor_skill_window.active = true
  4365.          @fmbs_skill_list_window.active = false
  4366.          $game_temp.fmb_menu_phase[1] = 5        
  4367.       end
  4368.   end
  4369.    
  4370. end
  4371.  
  4372. #==============================================================================
  4373. # ¦ F_ESkill_List_Window
  4374. #==============================================================================
  4375. class F_ESkill_List_Window < Window_Selectable
  4376.  
  4377.     attr_accessor :stype_id
  4378.   #--------------------------------------------------------------------------
  4379.   # * Object Initialization
  4380.   #--------------------------------------------------------------------------
  4381.   def initialize(help_window,x, y, width, height)
  4382.     super(x, y, width, height)
  4383.     @actor = nil
  4384.     @stype_id = 0
  4385.     @data = []
  4386.     @help_window = help_window
  4387.     self.z = 300
  4388.     self.visible = false
  4389.     self.active = false
  4390.     refresh
  4391.   end
  4392.   #--------------------------------------------------------------------------
  4393.   # * Set Actor
  4394.   #--------------------------------------------------------------------------
  4395.   def actor=(actor)
  4396.       @actor = actor
  4397.       show
  4398.   end  
  4399.  
  4400.   #--------------------------------------------------------------------------
  4401.   # * Set Skill Type ID
  4402.   #--------------------------------------------------------------------------
  4403.   def stype_id=(stype_id)
  4404.     return if @stype_id == stype_id
  4405.     @stype_id = stype_id
  4406.     refresh
  4407.     self.oy = 0
  4408.   end
  4409.   #--------------------------------------------------------------------------
  4410.   # * Get Digit Count
  4411.   #--------------------------------------------------------------------------
  4412.   def col_max
  4413.     return 1
  4414.   end
  4415.   #--------------------------------------------------------------------------
  4416.   # * Get Number of Items
  4417.   #--------------------------------------------------------------------------
  4418.   def item_max
  4419.     @data ? @data.size : 1
  4420.   end
  4421.   #--------------------------------------------------------------------------
  4422.   # * Get Skill
  4423.   #--------------------------------------------------------------------------
  4424.   def item
  4425.     @data && index >= 0 ? @data[index] : nil
  4426.   end
  4427.   #--------------------------------------------------------------------------
  4428.   # * Get Activation State of Selection Item
  4429.   #--------------------------------------------------------------------------
  4430.   def current_item_enabled?
  4431.     enable?(@data[index])
  4432.   end
  4433.   #--------------------------------------------------------------------------
  4434.   # * Include in Skill List?
  4435.   #--------------------------------------------------------------------------
  4436.   def include?(item)
  4437.       return false if item.nil?
  4438.       return false if @stype_id == 0 and !@actor.nil? and @actor.f_flying_type?
  4439.       return true if item.note =~ /<F Skill Type = All>/
  4440.       return true if item.note =~ /<F Skill Type = Ground>/ and @stype_id == 0
  4441.       return true if item.note =~ /<F Skill Type = Aerial>/ and @stype_id == 1
  4442.       return false
  4443.   end
  4444.   #--------------------------------------------------------------------------
  4445.   # * Display Skill in Active State?
  4446.   #--------------------------------------------------------------------------
  4447.   def enable?(item)
  4448.       return false if @actor.nil?
  4449.       return false if !@actor.skill_cost_payable?(item)
  4450.       return true
  4451.   end
  4452.  
  4453.   #--------------------------------------------------------------------------
  4454.   # * Create Skill List
  4455.   #--------------------------------------------------------------------------
  4456.   def make_item_list
  4457.     @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
  4458.   end
  4459.   #--------------------------------------------------------------------------
  4460.   # * Restore Previous Selection Position
  4461.   #--------------------------------------------------------------------------
  4462.   def select_last
  4463.     select(@data.index(@actor.last_skill.object) || 0)
  4464.   end
  4465.   #--------------------------------------------------------------------------
  4466.   # * Draw Item
  4467.   #--------------------------------------------------------------------------
  4468.   def draw_item(index)  
  4469.       skill = @data[index]
  4470.       if skill
  4471.         rect = item_rect(index)
  4472.         rect.width -= 4
  4473.         draw_item_name(skill, rect.x, rect.y, enable?(skill))
  4474.         draw_skill_cost(rect, skill)
  4475.       end
  4476.   end
  4477.   #--------------------------------------------------------------------------
  4478.   # * Draw Skill Use Cost
  4479.   #--------------------------------------------------------------------------
  4480.   def draw_skill_cost(rect, skill)
  4481.       if @actor.skill_tp_cost(skill) > 0
  4482.         change_color(tp_cost_color, enable?(skill))
  4483.         draw_text(rect, @actor.skill_tp_cost(skill), 2)
  4484.       elsif @actor.skill_mp_cost(skill) > 0
  4485.         change_color(mp_cost_color, enable?(skill))
  4486.         draw_text(rect, @actor.skill_mp_cost(skill), 2)
  4487.       end
  4488.   end
  4489.   #--------------------------------------------------------------------------
  4490.   # * Update Help Text
  4491.   #--------------------------------------------------------------------------
  4492.   def update_help
  4493.     @help_window.set_item(item)
  4494.   end
  4495.   #--------------------------------------------------------------------------
  4496.   # * Refresh
  4497.   #--------------------------------------------------------------------------
  4498.   def refresh
  4499.       create_contents
  4500.       make_item_list
  4501.       self.contents.font.size = 20
  4502.       self.contents.font.bold = true        
  4503.       draw_all_items
  4504.     end
  4505.    
  4506.   #--------------------------------------------------------------------------
  4507.   # ? Refresh
  4508.   #--------------------------------------------------------------------------
  4509.   def show
  4510.       return if @actor.nil?
  4511.       @help_window.show
  4512.       self.active = true
  4513.       self.visible = true
  4514.       self.index = 0
  4515.       @stype_id = 0
  4516.       refresh
  4517.   end
  4518.  
  4519.   #--------------------------------------------------------------------------
  4520.   # ? Hide
  4521.   #--------------------------------------------------------------------------
  4522.   def hide
  4523.       @help_window.hide
  4524.       self.active = false
  4525.       self.visible = false
  4526.       self.index = -1
  4527.   end  
  4528.  
  4529. end
  4530.  
  4531. #==============================================================================
  4532. # ¦ F Actor Skill Window
  4533. #==============================================================================
  4534. class F_Actor_Skill_Window < Window_Selectable
  4535.   include MOG_LMBS
  4536.   attr_accessor :actor
  4537.  
  4538.   #--------------------------------------------------------------------------
  4539.   # ? Object Initialization
  4540.   #--------------------------------------------------------------------------
  4541.   def initialize(help_window)
  4542.       y = help_window.height
  4543.       super(0,y,296,200)
  4544.       @help_window = help_window
  4545.       @actor = nil
  4546.       @data = []  
  4547.       self.z = 300
  4548.       self.visible = false
  4549.       self.active = false  
  4550.       $game_party.on_battle_start
  4551.   end
  4552.  
  4553.   #--------------------------------------------------------------------------
  4554.   # ? Set Actor
  4555.   #--------------------------------------------------------------------------
  4556.   def actor=(actor)
  4557.       @actor = actor
  4558.       show
  4559.   end  
  4560.  
  4561.   #--------------------------------------------------------------------------
  4562.   # ? Get Digit Count
  4563.   #--------------------------------------------------------------------------
  4564.   def col_max
  4565.     return 1
  4566.   end
  4567.  
  4568.   #--------------------------------------------------------------------------
  4569.   # ? Item Max
  4570.   #--------------------------------------------------------------------------
  4571.   def item_max
  4572.       return 7
  4573.   end
  4574.  
  4575.   #--------------------------------------------------------------------------
  4576.   # ? Update Help Text
  4577.   #--------------------------------------------------------------------------
  4578.   def update_help
  4579.     @help_window.set_item(item)
  4580.   end
  4581.  
  4582.   #--------------------------------------------------------------------------
  4583.   # ? Include in Skill List?
  4584.   #--------------------------------------------------------------------------
  4585.   def include?(item)
  4586.       return false if item.nil?
  4587.   end
  4588.  
  4589.   def item
  4590.       skill(e_skill(self.index))
  4591.   end
  4592.  
  4593.   #--------------------------------------------------------------------------
  4594.   # ? Skill
  4595.   #--------------------------------------------------------------------------
  4596.   def skill(i)
  4597.       $data_skills[i] rescue nil
  4598.   end
  4599.  
  4600.   #--------------------------------------------------------------------------
  4601.   # ? E Skill
  4602.   #--------------------------------------------------------------------------
  4603.   def e_skill(i)
  4604.       @actor.f_equipped_skill[i] rescue nil
  4605.   end
  4606.    
  4607.  
  4608.   #--------------------------------------------------------------------------
  4609.   # ? Enable?
  4610.   #--------------------------------------------------------------------------            
  4611.   def enable?(item)
  4612.       $fmbs_index_e_temp = 0 if $fmbs_index_e_temp.nil?
  4613.       return false if @actor.nil?
  4614.       return false if !@actor.skill_cost_payable?(item)
  4615.       return false if $fmbs_index_e_temp < 3 and @actor.f_flying_type?
  4616.       return true if item.note =~ /<F Skill Type = Ground>/ and $fmbs_index_e_temp < 3
  4617.       return true if item.note =~ /<F Skill Type = Aerial>/ and $fmbs_index_e_temp >= 3
  4618.       return true if item.note =~ /<F Skill Type = All>/
  4619.       return false
  4620.   end    
  4621.  
  4622.   #--------------------------------------------------------------------------
  4623.   # ? Draw F Icon
  4624.   #--------------------------------------------------------------------------
  4625.   def draw_f_icon(icon_index, x, y, enabled = true)
  4626.       y += 3
  4627.       bitmap = Cache.system("F_Iconset")
  4628.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  4629.       contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  4630.   end  
  4631.  
  4632.   #--------------------------------------------------------------------------
  4633.   # ? Draw Actor Equiped Skill
  4634.   #--------------------------------------------------------------------------
  4635.   def draw_actor_equiped_skill
  4636.       self.contents.font.size = 20
  4637.       self.contents.font.bold = true
  4638.       $fmbs_index_e_temp = 0
  4639.       @actor.f_equipped_skill.each_with_index do |skill_id,i|
  4640.           x = 0
  4641.           y = 24 * i          
  4642.           draw_f_icon(0, x + 13, 0) if i == 0
  4643.           draw_f_icon(1, x, 24) if i == 1
  4644.           draw_f_icon(2, x + 26, 24) if i == 1
  4645.           draw_f_icon(3, x + 13, 24 * 2) if i == 2
  4646.           draw_f_icon(5, x + 13, 24 * 3) if i == 3
  4647.           draw_f_icon(6, x, 24 * 4) if i == 4
  4648.           draw_f_icon(7, x + 26, 24 * 4) if i == 4
  4649.           draw_f_icon(8, x + 13, 24 * 5) if i == 5
  4650.           draw_f_icon(9, x + 13, 24 * 6) if i == 6
  4651.           draw_f_icon(10, x + 13, 24 * 7) if i == 7
  4652.           unless (i < 3 and @actor.f_flying_type?)
  4653.           if !e_skill(i).nil? and !skill(e_skill(i)).nil?
  4654.               change_color(normal_color, enable?(skill(e_skill(i))))
  4655.               draw_text(x + 52,y, 170,32, skill(e_skill(i)).name, 0)
  4656.              if @actor.skill_tp_cost(skill(e_skill(i))) > 0
  4657.                change_color(tp_cost_color, enable?(skill(e_skill(i))))
  4658.                draw_text(x + 200,y,64,32 , @actor.skill_tp_cost(skill(e_skill(i))), 2)
  4659.              elsif @actor.skill_mp_cost(skill(e_skill(i))) > 0
  4660.                change_color(mp_cost_color, enable?(skill(e_skill(i))))
  4661.                draw_text(x + 200,y,64,32 , @actor.skill_mp_cost(skill(e_skill(i))), 2)
  4662.              end              
  4663.           end
  4664.           end
  4665.           $fmbs_index_e_temp += 1
  4666.       end
  4667.   end
  4668.  
  4669.   #--------------------------------------------------------------------------
  4670.   # ? Refresh
  4671.   #--------------------------------------------------------------------------
  4672.   def show
  4673.       return if @actor.nil?
  4674.       @help_window.show
  4675.       self.active = true
  4676.       self.visible = true
  4677.       self.index = 0
  4678.       refresh
  4679.   end
  4680.  
  4681.   #--------------------------------------------------------------------------
  4682.   # ? Hide
  4683.   #--------------------------------------------------------------------------
  4684.   def hide
  4685.       @help_window.hide
  4686.       self.active = false
  4687.       self.visible = false
  4688.       self.index = -1
  4689.   end
  4690.    
  4691.   #--------------------------------------------------------------------------
  4692.   # ? Refresh
  4693.   #--------------------------------------------------------------------------
  4694.   def refresh
  4695.       create_contents
  4696.       draw_actor_equiped_skill
  4697.   end
  4698.  
  4699. end
  4700.  
  4701. #==============================================================================
  4702. # ¦ Window SkillList
  4703. #==============================================================================
  4704. class Window_SkillList < Window_Selectable  
  4705.  
  4706.   #--------------------------------------------------------------------------
  4707.   # ? Include?
  4708.   #--------------------------------------------------------------------------
  4709.   alias mog_fmbs_sl_include? include?
  4710.   def include?(item)
  4711.       return true if $game_system.fmbs_data[0] and SceneManager.scene_is?(Scene_Battle)
  4712.       mog_fmbs_sl_include?(item)
  4713.   end
  4714.  
  4715. end
  4716.  
  4717. #==============================================================================
  4718. # ¦ Fmbs Window
  4719. #==============================================================================
  4720. class Fmbs_Window < Window_Command
  4721.  
  4722.   #--------------------------------------------------------------------------
  4723.   # ? Initialize
  4724.   #--------------------------------------------------------------------------
  4725.   def initialize
  4726.       super(0, 0)
  4727.       self.openness = 0
  4728.       self.z = 300
  4729.       self.x = (Graphics.width / 2) - (window_width / 2) + MOG_LMBS::COMMAND_WINDOW_POSITION[0]
  4730.       self.y = (Graphics.height / 2) - (window_height / 2) + MOG_LMBS::COMMAND_WINDOW_POSITION[1]
  4731.       deactivate
  4732.   end
  4733.  
  4734.   #--------------------------------------------------------------------------
  4735.   # ? Window Width
  4736.   #--------------------------------------------------------------------------
  4737.   def window_width
  4738.     return 192
  4739.   end
  4740.  
  4741.   #--------------------------------------------------------------------------
  4742.   # ? Window Height
  4743.   #--------------------------------------------------------------------------
  4744.   def window_height
  4745.       return 84
  4746.   end
  4747.  
  4748.   #--------------------------------------------------------------------------
  4749.   # ? Make Command List
  4750.   #--------------------------------------------------------------------------
  4751.   def make_command_list
  4752.      # add_command(MOG_LMBS::COMMAND_WINDOW_LIST_NAME[0], :f_skill_window)
  4753.       add_command(MOG_LMBS::COMMAND_WINDOW_LIST_NAME[0], :f_item_window)
  4754.       add_command(MOG_LMBS::COMMAND_WINDOW_LIST_NAME[1], :f_equip_skill)
  4755.     #  add_command(MOG_LMBS::COMMAND_WINDOW_LIST_NAME[3], :f_change_target)
  4756.   end
  4757.  
  4758.   #--------------------------------------------------------------------------
  4759.   # ? Setup
  4760.   #--------------------------------------------------------------------------
  4761.   def start
  4762.       select(0)
  4763.       open      
  4764.       self.active = true
  4765.       self.visible = true      
  4766.   end
  4767.  
  4768.   #--------------------------------------------------------------------------
  4769.   # ? End
  4770.   #--------------------------------------------------------------------------
  4771.   def end
  4772.       close
  4773.       self.active = false
  4774.       self.visible = false
  4775.   end
  4776.    
  4777. end
  4778.  
  4779. #==============================================================================
  4780. # ¦ Window Menu Command
  4781. #==============================================================================
  4782. class Window_MenuCommand < Window_Command  
  4783.  
  4784.   #--------------------------------------------------------------------------
  4785.   # ? Add Main Commands
  4786.   #--------------------------------------------------------------------------
  4787.   alias mog_fmbs_skill_add_main_commands add_main_commands
  4788.   def add_main_commands
  4789.       mog_fmbs_skill_add_main_commands
  4790.       add_command(MOG_LMBS::SCENE_EQUIP_SKILL_NAME, :f_skill, main_commands_enabled)
  4791.   end
  4792.    
  4793. end  
  4794.  
  4795. #==============================================================================
  4796. # ¦ Scene Menu
  4797. #==============================================================================
  4798. class Scene_Menu < Scene_MenuBase
  4799.  
  4800.   #--------------------------------------------------------------------------
  4801.   # ? Create Command Window
  4802.   #--------------------------------------------------------------------------
  4803.   alias mog_fmbs_menu_create_command_window create_command_window
  4804.   def create_command_window
  4805.       mog_fmbs_menu_create_command_window
  4806.       @command_window.set_handler(:f_skill,     method(:command_personal))
  4807.   end
  4808.  
  4809.   #--------------------------------------------------------------------------
  4810.   # ? On Personal OK
  4811.   #--------------------------------------------------------------------------
  4812.   alias mog_fmbs_menu_on_personal_ok on_personal_ok
  4813.   def on_personal_ok
  4814.     case @command_window.current_symbol
  4815.        when :f_skill ; SceneManager.call(Scene_F_Skill)
  4816.     end
  4817.      mog_fmbs_menu_on_personal_ok
  4818.   end
  4819.  
  4820. end
  4821.  
  4822. #==============================================================================
  4823. # ¦ Scene Skill
  4824. #==============================================================================
  4825. class Scene_F_Skill < Scene_MenuBase
  4826.  
  4827.   #--------------------------------------------------------------------------
  4828.   # ? Start
  4829.   #--------------------------------------------------------------------------
  4830.   def start
  4831.       super
  4832.       @help_window = Window_Help.new
  4833.       @help_window.visible = false
  4834.       @fmbs_actor_skill_window = F_Actor_Skill_Window.new(@help_window)
  4835.       @fmbs_actor_skill_window.y = @help_window.height
  4836.       @fmbs_actor_skill_window.set_handler(:pagedown, method(:next_actor))
  4837.       @fmbs_actor_skill_window.set_handler(:pageup,   method(:prev_actor))      
  4838.       wd = Graphics.width - @fmbs_actor_skill_window.width
  4839.       @fmbs_skill_list_window = F_ESkill_List_Window.new(@help_window,@fmbs_actor_skill_window.width,@fmbs_actor_skill_window.y,wd,@fmbs_actor_skill_window.height)
  4840.       $game_temp.fmb_menu_phase = [true,5,false]
  4841.       @fmbs_actor_skill_window.actor = @actor      
  4842.       @fmbs_skill_list_window.actor = @actor
  4843.       @fmbs_skill_list_window.active = false
  4844.       @fmbs_skill_list_window.refresh
  4845.       @fmbs_actor_skill_window.update_help
  4846.       create_status_window
  4847.     end
  4848.    
  4849.   #--------------------------------------------------------------------------
  4850.   # ? Create Status Window
  4851.   #--------------------------------------------------------------------------
  4852.   def create_status_window
  4853.       @status_window = Window_SkillStatus.new(0,0)
  4854.       @status_window.z = 300
  4855.       @status_window.y = Graphics.height - @status_window.height
  4856.       @status_window.width = Graphics.width
  4857.       @status_window.actor = @actor
  4858.   end    
  4859.    
  4860.   #--------------------------------------------------------------------------
  4861.   # ? Terminate
  4862.   #--------------------------------------------------------------------------
  4863.   def terminate
  4864.       super
  4865.       @fmbs_actor_skill_window.dispose
  4866.       @fmbs_skill_list_window.dispose
  4867.       @help_window.dispose
  4868.       @status_window.dispose
  4869.       $game_temp.fmb_menu_phase = [false,0,false]
  4870.       $game_party.on_battle_end
  4871.   end
  4872.  
  4873.   #--------------------------------------------------------------------------
  4874.   # ? Om Actor Change
  4875.   #--------------------------------------------------------------------------
  4876.   def on_actor_change
  4877.       @fmbs_actor_skill_window.actor = @actor
  4878.       @fmbs_actor_skill_window.index = 0
  4879.       @fmbs_actor_skill_window.active = true
  4880.       @fmbs_skill_list_window.actor = @actor
  4881.       @fmbs_skill_list_window.index = 0
  4882.       @fmbs_skill_list_window.active = false
  4883.       @fmbs_skill_list_window.refresh
  4884.       @fmbs_actor_skill_window.update_help      
  4885.       @status_window.actor = @actor
  4886.   end
  4887.  
  4888.   #--------------------------------------------------------------------------
  4889.   # ? F Update Equip Skill
  4890.   #--------------------------------------------------------------------------            
  4891.   def update_equip_skill
  4892.       return if @actor.nil?
  4893.       skill_type = @fmbs_actor_skill_window.index < 3 ? 0 : 1
  4894.       if skill_type != @fmbs_skill_list_window.stype_id
  4895.          @fmbs_skill_list_window.stype_id = skill_type
  4896.          @fmbs_skill_list_window.index = 0
  4897.          @fmbs_skill_list_window.refresh
  4898.       end
  4899.       if Input.trigger?(:B)
  4900.          SceneManager.return
  4901.          $game_temp.fmb_menu_phase = [false,0,false]
  4902.          Sound.play_cancel
  4903.       elsif Input.trigger?(:C)  
  4904.          @fmbs_actor_skill_window.active = false
  4905.          @fmbs_skill_list_window.active = true
  4906.          $game_temp.fmb_menu_phase[1] = 6
  4907.          Sound.play_ok
  4908.       end      
  4909.   end
  4910.  
  4911.   #--------------------------------------------------------------------------
  4912.   # ? F Update Equip Skill 2
  4913.   #--------------------------------------------------------------------------            
  4914.   def update_equip_skill_2
  4915.       if Input.trigger?(:B)
  4916.          @fmbs_actor_skill_window.active = true
  4917.          @fmbs_skill_list_window.active = false
  4918.          $game_temp.fmb_menu_phase[1] = 5
  4919.          Sound.play_cancel
  4920.        elsif Input.trigger?(:C)  
  4921.          skill_id =  @fmbs_skill_list_window.item.id rescue nil
  4922.          if !skill_id.nil?
  4923.             @actor.f_equipped_skill[@fmbs_actor_skill_window.index] = skill_id
  4924.             @fmbs_actor_skill_window.refresh
  4925.          end  
  4926.          Sound.play_equip
  4927.          @fmbs_actor_skill_window.active = true
  4928.          @fmbs_skill_list_window.active = false
  4929.          $game_temp.fmb_menu_phase[1] = 5        
  4930.       end
  4931.   end
  4932.  
  4933.   #--------------------------------------------------------------------------
  4934.   # ? Update
  4935.   #--------------------------------------------------------------------------            
  4936.   def update
  4937.       super      
  4938.       case $game_temp.fmb_menu_phase[1]
  4939.          when 5 ; update_equip_skill
  4940.          when 6 ; update_equip_skill_2
  4941.       end
  4942.   end
  4943.    
  4944. end
  4945.  
  4946. #==============================================================================
  4947. # ¦ Sprite Base
  4948. #==============================================================================
  4949. class Sprite_Base < Sprite
  4950.  
  4951.   #--------------------------------------------------------------------------
  4952.   # ? Update Animation
  4953.   #--------------------------------------------------------------------------            
  4954.   alias mog_fmbs_update_animation update_animation
  4955.   def update_animation
  4956.       return if $game_system.fmbs_data[0] and $game_temp.fmb_menu_phase[0]
  4957.       mog_fmbs_update_animation
  4958.     end
  4959.  
  4960.   #--------------------------------------------------------------------------
  4961.   # ? Animation Set Sprite
  4962.   #--------------------------------------------------------------------------      
  4963.   alias mog_fmbs_ani_animation_set_sprites animation_set_sprites
  4964.   def animation_set_sprites(frame)
  4965.       f_update_animation_set_sprites(frame) if SceneManager.scene_is?(Scene_Battle) and $game_system.fmbs_data[0]
  4966.       mog_fmbs_ani_animation_set_sprites(frame)
  4967.   end        
  4968.    
  4969.   #--------------------------------------------------------------------------
  4970.   # ? F update Animation Set Sprites
  4971.   #--------------------------------------------------------------------------      
  4972.   def f_update_animation_set_sprites(frame)
  4973.       return if @battler.nil?
  4974.       @ani_ox = self.x ; @ani_oy = self.y - @battler.f_body_height2
  4975.       if @animation.position == 0
  4976.          @ani_oy -= @battler.f_body_height2
  4977.       elsif @animation.position == 2
  4978.          @ani_oy += @battler.f_body_height2
  4979.       end  
  4980.   end
  4981.      
  4982. end
  4983.  
  4984. #==============================================================================
  4985. # ¦ Sprite Battler
  4986. #==============================================================================
  4987. class Sprite_Battler < Sprite_Base
  4988.  
  4989.   #--------------------------------------------------------------------------
  4990.   # ? Initialize
  4991.   #--------------------------------------------------------------------------            
  4992.   alias mog_fmbs_sb_initialize initialize
  4993.   def initialize(viewport, battler = nil)
  4994.       @sprite_index = -1 ; @skill_sprites = []
  4995.       mog_fmbs_sb_initialize(viewport,battler)
  4996.   end
  4997.  
  4998.   #--------------------------------------------------------------------------
  4999.   # ? Update
  5000.   #--------------------------------------------------------------------------            
  5001.   alias mog_fmbs_sb_update update
  5002.   def update
  5003.       return if $game_temp.fmb_phase_end == 4
  5004.       mog_fmbs_sb_update
  5005.   end
  5006.  
  5007.   #--------------------------------------------------------------------------
  5008.   # ? Dispose
  5009.   #--------------------------------------------------------------------------            
  5010.   alias mog_fmbs_sb_dispose dispose
  5011.   def dispose
  5012.       mog_fmbs_sb_dispose
  5013.       @skill_sprites.each do |sprite| sprite.dispose end
  5014.       dispose_f_shadow
  5015.       $game_temp.f_fmbs_clear
  5016.   end
  5017.  
  5018.   #--------------------------------------------------------------------------
  5019.   # ? Update Bitmap
  5020.   #--------------------------------------------------------------------------            
  5021.   alias mog_fmbs_sb_update_bitmap update_bitmap
  5022.   def update_bitmap  
  5023.       if $game_system.fmbs_data[0] ; update_fmbs_bitmap ; return ; end
  5024.       mog_fmbs_sb_update_bitmap
  5025.   end
  5026.  
  5027.   #--------------------------------------------------------------------------
  5028.   # ? Update Battler Motion
  5029.   #--------------------------------------------------------------------------            
  5030.   if $imported[:mog_battler_motion]
  5031.   alias mog_fmbs_can_update_battler_motion? can_update_battler_motion?
  5032.   def can_update_battler_motion?
  5033.       return false if $game_system.fmbs_data[0]
  5034.       mog_fmbs_can_update_battler_motion?
  5035.   end  
  5036.   end
  5037.  
  5038.   #--------------------------------------------------------------------------
  5039.   # ? Update Actor Sprite Damage Effect
  5040.   #--------------------------------------------------------------------------            
  5041.   if $imported[:mog_battler_motion]
  5042.   alias mog_fmbs_update_actor_sprite_damage_effect update_actor_sprite_damage_effect
  5043.   def update_actor_sprite_damage_effect
  5044.       return if $game_system.fmbs_data[0]
  5045.       mog_fmbs_update_actor_sprite_damage_effect
  5046.   end
  5047.   end
  5048.  
  5049.   #--------------------------------------------------------------------------
  5050.   # ? Update Fmbs Bitmap
  5051.   #--------------------------------------------------------------------------            
  5052.   def update_fmbs_bitmap
  5053.       return if $game_temp.fmb_menu_phase[0]      
  5054.       pre_cache_sprites if @sprites_p.nil?
  5055.       refresh_fmbs_bitmap if refresh_fmbs_bitmap?
  5056.       refresh_fmbs_character_bitmap if self.bitmap.nil?      
  5057.       if !self.bitmap.nil?
  5058.          refresh_sprite_size if @battler.sprite_data[12][0] == 0
  5059.          update_fmbs_rect if update_fmbs_rect?
  5060.          update_fmbs_character_sprite if @battler.f_char_data[0]
  5061.          update_fmbs_movement
  5062.          update_fmbs_skills
  5063.          update_fmbs_battler
  5064.          update_fmbs_opacity  
  5065.       end  
  5066.   end
  5067.  
  5068.   #--------------------------------------------------------------------------
  5069.   # ? Update Fmbs Opacity
  5070.   #--------------------------------------------------------------------------            
  5071.   def update_fmbs_opacity
  5072.       if update_fmbs_collapse?
  5073.          update_fmbs_collapse
  5074.       else
  5075.          if @battler.f_sprite_fade[0]
  5076.             update_fmbs_fade_effect
  5077.          else  
  5078.             self.opacity += 20
  5079.          end  
  5080.       end  
  5081.   end
  5082.    
  5083.   #--------------------------------------------------------------------------
  5084.   # ? Update Fmbs Escape Effect
  5085.   #--------------------------------------------------------------------------            
  5086.   def update_fmbs_fade_effect
  5087.       return true if @battler.is_a?(Game_Enemy) and @battler.dead?
  5088.       return if @battler.is_a?(Game_Enemy) and @battler.f_sprite_fade[1] == 0
  5089.       return if @battler.is_a?(Game_Actor) and @battler.f_sprite_fade[1] == 1
  5090.       self.opacity -= 20
  5091.   end
  5092.  
  5093.   #--------------------------------------------------------------------------
  5094.   # ? Update Fmbs Collpase
  5095.   #--------------------------------------------------------------------------            
  5096.   def update_fmbs_collapse?
  5097.       return false if !@battler.f_ground?
  5098.       return false if @battler.is_a?(Game_Actor)
  5099. #      return false if !@sprites_p[9].nil?
  5100.       return @battler.dead?
  5101.   end
  5102.  
  5103.   #--------------------------------------------------------------------------
  5104.   # ? Update Fmbs Collpase
  5105.   #--------------------------------------------------------------------------            
  5106.   def update_fmbs_collapse
  5107.       return if @effect_duration > 2
  5108.       self.opacity -= 5
  5109.   end
  5110.  
  5111.   #--------------------------------------------------------------------------
  5112.   # ? Update Fmbs Bitmap
  5113.   #--------------------------------------------------------------------------            
  5114.   def update_fmbs_battler
  5115.       @battler.f_update_fmbs_battler_damage if @battler.f_damage[0] > 0
  5116.       @battler.f_update_fmbs_battler_inv_duration
  5117.       @battler.f_update_fmbs_battler_effect if @battler.f_damage_effect[0] != 0
  5118.       @battler.f_update_base_pose
  5119.       @battler.f_update_ai if @battler.f_update_ai?
  5120.   end    
  5121.  
  5122.   #--------------------------------------------------------------------------
  5123.   # ? Update Fmbs Rect?
  5124.   #--------------------------------------------------------------------------            
  5125.   def update_fmbs_rect?
  5126.       return false if @sprites_p.nil?
  5127.       return false if @battler.f_char_data[0]
  5128.       return false if @sprites_p[@battler.sprite_data[0]].nil?
  5129.       return false if @sprites_p[@battler.sprite_data[0]].size == 0
  5130.       return false if @sprites_p[@battler.sprite_data[0]][2].nil?
  5131.       return false if $game_temp.fmb_phase_end == 4
  5132.       return true
  5133.   end
  5134.  
  5135.   #--------------------------------------------------------------------------
  5136.   # ? Refresh FMBS Bitmap?
  5137.   #--------------------------------------------------------------------------            
  5138.   def refresh_fmbs_bitmap?
  5139.       return false if @sprites_p.empty?
  5140.       return false if $game_temp.battle_end and @sprite_index == 9
  5141.       return false if $game_temp.fmb_phase_end == 4
  5142.       return true if @battler.sprite_data[0] != @sprite_index
  5143.       return false
  5144.   end
  5145.  
  5146.   #--------------------------------------------------------------------------
  5147.   # ? Pre Cache Sprites
  5148.   #--------------------------------------------------------------------------            
  5149.   def pre_cache_sprites
  5150.       @sprites_p = [] ; b_name = @battler.battler_name
  5151.       original_sprite = Cache.battler(@battler.battler_name.to_s, 0) rescue nil
  5152.       return if original_sprite.nil?
  5153.       sprites_names = []
  5154.       return if b_name == ""
  5155.       Dir.glob("Graphics/Battlers/" + b_name + "*.png").each do |file|
  5156.       sprites_names.push(File.basename(file)) ; end
  5157.       sprites_names.each do |file|
  5158.          ns = file =~ /\[F(\d+)]/ ? $1.to_s : 1
  5159.          sp = file =~ /\[S(\d+)]/ ? $1.to_s : MOG_LMBS::DEFAULT_SPRITE_ANIMATION_SPEED
  5160.          eh = file =~ /\[H(\d+)]/ ? $1.to_s : 0
  5161.          @sprites_p[0] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Idle]/
  5162.          @sprites_p[1] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Walk]/
  5163.          @sprites_p[2] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Jump]/
  5164.          @sprites_p[3] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Fall]/
  5165.          @sprites_p[3] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if @sprites_p[3].nil? and file =~ /\[Jump]/
  5166.          @sprites_p[4] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Crouch]/
  5167.          @sprites_p[5] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Dash]/
  5168.          @sprites_p[5] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if @sprites_p[5].nil? and file =~ /\[Walk]/
  5169.          @sprites_p[6] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Guard]/
  5170.          @sprites_p[7] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Guard2]/
  5171.          @sprites_p[7] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if @sprites_p[7].nil? and file =~ /\[Guard]/
  5172.          @sprites_p[8] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Damage]/
  5173.          @sprites_p[9] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Dead]/
  5174.          @sprites_p[9] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if @sprites_p[9].nil? and file =~ /\[Damage]/
  5175.          @sprites_p[10] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Cast]/
  5176.          @sprites_p[11] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Victory]/
  5177.          @sprites_p[$1.to_i + 1000] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Skill_(\d+)]/
  5178.          @sprites_p[$1.to_i + 2000] = [Cache.battler(file, @battler.battler_hue) ,ns.to_i,sp.to_i,eh.to_i] if file =~ /\[Item_(\d+)]/
  5179.       end
  5180.       @battler.f_crouch[0] = true if !@sprites_p[4].nil?
  5181.   end  
  5182.  
  5183.   #--------------------------------------------------------------------------
  5184.   # ? Set Sprite Index
  5185.   #--------------------------------------------------------------------------            
  5186.   def set_sprite_index
  5187.       s_data = nil
  5188.       if @sprites_p[@battler.sprite_data[0]].nil? or @sprites_p[@battler.sprite_data[0]][0].nil?
  5189.          if @battler.f_mov_acting?
  5190.             if !@sprites_p[1001].nil? and @battler.f_action[4] == 0
  5191.                 s_data = @sprites_p[1001]
  5192.                 @sprites_p[@battler.sprite_data[0]] = s_data  
  5193.             else !@sprites_p[2001].nil? and @battler.f_action[4] == 1
  5194.                 s_data = @sprites_p[2001]
  5195.                 @sprites_p[@battler.sprite_data[0]] = s_data                  
  5196.             end  
  5197.          else  
  5198.             return nil if @sprites_p[0].nil? or @sprites_p[0][0].nil?
  5199.             s_data = @sprites_p[0]
  5200.             @sprites_p[@battler.sprite_data[0]] = s_data
  5201.          end
  5202.       else    
  5203.          s_data = @sprites_p[@battler.sprite_data[0]]
  5204.       end    
  5205.       return s_data
  5206.   end
  5207.  
  5208.   #--------------------------------------------------------------------------
  5209.   # ? Refresh FMBS Initial Position
  5210.   #--------------------------------------------------------------------------            
  5211.   def refresh_fmbs_initial_position
  5212.       return if !@f_ini_p.nil?
  5213.       return if bitmap.nil?
  5214.       @f_ini_p = true ; lm_x = 0
  5215.       lm_x = ((Graphics.width / 2) * camera_range / 100) if $imported[:mog_battle_camera]
  5216.       if @battler.is_a?(Game_Actor)        
  5217.          space = 200 / $game_party.battle_members.size
  5218.          @battler.screen_x = -lm_x + 64 + (space * @battler.index)
  5219.          @battler.sprite_data[3] = 1
  5220.       else
  5221.          if @battler.is_a?(Game_Enemy) and $game_system.f_adjust_position_auto
  5222.             space = ((Graphics.width / 2) - 64 + lm_x) / $game_troop.members.size
  5223.             @battler.screen_x = (Graphics.width - 64) - (space * @battler.index) + lm_x
  5224.          end
  5225.       end  
  5226.       @battler.screen_y = @battler.f_ground
  5227.       @battler.screen_y = @battler.f_flying_height if @battler.f_flying_type?
  5228.       self.x = @battler.screen_x ; self.y = @battler.screen_y
  5229.  end    
  5230.  
  5231.   #--------------------------------------------------------------------------
  5232.   # ? Refresh FMBS Bitmap
  5233.   #--------------------------------------------------------------------------            
  5234.   def refresh_fmbs_bitmap
  5235.       return if @sprites_p[0].nil?      
  5236.       @sprite_index = @battler.sprite_data[0]
  5237.       s_data = set_sprite_index
  5238.       self.bitmap = Bitmap.new(16,16) if bitmap.nil? and @sprites_p[0][0].nil?
  5239.       return if s_data.nil?
  5240.       @b_image = s_data[0]
  5241.       @fm = s_data[1]
  5242.       @cw = @b_image.width / @fm
  5243.       @ch = @b_image.height
  5244.       self.bitmap = Bitmap.new(@cw,@ch)
  5245.       @battler.sprite_data[1] = 0
  5246.       @battler.sprite_data[2] = s_data[2]
  5247.       @sprites_p[@battler.sprite_data[0]][2] = s_data[2] if @sprites_p[@battler.sprite_data[0]][2].nil?
  5248.       update_fmbs_rect
  5249.       @battler.sprite_data[14] = @sprites_p[@battler.sprite_data[0]][3]
  5250.   end
  5251.  
  5252.   #--------------------------------------------------------------------------
  5253.   # ? Update FMBS Rect
  5254.   #--------------------------------------------------------------------------            
  5255.   def update_fmbs_rect
  5256.       return if @battler.sprite_data[0].nil?
  5257.       return if @cw.nil?
  5258.       @battler.sprite_data[2] += 1
  5259.       return if @battler.sprite_data[2] < @sprites_p[@battler.sprite_data[0]][2]
  5260.       @battler.sprite_data[2] = 0
  5261.       self.bitmap.clear
  5262.       f_rect = Rect.new(@cw * @battler.sprite_data[1],0,@cw,@ch)
  5263.       self.bitmap.blt(0,0,@b_image,f_rect)
  5264.       @battler.sprite_data[1] += 1 unless @battler.f_mov_air_dash?
  5265.       if @battler.sprite_data[1] >= @fm
  5266.          @battler.sprite_data[1] = 0
  5267.          @battler.sprite_data[1] = @fm - 1 if @battler.f_noloop_animation?
  5268.       end
  5269.   end
  5270.  
  5271.   #--------------------------------------------------------------------------
  5272.   # ? Update FMBS Movement
  5273.   #--------------------------------------------------------------------------            
  5274.   def update_fmbs_movement
  5275.       @battler.f_fix_direction[0] = false
  5276.       @battler.f_air_ground[0] = false
  5277.       @battler.f_air_ground[1] = 0 if @battler.screen_y >= @battler.f_ground
  5278.       @battler.f_fix_direction[1] -= 1 if @battler.f_fix_direction[1] > 0
  5279.       @battler.f_update_animation_mirror
  5280.       @battler.f_update_jump if @battler.f_mov_jumping?
  5281.       @battler.f_update_double_jump if @battler.f_mov_double_jump?
  5282.       @battler.f_update_air_dash if @battler.f_mov_air_dash?
  5283.       @battler.f_update_gravity
  5284.       @battler.f_update_action if !@battler.f_action[1].nil?
  5285.       @battler.f_update_cast if @battler.f_update_cast?
  5286.       @battler.f_update_turn
  5287.       update_f_force_action if !@battler.f_force_action[0].nil?
  5288.       update_f_battler_direction if update_f_battler_direction?
  5289.       @battler.f_update_force_move if @battler.f_force_movement?
  5290.       update_f_sprite_effects
  5291.   end
  5292.  
  5293.   #--------------------------------------------------------------------------
  5294.   # ? Update F Force Action
  5295.   #--------------------------------------------------------------------------            
  5296.   def update_f_force_action
  5297.       item = @battler.f_force_action[0]
  5298.       i_type = item.is_a?(RPG::Skill) ? 0 : 1
  5299.       @battler.f_force_action[1].each_with_index do |trg,i|
  5300.           @battler.f_execute_skill(item.id,trg,i_type)
  5301.           @battler.f_action[3] = trg
  5302.           lt = 1 * (i + 1)
  5303.           make_sprite_skill(lt)
  5304.       end        
  5305.       @battler.f_force_action = [nil,[]]
  5306.   end
  5307.  
  5308.   #--------------------------------------------------------------------------
  5309.   # ? Update F Battler Direction
  5310.   #--------------------------------------------------------------------------            
  5311.   def update_f_battler_direction?
  5312.       return false if @battler.f_target.nil?
  5313.     #  return false if !@battler.f_movable?
  5314.       return true
  5315.   end
  5316.    
  5317.   #--------------------------------------------------------------------------
  5318.   # ? Update F Battler Direction
  5319.   #--------------------------------------------------------------------------            
  5320.   def update_f_battler_direction
  5321.       self.mirror = @battler.sprite_data[3] == 1 ? true : false
  5322.   end
  5323.  
  5324.   #--------------------------------------------------------------------------
  5325.   # ? Set New Animation
  5326.   #--------------------------------------------------------------------------
  5327.   alias mog_fmbs_setup_new_animation setup_new_animation
  5328.   def setup_new_animation
  5329.       if @battler.animation_id > 0
  5330.          animation = $data_animations[@battler.animation_id]
  5331.          mirror = @battler.f_damage[4] == 0 ? false : true
  5332.          start_animation(animation, mirror)
  5333.          @battler.animation_id = 0
  5334.       end
  5335.       mog_fmbs_setup_new_animation
  5336.   end  
  5337.  
  5338.   #--------------------------------------------------------------------------
  5339.   # ? Update F Sprite Effects
  5340.   #--------------------------------------------------------------------------
  5341.   def update_f_sprite_effects
  5342.       @battler.f_update_fying_effect if @battler.f_flying_type? and ! @battler.f_char_data[0]
  5343.       update_f_zoom_effect
  5344.   end
  5345.  
  5346.   #--------------------------------------------------------------------------
  5347.   # ? Update f Zoom Effect
  5348.   #--------------------------------------------------------------------------
  5349.   def update_f_zoom_effect
  5350.       if @battler.f_breath_effect?
  5351.          @battler.f_update_breath_effect
  5352.          self.zoom_y = 1.01 + @battler.f_breath_effect[1]
  5353.       end  
  5354.      
  5355.   end
  5356.  
  5357. end
  5358.  
  5359.  
  5360. #==============================================================================
  5361. # ¦ Sprite Battler
  5362. #==============================================================================
  5363. class Sprite_Battler < Sprite_Base
  5364.  
  5365.   #--------------------------------------------------------------------------
  5366.   # ? Update FMBS Character Sprite
  5367.   #--------------------------------------------------------------------------            
  5368.   def update_fmbs_character_sprite
  5369.       update_fmbs_character_rect
  5370.       refresh_fmbs_character_pose if @battler.f_char_data[3]
  5371.   end
  5372.  
  5373.   #--------------------------------------------------------------------------
  5374.   # ? Refresh FMBS Character Pose
  5375.   #--------------------------------------------------------------------------            
  5376.   def refresh_fmbs_character_pose
  5377.       @battler.f_char_data[3] = false
  5378.       self.angle = @battler.dead? ? 270 : 0 if @battler.f_direction == 0
  5379.       self.angle = @battler.dead? ? 90 : 0 if @battler.f_direction == 1
  5380.   end
  5381.  
  5382.   #--------------------------------------------------------------------------
  5383.   # ? Refresh Fmbs Force Bitmap
  5384.   #--------------------------------------------------------------------------            
  5385.   def refresh_fmbs_character_bitmap
  5386.       self.bitmap = Cache.battler(@battler.battler_name, 0) rescue nil if @battler.battler_name != ""
  5387.       refresh_fmbs_bitmap_character if self.bitmap.nil? and @battler.is_a?(Game_Actor)
  5388.       self.bitmap = Bitmap.new(48,96) if self.bitmap.nil?
  5389.   end
  5390.  
  5391.   #--------------------------------------------------------------------------
  5392.   # ? Refresh Fmbs Bitmap Character
  5393.   #--------------------------------------------------------------------------            
  5394.   def refresh_fmbs_bitmap_character
  5395.       @battler.f_char_data = [true,10,0,true]
  5396.       self.bitmap = Cache.character(@battler.character_name)
  5397.       sign = @battler.character_name[/^[\!\$]./]
  5398.       if sign && sign.include?('$')
  5399.          @cw = bitmap.width / 3
  5400.          @ch = bitmap.height / 4
  5401.       else
  5402.          @cw = bitmap.width / 12
  5403.          @ch = bitmap.height / 8
  5404.       end
  5405.       self.ox = @cw / 2
  5406.       self.oy = @ch
  5407.       self.zoom_x = 1.5
  5408.       self.zoom_y = self.zoom_x
  5409.       refresh_fmbs_character_pose
  5410.       update_fmbs_character_rect      
  5411.   end
  5412.  
  5413.   #--------------------------------------------------------------------------
  5414.   # ? Set Sprite Size
  5415.   #--------------------------------------------------------------------------
  5416.   def refresh_sprite_size
  5417.       if @battler.f_char_data[0]
  5418.          zoom = 1.5
  5419.          x1 = (@cw * zoom) / 1.00
  5420.          x2 = ((@cw / 2) * zoom) / 1.00
  5421.          y1 = (@ch * zoom) / 1.00
  5422.          y2 = ((@ch / 2) * zoom) / 1.00
  5423.          @battler.sprite_data[12] = [x1,y1,x2,y2]
  5424.       else  
  5425.          @battler.set_sprite_size
  5426.       end  
  5427.   end
  5428.      
  5429.   #--------------------------------------------------------------------------
  5430.   # ? Update Fmbs Character Rect
  5431.   #--------------------------------------------------------------------------
  5432.   def update_fmbs_character_rect
  5433.       @battler.f_char_data[1] += 1  
  5434.       return if @battler.f_char_data[1] < 4
  5435.       @battler.f_char_data[1] = 0
  5436.       index = @battler.character_index
  5437.       sx = (index % 4 * 3 + @battler.f_char_data[2]) * @cw
  5438.       sy = (index / 4 * 4 + 1) * @ch
  5439.       self.src_rect.set(sx, sy, @cw, @ch)
  5440.       @battler.f_char_data[2] += 1 if f_anime_char_sprite?
  5441.       if @battler.f_char_data[2] > 2 or @battler.f_mov_damage? or @battler.f_mov_unconscious?
  5442.          @battler.f_char_data[2] = 0
  5443.       end
  5444.   end
  5445.  
  5446.   #--------------------------------------------------------------------------
  5447.   # ? F Anime Char Sprite
  5448.   #--------------------------------------------------------------------------
  5449.   def f_anime_char_sprite?
  5450.       return true if @battler.f_walking?
  5451.       return true if @battler.f_mov_dashing? and @battler.f_ground?
  5452.       return true if @battler.f_mov_acting?
  5453.       return false
  5454.   end
  5455.  
  5456.   #--------------------------------------------------------------------------
  5457.   # ? Update Origin
  5458.   #--------------------------------------------------------------------------
  5459.   alias mog_fmbs_update_origin update_origin
  5460.   def update_origin
  5461.       mog_fmbs_update_origin
  5462.       if bitmap and @battler.f_char_data[0]
  5463.          self.ox = @cw / 2 ;  self.oy = @ch
  5464.       end      
  5465.   end
  5466.    
  5467. end
  5468.  
  5469. #==============================================================================
  5470. # ¦ Sprite Battler
  5471. #==============================================================================
  5472. class Sprite_Battler < Sprite_Base
  5473.  
  5474.   #--------------------------------------------------------------------------
  5475.   # ? Can create Battler Shadow
  5476.   #--------------------------------------------------------------------------  
  5477.   if $imported[:mog_battler_shadow]
  5478.   alias mog_fmbs_can_create_battler_shadow? can_create_battler_shadow?
  5479.   def can_create_battler_shadow?
  5480.       return false if $game_system.fmbs_data[0]
  5481.       mog_fmbs_can_create_battler_shadow?
  5482.   end
  5483.   end  
  5484.  
  5485.   #--------------------------------------------------------------------------
  5486.   # ? Refresh Fms Shadow
  5487.   #--------------------------------------------------------------------------            
  5488.   def refresh_fmbs_shadow
  5489.       return if !$game_system.fmbs_data[0]
  5490.       return if !@shadow_sprite.nil?
  5491.       return if !MOG_LMBS::SHADOW_ENABLE
  5492.       return if @battler.f_body_width == 0
  5493.       @shadow_sprite = Sprite.new
  5494.       @shadow_image = Cache.system("F_Shadow")
  5495.       @shadow_sprite.bitmap = Bitmap.new(@battler.f_body_width,@shadow_image.height)
  5496.       @shadow_sprite.bitmap.stretch_blt(@shadow_sprite.bitmap.rect, @shadow_image, @shadow_image.rect)
  5497.       @shadow_sprite.ox = @shadow_sprite.bitmap.width / 2
  5498.       @shadow_sprite.oy = @shadow_sprite.bitmap.height / 2
  5499.       @shadow_sprite.viewport = self.viewport
  5500.       @shadow_pos = MOG_LMBS::SHADOW_POSITION
  5501.   end
  5502.  
  5503.   #--------------------------------------------------------------------------
  5504.   # ? Dispose F Shadow
  5505.   #--------------------------------------------------------------------------            
  5506.   def dispose_f_shadow
  5507.       return if @shadow_sprite.nil?
  5508.       @shadow_sprite.bitmap.dispose
  5509.       @shadow_sprite.dispose
  5510.   end
  5511.  
  5512.   #--------------------------------------------------------------------------
  5513.   # ? Update Fmbs Shadow
  5514.   #--------------------------------------------------------------------------            
  5515.   def update_fmbs_shadow
  5516.       refresh_fmbs_shadow if @shadow_sprite.nil?
  5517.       return if @shadow_sprite.nil?
  5518.       @shadow_sprite.x = self.x + @shadow_pos[0]
  5519.       @shadow_sprite.y = @battler.f_ground + @shadow_pos[1]
  5520.       @shadow_sprite.z = self.z - 10
  5521.       @shadow_sprite.opacity = self.opacity
  5522.       @shadow_sprite.visible = self.visible
  5523.       @shadow_sprite.mirror = self.mirror
  5524.   end  
  5525.  
  5526.   #--------------------------------------------------------------------------
  5527.   # ? Update Position
  5528.   #--------------------------------------------------------------------------      
  5529.   alias mog_fmbs_update_position update_position
  5530.   def update_position
  5531.       return if $game_temp.fmb_menu_phase[0]
  5532.       update_fmbs_shadow
  5533.       return if $game_temp.fmb_phase_end == 4
  5534.       refresh_fmbs_initial_position if @f_ini_p.nil?
  5535.       mog_fmbs_update_position
  5536.       update_fmbs_eh      
  5537.       update_fmbs_flying_type
  5538.       update_fmbs_z
  5539.   end  
  5540.  
  5541.   #--------------------------------------------------------------------------
  5542.   # ? Update Fmbs Z
  5543.   #--------------------------------------------------------------------------      
  5544.   def update_fmbs_z
  5545.       return if @battler.nil?
  5546.       return if BattleManager.active_actor.nil?
  5547.       self.z += 10 if @battler == BattleManager.active_actor
  5548.   end
  5549.      
  5550.   #--------------------------------------------------------------------------
  5551.   # ? Update Fmbs EH
  5552.   #--------------------------------------------------------------------------      
  5553.   def update_fmbs_eh
  5554.       return if @sprites_p[@battler.sprite_data[0]].nil?
  5555.       self.y += @battler.sprite_data[14]
  5556.   end
  5557.      
  5558.   #--------------------------------------------------------------------------
  5559.   # ? Update Fmbs Flying Type
  5560.   #--------------------------------------------------------------------------      
  5561.   def update_fmbs_flying_type
  5562.       return if !$game_system.fmbs_data[0]
  5563.       self.y += @battler.f_flying_type[2]
  5564.   end
  5565.  
  5566. end
  5567.  
  5568. #==============================================================================
  5569. # ¦ Sprite Battler
  5570. #==============================================================================
  5571. class Sprite_Battler < Sprite_Base
  5572.  
  5573.   #--------------------------------------------------------------------------
  5574.   # ? Update FMBS Skills
  5575.   #--------------------------------------------------------------------------            
  5576.   def update_fmbs_skills
  5577.       return if @skill_sprites.nil?
  5578.       make_sprite_skill if need_make_sprite_skill?
  5579.       @skill_sprites.each do |sprite|
  5580.             sprite.update
  5581.             sprite.update_skill
  5582.             if sprite.duration == 0 or sprite.bitmap.disposed?
  5583.                sprite.dispose
  5584.                @skill_sprites.delete(sprite)
  5585.                @skill_sprites.compact!
  5586.             end
  5587.       end
  5588.   end
  5589.    
  5590.   #--------------------------------------------------------------------------
  5591.   # ? Need Make Sprite Skill
  5592.   #--------------------------------------------------------------------------            
  5593.   def need_make_sprite_skill?
  5594.       return true if @battler.f_action[0]
  5595.       return false
  5596.   end
  5597.  
  5598.   #--------------------------------------------------------------------------
  5599.   # ? Make Sprite Skill
  5600.   #--------------------------------------------------------------------------            
  5601.   def make_sprite_skill(lt = nil)    
  5602.       @battler.f_action[0] = false
  5603.       @skill_sprites.push(Sprite_Skills.new(self.viewport,self,lt))
  5604.   end
  5605.  
  5606.   #--------------------------------------------------------------------------
  5607.   # ? Fmbs Skills Clear
  5608.   #--------------------------------------------------------------------------            
  5609.   def fmbs_skills_clear
  5610.       @skill_sprites.each do |sprite|
  5611.            sprite.duration = 0
  5612.            sprite.dispose
  5613.            @skill_sprites.delete(sprite)
  5614.            @skill_sprites.compact!
  5615.       end
  5616.   end
  5617.  
  5618. end
  5619.  
  5620. #==============================================================================
  5621. # ¦ Sprite Skills
  5622. #==============================================================================
  5623. class Sprite_Skills < Sprite_Base
  5624.  
  5625.   attr_accessor :duration
  5626.   attr_accessor :piercing
  5627.  
  5628.   #--------------------------------------------------------------------------
  5629.   # ? Initialize
  5630.   #--------------------------------------------------------------------------            
  5631.   def initialize(viewport,user,lt = nil)
  5632.       super(viewport)
  5633.       @sprite = user
  5634.       @user = user.battler
  5635.       @user_collision = user.battler
  5636.       @direction = @user.f_direction
  5637.       @user_synchronize = lt.nil? ? true : false
  5638.       @skill = @user.f_action[1]
  5639.       @item = @skill
  5640.       @item = @user.equips[0] if @user.item_weapon?(@skill) and !@user.equips[0].nil?    
  5641.       @skill_type = @user.f_action[1].is_a?(RPG::Skill) ? 0 : 1
  5642.       @move_speed = [0,0]
  5643.       @duration = @user.f_action[7] != 0 ? @user.f_action[7] : 60
  5644.       @range = [0,0,0,0]
  5645.       @piercing = [true,false]
  5646.       @targets_done = []
  5647.       @multi_hit = false
  5648.       @ignore_knockback = false
  5649.       @ignore_guard = false
  5650.       @ignore_reflect = false
  5651.       @on_target = false
  5652.       @auto_target = lt.nil? ? false : true
  5653.       @collision_wait_duration = !lt.nil? ? lt : 5
  5654.       @pr_target = @user.f_action[3]
  5655.       @hit_animation_id = 0
  5656.       @ignore_p_target = false
  5657.       if @skill.nil?
  5658.          self.bitmap = Bitmap.new(16,16)
  5659.          self.ox = self.bitmap.width / 2
  5660.          self.mirror = @sprite.mirror
  5661.          self.oy = self.bitmap.height / 2
  5662.          self.x = @user.screen_x - self.ox
  5663.          self.y = @user.screen_y - @user.f_body_height2 - 1
  5664.          self.z = @sprite.z + 1
  5665.          @user_synchronize = false
  5666.          animation = $data_animations[@user.f_action[2]]
  5667.          mirror = @user.animation_mirror
  5668.          start_animation(animation, mirror)
  5669.       else
  5670.           name = $1.to_s if @item.note =~ /<F Sprite = (\S+)>/
  5671.           if !name.nil?
  5672.              ns = $1.to_i if name =~ /\[F(\d+)]/
  5673.              sp = name =~ /\[S(\d+)]/ ? $1.to_s : MOG_LMBS::DEFAULT_SPRITE_ANIMATION_SPEED
  5674.              if ns.nil?
  5675.                 self.bitmap = Cache.projectile(name).dup
  5676.              else  
  5677.                 @anime_data = [Cache.projectile(name),ns.to_i,sp.to_i,ns.to_i,0]
  5678.                 @cw = @anime_data[0].width / @anime_data[1]
  5679.                 @ch = @anime_data[0].height
  5680.                 self.bitmap = Bitmap.new(@cw,@ch)
  5681.                 update_bitmap_rect
  5682.              end  
  5683.           else
  5684.              self.bitmap = Bitmap.new(16,16)
  5685.           end  
  5686.           self.ox = self.bitmap.width / 2
  5687.           self.mirror = @sprite.mirror
  5688.           self.oy = self.bitmap.height / 2
  5689.           self.x = @user.screen_x - self.ox
  5690.           self.y = @user.screen_y - @user.f_body_height2
  5691.           self.z = @sprite.z + 1
  5692.           self.blend_type = $1.to_i if @item.note =~ /<F Blend Type = (\S+)>/
  5693.           set_skill_data
  5694.       end
  5695.       @cw = self.bitmap.width ; @ch = self.bitmap.height
  5696.       @duration = 1 if @duration < 1
  5697.       @collision_wait_duration = 1 if @collision_wait_duration < 1
  5698.       set_animation if !@skill.nil? and @user.f_action[2] == 0
  5699.       update_movement
  5700.       check_collision if !@pr_target.nil?
  5701.       execute_animation if !@ani_id.nil?  
  5702.       self.z = @user.screen_z + 20
  5703.       if !@item.nil? and @item.note =~ /<F Auto Target Area>/
  5704.          @auto_target = false ; @ignore_p_target = true
  5705.       end          
  5706.   end
  5707.  
  5708.   #--------------------------------------------------------------------------
  5709.   # ? Execute Animation
  5710.   #--------------------------------------------------------------------------            
  5711.   def execute_animation
  5712.       animation = $data_animations[@ani_id]
  5713.       mirror = @user.animation_mirror
  5714.       start_animation(animation, self.mirror)  
  5715.   end  
  5716.  
  5717.   #--------------------------------------------------------------------------
  5718.   # ? Set Animation
  5719.   #--------------------------------------------------------------------------            
  5720.   def set_animation
  5721.       @hit_animation_id = $1.to_i.abs if @item.note =~ /<F Hit Animation = (\d+)>/
  5722.       anime_id = nil
  5723.       if @skill.is_a?(RPG::Skill) and @skill.id == @user.attack_skill_id
  5724.          if @user.is_a?(Game_Actor) and !@user.equips[0].nil?
  5725.             @hit_animation_id = @user.equips[0].animation_id
  5726.            else
  5727.             @hit_animation_id = 1 if @user.is_a?(Game_Enemy)
  5728.          end
  5729.       else  
  5730.          anime_id = @item.animation_id.abs
  5731.       end    
  5732.       @ani_id = anime_id
  5733.       if !@ani_id.nil? and @ani_id > 0
  5734.           anime = $data_animations[anime_id] rescue nil
  5735.           if !anime.nil?
  5736.               ani_duration = (anime.frame_max * 4) + 1
  5737.               @duration = ani_duration if @duration < ani_duration
  5738.           end    
  5739.        end  
  5740.   end
  5741.      
  5742.   #--------------------------------------------------------------------------
  5743.   # ? Update Bitmap Rect
  5744.   #--------------------------------------------------------------------------            
  5745.   def update_bitmap_rect
  5746.       @anime_data[3] += 1
  5747.       return if @anime_data[3] < @anime_data[2]
  5748.       @anime_data[3] = 0
  5749.       self.bitmap.clear
  5750.       s_rect = Rect.new(@cw * @anime_data[4],0,@cw,@ch)
  5751.       self.bitmap.blt(0,0,@anime_data[0],s_rect)
  5752.       @anime_data[4] += 1
  5753.       @anime_data[4] = 0 if @anime_data[4] >= @anime_data[1]
  5754.   end
  5755.  
  5756.   #--------------------------------------------------------------------------
  5757.   # ? Set Skill Data
  5758.   #--------------------------------------------------------------------------            
  5759.   def set_skill_data
  5760.       #Range
  5761.       @range = [(self.ox / 3),-24,(self.oy / 4),(self.oy / 2)]
  5762.       if @item.note =~ /<F Area = \s*(\-*\d+)\s* - \s*(\-*\d+)\s* - \s*(\-*\d+)\s* - \s*(\-*\d+)\s*>/
  5763.          @range = [$1.to_i.abs,$2.to_i.abs,$3.to_i.abs,$4.to_i.abs]  
  5764.       end  
  5765.       #Piercing
  5766.       @piercing = [false,false] if @item.note =~ /F Disable Piercing>/
  5767.       #Move Speed
  5768.       if @item.note =~ /<F Move Speed = x\s*(\-*\d+)\s* y\s*(\-*\d+)\s*>/
  5769.          dx = @user.f_direction == 0 ? -$1.to_i : $1.to_i
  5770.          @np = [dx,$2.to_i]
  5771.          if @user.item_weapon?(@item)
  5772.             @np[1] = 5 if @np[1] == 0
  5773.          end
  5774.          @user_synchronize = false
  5775.          self.x += self.ox
  5776.       end  
  5777.       @multi_hit = true if @item.note =~ /<F Multi Hit>/
  5778.       @ignore_knockback = true if @item.note =~ /<F Ignore Knockback>/
  5779.       @ignore_knockback = true if @multi_hit
  5780.       @ignore_guard = true if @item.note =~ /<F Ignore Guard>/
  5781.       @ignore_reflect = true if @item.note =~ /<F Ignore Reflect>/
  5782.       @on_target = true if @item.note =~ /<F On Target>/
  5783.       @collision_wait_duration = $1.to_i.abs if @item.note =~ /<F Wait Collision = (\d+)>/
  5784.       @collision_wait_duration = 1 if !@np.nil? and @collision_wait_duration == 5
  5785.       @oxy = [0,@sprite.bitmap.height / 2]
  5786.       @user.animation_id = $1.to_i if @item.note =~ /<F User Animation = (\d+)>/
  5787.   end
  5788.  
  5789.  #--------------------------------------------------------------------------
  5790.   # ? Dispose
  5791.   #--------------------------------------------------------------------------            
  5792.   def dispose
  5793.       super
  5794.       self.bitmap.dispose rescue nil
  5795.   end
  5796.  
  5797.   #--------------------------------------------------------------------------
  5798.   # ? Update
  5799.   #--------------------------------------------------------------------------            
  5800.   def update_skill
  5801.       return if @duration == 0
  5802.       return if self.bitmap.disposed?
  5803.       if !@skill.nil?
  5804.          update_wait_collision if @collision_wait_duration > 0
  5805.          update_movement unless @ignore_p_target
  5806.          check_collision if !BattleManager.f_targets.nil?
  5807.          update_bitmap_rect if !@anime_data.nil?
  5808.       end  
  5809.       update_skill_duration rescue nil    
  5810.   end
  5811.  
  5812.   #--------------------------------------------------------------------------
  5813.   # ? Update Wait Collision
  5814.   #--------------------------------------------------------------------------      
  5815.   def update_wait_collision
  5816.       @collision_wait_duration -= 1
  5817.   end  
  5818.    
  5819.   #--------------------------------------------------------------------------
  5820.   # ? Animation Set Sprite
  5821.   #--------------------------------------------------------------------------      
  5822.   def animation_set_sprites(frame)    
  5823.       @ani_ox = self.x ; @ani_oy = self.y
  5824.       if @animation.position == 0
  5825.          @ani_oy -= @user.f_body_height2
  5826.       elsif @animation.position == 2
  5827.          @ani_oy += @user.f_body_height2
  5828.       end
  5829.       super
  5830.       @ani_sprites.each_with_index do |sprite, i| sprite.z = self.z + 1  end
  5831.   end    
  5832.  
  5833.   #--------------------------------------------------------------------------
  5834.   # ? Update Skill Duration
  5835.   #--------------------------------------------------------------------------      
  5836.   def update_skill_duration
  5837.       @duration -= 1 if @duration >= 0
  5838.       self.opacity -= 25 if @piercing[1] or @user.dead?
  5839.       self.opacity -= 50 if !@piercing[1] and @duration < 5
  5840.       @piercing[1] = true if out_of_screen?
  5841.       if dispose_skill?
  5842.          @duration = 0
  5843.          self.opacity = 0
  5844.          self.visible = false
  5845.          self.bitmap.dispose rescue nil
  5846.       end
  5847.   end    
  5848.  
  5849.   #--------------------------------------------------------------------------
  5850.   # ? Dispose Skill?
  5851.   #--------------------------------------------------------------------------      
  5852.   def dispose_skill?
  5853.       return true if @user_synchronize and !@user.f_mov_acting?
  5854.       return true if @duration <= 0
  5855.       return true if self.opacity == 0
  5856.       return true if out_of_screen?
  5857.       return false
  5858.   end
  5859.  
  5860.   #--------------------------------------------------------------------------
  5861.   # ? Out of Screen
  5862.   #--------------------------------------------------------------------------      
  5863.   def out_of_screen?
  5864.       return true if !self.x.between?((@user.f_limit_x1 - @cw),(@user.f_limit_x2 + @cw))
  5865.       return true if !self.y.between?((@user.f_limit_y1 - @ch),(@user.f_ground + (@ch / 2)))
  5866.       return false
  5867.   end
  5868.    
  5869. end
  5870.  
  5871. #==============================================================================
  5872. # ¦ Sprite Skills
  5873. #==============================================================================
  5874. class Sprite_Skills < Sprite_Base
  5875.  
  5876.   #--------------------------------------------------------------------------
  5877.   # ? Check Collision
  5878.   #--------------------------------------------------------------------------            
  5879.   def check_collision
  5880.       return if @piercing[1]
  5881.       targets = [] ; dmg = false
  5882.       BattleManager.f_targets.each do |sprite|
  5883.            next if !execute_effect?(sprite.battler)
  5884.            targets.push(sprite.battler) if targets_in_range?(sprite)
  5885.       end
  5886.       targets.each do |battler|
  5887.          dmg = true
  5888.          @skill.repeats.times { execute_effect(battler, @skill)}
  5889.       end  
  5890.       @piercing[1] = true if !@piercing[0] and dmg
  5891.   end
  5892.  
  5893.   #--------------------------------------------------------------------------
  5894.   # ? Targets In Range
  5895.   #--------------------------------------------------------------------------            
  5896.   def targets_in_range?(sprite)
  5897.       return true if @auto_target
  5898.       br = [self.x, self.y] ; sr = [0,0,0,0]
  5899.       if @direction == 0
  5900.          sr[0] = sprite.x - (sprite.battler.f_body_width2 + @range[1])
  5901.          sr[1] = sprite.x + (sprite.battler.f_body_width2 + @range[0])
  5902.       else
  5903.          sr[0] = sprite.x - (sprite.battler.f_body_width2 + @range[0])
  5904.          sr[1] = sprite.x + (sprite.battler.f_body_width2 + @range[1])
  5905.       end  
  5906.       sr[2] = sprite.y + @range[2]
  5907.       sr[3] = sprite.y - (sprite.battler.f_body_height + @range[3])
  5908.       return false if !br[0].between?(sr[0],sr[1])
  5909.       return false if !br[1].between?(sr[3],sr[2])
  5910.       return true
  5911.   end  
  5912.  
  5913.   #--------------------------------------------------------------------------
  5914.   # ? Check Collision
  5915.   #--------------------------------------------------------------------------            
  5916.   def execute_effect?(target)
  5917.       return false if $game_temp.battle_end
  5918.       return false if $game_temp.fmb_phase_data[1] > 0
  5919.       return false if target.nil?
  5920.       return false if @skill.nil?
  5921.       return false if @user.dead?
  5922.       # Base -------------------------------------------------------------------
  5923.       return false if !@multi_hit and @targets_done.include?(target)
  5924.       return false if !@ignore_p_target and !@pr_target.nil? and @pr_target != target    
  5925.       # Scope ------------------------------------------------------------------
  5926.       return false if @skill.scope == 0
  5927.       return false if [11].include?(@skill.scope) and target != @user
  5928.       return false if [1,2,3,4,5,6].include?(@skill.scope) and target.dead?
  5929.       return false if [9,10].include?(@skill.scope) and !target.dead?
  5930.       return true if @skill.scope == 11 and target == @user_collision
  5931.       if @user_collision.is_a?(Game_Actor)
  5932.          return false if [1,2,3,4,5,6].include?(@skill.scope) and target.is_a?(Game_Actor)
  5933.          return false if [7,8,9,10].include?(@skill.scope) and target.is_a?(Game_Enemy)
  5934.       else  
  5935.          return false if [1,2,3,4,5,6].include?(@skill.scope) and target.is_a?(Game_Enemy)
  5936.          return false if [7,8,9,10].include?(@skill.scope) and target.is_a?(Game_Actor)
  5937.       end        
  5938.       return true if [9,10].include?(@skill.scope) and target.dead?
  5939.       # Knockback --------------------------------------------------------------
  5940.       return false if @collision_wait_duration > 0
  5941.       return true if @auto_target
  5942.       return false if target.f_damage[2] > 0
  5943.       return false if target.f_knockback[1] > 0
  5944.       unless @ignore_knockback
  5945.           return false if target.f_knockback[2] > 0
  5946.           return false if target.f_knockback[3] > 0
  5947.       end
  5948.       # ------------------------------------------------------------------------
  5949.       return true
  5950.   end
  5951.  
  5952. end
  5953.  
  5954. #==============================================================================
  5955. # ¦ Sprite Skills
  5956. #==============================================================================
  5957. class Sprite_Skills < Sprite_Base
  5958.  
  5959.   #--------------------------------------------------------------------------
  5960.   # ? Update Movement
  5961.   #--------------------------------------------------------------------------            
  5962.   def update_movement
  5963.       if !@pr_target.nil?
  5964.          self.x = @pr_target.screen_x
  5965.          self.y = @pr_target.screen_y - @pr_target.f_body_height2 - 12        
  5966.       elsif @on_target and !@user_collision.f_target.nil?
  5967.          self.x = @user_collision.f_target.screen_x
  5968.          self.y = @user_collision.f_target.screen_y - @user_collision.f_target.f_body_height2 - 12          
  5969.       elsif @np.nil?
  5970.          self.x = @user.screen_x
  5971.          self.y = @user.screen_y - @user.f_body_height2 - 12      
  5972.       else
  5973.         unless @piercing[1]
  5974.            self.x += @np[0]
  5975.            self.y += @np[1]
  5976.         end
  5977.       end
  5978.   end
  5979.    
  5980. end
  5981.  
  5982. #==============================================================================
  5983. # ¦ Sprite Skills
  5984. #==============================================================================
  5985. class Sprite_Skills < Sprite_Base
  5986.  
  5987.   #--------------------------------------------------------------------------
  5988.   # ? Execute Effect
  5989.   #--------------------------------------------------------------------------
  5990.   def execute_effect(target, item)
  5991.       target.f_damage = [20,item,5,false,@direction,1,target.f_grv_speed + 2,20,10,@hit_animation_id]
  5992.       target.f_knockback[1] = 22
  5993.       target.f_guard[1] = false
  5994.       @targets_done.push(target) if !@multi_hit and !@targets_done.include?(target)
  5995.       if apply_reflect_effect?(target, item)
  5996.          apply_reflect_effect(target, item)
  5997.       elsif apply_guard_effect?(target, item)
  5998.          if target.f_guard[0] == 1
  5999.             apply_guard_effect(target, item)
  6000.          else
  6001.             target.f_guard[1] = true
  6002.             apply_item_effects_f(target, item)
  6003.          end  
  6004.       else  
  6005.          apply_item_effects_f(target, item)
  6006.       end  
  6007.       effects_after_damage(target, item)
  6008.    end
  6009.  
  6010.   #--------------------------------------------------------------------------
  6011.   # ? Apply Reflect Effect
  6012.   #--------------------------------------------------------------------------
  6013.   def apply_reflect_effect(target, item)
  6014.       @user_collision = target
  6015.       @collision_wait_duration = 5
  6016.       self.mirror = @direction == 0 ? true : false
  6017.       @direction = @direction == 0 ? 1 : 0
  6018.       @np[0] = -@np[0]
  6019.       @np[1] = -@np[1]
  6020.       target.damage.push(["Reflect","String"]) if $imported[:mog_damage_popup]
  6021.   end
  6022.      
  6023.   #--------------------------------------------------------------------------
  6024.   # ? Apply Reflect Effect?
  6025.   #--------------------------------------------------------------------------
  6026.   def apply_reflect_effect?(target, item)
  6027.       return false if @np.nil?
  6028.       return false if @user_synchronize
  6029.       return false if @ignore_reflect
  6030.       return false if @skill_type == 1
  6031.       return false if target.f_direction == @direction
  6032.       return target.f_reflect?
  6033.   end  
  6034.    
  6035.   #--------------------------------------------------------------------------
  6036.   # ? Apply Guard Effect?
  6037.   #--------------------------------------------------------------------------
  6038.   def apply_guard_effect?(target, item)
  6039.       return false if !target.f_mov_guarding?
  6040.       return false if @ignore_guard
  6041.      # return false if @ignore_knockback
  6042.       return false if @direction == target.f_direction
  6043.       #return false if @skill_type == 1
  6044.       return true
  6045.   end
  6046.  
  6047.   #--------------------------------------------------------------------------
  6048.   # ? Apply Guard Effect?
  6049.   #--------------------------------------------------------------------------
  6050.   def apply_guard_effect(target, item)
  6051.       target.f_knockback[4] = 20
  6052.       target.execute_target_animation(@user, item)
  6053.       target.damage.push(["Guard","String"]) if $imported[:mog_damage_popup]
  6054.   end
  6055.  
  6056.   #--------------------------------------------------------------------------
  6057.   # ? Effects After Damage
  6058.   #--------------------------------------------------------------------------
  6059.    def effects_after_damage(target, item)
  6060.        @user.last_target_index = target.index
  6061.        effect_for_dead(target, item) if target.dead?
  6062.    end    
  6063.        
  6064.   #--------------------------------------------------------------------------
  6065.   # ? Effects For Dead
  6066.   #--------------------------------------------------------------------------
  6067.    def effect_for_dead(target, item)
  6068.        target.f_clear_poses
  6069.        target.f_action_clear
  6070.        BattleManager.next_actor_index(1) if target == @user
  6071.        if $game_party.all_dead? or $game_troop.all_dead?
  6072.           $game_temp.fmb_phase_data = [1,90]
  6073.           RPG::BGM.fade(2000)
  6074.        end
  6075.    end    
  6076.    
  6077.   #--------------------------------------------------------------------------
  6078.   # ? Apply Skill/Item Effect
  6079.   #--------------------------------------------------------------------------
  6080.   def apply_item_effects_f(target, item)
  6081.       target.item_apply(@user, item)
  6082.   end  
  6083.  
  6084. end
  6085.  
  6086. #==============================================================================
  6087. # ¦ Spriteset Battle
  6088. #==============================================================================
  6089. class Spriteset_Battle
  6090.  
  6091.   #--------------------------------------------------------------------------
  6092.   # ? Initialize
  6093.   #--------------------------------------------------------------------------            
  6094.   alias mog_fmbs_initialize initialize
  6095.   def initialize
  6096.        mog_fmbs_initialize
  6097.        BattleManager.set_f_targets(battler_sprites)
  6098.        create_f_cursor
  6099.        create_f_cursor_actor
  6100.        create_f_escape      
  6101.   end
  6102.  
  6103.   #--------------------------------------------------------------------------
  6104.   # ? Dispose
  6105.   #--------------------------------------------------------------------------            
  6106.   alias mog_fmbs_dispose dispose
  6107.   def dispose
  6108.       mog_fmbs_dispose
  6109.       BattleManager.set_f_targets(nil)
  6110.       dispose_f_cursor
  6111.       dispose_f_cursor_actor
  6112.       dispose_f_escape
  6113.   end
  6114.  
  6115.   #--------------------------------------------------------------------------
  6116.   # ? Update
  6117.   #--------------------------------------------------------------------------            
  6118.   alias mog_fmbs_spriteset_update update
  6119.   def update
  6120.       update_f_cursor
  6121.       update_f_cursor_actor
  6122.       update_f_escape
  6123.       mog_fmbs_spriteset_update
  6124.   end
  6125.  
  6126.   #--------------------------------------------------------------------------
  6127.   # ? Create f Cursor Actor
  6128.   #--------------------------------------------------------------------------            
  6129.   def create_f_cursor_actor
  6130.       return if !$game_system.fmbs_data[0]
  6131.       return if $game_party.members.empty?    
  6132.       @f_cursor_actor = Sprite.new
  6133.       @f_cursor_actor.bitmap = Cache.system("Battle_Cursor_Actor")    
  6134.       @f_cursor_actor.z = 150 ; @f_cursor_actor.opacity = 0
  6135.       @f_capos = [-(@f_cursor_actor.bitmap.width / 2) + MOG_LMBS::CURSOR_ACTOR_POSITION[0],
  6136.       -@f_cursor_actor.bitmap.height + MOG_LMBS::CURSOR_ACTOR_POSITION[1]
  6137.       ]
  6138.   end
  6139.  
  6140.   #--------------------------------------------------------------------------
  6141.   # ? Dispose f Cursor Actor
  6142.   #--------------------------------------------------------------------------            
  6143.   def dispose_f_cursor_actor
  6144.       return if @f_cursor_actor.nil?
  6145.       @f_cursor_actor.bitmap.dispose
  6146.       @f_cursor_actor.dispose
  6147.   end
  6148.  
  6149.   #--------------------------------------------------------------------------
  6150.   # ? Update f Cursor Actor
  6151.   #--------------------------------------------------------------------------            
  6152.   def update_f_cursor_actor
  6153.       return if @f_cursor_actor.nil?
  6154.       $game_temp.f_actor_cursor_d -= 1 if $game_temp.f_actor_cursor_d > 0
  6155.       if f_cursor_actor_visible?
  6156.         @f_cursor_actor.opacity += 25
  6157.       else
  6158.         @f_cursor_actor.opacity -= 10
  6159.       end
  6160.       if !BattleManager.active_actor.nil?
  6161.          fxc = BattleManager.active_actor.screen_x + @f_capos[0]
  6162.          fxy = BattleManager.active_actor.screen_y - BattleManager.active_actor.f_body_height + @f_capos[1]
  6163.          @f_cursor_actor.x = fxc
  6164.          @f_cursor_actor.y = fxy
  6165.       end  
  6166.       if $imported[:mog_battle_camera]
  6167.          @f_cursor_actor.ox = $game_temp.viewport_oxy[0]
  6168.          @f_cursor_actor.oy = $game_temp.viewport_oxy[1]
  6169.       end
  6170.   end
  6171.  
  6172.   #--------------------------------------------------------------------------
  6173.   # ? F Cursor Actor Visible?
  6174.   #--------------------------------------------------------------------------            
  6175.   def f_cursor_actor_visible?
  6176.       return false if BattleManager.active_actor.nil?
  6177.       return false if $game_temp.battle_end
  6178.       unless !MOG_LMBS::CURSOR_ACTOR_FADE_EFFECT
  6179.         return false if $game_temp.f_actor_cursor_d == 0
  6180.       end
  6181.       return true
  6182.   end
  6183.  
  6184.   #--------------------------------------------------------------------------
  6185.   # ? Create Battle Cursor
  6186.   #--------------------------------------------------------------------------            
  6187.   def create_f_cursor
  6188.       return if !$game_system.fmbs_data[0]
  6189.       return if $game_party.members.empty?
  6190.       @f_cursor_battler = nil
  6191.       @f_cursor = Sprite.new
  6192.       @f_cursor.bitmap = Cache.system("Battle_Cursor")
  6193.       @f_oxy = [@f_cursor.bitmap.width / 2,@f_cursor.bitmap.height / 2]
  6194.       @f_cursor.z = 150
  6195.       @f_cursor.visible = false
  6196.       @f_cursor_pos = MOG_LMBS::CURSOR_POSITION
  6197.       @f_cursor_name = Sprite.new
  6198.       @f_cursor_name.bitmap = Bitmap.new(120,32)
  6199.       @f_cursor_name.z = @f_cursor.z + 1
  6200.       @f_cursor_name.visible = false
  6201.       @f_cursor_name_pos = MOG_LMBS::CURSOR_NAME_POSITION
  6202.   end
  6203.  
  6204.   #--------------------------------------------------------------------------
  6205.   # ? F Refresh Cursor Name
  6206.   #--------------------------------------------------------------------------            
  6207.   def f_refresh_cursor_name
  6208.       @f_cursor_battler = $game_temp.f_cursor_target
  6209.       @f_cursor_name.bitmap.clear
  6210.       @f_cursor_name.bitmap.draw_text(0,0,120,32,$game_temp.f_cursor_target.name,1)
  6211.   end
  6212.  
  6213.   #--------------------------------------------------------------------------
  6214.   # ? Dispose F Cursor
  6215.   #--------------------------------------------------------------------------            
  6216.   def dispose_f_cursor
  6217.       return if @f_cursor.nil?
  6218.       @f_cursor.bitmap.dispose
  6219.       @f_cursor.dispose
  6220.       @f_cursor_name.bitmap.dispose
  6221.       @f_cursor_name.dispose
  6222.   end
  6223.  
  6224.   #--------------------------------------------------------------------------
  6225.   # ? Update f Cursor
  6226.   #--------------------------------------------------------------------------            
  6227.   def update_f_cursor
  6228.       return if @f_cursor.nil?
  6229.       @f_cursor.visible = f_cursor_visible?
  6230.       @f_cursor_name.visible = @f_cursor.visible
  6231.       return if !@f_cursor.visible
  6232.       if !$game_temp.f_cursor_target.nil?
  6233.           f_sprite_move(@f_cursor,0,@f_cursor.x,$game_temp.f_cursor_target.screen_x + @f_cursor_pos[0])
  6234.           f_sprite_move(@f_cursor,1,@f_cursor.y,$game_temp.f_cursor_target.screen_y + @f_cursor_pos[1])
  6235.           @f_cursor_name.x = @f_cursor.x + @f_cursor_name_pos[0] - 60
  6236.           @f_cursor_name.y = @f_cursor.y + @f_cursor_name_pos[1]
  6237.           f_refresh_cursor_name if @f_cursor_battler != $game_temp.f_cursor_target
  6238.       end  
  6239.       update_f_cursor_oxy if $imported[:mog_battle_camera]
  6240.       $game_temp.f_cursor_target = BattleManager.active_actor if $game_temp.f_cursor_target.nil?
  6241.   end
  6242.  
  6243.   #--------------------------------------------------------------------------
  6244.   # ?  F Sprite Move
  6245.   #--------------------------------------------------------------------------      
  6246.   def f_sprite_move(sprite,type,cp,np)
  6247.       sp = 5 + ((cp - np).abs / 10)
  6248.       if cp > np ;    cp -= sp ; cp = np if cp < np
  6249.       elsif cp < np ; cp += sp ; cp = np if cp > np
  6250.       end    
  6251.       sprite.x = cp if type == 0 ; sprite.y = cp if type == 1
  6252.   end    
  6253.  
  6254.   #--------------------------------------------------------------------------
  6255.   # ? F Cursor Visible?
  6256.   #--------------------------------------------------------------------------            
  6257.   def f_cursor_visible?
  6258.       return false if $game_temp.f_cursor_target.nil?
  6259.       return false if ![3,4,7].include?($game_temp.fmb_menu_phase[1])
  6260.       return true
  6261.   end
  6262.  
  6263.   #--------------------------------------------------------------------------
  6264.   # ? Update f Cursor OXY
  6265.   #--------------------------------------------------------------------------            
  6266.   def update_f_cursor_oxy
  6267.       @f_cursor.ox = $game_temp.viewport_oxy[0] + @f_oxy[0]
  6268.       @f_cursor.oy = $game_temp.viewport_oxy[1] + @f_oxy[1]
  6269.       @f_cursor_name.ox = $game_temp.viewport_oxy[0]
  6270.       @f_cursor_name.oy = $game_temp.viewport_oxy[1]
  6271.   end
  6272.  
  6273.   #--------------------------------------------------------------------------
  6274.   # ? Create F Escape
  6275.   #--------------------------------------------------------------------------            
  6276.   def create_f_escape
  6277.       return if $game_party.members.empty?
  6278.       @f_escape_meter = Cache.system("F_Escape_B")
  6279.       @f_escape_cw = @f_escape_meter.width
  6280.       @f_escape_ch = @f_escape_meter.height
  6281.       @f_escape_a = Sprite.new
  6282.       @f_escape_a.bitmap = Cache.system("F_Escape_A")
  6283.       @f_escape_a.z = 151
  6284.       @f_escape_a.x = MOG_LMBS::ESCAPE_SPRITE_POSITION[0]
  6285.       @f_escape_a.y = MOG_LMBS::ESCAPE_SPRITE_POSITION[1]
  6286.       @f_escape_a.ox = @f_escape_a.bitmap.width / 2
  6287.       @f_escape_a.opacity = 0
  6288.       @f_escape_b = Sprite.new
  6289.       @f_escape_b.bitmap = Bitmap.new(@f_escape_cw,@f_escape_ch)
  6290.       @f_escape_b.z = 152
  6291.       @f_escape_b.x = @f_escape_a.x + MOG_LMBS::ESCAPE_SPRITE_METER_POSITION[0]
  6292.       @f_escape_b.y = @f_escape_a.y + MOG_LMBS::ESCAPE_SPRITE_METER_POSITION[1]
  6293.       @f_escape_b.ox = @f_escape_b.bitmap.width / 2
  6294.       @f_escape_b.opacity = 0
  6295.       update_f_escape_rect
  6296.   end
  6297.  
  6298.   #--------------------------------------------------------------------------
  6299.   # ? Dispose F Escape
  6300.   #--------------------------------------------------------------------------            
  6301.   def dispose_f_escape
  6302.       return if @f_escape_a.nil?
  6303.       @f_escape_a.bitmap.dispose
  6304.       @f_escape_a.dispose
  6305.       @f_escape_b.bitmap.dispose
  6306.       @f_escape_b.dispose      
  6307.   end
  6308.  
  6309.   #--------------------------------------------------------------------------
  6310.   # ? Update F Escape
  6311.   #--------------------------------------------------------------------------            
  6312.   def update_f_escape
  6313.       return if @f_escape_a.nil?      
  6314.       update_f_escape_visible
  6315.       return if BattleManager.active_actor.nil?
  6316.       return if @f_escape_a.opacity == 0
  6317.       update_f_escape_rect
  6318.   end
  6319.  
  6320.   #--------------------------------------------------------------------------
  6321.   # ? Update F Escape Visible
  6322.   #--------------------------------------------------------------------------            
  6323.   def update_f_escape_visible
  6324.       return if @f_escape_a.nil?
  6325.       if $game_temp.f_escape_phase[2] > 0
  6326.          $game_temp.f_escape_phase[2] -= 1
  6327.          $game_temp.f_escape_phase[1] = 0 if $game_temp.f_escape_phase[2] == 0
  6328.       end  
  6329.       if f_escape_visible?
  6330.          @f_escape_a.opacity += 15
  6331.          @f_escape_a.visible = true
  6332.       else  
  6333.          @f_escape_a.opacity -= 10
  6334.          @f_escape_a.visible = false if @f_escape_a.opacity == 0
  6335.       end
  6336.       @f_escape_b.opacity = @f_escape_a.opacity
  6337.       @f_escape_b.visible = @f_escape_a.visible
  6338.   end
  6339.  
  6340.   #--------------------------------------------------------------------------
  6341.   # ? F Escape Visible?
  6342.   #--------------------------------------------------------------------------            
  6343.   def f_escape_visible?
  6344.       return false if $game_temp.battle_end
  6345.       return false if $game_temp.f_escape_phase[1] == 0
  6346.       return false if $game_temp.f_escape_phase[2] == 0
  6347.       return false if BattleManager.active_actor.nil?
  6348.       return false if BattleManager.active_actor.dead?
  6349.       return true
  6350.   end
  6351.  
  6352.   #--------------------------------------------------------------------------
  6353.   # ? Update f Escape Rect
  6354.   #--------------------------------------------------------------------------            
  6355.   def update_f_escape_rect
  6356.       @f_escape_b.bitmap.clear
  6357.       w = @f_escape_b.width * $game_temp.f_escape_phase[1] / BattleManager.active_actor.f_espace_duration
  6358.       e_rect = Rect.new(0,0,w,@f_escape_ch)
  6359.       @f_escape_b.bitmap.blt(0,0,@f_escape_meter,e_rect)
  6360.   end
  6361.  
  6362. end
  6363.  
  6364. if $imported[:mog_battle_camera]
  6365. #==============================================================================
  6366. # ¦ Spriteset Battle
  6367. #==============================================================================
  6368. class Spriteset_Battle
  6369.  
  6370.  #--------------------------------------------------------------------------
  6371.  # ? BCamera Center
  6372.  #--------------------------------------------------------------------------
  6373.  alias mog_fmbs_bcamera_center? bcamera_center?
  6374.  def bcamera_center?
  6375.      return false if $game_system.fmbs_data[0]
  6376.      mog_fmbs_bcamera_center?
  6377.  end
  6378.  
  6379.  #--------------------------------------------------------------------------
  6380.  # ? BC Move To
  6381.  #--------------------------------------------------------------------------
  6382.  alias mog_fmbs_bc_move_to bc_move_to
  6383.  def bc_move_to(type,cp,np)
  6384.      return if [2,4].include?($game_temp.fmb_phase_end)
  6385.      mog_fmbs_bc_move_to(type,cp,np)
  6386.  end
  6387.  
  6388. end
  6389.  
  6390. #==============================================================================
  6391. # ¦ Sprite Battler
  6392. #==============================================================================
  6393. class Sprite_Battler < Sprite_Base
  6394.  
  6395.   #--------------------------------------------------------------------------
  6396.   # ? Camera Range
  6397.   #--------------------------------------------------------------------------  
  6398.   def camera_range
  6399.       return [[$game_system.battle_camera_range.abs, 100].min, 0].max
  6400.   end    
  6401.  
  6402.   #--------------------------------------------------------------------------
  6403.   # ? Force Target Dmg Temp
  6404.   #--------------------------------------------------------------------------  
  6405.   alias mog_fmbs_force_target_dmg_temp? force_target_dmg_temp?
  6406.   def force_target_dmg_temp?
  6407.       return false if $game_system.fmbs_data[0]
  6408.       mog_fmbs_force_target_dmg_temp?
  6409.   end    
  6410.    
  6411.   #--------------------------------------------------------------------------
  6412.   # ? Update BC Cursor
  6413.   #--------------------------------------------------------------------------  
  6414.   alias mog_fmbs_update_bc_cursor update_bc_cursor
  6415.   def update_bc_cursor
  6416.       if $game_system.fmbs_data[0] and !BattleManager.active_actor.nil?
  6417.          if !$game_temp.f_cursor_target.nil? and [3,4,7].include?($game_temp.fmb_menu_phase[1])
  6418.              $game_temp.bc_data[2] = $game_temp.f_cursor_target.screen_x
  6419.              $game_temp.bc_data[3] = $game_temp.f_cursor_target.screen_y - $game_temp.f_cursor_target.f_ground / 2
  6420.              return
  6421.         else
  6422.            if BattleManager.active_actor == @battler
  6423.               $game_temp.bc_data[2] = self.x
  6424.               $game_temp.bc_data[3] = self.y - @battler.f_ground / 2
  6425.               return
  6426.             end
  6427.         end
  6428.       end    
  6429.       mog_fmbs_update_bc_cursor
  6430.   end
  6431. end    
  6432.  
  6433. end
  6434.  
  6435.  
  6436. if $imported[:mog_atb_skill_name]
  6437. #==============================================================================
  6438. # ¦ Game_Battler
  6439. #==============================================================================
  6440. class Game_Battler < Game_BattlerBase
  6441.  
  6442.   #--------------------------------------------------------------------------
  6443.   # ? F Set Action Data
  6444.   #--------------------------------------------------------------------------            
  6445.   alias mog_fmbs_f_set_action_data f_set_action_data
  6446.   def f_set_action_data(skill,pr_target,type)
  6447.       mog_fmbs_f_set_action_data(skill,pr_target,type)
  6448.       f_set_skill_name(skill) if f_set_skill_name?(skill)
  6449.   end
  6450.    
  6451.   #--------------------------------------------------------------------------
  6452.   # ? F Set Skill Name
  6453.   #--------------------------------------------------------------------------            
  6454.   def f_set_skill_name?(item)
  6455.       return false if item.nil?
  6456.       return false if self != BattleManager.active_actor
  6457.       if item.is_a?(RPG::Skill)
  6458.          return false if MOG_ATB_SKILL_NAME::DISABLE_SKILL_NAME.include?(item.id)
  6459.          return false if item.id == attack_skill_id
  6460.       elsif item.is_a?(RPG::Item)
  6461.          return false if MOG_ATB_SKILL_NAME::DISABLE_ITEM_NAME.include?(item.id)
  6462.       end
  6463.       return true
  6464.   end
  6465.  
  6466.   #--------------------------------------------------------------------------
  6467.   # ? F Set Skill Name
  6468.   #--------------------------------------------------------------------------            
  6469.   def f_set_skill_name(item)
  6470.       $game_temp.skill_name_bh = [item,true]
  6471.   end
  6472.  
  6473. end  
  6474.  
  6475. #==============================================================================
  6476. # ¦ Spriteset Battle
  6477. #==============================================================================
  6478. class Spriteset_Battle
  6479.  
  6480.   #--------------------------------------------------------------------------
  6481.   # ? F Set Skill Name
  6482.   #--------------------------------------------------------------------------            
  6483.   alias mog_fmbs_refresh_skill_name refresh_skill_name
  6484.   def refresh_skill_name
  6485.       mog_fmbs_refresh_skill_name
  6486.       if BattleManager.active_actor.sprite_data[11][1] > 0
  6487.       @skill_text[1] = BattleManager.active_actor.sprite_data[11][1] + 20 if !BattleManager.active_actor.nil?
  6488.       end
  6489.   end
  6490.  
  6491. end
  6492.  
  6493. end
  6494.  
  6495.  
  6496. # -----------------------------------------------------------------------------
  6497. if $imported[:mog_battle_cry]
  6498. #==============================================================================
  6499. # ¦ Game_Battler
  6500. #==============================================================================
  6501. class Game_Battler < Game_BattlerBase  
  6502.  
  6503.   #--------------------------------------------------------------------------
  6504.   # ? F Set Action Data
  6505.   #--------------------------------------------------------------------------            
  6506.   alias mog_battle_cry_f_set_action_data f_set_action_data
  6507.   def f_set_action_data(skill,pr_target,type)
  6508.       mog_battle_cry_f_set_action_data(skill,pr_target,type)
  6509.       if self.is_a?(Game_Actor) and skill.is_a?(RPG::Item)
  6510.           execute_battle_cry(5, skill.id, self)
  6511.       else    
  6512.           execute_battle_cry(2, skill.id, self)
  6513.       end    
  6514.   end  
  6515.  
  6516. end  
  6517.  
  6518. #==============================================================================
  6519. # ¦ Scene Battle
  6520. #==============================================================================
  6521. class Scene_Battle < Scene_Base
  6522.  
  6523.   #--------------------------------------------------------------------------
  6524.   # ? Next Actor Effect
  6525.   #--------------------------------------------------------------------------            
  6526.   alias mog_battle_cry_next_actor_effect next_actor_effect
  6527.   def next_actor_effect
  6528.       mog_battle_cry_next_actor_effect
  6529.       execute_battle_cry(7, nil, BattleManager.active_actor) unless BattleManager.active_actor.f_mov_acting?
  6530.   end
  6531.  
  6532.   #--------------------------------------------------------------------------
  6533.   # ? Update Basic
  6534.   #--------------------------------------------------------------------------            
  6535.   alias mog_battlecry_fmbs_update update
  6536.   def update
  6537.       execute_battle_cry_start
  6538.       mog_battlecry_fmbs_update
  6539.   end  
  6540.  
  6541. end
  6542.  
  6543. end
  6544.  
  6545. # -----------------------------------------------------------------------------
  6546. if $imported[:mog_ougi_animation]
  6547.  
  6548. #==============================================================================
  6549. # ¦ Game_Battler
  6550. #==============================================================================
  6551. class Game_Battler < Game_BattlerBase  
  6552.  
  6553.   #--------------------------------------------------------------------------
  6554.   # ? F Set Action Data
  6555.   #--------------------------------------------------------------------------            
  6556.   alias mog_ougi_f_set_action_data f_set_action_data
  6557.   def f_set_action_data(skill,pr_target,type)
  6558.       mog_ougi_f_set_action_data(skill,pr_target,type)
  6559.       update_sp_animation if skill.note =~ /<Ougi Animation>/
  6560.   end  
  6561.  
  6562.   #--------------------------------------------------------------------------
  6563.   # ? Update SP Animation
  6564.   #--------------------------------------------------------------------------  
  6565.   def update_sp_animation
  6566.       special_animation = Ougi_Animation.new(self)
  6567.       loop do
  6568.           @ougi_ref = true
  6569.           special_animation.update ; Graphics.update
  6570.           break if special_animation.phase == 3
  6571.       end
  6572.       special_animation.dispose
  6573.   end  
  6574.  
  6575. end
  6576.  
  6577. end
  6578.  
  6579. #-------------------------------------------------------------------------------
  6580. if $imported[:mog_battler_result]
  6581. #==============================================================================
  6582. # ¦ Battle Result
  6583. #==============================================================================
  6584. class Battle_Result
  6585.  
  6586.   #--------------------------------------------------------------------------
  6587.   # ? Initialize
  6588.   #--------------------------------------------------------------------------
  6589.   alias mog_fmbs_result_initialize initialize
  6590.   def initialize
  6591.       $game_temp.fmb_phase_end = 1
  6592.       mog_fmbs_result_initialize
  6593.   end
  6594.  
  6595. end
  6596.  
  6597. en
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement