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

Project1

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

[已经解决] 如何在战斗中整队

[复制链接]

Lv3.寻梦者

虚空人形

梦石
0
星屑
4604
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

跳转到指定楼层
1
发表于 2012-3-28 14:43:40 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 hcm 于 2012-4-7 12:37 编辑

  RT,如何在战斗中更改战斗序列(包括替补队员),因为即使队员总数很多,场上的死光也就输了,
但一次出场一大堆人总觉得怪怪的,一般都是3-4个的。

Lv1.梦旅人

梦石
0
星屑
50
在线时间
334 小时
注册时间
2011-10-21
帖子
413
2
发表于 2012-3-28 16:28:42 | 只看该作者
目前没发现这样的脚本,于是写了一个~
  1. class Window_PartyCommand < Window_Command
  2.   def make_command_list
  3.     add_command(Vocab::fight,  :fight)
  4.     add_command("队伍",  :party)
  5.     add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  6.   end
  7. end

  8. class Window_BattleParty < Window_Selectable
  9.   attr_reader   :pending_index
  10.   def initialize
  11.     super(64, 0, 416, window_height)
  12.     refresh
  13.     self.openness = 0
  14.     @pending_index = -1
  15.   end
  16.   def window_height
  17.     $game_party.members.size * line_height + standard_padding * 2
  18.   end
  19.   def item_max
  20.     $game_party.members.size
  21.   end
  22.   def refresh
  23.     contents.clear
  24.     draw_all_items
  25.   end
  26.   def draw_item(index)
  27.     actor = $game_party.battle_members[index]
  28.     draw_item_background(index)
  29.     draw_basic_area(basic_area_rect(index), actor)
  30.     draw_gauge_area(gauge_area_rect(index), actor)
  31.   end
  32.   def draw_item_background(index)
  33.     if index == @pending_index
  34.       contents.fill_rect(item_rect(index), pending_color)
  35.     end
  36.   end
  37.   def basic_area_rect(index)
  38.     rect = item_rect_for_text(index)
  39.     rect.width -= gauge_area_width + 10
  40.     rect
  41.   end
  42.   def gauge_area_rect(index)
  43.     rect = item_rect_for_text(index)
  44.     rect.x += rect.width - gauge_area_width
  45.     rect.width = gauge_area_width
  46.     rect
  47.   end
  48.   def gauge_area_width
  49.     return 220
  50.   end
  51.   def draw_basic_area(rect, actor)
  52.     draw_actor_name(actor, rect.x + 0, rect.y, 100)
  53.     draw_actor_icons(actor, rect.x + 104, rect.y, rect.width - 104)
  54.   end
  55.   def draw_gauge_area(rect, actor)
  56.     if $data_system.opt_display_tp
  57.       draw_gauge_area_with_tp(rect, actor)
  58.     else
  59.       draw_gauge_area_without_tp(rect, actor)
  60.     end
  61.   end
  62.   def draw_gauge_area_with_tp(rect, actor)
  63.     draw_actor_hp(actor, rect.x + 0, rect.y, 72)
  64.     draw_actor_mp(actor, rect.x + 82, rect.y, 64)
  65.     draw_actor_tp(actor, rect.x + 156, rect.y, 64)
  66.   end
  67.   def draw_gauge_area_without_tp(rect, actor)
  68.     draw_actor_hp(actor, rect.x + 0, rect.y, 134)
  69.     draw_actor_mp(actor, rect.x + 144,  rect.y, 76)
  70.   end
  71.   def pending_index=(index)
  72.     last_pending_index = @pending_index
  73.     @pending_index = index
  74.     redraw_item(@pending_index)
  75.     redraw_item(last_pending_index)
  76.   end
  77. end

  78. class Scene_Battle < Scene_Base
  79.   alias create_party_command_window_party create_party_command_window
  80.   def create_party_command_window
  81.     create_party_command_window_party
  82.     @party_command_window.set_handler(:party,  method(:command_party))
  83.   end
  84.   def command_party
  85.     @party_window = Window_BattleParty.new if @party_window == nil
  86.     @party_window.open
  87.     @party_window.activate
  88.     @party_window.index = 0
  89.     @party_window.set_handler(:ok,     method(:on_formation_ok))
  90.     @party_window.set_handler(:cancel, method(:on_formation_cancel))
  91.   end
  92.   def on_formation_ok
  93.     if @party_window.pending_index >= 0
  94.       $game_party.swap_order(@party_window.index,
  95.                              @party_window.pending_index)
  96.       @party_window.pending_index = -1
  97.       @party_window.redraw_item(@party_window.index)
  98.     else
  99.       @party_window.pending_index = @party_window.index
  100.     end
  101.     @party_window.activate
  102.   end
  103.   def on_formation_cancel
  104.     if @party_window.pending_index >= 0
  105.       @party_window.pending_index = -1
  106.       @party_window.activate
  107.     else
  108.       @party_window.unselect
  109.       @party_window.close
  110.       @status_window.refresh
  111.       @party_command_window.activate
  112.     end
  113.   end
  114. end
复制代码

评分

参与人数 1星屑 +28 收起 理由
hcm + 28 感谢回答。

查看全部评分

我是活着的死人哦
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
637
在线时间
610 小时
注册时间
2010-8-5
帖子
139
3
发表于 2012-3-28 19:18:18 | 只看该作者
替补好像放不进
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2010-12-14
帖子
20
4
发表于 2012-3-28 19:27:26 | 只看该作者
就是不进入战斗界面战斗
  怪物是做1个事件,触碰后自动打玩家,玩家按空格/回车攻击怪物,如果可以显示血魔条和伤害最好,不行就算了,,
[
回复

使用道具 举报

Lv3.寻梦者

虚空人形

梦石
0
星屑
4604
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

5
 楼主| 发表于 2012-3-28 21:52:41 | 只看该作者
消失的三千 发表于 2012-3-28 16:28
目前没发现这样的脚本,于是写了一个~

这个脚本只能替换在战场上的人员,替补人员不算在内。
另外我加了禁止主角1调整序列的脚本:
  1. class Scene_Menu < Scene_MenuBase
  2.   alias fix_num1_on_formation_ok on_formation_ok
  3.   def on_formation_ok
  4.     if @status_window.index == $game_variables[10]
  5.       Sound.play_buzzer
  6.       @status_window.activate
  7.     else
  8.       fix_num1_on_formation_ok
  9.     end
  10.   end
  11. end
复制代码
该脚本在战斗中不起作用。

点评

抱歉迟了回复,第一行,class Scene_Menu,这个是只对菜单有效对战斗界面无效哦  发表于 2012-3-30 07:41
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
154
在线时间
664 小时
注册时间
2011-9-25
帖子
241
6
发表于 2012-3-28 21:59:21 | 只看该作者
本帖最后由 xuzhengchi 于 2012-3-28 22:01 编辑
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Party System Add-On: Command Party v1.01
  4. # -- Last Updated: 2012.01.10
  5. # -- Level: Easy, Normal
  6. # -- Requires: YEA - Party System v1.00+
  7. #
  8. #==============================================================================

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

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.10 - Compatibility Update: Ace Battle Engine v1.15+
  15. # 2011.12.13 - Started Script and Finished.
  16. #
  17. #==============================================================================
  18. # ▼ Introduction
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # An add-on to the Yanfly Engine Ace - Party System script. This script allows
  21. # the player to change party members during the middle of battle from the
  22. # Party Command Window (the Fight/Escape window).
  23. # 允许战斗中更换队员
  24. #==============================================================================
  25. # ▼ Instructions
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # To install this script, open up your script editor and copy/paste this script
  28. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  29. #
  30. # Note, if you do not give your player access to the party formation menu
  31. # available in the Party System script, this script will disable itself.
  32. #
  33. #==============================================================================
  34. # ▼ Compatibility
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  37. # it will run with RPG Maker VX without adjusting.
  38. #
  39. # This script requires Yanfly Engine Ace - Party System v1.00+.
  40. #
  41. #==============================================================================

  42. module YEA
  43.   module COMMAND_PARTY
  44.    
  45.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  46.     # - Command Party Settings -
  47.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  48.     # This is just how the text appears visually in battle for your party and
  49.     # how often the can change party in battle. Furthermore, there's two
  50.     # switches that may be enabled or disabled to add the command to the
  51.     # game. Adjust it as you see fit. Set the switches to 0 to not use them.
  52.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  53.     COMMAND_TEXT   = "队列"    # Text used for the command.
  54.     PARTY_COOLDOWN = 2          # Turns that must pass between each change.
  55.     SHOW_SWITCH    = 0          # If switch is on, show command. 0 to disable.
  56.     ENABLE_SWITCH  = 0          # If switch is on, enable command. 0 to disable.
  57.    
  58.   end # COMMAND_PARTY
  59. end # YEA

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

  65. if $imported["YEA-PartySystem"]

  66. #==============================================================================
  67. # ■ SceneManager
  68. #==============================================================================

  69. module SceneManager
  70.   
  71.   #--------------------------------------------------------------------------
  72.   # new method: self.force_recall
  73.   #--------------------------------------------------------------------------
  74.   def self.force_recall(scene_class)
  75.     @scene = scene_class
  76.   end
  77.   
  78. end # SceneManager

  79. #==============================================================================
  80. # ■ Game_Unit
  81. #==============================================================================

  82. class Game_Unit
  83.   
  84.   #--------------------------------------------------------------------------
  85.   # alias method: on_battle_start
  86.   #--------------------------------------------------------------------------
  87.   alias game_unit_on_battle_start_cpt on_battle_start
  88.   def on_battle_start
  89.     game_unit_on_battle_start_cpt
  90.     reset_party_cooldown
  91.   end
  92.   
  93.   #--------------------------------------------------------------------------
  94.   # new method: reset_party_cooldown
  95.   #--------------------------------------------------------------------------
  96.   def reset_party_cooldown
  97.     @party_cooldown = 0
  98.   end
  99.   
  100.   #--------------------------------------------------------------------------
  101.   # new method: update_party_cooldown
  102.   #--------------------------------------------------------------------------
  103.   def update_party_cooldown
  104.     reset_party_cooldown if @party_cooldown.nil?
  105.     @party_cooldown = [@party_cooldown - 1, 0].max
  106.   end
  107.   
  108.   #--------------------------------------------------------------------------
  109.   # new method: battle_party_change?
  110.   #--------------------------------------------------------------------------
  111.   def battle_party_change?
  112.     switch = YEA::COMMAND_PARTY::ENABLE_SWITCH
  113.     enabled = switch <= 0 ? true : $game_switches[switch]
  114.     return false unless enabled
  115.     reset_party_cooldown if @party_cooldown.nil?
  116.     return @party_cooldown <= 0
  117.   end
  118.   
  119.   #--------------------------------------------------------------------------
  120.   # new method: set_party_cooldown
  121.   #--------------------------------------------------------------------------
  122.   def set_party_cooldown
  123.     @party_cooldown = YEA::COMMAND_PARTY::PARTY_COOLDOWN
  124.   end
  125.   
  126.   #--------------------------------------------------------------------------
  127.   # alias method: on_battle_end
  128.   #--------------------------------------------------------------------------
  129.   alias game_unit_on_battle_end_cpt on_battle_end
  130.   def on_battle_end
  131.     game_unit_on_battle_end_cpt
  132.     reset_party_cooldown
  133.   end
  134.   
  135. end # Game_Unit

  136. #==============================================================================
  137. # ■ Window_PartyCommand
  138. #==============================================================================

  139. class Window_PartyCommand < Window_Command
  140.   
  141.   #--------------------------------------------------------------------------
  142.   # alias method: make_command_list
  143.   #--------------------------------------------------------------------------
  144.   alias window_partycommand_make_command_list_cpt make_command_list
  145.   def make_command_list
  146.     window_partycommand_make_command_list_cpt
  147.     return if $imported["YEA-BattleCommandList"]
  148.     add_party_command
  149.   end
  150.   
  151.   #--------------------------------------------------------------------------
  152.   # new method: add_party_command
  153.   #--------------------------------------------------------------------------
  154.   def add_party_command
  155.     return unless YEA::PARTY::ENABLE_MENU
  156.     show = YEA::COMMAND_PARTY::SHOW_SWITCH
  157.     continue = show == 0 ? true : $game_switches[show]
  158.     continue = false if $game_party.all_members.size < 2
  159.     return unless continue
  160.     text = YEA::COMMAND_PARTY::COMMAND_TEXT
  161.     add_command(text, :party, $game_party.battle_party_change?)
  162.   end
  163.   
  164. end # Window_PartyCommand

  165. #==============================================================================
  166. # ■ Scene_Battle
  167. #==============================================================================

  168. class Scene_Battle < Scene_Base
  169.   
  170.   #--------------------------------------------------------------------------
  171.   # alias method: create_party_command_window
  172.   #--------------------------------------------------------------------------
  173.   alias create_party_command_window_cpt create_party_command_window
  174.   def create_party_command_window
  175.     create_party_command_window_cpt
  176.     @party_command_window.set_handler(:party, method(:command_party))
  177.   end
  178.   
  179.   #--------------------------------------------------------------------------
  180.   # new method: command_party
  181.   #--------------------------------------------------------------------------
  182.   def command_party
  183.     Graphics.freeze
  184.     @info_viewport.visible = false
  185.     hide_extra_gauges if $imported["YEA-BattleEngine"]
  186.     SceneManager.snapshot_for_background
  187.     previous_party = $game_party.battle_members.clone
  188.     index = @party_command_window.index
  189.     oy = @party_command_window.oy
  190.     #---
  191.     SceneManager.call(Scene_Party)
  192.     SceneManager.scene.main
  193.     SceneManager.force_recall(self)
  194.     #---
  195.     show_extra_gauges if $imported["YEA-BattleEngine"]
  196.     if previous_party != $game_party.battle_members
  197.       $game_party.make_actions
  198.       $game_party.set_party_cooldown
  199.     end
  200.     @info_viewport.visible = true
  201.     @status_window.refresh
  202.     @party_command_window.setup
  203.     @party_command_window.select(index)
  204.     @party_command_window.oy = oy
  205.     perform_transition
  206.   end
  207.   
  208.   #--------------------------------------------------------------------------
  209.   # alias method: turn_end
  210.   #--------------------------------------------------------------------------
  211.   alias scene_battle_turn_end_cpt turn_end
  212.   def turn_end
  213.     scene_battle_turn_end_cpt
  214.     return if $imported["YEA-BattleEngine"]
  215.     update_party_cooldowns
  216.   end
  217.   
  218.   #--------------------------------------------------------------------------
  219.   # new method: update_party_cooldowns
  220.   #--------------------------------------------------------------------------
  221.   def update_party_cooldowns
  222.     $game_party.update_party_cooldown
  223.     $game_troop.update_party_cooldown
  224.   end
  225.   
  226. end # Scene_Battle
  227. end # $imported["YEA-PartySystem"]

  228. #==============================================================================
  229. #
  230. # ▼ End of File
  231. #
  232. #==============================================================================
复制代码
  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   = 5      # 最大参战人员. Default: 4
  87.     SPLIT_EXP            = false  # 平分经验?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 = 0  #设置游戏中改变最大参战人员的变量
  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. #==============================================================================
复制代码
第二个是YEA的队列脚本,作为战斗更换脚本的前置脚本存在。

点评

hcm
是的,但除389-399,貌似都是绿字的注解。不清楚该插在哪里。  发表于 2012-3-28 23:00
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
637
在线时间
610 小时
注册时间
2010-8-5
帖子
139
7
发表于 2012-3-28 22:10:26 | 只看该作者
楼上这个能让所有人都上场……可是怎么换呢

点评

hcm
第二套脚本89行改。  发表于 2012-3-28 22:21
回复

使用道具 举报

Lv3.寻梦者

虚空人形

梦石
0
星屑
4604
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

8
 楼主| 发表于 2012-3-28 22:40:39 | 只看该作者
xuzhengchi 发表于 2012-3-28 21:59
第二个是YEA的队列脚本,作为战斗更换脚本的前置脚本存在。

是不错的脚本啊,就是想问一下有没有办法禁止第一战斗序列更改,
加这套脚本后5楼的脚本失效了。

点评

lock_actor(x) 锁定X角色在队伍中的位置 请问你指的是这个吗?  发表于 2012-3-28 22:51
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
22948
在线时间
8638 小时
注册时间
2011-12-31
帖子
3367
9
发表于 2012-3-28 22:42:59 | 只看该作者
本帖最后由 tseyik 于 2012-3-28 23:22 编辑

http://a1tktk.web.fc2.com/scripts_page/change_member.html
A1共通スクリプト

  1. # ===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    A1共通処理(RGSS2/RGSS3共用)
  4. #
  5. # バージョン   : 4.50 (2012/01/26)
  6. # 作者         : A1
  7. # URL     : http://a1tktk.web.fc2.com/
  8. # ---------------------------------------------------------------------------
  9. # 更新履歴   :2011/11/11 Ver1.00 新規作成
  10. #        :2011/12/22 Ver2.00 RGSS3用と同様の処理に変更
  11. #        :2011/12/30 Ver2.10 RGSS3用メソッドを追加
  12. #        :2011/12/30 Ver3.00 RGSS3用共通処理と統合
  13. #        :2011/12/31 Ver3.10 マップチップサーチの仕様を変更
  14. #        :2011/12/31 Ver3.10 拡張通行判定を追加
  15. #        :2012/01/01 Ver3.11 クラス名の取得処理を追加
  16. #              :2012/01/02 Ver3.20 配列を考慮したsplit処理を追加
  17. #              :2012/01/02 Ver3.20 配列の全ての要素を整数にする処理を追加
  18. #              :2012/01/02 Ver3.30 注釈の処理の仕様を変更
  19. #              :2012/01/02 Ver3.40 「前のイベントコマンドの取得」を追加
  20. #              :2012/01/03 Ver3.50 「フレーム更新」を追加
  21. #              :2012/01/04 Ver3.60 「指定のウィンドウが開いている間ウェイト」追加
  22. #              :2012/01/04 Ver3.70 RGSS2用処理見直し
  23. #              :2012/01/05 Ver3.80 注釈文字列にエスケープコマンド対応
  24. #              :2012/01/05 Ver3.80 多次元配列を考慮したsplit処理を追加
  25. #              :2012/01/05 Ver3.80 注釈にスクリプト処理機能を追加
  26. #              :2012/01/10 Ver3.90 文字縁取り描画を追加
  27. #              :2012/01/11 Ver4.00 テキストビットマップのキャッシュを追加
  28. #              :2012/01/13 Ver4.01 「タイルセットの変更」ができなくなる不具合を修正
  29. #              :2012/01/14 Ver4.10 split処理を強化
  30. #              :2012/01/14 Ver4.20 空白を含む注釈コマンドに対応
  31. #              :2012/01/14 Ver4.21 split処理の不具合を修正
  32. #              :2012/01/21 Ver4.30 メモの内容を取得する関数を追加
  33. #              :2012/01/24 Ver4.40 メモの内容を取得する関数を追加
  34. #              :2012/01/24 Ver4.50 メモの内容を取得する関数を追加
  35. # ---------------------------------------------------------------------------
  36. # 設置場所      
  37. #  なるべく上の方
  38. #
  39. # 必要スクリプト
  40. #    なし
  41. #==============================================================================
  42. $imported = {} if $imported == nil
  43. $imported["A1_Common_Script"] = 4.50
  44. #==============================================================================
  45. # ■ Kernel
  46. #==============================================================================
  47. module Kernel
  48.   #--------------------------------------------------------------------------
  49.   # ○ RGSSのバージョン取得
  50.   #--------------------------------------------------------------------------
  51.   def rgss_version
  52.     return 3 if defined? Graphics.play_movie
  53.     return 2 if defined? Graphics.resize_screen
  54.     return 1
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ○ コモンスクリプトのバージョン取得
  58.   #--------------------------------------------------------------------------
  59.   def common_version
  60.     $imported["A1_Common_Script"]
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ○ コモンスクリプトのバージョンが古い
  64.   #--------------------------------------------------------------------------
  65.   def old_common_script(script_name, version)
  66.     msgbox("#{script_name}にはA1共通スクリプトVer#{version}以上が必要です")
  67.   end
  68. end
  69. #==============================================================================
  70. # ■ A1_System
  71. #==============================================================================
  72. module A1_System
  73. end
  74. #==============================================================================
  75. # ■ A1_System::CommonModule
  76. #==============================================================================

  77. class A1_System::CommonModule
  78.   #--------------------------------------------------------------------------
  79.   # ○ 定数
  80.   #--------------------------------------------------------------------------
  81.   TWOBYTE_LIST = {
  82.                   " " => " ",
  83.                   "=" => "=",
  84.                   ":" => ":"
  85.                   }
  86.   #--------------------------------------------------------------------------
  87.   # ○ オブジェクト初期化
  88.   #--------------------------------------------------------------------------
  89.   def initialize
  90.     define_command
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ○ 変換対象の全角文字を半角に置換
  94.   #--------------------------------------------------------------------------
  95.   def replace_twobyte(str)
  96.     for key in TWOBYTE_LIST.keys
  97.       str.gsub!(key) {TWOBYTE_LIST[key]}
  98.     end
  99.     return str
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ○ マイナスが含まれている文字列を数値にする
  103.   #--------------------------------------------------------------------------
  104.   def minus_to_i(s)
  105.     if s[0,0] == "-"
  106.       s.gsub!("-","")
  107.       return s.to_i * -1
  108.     else
  109.       return s.to_i
  110.     end
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ○ ミリ秒単位の現在時間
  114.   #--------------------------------------------------------------------------
  115.   def now_usec
  116.     now = Time.now
  117.     hour = now.hour * 60 * 60
  118.     min  = now.min * 60
  119.     sec  = now.sec
  120.     msec = (now.usec / 1000.0).round
  121.     return (hour + min + sec) * 1000 + msec
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ○ イベントリストの作成
  125.   #--------------------------------------------------------------------------
  126.   def create_event_list(code, indent, parameters)
  127.     list = RPG::EventCommand.new
  128.     list.code       = code
  129.     list.indent     = indent
  130.     list.parameters = parameters
  131.     return list
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ○ メソッド呼び出し
  135.   #--------------------------------------------------------------------------
  136.   def send_method(method_name)
  137.     return send(method_name) if respond_to?(method_name)
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ○ オブジェクトの型を判断してStringならエンコード
  141.   #--------------------------------------------------------------------------
  142.   def encoding_string(obj)
  143.     obj.force_encoding("UTF-8") if obj.is_a?(String)
  144.     return obj
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ○ メモの内容から必要な情報を取得
  148.   #--------------------------------------------------------------------------
  149.   def note_data(note, key)
  150.     result = []
  151.     note.each_line {|line|
  152.       next unless line =~ /<#{key}[ ]?(.*)>/
  153.       return true if $1.empty?
  154.       data = $a1_common.replace_twobyte($1).split(" ")
  155.       for st in data
  156.         result.push(st)
  157.       end
  158.     }
  159.     return false if result.empty?
  160.     return result
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ○ メモの内容からハッシュを作成
  164.   #--------------------------------------------------------------------------
  165.   def note_data_hash(note, key, data_default = nil, default = {}, ret = {})
  166.     list = note_data_split(note, key)
  167.     return default if list.empty?
  168.     list.each {|data| ret[data[0]] = data[1] ? data[1] : data_default }
  169.     return ret
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ○ メモの内容からカンマ区切りの多元配列を取得
  173.   #--------------------------------------------------------------------------
  174.   def note_data_split(note, key, default = [], ret = [])
  175.     data = note_data(note, key)
  176.     return default unless data.is_a?(Array)
  177.     data.each {|str| ret.push(convert_integer_from_array(split_array(str)))}
  178.     return ret
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ○ 配列の内容から数値があれば変換
  182.   #--------------------------------------------------------------------------
  183.   def convert_integer_from_array(data, ret = [])
  184.     data.each {|str| ret.push(convert_integer(str))}
  185.     return ret
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ○ 数値があれば変換
  189.   #--------------------------------------------------------------------------
  190.   def convert_integer(str)
  191.     return $1.to_i if str =~ /(^[-]?[0-9]+$)/
  192.     str.is_a?(Array) ? convert_integer_from_array(str) : str
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ○ メモの内容から単項目の数値を取得
  196.   #--------------------------------------------------------------------------
  197.   def note_data_one_value(note, key, default)
  198.     data = note_data(note, key)
  199.     return data[0].to_i if data.is_a?(Array)
  200.     return default
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ○ メモの内容から単項目を取得
  204.   #--------------------------------------------------------------------------
  205.   def note_data_one(note, key, default)
  206.     data = note_data(note, key)
  207.     return data[0] if data.is_a?(Array)
  208.     return default
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ○ メモの内容からカンマ区切りの文字列を取得
  212.   #--------------------------------------------------------------------------
  213.   def note_data_array_str(note, key, default)
  214.     data = note_data(note, key)
  215.     return data[0].split(",") if data.is_a?(Array)
  216.     return default
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ○ メモの内容からカンマ区切りの数値を取得
  220.   #--------------------------------------------------------------------------
  221.   def note_data_array_value(note, key, default)
  222.     data = note_data(note, key)
  223.     return default unless data.is_a?(Array)
  224.     return convert_integer_from_array(split_array(data[0]))
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ○ カンマ区切りの文字列メモを変換
  228.   #--------------------------------------------------------------------------
  229.   def note_data_array(note, key, type, default = nil, through = true)
  230.     ret = []
  231.     default.each {|dat| ret.push(dat)} if default != nil
  232.    
  233.     data = note_data(note, key)
  234.     return ret unless data.is_a?(Array)
  235.    
  236.     data = data[0].split(",")
  237.     for d in data
  238.       next if ret.include?(d) if through
  239.       ret.push(d.to_i) if type.is_a?(Integer)
  240.       ret.push(d)      if type.is_a?(String)
  241.     end
  242.     return ret
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ○ ディレクトリの作成
  246.   #--------------------------------------------------------------------------
  247.   def make_directory(dir_name)
  248.     Dir::mkdir(dir_name) unless FileTest.exist?(dir_name)
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ○ コマンドリスト
  252.   #--------------------------------------------------------------------------
  253.   def make_command(command, src = "", dect = "")
  254.     src.gsub!("/","\\")
  255.     dect.gsub!("/","\\")
  256.     cmd = "#{command} \"#{src}\" \"#{dect}\""
  257.     return cmd
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ○ 素材の拡張子を取得
  261.   #--------------------------------------------------------------------------
  262.   def material_ext(directory, file, direct = false)
  263.     exts = []
  264.     exts = [".png",".bmp",".jpg"]               if directory =~ /(.*)Graphics\/(.*)/
  265.     exts = [".mid",".ogg",".wav",".mp3",".wma"] if directory =~ /(.*)Audio(.*)/
  266.    
  267.     find_file = sprintf("%s%s", directory, file) unless direct
  268.     find_file = file if direct
  269.    
  270.     for ext in exts
  271.       return ext if File.exist?(sprintf("%s%s", find_file, ext))
  272.     end
  273.     return nil
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ○ 素材が存在するかチェック
  277.   #--------------------------------------------------------------------------
  278.   def material_exist?(directory, file, direct = false)
  279.     return false if material_ext(directory, file, direct) == nil
  280.     return true
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ○ ファイルコピー
  284.   #--------------------------------------------------------------------------
  285.   def copy_file(src, dest)
  286.     srcFile = File.open( src, "rb" )
  287.     dstFile = File.open( dest, "wb" )
  288.     dstFile.write( srcFile.read )
  289.     srcFile.close
  290.     dstFile.close
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ○ ファイルの存在を確認してファイルコピー
  294.   #--------------------------------------------------------------------------
  295.   def material_copy(src, dest, directory)
  296.     ext = material_ext(directory, src, true)
  297.     copy_file( src + ext, dest + ext ) if ext != nil
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ○ 配列からAudioを作成
  301.   #--------------------------------------------------------------------------
  302.   def set_audio(sound, kind)
  303.     case kind
  304.     when "BGM"; audio = RPG::BGM.new
  305.     when "BGS"; audio = RPG::BGS.new
  306.     when "ME";  audio = RPG::ME.new
  307.     when "SE";  audio = RPG::SE.new
  308.     end
  309.     audio.name   = sound[0]
  310.     audio.volume = sound[1]
  311.     audio.pitch  = sound[2]
  312.     return audio
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ○ 既に準拠識別子を持っているかチェック
  316.   #--------------------------------------------------------------------------
  317.   def chk_rtp(file_name, default)
  318.     return "" if file_name =~ /^VX_.*/
  319.     return "" if file_name =~ /^XP_.*/
  320.     return "" if file_name =~ /^2000_.*/
  321.     return "" if file_name =~ /^2003_.*/
  322.     return default
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ○ 先頭の $ を切り出す
  326.   #--------------------------------------------------------------------------
  327.   def one_character(file_name)
  328.     return file_name unless file_name[0] == "$"
  329.     tmp = file_name.clone
  330.     tmp[0] = ""
  331.     return tmp
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ○ 配列を入れ替える
  335.   #--------------------------------------------------------------------------
  336.   def change_array(array, index1, index2)
  337.     tmp = array[index1]
  338.     array[index1] = array[index2]
  339.     array[index2] = tmp
  340.     return array
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # ○ 移動ルートの作成
  344.   #--------------------------------------------------------------------------
  345.   def create_move_route(repeat, skippable, wait, list)
  346.     move_route = RPG::MoveRoute.new
  347.     move_route.repeat    = repeat
  348.     move_route.skippable = skippable
  349.     move_route.wait      = wait
  350.     move_route.list      = list
  351.     return move_route
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ○ 移動ルートコマンドの作成
  355.   #--------------------------------------------------------------------------
  356.   def create_move_command(code, parameters)
  357.     list = RPG::MoveCommand.new
  358.     list.code       = code
  359.     list.parameters = parameters
  360.     return list
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # ○ インタプリタ起動用リストの作成
  364.   #--------------------------------------------------------------------------
  365.   def create_list(code, indent, parameters)
  366.     list            = RPG::EventCommand.new
  367.     list.code       = code
  368.     list.indent     = indent
  369.     list.parameters = parameters
  370.     return list
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ○ クラス名の取得
  374.   #--------------------------------------------------------------------------
  375.   def class_name(class_instance)
  376.     return class_instance.to_s.split(":")[0].gsub("#<","")
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   # ○ 配列を考慮したsplit
  380.   #--------------------------------------------------------------------------
  381.   def split_array(str)
  382.     str = convert_escape_characters(str)
  383.    
  384.     ret       = []
  385.     tmp_array = str.split(",")
  386.    
  387.     return strip_array_str(tmp_array) unless str.include?("[")
  388.     tmp_str   = ""
  389.     tmp_array.each {|s|
  390.       if char_in_str(s, "[", "]") && tmp_str.empty?
  391.         ret.push(s) unless s =~ /^\[/
  392.         ret.push([s[1...s.size-1]]) if s =~ /^\[/
  393.       else
  394.         tmp_str = "#{tmp_str}#{s},"
  395.         if char_in_str(tmp_str, "[", "]")
  396.           unless tmp_str =~ /^\[/
  397.             ret.push(tmp_str[0...tmp_str.size-1])
  398.             tmp_str = ""
  399.           else
  400.             tmp_str = tmp_str[1...tmp_str.size-2]
  401.             tmp_str = split_array(tmp_str) if tmp_str.include?("[")
  402.             tmp_str = tmp_str.split(",") if tmp_str.include?(",")
  403.             ret.push(tmp_str)   if tmp_str.is_a?(Array)
  404.             ret.push([tmp_str]) if !tmp_str.is_a?(Array)
  405.             tmp_str = ""
  406.           end
  407.         end
  408.       end
  409.     }
  410.     return strip_array_str(ret)
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # ○ 配列の中の文字列の先頭と末尾の空白を除去
  414.   #--------------------------------------------------------------------------
  415.   def strip_array_str(array, ret = [])
  416.     array.each {|str| ret.push(strip_array_str(str)) if str.is_a?(Array); next if str.is_a?(Array); ret.push(str.strip) }
  417.     return ret
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ○ 文字列の中に文字が何文字含まれているか調べて同数ならtrueを返す
  421.   #--------------------------------------------------------------------------
  422.   def char_in_str(str, c1, c2)
  423.     num1 = 0
  424.     num2 = 0
  425.     (0...str.size).each {|i| num1 += 1 if str[i] == c1; num2 += 1 if str[i] == c2 }
  426.     return num1 == num2
  427.   end
  428.   #--------------------------------------------------------------------------
  429.   # ○ 制御文字の変換
  430.   #--------------------------------------------------------------------------
  431.   def convert_escape_characters(text)
  432.     result = text.to_s.clone
  433.     result.gsub!(/\\/)                           { "\e" }
  434.     result.gsub!(/\e\e/)                         { "\\" }
  435.     result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
  436.     result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
  437.     result.gsub!(/\eN\[(\d+)\]/i)                { actor_name($1.to_i) }
  438.     result.gsub!(/\eP\[(\d+)\]/i)                { party_member_name($1.to_i) }
  439.     result.gsub!(/\eG/i)                         { Vocab::currency_unit }
  440.     loop { result = result.sub(/<s>(.+?)<\/s>/i) { eval($1) }; break unless $1 }
  441.     result
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # ○ アクター n 番の名前を取得
  445.   #--------------------------------------------------------------------------
  446.   def actor_name(n)
  447.     actor = n >= 1 ? $game_actors[n] : nil
  448.     actor ? actor.name : ""
  449.   end
  450.   #--------------------------------------------------------------------------
  451.   # ○ パーティメンバー n 番の名前を取得
  452.   #--------------------------------------------------------------------------
  453.   def party_member_name(n)
  454.     actor = n >= 1 ? $game_party.members[n - 1] : nil
  455.     actor ? actor.name : ""
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # ○ 配列を全て整数にする
  459.   #--------------------------------------------------------------------------
  460.   def params_to_i(params)
  461.     ret = []
  462.     params.each {|param| ret.push(param.to_i)}
  463.     return ret
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ○ 注釈コマンド定義
  467.   #--------------------------------------------------------------------------
  468.   def define_command
  469.     @cmd_108 = {}
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ○ 注釈コマンド定義取得
  473.   #--------------------------------------------------------------------------
  474.   def cmd_108
  475.     @cmd_108
  476.   end
  477.   #--------------------------------------------------------------------------
  478.   # ○ フレーム更新
  479.   #--------------------------------------------------------------------------
  480.   def update
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # ○ 文字の幅と高さを取得
  484.   #--------------------------------------------------------------------------
  485.   def text_size(font, size, text)
  486.     bitmap = Cache.system("")
  487.     bitmap.font.name = font
  488.     bitmap.font.size = size
  489.     tw = bitmap.text_size(text).width
  490.     th = bitmap.text_size(text).height
  491.     bitmap.dispose
  492.     return [tw, th]
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ○ 文字の幅を取得
  496.   #--------------------------------------------------------------------------
  497.   def text_width(font, text)
  498.     texts = text.split("\n")
  499.     @max_width = 0
  500.     texts.each {|text|
  501.       width = text_size(font.name, font.size, text)[0]
  502.       @max_width = @max_width < width ? width : @max_width
  503.     }
  504.     return @max_width
  505.   end
  506. end
  507. #==============================================================================
  508. # ◆ RGSS3用処理
  509. #==============================================================================
  510. if rgss_version == 3
  511. #==============================================================================
  512. # ■ RPG::Tileset
  513. #==============================================================================

  514. class RPG::Tileset
  515.   #--------------------------------------------------------------------------
  516.   # ○ 拡張通行判定
  517.   #--------------------------------------------------------------------------
  518.   def ex_flags
  519.     @ex_flags ||= Table.new(8192)
  520.     return @ex_flags
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ○ 拡張通行判定初期化
  524.   #--------------------------------------------------------------------------
  525.   def init_ex_flags
  526.     @ex_flags = Table.new(8192)
  527.   end
  528. end
  529. #==============================================================================
  530. # ■ Game_Interpreter
  531. #------------------------------------------------------------------------------
  532. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  533. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  534. #==============================================================================

  535. class Game_Interpreter
  536.   #--------------------------------------------------------------------------
  537.   # ☆ オブジェクト初期化
  538.   #     depth : ネストの深さ
  539.   #--------------------------------------------------------------------------
  540.   alias a1_common_gi_rgss3_initialize initialize
  541.   def initialize(depth = 0, sub_interpreter = false)
  542.     @sub_interpreter = sub_interpreter
  543.     a1_common_gi_rgss3_initialize(depth)
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # ☆ メッセージ表示がビジー状態の間ウェイト
  547.   #--------------------------------------------------------------------------
  548.   alias a1_common_gi_wait_for_message wait_for_message
  549.   def wait_for_message
  550.     return if @sub_interpreter
  551.     a1_common_gi_wait_for_message
  552.   end
  553. end
  554. #==============================================================================
  555. # ■ Window_Message
  556. #------------------------------------------------------------------------------
  557. #  文章表示に使うメッセージウィンドウです。
  558. #==============================================================================

  559. class Window_Message < Window_Base
  560.   #--------------------------------------------------------------------------
  561.   # ☆ 通常文字の処理
  562.   #--------------------------------------------------------------------------
  563.   alias a1_common_wm_process_normal_character process_normal_character
  564.   def process_normal_character(c, pos)
  565.     wait_for_one_character_before
  566.     a1_common_wm_process_normal_character(c, pos)
  567.   end
  568.   #--------------------------------------------------------------------------
  569.   # ○ 一文字出力前のウェイト
  570.   #--------------------------------------------------------------------------
  571.   def wait_for_one_character_before
  572.   end
  573. end
  574. #==============================================================================
  575. # ■ RPG::Map
  576. #==============================================================================

  577. class RPG::Map
  578.   #--------------------------------------------------------------------------
  579.   # ○ マップチップを調べるか判定する
  580.   #--------------------------------------------------------------------------
  581.   def search_map_chip?
  582.     return true if $a1_common.note_data(self.note, "マップチップサーチ")
  583.     return false
  584.   end
  585. end
  586. #==============================================================================
  587. # ■ Game_Map
  588. #------------------------------------------------------------------------------
  589. #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  590. # このクラスのインスタンスは $game_map で参照されます。
  591. #==============================================================================

  592. class Game_Map
  593.   #--------------------------------------------------------------------------
  594.   # ☆ セットアップ
  595.   #--------------------------------------------------------------------------
  596.   alias a1_common_gm_setup setup
  597.   def setup(map_id)
  598.     a1_common_gm_setup(map_id)
  599.     setup_tileset
  600.     map_chip_search if search_map_chip?
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ★ タイルセットの取得
  604.   #--------------------------------------------------------------------------
  605.   def tileset
  606.     setup_tileset unless @tileset && @now_tileset_id == @tileset_id
  607.     return @tileset
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # ○ タイルセットのセットアップ
  611.   #--------------------------------------------------------------------------
  612.   def setup_tileset
  613.     @tileset        = $data_tilesets[@tileset_id].clone
  614.     @tileset.flags  = $data_tilesets[@tileset_id].flags.clone
  615.     @now_tileset_id = @tileset_id
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # ○ マップチップを調べるか判定する
  619.   #--------------------------------------------------------------------------
  620.   def search_map_chip?
  621.     return @map.search_map_chip?
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ○ 指定座標の全レイヤーのフラグ判定(イベント含む)
  625.   #--------------------------------------------------------------------------
  626.   def all_tiles_flag?(x, y, bit)
  627.     all_tiles(x, y).any? {|tile_id| tileset.flags[tile_id] & bit != 0 }
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ○ 指定座標の全レイヤーの拡張フラグ判定(イベント含む)
  631.   #--------------------------------------------------------------------------
  632.   def all_tiles_flag_ex?(x, y, bit)
  633.     all_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ○ 指定座標の全レイヤーの拡張フラグ判定
  637.   #--------------------------------------------------------------------------
  638.   def layered_tiles_flag_ex?(x, y, bit)
  639.     layered_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # ○ 地形タグの取得(イベント含む)
  643.   #--------------------------------------------------------------------------
  644.   def terrain_tag_all_tailes(x, y)
  645.     return 0 unless valid?(x, y)
  646.     all_tiles(x, y).each do |tile_id|
  647.       tag = tileset.flags[tile_id] >> 12
  648.       return tag if tag > 0
  649.     end
  650.     return 0
  651.   end
  652. end
  653. #==============================================================================
  654. # ■ DataManager
  655. #------------------------------------------------------------------------------
  656. #  データベースとゲームオブジェクトを管理するモジュールです。ゲームで使用する
  657. # ほぼ全てのグローバル変数はこのモジュールで初期化されます。
  658. #==============================================================================

  659. module DataManager
  660.   #--------------------------------------------------------------------------
  661.   # ○ エイリアス用特異メソッド
  662.   #--------------------------------------------------------------------------
  663.   class << self
  664.     alias :a1_common_create_game_objects :create_game_objects
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # ☆ 各種ゲームオブジェクトの作成
  668.   #--------------------------------------------------------------------------
  669.   def self.create_game_objects
  670.     $a1_common ||= A1_System::CommonModule.new
  671.     a1_common_create_game_objects
  672.   end
  673. end
  674. #==============================================================================
  675. # ■ Scene_Base
  676. #------------------------------------------------------------------------------
  677. #  ゲーム中の全てのシーンのスーパークラスです。
  678. #==============================================================================

  679. class Scene_Base
  680.   #--------------------------------------------------------------------------
  681.   # ☆ フレーム更新(基本)
  682.   #--------------------------------------------------------------------------
  683.   alias a1_common_sb_update_basic update_basic
  684.   def update_basic
  685.     a1_common_sb_update_basic
  686.     $a1_common.update
  687.   end
  688.   #--------------------------------------------------------------------------
  689.   # ○ 指定のウィンドウが開いている間ウェイト
  690.   #--------------------------------------------------------------------------
  691.   def wait_for_window_open(window)
  692.     update_basic until window.openness == 0
  693.   end
  694. end
  695. #==============================================================================
  696. # ■ Window_Base
  697. #------------------------------------------------------------------------------
  698. #  ゲーム中の全てのウィンドウのスーパークラスです。
  699. #==============================================================================

  700. class Window_Base < Window
  701.   #--------------------------------------------------------------------------
  702.   # ★ 制御文字の事前変換
  703.   #    実際の描画を始める前に、原則として文字列に変わるものだけを置き換える。
  704.   #    文字「\」はエスケープ文字(\e)に変換。
  705.   #--------------------------------------------------------------------------
  706.   def convert_escape_characters(text)
  707.     return $a1_common.convert_escape_characters(text)
  708.   end
  709. end
  710. #==============================================================================
  711. # ◆ RGSS2用処理
  712. #==============================================================================
  713. elsif rgss_version == 2
  714. #==============================================================================
  715. # ■ Window
  716. #==============================================================================

  717. class Window
  718.   #--------------------------------------------------------------------------
  719.   # ○ ウィンドウが開いている?
  720.   #--------------------------------------------------------------------------
  721.   def open?
  722.     return self.openness == 255
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # ○ ウィンドウが閉じている?
  726.   #--------------------------------------------------------------------------
  727.   def close?
  728.     return self.openness == 0
  729.   end
  730. end
  731. #==============================================================================
  732. # ■ Cache
  733. #------------------------------------------------------------------------------
  734. #  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
  735. # です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
  736. # のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
  737. # を返すようになっています。
  738. #==============================================================================

  739. module Cache
  740.   #--------------------------------------------------------------------------
  741.   # ○ キャッシュ存在チェック
  742.   #--------------------------------------------------------------------------
  743.   def self.include?(key)
  744.     @cache[key] && !@cache[key].disposed?
  745.   end
  746. end
  747. #==============================================================================
  748. # ■ Game_Interpreter
  749. #------------------------------------------------------------------------------
  750. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  751. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  752. #==============================================================================

  753. class Game_Interpreter
  754.   #--------------------------------------------------------------------------
  755.   # ○ 注釈
  756.   #--------------------------------------------------------------------------
  757.   def command_108
  758.     @comments = [@params[0]]
  759.     while next_event_code == 408
  760.       @index += 1
  761.       @comments.push(@list[@index].parameters[0])
  762.     end
  763.   end
  764.   #--------------------------------------------------------------------------
  765.   # ★ イベントコマンドの実行
  766.   #--------------------------------------------------------------------------
  767.   def execute_command
  768.     return rgss3_execute_command unless @index >= @list.size-1
  769.     command_end
  770.     return true
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # ○ RGSS3風「イベントコマンドの実行」
  774.   #--------------------------------------------------------------------------
  775.   def rgss3_execute_command
  776.     command = @list[@index]
  777.     @params = command.parameters
  778.     @indent = command.indent
  779.     method_name = "command_#{command.code}"
  780.     send(method_name) if respond_to?(method_name)
  781.   end
  782.   #--------------------------------------------------------------------------
  783.   # ○ 次のイベントコマンドのコードを取得
  784.   #--------------------------------------------------------------------------
  785.   def next_event_code
  786.     @list[@index + 1].code
  787.   end
  788. end
  789. #==============================================================================
  790. # ■ Game_Map
  791. #------------------------------------------------------------------------------
  792. #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  793. # このクラスのインスタンスは $game_map で参照されます。
  794. #==============================================================================

  795. class Game_Map
  796.   #--------------------------------------------------------------------------
  797.   # ○ マップチップを調べるか判定する
  798.   #--------------------------------------------------------------------------
  799.   def search_map_chip?
  800.     return $data_map_infos[@map_id].name =~ /\[サーチ\]/
  801.   end
  802.   #--------------------------------------------------------------------------
  803.   # ○ 指定座標に存在するタイル扱いイベント(すり抜け以外)の配列取得
  804.   #--------------------------------------------------------------------------
  805.   def tile_events_xy(x, y)
  806.     @tile_events.select {|event| event.pos_nt?(x, y) }
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ○ タイル扱いイベントの配列をリフレッシュ
  810.   #--------------------------------------------------------------------------
  811.   def refresh_tile_events
  812.     @tile_events = @events.values.select {|event| event.tile? }
  813.   end
  814. end
  815. #==============================================================================
  816. # ■ Game_Character
  817. #------------------------------------------------------------------------------
  818. #  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
  819. # クラスのスーパークラスとして使用されます。
  820. #==============================================================================

  821. class Game_Character
  822.   #--------------------------------------------------------------------------
  823.   # ○ タイル判定
  824.   #--------------------------------------------------------------------------
  825.   def tile?
  826.     @tile_id > 0 && @priority_type == 0
  827.   end
  828. end
  829. #==============================================================================
  830. # ■ Scene_Title
  831. #------------------------------------------------------------------------------
  832. #  タイトル画面の処理を行うクラスです。
  833. #==============================================================================

  834. class Scene_Title < Scene_Base
  835.   #--------------------------------------------------------------------------
  836.   # ☆ データベースのロード
  837.   #--------------------------------------------------------------------------
  838.   alias a1_common_st_load_database load_database
  839.   def load_database
  840.     a1_common_st_load_database
  841.     $data_map_infos = load_data("Data/MapInfos.rvdata")
  842.   end
  843.   #--------------------------------------------------------------------------
  844.   # ☆ 各種ゲームオブジェクトの作成
  845.   #--------------------------------------------------------------------------
  846.   alias a1_common_st_create_game_objects create_game_objects
  847.   def create_game_objects
  848.     $a1_common ||= A1_System::CommonModule.new
  849.     a1_common_st_create_game_objects
  850.   end
  851. end
  852. #==============================================================================
  853. # ◆ RGSS用処理
  854. #==============================================================================
  855. elsif rgss_version == 1
  856. end
  857. #==============================================================================
  858. # ■ Cache
  859. #------------------------------------------------------------------------------
  860. #  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
  861. # です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
  862. # のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
  863. # を返すようになっています。
  864. #==============================================================================

  865. module Cache
  866.   #--------------------------------------------------------------------------
  867.   # ○ 拡大縮小したビットマップのロード
  868.   #--------------------------------------------------------------------------
  869.   def self.load_resize_bitmap(load_path, key, resize = nil)
  870.     @cache ||= {}
  871.     key = load_path if key == nil
  872.     return @cache[key] if include?(key)
  873.    
  874.     @cache[key] = Bitmap.new(load_path)
  875.     return @cache[key] if resize == nil
  876.     return @cache[key] if @cache[key].width == resize[0] and @cache[key].height == resize[1]
  877.    
  878.     info = calc_size(resize, key)
  879.     return resize_bitmap(@cache[key], info[0], info[1], key)
  880.   end
  881.   #--------------------------------------------------------------------------
  882.   # ○ 拡大縮小した色相変化済みビットマップを作成/取得
  883.   #--------------------------------------------------------------------------
  884.   def self.load_resize_hue_changed_bitmap(load_path, path, hue, resize)
  885.     key = [path, hue]
  886.     return @cache[key] if include?(key)
  887.    
  888.     @cache[key] = load_resize_bitmap(load_path, path, resize).clone
  889.     @cache[key].hue_change(hue)
  890.     return @cache[key]
  891.   end
  892.   #--------------------------------------------------------------------------
  893.   # ○ リサイズするサイズを取得
  894.   #--------------------------------------------------------------------------
  895.   def self.calc_size(resize, key)
  896.     width  = resize[0]
  897.     width  = @cache[key].width * width.abs if width < 0
  898.     height = resize[1]
  899.     height = @cache[key].height * height.abs if height < 0
  900.     height = Integer(@cache[key].height * (width.to_f / @cache[key].width.to_f)) if height == 0
  901.     return [width, height]
  902.   end
  903.   #--------------------------------------------------------------------------
  904.   # ○ ビットマップの拡大縮小
  905.   #--------------------------------------------------------------------------
  906.   def self.resize_bitmap(bitmap, width, height, key)
  907.     resize = Bitmap.new(width, height)
  908.     resize.stretch_blt(resize.rect, bitmap, bitmap.rect)
  909.     @cache[key] = resize
  910.     return resize
  911.   end
  912.   #--------------------------------------------------------------------------
  913.   # ○ テキストビットマップの取得
  914.   #--------------------------------------------------------------------------
  915.   def self.text_picture(text, font)
  916.     load_text_bitmap(text, font)
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # ○ フォントのキーを作成
  920.   #--------------------------------------------------------------------------
  921.   def self.make_font_key(text, font)
  922.     [text, font.name, font.size, font.bold, font.italic, font.outline, font.shadow, font.color.to_s, font.out_color.to_s]
  923.   end
  924.   #--------------------------------------------------------------------------
  925.   # ○ テキストビットマップの作成
  926.   #--------------------------------------------------------------------------
  927.   def self.load_text_bitmap(text, font)
  928.     @cache ||= {}
  929.     key = make_font_key(text, font)
  930.     return @cache[key] if include?(key)
  931.    
  932.     # 計算用ダミービットマップ
  933.     bitmap = Cache.system("")
  934.     bitmap.font = font
  935.     tw = bitmap.text_size(text).width + 8
  936.    
  937.     # ビットマップ作成
  938.     bitmap = Bitmap.new(tw, bitmap.font.size + 4)
  939.     bitmap.font = font
  940.     bitmap.draw_text(0, 0, bitmap.width, bitmap.height, text, 1)
  941.    
  942.     @cache[key] = bitmap
  943.     return @cache[key]
  944.   end
  945. end
  946. #==============================================================================
  947. # ■ Game_Interpreter
  948. #------------------------------------------------------------------------------
  949. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  950. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  951. #==============================================================================

  952. class Game_Interpreter
  953.   #--------------------------------------------------------------------------
  954.   # ○ 注釈
  955.   #--------------------------------------------------------------------------
  956.   alias a1_common_command_108 command_108
  957.   def command_108
  958.     a1_common_command_108
  959.     proc_comment(@comments)
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ○ 注釈の処理
  963.   #--------------------------------------------------------------------------
  964.   def proc_comment(comments)
  965.     param = ""
  966.     comments.each {|comment| param += comment }
  967.     params = param.sub(/^(\S+)/, "")
  968.     command = $1
  969.     comment_parameters = $a1_common.split_array(params) if params
  970.     proc_comment_command(command, comment_parameters)
  971.   end
  972.   #--------------------------------------------------------------------------
  973.   # ○ 注釈の実行
  974.   #--------------------------------------------------------------------------
  975.   def proc_comment_command(command, params)
  976.     cmd_108 = $a1_common.cmd_108[command]
  977.     method(cmd_108).call(params) if cmd_108 != nil
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # ○ 前のイベントコマンドを取得
  981.   #--------------------------------------------------------------------------
  982.   def prev_event
  983.     @list[@index - 1]
  984.   end
  985. end
  986. #==============================================================================
  987. # ■ Game_Map
  988. #------------------------------------------------------------------------------
  989. #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  990. # このクラスのインスタンスは $game_map で参照されます。
  991. #==============================================================================

  992. class Game_Map
  993.   #--------------------------------------------------------------------------
  994.   # ○ 全マップチップを調べる
  995.   #--------------------------------------------------------------------------
  996.   def map_chip_search
  997.     tileset.init_ex_flags
  998.     ([email protected]).each {|x| map_chip_search_y(x) }
  999.   end
  1000.   #--------------------------------------------------------------------------
  1001.   # ○ x座標にあるy座標のマップチップを調べる
  1002.   #--------------------------------------------------------------------------
  1003.   def map_chip_search_y(x)
  1004.     ([email protected]).each {|y| map_pos_proc(x, y); map_chip_search_z(x, y) }
  1005.   end
  1006.   #--------------------------------------------------------------------------
  1007.   # ○ x,y座標にあるz座標のマップチップを調べる
  1008.   #--------------------------------------------------------------------------
  1009.   def map_chip_search_z(x, y)
  1010.     ([email protected]).each {|z| map_chip_proc(x, y, z) }
  1011.     tile_events_xy(x, y).collect {|ev| tile_event_proc(ev.tile_id) }
  1012.   end
  1013.   #--------------------------------------------------------------------------
  1014.   # ○ 座標に対して処理を行う
  1015.   #--------------------------------------------------------------------------
  1016.   def map_pos_proc(x, y)
  1017.   end
  1018.   #--------------------------------------------------------------------------
  1019.   # ○ マップチップに対して処理を行う
  1020.   #--------------------------------------------------------------------------
  1021.   def map_chip_proc(x, y, z)
  1022.   end
  1023.   #--------------------------------------------------------------------------
  1024.   # ○ タイルのイベントに対して処理を行う
  1025.   #--------------------------------------------------------------------------
  1026.   def tile_event_proc(tile_id)
  1027.   end
  1028. end
  1029. #==============================================================================
  1030. # ■ Window_Base
  1031. #------------------------------------------------------------------------------
  1032. #  ゲーム中の全てのウィンドウのスーパークラスです。
  1033. #==============================================================================

  1034. class Window_Base < Window
  1035.   #--------------------------------------------------------------------------
  1036.   # ○ 入力を受け付けるか?
  1037.   #--------------------------------------------------------------------------
  1038.   def can_input?
  1039.     @can_input
  1040.   end
  1041.   #--------------------------------------------------------------------------
  1042.   # ○ 入力受け付け設定
  1043.   #--------------------------------------------------------------------------
  1044.   def can_input=(flag)
  1045.     @can_input = flag
  1046.   end
  1047. end
  1048. #==============================================================================
  1049. # ■ Bitmap
  1050. #==============================================================================

  1051. class Bitmap
  1052.   #--------------------------------------------------------------------------
  1053.   # ○ 文字縁取り描画
  1054.   #--------------------------------------------------------------------------
  1055.   def draw_text_f(x, y, width, height, str, align = 0, color = Color.new(64,32,128))
  1056.     shadow = self.font.shadow
  1057.     b_color = self.font.color.dup
  1058.     font.shadow = false
  1059.     font.color = color
  1060.     draw_text(x + 1, y, width, height, str, align)
  1061.     draw_text(x - 1, y, width, height, str, align)
  1062.     draw_text(x, y + 1, width, height, str, align)
  1063.     draw_text(x, y - 1, width, height, str, align)
  1064.     font.color = b_color
  1065.     draw_text(x, y, width, height, str, align)
  1066.     font.shadow = shadow
  1067.   end
  1068.   #--------------------------------------------------------------------------
  1069.   # ○ 文字縁取り描画の矩形を取得
  1070.   #--------------------------------------------------------------------------
  1071.   def draw_text_f_rect(r, str, align = 0, color = Color.new(64,32,128))
  1072.     draw_text_f(r.x, r.y, r.width, r.height, str, align = 0, color)
  1073.   end
  1074. end

复制代码
A1バトル共通スクリプト

  1. # ===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    A1バトル共通スクリプト(RGSS3)
  4. #
  5. # バージョン   : 1.23 (2012/01/27)
  6. # 作者         : A1
  7. # URL     : http://a1tktk.web.fc2.com/
  8. # ---------------------------------------------------------------------------
  9. # 更新履歴   :2012/01/18 Ver1.00 リリース
  10. #                2012/01/21 Ver1.10 装備拡張対応
  11. #                2012/01/21 Ver1.10 メンバー加入時の不具合を修正
  12. #                2012/01/21 Ver1.10 メンバー加入時に既にパーティに居るさい何もしないように修正
  13. #                2012/01/24 Ver1.20 スキル拡張対応
  14. #                2012/01/24 Ver1.21 Window_BattleActorの不具合を修正
  15. #                2012/01/26 Ver1.22 Window_BattleSkillの不具合を修正
  16. #                2012/01/27 Ver1.23 戦闘行動がない際の不具合を修正
  17. # ---------------------------------------------------------------------------
  18. # 設置場所      
  19. #  A1共通スクリプトより下
  20. #    一部再定義メソッドがあるため、なるべく上の方
  21. #
  22. # 必要スクリプト
  23. #    A1共通スクリプトVer4.30以上
  24. #==============================================================================
  25. $imported = {} if $imported == nil
  26. if $imported["A1_Common_Script"]
  27. $imported["A1_BattleCommonScript"] = true
  28. old_common_script("A1バトル共通スクリプト", "4.30") if common_version < 4.30
  29. #==============================================================================
  30. # ■ Window_Base
  31. #------------------------------------------------------------------------------
  32. #  ゲーム中の全てのウィンドウのスーパークラスです。
  33. #==============================================================================

  34. class Window_Base < Window
  35.   #--------------------------------------------------------------------------
  36.   # ○ メソッドの定義
  37.   #--------------------------------------------------------------------------
  38.   def define_method(method, symbol)
  39.     @method ||= {}
  40.     @method[symbol] = method
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ○ メソッドのコール
  44.   #--------------------------------------------------------------------------
  45.   def call_method(symbol, *args)
  46.     @method ||= {}
  47.     @method[symbol].call(*args) if @method[symbol]
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ○ 顔グラフィックの描画(解放なし)
  51.   #--------------------------------------------------------------------------
  52.   def draw_face_no_dispose(face_name, face_index, x, y, enabled = true)
  53.     bitmap = Cache.face(face_name)
  54.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
  55.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ○ 背景の描画
  59.   #--------------------------------------------------------------------------
  60.   def draw_background(rect)
  61.     temp_rect = rect.clone
  62.     temp_rect.width /= 2
  63.     contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
  64.     temp_rect.x = temp_rect.width
  65.     contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ○ 背景色 1 の取得
  69.   #--------------------------------------------------------------------------
  70.   def back_color1
  71.     Color.new(0, 0, 0, 192)
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ○ 背景色 2 の取得
  75.   #--------------------------------------------------------------------------
  76.   def back_color2
  77.     Color.new(0, 0, 0, 0)
  78.   end
  79. end
  80. #==============================================================================
  81. # ■ Window_Help
  82. #------------------------------------------------------------------------------
  83. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  84. #==============================================================================

  85. class Window_Help < Window_Base
  86.   #--------------------------------------------------------------------------
  87.   # ○ センターにテキストを描画
  88.   #--------------------------------------------------------------------------
  89.   def draw_center_text(text)
  90.     contents.clear
  91.     draw_text(0, 0, contents.width, line_height, text, 1)
  92.   end
  93. end
  94. #==============================================================================
  95. # ■ Window_BattleActor
  96. #------------------------------------------------------------------------------
  97. #  バトル画面で、行動対象のアクターを選択するウィンドウです。
  98. #==============================================================================

  99. class Window_BattleActor < Window_BattleStatus
  100.   #--------------------------------------------------------------------------
  101.   # ★ ウィンドウの表示
  102.   #--------------------------------------------------------------------------
  103.   def show
  104.     setup_remain if @info_viewport
  105.     self.visible = true
  106.     refresh
  107.     open
  108.     self
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ★ ウィンドウの非表示
  112.   #--------------------------------------------------------------------------
  113.   def hide
  114.     close
  115.     @info_viewport.rect.width = Graphics.width if @info_viewport
  116.     call_method(:select_actor_end)
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ○ フレーム更新
  120.   #--------------------------------------------------------------------------
  121.   def update
  122.     return update_basic unless self.visible
  123.     super
  124.     self.visible = false if self.openness == 0
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ○ フレーム更新(基本)
  128.   #--------------------------------------------------------------------------
  129.   def update_basic
  130.     process_cursor_move
  131.     process_handling
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ○ 項目の選択
  135.   #--------------------------------------------------------------------------
  136.   def select(index)
  137.     super
  138.     call_method(:select_actor, index)
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ○ ウィンドウの調整
  142.   #--------------------------------------------------------------------------
  143.   def setup_remain
  144.     width_remain = Graphics.width - width
  145.     self.x = width_remain
  146.     @info_viewport.rect.width = width_remain
  147.     select(0)
  148.   end
  149. end
  150. #==============================================================================
  151. # ■ Window_BattleEnemy
  152. #------------------------------------------------------------------------------
  153. #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。
  154. #==============================================================================

  155. class Window_BattleEnemy < Window_Selectable
  156.   #--------------------------------------------------------------------------
  157.   # ★ ウィンドウの表示
  158.   #--------------------------------------------------------------------------
  159.   def show
  160.     setup_remain if @info_viewport
  161.     self.visible = true
  162.     open
  163.     self
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ★ ウィンドウの非表示
  167.   #--------------------------------------------------------------------------
  168.   def hide
  169.     close
  170.     @info_viewport.rect.width = Graphics.width if @info_viewport
  171.     call_method(:select_enemy_end)
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ○ フレーム更新
  175.   #--------------------------------------------------------------------------
  176.   def update
  177.     return update_basic unless self.visible
  178.     super
  179.     self.visible = false if self.openness == 0
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ○ フレーム更新(基本)
  183.   #--------------------------------------------------------------------------
  184.   def update_basic
  185.     process_cursor_move
  186.     process_handling
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ○ 項目の選択
  190.   #--------------------------------------------------------------------------
  191.   def select(index)
  192.     super
  193.     call_method(:select_enemy, index)
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ○ ウィンドウの調整
  197.   #--------------------------------------------------------------------------
  198.   def setup_remain
  199.     width_remain = Graphics.width - width
  200.     self.x = width_remain
  201.     @info_viewport.rect.width = width_remain
  202.     select(0)
  203.   end
  204. end
  205. #==============================================================================
  206. # ■ Window_BattleSkill
  207. #------------------------------------------------------------------------------
  208. #  バトル画面で、使用するスキルを選択するウィンドウです。
  209. #==============================================================================

  210. class Window_BattleSkill < Window_SkillList
  211.   #--------------------------------------------------------------------------
  212.   # ☆ オブジェクト初期化
  213.   #     info_viewport : 情報表示用ビューポート
  214.   #--------------------------------------------------------------------------
  215.   alias a1_psw_wbs_initialize initialize
  216.   def initialize(help_window, info_viewport)
  217.     a1_psw_wbs_initialize(help_window, info_viewport)
  218.     self.openness = 0
  219.     self.visible  = true
  220.     @help_window.openness = 0
  221.     @help_window.visible = true
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ○ 高さを変える
  225.   #--------------------------------------------------------------------------
  226.   def resize_height(base_y)
  227.     self.height = base_y - self.y
  228.     create_contents
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ★ ウィンドウの表示
  232.   #--------------------------------------------------------------------------
  233.   def show
  234.     self.visible = true
  235.     @help_window.visible = true
  236.     select_last
  237.     open
  238.     @help_window.open
  239.     self
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ★ ウィンドウの非表示
  243.   #--------------------------------------------------------------------------
  244.   def hide
  245.     close
  246.     @help_window.close
  247.     @info_viewport.rect.width = Graphics.width if @info_viewport
  248.     call_method(:skill_item_window_hide)
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ○ オープン
  252.   #--------------------------------------------------------------------------
  253.   def open
  254.     self.visible = true
  255.     call_method(:skill_item_window_show)
  256.     super
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ○ アクティブ化
  260.   #--------------------------------------------------------------------------
  261.   def activate
  262.     open
  263.     @help_window.open
  264.     super
  265.   end
  266. end
  267. #==============================================================================
  268. # ■ Window_BattleItem
  269. #------------------------------------------------------------------------------
  270. #  バトル画面で、使用するアイテムを選択するウィンドウです。
  271. #==============================================================================

  272. class Window_BattleItem < Window_ItemList
  273.   #--------------------------------------------------------------------------
  274.   # ☆ オブジェクト初期化
  275.   #     info_viewport : 情報表示用ビューポート
  276.   #--------------------------------------------------------------------------
  277.   alias a1_battle_common_wbi_initialize initialize
  278.   def initialize(help_window, info_viewport)
  279.     a1_battle_common_wbi_initialize(help_window, info_viewport)
  280.     self.openness = 0
  281.     self.visible  = true
  282.     @help_window.openness = 0
  283.     @help_window.visible = true
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ○ 高さを変える
  287.   #--------------------------------------------------------------------------
  288.   def resize_height(base_y)
  289.     self.height = base_y - self.y
  290.     create_contents
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ★ ウィンドウの表示
  294.   #--------------------------------------------------------------------------
  295.   def show
  296.     self.visible = true
  297.     @help_window.visible = true
  298.     select_last
  299.     open
  300.     @help_window.open
  301.     self
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ★ ウィンドウの非表示
  305.   #--------------------------------------------------------------------------
  306.   def hide
  307.     close
  308.     @help_window.close
  309.     call_method(:skill_item_window_hide)
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ○ オープン
  313.   #--------------------------------------------------------------------------
  314.   def open
  315.     self.visible = true
  316.     call_method(:skill_item_window_show)
  317.     super
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ○ アクティブ化
  321.   #--------------------------------------------------------------------------
  322.   def activate
  323.     open
  324.     @help_window.open
  325.     super
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # ○ フレーム更新
  329.   #--------------------------------------------------------------------------
  330.   def update
  331.     return unless self.visible
  332.     super
  333.     self.visible = false if self.openness == 0
  334.   end
  335. end
  336. #==============================================================================
  337. # ■ Window_ActorCommand
  338. #------------------------------------------------------------------------------
  339. #  バトル画面で、アクターの行動を選択するウィンドウです。
  340. #==============================================================================

  341. class Window_ActorCommand < Window_Command
  342.   #--------------------------------------------------------------------------
  343.   # ☆ セットアップ
  344.   #--------------------------------------------------------------------------
  345.   alias a1_battle_common_wac_setup setup
  346.   def setup(actor)
  347.     call_method(:actor_command_setup, actor)
  348.     a1_battle_common_wac_setup(actor)
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ○ ウィンドウのアクティブ化
  352.   #--------------------------------------------------------------------------
  353.   def activate
  354.     open
  355.     super
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ○ オープン
  359.   #--------------------------------------------------------------------------
  360.   def open
  361.     call_method(:actor_command_open)
  362.     super
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # ○ クローズ
  366.   #--------------------------------------------------------------------------
  367.   def close
  368.     call_method(:actor_command_close)
  369.     super
  370.   end
  371. end
  372. #==============================================================================
  373. # ■ Window_BattleStatus
  374. #------------------------------------------------------------------------------
  375. #  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。
  376. #==============================================================================

  377. class Window_BattleStatus < Window_Selectable
  378.   #--------------------------------------------------------------------------
  379.   # ☆ リフレッシュ
  380.   #--------------------------------------------------------------------------
  381.   alias a1_battle_common_wbs_refresh refresh
  382.   def refresh
  383.     call_method(:refresh_statsu_window)
  384.     return unless self.visible
  385.     a1_battle_common_wbs_refresh
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # ○ ウィンドウを開く
  389.   #--------------------------------------------------------------------------
  390.   def open
  391.     super
  392.     call_method(:open_status_window)
  393.   end
  394.   #--------------------------------------------------------------------------
  395.   # ○ ウィンドウを閉じる
  396.   #--------------------------------------------------------------------------
  397.   def close
  398.     super
  399.     call_method(:close_status_window)
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # ○ 項目の選択
  403.   #--------------------------------------------------------------------------
  404.   def select(index)
  405.     super
  406.     call_method(:select_status_window, index)
  407.   end
  408.   #--------------------------------------------------------------------------
  409.   # ○ フレーム更新
  410.   #--------------------------------------------------------------------------
  411.   def update
  412.     call_method(:update_status_window)
  413.     return unless self.visible
  414.     super
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ○ 解放
  418.   #--------------------------------------------------------------------------
  419.   def dispose
  420.     super
  421.     call_method(:dispose_status_window)
  422.   end
  423. end
  424. #==============================================================================
  425. # ■ Window_PersonalStatus
  426. #==============================================================================

  427. class Window_PersonalStatus < Window_Base
  428.   #--------------------------------------------------------------------------
  429.   # ○ オブジェクト初期化
  430.   #--------------------------------------------------------------------------
  431.   def initialize(x, y, opacity = 0)
  432.     super(x, y, Graphics.width / 2, 120)
  433.     self.opacity  = opacity
  434.     self.openness = 0
  435.     @actor = nil
  436.   end
  437.   #--------------------------------------------------------------------------
  438.   # ○ アクターの設定
  439.   #--------------------------------------------------------------------------
  440.   def actor=(actor)
  441.     @actor = actor
  442.     refresh
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ○ リフレッシュ
  446.   #--------------------------------------------------------------------------
  447.   def refresh
  448.     contents.clear
  449.     draw_face(@actor.face_name, @actor.face_index, 0, 0)
  450.     draw_text(116, line_height * 0, contents.width, line_height, @actor.name)
  451.     draw_actor_level(@actor, 116, 0 + line_height * 1)
  452.     draw_actor_icons(@actor, 180, 0 + line_height * 1)
  453.     draw_actor_hp(@actor, 116, 0 + line_height * 2, 128)
  454.     draw_actor_mp(@actor, 116, 0 + line_height * 3, 60)
  455.     draw_actor_tp(@actor, 184, 0 + line_height * 3, 60) if $data_system.opt_display_tp
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # ○ フレーム更新
  459.   #--------------------------------------------------------------------------
  460.   def update
  461.     return unless self.visible
  462.     super
  463.     self.visible = false if self.openness == 0
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ○ オープン
  467.   #--------------------------------------------------------------------------
  468.   def open
  469.     self.visible = true
  470.     super
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ○ 顔グラフィックの描画
  474.   #--------------------------------------------------------------------------
  475.   def draw_face(face_name, face_index, x, y, enabled = true)
  476.     draw_face_no_dispose(face_name, face_index, x, y, enabled)
  477.   end
  478. end
  479. #==============================================================================
  480. # ■ RPG::Enemy
  481. #==============================================================================

  482. class RPG::Enemy < RPG::BaseItem
  483.   #--------------------------------------------------------------------------
  484.   # ○ 初期装備
  485.   #--------------------------------------------------------------------------
  486.   def equips
  487.     @equips ||= [0,0,0,0,0]
  488.     @equips[0] ||= $a1_common.note_data_one(self.note, "エネミー武器", 0)
  489.     return @equips
  490.   end
  491. end
  492. #==============================================================================
  493. # ■ Game_Enemy
  494. #------------------------------------------------------------------------------
  495. #  敵キャラを扱うクラスです。このクラスは Game_Troop クラス($game_troop)の
  496. # 内部で使用されます。
  497. #==============================================================================

  498. class Game_Enemy < Game_Battler
  499.   #--------------------------------------------------------------------------
  500.   # ☆ オブジェクト初期化
  501.   #--------------------------------------------------------------------------
  502.   alias a1_battle_common_ge_initialize initialize
  503.   def initialize(index, enemy_id)
  504.     @equips = []
  505.     a1_battle_common_ge_initialize(index, enemy_id)
  506.     init_equips(enemy.equips)
  507.   end
  508. end
  509. #==============================================================================
  510. # ■ Game_Actor
  511. #------------------------------------------------------------------------------
  512. #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
  513. # の内部で使用され、Game_Party クラス($game_party)からも参照されます。
  514. #==============================================================================

  515. class Game_Actor < Game_Battler
  516.   #--------------------------------------------------------------------------
  517.   # ★ 装備品の初期化
  518.   #     equips : 初期装備の配列
  519.   #--------------------------------------------------------------------------
  520.   def init_equips(equips)
  521.     super
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ★ 装備タイプからスロット ID に変換(空きを優先)
  525.   #--------------------------------------------------------------------------
  526.   def empty_slot(etype_id)
  527.     super
  528.   end
  529.   #--------------------------------------------------------------------------
  530.   # ★ 装備タイプからスロット ID のリストに変換
  531.   #--------------------------------------------------------------------------
  532.   def slot_list(etype_id)
  533.     super
  534.   end
  535.   #--------------------------------------------------------------------------
  536.   # ★ エディタで設定されたインデックスを装備タイプ ID に変換
  537.   #--------------------------------------------------------------------------
  538.   def index_to_etype_id(index)
  539.     super
  540.   end
  541.   #--------------------------------------------------------------------------
  542.   # ★ 装備スロットの配列を取得
  543.   #--------------------------------------------------------------------------
  544.   def equip_slots
  545.     super
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ★ 装備品オブジェクトの配列取得
  549.   #--------------------------------------------------------------------------
  550.   def equips
  551.     super
  552.   end
  553.   #--------------------------------------------------------------------------
  554.   # ★ 武器オブジェクトの配列取得
  555.   #--------------------------------------------------------------------------
  556.   def weapons
  557.     super
  558.   end
  559.   #--------------------------------------------------------------------------
  560.   # ★ 通常能力値の加算値取得
  561.   #--------------------------------------------------------------------------
  562.   def param_plus(param_id)
  563.     super
  564.   end
  565.   #--------------------------------------------------------------------------
  566.   # ☆ 通常攻撃 アニメーション ID の取得
  567.   #--------------------------------------------------------------------------
  568.   alias a1_battle_common_ga_atk_animation_id1 atk_animation_id1
  569.   def atk_animation_id1
  570.     return a1_battle_common_ga_atk_animation_id1 if !@current_weapon || @current_weapon.is_a?(Array)
  571.     @current_weapon.animation_id
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ☆ 通常攻撃 アニメーション ID の取得(二刀流:武器2)
  575.   #--------------------------------------------------------------------------
  576.   alias a1_battle_common_ga_atk_animation_id2 atk_animation_id2
  577.   def atk_animation_id2
  578.     return a1_battle_common_ga_atk_animation_id2 if !@current_weapon || @current_weapon.is_a?(Array)
  579.     @current_weapon.animation_id
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   # ○ 装備タイプ名を取得
  583.   #--------------------------------------------------------------------------
  584.   def e_type_name(item)
  585.     return $data_system.weapon_types[item.wtype_id] if item.is_a?(RPG::Weapon)
  586.     return $data_system.armor_types[item.atype_id] if item.is_a?(RPG::Armor)
  587.   end
  588. end
  589. #==============================================================================
  590. # ■ Game_BattlerBase
  591. #------------------------------------------------------------------------------
  592. #  バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ
  593. # のクラスは Game_Battler クラスのスーパークラスとして使用されます。
  594. #==============================================================================

  595. class Game_BattlerBase
  596.   #--------------------------------------------------------------------------
  597.   # ○ 二刀流?
  598.   #--------------------------------------------------------------------------
  599.   def two_sword_style?
  600.     weapons[0] && weapons[1]
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ○ バトラーオブジェクト取得
  604.   #--------------------------------------------------------------------------
  605.   def battler
  606.     return actor if self.actor?
  607.     return enemy
  608.   end
  609. end
  610. #==============================================================================
  611. # ■ Game_Battler
  612. #------------------------------------------------------------------------------
  613. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
  614. # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
  615. #==============================================================================

  616. class Game_Battler < Game_BattlerBase
  617.   #--------------------------------------------------------------------------
  618.   # ○ 公開インスタンス変数
  619.   #--------------------------------------------------------------------------
  620.   attr_accessor :current_weapon
  621.   attr_accessor :current_main
  622.   #--------------------------------------------------------------------------
  623.   # ○ 装備品の初期化
  624.   #     equips : 初期装備の配列
  625.   #--------------------------------------------------------------------------
  626.   def init_equips(equips)
  627.     @equips = Array.new(equip_slots.size) { Game_BaseItem.new }
  628.     equips.each_with_index do |item_id, i|
  629.       etype_id = index_to_etype_id(i)
  630.       slot_id = empty_slot(etype_id)
  631.       @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
  632.     end
  633.     refresh
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ○ 装備タイプからスロット ID に変換(空きを優先)
  637.   #--------------------------------------------------------------------------
  638.   def empty_slot(etype_id)
  639.     list = slot_list(etype_id)
  640.     list.find {|i| @equips[i].is_nil? } || list[0]
  641.   end
  642.   #--------------------------------------------------------------------------
  643.   # ○ 装備タイプからスロット ID のリストに変換
  644.   #--------------------------------------------------------------------------
  645.   def slot_list(etype_id)
  646.     result = []
  647.     equip_slots.each_with_index {|e, i| result.push(i) if e == etype_id }
  648.     result
  649.   end
  650.   #--------------------------------------------------------------------------
  651.   # ○ エディタで設定されたインデックスを装備タイプ ID に変換
  652.   #--------------------------------------------------------------------------
  653.   def index_to_etype_id(index)
  654.     index == 1 && dual_wield? ? 0 : index
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ○ 装備スロットの配列を取得
  658.   #--------------------------------------------------------------------------
  659.   def equip_slots
  660.     return [0,0,2,3,4] if dual_wield?       # 二刀流
  661.     return [0,1,2,3,4]                      # 通常
  662.   end
  663.   #--------------------------------------------------------------------------
  664.   # ○ 装備品オブジェクトの配列取得
  665.   #--------------------------------------------------------------------------
  666.   def equips
  667.     @equips.collect {|item| item.object }
  668.   end
  669.   #--------------------------------------------------------------------------
  670.   # ○ 武器オブジェクトの配列取得
  671.   #--------------------------------------------------------------------------
  672.   def weapons
  673.     @equips.select {|item| item.is_weapon? }.collect {|item| item.object }
  674.   end
  675.   #--------------------------------------------------------------------------
  676.   # ○ 通常能力値の加算値取得
  677.   #--------------------------------------------------------------------------
  678.   def param_plus(param_id)
  679.     equips.compact.inject(super) {|r, item| r += item.params[param_id] + ex_item_params(item, param_id) }
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ○ アイテムにかける追加要素
  683.   #--------------------------------------------------------------------------
  684.   def ex_item_params(item, param_id)
  685.     return 0
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # ○ スキルを取得
  689.   #--------------------------------------------------------------------------
  690.   def skill(skill_id)
  691.     $data_skills[skill_id]
  692.   end
  693. end
  694. #==============================================================================
  695. # ■ Game_Party
  696. #------------------------------------------------------------------------------
  697. #  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
  698. # スのインスタンスは $game_party で参照されます。
  699. #==============================================================================

  700. class Game_Party < Game_Unit
  701.   #--------------------------------------------------------------------------
  702.   # ☆ アクターを加える
  703.   #--------------------------------------------------------------------------
  704.   alias a1_battle_common_gp_add_actor add_actor
  705.   def add_actor(actor_id)
  706.     return a1_battle_common_gp_add_actor(actor_id) unless in_battle
  707.     return if @actors.include?(actor_id)
  708.     prev_add_actor(battle_members)
  709.     insert_actor(actor_id)
  710.     post_add_actor($game_actors[actor_id])
  711.   end
  712.   #--------------------------------------------------------------------------
  713.   # ○ アクターを加える
  714.   #--------------------------------------------------------------------------
  715.   def insert_actor(actor_id)
  716.     @new_index = @remove_member_index ? @remove_member_index[0] : @actors.size
  717.     @actors.insert(@new_index, actor_id) unless @actors.include?(actor_id)
  718.     $game_player.refresh
  719.     $game_map.need_refresh = true
  720.     return unless @remove_member_index
  721.     @remove_member_index.delete_at(0)
  722.     @remove_member_index = nil if @remove_member_index.empty?
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # ○ アクターを加えたIndexを取得
  726.   #--------------------------------------------------------------------------
  727.   def new_index
  728.     @new_index
  729.   end
  730.   #--------------------------------------------------------------------------
  731.   # ○ アクターを加える前処理
  732.   #--------------------------------------------------------------------------
  733.   def prev_add_actor(members)
  734.     BattleManager.call_method(:prev_add_battler, members)
  735.   end
  736.   #--------------------------------------------------------------------------
  737.   # ○ アクターを加えた後処理
  738.   #--------------------------------------------------------------------------
  739.   def post_add_actor(member)
  740.     BattleManager.call_method(:post_add_battler, member)
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ☆ アクターを外す
  744.   #--------------------------------------------------------------------------
  745.   alias a1_battle_common_gp_remove_actor remove_actor
  746.   def remove_actor(actor_id)
  747.     prev_remove_actor($game_actors[actor_id]) if in_battle
  748.     a1_battle_common_gp_remove_actor(actor_id)
  749.     post_remove_actor if in_battle
  750.   end
  751.   #--------------------------------------------------------------------------
  752.   # ○ アクターを外す前処理
  753.   #--------------------------------------------------------------------------
  754.   def prev_remove_actor(member)
  755.     @remove_member_index ||= []
  756.     @remove_member_index.push(member.index)
  757.     BattleManager.call_method(:prev_remove_battler, member)
  758.   end
  759.   #--------------------------------------------------------------------------
  760.   # ○ アクターを外した後処理
  761.   #--------------------------------------------------------------------------
  762.   def post_remove_actor
  763.     BattleManager.call_method(:post_remove_battler)
  764.   end
  765. end
  766. #==============================================================================
  767. # ■ BattleManager
  768. #------------------------------------------------------------------------------
  769. #  戦闘の進行を管理するモジュールです。
  770. #==============================================================================

  771. module BattleManager
  772.   #--------------------------------------------------------------------------
  773.   # ○ エイリアス用特異メソッド
  774.   #--------------------------------------------------------------------------
  775.   class << self
  776.     alias :a1_battle_common_bm_turn_end :turn_end
  777.     alias :a1_battle_common_bm_turn_start :turn_start
  778.     alias :a1_battle_common_bm_battle_end :battle_end
  779.   end
  780.   #--------------------------------------------------------------------------
  781.   # ☆ ターン開始
  782.   #--------------------------------------------------------------------------
  783.   def self.turn_start
  784.     @turn_end_wait = 0
  785.     a1_battle_common_bm_turn_start
  786.   end
  787.   #--------------------------------------------------------------------------
  788.   # ☆ ターン終了
  789.   #--------------------------------------------------------------------------
  790.   def self.turn_end
  791.     call_method(:wait, @turn_end_wait) if @turn_end_wait > 0
  792.     @turn_end_wait = 0
  793.     a1_battle_common_bm_turn_end
  794.   end
  795.   #--------------------------------------------------------------------------
  796.   # ○ メソッドの設定
  797.   #--------------------------------------------------------------------------
  798.   def self.define_method(method, symbol)
  799.     @method ||= {}
  800.     @method[symbol] = method
  801.   end
  802.   #--------------------------------------------------------------------------
  803.   # ○ メソッドのコール
  804.   #--------------------------------------------------------------------------
  805.   def self.call_method(symbol, *args)
  806.     @method[symbol].call(*args) if @method[symbol]
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ○ ターン終了後ウェイト設定
  810.   #--------------------------------------------------------------------------
  811.   def self.turn_end_wait=(flame)
  812.     @turn_end_wait = flame if @turn_end_wait < flame || flame == 0
  813.   end
  814.   #--------------------------------------------------------------------------
  815.   # ☆ 戦闘終了
  816.   #     result : 結果(0:勝利 1:逃走 2:敗北)
  817.   #--------------------------------------------------------------------------
  818.   def self.battle_end(result)
  819.     call_method(:battle_end, result)
  820.     a1_battle_common_bm_battle_end(result)
  821.   end
  822. end
  823. #==============================================================================
  824. # ■ Game_Action
  825. #------------------------------------------------------------------------------
  826. #  戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され
  827. # ます。
  828. #==============================================================================

  829. class Game_Action
  830.   #--------------------------------------------------------------------------
  831.   # ☆ ターゲットの配列作成
  832.   #--------------------------------------------------------------------------
  833.   alias a1_battle_common_gac_make_targets make_targets
  834.   def make_targets
  835.     @targets ||= pre_make_targets
  836.     return @targets
  837.   end
  838.   #--------------------------------------------------------------------------
  839.   # ○ ターゲットの配列先行作成
  840.   #--------------------------------------------------------------------------
  841.   def pre_make_targets
  842.     @targets = a1_battle_common_gac_make_targets
  843.   end
  844.   #--------------------------------------------------------------------------
  845.   # ○ ターゲットの配列を取得
  846.   #--------------------------------------------------------------------------
  847.   def targets
  848.     @targets.compact
  849.   end
  850.   #--------------------------------------------------------------------------
  851.   # ○ ターゲットの配列をクリア
  852.   #--------------------------------------------------------------------------
  853.   def clear_targets
  854.     @targets = nil
  855.   end
  856. end
  857. #==============================================================================
  858. # ■ Scene_Battle
  859. #------------------------------------------------------------------------------
  860. #  バトル画面の処理を行うクラスです。
  861. #==============================================================================

  862. class Scene_Battle < Scene_Base
  863.   #--------------------------------------------------------------------------
  864.   # ☆ 開始処理
  865.   #--------------------------------------------------------------------------
  866.   alias a1_battle_common_sb_start start
  867.   def start
  868.     a1_battle_common_sb_start
  869.     define_battle_manager_method
  870.   end
  871.   #--------------------------------------------------------------------------
  872.   # ○ バトルマネージャメソッドの定義
  873.   #--------------------------------------------------------------------------
  874.   def define_battle_manager_method
  875.     BattleManager.define_method(method(:wait), :wait)
  876.     BattleManager.define_method(method(:post_add_battler),       :post_add_battler)
  877.     BattleManager.define_method(method(:post_remove_battler),    :post_remove_battler)
  878.     BattleManager.define_method(method(:prev_remove_battler),    :prev_remove_battler)
  879.     BattleManager.define_method(method(:prev_add_battler),       :prev_add_battler)
  880.     BattleManager.define_method(method(:process_victory),        :process_victory)
  881.     BattleManager.define_method(method(:battle_end),             :battle_end)
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # ☆ ステータスウィンドウの作成
  885.   #--------------------------------------------------------------------------
  886.   alias a1_battle_common_sb_create_status_window create_status_window
  887.   def create_status_window
  888.     a1_battle_common_sb_create_status_window
  889.     post_create_status_window
  890.     define_status_window_method
  891.   end
  892.   #--------------------------------------------------------------------------
  893.   # ○ ステータスウィンドウ作成の後処理
  894.   #--------------------------------------------------------------------------
  895.   def post_create_status_window
  896.   end
  897.   #--------------------------------------------------------------------------
  898.   # ○ ステータスウィンドウメソッドの定義
  899.   #--------------------------------------------------------------------------
  900.   def define_status_window_method
  901.     @status_window.define_method(method(:refresh_statsu_window), :refresh_statsu_window)
  902.     @status_window.define_method(method(:close_status_window),   :close_status_window)
  903.     @status_window.define_method(method(:open_status_window),    :open_status_window)
  904.     @status_window.define_method(method(:select_status_window),  :select_status_window)
  905.     @status_window.define_method(method(:update_status_window),  :update_status_window)
  906.     @status_window.define_method(method(:dispose_status_window), :dispose_status_window)
  907.   end
  908.   #--------------------------------------------------------------------------
  909.   # ○ ステータスウィンドウがリフレッシュされた時の処理
  910.   #--------------------------------------------------------------------------
  911.   def refresh_statsu_window
  912.   end
  913.   #--------------------------------------------------------------------------
  914.   # ○ ステータスウィンドウがクローズされた時の処理
  915.   #--------------------------------------------------------------------------
  916.   def close_status_window
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # ○ ステータスウィンドウがオープンされた時の処理
  920.   #--------------------------------------------------------------------------
  921.   def open_status_window
  922.   end
  923.   #--------------------------------------------------------------------------
  924.   # ○ ステータスウィンドウがセレクトされた時の処理
  925.   #--------------------------------------------------------------------------
  926.   def select_status_window(index)
  927.   end
  928.   #--------------------------------------------------------------------------
  929.   # ○ ステータスウィンドウが更新された時の処理
  930.   #--------------------------------------------------------------------------
  931.   def update_status_window
  932.   end
  933.   #--------------------------------------------------------------------------
  934.   # ○ ステータスウィンドウが解放された時の処理
  935.   #--------------------------------------------------------------------------
  936.   def dispose_status_window
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # ☆ 情報表示ビューポートの作成
  940.   #--------------------------------------------------------------------------
  941.   alias a1_battle_common_sb_create_info_viewport create_info_viewport
  942.   def create_info_viewport
  943.     a1_battle_common_sb_create_info_viewport
  944.     post_create_info_viewport
  945.   end
  946.   #--------------------------------------------------------------------------
  947.   # ○ 情報表示ビューポート作成の後処理
  948.   #--------------------------------------------------------------------------
  949.   def post_create_info_viewport
  950.   end
  951.   #--------------------------------------------------------------------------
  952.   # ☆ スキルウィンドウの作成
  953.   #--------------------------------------------------------------------------
  954.   alias a1_battle_common_sb_create_skill_window create_skill_window
  955.   def create_skill_window
  956.     a1_battle_common_sb_create_skill_window
  957.     post_create_skill_window
  958.     define_skill_window_method
  959.   end
  960.   #--------------------------------------------------------------------------
  961.   # ○ スキルウィンドウ作成の後処理
  962.   #--------------------------------------------------------------------------
  963.   def post_create_skill_window
  964.   end
  965.   #--------------------------------------------------------------------------
  966.   # ○ スキルウィンドウメソッドの定義
  967.   #--------------------------------------------------------------------------
  968.   def define_skill_window_method
  969.     @skill_window.define_method(method(:skill_item_window_show), :skill_item_window_show)
  970.     @skill_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)
  971.   end
  972.   #--------------------------------------------------------------------------
  973.   # ☆ アイテムウィンドウの作成
  974.   #--------------------------------------------------------------------------
  975.   alias a1_battle_common_sb_create_item_window create_item_window
  976.   def create_item_window
  977.     a1_battle_common_sb_create_item_window
  978.     post_create_item_window
  979.     define_item_window_method
  980.   end
  981.   #--------------------------------------------------------------------------
  982.   # ○ アイテムウィンドウ作成の後処理
  983.   #--------------------------------------------------------------------------
  984.   def post_create_item_window
  985.   end
  986.   #--------------------------------------------------------------------------
  987.   # ○ アイテムウィンドウメソッドの定義
  988.   #--------------------------------------------------------------------------
  989.   def define_item_window_method
  990.     @item_window.define_method(method(:skill_item_window_show), :skill_item_window_show)
  991.     @item_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)
  992.   end
  993.   #--------------------------------------------------------------------------
  994.   # ○ スキル/アイテムウィンドウが表示された時の処理
  995.   #--------------------------------------------------------------------------
  996.   def skill_item_window_show
  997.   end
  998.   #--------------------------------------------------------------------------
  999.   # ○ スキル/アイテムウィンドウが非表示になった時の処理
  1000.   #--------------------------------------------------------------------------
  1001.   def skill_item_window_hide
  1002.   end
  1003.   #--------------------------------------------------------------------------
  1004.   # ☆ パーティコマンドウィンドウの作成
  1005.   #--------------------------------------------------------------------------
  1006.   alias a1_battle_common_sb_create_party_command_window create_party_command_window
  1007.   def create_party_command_window
  1008.     a1_battle_common_sb_create_party_command_window
  1009.     post_create_party_command_window
  1010.     define_party_command_window_method
  1011.     define_party_command_window_handle
  1012.   end
  1013.   #--------------------------------------------------------------------------
  1014.   # ○ パーティコマンドウィンドウ作成の後処理
  1015.   #--------------------------------------------------------------------------
  1016.   def post_create_party_command_window
  1017.   end
  1018.   #--------------------------------------------------------------------------
  1019.   # ○ パーティコマンドウィンドウメソッドの定義
  1020.   #--------------------------------------------------------------------------
  1021.   def define_party_command_window_method
  1022.   end
  1023.   #--------------------------------------------------------------------------
  1024.   # ○ パーティコマンドウィンドウハンドルの定義
  1025.   #--------------------------------------------------------------------------
  1026.   def define_party_command_window_handle
  1027.   end
  1028.   #--------------------------------------------------------------------------
  1029.   # ☆ アクターウィンドウの作成
  1030.   #--------------------------------------------------------------------------
  1031.   alias a1_battle_common_sb_create_actor_window create_actor_window
  1032.   def create_actor_window
  1033.     a1_battle_common_sb_create_actor_window
  1034.     post_create_actor_window
  1035.     define_actor_window_method
  1036.   end
  1037.   #--------------------------------------------------------------------------
  1038.   # ○ アクターウィンドウ作成の後処理
  1039.   #--------------------------------------------------------------------------
  1040.   def post_create_actor_window
  1041.   end
  1042.   #--------------------------------------------------------------------------
  1043.   # ○ アクターウィンドウメソッドの定義
  1044.   #--------------------------------------------------------------------------
  1045.   def define_actor_window_method
  1046.     @actor_window.define_method(method(:select_actor),     :select_actor)
  1047.     @actor_window.define_method(method(:select_actor_end), :select_actor_end)
  1048.   end
  1049.   #--------------------------------------------------------------------------
  1050.   # ○ アクターウィンドウをセレクトした時の処理
  1051.   #--------------------------------------------------------------------------
  1052.   def select_actor(index)
  1053.   end
  1054.   #--------------------------------------------------------------------------
  1055.   # ○ アクターウィンドウをセレクト終了した時の処理
  1056.   #--------------------------------------------------------------------------
  1057.   def select_actor_end
  1058.   end
  1059.   #--------------------------------------------------------------------------
  1060.   # ☆ 敵キャラウィンドウの作成
  1061.   #--------------------------------------------------------------------------
  1062.   alias a1_battle_common_sb_create_enemy_window create_enemy_window
  1063.   def create_enemy_window
  1064.     a1_battle_common_sb_create_enemy_window
  1065.     post_create_enemy_window
  1066.     define_enemy_window_method
  1067.   end
  1068.   #--------------------------------------------------------------------------
  1069.   # ○ 敵キャラウィンドウ作成の後処理
  1070.   #--------------------------------------------------------------------------
  1071.   def post_create_enemy_window
  1072.   end
  1073.   #--------------------------------------------------------------------------
  1074.   # ○ 敵キャラウィンドウメソッドの定義
  1075.   #--------------------------------------------------------------------------
  1076.   def define_enemy_window_method
  1077.     @enemy_window.define_method(method(:select_enemy),     :select_enemy)
  1078.     @enemy_window.define_method(method(:select_enemy_end) ,:select_enemy_end)
  1079.   end
  1080.   #--------------------------------------------------------------------------
  1081.   # ○ 敵キャラウィンドウをセレクトした時の処理
  1082.   #--------------------------------------------------------------------------
  1083.   def select_enemy(index)
  1084.   end
  1085.   #--------------------------------------------------------------------------
  1086.   # ○ 敵キャラウィンドウをセレクト終了した時の処理
  1087.   #--------------------------------------------------------------------------
  1088.   def select_enemy_end
  1089.   end
  1090.   #--------------------------------------------------------------------------
  1091.   # ☆ アクターコマンドウィンドウの作成
  1092.   #--------------------------------------------------------------------------
  1093.   alias a1_battle_common_sb_start_create_actor_command_window create_actor_command_window
  1094.   def create_actor_command_window
  1095.     a1_battle_common_sb_start_create_actor_command_window
  1096.     post_create_actor_command_window
  1097.     define_actor_command_handle
  1098.     define_actor_command_window
  1099.   end
  1100.   #--------------------------------------------------------------------------
  1101.   # ○ アクターコマンドウィンドウ作成の後処理
  1102.   #--------------------------------------------------------------------------
  1103.   def post_create_actor_command_window
  1104.   end
  1105.   #--------------------------------------------------------------------------
  1106.   # ○ アクターコマンドウィンドウメソッドの定義
  1107.   #--------------------------------------------------------------------------
  1108.   def define_actor_command_window
  1109.     @actor_command_window.define_method(method(:actor_command_open),  :actor_command_open)
  1110.     @actor_command_window.define_method(method(:actor_command_close), :actor_command_close)
  1111.     @actor_command_window.define_method(method(:actor_command_setup), :actor_command_setup)
  1112.   end
  1113.   #--------------------------------------------------------------------------
  1114.   # ○ アクターコマンドウィンドウハンドルの定義
  1115.   #--------------------------------------------------------------------------
  1116.   def define_actor_command_handle
  1117.   end
  1118.   #--------------------------------------------------------------------------
  1119.   # ○ アクターコマンドウィンドウがオープンした時の処理
  1120.   #--------------------------------------------------------------------------
  1121.   def actor_command_open
  1122.   end
  1123.   #--------------------------------------------------------------------------
  1124.   # ○ アクターコマンドウィンドウがクローズした時の処理
  1125.   #--------------------------------------------------------------------------
  1126.   def actor_command_close
  1127.   end
  1128.   #--------------------------------------------------------------------------
  1129.   # ○ アクターコマンドウィンドウのセットアップ時の処理
  1130.   #--------------------------------------------------------------------------
  1131.   def actor_command_setup(actor)
  1132.   end
  1133.   #--------------------------------------------------------------------------
  1134.   # ☆ パーティコマンド選択の開始
  1135.   #--------------------------------------------------------------------------
  1136.   alias a1_battle_common_sb_start_party_command_selection start_party_command_selection
  1137.   def start_party_command_selection
  1138.     prev_start_party_command_selection
  1139.     a1_battle_common_sb_start_party_command_selection
  1140.     post_start_party_command_selection
  1141.   end
  1142.   #--------------------------------------------------------------------------
  1143.   # ○ パーティコマンド選択の開始の前処理
  1144.   #--------------------------------------------------------------------------
  1145.   def prev_start_party_command_selection
  1146.   end
  1147.   #--------------------------------------------------------------------------
  1148.   # ○ パーティコマンド選択の開始の後処理
  1149.   #--------------------------------------------------------------------------
  1150.   def post_start_party_command_selection
  1151.   end
  1152.   #--------------------------------------------------------------------------
  1153.   # ☆ 次のコマンド入力へ
  1154.   #--------------------------------------------------------------------------
  1155.   alias a1_battle_common_sb_next_command next_command
  1156.   def next_command
  1157.     prev_next_command
  1158.     a1_battle_common_sb_next_command
  1159.     post_next_command
  1160.   end
  1161.   #--------------------------------------------------------------------------
  1162.   # ○ 次のコマンド入力への前処理
  1163.   #--------------------------------------------------------------------------
  1164.   def prev_next_command
  1165.   end
  1166.   #--------------------------------------------------------------------------
  1167.   # ○ 次のコマンド入力への後処理
  1168.   #--------------------------------------------------------------------------
  1169.   def post_next_command
  1170.   end
  1171.   #--------------------------------------------------------------------------
  1172.   # ☆ 前のコマンド入力へ
  1173.   #--------------------------------------------------------------------------
  1174.   alias a1_battle_common_sb_prior_command prior_command
  1175.   def prior_command
  1176.     prev_prior_command
  1177.     a1_battle_common_sb_prior_command
  1178.     post_prior_command
  1179.   end
  1180.   #--------------------------------------------------------------------------
  1181.   # ○ 前のコマンド入力への前処理
  1182.   #--------------------------------------------------------------------------
  1183.   def prev_prior_command
  1184.   end
  1185.   #--------------------------------------------------------------------------
  1186.   # ○ 前のコマンド入力への後処理
  1187.   #--------------------------------------------------------------------------
  1188.   def post_prior_command
  1189.   end
  1190.   #--------------------------------------------------------------------------
  1191.   # ☆ ターン開始
  1192.   #--------------------------------------------------------------------------
  1193.   alias a1_battle_common_sb_turn_start turn_start
  1194.   def turn_start
  1195.     prev_turn_start
  1196.     a1_battle_common_sb_turn_start
  1197.     post_turn_start
  1198.   end
  1199.   #--------------------------------------------------------------------------
  1200.   # ○ ターン開始の前処理
  1201.   #--------------------------------------------------------------------------
  1202.   def prev_turn_start
  1203.   end
  1204.   #--------------------------------------------------------------------------
  1205.   # ○ ターン開始の後処理
  1206.   #--------------------------------------------------------------------------
  1207.   def post_turn_start
  1208.   end
  1209.   #--------------------------------------------------------------------------
  1210.   # ☆ ターン終了
  1211.   #--------------------------------------------------------------------------
  1212.   alias a1_battle_common_sb_turn_end turn_end
  1213.   def turn_end
  1214.     prev_turn_end
  1215.     a1_battle_common_sb_turn_end
  1216.     post_turn_end
  1217.   end
  1218.   #--------------------------------------------------------------------------
  1219.   # ○ ターン終了の前処理
  1220.   #--------------------------------------------------------------------------
  1221.   def prev_turn_end
  1222.   end
  1223.   #--------------------------------------------------------------------------
  1224.   # ○ ターン終了の後処理
  1225.   #--------------------------------------------------------------------------
  1226.   def post_turn_end
  1227.   end
  1228.   #--------------------------------------------------------------------------
  1229.   # ○ ウィンドウが閉じるまでウェイト
  1230.   #--------------------------------------------------------------------------
  1231.   def wait_fot_window_close(window)
  1232.     update_basic while window.close?
  1233.   end
  1234.   #--------------------------------------------------------------------------
  1235.   # ○ アクターのバトルメンバー取得
  1236.   #--------------------------------------------------------------------------
  1237.   def battle_members
  1238.     @party_battle_members ||= $game_party.battle_members
  1239.     return @party_battle_members
  1240.   end
  1241.   #--------------------------------------------------------------------------
  1242.   # ○ バトルメンバーの追加の前処理
  1243.   #--------------------------------------------------------------------------
  1244.   def prev_add_battler(members)
  1245.   end
  1246.   #--------------------------------------------------------------------------
  1247.   # ○ バトルメンバーの追加後の処理
  1248.   #--------------------------------------------------------------------------
  1249.   def post_add_battler(member)
  1250.     @party_battle_members = $game_party.battle_members
  1251.   end
  1252.   #--------------------------------------------------------------------------
  1253.   # ○ バトルメンバー削除の前処理
  1254.   #--------------------------------------------------------------------------
  1255.   def prev_remove_battler(member)
  1256.   end
  1257.   #--------------------------------------------------------------------------
  1258.   # ○ バトルメンバーの削除後の処理
  1259.   #--------------------------------------------------------------------------
  1260.   def post_remove_battler
  1261.     @party_battle_members = $game_party.battle_members
  1262.   end
  1263.   #--------------------------------------------------------------------------
  1264.   # ☆ 戦闘行動の実行
  1265.   #--------------------------------------------------------------------------
  1266.   alias a1_battle_common_sb_execute_action execute_action
  1267.   def execute_action
  1268.     prev_execute_action
  1269.     a1_battle_common_sb_execute_action
  1270.     post_execute_action
  1271.   end
  1272.   #--------------------------------------------------------------------------
  1273.   # ○ 戦闘行動の実行の前処理
  1274.   #--------------------------------------------------------------------------
  1275.   def prev_execute_action
  1276.     @subject.current_action.pre_make_targets
  1277.   end
  1278.   #--------------------------------------------------------------------------
  1279.   # ○ 戦闘行動の実行の後処理
  1280.   #--------------------------------------------------------------------------
  1281.   def post_execute_action
  1282.     @subject.current_action.clear_targets if @subject.current_action
  1283.   end
  1284.   #--------------------------------------------------------------------------
  1285.   # ☆ スキル/アイテムの使用
  1286.   #--------------------------------------------------------------------------
  1287.   alias a1_battle_common_sb_use_item use_item
  1288.   def use_item
  1289.     prev_use_item
  1290.     a1_battle_common_sb_use_item
  1291.     post_use_item
  1292.   end
  1293.   #--------------------------------------------------------------------------
  1294.   # ○ スキル/アイテムの使用の前処理
  1295.   #--------------------------------------------------------------------------
  1296.   def prev_use_item
  1297.   end
  1298.   #--------------------------------------------------------------------------
  1299.   # ○ スキル/アイテムの使用の後処理
  1300.   #--------------------------------------------------------------------------
  1301.   def post_use_item
  1302.   end
  1303.   #--------------------------------------------------------------------------
  1304.   # ○ 勝利の処理
  1305.   #--------------------------------------------------------------------------
  1306.   def process_victory
  1307.   end
  1308.   #--------------------------------------------------------------------------
  1309.   # ○ 戦闘終了
  1310.   #--------------------------------------------------------------------------
  1311.   def battle_end(result)
  1312.     $game_party.all_members.each {|member| init_member_battle_end(member) }
  1313.   end
  1314.   #--------------------------------------------------------------------------
  1315.   # ○ 戦闘終了時のメンバー初期化
  1316.   #--------------------------------------------------------------------------
  1317.   def init_member_battle_end(member)
  1318.     member.current_weapon = nil
  1319.     member.current_main   = nil
  1320.   end
  1321. end
  1322. end
复制代码
スクリプト本体

  1. #===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    戦闘中入れ替え(RGSS3)
  4. #
  5. # バージョン   : 1.00 (2012/01/18)
  6. # 作者         : A1
  7. # URL     : http://a1tktk.web.fc2.com/
  8. #---------------------------------------------------------------------------
  9. # 機能:
  10. # ・戦闘中にメンバーを入れ替えます
  11. #---------------------------------------------------------------------------
  12. # 更新履歴   :2012/01/18 Ver1.00 リリース
  13. #---------------------------------------------------------------------------
  14. # 設置場所      
  15. #    A1バトル共通スクリプト以下
  16. #
  17. # 必要スクリプト
  18. #    A1バトル共通スクリプト
  19. #---------------------------------------------------------------------------
  20. # 使い方
  21. #   導入することで適用されます
  22. #==============================================================================
  23. $imported ||= {}
  24. if $imported["A1_BattleCommonScript"]
  25. $imported["A1_ChangeMember"] = true
  26. old_common_script("戦闘中入れ替え", "3.90") if common_version < 3.90
  27. #==============================================================================
  28. # ■ Window_PartyCommand
  29. #==============================================================================

  30. class Window_MemberChange < Window_Selectable
  31.   #--------------------------------------------------------------------------
  32.   # ○ オブジェクト初期化
  33.   #--------------------------------------------------------------------------
  34.   def initialize
  35.     @form_actor_window = Window_PersonalStatus.new(0, Graphics.height - 120, 255)
  36.     @to_actor_window   = Window_PersonalStatus.new(Graphics.width / 2, Graphics.height - 120, 255)
  37.     setup_members
  38.     width              = @battle_members.size * 48 + standard_padding * 2
  39.     height             = (@all_members.size / @battle_members.size.to_f).ceil * 48 + standard_padding * 2 + 36
  40.     super((Graphics.width - width) / 2, (Graphics.height - height) / 2, width, height)
  41.     self.y = Graphics.height - @form_actor_window.height - height if self.y + height > Graphics.height - @form_actor_window.height
  42.     self.index = 0
  43.     @from_actor = -1
  44.     self.openness = 0
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ○ アクティブ化
  48.   #--------------------------------------------------------------------------
  49.   def activate
  50.     super
  51.     refresh
  52.     @form_actor_window.actor = @all_members[self.index]
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ○ メンバーのセットアップ
  56.   #--------------------------------------------------------------------------
  57.   def setup_members
  58.     @all_members    = $game_party.all_members
  59.     @battle_members = $game_party.battle_members
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ○ 項目の選択
  63.   #--------------------------------------------------------------------------
  64.   def select(index)
  65.     super
  66.     @form_actor_window.actor = @all_members[self.index] if @from_actor == -1
  67.     @to_actor_window.actor   = @all_members[self.index] if @from_actor >= 0
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ○ 項目数の取得
  71.   #--------------------------------------------------------------------------
  72.   def item_max
  73.     @all_members.size
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ○ 桁数の取得
  77.   #--------------------------------------------------------------------------
  78.   def col_max
  79.     @battle_members.size
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ○ リフレッシュ
  83.   #--------------------------------------------------------------------------
  84.   def refresh
  85.     super
  86.     draw_horz_line(52)
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ○ 水平線の描画
  90.   #--------------------------------------------------------------------------
  91.   def draw_horz_line(y)
  92.     line_y = y + line_height / 2 - 1
  93.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ○ 水平線の色を取得
  97.   #--------------------------------------------------------------------------
  98.   def line_color
  99.     color = normal_color
  100.     color.alpha = 128
  101.     color
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ○ 項目の描画
  105.   #--------------------------------------------------------------------------
  106.   def draw_item(index)
  107.     c_name  = member(index).character_name
  108.     c_index = member(index).character_index
  109.     rect    = item_rect(index)
  110.     draw_character(c_name, c_index, rect.x + 24, rect.y + 40)
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ○ 項目を描画する矩形の取得
  114.   #--------------------------------------------------------------------------
  115.   def item_rect(index)
  116.     rect = Rect.new
  117.     rect.width = item_width
  118.     rect.height = item_height
  119.     rect.x = index % col_max * item_width
  120.     rect.y = index / col_max * item_height
  121.     rect.y += 24 if index > @battle_members.size - 1
  122.     rect
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ○ 項目の幅を取得
  126.   #--------------------------------------------------------------------------
  127.   def item_width
  128.     return 48
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ○ 項目の高さを取得
  132.   #--------------------------------------------------------------------------
  133.   def item_height
  134.     return 48
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ○ ウィンドウ内容の高さを計算
  138.   #--------------------------------------------------------------------------
  139.   def contents_height
  140.     row_max * item_height + 24
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ○ 下端パディングの更新
  144.   #--------------------------------------------------------------------------
  145.   def update_padding_bottom
  146.     surplus = (height - standard_padding * 2) % item_height - 24
  147.     self.padding_bottom = padding + surplus
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ○ メンバーの取得
  151.   #--------------------------------------------------------------------------
  152.   def member(index)
  153.     @all_members[index]
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ○ 決定処理の有効状態を取得
  157.   #--------------------------------------------------------------------------
  158.   def ok_enabled?
  159.     return true
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ○ 決定ボタンが押されたときの処理
  163.   #--------------------------------------------------------------------------
  164.   def process_ok
  165.     Sound.play_ok
  166.     Input.update
  167.     return select_start_to_actor if @from_actor == -1
  168.     return call_cancel_handler if @from_actor == self.index
  169.     change_member if @from_actor >= 0
  170.     post_change_member
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ○ メンバー入れ替え
  174.   #--------------------------------------------------------------------------
  175.   def change_member
  176.     $game_party.swap_order(@from_actor, self.index)
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ○ メンバー入れ替え後の処理
  180.   #--------------------------------------------------------------------------
  181.   def post_change_member
  182.     setup_members
  183.     self.index  = @from_actor
  184.     @form_actor_window.actor = @all_members[self.index]
  185.     @from_actor = -1
  186.     @to_actor_window.close
  187.     refresh
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ○ 入れ替え先のアクター選択開始
  191.   #--------------------------------------------------------------------------
  192.   def select_start_to_actor
  193.     @from_actor = self.index
  194.     @to_actor_window.open
  195.     self.index = self.index < @battle_members.size ? @battle_members.size : 0
  196.     @to_actor_window.actor = @all_members[self.index]
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ○ 入れ替え元のアクター
  200.   #--------------------------------------------------------------------------
  201.   def from_actor
  202.     @from_actor
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ○ オープン
  206.   #--------------------------------------------------------------------------
  207.   def open
  208.     super
  209.     @form_actor_window.open
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ○ キャンセルハンドラの呼び出し
  213.   #--------------------------------------------------------------------------
  214.   def call_cancel_handler
  215.     super if @from_actor == -1
  216.     @from_actor = -1
  217.     @to_actor_window.close
  218.     @form_actor_window.actor = @all_members[self.index]
  219.     activate
  220.   end
  221.   #--------------------------------------------------------------------------
  222.   # ○ クローズ
  223.   #--------------------------------------------------------------------------
  224.   def close
  225.     super
  226.     @form_actor_window.close
  227.     @to_actor_window.close
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ○ フレーム更新
  231.   #--------------------------------------------------------------------------
  232.   def update
  233.     super
  234.     @form_actor_window.update
  235.     @to_actor_window.update
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ○ 解放
  239.   #--------------------------------------------------------------------------
  240.   def dispose
  241.     super
  242.     @form_actor_window.dispose
  243.     @to_actor_window.dispose
  244.   end
  245. end
  246. #==============================================================================
  247. # ■ Window_PartyCommand
  248. #------------------------------------------------------------------------------
  249. #  バトル画面で、戦うか逃げるかを選択するウィンドウです。
  250. #==============================================================================

  251. class Window_PartyCommand < Window_Command
  252.   #--------------------------------------------------------------------------
  253.   # ☆ コマンドリストの作成
  254.   #--------------------------------------------------------------------------
  255.   alias a1_cbm_wpc_make_command_list make_command_list
  256.   def make_command_list
  257.     a1_cbm_wpc_make_command_list
  258.     add_command("入れ替え", :member_change, $game_party.all_members.size > $game_party.max_battle_members)
  259.   end
  260. end
  261. #==============================================================================
  262. # ■ Scene_Battle
  263. #------------------------------------------------------------------------------
  264. #  バトル画面の処理を行うクラスです。
  265. #==============================================================================

  266. class Scene_Battle < Scene_Base
  267.   #--------------------------------------------------------------------------
  268.   # ☆ 全ウィンドウの作成
  269.   #--------------------------------------------------------------------------
  270.   alias a1_cbm_wpc_create_all_windows create_all_windows
  271.   def create_all_windows
  272.     a1_cbm_wpc_create_all_windows
  273.     create_member_change_window
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ○ 入れ替えウィンドウの作成
  277.   #--------------------------------------------------------------------------
  278.   def create_member_change_window
  279.     @window_member_change = Window_MemberChange.new
  280.     @window_member_change.set_handler(:cancel, method(:on_member_change_cancel))
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ☆ パーティコマンドウィンドウハンドルの定義
  284.   #--------------------------------------------------------------------------
  285.   alias a1_cbm_sb_define_party_command_window_handle define_party_command_window_handle
  286.   def define_party_command_window_handle
  287.     a1_cbm_sb_define_party_command_window_handle
  288.     @party_command_window.set_handler(:member_change,  method(:command_member_change))
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ○ 入れ替え
  292.   #--------------------------------------------------------------------------
  293.   def command_member_change
  294.     @prev_battle_members = $game_party.battle_members
  295.     @status_window.close
  296.     @party_command_window.close
  297.     @window_member_change.open
  298.     @window_member_change.activate
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ○ 変更したメンバーを取得
  302.   #--------------------------------------------------------------------------
  303.   def change_diss_members(ret = [])
  304.     $game_party.battle_members.each_with_index {|member, i| ret.push(member) if member != @prev_battle_members[i] }
  305.     return ret
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ○ メンバーチェンジ[キャンセル]
  309.   #--------------------------------------------------------------------------
  310.   def on_member_change_cancel
  311.     @party_command_window.activate
  312.     @status_window.refresh
  313.     @status_window.open
  314.     @party_command_window.open
  315.     @window_member_change.close
  316.     change_diss_members.each {|member| member.make_actions }
  317.     @party_battle_members = $game_party.battle_members
  318.   end
  319. end
  320. end

复制代码

������

点评

这个脚本能禁止第一个角色换位吗?  发表于 2013-5-15 22:13
这三个脚本都需要?因为我用的是六格行走图,行走图显示会出现问题,请问怎么修改成头像?  发表于 2013-5-14 11:05
hcm
链接Over了。  发表于 2012-3-28 22:52

评分

参与人数 1星屑 +60 收起 理由
hcm + 60 感谢回答。

查看全部评分

回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
154
在线时间
664 小时
注册时间
2011-9-25
帖子
241
10
发表于 2012-3-28 23:12:36 | 只看该作者
第二个脚本第120行改成true就可以默认锁定一号角色了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-11-15 07:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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