Advertisement
FlipelyFlip

MOG_Monogatari Ohne Save

Dec 19th, 2024
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 335.85 KB | None | 0 0
  1. #==============================================================================
  2. # +++ MOG - Monogatari (物語)  (v1.5) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Sistema avançado de menu, voltado para scripters que desejam saber sobre
  8. # técnicas de manipulação de sprites e janelas.
  9. #==============================================================================
  10.  
  11. #==============================================================================
  12. # Version History.
  13. #==============================================================================
  14. # 1.5 - Função de desabilitar o save.
  15. #       Definição dos nomes das fontes baseado na fonte padrão do sistema,
  16. #       para resolver o problema de compatibilidade de fontes de outras línguas.
  17. #       Melhoria na posição das janelas.
  18. #       Correção do bug de não atualizar o número de itens. (Dual Wield)
  19. # 1.4 - Compatibilidade com Mog Menu Cursor.
  20. # 1.3 - Corrigido o bug do som da Scene Skill.
  21. # 1.2 - Compatibilidade com Third Party scripts.
  22. #     - Scene File incorporado ao sistema Monogatari, melhorando a performance.
  23. #==============================================================================
  24.  
  25. #==============================================================================
  26. # NOTA - Como este é um script para apresentar técnicas de RGSS, não foram
  27. # adicionados comentários explicativos no modulo de configuração
  28. #==============================================================================
  29.  
  30. #==============================================================================
  31. # ■ MAIN MENU
  32. #==============================================================================
  33. module MOG_MENU
  34.    NUMBER_OF_PARTICLES = 0  
  35.    BACKGROUND_SCROLL_SPEED = [0,0]
  36.    COMMAND_POSITION = [15,55]
  37.    COMMAND_POSITION_2 = [0,0]
  38.    COMMAND_SPACE = 0
  39.    COMMAND_NAME_POSITION = [0,0]
  40.    COMMAND_NAME_POSITION_2 = [213,21]
  41.    ACTOR_SPACE = 100
  42.    ACTOR_POSITION = [240,0]
  43.    
  44.    ACTOR_LAYOUT_POSITON = [0,325]
  45.    ACTOR_HP1_POSITON = [28,365]
  46.    ACTOR_HP2_POSITON = [50,380]
  47.    ACTOR_MP1_POSITON = [28,396]
  48.    ACTOR_MP2_POSITON = [50,410]  
  49.    ACTOR_HP_METER_POSITON = [29,379]
  50.    ACTOR_MP_METER_POSITON = [30,410]
  51.    ACTOR_LEVEL_POSITON = [20,341]
  52.    ACTOR_STATES_POSITION = [63,333]
  53.    
  54.    MEMBERS_FACE_POSITION =[170,55]
  55.    MEMBERS_FACE_SPACE = 64
  56.    MEMBERS_ARROW_LAYOUT_POSITION = [266,20]
  57.    MEMBERS_ARROW_1_POSITION = [251,23]
  58.    MEMBERS_ARROW_2_POSITION = [350,23]
  59.    TIME_NUMBER_POS = [565,17]
  60.    GOLD_NUMBER_POS = [170,450]
  61.    LOCATION_POS = [420,442]
  62.  end
  63.  
  64. #==============================================================================
  65. # ■ MOG_MENU ITEM
  66. #==============================================================================
  67. module MOG_MENU_ITEM
  68.    NUMBER_OF_PARTICLES = 0  
  69.    BACKGROUND_SCROLL_SPEED = [0,0]
  70.    COMMAND_POSITION = [0, 69]
  71.    BUTTON_POSITION = [259, 250]
  72.    BUTTON_SPACE = 100
  73. end
  74.  
  75. #==============================================================================
  76. # ■ MOG_MENU SKILL
  77. #==============================================================================
  78. module MOG_MENU_SKILL
  79.    NUMBER_OF_PARTICLES = 0  
  80.    BACKGROUND_SCROLL_SPEED = [0,0]
  81.    
  82. end
  83.  
  84. #==============================================================================
  85. # ■ MOG_ACTOR SKILL STATUS
  86. #==============================================================================
  87. module MOG_ACTOR_SKILL_STATUS
  88.   MEMBERS_SPACE = 0  
  89.   LAYOUT_POSITION = [155,0]
  90.   PAR_POSITION = [0,0]
  91.   FACE_POSITION = [-13,-3]
  92.   HP_METER_POSITION = [158,15]
  93.   MP_METER_POSITION = [177,35]
  94.   STATES_POSITION = [200,42]
  95.   STATES_SCROLLING_ANIMATION = false  
  96.   NAME_POSITION = [105,34]
  97.   FONT_SIZE = 18
  98.   FONT_BOLD = false  
  99. end
  100.  
  101. #==============================================================================
  102. # ■ MOG_MENU EQUIP
  103. #==============================================================================
  104. module MOG_MENU_EQUIP
  105.    NUMBER_OF_PARTICLES = 0  
  106.    BACKGROUND_SCROLL_SPEED = [0,0]
  107.    FONT_SIZE = 18
  108.    FONT_BOLD = false
  109.    FONT_ITALIC = false  
  110. end
  111.  
  112. #==============================================================================
  113. # ■ MOG_MENU STATUS
  114. #==============================================================================
  115. module MOG_EQUIP_STATUS  
  116.   LAYOUT_POSITION = [0,100]
  117.   FACE_POSITION = [125,-45]
  118.   PAR_POSITION = [5,32]
  119.   NAME_POSITION = [36,-3]
  120.   FONT_SIZE = 18
  121.   FONT_BOLD = false
  122. end
  123.  
  124. #==============================================================================
  125. # ■ MOG_MENU STATUS
  126. #==============================================================================
  127. module MOG_MENU_STATUS
  128.    NUMBER_OF_PARTICLES = 0  
  129.    BACKGROUND_SCROLL_SPEED = [0,0]
  130.  end
  131.  
  132. #==============================================================================
  133. # ■ MOG MENU PARTY
  134. #==============================================================================
  135. module MOG_MENU_PARTY
  136.    NUMBER_OF_PARTICLES = 0  
  137.    BACKGROUND_SCROLL_SPEED = [0,0]  
  138.  end
  139.  
  140. #==============================================================================
  141. # ■ MOG MENU END
  142. #==============================================================================
  143. module MOG_MENU_END
  144.    NUMBER_OF_PARTICLES = 0
  145.    BACKGROUND_SCROLL_SPEED = [0,0]
  146. end
  147.  
  148. #==============================================================================
  149. # ■ MOG ACTOR MENU STATUS
  150. #==============================================================================
  151. module MOG_ACTOR_MENU_STATUS  
  152.   LAYOUT_POSITION = [650,125]
  153.   FACE_POSITION = [48,-32]
  154.   PAR_POSITION = [5,64]
  155.   STATES_POSITION = [15,25]
  156.   STATES_SCROLLING_ANIMATION = false
  157.   NAME_POSITION = [10,60]
  158.   FONT_SIZE = 18
  159.   FONT_BOLD = false
  160. end
  161.  
  162. #==============================================================================
  163. # ■ MOG MEMBERS LAYOUT
  164. #==============================================================================
  165. module MOG_MEMBERS_LAYOUT
  166.   MEMBERS_SPACE = 80  
  167.   LAYOUT_POSITION = [30,200]
  168.   PAR_POSITION = [0,0]
  169.   FACE_POSITION = [0,-2]
  170.   HP_METER_POSITION = [12,37]
  171.   MP_METER_POSITION = [86,37]
  172.   SCOPE_TEXT_POSITION = [0,170]
  173.   ARROW_1_POSITION = [50,90]
  174.   ARROW_2_POSITION = [50,30]
  175.   NAME_POSITION = [42,38]
  176.   FONT_SIZE = 18
  177.   FONT_BOLD = false
  178. end
  179.  
  180. #==============================================================================
  181. # ■ MOG ACTOR MENU PARTY
  182. #==============================================================================
  183. module MOG_ACTOR_MENU_PARTY
  184.   FACE_POSITION = [500,126]
  185.   NAME_POSITION = [500,103]
  186.   FONT_SIZE = 16
  187.   FONT_BOLD = false
  188. end
  189.  
  190.  
  191. #==============================================================================
  192. # ■ MOG MENU BASE
  193. #==============================================================================
  194. module MOG_MENU_BASE
  195.  
  196. end
  197.  
  198. $imported = {} if $imported.nil?
  199. $imported[:mog_monogatari] = true
  200.  
  201. #==============================================================================
  202. # ■ Game Temp
  203. #==============================================================================
  204. class Game_Temp
  205.  
  206.   attr_accessor :menu_index
  207.   attr_accessor :actor_menu_temp
  208.   attr_accessor :item_scope
  209.   attr_accessor :temp_actor_equip
  210.  
  211.   #--------------------------------------------------------------------------
  212.   # ● Initialize
  213.   #--------------------------------------------------------------------------  
  214.   alias mog_menu_index_initialize initialize
  215.   def initialize
  216.       @menu_index = 0
  217.       @actor_menu_temp = -1      
  218.       @item_scope = 0
  219.       @temp_actor_equip = nil
  220.       mog_menu_index_initialize
  221.   end
  222.  
  223. end
  224.  
  225. #==============================================================================
  226. # ■ Scene Map
  227. #==============================================================================
  228. class Scene_Map < Scene_Base
  229.  
  230.  #--------------------------------------------------------------------------
  231.  # ● Update Call Menu
  232.  #--------------------------------------------------------------------------    
  233.  alias mog_menu_monogatari_update_call_menu update_call_menu    
  234.  def update_call_menu
  235.      if $game_party.members.size == 0
  236.         @call_menu = false
  237.         return
  238.      end
  239.      mog_menu_monogatari_update_call_menu
  240.  end
  241.  
  242.  #--------------------------------------------------------------------------
  243.  # ● Call Menu
  244.  #--------------------------------------------------------------------------    
  245.  alias mog_menu_monogatari_call_menu call_menu
  246.  def call_menu
  247.      $game_temp.menu_index = 0    
  248.      mog_menu_monogatari_call_menu
  249.  end
  250.    
  251. end
  252.  
  253. #==============================================================================
  254. # ■ Window Command
  255. #==============================================================================
  256. class Window_Command < Window_Selectable
  257.  
  258.   attr_reader :list
  259. end
  260.  
  261. #==============================================================================
  262. # ■ Game Party
  263. #==============================================================================
  264. class Game_Party < Game_Unit
  265.  
  266.    attr_accessor :menu_actor_id  
  267.    
  268. end
  269.  
  270. #==============================================================================
  271. # ■ Game Interpreter
  272. #==============================================================================
  273. class Game_Interpreter
  274.  
  275.  #--------------------------------------------------------------------------
  276.  # ● gain Tp
  277.  #--------------------------------------------------------------------------      
  278.  def gain_tp(actor_id,value)
  279.      return if $game_party.members[actor_id] == nil
  280.      $game_party.members[actor_id].tp += value.truncate
  281.  end  
  282.  
  283.  #--------------------------------------------------------------------------
  284.  # ● Lose Tp
  285.  #--------------------------------------------------------------------------      
  286.  def lose_tp(actor_id,value)
  287.      return if $game_party.members[actor_id] == nil
  288.      $game_party.members[actor_id].tp -= value.truncate
  289.  end  
  290.  
  291. end
  292.  
  293. #==============================================================================
  294. # ■ Cache
  295. #==============================================================================
  296. module Cache
  297.  
  298.   #--------------------------------------------------------------------------
  299.   # ● Menu
  300.   #--------------------------------------------------------------------------
  301.   def self.menu(filename)
  302.       load_bitmap("Graphics/Menus/", filename)
  303.   end  
  304.  
  305.   #--------------------------------------------------------------------------
  306.   # ● Menu Main
  307.   #--------------------------------------------------------------------------
  308.   def self.menu_main(filename)
  309.       load_bitmap("Graphics/Menus/", filename)
  310.   end
  311.  
  312.   #--------------------------------------------------------------------------
  313.   # ● Menu Item
  314.   #--------------------------------------------------------------------------
  315.   def self.menu_item(filename)
  316.       load_bitmap("Graphics/Menus/", filename)
  317.   end  
  318.  
  319.   #--------------------------------------------------------------------------
  320.   # ● Menu Skill
  321.   #--------------------------------------------------------------------------
  322.   def self.menu_skill(filename)
  323.       load_bitmap("Graphics/Menus/", filename)
  324.   end    
  325.  
  326.   #--------------------------------------------------------------------------
  327.   # ● Menu Equip
  328.   #--------------------------------------------------------------------------
  329.   def self.menu_equip(filename)
  330.       load_bitmap("Graphics/Menus/", filename)
  331.   end      
  332.  
  333.   #--------------------------------------------------------------------------
  334.   # ● Menu Status
  335.   #--------------------------------------------------------------------------
  336.   def self.menu_status(filename)
  337.       load_bitmap("Graphics/Menus/", filename)
  338.   end    
  339.  
  340.   #--------------------------------------------------------------------------
  341.   # ● Menu Save
  342.   #--------------------------------------------------------------------------
  343.   def self.menu_save(filename)
  344.       load_bitmap("Graphics/Menus/", filename)
  345.   end      
  346.  
  347.   #--------------------------------------------------------------------------
  348.   # ● Menu Party
  349.   #--------------------------------------------------------------------------
  350.   def self.menu_party(filename)
  351.       load_bitmap("Graphics/Menus/", filename)
  352.   end    
  353.  
  354.   #--------------------------------------------------------------------------
  355.   # ● Menu End
  356.   #--------------------------------------------------------------------------
  357.   def self.menu_end(filename)
  358.       load_bitmap("Graphics/Menus/", filename)
  359.   end      
  360.  
  361. end
  362.  
  363. #==============================================================================
  364. # ■ Game_Temp
  365. #==============================================================================
  366. class Game_Temp
  367.  
  368.   attr_accessor :pre_cache_main_menu
  369.   attr_accessor :pre_cache_actor_menu
  370.   attr_accessor :pre_cache_item_menu
  371.   attr_accessor :pre_cache_skill_menu
  372.   attr_accessor :pre_cache_equip_menu
  373.   attr_accessor :pre_cache_status_menu
  374.   attr_accessor :pre_cache_party_menu
  375.   attr_accessor :pre_cache_file_menu
  376.   attr_accessor :pre_cache_end_menu
  377.   attr_accessor :pre_cache_icon
  378.   attr_accessor :pre_symbol
  379.  
  380.   #--------------------------------------------------------------------------
  381.   # ● Pre Cache Atelier Menu
  382.   #--------------------------------------------------------------------------  
  383.   def pre_cache_atelier_menu    
  384.       @pre_cache_main_menu = []
  385.       @pre_cache_item_menu = []
  386.       @pre_cache_skill_menu = []
  387.       @pre_cache_equip_menu = []
  388.       @pre_cache_status_menu = []
  389.       @pre_cache_party_menu = []
  390.       @pre_cache_file_menu = []
  391.       @pre_cache_end_menu = []
  392.       @pre_symbol = ""
  393.       execute_pre_cache_icon if can_pre_cache_icon?
  394.       execute_pre_cache_actor
  395.       execute_pre_cache_main_menu
  396.       execute_pre_cache_item_menu
  397.       execute_pre_cache_skill_menu
  398.       execute_pre_cache_equip_menu
  399.       execute_pre_cache_status_menu
  400.       execute_pre_cache_file_menu
  401.       execute_pre_cache_party_menu
  402.       execute_pre_cache_end_menu
  403.   end
  404.  
  405.   #--------------------------------------------------------------------------
  406.   # ● Pre Cache Icon
  407.   #--------------------------------------------------------------------------    
  408.   def execute_pre_cache_icon
  409.       @pre_cache_icon = Cache.system("Iconset")
  410.   end
  411.      
  412.   #--------------------------------------------------------------------------
  413.   # ● Can Pre Cache Menu?
  414.   #--------------------------------------------------------------------------  
  415.   def can_pre_cache_icon?
  416.       return true if @pre_cache_icon == nil
  417.       return true if @pre_cache_icon.disposed? rescue return false
  418.       return false
  419.   end
  420.  
  421. end
  422.  
  423. #==============================================================================
  424. # ■ Spriteset_Map
  425. #==============================================================================
  426. class Spriteset_Map  
  427.  
  428.   #--------------------------------------------------------------------------
  429.   # ● Initialize
  430.   #--------------------------------------------------------------------------
  431.   alias mog_atelier_menu_initialize initialize
  432.   def initialize
  433.       $game_temp.pre_cache_atelier_menu if $game_temp.can_pre_cache_icon?
  434.       mog_atelier_menu_initialize
  435.   end
  436.  
  437. end
  438.  
  439. #==============================================================================
  440. # ■ Particles_Menu
  441. #==============================================================================
  442. class Particles_Menu < Sprite
  443.  
  444.  #--------------------------------------------------------------------------
  445.  # ● Initialize
  446.  #--------------------------------------------------------------------------            
  447.   def initialize(viewport = nil)
  448.       super(viewport)
  449.       @speed_x = 0
  450.       @speed_y = 0
  451.       @speed_a = 0
  452.       self.bitmap = Cache.menu("")
  453.       self.blend_type = 0
  454.       self.z = 1
  455.       reset_setting(true)
  456.   end  
  457.  
  458.  #--------------------------------------------------------------------------
  459.  # ● Reset Setting
  460.  #--------------------------------------------------------------------------              
  461.   def reset_setting(initial = false)
  462.       zoom = (50 + rand(100)) / 100.1
  463.       self.zoom_x = zoom
  464.       self.zoom_y = zoom
  465.       self.x = rand(576) - 160
  466.       self.y = initial == true ? rand(480) : 512
  467.       self.opacity = 0
  468.       @speed_y = -(1 + rand(3))
  469.       @speed_x = (1 + rand(2))
  470.       @speed_a = (1 + rand(2))    
  471.   end
  472.  
  473.  #--------------------------------------------------------------------------
  474.  # ● Dispose
  475.  #--------------------------------------------------------------------------              
  476.   def dispose
  477.       super
  478.       self.bitmap.dispose if self.bitmap != nil
  479.   end  
  480.  
  481.  #--------------------------------------------------------------------------
  482.  # ● Update
  483.  #--------------------------------------------------------------------------              
  484.   def update
  485.       super
  486.       self.x += @speed_x
  487.       self.y += @speed_y
  488.       self.opacity += 5
  489.       reset_setting if can_reset_setting?
  490.   end  
  491.  
  492.  #--------------------------------------------------------------------------
  493.  # ● Can Reset Setting
  494.  #--------------------------------------------------------------------------                
  495.   def can_reset_setting?
  496.       return true if self.y < -50
  497.       return true if self.x > 576
  498.       return false
  499.   end  
  500.    
  501. end
  502.  
  503.  
  504.  
  505.  
  506. #==============================================================================
  507. # ■ Window_Actor_Status_0
  508. #==============================================================================
  509. class Members_Windows_Status < Window_Selectable
  510.   attr_reader   :pending_index        
  511.  
  512.   #--------------------------------------------------------------------------
  513.   # ● Initialize
  514.   #--------------------------------------------------------------------------
  515.   def initialize(x = 0, y = 50)
  516.     super(x, y, window_width, window_height)
  517.     self.windowskin = Cache.menu("")
  518.     self.opacity = 255
  519.     self.contents_opacity = 0
  520.     self.visible = true
  521.     @input_lag = 0
  522.     @old_index = -1
  523.     @pending_index = -1
  524.     refresh
  525.   end
  526.  
  527.   #--------------------------------------------------------------------------
  528.   # ● Window Width
  529.   #--------------------------------------------------------------------------
  530.   def window_width
  531.       40
  532.   end
  533.  
  534.   #--------------------------------------------------------------------------
  535.   # ● Window Height
  536.   #--------------------------------------------------------------------------
  537.   def window_height
  538.       40
  539.   end
  540.  
  541.   #--------------------------------------------------------------------------
  542.   # ● Cursor Movable?
  543.   #--------------------------------------------------------------------------  
  544.   def cursor_movable?
  545.       active && open? && !@cursor_fix && !@cursor_all && item_max > 0 && @input_lag == 0
  546.   end  
  547.  
  548.   #--------------------------------------------------------------------------
  549.   # ● Item Max
  550.   #--------------------------------------------------------------------------
  551.   def item_max
  552.       $game_party.members.size
  553.   end
  554.  
  555.   #--------------------------------------------------------------------------
  556.   # ● Item Height
  557.   #--------------------------------------------------------------------------
  558.   def item_height
  559.     (height - standard_padding * 2) / 4
  560.   end
  561.  
  562.   #--------------------------------------------------------------------------
  563.   # ● Draw Item Background
  564.   #--------------------------------------------------------------------------
  565.   def draw_item_background(index)
  566.   end
  567.  
  568.   #--------------------------------------------------------------------------
  569.   # ● Pending Index
  570.   #--------------------------------------------------------------------------
  571.   def pending_index=(index)
  572.       last_pending_index = @pending_index
  573.       @pending_index = index
  574.   end
  575.  
  576.   #--------------------------------------------------------------------------
  577.   # ● Process OK
  578.   #--------------------------------------------------------------------------
  579.   def process_ok
  580.       $game_party.target_actor = $game_party.members[index] unless @cursor_all
  581.       call_ok_handler
  582.   end
  583.  
  584.   #--------------------------------------------------------------------------
  585.   # ● Select Last
  586.   #--------------------------------------------------------------------------
  587.   def select_last
  588.       select($game_party.target_actor.index || 0)
  589.   end
  590.  
  591.   #--------------------------------------------------------------------------
  592.   # ● Select For Item
  593.   #--------------------------------------------------------------------------
  594.   def select_for_item(item)
  595.       @cursor_fix = item.for_user?
  596.       @cursor_all = item.for_all?
  597.       if @cursor_fix
  598.          select($game_party.menu_actor.index)
  599.       elsif @cursor_all
  600.          select(0)
  601.       else
  602.           @index = @index < 0 ? 0 : @index
  603.       end
  604.   end
  605.  
  606.   #--------------------------------------------------------------------------
  607.   # ● Draw Item
  608.   #--------------------------------------------------------------------------  
  609.   def draw_item(index)
  610.   end
  611.  
  612.   #--------------------------------------------------------------------------
  613.   # ● Process Cursor Move 2
  614.   #--------------------------------------------------------------------------
  615.   def process_cursor_move2
  616.       return unless cursor_movable?
  617.       last_index = @index
  618.       cursor_down (Input.trigger?(:RIGHT))  if Input.repeat?(:RIGHT)
  619.       cursor_up   (Input.trigger?(:LEFT))    if Input.repeat?(:LEFT)
  620.       Sound.play_cursor if @index != last_index
  621.   end    
  622.  
  623.   #--------------------------------------------------------------------------
  624.   # ● Update
  625.   #--------------------------------------------------------------------------  
  626.   def update
  627.       super
  628.       @input_lag -= 1 if @input_lag > 0
  629.       if @old_index != @index
  630.          @old_index = @index
  631.          @input_lag = 5
  632.       end  
  633.   end
  634.  
  635. end
  636.  
  637. #==============================================================================
  638. # ■ Members Menu
  639. #==============================================================================
  640. class Members_Menu
  641.   include MOG_MEMBERS_LAYOUT
  642.  
  643.   attr_accessor :actor
  644.  
  645.   #--------------------------------------------------------------------------
  646.   # ● Initialize
  647.   #--------------------------------------------------------------------------
  648.   def initialize(actor,index)
  649.       @actor = actor
  650.       @index = index
  651.       @index_old = -1
  652.       @com_index = 0
  653.       @max_index = $game_party.members.size - 1      
  654.       @active = false
  655.       @active_old = false
  656.       @opac = 0
  657.       @opac_active = [0,0]
  658.       @par = []
  659.       @float = [0,0,0]
  660.       set_old_parameter
  661.       create_sprites
  662.       create_sprites_support if @index == 0
  663.   end
  664.  
  665.   #--------------------------------------------------------------------------
  666.   # ● Create Sprites
  667.   #--------------------------------------------------------------------------  
  668.   def create_sprites
  669.       @meter_image = $game_temp.pre_cache_actor_menu[6]
  670.       @meter_cw = @meter_image.width
  671.       @meter_ch = @meter_image.height / 2  
  672.       @parameter_number = $game_temp.pre_cache_actor_menu[2]
  673.       @parameter_cw = @parameter_number.width / 10
  674.       @parameter_ch = @parameter_number.height
  675.       @visible = false
  676.       create_layout
  677.       create_parameter
  678.       create_face
  679.       create_name
  680.       create_hp_meter
  681.       create_mp_meter
  682.       @next_pos = [-@layout.width - 64,0]
  683.       @now_index = [-@layout.width - 64,0,0]
  684.       @before_index = [-@layout.width - 64,0,0]
  685.       @next_index = [-@layout.width - 64,0,0]
  686.       set_position(-@layout.width - 64,0)
  687.       set_opacity(0)
  688.   end
  689.    
  690.   #--------------------------------------------------------------------------
  691.   # ● Create Sprites
  692.   #--------------------------------------------------------------------------    
  693.   def create_sprites_support
  694.       create_scope_all
  695.       create_arrow
  696.   end
  697.  
  698.   #--------------------------------------------------------------------------
  699.   # ● Create Scope All
  700.   #--------------------------------------------------------------------------      
  701.   def create_scope_all
  702.       @scope = Sprite.new
  703.       @scope.bitmap = $game_temp.pre_cache_actor_menu[4]
  704.       @scope_cw = @scope.bitmap.width
  705.       @org_pos_scope = [SCOPE_TEXT_POSITION[0],SCOPE_TEXT_POSITION[1],SCOPE_TEXT_POSITION[0] - @scope_cw]
  706.       @scope.x = @org_pos_scope[2]
  707.       @scope.y = @org_pos_scope[1]
  708.       @scope.z = 106 # edited from 15 to 106 #Flip edited
  709.   end
  710.  
  711.   #--------------------------------------------------------------------------
  712.   # ● Update Scope
  713.   #--------------------------------------------------------------------------        
  714.   def update_scope
  715.       if @active and all_targets
  716.          if @scope.x < @org_pos_scope[0]
  717.             @scope.x += 15
  718.             if @scope.x >= @org_pos_scope[0]
  719.                @scope.x = @org_pos_scope[0]
  720.             end  
  721.          end
  722.       else
  723.          if @scope.x > @org_pos_scope[2]        
  724.             @scope.x -= 15
  725.             if @scope.x <= @org_pos_scope[2]
  726.                @scope.x = @org_pos_scope[2]
  727.             end          
  728.           end
  729.       end
  730.   end
  731.  
  732.   #--------------------------------------------------------------------------
  733.   # ● Create Arrow
  734.   #--------------------------------------------------------------------------          
  735.   def create_arrow
  736.       @arrow_float = [0,0,0]
  737.       @arrow_np_1 = [0,0]
  738.       @arrow_np_2 = [0,0]
  739.       @arrow_image = $game_temp.pre_cache_actor_menu[5]
  740.       @arrow_image_cw = @arrow_image.width
  741.       @arrow_image_ch = @arrow_image.height# / 2
  742.       @arrow_1 = Sprite.new
  743.       @arrow_1.bitmap = Bitmap.new(@arrow_image_cw,@arrow_image_ch)
  744.       @arrow_cw = @arrow_1.bitmap.width
  745.       @org_pos_arrow_1 = [ARROW_1_POSITION[0],ARROW_1_POSITION[1]]
  746.       @arrow_1.x = @org_pos_arrow_1[0]
  747.       @arrow_1.y = @org_pos_arrow_1[1]
  748.       @arrow_1.z = 106 # edited from 15 to 106 #Flip edited
  749.       @arrow_1.opacity = 0
  750.       @arrow_2 = Sprite.new
  751.       @arrow_2.bitmap = Bitmap.new(@arrow_image_cw,@arrow_image_ch)
  752.       @arrow_2.ox = @arrow_2.bitmap.width / 2
  753.       @arrow_2.oy = @arrow_2.bitmap.height / 2
  754.       @arrow_2.angle = 180
  755.       ar_y = (MEMBERS_SPACE * 4) + ARROW_2_POSITION[1]
  756.       @org_pos_arrow_2 = [ARROW_2_POSITION[0] + @arrow_2.ox,ar_y]
  757.       @arrow_2.x = @org_pos_arrow_2[0]
  758.       @arrow_2.y = @org_pos_arrow_2[1]
  759.       @arrow_2.z = 106 # edited from 15 to 106 #Flip edited
  760.       @arrow_2.opacity = 0
  761.       @arrow_time_1 = 0
  762.       @arrow_time_2 = 0
  763.       refresh_arrow(0,@arrow_1,0)
  764.       refresh_arrow(1,@arrow_2,0)
  765.   end
  766.  
  767.   #--------------------------------------------------------------------------
  768.   # ● Refresh_arrow 1
  769.   #--------------------------------------------------------------------------            
  770.   def refresh_arrow(arrow,sprite,type)
  771.       sprite.bitmap.clear
  772.       h = @arrow_image_ch * type
  773.       a_rect = Rect.new(0,h,@arrow_image_cw,@arrow_image_ch)
  774.       sprite.bitmap.blt(0,0,@arrow_image,a_rect)
  775.       @arrow_time_1 = 20 if arrow == 0
  776.       @arrow_time_2 = 20 if arrow ==1
  777.   end
  778.  
  779.   #--------------------------------------------------------------------------
  780.   # ● Update Arrow
  781.   #--------------------------------------------------------------------------            
  782.   def update_arrow
  783.     #  update_arrow_type
  784.       update_arrow_visible
  785.       update_arrow_float_animation
  786.   end
  787.    
  788.   #--------------------------------------------------------------------------
  789.   # ● Update Arrow Type
  790.   #--------------------------------------------------------------------------              
  791.   def update_arrow_type
  792.       if @arrow_time_1 > 0
  793.          @arrow_time_1 -= 1
  794.          refresh_arrow(0,@arrow_1,0) if @arrow_time_1 == 0
  795.       end  
  796.       if @arrow_time_2 > 0
  797.          @arrow_time_2 -= 1
  798.          refresh_arrow(1,@arrow_2,0) if @arrow_time_2 == 0
  799.       end        
  800.   end
  801.  
  802.   #--------------------------------------------------------------------------
  803.   # ● Refresh Arrow Type
  804.   #--------------------------------------------------------------------------                
  805.   def refresh_arrow_type
  806.       return
  807.       if @index_old > @com_index
  808.          refresh_arrow(0,@arrow_1,1)
  809.       else  
  810.          refresh_arrow(1,@arrow_2,1)
  811.       end  
  812.   end  
  813.  
  814.   #--------------------------------------------------------------------------
  815.   # ● Update Arrow Visible
  816.   #--------------------------------------------------------------------------              
  817.   def update_arrow_visible
  818.       if can_arrow_visible?
  819.         @arrow_1.opacity += 15
  820.         @arrow_2.opacity += 15
  821.         @arrow_np_1 = [@org_pos_arrow_1[0],@org_pos_arrow_1[1]]
  822.         @arrow_np_2 = [@org_pos_arrow_2[0],@org_pos_arrow_2[1]]
  823.       else  
  824.         @arrow_1.opacity -= 10
  825.         @arrow_2.opacity -= 10
  826.         @arrow_np_1 = [-@arrow_cw,@org_pos[1]]
  827.         @arrow_np_2 = [-@arrow_cw + @arrow_2.ox,@org_pos[1] + @arrow_2.oy]        
  828.       end  
  829.  
  830.   end
  831.  
  832.  #--------------------------------------------------------------------------
  833.  # ● Update Slide Arrow
  834.  #--------------------------------------------------------------------------                      
  835.   def update_slide_arrow(type,sprite,cp,np)
  836.       cp -= @arrow_float[1] if type == 1
  837.       sp = 2 + ((cp - np).abs / 20)
  838.       if cp > np
  839.          cp -= sp
  840.          cp = np if cp < np
  841.       elsif cp < np
  842.          cp += sp
  843.          cp = np if cp > np
  844.       end    
  845.       sprite.x = cp if type == 0
  846.       sprite.y = cp + @arrow_float[1] if type == 1
  847.   end      
  848.  
  849.   #--------------------------------------------------------------------------
  850.   # ● Can Arrow Visiblle?
  851.   #--------------------------------------------------------------------------              
  852.   def can_arrow_visible?
  853.       return false if !@active
  854.       return false if all_targets
  855.       return false if $game_party.members.size < 2
  856.       return  true
  857.   end
  858.  
  859.   #--------------------------------------------------------------------------
  860.   # ● Update Arrow Float Animation
  861.   #--------------------------------------------------------------------------              
  862.   def update_arrow_float_animation
  863.       @arrow_float[2] += 1
  864.       if @arrow_float[2] > 2
  865.          @arrow_float[2] = 0
  866.          @arrow_float[0] += 1
  867.          case @arrow_float[0]
  868.             when 1..11
  869.               @arrow_float[1] += 1
  870.             when 12..22
  871.               @arrow_float[1] -= 1
  872.             else  
  873.               @arrow_float[0] = 0
  874.               @arrow_float[1] = 0
  875.          end  
  876.       end
  877.     update_slide_arrow(0,@arrow_1,@arrow_1.x,@arrow_np_1[0])
  878.     update_slide_arrow(1,@arrow_1,@arrow_1.y,@arrow_np_1[1])
  879.     update_slide_arrow(0,@arrow_2,@arrow_2.x,@arrow_np_2[0])
  880.     update_slide_arrow(1,@arrow_2,@arrow_2.y,@arrow_np_2[1])    
  881.   end
  882.      
  883.   #--------------------------------------------------------------------------
  884.   # ● Create Scope All
  885.   #--------------------------------------------------------------------------      
  886.   def update_support
  887.       update_scope
  888.       update_arrow
  889.   end
  890.  
  891.   #--------------------------------------------------------------------------
  892.   # ● Set Old Parameter
  893.   #--------------------------------------------------------------------------  
  894.   def set_old_parameter
  895.       @par.clear
  896.       @par = [@actor.hp,@actor.mhp,@actor.mp,@actor.mmp,@actor.level]
  897.   end    
  898.  
  899.   #--------------------------------------------------------------------------
  900.   # ● Members Spate
  901.   #--------------------------------------------------------------------------  
  902.   def members_space
  903.       LAYOUT_POSITION[1] + (@index * MEMBERS_SPACE)
  904.   end  
  905.  
  906.   #--------------------------------------------------------------------------
  907.   # ● Dispose
  908.   #--------------------------------------------------------------------------  
  909.   def dispose
  910.       dispose_layout
  911.       dispose_parameter
  912.       dispose_face
  913.       dispose_name
  914.       dispose_hp_meter
  915.       dispose_mp_meter
  916.       dispose_support if @index == 0
  917.   end
  918.  
  919.   #--------------------------------------------------------------------------
  920.   # ● Dispose Support
  921.   #--------------------------------------------------------------------------    
  922.   def dispose_support
  923.       dispose_scope
  924.       dispose_arrow
  925.   end
  926.  
  927.   #--------------------------------------------------------------------------
  928.   # ● Dispose Layout
  929.   #--------------------------------------------------------------------------    
  930.   def dispose_layout
  931.       @layout.dispose
  932.   end
  933.  
  934.   #--------------------------------------------------------------------------
  935.   # ● Dispose Scope
  936.   #--------------------------------------------------------------------------        
  937.   def dispose_scope
  938.       @scope.dispose
  939.   end  
  940.  
  941.   #--------------------------------------------------------------------------
  942.   # ● Dispose_Arrow
  943.   #--------------------------------------------------------------------------            
  944.   def dispose_arrow
  945.       @arrow_1.bitmap.dispose
  946.       @arrow_1.dispose
  947.       @arrow_2.bitmap.dispose
  948.       @arrow_2.dispose
  949.   end
  950.  
  951.   #--------------------------------------------------------------------------
  952.   # ● Dispose Parameter
  953.   #--------------------------------------------------------------------------      
  954.   def dispose_parameter
  955.       @parameter.bitmap.dispose
  956.       @parameter.dispose
  957.   end  
  958.  
  959.   #--------------------------------------------------------------------------
  960.   # ● Dispose Face
  961.   #--------------------------------------------------------------------------    
  962.   def dispose_face
  963.       @face.dispose
  964.   end    
  965.  
  966.   #--------------------------------------------------------------------------
  967.   # ● Dispose HP Meter
  968.   #--------------------------------------------------------------------------      
  969.   def dispose_hp_meter
  970.       @hp_meter.bitmap.dispose
  971.       @hp_meter.dispose
  972.   end
  973.  
  974.   #--------------------------------------------------------------------------
  975.   # ● Dispose MP Meter
  976.   #--------------------------------------------------------------------------      
  977.   def dispose_mp_meter
  978.       @mp_meter.bitmap.dispose
  979.       @mp_meter.dispose
  980.   end  
  981.  
  982.   #--------------------------------------------------------------------------
  983.   # ● Dispose Name
  984.   #--------------------------------------------------------------------------        
  985.   def dispose_name
  986.       @name.bitmap.dispose
  987.       @name.dispose
  988.   end  
  989.  
  990.   #--------------------------------------------------------------------------
  991.   # ● Create Layout
  992.   #--------------------------------------------------------------------------
  993.   def create_layout
  994.       @layout = Sprite.new
  995.       @layout.bitmap = Cache.menu("Actor_Layout_1")
  996.       @org_pos = [LAYOUT_POSITION[0],LAYOUT_POSITION[1]]
  997.       @layout.x = @org_pos[0]
  998.       @layout.y = @org_pos[1]
  999.       @layout.z = 101 # edited from 10 to 101 #Flip edited
  1000.       #@layout.opacity = 0
  1001.   end
  1002.  
  1003.   #--------------------------------------------------------------------------
  1004.   # ● Create Parameter
  1005.   #--------------------------------------------------------------------------
  1006.   def create_parameter
  1007.       @parameter = Sprite.new
  1008.       @parameter.bitmap = Bitmap.new(@layout.bitmap.width,@layout.bitmap.height)
  1009.       @org_pos_par = [@org_pos[0] + PAR_POSITION[0],
  1010.                       @org_pos[1] + PAR_POSITION[1]]
  1011.       @parameter.x = @org_pos_par[0]
  1012.       @parameter.y = @org_pos_par[1]
  1013.       @parameter.z = 103 # edited form 12 to 103 #Flip edited
  1014. #      @parameter.opacity = 0
  1015.       refresh_parameter
  1016.   end  
  1017.  
  1018.   #--------------------------------------------------------------------------
  1019.   # ● Create HP Meter
  1020.   #--------------------------------------------------------------------------  
  1021.   def create_hp_meter
  1022.       @hp_meter_old = [-1,-1]
  1023.       @hp_meter = Sprite.new
  1024.       @hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  1025.       @org_pos_hp = [@org_pos[0] + HP_METER_POSITION[0],
  1026.                      @org_pos[1] + HP_METER_POSITION[1]]      
  1027.       @hp_meter.x = @org_pos_hp[0]
  1028.       @hp_meter.y = @org_pos_hp[1]
  1029.       @hp_meter.z = 102 # edited from 11 to 102 #Flip edited
  1030.   end  
  1031.  
  1032.   #--------------------------------------------------------------------------
  1033.   # ● Refresh HP Meter
  1034.   #--------------------------------------------------------------------------  
  1035.   def refresh_hp_meter
  1036.       @hp_meter_old[0] = @actor.hp
  1037.       @hp_meter_old[1] = @actor.mhp
  1038.       @hp_meter.bitmap.clear
  1039.       width_range = @meter_cw * @actor.hp / @actor.mhp
  1040.       m_rect = Rect.new(0,0,width_range,@meter_ch)
  1041.       @hp_meter.bitmap.blt(0,0,@meter_image,m_rect)
  1042.   end
  1043.  
  1044.   #--------------------------------------------------------------------------
  1045.   # ● Create MP Meter
  1046.   #--------------------------------------------------------------------------  
  1047.   def create_mp_meter
  1048.       @mp_meter_old = [-1,-1]
  1049.       @mp_meter = Sprite.new
  1050.       @mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  1051.       @org_pos_mp = [@org_pos[0] + MP_METER_POSITION[0],
  1052.                      @org_pos[1] + MP_METER_POSITION[1]]      
  1053.       @mp_meter.x = @org_pos_mp[0]
  1054.       @mp_meter.y = @org_pos_mp[1]
  1055.       @mp_meter.z = 102 # edited from 11 to 102 #Flip edited
  1056.   end  
  1057.  
  1058.   #--------------------------------------------------------------------------
  1059.   # ● Refresh MP Meter
  1060.   #--------------------------------------------------------------------------  
  1061.   def refresh_mp_meter
  1062.       @mp_meter_old[0] = @actor.mp
  1063.       @mp_meter_old[1] = @actor.mmp
  1064.       @mp_meter.bitmap.clear
  1065.       width_range = @meter_cw * @actor.mp / @actor.mmp rescue nil
  1066.       width_range = 0 if width_range == nil
  1067.       m_rect = Rect.new(0,@meter_ch,width_range,@meter_ch)
  1068.       @mp_meter.bitmap.blt(0,0,@meter_image,m_rect)
  1069.   end  
  1070.  
  1071.   #--------------------------------------------------------------------------
  1072.   # ● Create Face
  1073.   #--------------------------------------------------------------------------  
  1074.   def refresh_parameter
  1075.       set_old_parameter    
  1076.       @parameter.bitmap.clear
  1077.      
  1078.       value = @actor.level
  1079.       x = 146
  1080.       y = 8
  1081.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1082.      
  1083.       value = @actor.hp
  1084.       x = 72
  1085.       y = 24
  1086.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1087.  
  1088.       value = @actor.mp
  1089.       x = 146
  1090.       y = 24
  1091.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1092.      
  1093.   end  
  1094.  
  1095.   #--------------------------------------------------------------------------
  1096.   # ● Refresh Number
  1097.   #--------------------------------------------------------------------------    
  1098.   def refresh_number(sprite,image,value,number_cw,number_ch,x,y)
  1099.       number = value.abs.to_s.split(//)
  1100.       x2 = -number_cw * number.size
  1101.       for i in 0..number.size - 1
  1102.           number_abs = number[i].to_i
  1103.           nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
  1104.           sprite.bitmap.blt(x + x2 + (number_cw  *  i), y, image, nsrc_rect)        
  1105.       end      
  1106.      
  1107.   end
  1108.  
  1109.   #--------------------------------------------------------------------------
  1110.   # ● Create Face
  1111.   #--------------------------------------------------------------------------  
  1112.   def create_face
  1113.       @face = Sprite.new
  1114.       @org_pos_face = [@org_pos[0] + FACE_POSITION[0],
  1115.                        @org_pos[1] + FACE_POSITION[1]]
  1116.       @face.x = @org_pos_face[0]
  1117.       @face.y = @org_pos_face[1]
  1118.       @face.z = 102 # edited fom 11 to 102 #Flip edited
  1119.    #   @face.opacity = 0
  1120.       refresh_face
  1121.   end  
  1122.  
  1123.   #--------------------------------------------------------------------------
  1124.   # ● Refresh Face
  1125.   #--------------------------------------------------------------------------    
  1126.   def refresh_face
  1127.       face_name = "Face_B" + @actor.id.to_s
  1128.       @face.bitmap = Cache.menu(face_name.to_s)
  1129.   end
  1130.  
  1131.   #--------------------------------------------------------------------------
  1132.   # ● Create Name
  1133.   #--------------------------------------------------------------------------    
  1134.   def create_name
  1135.       @name = Sprite.new
  1136.       @name.bitmap = Bitmap.new(140,32)
  1137.       @name.bitmap.font.size = FONT_SIZE
  1138.       @name.bitmap.font.bold = FONT_BOLD
  1139.       @org_pos_name = [@org_pos[0] + NAME_POSITION[0],
  1140.                        @org_pos[1] + NAME_POSITION[1]]
  1141.       @name.x = @org_pos_name[0]
  1142.       @name.y = @org_pos_name[1]
  1143.       @name.z = 102 # edited from 11 to 102 #Flip edited
  1144.       refresh_name    
  1145.   end  
  1146.  
  1147.   #--------------------------------------------------------------------------
  1148.   # ● Refresh Name
  1149.   #--------------------------------------------------------------------------      
  1150.   def refresh_name
  1151.       @name.bitmap.clear
  1152.       @name.bitmap.draw_text(0,0,140,32,@actor.name.to_s,0)
  1153.   end  
  1154.  
  1155.   #--------------------------------------------------------------------------
  1156.   # ● Set Actor
  1157.   #--------------------------------------------------------------------------        
  1158.   def set_actor(actor)
  1159.       @actor = actor
  1160.   end
  1161.  
  1162.   #--------------------------------------------------------------------------
  1163.   # ● Can Refresh HP Meter
  1164.   #--------------------------------------------------------------------------          
  1165.   def can_refresh_hp_meter?
  1166.       return true if @hp_meter_old[0] != @actor.hp
  1167.       return true if @hp_meter_old[1] != @actor.mhp
  1168.       return false
  1169.   end
  1170.      
  1171.   #--------------------------------------------------------------------------
  1172.   # ● Can Refresh MP Meter
  1173.   #--------------------------------------------------------------------------          
  1174.   def can_refresh_mp_meter?
  1175.       return true if @mp_meter_old[0] != @actor.mp
  1176.       return true if @mp_meter_old[1] != @actor.mmp
  1177.       return false
  1178.   end  
  1179.  
  1180.   #--------------------------------------------------------------------------
  1181.   # ● Can Refresh Parameter
  1182.   #--------------------------------------------------------------------------
  1183.   def can_refresh_parameter?
  1184.       return true if @par[0] != @actor.hp
  1185.       return true if @par[1] != @actor.mhp
  1186.       return true if @par[2] != @actor.mp
  1187.       return true if @par[3] != @actor.mmp
  1188.       return true if @par[4] != @actor.level
  1189.       return false
  1190.   end  
  1191.  
  1192.   #--------------------------------------------------------------------------
  1193.   # ● Refresh_Visible
  1194.   #--------------------------------------------------------------------------  
  1195.   def refresh_visible
  1196.       if can_visible?
  1197.          set_visible(true)
  1198.       else  
  1199.          set_visible(false)
  1200.       end  
  1201.   end  
  1202.  
  1203.   #--------------------------------------------------------------------------
  1204.   # ● Set Index
  1205.   #--------------------------------------------------------------------------    
  1206.   def set_index
  1207.       @now_index[0] = @com_index
  1208.       @before_index[0] = @com_index - 1
  1209.       @next_index[0] = @com_index + 1
  1210.       @before_index[0] = @max_index if @before_index[0] < 0
  1211.       @next_index[0] = 0 if @next_index[0] > @max_index    
  1212.   end
  1213.      
  1214.   #--------------------------------------------------------------------------
  1215.   # ● Can Visible?
  1216.   #--------------------------------------------------------------------------    
  1217.   def can_visible?
  1218.       return true if @index == @now_index[0]
  1219.       return true if @index == @next_index[0]
  1220.       return true if @index == @before_index[0]
  1221.       return false
  1222.   end
  1223.  
  1224.   #--------------------------------------------------------------------------
  1225.   # ● Set Visible
  1226.   #--------------------------------------------------------------------------    
  1227.   def set_visible(value)
  1228.       @visible = value
  1229.       return
  1230.       @layout.visible = @visible
  1231.       @parameter.visible = @visible
  1232.       @hp_meter.visible = @visible
  1233.       @mp_meter.visible = @visible
  1234.       @face.visible = @visible
  1235.       @name.visible = @visible
  1236.   end
  1237.  
  1238.   #--------------------------------------------------------------------------
  1239.   # ● Update Position
  1240.   #--------------------------------------------------------------------------      
  1241.   def update_position
  1242.       update_slide(0,@layout,@layout.x,@next_pos[0] + @org_pos[0])
  1243.       update_slide(1,@layout,@layout.y,@next_pos[1] + @org_pos[1])
  1244.       update_slide(0,@parameter,@parameter.x,@next_pos[0] + @org_pos_par[0])
  1245.       update_slide(1,@parameter,@parameter.y,@next_pos[1] + @org_pos_par[1])
  1246.       update_slide(0,@hp_meter,@hp_meter.x,@next_pos[0] + @org_pos_hp[0])
  1247.       update_slide(1,@hp_meter,@hp_meter.y,@next_pos[1] + @org_pos_hp[1])  
  1248.       update_slide(0,@mp_meter,@mp_meter.x,@next_pos[0] + @org_pos_mp[0])
  1249.       update_slide(1,@mp_meter,@mp_meter.y,@next_pos[1] + @org_pos_mp[1])        
  1250.       update_slide(0,@face,@face.x,@next_pos[0] + @org_pos_face[0])
  1251.       update_slide(1,@face,@face.y,@next_pos[1] + @org_pos_face[1])        
  1252.       update_slide(0,@name,@name.x,@next_pos[0] + @org_pos_name[0])
  1253.       update_slide(1,@name,@name.y,@next_pos[1] + @org_pos_name[1])      
  1254.   end
  1255.  
  1256.   #--------------------------------------------------------------------------
  1257.   # ● Update Float
  1258.   #--------------------------------------------------------------------------        
  1259.   def update_float
  1260.       @float[2] += 1
  1261.       if @float[2] > 5
  1262.          @float[2] = 0
  1263.          @float[0] += 1
  1264.          case @float[0]        
  1265.               when 1..5
  1266.                   @float[1] -= 1  
  1267.               when 6..15
  1268.                   @float[1] += 1
  1269.               when 16..20
  1270.                   @float[1] -= 1
  1271.               else
  1272.                  @float = [0,0,0]
  1273.           end
  1274.        end
  1275.   end
  1276.  
  1277.  #--------------------------------------------------------------------------
  1278.  # ● Update Slide
  1279.  #--------------------------------------------------------------------------                      
  1280.   def update_slide(type,sprite,cp,np)
  1281.       cp -= @float[1] if type == 1
  1282.       sp = 3 + ((cp - np).abs / 10)
  1283.       if cp > np
  1284.          cp -= sp
  1285.          cp = np if cp < np
  1286.       elsif cp < np
  1287.          cp += sp
  1288.          cp = np if cp > np
  1289.       end    
  1290.       sprite.x = cp if type == 0
  1291.       sprite.y = cp + @float[1] if type == 1
  1292.   end    
  1293.  
  1294.   #--------------------------------------------------------------------------
  1295.   # ● All Targets
  1296.   #--------------------------------------------------------------------------                        
  1297.   def all_targets
  1298.       return true if $game_temp.item_scope == 8
  1299.       return true if $game_temp.item_scope == 10
  1300.       return false
  1301.   end  
  1302.    
  1303.   #--------------------------------------------------------------------------
  1304.   # ● Update Opacity
  1305.   #--------------------------------------------------------------------------  
  1306.   def update_opacity
  1307.       if @visible
  1308.          if all_targets
  1309.             if @max_index == 0
  1310.                @next_pos = [0,0]
  1311.             else  
  1312.                if @index == @before_index[0]
  1313.                   @next_pos = [0,-MEMBERS_SPACE]
  1314.                elsif @index == @next_index[0]
  1315.                   @next_pos = [0,MEMBERS_SPACE]
  1316.                else  
  1317.                   @next_pos = [0,0]
  1318.                end      
  1319.             end            
  1320.             update_opacity_active
  1321.             update_float
  1322.          else  
  1323.              if ((@index == @before_index[0]) or (@index == @next_index[0])) and
  1324.                   @max_index != 0
  1325.                   opac_limit = 170
  1326.                   if @opac > opac_limit
  1327.                      @opac -= 10
  1328.                      @opac = opac_limit if @opac < opac_limit
  1329.                   elsif @opac < opac_limit
  1330.                      @opac += 10
  1331.                      @opac = opac_limit if @opac > opac_limit
  1332.                   end  
  1333.                   @float = [0,0,0]
  1334.              else  
  1335.                  update_opacity_active
  1336.                  update_float
  1337.              end  
  1338.          end  
  1339.       else
  1340.           @opac -= 10 if @opac > 0
  1341.           @opac = 0 if @opac < 0
  1342.           @float = [0,0,0]
  1343.       end
  1344.       set_opacity(@opac)
  1345.   end
  1346.  
  1347.   #--------------------------------------------------------------------------
  1348.   # ● Update Opacity Active
  1349.   #--------------------------------------------------------------------------    
  1350.   def update_opacity_active
  1351.       @opac_active[0] += 1
  1352.       case @opac_active[0]
  1353.          when 1..30
  1354.             @opac_active[1] +=  4
  1355.          when 31..60          
  1356.             @opac_active[1] -=  4
  1357.          else
  1358.            @opac_active[1] = 0
  1359.            @opac_active[0] = 0
  1360.       end
  1361.       @opac = 160 + @opac_active[1]
  1362.   end          
  1363.            
  1364.   #--------------------------------------------------------------------------
  1365.   # ● Set Opacity
  1366.   #--------------------------------------------------------------------------    
  1367.   def set_opacity(opac)
  1368.       @layout.opacity = opac
  1369.       @layout.opacity = opac
  1370.       @parameter.opacity = opac
  1371.       @parameter.opacity = opac
  1372.       @hp_meter.opacity = opac
  1373.       @hp_meter.opacity = opac
  1374.       @mp_meter.opacity = opac
  1375.       @mp_meter.opacity = opac
  1376.       @face.opacity = opac
  1377.       @face.opacity = opac
  1378.       @name.opacity = opac
  1379.       @name.opacity = opac
  1380.   end    
  1381.      
  1382.   #--------------------------------------------------------------------------
  1383.   # ● Refresh Index
  1384.   #--------------------------------------------------------------------------    
  1385.   def refresh_index
  1386.       refresh_arrow_type if @index == 0
  1387.       @index_old = @com_index
  1388.       set_index
  1389.       refresh_visible
  1390.       set_next_position
  1391.   end
  1392.  
  1393.   #--------------------------------------------------------------------------
  1394.   # ● Set Next Position
  1395.   #--------------------------------------------------------------------------      
  1396.   def set_next_position
  1397.       if @max_index == 0
  1398.          @next_pos = [0,0]
  1399.          return
  1400.       end  
  1401.       if @visible
  1402.       if @index == @before_index[0]
  1403.          @next_pos = [-32,-MEMBERS_SPACE]
  1404.          if @layout.opacity < 150
  1405.             set_position(@next_pos[0],-MEMBERS_SPACE * 2)
  1406.             set_opacity(0)
  1407.          end  
  1408.       elsif @index == @next_index[0]
  1409.          @next_pos = [-32,MEMBERS_SPACE]
  1410.          if @layout.opacity < 150  
  1411.             set_position(@next_pos[0],MEMBERS_SPACE * 2)
  1412.             set_opacity(0)
  1413.          end  
  1414.       else  
  1415.          @next_pos = [0,0]
  1416.       end    
  1417.       else
  1418.          @next_pos = [-64,0]
  1419.       end  
  1420.   end
  1421.  
  1422.   #--------------------------------------------------------------------------
  1423.   # ● Update Position
  1424.   #--------------------------------------------------------------------------      
  1425.   def set_position(pos_x,pos_y)
  1426.       @layout.x = @org_pos[0] + pos_x
  1427.       @layout.y = @org_pos[1] + pos_y
  1428.       @parameter.x = @org_pos_par[0] + pos_x
  1429.       @parameter.y = @org_pos_par[1] + pos_y
  1430.       @hp_meter.x = @org_pos_hp[0] + pos_x
  1431.       @hp_meter.y = @org_pos_hp[1] + pos_y
  1432.       @mp_meter.x = @org_pos_mp[0] + pos_x
  1433.       @mp_meter.y = @org_pos_mp[1] + pos_y
  1434.       @face.x = @org_pos_face[0] + pos_x
  1435.       @face.y = @org_pos_face[1] + pos_y
  1436.       @name.x = @org_pos_name[0] + pos_x
  1437.       @name.y = @org_pos_name[1] + pos_y
  1438.   end  
  1439.  
  1440.   #--------------------------------------------------------------------------
  1441.   # ● Refresh Active
  1442.   #--------------------------------------------------------------------------        
  1443.   def refresh_active
  1444.       @active_old = @active
  1445.       @visible = @active
  1446.       refresh_index
  1447.       if !@active
  1448.          @visible = @active
  1449.          @next_pos = [-@layout.width - 64,0]
  1450.       else  
  1451.          set_position(-@layout.width - 64,0)
  1452.       end  
  1453.   end
  1454.  
  1455.   #--------------------------------------------------------------------------
  1456.   # ● Update
  1457.   #--------------------------------------------------------------------------  
  1458.   def update(active,com_index)
  1459.       @active = active
  1460.       @com_index = com_index
  1461.       refresh_active if @active != @active_old
  1462.       update_opacity
  1463.       update_position
  1464.       update_support if @index == 0
  1465.       return if !@active
  1466.       refresh_index if @index_old != @com_index
  1467.       return if !@active or !@visible
  1468.       refresh_hp_meter if can_refresh_hp_meter?
  1469.       refresh_mp_meter if can_refresh_mp_meter?
  1470.       refresh_parameter if can_refresh_parameter?
  1471.   end
  1472.  
  1473.   #--------------------------------------------------------------------------
  1474.   # ● Current Actor
  1475.   #--------------------------------------------------------------------------    
  1476.   def current_actor
  1477.       return true if @com_index == @index
  1478.       return false
  1479.   end
  1480.  
  1481. end
  1482.  
  1483. #==============================================================================
  1484. # ■ Game_Temp
  1485. #==============================================================================
  1486. class Game_Temp
  1487.  
  1488.   #--------------------------------------------------------------------------
  1489.   # ● Execute Pre Cache Actor
  1490.   #--------------------------------------------------------------------------  
  1491.   def execute_pre_cache_actor
  1492.       @pre_cache_actor_menu = []
  1493.       @pre_cache_actor_menu.push(Cache.menu("Actor_Layout_1"))
  1494.       @pre_cache_actor_menu.push(Cache.menu("Actor_Layout_2"))      
  1495.       @pre_cache_actor_menu.push(Cache.menu("Actor_Number_1"))
  1496.       @pre_cache_actor_menu.push(Cache.menu("Actor_Number_2"))
  1497.       @pre_cache_actor_menu.push(Cache.menu("Actor_Scope_All"))
  1498.       @pre_cache_actor_menu.push(Cache.menu("Actor_Members_Arrow"))
  1499.       @pre_cache_actor_menu.push(Cache.menu("Actor_Meter"))
  1500.   end
  1501.    
  1502. end
  1503.  
  1504. #==============================================================================
  1505. # ■ Actor Menu Status
  1506. #==============================================================================
  1507. class Actor_Menu_Status
  1508.  
  1509.   include MOG_ACTOR_MENU_STATUS
  1510.  
  1511.   #--------------------------------------------------------------------------
  1512.   # ● Initialize
  1513.   #--------------------------------------------------------------------------
  1514.   def initialize(actor)
  1515.       @actor = actor
  1516.       @active = false
  1517.       set_old_parameter
  1518.       create_sprites
  1519.   end
  1520.  
  1521.   #--------------------------------------------------------------------------
  1522.   # ● Create Sprites
  1523.   #--------------------------------------------------------------------------  
  1524.   def create_sprites
  1525.       @parameter_number = $game_temp.pre_cache_actor_menu[3]
  1526.       @parameter_cw = @parameter_number.width / 10
  1527.       @parameter_ch = @parameter_number.height    
  1528.       create_layout
  1529.       create_face
  1530.       create_parameter
  1531.       create_name
  1532.       create_states  
  1533.   #    update(true,@actor)
  1534.   end
  1535.  
  1536.   #--------------------------------------------------------------------------
  1537.   # ● Dispose
  1538.   #--------------------------------------------------------------------------  
  1539.   def dispose
  1540.       dispose_layout
  1541.       dispose_face
  1542.       dispose_parameter
  1543.       dispose_name
  1544.       dispose_states
  1545.   end
  1546.  
  1547.   #--------------------------------------------------------------------------
  1548.   # ● Dispose Layout
  1549.   #--------------------------------------------------------------------------    
  1550.   def dispose_layout
  1551.       @layout.dispose
  1552.   end
  1553.  
  1554.   #--------------------------------------------------------------------------
  1555.   # ● Dispose Face
  1556.   #--------------------------------------------------------------------------    
  1557.   def dispose_face
  1558.       @face.bitmap.dispose if @face.bitmap != nil
  1559.       @face.dispose
  1560.   end  
  1561.  
  1562.   #--------------------------------------------------------------------------
  1563.   # ● Dispose Parameter
  1564.   #--------------------------------------------------------------------------      
  1565.   def dispose_parameter
  1566.       @parameter.bitmap.dispose
  1567.       @parameter.dispose
  1568.   end
  1569.  
  1570.   #--------------------------------------------------------------------------
  1571.   # ● Dispose Name
  1572.   #--------------------------------------------------------------------------        
  1573.   def dispose_name
  1574.       @name.bitmap.dispose
  1575.       @name.dispose
  1576.   end
  1577.  
  1578.   #--------------------------------------------------------------------------
  1579.   # ● Dispose States
  1580.   #--------------------------------------------------------------------------            
  1581.    def dispose_states
  1582.        return if @status == nil
  1583.        @status.bitmap.dispose
  1584.        @status.dispose
  1585.        if @actor_status != nil
  1586.           @actor_status.dispose
  1587.           @actor_status = nil
  1588.        end  
  1589.    end    
  1590.  
  1591.   #--------------------------------------------------------------------------
  1592.   # ● Set Old Parameter
  1593.   #--------------------------------------------------------------------------  
  1594.   def set_old_parameter
  1595.       @par = [] if @par == nil
  1596.       @par.clear
  1597.       @par = [@actor.hp,@actor.mhp,@actor.mp,@actor.mmp,@actor.atk,@actor.def,
  1598.               @actor.mat,@actor.mdf,@actor.agi,@actor.luk,@actor.level,@actor.tp]
  1599.   end    
  1600.  
  1601.   #--------------------------------------------------------------------------
  1602.   # ● Create Layout
  1603.   #--------------------------------------------------------------------------
  1604.   def create_layout
  1605.       @layout = Sprite.new
  1606.       @layout.bitmap = $game_temp.pre_cache_actor_menu[1]
  1607.       @org_pos = [LAYOUT_POSITION[0],LAYOUT_POSITION[1]]
  1608.       @layout.x = @org_pos[0]
  1609.       @layout.y = @org_pos[1]
  1610.       @layout.z = 10
  1611.       @layout.opacity = 0
  1612.   end
  1613.  
  1614.   #--------------------------------------------------------------------------
  1615.   # ● Create Parameter
  1616.   #--------------------------------------------------------------------------
  1617.   def create_parameter
  1618.       @parameter = Sprite.new
  1619.       @parameter.bitmap = Bitmap.new(@layout.bitmap.width,@layout.bitmap.height)
  1620.       @org_pos_par = [@org_pos[0] + PAR_POSITION[0],
  1621.                       @org_pos[1] + PAR_POSITION[1]]
  1622.       @parameter.x = @org_pos_par[0] - 50
  1623.       @parameter.y = @org_pos_par[1]
  1624.       @parameter.z = 11
  1625.       @parameter.opacity = 0
  1626.       refresh_parameter
  1627.   end
  1628.  
  1629.   #--------------------------------------------------------------------------
  1630.   # ● Create Face
  1631.   #--------------------------------------------------------------------------  
  1632.   def create_face
  1633.       @face = Sprite.new
  1634.       @face.bitmap = Bitmap.new(96,96)
  1635.       @org_pos_face = [@org_pos[0] + FACE_POSITION[0],
  1636.                        @org_pos[1] + FACE_POSITION[1]]
  1637.       @face.x = @org_pos_face[0] - 50
  1638.       @face.y = @org_pos_face[1]
  1639.       @face.z = 11
  1640.       @face.opacity = 0
  1641.       refresh_face
  1642.   end
  1643.  
  1644.   #--------------------------------------------------------------------------
  1645.   # ● Create Name
  1646.   #--------------------------------------------------------------------------    
  1647.   def create_name
  1648.       @name = Sprite.new
  1649.       @name.bitmap = Bitmap.new(140,32)
  1650.       @name.bitmap.font.size = FONT_SIZE
  1651.       @name.bitmap.font.bold = FONT_BOLD
  1652.       @org_pos_name = [@org_pos[0] + NAME_POSITION[0],
  1653.                        @org_pos[1] + NAME_POSITION[1]]
  1654.       @name.x = @org_pos_name[0] - 50
  1655.       @name.y = @org_pos_name[1]
  1656.       @name.z = 11
  1657.       @name.opacity = 0
  1658.       refresh_name    
  1659.   end  
  1660.  
  1661.   #--------------------------------------------------------------------------
  1662.   # ● Create_States
  1663.   #--------------------------------------------------------------------------      
  1664.   def create_states
  1665.       @status_old = nil
  1666.       @status_flow = [-24,0]    
  1667.       @status = Sprite.new
  1668.       @status.bitmap = Bitmap.new(24,24)
  1669.       @org_pos_states = [@org_pos[0] + STATES_POSITION[0],
  1670.                          @org_pos[1] + STATES_POSITION[1]]      
  1671.       @status.x = @org_pos_states[0] - 50
  1672.       @status.y = @org_pos_states[1]
  1673.       @status.z = 11
  1674.   end      
  1675.  
  1676.   #--------------------------------------------------------------------------
  1677.   # * Refresh States
  1678.   #--------------------------------------------------------------------------        
  1679.   def refresh_states
  1680.       check_icon_image
  1681.       @status_old = @actor.states
  1682.       @status_flow = [0,0]
  1683.       @actor_status.dispose if @actor_status != nil
  1684.       @states_size = @actor.states.size > 0 ? (26 * @actor.states.size) : 24
  1685.       @actor_status = Bitmap.new(@states_size,24)
  1686.       index = 0
  1687.       for i in @actor.states
  1688.          rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
  1689.          @actor_status.blt(26 * index , 0, @icon_image, rect)
  1690.          index += 1
  1691.       end
  1692.   end  
  1693.  
  1694.   #--------------------------------------------------------------------------
  1695.   # * Flow_Status
  1696.   #--------------------------------------------------------------------------          
  1697.   def flow_states
  1698.       return if @actor_status == nil
  1699.       @status.bitmap.clear
  1700.       return if @actor.states.size == 0
  1701.       st_src_rect = Rect.new(@status_flow[0],0, 24,24)
  1702.       @status.bitmap.blt(0,0, @actor_status, st_src_rect)
  1703.       if STATES_SCROLLING_ANIMATION
  1704.          @status_flow[0] += 1
  1705.          @status_flow[0] = -24 if @status_flow[0] >= @states_size + 2
  1706.       else  
  1707.          @status_flow[1] += 1 unless @actor.states.size <= 1
  1708.          if @status_flow[1] > 30
  1709.             @status_flow[1] = 0
  1710.             @status_flow[0] += 26
  1711.             @status_flow[0] = 0 if @status_flow[0] >= (@states_size - 0)
  1712.          end  
  1713.      end  
  1714.   end        
  1715.  
  1716.   #--------------------------------------------------------------------------
  1717.   # * Check Icon Image
  1718.   #--------------------------------------------------------------------------          
  1719.   def check_icon_image
  1720.       if @icon_image == nil or @icon_image.disposed?
  1721.          @icon_image = Cache.system("Iconset")
  1722.       end  
  1723.   end    
  1724.  
  1725.   #--------------------------------------------------------------------------
  1726.   # ● Can Refresh Parameter
  1727.   #--------------------------------------------------------------------------
  1728.   def can_refresh_parameter?
  1729.       return false if !@active
  1730.       return true if @par[0] != @actor.hp
  1731.       return true if @par[1] != @actor.mhp
  1732.       return true if @par[2] != @actor.mp
  1733.       return true if @par[3] != @actor.mmp
  1734.       return true if @par[4] != @actor.atk
  1735.       return true if @par[5] != @actor.def
  1736.       return true if @par[6] != @actor.mat
  1737.       return true if @par[7] != @actor.mdf
  1738.       return true if @par[8] != @actor.agi
  1739.       return true if @par[9] != @actor.luk
  1740.       return true if @par[10] != @actor.level
  1741.       return true if @par[11] != @actor.tp
  1742.       return false
  1743.   end  
  1744.  
  1745.   #--------------------------------------------------------------------------
  1746.   # ● Refresh All
  1747.   #--------------------------------------------------------------------------  
  1748.   def refresh_all(actor)      
  1749.       @actor = actor
  1750.       refresh_parameter
  1751.       refresh_face
  1752.       refresh_name
  1753.   end  
  1754.  
  1755.   #--------------------------------------------------------------------------
  1756.   # ● Refresh Name
  1757.   #--------------------------------------------------------------------------      
  1758.   def refresh_name    
  1759.       @name.bitmap.clear
  1760.       @name.bitmap.draw_text(0,0,140,32,@actor.name.to_s,0)
  1761.   end
  1762.  
  1763.   #--------------------------------------------------------------------------
  1764.   # ● Create Face
  1765.   #--------------------------------------------------------------------------  
  1766.   def refresh_parameter
  1767.       set_old_parameter
  1768.       @parameter.bitmap.clear      
  1769.       value = @actor.level
  1770.       x = 67
  1771.       y = 24
  1772.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1773.      
  1774.       value = @actor.tp
  1775.       x = 140
  1776.       y = 24
  1777.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1778.      
  1779.       value = @actor.hp
  1780.       x = 70
  1781.       y = 46
  1782.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1783.    
  1784.       value = @actor.mhp
  1785.       x = 140
  1786.       y = 46
  1787.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1788.      
  1789.       value = @actor.mp
  1790.       x = 70
  1791.       y = 46 + 22 * 1
  1792.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1793.  
  1794.       value = @actor.mmp
  1795.       x = 140
  1796.       y = 46 + 22 * 1
  1797.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1798.  
  1799.       value = @actor.atk
  1800.       x = 70
  1801.       y = 46 + 22 * 2
  1802.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1803.      
  1804.       value = @actor.def
  1805.       x = 70
  1806.       y = 46 + 22 * 3
  1807.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1808.      
  1809.       value = @actor.agi
  1810.       x = 70
  1811.       y = 46 + 22 * 4
  1812.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1813.      
  1814.       value = @actor.mat
  1815.       x = 140
  1816.       y = 46 + 22 * 2
  1817.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1818.      
  1819.       value = @actor.mdf
  1820.       x = 140
  1821.       y = 46 + 22 * 3
  1822.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1823.      
  1824.       value = @actor.luk
  1825.       x = 140
  1826.       y = 46 + 22 * 4
  1827.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  1828.   end
  1829.    
  1830.   #--------------------------------------------------------------------------
  1831.   # ● Refresh Number
  1832.   #--------------------------------------------------------------------------    
  1833.   def refresh_number(sprite,image,value,number_cw,number_ch,x,y)
  1834.       number = value.truncate.abs.to_s.split(//)
  1835.       x2 = -number_cw * number.size
  1836.       for i in 0..number.size - 1
  1837.           number_abs = number[i].to_i
  1838.           nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
  1839.           sprite.bitmap.blt(x + x2 + (number_cw  *  i), y, image, nsrc_rect)        
  1840.       end      
  1841.   end
  1842.  
  1843.   #--------------------------------------------------------------------------
  1844.   # ● Refresh Face
  1845.   #--------------------------------------------------------------------------  
  1846.   def refresh_face
  1847.       #return
  1848.       @face.bitmap.clear
  1849.       face_image = Cache.face(@actor.face_name)
  1850.       arect = Rect.new(@actor.face_index  % 4 * 96, @actor.face_index / 4 * 96, 96, 96)
  1851.       @face.bitmap.blt(0,0, face_image, arect)
  1852.      # face_image.dispose
  1853.   end
  1854.  
  1855.   #--------------------------------------------------------------------------
  1856.   # ● Update Slide
  1857.   #--------------------------------------------------------------------------  
  1858.   def update_slide
  1859.       slide_speed = 10
  1860.       opac_speed = 23
  1861.       @slide_range = (@org_pos[0] + 25)
  1862.       if @active
  1863.          if @layout.x > @org_pos[0]
  1864.             @layout.x -= slide_speed
  1865.             @parameter.x -= slide_speed
  1866.             @face.x -= slide_speed
  1867.             @name.x -= slide_speed
  1868.             @status.x -= slide_speed
  1869.             @layout.opacity += opac_speed
  1870.             @parameter.opacity += opac_speed
  1871.             @face.opacity += opac_speed
  1872.             @name.opacity += opac_speed
  1873.             @status.opacity += opac_speed
  1874.             if @layout.x <= @org_pos[0]
  1875.                @layout.x = @org_pos[0]
  1876.                @parameter.x = @org_pos_par[0]
  1877.                @face.x = @org_pos_face[0]
  1878.                @name.x = @org_pos_name[0]
  1879.                @status.x = @org_pos_states[0]
  1880.                @layout.opacity = 255
  1881.                @parameter.opacity = 255
  1882.                @face.opacity = 255
  1883.                @name.opacity = 255  
  1884.                @status.opacity = 255
  1885.             end  
  1886.          end  
  1887.       else
  1888.          if @layout.x <  @slide_range
  1889.             @layout.x += slide_speed
  1890.             @parameter.x += slide_speed
  1891.             @face.x += slide_speed
  1892.             @name.x += slide_speed
  1893.             @status.x += slide_speed
  1894.             @layout.opacity -= opac_speed
  1895.             @parameter.opacity -= opac_speed
  1896.             @face.opacity -= opac_speed
  1897.             @name.opacity -= opac_speed
  1898.             @status.opacity -= opac_speed
  1899.             if @layout.x >=  @slide_range
  1900.                @layout.x =  @slide_range
  1901.                @parameter.x = @org_pos_par[0]
  1902.                @face.x = @org_pos_face[0]
  1903.                @name.x = @org_pos_name[0]
  1904.                @status.x = @org_pos_states[0]
  1905.                @layout.opacity = 0
  1906.                @parameter.opacity = 0
  1907.                @face.opacity = 0
  1908.                @name.opacity = 0  
  1909.                @status.opacity = 0  
  1910.             end  
  1911.          end  
  1912.          
  1913.       end  
  1914.   end
  1915.  
  1916.   #--------------------------------------------------------------------------
  1917.   # ● Update
  1918.   #--------------------------------------------------------------------------
  1919.   def update(active,actor)
  1920.       @active = active
  1921.       update_slide
  1922.       return if !@active
  1923.       refresh_all(actor) if actor != @actor
  1924.       refresh_parameter if can_refresh_parameter?
  1925.       refresh_states if @status_old != @actor.states      
  1926.       flow_states
  1927.   end      
  1928.  
  1929. end
  1930.  
  1931.  
  1932.  
  1933.  #==============================================================================
  1934. # ■ Game_Temp
  1935. #==============================================================================
  1936. class Game_Temp
  1937.  
  1938.   #--------------------------------------------------------------------------
  1939.   # ● Execute Pre Cache Main Menu
  1940.   #--------------------------------------------------------------------------    
  1941.   def execute_pre_cache_main_menu
  1942.       @pre_cache_main_menu = []
  1943.       @pre_cache_main_menu.push(Cache.menu_main("Background"))
  1944.       @pre_cache_main_menu.push(Cache.menu_main("LayoutMain"))
  1945.       @pre_cache_main_menu.push(Cache.menu_main("Time_Number"))
  1946.       @pre_cache_main_menu.push(Cache.menu_main("Gold_Number"))
  1947.       @pre_cache_main_menu.push(Cache.menu_main("Members_Layout"))
  1948.       @pre_cache_main_menu.push(Cache.menu_main("Members_Arrow"))
  1949.       @pre_cache_main_menu.push(Cache.menu_main("Par_Number_1"))
  1950.       @pre_cache_main_menu.push(Cache.menu_main("Par_Number_2"))
  1951.       @pre_cache_main_menu.push(Cache.menu_main("Par_Meter"))
  1952.       @pre_cache_main_menu.push(Cache.menu_main("Par_Layout"))
  1953.   end    
  1954.    
  1955. end
  1956.  
  1957. #==============================================================================
  1958. # ■ Scene_Menu
  1959. #==============================================================================
  1960. class Scene_Menu
  1961.   include MOG_MENU
  1962.   include MOG_MENU_BASE
  1963.  
  1964.   #--------------------------------------------------------------------------
  1965.   # ● Main
  1966.   #--------------------------------------------------------------------------        
  1967.   def main
  1968.       execute_setup
  1969.       execute_loop
  1970.       execute_dispose
  1971.   end  
  1972.  
  1973.   #--------------------------------------------------------------------------
  1974.   # ● Execute Setup
  1975.   #--------------------------------------------------------------------------        
  1976.   def execute_setup
  1977.       $game_temp.execute_pre_cache_icon if $game_temp.can_pre_cache_icon?
  1978.       @phase = 0
  1979.       @members_windows_active = false
  1980.       @members_index = 0
  1981.       create_sprites
  1982.   end
  1983.  
  1984.   #--------------------------------------------------------------------------
  1985.   # ● Execute Lopp
  1986.   #--------------------------------------------------------------------------        
  1987.   def execute_loop
  1988.       Graphics.transition(10)
  1989.       loop do
  1990.          Input.update
  1991.          update
  1992.          Graphics.update
  1993.          break if SceneManager.scene != self
  1994.       end
  1995.   end  
  1996.  
  1997. end
  1998.  
  1999. #==============================================================================
  2000. # ■ Face Members
  2001. #==============================================================================
  2002. class Face_Members_Sprite < Sprite
  2003.   include MOG_MENU
  2004.   attr_accessor :index
  2005.   attr_accessor :active
  2006.   attr_accessor :actor_id
  2007.  
  2008.  #--------------------------------------------------------------------------
  2009.  # ● Initialize
  2010.  #--------------------------------------------------------------------------                  
  2011.   def initialize(viewport = nil, index, actor_id)
  2012.       super(viewport)
  2013.       @active = false
  2014.       @index = index
  2015.       @actor_id = actor_id
  2016.       @active = false
  2017.       self.bitmap = Cache.menu("Face" + @actor_id.to_s)
  2018.       self.z = 12
  2019.       self.ox = self.bitmap.width / 2
  2020.       self.oy = self.bitmap.height / 2
  2021.       members_size = $game_party.members.size - 1
  2022.       members_size = 3 if members_size > 3
  2023.       space_base = (MEMBERS_FACE_SPACE * @index)
  2024.       space = space_base - ((ACTOR_SPACE * members_size ) / 2) +  MEMBERS_FACE_POSITION[0]
  2025.       @org_pos =  [space + self.ox , self.oy   ]
  2026.       @ny = 0
  2027.       @zoom_duration = [0,0,false]
  2028.       self.x = @org_pos[0]
  2029.       self.y = @org_pos[1]
  2030.   end  
  2031.  
  2032.  #--------------------------------------------------------------------------
  2033.  # ● Dispose
  2034.  #--------------------------------------------------------------------------                    
  2035.   def dispose
  2036.       super
  2037.       self.bitmap.dispose
  2038.   end  
  2039.  
  2040.  #--------------------------------------------------------------------------
  2041.  # ● Update
  2042.  #--------------------------------------------------------------------------                    
  2043.   def update_command(index, ny)
  2044.       @active = index == @index ? true : false
  2045.       @ny = ny
  2046.       update_slide(index)
  2047.       update_opacity
  2048.       update_zoom    
  2049.   end  
  2050.    
  2051.  #--------------------------------------------------------------------------
  2052.  # ● Update Opacity
  2053.  #--------------------------------------------------------------------------                      
  2054.   def update_opacity
  2055.       if @active
  2056.          self.opacity += 12
  2057.       else  
  2058.          self.opacity -= 6 if self.opacity > 120
  2059.       end  
  2060.   end  
  2061.  
  2062.  #--------------------------------------------------------------------------
  2063.  # ● Update Zoom
  2064.  #--------------------------------------------------------------------------                      
  2065.   def update_zoom
  2066.       if @active
  2067.          if !@zoom_duration[2]
  2068.             update_zoom_out
  2069.             @zoom_duration = [0,0,true] if self.zoom_x == 1.00  
  2070.          else  
  2071.             update_zoom_effect
  2072.          end
  2073.       else
  2074.          @zoom_duration[2] = false  
  2075.          update_zoom_in
  2076.       end  
  2077.   end    
  2078.  
  2079.  #--------------------------------------------------------------------------
  2080.  # ● Update Zoom Out
  2081.  #--------------------------------------------------------------------------                        
  2082.   def update_zoom_out
  2083.       return if self.zoom_x == 1.00
  2084.       self.zoom_x += 0.03
  2085.       self.zoom_y += 0.03
  2086.       if self.zoom_x >= 1.00
  2087.             self.zoom_x = 1.00
  2088.             self.zoom_y = 1.00
  2089.       end  
  2090.    end  
  2091.  
  2092.  #--------------------------------------------------------------------------
  2093.  # ● Update Zoom In
  2094.  #--------------------------------------------------------------------------                            
  2095.   def update_zoom_in
  2096.       return if self.zoom_x == 0
  2097.       self.zoom_x -= 0
  2098.       self.zoom_y -= 0
  2099.       if self.zoom_x <= 0
  2100.          self.zoom_x = 0
  2101.          self.zoom_y = 0
  2102.       end  
  2103.   end      
  2104.          
  2105.  #--------------------------------------------------------------------------
  2106.  # ● Update Zoom_effect
  2107.  #--------------------------------------------------------------------------                        
  2108.  def update_zoom_effect
  2109.      @zoom_duration[0] += 0
  2110.      return if @zoom_duration[0] < 0
  2111.      @zoom_duration[0] = 0
  2112.      @zoom_duration[1] += 0
  2113.      case @zoom_duration[1]
  2114.           when 0..30
  2115.              self.zoom_x -= 0
  2116.              self.zoom_y -= 0                
  2117.           when 31..60
  2118.              self.zoom_x += 0
  2119.              self.zoom_y += 0          
  2120.           when 61..999  
  2121.           @zoom_duration[1] = 0
  2122.           self.zoom_x = 0
  2123.           self.zoom_y = 0
  2124.      end
  2125.  end  
  2126.  
  2127.  #--------------------------------------------------------------------------
  2128.  # ● Update Slide
  2129.  #--------------------------------------------------------------------------                      
  2130.   def update_slide(index)
  2131.       np = @org_pos[0] - (index * MEMBERS_FACE_SPACE) + @ny
  2132.       cp = self.x
  2133.       sp = 5 + ((cp - np).abs / 5)
  2134.       if cp > np
  2135.          cp -= sp
  2136.          cp = np if cp < np
  2137.       elsif cp < np
  2138.          cp += sp
  2139.          cp = np if cp > np
  2140.       end    
  2141.       self.x = cp      
  2142.   end  
  2143.  
  2144.  #--------------------------------------------------------------------------
  2145.  # ● Active
  2146.  #--------------------------------------------------------------------------                        
  2147.   def active(value)
  2148.       @active = value
  2149.   end    
  2150.      
  2151. end
  2152.  
  2153. #==============================================================================
  2154. # ■ Members Arrow Sprite
  2155. #==============================================================================
  2156. class Members_Arrow_Sprite
  2157.    include MOG_MENU
  2158.    attr_accessor :active
  2159.    
  2160.  #--------------------------------------------------------------------------
  2161.  # ● Initialize
  2162.  #--------------------------------------------------------------------------
  2163.   def initialize
  2164.       @active = false
  2165.       create_members_layout
  2166.       create_arrows
  2167.   end
  2168.  
  2169.  #--------------------------------------------------------------------------
  2170.  # ● Create Members Layout
  2171.  #--------------------------------------------------------------------------  
  2172.   def create_members_layout
  2173.       @layout_members = Sprite.new
  2174.       @layout_members.bitmap = $game_temp.pre_cache_main_menu[4]
  2175.       @layout_members.z = 13
  2176.       @layout_members_pos = [MEMBERS_ARROW_LAYOUT_POSITION[0], MEMBERS_ARROW_LAYOUT_POSITION[1]]
  2177.       @layout_members.x = @layout_members_pos[0]
  2178.       @layout_members.y = @layout_members_pos[1]
  2179.       @layout_members.opacity = 0
  2180.   end
  2181.  
  2182.  #--------------------------------------------------------------------------
  2183.  # ● Create Arrows
  2184.  #--------------------------------------------------------------------------  
  2185.   def create_arrows
  2186.       @arrow_animation_duration = [0,0]
  2187.       @arrow_1 = Sprite.new
  2188.       @arrow_1.bitmap = $game_temp.pre_cache_main_menu[5]
  2189.       @arrow_1.z = 13
  2190.       @arrow1_pos = [MEMBERS_ARROW_1_POSITION[0], MEMBERS_ARROW_1_POSITION[1]]
  2191.       @arrow_1.x = @arrow1_pos[0]
  2192.       @arrow_1.y = @arrow1_pos[1]
  2193.       @arrow_1.opacity = 0
  2194.       @arrow_2 = Sprite.new
  2195.       @arrow_2.bitmap = $game_temp.pre_cache_main_menu[5]
  2196.       @arrow_2.z = 13
  2197.       @arrow_2.mirror = true
  2198.       @arrow2_pos = [MEMBERS_ARROW_2_POSITION[0], MEMBERS_ARROW_2_POSITION[1]]
  2199.       @arrow_2.x = @arrow2_pos[0]
  2200.       @arrow_2.y = @arrow2_pos[1]
  2201.       @arrow_2.opacity = 0
  2202.       @nx = 0
  2203.       @nx2 = 0
  2204.   end  
  2205.  
  2206.  #--------------------------------------------------------------------------
  2207.  # ● Dispose
  2208.  #--------------------------------------------------------------------------                              
  2209.   def dispose
  2210.       dispose_members_layout
  2211.       dispose_arrows
  2212.   end
  2213.  
  2214.  #--------------------------------------------------------------------------
  2215.  # ● Dispose Arrows
  2216.  #--------------------------------------------------------------------------                                
  2217.  def dispose_arrows
  2218.      return if @arrow_1 == nil
  2219.      @arrow_1.dispose
  2220.      @arrow_2.dispose
  2221.      @arrow_1 = nil
  2222.  end  
  2223.  
  2224.  #--------------------------------------------------------------------------
  2225.  # ● Dispose Members Layout
  2226.  #--------------------------------------------------------------------------    
  2227.   def dispose_members_layout
  2228.       return if @layout_members == nil
  2229.       @layout_members.dispose
  2230.       @layout_members = nil
  2231.   end
  2232.  
  2233.  #--------------------------------------------------------------------------
  2234.  # ● Update
  2235.  #--------------------------------------------------------------------------                              
  2236.   def update
  2237.       update_arrow_animation
  2238.       update_position
  2239.       @layout_members.opacity += 15
  2240.       @arrow_1.opacity += 15
  2241.       @arrow_2.opacity += 15
  2242.   end  
  2243.  
  2244.  #--------------------------------------------------------------------------
  2245.  # ● Update Position
  2246.  #--------------------------------------------------------------------------                                
  2247.   def update_position
  2248.       @arrow_1.x = @arrow1_pos[0] + @nx + @nx2
  2249.       @arrow_2.x = @arrow2_pos[0] + @nx - @nx2  
  2250.       @layout_members.x = @layout_members_pos[0] + @nx
  2251.   end
  2252.  
  2253.  #--------------------------------------------------------------------------
  2254.  # ● Update Arrow Animation
  2255.  #--------------------------------------------------------------------------                                
  2256.   def update_arrow_animation
  2257.       @arrow_animation_duration[0] += 1
  2258.       return if @arrow_animation_duration[0] < 2
  2259.       @arrow_animation_duration[0] = 0
  2260.       @arrow_animation_duration[1] += 1
  2261.       case @arrow_animation_duration[1]
  2262.          when 1..20
  2263.            @nx2 -= 1
  2264.          when 21..40
  2265.            @nx2 += 1
  2266.          when 41..999  
  2267.            @nx2 = 0
  2268.            @arrow_animation_duration[1] = 0            
  2269.       end
  2270.   end
  2271.  
  2272.  #--------------------------------------------------------------------------
  2273.  # ● Active
  2274.  #--------------------------------------------------------------------------                        
  2275.   def nx(value)
  2276.       @nx = value
  2277.   end    
  2278.  
  2279. end
  2280.  
  2281. #==============================================================================
  2282. # ■ Command Menu Sprite
  2283. #==============================================================================
  2284. class Command_Menu_Sprite < Sprite
  2285.   include MOG_MENU
  2286.   attr_accessor :index
  2287.  
  2288.  #--------------------------------------------------------------------------
  2289.  # ● Initialize
  2290.  #--------------------------------------------------------------------------                  
  2291.       def initialize(viewport = nil,index,command_name)
  2292.       super(viewport)
  2293.       @index = index
  2294.       @command_name = command_name
  2295.       self.bitmap = Cache.menu_main("CM_" + @command_name.to_s)
  2296.       @cw = self.bitmap.width
  2297.       @ch = self.bitmap.height      
  2298.       cw1 = self.bitmap.height / 6
  2299.       cw2 = (self.bitmap.width + COMMAND_SPACE) * index
  2300.       self.ox = self.bitmap.width / 6
  2301.       self.oy = self.bitmap.height / 6
  2302.       @org_pos = [COMMAND_POSITION[0] + cw2 + self.ox, COMMAND_POSITION[1] + self.oy]
  2303.       @slide_max = @org_pos[1] + cw1
  2304.       @zoom_duration = [1.00,1.00,false]
  2305.       @zoom_limit = [1.00, 1.00]
  2306.       self.x = -@cw
  2307.       self.y = -@ch
  2308.       self.z = 10
  2309.       @active = false
  2310.       @visible_old = true
  2311.       @np = [-@cw,-@ch]
  2312.       @sprite_name = Sprite.new
  2313.       @sprite_name.bitmap = Bitmap.new(100,32)
  2314.       @sprite_name.bitmap.draw_text(0,0,100,32,@command_name.to_s,0)
  2315.       @sprite_name.z = 11
  2316.       @np_name = [-@cw,-@ch]
  2317.       @cw_name_pos = [@cw - self.ox + 4, -self.oy + 4]
  2318.   end  
  2319.  
  2320.  #--------------------------------------------------------------------------
  2321.  # ● Dispose
  2322.  #--------------------------------------------------------------------------                    
  2323.   def dispose_command
  2324.       self.bitmap.dispose
  2325.       @sprite_name.bitmap.dispose
  2326.       @sprite_name.dispose
  2327.   end  
  2328.  
  2329.  #--------------------------------------------------------------------------
  2330.  # ● Update
  2331.  #--------------------------------------------------------------------------                    
  2332.   def update_command(index, visible)
  2333.       @active = index == @index ? true : false
  2334.       refresh_active(visible) if @visible_old != visible
  2335.       update_position
  2336.       if !visible
  2337.           if @active
  2338.              self.opacity += 55
  2339.           else
  2340.              self.opacity -= 55
  2341.           end  
  2342.           return
  2343.       end  
  2344.       update_zoom
  2345.       update_opacity
  2346.     end  
  2347.  #--------------------------------------------------------------------------
  2348.  # ● Update Slide
  2349.  #--------------------------------------------------------------------------                      
  2350.   def update_slide(type,cp,np)
  2351.       sp = 1 + ((cp - np).abs / 3)
  2352.       if cp > np
  2353.          cp -= sp
  2354.          cp = np if cp < np
  2355.       elsif cp < np
  2356.          cp += sp
  2357.          cp = np if cp > np
  2358.       end    
  2359.       self.x = cp if type == 0
  2360.       self.y = cp if type == 1
  2361.       @sprite_name.x = cp if type == 2
  2362.       @sprite_name.y = cp if type == 3
  2363.   end
  2364.  
  2365.  #--------------------------------------------------------------------------
  2366.  # ● Update Position
  2367.  #--------------------------------------------------------------------------  
  2368.   def update_position
  2369.       unless !@visible_old
  2370.       if @active
  2371.          @np[0] = @org_pos[0]
  2372.          @np[1] = @slide_max
  2373.       else
  2374.          @np[0] = @org_pos[0]
  2375.          @np[1] = @org_pos[1]
  2376.       end  
  2377.       end
  2378.       update_slide(0,self.x,@np[0])
  2379.       update_slide(1,self.y,@np[1])
  2380.       update_sprite_name_position
  2381.   end      
  2382.  #--------------------------------------------------------------------------
  2383.  # ● Update Sprite Name Position
  2384.  #--------------------------------------------------------------------------  
  2385.  def update_sprite_name_position
  2386.       if (@active and !@visible_old) or !@active
  2387.          @np_name[0] = self.x + @cw_name_pos[0] + COMMAND_NAME_POSITION[0]
  2388.          @np_name[1] = self.y + @cw_name_pos[1] + COMMAND_NAME_POSITION[1]
  2389.       else
  2390.          @np_name[0] = COMMAND_NAME_POSITION_2[0]
  2391.          @np_name[1] = COMMAND_NAME_POSITION_2[1]
  2392.       end
  2393.       update_slide(2,@sprite_name.x,@np_name[0])
  2394.       update_slide(3,@sprite_name.y,@np_name[1])      
  2395.       @sprite_name.visible = @active ? true : false
  2396.   end    
  2397.  
  2398.  
  2399.  #--------------------------------------------------------------------------
  2400.  # ● Refresh Active
  2401.  #--------------------------------------------------------------------------                      
  2402.   def refresh_active(visible)
  2403.       if @active and !visible
  2404.          @np[0] = COMMAND_POSITION_2[0] + (@cw / 2)
  2405.          @np[1] = COMMAND_POSITION_2[1]  
  2406.          self.zoom_x = @zoom_limit[0]
  2407.          self.zoom_y = @zoom_limit[0]
  2408.       else
  2409.          @np[0] = @org_pos[0]
  2410.          @np[1] = @org_pos[1]    
  2411.       end
  2412.       @visible_old = visible
  2413.   end
  2414.  
  2415.  #--------------------------------------------------------------------------
  2416.  # ● Update Opacity
  2417.  #--------------------------------------------------------------------------  
  2418.   def update_opacity
  2419.       if @active
  2420.          self.opacity += 55
  2421.       else
  2422.          self.opacity -= 55 if self.opacity > 200
  2423.          if self.opacity < 200
  2424.             self.opacity += 55
  2425.             self.opacity = 200 if self.opacity > 200
  2426.          end  
  2427.       end    
  2428.   end  
  2429.  
  2430.  #--------------------------------------------------------------------------
  2431.  # ● Update Zoom
  2432.  #--------------------------------------------------------------------------                      
  2433.   def update_zoom
  2434.       if @active
  2435.          if !@zoom_duration[2]
  2436.             update_zoom_out
  2437.             @zoom_duration = [0,0,true] if self.zoom_x == @zoom_limit[1]
  2438.          else  
  2439.             update_zoom_effect
  2440.          end
  2441.       else
  2442.          @zoom_duration[2] = false  
  2443.          update_zoom_in
  2444.       end  
  2445.   end    
  2446.  
  2447.  #--------------------------------------------------------------------------
  2448.  # ● Update Zoom Out
  2449.  #--------------------------------------------------------------------------                        
  2450.   def update_zoom_out
  2451.       return if self.zoom_x == @zoom_limit[1]
  2452.       self.zoom_x += 0
  2453.       self.zoom_y += 0
  2454.       if self.zoom_x >= @zoom_limit[1]
  2455.             self.zoom_x = @zoom_limit[1]
  2456.             self.zoom_y = @zoom_limit[1]
  2457.       end  
  2458.    end  
  2459.  
  2460.  #--------------------------------------------------------------------------
  2461.  # ● Update Zoom In
  2462.  #--------------------------------------------------------------------------                            
  2463.   def update_zoom_in
  2464.       return if self.zoom_x == @zoom_limit[0]
  2465.       self.zoom_x -= 0
  2466.       self.zoom_y -= 0
  2467.       if self.zoom_x <= @zoom_limit[0]
  2468.          self.zoom_x = @zoom_limit[0]
  2469.          self.zoom_y = @zoom_limit[0]
  2470.       end  
  2471.   end      
  2472.          
  2473.  #--------------------------------------------------------------------------
  2474.  # ● Update Zoom_effect
  2475.  #--------------------------------------------------------------------------                        
  2476.  def update_zoom_effect
  2477.      @zoom_duration[0] += 1
  2478.      return if @zoom_duration[0] < 1
  2479.      @zoom_duration[0] = 0
  2480.      @zoom_duration[1] += 1
  2481.      case @zoom_duration[1]
  2482.           when 1..30
  2483.              self.zoom_x -= 0
  2484.              self.zoom_y -= 0                
  2485.           when 31..60
  2486.              self.zoom_x += 0
  2487.              self.zoom_y += 0          
  2488.           when 61..999  
  2489.           @zoom_duration[1] = 0
  2490.           self.zoom_x = @zoom_limit[1]
  2491.           self.zoom_y = @zoom_limit[1]
  2492.      end
  2493.  end  
  2494.  
  2495. end
  2496.  
  2497. #==============================================================================
  2498. # ■ Actor Menu Pictures
  2499. #==============================================================================
  2500. class Actor_Menu_Pictures < Sprite
  2501.   include MOG_MENU
  2502.   attr_accessor :index
  2503.  
  2504.  #--------------------------------------------------------------------------
  2505.  # ● Initialize
  2506.  #--------------------------------------------------------------------------                  
  2507.   def initialize(viewport = nil,index,actor_id)
  2508.       super(viewport)
  2509.       @index = index
  2510.       @actor_id = actor_id
  2511.       self.bitmap = Cache.menu("Actor" + @actor_id.to_s)
  2512.       self.z = 2
  2513.       set_position
  2514.       @slide_max = @org_pos[0] + 24
  2515.       auto_y = Graphics.height - self.bitmap.height
  2516.       self.ox = self.bitmap.width / 2
  2517.       self.x = @org_pos[0] - 15
  2518.       self.y = auto_y
  2519.       self.opacity = 0
  2520.       @op_time = 10 * @index
  2521.   end  
  2522.  
  2523.  #--------------------------------------------------------------------------
  2524.  # ● Set Position
  2525.  #--------------------------------------------------------------------------  
  2526.   def set_position
  2527.       members_size = $game_party.members.size
  2528.       members_size = $game_party.max_battle_members if members_size > $game_party.max_battle_members
  2529.       space_members = ((Graphics.width ) / members_size)
  2530.       space_members_2 = (space_members * @index)
  2531.       space_members_3 = ((space_members / 2) * (members_size - 1))
  2532.       center = Graphics.width / 2
  2533.       space = center + space_members_2 - space_members_3
  2534.       @org_pos =  [space, ACTOR_POSITION[1]]  
  2535.   end
  2536.      
  2537.  #--------------------------------------------------------------------------
  2538.  # ● Dispose
  2539.  #--------------------------------------------------------------------------                    
  2540.   def dispose_picture
  2541.       self.bitmap.dispose
  2542.   end  
  2543.  
  2544.  #--------------------------------------------------------------------------
  2545.  # ● Update Picture
  2546.  #--------------------------------------------------------------------------  
  2547.   def update_picture
  2548.       @op_time -= 1 if @op_time > 0
  2549.       return if @op_time > 0
  2550.       self.opacity += 15
  2551.       self.x += 1 if self.x < @org_pos[0]
  2552.   end
  2553.  
  2554. end
  2555.  
  2556. #==============================================================================
  2557. # ■ Actor Menu Parameter
  2558. #==============================================================================
  2559. class Actor_Menu_Parameter
  2560.  
  2561.   include MOG_MENU
  2562.   attr_accessor :index
  2563.  
  2564.   #--------------------------------------------------------------------------
  2565.   # ● Initialize
  2566.   #--------------------------------------------------------------------------                    
  2567.   def initialize(index, actor)
  2568.       setup(index, actor)
  2569.       create_layout_par
  2570.       create_hp_number
  2571.       create_hp2_number
  2572.       create_mp_number
  2573.       create_mp2_number
  2574.       create_hp_meter
  2575.       create_mp_meter
  2576.       create_level
  2577.       create_states
  2578.   end
  2579.  
  2580.   #--------------------------------------------------------------------------
  2581.   # ● Setup
  2582.   #--------------------------------------------------------------------------                      
  2583.   def setup(index, actor)
  2584.       @actor = actor
  2585.       @index = index
  2586.       set_position
  2587.       @number_image_1 = $game_temp.pre_cache_main_menu[6]
  2588.       @number_image_1_cw = @number_image_1.width / 10
  2589.       @number_image_1_ch = @number_image_1.height / 3
  2590.       @number_image_2 = $game_temp.pre_cache_main_menu[7]
  2591.       @number_image_2_cw = @number_image_2.width / 10
  2592.       @number_image_2_ch = @number_image_2.height
  2593.       @par_meter_image = $game_temp.pre_cache_main_menu[8]
  2594.       @par_meter_cw = @par_meter_image.width / 3
  2595.       @par_meter_ch = @par_meter_image.height / 2
  2596.       @par_meter_flow = 0
  2597.       @par_meter_flow_max = @par_meter_image.width - @par_meter_cw
  2598.       @icon_image = $game_temp.pre_cache_icon
  2599.   end
  2600.  
  2601.   #--------------------------------------------------------------------------
  2602.   # ● Set Position
  2603.   #--------------------------------------------------------------------------                      
  2604.   def set_position
  2605.       members_size = $game_party.members.size
  2606.       members_size = $game_party.max_battle_members if members_size >= $game_party.max_battle_members
  2607.       space_members = ((Graphics.width ) / members_size)
  2608.       space_members_2 = (space_members * @index)
  2609.       space_members_3 = ((space_members / 2) * (members_size - 1))
  2610.       center = Graphics.width / 2
  2611.       layout_ox = $game_temp.pre_cache_main_menu[9].width / 2
  2612.       @base_x = center - layout_ox + space_members_2 - space_members_3  
  2613.   end
  2614.      
  2615.   #--------------------------------------------------------------------------
  2616.   # ● Create Layout Par
  2617.   #--------------------------------------------------------------------------                      
  2618.   def create_layout_par
  2619.       @layout_par = Sprite.new
  2620.       @layout_par.bitmap = $game_temp.pre_cache_main_menu[9]
  2621.       @layout_par.z = 10
  2622.       @layout_par.x = @base_x + ACTOR_LAYOUT_POSITON[0]      
  2623.       @layout_par.y = ACTOR_LAYOUT_POSITON[1]
  2624.   end
  2625.  
  2626.   #--------------------------------------------------------------------------
  2627.   # ● Create Name
  2628.   #--------------------------------------------------------------------------  
  2629.   def create_name
  2630.       @actor_name = Sprite.new
  2631.       @actor_name.bitmap = Bitmap.new(160,32)
  2632.       @actor_name.bitmap.font.size = 18
  2633.       @actor_name.bitmap.font.bold = false
  2634.       @actor_name.bitmap.font.italic = false
  2635.       actor_name = @actor.name
  2636.       @actor_name.bitmap.font.color = Color.new(0,0,0)
  2637.       @actor_name.bitmap.draw_text(1,1,140,32,actor_name,1)
  2638.       @actor_name.bitmap.font.color = Color.new(255 ,255,255)
  2639.       @actor_name.bitmap.draw_text(0,0,140,32,actor_name,1)
  2640.       @actor_name.z = 12
  2641.       @actor_name.x = @base_x - 20
  2642.       @actor_name.y = 305
  2643.   end
  2644.  
  2645.   #--------------------------------------------------------------------------
  2646.   # ● Create HP Number
  2647.   #--------------------------------------------------------------------------  
  2648.   def create_hp_number
  2649.       @hp_number = Sprite.new
  2650.       @hp_number.bitmap = Bitmap.new(@number_image_1_cw * 4,@number_image_1_ch)
  2651.       @hp_number.z = 12
  2652.       @hp_number.x = @base_x + ACTOR_HP1_POSITON[0]
  2653.       @hp_number.y =  ACTOR_HP1_POSITON[1]
  2654.       refresh_hp
  2655.   end
  2656.  
  2657.   #--------------------------------------------------------------------------
  2658.   # ● Refresh HP
  2659.   #--------------------------------------------------------------------------    
  2660.   def refresh_hp
  2661.       @hp_number.bitmap.clear
  2662.       number = @actor.hp.abs.to_s.split(//)
  2663.       number_cw = @number_image_1_cw
  2664.       number_ch = @number_image_1_ch
  2665.       for i in 0..number.size - 1
  2666.           number_abs = number[i].to_i
  2667.           nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
  2668.           @hp_number.bitmap.blt(number_cw  *  i, 0, @number_image_1, nsrc_rect)        
  2669.       end
  2670.   end
  2671.    
  2672.   #--------------------------------------------------------------------------
  2673.   # ● Create HP2 Number
  2674.   #--------------------------------------------------------------------------  
  2675.   def create_hp2_number
  2676.       @hp2_number = Sprite.new
  2677.       @hp2_number.bitmap = Bitmap.new(@number_image_2_cw * 4,@number_image_2_ch)
  2678.       @hp2_number.z = 12
  2679.       @hp2_number.x = @base_x + ACTOR_HP2_POSITON[0]
  2680.       @hp2_number.y =  ACTOR_HP2_POSITON[1]
  2681.       refresh_hp2
  2682.   end
  2683.  
  2684.   #--------------------------------------------------------------------------
  2685.   # ● Refresh HP2
  2686.   #--------------------------------------------------------------------------    
  2687.   def refresh_hp2
  2688.       @hp2_number.bitmap.clear
  2689.       number = @actor.mhp.abs.to_s.split(//)
  2690.       number_cw = @number_image_2_cw
  2691.       number_ch = @number_image_2_ch
  2692.       for i in 0..number.size - 1
  2693.           number_abs = number[i].to_i
  2694.           nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
  2695.           @hp2_number.bitmap.blt(number_cw  *  i, 0, @number_image_2, nsrc_rect)        
  2696.       end
  2697.   end  
  2698.  
  2699.   #--------------------------------------------------------------------------
  2700.   # ● Create MP Number
  2701.   #--------------------------------------------------------------------------  
  2702.   def create_mp_number
  2703.       @mp_number = Sprite.new
  2704.       @mp_number.bitmap = Bitmap.new(@number_image_1_cw * 4,@number_image_1_ch)
  2705.       @mp_number.z = 12
  2706.       @mp_number.x = @base_x + ACTOR_MP1_POSITON[0]
  2707.       @mp_number.y =  ACTOR_MP1_POSITON[1]
  2708.       refresh_mp
  2709.   end
  2710.  
  2711.   #--------------------------------------------------------------------------
  2712.   # ● Refresh MP
  2713.   #--------------------------------------------------------------------------    
  2714.   def refresh_mp
  2715.       @mp_number.bitmap.clear
  2716.       number = @actor.mp.abs.to_s.split(//)
  2717.       number_cw = @number_image_1_cw
  2718.       number_ch = @number_image_1_ch
  2719.       for i in 0..number.size - 1
  2720.           number_abs = number[i].to_i
  2721.           nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
  2722.           @mp_number.bitmap.blt(number_cw  *  i, 0, @number_image_1, nsrc_rect)        
  2723.       end
  2724.     end
  2725.    
  2726.   #--------------------------------------------------------------------------
  2727.   # ● Create MP2 Number
  2728.   #--------------------------------------------------------------------------  
  2729.   def create_mp2_number
  2730.       @mp2_number = Sprite.new
  2731.       @mp2_number.bitmap = Bitmap.new(@number_image_2_cw * 4,@number_image_2_ch)
  2732.       @mp2_number.z = 12
  2733.       @mp2_number.x = @base_x + ACTOR_MP2_POSITON[0]
  2734.       @mp2_number.y =  ACTOR_MP2_POSITON[1]
  2735.       refresh_mp2
  2736.   end
  2737.  
  2738.   #--------------------------------------------------------------------------
  2739.   # ● Refresh MP2
  2740.   #--------------------------------------------------------------------------    
  2741.   def refresh_mp2
  2742.       @mp2_number.bitmap.clear
  2743.       number = @actor.mmp.abs.to_s.split(//)
  2744.       number_cw = @number_image_2_cw
  2745.       number_ch = @number_image_2_ch
  2746.       for i in 0..number.size - 1
  2747.           number_abs = number[i].to_i
  2748.           nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
  2749.           @mp2_number.bitmap.blt(number_cw  *  i, 0, @number_image_2, nsrc_rect)        
  2750.       end
  2751.   end      
  2752.    
  2753.   #--------------------------------------------------------------------------
  2754.   # ● Create Level
  2755.   #--------------------------------------------------------------------------      
  2756.   def create_level
  2757.       @level = Sprite.new
  2758.       @level.bitmap = Bitmap.new(@number_image_1_cw * 2, @number_image_1_ch)
  2759.       @level.z = 12
  2760.       @level.x = @base_x + ACTOR_LEVEL_POSITON[0]
  2761.       @level.y = ACTOR_LEVEL_POSITON[1]
  2762.       refresh_level
  2763.   end
  2764.  
  2765.   #--------------------------------------------------------------------------
  2766.   # ● Refresh Level
  2767.   #--------------------------------------------------------------------------        
  2768.   def refresh_level
  2769.       @level.bitmap.clear
  2770.       number = @actor.level.abs.to_s.split(//)
  2771.       number_cw = @number_image_1_cw
  2772.       number_ch = @number_image_1_ch
  2773.       for i in 0..number.size - 1
  2774.           number_abs = number[i].to_i
  2775.           nsrc_rect = Rect.new(number_cw * number_abs, number_ch * 2, number_cw , number_ch)
  2776.           @level.bitmap.blt(number_cw  *  i, 0, @number_image_1, nsrc_rect)        
  2777.       end      
  2778.   end  
  2779.  
  2780.   #--------------------------------------------------------------------------
  2781.   # ● Create HP Meter
  2782.   #--------------------------------------------------------------------------      
  2783.   def create_hp_meter
  2784.       @hp_meter = Sprite.new
  2785.       @hp_meter.bitmap = Bitmap.new(@par_meter_cw,@par_meter_ch)
  2786.       @hp_meter.z = 11
  2787.       @hp_meter.x = @base_x + ACTOR_HP_METER_POSITON[0]
  2788.       @hp_meter.y = ACTOR_HP_METER_POSITON[1]
  2789.       update_flow_hp
  2790.   end
  2791.  
  2792.   #--------------------------------------------------------------------------
  2793.   # ● Update Flow HP
  2794.   #--------------------------------------------------------------------------        
  2795.   def update_flow_hp
  2796.       @hp_meter.bitmap.clear
  2797.       par_width = @par_meter_cw * @actor.hp / @actor.mhp
  2798.       m_scr = Rect.new(@par_meter_flow,0, par_width, @par_meter_ch)
  2799.       @hp_meter.bitmap.blt(0,0,@par_meter_image, m_scr)
  2800.   end  
  2801.  
  2802.   #--------------------------------------------------------------------------
  2803.   # ● Create MP Meter
  2804.   #--------------------------------------------------------------------------      
  2805.   def create_mp_meter
  2806.       @mp_meter = Sprite.new
  2807.       @mp_meter.bitmap = Bitmap.new(@par_meter_cw,@par_meter_ch)
  2808.       @mp_meter.z = 11
  2809.       @mp_meter.x = @base_x + ACTOR_MP_METER_POSITON[0]
  2810.       @mp_meter.y = ACTOR_MP_METER_POSITON[1]
  2811.       update_flow_mp
  2812.   end
  2813.  
  2814.   #--------------------------------------------------------------------------
  2815.   # ● Update Flow MP
  2816.   #--------------------------------------------------------------------------        
  2817.   def update_flow_mp
  2818.       @mp_meter.bitmap.clear
  2819.       par_width = @par_meter_cw * @actor.mp / @actor.mmp rescue nil
  2820.       par_width = 0 if par_width == nil
  2821.       m_scr = Rect.new(@par_meter_flow,@par_meter_ch, par_width, @par_meter_ch)
  2822.       @mp_meter.bitmap.blt(0,0,@par_meter_image, m_scr)
  2823.       @par_meter_flow += 3
  2824.       @par_meter_flow = 0 if @par_meter_flow > @par_meter_flow_max
  2825.   end    
  2826.  
  2827.   #--------------------------------------------------------------------------
  2828.   # ● Create_States
  2829.   #--------------------------------------------------------------------------      
  2830.   def create_states
  2831.       refresh_states
  2832.       @status = Sprite.new
  2833.       @status.bitmap = Bitmap.new(24,24)
  2834.       @status.x = @base_x +  ACTOR_STATES_POSITION[0]
  2835.       @status.y = ACTOR_STATES_POSITION[1]
  2836.       @status_flow = -24
  2837.       @states_speed = 50
  2838.       @status.z = 503
  2839.       @old_states = @actor.states
  2840.       refresh_states
  2841.       update_flow_states
  2842.   end      
  2843.    
  2844.   #--------------------------------------------------------------------------
  2845.   # ● Upate Flow_Status
  2846.   #--------------------------------------------------------------------------          
  2847.   def update_flow_states
  2848.       return if @actor.states.size == 0 and !@status.visible
  2849.       @states_speed = 0
  2850.       @status.bitmap.clear
  2851.       src_rect = Rect.new(@status_flow,0, 24,24)
  2852.       @status.bitmap.blt(0,0, @actor_status, src_rect)
  2853.       @status.visible = @actor.states.size == 0 ? false : true
  2854.       @status_flow += 1
  2855.       @status_flow = -24 if @status_flow >= @states_size - 24
  2856.   end    
  2857.  
  2858.   #--------------------------------------------------------------------------
  2859.   # ● Refresh States
  2860.   #--------------------------------------------------------------------------        
  2861.   def refresh_states
  2862.       @old_states = @actor.states
  2863.       if @actor_status != nil
  2864.          @actor_status.dispose
  2865.          @actor_status = nil
  2866.       end
  2867.       @states_size = @actor.states.size > 0 ? (48 * @actor.states.size) : 24
  2868.       @actor_status = Bitmap.new(@states_size,24)
  2869.       index = 0
  2870.       for i in  @actor.states
  2871.          rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
  2872.          @actor_status.blt(48 * index , 0, @icon_image, rect)
  2873.          index += 1
  2874.       end
  2875.   end  
  2876.  
  2877.   #--------------------------------------------------------------------------
  2878.   # ● Update
  2879.   #--------------------------------------------------------------------------          
  2880.   def update
  2881.       update_flow_hp
  2882.       update_flow_mp
  2883.       update_flow_states
  2884.   end  
  2885.  
  2886. end
  2887.  
  2888.  
  2889. #==============================================================================
  2890. # ■ Actor Menu Parameter
  2891. #==============================================================================
  2892. class Actor_Menu_Parameter
  2893.  
  2894.   #--------------------------------------------------------------------------
  2895.   # ● Dispose
  2896.   #--------------------------------------------------------------------------                    
  2897.   def dispose
  2898.       dispose_actor_layout_par
  2899.       dispose_name
  2900.       dispose_hp_number
  2901.       dispose_mp_number
  2902.       dispose_hp_meter
  2903.       dispose_mp_meter
  2904.       dispose_states
  2905.       dispose_level
  2906.   end  
  2907.  
  2908.   #--------------------------------------------------------------------------
  2909.   # ● Dispose Actor Layout Par
  2910.   #--------------------------------------------------------------------------                        
  2911.   def dispose_actor_layout_par
  2912.       return if @layout_par == nil
  2913.       @layout_par.dispose
  2914.       @layout_par = nil
  2915.   end    
  2916.  
  2917.   #--------------------------------------------------------------------------
  2918.   # ● Dispose Name
  2919.   #--------------------------------------------------------------------------  
  2920.   def dispose_name
  2921.       return if @actor_name == nil
  2922.       @actor_name.bitmap.dispose
  2923.       @actor_name.dispose
  2924.       @actor_name = nil
  2925.   end
  2926.  
  2927.   #--------------------------------------------------------------------------
  2928.   # ● Dispose HP Number
  2929.   #--------------------------------------------------------------------------      
  2930.   def dispose_hp_number
  2931.       return if @hp_number == nil
  2932.       @hp_number.bitmap.dispose
  2933.       @hp_number.dispose
  2934.       @hp_number = nil
  2935.       @hp2_number.bitmap.dispose
  2936.       @hp2_number.dispose
  2937.       @hp2_number = nil      
  2938.      
  2939.   end    
  2940.  
  2941.   #--------------------------------------------------------------------------
  2942.   # ● Dispose MP Number
  2943.   #--------------------------------------------------------------------------      
  2944.   def dispose_mp_number
  2945.       return if @mp_number == nil
  2946.       @mp_number.bitmap.dispose
  2947.       @mp_number.dispose
  2948.       @mp_number = nil
  2949.       @mp2_number.bitmap.dispose
  2950.       @mp2_number.dispose
  2951.       @mp2_number = nil      
  2952.   end  
  2953.  
  2954.   #--------------------------------------------------------------------------
  2955.   # ● Dispose States
  2956.   #--------------------------------------------------------------------------            
  2957.    def dispose_states
  2958.        return if @status == nil
  2959.        @status.bitmap.dispose
  2960.        @status.dispose
  2961.        if @actor_status != nil
  2962.           @actor_status.dispose
  2963.           @actor_status = nil
  2964.        end  
  2965.    end  
  2966.  
  2967.   #--------------------------------------------------------------------------
  2968.   # ● Dispose MP Meter
  2969.   #--------------------------------------------------------------------------        
  2970.   def dispose_mp_meter
  2971.       return if @mp_meter == nil
  2972.       @mp_meter.bitmap.dispose
  2973.       @mp_meter.dispose
  2974.       @mp_meter = nil
  2975.   end    
  2976.  
  2977.   #--------------------------------------------------------------------------
  2978.   # ● Dispose HP Meter
  2979.   #--------------------------------------------------------------------------        
  2980.   def dispose_hp_meter
  2981.       return if @hp_meter == nil
  2982.       @hp_meter.bitmap.dispose
  2983.       @hp_meter.dispose
  2984.       @hp_meter = nil
  2985.   end
  2986.  
  2987.   #--------------------------------------------------------------------------
  2988.   # ● Dispose Level
  2989.   #--------------------------------------------------------------------------        
  2990.   def dispose_level
  2991.       return if @level == nil
  2992.       @level.bitmap.dispose
  2993.       @level.dispose
  2994.       @level = nil
  2995.   end
  2996.    
  2997. end  
  2998.  
  2999. #==============================================================================
  3000. # ■ Scene_Menu
  3001. #==============================================================================
  3002. class Scene_Menu
  3003.  
  3004.   #--------------------------------------------------------------------------
  3005.   # ● Create Sprites
  3006.   #--------------------------------------------------------------------------          
  3007.   def create_sprites
  3008.       create_menu_background
  3009.       create_layout
  3010.       create_particles
  3011.       create_command
  3012.       create_actor_pictures
  3013.       create_timer_sprite
  3014.       create_gold_number
  3015.       create_location
  3016.       create_actor_parameter
  3017.       create_members
  3018.       create_members_layout
  3019.       update_members_face
  3020.   end
  3021.  
  3022.   #--------------------------------------------------------------------------
  3023.   # ● Create Menu Background
  3024.   #--------------------------------------------------------------------------            
  3025.   def create_menu_background
  3026.       @background = Plane.new
  3027.       @background.bitmap = $game_temp.pre_cache_main_menu[0]
  3028.       @background.z = 0
  3029.       @background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
  3030.   end  
  3031.  
  3032.   #--------------------------------------------------------------------------
  3033.   # ● Create Menu Background
  3034.   #--------------------------------------------------------------------------              
  3035.   def create_layout
  3036.       @layout = Sprite.new
  3037.       @layout.bitmap = $game_temp.pre_cache_main_menu[1]
  3038.       @layout.z = 3
  3039.   end
  3040.  
  3041.   #--------------------------------------------------------------------------
  3042.   # ● Create Particles
  3043.   #--------------------------------------------------------------------------  
  3044.   def create_particles
  3045.       @particles_sprite =[]
  3046.       for i in 0...NUMBER_OF_PARTICLES
  3047.           @particles_sprite.push(Particles_Menu.new(nil))
  3048.       end
  3049.   end
  3050.    
  3051.   #--------------------------------------------------------------------------
  3052.   # ● Create Command
  3053.   #--------------------------------------------------------------------------  
  3054.   def create_command
  3055.       create_command_window
  3056.       @command_window.visible = false
  3057.       @command_window.x -=640      
  3058.       @command_max = @command_window.list.size
  3059.       @commnad_name = []
  3060.       index = 0
  3061.       for i in @command_window.list
  3062.          @commnad_name.push(i[:name])
  3063.          index += 1
  3064.       end  
  3065.       @command_scroll_max = @command_max > 6 ? 6 : @command_max
  3066.       @command_ny = 0
  3067.       @command_sprites = []
  3068.       index = 0
  3069.       for i in 0...@command_max
  3070.           @command_sprites.push(Command_Menu_Sprite.new(nil, index,@commnad_name[index]) )
  3071.           index += 1
  3072.       end
  3073.   end  
  3074.  
  3075.   #--------------------------------------------------------------------------
  3076.   # ● Create Command Window
  3077.   #--------------------------------------------------------------------------    
  3078.   def create_command_window
  3079.       @command_window = Window_MenuCommand.new
  3080.       @command_window.set_handler(:item,      method(:command_item))
  3081.       @command_window.set_handler(:skill,     method(:command_personal))
  3082.       @command_window.set_handler(:equip,     method(:command_personal))
  3083.       @command_window.set_handler(:status,    method(:command_personal))
  3084.       @command_window.set_handler(:formation, method(:command_formation))
  3085.       @command_window.set_handler(:save,      method(:command_save))
  3086.       @command_window.set_handler(:game_end,  method(:command_game_end))
  3087.       @command_window.set_handler(:cancel,    method(:return_scene))  
  3088.       @command_window.index = $game_temp.menu_index
  3089.    end  
  3090.      
  3091.   #--------------------------------------------------------------------------
  3092.   # ● Create Actor Pictures
  3093.   #--------------------------------------------------------------------------    
  3094.   def create_actor_pictures
  3095.       @actor_pictures = []
  3096.       members_size = $game_party.members.size
  3097.       members_size = $game_party.max_battle_members if members_size >= $game_party.max_battle_members
  3098.       for i in 0...members_size
  3099.          @actor_pictures.push(Actor_Menu_Pictures.new(nil,i,$game_party.members[i].id))
  3100.       end  
  3101.   end
  3102.  
  3103.   #--------------------------------------------------------------------------
  3104.   # ● Create Timer Number
  3105.   #--------------------------------------------------------------------------      
  3106.   def create_timer_sprite
  3107.       update_timer
  3108.       @min_old = @min
  3109.       @timer_image = $game_temp.pre_cache_main_menu[2]
  3110.       @timer_cw = @timer_image.width / 10
  3111.       @timer_ch = @timer_image.height
  3112.       @timer_sprite = Sprite.new
  3113.       @timer_sprite.bitmap = Bitmap.new(@timer_image.width ,@timer_image.height)
  3114.       @timer_sprite.z = 11
  3115.       @timer_sprite.x = TIME_NUMBER_POS[0]
  3116.       @timer_sprite.y = TIME_NUMBER_POS[1]
  3117.       refresh_timer
  3118.   end
  3119.  
  3120.   #--------------------------------------------------------------------------
  3121.   # ● Create Gold Number
  3122.   #--------------------------------------------------------------------------        
  3123.   def create_gold_number
  3124.       @gold = $game_party.gold
  3125.       @gold_image = $game_temp.pre_cache_main_menu[3]
  3126.       @gold_cw = @gold_image.width / 10
  3127.       @gold_ch = @gold_image.height
  3128.       @gold_sprite = Sprite.new
  3129.       @gold_sprite.bitmap = Bitmap.new(@gold_image.width ,@gold_image.height)
  3130.       @gold_sprite.z = 11
  3131.       @gold_sprite.x = GOLD_NUMBER_POS[0]
  3132.       @gold_sprite.y = GOLD_NUMBER_POS[1]
  3133.       refresh_gold
  3134.   end  
  3135.  
  3136.   #--------------------------------------------------------------------------
  3137.   # ● Create Location
  3138.   #--------------------------------------------------------------------------          
  3139.   def create_location
  3140.       @location = Sprite.new
  3141.       @location.bitmap = Bitmap.new(200,40)
  3142.       @location.bitmap.font.size = 20
  3143.       @location.bitmap.font.bold = false
  3144.       @location.bitmap.font.italic = false
  3145.       @location.z = 12
  3146.       @location.x = LOCATION_POS[0]
  3147.       @location.y = LOCATION_POS[1]
  3148.       refresh_location
  3149.   end
  3150.  
  3151.   #--------------------------------------------------------------------------
  3152.   # ● Refresh Location
  3153.   #--------------------------------------------------------------------------            
  3154.   def refresh_location
  3155.       location_name = $game_map.display_name
  3156.       @location.bitmap.clear
  3157.       @location.bitmap.font.color = Color.new(120,120,120,120)
  3158.       @location.bitmap.draw_text(6,4,190,32, location_name.to_s,2)
  3159.       @location.bitmap.font.color = Color.new(255,255,255)
  3160.       @location.bitmap.draw_text(0,0,190,32, location_name.to_s,2)
  3161.   end
  3162.  
  3163.   #--------------------------------------------------------------------------
  3164.   # ● Create Actor Parameter
  3165.   #--------------------------------------------------------------------------              
  3166.   def create_actor_parameter
  3167.       @actor_par = []
  3168.       members_size = $game_party.members.size
  3169.       members_size = $game_party.max_battle_members if members_size >= $game_party.max_battle_members
  3170.       for i in 0...members_size
  3171.           @actor_par.push(Actor_Menu_Parameter.new(i,$game_party.members[i]))
  3172.       end    
  3173.   end
  3174.  
  3175.   #--------------------------------------------------------------------------
  3176.   # ● Create Members
  3177.   #--------------------------------------------------------------------------                
  3178.   def create_members
  3179.       @members_viewport = Viewport.new(MEMBERS_FACE_POSITION[0],MEMBERS_FACE_POSITION[1],400,96)
  3180.       @members_viewport.z = 12
  3181.       @members_viewport.ox = -640
  3182.       @members_slide_max = (MEMBERS_FACE_POSITION[0] - 640)
  3183.       @members = []
  3184.       for i in 0...$game_party.members.size        
  3185.           @members.push(Face_Members_Sprite.new(@members_viewport,i, $game_party.members[i].id))
  3186.       end
  3187.   end
  3188.  
  3189.   #--------------------------------------------------------------------------
  3190.   # ● Create Members Layout
  3191.   #--------------------------------------------------------------------------                  
  3192.   def create_members_layout
  3193.       @members_layout = Members_Arrow_Sprite.new
  3194.   end  
  3195.  
  3196. end
  3197.  
  3198. #==============================================================================
  3199. # ■ Scene_Menu
  3200. #==============================================================================
  3201. class Scene_Menu
  3202.  
  3203.   #--------------------------------------------------------------------------
  3204.   # ● Execute Dispose
  3205.   #--------------------------------------------------------------------------        
  3206.   def execute_dispose
  3207.       Graphics.freeze
  3208.       dispose_background
  3209.       dispose_layout
  3210.       dispose_particles
  3211.       dispose_command_sprites
  3212.       dispose_actor_sprites
  3213.       dispose_actor_parameter
  3214.       dispose_timer_sprite
  3215.       dispose_gold_number
  3216.       dispose_location
  3217.       dispose_members
  3218.   end
  3219.  
  3220.   #--------------------------------------------------------------------------
  3221.   # ● Dispose Background
  3222.   #--------------------------------------------------------------------------  
  3223.   def dispose_background
  3224.       return if @background == nil
  3225.       @background.dispose
  3226.       @background = nil
  3227.   end
  3228.    
  3229.   #--------------------------------------------------------------------------
  3230.   # ● Dispose Layout
  3231.   #--------------------------------------------------------------------------                
  3232.   def dispose_layout
  3233.       return if @layout == nil
  3234.       @layout.dispose
  3235.       @layout = nil
  3236.   end  
  3237.  
  3238.  #--------------------------------------------------------------------------
  3239.  # ● Dispose Particles
  3240.  #--------------------------------------------------------------------------    
  3241.  def dispose_particles
  3242.      return if @particles_sprite == nil
  3243.      @particles_sprite.each {|sprite| sprite.dispose }
  3244.  end
  3245.    
  3246.   #--------------------------------------------------------------------------
  3247.   # ● Dispose Command Sprites
  3248.   #--------------------------------------------------------------------------    
  3249.   def dispose_command_sprites
  3250.       return if @command_sprites == nil
  3251.       @command_sprites.each {|sprite| sprite.dispose_command }
  3252.       @command_sprites = nil
  3253.       @command_window.dispose
  3254.   end  
  3255.  
  3256.   #--------------------------------------------------------------------------
  3257.   # ● Dispose Actor Sprites
  3258.   #--------------------------------------------------------------------------    
  3259.   def dispose_actor_sprites
  3260.       return if @actor_pictures == nil
  3261.       @actor_pictures.each {|sprite| sprite.dispose_picture }
  3262.       @actor_pictures = nil
  3263.   end    
  3264.  
  3265.   #--------------------------------------------------------------------------
  3266.   # ● Dispose timer Sprite
  3267.   #--------------------------------------------------------------------------        
  3268.   def dispose_timer_sprite
  3269.       return if @timer_sprite == nil
  3270.       @timer_sprite.dispose
  3271.   end
  3272.    
  3273.   #--------------------------------------------------------------------------
  3274.   # ● Dispose Gold Number
  3275.   #--------------------------------------------------------------------------          
  3276.   def dispose_gold_number
  3277.       return if @gold_image == nil
  3278.       @gold_sprite.dispose
  3279.       @gold_sprite = nil
  3280.   end
  3281.  
  3282.   #--------------------------------------------------------------------------
  3283.   # ● Dispose Location
  3284.   #--------------------------------------------------------------------------            
  3285.   def dispose_location
  3286.       return if @location == nil
  3287.       @location.bitmap.dispose
  3288.       @location.dispose
  3289.       @location = nil
  3290.   end    
  3291.  
  3292.   #--------------------------------------------------------------------------
  3293.   # ● Dispose Actor Parameter
  3294.   #--------------------------------------------------------------------------                
  3295.   def dispose_actor_parameter
  3296.       return if @actor_par == nil
  3297.       @actor_par.each {|sprite| sprite.dispose }
  3298.       @actor_par = nil
  3299.   end
  3300.  
  3301.   #--------------------------------------------------------------------------
  3302.   # ● Dispose Members
  3303.   #--------------------------------------------------------------------------                  
  3304.   def dispose_members
  3305.       return if @members == nil
  3306.       @members.each {|sprite| sprite.dispose }
  3307.       @members = nil
  3308.       @members_layout.dispose
  3309.       @members_viewport.dispose
  3310.   end  
  3311.    
  3312. end
  3313.  
  3314. #==============================================================================
  3315. # ■ Scene_Menu
  3316. #==============================================================================
  3317. class Scene_Menu
  3318.  
  3319.   #--------------------------------------------------------------------------
  3320.   # ● Update Sprites
  3321.   #--------------------------------------------------------------------------          
  3322.   def update_sprites    
  3323.       update_background
  3324.       update_particles
  3325.       update_command_sprites
  3326.       update_actor_parameter
  3327.       update_actor_sprites
  3328.       update_members_face
  3329.       refresh_timer if @min_old != @min
  3330.       refresh_gold if @gold != $game_party.gold      
  3331.   end
  3332.      
  3333.   #--------------------------------------------------------------------------
  3334.   # ● Update Background
  3335.   #--------------------------------------------------------------------------              
  3336.   def update_background
  3337.       return if @background == nil
  3338.       @background.ox += @background_scroll[0]
  3339.       @background.oy += @background_scroll[1]
  3340.   end    
  3341.  
  3342.   #--------------------------------------------------------------------------
  3343.   # ● Update Particles
  3344.   #--------------------------------------------------------------------------  
  3345.   def update_particles
  3346.       return if @particles_sprite == nil
  3347.       @particles_sprite.each {|sprite| sprite.update }
  3348.   end
  3349.    
  3350.   #--------------------------------------------------------------------------
  3351.   # ● Update Command Sprites
  3352.   #--------------------------------------------------------------------------    
  3353.   def update_command_sprites
  3354.       return if @command_window == nil
  3355.       visible = @phase == 0 ? true : false
  3356.       @command_sprites.each {|sprite| sprite.update_command(@command_window.index,visible) }
  3357.   end    
  3358.  
  3359.   #--------------------------------------------------------------------------
  3360.   # ● Refresh Number
  3361.   #--------------------------------------------------------------------------  
  3362.   def refresh_timer
  3363.       @min_old = @min
  3364.       @timer_sprite.bitmap.clear
  3365.       draw_number(@timer_cw * 1,0,0) if @hour < 10              
  3366.       draw_number(@timer_cw * 2,0,@hour)
  3367.       draw_number(@timer_cw * 4,0,0) if @min < 10            
  3368.       draw_number(@timer_cw * 5,0,@min)
  3369.   end  
  3370.  
  3371.   #--------------------------------------------------------------------------
  3372.   # ● Draw Number
  3373.   #--------------------------------------------------------------------------  
  3374.   def draw_number(x,y,value)
  3375.       @number_text = value.abs.to_s.split(//)
  3376.       plus_x = -@timer_cw * @number_text.size
  3377.       for r in 0..@number_text.size - 1
  3378.          @number_abs = @number_text[r].to_i
  3379.          nsrc_rect = Rect.new(@timer_cw * @number_abs, 0, @timer_cw, @timer_ch)
  3380.          @timer_sprite.bitmap.blt(plus_x + x + (@timer_cw  *  r), y, @timer_image, nsrc_rect)        
  3381.       end    
  3382.   end    
  3383.  
  3384.   #--------------------------------------------------------------------------
  3385.   # ● update
  3386.   #--------------------------------------------------------------------------  
  3387.   def update_timer
  3388.       time = $game_system.playtime
  3389.       @hour = time / 60 / 60
  3390.       @min = time / 60 % 60
  3391.       @sec = time % 60
  3392.   end      
  3393.  
  3394.   #--------------------------------------------------------------------------
  3395.   # ● Refresh Gold
  3396.   #--------------------------------------------------------------------------          
  3397.   def refresh_gold
  3398.       @gold = $game_party.gold
  3399.       @gold_sprite.bitmap.clear
  3400.       value_text = @gold.abs.to_s.split(//)
  3401.       index = 0
  3402.       for i in 0..value_text.size - 1
  3403.           value_abs = value_text[i].to_i
  3404.           nsrc_rect = Rect.new(@gold_cw * value_abs, 0, @gold_cw, @gold_ch)
  3405.           @gold_sprite.bitmap.blt(@gold_cw *  i, 0, @gold_image, nsrc_rect)
  3406.           index += 1
  3407.       end
  3408.       ey = (index * @gold_cw)  
  3409.       @gold_sprite.x = GOLD_NUMBER_POS[0] -  ey
  3410.   end
  3411.  
  3412.   #--------------------------------------------------------------------------
  3413.   # ● Update Actor Parameter
  3414.   #--------------------------------------------------------------------------                
  3415.   def update_actor_parameter
  3416.       return if @actor_par == nil
  3417.       @actor_par.each {|sprite| sprite.update }
  3418.   end
  3419.    
  3420.   #--------------------------------------------------------------------------
  3421.   # ● Update Actor Sprites
  3422.   #--------------------------------------------------------------------------    
  3423.   def update_actor_sprites
  3424.       return if @actor_pictures == nil
  3425.       @actor_pictures.each {|sprite| sprite.update_picture }
  3426.   end    
  3427.  
  3428.   #--------------------------------------------------------------------------
  3429.   # ● Update Members Face
  3430.   #--------------------------------------------------------------------------                  
  3431.   def update_members_face
  3432.       return if @members == nil or @members == 0
  3433.       if @members_index > 4
  3434.          ny = (5 * 64)
  3435.          else
  3436.          ny = 64 * @members_index
  3437.       end
  3438.       @members.each {|sprite| sprite.update_command(@members_index, ny) }
  3439.       @members_layout.update
  3440.       if @members_windows_active
  3441.          if @members_viewport.ox < 0
  3442.             @members_viewport.ox += 25
  3443.          end
  3444.        else    
  3445.          if @members_viewport.ox > -640
  3446.             @members_viewport.ox -= 25
  3447.           end          
  3448.       end
  3449.       @members_layout.nx(@members_viewport.ox)
  3450.   end  
  3451.  
  3452. end
  3453.  
  3454. #==============================================================================
  3455. # ■ Scene_Menu
  3456. #==============================================================================
  3457. class Scene_Menu
  3458.  
  3459.   #--------------------------------------------------------------------------
  3460.   # ● Update
  3461.   #--------------------------------------------------------------------------      
  3462.   def update
  3463.       update_timer
  3464.       update_sprites
  3465.       update_command
  3466.       @members_windows_active = @phase == 100 ? true : false
  3467.   end
  3468.    
  3469. end
  3470.  
  3471. #==============================================================================
  3472. # ■ Scene_Menu
  3473. #==============================================================================
  3474. class Scene_Menu
  3475.  
  3476.   #--------------------------------------------------------------------------
  3477.   # ● Update Command
  3478.   #--------------------------------------------------------------------------      
  3479.   def update_command
  3480.       case @phase
  3481.         when 0;       update_main_command
  3482.         when 100;      update_select_members            
  3483.      end    
  3484.   end
  3485.    
  3486.   #--------------------------------------------------------------------------
  3487.   # ● Update Main Command
  3488.   #--------------------------------------------------------------------------        
  3489.   def update_main_command
  3490.       if Input.trigger?(:UP) or Input.trigger?(:LEFT)
  3491.          move_command_index(-1)
  3492.       elsif Input.trigger?(:DOWN) or Input.trigger?(:RIGHT)
  3493.          move_command_index(1)
  3494.       elsif Input.trigger?(:C)
  3495.          execute_select
  3496.       elsif Input.trigger?(:B)
  3497.          return_to_map
  3498.       end  
  3499.   end
  3500.    
  3501.   #--------------------------------------------------------------------------
  3502.   # ● Update Main Command
  3503.   #--------------------------------------------------------------------------  
  3504.   def move_command_index(value)
  3505.       Sound.play_cursor
  3506.       @command_window.index += value
  3507.       @command_window.index = 0 if @command_window.index >= @command_max
  3508.       @command_window.index = (@command_max - 1) if @command_window.index < 0
  3509.   end    
  3510.  
  3511.   #--------------------------------------------------------------------------
  3512.   # ● Execute Select
  3513.   #--------------------------------------------------------------------------    
  3514.   def execute_select
  3515.       @phase = @command_window.index
  3516.       $game_temp.menu_index = @phase
  3517.       Sound.play_ok
  3518.       $game_temp.pre_symbol = @command_window.current_symbol
  3519.       @command_window.call_handler(@command_window.current_symbol)
  3520.   end
  3521.  
  3522.   #--------------------------------------------------------------------------
  3523.   # ● Update Select Members
  3524.   #--------------------------------------------------------------------------        
  3525.   def update_select_members  
  3526.       if $game_party.members.size == 0
  3527.          execute_cancel
  3528.          return
  3529.       end  
  3530.       if Input.trigger?(:LEFT)
  3531.          move_members_index(-1)
  3532.       elsif Input.trigger?(:RIGHT)
  3533.          move_members_index(1)
  3534.       elsif Input.trigger?(:C)
  3535.          execute_select_members
  3536.       elsif Input.trigger?(:B)
  3537.          execute_cancel
  3538.       end    
  3539.   end  
  3540.    
  3541.   #--------------------------------------------------------------------------
  3542.   # ● Execute Cancel
  3543.   #--------------------------------------------------------------------------          
  3544.   def execute_cancel
  3545.       Sound.play_cancel
  3546.       @phase = 0
  3547.       @members_index = 0
  3548.   end
  3549.      
  3550.   #--------------------------------------------------------------------------
  3551.   # ● Move Members Index
  3552.   #--------------------------------------------------------------------------          
  3553.   def move_members_index(value)
  3554.       Sound.play_cursor
  3555.       @members_index += value
  3556.       @members_index = 0 if @members_index >= $game_party.members.size
  3557.       @members_index = ($game_party.members.size - 1) if @members_index < 0
  3558.   end
  3559.  
  3560.   #--------------------------------------------------------------------------
  3561.   # ● Command Formation
  3562.   #--------------------------------------------------------------------------
  3563.   def command_formation
  3564.       SceneManager.call(Scene_Party)
  3565.   end  
  3566.  
  3567.   #--------------------------------------------------------------------------
  3568.   # ● Can Access Scene
  3569.   #--------------------------------------------------------------------------              
  3570.   def can_access_scene?
  3571.       if $game_party.members.size == 0
  3572.          #Sound.play_buzzer    
  3573.          execute_cancel
  3574.          return false
  3575.       end  
  3576.       return true
  3577.   end
  3578.  
  3579.   #--------------------------------------------------------------------------
  3580.   # ● Execute Select Members
  3581.   #--------------------------------------------------------------------------    
  3582.   def execute_select_members
  3583.       @phase = @command_window.index
  3584.       $game_temp.menu_index = @phase
  3585.       Sound.play_ok
  3586.       on_personal_ok
  3587.   end  
  3588.  
  3589.   #--------------------------------------------------------------------------
  3590.   # ● ON Personal OK
  3591.   #--------------------------------------------------------------------------            
  3592.   alias mog_monogatari_on_personal_ok on_personal_ok
  3593.   def on_personal_ok
  3594.       $game_temp.actor_menu_temp =  $game_party.members[@members_index]
  3595.       $game_party.menu_actor = $game_party.members[@members_index]
  3596.       mog_monogatari_on_personal_ok
  3597.   end    
  3598.  
  3599.   #--------------------------------------------------------------------------
  3600.   # ● Return To Map
  3601.   #--------------------------------------------------------------------------              
  3602.   def return_to_map
  3603.       $game_temp.menu_index = 0
  3604.       Sound.play_cancel
  3605.       SceneManager.return
  3606.   end  
  3607.  
  3608.   #--------------------------------------------------------------------------
  3609.   # ● Command Personal
  3610.   #--------------------------------------------------------------------------
  3611.   def command_personal
  3612.       @phase = 100
  3613.   end
  3614.  
  3615. end
  3616.  
  3617. #==============================================================================
  3618. # ■ Game_Temp
  3619. #==============================================================================
  3620. class Game_Temp
  3621.  
  3622.   #--------------------------------------------------------------------------
  3623.   # ● Execute Pre Cache Item Menu
  3624.   #--------------------------------------------------------------------------    
  3625.   def execute_pre_cache_item_menu
  3626.       @pre_cache_item_menu = []
  3627.       @pre_cache_item_menu.push(Cache.menu_item("Background"))
  3628.       @pre_cache_item_menu.push(Cache.menu_item("LayoutITEM"))
  3629.   end    
  3630.    
  3631. end
  3632.  
  3633. #==============================================================================
  3634. # ■ Scene_Menu
  3635. #==============================================================================
  3636. class Scene_Item
  3637.   include MOG_MENU_ITEM
  3638.   include MOG_MENU_BASE
  3639.  
  3640.   #--------------------------------------------------------------------------
  3641.   # ● Main
  3642.   #--------------------------------------------------------------------------        
  3643.   def main
  3644.       execute_setup
  3645.       execute_loop
  3646.       execute_dispose
  3647.   end  
  3648.  
  3649.   #--------------------------------------------------------------------------
  3650.   # ● Execute Setup
  3651.   #--------------------------------------------------------------------------        
  3652.   def execute_setup
  3653.       @phase = 0
  3654.       @command_index = 0
  3655.       @actor = $game_party.members[0]
  3656.       @wait_time = 0
  3657.       create_sprites
  3658.   end
  3659.  
  3660.   #--------------------------------------------------------------------------
  3661.   # ● Execute Lopp
  3662.   #--------------------------------------------------------------------------        
  3663.   def execute_loop
  3664.       Graphics.transition(10)
  3665.       loop do
  3666.          Input.update
  3667.          update
  3668.          Graphics.update
  3669.          break if SceneManager.scene != self
  3670.       end
  3671.   end  
  3672.  
  3673. end
  3674.  
  3675. #==============================================================================
  3676. # ■ Window_ItemList Z
  3677. #==============================================================================
  3678. class Window_ItemList_Z < Window_Selectable
  3679.  
  3680.   #--------------------------------------------------------------------------
  3681.   # ● Initialize
  3682.   #--------------------------------------------------------------------------
  3683.   def initialize(x, y, width, height)
  3684.       super
  3685.       @category = :none
  3686.       @data = []
  3687.   end
  3688.  
  3689.   #--------------------------------------------------------------------------
  3690.   # ● Category
  3691.   #--------------------------------------------------------------------------
  3692.   def category=(category)
  3693.       return if @category == category
  3694.       @category = category
  3695.       self.oy = 0
  3696.   end
  3697.  
  3698.   #--------------------------------------------------------------------------
  3699.   # ● Col Max
  3700.   #--------------------------------------------------------------------------
  3701.   def col_max
  3702.       return 1
  3703.   end
  3704.   #--------------------------------------------------------------------------
  3705.   # ● Item Max
  3706.   #--------------------------------------------------------------------------
  3707.   def item_max
  3708.       @data ? @data.size : 1
  3709.   end
  3710.   #--------------------------------------------------------------------------
  3711.   # ● Item
  3712.   #--------------------------------------------------------------------------
  3713.   def item
  3714.       @data && index >= 0 ? @data[index] : nil
  3715.   end
  3716.  
  3717.   #--------------------------------------------------------------------------
  3718.   # ● Current Item Enabled?
  3719.   #--------------------------------------------------------------------------
  3720.   def current_item_enabled?
  3721.       enable?(@data[index])
  3722.   end
  3723.  
  3724.   #--------------------------------------------------------------------------
  3725.   # ● Include?
  3726.   #--------------------------------------------------------------------------
  3727.   def include?(item)
  3728.       case @category
  3729.       when :item
  3730.            item.is_a?(RPG::Item) && !item.key_item?
  3731.       when :weapon
  3732.            item.is_a?(RPG::Weapon)
  3733.       when :armor
  3734.            item.is_a?(RPG::Armor)
  3735.       when :key_item
  3736.            item.is_a?(RPG::Item) && item.key_item?
  3737.       else
  3738.            false
  3739.       end
  3740.   end
  3741.  
  3742.   #--------------------------------------------------------------------------
  3743.   # ● Enable?
  3744.   #--------------------------------------------------------------------------
  3745.   def enable?(item)
  3746.       $game_party.usable?(item)
  3747.   end
  3748.  
  3749.   #--------------------------------------------------------------------------
  3750.   # ● Make Item List
  3751.   #--------------------------------------------------------------------------
  3752.   def make_item_list
  3753.       @data = $game_party.all_items.select {|item| include?(item) }
  3754.       @data.push(nil) if include?(nil)
  3755.   end
  3756.  
  3757.   #--------------------------------------------------------------------------
  3758.   # ● Select Last
  3759.   #--------------------------------------------------------------------------
  3760.   def select_last
  3761.       select(@data.index($game_party.last_item.object) || 0)
  3762.   end
  3763.  
  3764.   #--------------------------------------------------------------------------
  3765.   # ● Draw Item
  3766.   #--------------------------------------------------------------------------
  3767.   def draw_item(index)
  3768.       item = @data[index]
  3769.       if item
  3770.          rect = item_rect(index)
  3771.          rect.width -= 4
  3772.          draw_item_name(item, rect.x, rect.y, enable?(item))
  3773.          draw_item_number(rect, item)
  3774.       end
  3775.   end
  3776.  
  3777.   #--------------------------------------------------------------------------
  3778.   # ● Draw Item Number
  3779.   #--------------------------------------------------------------------------
  3780.   def draw_item_number(rect, item)
  3781.       draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
  3782.   end
  3783.  
  3784.   #--------------------------------------------------------------------------
  3785.   # ● Update Help
  3786.   #--------------------------------------------------------------------------
  3787.   def update_help
  3788.       @help_window.set_item(item)
  3789.   end
  3790.  
  3791.   #--------------------------------------------------------------------------
  3792.   # ● Refresh
  3793.   #--------------------------------------------------------------------------
  3794.   def refresh
  3795.       make_item_list
  3796.       create_contents
  3797.       draw_all_items
  3798.   end
  3799.    
  3800. end
  3801.  
  3802. #==============================================================================
  3803. # ■ Window_ItemList Z
  3804. #==============================================================================
  3805. class Window_ItemList_Item_1 < Window_Selectable
  3806.  
  3807.   #--------------------------------------------------------------------------
  3808.   # ● Initialize
  3809.   #--------------------------------------------------------------------------
  3810.   def initialize(x, y, width, height)
  3811.       super
  3812.       @category = :none
  3813.       @data = []
  3814.   end
  3815.  
  3816.   #--------------------------------------------------------------------------
  3817.   # ● Category
  3818.   #--------------------------------------------------------------------------
  3819.   def category=(category)
  3820.       return if @category == category
  3821.       @category = category
  3822.       self.oy = 0
  3823.   end
  3824.  
  3825.   #--------------------------------------------------------------------------
  3826.   # ● Col Max
  3827.   #--------------------------------------------------------------------------
  3828.   def col_max
  3829.       return 1
  3830.   end
  3831.   #--------------------------------------------------------------------------
  3832.   # ● Item Max
  3833.   #--------------------------------------------------------------------------
  3834.   def item_max
  3835.       @data ? @data.size : 1
  3836.   end
  3837.   #--------------------------------------------------------------------------
  3838.   # ● Item
  3839.   #--------------------------------------------------------------------------
  3840.   def item
  3841.       @data && index >= 0 ? @data[index] : nil
  3842.   end
  3843.  
  3844.   #--------------------------------------------------------------------------
  3845.   # ● Current Item Enabled?
  3846.   #--------------------------------------------------------------------------
  3847.   def current_item_enabled?
  3848.       enable?(@data[index])
  3849.   end
  3850.  
  3851.   #--------------------------------------------------------------------------
  3852.   # ● Include?
  3853.   #--------------------------------------------------------------------------
  3854.   def include?(item)
  3855.       case @category
  3856.       when :item   ;   item.is_a?(RPG::Item) && !item.key_item?
  3857.       else
  3858.            false
  3859.       end
  3860.   end
  3861.  
  3862.   #--------------------------------------------------------------------------
  3863.   # ● Enable?
  3864.   #--------------------------------------------------------------------------
  3865.   def enable?(item)
  3866.       $game_party.usable?(item)
  3867.   end
  3868.  
  3869.   #--------------------------------------------------------------------------
  3870.   # ● Make Item List
  3871.   #--------------------------------------------------------------------------
  3872.   def make_item_list
  3873.       @data = $game_party.all_items.select {|item| include?(item) }
  3874.       @data.push(nil) if include?(nil)
  3875.   end
  3876.  
  3877.   #--------------------------------------------------------------------------
  3878.   # ● Select Last
  3879.   #--------------------------------------------------------------------------
  3880.   def select_last
  3881.       select(@data.index($game_party.last_item.object) || 0)
  3882.   end
  3883.  
  3884.   #--------------------------------------------------------------------------
  3885.   # ● Draw Item
  3886.   #--------------------------------------------------------------------------
  3887.   def draw_item(index)
  3888.       item = @data[index]
  3889.       if item
  3890.          rect = item_rect(index)
  3891.          rect.width -= 4
  3892.          draw_item_number(rect, item)
  3893.       end
  3894.   end
  3895.  
  3896.   #--------------------------------------------------------------------------
  3897.   # ● Draw Item Number
  3898.   #--------------------------------------------------------------------------
  3899.   def draw_item_number(rect, item)
  3900.       draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
  3901.   end  
  3902.    
  3903.   #--------------------------------------------------------------------------
  3904.   # ● Update Help
  3905.   #--------------------------------------------------------------------------
  3906.   def update_help
  3907.       @help_window.set_item(item)
  3908.   end
  3909.  
  3910.   #--------------------------------------------------------------------------
  3911.   # ● Refresh
  3912.   #--------------------------------------------------------------------------
  3913.   def refresh
  3914.       make_item_list
  3915.       create_contents
  3916.       draw_all_items
  3917.    end
  3918.    
  3919. end
  3920.  
  3921. #==============================================================================
  3922. # ■ Window_ItemList Z
  3923. #==============================================================================
  3924. class Window_ItemList_Item_2 < Window_Selectable
  3925.  
  3926.   #--------------------------------------------------------------------------
  3927.   # ● Initialize
  3928.   #--------------------------------------------------------------------------
  3929.   def initialize(x, y, width, height)
  3930.       super
  3931.       @category = :none
  3932.       @data = []
  3933.   end
  3934.  
  3935.   #--------------------------------------------------------------------------
  3936.   # ● Category
  3937.   #--------------------------------------------------------------------------
  3938.   def category=(category)
  3939.       return if @category == category
  3940.       @category = category
  3941.       self.oy = 0
  3942.   end
  3943.  
  3944.   #--------------------------------------------------------------------------
  3945.   # ● Col Max
  3946.   #--------------------------------------------------------------------------
  3947.   def col_max
  3948.       return 1
  3949.   end
  3950.   #--------------------------------------------------------------------------
  3951.   # ● Item Max
  3952.   #--------------------------------------------------------------------------
  3953.   def item_max
  3954.       @data ? @data.size : 1
  3955.   end
  3956.   #--------------------------------------------------------------------------
  3957.   # ● Item
  3958.   #--------------------------------------------------------------------------
  3959.   def item
  3960.       @data && index >= 0 ? @data[index] : nil
  3961.   end
  3962.  
  3963.   #--------------------------------------------------------------------------
  3964.   # ● Current Item Enabled?
  3965.   #--------------------------------------------------------------------------
  3966.   def current_item_enabled?
  3967.       enable?(@data[index])
  3968.   end
  3969.  
  3970.   #--------------------------------------------------------------------------
  3971.   # ● Include?
  3972.   #--------------------------------------------------------------------------
  3973.   def include?(item)
  3974.       case @category
  3975.       when :item   ;   item.is_a?(RPG::Item) && !item.key_item?
  3976.       else
  3977.            false
  3978.       end
  3979.   end
  3980.  
  3981.   #--------------------------------------------------------------------------
  3982.   # ● Enable?
  3983.   #--------------------------------------------------------------------------
  3984.   def enable?(item)
  3985.       $game_party.usable?(item)
  3986.   end
  3987.  
  3988.   #--------------------------------------------------------------------------
  3989.   # ● Make Item List
  3990.   #--------------------------------------------------------------------------
  3991.   def make_item_list
  3992.       @data = $game_party.all_items.select {|item| include?(item) }
  3993.       @data.push(nil) if include?(nil)
  3994.   end
  3995.  
  3996.   #--------------------------------------------------------------------------
  3997.   # ● Select Last
  3998.   #--------------------------------------------------------------------------
  3999.   def select_last
  4000.       select(@data.index($game_party.last_item.object) || 0)
  4001.   end
  4002.  
  4003.   #--------------------------------------------------------------------------
  4004.   # ● Draw Item
  4005.   #--------------------------------------------------------------------------
  4006.   def draw_item(index)
  4007.       item = @data[index]
  4008.       if item
  4009.          rect = item_rect(index)
  4010.          rect.width -= 4
  4011.          draw_item_name(item, rect.x, rect.y, enable?(item))
  4012.         # draw_item_number(rect, item)
  4013.       end
  4014.   end
  4015.  
  4016.   #--------------------------------------------------------------------------
  4017.   # ● Draw Item Number
  4018.   #--------------------------------------------------------------------------
  4019.   def draw_item_number(rect, item)
  4020.       draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
  4021.   end
  4022.  
  4023.   #--------------------------------------------------------------------------
  4024.   # ● Update Help
  4025.   #--------------------------------------------------------------------------
  4026.   def update_help      
  4027.   end
  4028.  
  4029.   #--------------------------------------------------------------------------
  4030.   # ● Refresh
  4031.   #--------------------------------------------------------------------------
  4032.   def refresh
  4033.       make_item_list
  4034.       create_contents
  4035.       draw_all_items
  4036.   end
  4037.    
  4038. end
  4039.  
  4040. #==============================================================================
  4041. # ■ Scene_Item
  4042. #==============================================================================
  4043. class Scene_Item
  4044.  
  4045.   #--------------------------------------------------------------------------
  4046.   # ● Create Sprites
  4047.   #--------------------------------------------------------------------------          
  4048.   def create_sprites
  4049.       create_menu_background
  4050.       create_layout
  4051.       create_particles
  4052.       create_command
  4053.       create_button
  4054.       create_help_window
  4055.       create_item_window
  4056.       create_weapon_window
  4057.       create_armor_window
  4058.       create_key_window
  4059.       create_actor_window
  4060.       set_initial_visible
  4061.   end
  4062.    
  4063.   #--------------------------------------------------------------------------
  4064.   # ● Create Actor Window
  4065.   #--------------------------------------------------------------------------
  4066.   def create_actor_window
  4067.       @actor_window = Members_Windows_Status.new
  4068.       @actor_window.set_handler(:ok,     method(:on_actor_ok))
  4069.       @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  4070.       @actor_window.opacity = 0    
  4071.       @actor_window.x = -10
  4072.       @actor_window.y = 36
  4073. #~       @actor_window.z = 600
  4074.       @actor_window_slide_range = [@actor_window.x, -@actor_window.width]
  4075.       @actor_window.x = @actor_window_slide_range[1]
  4076.       @actor_window.visible = true
  4077.       @actor_window_index_old = @actor_window.index
  4078.       create_members_window
  4079.       create_actor_status
  4080.       update_active_window
  4081.       update_command_sprites
  4082.   end
  4083.  
  4084.   #--------------------------------------------------------------------------
  4085.   # ● Create Members Window
  4086.   #--------------------------------------------------------------------------  
  4087.   def create_members_window
  4088.       index = 0
  4089.       @members_status = []      
  4090.       for actor in $game_party.members
  4091.           @members_status.push(Members_Menu.new(actor,index))
  4092.           index += 1
  4093.       end    
  4094.   end
  4095.    
  4096.   #--------------------------------------------------------------------------
  4097.   # ● Create Actor Status
  4098.   #--------------------------------------------------------------------------  
  4099.   def create_actor_status
  4100.     @actor_status = Actor_Menu_Status.new(@actor)
  4101.   end  
  4102.    
  4103.   #--------------------------------------------------------------------------
  4104.   # ● Create Item Window
  4105.   #--------------------------------------------------------------------------
  4106.   def create_item_window
  4107.       @item_window = Window_ItemList_Item_1.new(162,92,225,240)  
  4108.       @item_window.help_window = @help_window
  4109.       @item_window.set_handler(:ok,     method(:on_item_ok))
  4110.       @item_window.set_handler(:cancel, method(:on_item_cancel))
  4111.       @item_window.category = :item
  4112.       @item_window.active = true
  4113.       @item_window.refresh
  4114.       @item_window.index = 0
  4115.       @item_window.opacity = 0
  4116.       @item_window_2 = Window_ItemList_Item_2.new(162,92,225,240)  
  4117.       @item_window_2.help_window = @help_window
  4118.       @item_window_2.set_handler(:ok,     method(:on_item_ok))
  4119.       @item_window_2.set_handler(:cancel, method(:on_item_cancel))
  4120.       @item_window_2.category = :item
  4121.       @item_window_2.active = true
  4122.       @item_window_2.refresh
  4123.       @item_window_2.index = 0
  4124.       @item_window_2.opacity = 0
  4125.   end  
  4126.  
  4127.   #--------------------------------------------------------------------------
  4128.   # ● Create Weapon Window
  4129.   #--------------------------------------------------------------------------
  4130.   def create_weapon_window
  4131.       @weapon_window = Window_ItemList_Z.new(162,92,225,240)  
  4132.       @weapon_window.help_window = @help_window
  4133.       @weapon_window.set_handler(:ok,     method(:on_item_ok))
  4134.       @weapon_window.set_handler(:cancel, method(:on_item_cancel))
  4135.       @weapon_window.category = :weapon
  4136.       @weapon_window.active = true
  4137.       @weapon_window.refresh
  4138.       @weapon_window.index = 0
  4139.       @weapon_window.opacity = 0
  4140.   end  
  4141.  
  4142.   #--------------------------------------------------------------------------
  4143.   # ● Create Armor Window
  4144.   #--------------------------------------------------------------------------
  4145.   def create_armor_window
  4146.       @armor_window = Window_ItemList_Z.new(162,92,225,240)  
  4147.       @armor_window.help_window = @help_window
  4148.       @armor_window.set_handler(:ok,     method(:on_item_ok))
  4149.       @armor_window.set_handler(:cancel, method(:on_item_cancel))
  4150.       @armor_window.category = :armor
  4151.       @armor_window.active = true
  4152.       @armor_window.refresh
  4153.       @armor_window.index = 0
  4154.       @armor_window.opacity = 0
  4155.   end    
  4156.  
  4157.   #--------------------------------------------------------------------------
  4158.   # ● Create Key Window
  4159.   #--------------------------------------------------------------------------
  4160.   def create_key_window
  4161.       @key_window = Window_ItemList_Z.new(162,92,225,240)  
  4162.       @key_window.help_window = @help_window
  4163.       @key_window.set_handler(:ok,     method(:on_item_ok))
  4164.       @key_window.set_handler(:cancel, method(:on_item_cancel))
  4165.       @key_window.category = :key_item
  4166.       @key_window.active = true
  4167.       @key_window.refresh
  4168.       @key_window.index = 0
  4169.       @key_window.opacity = 0
  4170.   end    
  4171.  
  4172.   #--------------------------------------------------------------------------
  4173.   # ● Create Help Window
  4174.   #--------------------------------------------------------------------------              
  4175.   def create_help_window
  4176.       @help_window = Window_Help.new
  4177.       @help_window.x = 0
  4178.       @help_window.y = Graphics.height - @help_window.height
  4179.       @help_window.opacity = 0
  4180.   end  
  4181.  
  4182.   #--------------------------------------------------------------------------
  4183.   # ● Create Menu Background
  4184.   #--------------------------------------------------------------------------            
  4185.   def create_menu_background
  4186.       @background = Plane.new
  4187.       @background.bitmap = $game_temp.pre_cache_item_menu[0]
  4188.       @background.z = 0
  4189.       @background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
  4190.   end  
  4191.  
  4192.   #--------------------------------------------------------------------------
  4193.   # ● Create Layout
  4194.   #--------------------------------------------------------------------------              
  4195.   def create_layout
  4196.       @layout = Sprite.new
  4197.       @layout.bitmap = $game_temp.pre_cache_item_menu[1]
  4198.       @layout.z = 3
  4199.   end
  4200.  
  4201.   #--------------------------------------------------------------------------
  4202.   # ● Create Particles
  4203.   #--------------------------------------------------------------------------  
  4204.   def create_particles
  4205.       @particles_sprite =[]
  4206.       for i in 0...NUMBER_OF_PARTICLES
  4207.           @particles_sprite.push(Particles_Menu.new(nil))
  4208.       end
  4209.   end
  4210.  
  4211.   #--------------------------------------------------------------------------
  4212.   # ● Create Command
  4213.   #--------------------------------------------------------------------------  
  4214.   def create_command
  4215.       @command_sprites = []
  4216.       index = 0      
  4217.       for i in 0...4
  4218.           @command_sprites.push(Layout_Window_Sprite.new(nil, index) )
  4219.           index += 1
  4220.       end
  4221.   end    
  4222.  
  4223.   #--------------------------------------------------------------------------
  4224.   # ● Create Button
  4225.   #--------------------------------------------------------------------------  
  4226.   def create_button
  4227.       @button_sprites = []
  4228.       index = 0      
  4229.       for i in 0...4
  4230.           @button_sprites.push(Item_Button_Sprite.new(nil, index) )
  4231.           index += 1
  4232.       end
  4233.   end      
  4234.  
  4235.   #--------------------------------------------------------------------------
  4236.   # ● Set Initial Visible
  4237.   #--------------------------------------------------------------------------            
  4238.   def set_initial_visible
  4239.       @item_window.visible = false
  4240.       @item_window_2.visible = false
  4241.       @weapon_window.visible = false
  4242.       @armor_window.visible = false
  4243.       @key_window.visible = false  
  4244.   end  
  4245.  
  4246. end
  4247.  
  4248. #==============================================================================
  4249. # ■ Layout Window Sprite
  4250. #==============================================================================
  4251. class Layout_Window_Sprite < Sprite
  4252.   include MOG_MENU_ITEM
  4253.   attr_accessor :index
  4254.   attr_accessor :position
  4255.  
  4256.  #--------------------------------------------------------------------------
  4257.  # ● Initialize
  4258.  #--------------------------------------------------------------------------                  
  4259.   def initialize(viewport = nil,index)
  4260.       super(viewport)
  4261.       @index = index
  4262.       self.bitmap = Cache.menu_item("Item_Window" + @index.to_s)
  4263.       self.z = 10
  4264.       @org_pos = [COMMAND_POSITION[0],COMMAND_POSITION[1]]
  4265.       @slide_max = @org_pos[0] + 24
  4266.       @center = (900 - self.bitmap.width) - (900 / 2) + (self.bitmap.width / 2)
  4267.       @left = -self.bitmap.width
  4268.       @right = 900
  4269.       @position = 0
  4270.       @direction = 0
  4271.       @org_pos = [@left ,COMMAND_POSITION[1]]
  4272.       self.x = @org_pos[0]
  4273.       self.y = @org_pos[1]
  4274.       self.visible = false if @index > 0
  4275.   end  
  4276.  
  4277.  #--------------------------------------------------------------------------
  4278.  # ● Dispose
  4279.  #--------------------------------------------------------------------------                    
  4280.   def dispose_sprite
  4281.       self.bitmap.dispose
  4282.   end  
  4283.  
  4284.  #--------------------------------------------------------------------------
  4285.  # ● Update
  4286.  #--------------------------------------------------------------------------                    
  4287.   def update_command(index)
  4288.       slide_speed = 30
  4289.       if @index == index
  4290.          if self.x < @center
  4291.             self.x += slide_speed
  4292.             self.x = @center if self.x >= @center
  4293.          elsif self.x > @center
  4294.             self.x -= slide_speed
  4295.             self.x = @center if self.x <= @center
  4296.          end
  4297.        else    
  4298.           if @direction == -1
  4299.              self.x -= slide_speed if self.x > @left
  4300.           else
  4301.              self.x += slide_speed if self.x < @right
  4302.           end  
  4303.       end  
  4304.   end  
  4305.  
  4306.  #--------------------------------------------------------------------------
  4307.  # ● New P
  4308.  #--------------------------------------------------------------------------  
  4309.   def newp(index,direction)
  4310.       now_command = index
  4311.       if direction == -1
  4312.          pre_command = index + 1
  4313.          pre_command = 0 if pre_command > 3
  4314.       else    
  4315.          pre_command = index - 1
  4316.          pre_command = 3 if pre_command < 0
  4317.         end
  4318.       if index == @index
  4319.          self.visible = true
  4320.          self.x = @right if direction == -1
  4321.          self.x = @left if direction == 1
  4322.       elsif pre_command ==  @index
  4323.          self.visible = true
  4324.       else  
  4325.          self.visible = false
  4326.       end  
  4327.       @direction = direction
  4328.   end
  4329.  
  4330. end
  4331.  
  4332. #==============================================================================
  4333. # ■ Item Button Sprite
  4334. #==============================================================================
  4335. class Item_Button_Sprite < Sprite
  4336.   include MOG_MENU_ITEM
  4337.   attr_accessor :index
  4338.  
  4339.  #--------------------------------------------------------------------------
  4340.  # ● Initialize
  4341.  #--------------------------------------------------------------------------                  
  4342.   def initialize(viewport = nil,index)
  4343.       super(viewport)
  4344.       @index = index
  4345.       self.bitmap = Cache.menu_item("Button" + @index.to_s)
  4346.       self.z = 12
  4347.       self.ox = self.bitmap.width / 2
  4348.       self.oy = self.bitmap.height / 2
  4349.       @org_pos = [(BUTTON_SPACE * @index) + BUTTON_POSITION[0],BUTTON_POSITION[1]]
  4350.       @slide_max = @org_pos[1] + 24
  4351.       @next_pos = [@org_pos[0],@org_pos[1]]
  4352.       self.x = @org_pos[0] - 15
  4353.       self.y = @org_pos[1] - 128
  4354.       @zoom_duration = [0,0,false]
  4355.       @active = false
  4356.   end  
  4357.  
  4358.  #--------------------------------------------------------------------------
  4359.  # ● Dispose
  4360.  #--------------------------------------------------------------------------                    
  4361.   def dispose_sprite
  4362.       self.bitmap.dispose
  4363.   end  
  4364.  
  4365.  #--------------------------------------------------------------------------
  4366.  # ● Update
  4367.  #--------------------------------------------------------------------------                    
  4368.   def update_command(index)
  4369.       if @index == index
  4370.         # self.y += 2
  4371.         # self.y = @slide_max if self.y > @slide_max
  4372.          @next_pos[1] =@slide_max / 5
  4373.          self.opacity += 15
  4374.          @active = true
  4375.       else
  4376.         # self.y -= 2
  4377.         # self.y = @org_pos[1] if self.y < @org_pos[1]
  4378.          @next_pos[1] = @org_pos[1] / 5
  4379.         self.opacity -= 15 if self.opacity > 255
  4380.          @active = false
  4381.       end
  4382.       update_slide(1,self.y,@next_pos[1])
  4383.       update_zoom
  4384.   end  
  4385.  
  4386.  
  4387.  #--------------------------------------------------------------------------
  4388.  # ● Update Slide
  4389.  #--------------------------------------------------------------------------                      
  4390.   def update_slide(type,cp,np)
  4391.       sp = 2 + ((cp - np).abs / 1)
  4392.       if cp > np
  4393.          cp -= sp
  4394.          cp = np if cp < np
  4395.       elsif cp < np
  4396.          cp += sp
  4397.          cp = np if cp > np
  4398.       end    
  4399.       self.x = cp if type == 0
  4400.       self.y = cp if type == 1
  4401.   end  
  4402.  
  4403.  #--------------------------------------------------------------------------
  4404.  # ● Update Zoom
  4405.  #--------------------------------------------------------------------------                      
  4406.   def update_zoom
  4407.       if @active
  4408.          if !@zoom_duration[2]
  4409.             update_zoom_in
  4410.             @zoom_duration = [0,0,true] if self.zoom_x == 1.00  
  4411.          else  
  4412.             update_zoom_effect
  4413.          end
  4414.       else
  4415.          @zoom_duration[2] = false  
  4416.          update_zoom_in
  4417.       end  
  4418.   end    
  4419.  
  4420.  #--------------------------------------------------------------------------
  4421.  # ● Update Zoom Out
  4422.  #--------------------------------------------------------------------------                        
  4423.   def update_zoom_out
  4424.       return if self.zoom_x == 1.00
  4425.       self.zoom_x += 0.03
  4426.       self.zoom_y += 0.03
  4427.       if self.zoom_x >= 1.00
  4428.             self.zoom_x = 1.00
  4429.             self.zoom_y = 1.00
  4430.       end  
  4431.    end  
  4432.  
  4433.  #--------------------------------------------------------------------------
  4434.  # ● Update Zoom In
  4435.  #--------------------------------------------------------------------------                            
  4436.   def update_zoom_in
  4437.       return if self.zoom_x == 1.00
  4438.       self.zoom_x -= 0.03
  4439.       self.zoom_y -= 0.03
  4440.       if self.zoom_x <= 1.00
  4441.          self.zoom_x = 1.00
  4442.          self.zoom_y = 1.00
  4443.       end  
  4444.   end      
  4445.          
  4446.  #--------------------------------------------------------------------------
  4447.  # ● Update Zoom_effect
  4448.  #--------------------------------------------------------------------------                        
  4449.  def update_zoom_effect
  4450.      @zoom_duration[0] += 1
  4451.      return if @zoom_duration[0] < 1
  4452.      @zoom_duration[0] = 0
  4453.      @zoom_duration[1] += 1
  4454.      case @zoom_duration[1]
  4455.           when 1..30
  4456.              self.zoom_x += 0
  4457.              self.zoom_y += 0              
  4458.           when 31..60
  4459.              self.zoom_x -= 0
  4460.              self.zoom_y -= 0          
  4461.           when 61..999  
  4462.           @zoom_duration[1] = 0
  4463.           self.zoom_x = 1.00
  4464.           self.zoom_y = 1.00
  4465.      end
  4466.  end      
  4467.  
  4468. end
  4469.  
  4470. #==============================================================================
  4471. # ■ Scene_Item
  4472. #==============================================================================
  4473. class Scene_Item
  4474.  
  4475.   #--------------------------------------------------------------------------
  4476.   # ● Execute Dispose
  4477.   #--------------------------------------------------------------------------        
  4478.   def execute_dispose
  4479.       Graphics.freeze
  4480.       dispose_background
  4481.       dispose_layout
  4482.       dispose_particles
  4483.       dispose_command_sprites
  4484.       dispose_button_sprites
  4485.       dispose_windows
  4486.       dispose_members_status
  4487.   end
  4488.  
  4489.   #--------------------------------------------------------------------------
  4490.   # ● Dispose Background
  4491.   #--------------------------------------------------------------------------  
  4492.   def dispose_background
  4493.       return if @background == nil
  4494.       @background.dispose
  4495.       @background = nil
  4496.   end
  4497.    
  4498.   #--------------------------------------------------------------------------
  4499.   # ● Dispose Layout
  4500.   #--------------------------------------------------------------------------                
  4501.   def dispose_layout
  4502.       return if @layout == nil
  4503.       @layout.dispose
  4504.       @layout = nil
  4505.   end  
  4506.  
  4507.  #--------------------------------------------------------------------------
  4508.  # ● Dispose Particles
  4509.  #--------------------------------------------------------------------------    
  4510.  def dispose_particles
  4511.      return if @particles_sprite == nil
  4512.      @particles_sprite.each {|sprite| sprite.dispose }
  4513.  end
  4514.    
  4515.   #--------------------------------------------------------------------------
  4516.   # ● Dispose Command Sprites
  4517.   #--------------------------------------------------------------------------    
  4518.   def dispose_command_sprites
  4519.       return if @command_sprites == nil
  4520.       @command_sprites.each {|sprite| sprite.dispose_sprite }
  4521.       @command_sprites = nil
  4522.   end  
  4523.  
  4524.   #--------------------------------------------------------------------------
  4525.   # ● Dispose Button Sprites
  4526.   #--------------------------------------------------------------------------    
  4527.   def dispose_button_sprites
  4528.       return if @button_sprites == nil
  4529.       @button_sprites.each {|sprite| sprite.dispose_sprite }
  4530.       @button_sprites = nil
  4531.   end    
  4532.  
  4533.   #--------------------------------------------------------------------------
  4534.   # ● Dispose Members Status
  4535.   #--------------------------------------------------------------------------            
  4536.   def dispose_members_status
  4537.       return if @members_status == nil
  4538.       @members_status.each {|sprite| sprite.dispose }
  4539.   end  
  4540.  
  4541.   #--------------------------------------------------------------------------
  4542.   # ● Dispose Winndows
  4543.   #--------------------------------------------------------------------------        
  4544.   def dispose_windows
  4545.       return if @item_window == nil
  4546.       @item_window.dispose
  4547.       @item_window_2.dispose
  4548.       @weapon_window.dispose
  4549.       @armor_window.dispose
  4550.       @key_window.dispose
  4551.       @actor_window.dispose
  4552.       @actor_status.dispose
  4553.       @help_window.dispose
  4554.   end  
  4555.  
  4556. end
  4557.  
  4558. #==============================================================================
  4559. # ■ Scene_Item
  4560. #==============================================================================
  4561. class Scene_Item
  4562.  
  4563.   #--------------------------------------------------------------------------
  4564.   # ● Update Sprites
  4565.   #--------------------------------------------------------------------------          
  4566.   def update_sprites    
  4567.       update_background
  4568.       update_particles
  4569.       update_command_sprites
  4570.       update_button_sprites
  4571.       update_windows
  4572.       update_members_status
  4573.   end
  4574.  
  4575.   #--------------------------------------------------------------------------
  4576.   # ● Update Members Status
  4577.   #--------------------------------------------------------------------------            
  4578.   def update_members_status
  4579.       @members_status.each {|sprite| sprite.update(@actor_window.active,@actor_window.index) }
  4580.   end
  4581.      
  4582.   #--------------------------------------------------------------------------
  4583.   # ● Update Background
  4584.   #--------------------------------------------------------------------------              
  4585.   def update_background
  4586.       return if @background == nil
  4587.       @background.ox += @background_scroll[0]
  4588.       @background.oy += @background_scroll[1]
  4589.   end    
  4590.  
  4591.   #--------------------------------------------------------------------------
  4592.   # ● Update Particles
  4593.   #--------------------------------------------------------------------------  
  4594.   def update_particles
  4595.       return if @particles_sprite == nil
  4596.       @particles_sprite.each {|sprite| sprite.update }
  4597.   end
  4598.  
  4599.   #--------------------------------------------------------------------------
  4600.   # ● Update Command Sprites
  4601.   #--------------------------------------------------------------------------    
  4602.   def update_command_sprites
  4603.       return if @command_sprites == nil
  4604.       for i in @command_sprites
  4605.           i.update_command(@command_index)
  4606.           if i.index == 0
  4607.              @item_window.x = i.x
  4608.              @item_window.visible = i.visible
  4609.              @item_window_2.x = i.x
  4610.              @item_window_2.visible = i.visible            
  4611.            elsif i.index == 1
  4612.              @weapon_window.x = i.x
  4613.              @weapon_window.visible = i.visible            
  4614.            elsif i.index == 2
  4615.              @armor_window.x = i.x
  4616.              @armor_window.visible = i.visible
  4617.            elsif i.index == 3
  4618.              @key_window.x = i.x
  4619.              @key_window.visible = i.visible                
  4620.          end
  4621.       end      
  4622.   end  
  4623.  
  4624.   #--------------------------------------------------------------------------
  4625.   # ● Update Button Sprites
  4626.   #--------------------------------------------------------------------------    
  4627.   def update_button_sprites
  4628.       return if @button_sprites == nil
  4629.       @button_sprites.each {|sprite| sprite.update_command(@command_index) }
  4630.   end    
  4631.  
  4632.   #--------------------------------------------------------------------------
  4633.   # ● Update Winndow
  4634.   #--------------------------------------------------------------------------      
  4635.   def update_windows
  4636.       return if @item_window == nil
  4637.       @item_window_2.index = @item_window.index
  4638.       @item_window.update
  4639.       @weapon_window.update    
  4640.       @armor_window.update
  4641.       @key_window.update        
  4642.       @actor_window.update      
  4643.       update_actor_window_slide
  4644.       update_actor_window2_slide
  4645.   end
  4646.  
  4647.   #--------------------------------------------------------------------------
  4648.   # ● Update Actor Window Slide
  4649.   #--------------------------------------------------------------------------  
  4650.   def update_actor_window_slide
  4651.       if @actor_window.active
  4652.          if @actor_window.x < @actor_window_slide_range[0]
  4653.             @actor_window.x += 15
  4654.             @actor_window.contents_opacity += 23
  4655.             if @actor_window.x >= @actor_window_slide_range[0]
  4656.                @actor_window.x = @actor_window_slide_range[0]
  4657.                @actor_window.contents_opacity = 255
  4658.             end  
  4659.          end  
  4660.       else          
  4661.          if @actor_window.x >= @actor_window_slide_range[1]
  4662.             @actor_window.x -= 15
  4663.             @actor_window.contents_opacity -= 15
  4664.             if @actor_window.x <= @actor_window_slide_range[1]
  4665.                @actor_window.x = @actor_window_slide_range[1]
  4666.                @actor_window.contents_opacity = 0
  4667.             end          
  4668.          end
  4669.       end
  4670.   end    
  4671.  
  4672.   #--------------------------------------------------------------------------
  4673.   # ● Update Actor Window Slide
  4674.   #--------------------------------------------------------------------------  
  4675.   def update_actor_window2_slide
  4676.       @actor_status.update(@actor_window.active,@actor)
  4677.   end  
  4678.  
  4679. end
  4680.  
  4681. #==============================================================================
  4682. # ■ Scene_Item
  4683. #==============================================================================
  4684. class Scene_Item
  4685.  
  4686.   #--------------------------------------------------------------------------
  4687.   # ● Update
  4688.   #--------------------------------------------------------------------------      
  4689.   def update
  4690.       update_command    
  4691.       update_sprites
  4692.   end
  4693.    
  4694. end
  4695.  
  4696. #==============================================================================
  4697. # ■ Scene_Item
  4698. #==============================================================================
  4699. class Scene_Item
  4700.  
  4701.   #--------------------------------------------------------------------------
  4702.   # ● Update Command
  4703.   #--------------------------------------------------------------------------      
  4704.   def update_command
  4705.       if @actor_window.active
  4706.          update_target_select          
  4707.       else
  4708.          update_main_command
  4709.          update_active_window
  4710.       end  
  4711.   end
  4712.  
  4713.   #--------------------------------------------------------------------------
  4714.   # ● Update Active Window
  4715.   #--------------------------------------------------------------------------        
  4716.   def update_active_window
  4717.       @item_window_2.active = false
  4718.       if @command_index == 0
  4719.          @item_window.active = true
  4720.          @weapon_window.active = false
  4721.          @armor_window.active = false
  4722.          @key_window.active = false
  4723.       elsif @command_index == 1          
  4724.          @item_window.active = false
  4725.          @weapon_window.active = true
  4726.          @armor_window.active = false
  4727.          @key_window.active = false
  4728.       elsif @command_index == 2  
  4729.          @item_window.active = false
  4730.          @weapon_window.active = false
  4731.          @armor_window.active = true
  4732.          @key_window.active = false
  4733.       elsif @command_index == 3
  4734.          @item_window.active = false
  4735.          @weapon_window.active = false
  4736.          @armor_window.active = false
  4737.          @key_window.active = true
  4738.       end        
  4739.   end
  4740.      
  4741.   #--------------------------------------------------------------------------
  4742.   # ● Update Main Command
  4743.   #--------------------------------------------------------------------------        
  4744.   def update_main_command
  4745.       @wait_time -= 1 if @wait_time > 0
  4746.       if Input.trigger?(:LEFT)
  4747.          move_command_index(-1)
  4748.       elsif Input.trigger?(:RIGHT)
  4749.          move_command_index(1)
  4750.       elsif Input.trigger?(:B)
  4751.          return_scene
  4752.       end  
  4753.   end
  4754.  
  4755.   #--------------------------------------------------------------------------
  4756.   # ● Return Scene
  4757.   #--------------------------------------------------------------------------          
  4758.   def return_scene
  4759.       Sound.play_cancel
  4760.       SceneManager.return
  4761.   end
  4762.  
  4763.   #--------------------------------------------------------------------------
  4764.   # ● Cancel_Selection
  4765.   #--------------------------------------------------------------------------          
  4766.   def cancel_selection
  4767.       Sound.play_cancel
  4768.       @phase = 0
  4769.   end
  4770.  
  4771.   #--------------------------------------------------------------------------
  4772.   # ● Update Main Command
  4773.   #--------------------------------------------------------------------------  
  4774.   def move_command_index(value)
  4775.       return if @wait_time > 0
  4776.       @wait_time = 7
  4777.       pre_index = @command_index
  4778.       @command_index += value
  4779.       @command_index = 0 if @command_index > 3
  4780.       @command_index = 3 if @command_index < 0
  4781.       for i in @command_sprites
  4782.           i.newp(@command_index,value)
  4783.       end          
  4784.       Sound.play_cursor
  4785.   end      
  4786.  
  4787.   #--------------------------------------------------------------------------
  4788.   # ● ON Category OK
  4789.   #--------------------------------------------------------------------------
  4790.   def on_category_ok
  4791.       if @command_index == 0
  4792.          @item_window.activate
  4793.          @item_window.select_last
  4794.       elsif @command_index == 1  
  4795.          @weapon_window.activate
  4796.          @weapon_window.select_last        
  4797.       elsif @command_index == 2  
  4798.          @armor_window.activate
  4799.          @armor_window.select_last
  4800.       elsif @command_index == 3  
  4801.          @key_window.activate
  4802.          @key_window.select_last
  4803.       end
  4804.       refresh_actor_status  
  4805.   end
  4806.  
  4807.   #--------------------------------------------------------------------------
  4808.   # ● ON Item OK
  4809.   #--------------------------------------------------------------------------
  4810.   def on_item_ok
  4811.       $game_party.last_item.object = item
  4812.       determine_item
  4813.   end
  4814.  
  4815.   #--------------------------------------------------------------------------
  4816.   # ● ON Item Cancel
  4817.   #--------------------------------------------------------------------------
  4818.   def on_item_cancel
  4819.      @item_window.unselect
  4820.   end
  4821.  
  4822.   #--------------------------------------------------------------------------
  4823.   # ● Play SE For Item
  4824.   #--------------------------------------------------------------------------
  4825.   def play_se_for_item
  4826.       Sound.play_use_item
  4827.   end  
  4828.  
  4829.   #--------------------------------------------------------------------------
  4830.   # ● Item
  4831.   #--------------------------------------------------------------------------
  4832.   def item
  4833.       if @command_index == 0
  4834.          @item_window.item
  4835.       elsif @command_index == 1  
  4836.          @weapon_window.item    
  4837.       elsif @command_index == 2  
  4838.          @armor_window.item
  4839.       elsif @command_index == 3  
  4840.          @key_window.item        
  4841.       end        
  4842.   end
  4843.  
  4844.   #--------------------------------------------------------------------------
  4845.   # ● User
  4846.   #--------------------------------------------------------------------------
  4847.   def user
  4848.       $game_party.movable_members.max_by {|member| member.pha }
  4849.   end
  4850.  
  4851.   #--------------------------------------------------------------------------
  4852.   # ● Cursor Left
  4853.   #--------------------------------------------------------------------------
  4854.   def cursor_left?
  4855.       @item_window.index % 2 == 0
  4856.   end
  4857.  
  4858.   #--------------------------------------------------------------------------
  4859.   # ● Show Sub Window
  4860.   #--------------------------------------------------------------------------
  4861.   def show_sub_window(window)
  4862.     window.show.activate
  4863.   end
  4864.  
  4865.   #--------------------------------------------------------------------------
  4866.   # ● Hide Sub Window
  4867.   #--------------------------------------------------------------------------
  4868.   def hide_sub_window(window)
  4869.       window.deactivate
  4870.       activate_item_window
  4871.   end
  4872.  
  4873.   #--------------------------------------------------------------------------
  4874.   # ● ON Actor OK
  4875.   #--------------------------------------------------------------------------
  4876.   def on_actor_ok
  4877.       if item_usable?
  4878.          use_item
  4879.          refresh_window
  4880.       else
  4881.         Sound.play_buzzer
  4882.       end
  4883.   end
  4884.  
  4885.   #--------------------------------------------------------------------------
  4886.   # ● Refresh Window
  4887.   #--------------------------------------------------------------------------  
  4888.   def refresh_window
  4889.       if @command_index == 0
  4890.          old_item = @item_window.item
  4891.          @item_window.refresh
  4892. #         set_actor_for_members_menu
  4893.          if @item_window.item  == nil
  4894.             @item_window.index -= 1
  4895.             @item_window.index = 0 if @item_window.index < 0
  4896.             @item_window.update
  4897.          end
  4898.          if old_item != @item_window.item
  4899.             on_actor_cancel
  4900.             cancel_selection
  4901.             @item_window_2.refresh
  4902.             @item_window.update_help
  4903.          end
  4904.       elsif @command_index == 1  
  4905.          @weapon_window.refresh
  4906.       elsif @command_index == 2  
  4907.          @armor_window.refresh
  4908.       elsif @command_index == 3  
  4909.          @key_window.refresh      
  4910.       end
  4911.   end
  4912.    
  4913.   #--------------------------------------------------------------------------
  4914.   # ● Set Actor for Members Menu
  4915.   #--------------------------------------------------------------------------  
  4916.   def set_actor_for_members_menu
  4917.       index = 0
  4918.       for actor in $game_party.members
  4919.           @members_status[index].set_actor(actor)
  4920.           index += 1
  4921.       end  
  4922.   end
  4923.          
  4924.   #--------------------------------------------------------------------------
  4925.   # ● ON Actor Cancel
  4926.   #--------------------------------------------------------------------------
  4927.   def on_actor_cancel
  4928.       hide_sub_window(@actor_window)
  4929.   end
  4930.  
  4931.   #--------------------------------------------------------------------------
  4932.   # ● Determine Item
  4933.   #--------------------------------------------------------------------------
  4934.   def determine_item
  4935.       if item.for_friend?
  4936.          show_sub_window(@actor_window)
  4937.          @actor_window.select_for_item(item)
  4938.          $game_temp.item_scope = @item_window.item.scope rescue nil
  4939.       else
  4940.          use_item
  4941.          activate_item_window
  4942.       end
  4943.   end
  4944.  
  4945.   #--------------------------------------------------------------------------
  4946.   # ● Activate Item Window
  4947.   #--------------------------------------------------------------------------
  4948.   def activate_item_window
  4949.       if @command_index == 0
  4950.          @item_window.refresh
  4951.          @item_window.activate
  4952.       elsif @command_index == 1  
  4953.          @weapon_window.refresh
  4954.          @weapon_window.activate
  4955.       elsif @command_index == 2  
  4956.          @armor_window.refresh
  4957.          @armor_window.activate
  4958.       elsif @command_index == 3  
  4959.          @key_window.refresh    
  4960.          @key_window.activate
  4961.       end    
  4962.   end
  4963.  
  4964.   #--------------------------------------------------------------------------
  4965.   # ● Item Target Actors
  4966.   #--------------------------------------------------------------------------
  4967.   def item_target_actors
  4968.       if !item.for_friend?
  4969.         []
  4970.       elsif item.for_all?
  4971.         $game_party.members
  4972.       else
  4973.         [$game_party.members[@actor_window.index]]
  4974.       end
  4975.   end
  4976.  
  4977.   #--------------------------------------------------------------------------
  4978.   # ● Item Usable?
  4979.   #--------------------------------------------------------------------------
  4980.   def item_usable?
  4981.       user.usable?(item) && item_effects_valid?
  4982.   end
  4983.  
  4984.   #--------------------------------------------------------------------------
  4985.   # ● Item Effects Valid?
  4986.   #--------------------------------------------------------------------------
  4987.   def item_effects_valid?
  4988.       item_target_actors.any? do |target|
  4989.            target.item_test(user, item)
  4990.       end
  4991.   end
  4992.  
  4993.   #--------------------------------------------------------------------------
  4994.   # ● Use Item to Actors
  4995.   #--------------------------------------------------------------------------
  4996.   def use_item_to_actors
  4997.       item_target_actors.each do |target|
  4998.         item.repeats.times { target.item_apply(user, item) }
  4999.       end
  5000.   end
  5001.  
  5002.   #--------------------------------------------------------------------------
  5003.   # ● Use Item
  5004.   #--------------------------------------------------------------------------
  5005.   def use_item
  5006.       play_se_for_item
  5007.       user.use_item(item)
  5008.       use_item_to_actors
  5009.       check_common_event
  5010.       check_gameover
  5011.       @actor_window.refresh
  5012.   end
  5013.  
  5014.   #--------------------------------------------------------------------------
  5015.   # ● Check Common Event
  5016.   #--------------------------------------------------------------------------
  5017.   def check_common_event
  5018.       SceneManager.goto(Scene_Map) if $game_temp.common_event_reserved?
  5019.   end
  5020.  
  5021.   #--------------------------------------------------------------------------
  5022.   # ● Update Target Select
  5023.   #--------------------------------------------------------------------------  
  5024.   def update_target_select
  5025.       @actor = $game_party.members[@actor_window.index]
  5026.       if Input.trigger?(:B)        
  5027.          cancel_selection
  5028.       end      
  5029.   end  
  5030.  
  5031. end
  5032.  
  5033.  
  5034. #==============================================================================
  5035. # ■ Game_Temp
  5036. #==============================================================================
  5037. class Game_Temp
  5038.  
  5039.   #--------------------------------------------------------------------------
  5040.   # ● Execute Pre Cache Skill Menu
  5041.   #--------------------------------------------------------------------------    
  5042.   def execute_pre_cache_skill_menu
  5043.       @pre_cache_skill_menu = []
  5044.       @pre_cache_skill_menu.push(Cache.menu_skill("Background"))
  5045.       @pre_cache_skill_menu.push(Cache.menu_skill("LayoutSKILL"))
  5046.       @pre_cache_skill_menu.push(Cache.menu_skill("Type_Layout"))
  5047.       @pre_cache_skill_menu.push(Cache.menu_skill("List_Layout"))
  5048.       @pre_cache_skill_menu.push(Cache.menu_skill("Actor_Layout"))
  5049.  
  5050.   end    
  5051.    
  5052. end
  5053.  
  5054. #==============================================================================
  5055. # ■ Scene_Skill
  5056. #==============================================================================
  5057. class Scene_Skill
  5058.   include MOG_MENU_SKILL
  5059.   include MOG_MENU_BASE
  5060.  
  5061.   #--------------------------------------------------------------------------
  5062.   # ● Main
  5063.   #--------------------------------------------------------------------------        
  5064.   def main
  5065.       execute_setup
  5066.       execute_loop
  5067.       execute_dispose
  5068.   end  
  5069.  
  5070.   #--------------------------------------------------------------------------
  5071.   # ● Execute Setup
  5072.   #--------------------------------------------------------------------------        
  5073.   def execute_setup
  5074.       @actor = $game_temp.actor_menu_temp
  5075.       @index_max = (@actor.added_skill_types.size - 1)
  5076.       @index_max = 0 if @index_max < 0      
  5077.       @phase = 0
  5078.       @press_time = 0
  5079.       @press_lag = 0
  5080.       @scene_active = @actor.added_skill_types.size > 0 ? true : false
  5081.       create_sprites
  5082.   end
  5083.  
  5084.   #--------------------------------------------------------------------------
  5085.   # ● Execute Lopp
  5086.   #--------------------------------------------------------------------------        
  5087.   def execute_loop
  5088.       Graphics.transition(10)
  5089.       loop do
  5090.          Input.update
  5091.          update
  5092.          Graphics.update
  5093.          break if SceneManager.scene != self
  5094.       end
  5095.   end
  5096.  
  5097. end
  5098.  
  5099. #==============================================================================
  5100. # ■ Actor Skill Status
  5101. #==============================================================================
  5102. class Actor_Skill_Status
  5103.   include MOG_ACTOR_SKILL_STATUS
  5104.  
  5105.   #--------------------------------------------------------------------------
  5106.   # ● Initialize
  5107.   #--------------------------------------------------------------------------
  5108.   def initialize(actor)
  5109.       @actor = actor
  5110.       set_old_parameter
  5111.       create_sprites
  5112.   end
  5113.  
  5114.   #--------------------------------------------------------------------------
  5115.   # ● Create Sprites
  5116.   #--------------------------------------------------------------------------  
  5117.   def create_sprites
  5118.       @meter_image = $game_temp.pre_cache_actor_menu[6]
  5119.       @meter_cw = @meter_image.width
  5120.       @meter_ch = @meter_image.height / 2  
  5121.       @parameter_number = $game_temp.pre_cache_actor_menu[2]
  5122.       @parameter_cw = @parameter_number.width / 10
  5123.       @parameter_ch = @parameter_number.height
  5124.       @opac = 0
  5125.       create_layout
  5126.       create_parameter
  5127.       create_face
  5128.       create_name
  5129.       create_hp_meter
  5130.       create_mp_meter
  5131.       create_states
  5132.       set_position(0,-@layout.bitmap.height - 48)
  5133.   end
  5134.    
  5135.   #--------------------------------------------------------------------------
  5136.   # ● Set Old Parameter
  5137.   #--------------------------------------------------------------------------  
  5138.   def set_old_parameter
  5139.       @par = [] if @par == nil
  5140.       @par.clear
  5141.       @par = [@actor.hp,@actor.mhp,@actor.mp,@actor.mmp,@actor.level]
  5142.   end    
  5143.  
  5144.   #--------------------------------------------------------------------------
  5145.   # ● Dispose
  5146.   #--------------------------------------------------------------------------  
  5147.   def dispose
  5148.       dispose_layout
  5149.       dispose_parameter
  5150.       dispose_face
  5151.       dispose_name
  5152.       dispose_hp_meter
  5153.       dispose_mp_meter
  5154.       dispose_states
  5155.   end
  5156.  
  5157.   #--------------------------------------------------------------------------
  5158.   # ● Dispose Layout
  5159.   #--------------------------------------------------------------------------    
  5160.   def dispose_layout
  5161.       @layout.dispose
  5162.   end
  5163.  
  5164.   #--------------------------------------------------------------------------
  5165.   # ● Dispose Parameter
  5166.   #--------------------------------------------------------------------------      
  5167.   def dispose_parameter
  5168.       @parameter.bitmap.dispose
  5169.       @parameter.dispose
  5170.   end  
  5171.  
  5172.   #--------------------------------------------------------------------------
  5173.   # ● Dispose Face
  5174.   #--------------------------------------------------------------------------    
  5175.   def dispose_face
  5176.       @face.bitmap.dispose if @face.bitmap != nil
  5177.       @face.dispose
  5178.   end    
  5179.  
  5180.   #--------------------------------------------------------------------------
  5181.   # ● Dispose HP Meter
  5182.   #--------------------------------------------------------------------------      
  5183.   def dispose_hp_meter
  5184.       @hp_meter.bitmap.dispose
  5185.       @hp_meter.dispose
  5186.   end
  5187.  
  5188.   #--------------------------------------------------------------------------
  5189.   # ● Dispose MP Meter
  5190.   #--------------------------------------------------------------------------      
  5191.   def dispose_mp_meter
  5192.       @mp_meter.bitmap.dispose
  5193.       @mp_meter.dispose
  5194.   end  
  5195.  
  5196.   #--------------------------------------------------------------------------
  5197.   # ● Dispose Name
  5198.   #--------------------------------------------------------------------------        
  5199.   def dispose_name
  5200.       @name.bitmap.dispose
  5201.       @name.dispose
  5202.   end  
  5203.  
  5204.   #--------------------------------------------------------------------------
  5205.   # ● Dispose States
  5206.   #--------------------------------------------------------------------------            
  5207.    def dispose_states
  5208.        return if @status == nil
  5209.        @status.bitmap.dispose
  5210.        @status.dispose
  5211.        if @actor_status != nil
  5212.           @actor_status.dispose
  5213.           @actor_status = nil
  5214.        end  
  5215.     end    
  5216.  
  5217.   #--------------------------------------------------------------------------
  5218.   # ● Create Layout
  5219.   #--------------------------------------------------------------------------
  5220.   def create_layout
  5221.       @layout = Sprite.new
  5222.       @layout.bitmap = $game_temp.pre_cache_skill_menu[4]
  5223.       @org_pos = [LAYOUT_POSITION[0],LAYOUT_POSITION[1]]
  5224.       @layout.x = @org_pos[0]
  5225.       @layout.y = @org_pos[1]
  5226.       @layout.z = 10
  5227.       #@layout.opacity = 0
  5228.   end
  5229.  
  5230.   #--------------------------------------------------------------------------
  5231.   # ● Create Parameter
  5232.   #--------------------------------------------------------------------------
  5233.   def create_parameter
  5234.       @parameter = Sprite.new
  5235.       @parameter.bitmap = Bitmap.new(@layout.bitmap.width,@layout.bitmap.height)
  5236.       @org_pos_par = [@org_pos[0] + PAR_POSITION[0],
  5237.                       @org_pos[1] + PAR_POSITION[1]]
  5238.       @parameter.x = @org_pos_par[0]
  5239.       @parameter.y = @org_pos_par[1]
  5240.       @parameter.z = 12
  5241. #      @parameter.opacity = 0
  5242.       refresh_parameter
  5243.   end  
  5244.  
  5245.   #--------------------------------------------------------------------------
  5246.   # ● Create HP Meter
  5247.   #--------------------------------------------------------------------------  
  5248.   def create_hp_meter
  5249.       @hp_meter_old = [-1,-1]
  5250.       @hp_meter = Sprite.new
  5251.       @hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  5252.       @org_pos_hp = [@org_pos[0] + HP_METER_POSITION[0],
  5253.                      @org_pos[1] + HP_METER_POSITION[1]]      
  5254.       @hp_meter.x = @org_pos_hp[0]
  5255.       @hp_meter.y = @org_pos_hp[1]
  5256.       @hp_meter.z = 11
  5257.   end  
  5258.  
  5259.   #--------------------------------------------------------------------------
  5260.   # ● Refresh HP Meter
  5261.   #--------------------------------------------------------------------------  
  5262.   def refresh_hp_meter
  5263.       @hp_meter_old[0] = @actor.hp
  5264.       @hp_meter_old[1] = @actor.mhp
  5265.       @hp_meter.bitmap.clear
  5266.       width_range = @meter_cw * @actor.hp / @actor.mhp
  5267.       m_rect = Rect.new(0,0,width_range,@meter_ch)
  5268.       @hp_meter.bitmap.blt(0,0,@meter_image,m_rect)
  5269.   end
  5270.  
  5271.   #--------------------------------------------------------------------------
  5272.   # ● Create MP Meter
  5273.   #--------------------------------------------------------------------------  
  5274.   def create_mp_meter
  5275.       @mp_meter_old = [-1,-1]
  5276.       @mp_meter = Sprite.new
  5277.       @mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  5278.       @org_pos_mp = [@org_pos[0] + MP_METER_POSITION[0],
  5279.                      @org_pos[1] + MP_METER_POSITION[1]]      
  5280.       @mp_meter.x = @org_pos_mp[0]
  5281.       @mp_meter.y = @org_pos_mp[1]
  5282.       @mp_meter.z = 11
  5283.   end  
  5284.  
  5285.   #--------------------------------------------------------------------------
  5286.   # ● Create_States
  5287.   #--------------------------------------------------------------------------      
  5288.   def create_states
  5289.       @status_old = nil
  5290.       @status_flow = [-24,0]    
  5291.       @status = Sprite.new
  5292.       @status.bitmap = Bitmap.new(24,24)
  5293.       @org_pos_states = [@org_pos[0] + STATES_POSITION[0],
  5294.                          @org_pos[1] + STATES_POSITION[1]]      
  5295.       @status.x = @org_pos_states[0] + 1
  5296.       @status.y = @org_pos_states[1]
  5297.       @status.z = 11
  5298.   end      
  5299.  
  5300.   #--------------------------------------------------------------------------
  5301.   # * Refresh States
  5302.   #--------------------------------------------------------------------------        
  5303.   def refresh_states
  5304.       check_icon_image
  5305.       @status_old = @actor.states
  5306.       @status_flow = [0,0]
  5307.       @actor_status.dispose if @actor_status != nil
  5308.       @states_size = @actor.states.size > 0 ? (26 * @actor.states.size) : 24
  5309.       @actor_status = Bitmap.new(@states_size,24)
  5310.       index = 0
  5311.       for i in @actor.states
  5312.          rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
  5313.          @actor_status.blt(26 * index , 0, @icon_image, rect)
  5314.          index += 1
  5315.       end
  5316.   end  
  5317.  
  5318.   #--------------------------------------------------------------------------
  5319.   # * Flow_Status
  5320.   #--------------------------------------------------------------------------          
  5321.   def flow_states
  5322.       return if @actor_status == nil
  5323.       @status.bitmap.clear
  5324.       return if @actor.states.size == 0
  5325.       st_src_rect = Rect.new(@status_flow[0],0, 24,24)
  5326.       @status.bitmap.blt(0,0, @actor_status, st_src_rect)
  5327.       if STATES_SCROLLING_ANIMATION
  5328.          @status_flow[0] += 1
  5329.          @status_flow[0] = -24 if @status_flow[0] >= @states_size + 2
  5330.       else  
  5331.          @status_flow[1] += 1 unless @actor.states.size <= 1
  5332.          if @status_flow[1] > 30
  5333.             @status_flow[1] = 0
  5334.             @status_flow[0] += 26
  5335.             @status_flow[0] = 0 if @status_flow[0] >= (@states_size - 0)
  5336.          end  
  5337.      end  
  5338.   end        
  5339.  
  5340.   #--------------------------------------------------------------------------
  5341.   # * Check Icon Image
  5342.   #--------------------------------------------------------------------------          
  5343.   def check_icon_image
  5344.       if @icon_image == nil or @icon_image.disposed?
  5345.          @icon_image = Cache.system("Iconset")
  5346.       end  
  5347.   end    
  5348.      
  5349.  
  5350.   #--------------------------------------------------------------------------
  5351.   # ● Refresh MP Meter
  5352.   #--------------------------------------------------------------------------  
  5353.   def refresh_mp_meter
  5354.       @mp_meter_old[0] = @actor.mp
  5355.       @mp_meter_old[1] = @actor.mmp
  5356.       @mp_meter.bitmap.clear
  5357.       width_range = @meter_cw * @actor.mp / @actor.mmp rescue nil
  5358.       width_range = 0 if width_range == nil
  5359.       m_rect = Rect.new(0,@meter_ch,width_range,@meter_ch)
  5360.       @mp_meter.bitmap.blt(0,0,@meter_image,m_rect)
  5361.   end  
  5362.  
  5363.   #--------------------------------------------------------------------------
  5364.   # ● Create Face
  5365.   #--------------------------------------------------------------------------  
  5366.   def refresh_parameter
  5367.       set_old_parameter    
  5368.       @parameter.bitmap.clear
  5369.      
  5370.       value = @actor.level
  5371.       x = 112
  5372.       y = 8
  5373.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  5374.      
  5375.       value = @actor.hp
  5376.       x = 218
  5377.       y = 2
  5378.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  5379.  
  5380.       value = @actor.mp
  5381.       x = 238
  5382.       y = 22
  5383.       refresh_number(@parameter,@parameter_number,value,@parameter_cw,@parameter_ch,x,y)
  5384.      
  5385.   end  
  5386.  
  5387.   #--------------------------------------------------------------------------
  5388.   # ● Refresh Number
  5389.   #--------------------------------------------------------------------------    
  5390.   def refresh_number(sprite,image,value,number_cw,number_ch,x,y)
  5391.       number = value.abs.to_s.split(//)
  5392.       x2 = -number_cw * number.size
  5393.       for i in 0..number.size - 1
  5394.           number_abs = number[i].to_i
  5395.           nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
  5396.           sprite.bitmap.blt(x + x2 + (number_cw  *  i), y, image, nsrc_rect)        
  5397.       end      
  5398.      
  5399.   end
  5400.  
  5401.   #--------------------------------------------------------------------------
  5402.   # ● Create Face
  5403.   #--------------------------------------------------------------------------  
  5404.   def create_face
  5405.       @face = Sprite.new
  5406.       @org_pos_face = [@org_pos[0] + FACE_POSITION[0],
  5407.                        @org_pos[1] + FACE_POSITION[1]]
  5408.       @face.x = @org_pos_face[0]
  5409.       @face.y = @org_pos_face[1]
  5410.       @face.z = 11
  5411.    #   @face.opacity = 0
  5412.       refresh_face
  5413.   end  
  5414.  
  5415.   #--------------------------------------------------------------------------
  5416.   # ● Refresh Face
  5417.   #--------------------------------------------------------------------------    
  5418.   def refresh_face
  5419.       face_name = "Face" + @actor.id.to_s
  5420.       @face.bitmap = Cache.menu(face_name.to_s)
  5421.   end
  5422.  
  5423.   #--------------------------------------------------------------------------
  5424.   # ● Create Name
  5425.   #--------------------------------------------------------------------------    
  5426.   def create_name
  5427.       @name = Sprite.new
  5428.       @name.bitmap = Bitmap.new(140,32)
  5429.       @name.bitmap.font.size = FONT_SIZE
  5430.       @name.bitmap.font.bold = FONT_BOLD
  5431.       @org_pos_name = [@org_pos[0] + NAME_POSITION[0],
  5432.                        @org_pos[1] + NAME_POSITION[1]]
  5433.       @name.x = @org_pos_name[0]
  5434.       @name.y = @org_pos_name[1]
  5435.       @name.z = 11
  5436.      #@name.opacity = 0
  5437.       refresh_name    
  5438.   end  
  5439.  
  5440.   #--------------------------------------------------------------------------
  5441.   # ● Refresh Name
  5442.   #--------------------------------------------------------------------------      
  5443.   def refresh_name
  5444.       @name.bitmap.clear
  5445.       @name.bitmap.draw_text(0,0,140,32,@actor.name.to_s,0)
  5446.   end  
  5447.  
  5448.   #--------------------------------------------------------------------------
  5449.   # ● Set Actor
  5450.   #--------------------------------------------------------------------------        
  5451.   def set_actor(actor)
  5452.       @actor = actor
  5453.   end
  5454.  
  5455.   #--------------------------------------------------------------------------
  5456.   # ● Can Refresh HP Meter
  5457.   #--------------------------------------------------------------------------          
  5458.   def can_refresh_hp_meter?
  5459.       return true if @hp_meter_old[0] != @actor.hp
  5460.       return true if @hp_meter_old[1] != @actor.mhp
  5461.       return false
  5462.   end
  5463.      
  5464.   #--------------------------------------------------------------------------
  5465.   # ● Can Refresh MP Meter
  5466.   #--------------------------------------------------------------------------          
  5467.   def can_refresh_mp_meter?
  5468.       return true if @mp_meter_old[0] != @actor.mp
  5469.       return true if @mp_meter_old[1] != @actor.mmp
  5470.       return false
  5471.   end  
  5472.  
  5473.   #--------------------------------------------------------------------------
  5474.   # ● Can Refresh Parameter
  5475.   #--------------------------------------------------------------------------
  5476.   def can_refresh_parameter?
  5477.       return true if @par[0] != @actor.hp
  5478.       return true if @par[1] != @actor.mhp
  5479.       return true if @par[2] != @actor.mp
  5480.       return true if @par[3] != @actor.mmp
  5481.       return false
  5482.   end
  5483.  
  5484.   #--------------------------------------------------------------------------
  5485.   # ● Update Position
  5486.   #--------------------------------------------------------------------------      
  5487.   def update_position
  5488.       update_slide(0,@layout,@layout.x,@org_pos[0])
  5489.       update_slide(1,@layout,@layout.y,@org_pos[1])
  5490.       update_slide(0,@parameter,@parameter.x,@org_pos_par[0])
  5491.       update_slide(1,@parameter,@parameter.y,@org_pos_par[1])
  5492.       update_slide(0,@hp_meter,@hp_meter.x,@org_pos_hp[0])
  5493.       update_slide(1,@hp_meter,@hp_meter.y,@org_pos_hp[1])  
  5494.       update_slide(0,@mp_meter,@mp_meter.x,@org_pos_mp[0])
  5495.       update_slide(1,@mp_meter,@mp_meter.y,@org_pos_mp[1])        
  5496.       update_slide(0,@face,@face.x,@org_pos_face[0])
  5497.       update_slide(1,@face,@face.y,@org_pos_face[1])        
  5498.       update_slide(0,@name,@name.x,@org_pos_name[0])
  5499.       update_slide(1,@name,@name.y,@org_pos_name[1])      
  5500.       update_slide(0,@status,@status.x,@org_pos_states[0])
  5501.       update_slide(1,@status,@status.y,@org_pos_states[1])        
  5502.   end
  5503.  
  5504.  #--------------------------------------------------------------------------
  5505.  # ● Update Slide
  5506.  #--------------------------------------------------------------------------                      
  5507.   def update_slide(type,sprite,cp,np)
  5508.       sp = 3 + ((cp - np).abs / 10)
  5509.       if cp > np
  5510.          cp -= sp
  5511.          cp = np if cp < np
  5512.       elsif cp < np
  5513.          cp += sp
  5514.          cp = np if cp > np
  5515.       end    
  5516.       sprite.x = cp if type == 0
  5517.       sprite.y = cp if type == 1
  5518.   end    
  5519.  
  5520.   #--------------------------------------------------------------------------
  5521.   # ● Update Opacity
  5522.   #--------------------------------------------------------------------------  
  5523.   def update_opacity
  5524.       @opac += 10
  5525.       @opac = 255 if @opac > 255
  5526.       set_opacity(@opac)
  5527.   end
  5528.  
  5529.   #--------------------------------------------------------------------------
  5530.   # ● Set Opacity
  5531.   #--------------------------------------------------------------------------    
  5532.   def set_opacity(opac)
  5533.       @layout.opacity = opac
  5534.       @layout.opacity = opac
  5535.       @parameter.opacity = opac
  5536.       @parameter.opacity = opac
  5537.       @hp_meter.opacity = opac
  5538.       @hp_meter.opacity = opac
  5539.       @mp_meter.opacity = opac
  5540.       @mp_meter.opacity = opac
  5541.       @face.opacity = opac
  5542.       @face.opacity = opac
  5543.       @name.opacity = opac
  5544.       @name.opacity = opac
  5545.       @status.opacity = opac
  5546.   end    
  5547.  
  5548.   #--------------------------------------------------------------------------
  5549.   # ● Update Position
  5550.   #--------------------------------------------------------------------------      
  5551.   def set_position(pos_x,pos_y)
  5552.       @layout.x = @org_pos[0] + pos_x
  5553.       @layout.y = @org_pos[1] + pos_y
  5554.       @parameter.x = @org_pos_par[0] + pos_x
  5555.       @parameter.y = @org_pos_par[1] + pos_y
  5556.       @hp_meter.x = @org_pos_hp[0] + pos_x
  5557.       @hp_meter.y = @org_pos_hp[1] + pos_y
  5558.       @mp_meter.x = @org_pos_mp[0] + pos_x
  5559.       @mp_meter.y = @org_pos_mp[1] + pos_y
  5560.       @face.x = @org_pos_face[0] + pos_x
  5561.       @face.y = @org_pos_face[1] + pos_y
  5562.       @name.x = @org_pos_name[0] + pos_x
  5563.       @name.y = @org_pos_name[1] + pos_y
  5564.       @status.x = @org_pos_states[0] + pos_x
  5565.       @status.y = @org_pos_states[1] + pos_y
  5566.   end    
  5567.  
  5568.   #--------------------------------------------------------------------------
  5569.   # ● Update
  5570.   #--------------------------------------------------------------------------  
  5571.   def update
  5572.       refresh_hp_meter if can_refresh_hp_meter?
  5573.       refresh_mp_meter if can_refresh_mp_meter?
  5574.       refresh_parameter if can_refresh_parameter?
  5575.       refresh_states if @status_old != @actor.states
  5576.       update_opacity
  5577.       update_position
  5578.       flow_states      
  5579.   end
  5580.  
  5581. end
  5582.  
  5583. #==============================================================================
  5584. # ■ Window_SkillCommand
  5585. #==============================================================================
  5586. class Window_SkillCommand_2 < Window_Command
  5587.  
  5588.   attr_reader   :skill_window
  5589.  
  5590.   #--------------------------------------------------------------------------
  5591.   # ● Initialize
  5592.   #--------------------------------------------------------------------------
  5593.   def initialize(x, y)
  5594.     super(x, y)
  5595.     @actor = nil
  5596.     @index_max = 0
  5597.   end
  5598.  
  5599.   #--------------------------------------------------------------------------
  5600.   # ● Window Width
  5601.   #--------------------------------------------------------------------------
  5602.   def window_width
  5603.     return 140
  5604.   end
  5605.  
  5606.   #--------------------------------------------------------------------------
  5607.   # ● Actor
  5608.   #--------------------------------------------------------------------------
  5609.   def actor=(actor)
  5610.       return if @actor == actor
  5611.       @actor = actor
  5612.       @index_max = (@actor.added_skill_types.size - 1)
  5613.       @index_max = 0 if @index_max < 0
  5614.       refresh
  5615.       select_last
  5616.   end
  5617.  
  5618.   #--------------------------------------------------------------------------
  5619.   # ● Visible Line Number
  5620.   #--------------------------------------------------------------------------
  5621.   def visible_line_number
  5622.       return 4
  5623.   end
  5624.  
  5625.   #--------------------------------------------------------------------------
  5626.   # ● Make Command List
  5627.   #--------------------------------------------------------------------------
  5628.   def make_command_list
  5629.       return unless @actor
  5630.          @actor.added_skill_types.sort.each do |stype_id|
  5631.          name = $data_system.skill_types[stype_id]
  5632.          add_command(name, :skill, true, stype_id)
  5633.       end
  5634.   end
  5635.  
  5636.   #--------------------------------------------------------------------------
  5637.   # ● Update
  5638.   #--------------------------------------------------------------------------
  5639.   def update
  5640.       super
  5641.       @skill_window.stype_id = current_ext if @skill_window
  5642.      # update_index
  5643.   end
  5644.  
  5645.   #--------------------------------------------------------------------------
  5646.   # ● Update
  5647.   #--------------------------------------------------------------------------  
  5648.   def update_index
  5649.       return if @index_max <= 0
  5650.       if Input.trigger?(:RIGHT)
  5651.          add_index(1)
  5652.       elsif Input.trigger?(:LEFT)    
  5653.          add_index(-1)
  5654.       end  
  5655.   end
  5656.  
  5657.   #--------------------------------------------------------------------------
  5658.   # ● Add Index
  5659.   #--------------------------------------------------------------------------    
  5660.   def add_index(value)
  5661.       Sound.play_cursor
  5662.       @index += value
  5663.       @index = 0 if @index > @index_max
  5664.       @index = @index_max if @index < 0
  5665.   end
  5666.  
  5667.   #--------------------------------------------------------------------------
  5668.   # ● Skill Window
  5669.   #--------------------------------------------------------------------------
  5670.   def skill_window=(skill_window)
  5671.       @skill_window = skill_window
  5672.       update
  5673.   end  
  5674.  
  5675.   #--------------------------------------------------------------------------
  5676.   # ● Select Last
  5677.   #--------------------------------------------------------------------------
  5678.   def select_last
  5679.       skill = @actor.last_skill.object
  5680.       if skill
  5681.          select_ext(skill.stype_id)
  5682.       else
  5683.          select(0)
  5684.       end
  5685.   end
  5686.    
  5687. end
  5688.  
  5689. #==============================================================================
  5690. # ■ Window_SkillList
  5691. #==============================================================================
  5692. class Window_SkillList_Menu < Window_Selectable
  5693.  
  5694.   attr_accessor :windows_index
  5695.  
  5696.   #--------------------------------------------------------------------------
  5697.   # ● Initialize
  5698.   #--------------------------------------------------------------------------
  5699.   def initialize(x, y, width, height)
  5700.       super
  5701.       @stype_id = 0
  5702.       @data = []
  5703.       @windows_index = 0
  5704.       self.opacity = 0
  5705.       @actor = nil
  5706.   end
  5707.  
  5708.   #--------------------------------------------------------------------------
  5709.   # ● Actor
  5710.   #--------------------------------------------------------------------------
  5711.   def actor=(actor)
  5712.       return if @actor == actor
  5713.       @actor = actor
  5714.       self.oy = 0
  5715.   end
  5716.  
  5717.   #--------------------------------------------------------------------------
  5718.   # ● Setup
  5719.   #--------------------------------------------------------------------------  
  5720.   def setup(actor,skill_type,index)
  5721.       @actor = actor
  5722.       @stype_id = skill_type
  5723.       @windows_index = index
  5724.       refresh
  5725.   end
  5726.  
  5727.   #--------------------------------------------------------------------------
  5728.   # ● Stype ID
  5729.   #--------------------------------------------------------------------------
  5730.   def stype_id=(stype_id)
  5731.   end
  5732.  
  5733.   #--------------------------------------------------------------------------
  5734.   # ● Col Max
  5735.   #--------------------------------------------------------------------------
  5736.   def col_max
  5737.       return 1
  5738.   end
  5739.  
  5740.   #--------------------------------------------------------------------------
  5741.   # ● Item Max
  5742.   #--------------------------------------------------------------------------
  5743.   def item_max
  5744.       @data ? @data.size : 1
  5745.   end
  5746.  
  5747.   #--------------------------------------------------------------------------
  5748.   # ● Item
  5749.   #--------------------------------------------------------------------------
  5750.   def item
  5751.       @data && index >= 0 ? @data[index] : nil
  5752.   end
  5753.  
  5754.   #--------------------------------------------------------------------------
  5755.   # ● Current Item Enabled
  5756.   #--------------------------------------------------------------------------
  5757.   def current_item_enabled?
  5758.       enable?(@data[index])
  5759.   end
  5760.  
  5761.   #--------------------------------------------------------------------------
  5762.   # ● Include
  5763.   #--------------------------------------------------------------------------
  5764.   def include?(item)
  5765.       item && item.stype_id == @stype_id
  5766.   end
  5767.  
  5768.   #--------------------------------------------------------------------------
  5769.   # ● Enable
  5770.   #--------------------------------------------------------------------------
  5771.   def enable?(item)
  5772.       @actor && @actor.usable?(item)
  5773.   end
  5774.  
  5775.   #--------------------------------------------------------------------------
  5776.   # ● Male Item List
  5777.   #--------------------------------------------------------------------------
  5778.   def make_item_list
  5779.       @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
  5780.   end
  5781.  
  5782.   #--------------------------------------------------------------------------
  5783.   # ● Select Last
  5784.   #--------------------------------------------------------------------------
  5785.   def select_last
  5786.       select(@data.index(@actor.last_skill.object) || 0)
  5787.   end
  5788.  
  5789.   #--------------------------------------------------------------------------
  5790.   # ● Draw Item
  5791.   #--------------------------------------------------------------------------
  5792.   def draw_item(index)
  5793.       self.contents.font.size = 18
  5794.       self.contents.font.bold = false
  5795.       skill = @data[index]
  5796.       if skill
  5797.          rect = item_rect(index)
  5798.          rect.width -= 4
  5799.          draw_item_name(skill, rect.x, rect.y, enable?(skill),110)
  5800.          draw_skill_cost(rect, skill)
  5801.       end
  5802.   end
  5803.  
  5804.   #--------------------------------------------------------------------------
  5805.   # ● Draw Skill Cost
  5806.   #--------------------------------------------------------------------------
  5807.   def draw_skill_cost(rect, skill)
  5808.       if @actor.skill_tp_cost(skill) > 0
  5809.          change_color(tp_cost_color, enable?(skill))
  5810.          draw_text(rect, @actor.skill_tp_cost(skill), 2)
  5811.       elsif @actor.skill_mp_cost(skill) > 0
  5812.          change_color(mp_cost_color, enable?(skill))
  5813.          draw_text(rect, @actor.skill_mp_cost(skill), 2)
  5814.       end
  5815.   end
  5816.  
  5817.   #--------------------------------------------------------------------------
  5818.   # ● Update Help
  5819.   #--------------------------------------------------------------------------
  5820.   def update_help
  5821.       @help_window.set_item(item)
  5822.   end
  5823.  
  5824.   #--------------------------------------------------------------------------
  5825.   # ● Refresh
  5826.   #--------------------------------------------------------------------------
  5827.   def refresh
  5828.       make_item_list
  5829.       create_contents
  5830.       draw_all_items
  5831.   end
  5832.  
  5833. end
  5834.  
  5835. #==============================================================================
  5836. # ■ Scene Skill
  5837. #==============================================================================
  5838. class Scene_Skill
  5839.  
  5840.   #--------------------------------------------------------------------------
  5841.   # ● Create Sprites
  5842.   #--------------------------------------------------------------------------          
  5843.   def create_sprites
  5844.       create_menu_background
  5845.       create_layout
  5846.       create_particles
  5847.       create_actor_status
  5848.       create_help_window
  5849.       create_command_window
  5850.       create_type_layout
  5851.       create_item_window
  5852.       create_list_layout
  5853.       create_actor_window
  5854.       create_type_name
  5855.       @command_window.active = true        
  5856.   end
  5857.  
  5858.   #--------------------------------------------------------------------------
  5859.   # ● Create Menu Background
  5860.   #--------------------------------------------------------------------------            
  5861.   def create_menu_background
  5862.       @background = Plane.new
  5863.       @background.bitmap = $game_temp.pre_cache_skill_menu[0]
  5864.       @background.z = 0
  5865.       @background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
  5866.   end  
  5867.  
  5868.   #--------------------------------------------------------------------------
  5869.   # ● Create Layout
  5870.   #--------------------------------------------------------------------------              
  5871.   def create_layout
  5872.       @layout = Sprite.new
  5873.       @layout.bitmap = $game_temp.pre_cache_skill_menu[1]
  5874.       @layout.z = 3
  5875.   end
  5876.  
  5877.   #--------------------------------------------------------------------------
  5878.   # ● Create Particles
  5879.   #--------------------------------------------------------------------------  
  5880.   def create_particles
  5881.       @particles_sprite =[]
  5882.       for i in 0...NUMBER_OF_PARTICLES
  5883.           @particles_sprite.push(Particles_Menu.new(nil))
  5884.       end
  5885.   end
  5886.  
  5887.   #--------------------------------------------------------------------------
  5888.   # ● Create Actor Status
  5889.   #--------------------------------------------------------------------------    
  5890.   def create_actor_status
  5891.       @actor_skill_status = Actor_Skill_Status.new(@actor)
  5892.   end  
  5893.  
  5894.   #--------------------------------------------------------------------------
  5895.   # ● Create Help Window
  5896.   #--------------------------------------------------------------------------              
  5897.   def create_help_window
  5898.       @help_window = Window_Help.new
  5899.       @help_window.x = 0
  5900.       @help_window.y = Graphics.height - @help_window.height
  5901.       @help_window.opacity = 0
  5902.   end    
  5903.  
  5904.   #--------------------------------------------------------------------------
  5905.   # ● Create Command Window
  5906.   #--------------------------------------------------------------------------
  5907.   def create_command_window
  5908.       @command_window = Window_SkillCommand_2.new(0, 84)
  5909.       @command_window.help_window = @help_window
  5910.       @command_window.actor = @actor
  5911.       @command_window.set_handler(:skill,    method(:command_skill))
  5912.       @command_window.set_handler(:pagedown, method(:next_actor))
  5913.       @command_window.set_handler(:pageup,   method(:prev_actor))
  5914.       @command_window.active = false
  5915.       @command_window.opacity = 0
  5916.       @command_window.index = 0
  5917.       @command_window.visible = @scene_active
  5918.       @skill_list_slide_range = [@command_window.x, -(@command_window.x + @command_window.width)]
  5919.       @command_window.x = @skill_list_slide_range[1] - 80
  5920.       @command_window.opacity = 0
  5921.   end  
  5922.  
  5923.   #--------------------------------------------------------------------------
  5924.   # ● Create Type Layout
  5925.   #--------------------------------------------------------------------------
  5926.   def create_type_layout
  5927.       @type_layout = Sprite.new
  5928.       @type_layout.bitmap = $game_temp.pre_cache_skill_menu[2]
  5929.       @type_layout.z = @command_window.z - 1
  5930.       @type_layout.x = @command_window.x
  5931.       @type_layout.y = @command_window.y - 30
  5932.       @type_layout.opacity = 0      
  5933.   end  
  5934.  
  5935.   #--------------------------------------------------------------------------
  5936.   # ● Create Item Window
  5937.   #--------------------------------------------------------------------------
  5938.   def create_item_window
  5939.       @skill_window = []
  5940.       index = 0
  5941.       window_max = @actor.added_skill_types.size
  5942.       window_max = 1 if window_max == 0
  5943.       for item in 0...window_max
  5944.           @skill_window.push(Window_SkillList_Menu.new(196,95,205,240))
  5945.           @skill_window[index].setup(@actor,@actor.added_skill_types[index],index)
  5946.           @skill_window[index].help_window = @help_window
  5947.           @skill_window[index].set_handler(:ok,     method(:on_item_ok))
  5948.           @skill_window[index].set_handler(:cancel, method(:on_item_cancel))
  5949.           @skill_window[index].active = false
  5950.           @skill_window[index].index = -1
  5951.           @skill_window[index].opacity = 0
  5952.           @skill_window[index].contents_opacity = 0
  5953.           @item_slide_range = [@skill_window[index].x, @skill_window[index].x + 50]
  5954.           @skill_window[index].x = @item_slide_range[1]
  5955.           index += 1
  5956.       end  
  5957.       @item_pre_index = @skill_window[@command_window.index].index
  5958.       @old_command_index = @skill_window[@command_window.index].index
  5959.   end  
  5960.  
  5961.   #--------------------------------------------------------------------------
  5962.   # ● Create List Layout
  5963.   #--------------------------------------------------------------------------  
  5964.   def create_list_layout
  5965.       @list_layout = Sprite.new
  5966.       @list_layout.bitmap = $game_temp.pre_cache_skill_menu[3]
  5967.       @list_layout.z = @skill_window[@command_window.index].z - 1
  5968.       @list_layout.x = @item_slide_range[0] - 4
  5969.       @list_layout.y = @skill_window[@command_window.index].y - 20
  5970.       @list_layout.opacity = 0
  5971.       @list_layout_slide_range = [@list_layout.x,@list_layout.x + 50]
  5972.       @list_layout.x = @list_layout_slide_range[1]
  5973.   end
  5974.  
  5975.   #--------------------------------------------------------------------------
  5976.   # ● Create Actor Window
  5977.   #--------------------------------------------------------------------------
  5978.   def create_actor_window
  5979.       @actor_window = Members_Windows_Status.new
  5980.       @actor_window.set_handler(:ok,     method(:on_actor_ok))
  5981.       @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  5982.       @actor_window.opacity = 0
  5983.       @actor_window.x = -10
  5984.       @actor_window.y = 36
  5985.       @actor_window_slide_range = [@actor_window.x, -@actor_window.width]
  5986.       @actor_window.x = @actor_window_slide_range[1]
  5987.       @actor_window.visible = true
  5988.       @actor_window_index_old = @actor_window.index
  5989.       create_members_window
  5990.       update_active
  5991.   end
  5992.  
  5993.   #--------------------------------------------------------------------------
  5994.   # ● Create Members Window
  5995.   #--------------------------------------------------------------------------  
  5996.   def create_members_window
  5997.       @actor_status = Actor_Menu_Status.new(@actor)
  5998.       index = 0
  5999.       @members_status = []      
  6000.       for actor in $game_party.members
  6001.           @members_status.push(Members_Menu.new(actor,index))
  6002.           index += 1
  6003.       end    
  6004.   end  
  6005.  
  6006.   #--------------------------------------------------------------------------
  6007.   # ● Create Type Name
  6008.   #--------------------------------------------------------------------------  
  6009.   def create_type_name
  6010.       @type_name = Sprite.new
  6011.       @type_name.x = 160
  6012.       @type_name.y = 60
  6013.       @type_name.z = @list_layout.z + 2
  6014.       @type_name.bitmap = Bitmap.new(100,32)
  6015.       @type_name.bitmap.font.size = 18
  6016.       @type_name.bitmap.font.bold = false
  6017.       @type_name.opacity = 0
  6018.       refresh_type_name
  6019.   end
  6020.  
  6021.   #--------------------------------------------------------------------------
  6022.   # ● Refresh Type Name
  6023.   #--------------------------------------------------------------------------  
  6024.   def refresh_type_name
  6025.      @type_name.bitmap.clear
  6026.      return if !@scene_active
  6027.      stype_id = @actor.added_skill_types[@command_window.index]
  6028.      type_name = $data_system.skill_types[stype_id]
  6029.      @type_name.bitmap.draw_text(0,0,100,32,type_name,2)
  6030.   end
  6031.  
  6032. end
  6033.  
  6034. #==============================================================================
  6035. # ■ Scene_Skill
  6036. #==============================================================================
  6037. class Scene_Skill
  6038.  
  6039.   #--------------------------------------------------------------------------
  6040.   # ● Execute Dispose
  6041.   #--------------------------------------------------------------------------        
  6042.   def execute_dispose
  6043.       Graphics.freeze
  6044.       dispose_background
  6045.       dispose_layout
  6046.       dispose_list_layout
  6047.       dispose_particles
  6048.       dispose_windows
  6049.       dispose_members_status
  6050.       dispose_type_name
  6051.   end
  6052.  
  6053.   #--------------------------------------------------------------------------
  6054.   # ● Dispose Background
  6055.   #--------------------------------------------------------------------------  
  6056.   def dispose_background
  6057.       return if @background == nil
  6058.       @background.dispose
  6059.       @background = nil
  6060.   end
  6061.    
  6062.  
  6063.   #--------------------------------------------------------------------------
  6064.   # ● Dispose Layout
  6065.   #--------------------------------------------------------------------------                
  6066.   def dispose_layout
  6067.       return if @layout == nil
  6068.       @layout.dispose
  6069.       @layout = nil
  6070.   end  
  6071.  
  6072.  #--------------------------------------------------------------------------
  6073.  # ● Dispose Particles
  6074.  #--------------------------------------------------------------------------    
  6075.  def dispose_particles
  6076.      return if @particles_sprite == nil
  6077.      @particles_sprite.each {|sprite| sprite.dispose }
  6078.  end  
  6079.  
  6080.  #--------------------------------------------------------------------------
  6081.  # ● Dispose Window
  6082.  #--------------------------------------------------------------------------    
  6083.  def dispose_windows
  6084.      return if @command_window == nil
  6085.      @skill_window.each {|sprite| sprite.dispose }
  6086.      @command_window.dispose
  6087.      @actor_window.dispose
  6088.      @help_window.dispose
  6089.  end
  6090.    
  6091.  #--------------------------------------------------------------------------
  6092.  # ● Dispose List Layout
  6093.  #--------------------------------------------------------------------------      
  6094.  def dispose_list_layout
  6095.      return if @list_layout == nil
  6096.      @list_layout.dispose
  6097.      @type_layout.dispose
  6098.      @list_layout = nil
  6099.  end
  6100.      
  6101.   #--------------------------------------------------------------------------
  6102.   # ● Dispose Members Status
  6103.   #--------------------------------------------------------------------------            
  6104.   def dispose_members_status
  6105.       return if @members_status == nil
  6106.       @actor_status.dispose
  6107.       @actor_skill_status.dispose
  6108.       @members_status.each {|sprite| sprite.dispose }
  6109.   end  
  6110.  
  6111.   #--------------------------------------------------------------------------
  6112.   # ● Dispose Type Name
  6113.   #--------------------------------------------------------------------------    
  6114.   def dispose_type_name
  6115.       @type_name.bitmap.dispose
  6116.       @type_name.dispose
  6117.   end  
  6118.  
  6119. end
  6120.  
  6121. #==============================================================================
  6122. # ■ Scene Skill
  6123. #==============================================================================
  6124. class Scene_Skill
  6125.  
  6126.   #--------------------------------------------------------------------------
  6127.   # ● Update Sprites
  6128.   #--------------------------------------------------------------------------          
  6129.   def update_sprites    
  6130.       update_background
  6131.       update_particles    
  6132.       update_actor_status
  6133.       update_slide_item
  6134.       update_members_status
  6135.       update_windows
  6136.   end
  6137.  
  6138.   #--------------------------------------------------------------------------
  6139.   # ● Update Background
  6140.   #--------------------------------------------------------------------------              
  6141.   def update_background
  6142.       return if @background == nil
  6143.       @background.ox += @background_scroll[0]
  6144.       @background.oy += @background_scroll[1]
  6145.   end    
  6146.  
  6147.   #--------------------------------------------------------------------------
  6148.   # ● Update Particles
  6149.   #--------------------------------------------------------------------------  
  6150.   def update_particles
  6151.       return if @particles_sprite == nil
  6152.       @particles_sprite.each {|sprite| sprite.update }
  6153.   end
  6154.  
  6155.   #--------------------------------------------------------------------------
  6156.   # ● Update Windows
  6157.   #--------------------------------------------------------------------------    
  6158.   def update_windows
  6159.       @press_lag -= 1 if @press_lag > 0
  6160.       return if @command_window == nil
  6161.       for skw in @skill_window
  6162.           skw.update unless @press_lag > 0
  6163.           if skw.windows_index == @command_window.index
  6164.              skw.active = true
  6165.              if @phase == 0
  6166.                 skw.index = 0 if skw.index < 0 or skw.index >= skw.item_max
  6167.              end  
  6168.              skw.visible = true
  6169.           else  
  6170.              skw.visible = false
  6171.              skw.active = false
  6172.           end  
  6173.       end
  6174.       #@skill_window[@command_window.index].update
  6175.       @command_window.update    
  6176.       @actor_window.update
  6177.       update_actor_window_slide
  6178.       update_skill_list_slide
  6179.   end
  6180.  
  6181.   #--------------------------------------------------------------------------
  6182.   # ● Update Skill List Slide
  6183.   #--------------------------------------------------------------------------      
  6184.   def update_skill_list_slide
  6185.       return if @phase == 999
  6186.       if @actor_window.active or !@command_window.active
  6187.          if @command_window.x > @skill_list_slide_range[1]
  6188.             @command_window.x -= 15
  6189.             @command_window.x = @skill_list_slide_range[1] if @command_window.x < @skill_list_slide_range[1]
  6190.          end  
  6191.       else
  6192.          if @command_window.x < @skill_list_slide_range[0]
  6193.             @command_window.x += 15
  6194.             @command_window.x = @skill_list_slide_range[0] if @command_window.x > @skill_list_slide_range[0]
  6195.          end        
  6196.       end  
  6197.       @type_layout.x = @command_window.x
  6198.   end
  6199.      
  6200.   #--------------------------------------------------------------------------
  6201.   # ● Update Actor Window Slide
  6202.   #--------------------------------------------------------------------------  
  6203.   def update_actor_window_slide
  6204.       if @actor_window.active
  6205.          if @actor_window.x < @actor_window_slide_range[0]
  6206.             @actor_window.x += 15
  6207.             @actor_window.contents_opacity += 23
  6208.             if @actor_window.x >= @actor_window_slide_range[0]
  6209.                @actor_window.x = @actor_window_slide_range[0]
  6210.                @actor_window.contents_opacity = 255
  6211.             end  
  6212.          end  
  6213.       else          
  6214.          if @actor_window.x >= @actor_window_slide_range[1]
  6215.             @actor_window.x -= 15
  6216.             @actor_window.contents_opacity -= 3
  6217.             if @actor_window.x <= @actor_window_slide_range[1]
  6218.                @actor_window.x = @actor_window_slide_range[1]
  6219.                @actor_window.contents_opacity = 0
  6220.             end          
  6221.          end
  6222.       end
  6223.   end    
  6224.  
  6225.   #--------------------------------------------------------------------------
  6226.   # ● Update Actor Status
  6227.   #--------------------------------------------------------------------------                
  6228.   def update_actor_status
  6229.       refresh_actor_status(true) if @actor_window_index_old != @actor_window.index
  6230.   end  
  6231.    
  6232.   #--------------------------------------------------------------------------
  6233.   # ● Refresh Actor Status
  6234.   #--------------------------------------------------------------------------                
  6235.   def refresh_actor_status(reset = false)
  6236. #      @actor = $game_party.members[@actor_window.index]
  6237. #      @actor_window_index_old = @actor_window.index
  6238.   end  
  6239.  
  6240.   #--------------------------------------------------------------------------
  6241.   # ● Update Slide Item
  6242.   #--------------------------------------------------------------------------  
  6243.   def update_slide_item
  6244.       if @phase == 0
  6245.          @command_window.contents_opacity += 10
  6246.       else  
  6247.          @command_window.contents_opacity -= 10 if @command_window.contents_opacity > 160
  6248.       end  
  6249.       @type_layout.opacity = @command_window.contents_opacity
  6250.       @type_name.opacity = @skill_window[@command_window.index].contents_opacity
  6251.       if @phase == 1
  6252.          @skill_window[@command_window.index].contents_opacity += 5
  6253.          @list_layout.opacity += 5
  6254.       else  
  6255.          @skill_window[@command_window.index].contents_opacity -= 10 if @skill_window[@command_window.index].contents_opacity > 165
  6256.          @list_layout.opacity -= 10 if @list_layout.opacity > 160
  6257.       end  
  6258.       if @skill_window[@command_window.index].x > @item_slide_range[0]
  6259.          @skill_window[@command_window.index].x -= 3
  6260.          @list_layout.x -= 3
  6261.          if @skill_window[@command_window.index].x <= @item_slide_range[0]
  6262.             @skill_window[@command_window.index].x = @item_slide_range[0]
  6263.             @list_layout.x = @list_layout_slide_range[0]
  6264.          end  
  6265.       end  
  6266.   end    
  6267.  
  6268.   #--------------------------------------------------------------------------
  6269.   # ● Update Members Status
  6270.   #--------------------------------------------------------------------------            
  6271.   def update_members_status
  6272.       for members in @members_status
  6273.           members.update(@actor_window.active,@actor_window.index)
  6274.           @actor_2 = members.actor if members.current_actor
  6275.       end  
  6276.       @actor_2 = @actor if @actor_2 == nil
  6277.       @actor_skill_status.update
  6278.       @actor_status.update(@actor_window.active,@actor_2)
  6279.       #@members_status.each {|sprite| sprite.update(@actor_window.active,@actor_window.index) }
  6280.   end  
  6281.  
  6282. end
  6283.  
  6284. #==============================================================================
  6285. # ■ Scene_Skill
  6286. #==============================================================================
  6287. class Scene_Skill
  6288.  
  6289.   #--------------------------------------------------------------------------
  6290.   # ● Update
  6291.   #--------------------------------------------------------------------------      
  6292.   def update
  6293.       unless @skill_window[@command_window.index].index < 0
  6294.           @item_pre_index = @skill_window[@command_window.index].index
  6295.       end    
  6296.       update_command
  6297.       update_sprites
  6298.   end
  6299.    
  6300.   #--------------------------------------------------------------------------
  6301.   # ● Show Sub Window
  6302.   #--------------------------------------------------------------------------
  6303.   def show_sub_window(window)
  6304.       window.show.activate
  6305.   end
  6306.   #--------------------------------------------------------------------------
  6307.   # ● Hide Sub Window
  6308.   #--------------------------------------------------------------------------
  6309.   def hide_sub_window(window)
  6310.       window.hide.deactivate
  6311.       activate_item_window    
  6312.   end
  6313.  
  6314.   #--------------------------------------------------------------------------
  6315.   # ● Determine Item
  6316.   #--------------------------------------------------------------------------
  6317.   def determine_item
  6318.       if item.for_friend?        
  6319.          @phase = 2
  6320.          show_sub_window(@actor_window)
  6321.          @actor_window.select_for_item(item)    
  6322.          $game_temp.item_scope = @skill_window[@command_window.index].item.scope rescue nil
  6323.       else
  6324.          use_item
  6325.          activate_item_window
  6326.       end
  6327.   end  
  6328.  
  6329.   #--------------------------------------------------------------------------
  6330.   # ● ON Item OK
  6331.   #--------------------------------------------------------------------------
  6332.   def on_item_ok
  6333.       return if @press_time > 1
  6334.       @actor.last_skill.object = item
  6335.       determine_item
  6336.   end
  6337.  
  6338.   #--------------------------------------------------------------------------
  6339.   # ● Item
  6340.   #--------------------------------------------------------------------------
  6341.   def item
  6342.     @skill_window[@command_window.index].item
  6343.   end  
  6344.  
  6345.   #--------------------------------------------------------------------------
  6346.   # ● Use Item
  6347.   #--------------------------------------------------------------------------
  6348.   def use_item
  6349.       super
  6350.       @skill_window[@command_window.index].refresh if can_refresh_item_window?
  6351.   end  
  6352.  
  6353.   #--------------------------------------------------------------------------
  6354.   # ● Activate Item Window
  6355.   #--------------------------------------------------------------------------
  6356.   def activate_item_window    
  6357.     @skill_window[@command_window.index].refresh if can_refresh_item_window?
  6358.     @skill_window[@command_window.index].activate
  6359.   end  
  6360.  
  6361.   #--------------------------------------------------------------------------
  6362.   # ● On Item Cancel
  6363.   #--------------------------------------------------------------------------
  6364.   def on_item_cancel
  6365.       @skill_window[@command_window.index].unselect
  6366.       @command_window.activate
  6367.   end  
  6368.  
  6369.   #--------------------------------------------------------------------------
  6370.   # ● Can Refresh Item Window
  6371.   #--------------------------------------------------------------------------  
  6372.   def can_refresh_item_window?
  6373.       return true if @actor.mp < @skill_window[@command_window.index].item.mp_cost
  6374.       return true if @actor.tp < @skill_window[@command_window.index].item.tp_cost
  6375.       return false
  6376.   end
  6377.      
  6378. end
  6379.  
  6380. #==============================================================================
  6381. # ■ Scene_Item
  6382. #==============================================================================
  6383. class Scene_Skill
  6384.  
  6385.   #--------------------------------------------------------------------------
  6386.   # ● Update Command
  6387.   #--------------------------------------------------------------------------      
  6388.   def update_command
  6389.       @skill_window[@command_window.index].index = @item_pre_index        
  6390.       if @phase == 0
  6391.          update_main_command
  6392.       elsif @phase == 1
  6393.          update_item_window
  6394.       elsif @phase == 2        
  6395.          update_target_window
  6396.       end        
  6397.       update_active
  6398.   end
  6399.  
  6400.   #--------------------------------------------------------------------------
  6401.   # ● Command Skill
  6402.   #--------------------------------------------------------------------------
  6403.   def command_skill
  6404.       @skill_window[@command_window.index].activate
  6405.       @skill_window[@command_window.index].select_last
  6406.    # @item_window.activate
  6407.    # @item_window.select_last
  6408.   end  
  6409.  
  6410.   #--------------------------------------------------------------------------
  6411.   # ● Update Active
  6412.   #--------------------------------------------------------------------------      
  6413.   def update_active
  6414.       if @phase == 0
  6415.          @skill_window[@command_window.index].active = false
  6416.          @command_window.active = true
  6417.          @actor_window.active = false
  6418.       elsif @phase == 1
  6419.          @skill_window[@command_window.index].active = true
  6420.          @command_window.active = false
  6421.          @actor_window.active = false
  6422.       elsif @phase == 2
  6423.          @skill_window[@command_window.index].active = false
  6424.          @command_window.active = false
  6425.          @actor_window.active = true
  6426.       end
  6427.   end
  6428.  
  6429.   #--------------------------------------------------------------------------
  6430.   # ● Update Main Command
  6431.   #--------------------------------------------------------------------------        
  6432.   def update_main_command
  6433.       reset_item_index
  6434.       if Input.trigger?(:C) and @scene_active
  6435.          Sound.play_ok
  6436.          @phase = 1
  6437.          @press_time = 2
  6438.          @press_lag = 2
  6439.          @skill_window[@command_window.index].index = 0 if @skill_window[@command_window.index].index == -1
  6440.       elsif Input.trigger?(:B)
  6441.          return_scene
  6442.       end  
  6443.   end
  6444.  
  6445.   #--------------------------------------------------------------------------
  6446.   # ● Return Scene
  6447.   #--------------------------------------------------------------------------          
  6448.   def return_scene
  6449.       Sound.play_cancel
  6450.       SceneManager.return
  6451.     end
  6452.  
  6453.   #--------------------------------------------------------------------------
  6454.   # ● ON Actor Charge
  6455.   #--------------------------------------------------------------------------
  6456.   def on_actor_change
  6457.       @phase = 999
  6458.       $game_temp.actor_menu_temp = @actor
  6459.       SceneManager.goto(Scene_Skill)
  6460.   end
  6461.  
  6462.   #--------------------------------------------------------------------------
  6463.   # ● Reset Item Index
  6464.   #--------------------------------------------------------------------------            
  6465.   def reset_item_index
  6466.        return if @old_command_index == @command_window.index
  6467.        return if @command_window.index == -1
  6468.        @old_command_index = @command_window.index
  6469.        refresh_type_name
  6470.        reset_item_position
  6471.   end  
  6472.  
  6473.   #--------------------------------------------------------------------------
  6474.   # ● Reset Item Position
  6475.   #--------------------------------------------------------------------------              
  6476.   def reset_item_position
  6477.       @skill_window[@command_window.index].x = @item_slide_range[1]
  6478.       @skill_window[@command_window.index].contents_opacity = 160
  6479.       @list_layout.x = @list_layout_slide_range[1]
  6480.       @list_layout.opacity = 160
  6481.   end  
  6482.  
  6483. end
  6484.  
  6485. #==============================================================================
  6486. # ■ Scene_Skill
  6487. #==============================================================================
  6488. class Scene_Skill
  6489.  
  6490.   #--------------------------------------------------------------------------
  6491.   # ● Update Item Window
  6492.   #--------------------------------------------------------------------------                
  6493.   def update_item_window
  6494.       @press_time -= 1 if @press_time > 0
  6495.       update_item_command
  6496.       update_index_type
  6497.   end
  6498.  
  6499.   #--------------------------------------------------------------------------
  6500.   # ● Update Main Command
  6501.   #--------------------------------------------------------------------------        
  6502.   def update_item_command
  6503.       if Input.trigger?(:B)
  6504.          @phase = 0
  6505.          Sound.play_cancel
  6506.       end  
  6507.   end  
  6508.  
  6509.   #--------------------------------------------------------------------------
  6510.   # ● Update
  6511.   #--------------------------------------------------------------------------  
  6512.   def update_index_type
  6513.       return if @index_max <= 0
  6514.       return if @command_window == nil
  6515.       if Input.trigger?(:RIGHT)
  6516.          add_index(1)
  6517.       elsif Input.trigger?(:LEFT)    
  6518.          add_index(-1)
  6519.       end  
  6520.   end
  6521.  
  6522.   #--------------------------------------------------------------------------
  6523.   # ● Add Index
  6524.   #--------------------------------------------------------------------------    
  6525.   def add_index(value)
  6526.       Sound.play_cursor      
  6527.       @command_window.index += value
  6528.       @command_window.index = 0 if @command_window.index > @index_max
  6529.       @command_window.index = @index_max if @command_window.index < 0
  6530.       reset_item_index
  6531.   end    
  6532.  
  6533. end
  6534.  
  6535. #==============================================================================
  6536. # ■ Scene_Skill
  6537. #==============================================================================
  6538. class Scene_Skill
  6539.  
  6540.   #--------------------------------------------------------------------------
  6541.   # ● Update Item Window
  6542.   #--------------------------------------------------------------------------                
  6543.   def update_target_window
  6544.       update_target_command
  6545.   end
  6546.  
  6547.   #--------------------------------------------------------------------------
  6548.   # ● Update Main Command
  6549.   #--------------------------------------------------------------------------        
  6550.   def update_target_command
  6551.       if Input.trigger?(:B)
  6552.          @phase = 1
  6553.          @skill_window[@command_window.index].index = @item_pre_index
  6554.        end  
  6555.   end  
  6556.  
  6557. end
  6558.  
  6559.  
  6560. #==============================================================================
  6561. # ■ Game_Temp
  6562. #==============================================================================
  6563. class Game_Temp
  6564.  
  6565.   #--------------------------------------------------------------------------
  6566.   # ● Execute Pre Cache Skill Menu
  6567.   #--------------------------------------------------------------------------    
  6568.   def execute_pre_cache_equip_menu
  6569.       @pre_cache_equip_menu = []
  6570.       @pre_cache_equip_menu.push(Cache.menu_equip("Background"))
  6571.       @pre_cache_equip_menu.push(Cache.menu_equip("Layout_U"))
  6572.       @pre_cache_equip_menu.push(Cache.menu_equip("Layout_R"))
  6573.       @pre_cache_equip_menu.push(Cache.menu_equip("Layout_D"))
  6574.       @pre_cache_equip_menu.push(Cache.menu_equip("Layout_L"))
  6575.       @pre_cache_equip_menu.push(Cache.menu_equip("Par_Number"))
  6576.   end    
  6577.    
  6578. end
  6579.  
  6580. #==============================================================================
  6581. # ■ Scene_Skill
  6582. #==============================================================================
  6583. class Scene_Equip
  6584.   include MOG_MENU_EQUIP
  6585.   include MOG_MENU_BASE
  6586.  
  6587.   #--------------------------------------------------------------------------
  6588.   # ● Main
  6589.   #--------------------------------------------------------------------------        
  6590.   def main
  6591.       execute_setup
  6592.       execute_loop
  6593.       execute_dispose
  6594.   end  
  6595.  
  6596.   #--------------------------------------------------------------------------
  6597.   # ● Execute Setup
  6598.   #--------------------------------------------------------------------------        
  6599.   def execute_setup
  6600.       @actor = $game_temp.actor_menu_temp
  6601.       @actor_old = @actor
  6602.       @phase = 0
  6603.       create_sprites
  6604.   end
  6605.  
  6606.   #--------------------------------------------------------------------------
  6607.   # ● Execute Lopp
  6608.   #--------------------------------------------------------------------------        
  6609.   def execute_loop
  6610.       Graphics.transition(10)
  6611.       loop do
  6612.          Input.update
  6613.          update
  6614.          Graphics.update
  6615.          break if SceneManager.scene != self
  6616.       end
  6617.   end
  6618.  
  6619. end
  6620.  
  6621. #==============================================================================
  6622. # ■ Window_EquipStatus
  6623. #==============================================================================
  6624. class Window_EquipStatus < Window_Base
  6625.  
  6626.   #--------------------------------------------------------------------------
  6627.   # ● Initializee
  6628.   #--------------------------------------------------------------------------
  6629.   def initialize(x, y)
  6630.       super(x, y, window_width, window_height)
  6631.       @actor = nil
  6632.       @temp_actor = nil
  6633.       self.visible = false
  6634.   end
  6635.  
  6636.   #--------------------------------------------------------------------------
  6637.   # ● Window Width
  6638.   #--------------------------------------------------------------------------
  6639.   def window_width
  6640.       return 208
  6641.   end
  6642.  
  6643.   #--------------------------------------------------------------------------
  6644.   # ● Window Height
  6645.   #--------------------------------------------------------------------------
  6646.   def window_height
  6647.       return 296
  6648.   end
  6649.  
  6650.   #--------------------------------------------------------------------------
  6651.   # ● Visible Line Number
  6652.   #--------------------------------------------------------------------------
  6653.   def visible_line_number
  6654.       return 1
  6655.   end
  6656.   #--------------------------------------------------------------------------
  6657.   # ● Actor
  6658.   #--------------------------------------------------------------------------
  6659.   def actor=(actor)
  6660.       return if @actor == actor
  6661.       @actor = actor
  6662.   end
  6663.  
  6664.   #--------------------------------------------------------------------------
  6665.   # ● Refresh
  6666.   #--------------------------------------------------------------------------
  6667.   def refresh
  6668.       contents.clear
  6669.   end
  6670.  
  6671.   #--------------------------------------------------------------------------
  6672.   # ● Set Temp Actor
  6673.   #--------------------------------------------------------------------------
  6674.   def set_temp_actor(temp_actor)
  6675.       return if @temp_actor == temp_actor
  6676.       @temp_actor = temp_actor
  6677.       $game_temp.temp_actor_equip = @temp_actor
  6678.   end
  6679.  
  6680. end
  6681.  
  6682. #==============================================================================
  6683. # ■ Window_EquipCommand
  6684. #==============================================================================
  6685. class Window_EquipCommand < Window_HorzCommand
  6686.  
  6687.   #--------------------------------------------------------------------------
  6688.   # ● Initialize
  6689.   #--------------------------------------------------------------------------
  6690.   def initialize(x, y, width)
  6691.       @window_width = width
  6692.       super(x, y)
  6693.   end
  6694.  
  6695.   #--------------------------------------------------------------------------
  6696.   # ● Window Width
  6697.   #--------------------------------------------------------------------------
  6698.   def window_width
  6699.       @window_width
  6700.   end
  6701.  
  6702.   #--------------------------------------------------------------------------
  6703.   # ● Col Max
  6704.   #--------------------------------------------------------------------------
  6705.   def col_max
  6706.       return 3
  6707.   end
  6708.  
  6709.   #--------------------------------------------------------------------------
  6710.   # ● Make Command List
  6711.   #--------------------------------------------------------------------------
  6712.   def make_command_list
  6713.       add_command(Vocab::equip2,   :equip)
  6714.       add_command(Vocab::optimize, :optimize)
  6715.       add_command(Vocab::clear,    :clear)
  6716.   end
  6717.  
  6718.   #--------------------------------------------------------------------------
  6719.   # ● Draw Item
  6720.   #--------------------------------------------------------------------------  
  6721.   def draw_item(index)
  6722.   end  
  6723.  
  6724. end
  6725.  
  6726. #==============================================================================
  6727. # ■ Window_EquipSlot
  6728. #==============================================================================
  6729. class Window_EquipSlot < Window_Selectable
  6730.  
  6731.   attr_reader   :status_window        
  6732.   attr_reader   :item_window
  6733.  
  6734.   include MOG_MENU_EQUIP
  6735.  
  6736.   #--------------------------------------------------------------------------
  6737.   # ● Set Equip Font
  6738.   #--------------------------------------------------------------------------          
  6739.   def set_font_equip
  6740.       return if self.disposed?
  6741.       return if self.contents == nil
  6742.       self.contents.font.size = FONT_SIZE
  6743.       self.contents.font.bold = FONT_BOLD
  6744.   end  
  6745.  
  6746.   #--------------------------------------------------------------------------
  6747.   # ● Initialize
  6748.   #--------------------------------------------------------------------------
  6749.   def initialize(x, y, width)
  6750.       super(x, y, width, window_height)
  6751.       @actor = nil    
  6752.       refresh
  6753.   end
  6754.  
  6755.   #--------------------------------------------------------------------------
  6756.   # ● Window Height
  6757.   #--------------------------------------------------------------------------
  6758.   def window_height
  6759.       fitting_height(visible_line_number)
  6760.   end
  6761.  
  6762.   #--------------------------------------------------------------------------
  6763.   # ● Visible Line Number
  6764.   #--------------------------------------------------------------------------
  6765.   def visible_line_number
  6766.       return 5
  6767.   end
  6768.  
  6769.   #--------------------------------------------------------------------------
  6770.   # ● Actor
  6771.   #--------------------------------------------------------------------------
  6772.   def actor=(actor)
  6773.       return if @actor == actor
  6774.       @actor = actor
  6775.       refresh
  6776.   end
  6777.  
  6778.   #--------------------------------------------------------------------------
  6779.   # ● Update
  6780.   #--------------------------------------------------------------------------
  6781.   def update
  6782.       super
  6783.       @item_window.slot_id = index if @item_window
  6784.   end
  6785.  
  6786.   #--------------------------------------------------------------------------
  6787.   # ● Item Max
  6788.   #--------------------------------------------------------------------------
  6789.   def item_max
  6790.       @actor ? @actor.equip_slots.size : 0
  6791.   end
  6792.  
  6793.   #--------------------------------------------------------------------------
  6794.   # ● Item
  6795.   #--------------------------------------------------------------------------
  6796.   def item
  6797.       @actor ? @actor.equips[index] : nil
  6798.   end
  6799.  
  6800.   #--------------------------------------------------------------------------
  6801.   # ● Draw Item
  6802.   #--------------------------------------------------------------------------
  6803.   def draw_item(index)
  6804.       return unless @actor
  6805.       rect = item_rect_for_text(index)
  6806.       change_color(system_color, enable?(index))
  6807.       set_font_equip
  6808.       draw_item_name(@actor.equips[index], rect.x + 92, rect.y, enable?(index))
  6809.   end
  6810.  
  6811.   #--------------------------------------------------------------------------
  6812.   # ● Slot Name
  6813.   #--------------------------------------------------------------------------
  6814.   def slot_name(index)
  6815.       @actor ? Vocab::etype(@actor.equip_slots[index]) : ""
  6816.   end
  6817.  
  6818.   #--------------------------------------------------------------------------
  6819.   # ● Enable
  6820.   #--------------------------------------------------------------------------
  6821.   def enable?(index)
  6822.       @actor ? @actor.equip_change_ok?(index) : false
  6823.   end
  6824.  
  6825.   #--------------------------------------------------------------------------
  6826.   # ● Current Item Enabled
  6827.   #--------------------------------------------------------------------------
  6828.   def current_item_enabled?
  6829.     enable?(index)
  6830.   end
  6831.  
  6832.   #--------------------------------------------------------------------------
  6833.   # ● Status  Window
  6834.   #--------------------------------------------------------------------------
  6835.   def status_window=(status_window)
  6836.       @status_window = status_window
  6837.       call_update_help
  6838.   end
  6839.  
  6840.   #--------------------------------------------------------------------------
  6841.   # ● Item Window
  6842.   #--------------------------------------------------------------------------
  6843.   def item_window=(item_window)
  6844.       @item_window = item_window
  6845.       update
  6846.   end
  6847.  
  6848.   #--------------------------------------------------------------------------
  6849.   # ● Update Help
  6850.   #--------------------------------------------------------------------------
  6851.   def update_help
  6852.       super
  6853.       @help_window.set_item(item) if @help_window
  6854.       $game_temp.temp_actor_equip = nil if @status_window
  6855.   end
  6856.  
  6857. end
  6858.  
  6859. #==============================================================================
  6860. # ■ Window_EquipItem
  6861. #==============================================================================
  6862. class Window_EquipItem_Menu < Window_ItemList
  6863.  
  6864.   attr_reader   :status_window  
  6865.   attr_accessor :windows_index
  6866.  
  6867.   include MOG_MENU_EQUIP
  6868.  
  6869.   #--------------------------------------------------------------------------
  6870.   # ● Set Equip Font
  6871.   #--------------------------------------------------------------------------          
  6872.   def set_font_equip
  6873.       return if self.disposed?
  6874.       return if self.contents == nil
  6875.       self.contents.font.size = FONT_SIZE
  6876.       self.contents.font.bold = FONT_BOLD
  6877.   end  
  6878.  
  6879.   #--------------------------------------------------------------------------
  6880.   # ● Initialize
  6881.   #--------------------------------------------------------------------------
  6882.   def initialize(x, y, width, height)
  6883.       super
  6884.       @actor = nil
  6885.       @slot_id = 0
  6886.       @windows_index = 0
  6887.       self.visible = false
  6888.       self.opacity = 0
  6889.   end
  6890.  
  6891.   #--------------------------------------------------------------------------
  6892.   # ● Col Max
  6893.   #--------------------------------------------------------------------------
  6894.   def col_max
  6895.       return 1
  6896.   end  
  6897.  
  6898.   #--------------------------------------------------------------------------
  6899.   # ● Actor
  6900.   #--------------------------------------------------------------------------
  6901.   def actor=(actor)
  6902.       return if @actor == actor
  6903.       @actor = actor
  6904.       self.oy = 0
  6905.   end
  6906.  
  6907.   #--------------------------------------------------------------------------
  6908.   # ● Setup
  6909.   #--------------------------------------------------------------------------  
  6910.   def setup(actor,equip_type,index)
  6911.       @actor = actor
  6912.       @slot_id = equip_type
  6913.       @windows_index = index      
  6914.       refresh
  6915.   end  
  6916.  
  6917.   #--------------------------------------------------------------------------
  6918.   # ● Slot ID
  6919.   #--------------------------------------------------------------------------
  6920.   def slot_id=(slot_id)
  6921.   end
  6922.  
  6923.   #--------------------------------------------------------------------------
  6924.   # ● Include?
  6925.   #--------------------------------------------------------------------------
  6926.   def include?(item)
  6927.       return true if item == nil
  6928.       return false unless item.is_a?(RPG::EquipItem)
  6929.       return false if @slot_id < 0
  6930.       return false if item.etype_id != @actor.equip_slots[@slot_id]
  6931.       return @actor.equippable?(item)
  6932.   end
  6933.  
  6934.   #--------------------------------------------------------------------------
  6935.   # ● Enable?
  6936.   #--------------------------------------------------------------------------
  6937.   def enable?(item)
  6938.       return true
  6939.   end
  6940.  
  6941.   #--------------------------------------------------------------------------
  6942.   # ● Select Last
  6943.   #--------------------------------------------------------------------------
  6944.   def select_last
  6945.   end
  6946.  
  6947.   #--------------------------------------------------------------------------
  6948.   # ● Status Window
  6949.   #--------------------------------------------------------------------------
  6950.   def status_window=(status_window)
  6951.       @status_window = status_window
  6952.       call_update_help
  6953.   end
  6954.  
  6955.   #--------------------------------------------------------------------------
  6956.   # ● Update Help
  6957.   #--------------------------------------------------------------------------
  6958.   def update_help
  6959.       super
  6960.       if @actor && @status_window
  6961.          temp_actor = Marshal.load(Marshal.dump(@actor))
  6962.          temp_actor.force_change_equip(@slot_id, item)
  6963.          $game_temp.temp_actor_equip = temp_actor
  6964.       end
  6965.   end
  6966.    
  6967.   #--------------------------------------------------------------------------
  6968.   # ● Draw Item
  6969.   #--------------------------------------------------------------------------
  6970.   def draw_item(index)
  6971.       item = @data[index]
  6972.       if item
  6973.           set_font_equip
  6974.           rect = item_rect(index)
  6975.           rect.width -= 4
  6976.           draw_item_name(item, rect.x, rect.y, enable?(item))
  6977.           draw_item_number(rect, item)
  6978.       end
  6979.   end      
  6980.  
  6981.   #--------------------------------------------------------------------------
  6982.   # ● Draw Item Number
  6983.   #--------------------------------------------------------------------------
  6984.   def draw_item_number(rect, item)
  6985.       draw_text(rect, sprintf(": %2d", $game_party.item_number(item)), 2)
  6986.   end  
  6987.  
  6988. end
  6989.  
  6990. #==============================================================================
  6991. # ■ Actor Menu Status
  6992. #==============================================================================
  6993. class Actor_Equip_Status
  6994.  
  6995.   include MOG_EQUIP_STATUS  
  6996.  
  6997.   #--------------------------------------------------------------------------
  6998.   # ● Initialize
  6999.   #--------------------------------------------------------------------------
  7000.   def initialize(actor)
  7001.       @actor = actor
  7002.       @actor_old = @actor
  7003.       $game_temp.temp_actor_equip = nil
  7004.       @old_temp_actor = $game_temp.temp_actor_equip
  7005.       set_old_parameter
  7006.       create_sprites
  7007.   end
  7008.  
  7009.   #--------------------------------------------------------------------------
  7010.   # ● Create Sprites
  7011.   #--------------------------------------------------------------------------  
  7012.   def create_sprites
  7013.       @parameter_number = $game_temp.pre_cache_equip_menu[5]
  7014.       @parameter_cw = @parameter_number.width / 11
  7015.       @parameter_ch = @parameter_number.height / 3
  7016.       create_layout
  7017.       create_face
  7018.       create_parameter
  7019.       create_name
  7020.   end
  7021.  
  7022.   #--------------------------------------------------------------------------
  7023.   # ● Dispose
  7024.   #--------------------------------------------------------------------------  
  7025.   def dispose
  7026.       dispose_layout
  7027.       dispose_face
  7028.       dispose_parameter
  7029.       dispose_name
  7030.   end
  7031.  
  7032.   #--------------------------------------------------------------------------
  7033.   # ● Dispose Layout
  7034.   #--------------------------------------------------------------------------    
  7035.   def dispose_layout
  7036.       @layout.dispose
  7037.   end
  7038.  
  7039.   #--------------------------------------------------------------------------
  7040.   # ● Dispose Face
  7041.   #--------------------------------------------------------------------------    
  7042.   def dispose_face
  7043.       @face.dispose
  7044.   end  
  7045.  
  7046.   #--------------------------------------------------------------------------
  7047.   # ● Dispose Parameter
  7048.   #--------------------------------------------------------------------------      
  7049.   def dispose_parameter
  7050.       @parameter.bitmap.dispose
  7051.       @parameter.dispose
  7052.   end
  7053.  
  7054.   #--------------------------------------------------------------------------
  7055.   # ● Dispose Name
  7056.   #--------------------------------------------------------------------------        
  7057.   def dispose_name
  7058.       @name.bitmap.dispose
  7059.       @name.dispose
  7060.   end
  7061.  
  7062.   #--------------------------------------------------------------------------
  7063.   # ● Create Layout
  7064.   #--------------------------------------------------------------------------
  7065.   def create_layout
  7066.       @layout = Sprite.new
  7067.       @layout.bitmap = $game_temp.pre_cache_equip_menu[4]
  7068.       @org_pos = [LAYOUT_POSITION[0],LAYOUT_POSITION[1]]
  7069.       @layout.x = @org_pos[0] - 150
  7070.       @layout.y = @org_pos[1]
  7071.       @layout.z = 10
  7072.       @layout.opacity = 0
  7073.       @slide_range = (@org_pos[0] - 150)
  7074.   end
  7075.  
  7076.   #--------------------------------------------------------------------------
  7077.   # ● Create Parameter
  7078.   #--------------------------------------------------------------------------
  7079.   def create_parameter
  7080.       @parameter = Sprite.new
  7081.       @parameter.bitmap = Bitmap.new(@layout.bitmap.width,@layout.bitmap.height)
  7082.       @org_pos_par = [@org_pos[0] + PAR_POSITION[0],
  7083.                       @org_pos[1] + PAR_POSITION[1]]
  7084.       @parameter.x = @org_pos_par[0] - 150
  7085.       @parameter.y = @org_pos_par[1]
  7086.       @parameter.z = 11
  7087.       @parameter.opacity = 0
  7088.       refresh_parameter
  7089.   end
  7090.  
  7091.   #--------------------------------------------------------------------------
  7092.   # ● Create Face
  7093.   #--------------------------------------------------------------------------  
  7094.   def create_face
  7095.       @face = Sprite.new
  7096.       @org_pos_face = [@org_pos[0] + FACE_POSITION[0],
  7097.                        @org_pos[1] + FACE_POSITION[1]]
  7098.       @face.x = @org_pos_face[0] - 150
  7099.       @face.y = @org_pos_face[1]
  7100.       @face.z = 11
  7101.       @face.opacity = 0
  7102.       refresh_face
  7103.   end
  7104.  
  7105.   #--------------------------------------------------------------------------
  7106.   # ● Create Name
  7107.   #--------------------------------------------------------------------------    
  7108.   def create_name
  7109.       @name = Sprite.new
  7110.       @name.bitmap = Bitmap.new(140,32)
  7111.       @name.bitmap.font.size = FONT_SIZE
  7112.       @name.bitmap.font.bold = FONT_BOLD
  7113.       @org_pos_name = [@org_pos[0] + NAME_POSITION[0],
  7114.                        @org_pos[1] + NAME_POSITION[1]]
  7115.       @name.x = @org_pos_name[0] - 150
  7116.       @name.y = @org_pos_name[1]
  7117.       @name.z = 11
  7118.       @name.opacity = 0
  7119.       refresh_name    
  7120.   end  
  7121.  
  7122.   #--------------------------------------------------------------------------
  7123.   # ● Set Old Parameter
  7124.   #--------------------------------------------------------------------------  
  7125.   def set_old_parameter
  7126.       @par = [] if @par == nil
  7127.       @par.clear
  7128.       @par = [
  7129.       @actor.param(0),@actor.param(1),@actor.param(2),@actor.param(3),
  7130.       @actor.param(4),@actor.param(5),@actor.param(6),@actor.param(7),
  7131.       @old_temp_actor
  7132.       ]
  7133.   end  
  7134.  
  7135.   #--------------------------------------------------------------------------
  7136.   # ● Can Refresh Parameter
  7137.   #--------------------------------------------------------------------------
  7138.   def can_refresh_parameter?
  7139.       return true if @par[0] != @actor.param(0)
  7140.       return true if @par[1] != @actor.param(1)
  7141.       return true if @par[2] != @actor.param(2)
  7142.       return true if @par[3] != @actor.param(3)
  7143.       return true if @par[4] != @actor.param(4)
  7144.       return true if @par[5] != @actor.param(5)
  7145.       return true if @par[6] != @actor.param(6)
  7146.       return true if @par[7] != @actor.param(7)
  7147.       return true if @old_temp_actor != $game_temp.temp_actor_equip
  7148.       return false
  7149.   end  
  7150.  
  7151.   #--------------------------------------------------------------------------
  7152.   # ● Refresh Name
  7153.   #--------------------------------------------------------------------------      
  7154.   def refresh_name    
  7155.       @name.bitmap.clear
  7156.       @name.bitmap.draw_text(0,0,140,32,@actor.name.to_s,0)
  7157.   end
  7158.  
  7159.   #--------------------------------------------------------------------------
  7160.   # ● Create Face
  7161.   #--------------------------------------------------------------------------  
  7162.   def refresh_parameter
  7163.       set_old_parameter
  7164.       @parameter.bitmap.clear
  7165.       @old_temp_actor = $game_temp.temp_actor_equip
  7166.       x = 180      
  7167.       for p in 0...8
  7168.           y = 24 * p
  7169.           refresh_number(@parameter,@parameter_number,p,@parameter_cw,@parameter_ch,x,y,0)
  7170.       end      
  7171.       if $game_temp.temp_actor_equip != nil
  7172.          x = 180 - (@parameter_cw * 7)
  7173.          for p in 0...8
  7174.              y = 24 * p
  7175.              refresh_number(@parameter,@parameter_number,p,@parameter_cw,@parameter_ch,x,y,1)
  7176.          end    
  7177.      end
  7178.   end
  7179.    
  7180.   #--------------------------------------------------------------------------
  7181.   # ● Refresh Number
  7182.   #--------------------------------------------------------------------------    
  7183.   def refresh_number(sprite,image,p,number_cw,number_ch,x,y,type)
  7184.       value = @actor.param(p)
  7185.       new_value = 0
  7186.       ch = 0
  7187.       if type == 1        
  7188.          if $game_temp.temp_actor_equip != nil
  7189.             new_value = $game_temp.temp_actor_equip.param(p)
  7190.          end        
  7191.          d_value = new_value - value
  7192.          if d_value < 0
  7193.             ch = 2
  7194.          elsif d_value > 0
  7195.             ch = 1
  7196.          else
  7197.             ch = 0
  7198.          end  
  7199.          value = new_value
  7200.       end
  7201.       draw_arrow(sprite,image,number_cw,number_ch,x,y,ch)
  7202.       draw_number(sprite,image,value,number_cw,number_ch,x,y,ch)
  7203.   end
  7204.  
  7205.   #--------------------------------------------------------------------------
  7206.   # ● Draw Arrow
  7207.   #--------------------------------------------------------------------------        
  7208.   def draw_arrow(sprite,image,number_cw,number_ch,x,y,ch)
  7209.       nsrc_rect = Rect.new(number_cw * 10, number_ch * ch , number_cw , number_ch)
  7210.       sprite.bitmap.blt(x + number_cw, y, image, nsrc_rect)    
  7211.   end
  7212.  
  7213.   #--------------------------------------------------------------------------
  7214.   # ● Draw Number
  7215.   #--------------------------------------------------------------------------      
  7216.   def draw_number(sprite,image,value,number_cw,number_ch,x,y,ch)
  7217.       number = value.truncate.abs.to_s.split(//)
  7218.       x2 = -number_cw * number.size
  7219.       for i in 0..number.size  - 1
  7220.           number_abs = number[i].to_i
  7221.           nsrc_rect = Rect.new(number_cw * number_abs, number_ch * ch , number_cw , number_ch)
  7222.           sprite.bitmap.blt(x + x2 + (number_cw  *  i), y, image, nsrc_rect)        
  7223.       end      
  7224.   end
  7225.  
  7226.   #--------------------------------------------------------------------------
  7227.   # ● Refresh Face
  7228.   #--------------------------------------------------------------------------  
  7229.   def refresh_face
  7230.       face_name = "Face" + @actor.id.to_s
  7231.       @face.bitmap = Cache.menu(face_name.to_s)
  7232.   end
  7233.  
  7234.   #--------------------------------------------------------------------------
  7235.   # ● Update Move
  7236.   #--------------------------------------------------------------------------  
  7237.   def update_move
  7238.       update_slide(0,@layout,@layout.x,@org_pos[0])
  7239.       update_slide(1,@layout,@layout.y,@org_pos[1])      
  7240.       update_slide(0,@parameter,@parameter.x,@org_pos_par[0])
  7241.       update_slide(1,@parameter,@parameter.y,@org_pos_par[1])
  7242.       update_slide(0,@face,@face.x,@org_pos_face[0])
  7243.       update_slide(1,@face,@face.y,@org_pos_face[1])
  7244.       update_slide(0,@name,@name.x,@org_pos_name[0])
  7245.       update_slide(1,@name,@name.y,@org_pos_name[1])
  7246.   end
  7247.  
  7248.  #--------------------------------------------------------------------------
  7249.  # ● Update Slide
  7250.  #--------------------------------------------------------------------------                      
  7251.   def update_slide(type,sprite,cp,np)
  7252.       sprite.opacity += 5
  7253.       sp = 3 + ((cp - np).abs / 10)
  7254.       if cp > np
  7255.          cp -= sp
  7256.          cp = np if cp < np
  7257.       elsif cp < np
  7258.          cp += sp
  7259.          cp = np if cp > np
  7260.       end    
  7261.       sprite.x = cp if type == 0
  7262.       sprite.y = cp if type == 1
  7263.   end      
  7264.  
  7265.   #--------------------------------------------------------------------------
  7266.   # ● Refresh All
  7267.   #--------------------------------------------------------------------------  
  7268.   def refresh_all(actor)      
  7269.       @actor = actor
  7270.       refresh_parameter
  7271.       refresh_face
  7272.       refresh_name
  7273.   end    
  7274.  
  7275.   #--------------------------------------------------------------------------
  7276.   # ● Update
  7277.   #--------------------------------------------------------------------------
  7278.   def update(actor)
  7279.       update_move
  7280.       refresh_all(actor) if actor != @actor
  7281.       refresh_parameter if can_refresh_parameter?
  7282.   end      
  7283.  
  7284. end
  7285.  
  7286. #==============================================================================
  7287. # ■ Scene_Equip
  7288. #==============================================================================
  7289. class Scene_Equip
  7290.  
  7291.   #--------------------------------------------------------------------------
  7292.   # ● Create Sprites
  7293.   #--------------------------------------------------------------------------
  7294.   def create_sprites
  7295.       create_menu_background
  7296.       create_layout
  7297.       create_particles
  7298.       create_help_window
  7299.       create_status_window
  7300.       create_command_window
  7301.       create_slot_window
  7302.       create_item_window
  7303.       create_actor_status
  7304.       set_sprite_position
  7305.   end
  7306.  
  7307.   #--------------------------------------------------------------------------
  7308.   # ● Set Sprite Position
  7309.   #--------------------------------------------------------------------------  
  7310.   def set_sprite_position
  7311.       @status_window.opacity = 0
  7312.       @command_window.opacity = 0
  7313.       @slot_window.opacity = 0
  7314.       @help_window.opacity = 0
  7315.       @status_window.contents_opacity = 0
  7316.       @command_window.contents_opacity = 0
  7317.       @slot_window.contents_opacity = 0
  7318.       @help_window.contents_opacity = 0      
  7319.       @layout2.opacity = 0
  7320.       @layout3.opacity = 0
  7321.       @layout4.opacity = 0
  7322.       @org_pos_help = [@help_window.x,@help_window.y]
  7323.       @help_window.x = @org_pos_help[0]
  7324.       @help_window.y = @org_pos_help[1] + 150    
  7325.       @org_pos_com = [@command_window.x,@command_window.y]
  7326.       @command_window.x = @org_pos_com[0]
  7327.       @command_window.y = @org_pos_com[1] - 150
  7328.       @org_pos_slot = [@slot_window.x,@slot_window.y]
  7329.       @slot_window.x = @org_pos_slot[0] + 150
  7330.       @slot_window.y = @org_pos_slot[1]      
  7331.       @layout2.y = -150
  7332.       @layout3.x = 150
  7333.       @layout4.y = 150      
  7334.   end
  7335.  
  7336.   #--------------------------------------------------------------------------
  7337.   # ● Create Actor Status
  7338.   #--------------------------------------------------------------------------  
  7339.   def create_actor_status
  7340.       @actor_status = Actor_Equip_Status.new(@actor)
  7341.   end  
  7342.  
  7343.   #--------------------------------------------------------------------------
  7344.   # ● Create Menu Background
  7345.   #--------------------------------------------------------------------------            
  7346.   def create_menu_background
  7347.       @background = Plane.new
  7348.       @background.bitmap = $game_temp.pre_cache_equip_menu[0]
  7349.       @background.z = 0
  7350.       @background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
  7351.   end    
  7352.  
  7353.   #--------------------------------------------------------------------------
  7354.   # ● Create Layout
  7355.   #--------------------------------------------------------------------------              
  7356.   def create_layout    
  7357.       @layout2 = Sprite.new
  7358.       @layout2.bitmap = $game_temp.pre_cache_equip_menu[1]
  7359.       @layout2.z = 3
  7360.       @layout3 = Sprite.new
  7361.       @layout3.bitmap = $game_temp.pre_cache_equip_menu[2]
  7362.       @layout3.z = 3
  7363.       @layout4 = Sprite.new
  7364.       @layout4.bitmap = $game_temp.pre_cache_equip_menu[3]
  7365.       @layout4.z = 3
  7366.   end  
  7367.  
  7368.   #--------------------------------------------------------------------------
  7369.   # ● Create Particles
  7370.   #--------------------------------------------------------------------------  
  7371.   def create_particles
  7372.       @particles_sprite =[]
  7373.       for i in 0...NUMBER_OF_PARTICLES
  7374.           @particles_sprite.push(Particles_Menu.new(nil))
  7375.       end
  7376.   end  
  7377.  
  7378.   #--------------------------------------------------------------------------
  7379.   # ● Create Help Window
  7380.   #--------------------------------------------------------------------------              
  7381.   def create_help_window
  7382.       @help_window = Window_Help.new
  7383.       @help_window.x = 0
  7384.       @help_window.y = Graphics.height - @help_window.height
  7385.   end    
  7386.  
  7387.   #--------------------------------------------------------------------------
  7388.   # ● Create Status Window
  7389.   #--------------------------------------------------------------------------
  7390.   def create_status_window
  7391.       @status_window = Window_EquipStatus.new(0, @help_window.height)
  7392.       @status_window.viewport = @viewport
  7393.       @status_window.actor = @actor
  7394.       @status_window.y = 48
  7395.   end
  7396.  
  7397.   #--------------------------------------------------------------------------
  7398.   # ● Create Command Window
  7399.   #--------------------------------------------------------------------------
  7400.   def create_command_window
  7401.       @command_window = Window_EquipCommand.new(208, 0, 336)
  7402.       @command_window.help_window = @help_window
  7403.       @command_window.set_handler(:equip,    method(:command_equip))
  7404.       @command_window.set_handler(:optimize, method(:command_optimize))
  7405.       @command_window.set_handler(:clear,    method(:command_clear))
  7406.       @command_window.set_handler(:cancel,   method(:return_scene))
  7407.       @command_window.set_handler(:pagedown, method(:next_actor))
  7408.       @command_window.set_handler(:pageup,   method(:prev_actor))
  7409.   end
  7410.  
  7411.   #--------------------------------------------------------------------------
  7412.   # ● Create Slot Window
  7413.   #--------------------------------------------------------------------------
  7414.   def create_slot_window
  7415.       wx = @status_window.width
  7416.       wy = @command_window.y + @command_window.height + 5
  7417.       ww = Graphics.width - @status_window.width
  7418.       @slot_window = Window_EquipSlot.new(wx, wy, ww)
  7419.       @slot_window.help_window = @help_window
  7420.       @slot_window.status_window = @status_window
  7421.       @slot_window.actor = @actor
  7422.       @slot_window.set_handler(:ok,       method(:on_slot_ok))
  7423.       @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  7424.       @slot_window.set_handler(:pagedown, method(:next_actor))
  7425.       @slot_window.set_handler(:pageup,   method(:prev_actor))  
  7426.   end
  7427.  
  7428.   #--------------------------------------------------------------------------
  7429.   # ● Create Item Window
  7430.   #--------------------------------------------------------------------------
  7431.   def create_item_window
  7432.       @equip_window = []
  7433.       index = 0
  7434.       window_max = 5
  7435.       for item in 0...window_max    
  7436.           wx = @slot_window.x
  7437.           wy = @slot_window.y + @slot_window.height + 5
  7438.           ww = @slot_window.width
  7439.           wh = @slot_window.height - 5
  7440.           @equip_window.push(Window_EquipItem_Menu.new(wx, wy, ww, wh))
  7441.           @equip_window[item].setup(@actor,item, index)
  7442.           @equip_window[item].visible = false
  7443.           @equip_window[item].help_window = @help_window
  7444.           @equip_window[item].status_window = @status_window
  7445.           @equip_window[item].actor = @actor
  7446.           @equip_window[item].set_handler(:ok,     method(:on_item_ok))
  7447.           @equip_window[item].set_handler(:cancel, method(:on_item_cancel))
  7448.           @equip_window[item].opacity = 0
  7449.           @org_pos_equip = [@equip_window[item].x,@equip_window[item].y]
  7450.           index += 1
  7451.        end    
  7452.  
  7453.    end
  7454.    
  7455. end
  7456.  
  7457. #==============================================================================
  7458. # ■ Scene_Equip
  7459. #==============================================================================
  7460. class Scene_Equip
  7461.  
  7462.   #--------------------------------------------------------------------------
  7463.   # ● Execute Dispose
  7464.   #--------------------------------------------------------------------------        
  7465.   def execute_dispose
  7466.       Graphics.freeze
  7467.       dispose_background
  7468.       dispose_layout
  7469.       dispose_particles
  7470.       dispose_window
  7471.       dispose_actor_status
  7472.   end
  7473.  
  7474.   #--------------------------------------------------------------------------
  7475.   # ● Dispose Background
  7476.   #--------------------------------------------------------------------------  
  7477.   def dispose_background
  7478.       return if @background == nil
  7479.       @background.dispose
  7480.       @background = nil
  7481.   end
  7482.  
  7483.   #--------------------------------------------------------------------------
  7484.   # ● Dispose Layout
  7485.   #--------------------------------------------------------------------------                
  7486.   def dispose_layout
  7487.       return if @layout2 == nil
  7488.       @layout2.dispose
  7489.       @layout3.dispose
  7490.       @layout4.dispose
  7491.       @layout2 = nil
  7492.   end  
  7493.  
  7494.  #--------------------------------------------------------------------------
  7495.  # ● Dispose Particles
  7496.  #--------------------------------------------------------------------------    
  7497.  def dispose_particles
  7498.      return if @particles_sprite == nil
  7499.      @particles_sprite.each {|sprite| sprite.dispose }
  7500.  end    
  7501.  
  7502.   #--------------------------------------------------------------------------
  7503.   # ● Dispose Window
  7504.   #--------------------------------------------------------------------------          
  7505.   def dispose_window
  7506.       @status_window.dispose
  7507.       @command_window.dispose
  7508.       @slot_window.dispose
  7509.       @equip_window.each {|sprite| sprite.dispose }
  7510.       @help_window.dispose
  7511.   end  
  7512.  
  7513.   #--------------------------------------------------------------------------
  7514.   # ● Dispose Actor Status
  7515.   #--------------------------------------------------------------------------  
  7516.   def dispose_actor_status
  7517.       return if @actor_status == nil
  7518.       @actor_status.dispose
  7519.   end    
  7520.  
  7521. end
  7522.  
  7523. #==============================================================================
  7524. # ■ Scene_Equip
  7525. #==============================================================================
  7526. class Scene_Equip  
  7527.  
  7528.   #--------------------------------------------------------------------------
  7529.   # ● Update Sprites
  7530.   #--------------------------------------------------------------------------          
  7531.   def update_sprites
  7532.       update_actor_status
  7533.       update_background
  7534.       update_particles
  7535.       update_window
  7536.       update_move
  7537.   end
  7538.  
  7539.   #--------------------------------------------------------------------------
  7540.   # ● Update Move
  7541.   #--------------------------------------------------------------------------
  7542.   def update_move
  7543.    
  7544.       update_slide(0,@command_window,@org_pos_com[0],0)
  7545.       update_slide(1,@command_window,@org_pos_com[1],0)
  7546.      
  7547.       update_slide(0,@help_window,@org_pos_help[0],0)
  7548.       update_slide(1,@help_window,@org_pos_help[1],0)      
  7549.    
  7550.       update_slide(0,@slot_window,@org_pos_slot[0],0)
  7551.       update_slide(1,@slot_window,@org_pos_slot[1],0)        
  7552.      
  7553.       update_slide(0,@layout2,0,1)
  7554.       update_slide(1,@layout2,0,1)
  7555.      
  7556.       update_slide(0,@layout3,0,1)
  7557.       update_slide(1,@layout3,0,1)      
  7558.      
  7559.       update_slide(0,@layout4,0,1)
  7560.       update_slide(1,@layout4,0,1)      
  7561.      
  7562.   end
  7563.  
  7564.  #--------------------------------------------------------------------------
  7565.  # ● Update Slide
  7566.  #--------------------------------------------------------------------------                      
  7567.   def update_slide(type,sprite,np,op_type)
  7568.       if op_type == 0
  7569.          sprite.contents_opacity += 5
  7570.       else
  7571.          sprite.opacity += 5
  7572.       end
  7573.       cp = type == 0 ? sprite.x : sprite.y
  7574.       sp = 3 + ((cp - np).abs / 10)
  7575.       if cp > np
  7576.          cp -= sp
  7577.          cp = np if cp < np
  7578.       elsif cp < np
  7579.          cp += sp
  7580.          cp = np if cp > np
  7581.       end    
  7582.       sprite.x = cp if type == 0
  7583.       sprite.y = cp if type == 1
  7584.   end    
  7585.  
  7586.   #--------------------------------------------------------------------------
  7587.   # ● Update Actor Status
  7588.   #--------------------------------------------------------------------------            
  7589.   def update_actor_status
  7590.       return if @actor_status == nil
  7591.       @actor_status.update(@actor)
  7592.   end
  7593.    
  7594.   #--------------------------------------------------------------------------
  7595.   # ● Update Background
  7596.   #--------------------------------------------------------------------------              
  7597.   def update_background
  7598.       return if @background == nil
  7599.       @background.ox += @background_scroll[0]
  7600.       @background.oy += @background_scroll[1]
  7601.   end    
  7602.  
  7603.   #--------------------------------------------------------------------------
  7604.   # ● Update Particles
  7605.   #--------------------------------------------------------------------------  
  7606.   def update_particles
  7607.       return if @particles_sprite == nil
  7608.       @particles_sprite.each {|sprite| sprite.update }
  7609.   end  
  7610.  
  7611.   #--------------------------------------------------------------------------
  7612.   # ● Update Window
  7613.   #--------------------------------------------------------------------------            
  7614.   def update_window
  7615.       @status_window.update
  7616.       @command_window.update
  7617.       @slot_window.update
  7618.       for equip in @equip_window
  7619.           update_slide(0,equip,@org_pos_equip[0],0)
  7620.           update_slide(1,equip,@org_pos_equip[1],0)          
  7621.           if equip.windows_index == @slot_window.index
  7622.              equip.visible = true
  7623.              equip.update  
  7624.           else
  7625.              equip.visible = false
  7626.           end
  7627.       end  
  7628.   end
  7629.  
  7630. end
  7631.  
  7632. #==============================================================================
  7633. # ■ Scene_Equip
  7634. #==============================================================================
  7635. class Scene_Equip
  7636.  
  7637.   #--------------------------------------------------------------------------
  7638.   # ● Update
  7639.   #--------------------------------------------------------------------------      
  7640.   def update
  7641.       update_sprites
  7642.       update_command
  7643.   end
  7644.  
  7645.   #--------------------------------------------------------------------------
  7646.   # ● Command Equip
  7647.   #--------------------------------------------------------------------------
  7648.   def command_equip
  7649.       @slot_window.activate
  7650.       @slot_window.select(0)
  7651.   end
  7652.  
  7653.   #--------------------------------------------------------------------------
  7654.   # ● Command Optimize
  7655.   #--------------------------------------------------------------------------
  7656.   def command_optimize
  7657.       Sound.play_equip
  7658.       @actor.optimize_equipments
  7659.       @status_window.refresh
  7660.       @slot_window.refresh
  7661.       @command_window.activate
  7662.   end
  7663.  
  7664.   #--------------------------------------------------------------------------
  7665.   # ● Command Clear
  7666.   #--------------------------------------------------------------------------
  7667.   def command_clear
  7668.       Sound.play_equip
  7669.       @actor.clear_equipments
  7670.       @status_window.refresh
  7671.       @slot_window.refresh
  7672.       @command_window.activate
  7673.   end
  7674.  
  7675.   #--------------------------------------------------------------------------
  7676.   # ● On Slot OK
  7677.   #--------------------------------------------------------------------------
  7678.   def on_slot_ok
  7679.       @equip_window[@slot_window.index].activate
  7680.       @equip_window[@slot_window.index].select(0)
  7681.   end
  7682.  
  7683.   #--------------------------------------------------------------------------
  7684.   # ● On Slot Cancel
  7685.   #--------------------------------------------------------------------------
  7686.   def on_slot_cancel
  7687.       @slot_window.unselect
  7688.       @command_window.activate
  7689.   end
  7690.  
  7691.   #--------------------------------------------------------------------------
  7692.   # ● On Item OK
  7693.   #--------------------------------------------------------------------------
  7694.   def on_item_ok
  7695.       Sound.play_equip
  7696.       @actor.change_equip(@slot_window.index, @equip_window[@slot_window.index].item)
  7697.       @slot_window.activate
  7698.       @slot_window.refresh
  7699.       @equip_window.each do |i| i.refresh; i.index = 0; i.unselect end
  7700.   end
  7701.  
  7702.   #--------------------------------------------------------------------------
  7703.   # ● On Item Cancel
  7704.   #--------------------------------------------------------------------------
  7705.   def on_item_cancel
  7706.       @slot_window.activate
  7707.       @equip_window[@slot_window.index].unselect
  7708.   end
  7709.  
  7710.   #--------------------------------------------------------------------------
  7711.   # ● Return Scene
  7712.   #--------------------------------------------------------------------------          
  7713.   def return_scene
  7714.       Sound.play_cancel
  7715.       SceneManager.return
  7716.     end
  7717.  
  7718.   #--------------------------------------------------------------------------
  7719.   # ● ON Actor Charge
  7720.   #--------------------------------------------------------------------------
  7721.   def on_actor_change
  7722.       $game_temp.actor_menu_temp = @actor
  7723.       SceneManager.goto(Scene_Equip)
  7724.   end  
  7725.  
  7726. end
  7727.  
  7728. #==============================================================================
  7729. # ■ Scene_Equip
  7730. #==============================================================================
  7731. class Scene_Equip
  7732.  
  7733.   #--------------------------------------------------------------------------
  7734.   # ● Update Command
  7735.   #--------------------------------------------------------------------------      
  7736.   def update_command
  7737.    
  7738.   end
  7739.  
  7740. end
  7741.  
  7742. #==============================================================================
  7743. # ■ Game_Temp
  7744. #==============================================================================
  7745. class Game_Temp
  7746.  
  7747.   #--------------------------------------------------------------------------
  7748.   # ● Execute Pre Cache Status Menu
  7749.   #--------------------------------------------------------------------------    
  7750.   def execute_pre_cache_status_menu
  7751.       @pre_cache_status_menu = []
  7752.       @pre_cache_status_menu.push(Cache.menu_status("Background"))
  7753.       @pre_cache_status_menu.push(Cache.menu_status("LayoutStatus"))
  7754.   end    
  7755.    
  7756. end
  7757.  
  7758. #==============================================================================
  7759. # ■ Scene_Status
  7760. #==============================================================================
  7761. class Scene_Status
  7762.   include MOG_MENU_STATUS
  7763.   include MOG_MENU_BASE
  7764.  
  7765.   #--------------------------------------------------------------------------
  7766.   # ● Main
  7767.   #--------------------------------------------------------------------------        
  7768.   def main
  7769.       execute_setup
  7770.       execute_loop
  7771.       execute_dispose
  7772.   end  
  7773.  
  7774.   #--------------------------------------------------------------------------
  7775.   # ● Execute Setup
  7776.   #--------------------------------------------------------------------------        
  7777.   def execute_setup
  7778.       @actor = $game_temp.actor_menu_temp
  7779.       @actor_old = @actor
  7780.       @phase = 0
  7781.       create_sprites
  7782.   end
  7783.  
  7784.   #--------------------------------------------------------------------------
  7785.   # ● Execute Lopp
  7786.   #--------------------------------------------------------------------------        
  7787.   def execute_loop
  7788.       Graphics.transition(10)
  7789.       loop do
  7790.          Input.update
  7791.          update
  7792.          Graphics.update
  7793.          break if SceneManager.scene != self
  7794.       end
  7795.   end
  7796.  
  7797. end
  7798.  
  7799. #==============================================================================
  7800. # ■ Window_Status
  7801. #==============================================================================
  7802. class Window_Status < Window_Selectable
  7803.   include MOG_MENU_STATUS
  7804.  
  7805.   #--------------------------------------------------------------------------
  7806.   # ● Initialize
  7807.   #--------------------------------------------------------------------------
  7808.   def initialize(actor)
  7809.       super(-16, -16, Graphics.width + 32, Graphics.height + 32)
  7810.       @actor = actor
  7811.       self.z = 10
  7812.       refresh
  7813.       activate
  7814.   end
  7815.  
  7816.   #--------------------------------------------------------------------------
  7817.   # ● Actor
  7818.   #--------------------------------------------------------------------------
  7819.   def actor=(actor)
  7820.       return if @actor == actor
  7821.       @actor = actor
  7822.       refresh
  7823.   end
  7824.  
  7825.   #--------------------------------------------------------------------------
  7826.   # ● Refresh
  7827.   #--------------------------------------------------------------------------
  7828.   def refresh
  7829.       contents.clear
  7830.       draw_description
  7831.       self.contents.font.size = 18
  7832.       self.contents.font.bold = false
  7833.       draw_actor_name
  7834.       draw_equipments
  7835.       draw_exp_info
  7836.       draw_parameters      
  7837.       draw_actor_hp_mp_tp
  7838.   end
  7839.  
  7840.   #--------------------------------------------------------------------------
  7841.   # ● Draw Actor Name
  7842.   #--------------------------------------------------------------------------  
  7843.   def draw_actor_name
  7844.       self.contents.font.size = 16
  7845.       text = @actor.class.name
  7846.       draw_text(240,185,100,32, text.to_s,1)      
  7847.       self.contents.font.size = 20    
  7848.       text = @actor.name
  7849.       draw_text(125,50,120,32, text.to_s,1)
  7850.   end
  7851.  
  7852.   #--------------------------------------------------------------------------
  7853.   # ● Draw Parameters
  7854.   #--------------------------------------------------------------------------
  7855.   def draw_parameters
  7856.       par = @actor.atk
  7857.       draw_text(43,112,80,32, par.to_s,2)
  7858.       par = @actor.def
  7859.       draw_text(43,146,80,32, par.to_s,2)
  7860.       par = @actor.mat
  7861.       draw_text(162 ,112,80,32, par.to_s,2)      
  7862.       par = @actor.mdf
  7863.       draw_text(162,146,80,32, par.to_s,2)      
  7864.       par = @actor.agi
  7865.       draw_text(282,112,80,32, par.to_s,2)        
  7866.       par = @actor.luk
  7867.       draw_text(282,146,80,32, par.to_s,2)
  7868.   end    
  7869.      
  7870.   #--------------------------------------------------------------------------
  7871.   # ● Draw Actor HP MP TP
  7872.   #--------------------------------------------------------------------------  
  7873.   def draw_actor_hp_mp_tp
  7874.       self.contents.font.size = 16
  7875.       par = @actor.hp.truncate
  7876.       draw_text(5,80,80,32, par.to_s,2)      
  7877.       par = @actor.mhp.truncate
  7878.       draw_text(42,80,80,32, par.to_s,2)          
  7879.       par = @actor.mp.truncate
  7880.       draw_text(123,80,80,32, par.to_s,2)      
  7881.       par = @actor.mmp.truncate
  7882.       draw_text(162,80,80,32, par.to_s,2)        
  7883.       par = @actor.tp.truncate
  7884.       draw_text(244,80,80,32, par.to_s,2)      
  7885.       par = @actor.max_tp.truncate
  7886.       draw_text(282,80,80,32, par.to_s,2)      
  7887.   end
  7888.  
  7889.   #--------------------------------------------------------------------------
  7890.   # ● Draw Exp Info
  7891.   #--------------------------------------------------------------------------
  7892.   def draw_exp_info
  7893.       draw_text(200,8,64,32,@actor.level.to_s,1)
  7894.       s1 = @actor.max_level? ? "----------" : @actor.exp
  7895.       s2 = @actor.max_level? ? "----------" : @actor.next_level_exp - @actor.exp
  7896.       draw_text(300,8, 80, 32,s1.to_s, 1)
  7897.       draw_text(460,8, 80, 32,s2.to_s, 1)
  7898.   end
  7899.  
  7900.   #--------------------------------------------------------------------------
  7901.   # ● Draw Equipments
  7902.   #--------------------------------------------------------------------------
  7903.   def draw_equipments
  7904.       self.contents.font.size = 16
  7905.       item = @actor.equips[0]
  7906.       draw_item_name(item, 20, 220,true,140)
  7907.       item = @actor.equips[1]
  7908.       draw_item_name(item, 20, 220 + 43,true,140)
  7909.       item = @actor.equips[2]
  7910.       draw_item_name(item, 20, 220 + 86,true,140)      
  7911.       item = @actor.equips[3]
  7912.       draw_item_name(item, 196, 242,true,140)      
  7913.       item = @actor.equips[4]
  7914.       draw_item_name(item, 196, 242 + 43,true,140)
  7915.   end
  7916.  
  7917.   #--------------------------------------------------------------------------
  7918.   # ● Draw Description
  7919.   #--------------------------------------------------------------------------
  7920.   def draw_description
  7921.       draw_text_ex(20, height - 96,@actor.description)
  7922.   end
  7923.  
  7924.   #--------------------------------------------------------------------------
  7925.   # ● Next Actor
  7926.   #--------------------------------------------------------------------------
  7927.   def next_actor
  7928.       $game_temp.actor_menu_temp = $game_party.menu_actor_next
  7929.       on_actor_change
  7930.   end
  7931.   #--------------------------------------------------------------------------
  7932.   # ● Prev Actor
  7933.   #--------------------------------------------------------------------------
  7934.   def prev_actor
  7935.       $game_temp.actor_menu_temp = $game_party.menu_actor_prev
  7936.       on_actor_change
  7937.   end  
  7938.  
  7939.   #--------------------------------------------------------------------------
  7940.   # ● On Actor Change
  7941.   #--------------------------------------------------------------------------
  7942.   def on_actor_change
  7943.       Sound.play_cursor
  7944.       SceneManager.goto(Scene_Status)
  7945.   end  
  7946.  
  7947. end
  7948.  
  7949. module MOG_STATUS_PARAMETER
  7950.   PICTURE_POS = [-105,0]
  7951.   METER_POSITION = [53,101]
  7952.   STATES_POSITION = [201,46]
  7953.   STATES_SCROLLING_ANIMATION = false
  7954.   MAX_PARAMETER_VALUE = 999
  7955. end
  7956. #==============================================================================
  7957. # ■ Status Parameter
  7958. #==============================================================================
  7959. class Status_Parameter
  7960.  
  7961.   include MOG_STATUS_PARAMETER
  7962.  
  7963.   #--------------------------------------------------------------------------
  7964.   # ● Initialize
  7965.   #--------------------------------------------------------------------------
  7966.   def initialize(actor)
  7967.       @actor = actor
  7968.       create_picture
  7969.       create_states
  7970.       create_meter
  7971.   end
  7972.  
  7973.   #--------------------------------------------------------------------------
  7974.   # ● Create Picture
  7975.   #--------------------------------------------------------------------------  
  7976.   def create_picture
  7977.       @picture = Sprite.new
  7978.       pic_name = "Actor_S" + @actor.id.to_s
  7979.       @picture.bitmap = Cache.menu_status(pic_name.to_s)
  7980.       @picture.ox = @picture.bitmap.width / 2
  7981.       pos = [Graphics.width,Graphics.height - @picture.bitmap.height]
  7982.       @pos_org_pic = [PICTURE_POS[0] + pos[0] ,PICTURE_POS[1] + pos[1]]
  7983.       @picture.x = @pos_org_pic[0]
  7984.       @picture.y = @pos_org_pic[1] + 150
  7985.       @picture.opacity = 0
  7986.       @picture.z = 3
  7987.   end  
  7988.  
  7989.   #--------------------------------------------------------------------------
  7990.   # ● Create_States
  7991.   #--------------------------------------------------------------------------      
  7992.   def create_states
  7993.       @status_old = nil
  7994.       @status_flow = [-24,0]    
  7995.       @status = Sprite.new
  7996.       @status.bitmap = Bitmap.new(24,24)
  7997.       @org_pos_states = [STATES_POSITION[0],STATES_POSITION[1]]      
  7998.       @status.x = @org_pos_states[0] + 150
  7999.       @status.y = @org_pos_states[1]
  8000.       @status.z = 11
  8001.       @status.opacity = 0
  8002.   end      
  8003.  
  8004.   #--------------------------------------------------------------------------
  8005.   # * Refresh States
  8006.   #--------------------------------------------------------------------------        
  8007.   def refresh_states
  8008.       check_icon_image
  8009.       @status_old = @actor.states
  8010.       @status_flow = [0,0]
  8011.       @actor_status.dispose if @actor_status != nil
  8012.       @states_size = @actor.states.size > 0 ? (26 * @actor.states.size) : 24
  8013.       @actor_status = Bitmap.new(@states_size,24)
  8014.       index = 0
  8015.       for i in @actor.states
  8016.          rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
  8017.          @actor_status.blt(26 * index , 0, @icon_image, rect)
  8018.          index += 1
  8019.       end
  8020.   end  
  8021.  
  8022.   #--------------------------------------------------------------------------
  8023.   # * Flow_Status
  8024.   #--------------------------------------------------------------------------          
  8025.   def flow_states
  8026.       return if @actor_status == nil
  8027.       @status.bitmap.clear
  8028.       return if @actor.states.size == 0
  8029.       st_src_rect = Rect.new(@status_flow[0],0, 24,24)
  8030.       @status.bitmap.blt(0,0, @actor_status, st_src_rect)
  8031.       if STATES_SCROLLING_ANIMATION
  8032.          @status_flow[0] += 1
  8033.          @status_flow[0] = -24 if @status_flow[0] >= @states_size + 2
  8034.       else  
  8035.          @status_flow[1] += 1 unless @actor.states.size <= 1
  8036.          if @status_flow[1] > 30
  8037.             @status_flow[1] = 0
  8038.             @status_flow[0] += 26
  8039.             @status_flow[0] = 0 if @status_flow[0] >= (@states_size - 0)
  8040.          end  
  8041.      end  
  8042.   end        
  8043.  
  8044.   #--------------------------------------------------------------------------
  8045.   # * Check Icon Image
  8046.   #--------------------------------------------------------------------------          
  8047.   def check_icon_image
  8048.       if @icon_image == nil or @icon_image.disposed?
  8049.          @icon_image = Cache.system("Iconset")
  8050.       end  
  8051.   end  
  8052.  
  8053.   #--------------------------------------------------------------------------
  8054.   # * Create Meter
  8055.   #--------------------------------------------------------------------------            
  8056.   def create_meter
  8057.       @meter_image = Cache.menu_status("Par_Meter2")
  8058.       @meter_cw = @meter_image.width / 3
  8059.       @meter_ch = @meter_image.height / 4
  8060.       @meter = Sprite.new
  8061.       @meter.bitmap = Bitmap.new(380,140)
  8062.       @org_pos_meter = [METER_POSITION[0],METER_POSITION[1]]      
  8063.       @meter.x = @org_pos_meter[0] + 150
  8064.       @meter.y = @org_pos_meter[1]
  8065.       @meter.z = 11  
  8066.       @meter.opacity = 0
  8067.       @meter_flow = [0,@meter_cw * 2]      
  8068.       refresh_meter
  8069.   end  
  8070.  
  8071.   #--------------------------------------------------------------------------
  8072.   # * Refresh Meter
  8073.   #--------------------------------------------------------------------------            
  8074.   def refresh_meter
  8075.       @meter.bitmap.clear
  8076.       max_par = MAX_PARAMETER_VALUE
  8077.       value = @actor.hp
  8078.       value_max = @actor.mhp
  8079.       pos = [0,0]
  8080.       draw_meter(value,value_max,0,pos[0],pos[1])
  8081.       value = @actor.mp
  8082.       value_max = @actor.mmp
  8083.       pos = [120,0]
  8084.       draw_meter(value,value_max,1,pos[0],pos[1])
  8085.       value = @actor.tp
  8086.       value_max = @actor.max_tp
  8087.       pos = [240,0]
  8088.       draw_meter(value,value_max,2,pos[0],pos[1])        
  8089.       value = @actor.atk
  8090.       value_max = max_par
  8091.       pos = [0,34]
  8092.       draw_meter(value,value_max,3,pos[0],pos[1])      
  8093.       value = @actor.mat
  8094.       value_max = max_par
  8095.       pos = [120,34]
  8096.       draw_meter(value,value_max,3,pos[0],pos[1])          
  8097.       value = @actor.agi
  8098.       value_max = max_par
  8099.       pos = [240,34]
  8100.       draw_meter(value,value_max,3,pos[0],pos[1])      
  8101.       value = @actor.def
  8102.       value_max = max_par
  8103.       pos = [0,68]
  8104.       draw_meter(value,value_max,3,pos[0],pos[1])      
  8105.       value = @actor.mdf
  8106.       value_max = max_par
  8107.       pos = [120,68]
  8108.       draw_meter(value,value_max,3,pos[0],pos[1])          
  8109.       value = @actor.luk
  8110.       value_max = max_par
  8111.       pos = [240,68]
  8112.       draw_meter(value,value_max,3,pos[0],pos[1])      
  8113.       @meter_flow[0] += 5
  8114.       @meter_flow[0] = 0 if @meter_flow[0] > @meter_flow[1]
  8115.   end
  8116.  
  8117.   #--------------------------------------------------------------------------
  8118.   # * Draw Meter
  8119.   #--------------------------------------------------------------------------              
  8120.   def draw_meter(value,value_max,type,x,y)
  8121.       value_max = 1 if value_max <= 0
  8122.       range = @meter_cw * value.truncate / value_max.truncate
  8123.       ch = @meter_ch * type
  8124.       meter_scr = Rect.new(@meter_flow[0],ch,range,@meter_ch)
  8125.       @meter.bitmap.blt(x,y,@meter_image,meter_scr)
  8126.   end
  8127.  
  8128.   #--------------------------------------------------------------------------
  8129.   # ● Dispose
  8130.   #--------------------------------------------------------------------------  
  8131.   def dispose
  8132.       dispose_picture
  8133.       dispose_states
  8134.       dispose_meter
  8135.   end
  8136.  
  8137.   #--------------------------------------------------------------------------
  8138.   # ● Dispose Picture
  8139.   #--------------------------------------------------------------------------    
  8140.   def dispose_picture
  8141.       @picture.bitmap.dispose
  8142.       @picture.dispose
  8143.   end
  8144.  
  8145.   #--------------------------------------------------------------------------
  8146.   # ● Dispose States
  8147.   #--------------------------------------------------------------------------            
  8148.    def dispose_states
  8149.        return if @status == nil
  8150.        @status.bitmap.dispose
  8151.        @status.dispose
  8152.        if @actor_status != nil
  8153.           @actor_status.dispose
  8154.           @actor_status = nil
  8155.        end  
  8156.    end    
  8157.  
  8158.   #--------------------------------------------------------------------------
  8159.   # ● Dispose Meter
  8160.   #--------------------------------------------------------------------------            
  8161.    def dispose_meter
  8162.        return if @meter == nil
  8163.        @meter.bitmap.dispose
  8164.        @meter.dispose
  8165.    end    
  8166.      
  8167.   #--------------------------------------------------------------------------
  8168.   # ● Update
  8169.   #--------------------------------------------------------------------------  
  8170.   def update
  8171.       update_slide(0,@picture,@pos_org_pic[0])
  8172.       update_slide(1,@picture,@pos_org_pic[1])
  8173.       update_slide(0,@status,@org_pos_states[0])
  8174.       update_slide(1,@status,@org_pos_states[1])    
  8175.       update_slide(0,@meter,@org_pos_meter[0])
  8176.       update_slide(1,@meter,@org_pos_meter[1])          
  8177.       refresh_states if @status_old != @actor.states
  8178.       refresh_meter
  8179.       flow_states      
  8180.   end
  8181.  
  8182.  
  8183.  #--------------------------------------------------------------------------
  8184.  # ● Update Slide
  8185.  #--------------------------------------------------------------------------                      
  8186.   def update_slide(type,sprite,np)
  8187.       sprite.opacity += 5
  8188.       cp = type == 0 ? sprite.x : sprite.y
  8189.       sp = 3 + ((cp - np).abs / 10)
  8190.       if cp > np
  8191.          cp -= sp
  8192.          cp = np if cp < np
  8193.       elsif cp < np
  8194.          cp += sp
  8195.          cp = np if cp > np
  8196.       end    
  8197.       sprite.x = cp if type == 0
  8198.       sprite.y = cp if type == 1
  8199.   end    
  8200.  
  8201. end
  8202.  
  8203. #==============================================================================
  8204. # ■ Scene_Status
  8205. #==============================================================================
  8206. class Scene_Status
  8207.  
  8208.   #--------------------------------------------------------------------------
  8209.   # ● Create Sprites
  8210.   #--------------------------------------------------------------------------
  8211.   def create_sprites
  8212.       create_menu_background
  8213.       create_layout
  8214.       create_particles
  8215.       create_status_window
  8216.       create_parameter
  8217.   end
  8218.  
  8219.   #--------------------------------------------------------------------------
  8220.   # ● Create Menu Background
  8221.   #--------------------------------------------------------------------------            
  8222.   def create_menu_background
  8223.       @background = Plane.new
  8224.       @background.bitmap = $game_temp.pre_cache_status_menu[0]
  8225.       @background.z = 0
  8226.       @background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
  8227.   end    
  8228.  
  8229.   #--------------------------------------------------------------------------
  8230.   # ● Create Layout
  8231.   #--------------------------------------------------------------------------              
  8232.   def create_layout    
  8233.       @layout = Sprite.new
  8234.       @layout.bitmap = $game_temp.pre_cache_status_menu[1]
  8235.       @layout.z = 9
  8236.       @layout.x = -150
  8237.       @layout.opacity = 0
  8238.   end  
  8239.  
  8240.   #--------------------------------------------------------------------------
  8241.   # ● Create Particles
  8242.   #--------------------------------------------------------------------------  
  8243.   def create_particles
  8244.       @particles_sprite =[]
  8245.       for i in 0...NUMBER_OF_PARTICLES
  8246.           @particles_sprite.push(Particles_Menu.new(nil))
  8247.       end
  8248.   end  
  8249.    
  8250.   #--------------------------------------------------------------------------
  8251.   # ● Create Status Window
  8252.   #--------------------------------------------------------------------------  
  8253.   def create_status_window
  8254.       @status_window = Window_Status.new(@actor)
  8255.       @status_window.set_handler(:cancel,   method(:return_scene))
  8256.       @status_window.set_handler(:pagedown, method(:next_actor))
  8257.       @status_window.set_handler(:pageup,   method(:prev_actor))
  8258.       @org_pos_win = [@status_window.x,@status_window.y]
  8259.       @status_window.x += 150
  8260.       @status_window.opacity = 0
  8261.       @status_window.contents_opacity = 0
  8262.   end  
  8263.  
  8264.   #--------------------------------------------------------------------------
  8265.   # ● Create Parameter
  8266.   #--------------------------------------------------------------------------    
  8267.   def create_parameter
  8268.       @parameter = Status_Parameter.new(@actor)
  8269.   end
  8270.  
  8271. end
  8272.  
  8273. #==============================================================================
  8274. # ■ Scene_Status
  8275. #==============================================================================
  8276. class Scene_Status
  8277.  
  8278.   #--------------------------------------------------------------------------
  8279.   # ● Execute Dispose
  8280.   #--------------------------------------------------------------------------        
  8281.   def execute_dispose
  8282.       Graphics.freeze
  8283.       dispose_background
  8284.       dispose_layout
  8285.       dispose_particles
  8286.       dispose_status_window
  8287.       dispose_parameter
  8288.    end
  8289.  
  8290.   #--------------------------------------------------------------------------
  8291.   # ● Dispose Background
  8292.   #--------------------------------------------------------------------------  
  8293.   def dispose_background
  8294.       return if @background == nil
  8295.       @background.dispose
  8296.       @background = nil
  8297.   end
  8298.  
  8299.   #--------------------------------------------------------------------------
  8300.   # ● Dispose Layout
  8301.   #--------------------------------------------------------------------------                
  8302.   def dispose_layout
  8303.       return if @layout == nil
  8304.       @layout.dispose
  8305.       @layout = nil
  8306.   end  
  8307.  
  8308.  #--------------------------------------------------------------------------
  8309.  # ● Dispose Particles
  8310.  #--------------------------------------------------------------------------    
  8311.  def dispose_particles
  8312.      return if @particles_sprite == nil
  8313.      @particles_sprite.each {|sprite| sprite.dispose }
  8314.  end    
  8315.  
  8316.   #--------------------------------------------------------------------------
  8317.   # ● Dispose Status Window
  8318.   #--------------------------------------------------------------------------  
  8319.   def dispose_status_window
  8320.       return if @status_window == nil
  8321.       @status_window.dispose
  8322.   end  
  8323.  
  8324.   #--------------------------------------------------------------------------
  8325.   # ● Dispose Parameter
  8326.   #--------------------------------------------------------------------------    
  8327.   def dispose_parameter
  8328.       return if @parameter == nil
  8329.       @parameter.dispose
  8330.   end  
  8331.  
  8332. end
  8333.  
  8334. #==============================================================================
  8335. # ■ Scene Status
  8336. #==============================================================================
  8337. class Scene_Status
  8338.  
  8339.   #--------------------------------------------------------------------------
  8340.   # ● Update Sprites
  8341.   #--------------------------------------------------------------------------          
  8342.   def update_sprites    
  8343.       update_background
  8344.       update_particles    
  8345.       update_status_window
  8346.       update_parameter
  8347.       update_move
  8348.   end
  8349.  
  8350.   #--------------------------------------------------------------------------
  8351.   # ● Update Background
  8352.   #--------------------------------------------------------------------------              
  8353.   def update_background
  8354.       return if @background == nil
  8355.       @background.ox += @background_scroll[0]
  8356.       @background.oy += @background_scroll[1]
  8357.   end    
  8358.  
  8359.   #--------------------------------------------------------------------------
  8360.   # ● Update Particles
  8361.   #--------------------------------------------------------------------------  
  8362.   def update_particles
  8363.       return if @particles_sprite == nil
  8364.       @particles_sprite.each {|sprite| sprite.update }
  8365.   end
  8366.  
  8367.   #--------------------------------------------------------------------------
  8368.   # ● Update Sprites
  8369.   #--------------------------------------------------------------------------  
  8370.   def update_status_window
  8371.       return if @status_window == nil
  8372.       @status_window.update
  8373.   end
  8374.    
  8375.   #--------------------------------------------------------------------------
  8376.   # ● Update Move
  8377.   #--------------------------------------------------------------------------      
  8378.   def update_move
  8379.       update_slide(0,@status_window,@org_pos_win[0],0)
  8380.       update_slide(1,@status_window,@org_pos_win[1],0)
  8381.       update_slide(0,@layout,0,1)
  8382.       update_slide(1,@layout,0,1)    
  8383.   end  
  8384.  
  8385.  #--------------------------------------------------------------------------
  8386.  # ● Update Slide
  8387.  #--------------------------------------------------------------------------                      
  8388.   def update_slide(type,sprite,np,opa)
  8389.       if opa == 0
  8390.          sprite.contents_opacity += 5
  8391.       else  
  8392.          sprite.opacity += 5
  8393.       end  
  8394.       cp = type == 0 ? sprite.x : sprite.y
  8395.       sp = 3 + ((cp - np).abs / 10)
  8396.       if cp > np
  8397.          cp -= sp
  8398.          cp = np if cp < np
  8399.       elsif cp < np
  8400.          cp += sp
  8401.          cp = np if cp > np
  8402.       end    
  8403.       sprite.x = cp if type == 0
  8404.       sprite.y = cp if type == 1
  8405.   end    
  8406.  
  8407.   #--------------------------------------------------------------------------
  8408.   # ● Update Parameter
  8409.   #--------------------------------------------------------------------------    
  8410.   def update_parameter
  8411.       return if @parameter == nil
  8412.       @parameter.update
  8413.   end    
  8414.  
  8415. end
  8416.  
  8417. #==============================================================================
  8418. # ■ Scene_Status
  8419. #==============================================================================
  8420. class Scene_Status
  8421.  
  8422.   #--------------------------------------------------------------------------
  8423.   # ● Update
  8424.   #--------------------------------------------------------------------------      
  8425.   def update
  8426.       update_sprites
  8427.       update_command
  8428.   end
  8429.  
  8430.   #--------------------------------------------------------------------------
  8431.   # ● Return Scene
  8432.   #--------------------------------------------------------------------------          
  8433.   def return_scene
  8434.       Sound.play_cancel
  8435.       SceneManager.return
  8436.   end
  8437.  
  8438.   #--------------------------------------------------------------------------
  8439.   # ● ON Actor Charge
  8440.   #--------------------------------------------------------------------------
  8441.   def on_actor_change
  8442.       Sound.play_cursor
  8443.       $game_temp.actor_menu_temp = @actor
  8444.       SceneManager.goto(Scene_Status)
  8445.   end  
  8446.  
  8447. end
  8448.  
  8449. #==============================================================================
  8450. # ■ Scene_Status
  8451. #==============================================================================
  8452. class Scene_Status
  8453.  
  8454.   #--------------------------------------------------------------------------
  8455.   # ● Update Command
  8456.   #--------------------------------------------------------------------------      
  8457.   def update_command
  8458.       update_next_actor
  8459.   end
  8460.  
  8461.   #--------------------------------------------------------------------------
  8462.   # ● Update Next Actor
  8463.   #--------------------------------------------------------------------------        
  8464.   def update_next_actor
  8465.       if Input.trigger?(:RIGHT)
  8466.          @status_window.next_actor
  8467.        elsif Input.trigger?(:LEFT)
  8468.          @status_window.prev_actor
  8469.       end
  8470.   end
  8471.  
  8472. end
  8473.  
  8474.  
  8475.  
  8476. #==============================================================================
  8477. # ■ Game_Temp
  8478. #==============================================================================
  8479. class Game_Temp
  8480.  
  8481.   #--------------------------------------------------------------------------
  8482.   # ● Execute Pre Cache Party Menu
  8483.   #--------------------------------------------------------------------------    
  8484.   def execute_pre_cache_party_menu
  8485.       @pre_cache_party_menu = []
  8486.       @pre_cache_party_menu.push(Cache.menu_party("Background"))
  8487.       @pre_cache_party_menu.push(Cache.menu_party("LayoutParty"))
  8488.   end    
  8489.    
  8490. end
  8491.  
  8492. #==============================================================================
  8493. # ■ Scene_Party
  8494. #==============================================================================
  8495. class Scene_Party
  8496.   include MOG_MENU_PARTY
  8497.   include MOG_MENU_BASE
  8498.  
  8499.   #--------------------------------------------------------------------------
  8500.   # ● Main
  8501.   #--------------------------------------------------------------------------        
  8502.   def main
  8503.       execute_setup
  8504.       execute_loop
  8505.       execute_dispose
  8506.   end  
  8507.  
  8508.   #--------------------------------------------------------------------------
  8509.   # ● Execute Setup
  8510.   #--------------------------------------------------------------------------        
  8511.   def execute_setup
  8512.       @phase = 0
  8513.       @actor = $game_party.members[0]
  8514.       @actor_old = @actor
  8515.       create_sprites
  8516.   end
  8517.  
  8518.   #--------------------------------------------------------------------------
  8519.   # ● Execute Lopp
  8520.   #--------------------------------------------------------------------------        
  8521.   def execute_loop
  8522.       Graphics.transition(10)
  8523.       loop do
  8524.          Input.update
  8525.          update
  8526.          Graphics.update
  8527.          break if SceneManager.scene != self
  8528.       end
  8529.   end
  8530.  
  8531. end
  8532.  
  8533. #==============================================================================
  8534. # ■ Actor Menu Status Party
  8535. #==============================================================================
  8536. class Actor_Menu_Status_Party
  8537.  
  8538.   include MOG_ACTOR_MENU_PARTY
  8539.  
  8540.   #--------------------------------------------------------------------------
  8541.   # ● Initialize
  8542.   #--------------------------------------------------------------------------
  8543.   def initialize
  8544.       @active = false
  8545.       @max_members = $game_party.max_battle_members
  8546.       @max_members = $game_party.members.size if @max_members > $game_party.members.size
  8547.       create_sprites
  8548.   end
  8549.  
  8550.   #--------------------------------------------------------------------------
  8551.   # ● Create Sprites
  8552.   #--------------------------------------------------------------------------  
  8553.   def create_sprites
  8554.       @face = []
  8555.       @face_org = []
  8556.       @name = []
  8557.       @name_org = []
  8558.       @actor_id = []
  8559.       space = 70
  8560.       index = 0
  8561.       for actor in $game_party.members  
  8562.          @face.push(Sprite.new)
  8563.          @face_org[index] = [FACE_POSITION[0],FACE_POSITION[1] + space * index]
  8564.          @face[index].x = @face_org[index][0] + 150 + (150 * index)
  8565.          @face[index].y = @face_org[index][1]
  8566.          @face[index].z = 10  
  8567.          @name.push(Sprite.new)
  8568.          @name[index].bitmap = Bitmap.new(200,120)
  8569.          @name[index].bitmap.font.size = FONT_SIZE
  8570.          @name[index].bitmap.font.bold = FONT_BOLD
  8571.          @name_org[index] = [NAME_POSITION[0],NAME_POSITION[1] + space * index]
  8572.          @name[index].x = @name_org[index][0] + 150 + (150 * index)
  8573.          @name[index].y = @name_org[index][1]
  8574.          @name[index].z = 11
  8575.          @actor_id[index] = actor.id
  8576.          index += 1
  8577.          break if index >= @max_members
  8578.       end
  8579.       refresh
  8580.   end
  8581.  
  8582.   #--------------------------------------------------------------------------
  8583.   # ● Refresh Position
  8584.   #--------------------------------------------------------------------------    
  8585.   def refresh_position(actor,index)
  8586.       @actor_id[index] = actor.id
  8587.       @face[index].x = @face_org[index][0] + 150 + (150 * index)
  8588.       @name[index].x = @name_org[index][0] + 150 + (150 * index)    
  8589.   end
  8590.  
  8591.   #--------------------------------------------------------------------------
  8592.   # ● Dispose
  8593.   #--------------------------------------------------------------------------      
  8594.   def dispose
  8595.       @face.each {|sprite| sprite.dispose }
  8596.       @name.each {|sprite| sprite.bitmap.dispose }
  8597.       @name.each {|sprite| sprite.dispose }
  8598.   end
  8599.    
  8600.   #--------------------------------------------------------------------------
  8601.   # ● Refresh
  8602.   #--------------------------------------------------------------------------      
  8603.   def refresh
  8604.       index = 0
  8605.       for actor in $game_party.members  
  8606.           face_name = "Face_B" + actor.id.to_s
  8607.           @face[index].bitmap = Cache.menu(face_name.to_s)
  8608.           @name[index].bitmap.clear
  8609.           @name[index].bitmap.draw_text(100,28,64,32,"LV " + actor.level.to_s,0)
  8610.           aname = actor.name
  8611.           @name[index].bitmap.draw_text(0,0,100,32,aname.to_s,0)
  8612.           refresh_position(actor,index) if @actor_id[index] != actor.id
  8613.           index += 1
  8614.           break if index >= @max_members
  8615.       end
  8616.   end
  8617.  
  8618.  #--------------------------------------------------------------------------
  8619.  # ● Update Slide
  8620.  #--------------------------------------------------------------------------                      
  8621.   def update_slide(type,sprite,np)
  8622.       sprite.opacity += 5
  8623.       cp = type == 0 ? sprite.x : sprite.y
  8624.       sp = 3 + ((cp - np).abs / 10)
  8625.       if cp > np
  8626.          cp -= sp
  8627.          cp = np if cp < np
  8628.       elsif cp < np
  8629.          cp += sp
  8630.          cp = np if cp > np
  8631.       end    
  8632.       sprite.x = cp if type == 0
  8633.       sprite.y = cp if type == 1
  8634.   end      
  8635.  
  8636.   #--------------------------------------------------------------------------
  8637.   # ● Update
  8638.   #--------------------------------------------------------------------------
  8639.   def update(actor)
  8640.       for index in 0...@name.size
  8641.           update_slide(0,@face[index],@face_org[index][0])
  8642.           update_slide(1,@face[index],@face_org[index][1])
  8643.           update_slide(0,@name[index],@name_org[index][0])
  8644.           update_slide(1,@name[index],@name_org[index][1])
  8645.       end      
  8646.   end      
  8647.  
  8648. end
  8649.  
  8650. #==============================================================================
  8651. # ■ Window_MenuStatus Party
  8652. #==============================================================================
  8653. class Window_MenuStatus_Party < Window_Selectable
  8654.   attr_reader   :pending_index          
  8655.  
  8656.   #--------------------------------------------------------------------------
  8657.   # ● Initialize
  8658.   #--------------------------------------------------------------------------
  8659.   def initialize(x, y)
  8660.       super(x, y, window_width, window_height)
  8661.       @pending_index = -1
  8662.       self.opacity = 0
  8663.       self.contents.font.bold = true
  8664.       self.contents.font.size = 18
  8665.       refresh
  8666.   end
  8667.  
  8668.   #--------------------------------------------------------------------------
  8669.   # ● Window Width
  8670.   #--------------------------------------------------------------------------
  8671.   def window_width
  8672.       Graphics.width - 160
  8673.   end
  8674.  
  8675.   #--------------------------------------------------------------------------
  8676.   # ● Window Height
  8677.   #--------------------------------------------------------------------------
  8678.   def window_height
  8679.       Graphics.height
  8680.   end
  8681.  
  8682.   #--------------------------------------------------------------------------
  8683.   # ● Item Max
  8684.   #--------------------------------------------------------------------------
  8685.   def item_max
  8686.       $game_party.members.size
  8687.   end
  8688.  
  8689.   #--------------------------------------------------------------------------
  8690.   # ● Item Height
  8691.   #--------------------------------------------------------------------------
  8692.   def item_height
  8693.     (height - standard_padding * 2) / 4
  8694.   end
  8695.  
  8696.   #--------------------------------------------------------------------------
  8697.   # ● Draw Item
  8698.   #--------------------------------------------------------------------------
  8699.   def draw_item(index)
  8700.     actor = $game_party.members[index]
  8701.     enabled = $game_party.battle_members.include?(actor)
  8702.     rect = item_rect(index)
  8703.     draw_item_background(index)
  8704.     draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
  8705.     self.contents.font.color = Color.new(255,155,55,255)
  8706.     draw_text(rect.x + 60,rect.y + 23,64,32,"LV",2)
  8707.     draw_text(rect.x + 60,rect.y + 43,64,32,"HP",2)
  8708.     draw_text(rect.x + 60,rect.y + 63,64,32,"MP",2)
  8709.    
  8710.     draw_text(rect.x + 140,rect.y + 23,64,32,"Atk",2)
  8711.     draw_text(rect.x + 140,rect.y + 43,64,32,"Def",2)
  8712.     draw_text(rect.x + 140,rect.y + 63,64,32,"Agi",2)    
  8713.    
  8714.     draw_text(rect.x + 220,rect.y + 23,64,32,"Mag",2)
  8715.     draw_text(rect.x + 220,rect.y + 43,64,32,"Mdf",2)
  8716.     draw_text(rect.x + 220,rect.y + 63,64,32,"Luk",2)      
  8717.    
  8718.     self.contents.font.color = Color.new(255,255,255,255)
  8719.     draw_text(rect.x + 105,rect.y,105,32,actor.name,0)
  8720.  
  8721.     draw_text(rect.x + 105,rect.y + 23,64,32,actor.level,2)
  8722.     draw_text(rect.x + 105,rect.y + 43,64,32,actor.mhp,2)
  8723.     draw_text(rect.x + 105,rect.y + 63,64,32,actor.mmp,2)    
  8724.    
  8725.    
  8726.     draw_text(rect.x + 185,rect.y + 23,64,32,actor.atk,2)
  8727.     draw_text(rect.x + 185,rect.y + 43,64,32,actor.def,2)
  8728.     draw_text(rect.x + 185,rect.y + 63,64,32,actor.agi,2)  
  8729.    
  8730.     draw_text(rect.x + 265,rect.y + 23,64,32,actor.mat,2)
  8731.     draw_text(rect.x + 265,rect.y + 43,64,32,actor.mdf,2)
  8732.     draw_text(rect.x + 265,rect.y + 63,64,32,actor.luk,2)      
  8733.    
  8734.   end
  8735.  
  8736.  
  8737.   #--------------------------------------------------------------------------
  8738.   # ● Draw Item Background
  8739.   #--------------------------------------------------------------------------
  8740.   def draw_item_background(index)
  8741.       if index == @pending_index
  8742.         contents.fill_rect(item_rect(index), pending_color)
  8743.       end
  8744.   end
  8745.  
  8746.   #--------------------------------------------------------------------------
  8747.   # ● Process OK
  8748.   #--------------------------------------------------------------------------
  8749.   def process_ok
  8750.       super
  8751.       $game_party.menu_actor = $game_party.members[index]
  8752.   end
  8753.  
  8754.   #--------------------------------------------------------------------------
  8755.   # ● Select Last
  8756.   #--------------------------------------------------------------------------
  8757.   def select_last
  8758.       select($game_party.menu_actor.index || 0)
  8759.   end
  8760.  
  8761.   #--------------------------------------------------------------------------
  8762.   # ● Pending Index
  8763.   #--------------------------------------------------------------------------
  8764.   def pending_index=(index)
  8765.       last_pending_index = @pending_index
  8766.       @pending_index = index
  8767.       redraw_item(@pending_index)
  8768.       redraw_item(last_pending_index)
  8769.   end
  8770. end
  8771.  
  8772. #==============================================================================
  8773. # ■ Scene_Party
  8774. #==============================================================================
  8775. class Scene_Party
  8776.  
  8777.   #--------------------------------------------------------------------------
  8778.   # ● Create Sprites
  8779.   #--------------------------------------------------------------------------
  8780.   def create_sprites
  8781.       create_menu_background
  8782.       create_layout
  8783.       create_particles
  8784.       create_status_window
  8785.       create_actor_menu
  8786.   end
  8787.  
  8788.   #--------------------------------------------------------------------------
  8789.   # ● Create Status Window
  8790.   #--------------------------------------------------------------------------
  8791.   def create_status_window
  8792.       @status_window = Window_MenuStatus_Party.new(0, 0)
  8793.       command_formation
  8794.   end  
  8795.  
  8796.   #--------------------------------------------------------------------------
  8797.   # ● Create Actor Menu
  8798.   #--------------------------------------------------------------------------  
  8799.   def create_actor_menu
  8800.       @actor_status = Actor_Menu_Status_Party.new  
  8801.   end
  8802.  
  8803.   #--------------------------------------------------------------------------
  8804.   # ● Command Personal
  8805.   #--------------------------------------------------------------------------
  8806.   def command_personal
  8807.     @status_window.select_last
  8808.     @status_window.activate
  8809.     @status_window.set_handler(:ok,     method(:on_personal_ok))
  8810.     @status_window.set_handler(:cancel, method(:on_personal_cancel))
  8811.   end
  8812.  
  8813.   #--------------------------------------------------------------------------
  8814.   # ● Command Formation
  8815.   #--------------------------------------------------------------------------
  8816.   def command_formation
  8817.     @status_window.index = 0
  8818.     @old_index = @status_window.index
  8819.     @status_window.activate
  8820.     @status_window.set_handler(:ok,     method(:on_formation_ok))
  8821.     @status_window.set_handler(:cancel, method(:on_formation_cancel))
  8822.   end
  8823.  
  8824.   #--------------------------------------------------------------------------
  8825.   # ● On Personal Cancel
  8826.   #--------------------------------------------------------------------------
  8827.   def on_personal_cancel
  8828.       @status_window.unselect
  8829.   end
  8830.  
  8831.   #--------------------------------------------------------------------------
  8832.   # ● On Formation OK
  8833.   #--------------------------------------------------------------------------
  8834.   def on_formation_ok    
  8835.       if @status_window.pending_index >= 0
  8836.         $game_party.swap_order(@status_window.index,
  8837.                                @status_window.pending_index)
  8838.         @status_window.pending_index = -1
  8839.         @status_window.redraw_item(@status_window.index)
  8840.         @actor_status.refresh
  8841.       else
  8842.         @status_window.pending_index = @status_window.index        
  8843.       end
  8844.       @status_window.activate
  8845.   end
  8846.  
  8847.   #--------------------------------------------------------------------------
  8848.   # ● On Formation Cancel
  8849.   #--------------------------------------------------------------------------
  8850.   def on_formation_cancel
  8851.       if @status_window.pending_index >= 0
  8852.          @status_window.pending_index = -1
  8853.          @status_window.activate        
  8854.       else
  8855.          return_scene
  8856.       end
  8857.   end  
  8858.  
  8859.   #--------------------------------------------------------------------------
  8860.   # ● Create Menu Background
  8861.   #--------------------------------------------------------------------------            
  8862.   def create_menu_background
  8863.       @background = Plane.new
  8864.       @background.bitmap = $game_temp.pre_cache_party_menu[0]
  8865.       @background.z = 0
  8866.       @background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
  8867.   end    
  8868.  
  8869.   #--------------------------------------------------------------------------
  8870.   # ● Create Layout
  8871.   #--------------------------------------------------------------------------              
  8872.   def create_layout    
  8873.       @layout = Sprite.new
  8874.       @layout.bitmap = $game_temp.pre_cache_party_menu[1]
  8875.       @layout.z = 3
  8876.   end  
  8877.  
  8878.   #--------------------------------------------------------------------------
  8879.   # ● Create Particles
  8880.   #--------------------------------------------------------------------------  
  8881.   def create_particles
  8882.       @particles_sprite =[]
  8883.       for i in 0...NUMBER_OF_PARTICLES
  8884.           @particles_sprite.push(Particles_Menu.new(nil))
  8885.       end
  8886.   end  
  8887.    
  8888. end
  8889.  
  8890. #==============================================================================
  8891. # ■ Scene_Party
  8892. #==============================================================================
  8893. class Scene_Party
  8894.  
  8895.   #--------------------------------------------------------------------------
  8896.   # ● Execute Dispose
  8897.   #--------------------------------------------------------------------------        
  8898.   def execute_dispose
  8899.       Graphics.freeze
  8900.       dispose_background
  8901.       dispose_layout
  8902.       dispose_particles
  8903.       dispose_status_window
  8904.       dispose_actor_menu
  8905.    end
  8906.  
  8907.   #--------------------------------------------------------------------------
  8908.   # ● Dispose Status Window
  8909.   #--------------------------------------------------------------------------          
  8910.    def dispose_status_window
  8911.        @status_window.dispose
  8912.    end
  8913.      
  8914.   #--------------------------------------------------------------------------
  8915.   # ● Dispose Background
  8916.   #--------------------------------------------------------------------------  
  8917.   def dispose_background
  8918.       return if @background == nil
  8919.       @background.dispose
  8920.       @background = nil
  8921.   end    
  8922.  
  8923.   #--------------------------------------------------------------------------
  8924.   # ● Dispose Layout
  8925.   #--------------------------------------------------------------------------                
  8926.   def dispose_layout
  8927.       return if @layout == nil
  8928.       @layout.dispose
  8929.       @layout = nil
  8930.   end  
  8931.  
  8932.  #--------------------------------------------------------------------------
  8933.  # ● Dispose Particles
  8934.  #--------------------------------------------------------------------------    
  8935.  def dispose_particles
  8936.      return if @particles_sprite == nil
  8937.      @particles_sprite.each {|sprite| sprite.dispose }
  8938.  end    
  8939.  
  8940.  #--------------------------------------------------------------------------
  8941.  # ● Dispose Actor Menu
  8942.  #--------------------------------------------------------------------------  
  8943.  def dispose_actor_menu
  8944.      return if @actor_status == nil
  8945.      @actor_status.dispose
  8946.  end  
  8947.  
  8948. end
  8949.  
  8950. #==============================================================================
  8951. # ■ Scene_Party
  8952. #==============================================================================
  8953. class Scene_Party
  8954.  
  8955.   #--------------------------------------------------------------------------
  8956.   # ● Update Sprites
  8957.   #--------------------------------------------------------------------------          
  8958.   def update_sprites    
  8959.       update_background
  8960.       update_particles
  8961.       update_status_window
  8962.   end
  8963.  
  8964.   #--------------------------------------------------------------------------
  8965.   # ● Update Background
  8966.   #--------------------------------------------------------------------------              
  8967.   def update_background
  8968.       return if @background == nil
  8969.       @background.ox += @background_scroll[0]
  8970.       @background.oy += @background_scroll[1]
  8971.   end    
  8972.  
  8973.   #--------------------------------------------------------------------------
  8974.   # ● Update Particles
  8975.   #--------------------------------------------------------------------------  
  8976.   def update_particles
  8977.       return if @particles_sprite == nil
  8978.       @particles_sprite.each {|sprite| sprite.update }
  8979.   end
  8980.  
  8981.   #--------------------------------------------------------------------------
  8982.   # ● Update Status Window
  8983.   #--------------------------------------------------------------------------    
  8984.   def update_status_window
  8985.       return if @status_window == nil
  8986.       @status_window.update
  8987.       update_slide(0,@status_window,0)
  8988.       update_slide(1,@status_window,0)
  8989.       @actor = $game_party.members[@status_window.index]
  8990.       @actor_status.update(@actor)
  8991.   end
  8992.  
  8993.  #--------------------------------------------------------------------------
  8994.  # ● Update Slide
  8995.  #--------------------------------------------------------------------------                      
  8996.   def update_slide(type,sprite,np)
  8997.       sprite.contents_opacity += 5
  8998.       cp = type == 0 ? sprite.x : sprite.y
  8999.       sp = 3 + ((cp - np).abs / 10)
  9000.       if cp > np
  9001.          cp -= sp
  9002.          cp = np if cp < np
  9003.       elsif cp < np
  9004.          cp += sp
  9005.          cp = np if cp > np
  9006.       end    
  9007.       sprite.x = cp if type == 0
  9008.       sprite.y = cp if type == 1
  9009.   end    
  9010.  
  9011. end
  9012.  
  9013. #==============================================================================
  9014. # ■ Scene_Party
  9015. #==============================================================================
  9016. class Scene_Party
  9017.  
  9018.   #--------------------------------------------------------------------------
  9019.   # ● Update
  9020.   #--------------------------------------------------------------------------      
  9021.   def update
  9022.       update_sprites
  9023.       update_command
  9024.   end
  9025.  
  9026.   #--------------------------------------------------------------------------
  9027.   # ● Return Scene
  9028.   #--------------------------------------------------------------------------          
  9029.   def return_scene
  9030.       Sound.play_cancel
  9031.       SceneManager.return
  9032.   end
  9033.  
  9034.   #--------------------------------------------------------------------------
  9035.   # ● ON Actor Charge
  9036.   #--------------------------------------------------------------------------
  9037.   def on_actor_change
  9038.       $game_temp.actor_menu_temp = @actor
  9039.       SceneManager.goto(Scene_Status)
  9040.   end  
  9041.  
  9042. end
  9043.  
  9044. #==============================================================================
  9045. # ■ Scene_Party
  9046. #==============================================================================
  9047. class Scene_Party
  9048.  
  9049.   #--------------------------------------------------------------------------
  9050.   # ● Update Command
  9051.   #--------------------------------------------------------------------------      
  9052.   def update_command
  9053.    
  9054.   end
  9055.  
  9056. end
  9057.  
  9058. #==============================================================================
  9059. # ■ Game_Temp
  9060. #==============================================================================
  9061. class Game_Temp
  9062.  
  9063.   #--------------------------------------------------------------------------
  9064.   # ● Execute Pre Cache File Menu
  9065.   #--------------------------------------------------------------------------    
  9066.   def execute_pre_cache_file_menu
  9067.       @pre_cache_file_menu = []
  9068.       @pre_cache_file_menu.push(Cache.menu_save(""))
  9069.       @pre_cache_file_menu.push(Cache.menu_save(""))
  9070.       @pre_cache_file_menu.push(Cache.menu_save(""))
  9071.       @pre_cache_file_menu.push(Cache.menu_save(""))
  9072.       @pre_cache_file_menu.push(Cache.menu_save(""))
  9073.       @pre_cache_file_menu.push(Cache.menu_save(""))
  9074.       @pre_cache_file_menu.push(Cache.menu_save(""))
  9075.       @pre_cache_file_menu.push(Cache.menu_save(""))
  9076.   end    
  9077.    
  9078. end
  9079.  
  9080. #==============================================================================
  9081. # ■ Game Temp
  9082. #==============================================================================
  9083. class Game_Temp
  9084.  
  9085.   attr_accessor :scene_save
  9086.   #--------------------------------------------------------------------------
  9087.   # ● Initialize
  9088.   #--------------------------------------------------------------------------
  9089.   alias mog_scene_file_initialize initialize
  9090.   def initialize
  9091.       mog_scene_file_initialize
  9092.       @scene_save = false  
  9093.   end
  9094.  
  9095. end
  9096.    
  9097. #==============================================================================
  9098. # ■ Window_Base
  9099. #==============================================================================
  9100. class Window_Base < Window
  9101.  
  9102.   #--------------------------------------------------------------------------
  9103.   # ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index)    
  9104.   #--------------------------------------------------------------------------
  9105.   # X - Posição na horizontal
  9106.   # Y - Posição na vertical
  9107.   # VALUE - Valor Numérico
  9108.   # FILE_NAME - Nome do arquivo
  9109.   # ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita  
  9110.   # SPACE - Espaço entre os números.
  9111.   # FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter.
  9112.   # FRAME_INDEX - Definição do quadro a ser utilizado.
  9113.   #--------------------------------------------------------------------------  
  9114.   def draw_picture_number_file(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0)    
  9115.       number_image = $game_temp.pre_cache_file_menu[7]
  9116.       frame_max = 1 if frame_max < 1
  9117.       frame_index = frame_max -1 if frame_index > frame_max -1
  9118.       align = 2 if align > 2
  9119.       cw = number_image.width / 10
  9120.       ch = number_image.height / frame_max
  9121.       h = ch * frame_index
  9122.       number = value.abs.to_s.split(//)
  9123.       case align
  9124.          when 0
  9125.             plus_x = (-cw + space) * number.size
  9126.          when 1
  9127.             plus_x = (-cw + space) * number.size
  9128.             plus_x /= 2
  9129.          when 2  
  9130.             plus_x = 0
  9131.       end
  9132.       for r in 0..number.size - 1      
  9133.           number_abs = number[r].to_i
  9134.           number_rect = Rect.new(cw * number_abs, h, cw, ch)
  9135.           self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect)        
  9136.       end    
  9137.   end
  9138.    
  9139.   #--------------------------------------------------------------------------
  9140.   # ● Draw Help Layout
  9141.   #--------------------------------------------------------------------------
  9142.   def draw_face_save(name,x,y,type)
  9143.       if type == 0
  9144.          image_name = name + "_0"
  9145.       elsif type == 1
  9146.          image_name = name + "_1"        
  9147.       else  
  9148.          image_name = name + "_2"
  9149.       end
  9150.       image = Cache.face(image_name)    
  9151.       cw = image.width  
  9152.       ch = image.height
  9153.       src_rect = Rect.new(0, 0, cw, ch)    
  9154.       self.contents.blt(x , y , image, src_rect)  
  9155.       image.dispose
  9156.   end    
  9157.    
  9158.   #--------------------------------------------------------------------------
  9159.   # ● draw_parameter_layout
  9160.   #--------------------------------------------------------------------------  
  9161.   def draw_parameter_layout(x,y)
  9162.       image = $game_temp.pre_cache_file_menu[3]
  9163.       cw = image.width  
  9164.       ch = image.height
  9165.       src_rect = Rect.new(0, 0, cw, ch)    
  9166.       self.contents.blt(x , y , image, src_rect)    
  9167.   end    
  9168.  
  9169.   #--------------------------------------------------------------------------
  9170.   # ● draw_parameter_layout2
  9171.   #--------------------------------------------------------------------------  
  9172.   def draw_parameter_layout2(x,y,type)
  9173.       if type == 0
  9174.          image = $game_temp.pre_cache_file_menu[4]
  9175.       else  
  9176.          image = $game_temp.pre_cache_file_menu[5]
  9177.       end  
  9178.       cw = image.width  
  9179.       ch = image.height
  9180.       src_rect = Rect.new(0, 0, cw, ch)    
  9181.       self.contents.blt(x , y , image, src_rect)    
  9182.   end      
  9183.  
  9184.   #--------------------------------------------------------------------------
  9185.   # ● draw_character_floor
  9186.   #--------------------------------------------------------------------------  
  9187.   def draw_character_floor(x,y)
  9188.       image = $game_temp.pre_cache_file_menu[6]
  9189.       cw = image.width  
  9190.       ch = image.height
  9191.       src_rect = Rect.new(0, 0, cw, ch)    
  9192.       self.contents.blt(x , y , image, src_rect)    
  9193.   end
  9194.  
  9195. end  
  9196.  
  9197. #==============================================================================
  9198. # ■ Game_Temp
  9199. #==============================================================================
  9200. class Game_Temp
  9201.  
  9202.   #--------------------------------------------------------------------------
  9203.   # ● Execute Pre Cache End Menu
  9204.   #--------------------------------------------------------------------------    
  9205.   def execute_pre_cache_end_menu
  9206.       @pre_cache_end_menu = []
  9207.       @pre_cache_end_menu.push(Cache.menu_end("Background"))
  9208.       @pre_cache_end_menu.push(Cache.menu_end("LayoutEnd"))
  9209.   end    
  9210.    
  9211. end
  9212.  
  9213. #==============================================================================
  9214. # ■ Scene_End
  9215. #==============================================================================
  9216. class Scene_End
  9217.   include MOG_MENU_END
  9218.   include MOG_MENU_BASE
  9219.  
  9220.   #--------------------------------------------------------------------------
  9221.   # ● Main
  9222.   #--------------------------------------------------------------------------        
  9223.   def main
  9224.       execute_setup
  9225.       execute_loop
  9226.       execute_dispose
  9227.   end  
  9228.  
  9229.   #--------------------------------------------------------------------------
  9230.   # ● Execute Setup
  9231.   #--------------------------------------------------------------------------        
  9232.   def execute_setup
  9233.       @phase = 0
  9234.       create_sprites
  9235.   end
  9236.  
  9237.   #--------------------------------------------------------------------------
  9238.   # ● Execute Lopp
  9239.   #--------------------------------------------------------------------------        
  9240.   def execute_loop
  9241.       Graphics.transition(10)
  9242.       loop do
  9243.          Input.update
  9244.          update
  9245.          Graphics.update
  9246.          break if SceneManager.scene != self
  9247.       end
  9248.   end
  9249.  
  9250. end
  9251.  
  9252. #==============================================================================
  9253. # ■ Scene_End
  9254. #==============================================================================
  9255. class Scene_End
  9256.  
  9257.   #--------------------------------------------------------------------------
  9258.   # ● Create Sprites
  9259.   #--------------------------------------------------------------------------
  9260.   def create_sprites
  9261.       create_menu_background
  9262.       create_layout
  9263.       create_particles
  9264.       create_command_window
  9265.   end
  9266.  
  9267.   #--------------------------------------------------------------------------
  9268.   # ● Create Menu Background
  9269.   #--------------------------------------------------------------------------            
  9270.   def create_menu_background
  9271.       @background = Plane.new
  9272.       @background.bitmap = $game_temp.pre_cache_end_menu[0]
  9273.       @background.z = 0
  9274.       @background_scroll = [BACKGROUND_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1]]
  9275.   end    
  9276.  
  9277.   #--------------------------------------------------------------------------
  9278.   # ● Create Layout
  9279.   #--------------------------------------------------------------------------              
  9280.   def create_layout    
  9281.       @layout = Sprite.new
  9282.       @layout.bitmap = $game_temp.pre_cache_end_menu[1]
  9283.       @layout.z = 3
  9284.   end  
  9285.  
  9286.   #--------------------------------------------------------------------------
  9287.   # ● Create Particles
  9288.   #--------------------------------------------------------------------------  
  9289.   def create_particles
  9290.       @particles_sprite =[]
  9291.       for i in 0...NUMBER_OF_PARTICLES
  9292.           @particles_sprite.push(Particles_Menu.new(nil))
  9293.       end
  9294.   end  
  9295.    
  9296.   #--------------------------------------------------------------------------
  9297.   # ● Create Command Window
  9298.   #--------------------------------------------------------------------------
  9299.   def create_command_window
  9300.       @command_window = Window_GameEnd.new
  9301.       @command_window.set_handler(:to_title, method(:command_to_title))
  9302.       @command_window.set_handler(:shutdown, method(:command_shutdown))
  9303.       @command_window.set_handler(:cancel,   method(:return_scene))
  9304.   end  
  9305.  
  9306. end
  9307.  
  9308. #==============================================================================
  9309. # ■ Scene_End
  9310. #==============================================================================
  9311. class Scene_End
  9312.  
  9313.   #--------------------------------------------------------------------------
  9314.   # ● Execute Dispose
  9315.   #--------------------------------------------------------------------------        
  9316.   def execute_dispose
  9317.       Graphics.freeze
  9318.       dispose_background
  9319.       dispose_layout
  9320.       dispose_particles
  9321.       dispose_command_window
  9322.    end
  9323.  
  9324.   #--------------------------------------------------------------------------
  9325.   # ● Dispose Background
  9326.   #--------------------------------------------------------------------------  
  9327.   def dispose_background
  9328.       return if @background == nil
  9329.       @background.dispose
  9330.       @background = nil
  9331.   end
  9332.    
  9333.  
  9334.   #--------------------------------------------------------------------------
  9335.   # ● Dispose Layout
  9336.   #--------------------------------------------------------------------------                
  9337.   def dispose_layout
  9338.       return if @layout == nil
  9339.       @layout.dispose
  9340.       @layout = nil
  9341.   end  
  9342.  
  9343.  #--------------------------------------------------------------------------
  9344.  # ● Dispose Particles
  9345.  #--------------------------------------------------------------------------    
  9346.  def dispose_particles
  9347.      return if @particles_sprite == nil
  9348.      @particles_sprite.each {|sprite| sprite.dispose }
  9349.  end    
  9350.  
  9351.   #--------------------------------------------------------------------------
  9352.   # ● Dispose Command Window
  9353.   #--------------------------------------------------------------------------
  9354.   def dispose_command_window
  9355.       return if @command_window == nil
  9356.       @command_window.dispose
  9357.   end    
  9358.  
  9359. end
  9360.  
  9361. #==============================================================================
  9362. # ■ Scene_End
  9363. #==============================================================================
  9364. class Scene_End
  9365.  
  9366.   #--------------------------------------------------------------------------
  9367.   # ● Update Sprites
  9368.   #--------------------------------------------------------------------------          
  9369.   def update_sprites    
  9370.       update_background
  9371.       update_particles    
  9372.       update_command_window
  9373.   end
  9374.  
  9375.   #--------------------------------------------------------------------------
  9376.   # ● Update Background
  9377.   #--------------------------------------------------------------------------              
  9378.   def update_background
  9379.       return if @background == nil
  9380.       @background.ox += @background_scroll[0]
  9381.       @background.oy += @background_scroll[1]
  9382.   end    
  9383.  
  9384.   #--------------------------------------------------------------------------
  9385.   # ● Update Particles
  9386.   #--------------------------------------------------------------------------  
  9387.   def update_particles
  9388.       return if @particles_sprite == nil
  9389.       @particles_sprite.each {|sprite| sprite.update }
  9390.   end
  9391.  
  9392.   #--------------------------------------------------------------------------
  9393.   # ● Update Command Window
  9394.   #--------------------------------------------------------------------------
  9395.   def update_command_window
  9396.       return if @command_window == nil
  9397.       @command_window.update
  9398.   end      
  9399.  
  9400. end
  9401.  
  9402. #==============================================================================
  9403. # ■ Scene_End
  9404. #==============================================================================
  9405. class Scene_End
  9406.  
  9407.   #--------------------------------------------------------------------------
  9408.   # ● Update
  9409.   #--------------------------------------------------------------------------      
  9410.   def update
  9411.       update_sprites
  9412.       update_command
  9413.   end
  9414.  
  9415.   #--------------------------------------------------------------------------
  9416.   # ● Return Scene
  9417.   #--------------------------------------------------------------------------          
  9418.   def return_scene
  9419.       Sound.play_cancel
  9420.       SceneManager.return
  9421.   end
  9422.  
  9423.   #--------------------------------------------------------------------------
  9424.   # ● ON Actor Charge
  9425.   #--------------------------------------------------------------------------
  9426.   def on_actor_change
  9427.       $game_temp.actor_menu_temp = @actor
  9428.       SceneManager.goto(Scene_Status)
  9429.   end  
  9430.  
  9431.   #--------------------------------------------------------------------------
  9432.   # ● Update Command
  9433.   #--------------------------------------------------------------------------      
  9434.   def update_command    
  9435.   end  
  9436.  
  9437. end
  9438.  
  9439. class RPG::BaseItem
  9440.   def script_eval
  9441.     if @eval.nil?
  9442.       @eval = false
  9443.       if note[/<eval\s*:\s*(.+)>/i]
  9444.         @eval = $1.to_s
  9445.       end
  9446.     end
  9447.     return @eval
  9448.   end
  9449. end
  9450.  
  9451. class Scene_Item
  9452.   alias item_eval_on_use use_item
  9453.   def use_item
  9454.     if item.script_eval
  9455.       eval(item.script_eval)
  9456.     end
  9457.     item_eval_on_use
  9458.   end
  9459. end
  9460.  
  9461. def picture_gallery
  9462.   SceneManager.call(Scene_Picture_Gallery)
  9463. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement