设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1415|回复: 0
打印 上一主题 下一主题

[已经过期] 请教战斗中换人先关问题,先谢谢!

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1010
在线时间
423 小时
注册时间
2010-12-26
帖子
337
跳转到指定楼层
1
发表于 2012-8-18 20:04:11 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 358429534 于 2012-8-18 20:50 编辑

对不起!此为非公开资料!
1   实现出场战斗为1人,战斗人员为2人(不是待机人数啊)      
2   在1号人物死亡后自动推出2号人物战斗。
3   在战斗中更换队员后战斗结束,原先的队列排序变(若1号角色死亡,自动安排在队尾)
4   可设置替换次数
5   可实现每点一次扣除金钱(基础金钱*当前等级)
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Party System v1.08
  4. # -- Last Updated: 2012.01.23
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-PartySystem"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.23 - Bug fixed: Party members are now rearranged when newly added.
  15. # 2012.01.14 - New Feature: Maximum Battle Members Variable added.
  16. # 2012.01.07 - Bug fixed: Error with removing members.
  17. # 2012.01.05 - Bug fixed: Escape skill/item effects no longer counts as death.
  18. # 2011.12.26 - Compatibility Update: New Game+
  19. # 2011.12.17 - Updated Spriteset_Battle to have updated sprite counts.
  20. # 2011.12.13 - Updated to provide better visual display when more than 5 pieces
  21. #              of equipment are equipped on an actor at a time.
  22. # 2011.12.05 - Added functionality to display faces in the Party Select Window.
  23. #            - Fixed bug that doesn't refresh the caterpillar when new members
  24. #              join the party.
  25. # 2011.12.04 - Started Script and Finished.
  26. #
  27. #==============================================================================
  28. # ▼ Introduction
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # RPG Maker VX Ace comes with a very nice party system. However, changing the
  31. # maximum number of members isn't possible without the aid of a script. This
  32. # script enables you the ability to change the maximum number of party members,
  33. # change EXP rates, and/or open up a separate party menu (if desired). In
  34. # addition to that, you can lock the position of actors within a party and
  35. # require other actors to be in the active party before continuing.
  36. #
  37. #==============================================================================
  38. # ▼ Instructions
  39. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40. # To install this script, open up your script editor and copy/paste this script
  41. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  42. #
  43. # -----------------------------------------------------------------------------
  44. # 脚本命令语句 - These commands are used with script calls.
  45. # -----------------------------------------------------------------------------
  46. # *IMPORTANT* These script calls require the new party menu to be enabled to
  47. # use them. Otherwise, nothing will happen.
  48. #
  49. # lock_actor(x)      锁定X角色在队伍中的位置
  50. # unlock_actor(x)
  51. # This will lock actor x in its current position in the party if the actor is
  52. # in the current party. The actor is unable to switch position and must remain
  53. # in that position until the lock is removed. Use the unlock script call to
  54. # remove the locked status. This script requires the actor to have joined and
  55. # in the current party before the script call will work.
  56. #
  57. # require_actor(x)   需要X角色参战
  58. # unrequire_actor(x)
  59. # This will cause the party to require actor x in order to continue. If the
  60. # actor isn't in the current party but is in the reserve party, the party menu
  61. # will open up and prompt the player to add the required actor into the party
  62. # before being able to continue. This script call will not function unless the
  63. # specific actor has joined the party, whether it is in the current or reserve.
  64. #
  65. # call_party_menu    打开队伍菜单
  66. # This will open up the party menu. This script call requires for the party
  67. # menu to be enabled to use.
  68. #
  69. #==============================================================================
  70. # ▼ Compatibility
  71. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  72. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  73. # it will run with RPG Maker VX without adjusting.
  74. #
  75. #==============================================================================

  76. module YEA
  77.   module PARTY
  78.    
  79.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  80.     # - General Party Settings -
  81.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82.     # In this section, you can adjust the general party settings for your game
  83.     # such as the maximum amount of members and whatnot, the EXP rate for
  84.     # party members in the reserve, etc.
  85.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  86.     MAX_BATTLE_MEMBERS   = 1      # 最大参战人员. Default: 4
  87.     SPLIT_EXP            = true  # 平分经验?Splits EXP with more members in the party.
  88.     RESERVE_EXP_RATE     = 0.50   # 休息人员的经验获得率Reserve EXP Rate. Default: 1.00
  89.    
  90.     # If you wish to be able to change the maximum number of battle members
  91.     # during the middle of your game, set this constant to a variable ID. If
  92.     # that variable ID is a number greater than 0, that variable will determine
  93.     # the current maximum number of battle members. Be cautious about using
  94.     # this during battle.
  95.     MAX_MEMBERS_VARIABLE = 3  #设置游戏中改变最大参战人员的变量
  96.    
  97.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  98.     # - Party Menu Settings -
  99.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  100.     # This section contains various menu settings for those who wish to use a
  101.     # menu separate for the party system. Here, adjust the menu command order,
  102.     # icons used, and other settings.
  103.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  104.     ENABLE_MENU = true   # Enables party menu. Default: false
  105.     COMMANDS =[          # The order at which the menu items are shown.
  106.     # [:command,  "Display"],
  107.       [ :change,  "更换",],
  108.       [ :remove,  "移除",],
  109.       [ :revert,  "还原",],
  110.       [ :finish,  "完成",],
  111.     ] # Do not remove this.
  112.     COMMAND_ALIGN    = 1     # 0:左对齐, 1:Center Align, 2:Right Align
  113.    
  114.     # These settings here are used for the upper right window: the Party Select
  115.     # window where the player selects a member to swap out or remove.
  116.     PARTY_FONT_SIZE  = 20    # Font size used for party member names.
  117.     LOCK_FIRST_ACTOR = false # Lock the first actor by default?
  118.     LOCKED_ICON      = 125   # Icon used for locked members.
  119.     REQUIRED_ICON    = 126   # Icon used for required members.
  120.     EMPTY_TEXT = "-Empty-"   # Text used when a member isn't present.
  121.     DISPLAY_FACE     = false # Display faces instead of sprites?
  122.    
  123.     # These settings here are used for the lower left window: the Party List
  124.     # window where the player selects a member to replace.
  125.     REMOVE_ICON      = 185          # Icon used for removing members.
  126.     REMOVE_TEXT      = "-Remove-"   # Text used for remove member command.
  127.     ACTOR_Y_BUFFER   = 12           # Amount the actor graphic be adjusted by.
  128.    
  129.     # These settings here are used for the lower right window: the Party Status
  130.     # window where info about a selected actor is shown.
  131.     NO_DATA         = "- No Data -" # Text used for when no actor is shown.
  132.     IN_PARTY_COLOUR = 6             # Text colour used for in party members.
  133.     STAT_FONT_SIZE  = 20            # Font size used for stats.
  134.     EQUIP_TEXT      = "Equipment"   # Text used to display equipment.
  135.    
  136.   end # PARTY
  137. end # YEA

  138. #==============================================================================
  139. # ▼ Editting anything past this point may potentially result in causing
  140. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  141. # halitosis so edit at your own risk.
  142. #==============================================================================

  143. #==============================================================================
  144. # ■ Icon
  145. #==============================================================================

  146. module Icon
  147.   
  148.   #--------------------------------------------------------------------------
  149.   # self.locked_party
  150.   #--------------------------------------------------------------------------
  151.   def self.locked_party; return YEA::PARTY::LOCKED_ICON; end
  152.   
  153.   #--------------------------------------------------------------------------
  154.   # self.required_party
  155.   #--------------------------------------------------------------------------
  156.   def self.required_party; return YEA::PARTY::REQUIRED_ICON; end
  157.   
  158.   #--------------------------------------------------------------------------
  159.   # self.remove_party
  160.   #--------------------------------------------------------------------------
  161.   def self.remove_party; return YEA::PARTY::REMOVE_ICON; end
  162.    
  163. end # Icon

  164. #==============================================================================
  165. # ■ Variable
  166. #==============================================================================

  167. module Variable
  168.   
  169.   #--------------------------------------------------------------------------
  170.   # self.max_battle_members
  171.   #--------------------------------------------------------------------------
  172.   def self.max_battle_members
  173.     default = YEA::PARTY::MAX_BATTLE_MEMBERS
  174.     return default if YEA::PARTY::MAX_MEMBERS_VARIABLE <= 0
  175.     return default if $game_variables[YEA::PARTY::MAX_MEMBERS_VARIABLE] <= 0
  176.     return $game_variables[YEA::PARTY::MAX_MEMBERS_VARIABLE]
  177.   end
  178.   
  179. end # Variable

  180. #==============================================================================
  181. # ■ Numeric
  182. #==============================================================================

  183. class Numeric
  184.   
  185.   #--------------------------------------------------------------------------
  186.   # new method: group_digits
  187.   #--------------------------------------------------------------------------
  188.   unless $imported["YEA-CoreEngine"]
  189.   def group; return self.to_s; end
  190.   end # $imported["YEA-CoreEngine"]
  191.    
  192. end # Numeric

  193. #==============================================================================
  194. # ■ Game_Actor
  195. #==============================================================================

  196. class Game_Actor < Game_Battler
  197.   
  198.   #--------------------------------------------------------------------------
  199.   # public instance variables
  200.   #--------------------------------------------------------------------------
  201.   attr_accessor :locked
  202.   attr_accessor :required
  203.   
  204.   #--------------------------------------------------------------------------
  205.   # alias method: setup
  206.   #--------------------------------------------------------------------------
  207.   alias game_actor_setup_ps setup
  208.   def setup(actor_id)
  209.     game_actor_setup_ps(actor_id)
  210.     @locked = false
  211.     @required = false
  212.   end
  213.   
  214.   #--------------------------------------------------------------------------
  215.   # overwrite method: final_exp_rate
  216.   #--------------------------------------------------------------------------
  217.   def final_exp_rate
  218.     n = exr * (battle_member? ? 1 : reserve_members_exp_rate)
  219.     if $game_party.in_battle
  220.       n /= [$game_party.battle_members.size, 1].max if YEA::PARTY::SPLIT_EXP
  221.     end
  222.     return n
  223.   end
  224.   
  225.   #--------------------------------------------------------------------------
  226.   # overwrite method: reserve_members_exp_rate
  227.   #--------------------------------------------------------------------------
  228.   def reserve_members_exp_rate
  229.     $data_system.opt_extra_exp ? YEA::PARTY::RESERVE_EXP_RATE : 0
  230.   end
  231.   
  232. end # Game_Actor

  233. #==============================================================================
  234. # ■ Game_Party
  235. #==============================================================================

  236. class Game_Party < Game_Unit
  237.   
  238.   #--------------------------------------------------------------------------
  239.   # public instance variables
  240.   #--------------------------------------------------------------------------
  241.   attr_accessor :battle_members_array
  242.   
  243.   #--------------------------------------------------------------------------
  244.   # alias method: initialize
  245.   #--------------------------------------------------------------------------
  246.   alias game_party_initialize_ps initialize
  247.   def initialize
  248.     game_party_initialize_ps
  249.     @battle_members_array = nil
  250.   end
  251.   
  252.   #--------------------------------------------------------------------------
  253.   # overwrite method: max_battle_members
  254.   #--------------------------------------------------------------------------
  255.   def max_battle_members; return Variable.max_battle_members; end
  256.   
  257.   #--------------------------------------------------------------------------
  258.   # alias method: setup_starting_members
  259.   #--------------------------------------------------------------------------
  260.   alias setup_starting_members_ps setup_starting_members
  261.   def setup_starting_members
  262.     setup_starting_members_ps
  263.     initialize_battle_members
  264.     return unless YEA::PARTY::LOCK_FIRST_ACTOR
  265.     return if members[0].nil?
  266.     members[0].locked = true
  267.   end
  268.   
  269.   #--------------------------------------------------------------------------
  270.   # alias method: setup_battle_test_members
  271.   #--------------------------------------------------------------------------
  272.   alias setup_battle_test_members_ps setup_battle_test_members
  273.   def setup_battle_test_members
  274.     setup_battle_test_members_ps
  275.     return unless YEA::PARTY::LOCK_FIRST_ACTOR
  276.     return if members[0].nil?
  277.     members[0].locked = true
  278.   end
  279.   
  280.   #--------------------------------------------------------------------------
  281.   # overwrite method: battle_members
  282.   #--------------------------------------------------------------------------
  283.   def battle_members
  284.     initialize_battle_members if initialize_battle_members?
  285.     array = []
  286.     for actor_id in @battle_members_array
  287.       break if array.size > max_battle_members
  288.       next if actor_id.nil?
  289.       next if $game_actors[actor_id].nil?
  290.       next unless $game_actors[actor_id].exist?
  291.       array.push($game_actors[actor_id])
  292.     end
  293.     return array
  294.   end
  295.   
  296.   #--------------------------------------------------------------------------
  297.   # new method: initialize_battle_members?
  298.   #--------------------------------------------------------------------------
  299.   def initialize_battle_members?
  300.     return true if @battle_members_array.nil?
  301.     return @battle_members_array.size != max_battle_members
  302.   end
  303.   
  304.   #--------------------------------------------------------------------------
  305.   # new method: initialize_battle_members
  306.   #--------------------------------------------------------------------------
  307.   def initialize_battle_members
  308.     @battle_members_array = []
  309.     for i in 0...max_battle_members
  310.       @battle_members_array.push(@actors[i]) unless @actors[i].nil?
  311.       @battle_members_array.push(0) if @actors[i].nil?
  312.     end
  313.     $game_player.refresh
  314.   end
  315.   
  316.   #--------------------------------------------------------------------------
  317.   # alias method: add_actor
  318.   #--------------------------------------------------------------------------
  319.   alias game_party_add_actor_ps add_actor
  320.   def add_actor(actor_id)
  321.     game_party_add_actor_ps(actor_id)
  322.     return if @battle_members_array.include?(actor_id)
  323.     return unless @battle_members_array.include?(0)
  324.     index = @battle_members_array.index(0)
  325.     @battle_members_array[index] = actor_id
  326.     $game_player.refresh
  327.     $game_map.need_refresh = true
  328.     rearrange_actors
  329.   end
  330.   
  331.   #--------------------------------------------------------------------------
  332.   # alias method: remove_actor
  333.   #--------------------------------------------------------------------------
  334.   alias game_party_remove_actor_ps remove_actor
  335.   def remove_actor(actor_id)
  336.     game_party_remove_actor_ps(actor_id)
  337.     return unless @battle_members_array.include?(actor_id)
  338.     index = @battle_members_array.index(actor_id)
  339.     @battle_members_array[index] = 0
  340.     $game_player.refresh
  341.     $game_map.need_refresh = true
  342.     rearrange_actors
  343.   end
  344.   
  345.   #--------------------------------------------------------------------------
  346.   # new method: rearrange_actors
  347.   #--------------------------------------------------------------------------
  348.   def rearrange_actors
  349.     initialize_battle_members if @battle_members_array.nil?
  350.     array = []
  351.     for actor_id in @battle_members_array
  352.       next if [0, nil].include?(actor_id)
  353.       next if $game_actors[actor_id].nil?
  354.       array.push(actor_id)
  355.     end
  356.     for actor_id in @actors
  357.       next if array.include?(actor_id)
  358.       next if $game_actors[actor_id].nil?
  359.       array.push(actor_id)
  360.     end
  361.     @actors = array
  362.   end
  363.   
  364. end # Game_Party

  365. #==============================================================================
  366. # ■ Game_Interpreter
  367. #==============================================================================

  368. class Game_Interpreter
  369.   
  370.   #--------------------------------------------------------------------------
  371.   # new method: lock_actor
  372.   #--------------------------------------------------------------------------
  373.   def lock_actor(actor_id)
  374.     return unless YEA::PARTY::ENABLE_MENU
  375.     actor = $game_actors[actor_id]
  376.     return unless $game_party.battle_members.include?(actor.id)
  377.     actor.locked = true
  378.   end
  379.   
  380.   #--------------------------------------------------------------------------
  381.   # new method: unlock_actor
  382.   #--------------------------------------------------------------------------
  383.   def unlock_actor(actor_id)
  384.     return unless YEA::PARTY::ENABLE_MENU
  385.     actor = $game_actors[actor_id]
  386.     return unless $game_party.battle_members.include?(actor.id)
  387.     actor.locked = false
  388.   end
  389.   
  390.   #--------------------------------------------------------------------------
  391.   # new method: require_actor
  392.   #--------------------------------------------------------------------------
  393.   def require_actor(actor_id)
  394.     return unless YEA::PARTY::ENABLE_MENU
  395.     return if $game_system.formation_disabled
  396.     actor = $game_actors[actor_id]
  397.     return unless $game_party.all_members.include?(actor)
  398.     actor.required = true
  399.     call_party_menu unless $game_party.battle_members.include?(actor)
  400.   end
  401.   
  402.   #--------------------------------------------------------------------------
  403.   # new method: unrequire_actor
  404.   #--------------------------------------------------------------------------
  405.   def unrequire_actor(actor_id)
  406.     return unless YEA::PARTY::ENABLE_MENU
  407.     return if $game_system.formation_disabled
  408.     actor = $game_actors[actor_id]
  409.     return unless $game_party.all_members.include?(actor)
  410.     actor.required = false
  411.     call_party_menu unless $game_party.battle_members.include?(actor)
  412.   end
  413.   
  414.   #--------------------------------------------------------------------------
  415.   # new method: call_party_menu
  416.   #--------------------------------------------------------------------------
  417.   def call_party_menu
  418.     return unless YEA::PARTY::ENABLE_MENU
  419.     return if $game_system.formation_disabled
  420.     SceneManager.call(Scene_Party)
  421.   end
  422.   
  423. end # Game_Interpreter

  424. #==============================================================================
  425. # ■ Spriteset_Battle
  426. #==============================================================================

  427. class Spriteset_Battle
  428.   
  429.   #--------------------------------------------------------------------------
  430.   # overwrite method: create_actors
  431.   #--------------------------------------------------------------------------
  432.   def create_actors
  433.     total = $game_party.max_battle_members
  434.     @actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) }
  435.   end
  436.   
  437. end # Spriteset_Battle

  438. #==============================================================================
  439. # ■ Window_PartyMenuCommand
  440. #==============================================================================

  441. class Window_PartyMenuCommand < Window_Command
  442.   
  443.   #--------------------------------------------------------------------------
  444.   # window_width
  445.   #--------------------------------------------------------------------------
  446.   def window_width; return 160; end
  447.   
  448.   #--------------------------------------------------------------------------
  449.   # visible_line_number
  450.   #--------------------------------------------------------------------------
  451.   def visible_line_number; 4; end
  452.   
  453.   #--------------------------------------------------------------------------
  454.   # alignment
  455.   #--------------------------------------------------------------------------
  456.   def alignment
  457.     return Menu.command_window_align if $imported["YEA-AceMenuEngine"]
  458.     return YEA::PARTY::COMMAND_ALIGN
  459.   end
  460.   
  461.   #--------------------------------------------------------------------------
  462.   # scene
  463.   #--------------------------------------------------------------------------
  464.   def scene; return SceneManager.scene; end
  465.   
  466.   #--------------------------------------------------------------------------
  467.   # make_command_list
  468.   #--------------------------------------------------------------------------
  469.   def make_command_list
  470.     for command in YEA::PARTY::COMMANDS
  471.       case command[0]
  472.       when :change, :remove, :revert
  473.         add_command(command[1], command[0])
  474.       when :finish
  475.         add_command(command[1], command[0], enable_cancel?)
  476.       else; next
  477.       end
  478.     end
  479.   end
  480.   
  481.   #--------------------------------------------------------------------------
  482.   # process_cancel
  483.   #--------------------------------------------------------------------------
  484.   def process_cancel
  485.     unless enable_cancel?
  486.       Sound.play_buzzer
  487.       return
  488.     end
  489.     super
  490.   end
  491.   
  492.   #--------------------------------------------------------------------------
  493.   # in_party?
  494.   #--------------------------------------------------------------------------
  495.   def in_party?(actor)
  496.     return $game_party.battle_members.include?(actor)
  497.   end
  498.   
  499.   #--------------------------------------------------------------------------
  500.   # enable_cancel?
  501.   #--------------------------------------------------------------------------
  502.   def enable_cancel?
  503.     return false if $game_party.battle_members.size <= 0
  504.     for actor in $game_party.all_members
  505.       next if in_party?(actor)
  506.       return false if actor.required
  507.       return false if actor.locked
  508.     end
  509.     return true
  510.   end
  511.   
  512. end # Window_PartyMenuCommand

  513. #==============================================================================
  514. # ■ Window_PartySelect
  515. #==============================================================================

  516. class Window_PartySelect < Window_Selectable
  517.   
  518.   #--------------------------------------------------------------------------
  519.   # initialize
  520.   #-------------------------------------------------------------------------
  521.   def initialize(command_window)
  522.     @command_window = command_window
  523.     super(160, 0, window_width, fitting_height(visible_line_number))
  524.     select(0)
  525.     deactivate
  526.     refresh
  527.   end
  528.   
  529.   #--------------------------------------------------------------------------
  530.   # col_max
  531.   #--------------------------------------------------------------------------
  532.   def col_max; return $game_party.max_battle_members; end
  533.   
  534.   #--------------------------------------------------------------------------
  535.   # item_max
  536.   #--------------------------------------------------------------------------
  537.   def item_max; return $game_party.max_battle_members; end
  538.   
  539.   #--------------------------------------------------------------------------
  540.   # window_width
  541.   #--------------------------------------------------------------------------
  542.   def window_width; return Graphics.width - 160; end
  543.   
  544.   #--------------------------------------------------------------------------
  545.   # visible_line_number
  546.   #--------------------------------------------------------------------------
  547.   def visible_line_number; 4; end
  548.   
  549.   #--------------------------------------------------------------------------
  550.   # item_rect
  551.   #--------------------------------------------------------------------------
  552.   def item_rect(index)
  553.     rect = Rect.new
  554.     rect.width = contents.width / item_max
  555.     rect.height = contents.height
  556.     rect.x = index * rect.width
  557.     rect.y = 0
  558.     return rect
  559.   end
  560.   
  561.   #--------------------------------------------------------------------------
  562.   # refresh
  563.   #--------------------------------------------------------------------------
  564.   def refresh
  565.     make_item_list
  566.     create_contents
  567.     draw_all_items
  568.   end
  569.   
  570.   #--------------------------------------------------------------------------
  571.   # make_item_list
  572.   #--------------------------------------------------------------------------
  573.   def make_item_list
  574.     @data = $game_party.battle_members_array.clone
  575.   end
  576.   
  577.   #--------------------------------------------------------------------------
  578.   # draw_item
  579.   #--------------------------------------------------------------------------
  580.   def draw_item(index)
  581.     actor = $game_actors[@data[index]]
  582.     rect = item_rect(index)
  583.     if actor.nil?
  584.       draw_empty(rect.clone)
  585.       return
  586.     end
  587.     dx = rect.width / 2
  588.     dy = rect.height - 16
  589.     draw_actor_face(actor, rect.x, rect.y) if display_face?
  590.     draw_actor_graphic(actor, rect.x + dx, rect.y + dy) unless display_face?
  591.     draw_actor_name(actor, rect)
  592.     draw_locked_icon(actor, rect)
  593.     draw_required_icon(actor, rect)
  594.   end
  595.   
  596.   #--------------------------------------------------------------------------
  597.   # display_face?
  598.   #--------------------------------------------------------------------------
  599.   def display_face?
  600.     return YEA::PARTY::DISPLAY_FACE
  601.   end
  602.   
  603.   #--------------------------------------------------------------------------
  604.   # draw_empty
  605.   #--------------------------------------------------------------------------
  606.   def draw_empty(rect)
  607.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  608.     rect.x += 2
  609.     rect.y += 2
  610.     rect.width -= 4
  611.     rect.height -= 4
  612.     contents.fill_rect(rect, colour)
  613.     reset_font_settings
  614.     change_color(system_color)
  615.     text = YEA::PARTY::EMPTY_TEXT
  616.     draw_text(rect, text, 1)
  617.     reset_font_settings
  618.   end
  619.   
  620.   #--------------------------------------------------------------------------
  621.   # draw_actor_name
  622.   #--------------------------------------------------------------------------
  623.   def draw_actor_name(actor, rect)
  624.     contents.font.size = YEA::PARTY::PARTY_FONT_SIZE
  625.     change_color(normal_color, actor.exist?)
  626.     draw_text(rect.x+4, rect.y, rect.width-8, line_height, actor.name, 1)
  627.   end
  628.   
  629.   #--------------------------------------------------------------------------
  630.   # draw_face
  631.   #--------------------------------------------------------------------------
  632.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  633.     bitmap = Cache.face(face_name)
  634.     dw = [96, item_rect(0).width-4].min
  635.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, dw, 92)
  636.     contents.blt(dx+2, dy+2, bitmap, rect, enabled ? 255 : translucent_alpha)
  637.     bitmap.dispose
  638.   end
  639.   
  640.   #--------------------------------------------------------------------------
  641.   # draw_locked_icon
  642.   #--------------------------------------------------------------------------
  643.   def draw_locked_icon(actor, rect)
  644.     return unless actor_locked?(actor)
  645.     draw_icon(Icon.locked_party, rect.x+rect.width-26, rect.height - 26)
  646.   end
  647.   
  648.   #--------------------------------------------------------------------------
  649.   # draw_required_icon
  650.   #--------------------------------------------------------------------------
  651.   def draw_required_icon(actor, rect)
  652.     return if actor_locked?(actor)
  653.     return unless actor_required?(actor)
  654.     draw_icon(Icon.required_party, rect.x+rect.width-26, rect.height - 26)
  655.   end
  656.   
  657.   #--------------------------------------------------------------------------
  658.   # actor_locked?
  659.   #--------------------------------------------------------------------------
  660.   def actor_locked?(actor); return actor.locked; end
  661.   
  662.   #--------------------------------------------------------------------------
  663.   # actor_required?
  664.   #--------------------------------------------------------------------------
  665.   def actor_required?(actor)
  666.     return false if actor.locked
  667.     return actor.required
  668.   end
  669.   
  670.   #--------------------------------------------------------------------------
  671.   # current_item_enabled?
  672.   #--------------------------------------------------------------------------
  673.   def current_item_enabled?; enable?(@data[index]); end
  674.   
  675.   #--------------------------------------------------------------------------
  676.   # enable?
  677.   #--------------------------------------------------------------------------
  678.   def enable?(item)
  679.     case @command_window.current_symbol
  680.     when :change
  681.       return true if item.nil?
  682.       return true if item == 0
  683.     when :remove
  684.       return false if item.nil?
  685.       return false if item == 0
  686.     end
  687.     actor = $game_actors[item]
  688.     return false if actor.locked
  689.     return false if actor.required
  690.     return true
  691.   end
  692.   
  693.   #--------------------------------------------------------------------------
  694.   # process_handling
  695.   #--------------------------------------------------------------------------
  696.   def process_handling
  697.     return unless open? && active
  698.     return process_ok       if ok_enabled?        && Input.trigger?(:C)
  699.     return process_cancel   if cancel_enabled?    && Input.trigger?(:B)
  700.     return process_pagedown if handle?(:pagedown) && Input.repeat?(:R)
  701.     return process_pageup   if handle?(:pageup)   && Input.repeat?(:L)
  702.   end
  703.   
  704.   #--------------------------------------------------------------------------
  705.   # cur_actor
  706.   #--------------------------------------------------------------------------
  707.   def cur_actor
  708.     actor_id = @data[index]
  709.     return $game_actors[actor_id]
  710.   end
  711.   
  712.   #--------------------------------------------------------------------------
  713.   # prev_actor
  714.   #--------------------------------------------------------------------------
  715.   def prev_actor
  716.     id = index == 0 ? @data.size - 1 : index - 1
  717.     actor_id = @data[id]
  718.     return $game_actors[actor_id]
  719.   end
  720.   
  721.   #--------------------------------------------------------------------------
  722.   # next_actor
  723.   #--------------------------------------------------------------------------
  724.   def next_actor
  725.     id = index == @data.size - 1 ? 0 : index + 1
  726.     actor_id = @data[id]
  727.     return $game_actors[actor_id]
  728.   end
  729.   
  730.   #--------------------------------------------------------------------------
  731.   # process_pageup
  732.   #--------------------------------------------------------------------------
  733.   def process_pageup
  734.     allow = true
  735.     allow = false if !prev_actor.nil? && prev_actor.locked
  736.     allow = false if !cur_actor.nil? && cur_actor.locked
  737.     Sound.play_buzzer unless allow
  738.     if allow
  739.       super
  740.       activate
  741.       select(index == 0 ? @data.size - 1 : index - 1)
  742.     end
  743.   end
  744.   
  745.   #--------------------------------------------------------------------------
  746.   # process_pagedown
  747.   #--------------------------------------------------------------------------
  748.   def process_pagedown
  749.     allow = true
  750.     allow = false if !next_actor.nil? && next_actor.locked
  751.     allow = false if !cur_actor.nil? && cur_actor.locked
  752.     Sound.play_buzzer unless allow
  753.     if allow
  754.       super
  755.       activate
  756.       select(index == @data.size - 1 ? 0 : index + 1)
  757.     end
  758.   end
  759.   
  760.   #--------------------------------------------------------------------------
  761.   # item
  762.   #--------------------------------------------------------------------------
  763.   def item; return @data[index]; end
  764.   
  765. end # Window_PartySelect

  766. #==============================================================================
  767. # ■ Window_PartyList
  768. #==============================================================================

  769. class Window_PartyList < Window_Selectable
  770.   
  771.   #--------------------------------------------------------------------------
  772.   # initialize
  773.   #-------------------------------------------------------------------------
  774.   def initialize(party_window)
  775.     super(0, fitting_height(4), window_width, window_height)
  776.     @party_window = party_window
  777.     select(1)
  778.     deactivate
  779.     refresh
  780.   end
  781.   
  782.   #--------------------------------------------------------------------------
  783.   # window_width
  784.   #--------------------------------------------------------------------------
  785.   def window_width; return 200; end
  786.   
  787.   #--------------------------------------------------------------------------
  788.   # window_height
  789.   #--------------------------------------------------------------------------
  790.   def window_height; return Graphics.height - fitting_height(4); end
  791.   
  792.   #--------------------------------------------------------------------------
  793.   # item_max
  794.   #--------------------------------------------------------------------------
  795.   def item_max; return @data ? @data.size : 1; end
  796.   
  797.   #--------------------------------------------------------------------------
  798.   # refresh
  799.   #--------------------------------------------------------------------------
  800.   def refresh
  801.     make_item_list
  802.     create_contents
  803.     draw_all_items
  804.   end
  805.   
  806.   #--------------------------------------------------------------------------
  807.   # make_item_list
  808.   #--------------------------------------------------------------------------
  809.   def make_item_list
  810.     @data = [0]
  811.     for member in $game_party.all_members
  812.       next if member.nil?
  813.       @data.push(member.id)
  814.     end
  815.     @data.push(0)
  816.   end
  817.   
  818.   #--------------------------------------------------------------------------
  819.   # draw_item
  820.   #--------------------------------------------------------------------------
  821.   def draw_item(index)
  822.     clear_item(index)
  823.     rect = item_rect(index)
  824.     if @data[index] == 0
  825.       draw_remove(rect)
  826.       return
  827.     end
  828.     actor = $game_actors[@data[index]]
  829.     draw_actor(actor, rect)
  830.     draw_actor_locked(actor, rect)
  831.     draw_actor_required(actor, rect)
  832.   end
  833.   
  834.   #--------------------------------------------------------------------------
  835.   # draw_remove
  836.   #--------------------------------------------------------------------------
  837.   def draw_remove(rect)
  838.     reset_font_settings
  839.     draw_icon(Icon.remove_party, rect.x+4, rect.y)
  840.     text = YEA::PARTY::REMOVE_TEXT
  841.     draw_text(rect.x+32, rect.y, rect.width-32, line_height, text)
  842.   end
  843.   
  844.   #--------------------------------------------------------------------------
  845.   # draw_actor
  846.   #--------------------------------------------------------------------------
  847.   def draw_actor(actor, rect)
  848.     buffer = YEA::PARTY::ACTOR_Y_BUFFER
  849.     draw_actor_graphic(actor, rect.x + 16, rect.y + rect.height + buffer)
  850.     text = actor.name
  851.     change_color(list_colour(actor), enabled?(actor))
  852.     draw_text(rect.x+32, rect.y, rect.width-32, line_height, text)
  853.   end
  854.   
  855.   #--------------------------------------------------------------------------
  856.   # list_colour
  857.   #--------------------------------------------------------------------------
  858.   def list_colour(actor)
  859.     return text_color(YEA::PARTY::IN_PARTY_COLOUR) if in_party?(actor)
  860.     return normal_color
  861.   end
  862.   
  863.   #--------------------------------------------------------------------------
  864.   # draw_actor_locked
  865.   #--------------------------------------------------------------------------
  866.   def draw_actor_locked(actor, rect)
  867.     return unless actor.locked
  868.     draw_icon(Icon.locked_party, rect.width-24, rect.y)
  869.   end
  870.   
  871.   #--------------------------------------------------------------------------
  872.   # draw_actor_required
  873.   #--------------------------------------------------------------------------
  874.   def draw_actor_required(actor, rect)
  875.     return if actor.locked
  876.     return unless actor.required
  877.     draw_icon(Icon.required_party, rect.width-24, rect.y)
  878.   end
  879.   
  880.   #--------------------------------------------------------------------------
  881.   # enabled?
  882.   #--------------------------------------------------------------------------
  883.   def enabled?(actor)
  884.     return false if actor.locked
  885.     return false if actor.required && in_party?(actor)
  886.     return actor.exist?
  887.   end
  888.   
  889.   #--------------------------------------------------------------------------
  890.   # in_party?
  891.   #--------------------------------------------------------------------------
  892.   def in_party?(actor); return $game_party.battle_members.include?(actor); end
  893.   
  894.   #--------------------------------------------------------------------------
  895.   # current_item_enabled?
  896.   #--------------------------------------------------------------------------
  897.   def current_item_enabled?
  898.     actor = $game_actors[item]
  899.     replace = $game_actors[@party_window.item]
  900.     unless actor.nil?
  901.       return false if actor.locked && in_party?(actor)
  902.       return false if actor.required && in_party?(actor)
  903.     end
  904.     return true if replace.nil?
  905.     return false if replace.locked
  906.     return false if replace.required
  907.     return true if actor.nil?
  908.     return actor.exist?
  909.   end
  910.   
  911.   #--------------------------------------------------------------------------
  912.   # item
  913.   #--------------------------------------------------------------------------
  914.   def item; return @data[index]; end
  915.   
  916. end # Window_PartyList

  917. #==============================================================================
  918. # ** Window_PartyStatus
  919. #==============================================================================

  920. class Window_PartyStatus < Window_Base
  921.   
  922.   #--------------------------------------------------------------------------
  923.   # initialize
  924.   #--------------------------------------------------------------------------
  925.   def initialize(party_window, list_window)
  926.     super(200, fitting_height(4), window_width, window_height)
  927.     @party_window = party_window
  928.     @list_window = list_window
  929.     @actor = active_actor
  930.     refresh
  931.   end
  932.   
  933.   #--------------------------------------------------------------------------
  934.   # window_width
  935.   #--------------------------------------------------------------------------
  936.   def window_width; Graphics.width - 200; end
  937.   
  938.   #--------------------------------------------------------------------------
  939.   # window_height
  940.   #--------------------------------------------------------------------------
  941.   def window_height; Graphics.height - fitting_height(4); end
  942.   
  943.   #--------------------------------------------------------------------------
  944.   # update
  945.   #--------------------------------------------------------------------------
  946.   def update
  947.     super
  948.     refresh if @actor != active_actor
  949.   end
  950.   
  951.   #--------------------------------------------------------------------------
  952.   # active_actor
  953.   #--------------------------------------------------------------------------
  954.   def active_actor
  955.     if @list_window.active
  956.       actor = @list_window.item
  957.     else
  958.       actor = @party_window.item
  959.     end
  960.     return nil if [0, nil].include?(actor)
  961.     return actor
  962.   end
  963.   
  964.   #--------------------------------------------------------------------------
  965.   # refresh
  966.   #--------------------------------------------------------------------------
  967.   def refresh
  968.     contents.clear
  969.     @actor = active_actor
  970.     reset_font_settings
  971.     if @actor.nil?
  972.       draw_nil_actor
  973.       return
  974.     end
  975.     actor = $game_actors[@actor]
  976.     draw_actor_face(actor, 0, 0)
  977.     draw_actor_name(actor, 108, 0)
  978.     draw_actor_class(actor, 228, 0, contents.width-232)
  979.     draw_actor_level(actor, 108, line_height)
  980.     draw_actor_icons(actor, 228, line_height, contents.width-232)
  981.     draw_actor_hp(actor, 108, line_height*2, contents.width-112)
  982.     draw_actor_mp(actor, 108, line_height*3, contents.width-112)
  983.     draw_actor_parameters(actor, 0, line_height*4 + line_height/2)
  984.     draw_equipments(actor, contents.width/2, line_height*4 + line_height/2)
  985.   end
  986.   
  987.   #--------------------------------------------------------------------------
  988.   # draw_nil_actor
  989.   #--------------------------------------------------------------------------
  990.   def draw_nil_actor
  991.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  992.     rect = Rect.new(0, 0, contents.width, contents.height)
  993.     contents.fill_rect(rect, colour)
  994.     change_color(system_color)
  995.     text = YEA::PARTY::NO_DATA
  996.     draw_text(rect, text, 1)
  997.   end
  998.   
  999.   #--------------------------------------------------------------------------
  1000.   # draw_actor_parameters
  1001.   #--------------------------------------------------------------------------
  1002.   def draw_actor_parameters(actor, dx, dy)
  1003.     dw = contents.width/2 - 4
  1004.     rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  1005.     contents.font.size = YEA::PARTY::STAT_FONT_SIZE
  1006.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  1007.     array = [:atk, :def, :mat, :mdf, :agi, :luk]
  1008.     cx = 4
  1009.     for stat in array
  1010.       case stat
  1011.       when :atk
  1012.         param = Vocab::param(2)
  1013.         value = actor.atk.group
  1014.       when :def
  1015.         param = Vocab::param(3)
  1016.         value = actor.def.group
  1017.       when :mat
  1018.         param = Vocab::param(4)
  1019.         value = actor.mat.group
  1020.       when :mdf
  1021.         param = Vocab::param(5)
  1022.         value = actor.mdf.group
  1023.       when :agi
  1024.         param = Vocab::param(6)
  1025.         value = actor.agi.group
  1026.       when :luk
  1027.         param = Vocab::param(7)
  1028.         value = actor.luk.group
  1029.       else; next
  1030.       end
  1031.       contents.fill_rect(rect, colour)
  1032.       change_color(system_color)
  1033.       draw_text(rect.x + cx, rect.y, rect.width-cx*2, line_height, param, 0)
  1034.       change_color(normal_color)
  1035.       draw_text(rect.x + cx, rect.y, rect.width-cx*2, line_height, value, 2)
  1036.       rect.y += line_height
  1037.     end
  1038.     reset_font_settings
  1039.   end
  1040.   
  1041.   #--------------------------------------------------------------------------
  1042.   # draw_equipments
  1043.   #--------------------------------------------------------------------------
  1044.   def draw_equipments(actor, dx, dy)
  1045.     text = YEA::PARTY::EQUIP_TEXT
  1046.     change_color(system_color)
  1047.     draw_text(dx, dy, contents.width - dx, line_height, text, 1)
  1048.     dy += line_height
  1049.     if actor.equips.size <= 5
  1050.       actor.equips.each_with_index do |item, i|
  1051.         draw_item_name(item, dx, dy + line_height * i)
  1052.       end
  1053.     else
  1054.       orig_x = dx
  1055.       actor.equips.each_with_index do |item, i|
  1056.         next if item.nil?
  1057.         draw_icon(item.icon_index, dx, dy)
  1058.         dy += line_height if dx + 48 > contents.width
  1059.         dx = dx + 48 > contents.width ? orig_x : dx + 24
  1060.       end
  1061.     end
  1062.   end
  1063.   
  1064. end # Window_PartyStatus

  1065. #==============================================================================
  1066. # ■ Scene_Menu
  1067. #==============================================================================

  1068. class Scene_Menu < Scene_MenuBase
  1069.   
  1070.   #--------------------------------------------------------------------------
  1071.   # overwrite method: command_formation
  1072.   #--------------------------------------------------------------------------
  1073.   if YEA::PARTY::ENABLE_MENU
  1074.   def command_formation
  1075.     SceneManager.call(Scene_Party)
  1076.   end
  1077.   end # YEA::PARTY::ENABLE_MENU
  1078.   
  1079. end # Scene_Menu

  1080. #==============================================================================
  1081. # ■ Scene_Party
  1082. #==============================================================================

  1083. class Scene_Party < Scene_MenuBase
  1084.   
  1085.   #--------------------------------------------------------------------------
  1086.   # start
  1087.   #--------------------------------------------------------------------------
  1088.   def start
  1089.     super
  1090.     @former_party = $game_party.battle_members_array.clone
  1091.     create_command_window
  1092.     create_party_window
  1093.     create_list_window
  1094.     create_status_window
  1095.   end
  1096.   
  1097.   #--------------------------------------------------------------------------
  1098.   # create_command_window
  1099.   #--------------------------------------------------------------------------
  1100.   def create_command_window
  1101.     @command_window = Window_PartyMenuCommand.new(0, 0)
  1102.     @command_window.set_handler(:change, method(:adjust_members))
  1103.     @command_window.set_handler(:remove, method(:adjust_members))
  1104.     @command_window.set_handler(:revert, method(:revert_party))
  1105.     @command_window.set_handler(:finish, method(:return_scene))
  1106.     @command_window.set_handler(:cancel, method(:return_scene))
  1107.   end
  1108.   
  1109.   #--------------------------------------------------------------------------
  1110.   # create_party_window
  1111.   #--------------------------------------------------------------------------
  1112.   def create_party_window
  1113.     @party_window = Window_PartySelect.new(@command_window)
  1114.     @party_window.set_handler(:ok,       method(:on_party_ok))
  1115.     @party_window.set_handler(:cancel,   method(:on_party_cancel))
  1116.     @party_window.set_handler(:pageup,   method(:on_party_pageup))
  1117.     @party_window.set_handler(:pagedown, method(:on_party_pagedown))
  1118.   end
  1119.   
  1120.   #--------------------------------------------------------------------------
  1121.   # create_list_window
  1122.   #--------------------------------------------------------------------------
  1123.   def create_list_window
  1124.     @list_window = Window_PartyList.new(@party_window)
  1125.     @list_window.set_handler(:ok,     method(:on_list_ok))
  1126.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  1127.   end
  1128.   
  1129.   #--------------------------------------------------------------------------
  1130.   # create_status_window
  1131.   #--------------------------------------------------------------------------
  1132.   def create_status_window
  1133.     @status_window = Window_PartyStatus.new(@party_window, @list_window)
  1134.   end
  1135.   
  1136.   #--------------------------------------------------------------------------
  1137.   # adjust_members
  1138.   #--------------------------------------------------------------------------
  1139.   def adjust_members
  1140.     @party_window.activate
  1141.   end
  1142.   
  1143.   #--------------------------------------------------------------------------
  1144.   # window_refresh
  1145.   #--------------------------------------------------------------------------
  1146.   def window_refresh
  1147.     $game_party.rearrange_actors
  1148.     @command_window.refresh
  1149.     @party_window.refresh
  1150.     @list_window.refresh
  1151.     $game_player.refresh
  1152.     $game_map.need_refresh = true
  1153.   end
  1154.   
  1155.   #--------------------------------------------------------------------------
  1156.   # revert_party
  1157.   #--------------------------------------------------------------------------
  1158.   def revert_party
  1159.     @command_window.activate
  1160.     $game_party.battle_members_array = @former_party.clone
  1161.     window_refresh
  1162.   end
  1163.   
  1164.   #--------------------------------------------------------------------------
  1165.   # on_party_ok
  1166.   #--------------------------------------------------------------------------
  1167.   def on_party_ok
  1168.     case @command_window.current_symbol
  1169.     when :change
  1170.       @list_window.activate
  1171.     when :remove
  1172.       index = @party_window.index
  1173.       actor = $game_actors[$game_party.battle_members_array[index]]
  1174.       Sound.play_equip
  1175.       $game_party.battle_members_array[index] = 0
  1176.       window_refresh
  1177.       @party_window.activate
  1178.     end
  1179.   end
  1180.   
  1181.   #--------------------------------------------------------------------------
  1182.   # on_party_cancel
  1183.   #--------------------------------------------------------------------------
  1184.   def on_party_cancel
  1185.     @command_window.activate
  1186.   end
  1187.   
  1188.   #--------------------------------------------------------------------------
  1189.   # on_party_pageup
  1190.   #--------------------------------------------------------------------------
  1191.   def on_party_pageup
  1192.     Sound.play_equip
  1193.     actor_id1 = @party_window.item
  1194.     actor_id2 = @party_window.prev_actor.nil? ? 0 : @party_window.prev_actor.id
  1195.     max = @party_window.item_max-1
  1196.     index1 = @party_window.index
  1197.     index2 = @party_window.index == 0 ? max : index1-1
  1198.     $game_party.battle_members_array[index1] = actor_id2
  1199.     $game_party.battle_members_array[index2] = actor_id1
  1200.     window_refresh
  1201.   end
  1202.   
  1203.   #--------------------------------------------------------------------------
  1204.   # on_party_pagedown
  1205.   #--------------------------------------------------------------------------
  1206.   def on_party_pagedown
  1207.     Sound.play_equip
  1208.     actor_id1 = @party_window.item
  1209.     actor_id2 = @party_window.next_actor.nil? ? 0 : @party_window.next_actor.id
  1210.     max = @party_window.item_max-1
  1211.     index1 = @party_window.index
  1212.     index2 = @party_window.index == max ? 0 : index1+1
  1213.     $game_party.battle_members_array[index1] = actor_id2
  1214.     $game_party.battle_members_array[index2] = actor_id1
  1215.     window_refresh
  1216.   end
  1217.   
  1218.   #--------------------------------------------------------------------------
  1219.   # on_list_cancel
  1220.   #--------------------------------------------------------------------------
  1221.   def on_list_cancel
  1222.     @party_window.activate
  1223.   end
  1224.   
  1225.   #--------------------------------------------------------------------------
  1226.   # on_list_ok
  1227.   #--------------------------------------------------------------------------
  1228.   def on_list_ok
  1229.     Sound.play_equip
  1230.     replace = $game_actors[@party_window.item]
  1231.     actor = $game_actors[@list_window.item]
  1232.     index1 = @party_window.index
  1233.     actor_id1 = actor.nil? ? 0 : actor.id
  1234.     if actor.nil?
  1235.       $game_party.battle_members_array[index1] = 0
  1236.       window_refresh
  1237.       @party_window.activate
  1238.       return
  1239.     end
  1240.     actor_id2 = replace.nil? ? 0 : replace.id
  1241.     if $game_party.battle_members_array.include?(actor_id1)
  1242.       index2 = $game_party.battle_members_array.index(actor_id1)
  1243.       $game_party.battle_members_array[index2] = actor_id2
  1244.     end
  1245.     $game_party.battle_members_array[index1] = actor_id1
  1246.     window_refresh
  1247.     @party_window.activate
  1248.   end
  1249.   
  1250. end # Scene_Party

  1251. #==============================================================================
  1252. #
  1253. # ▼ End of File
  1254. #
  1255. #==============================================================================
复制代码
我是神奇的分割线-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------




#==============================================================================
#
# ▼ Yanfly Engine Ace - Party System Add-On: Command Party v1.01
# -- Last Updated: 2012.01.10
# -- Level: Easy, Normal
# -- Requires: YEA - Party System v1.00+
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-CommandParty"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.10 - Compatibility Update: Ace Battle Engine v1.15+
# 2011.12.13 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# An add-on to the Yanfly Engine Ace - Party System script. This script allows
# the player to change party members during the middle of battle from the
# Party Command Window (the Fight/Escape window).
# 允许战斗中更换队员
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# Note, if you do not give your player access to the party formation menu
# available in the Party System script, this script will disable itself.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# This script requires Yanfly Engine Ace - Party System v1.00+.
#
#==============================================================================

module YEA
  module COMMAND_PARTY
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Command Party Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This is just how the text appears visually in battle for your party and
    # how often the can change party in battle. Furthermore, there's two
    # switches that may be enabled or disabled to add the command to the
    # game. Adjust it as you see fit. Set the switches to 0 to not use them.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    COMMAND_TEXT   = "换战"    # Text used for the command.
    PARTY_COOLDOWN = 2          # Turns that must pass between each change.
    SHOW_SWITCH    = 0          # If switch is on, show command. 0 to disable.
    ENABLE_SWITCH  = 0          # If switch is on, enable command. 0 to disable.
   
  end # COMMAND_PARTY
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

if $imported["YEA-PartySystem"]

#==============================================================================
# ■ SceneManager
#==============================================================================

module SceneManager
  
  #--------------------------------------------------------------------------
  # new method: self.force_recall
  #--------------------------------------------------------------------------
  def self.force_recall(scene_class)
    @scene = scene_class
  end
  
end # SceneManager

#==============================================================================
# ■ Game_Unit
#==============================================================================

class Game_Unit
  
  #--------------------------------------------------------------------------
  # alias method: on_battle_start
  #--------------------------------------------------------------------------
  alias game_unit_on_battle_start_cpt on_battle_start
  def on_battle_start
    game_unit_on_battle_start_cpt
    reset_party_cooldown
  end
  
  #--------------------------------------------------------------------------
  # new method: reset_party_cooldown
  #--------------------------------------------------------------------------
  def reset_party_cooldown
    @party_cooldown = 0
  end
  
  #--------------------------------------------------------------------------
  # new method: update_party_cooldown
  #--------------------------------------------------------------------------
  def update_party_cooldown
    reset_party_cooldown if @party_cooldown.nil?
    @party_cooldown = [@party_cooldown - 1, 0].max
  end
  
  #--------------------------------------------------------------------------
  # new method: battle_party_change?
  #--------------------------------------------------------------------------
  def battle_party_change?
    switch = YEA::COMMAND_PARTY::ENABLE_SWITCH
    enabled = switch <= 0 ? true : $game_switches[switch]
    return false unless enabled
    reset_party_cooldown if @party_cooldown.nil?
    return @party_cooldown <= 0
  end
  
  #--------------------------------------------------------------------------
  # new method: set_party_cooldown
  #--------------------------------------------------------------------------
  def set_party_cooldown
    @party_cooldown = YEA::COMMAND_PARTY::PARTY_COOLDOWN
  end
  
  #--------------------------------------------------------------------------
  # alias method: on_battle_end
  #--------------------------------------------------------------------------
  alias game_unit_on_battle_end_cpt on_battle_end
  def on_battle_end
    game_unit_on_battle_end_cpt
    reset_party_cooldown
  end
  
end # Game_Unit

#==============================================================================
# ■ Window_PartyCommand
#==============================================================================

class Window_PartyCommand < Window_Command
  
  #--------------------------------------------------------------------------
  # alias method: make_command_list
  #--------------------------------------------------------------------------
  alias window_partycommand_make_command_list_cpt make_command_list
  def make_command_list
    window_partycommand_make_command_list_cpt
    return if $imported["YEA-BattleCommandList"]
    add_party_command
  end
  
  #--------------------------------------------------------------------------
  # new method: add_party_command
  #--------------------------------------------------------------------------
  def add_party_command
    return unless YEA::PARTY::ENABLE_MENU
    show = YEA::COMMAND_PARTY::SHOW_SWITCH
    continue = show == 0 ? true : $game_switches[show]
    continue = false if $game_party.all_members.size < 2
    return unless continue
    text = YEA::COMMAND_PARTY::COMMAND_TEXT
    add_command(text, :party, $game_party.battle_party_change?)
  end
  
end # Window_PartyCommand

#==============================================================================
# ■ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # alias method: create_party_command_window
  #--------------------------------------------------------------------------
  alias create_party_command_window_cpt create_party_command_window
  def create_party_command_window
    create_party_command_window_cpt
    @party_command_window.set_handler(:party, method(:command_party))
  end
  
  #--------------------------------------------------------------------------
  # new method: command_party
  #--------------------------------------------------------------------------
  def command_party
    Graphics.freeze
    @info_viewport.visible = false
    hide_extra_gauges if $imported["YEA-BattleEngine"]
    SceneManager.snapshot_for_background
    previous_party = $game_party.battle_members.clone
    index = @party_command_window.index
    oy = @party_command_window.oy
    #---
    SceneManager.call(Scene_Party)
    SceneManager.scene.main
    SceneManager.force_recall(self)
    #---
    show_extra_gauges if $imported["YEA-BattleEngine"]
    if previous_party != $game_party.battle_members
      $game_party.make_actions
      $game_party.set_party_cooldown
    end
    @info_viewport.visible = true
    @status_window.refresh
    @party_command_window.setup
    @party_command_window.select(index)
    @party_command_window.oy = oy
    perform_transition
  end
  
  #--------------------------------------------------------------------------
  # alias method: turn_end
  #--------------------------------------------------------------------------
  alias scene_battle_turn_end_cpt turn_end
  def turn_end
    scene_battle_turn_end_cpt
    return if $imported["YEA-BattleEngine"]
    update_party_cooldowns
  end
  
  #--------------------------------------------------------------------------
  # new method: update_party_cooldowns
  #--------------------------------------------------------------------------
  def update_party_cooldowns
    $game_party.update_party_cooldown
    $game_troop.update_party_cooldown
  end
  
end # Scene_Battle
end # $imported["YEA-PartySystem"]

#==============================================================================
#
# ▼ End of File
#
#==============================================================================

点评

我*。。喵的这个脚本把非战斗人员都算作死亡的么。。$game_party.alive_members只有参战的。。  发表于 2012-8-18 20:31
摘自《暗悲传》
某人
天啊!我无骂无打怎么这么多的狗,每天都要来咬我呢?......天理何在
某人
在路上看到了许多行人说道我眼前怎么全是无肺黑心肝在行走呢?
某人
有时被整的实在是受不了,很想杀狗,看看他们的心脏是黑的吗?
某人
我很喜欢黑夜与下雨,或许我只能在虚拟世界能过上一般人的生活......
某人
无论别人无良心骂我,诅咒死,刻意整蛊......希望能坚持活着!要永远记住那些人的奸诈嘴脸!
某人
又有谁能出来主持公道呢?谁能理解你,谁能站出来说句话.....他是无辜又悲苦......这真是无聊的故事吗?
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 08:48

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表