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

Project1

 找回密码
 注册会员
搜索
查看: 7690|回复: 31

[随意闲聊] 【RPGVX】VX的脚本都拿来共享吧,VX的脚本好少啊。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
发表于 2015-6-22 23:14:18 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 丿冷丶心△男神 于 2015-6-23 06:00 编辑

谁有好料料的脚本都拿来共享吧。呵呵。
这些脚本都是我自己找的,给新手提供的。【高手、牛逼人士勿喷!!!】
脚本有BUG的话,记得反应哦。
所有脚本的来源都是百度。提前说明下。
所有的脚本使用方法就是放在脚本编辑器里的Main后面,这个方法应该很简单的吧,右键点击Main然后插入,在白页里面输入脚本,旁边一小行一小行的输入脚本名字(爱叫啥叫啥)。
事件的,改天再发。




话说,为毛,没人,说话,只有,我一,个人,在发,脚本。。。。。。

评分

参与人数 1星屑 +50 收起 理由
鑫晴 + 50 赞美分享精神

查看全部评分

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
 楼主| 发表于 2015-6-22 23:14:19 | 显示全部楼层
本帖最后由 怪蜀黍 于 2015-6-23 20:59 编辑
  1. 存档扩展的脚本(该行不要复制)
  2. #==============================================================================
  3. # vx新截图存档 by 沉影不器
  4. #------------------------------------------------------------------------------
  5. # ☆ 核心部分是内存位图的输入输出
  6. #    (快速存储Bitmap的Marshal 作者: 柳之一) 强大啊
  7. #------------------------------------------------------------------------------
  8. # ▼ 相比rmxp正版截图存档(作者: 柳柳),主要变动如下:
  9. #     ① 省去了 screenshot.dll 文件 (因快速存储Bitmap的Marshal的存在)
  10. #     ② 无须人工新建存档文件夹,脚本将自建
  11. #     ③ 方便地更改最大存档数,只需设置最大值
  12. #==============================================================================
  13. MAX_SAVE_ID = 12                          # 最大存档数
  14. SAVE_DIR = "Saves/"                       # 改变的存档目录(不希望改变目录请删)
  15. #==============================================================================
  16. # (快速存储Bitmap的Marshal 作者: 柳之一) 强大啊
  17. #==============================================================================
  18. class Font
  19.   def marshal_dump
  20.   end
  21.   def marshal_load(obj)
  22.   end
  23. end

  24. class Bitmap
  25.   # 传送到内存的API函数
  26.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  27.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  28.   def _dump(limit)
  29.     data = "rgba" * width * height
  30.     RtlMoveMemory_pi.call(data, address, data.length)
  31.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*") # 压缩
  32.   end
  33.   def self._load(str)
  34.     w, h, zdata = str.unpack("LLa*")
  35.     b = self.new(w, h)
  36.     RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  37.     return b
  38.   end
  39. # [[[bitmap.object_id * 2 + 16] + 8] + 16] == 数据的开头
  40.   def address
  41.     buffer, ad = "rgba", object_id * 2 + 16
  42.     RtlMoveMemory_pi.call(buffer, ad, 4)
  43.     ad = buffer.unpack("L")[0] + 8
  44.     RtlMoveMemory_pi.call(buffer, ad, 4)
  45.     ad = buffer.unpack("L")[0] + 16
  46.     RtlMoveMemory_pi.call(buffer, ad, 4)
  47.     return buffer.unpack("L")[0]
  48.   end
  49. end

  50. #==============================================================================
  51. # ■ Game_Temp
  52. #==============================================================================
  53. class Game_Temp
  54.   #--------------------------------------------------------------------------
  55.   # ● 定义实例变量
  56.   #--------------------------------------------------------------------------
  57.   attr_accessor :save_bitmap        # 存档位图
  58.   #--------------------------------------------------------------------------
  59.   # ● 初始化对象
  60.   #--------------------------------------------------------------------------
  61.   alias ini initialize
  62.   def initialize
  63.     ini
  64.     @save_bitmap = Bitmap.new(1, 1)
  65.   end
  66. end

  67. #==============================================================================
  68. # ■ Window_SaveFile
  69. #==============================================================================
  70. class Window_SaveFile < Window_Base
  71.   #--------------------------------------------------------------------------
  72.   # ● 定义实例变量
  73.   #--------------------------------------------------------------------------
  74.   attr_reader   :filename                 # 文件名
  75.   attr_reader   :file_exist               # 文件存在标志
  76.   #--------------------------------------------------------------------------
  77.   # ● 初始化对象
  78.   #     file_index : 存档文件索引 (0~3)
  79.   #     filename   : 文件名
  80.   #--------------------------------------------------------------------------
  81.   def initialize(file_index, filename)
  82.     super(160, 56, 384, 360)
  83.     @file_index = file_index
  84.     @filename = filename
  85.     make_dir(SAVE_DIR) if SAVE_DIR != nil
  86.     load_gamedata
  87.     refresh(@file_index)
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● 读取部分游戏数据
  91.   #--------------------------------------------------------------------------
  92.   def load_gamedata
  93.     @file_exist = FileTest.exist?(SAVE_DIR + @filename)
  94.     if @file_exist
  95.       file = File.open(SAVE_DIR + @filename, "r")
  96.       begin
  97.         @characters          = Marshal.load(file)
  98.         @frame_count         = Marshal.load(file)
  99.         @last_bgm            = Marshal.load(file)
  100.         @last_bgs            = Marshal.load(file)
  101.         @game_system         = Marshal.load(file)
  102.         @game_message        = Marshal.load(file)
  103.         @game_switches       = Marshal.load(file)
  104.         @game_variables      = Marshal.load(file)
  105.         @game_self_switches  = Marshal.load(file)
  106.         @game_actors         = Marshal.load(file)
  107.         @game_party          = Marshal.load(file)
  108.         @game_troop          = Marshal.load(file)
  109.         @game_map            = Marshal.load(file)
  110.         [url=home.php?mod=space&uid=14736]@game_player[/url]         = Marshal.load(file)
  111.         # 读取截图
  112.         @file_bitmap         = Marshal.load(file)
  113.         @total_sec = @frame_count / Graphics.frame_rate
  114.       rescue
  115.         @file_exist = false
  116.       ensure
  117.         file.close
  118.       end
  119.     end
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 刷新
  123.   #     index : 索引
  124.   #--------------------------------------------------------------------------
  125.   def refresh(index)
  126.     file_index = index
  127.     self.contents.clear
  128.     self.contents.font.color = normal_color
  129.     if @file_exist
  130.       # 描绘底部阴影
  131.       self.contents.fill_rect(12+3, 4+3, 326,249, Color.new(0,0,64))
  132.       # 描绘截图
  133.       draw_snap_bitmap(12, 4)
  134.       draw_party_characters(152, 296)
  135.       draw_playtime(0, 296+8, contents.width - 40, 2)
  136.     else
  137.       self.contents.draw_text(0, 296, 384-32, 24, "无此存档!", 1)
  138.     end
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ◎ 更改索引
  142.   #     index : 索引
  143.   #--------------------------------------------------------------------------
  144.   def file_index=(file_index)
  145.     @file_index = file_index
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 描绘游戏人物
  149.   #     x : 描画先 X 座標
  150.   #     y : 描画先 Y 座標
  151.   #--------------------------------------------------------------------------
  152.   def draw_party_characters(x, y)
  153.     for i in [email][email protected][/email]
  154.       name = @characters[i][0]
  155.       index = @characters[i][1]
  156.       draw_character(name, index, x + i * 48, y)
  157.     end
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ◎ 生成保存路径
  161.   #     path : 路径
  162.   #--------------------------------------------------------------------------
  163.   def make_dir(path)
  164.     dir = path.split("/")
  165.     for i in 0...dir.size
  166.       unless dir == "."
  167.         add_dir = dir[0..i].join("/")
  168.         begin
  169.           Dir.mkdir(add_dir)
  170.         rescue
  171.         end
  172.       end
  173.     end
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ◎ 生成文件名
  177.   #     file_index : 存档文件索引 (0~3)
  178.   #--------------------------------------------------------------------------
  179.   def make_filename(file_index)
  180.     return "Save#{file_index + 1}.rvdata"
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ◎ 描绘截图
  184.   #     x : 描画先 X 座標
  185.   #     y : 描画先 Y 座標
  186.   #--------------------------------------------------------------------------
  187.   def draw_snap_bitmap(x, y)
  188.     bitmap = @file_bitmap
  189.     if bitmap == nil
  190.       self.contents.draw_text(0, 112, 384-32, 24, "找不到截图文件!", 1)
  191.     else
  192.       self.contents.blur
  193.       rect = Rect.new(0, 0, 0, 0)
  194.       rect.width = bitmap.width
  195.       rect.height = bitmap.height
  196.       self.contents.blt(x, y, bitmap, rect)
  197.     end
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● 描绘游戏时间
  201.   #     x     : 描绘目标 X 坐标
  202.   #     y     : 描绘目标 Y 坐标
  203.   #     width : 宽
  204.   #     align : 配置
  205.   #--------------------------------------------------------------------------
  206.   def draw_playtime(x, y, width, align)
  207.     hour = @total_sec / 60 / 60
  208.     min = @total_sec / 60 % 60
  209.     sec = @total_sec % 60
  210.     time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  211.     self.contents.font.color = normal_color
  212.     self.contents.draw_text(x, y, width, WLH, time_string, 2)
  213.   end
  214. end

  215. #==============================================================================
  216. # ■ Scene_Base
  217. #==============================================================================
  218. class Scene_Base
  219.   #--------------------------------------------------------------------------
  220.   # ◎ 生成存档位图快照
  221.   #--------------------------------------------------------------------------
  222.   def snapshot_for_save
  223.     d_rect = Rect.new(0, 0, 326, 249)
  224.     s_rect = Rect.new(0, 0, 544, 416)
  225.     save_bitmap = Graphics.snap_to_bitmap
  226.     $game_temp.save_bitmap.dispose
  227.     $game_temp.save_bitmap = Bitmap.new(326, 249)
  228.     $game_temp.save_bitmap.stretch_blt(d_rect, save_bitmap, s_rect)
  229.   end
  230. end

  231. #==============================================================================
  232. # ■ Scene_Map
  233. #==============================================================================
  234. class Scene_Map < Scene_Base
  235.   #--------------------------------------------------------------------------
  236.   # ● 结束处理
  237.   #--------------------------------------------------------------------------
  238.   alias save_terminate terminate
  239.   def terminate
  240.     snapshot_for_save
  241.     save_terminate
  242.   end
  243. end

  244. #==============================================================================
  245. # ■ Scene_Title
  246. #==============================================================================
  247. class Scene_Title < Scene_Base
  248.   #--------------------------------------------------------------------------
  249.   # ● 判断继续是否有效
  250.   #--------------------------------------------------------------------------
  251.   def check_continue
  252.     @continue_enabled = (Dir.glob(SAVE_DIR + 'Save*.rvdata').size > 0)
  253.   end
  254. end

  255. #==============================================================================
  256. # ■ Scene_File
  257. #------------------------------------------------------------------------------
  258. #  处理文件的类。
  259. #==============================================================================
  260. class Scene_File < Scene_Base
  261.   #--------------------------------------------------------------------------
  262.   # ● 初始化对象
  263.   #     saving     : 存档标志 (false 为载入画面)
  264.   #     from_title : 调用标题画面的 "继续" 标志
  265.   #     from_event : 事件的 "调用存档画面" 的调用标志
  266.   #--------------------------------------------------------------------------
  267.   def initialize(saving, from_title, from_event)
  268.     @saving = saving
  269.     @from_title = from_title
  270.     @from_event = from_event
  271.   end
  272.   #--------------------------------------------------------------------------
  273.   # ● 开始处理
  274.   #--------------------------------------------------------------------------
  275.   def start
  276.     super
  277.     create_menu_background
  278.     @help_window = Window_Help.new
  279.     create_command_window
  280.     if @saving
  281.       @index = $game_temp.last_file_index
  282.       @help_window.set_text(Vocab::SaveMessage)
  283.     else
  284.       @index = self.latest_file_index
  285.       @help_window.set_text(Vocab::LoadMessage)
  286.     end
  287.     @refresh_index = @command_window.index = @index
  288.     @item_max = MAX_SAVE_ID
  289.     create_savefile_window
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ● 结束处理
  293.   #--------------------------------------------------------------------------
  294.   def terminate
  295.     super
  296.     dispose_menu_background
  297.     @help_window.dispose
  298.     dispose_item_windows
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● 还原至原先的画面
  302.   #--------------------------------------------------------------------------
  303.   def return_scene
  304.     if @from_title
  305.       $scene = Scene_Title.new
  306.     elsif @from_event
  307.       $scene = Scene_Map.new
  308.     else
  309.       $scene = Scene_Menu.new(4)
  310.     end
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● 更新画面
  314.   #--------------------------------------------------------------------------
  315.   def update
  316.     super
  317.     update_menu_background
  318.     @help_window.update
  319.     update_savefile_windows
  320.     update_savefile_selection
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ◎ 生成存档文件列表窗口
  324.   #--------------------------------------------------------------------------
  325.   def create_command_window
  326.     file_names = []
  327.     digit = MAX_SAVE_ID.to_s.size
  328.     str_f = ""
  329.     digit.times{|n| str_f += "0"}
  330.     str_f[str_f.size-1, 1] = digit.to_s
  331.     for i in 0...MAX_SAVE_ID
  332.       id = sprintf("%#{str_f}d", i+1)
  333.       file_names.push(Vocab::File + "\s" + id)
  334.     end
  335.     @command_window = Window_Command.new(160, file_names)
  336.     @command_window.height = 360
  337.     @command_window.y = 56
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● 生成存档文件窗口
  341.   #--------------------------------------------------------------------------
  342.   def create_savefile_window
  343.     @savefile_window = Window_SaveFile.new(@command_window.index, make_filename(@command_window.index))
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● 释放存档文件
  347.   #--------------------------------------------------------------------------
  348.   def dispose_item_windows
  349.     @command_window.dispose
  350.     @savefile_window.dispose
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # ● 更新存档文件窗口
  354.   #--------------------------------------------------------------------------
  355.   def update_savefile_windows
  356.     @command_window.update
  357.     @savefile_window.update
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 更新存档文件选择
  361.   #--------------------------------------------------------------------------
  362.   def update_savefile_selection
  363.     if Input.trigger?(Input::C)
  364.       determine_savefile
  365.     end
  366.     if Input.trigger?(Input::B)
  367.       Sound.play_cancel
  368.       return_scene
  369.     end
  370.     if @refresh_index != @command_window.index
  371.       @refresh_index = @command_window.index
  372.       @savefile_window.dispose
  373.       create_savefile_window
  374.       end
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● 确定存档文件
  378.   #--------------------------------------------------------------------------
  379.   def determine_savefile
  380.     if @saving
  381.       Sound.play_save
  382.       do_save
  383.     else
  384.       if @savefile_window.file_exist
  385.         Sound.play_load
  386.         do_load
  387.       else
  388.         Sound.play_buzzer
  389.         return
  390.       end
  391.     end
  392.     $game_temp.last_file_index = @index
  393.   end
  394.   #--------------------------------------------------------------------------
  395.   # ◎ 生成文件名
  396.   #     file_index : 存档文件索引
  397.   #--------------------------------------------------------------------------
  398.   def make_filename(file_index)
  399.     return "Save#{file_index + 1}.rvdata"
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # ● 按时间戳选择最新的文件
  403.   #--------------------------------------------------------------------------
  404.   def latest_file_index
  405.     index = 0
  406.     latest_time = Time.at(0) # 时间戳
  407.     for i in 0...MAX_SAVE_ID
  408.       file_name = make_filename(i)
  409.       if FileTest.exist?(SAVE_DIR + file_name)
  410.         file = File.open(SAVE_DIR + file_name, "r")
  411.         if file.mtime > latest_time
  412.           latest_time = file.mtime
  413.           index = i
  414.         end
  415.       end
  416.     end
  417.     return index
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ● 执行存档
  421.   #--------------------------------------------------------------------------
  422.   def do_save
  423.     file_name = make_filename(@command_window.index)
  424.     file = File.open(SAVE_DIR + file_name, "wb")
  425.     write_save_data(file)
  426.     # 保存位图
  427.     $file_bitmap = $game_temp.save_bitmap
  428.     Marshal.dump($file_bitmap, file)
  429.     file.close
  430.     return_scene
  431.   end
  432.   #--------------------------------------------------------------------------
  433.   # ● 执行载入
  434.   #--------------------------------------------------------------------------
  435.   def do_load
  436.     file_name = make_filename(@command_window.index)
  437.     file = File.open(SAVE_DIR + file_name, "rb")
  438.     read_save_data(file)
  439.     file.close
  440.     $scene = Scene_Map.new
  441.     RPG::BGM.fade(1500)
  442.     Graphics.fadeout(60)
  443.     Graphics.wait(40)
  444.     @last_bgm.play
  445.     @last_bgs.play
  446.   end
  447. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
 楼主| 发表于 2015-6-22 23:14:20 | 显示全部楼层
(队伍里面最多可以加入八个人的脚本,该行不要复制)
#==============================================================================
# ○ 多人队伍脚本扩展-八人状态菜单
#                      ——By.冰舞蝶恋
#------------------------------------------------------------------------------
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
#  显示菜单画面和同伴状态的窗口。
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     x      : 窗口 X 座标
  #     y      : 窗口 Y 座标
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 384, 416)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    if @item_max <= 4
    for actor in $game_party.members
      draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
      x = 104
      y = actor.index * 96 + WLH / 2
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 120, y)
      draw_actor_level(actor, x, y + WLH * 1)
      draw_actor_state(actor, x, y + WLH * 2)
      draw_actor_hp(actor, x + 120, y + WLH * 1)
      draw_actor_mp(actor, x + 120, y + WLH * 2)
    end
    else
    for actor in $game_party.members
     for a in 0..@item_max-1
     if a < 4
      draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
      x = 4
      y = actor.index * 96 + WLH / 2-12
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 120-24, y)
      draw_actor_level(actor, x+120-24, y + WLH * 1)
      draw_actor_hp(actor, x + 120-24, y + WLH * 1+24, 72)
      draw_actor_mp(actor, x + 120-24, y + WLH * 2+24, 72)
     else
      draw_actor_face(actor, 2+176, (actor.index - 4) * 96 + 2, 92)
      x = 4+176
      y = (actor.index - 4) * 96 + WLH / 2-12
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 120-24, y)
      draw_actor_level(actor, x+120-24, y + WLH * 1)
      draw_actor_hp(actor, x + 120-24, y + WLH * 1+24, 72)
      draw_actor_mp(actor, x + 120-24, y + WLH * 2+24, 72)
     end
     end
    end
    end
  end
  #--------------------------------------------------------------------------
  # ● 更新光标
  #--------------------------------------------------------------------------
  def update_cursor
    if @item_max <= 4
    if @index < 0               # 无光标
      self.cursor_rect.empty
    elsif @index < @item_max    # 一般
      self.cursor_rect.set(0, @index * 96, contents.width, 96)
    elsif @index >= 100         # 使用本身
      self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
    else                        # 全体
      self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
    end
    else
    if @index < 0               # 无光标
      self.cursor_rect.empty
    elsif @index < @item_max    # 一般
      if @index < 4
        self.cursor_rect.set(0, @index * 96, 352 / 2, 96)
      else
        self.cursor_rect.set(352 / 2, (@index - 4) * 96, 352 / 2, 96)
      end
    elsif @index >= 100         # 使用本身
      if @index-100 < 4
        self.cursor_rect.set(0, (@index - 100) * 96, 352 / 2, 96)
      else
        self.cursor_rect.set(352 / 2, (@index - 100 - 4) * 96, 352 / 2, 96)
      end
    else                        # 全体
      self.cursor_rect.set(0, 0, contents.width, 4*96)
    end
    end
  end
end
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
 楼主| 发表于 2015-6-22 23:14:21 | 显示全部楼层
本帖最后由 怪蜀黍 于 2015-6-23 20:57 编辑
  1. (简易商店扩展描绘    老规矩)
  2. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  3. #_/    ◆ 简易商店拓展描绘脚本 - FSL_SHOP ◆ VX ◆
  4. #_/
  5. #_/    ◇ 许可协议 :FSL       ◇
  6. #_/    ◇ 项目分类 : 角色辅助  ◇
  7. #_/    ◇ 项目版本 : 1.5.903   ◇
  8. #_/    ◇ 建立日期 : 2010/8/26 ◇
  9. #_/    ◇ 最后更新 : 2010/9/03 ◇
  10. #_/----------------------------------------------------------------------------
  11. #_/  作者:wangswz DeathKing
  12. #_/  引用网址: [url]http://rpg.blue/thread-154915-1-1.html[/url]
  13. #_/============================================================================
  14. #_/ 【基本机能】方便商店购物选择
  15. #_/  放在默认脚本之后,Main脚本之前,通过事件指令【商店处理】调用。
  16. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  17. #===============================================================================
  18. #-------------------------------------------------------------------------------
  19. # ▼ 通用配置模块
  20. #-------------------------------------------------------------------------------
  21. module FSL
  22.   module SHOP
  23.     # ◆ 无法装备的提示信息
  24.     Shop_help = "-无法装备-"
  25.    
  26.     # ◆ 无法使用的提示信息
  27.     Shop_help2 = "-无法使用-"
  28.    
  29.     # ◆ 设置atk def spi agi 上升 下降 相等时 图标显示 4个一组
  30.     Shop_icon = [
  31.     120,121,122,123,
  32.     124,125,126,127,
  33.       0,  0,  0,  0
  34.     ]
  35.   end
  36. end
  37. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  38. $imported = {} if $imported == nil
  39. $fscript = {} if $fscript == nil
  40. $fscript["FSL_SHOP"] = "1.5.903"
  41. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  42. #==============================================================================
  43. # ■ Scene_Map
  44. #==============================================================================

  45. class Scene_Map < Scene_Base
  46.   #--------------------------------------------------------------------------
  47.   # ● ショップ画面への切り替え
  48.   #--------------------------------------------------------------------------
  49.   def call_shop
  50.     if $imported["ComposeItem"] == true && $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH]
  51.       # 合成画面に移行
  52.       $game_temp.next_scene = nil
  53.       $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH] = false
  54.       $scene = Scene_ComposeItem.new
  55.     else
  56.       $game_temp.next_scene = nil
  57.       $scene = Scene_Shop2.new
  58.     end
  59.   end
  60. end
  61. #==============================================================================
  62. # ■ Scene_Shop
  63. #------------------------------------------------------------------------------
  64. #  处理商店画面的类。
  65. #==============================================================================

  66. class Scene_Shop2 < Scene_Base
  67.   #--------------------------------------------------------------------------
  68.   # ● 开始处理
  69.   #--------------------------------------------------------------------------
  70.   def start
  71.     super
  72.     create_menu_background
  73.     create_command_window
  74.     create_command_window2
  75.     @help_window = Window_Help.new
  76.     @gold_window = Window_Gold.new(384, 56)
  77.     @dummy_window = Window_Base.new(0, 112, 544, 304)
  78.     @dummy_window2 = Window_Base.new(304, 112, 240, 304)
  79.     @dummy_window3 = Window_Base.new(0, 168, 304, 248)
  80.     @dummy_window2.visible = false
  81.     @dummy_window3.visible = false
  82.     @buy_window = Window_ShopBuy2.new(0, 168)
  83.     @buy_window.active = false
  84.     @buy_window.visible = false
  85.     @buy_window.help_window = @help_window
  86.     @sell_window = Window_ShopSell.new(0, 112, 544, 304)
  87.     @sell_window.active = false
  88.     @sell_window.visible = false
  89.     @sell_window.help_window = @help_window
  90.     @number_window = Window_ShopNumber.new(0, 112)
  91.     @number_window.active = false
  92.     @number_window.visible = false
  93.     @actor_index = 0
  94.     @status_window = Window_Shop_ActorStatus.new($game_party.members[@actor_index])
  95.     @status_window.visible = false
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 结束处理
  99.   #--------------------------------------------------------------------------
  100.   def terminate
  101.     super
  102.     dispose_menu_background
  103.     dispose_command_window
  104.     dispose_command_window2
  105.     @help_window.dispose
  106.     @gold_window.dispose
  107.     @dummy_window.dispose
  108.     @dummy_window2.dispose
  109.     @dummy_window3.dispose
  110.     @buy_window.dispose
  111.     @sell_window.dispose
  112.     @number_window.dispose
  113.     @status_window.dispose
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 更新画面
  117.   #--------------------------------------------------------------------------
  118.   def update
  119.     super
  120.     update_menu_background
  121.     @help_window.update
  122.     @command_window.update
  123.     @command_window2.update
  124.     @gold_window.update
  125.     @dummy_window.update
  126.     @dummy_window2.update
  127.     @dummy_window3.update
  128.     @buy_window.update
  129.     @sell_window.update
  130.     @number_window.update
  131.     @status_window.update
  132.     if @command_window.active
  133.       update_command_selection
  134.     elsif @buy_window.active
  135.       update_buy_selection1
  136.     elsif @sell_window.active
  137.       update_sell_selection
  138.     elsif @number_window.active
  139.       update_number_input
  140.     elsif @command_window2.active
  141.       update_command_selection2
  142.     end
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ● 生成命令窗口
  146.   #--------------------------------------------------------------------------
  147.   def create_command_window
  148.     s1 = Vocab::ShopBuy
  149.     s2 = Vocab::ShopSell
  150.     s3 = Vocab::ShopCancel
  151.     @command_window = Window_Command.new(384, [s1, s2, s3], 3)
  152.     @command_window.y = 56
  153.     if $game_temp.shop_purchase_only
  154.       @command_window.draw_item(1, false)
  155.     end
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 释放命令窗口
  159.   #--------------------------------------------------------------------------
  160.   def dispose_command_window
  161.     @command_window.dispose
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 更新命令窗口
  165.   #--------------------------------------------------------------------------
  166.   def update_command_selection
  167.     if Input.trigger?(Input::B)
  168.       Sound.play_cancel
  169.       $scene = Scene_Map.new
  170.     elsif Input.trigger?(Input::C)
  171.       case @command_window.index
  172.       when 0  # 买入
  173.         Sound.play_decision
  174.         @command_window.active = false
  175.         @dummy_window.visible = false
  176.         @dummy_window2.visible = true
  177.         @dummy_window3.visible = true
  178.         @command_window2.active = true
  179.         @command_window2.visible = true
  180.       when 1  # 卖出
  181.         if $game_temp.shop_purchase_only
  182.           Sound.play_buzzer
  183.         else
  184.           Sound.play_decision
  185.           @command_window.active = false
  186.           @dummy_window.visible = false
  187.           @sell_window.active = true
  188.           @sell_window.visible = true
  189.           @sell_window.refresh
  190.         end
  191.       when 2  # 离开
  192.         Sound.play_decision
  193.         $scene = Scene_Map.new
  194.       end
  195.     end
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 生成二级命令窗口
  199.   #--------------------------------------------------------------------------
  200.   def create_command_window2
  201.     s1 = "物品"
  202.     s2 = "武器"
  203.     s3 = "防具"
  204.     @command_window2 = Window_Command.new(304, [s1, s2, s3], 3)
  205.     @command_window2.x = 0
  206.     @command_window2.y = 112
  207.     @command_window2.active = false
  208.     @command_window2.visible = false
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ● 释放二级命令窗口
  212.   #--------------------------------------------------------------------------
  213.   def dispose_command_window2
  214.     @command_window2.dispose
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # ● 更新二级命令窗口
  218.   #--------------------------------------------------------------------------
  219.   def update_command_selection2
  220.     if Input.trigger?(Input::B)
  221.       Sound.play_cancel
  222.       @command_window.active = true
  223.       @command_window2.active = false
  224.       @command_window2.visible = false
  225.       @dummy_window.visible = true
  226.       @dummy_window2.visible = false
  227.       @dummy_window3.visible = false
  228.       @buy_window.active = false
  229.       @buy_window.visible = false
  230.       @status_window.visible = false
  231.       @status_window.item = nil
  232.       @help_window.set_text("")
  233.       return
  234.     elsif Input.trigger?(Input::C)
  235.       case @command_window2.index
  236.       when 0
  237.         Sound.play_decision
  238.         @command_window2.active = false
  239.         @buy_window.index = 0
  240.         @buy_window.active = true
  241.         @buy_window.visible = true
  242.         @buy_window.type = 0
  243.         @buy_window.refresh
  244.         @status_window.visible = true
  245.       when 1
  246.         Sound.play_decision
  247.         @command_window2.active = false
  248.         @buy_window.index = 0
  249.         @buy_window.active = true
  250.         @buy_window.visible = true
  251.         @buy_window.type = 1
  252.         @buy_window.refresh
  253.         @status_window.visible = true
  254.       when 2
  255.         Sound.play_decision
  256.         @command_window2.active = false
  257.         @buy_window.index = 0
  258.         @buy_window.active = true
  259.         @buy_window.visible = true
  260.         @buy_window.type = 2
  261.         @buy_window.refresh
  262.         @status_window.visible = true
  263.       end
  264.     end
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● 更新买入选择
  268.   #--------------------------------------------------------------------------
  269.   def update_buy_selection1
  270.     @status_window.item = @buy_window.item
  271.     if Input.trigger?(Input::B)
  272.       Sound.play_cancel
  273.       @command_window2.active = true
  274.       @buy_window.active = false
  275.       @buy_window.visible = false
  276.       @status_window.visible = false
  277.       @status_window.item = nil
  278.       @help_window.set_text("")
  279.       return
  280.     end
  281.     if Input.trigger?(Input::C)
  282.       @item = @buy_window.item
  283.       number = $game_party.item_number(@item)
  284.       if $imported["LimitBreak"] == true
  285.         if @item == nil || @item.price > $game_party.gold ||
  286.           number == @item.number_limit
  287.           Sound.play_buzzer
  288.         else
  289.           Sound.play_decision
  290.           max = (@item.price == 0 ?
  291.           @item.number_limit : $game_party.gold / @item.price)
  292.           max = [max, @item.number_limit - number].min
  293.           @buy_window.active = false
  294.           @buy_window.visible = false
  295.           @number_window.set(@item, max, @item.price)
  296.           @number_window.active = true
  297.           @number_window.visible = true
  298.         end
  299.       else
  300.         if @item == nil or @item.price > $game_party.gold or number == 99
  301.           Sound.play_buzzer
  302.         else
  303.           Sound.play_decision
  304.           max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  305.           max = [max, 99 - number].min
  306.           @buy_window.active = false
  307.           @buy_window.visible = false
  308.           @number_window.set(@item, max, @item.price)
  309.           @number_window.active = true
  310.           @number_window.visible = true
  311.         end
  312.       end
  313.     end
  314.     if Input.trigger?(Input::RIGHT)
  315.       Sound.play_cursor
  316.       next_actor
  317.     elsif Input.trigger?(Input::LEFT)
  318.       Sound.play_cursor
  319.       prev_actor
  320.     end
  321.     if Input.trigger?(Input::X)
  322.       @buy_window.sort_item
  323.     end
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● 切换至下一角色画面
  327.   #--------------------------------------------------------------------------
  328.   def next_actor
  329.     @actor_index += 1
  330.     @actor_index %= $game_party.members.size
  331.     @status_window.actor = ($game_party.members[@actor_index])
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ● 切换至上一角色画面
  335.   #--------------------------------------------------------------------------
  336.   def prev_actor
  337.     @actor_index += $game_party.members.size - 1
  338.     @actor_index %= $game_party.members.size
  339.     @status_window.actor = ($game_party.members[@actor_index])
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ● 更新卖出选择
  343.   #--------------------------------------------------------------------------
  344.   def update_sell_selection
  345.     if Input.trigger?(Input::B)
  346.       Sound.play_cancel
  347.       @command_window.active = true
  348.       @dummy_window.visible = true
  349.       @sell_window.active = false
  350.       @sell_window.visible = false
  351.       @status_window.item = nil
  352.       @help_window.set_text("")
  353.     elsif Input.trigger?(Input::C)
  354.       @item = @sell_window.item
  355.       @status_window.item = @item
  356.       if @item == nil or @item.price == 0
  357.         Sound.play_buzzer
  358.       else
  359.         Sound.play_decision
  360.         max = $game_party.item_number(@item)
  361.         @sell_window.active = false
  362.         @sell_window.visible = false
  363.         @number_window.set(@item, max, @item.price / 2)
  364.         @number_window.active = true
  365.         @number_window.visible = true
  366.         @status_window.visible = true
  367.       end
  368.     end
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● 更新数值输入
  372.   #--------------------------------------------------------------------------
  373.   def update_number_input
  374.     if Input.trigger?(Input::B)
  375.       cancel_number_input
  376.     elsif Input.trigger?(Input::C)
  377.       decide_number_input
  378.     end
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 取消数值输入
  382.   #--------------------------------------------------------------------------
  383.   def cancel_number_input
  384.     Sound.play_cancel
  385.     @number_window.active = false
  386.     @number_window.visible = false
  387.     case @command_window.index
  388.     when 0  # 买入
  389.       @buy_window.active = true
  390.       @buy_window.visible = true
  391.     when 1  # 卖出
  392.       @sell_window.active = true
  393.       @sell_window.visible = true
  394.       @status_window.visible = false
  395.     end
  396.   end
  397.   #--------------------------------------------------------------------------
  398.   # ● 确认数值输入
  399.   #--------------------------------------------------------------------------
  400.   def decide_number_input
  401.     Sound.play_shop
  402.     @number_window.active = false
  403.     @number_window.visible = false
  404.     case @command_window.index
  405.     when 0  # 买入
  406.       $game_party.lose_gold(@number_window.number * @item.price)
  407.       $game_party.gain_item(@item, @number_window.number)
  408.       @gold_window.refresh
  409.       @buy_window.refresh
  410.       @status_window.refresh
  411.       @buy_window.active = true
  412.       @buy_window.visible = true
  413.     when 1  # 卖出
  414.       $game_party.gain_gold(@number_window.number * (@item.price / 2))
  415.       $game_party.lose_item(@item, @number_window.number)
  416.       @gold_window.refresh
  417.       @sell_window.refresh
  418.       @status_window.refresh
  419.       @sell_window.active = true
  420.       @sell_window.visible = true
  421.       @status_window.visible = false
  422.     end
  423.   end
  424. end
  425. #==============================================================================
  426. # ■ Window_Shop_ActorStatus
  427. #------------------------------------------------------------------------------
  428. #  显示角色的状态窗口。
  429. #==============================================================================

  430. class Window_Shop_ActorStatus < Window_Base
  431.   #--------------------------------------------------------------------------
  432.   # ● 初始化对像
  433.   #     actor : 角色
  434.   #--------------------------------------------------------------------------
  435.   def initialize(actor, item = nil, sort = 0)
  436.     super(304, 112, 240, 304)
  437.     @item = item
  438.     @actor = actor
  439.     @sort = sort
  440.     refresh
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● 刷新
  444.   #--------------------------------------------------------------------------
  445.   def refresh
  446.     self.contents.clear
  447.     draw_Shopface(@actor.face_name, @actor.face_index, 84, 4)
  448.     draw_actor_name(@actor, 4, 0)
  449.     draw_actor_graphic(@actor, 192, 56)
  450.    
  451.     if @item != nil
  452.       draw_actor_parameter_change(@actor, 4, 96)
  453.       number = $game_party.item_number(@item)
  454.       self.contents.font.color = system_color
  455.       self.contents.draw_text(4, WLH * 10, 200, WLH, Vocab::Possession)
  456.       self.contents.font.color = normal_color
  457.       self.contents.draw_text(4, WLH * 10, 200, WLH, number, 2)
  458.       if @item.is_a?(RPG::Item) && @item.scope > 0
  459.         draw_item_parameter_change(4, 48)
  460.       elsif @item.is_a?(RPG::Item)
  461.         self.contents.font.color = system_color
  462.         self.contents.draw_text(0, y + 24, 200, WLH, FSL::SHOP::Shop_help2, 1)
  463.       end
  464.     end
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ● 绘制物品效果
  468.   #     x     : 绘制点 X 座标
  469.   #     y     : 绘制点 Y 座标
  470.   #--------------------------------------------------------------------------
  471.   def draw_item_parameter_change(x, y)
  472.     if @item.scope > 6
  473.       draw_actor_hp(@actor, x, y)
  474.       draw_actor_mp(@actor, x, y + 24)
  475.       self.contents.font.color = system_color
  476.       self.contents.draw_text(x, y + WLH * 2, 200, WLH, "hp mp 回复值/率", 2)
  477.          
  478.       self.contents.font.color = hp_gauge_color1
  479.       self.contents.draw_text(x - 10, y + WLH * 3, 104, WLH, sprintf("%d", @item.hp_recovery), 2)
  480.       self.contents.draw_text(x, y + WLH * 4, 104, WLH, sprintf("%d", @item.hp_recovery_rate)+"%", 2)
  481.       
  482.       self.contents.font.color = mp_gauge_color1
  483.       self.contents.draw_text(x - 10, y + WLH * 3, 200, WLH, sprintf("%d", @item.mp_recovery), 2)
  484.       self.contents.draw_text(x, y + WLH * 4, 200, WLH, sprintf("%d", @item.mp_recovery_rate)+"%", 2)
  485.       
  486.       if @item.parameter_type > 0
  487.         self.contents.font.color = system_color
  488.         self.contents.draw_text(x, y + WLH * 7, 200, WLH, "增加能力")
  489.         self.contents.font.color = normal_color
  490.         case @item.parameter_type
  491.         when 1
  492.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "HP", 1)
  493.         when 2
  494.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "MP", 1)
  495.         when 3
  496.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "ATK", 1)
  497.         when 4
  498.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "DEF", 1)
  499.         when 5
  500.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "SPI", 1)
  501.         when 6
  502.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "AGI", 1)
  503.         end
  504.         self.contents.draw_text(x, y + WLH * 7, 200, WLH, sprintf("%d", @item.parameter_points), 2)
  505.       else
  506.         self.contents.font.color = text_color(7)
  507.         self.contents.draw_text(x, y + WLH * 7, 200, WLH, "增加能力")
  508.       end
  509.     else
  510.       self.contents.font.color = normal_color
  511.       draw_actor_parameter(@actor, x, y, 0)
  512.       draw_actor_parameter(@actor, x, y + 24, 2)
  513.       
  514.       self.contents.font.color = system_color
  515.       self.contents.draw_text(x, y + WLH * 2, 240, WLH, "伤害值 力量/精神影响")
  516.       
  517.       self.contents.font.color = normal_color
  518.       self.contents.draw_text(x, y + WLH * 3, 104, WLH, sprintf("%d", @item.base_damage))
  519.       
  520.       self.contents.font.color = hp_gauge_color1
  521.       self.contents.draw_text(x, y + WLH * 4, 104, WLH, sprintf("%d", @item.atk_f), 2)
  522.       
  523.       self.contents.font.color = mp_gauge_color1
  524.       self.contents.draw_text(x, y + WLH * 4, 200, WLH, sprintf("%d", @item.spi_f), 2)
  525.     end

  526.     self.contents.font.color = system_color
  527.     if @item.plus_state_set.size == 0
  528.       self.contents.font.color = text_color(7)
  529.     end
  530.     self.contents.draw_text(x, y + WLH * 5, 200, WLH, "增益")
  531.     self.contents.font.color = system_color
  532.     if @item.minus_state_set.size == 0
  533.       self.contents.font.color = text_color(7)
  534.     end
  535.     self.contents.draw_text(x, y + WLH * 6, 200, WLH, "削减")
  536.     m = 48
  537.     for i in @item.plus_state_set
  538.       draw_icon($data_states[i].icon_index, x + m, y + WLH * 5)
  539.       break if m == 168
  540.       m += 24
  541.     end
  542.     m = 48
  543.     for i in @item.minus_state_set
  544.       draw_icon($data_states[i].icon_index, x + m, y + WLH * 6)
  545.       break if m == 168
  546.       m += 24
  547.     end
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # ● 绘制角色当前装备和能力值
  551.   #     actor : 角色
  552.   #     x     : 绘制点 X 座标
  553.   #     y     : 绘制点 Y 座标
  554.   #--------------------------------------------------------------------------
  555.   def draw_actor_parameter_change(actor, x, y)
  556.     return if @item.is_a?(RPG::Item)
  557.     enabled = actor.equippable?(@item)
  558.     if @item.is_a?(RPG::Weapon)
  559.       item1 = weaker_weapon(actor)
  560.     elsif actor.two_swords_style and @item.kind == 0
  561.       item1 = nil
  562.     else
  563.       if $imported["EquipExtension"] == true
  564.         index = actor.equip_type.index(@item.kind)
  565.         item1 = (index != nil ? actor.equips[1 + index] : nil)
  566.       else
  567.         item1 = actor.equips[1 + @item.kind]
  568.       end
  569.     end
  570.    
  571.     if enabled
  572.       
  573.       atk1 = item1 == nil ? 0 : item1.atk
  574.       atk2 = @item == nil ? 0 : @item.atk
  575.       change = atk2 - atk1
  576.       shop_change(change)
  577.       if change > 0
  578.         draw_icon(FSL::SHOP::Shop_icon[0], 108, y + WLH)
  579.       elsif  change < 0
  580.         draw_icon(FSL::SHOP::Shop_icon[4], 108, y + WLH)
  581.       else
  582.         draw_icon(FSL::SHOP::Shop_icon[8], 108, y + WLH)
  583.       end
  584.       self.contents.draw_text(x, y + WLH, 200, WLH, sprintf("%d", atk2), 2)
  585.       
  586.       def1 = item1 == nil ? 0 : item1.def
  587.       def2 = @item == nil ? 0 : @item.def
  588.       change = def2 - def1
  589.       shop_change(change)
  590.       if change > 0
  591.         draw_icon(FSL::SHOP::Shop_icon[1], 108, y + WLH * 2)
  592.       elsif  change < 0
  593.         draw_icon(FSL::SHOP::Shop_icon[5], 108, y + WLH * 2)
  594.       else
  595.         draw_icon(FSL::SHOP::Shop_icon[9], 108, y + WLH)
  596.       end
  597.       self.contents.draw_text(x, y + WLH * 2, 200, WLH, sprintf("%d", def2), 2)
  598.       
  599.       spi1 = item1 == nil ? 0 : item1.spi
  600.       spi2 = @item == nil ? 0 : @item.spi
  601.       change = spi2 - spi1
  602.       shop_change(change)
  603.       if change > 0
  604.         draw_icon(FSL::SHOP::Shop_icon[2], 108, y + WLH * 3)
  605.       elsif  change < 0
  606.         draw_icon(FSL::SHOP::Shop_icon[6], 108, y + WLH * 3)
  607.       else
  608.         draw_icon(FSL::SHOP::Shop_icon[10], 108, y + WLH)
  609.       end
  610.       self.contents.draw_text(x, y + WLH * 3, 200, WLH, sprintf("%d", spi2), 2)
  611.       
  612.       agi1 = item1 == nil ? 0 : item1.agi
  613.       agi2 = @item == nil ? 0 : @item.agi
  614.       change = agi2 - agi1
  615.       shop_change(change)
  616.       if change > 0
  617.         draw_icon(FSL::SHOP::Shop_icon[3], 108, y + WLH * 4)
  618.       elsif  change < 0
  619.         draw_icon(FSL::SHOP::Shop_icon[7], 108, y + WLH * 4)
  620.       else
  621.         draw_icon(FSL::SHOP::Shop_icon[11], 108, y + WLH)
  622.       end
  623.       self.contents.draw_text(x, y + WLH * 4, 200, WLH, sprintf("%d", agi2), 2)
  624.       
  625.       self.contents.font.color = system_color
  626.       self.contents.draw_text(4, y - 32, 204, WLH, "当前装备")
  627.       
  628.       self.contents.draw_text(x + 32, y + WLH, 200, WLH, sprintf("%d", atk1))
  629.       self.contents.draw_text(x + 32, y + WLH * 2, 200, WLH, sprintf("%d", def1))
  630.       self.contents.draw_text(x + 32, y + WLH * 3, 200, WLH, sprintf("%d", spi1))
  631.       self.contents.draw_text(x + 32, y + WLH * 4, 200, WLH, sprintf("%d", agi1))
  632.       
  633.       self.contents.draw_text(0, y + WLH, 200, WLH, "ATK")
  634.       self.contents.draw_text(0, y + WLH * 2, 200, WLH, "DEF")
  635.       self.contents.draw_text(0, y + WLH * 3, 200, WLH, "SPI")
  636.       self.contents.draw_text(0, y + WLH * 4, 200, WLH, "AGI")
  637.       
  638.       if item1 != nil
  639.         self.contents.draw_text(24, y, 208, WLH, item1.name)
  640.         draw_icon(item1.icon_index, 0, y)
  641.       else
  642.         self.contents.draw_text(24, y, 208, WLH, "无")
  643.       end
  644.     else
  645.       self.contents.font.color = normal_color
  646.       self.contents.draw_text(0, y + 24, 200, WLH, FSL::SHOP::Shop_help, 1)
  647.     end
  648.   end
  649.   #--------------------------------------------------------------------------
  650.   # ● 判断数值颜色
  651.   #     change : 数值
  652.   #--------------------------------------------------------------------------
  653.   def shop_change(change)
  654.     if change == 0
  655.       self.contents.font.color = normal_color
  656.     else
  657.       self.contents.font.color = change>0 ? power_up_color : power_down_color
  658.     end
  659.   end
  660.   #--------------------------------------------------------------------------
  661.   # ● 获取双刀派角色所装备的武器中较弱的武器
  662.   #     actor : 角色
  663.   #--------------------------------------------------------------------------
  664.   def weaker_weapon(actor)
  665.     if actor.two_swords_style
  666.       weapon1 = actor.weapons[0]
  667.       weapon2 = actor.weapons[1]
  668.       if weapon1 == nil or weapon2 == nil
  669.         return nil
  670.       elsif weapon1.atk < weapon2.atk
  671.         return weapon1
  672.       else
  673.         return weapon2
  674.       end
  675.     else
  676.       return actor.weapons[0]
  677.     end
  678.   end
  679.   #--------------------------------------------------------------------------
  680.   # ● 设置角色
  681.   #     actor : 角色
  682.   #--------------------------------------------------------------------------
  683.   def actor=(actor)
  684.     if @actor != actor
  685.       @actor = actor
  686.       refresh
  687.     end
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # ● 设置物品
  691.   #     item : 新物品
  692.   #--------------------------------------------------------------------------
  693.   def item=(item)
  694.     if @item != item
  695.       @item = item
  696.       refresh
  697.     end
  698.   end
  699.   #--------------------------------------------------------------------------
  700.   # ● 绘制头像部分图
  701.   #     face_name  : 头像文件名
  702.   #     face_index : 头像号码
  703.   #     x     : 描画目标 X 坐标
  704.   #     y     : 描画目标 Y 坐标
  705.   #     size       : 显示大小
  706.   #--------------------------------------------------------------------------
  707.   def draw_Shopface(face_name, face_index, x, y, size = 96)
  708.     bitmap = Cache.face(face_name)
  709.     rect = Rect.new(0, 0, 0, 0)
  710.     rect.x = face_index % 4 * 96 + (96 - size) / 2
  711.     rect.y = face_index / 4 * 96 + (96 - size) / 2 + size / 4
  712.     rect.width = size
  713.     rect.height = size / 2
  714.     self.contents.blt(x, y, bitmap, rect)
  715.     bitmap.dispose
  716.   end
  717. end
  718. #==============================================================================
  719. # ■ Window_ShopBuy2
  720. #------------------------------------------------------------------------------
  721. #  商店画面、浏览显示可以购买的商品的窗口。
  722. #==============================================================================

  723. class Window_ShopBuy2 < Window_Selectable
  724.   #--------------------------------------------------------------------------
  725.   # ● 初始化对像
  726.   #     x      : 窗口 X 座标
  727.   #     y      : 窗口 Y 座标
  728.   #--------------------------------------------------------------------------
  729.   def initialize(x, y)
  730.     super(x, y, 304, 248)
  731.     @shop_goods = $game_temp.shop_goods
  732.     @type = 0
  733.     @sort = 0
  734.     refresh
  735.     self.index = 0
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # ● 商品类型
  739.   #--------------------------------------------------------------------------
  740.   def type=(type)
  741.     if @type != type
  742.       @type = type
  743.       refresh
  744.     end
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # ● 获取商品
  748.   #--------------------------------------------------------------------------
  749.   def item
  750.     if @type == 0
  751.       return @data1[self.index]
  752.     elsif @type == 1
  753.       return @data2[self.index]
  754.     else
  755.       return @data3[self.index]
  756.     end
  757.   end
  758.   #--------------------------------------------------------------------------
  759.   # ● 刷新
  760.   #--------------------------------------------------------------------------
  761.   def refresh
  762.     @data1 = []
  763.     @data2 = []
  764.     @data3 = []
  765.     for goods_item in @shop_goods
  766.       case goods_item[0]
  767.       when 0
  768.         item = $data_items[goods_item[1]]
  769.         if item != nil
  770.           @data1.push(item)
  771.         end
  772.       when 1
  773.         item = $data_weapons[goods_item[1]]
  774.         if item != nil
  775.           @data2.push(item)
  776.         end
  777.       when 2
  778.         item = $data_armors[goods_item[1]]
  779.         if item != nil
  780.           @data3.push(item)
  781.         end
  782.       end
  783.     end
  784.     for i in [email][email protected][/email]
  785.       for j in [email][email protected][/email]
  786.         if @data2[i].atk < @data2[j].atk
  787.           m = @data2[i]
  788.           @data2[i] = @data2[j]
  789.           @data2[j] = m
  790.         end
  791.       end
  792.     end
  793.     for i in [email][email protected][/email]
  794.       for j in [email][email protected][/email]
  795.         if @data3[i].atk < @data3[j].atk
  796.           m = @data3[i]
  797.           @data3[i] = @data3[j]
  798.           @data3[j] = m
  799.         end
  800.       end
  801.     end
  802.     @sort = 1
  803.     if    @type == 0
  804.       @item_max = @data1.size
  805.     elsif @type == 1
  806.       @item_max = @data2.size
  807.     else
  808.       @item_max = @data3.size
  809.     end
  810.    
  811.     create_contents
  812.     for i in 0...@item_max
  813.       draw_item1(i)
  814.     end
  815.   end
  816.   #--------------------------------------------------------------------------
  817.   # ● 绘制商品
  818.   #     index : 商品索引
  819.   #--------------------------------------------------------------------------
  820.   def draw_item1(index)
  821.     if    @type == 0
  822.       item = @data1[index]
  823.     elsif @type == 1
  824.       item = @data2[index]
  825.     else
  826.       item = @data3[index]
  827.     end
  828.     number = $game_party.item_number(item)
  829.     if $imported["LimitBreak"] == true
  830.       enabled = (item.price <= $game_party.gold && number < item.number_limit)
  831.     else
  832.       enabled = (item.price <= $game_party.gold and number < 99)
  833.     end
  834.     rect = item_rect(index)
  835.     self.contents.clear_rect(rect)
  836.     draw_item_name(item, rect.x, rect.y, enabled)
  837.     rect.width -= 4
  838.     self.contents.draw_text(rect, item.price, 2)
  839.   end
  840.   #--------------------------------------------------------------------------
  841.   # ● 顺位排序
  842.   #--------------------------------------------------------------------------
  843.   def sort_item
  844.     case @sort
  845.     when 0
  846.       for i in [email][email protected][/email]
  847.         for j in [email][email protected][/email]
  848.           if @data2[i].atk < @data2[j].atk
  849.             m = @data2[i]
  850.             @data2[i] = @data2[j]
  851.             @data2[j] = m
  852.           end
  853.         end
  854.       end
  855.       for i in [email][email protected][/email]
  856.         for j in [email][email protected][/email]
  857.           if @data3[i].atk < @data3[j].atk
  858.             m = @data3[i]
  859.             @data3[i] = @data3[j]
  860.             @data3[j] = m
  861.           end
  862.         end
  863.       end
  864.       @sort = 1
  865.     when 1
  866.       for i in [email][email protected][/email]
  867.         for j in [email][email protected][/email]
  868.           if @data2[i].def < @data2[j].def
  869.             m = @data2[i]
  870.             @data2[i] = @data2[j]
  871.             @data2[j] = m
  872.           end
  873.         end
  874.       end
  875.       for i in [email][email protected][/email]
  876.         for j in [email][email protected][/email]
  877.           if @data3[i].def < @data3[j].def
  878.             m = @data3[i]
  879.             @data3[i] = @data3[j]
  880.             @data3[j] = m
  881.           end
  882.         end
  883.       end
  884.       @sort = 2
  885.     when 2
  886.       for i in [email][email protected][/email]
  887.         for j in [email][email protected][/email]
  888.           if @data2[i].spi < @data2[j].spi
  889.             m = @data2[i]
  890.             @data2[i] = @data2[j]
  891.             @data2[j] = m
  892.           end
  893.         end
  894.       end
  895.       for i in [email][email protected][/email]
  896.         for j in [email][email protected][/email]
  897.           if @data3[i].spi < @data3[j].spi
  898.             m = @data3[i]
  899.             @data3[i] = @data3[j]
  900.             @data3[j] = m
  901.           end
  902.         end
  903.       end
  904.       @sort = 3
  905.     when 3
  906.       for i in [email][email protected][/email]
  907.         for j in [email][email protected][/email]
  908.           if @data2[i].agi < @data2[j].agi
  909.             m = @data2[i]
  910.             @data2[i] = @data2[j]
  911.             @data2[j] = m
  912.           end
  913.         end
  914.       end
  915.       for i in [email][email protected][/email]
  916.         for j in [email][email protected][/email]
  917.           if @data3[i].agi < @data3[j].agi
  918.             m = @data3[i]
  919.             @data3[i] = @data3[j]
  920.             @data3[j] = m
  921.           end
  922.         end
  923.       end
  924.       @sort = 0
  925.     end
  926.     if    @type == 0
  927.       @item_max = @data1.size
  928.     elsif @type == 1
  929.       @item_max = @data2.size
  930.     else
  931.       @item_max = @data3.size
  932.     end
  933.    
  934.     create_contents
  935.     for i in 0...@item_max
  936.       draw_item1(i)
  937.     end
  938.   end
  939.   #--------------------------------------------------------------------------
  940.   # ● 更新帮助窗口文字
  941.   #--------------------------------------------------------------------------
  942.   def update_help
  943.     @help_window.set_text(item == nil ? "" : item.description)
  944.   end
  945. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
 楼主| 发表于 2015-6-22 23:14:22 | 显示全部楼层
本帖最后由 怪蜀黍 于 2015-6-23 20:57 编辑
  1. (技能分类脚本  老规矩           来源:绿坝娘大冒险)
  2. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  3. #_/    ◆ スキル分類 - KGC_CategorizeSkill ◆ VX ◆
  4. #_/    ◇ Last update : 2008/06/13 ◇
  5. #_/----------------------------------------------------------------------------
  6. #_/  スキルを種類別に分類する機能を作成します。
  7. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  8. $data_system = load_data("Data/System.rvdata") if $data_system == nil

  9. #==============================================================================
  10. # ★ カスタマイズ項目 - Customize ★
  11. #==============================================================================

  12. module KGC
  13. module CategorizeSkill
  14.   # ◆ 非戦闘時に分類する
  15.   ENABLE_NOT_IN_BATTLE = true
  16.   # ◆ 戦闘時に分類する
  17.   ENABLE_IN_BATTLE     = true

  18.   # ◆ 戦闘時と非戦闘時で同じカテゴリを使用する
  19.   #  分類ウィンドウの設定は個別に行ってください。
  20.   USE_SAME_CATEGORY = true

  21.   # ◆ 自動振り分けを行う
  22.   ENABLE_AUTO_CATEGORIZE = true
  23.   # ◆ 複数のカテゴリには配置しない
  24.   #  true  : いずれか1つのカテゴリにしか振り分けない (「全種」は例外)
  25.   #  false : 該当するカテゴリすべてに振り分ける
  26.   NOT_ALLOW_DUPLICATE = false

  27.   # ◆ 戦闘中に選択したスキルの位置を記憶する
  28.   REMEMBER_INDEX_IN_BATTLE = true


  29.   # ━━━━━━━━ 非戦闘時 カテゴリ ━━━━━━━━

  30.   # ◆ カテゴリ識別名
  31.   #  メモ欄でカテゴリを識別するための名称を並べてください。
  32.   #  以下の名称は、メモ欄に記述する必要はありません。
  33.   #   "全種", "回復", "回復魔法", "回復技", "攻撃", "攻撃魔法", "攻撃技",
  34.   #   "補助", "補助魔法", "補助技"
  35.   CATEGORY_IDENTIFIER = [
  36.     "回復",
  37.     "攻撃魔法",
  38.     "攻撃技",
  39.     "補助",
  40.     "特殊スキル",
  41.     "全種",  # ← 最後の項目だけは , を付けても付けなくてもOK
  42.   ]
  43.   # ◆ スキルのデフォルトカテゴリ
  44.   #  どのカテゴリにも当てはまらないスキルの割り当て先です。
  45.   SKILL_DEFAULT_CATEGORY = "特殊スキル"

  46.   # ◆ リストに表示する名称
  47.   #  スキル画面で分類ウィンドウに表示する名称です。
  48.   #  「カテゴリ識別名」と同じ順に並べてください。
  49.   CATEGORY_NAME = [
  50.     "回复",
  51.     "特殊攻击",
  52.     "实体攻击",
  53.     "辅助",
  54.     "被动技能",
  55.     "全部",
  56.   ]

  57.   # ◆ 分類の説明文
  58.   #  「分類識別名」と同じ順に並べてください。
  59.   CATEGORY_DESCRIPTION = [
  60.     "回复类",
  61.     "特殊攻击类",
  62.     "实体攻击类",
  63.     "辅助类",
  64.     "被动技能",
  65.     "全部",
  66.   ]


  67.   # ━━━━━━━━ 戦闘時 カテゴリ ━━━━━━━━
  68.   # USE_SAME_CATEGORY = false  の場合のみ有効になります。
  69.   # 設定方法は非戦闘時と同様です。

  70.   # ◆ カテゴリ識別名
  71.   CATEGORY_IDENTIFIER_BATTLE = [
  72.     "回復",
  73.     "攻撃魔法",
  74.     "攻撃技",
  75.     "補助",
  76.     "特殊スキル",
  77.     "全種",
  78.   ]
  79.   # ◆ スキルのデフォルトカテゴリ
  80.   SKILL_DEFAULT_CATEGORY_BATTLE = "特殊スキル"

  81.   # ◆ リストに表示する名称
  82.   CATEGORY_NAME_BATTLE = [
  83.     "回复",
  84.     "特殊攻击",
  85.     "实体攻击",
  86.     "辅助",
  87.     "被动技能",
  88.     "全部",
  89.   ]

  90.   # ◆ 分類の説明文
  91.   CATEGORY_DESCRIPTION_BATTLE = [
  92.     "回复类",
  93.     "特殊攻击类",
  94.     "实体攻击类",
  95.     "辅助类",
  96.     "被动技能",
  97.     "全部",
  98.   ]

  99.   if USE_SAME_CATEGORY
  100.     # 非戦闘時の設定を流用
  101.     CATEGORY_IDENTIFIER_BATTLE    = CATEGORY_IDENTIFIER
  102.     SKILL_DEFAULT_CATEGORY_BATTLE = SKILL_DEFAULT_CATEGORY
  103.     CATEGORY_NAME_BATTLE          = CATEGORY_NAME
  104.     CATEGORY_DESCRIPTION_BATTLE   = CATEGORY_DESCRIPTION
  105.   end


  106.   # ━━━━━━━━ 非戦闘時 分類ウィンドウ ━━━━━━━━

  107.   # ◆ 分類ウィンドウの座標 [x, y]
  108.   CATEGORY_WINDOW_POSITION  = [264, 192]
  109.   # ◆ 分類ウィンドウの列数
  110.   CATEGORY_WINDOW_COLUMNS   = 2
  111.   # ◆ 分類ウィンドウの列幅
  112.   CATEGORY_WINDOW_COL_WIDTH = 96
  113.   # ◆ 分類ウィンドウの列間の空白
  114.   CATEGORY_WINDOW_COL_SPACE = 32


  115.   # ━━━━━━━━ 戦闘時 分類ウィンドウ ━━━━━━━━

  116.   # ◆ 分類ウィンドウの座標 [x, y]
  117.   CATEGORY_WINDOW_POSITION_BATTLE  = [264, 128]
  118.   # ◆ 分類ウィンドウの列数
  119.   CATEGORY_WINDOW_COLUMNS_BATTLE   = 2
  120.   # ◆ 分類ウィンドウの列幅
  121.   CATEGORY_WINDOW_COL_WIDTH_BATTLE = 96
  122.   # ◆ 分類ウィンドウの列間の空白
  123.   CATEGORY_WINDOW_COL_SPACE_BATTLE = 32
  124. end
  125. end

  126. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  127. $imported = {} if $imported == nil
  128. $imported["CategorizeSkill"] = true

  129. module KGC::CategorizeSkill
  130.   # スキルのデフォルトカテゴリ index
  131.   SKILL_DEFAULT_CATEGORY_INDEX =
  132.     CATEGORY_IDENTIFIER.index(SKILL_DEFAULT_CATEGORY)
  133.   # スキルのデフォルトカテゴリ index (戦闘時)
  134.   SKILL_DEFAULT_CATEGORY_INDEX_BATTLE =
  135.     CATEGORY_IDENTIFIER_BATTLE.index(SKILL_DEFAULT_CATEGORY_BATTLE)

  136.   # 予約識別名
  137.   RESERVED_CATEGORIES = [
  138.     "全種", "回復", "回復魔法", "回復技", "攻撃", "攻撃魔法", "攻撃技",
  139.     "補助", "補助魔法", "補助技"
  140.   ]
  141.   # 予約カテゴリ index
  142.   RESERVED_CATEGORY_INDEX = {}
  143.   # 予約カテゴリ index (戦闘時)
  144.   RESERVED_CATEGORY_INDEX_BATTLE = {}

  145.   # 予約カテゴリ index 作成
  146.   RESERVED_CATEGORIES.each { |c|
  147.     RESERVED_CATEGORY_INDEX[c] = CATEGORY_IDENTIFIER.index(c)
  148.     RESERVED_CATEGORY_INDEX_BATTLE[c] = CATEGORY_IDENTIFIER_BATTLE.index(c)
  149.   }

  150.   # 正規表現を定義
  151.   module Regexp
  152.     # スキル
  153.     module Skill
  154.       # カテゴリ
  155.       CATEGORY = /<(?:CATEGORY|分類|カテゴリー?)\s*(.*)>/i
  156.     end
  157.   end
  158. end

  159. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  160. #==============================================================================
  161. # ■ RPG::Skill
  162. #==============================================================================

  163. class RPG::Skill < RPG::UsableItem
  164.   #--------------------------------------------------------------------------
  165.   # ○ スキル分類のキャッシュ生成 (非戦闘時)
  166.   #--------------------------------------------------------------------------
  167.   def create_categorize_skill_cache
  168.     @__skill_category = []

  169.     # 自動振り分け
  170.     if KGC::CategorizeSkill::ENABLE_AUTO_CATEGORIZE
  171.       prefix = auto_categorize_prefix
  172.       if prefix != nil
  173.         suffix = auto_categorize_suffix
  174.         @__skill_category <<
  175.           KGC::CategorizeSkill::RESERVED_CATEGORY_INDEX[prefix]
  176.         @__skill_category <<
  177.           KGC::CategorizeSkill::RESERVED_CATEGORY_INDEX[prefix + suffix]
  178.       end
  179.       @__skill_category.compact!
  180.     end

  181.     # メモ欄
  182.     self.note.split(/[\r\n]+/).each { |line|
  183.       if line =~ KGC::CategorizeSkill::Regexp::Skill::CATEGORY
  184.         # カテゴリ
  185.         c = KGC::CategorizeSkill::CATEGORY_IDENTIFIER.index($1)
  186.         @__skill_category << c if c != nil
  187.       end
  188.     }

  189.     if @__skill_category.empty?
  190.       @__skill_category << KGC::CategorizeSkill::SKILL_DEFAULT_CATEGORY_INDEX
  191.     elsif KGC::CategorizeSkill::NOT_ALLOW_DUPLICATE
  192.       # 最後に指定したカテゴリに配置
  193.       @__skill_category = [@__skill_category.pop]
  194.     end
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ○ スキル分類のキャッシュ生成 (戦闘時)
  198.   #--------------------------------------------------------------------------
  199.   def create_categorize_skill_battle_cache
  200.     @__skill_category_battle = []

  201.     # 自動振り分け
  202.     if KGC::CategorizeSkill::ENABLE_AUTO_CATEGORIZE
  203.       prefix = auto_categorize_prefix
  204.       if prefix != nil
  205.         suffix = auto_categorize_suffix
  206.         @__skill_category_battle <<
  207.           KGC::CategorizeSkill::RESERVED_CATEGORY_INDEX_BATTLE[prefix]
  208.         @__skill_category_battle <<
  209.           KGC::CategorizeSkill::RESERVED_CATEGORY_INDEX_BATTLE[prefix + suffix]
  210.       end
  211.       @__skill_category_battle.compact!
  212.     end

  213.     # メモ欄
  214.     self.note.split(/[\r\n]+/).each { |line|
  215.       if line =~ KGC::CategorizeSkill::Regexp::Skill::CATEGORY
  216.         # カテゴリ
  217.         c = KGC::CategorizeSkill::CATEGORY_IDENTIFIER_BATTLE.index($1)
  218.         @__skill_category_battle << c if c != nil
  219.       end
  220.     }

  221.     if @__skill_category_battle.empty?
  222.       @__skill_category_battle <<
  223.         KGC::CategorizeSkill::SKILL_DEFAULT_CATEGORY_INDEX_BATTLE
  224.     elsif KGC::CategorizeSkill::NOT_ALLOW_DUPLICATE
  225.       # 最後に指定したカテゴリに配置
  226.       @__skill_category_battle = [@__skill_category_battle.pop]
  227.     end
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ○ 自動振り分け先の接頭辞
  231.   #--------------------------------------------------------------------------
  232.   def auto_categorize_prefix
  233.     if is_recover?
  234.       return "回復"
  235.     elsif is_attack?
  236.       return "攻撃"
  237.     elsif is_assist?
  238.       return "補助"
  239.     else
  240.       return nil
  241.     end
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ○ 自動振り分け先の接尾辞
  245.   #--------------------------------------------------------------------------
  246.   def auto_categorize_suffix
  247.     return (physical_attack ? "技" : "魔法")
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ○ 回復スキル判定
  251.   #--------------------------------------------------------------------------
  252.   def is_recover?
  253.     result = for_friend?            # 対象が味方
  254.     result &= (occasion != 3)       # 使用不可でない
  255.     result &= (base_damage < 0) ||  # ダメージ量が負、または
  256.       (plus_state_set.empty? &&     # ステートを付加せずに解除する
  257.        !minus_state_set.empty?)
  258.     return result
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # ○ 攻撃スキル判定
  262.   #--------------------------------------------------------------------------
  263.   def is_attack?
  264.     result = for_opponent?       # 対象が敵
  265.     result &= battle_ok?         # 戦闘中に使用可能
  266.     result &= (base_damage > 0)  # ダメージ量が正
  267.     return result
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ○ 補助スキル判定
  271.   #--------------------------------------------------------------------------
  272.   def is_assist?
  273.     result = (scope != 0)                 # 対象が [なし] 以外
  274.     result &= battle_ok?                  # 戦闘中に使用可能
  275.     result &= !(plus_state_set.empty? &&
  276.       minus_state_set.empty?)             # ステートが変化する
  277.     return result
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # ○ スキルのカテゴリ (非戦闘時)
  281.   #--------------------------------------------------------------------------
  282.   def skill_category
  283.     create_categorize_skill_cache if @__skill_category == nil
  284.     return @__skill_category
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ○ スキルのカテゴリ (戦闘時)
  288.   #--------------------------------------------------------------------------
  289.   def skill_category_battle
  290.     create_categorize_skill_battle_cache if @__skill_category_battle == nil
  291.     return @__skill_category_battle
  292.   end
  293. end

  294. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  295. #==============================================================================
  296. # ■ Game_Actor
  297. #==============================================================================

  298. class Game_Actor < Game_Battler
  299.   #--------------------------------------------------------------------------
  300.   # ● 公開インスタンス変数
  301.   #--------------------------------------------------------------------------
  302.   attr_writer   :last_skill_category      # カーソル記憶用 : スキルカテゴリ
  303.   #--------------------------------------------------------------------------
  304.   # ● オブジェクト初期化
  305.   #     actor_id : アクター ID
  306.   #--------------------------------------------------------------------------
  307.   alias initialize_KGC_CategorizeSkill initialize
  308.   def initialize(actor_id)
  309.     initialize_KGC_CategorizeSkill(actor_id)

  310.     @last_skill_category = 0
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ○ カーソル記憶用のカテゴリ取得
  314.   #--------------------------------------------------------------------------
  315.   def last_skill_category
  316.     @last_skill_category = 0 if @last_skill_category == nil
  317.     return @last_skill_category
  318.   end
  319. end

  320. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  321. #==============================================================================
  322. # ■ Window_Skill
  323. #==============================================================================

  324. class Window_Skill < Window_Selectable
  325.   #--------------------------------------------------------------------------
  326.   # ● 公開インスタンス変数
  327.   #--------------------------------------------------------------------------
  328.   attr_reader   :category                 # カテゴリ
  329.   #--------------------------------------------------------------------------
  330.   # ● オブジェクト初期化
  331.   #     x      : ウィンドウの X 座標
  332.   #     y      : ウィンドウの Y 座標
  333.   #     width  : ウィンドウの幅
  334.   #     height : ウィンドウの高さ
  335.   #     actor  : アクター
  336.   #--------------------------------------------------------------------------
  337.   alias initialize_KGC_CategorizeSkill initialize
  338.   def initialize(x, y, width, height, actor)
  339.     @category = 0

  340.     initialize_KGC_CategorizeSkill(x, y, width, height, actor)
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # ○ カテゴリ設定
  344.   #--------------------------------------------------------------------------
  345.   def category=(value)
  346.     @category = value
  347.     refresh
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # ○ スキルをリストに含めるかどうか
  351.   #     skill : スキル
  352.   #--------------------------------------------------------------------------
  353.   unless $@
  354.     alias include_KGC_CategorizeSkill? include? if method_defined?(:include?)
  355.   end
  356.   def include?(skill)
  357.     return false if skill == nil

  358.     if defined?(include_KGC_CategorizeSkill?)
  359.       return false unless include_KGC_CategorizeSkill?(skill)
  360.     end

  361.     # 分類しない場合は含める
  362.     if $game_temp.in_battle
  363.       return true unless KGC::CategorizeSkill::ENABLE_IN_BATTLE
  364.       reserved_index = KGC::CategorizeSkill::RESERVED_CATEGORY_INDEX_BATTLE
  365.       skill_category = skill.skill_category_battle
  366.     else
  367.       return true unless KGC::CategorizeSkill::ENABLE_NOT_IN_BATTLE
  368.       reserved_index = KGC::CategorizeSkill::RESERVED_CATEGORY_INDEX
  369.       skill_category = skill.skill_category
  370.     end
  371.     # 「全種」なら含める
  372.     return true if @category == reserved_index["全種"]
  373.     # カテゴリ一致判定
  374.     return (skill_category.include?(@category))
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● リフレッシュ
  378.   #--------------------------------------------------------------------------
  379.   def refresh
  380.     @data = []
  381.     for skill in @actor.skills
  382.       next unless include?(skill)
  383.       @data.push(skill)
  384.       if skill.id == @actor.last_skill_id
  385.         self.index = @data.size - 1
  386.       end
  387.     end
  388.     @item_max = @data.size
  389.     create_contents
  390.     for i in 0...@item_max
  391.       draw_item(i)
  392.     end
  393.   end
  394. end

  395. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  396. #==============================================================================
  397. # □ Window_SkillCategory
  398. #------------------------------------------------------------------------------
  399. #  スキル画面でカテゴリ選択を行うウィンドウです。
  400. #==============================================================================

  401. class Window_SkillCategory < Window_Command
  402.   #--------------------------------------------------------------------------
  403.   # ● オブジェクト初期化
  404.   #--------------------------------------------------------------------------
  405.   def initialize
  406.     if $game_temp.in_battle
  407.       cols = KGC::CategorizeSkill::CATEGORY_WINDOW_COLUMNS_BATTLE
  408.       width = KGC::CategorizeSkill::CATEGORY_WINDOW_COL_WIDTH_BATTLE
  409.       space = KGC::CategorizeSkill::CATEGORY_WINDOW_COL_SPACE_BATTLE
  410.       commands = KGC::CategorizeSkill::CATEGORY_NAME_BATTLE
  411.       position = KGC::CategorizeSkill::CATEGORY_WINDOW_POSITION_BATTLE
  412.     else
  413.       cols = KGC::CategorizeSkill::CATEGORY_WINDOW_COLUMNS
  414.       width = KGC::CategorizeSkill::CATEGORY_WINDOW_COL_WIDTH
  415.       space = KGC::CategorizeSkill::CATEGORY_WINDOW_COL_SPACE
  416.       commands = KGC::CategorizeSkill::CATEGORY_NAME
  417.       position = KGC::CategorizeSkill::CATEGORY_WINDOW_POSITION
  418.     end
  419.     width = width * cols + 32
  420.     width += (cols - 1) * space
  421.     super(width, commands, cols, 0, space)
  422.     self.x = position[0]
  423.     self.y = position[1]
  424.     self.z = 1000
  425.     self.index = 0
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # ● ヘルプテキスト更新
  429.   #--------------------------------------------------------------------------
  430.   def update_help
  431.     if $game_temp.in_battle
  432.       text = KGC::CategorizeSkill::CATEGORY_DESCRIPTION_BATTLE[self.index]
  433.     else
  434.       text = KGC::CategorizeSkill::CATEGORY_DESCRIPTION[self.index]
  435.     end
  436.     @help_window.set_text(text)
  437.   end
  438. end

  439. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  440. #==============================================================================
  441. # ■ Scene_Skill
  442. #==============================================================================

  443. if KGC::CategorizeSkill::ENABLE_NOT_IN_BATTLE
  444. class Scene_Skill < Scene_Base
  445.   #--------------------------------------------------------------------------
  446.   # ● 開始処理
  447.   #--------------------------------------------------------------------------
  448.   alias start_KGC_CategorizeSkill start
  449.   def start
  450.     start_KGC_CategorizeSkill

  451.     @category_window = Window_SkillCategory.new
  452.     @category_window.help_window = @help_window
  453.     show_category_window
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 終了処理
  457.   #--------------------------------------------------------------------------
  458.   alias terminate_KGC_CategorizeSkill terminate
  459.   def terminate
  460.     terminate_KGC_CategorizeSkill

  461.     @category_window.dispose
  462.   end
  463.   #--------------------------------------------------------------------------
  464.   # ● フレーム更新
  465.   #--------------------------------------------------------------------------
  466.   alias update_KGC_CategorizeSkill update
  467.   def update
  468.     @category_window.update

  469.     update_KGC_CategorizeSkill

  470.     if @category_window.active
  471.       update_category_selection
  472.     end
  473.   end
  474.   #--------------------------------------------------------------------------
  475.   # ○ カテゴリ選択の更新
  476.   #--------------------------------------------------------------------------
  477.   def update_category_selection
  478.     unless @category_activated
  479.       @category_activated = true
  480.       return
  481.     end

  482.     # 選択カテゴリー変更
  483.     if @last_category_index != @category_window.index
  484.       @skill_window.category = @category_window.index
  485.       @skill_window.refresh
  486.       @last_category_index = @category_window.index
  487.     end

  488.     if Input.trigger?(Input::B)
  489.       Sound.play_cancel
  490.       return_scene
  491.     elsif Input.trigger?(Input::C)
  492.       Sound.play_decision
  493.       hide_category_window
  494.     elsif Input.trigger?(Input::R)
  495.       Sound.play_cursor
  496.       next_actor
  497.     elsif Input.trigger?(Input::L)
  498.       Sound.play_cursor
  499.       prev_actor
  500.     end
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # ● スキル選択の更新
  504.   #--------------------------------------------------------------------------
  505.   alias update_skill_selection_KGC_CategorizeSkill update_skill_selection
  506.   def update_skill_selection
  507.     if Input.trigger?(Input::B)
  508.       Sound.play_cancel
  509.       show_category_window
  510.       return
  511.     elsif Input.trigger?(Input::R) || Input.trigger?(Input::L)
  512.       # 何もしない
  513.       return
  514.     end

  515.     update_skill_selection_KGC_CategorizeSkill
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ○ カテゴリウィンドウの表示
  519.   #--------------------------------------------------------------------------
  520.   def show_category_window
  521.     @category_window.open
  522.     @category_window.active = true
  523.     @skill_window.active = false
  524.   end
  525.   #--------------------------------------------------------------------------
  526.   # ○ カテゴリウィンドウの非表示
  527.   #--------------------------------------------------------------------------
  528.   def hide_category_window
  529.     @category_activated = false
  530.     @category_window.close
  531.     @category_window.active = false
  532.     @skill_window.active = true
  533.     # スキルウィンドウのインデックスを調整
  534.     if @skill_window.index >= @skill_window.item_max
  535.       @skill_window.index = [@skill_window.item_max - 1, 0].max
  536.     end
  537.   end
  538. end
  539. end

  540. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  541. #==============================================================================
  542. # ■ Scene_Battle
  543. #==============================================================================

  544. if KGC::CategorizeSkill::ENABLE_IN_BATTLE
  545. class Scene_Battle < Scene_Base
  546.   #--------------------------------------------------------------------------
  547.   # ● スキル選択の開始
  548.   #--------------------------------------------------------------------------
  549.   alias start_skill_selection_KGC_CategorizeSkill start_skill_selection
  550.   def start_skill_selection
  551.     start_skill_selection_KGC_CategorizeSkill

  552.     # カテゴリウィンドウを作成
  553.     @category_window = Window_SkillCategory.new
  554.     @category_window.help_window = @help_window
  555.     @category_window.z = @help_window.z + 10
  556.     @skill_window.active = false

  557.     # 記憶していたカテゴリを復元
  558.     if KGC::CategorizeSkill::REMEMBER_INDEX_IN_BATTLE
  559.       @category_window.index = @active_battler.last_skill_category
  560.       @skill_window.category = @category_window.index
  561.       @skill_window.refresh
  562.     end
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ● スキル選択の終了
  566.   #--------------------------------------------------------------------------
  567.   alias end_skill_selection_KGC_CategorizeSkill end_skill_selection
  568.   def end_skill_selection
  569.     if @category_window != nil
  570.       @category_window.dispose
  571.       @category_window = nil
  572.     end

  573.     end_skill_selection_KGC_CategorizeSkill
  574.   end
  575.   #--------------------------------------------------------------------------
  576.   # ● スキル選択の更新
  577.   #--------------------------------------------------------------------------
  578.   alias update_skill_selection_KGC_CategorizeSkill update_skill_selection
  579.   def update_skill_selection
  580.     @category_window.update
  581.     if @category_window.active
  582.       update_skill_category_selection
  583.       return
  584.     elsif Input.trigger?(Input::B)
  585.       Sound.play_cancel
  586.       show_category_window
  587.       return
  588.     end

  589.     update_skill_selection_KGC_CategorizeSkill
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   # ● スキルの決定
  593.   #--------------------------------------------------------------------------
  594.   alias determine_skill_KGC_CategorizeSkill determine_skill
  595.   def determine_skill
  596.     # 選択したカテゴリを記憶
  597.     if KGC::CategorizeSkill::REMEMBER_INDEX_IN_BATTLE && @category_window != nil
  598.       @active_battler.last_skill_category = @category_window.index
  599.     end

  600.     determine_skill_KGC_CategorizeSkill
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ○ スキルのカテゴリ選択の更新
  604.   #--------------------------------------------------------------------------
  605.   def update_skill_category_selection
  606.     @help_window.update

  607.     # 選択カテゴリー変更
  608.     if @last_category_index != @category_window.index
  609.       @skill_window.category = @category_window.index
  610.       @skill_window.refresh
  611.       @last_category_index = @category_window.index
  612.     end

  613.     if Input.trigger?(Input::B)
  614.       Sound.play_cancel
  615.       end_skill_selection
  616.     elsif Input.trigger?(Input::C)
  617.       Sound.play_decision
  618.       hide_category_window
  619.     end
  620.   end
  621.   #--------------------------------------------------------------------------
  622.   # ○ カテゴリウィンドウの表示
  623.   #--------------------------------------------------------------------------
  624.   def show_category_window
  625.     @category_window.open
  626.     @category_window.active = true
  627.     @skill_window.active = false
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ○ カテゴリウィンドウの非表示
  631.   #--------------------------------------------------------------------------
  632.   def hide_category_window
  633.     @category_activated = false
  634.     @category_window.close
  635.     @category_window.active = false
  636.     @skill_window.active = true
  637.     # スキルウィンドウのインデックスを調整
  638.     if @skill_window.index >= @skill_window.item_max
  639.       @skill_window.index = [@skill_window.item_max - 1, 0].max
  640.     end
  641.   end
  642. end
  643. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
 楼主| 发表于 2015-6-22 23:14:23 | 显示全部楼层
本帖最后由 怪蜀黍 于 2015-6-23 20:58 编辑
  1. (物品的职位归属脚本    老规矩         来源:绿坝娘大冒险)
  2. #==============================================================================
  3. # 物品的职业归属 by 沉影不器
  4. # -----------------------------------------------------------------------------
  5. # 功能描述:
  6. #       让物品也跟武器防具那样,属于指定职业
  7. #       当物品为全体有效时,也只对归属的职业同伴有效
  8. # 使用方法:
  9. #       ① 在数据库-物品-备注]中填写 职业 = 第一种职业ID,第二种职业ID...
  10. #          (详见范例)
  11. #       ② 未填写备注的情况下,视同属于所有职业
  12. #==============================================================================
  13. # ■ Array
  14. #==============================================================================
  15. class Array
  16.   # 整个数组所有元素一起化成数值型
  17.   def to_i
  18.     array_to_i=[]
  19.     self.each{|i| array_to_i.push i.to_i}
  20.     return array_to_i
  21.   end
  22.   # 整个数组所有元素一起化成文本型
  23.   def to_s
  24.     array_to_s=[]
  25.     self.each{|s| array_to_s.push s.to_s}
  26.     return array_to_s
  27.   end
  28. end

  29. #==============================================================================
  30. # ■ RPG
  31. #==============================================================================
  32. module RPG
  33.   class Item < UsableItem
  34.     def class_set
  35.       self.read_note('职业').split(/,/).to_i
  36.     end
  37.   end
  38. end

  39. #==============================================================================
  40. # ■ Game_Actor
  41. #==============================================================================
  42. class Game_Actor < Game_Battler
  43.   #--------------------------------------------------------------------------
  44.   # ○ 判断是否可以应用物品
  45.   #     user : 物品使用者
  46.   #     item : 物品
  47.   #--------------------------------------------------------------------------
  48.   def item_effective?(user, item)
  49.     if item.for_dead_friend? != dead?
  50.       return false
  51.     end
  52.     # 判断职业归属
  53.     if user.is_a?(Game_Actor) and !item.class_set.empty?
  54.       unless item.class_set.include?(user.class_id)
  55.         return false
  56.       end
  57.     end
  58.     if not $game_temp.in_battle and item.for_friend?
  59.       return item_test(user, item)
  60.     end
  61.     return true
  62.   end
  63. end

  64. #==============================================================================
  65. # 读取rmvx备注栏指定字段 by 沉影不器
  66. # -----------------------------------------------------------------------------
  67. # 使用方法:
  68. #           在vx数据库比如1号物品的备注栏里书写: 耐久度 = 10
  69. #           读取时使用: p $data_items[1].read_note('耐久度')
  70. # 几点注意:
  71. #           ① 忽略空格
  72. #           ② 返回值为文本格式
  73. #==============================================================================
  74. module RPG
  75.   #=============================================================================
  76.   # ■ BaseItem
  77.   #=============================================================================
  78.   class BaseItem
  79.     #-------------------------------------------------------------------------
  80.     # ○ 读取rmvx备注栏指定字段
  81.     #     section : 字段名
  82.     #     ignore_caps : 忽略大小写(仅字段名)
  83.     #-------------------------------------------------------------------------
  84.     def read_note(section, ignore_caps = false)
  85.       result = ''
  86.       # 忽略大小写时,全部转大写
  87.       section.upcase! if ignore_caps
  88.       # 转symbol方便比较
  89.       s = section.to_sym
  90.       self.note.each_line{|line|
  91.         temp = line.split(/=/)
  92.         # 去掉干扰字符
  93.         temp.each {|i| i.strip!}
  94.         temp[0].upcase! if ignore_caps
  95.         if temp[0].to_sym == s
  96.           unless temp[1] == nil
  97.             result = temp[1]
  98.           end
  99.           # 如果希望同名字段值覆盖前面的字段,去掉下一行
  100.           break
  101.         end
  102.       }
  103.       return result
  104.     end
  105.   end
  106.   #=============================================================================
  107.   # ■ Enemy
  108.   #=============================================================================
  109.   class Enemy
  110.     #-------------------------------------------------------------------------
  111.     # ○ 读取rmvx备注栏指定字段
  112.     #     section : 字段名
  113.     #     ignore_caps : 忽略大小写(仅字段名)
  114.     #-------------------------------------------------------------------------
  115.     def read_note(section, ignore_caps = false)
  116.       result = ''
  117.       # 忽略大小写时,全部转大写
  118.       section.upcase! if ignore_caps
  119.       # 转symbol方便比较
  120.       s = section.to_sym
  121.       self.note.each_line{|line|
  122.         temp = line.split(/=/)
  123.         # 去掉干扰字符
  124.         temp.each {|i| i.strip!}
  125.         temp[0].upcase! if ignore_caps
  126.         if temp[0].to_sym == s
  127.           unless temp[1] == nil
  128.             result = temp[1]
  129.           end
  130.           # 如果希望同名字段值覆盖前面的字段,去掉下一行
  131.           break
  132.         end
  133.       }
  134.       return result
  135.     end
  136.   end
  137.   #=============================================================================
  138.   # ■ State
  139.   #=============================================================================
  140.   class State
  141.     #-------------------------------------------------------------------------
  142.     # ○ 读取rmvx备注栏指定字段
  143.     #     section : 字段名
  144.     #     ignore_caps : 忽略大小写(仅字段名)
  145.     #-------------------------------------------------------------------------
  146.     def read_note(section, ignore_caps = false)
  147.       result = ''
  148.       # 忽略大小写时,全部转大写
  149.       section.upcase! if ignore_caps
  150.       # 转symbol方便比较
  151.       s = section.to_sym
  152.       self.note.each_line{|line|
  153.         temp = line.split(/=/)
  154.         # 去掉干扰字符
  155.         temp.each {|i| i.strip!}
  156.         temp[0].upcase! if ignore_caps
  157.         if temp[0].to_sym == s
  158.           unless temp[1] == nil
  159.             result = temp[1]
  160.           end
  161.           # 如果希望同名字段值覆盖前面的字段,去掉下一行
  162.           break
  163.         end
  164.       }
  165.       return result
  166.     end
  167.   end
  168. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
 楼主| 发表于 2015-6-22 23:14:24 | 显示全部楼层
本帖最后由 怪蜀黍 于 2015-6-23 20:58 编辑
  1. (动画修正脚本    老规矩    来源:度娘)
  2. ==============================================================================
  3. # ■ VX_SP1
  4. #------------------------------------------------------------------------------
  5. #  修正预置脚本的不兼容问题。
  6. #==============================================================================

  7. #------------------------------------------------------------------------------
  8. # 【SP1 修正内容】
  9. #------------------------------------------------------------------------------
  10. # ■修正了在动画中、编号大的元件显示在编号小的元件之上 (Y 坐标较小的关系),导致
  11. #   了与元件显示的优先度发生了冲突的问题。
  12. # ■修正了在反向显示动画时、由于 Y 坐标的错误算法导致的不兼容问题。
  13. # ■修正了在播放统一动画时、错误释放里必须的动画数据导致的不兼容问题。
  14. #------------------------------------------------------------------------------

  15. class Sprite_Base < Sprite
  16.   #--------------------------------------------------------------------------
  17.   # ● 释放动画
  18.   #--------------------------------------------------------------------------
  19.   alias eb_sp1_dispose_animation dispose_animation
  20.   def dispose_animation
  21.     eb_sp1_dispose_animation
  22.     @animation_bitmap1 = nil
  23.     @animation_bitmap2 = nil
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 设置动画活动块
  27.   #     frame : 帧数据 (RPG::Animation::Frame)
  28.   #--------------------------------------------------------------------------
  29.   alias eb_sp1_animation_set_sprites animation_set_sprites
  30.   def animation_set_sprites(frame)
  31.     eb_sp1_animation_set_sprites(frame)
  32.     cell_data = frame.cell_data
  33.     for i in 0..15
  34.       sprite = @animation_sprites[i]
  35.       next if sprite == nil
  36.       pattern = cell_data[i, 0]
  37.       next if pattern == nil or pattern == -1
  38.       if @animation_mirror
  39.         sprite.y = @animation_oy + cell_data[i, 2]
  40.       end
  41.       sprite.z = self.z + 300 + i
  42.     end
  43.   end
  44. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
 楼主| 发表于 2015-6-22 23:14:25 | 显示全部楼层
本帖最后由 怪蜀黍 于 2015-6-23 20:58 编辑
  1. (事件图片刷新简化脚本    来源:度娘)
  2. #============================================================================
  3. # ■ VX_事件图形刷新简化    —— By 诡异の猫
  4. #============================================================================
  5. #    脚本内容: 只刷新视野内的事件图形,改善大地图事件过多卡机情况.
  6. #============================================================================
  7. class Sprite_Character < Sprite_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 判定图形是否再视野内
  10.   #--------------------------------------------------------------------------
  11.   def in_view?
  12.     add_x = (self.width-32)*4 + 256
  13.     add_y = self.height*8
  14.     begin_x = $game_map.display_x - add_x
  15.     begin_y = $game_map.display_y - add_y
  16.     end_x = $game_map.display_x + 4352 + add_x
  17.     end_y = $game_map.display_y + 3328 + add_y
  18.     limit_x = $game_map.width * 256 - 256 + add_x
  19.     limit_y = $game_map.height * 256 - 256 + add_y
  20.     char_x = @character.real_x
  21.     char_y = @character.real_y
  22.     if end_x <= limit_x
  23.       return false if char_x < begin_x or char_x > end_x
  24.     end
  25.     if end_y <= limit_y
  26.       return false if char_y < begin_y or char_y > end_y
  27.     end
  28.     if end_x > limit_x and end_y > limit_y
  29.       return false if char_x < begin_x and char_x > end_x - limit_x
  30.       return false if char_y < begin_y and char_y > end_y - limit_y
  31.     end
  32.     return true
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 更新画面
  36.   #--------------------------------------------------------------------------
  37.   def update
  38.     super
  39.     if in_view?
  40.       update_bitmap
  41.       self.visible = (not @character.transparent)
  42.       update_src_rect
  43.       self.x = @character.screen_x
  44.       self.y = @character.screen_y
  45.       self.z = @character.screen_z
  46.       self.opacity = @character.opacity
  47.       self.blend_type = @character.blend_type
  48.       self.bush_depth = @character.bush_depth
  49.     end
  50.     update_balloon
  51.     if @character.animation_id != 0
  52.       animation = $data_animations[@character.animation_id]
  53.       start_animation(animation)
  54.       @character.animation_id = 0
  55.     end
  56.     if @character.balloon_id != 0
  57.       @balloon_id = @character.balloon_id
  58.       start_balloon
  59.       @character.balloon_id = 0
  60.     end
  61.   end
  62. end
  63. #==============================================================================
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
 楼主| 发表于 2015-6-22 23:14:26 | 显示全部楼层
本帖最后由 怪蜀黍 于 2015-6-23 20:58 编辑
  1. (队伍多人数脚本(和之前的不同)来源:度娘)
  2. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  3. #_/    ◆ 多人数パーティ - KGC_LargeParty ◆ VX ◆
  4. #_/    ◇ Last update : 2009/11/01 ◇
  5. #_/----------------------------------------------------------------------------
  6. #_/  5人以上の大規模パーティを構築可能にします。
  7. #_/============================================================================
  8. #_/ 【特殊システム】?パーティ編成画面2? より上に導入してください。
  9. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  10. #==============================================================================
  11. # ★ カスタマイズ項目 - Customize BEGIN ★
  12. #==============================================================================

  13. module KGC
  14. module LargeParty
  15.   # ◆ パーティ編成許可を表すスイッチ番号
  16.   #  このスイッチの ON/OFF でパーティ編成の 許可/不許可 を切り替えます。
  17.   PARTYFORM_SWITCH          = 3
  18.   # ◆ 戦闘中のパーティ編成許可を表すスイッチ番号
  19.   #  ↑と異なる番号を指定すると、戦闘中のみの入れ替え可否を設定できます。
  20.   BATTLE_PARTYFORM_SWITCH   = 3
  21.   # ◆ デフォルトの編成許可フラグ
  22.   #  true にすると、「ニューゲーム」選択時に両方のパーティ編成許可スイッチが
  23.   #  自動的に ON になります。
  24.   DEFAULT_PARTYFORM_ENABLED = true

  25.   # ◆ 戦闘メンバー最大数 (デフォルト値)
  26.   #  5 以上にすると、戦闘画面のステータスがやや見辛くなります。
  27.   MAX_BATTLE_MEMBERS = 4
  28.   # ◆ パーティメンバー最大数
  29.   #  Game_Party::MAX_MEMBERS を上書きします。
  30.   #  100 以上にすると [Window_MenuStatus] がバグります。
  31.   MAX_MEMBERS = 99

  32.   # ◆ 固定メンバーの並び替えを禁止
  33.   #  スクリプトからの操作以外では並び替えできなくなります。
  34.   FORBID_CHANGE_SHIFT_FIXED = true

  35.   # ◆ 待機メンバーの背景色
  36.   #  色を変えない場合は  Color.new(0, 0, 0, 0)
  37.   STAND_BY_COLOR = Color.new(0, 0, 0, 128)
  38.   # ◆ 固定メンバーの背景色
  39.   FIXED_COLOR    = Color.new(255, 128, 64, 96)
  40.   # ◆ 並び替え時の背景色
  41.   SELECTED_COLOR = Color.new(64, 255, 128, 128)

  42.   # ◆ パーティ編成ボタン (メニュー画面用)
  43.   #  メニュー画面でこのボタンを押すと、パーティ編成画面に移行します。
  44.   #  使用しない場合は nil
  45.   MENU_PARTYFORM_BUTTON      = Input::A
  46.   # ◆ メニュー画面にパーティ編成コマンドを追加する
  47.   #  追加する場所は、メニューコマンドの最下部です。
  48.   #  他の部分に追加したければ、?カスタムメニューコマンド? をご利用ください。
  49.   USE_MENU_PARTYFORM_COMMAND = true
  50.   # ◆ メニュー画面のパーティ編成コマンドの名称
  51.   VOCAB_MENU_PARTYFORM       = "队伍编成"

  52.   # ◆ 戦闘中にパーティ編成コマンドを使用する
  53.   #  追加する場所は、パーティコマンドの最下部(「逃げる」の下)です。
  54.   USE_BATTLE_PARTYFORM   = true
  55.   # ◆ 戦闘中のパーティ編成コマンドの名称
  56.   VOCAB_BATTLE_PARTYFORM = "替换队员"

  57.   # ◆ 全滅時の自動出撃を使用する
  58.   #   true  : 入れ替え可能なら生存者が出撃 (戦闘中の編成を許可する必要あり)
  59.   #   false : 全滅したら終了
  60.   ENABLE_DEFEAT_LAUNCH  = false
  61.   # ◆ 全滅時の入れ替えメッセージ
  62.   #  %s : 出撃者名
  63.   DEFEAT_LAUNCH_MESSAGE = "%s跳了出来!"

  64.   # ◆ 編成画面のキャラクター描画サイズ [幅, 高さ]
  65.   #  アクターの歩行グラフィックのサイズに応じて書き換えてください。
  66.   PARTY_FORM_CHARACTER_SIZE   = [40, 48]
  67.   # ◆ 編成画面の戦闘メンバーウィンドウの空欄に表示するテキスト
  68.   BATTLE_MEMBER_BLANK_TEXT    = "空白"
  69.   # ◆ 編成画面のパーティメンバーウィンドウの最大行数
  70.   #  ステータスウィンドウが画面からはみ出る場合は、
  71.   #  この値を 1 にしてください。
  72.   PARTY_MEMBER_WINDOW_ROW_MAX = 2
  73.   # ◆ 編成画面のパーティメンバーウィンドウに戦闘メンバーを表示する
  74.   SHOW_BATTLE_MEMBER_IN_PARTY = false
  75.   # ◆ 編成画面のパーティメンバーウィンドウの空欄に表示するテキスト
  76.   PARTY_MEMBER_BLANK_TEXT     = "-"

  77.   # ◆ 編成画面のキャプションウィンドウの幅
  78.   CAPTION_WINDOW_WIDTH  = 192
  79.   # ◆ 編成画面の戦闘メンバーウィンドウのキャプション
  80.   BATTLE_MEMBER_CAPTION = "参战人员"

  81.   if SHOW_BATTLE_MEMBER_IN_PARTY
  82.     # ◆ 編成画面のパーティメンバーウィンドウのキャプション
  83.     #  SHOW_BATTLE_MEMBER_IN_PARTY = true のとき
  84.     PARTY_MEMBER_CAPTION = "在队人员"
  85.   else
  86.     # ◆ 編成画面のパーティメンバーウィンドウのキャプション
  87.     #  SHOW_BATTLE_MEMBER_IN_PARTY = false のとき
  88.     PARTY_MEMBER_CAPTION = "待机人员"
  89.   end

  90.   # ◆ 編成確認ウィンドウの幅
  91.   CONFIRM_WINDOW_WIDTH    = 160
  92.   # ◆ 編成確認ウィンドウの文字列
  93.   #  ※コマンド数?順番を変更するとバグります。
  94.   CONFIRM_WINDOW_COMMANDS = ["完成编成", "放弃编成", "取消"]

  95.   # ◆ ショップ画面のステータスウィンドウスクロール時に使用するボタン
  96.   #  このボタンを押している間、上下ボタンでスクロールできます。
  97.   #  スクロールを無効にする場合は nil を指定。
  98.   #  ?ヘルプウィンドウ機能拡張? 併用時は、上に導入したものを優先。
  99.   SHOP_STATUS_SCROLL_BUTTON = Input::A

  100.   # ◆ 待機メンバー獲得経験値割合【単位:‰(千分率 1‰=0.1%)】
  101.   #  500 なら 50.0% です。
  102.   STAND_BY_EXP_RATE = 1000
  103.   # ◆ リザルト画面で待機メンバーのレベルアップを表示する
  104.   #  true  : 待機メンバーのレベルアップを表示。
  105.   #  false : 戦闘メンバーのみ表示。
  106.   SHOW_STAND_BY_LEVEL_UP = true
  107.   # ◆ 戦闘以外でも待機メンバーを表示する
  108.   #  true  : 戦闘以外では常に全員を表示。
  109.   #  false : 入れ替え時以外は、待機メンバーをいないものとして扱う。
  110.   SHOW_STAND_BY_MEMBER_NOT_IN_BATTLE = true
  111. end
  112. end

  113. #==============================================================================
  114. # ☆ カスタマイズ項目終了 - Customize END ☆
  115. #==============================================================================

  116. $imported = {} if $imported == nil
  117. $imported["LargeParty"] = true

  118. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  119. #==============================================================================
  120. # □ KGC::Commands
  121. #==============================================================================

  122. module KGC
  123. module Commands
  124.   # メンバーのソート形式
  125.   SORT_BY_ID    = 0  # ID順
  126.   SORT_BY_NAME  = 1  # 名前順
  127.   SORT_BY_LEVEL = 2  # レベル順

  128.   module_function
  129.   #--------------------------------------------------------------------------
  130.   # ○ パーティ編成画面の呼び出し
  131.   #--------------------------------------------------------------------------
  132.   def call_partyform
  133.     return if $game_temp.in_battle
  134.     $game_temp.next_scene = :partyform
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ○ 戦闘メンバー最大数を設定
  138.   #     value : 人数 (省略した場合はデフォルト値を使用)
  139.   #--------------------------------------------------------------------------
  140.   def set_max_battle_member_count(value = nil)
  141.     $game_party.max_battle_member_count = value
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ○ 全メンバー数取得
  145.   #     variable_id : 取得した値を代入する変数の ID
  146.   #--------------------------------------------------------------------------
  147.   def get_all_member_count(variable_id = 0)
  148.     n = $game_party.all_members.size
  149.     if variable_id > 0
  150.       $game_variables[variable_id] = n
  151.       $game_map.need_refresh = true
  152.     end
  153.     return n
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ○ 戦闘メンバー数取得
  157.   #     variable_id : 取得した値を代入する変数の ID
  158.   #--------------------------------------------------------------------------
  159.   def get_battle_member_count(variable_id = 0)
  160.     n = $game_party.battle_members.size
  161.     if variable_id > 0
  162.       $game_variables[variable_id] = n
  163.       $game_map.need_refresh = true
  164.     end
  165.     return n
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ○ 待機メンバー数取得
  169.   #     variable_id : 取得した値を代入する変数の ID
  170.   #--------------------------------------------------------------------------
  171.   def get_stand_by_member_count(variable_id = 0)
  172.     n = $game_party.stand_by_members.size
  173.     if variable_id > 0
  174.       $game_variables[variable_id] = n
  175.       $game_map.need_refresh = true
  176.     end
  177.     return n
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ○ パーティ人数が一杯か
  181.   #--------------------------------------------------------------------------
  182.   def party_full?
  183.     return $game_party.full?
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ○ パーティ編成可否を設定
  187.   #     enabled : 有効フラグ (省略時 : true)
  188.   #--------------------------------------------------------------------------
  189.   def permit_partyform(enabled = true)
  190.     $game_switches[KGC::LargeParty::PARTYFORM_SWITCH] = enabled
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ○ 戦闘中のパーティ編成可否を設定
  194.   #     enabled : 有効フラグ (省略時 : true)
  195.   #--------------------------------------------------------------------------
  196.   def permit_battle_partyform(enabled = true)
  197.     $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH] = enabled
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ○ アクターの固定状態を設定
  201.   #     actor_id : アクター ID
  202.   #     fixed    : 固定フラグ (省略時 : true)
  203.   #--------------------------------------------------------------------------
  204.   def fix_actor(actor_id, fixed = true)
  205.     $game_party.fix_actor(actor_id, fixed)
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ○ 並び替え
  209.   #    メンバーの index1 番目と index2 番目を入れ替える
  210.   #--------------------------------------------------------------------------
  211.   def change_party_shift(index1, index2)
  212.     $game_party.change_shift(index1, index2)
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ○ メンバー整列 (昇順)
  216.   #     sort_type : ソート形式 (SORT_BY_xxx)
  217.   #     reverse   : true だと降順
  218.   #--------------------------------------------------------------------------
  219.   def sort_party_member(sort_type = SORT_BY_ID, reverse = false)
  220.     $game_party.sort_member(sort_type, reverse)
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # ○ 待機メンバーの ID を取得
  224.   #--------------------------------------------------------------------------
  225.   def get_stand_by_member_ids
  226.     result = []
  227.     $game_party.stand_by_members.each { |actor| result << actor.id }
  228.     return result
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ○ アクターが待機メンバーか
  232.   #     actor_id : アクター ID
  233.   #--------------------------------------------------------------------------
  234.   def stand_by_member?(actor_id)
  235.     return get_stand_by_member_ids.include?(actor_id)
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ○ アクターを戦闘メンバーに加える
  239.   #     actor_id : アクター ID
  240.   #     index    : 追加位置 (省略時は最後尾)
  241.   #--------------------------------------------------------------------------
  242.   def add_battle_member(actor_id, index = nil)
  243.     $game_party.add_battle_member(actor_id, index)
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ○ アクターを戦闘メンバーから外す
  247.   #     actor_id : アクター ID
  248.   #--------------------------------------------------------------------------
  249.   def remove_battle_member(actor_id)
  250.     $game_party.remove_battle_member(actor_id)
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # ○ 固定アクター以外を戦闘メンバーから外す
  254.   #--------------------------------------------------------------------------
  255.   def remove_all_battle_member
  256.     $game_party.remove_all_battle_member
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ○ ランダム出撃
  260.   #--------------------------------------------------------------------------
  261.   def random_launch
  262.     new_battle_members = $game_party.fixed_members
  263.     candidates = $game_party.all_members - new_battle_members
  264.     num = [$game_party.max_battle_member_count - new_battle_members.size,
  265.       candidates.size].min
  266.     return if num <= 0

  267.     # ランダムに選ぶ
  268.     ary = (0...candidates.size).to_a.sort_by { rand }
  269.     ary[0...num].each { |i| new_battle_members << candidates[i] }
  270.     $game_party.set_battle_member(new_battle_members)
  271.   end
  272. end
  273. end

  274. class Game_Interpreter
  275.   include KGC::Commands
  276. end

  277. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  278. #==============================================================================
  279. # ■ Vocab
  280. #==============================================================================

  281. module Vocab
  282.   # 全滅時の入れ替えメッセージ
  283.   DefeatLaunch = KGC::LargeParty::DEFEAT_LAUNCH_MESSAGE

  284.   # 「パーティ編成」コマンド名 (メニュー)
  285.   def self.partyform
  286.     return KGC::LargeParty::VOCAB_MENU_PARTYFORM
  287.   end

  288.   # 「パーティ編成」コマンド名 (戦闘)
  289.   def self.partyform_battle
  290.     return KGC::LargeParty::VOCAB_BATTLE_PARTYFORM
  291.   end
  292. end

  293. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  294. #==============================================================================
  295. # ■ Game_Actor
  296. #==============================================================================

  297. class Game_Actor < Game_Battler
  298.   #--------------------------------------------------------------------------
  299.   # ○ パーティ内インデックス取得
  300.   #--------------------------------------------------------------------------
  301.   def party_index
  302.     return $game_party.all_members.index(self)
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ○ 戦闘メンバーか判定
  306.   #--------------------------------------------------------------------------
  307.   def battle_member?
  308.     return $game_party.battle_members.include?(self)
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ○ 固定メンバーか判定
  312.   #--------------------------------------------------------------------------
  313.   def fixed_member?
  314.     return $game_party.fixed_members.include?(self)
  315.   end
  316. end

  317. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  318. #==============================================================================
  319. # ■ Game_Party
  320. #==============================================================================

  321. class Game_Party
  322.   #--------------------------------------------------------------------------
  323.   # ● 定数
  324.   #--------------------------------------------------------------------------
  325.   MAX_MEMBERS = KGC::LargeParty::MAX_MEMBERS  # 最大パーティ人数
  326.   #--------------------------------------------------------------------------
  327.   # ● オブジェクト初期化
  328.   #--------------------------------------------------------------------------
  329.   alias initialize_KGC_LargeParty initialize
  330.   def initialize
  331.     initialize_KGC_LargeParty

  332.     @max_battle_member_count = nil
  333.     @battle_member_count = 0
  334.     @fixed_actors = []
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # ○ 戦闘メンバー最大数取得
  338.   #--------------------------------------------------------------------------
  339.   def max_battle_member_count
  340.     if @max_battle_member_count == nil
  341.       return KGC::LargeParty::MAX_BATTLE_MEMBERS
  342.     else
  343.       return @max_battle_member_count
  344.     end
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ○ 戦闘メンバー最大数変更
  348.   #--------------------------------------------------------------------------
  349.   def max_battle_member_count=(value)
  350.     if value.is_a?(Integer)
  351.       value = [value, 1].max
  352.     end
  353.     @max_battle_member_count = value
  354.   end
  355.   #--------------------------------------------------------------------------
  356.   # ○ 戦闘メンバー数取得
  357.   #--------------------------------------------------------------------------
  358.   def battle_member_count
  359.     if @battle_member_count == nil
  360.       @battle_member_count = @actors.size
  361.     end
  362.     @battle_member_count =
  363.       [@battle_member_count, @actors.size, max_battle_member_count].min
  364.     return @battle_member_count
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ○ 戦闘メンバー数設定
  368.   #--------------------------------------------------------------------------
  369.   def battle_member_count=(value)
  370.     @battle_member_count = [[value, 0].max,
  371.       @actors.size, max_battle_member_count].min
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● メンバーの取得
  375.   #--------------------------------------------------------------------------
  376.   alias members_KGC_LargeParty members
  377.   def members
  378.     if $game_temp.in_battle ||
  379.         !KGC::LargeParty::SHOW_STAND_BY_MEMBER_NOT_IN_BATTLE
  380.       return battle_members
  381.     else
  382.       return members_KGC_LargeParty
  383.     end
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ○ 全メンバーの取得
  387.   #--------------------------------------------------------------------------
  388.   def all_members
  389.     return members_KGC_LargeParty
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # ○ 戦闘メンバーの取得
  393.   #--------------------------------------------------------------------------
  394.   def battle_members
  395.     result = []
  396.     battle_member_count.times { |i| result << $game_actors[@actors[i]] }
  397.     return result
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # ○ 待機メンバーの取得
  401.   #--------------------------------------------------------------------------
  402.   def stand_by_members
  403.     return (all_members - battle_members)
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # ○ 固定メンバーの取得
  407.   #--------------------------------------------------------------------------
  408.   def fixed_members
  409.     result = []
  410.     @fixed_actors.each { |i| result << $game_actors[i] }
  411.     return result
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ● 初期パーティのセットアップ
  415.   #--------------------------------------------------------------------------
  416.   alias setup_starting_members_KGC_LargeParty setup_starting_members
  417.   def setup_starting_members
  418.     setup_starting_members_KGC_LargeParty

  419.     self.battle_member_count = @actors.size
  420.   end
  421.   #--------------------------------------------------------------------------
  422.   # ● 戦闘テスト用パーティのセットアップ
  423.   #--------------------------------------------------------------------------
  424.   alias setup_battle_test_members_KGC_LargeParty setup_battle_test_members
  425.   def setup_battle_test_members
  426.     setup_battle_test_members_KGC_LargeParty

  427.     self.battle_member_count = @actors.size
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # ○ メンバーの新規設定
  431.   #     new_member : 新しいメンバー
  432.   #--------------------------------------------------------------------------
  433.   def set_member(new_member)
  434.     @actors = []
  435.     new_member.each { |actor| @actors << actor.id }
  436.   end
  437.   #--------------------------------------------------------------------------
  438.   # ○ 戦闘メンバーの新規設定
  439.   #     new_member : 新しい戦闘メンバー
  440.   #--------------------------------------------------------------------------
  441.   def set_battle_member(new_member)
  442.     new_battle_member = []
  443.     new_member.each { |actor|
  444.       @actors.delete(actor.id)
  445.       new_battle_member << actor.id
  446.     }
  447.     @actors = new_battle_member + @actors
  448.     self.battle_member_count = new_member.size
  449.   end
  450.   #--------------------------------------------------------------------------
  451.   # ○ パーティ編成を許可しているか判定
  452.   #--------------------------------------------------------------------------
  453.   def partyform_enable?
  454.     return $game_switches[KGC::LargeParty::PARTYFORM_SWITCH]
  455.   end
  456.   #--------------------------------------------------------------------------
  457.   # ○ 戦闘中のパーティ編成を許可しているか判定
  458.   #--------------------------------------------------------------------------
  459.   def battle_partyform_enable?
  460.     return false unless partyform_enable?
  461.     return $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH]
  462.   end
  463.   #--------------------------------------------------------------------------
  464.   # ○ メンバーが一杯か判定
  465.   #--------------------------------------------------------------------------
  466.   def full?
  467.     return (@actors.size >= MAX_MEMBERS)
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # ○ 出撃中か判定
  471.   #     actor_id : 判定するアクターの ID
  472.   #--------------------------------------------------------------------------
  473.   def actor_launched?(actor_id)
  474.     return battle_members.include?($game_actors[actor_id])
  475.   end
  476.   #--------------------------------------------------------------------------
  477.   # ○ 固定アクターか判定
  478.   #     actor_id : 判定するアクターの ID
  479.   #--------------------------------------------------------------------------
  480.   def actor_fixed?(actor_id)
  481.     return @fixed_actors.include?(actor_id)
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # ● アクターを加える
  485.   #     actor_id : アクター ID
  486.   #--------------------------------------------------------------------------
  487.   alias add_actor_KGC_LargeParty add_actor
  488.   def add_actor(actor_id)
  489.     last_size = @actors.size

  490.     add_actor_KGC_LargeParty(actor_id)

  491.     if last_size < @actors.size
  492.       self.battle_member_count += 1
  493.     end
  494.   end
  495.   #--------------------------------------------------------------------------
  496.   # ○ アクターを戦闘メンバーに加える
  497.   #     actor_id : アクター ID
  498.   #     index    : 追加位置 (省略時は最後尾)
  499.   #--------------------------------------------------------------------------
  500.   def add_battle_member(actor_id, index = nil)
  501.     return unless @actors.include?(actor_id)  # パーティにいない
  502.     if index == nil
  503.       return if battle_members.include?($game_actors[actor_id])  # 出撃済み
  504.       return if battle_member_count == max_battle_member_count   # 人数が最大
  505.       index = battle_member_count
  506.     end

  507.     @actors.delete(actor_id)
  508.     @actors.insert(index, actor_id)
  509.     self.battle_member_count += 1
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ○ アクターを戦闘メンバーから外す
  513.   #     actor_id : アクター ID
  514.   #--------------------------------------------------------------------------
  515.   def remove_battle_member(actor_id)
  516.     return unless @actors.include?(actor_id)  # パーティにいない
  517.     return if actor_fixed?(actor_id)          # 固定済み
  518.     return unless actor_launched?(actor_id)   # 待機中

  519.     @actors.delete(actor_id)
  520.     @actors.push(actor_id)
  521.     self.battle_member_count -= 1
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ○ アクターの固定状態を設定
  525.   #     actor_id : アクター ID
  526.   #     fixed    : 固定フラグ (省略時 : false)
  527.   #--------------------------------------------------------------------------
  528.   def fix_actor(actor_id, fixed = false)
  529.     return unless @actors.include?(actor_id)  # パーティにいない

  530.     if fixed
  531.       # 固定
  532.       unless @fixed_actors.include?(actor_id)
  533.         @fixed_actors << actor_id
  534.         unless battle_members.include?($game_actors[actor_id])
  535.           self.battle_member_count += 1
  536.         end
  537.       end
  538.       # 強制出撃
  539.       apply_force_launch
  540.     else
  541.       # 固定解除
  542.       @fixed_actors.delete(actor_id)
  543.     end
  544.     $game_player.refresh
  545.   end
  546.   #--------------------------------------------------------------------------
  547.   # ○ 強制出撃適用
  548.   #--------------------------------------------------------------------------
  549.   def apply_force_launch
  550.     while (fixed_members - battle_members).size > 0
  551.       # 固定状態でないメンバーを適当に持ってきて入れ替え
  552.       actor1 = stand_by_members.find { |a| @fixed_actors.include?(a.id) }
  553.       actor2 = battle_members.reverse.find { |a| !@fixed_actors.include?(a.id) }
  554.       index1 = @actors.index(actor1.id)
  555.       index2 = @actors.index(actor2.id)
  556.       @actors[index1], @actors[index2] = @actors[index2], @actors[index1]

  557.       # 戦闘メンバーが全員固定されたら戻る (無限ループ防止)
  558.       all_fixed = true
  559.       battle_members.each { |actor|
  560.         unless actor.fixed_member?
  561.           all_fixed = false
  562.           break
  563.         end
  564.       }
  565.       break if all_fixed
  566.     end
  567.   end
  568.   #--------------------------------------------------------------------------
  569.   # ○ 固定アクター以外を戦闘メンバーから外す
  570.   #--------------------------------------------------------------------------
  571.   def remove_all_battle_member
  572.     all_members.each { |actor|
  573.       remove_battle_member(actor.id) if actor_launched?(actor.id)
  574.     }
  575.   end
  576.   #--------------------------------------------------------------------------
  577.   # ○ メンバー整列 (昇順)
  578.   #     sort_type : ソート形式 (SORT_BY_xxx)
  579.   #     reverse   : true だと降順
  580.   #--------------------------------------------------------------------------
  581.   def sort_member(sort_type = KGC::Commands::SORT_BY_ID,
  582.                   reverse = false)
  583.     # バッファを準備
  584.     b_actors = battle_members
  585.     actors   = all_members - b_actors
  586.     f_actors = fixed_members
  587.     # 固定キャラはソートしない
  588.     if KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED
  589.       actors   -= f_actors
  590.       b_actors -= f_actors
  591.     end

  592.     # ソート
  593.     case sort_type
  594.     when KGC::Commands::SORT_BY_ID     # ID順
  595.       actors.sort!   { |a, b| a.id <=> b.id }
  596.       b_actors.sort! { |a, b| a.id <=> b.id }
  597.     when KGC::Commands::SORT_BY_NAME   # 名前順
  598.       actors.sort!   { |a, b| a.name <=> b.name }
  599.       b_actors.sort! { |a, b| a.name <=> b.name }
  600.     when KGC::Commands::SORT_BY_LEVEL  # レベル順
  601.       actors.sort!   { |a, b| a.level <=> b.level }
  602.       b_actors.sort! { |a, b| a.level <=> b.level }
  603.     end
  604.     # 反転
  605.     if reverse
  606.       actors.reverse!
  607.       b_actors.reverse!
  608.     end

  609.     # 固定キャラを先頭に持ってくる
  610.     if KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED
  611.       actors   = f_actors + actors
  612.       b_actors = f_actors + b_actors
  613.     end

  614.     # 復帰
  615.     set_member(actors)
  616.     set_battle_member(b_actors)

  617.     apply_force_launch
  618.     $game_player.refresh
  619.   end
  620.   #--------------------------------------------------------------------------
  621.   # ○ 並び替え
  622.   #    戦闘メンバーの index1 番目と index2 番目を入れ替える
  623.   #--------------------------------------------------------------------------
  624.   def change_shift(index1, index2)
  625.     size = @actors.size
  626.     if index1 >= size || index2 >= size
  627.       return
  628.     end
  629.     buf = @actors[index1]
  630.     @actors[index1] = @actors[index2]
  631.     @actors[index2] = buf
  632.     $game_player.refresh
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # ● 戦闘用ステートの解除 (戦闘終了時に呼び出し)
  636.   #--------------------------------------------------------------------------
  637.   def remove_states_battle
  638.     (1...$data_actors.size).each { |i|
  639.       $game_actors[i].remove_states_battle
  640.     }
  641.   end
  642. end

  643. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  644. #==============================================================================
  645. # ■ Window_Command
  646. #==============================================================================

  647. class Window_Command < Window_Selectable
  648.   unless method_defined?(:add_command)
  649.   #--------------------------------------------------------------------------
  650.   # ○ コマンドを追加
  651.   #    追加した位置を返す
  652.   #--------------------------------------------------------------------------
  653.   def add_command(command)
  654.     @commands << command
  655.     @item_max = @commands.size
  656.     item_index = @item_max - 1
  657.     refresh_command
  658.     draw_item(item_index)
  659.     return item_index
  660.   end
  661.   #--------------------------------------------------------------------------
  662.   # ○ コマンドをリフレッシュ
  663.   #--------------------------------------------------------------------------
  664.   def refresh_command
  665.     buf = self.contents.clone
  666.     self.height = [self.height, row_max * WLH + 32].max
  667.     create_contents
  668.     self.contents.blt(0, 0, buf, buf.rect)
  669.     buf.dispose
  670.   end
  671.   #--------------------------------------------------------------------------
  672.   # ○ コマンドを挿入
  673.   #--------------------------------------------------------------------------
  674.   def insert_command(index, command)
  675.     @commands.insert(index, command)
  676.     @item_max = @commands.size
  677.     refresh_command
  678.     refresh
  679.   end
  680.   #--------------------------------------------------------------------------
  681.   # ○ コマンドを削除
  682.   #--------------------------------------------------------------------------
  683.   def remove_command(command)
  684.     @commands.delete(command)
  685.     @item_max = @commands.size
  686.     refresh
  687.   end
  688.   end
  689. end

  690. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  691. #==============================================================================
  692. # ■ Window_MenuStatus
  693. #==============================================================================

  694. class Window_MenuStatus < Window_Selectable
  695.   #--------------------------------------------------------------------------
  696.   # ● 定数
  697.   #--------------------------------------------------------------------------
  698.   STATUS_HEIGHT = 96  # ステータス一人分の高さ
  699.   #--------------------------------------------------------------------------
  700.   # ● ウィンドウ内容の作成
  701.   #--------------------------------------------------------------------------
  702.   def create_contents
  703.     self.contents.dispose
  704.     self.contents = Bitmap.new(width - 32,
  705.       [height - 32, row_max * STATUS_HEIGHT].max)
  706.   end
  707.   #--------------------------------------------------------------------------
  708.   # ● 先頭の行の取得
  709.   #--------------------------------------------------------------------------
  710.   def top_row
  711.     return self.oy / STATUS_HEIGHT
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● 先頭の行の設定
  715.   #     row : 先頭に表示する行
  716.   #--------------------------------------------------------------------------
  717.   def top_row=(row)
  718.     super(row)
  719.     self.oy = self.oy / WLH * STATUS_HEIGHT
  720.   end
  721.   #--------------------------------------------------------------------------
  722.   # ● 1 ページに表示できる行数の取得
  723.   #--------------------------------------------------------------------------
  724.   def page_row_max
  725.     return (self.height - 32) / STATUS_HEIGHT
  726.   end
  727.   #--------------------------------------------------------------------------
  728.   # ● 項目を描画する矩形の取得
  729.   #     index : 項目番号
  730.   #--------------------------------------------------------------------------
  731.   def item_rect(index)
  732.     rect = super(index)
  733.     rect.height = STATUS_HEIGHT
  734.     rect.y = index / @column_max * STATUS_HEIGHT
  735.     return rect
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # ● リフレッシュ
  739.   #--------------------------------------------------------------------------
  740.   def refresh
  741.     @item_max = $game_party.members.size
  742.     create_contents
  743.     fill_stand_by_background
  744.     draw_member
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # ○ パーティメンバー描画
  748.   #--------------------------------------------------------------------------
  749.   def draw_member
  750.     for actor in $game_party.members
  751.       draw_actor_face(actor, 2, actor.party_index * 96 + 2, 92)
  752.       x = 104
  753.       y = actor.party_index * 96 + WLH / 2
  754.       draw_actor_name(actor, x, y)
  755.       draw_actor_class(actor, x + 120, y)
  756.       draw_actor_level(actor, x, y + WLH * 1)
  757.       draw_actor_state(actor, x, y + WLH * 2)
  758.       draw_actor_hp(actor, x + 120, y + WLH * 1)
  759.       draw_actor_mp(actor, x + 120, y + WLH * 2)
  760.     end
  761.   end
  762.   #--------------------------------------------------------------------------
  763.   # ○ 待機メンバーの背景色を塗る
  764.   #--------------------------------------------------------------------------
  765.   def fill_stand_by_background
  766.     color = KGC::LargeParty::STAND_BY_COLOR
  767.     dy = STATUS_HEIGHT * $game_party.battle_members.size
  768.     dh = STATUS_HEIGHT * $game_party.stand_by_members.size
  769.     if dh > 0
  770.       self.contents.fill_rect(0, dy, self.width - 32, dh, color)
  771.     end
  772.   end
  773.   #--------------------------------------------------------------------------
  774.   # ● カーソルの更新
  775.   #--------------------------------------------------------------------------
  776.   def update_cursor
  777.     if @index < 0               # カーソルなし
  778.       self.cursor_rect.empty
  779.     elsif @index < @item_max    # 通常
  780.       super
  781.     elsif @index >= 100         # 自分
  782.       self.cursor_rect.set(0, (@index - 100) * STATUS_HEIGHT,
  783.         contents.width, STATUS_HEIGHT)
  784.     else                        # 全体
  785.       self.cursor_rect.set(0, 0, contents.width, @item_max * STATUS_HEIGHT)
  786.     end
  787.   end
  788. end

  789. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  790. #==============================================================================
  791. # ■ Window_ShopStatus
  792. #==============================================================================

  793. class Window_ShopStatus < Window_Base
  794.   #--------------------------------------------------------------------------
  795.   # ● ウィンドウ内容の作成
  796.   #--------------------------------------------------------------------------
  797.   def create_contents
  798.     self.contents.dispose
  799.     self.contents = Bitmap.new(width - 32,
  800.       WLH * ($game_party.members.size + 1) * 2)
  801.   end
  802. end

  803. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  804. #==============================================================================
  805. # ■ Window_BattleStatus
  806. #==============================================================================

  807. class Window_BattleStatus < Window_Selectable
  808.   #--------------------------------------------------------------------------
  809.   # ● ウィンドウ内容の作成
  810.   #--------------------------------------------------------------------------
  811.   def create_contents
  812.     self.contents.dispose
  813.     self.contents = Bitmap.new(width - 32,
  814.       [WLH * $game_party.members.size, height - 32].max)
  815.   end
  816.   #--------------------------------------------------------------------------
  817.   # ● リフレッシュ
  818.   #--------------------------------------------------------------------------
  819.   alias refresh_KGC_LargeParty refresh
  820.   def refresh
  821.     create_contents

  822.     refresh_KGC_LargeParty
  823.   end
  824. end

  825. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  826. #==============================================================================
  827. # □ Window_PartyFormCaption
  828. #------------------------------------------------------------------------------
  829. #  パーティ編成画面でウィンドウのキャプションを表示するウィンドウです。
  830. #==============================================================================

  831. class Window_PartyFormCaption < Window_Base
  832.   #--------------------------------------------------------------------------
  833.   # ● オブジェクト初期化
  834.   #     caption : 表示するキャプション
  835.   #--------------------------------------------------------------------------
  836.   def initialize(caption = "")
  837.     super(0, 0, KGC::LargeParty::CAPTION_WINDOW_WIDTH, WLH + 32)
  838.     @caption = caption
  839.     refresh
  840.   end
  841.   #--------------------------------------------------------------------------
  842.   # ● リフレッシュ
  843.   #--------------------------------------------------------------------------
  844.   def refresh
  845.     self.contents.clear
  846.     self.contents.draw_text(0, 0, width - 32, WLH, @caption)
  847.   end
  848. end

  849. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  850. #==============================================================================
  851. # □ Window_PartyFormMember
  852. #------------------------------------------------------------------------------
  853. #  パーティ編成画面でメンバーを表示するウィンドウです。
  854. #==============================================================================

  855. class Window_PartyFormMember < Window_Selectable
  856.   #--------------------------------------------------------------------------
  857.   # ○ 定数
  858.   #--------------------------------------------------------------------------
  859.   DRAW_SIZE = KGC::LargeParty::PARTY_FORM_CHARACTER_SIZE
  860.   #--------------------------------------------------------------------------
  861.   # ● 公開インスタンス変数
  862.   #--------------------------------------------------------------------------
  863.   attr_accessor :selected_index           # 選択済みインデックス
  864.   #--------------------------------------------------------------------------
  865.   # ● オブジェクト初期化
  866.   #     x       : ウィンドウの X 座標
  867.   #     y       : ウィンドウの Y 座標
  868.   #     width   : ウィンドウの幅
  869.   #     height  : ウィンドウの高さ
  870.   #     spacing : 横に項目が並ぶときの空白の幅
  871.   #--------------------------------------------------------------------------
  872.   def initialize(x, y, width, height, spacing = 8)
  873.     super(x, y, width, height, spacing)
  874.   end
  875.   #--------------------------------------------------------------------------
  876.   # ● ウィンドウ内容の作成
  877.   #--------------------------------------------------------------------------
  878.   def create_contents
  879.     self.contents.dispose
  880.     self.contents = Bitmap.new(width - 32,
  881.       [height - 32, row_max * DRAW_SIZE[1]].max)
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # ● 先頭の行の取得
  885.   #--------------------------------------------------------------------------
  886.   def top_row
  887.     return self.oy / DRAW_SIZE[1]
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ● 先頭の行の設定
  891.   #     row : 先頭に表示する行
  892.   #--------------------------------------------------------------------------
  893.   def top_row=(row)
  894.     super(row)
  895.     self.oy = self.oy / WLH * DRAW_SIZE[1]
  896.   end
  897.   #--------------------------------------------------------------------------
  898.   # ● 1 ページに表示できる行数の取得
  899.   #--------------------------------------------------------------------------
  900.   def page_row_max
  901.     return (self.height - 32) / DRAW_SIZE[1]
  902.   end
  903.   #--------------------------------------------------------------------------
  904.   # ● 項目を描画する矩形の取得
  905.   #     index : 項目番号
  906.   #--------------------------------------------------------------------------
  907.   def item_rect(index)
  908.     rect = super(index)
  909.     rect.width = DRAW_SIZE[0]
  910.     rect.height = DRAW_SIZE[1]
  911.     rect.y = index / @column_max * DRAW_SIZE[1]
  912.     return rect
  913.   end
  914.   #--------------------------------------------------------------------------
  915.   # ○ 選択アクター取得
  916.   #--------------------------------------------------------------------------
  917.   def actor
  918.     return @actors[self.index]
  919.   end
  920.   #--------------------------------------------------------------------------
  921.   # ● リフレッシュ
  922.   #--------------------------------------------------------------------------
  923.   def refresh
  924.     self.contents.clear
  925.     restore_member_list
  926.     draw_member
  927.   end
  928.   #--------------------------------------------------------------------------
  929.   # ○ メンバーリスト修復
  930.   #--------------------------------------------------------------------------
  931.   def restore_member_list
  932.     # 継承先で定義
  933.   end
  934.   #--------------------------------------------------------------------------
  935.   # ○ メンバー描画
  936.   #--------------------------------------------------------------------------
  937.   def draw_member
  938.     # 継承先で定義
  939.   end
  940.   #--------------------------------------------------------------------------
  941.   # ○ 空欄アクター描画
  942.   #     index : 項目番号
  943.   #--------------------------------------------------------------------------
  944.   def draw_empty_actor(index)
  945.     # 継承先で定義
  946.   end
  947.   #--------------------------------------------------------------------------
  948.   # ○ 固定キャラ背景描画
  949.   #     index : 項目番号
  950.   #--------------------------------------------------------------------------
  951.   def draw_fixed_back(index)
  952.     rect = item_rect(index)
  953.     self.contents.fill_rect(rect, KGC::LargeParty::FIXED_COLOR)
  954.   end
  955.   #--------------------------------------------------------------------------
  956.   # ○ 選択中キャラ背景描画
  957.   #     index : 項目番号
  958.   #--------------------------------------------------------------------------
  959.   def draw_selected_back(index)
  960.     rect = item_rect(index)
  961.     self.contents.fill_rect(rect, KGC::LargeParty::SELECTED_COLOR)
  962.   end
  963. end

  964. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  965. #==============================================================================
  966. # □ Window_PartyFormBattleMember
  967. #------------------------------------------------------------------------------
  968. #  パーティ編成画面で戦闘メンバーを表示するウィンドウです。
  969. #==============================================================================

  970. class Window_PartyFormBattleMember < Window_PartyFormMember
  971.   #--------------------------------------------------------------------------
  972.   # ● 公開インスタンス変数
  973.   #--------------------------------------------------------------------------
  974.   attr_accessor :selected_index           # 選択済みインデックス
  975.   #--------------------------------------------------------------------------
  976.   # ● オブジェクト初期化
  977.   #--------------------------------------------------------------------------
  978.   def initialize
  979.     super(0, 0, 64, DRAW_SIZE[1] + 32)
  980.     column_width = DRAW_SIZE[0] + @spacing
  981.     nw = [column_width * $game_party.max_battle_member_count + 32,
  982.       Graphics.width].min
  983.     self.width = nw

  984.     @item_max = $game_party.max_battle_member_count
  985.     @column_max = width / column_width
  986.     @selected_index = nil
  987.     create_contents
  988.     refresh
  989.     self.active = true
  990.     self.index = 0
  991.   end
  992.   #--------------------------------------------------------------------------
  993.   # ○ メンバーリスト修復
  994.   #--------------------------------------------------------------------------
  995.   def restore_member_list
  996.     @actors = $game_party.battle_members
  997.   end
  998.   #--------------------------------------------------------------------------
  999.   # ○ メンバー描画
  1000.   #--------------------------------------------------------------------------
  1001.   def draw_member
  1002.     @item_max.times { |i|
  1003.       actor = @actors[i]
  1004.       if actor == nil
  1005.         draw_empty_actor(i)
  1006.       else
  1007.         if i == @selected_index
  1008.           draw_selected_back(i)
  1009.         elsif $game_party.actor_fixed?(actor.id)
  1010.           draw_fixed_back(i)
  1011.         end
  1012.         rect = item_rect(i)
  1013.         draw_actor_graphic(actor,
  1014.           rect.x + DRAW_SIZE[0] / 2,
  1015.           rect.y + DRAW_SIZE[1] - 4)
  1016.       end
  1017.     }
  1018.   end
  1019.   #--------------------------------------------------------------------------
  1020.   # ○ 空欄アクター描画
  1021.   #     index : 項目番号
  1022.   #--------------------------------------------------------------------------
  1023.   def draw_empty_actor(index)
  1024.     rect = item_rect(index)
  1025.     self.contents.font.color = system_color
  1026.     self.contents.draw_text(rect, KGC::LargeParty::BATTLE_MEMBER_BLANK_TEXT, 1)
  1027.     self.contents.font.color = normal_color
  1028.   end
  1029. end

  1030. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1031. #==============================================================================
  1032. # □ Window_PartyFormAllMember
  1033. #------------------------------------------------------------------------------
  1034. #  パーティ編成画面で全メンバーを表示するウィンドウです。
  1035. #==============================================================================

  1036. class Window_PartyFormAllMember < Window_PartyFormMember
  1037.   #--------------------------------------------------------------------------
  1038.   # ● オブジェクト初期化
  1039.   #--------------------------------------------------------------------------
  1040.   def initialize
  1041.     super(0, 0, 64, 64)
  1042.     restore_member_list
  1043.     @item_max = $game_party.all_members.size

  1044.     # 各種サイズ計算
  1045.     column_width = DRAW_SIZE[0] + @spacing
  1046.     sw = [@item_max * column_width + 32, Graphics.width].min
  1047.     @column_max = (sw - 32) / column_width
  1048.     sh = ([@item_max - 1, 0].max / @column_max + 1) * DRAW_SIZE[1] + 32
  1049.     sh = [sh, DRAW_SIZE[1] * KGC::LargeParty::PARTY_MEMBER_WINDOW_ROW_MAX + 32].min

  1050.     # 座標?サイズ調整
  1051.     self.y += DRAW_SIZE[1] + 32
  1052.     self.width = sw
  1053.     self.height = sh

  1054.     create_contents
  1055.     refresh
  1056.     self.active = false
  1057.     self.index = 0
  1058.   end
  1059.   #--------------------------------------------------------------------------
  1060.   # ○ 選択しているアクターのインデックス取得
  1061.   #--------------------------------------------------------------------------
  1062.   def actor_index
  1063.     return @index_offset + self.index
  1064.   end
  1065.   #--------------------------------------------------------------------------
  1066.   # ○ メンバーリスト修復
  1067.   #--------------------------------------------------------------------------
  1068.   def restore_member_list
  1069.     if KGC::LargeParty::SHOW_BATTLE_MEMBER_IN_PARTY
  1070.       @actors = $game_party.all_members
  1071.       @index_offset = 0
  1072.     else
  1073.       @actors = $game_party.stand_by_members
  1074.       @index_offset = $game_party.battle_members.size
  1075.     end
  1076.   end
  1077.   #--------------------------------------------------------------------------
  1078.   # ○ メンバー描画
  1079.   #--------------------------------------------------------------------------
  1080.   def draw_member
  1081.     @item_max.times { |i|
  1082.       actor = @actors[i]
  1083.       if actor == nil
  1084.         draw_empty_actor(i)
  1085.         next
  1086.       end

  1087.       if $game_party.actor_fixed?(actor.id)
  1088.         draw_fixed_back(i)
  1089.       end
  1090.       rect = item_rect(i)
  1091.       opacity = ($game_party.battle_members.include?(actor) ? 96 : 255)
  1092.       draw_actor_graphic(actor,
  1093.         rect.x + DRAW_SIZE[0] / 2,
  1094.         rect.y + DRAW_SIZE[1] - 4,
  1095.         opacity)
  1096.     }
  1097.   end
  1098.   #--------------------------------------------------------------------------
  1099.   # ● アクターの歩行グラフィック描画
  1100.   #     actor   : アクター
  1101.   #     x       : 描画先 X 座標
  1102.   #     y       : 描画先 Y 座標
  1103.   #     opacity : 不透明度
  1104.   #--------------------------------------------------------------------------
  1105.   def draw_actor_graphic(actor, x, y, opacity = 255)
  1106.     draw_character(actor.character_name, actor.character_index, x, y, opacity)
  1107.   end
  1108.   #--------------------------------------------------------------------------
  1109.   # ● 歩行グラフィックの描画
  1110.   #     character_name  : 歩行グラフィック ファイル名
  1111.   #     character_index : 歩行グラフィック インデックス
  1112.   #     x               : 描画先 X 座標
  1113.   #     y               : 描画先 Y 座標
  1114.   #     opacity         : 不透明度
  1115.   #--------------------------------------------------------------------------
  1116.   def draw_character(character_name, character_index, x, y, opacity = 255)
  1117.     return if character_name == nil
  1118.     bitmap = Cache.character(character_name)
  1119.     sign = character_name[/^[\!\$]./]
  1120.     if sign != nil and sign.include?(')
  1121.       cw = bitmap.width / 3
  1122.       ch = bitmap.height / 4
  1123.     else
  1124.       cw = bitmap.width / 12
  1125.       ch = bitmap.height / 8
  1126.     end
  1127.     n = character_index
  1128.     src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  1129.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
  1130.   end
  1131.   #--------------------------------------------------------------------------
  1132.   # ○ 空欄アクター描画
  1133.   #     index : 項目番号
  1134.   #--------------------------------------------------------------------------
  1135.   def draw_empty_actor(index)
  1136.     rect = item_rect(index)
  1137.     self.contents.font.color = system_color
  1138.     self.contents.draw_text(rect, KGC::LargeParty::PARTY_MEMBER_BLANK_TEXT, 1)
  1139.     self.contents.font.color = normal_color
  1140.   end
  1141. end

  1142. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1143. #==============================================================================
  1144. # □ Window_PartyFormStatus
  1145. #------------------------------------------------------------------------------
  1146. #  パーティ編成画面でアクターのステータスを表示するウィンドウです。
  1147. #==============================================================================

  1148. class Window_PartyFormStatus < Window_Base
  1149.   #--------------------------------------------------------------------------
  1150.   # ● オブジェクト初期化
  1151.   #--------------------------------------------------------------------------
  1152.   def initialize
  1153.     super(0, 0, 384, 128)
  1154.     self.z = 1000
  1155.     @actor = nil
  1156.     refresh
  1157.   end
  1158.   #--------------------------------------------------------------------------
  1159.   # ○ アクター設定
  1160.   #--------------------------------------------------------------------------
  1161.   def set_actor(actor)
  1162.     if @actor != actor
  1163.       @actor = actor
  1164.       refresh
  1165.     end
  1166.   end
  1167.   #--------------------------------------------------------------------------
  1168.   # ● リフレッシュ
  1169.   #--------------------------------------------------------------------------
  1170.   def refresh
  1171.     self.contents.clear
  1172.     if @actor == nil
  1173.       return
  1174.     end

  1175.     draw_actor_face(@actor, 0, 0)
  1176.     dx = 104
  1177.     draw_actor_name(@actor, dx, 0)
  1178.     draw_actor_level(@actor, dx, WLH * 1)
  1179.     draw_actor_hp(@actor, dx, WLH * 2)
  1180.     draw_actor_mp(@actor, dx, WLH * 3)
  1181.     4.times { |i|
  1182.       draw_actor_parameter(@actor, dx + 128, WLH * i, i, 120)
  1183.     }
  1184.   end
  1185.   #--------------------------------------------------------------------------
  1186.   # ● 能力値の描画
  1187.   #     actor : アクター
  1188.   #     x     : 描画先 X 座標
  1189.   #     y     : 描画先 Y 座標
  1190.   #     type  : 能力値の種類 (0~3)
  1191.   #     width : 描画幅
  1192.   #--------------------------------------------------------------------------
  1193.   def draw_actor_parameter(actor, x, y, type, width = 156)
  1194.     case type
  1195.     when 0
  1196.       parameter_name = Vocab::atk
  1197.       parameter_value = actor.atk
  1198.     when 1
  1199.       parameter_name = Vocab::def
  1200.       parameter_value = actor.def
  1201.     when 2
  1202.       parameter_name = Vocab::spi
  1203.       parameter_value = actor.spi
  1204.     when 3
  1205.       parameter_name = Vocab::agi
  1206.       parameter_value = actor.agi
  1207.     end
  1208.     nw = width - 36
  1209.     self.contents.font.color = system_color
  1210.     self.contents.draw_text(x, y, nw, WLH, parameter_name)
  1211.     self.contents.font.color = normal_color
  1212.     self.contents.draw_text(x + nw, y, 36, WLH, parameter_value, 2)
  1213.   end
  1214. end

  1215. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1216. #==============================================================================
  1217. # □ Window_PartyFormControl
  1218. #------------------------------------------------------------------------------
  1219. #  パーティ編成画面で操作方法を表示するウィンドウです。
  1220. #==============================================================================

  1221. class Window_PartyFormControl < Window_Base
  1222.   #--------------------------------------------------------------------------
  1223.   # ○ 定数
  1224.   #--------------------------------------------------------------------------
  1225.   MODE_BATTLE_MEMBER = 0
  1226.   MODE_SHIFT_CHANGE  = 1
  1227.   MODE_PARTY_MEMBER  = 2
  1228.   #--------------------------------------------------------------------------
  1229.   # ● オブジェクト初期化
  1230.   #--------------------------------------------------------------------------
  1231.   def initialize
  1232.     super(0, 0, Graphics.width - 384, 128)
  1233.     self.z = 1000
  1234.     @mode = MODE_BATTLE_MEMBER
  1235.     refresh
  1236.   end
  1237.   #--------------------------------------------------------------------------
  1238.   # ○ モード変更
  1239.   #--------------------------------------------------------------------------
  1240.   def mode=(value)
  1241.     @mode = value
  1242.     refresh
  1243.   end
  1244.   #--------------------------------------------------------------------------
  1245.   # ● リフレッシュ
  1246.   #--------------------------------------------------------------------------
  1247.   def refresh
  1248.     self.contents.clear
  1249.     case @mode
  1250.     when MODE_BATTLE_MEMBER  # 戦闘メンバー
  1251.       buttons = [
  1252.         "A: 变更",
  1253.         "B: 结束",
  1254.         "C: 确定",
  1255.         "X: 替换位置"
  1256.       ]
  1257.     when MODE_SHIFT_CHANGE   # 並び替え
  1258.       buttons = [
  1259.         "B: 取消",
  1260.         "C: 确定",
  1261.         "X: 确定"
  1262.       ]
  1263.     when MODE_PARTY_MEMBER   # パーティメンバー
  1264.       buttons = [
  1265.         "B: 取消",
  1266.         "C: 确定"
  1267.       ]
  1268.     else
  1269.       return
  1270.     end

  1271.     buttons.each_with_index { |c, i|
  1272.       self.contents.draw_text(0, WLH * i, width - 32, WLH, c)
  1273.     }
  1274.   end
  1275. end

  1276. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1277. #==============================================================================
  1278. # ■ Scene_Title
  1279. #==============================================================================

  1280. class Scene_Title < Scene_Base
  1281.   #--------------------------------------------------------------------------
  1282.   # ● 各種ゲームオブジェクトの作成
  1283.   #--------------------------------------------------------------------------
  1284.   alias create_game_objects_KGC_LargeParty create_game_objects
  1285.   def create_game_objects
  1286.     create_game_objects_KGC_LargeParty

  1287.     if KGC::LargeParty::DEFAULT_PARTYFORM_ENABLED
  1288.       $game_switches[KGC::LargeParty::PARTYFORM_SWITCH] = true
  1289.       $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH] = true
  1290.     end
  1291.   end
  1292. end

  1293. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1294. #==============================================================================
  1295. # ■ Scene_Map
  1296. #==============================================================================

  1297. class Scene_Map < Scene_Base
  1298.   #--------------------------------------------------------------------------
  1299.   # ● 画面切り替えの実行
  1300.   #--------------------------------------------------------------------------
  1301.   alias update_scene_change_KGC_LargeParty update_scene_change
  1302.   def update_scene_change
  1303.     return if $game_player.moving?    # プレイヤーの移動中?

  1304.     if $game_temp.next_scene == :partyform
  1305.       call_partyform
  1306.       return
  1307.     end

  1308.     update_scene_change_KGC_LargeParty
  1309.   end
  1310.   #--------------------------------------------------------------------------
  1311.   # ○ パーティ編成画面への切り替え
  1312.   #--------------------------------------------------------------------------
  1313.   def call_partyform
  1314.     $game_temp.next_scene = nil
  1315.     $scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_MAP)
  1316.   end
  1317. end

  1318. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1319. #==============================================================================
  1320. # ■ Scene_Menu
  1321. #==============================================================================

  1322. class Scene_Menu < Scene_Base
  1323.   if KGC::LargeParty::USE_MENU_PARTYFORM_COMMAND
  1324.   #--------------------------------------------------------------------------
  1325.   # ● コマンドウィンドウの作成
  1326.   #--------------------------------------------------------------------------
  1327.   alias create_command_window_KGC_LargeParty create_command_window
  1328.   def create_command_window
  1329.     create_command_window_KGC_LargeParty

  1330.     return if $imported["CustomMenuCommand"]

  1331.     @__command_partyform_index =
  1332.       @command_window.add_command(Vocab.partyform)
  1333.     @command_window.draw_item(@__command_partyform_index,
  1334.       $game_party.partyform_enable?)
  1335.     if @command_window.oy > 0
  1336.       @command_window.oy -= Window_Base::WLH
  1337.     end
  1338.     @command_window.index = @menu_index
  1339.   end
  1340.   end
  1341.   #--------------------------------------------------------------------------
  1342.   # ● コマンド選択の更新
  1343.   #--------------------------------------------------------------------------
  1344.   alias update_command_selection_KGC_LargeParty update_command_selection
  1345.   def update_command_selection
  1346.     current_menu_index = @__command_partyform_index
  1347.     call_partyform_flag = false

  1348.     if Input.trigger?(Input::C)
  1349.       case @command_window.index
  1350.       when @__command_partyform_index  # パーティ編成
  1351.         call_partyform_flag = true
  1352.       end
  1353.     # パーティ編成ボタン押下
  1354.     elsif KGC::LargeParty::MENU_PARTYFORM_BUTTON != nil &&
  1355.         Input.trigger?(KGC::LargeParty::MENU_PARTYFORM_BUTTON)
  1356.       call_partyform_flag = true
  1357.       current_menu_index = @command_window.index if current_menu_index == nil
  1358.     end

  1359.     # パーティ編成画面に移行
  1360.     if call_partyform_flag
  1361.       if $game_party.members.size == 0 || !$game_party.partyform_enable?
  1362.         Sound.play_buzzer
  1363.         return
  1364.       end
  1365.       Sound.play_decision
  1366.       $scene = Scene_PartyForm.new(current_menu_index)
  1367.       return
  1368.     end

  1369.     update_command_selection_KGC_LargeParty
  1370.   end
  1371. end

  1372. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1373. #==============================================================================
  1374. # ■ Scene_Shop
  1375. #==============================================================================

  1376. unless $imported["HelpExtension"]
  1377. class Scene_Shop < Scene_Base
  1378.   #--------------------------------------------------------------------------
  1379.   # ● フレーム更新
  1380.   #--------------------------------------------------------------------------
  1381.   alias udpate_KGC_LargeParty update
  1382.   def update
  1383.     # スクロール判定
  1384.     if !@command_window.active &&
  1385.         KGC::LargeParty::SHOP_STATUS_SCROLL_BUTTON != nil &&
  1386.         Input.press?(KGC::LargeParty::SHOP_STATUS_SCROLL_BUTTON)
  1387.       super
  1388.       update_menu_background
  1389.       update_scroll_status
  1390.       return
  1391.     else
  1392.       @status_window.cursor_rect.empty
  1393.     end

  1394.     udpate_KGC_LargeParty
  1395.   end
  1396.   #--------------------------------------------------------------------------
  1397.   # ○ ステータスウィンドウのスクロール処理
  1398.   #--------------------------------------------------------------------------
  1399.   def update_scroll_status
  1400.     # ステータスウィンドウにカーソルを表示
  1401.     @status_window.cursor_rect.width = @status_window.contents.width
  1402.     @status_window.cursor_rect.height = @status_window.height - 32
  1403.     @status_window.update

  1404.     if Input.press?(Input::UP)
  1405.       @status_window.oy = [@status_window.oy - 4, 0].max
  1406.     elsif Input.press?(Input::DOWN)
  1407.       max_pos = [@status_window.contents.height -
  1408.         (@status_window.height - 32), 0].max
  1409.       @status_window.oy = [@status_window.oy + 4, max_pos].min
  1410.     end
  1411.   end
  1412. end
  1413. end

  1414. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1415. #==============================================================================
  1416. # □ Scene_PartyForm
  1417. #------------------------------------------------------------------------------
  1418. #  パーティ編成画面の処理を行うクラスです。
  1419. #==============================================================================

  1420. class Scene_PartyForm < Scene_Base
  1421.   #--------------------------------------------------------------------------
  1422.   # ○ 定数
  1423.   #--------------------------------------------------------------------------
  1424.   CAPTION_OFFSET = 40  # キャプションウィンドウの位置補正
  1425.   HOST_MENU   = 0      # 呼び出し元 : メニュー
  1426.   HOST_MAP    = 1      # 呼び出し元 : マップ
  1427.   HOST_BATTLE = 2      # 呼び出し元 : 戦闘
  1428.   #--------------------------------------------------------------------------
  1429.   # ● オブジェクト初期化
  1430.   #     menu_index : コマンドのカーソル初期位置
  1431.   #     host_scene : 呼び出し元 (0..メニュー  1..マップ  2..戦闘)
  1432.   #--------------------------------------------------------------------------
  1433.   def initialize(menu_index = 0, host_scene = HOST_MENU)
  1434.     @menu_index = menu_index
  1435.     @host_scene = host_scene
  1436.   end
  1437.   #--------------------------------------------------------------------------
  1438.   # ● 開始処理
  1439.   #--------------------------------------------------------------------------
  1440.   def start
  1441.     super
  1442.     create_menu_background

  1443.     create_windows
  1444.     create_confirm_window
  1445.     adjust_window_location

  1446.     # 編成前のパーティを保存
  1447.     @battle_actors = $game_party.battle_members.dup
  1448.     @party_actors  = $game_party.all_members.dup
  1449.   end
  1450.   #--------------------------------------------------------------------------
  1451.   # ○ ウィンドウの作成
  1452.   #--------------------------------------------------------------------------
  1453.   def create_windows
  1454.     # 編成用ウィンドウを作成
  1455.     @battle_member_window = Window_PartyFormBattleMember.new
  1456.     @party_member_window  = Window_PartyFormAllMember.new
  1457.     @status_window        = Window_PartyFormStatus.new
  1458.     @status_window.set_actor(@battle_member_window.actor)

  1459.     # その他のウィンドウを作成
  1460.     @battle_member_caption_window =
  1461.       Window_PartyFormCaption.new(KGC::LargeParty::BATTLE_MEMBER_CAPTION)
  1462.     @party_member_caption_window =
  1463.       Window_PartyFormCaption.new(KGC::LargeParty::PARTY_MEMBER_CAPTION)
  1464.     @control_window = Window_PartyFormControl.new
  1465.   end
  1466.   #--------------------------------------------------------------------------
  1467.   # ○ 確認ウィンドウの作成
  1468.   #--------------------------------------------------------------------------
  1469.   def create_confirm_window
  1470.     commands = KGC::LargeParty::CONFIRM_WINDOW_COMMANDS
  1471.     @confirm_window =
  1472.       Window_Command.new(KGC::LargeParty::CONFIRM_WINDOW_WIDTH, commands)
  1473.     @confirm_window.index    = 0
  1474.     @confirm_window.openness = 0
  1475.     @confirm_window.active   = false
  1476.   end
  1477.   #--------------------------------------------------------------------------
  1478.   # ○ ウィンドウの座標調整
  1479.   #--------------------------------------------------------------------------
  1480.   def adjust_window_location
  1481.     # 基準座標を計算
  1482.     base_x = [@battle_member_window.width, @party_member_window.width].max
  1483.     base_x = [(Graphics.width - base_x) / 2, 0].max
  1484.     base_y = @battle_member_window.height + @party_member_window.height +
  1485.       @status_window.height + CAPTION_OFFSET * 2
  1486.     base_y = [(Graphics.height - base_y) / 2, 0].max
  1487.     base_z = @menuback_sprite.z + 1000

  1488.     # 編成用ウィンドウの座標をセット
  1489.     @battle_member_window.x = base_x
  1490.     @battle_member_window.y = base_y + CAPTION_OFFSET
  1491.     @battle_member_window.z = base_z
  1492.     @party_member_window.x = base_x
  1493.     @party_member_window.y = @battle_member_window.y +
  1494.       @battle_member_window.height + CAPTION_OFFSET
  1495.     @party_member_window.z = base_z
  1496.     @status_window.x = 0
  1497.     @status_window.y = @party_member_window.y + @party_member_window.height
  1498.     @status_window.z = base_z

  1499.     # その他のウィンドウの座標をセット
  1500.     @battle_member_caption_window.x = [base_x - 16, 0].max
  1501.     @battle_member_caption_window.y = @battle_member_window.y - CAPTION_OFFSET
  1502.     @battle_member_caption_window.z = base_z + 500
  1503.     @party_member_caption_window.x = [base_x - 16, 0].max
  1504.     @party_member_caption_window.y = @party_member_window.y - CAPTION_OFFSET
  1505.     @party_member_caption_window.z = base_z + 500
  1506.     @control_window.x = @status_window.width
  1507.     @control_window.y = @status_window.y
  1508.     @control_window.z = base_z

  1509.     @confirm_window.x = (Graphics.width - @confirm_window.width) / 2
  1510.     @confirm_window.y = (Graphics.height - @confirm_window.height) / 2
  1511.     @confirm_window.z = base_z + 1000
  1512.   end
  1513.   #--------------------------------------------------------------------------
  1514.   # ● 終了処理
  1515.   #--------------------------------------------------------------------------
  1516.   def terminate
  1517.     super
  1518.     dispose_menu_background
  1519.     @battle_member_window.dispose
  1520.     @party_member_window.dispose
  1521.     @status_window.dispose
  1522.     @battle_member_caption_window.dispose
  1523.     @party_member_caption_window.dispose
  1524.     @control_window.dispose
  1525.     @confirm_window.dispose
  1526.   end
  1527.   #--------------------------------------------------------------------------
  1528.   # ● メニュー画面系の背景作成
  1529.   #--------------------------------------------------------------------------
  1530.   def create_menu_background
  1531.     super
  1532.     @menuback_sprite.z = 20000
  1533.   end
  1534.   #--------------------------------------------------------------------------
  1535.   # ● 元の画面へ戻る
  1536.   #--------------------------------------------------------------------------
  1537.   def return_scene
  1538.     case @host_scene
  1539.     when HOST_MENU
  1540.       $scene = Scene_Menu.new(@menu_index)
  1541.     when HOST_MAP
  1542.       $scene = Scene_Map.new
  1543.     when HOST_BATTLE
  1544.       $scene = Scene_Battle.new
  1545.     end
  1546.     $game_player.refresh
  1547.   end
  1548.   #--------------------------------------------------------------------------
  1549.   # ● フレーム更新
  1550.   #--------------------------------------------------------------------------
  1551.   def update
  1552.     super
  1553.     update_menu_background
  1554.     update_window
  1555.     if @battle_member_window.active
  1556.       update_battle_member
  1557.     elsif @party_member_window.active
  1558.       update_party_member
  1559.     elsif @confirm_window.active
  1560.       update_confirm
  1561.     end
  1562.   end
  1563.   #--------------------------------------------------------------------------
  1564.   # ○ ウィンドウ更新
  1565.   #--------------------------------------------------------------------------
  1566.   def update_window
  1567.     @battle_member_window.update
  1568.     @party_member_window.update
  1569.     @status_window.update
  1570.     @battle_member_caption_window.update
  1571.     @party_member_caption_window.update
  1572.     @control_window.update
  1573.     @confirm_window.update
  1574.   end
  1575.   #--------------------------------------------------------------------------
  1576.   # ○ ウィンドウ再描画
  1577.   #--------------------------------------------------------------------------
  1578.   def refresh_window
  1579.     @battle_member_window.refresh
  1580.     @party_member_window.refresh
  1581.   end
  1582.   #--------------------------------------------------------------------------
  1583.   # ○ フレーム更新 (戦闘メンバーウィンドウがアクティブの場合)
  1584.   #--------------------------------------------------------------------------
  1585.   def update_battle_member
  1586.     @status_window.set_actor(@battle_member_window.actor)
  1587.     if Input.trigger?(Input::A)
  1588.       if @battle_member_window.selected_index == nil  # 並び替え中でない
  1589.         actor = @battle_member_window.actor
  1590.         # アクターを外せない場合
  1591.         if actor == nil || $game_party.actor_fixed?(actor.id)
  1592.           Sound.play_buzzer
  1593.           return
  1594.         end
  1595.         # アクターを外す
  1596.         Sound.play_decision
  1597.         actors = $game_party.battle_members
  1598.         actors.delete_at(@battle_member_window.index)
  1599.         $game_party.set_battle_member(actors)
  1600.         refresh_window
  1601.       end
  1602.     elsif Input.trigger?(Input::B)
  1603.       if @battle_member_window.selected_index == nil  # 並び替え中でない
  1604.         # 確認ウィンドウに切り替え
  1605.         Sound.play_cancel
  1606.         show_confirm_window
  1607.       else                                            # 並び替え中
  1608.         # 並び替え解除
  1609.         Sound.play_cancel
  1610.         @battle_member_window.selected_index = nil
  1611.         @battle_member_window.refresh
  1612.         @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
  1613.       end
  1614.     elsif Input.trigger?(Input::C)
  1615.       if @battle_member_window.selected_index == nil  # 並び替え中でない
  1616.         actor = @battle_member_window.actor
  1617.         # アクターを外せない場合
  1618.         if actor != nil && $game_party.actor_fixed?(actor.id)
  1619.           Sound.play_buzzer
  1620.           return
  1621.         end
  1622.         # パーティメンバーウィンドウに切り替え
  1623.         Sound.play_decision
  1624.         @battle_member_window.active = false
  1625.         @party_member_window.active = true
  1626.         @control_window.mode = Window_PartyFormControl::MODE_PARTY_MEMBER
  1627.       else                                            # 並び替え中
  1628.         unless can_change_shift?(@battle_member_window.actor)
  1629.           Sound.play_buzzer
  1630.           return
  1631.         end
  1632.         # 並び替え実行
  1633.         Sound.play_decision
  1634.         index1 = @battle_member_window.selected_index
  1635.         index2 = @battle_member_window.index
  1636.         change_shift(index1, index2)
  1637.         @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
  1638.       end
  1639.     elsif Input.trigger?(Input::X)
  1640.       # 並び替え不可能な場合
  1641.       unless can_change_shift?(@battle_member_window.actor)
  1642.         Sound.play_buzzer
  1643.         return
  1644.       end
  1645.       if @battle_member_window.selected_index == nil  # 並び替え中でない
  1646.         # 並び替え開始
  1647.         Sound.play_decision
  1648.         @battle_member_window.selected_index = @battle_member_window.index
  1649.         @battle_member_window.refresh
  1650.         @control_window.mode = Window_PartyFormControl::MODE_SHIFT_CHANGE
  1651.       else                                            # 並び替え中
  1652.         # 並び替え実行
  1653.         Sound.play_decision
  1654.         index1 = @battle_member_window.selected_index
  1655.         index2 = @battle_member_window.index
  1656.         change_shift(index1, index2)
  1657.         @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
  1658.       end
  1659.     end
  1660.   end
  1661.   #--------------------------------------------------------------------------
  1662.   # ○ 並び替え可否判定
  1663.   #--------------------------------------------------------------------------
  1664.   def can_change_shift?(actor)
  1665.     # 選択したアクターが存在しない、または並び替え不能な場合
  1666.     if actor == nil ||
  1667.         (KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED &&
  1668.          $game_party.actor_fixed?(actor.id))
  1669.       return false
  1670.     end
  1671.     return true
  1672.   end
  1673.   #--------------------------------------------------------------------------
  1674.   # ○ 並び替え
  1675.   #--------------------------------------------------------------------------
  1676.   def change_shift(index1, index2)
  1677.     # 位置を入れ替え
  1678.     $game_party.change_shift(index1, index2)
  1679.     # 選択済みインデックスをクリア
  1680.     @battle_member_window.selected_index = nil
  1681.     refresh_window
  1682.   end
  1683.   #--------------------------------------------------------------------------
  1684.   # ○ フレーム更新 (パーティウィンドウがアクティブの場合)
  1685.   #--------------------------------------------------------------------------
  1686.   def update_party_member
  1687.     @status_window.set_actor(@party_member_window.actor)
  1688.     if Input.trigger?(Input::B)
  1689.       Sound.play_cancel
  1690.       # 戦闘メンバーウィンドウに切り替え
  1691.       @battle_member_window.active = true
  1692.       @party_member_window.active = false
  1693.         @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
  1694.     elsif Input.trigger?(Input::C)
  1695.       actor = @party_member_window.actor
  1696.       # アクターが戦闘メンバーに含まれる場合
  1697.       if $game_party.battle_members.include?(actor)
  1698.         Sound.play_buzzer
  1699.         return
  1700.       end
  1701.       # アクターを入れ替え
  1702.       Sound.play_decision
  1703.       actors = $game_party.all_members
  1704.       battle_actors = $game_party.battle_members
  1705.       if @battle_member_window.actor != nil
  1706.         actors[@party_member_window.actor_index] = @battle_member_window.actor
  1707.         actors[@battle_member_window.index] = actor
  1708.         $game_party.set_member(actors.compact)
  1709.       end
  1710.       battle_actors[@battle_member_window.index] = actor
  1711.       $game_party.set_battle_member(battle_actors.compact)
  1712.       refresh_window
  1713.       # 戦闘メンバーウィンドウに切り替え
  1714.       @battle_member_window.active = true
  1715.       @party_member_window.active = false
  1716.       @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
  1717.     end
  1718.   end
  1719.   #--------------------------------------------------------------------------
  1720.   # ○ フレーム更新 (確認ウィンドウがアクティブの場合)
  1721.   #--------------------------------------------------------------------------
  1722.   def update_confirm
  1723.     if Input.trigger?(Input::B)
  1724.       Sound.play_cancel
  1725.       hide_confirm_window
  1726.     elsif Input.trigger?(Input::C)
  1727.       case @confirm_window.index
  1728.       when 0  # 編成完了
  1729.         # パーティが無効の場合
  1730.         unless battle_member_valid?
  1731.           Sound.play_buzzer
  1732.           return
  1733.         end
  1734.         Sound.play_decision
  1735.         return_scene
  1736.       when 1  # 編成中断
  1737.         Sound.play_decision
  1738.         # パーティを編成前の状態に戻す
  1739.         $game_party.set_member(@party_actors)
  1740.         $game_party.set_battle_member(@battle_actors)
  1741.         return_scene
  1742.       when 2  # キャンセル
  1743.         Sound.play_cancel
  1744.         hide_confirm_window
  1745.       end
  1746.     end
  1747.   end
  1748.   #--------------------------------------------------------------------------
  1749.   # ○ 戦闘メンバー有効判定
  1750.   #--------------------------------------------------------------------------
  1751.   def battle_member_valid?
  1752.     return false if $game_party.battle_members.size == 0  # 戦闘メンバーが空
  1753.     $game_party.battle_members.each { |actor|
  1754.       return true if actor.exist?  # 生存者がいればOK
  1755.     }
  1756.     return false
  1757.   end
  1758.   #--------------------------------------------------------------------------
  1759.   # ○ 確認ウィンドウの表示
  1760.   #--------------------------------------------------------------------------
  1761.   def show_confirm_window
  1762.     if @battle_member_window.active
  1763.       @last_active_window = @battle_member_window
  1764.     else
  1765.       @last_active_window = @party_member_window
  1766.     end
  1767.     @battle_member_window.active = false
  1768.     @party_member_window.active = false

  1769.     @confirm_window.draw_item(0, battle_member_valid?)
  1770.     @confirm_window.open
  1771.     @confirm_window.active = true
  1772.   end
  1773.   #--------------------------------------------------------------------------
  1774.   # ○ 確認ウィンドウの非表示
  1775.   #--------------------------------------------------------------------------
  1776.   def hide_confirm_window
  1777.     @confirm_window.active = false
  1778.     @confirm_window.close
  1779.     @last_active_window.active = true
  1780.   end
  1781. end

  1782. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1783. #==============================================================================
  1784. # ■ Scene_Battle
  1785. #==============================================================================

  1786. class Scene_Battle < Scene_Base
  1787.   #--------------------------------------------------------------------------
  1788.   # ● メッセージ表示が終わるまでウェイト
  1789.   #--------------------------------------------------------------------------
  1790.   alias wait_for_message_KGC_LargeParty wait_for_message
  1791.   def wait_for_message
  1792.     return if @ignore_wait_for_message  # メッセージ終了までのウェイトを無視

  1793.     wait_for_message_KGC_LargeParty
  1794.   end
  1795.   #--------------------------------------------------------------------------
  1796.   # ● レベルアップの表示
  1797.   #--------------------------------------------------------------------------
  1798.   alias display_level_up_KGC_LargeParty display_level_up
  1799.   def display_level_up
  1800.     @ignore_wait_for_message = true

  1801.     display_level_up_KGC_LargeParty

  1802.     exp = $game_troop.exp_total * KGC::LargeParty::STAND_BY_EXP_RATE / 1000
  1803.     $game_party.stand_by_members.each { |actor|
  1804.       if actor.exist?
  1805.         actor.gain_exp(exp, KGC::LargeParty::SHOW_STAND_BY_LEVEL_UP)
  1806.       end
  1807.     }
  1808.     @ignore_wait_for_message = false
  1809.     wait_for_message
  1810.   end
  1811.   #--------------------------------------------------------------------------
  1812.   # ● パーティコマンド選択の開始
  1813.   #--------------------------------------------------------------------------
  1814.   alias start_party_command_selection_KGC_LargeParty start_party_command_selection
  1815.   def start_party_command_selection
  1816.     if $game_temp.in_battle
  1817.       @status_window.index = 0
  1818.     end

  1819.     start_party_command_selection_KGC_LargeParty
  1820.   end

  1821.   if KGC::LargeParty::USE_BATTLE_PARTYFORM

  1822.   #--------------------------------------------------------------------------
  1823.   # ● 情報表示ビューポートの作成
  1824.   #--------------------------------------------------------------------------
  1825.   alias create_info_viewport_KGC_LargeParty create_info_viewport
  1826.   def create_info_viewport
  1827.     create_info_viewport_KGC_LargeParty

  1828.     @__command_partyform_index =
  1829.       @party_command_window.add_command(Vocab.partyform_battle)
  1830.     @party_command_window.draw_item(@__command_partyform_index,
  1831.       $game_party.battle_partyform_enable?)
  1832.   end
  1833.   #--------------------------------------------------------------------------
  1834.   # ● パーティコマンド選択の更新
  1835.   #--------------------------------------------------------------------------
  1836.   alias update_party_command_selection_KGC_LargeParty update_party_command_selection
  1837.   def update_party_command_selection
  1838.     if Input.trigger?(Input::C)
  1839.       case @party_command_window.index
  1840.       when @__command_partyform_index  # パーティ編成
  1841.         unless $game_party.battle_partyform_enable?
  1842.           Sound.play_buzzer
  1843.           return
  1844.         end
  1845.         Sound.play_decision
  1846.         process_partyform
  1847.         return
  1848.       end
  1849.     end

  1850.     update_party_command_selection_KGC_LargeParty
  1851.   end
  1852.   #--------------------------------------------------------------------------
  1853.   # ○ パーティ編成の処理
  1854.   #--------------------------------------------------------------------------
  1855.   def process_partyform
  1856.     prev_party_command_active = @party_command_window.active
  1857.     @party_command_window.active = false
  1858.     Graphics.freeze
  1859.     snapshot_for_background
  1860.     $scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_BATTLE)
  1861.     $scene.main
  1862.     $scene = self
  1863.     @spriteset.update_actors
  1864.     @status_window.refresh
  1865.     @party_command_window.active = prev_party_command_active
  1866.     Window_Base.show_cursor_animation if $imported["CursorAnimation"]
  1867.     perform_transition
  1868.   end
  1869.   #--------------------------------------------------------------------------
  1870.   # ● 敗北の処理
  1871.   #--------------------------------------------------------------------------
  1872.   alias process_defeat_KGC_LargeParty process_defeat
  1873.   def process_defeat
  1874.     process_defeat_launch

  1875.     process_defeat_KGC_LargeParty if $game_party.all_dead?
  1876.   end
  1877.   #--------------------------------------------------------------------------
  1878.   # ○ 全滅時の入れ替え処理
  1879.   #--------------------------------------------------------------------------
  1880.   def process_defeat_launch
  1881.     while @spriteset.animation?
  1882.       update_basic
  1883.     end

  1884.     return unless KGC::LargeParty::ENABLE_DEFEAT_LAUNCH
  1885.     return unless $game_party.partyform_enable?

  1886.     exist = false
  1887.     $game_party.all_members.each { |actor| exist |= actor.exist? }
  1888.     return unless exist  # 生存者なし

  1889.     @info_viewport.visible  = false
  1890.     @message_window.visible = true

  1891.     # 戦闘可能者を出撃 (固定アクターは残す)
  1892.     $game_party.remove_all_battle_member
  1893.     max = $game_party.max_battle_member_count
  1894.     while ($game_party.battle_members.size < max)
  1895.       actor = $game_party.stand_by_members.find { |a| a.exist? }
  1896.       break if actor == nil
  1897.       $game_party.add_battle_member(actor.id)
  1898.       @status_window.refresh
  1899.       display_launch(actor)
  1900.     end

  1901.     @info_viewport.visible  = true
  1902.     @message_window.visible = false
  1903.     @message_window.clear
  1904.   end
  1905.   #--------------------------------------------------------------------------
  1906.   # ○ 出撃の表示
  1907.   #     target : 対象者 (アクター)
  1908.   #--------------------------------------------------------------------------
  1909.   def display_launch(target)
  1910.     text = sprintf(Vocab::DefeatLaunch, target.name)
  1911.     @message_window.add_instant_text(text)
  1912.     wait(40)
  1913.   end

  1914.   end  # <-- if KGC::LargeParty::USE_BATTLE_PARTYFORM
  1915. end
  1916. (建议搭配队友跟随脚本    老规矩        来源:度娘)
  1917. class Game_Player
  1918. #--------------------------------------------------------------------------
  1919. # * Move Down
  1920. # turn_enabled : a flag permits direction change on that spot
  1921. #--------------------------------------------------------------------------
  1922. def move_down(turn_enabled = true)
  1923. super(turn_enabled)
  1924. end
  1925. #--------------------------------------------------------------------------
  1926. # * Move Left
  1927. # turn_enabled : a flag permits direction change on that spot
  1928. #--------------------------------------------------------------------------
  1929. def move_left(turn_enabled = true)
  1930. super(turn_enabled)
  1931. end
  1932. #--------------------------------------------------------------------------
  1933. # * Move Right
  1934. # turn_enabled : a flag permits direction change on that spot
  1935. #--------------------------------------------------------------------------
  1936. def move_right(turn_enabled = true)
  1937. super(turn_enabled)
  1938. end
  1939. #--------------------------------------------------------------------------
  1940. # * Move up
  1941. # turn_enabled : a flag permits direction change on that spot
  1942. #--------------------------------------------------------------------------
  1943. def move_up(turn_enabled = true)
  1944. super(turn_enabled)
  1945. end
  1946. #--------------------------------------------------------------------------
  1947. # * Move Lower Left
  1948. #--------------------------------------------------------------------------
  1949. def move_lower_left
  1950. super
  1951. end
  1952. #--------------------------------------------------------------------------
  1953. # * Move Lower Right
  1954. #--------------------------------------------------------------------------
  1955. def move_lower_right
  1956. super
  1957. end
  1958. #--------------------------------------------------------------------------
  1959. # * Move Upper Left
  1960. #--------------------------------------------------------------------------
  1961. def move_upper_left
  1962. super
  1963. end
  1964. #--------------------------------------------------------------------------
  1965. # * Move Upper Right
  1966. #--------------------------------------------------------------------------
  1967. def move_upper_right
  1968. super
  1969. end
  1970. end

  1971. class Game_Follower < Game_Character
  1972. #--------------------------------------------------------------------------
  1973. # * Public Instance Variables
  1974. #--------------------------------------------------------------------------
  1975. attr_reader :actor
  1976. attr_accessor :move_speed
  1977. #--------------------------------------------------------------------------
  1978. # * Object Initialization
  1979. #--------------------------------------------------------------------------
  1980. def initialize(actor)
  1981. super()
  1982. @through = true
  1983. @actor = actor
  1984. end
  1985. #--------------------------------------------------------------------------
  1986. # * Set Actor
  1987. #--------------------------------------------------------------------------
  1988. def actor=(actor)
  1989. @actor = actor
  1990. setup
  1991. end
  1992. #--------------------------------------------------------------------------
  1993. # * Setup
  1994. #--------------------------------------------------------------------------
  1995. def setup
  1996. if @actor != nil
  1997. @character_name = $game_actors[@actor].character_name
  1998. @character_index = $game_actors[@actor].character_index
  1999. else
  2000. @character_name = ""
  2001. @character_index = 0
  2002. end
  2003. @opacity = 255
  2004. @blend_type = 0
  2005. @priority_type = 0
  2006. end

  2007. #--------------------------------------------------------------------------
  2008. # * Screen Z
  2009. #--------------------------------------------------------------------------
  2010. def screen_z
  2011. if $game_player.x == @x and $game_player.y == @y
  2012. return $game_player.screen_z - 1
  2013. end
  2014. super
  2015. end
  2016. #--------------------------------------------------------------------------
  2017. # * Same Position Starting Determinant (Disabled)
  2018. #--------------------------------------------------------------------------
  2019. def check_event_trigger_here(triggers)
  2020. result = false
  2021. return result
  2022. end
  2023. #--------------------------------------------------------------------------
  2024. # * Front Envent Starting Determinant (Disabled)
  2025. #--------------------------------------------------------------------------
  2026. def check_event_trigger_there(triggers)
  2027. result = false
  2028. return result
  2029. end
  2030. #--------------------------------------------------------------------------
  2031. # * Touch Event Starting Determinant (Disabled)
  2032. #--------------------------------------------------------------------------
  2033. def check_event_trigger_touch(x, y)
  2034. result = false
  2035. return result
  2036. end
  2037. end

  2038. class Spriteset_Map
  2039. alias_method :spriteset_map_create_characters, :create_characters
  2040. def create_characters
  2041. spriteset_map_create_characters
  2042. $game_party.followers.each do |char|
  2043. @character_sprites << Sprite_Character.new(@viewport1, char)
  2044. end
  2045. end
  2046. end

  2047. class Game_Party
  2048. #--------------------------------------------------------------------------
  2049. # * Constants
  2050. #--------------------------------------------------------------------------
  2051. MAX_SIZE = 8
  2052. CATERPILLAR = 2
  2053. #--------------------------------------------------------------------------
  2054. # * Public Instance Variables
  2055. #--------------------------------------------------------------------------
  2056. attr_reader :followers
  2057. #--------------------------------------------------------------------------
  2058. # * Object Initialization
  2059. #--------------------------------------------------------------------------
  2060. alias_method :trick_caterpillar_party_initialize, :initialize
  2061. def initialize
  2062. trick_caterpillar_party_initialize
  2063. @followers = Array.new(MAX_SIZE - 1) {Game_Follower.new(nil)}
  2064. @move_list = []
  2065. end
  2066. #--------------------------------------------------------------------------
  2067. # * Update Followers
  2068. #--------------------------------------------------------------------------
  2069. def update_followers
  2070. flag = $game_player.transparent || $game_switches[CATERPILLAR]
  2071. @followers.each_with_index do |char, i|
  2072. char.actor = @actors[i + 1]
  2073. char.move_speed = $game_player.move_speed
  2074. if $game_player.dash?
  2075. char.move_speed += 1
  2076. end
  2077. char.update
  2078. char.transparent = flag
  2079. end
  2080. end
  2081. #--------------------------------------------------------------------------
  2082. # * Move To Party
  2083. #--------------------------------------------------------------------------
  2084. def moveto_party(x, y)
  2085. @followers.each {|char| char.moveto(x, y)}
  2086. @move_list.clear
  2087. end
  2088. #--------------------------------------------------------------------------
  2089. # * Move Party
  2090. #--------------------------------------------------------------------------
  2091. def move_party
  2092. @move_list.each_index do |i|
  2093. if @followers[i] == nil
  2094. @move_list[[email]i...@move_list.size[/email]] = nil
  2095. next
  2096. end
  2097. case @move_list[i].type
  2098. when 2
  2099. @followers[i].move_down(*@move_list[i].args)
  2100. when 4
  2101. @followers[i].move_left(*@move_list[i].args)
  2102. when 6
  2103. @followers[i].move_right(*@move_list[i].args)
  2104. when 8
  2105. @followers[i].move_up(*@move_list[i].args)
  2106. when j
  2107. @followers[i].move_lower_left
  2108. when 3
  2109. @followers[i].move_lower_right
  2110. when 7
  2111. @followers[i].move_upper_left
  2112. when 9
  2113. @followers[i].move_upper_right
  2114. when 5
  2115. @followers[i].jump(*@move_list[i].args)
  2116. end
  2117. end
  2118. end
  2119. #--------------------------------------------------------------------------
  2120. # * Add Move List
  2121. #--------------------------------------------------------------------------
  2122. def update_move(type, *args)
  2123. move_party
  2124. @move_list.unshift(Game_MoveListElement.new(type, args))
  2125. end
  2126. end

  2127. class Game_MoveListElement
  2128. #--------------------------------------------------------------------------
  2129. # * Object Initialization
  2130. #--------------------------------------------------------------------------
  2131. def initialize(type, args)
  2132. @type = type
  2133. @args = args
  2134. end
  2135. #--------------------------------------------------------------------------
  2136. # * Type
  2137. #--------------------------------------------------------------------------
  2138. def type
  2139. return @type
  2140. end
  2141. #--------------------------------------------------------------------------
  2142. # * Args
  2143. #--------------------------------------------------------------------------
  2144. def args
  2145. return @args
  2146. end
  2147. end

  2148. class Game_Player
  2149. #--------------------------------------------------------------------------
  2150. # * Public Instance Variables
  2151. #--------------------------------------------------------------------------
  2152. attr_reader :move_speed

  2153. #--------------------------------------------------------------------------
  2154. # * Update
  2155. #--------------------------------------------------------------------------
  2156. alias_method :trick_caterpillar_player_update, :update
  2157. def update
  2158. $game_party.update_followers
  2159. trick_caterpillar_player_update
  2160. end
  2161. #--------------------------------------------------------------------------
  2162. # * Moveto
  2163. #--------------------------------------------------------------------------
  2164. alias_method :trick_caterpillar_player_moveto, :moveto
  2165. def moveto(x, y)
  2166. $game_party.moveto_party(x, y)
  2167. trick_caterpillar_player_moveto(x, y)
  2168. end
  2169. #--------------------------------------------------------------------------
  2170. # * Move Down
  2171. #--------------------------------------------------------------------------
  2172. alias_method :trick_caterpillar_player_move_down, :move_down
  2173. def move_down(turn_enabled = true)
  2174. if passable?(@x, @y+1)
  2175. $game_party.update_move(2, turn_enabled)
  2176. end
  2177. trick_caterpillar_player_move_down(turn_enabled)
  2178. end
  2179. #--------------------------------------------------------------------------
  2180. # * Move Left
  2181. #--------------------------------------------------------------------------
  2182. alias_method :trick_caterpillar_player_move_left, :move_left
  2183. def move_left(turn_enabled = true)
  2184. if passable?(@x-1, @y)
  2185. $game_party.update_move(4, turn_enabled)
  2186. end
  2187. trick_caterpillar_player_move_left(turn_enabled)
  2188. end
  2189. #--------------------------------------------------------------------------
  2190. # * Move Right
  2191. #--------------------------------------------------------------------------
  2192. alias_method :trick_caterpillar_player_move_right, :move_right
  2193. def move_right(turn_enabled = true)
  2194. if passable?(@x+1, @y)
  2195. $game_party.update_move(6, turn_enabled)
  2196. end
  2197. trick_caterpillar_player_move_right(turn_enabled)
  2198. end
  2199. #--------------------------------------------------------------------------
  2200. # * Move Up
  2201. #--------------------------------------------------------------------------
  2202. alias_method :trick_caterpillar_player_move_up, :move_up
  2203. def move_up(turn_enabled = true)
  2204. if passable?(@x, @y-1)
  2205. $game_party.update_move(8, turn_enabled)
  2206. end
  2207. trick_caterpillar_player_move_up(turn_enabled)
  2208. end
  2209. #--------------------------------------------------------------------------
  2210. # * Move Lower Left
  2211. #--------------------------------------------------------------------------
  2212. alias_method :trick_caterpillar_player_move_lower_left, :move_lower_left
  2213. def move_lower_left
  2214. if passable?(@x - 1, @y) and passable?(@x, @y + 1)
  2215. $game_party.update_move(1)
  2216. end
  2217. trick_caterpillar_player_move_lower_left
  2218. end
  2219. #--------------------------------------------------------------------------
  2220. # * Move Lower Right
  2221. #--------------------------------------------------------------------------
  2222. alias_method :trick_caterpillar_player_move_lower_right, :move_lower_right
  2223. def move_lower_right
  2224. if passable?(@x + 1, @y) and passable?(@x, @y + 1)
  2225. $game_party.update_move(3)
  2226. end
  2227. trick_caterpillar_player_move_lower_right
  2228. end
  2229. #--------------------------------------------------------------------------
  2230. # * Move Upper Left
  2231. #--------------------------------------------------------------------------
  2232. alias_method :trick_caterpillar_player_move_upper_left, :move_upper_left
  2233. def move_upper_left
  2234. if passable?(@x - 1, @y) and passable?(@x, @y - 1)
  2235. $game_party.update_move(7)
  2236. end
  2237. trick_caterpillar_player_move_upper_left
  2238. end
  2239. #--------------------------------------------------------------------------
  2240. # * Move Upper Right
  2241. #--------------------------------------------------------------------------
  2242. alias_method :trick_caterpillar_player_move_upper_right, :move_upper_right
  2243. def move_upper_right
  2244. if passable?(@x + 1, @y) and passable?(@x, @y - 1)
  2245. $game_party.update_move(9)
  2246. end
  2247. trick_caterpillar_player_move_upper_right
  2248. end
  2249. #--------------------------------------------------------------------------
  2250. # * Jump
  2251. #--------------------------------------------------------------------------
  2252. alias_method :trick_caterpillar_player_jump, :jump
  2253. def jump(x_plus, y_plus)
  2254. new_x = @x + x_plus
  2255. new_y = @y + y_plus
  2256. if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y)
  2257. $game_party.update_move(5, x_plus, y_plus)
  2258. end
  2259. trick_caterpillar_player_jump(x_plus, y_plus)
  2260. end
  2261. end###########
  2262. ###########
  2263. ###########
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
 楼主| 发表于 2015-6-22 23:14:27 | 显示全部楼层
本帖最后由 怪蜀黍 于 2015-6-23 20:56 编辑
  1. (读取VX备注的脚本       来源:度娘)
  2. #==============================================================================
  3. # 读取rmvx备注栏指定字段 by 沉影不器
  4. # -----------------------------------------------------------------------------
  5. # 使用方法:
  6. #           在vx数据库比如1号物品的备注栏里书写: 耐久度 = 10
  7. #           读取时使用: p $data_items[1].read_note('耐久度')
  8. # 几点注意:
  9. #           ① 忽略空格
  10. #           ② 返回值为文本格式
  11. #==============================================================================
  12. module RPG
  13.   #=============================================================================
  14.   # ■ BaseItem
  15.   #=============================================================================
  16.   class BaseItem
  17.     #-------------------------------------------------------------------------
  18.     # ○ 读取rmvx备注栏指定字段
  19.     #     section : 字段名
  20.     #     ignore_caps : 忽略大小写(仅字段名)
  21.     #-------------------------------------------------------------------------
  22.     def read_note(section, ignore_caps = false)
  23.       result = ''
  24.       # 忽略大小写时,全部转大写
  25.       section.upcase! if ignore_caps
  26.       # 转symbol方便比较
  27.       s = section.to_sym
  28.       self.note.each_line{|line|
  29.         temp = line.split(/=/)
  30.         # 去掉干扰字符
  31.         temp.each {|i| i.strip!}
  32.         temp[0].upcase! if ignore_caps
  33.         if temp[0].to_sym == s
  34.           unless temp[1] == nil
  35.             result = temp[1]
  36.           end
  37.           # 如果希望同名字段值覆盖前面的字段,去掉下一行
  38.           break
  39.         end
  40.       }
  41.       return result
  42.     end
  43.   end
  44.   #=============================================================================
  45.   # ■ Enemy
  46.   #=============================================================================
  47.   class Enemy
  48.     #-------------------------------------------------------------------------
  49.     # ○ 读取rmvx备注栏指定字段
  50.     #     section : 字段名
  51.     #     ignore_caps : 忽略大小写(仅字段名)
  52.     #-------------------------------------------------------------------------
  53.     def read_note(section, ignore_caps = false)
  54.       result = ''
  55.       # 忽略大小写时,全部转大写
  56.       section.upcase! if ignore_caps
  57.       # 转symbol方便比较
  58.       s = section.to_sym
  59.       self.note.each_line{|line|
  60.         temp = line.split(/=/)
  61.         # 去掉干扰字符
  62.         temp.each {|i| i.strip!}
  63.         temp[0].upcase! if ignore_caps
  64.         if temp[0].to_sym == s
  65.           unless temp[1] == nil
  66.             result = temp[1]
  67.           end
  68.           # 如果希望同名字段值覆盖前面的字段,去掉下一行
  69.           break
  70.         end
  71.       }
  72.       return result
  73.     end
  74.   end
  75.   #=============================================================================
  76.   # ■ State
  77.   #=============================================================================
  78.   class State
  79.     #-------------------------------------------------------------------------
  80.     # ○ 读取rmvx备注栏指定字段
  81.     #     section : 字段名
  82.     #     ignore_caps : 忽略大小写(仅字段名)
  83.     #-------------------------------------------------------------------------
  84.     def read_note(section, ignore_caps = false)
  85.       result = ''
  86.       # 忽略大小写时,全部转大写
  87.       section.upcase! if ignore_caps
  88.       # 转symbol方便比较
  89.       s = section.to_sym
  90.       self.note.each_line{|line|
  91.         temp = line.split(/=/)
  92.         # 去掉干扰字符
  93.         temp.each {|i| i.strip!}
  94.         temp[0].upcase! if ignore_caps
  95.         if temp[0].to_sym == s
  96.           unless temp[1] == nil
  97.             result = temp[1]
  98.           end
  99.           # 如果希望同名字段值覆盖前面的字段,去掉下一行
  100.           break
  101.         end
  102.       }
  103.       return result
  104.     end
  105.   end
  106. end
复制代码

点评

吾印象中这个是通用脚本,可以在VA里使用~还有,发脚本请使用脚本框代码  发表于 2015-6-23 20:56
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-28 16:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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