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

Project1

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

[已经解决] 为什么修改分辨率/装备栏改造/伤害显示脚本之间有BUG?

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7098
在线时间
887 小时
注册时间
2015-2-10
帖子
248
跳转到指定楼层
1
发表于 2021-10-12 19:10:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
50星屑
本帖最后由 fbeds 于 2021-10-12 19:11 编辑

这是修改游戏分辨率的脚本:
RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ String
  4. #------------------------------------------------------------------------------
  5. #  String 类追加定义。
  6. #==============================================================================
  7.  
  8. class String
  9.   #----------------------------------------------------------------------------
  10.   # ● API
  11.   #----------------------------------------------------------------------------
  12.   @@MultiByteToWideChar  = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
  13.   @@WideCharToMultiByte  = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
  14.   #----------------------------------------------------------------------------
  15.   # ● UTF-8 转 Unicode
  16.   #----------------------------------------------------------------------------
  17.   def u2w
  18.     i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0)
  19.     buffer = "\0" * (i*2)
  20.     @@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i)
  21.     buffer.chop!
  22.     return buffer
  23.   end  
  24.   #----------------------------------------------------------------------------
  25.   # ● UTF-8 转系统编码
  26.   #----------------------------------------------------------------------------
  27.   def u2s
  28.     i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0)
  29.     buffer = "\0" * (i*2)
  30.     @@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i)
  31.     i = @@WideCharToMultiByte.call(0, 0, buffer, -1, nil, 0, nil, nil)
  32.     result = "\0" * i
  33.     @@WideCharToMultiByte.call(0, 0, buffer, -1, result, i, nil, nil)
  34.     result.chop!
  35.     return result
  36.   end
  37.   #----------------------------------------------------------------------------
  38.   # ● 系统编码转 UTF-8
  39.   #----------------------------------------------------------------------------
  40.   def s2u
  41.     i = @@MultiByteToWideChar.call(0, 0, self, -1, nil, 0)
  42.     buffer = "\0" * (i*2)
  43.     @@MultiByteToWideChar.call(0, 0, self, -1, buffer, buffer.size / 2)
  44.     i = @@WideCharToMultiByte.call(65001, 0, buffer, -1, nil, 0, nil, nil)
  45.     result = "\0" * i
  46.     @@WideCharToMultiByte.call(65001, 0, buffer, -1, result, result.size, nil, nil)
  47.     result.chop!
  48.     return result
  49.   end
  50. end
  51.  
  52. #==============================================================================
  53. # ■ AceResolutionMemoryPatch
  54. #------------------------------------------------------------------------------
  55. #  用于调整RMACE分辨率的内存补丁脚本,免修改DLL。
  56. #
  57. #   by 灼眼的夏娜(感谢fux2君提供内存地址)
  58. #==============================================================================
  59. # 更多脚本请转到 [url]www.66rpg.com[/url]。
  60. #==============================================================================
  61. module AceResolutionMemoryPatch
  62.  
  63.   GetModuleFileName       = Win32API.new("kernel32", "GetModuleFileName", "lpl", "l")
  64.   GetPrivateProfileString = Win32API.new("kernel32", "GetPrivateProfileString", "pppplp", "l")
  65.   GetModuleHandle         = Win32API.new("kernel32", "GetModuleHandle", "p", "l")
  66.   RtlMoveMemory           = Win32API.new("kernel32", "RtlMoveMemory", "pli", "v")
  67.   RtlMoveMemoryLP         = Win32API.new("kernel32", "RtlMoveMemory", "lpi", "v")
  68.   VirtualProtect          = Win32API.new("kernel32", "VirtualProtect", "lllp", "i")
  69.   FindWindow              = Win32API.new("user32", "FindWindow", "pp", "l")
  70.  
  71.   module_function
  72.  
  73.   def patch(width = 1024, height = 768)
  74.     # 获取句柄
  75.     path = 0.chr * 256
  76.     return false if 0 == GetModuleFileName.call(0, path, path.size)
  77.     path = path.s2u.gsub!(/.exe/ ,".ini").u2s
  78.     buff = 0.chr * 256
  79.     return false if 0 == GetPrivateProfileString.call("Game", "Library", nil, buff, buff.size, path)
  80.     buff.delete!("\0")
  81.     rgsshandle = GetModuleHandle.call(buff)
  82.     # 获取标题名和脚本名字
  83.     title = 0.chr * 256
  84.     return false if 0 == GetPrivateProfileString.call("Game", "Title", nil, title, title.size, path)
  85.     title = title.s2u.delete("\0").u2s
  86.     scripts = 0.chr * 256
  87.     return false if 0 == GetPrivateProfileString.call("Game", "Scripts", nil, scripts, scripts.size, path)
  88.     scripts = scripts.s2u.delete("\0").u2w
  89.     # 地址表
  90.     addr =
  91.     {
  92.       # 直接宽度替换
  93.       :w0 => [0x000016EE, 0x000020F6, 0x000020FF, 0x0010DFED, 0x0010E025, 0x0010E059, 0x0010E08D, 0x000019AA, 0x00001A5B, 0x0001C528, 0x0001F49C, 0x0010E7E7, 0x0010EFE9],
  94.       # 直接高度替换
  95.       :h0 => [0x000016E9, 0x00002106, 0x0000210F, 0x0010DFE8, 0x0010E020, 0x0010E054, 0x0010E088, 0x000019A5, 0x00001A56, 0x0001C523, 0x0001F497, 0x0010E803, 0x0010EFF9],
  96.  
  97.       # 宽度+32
  98.       :w1 => [0x000213E4],
  99.       # 高度+32
  100.       :h1 => [0x000213DF],
  101.  
  102.       # 最大宽度/32+1
  103.       :w2 => [0x00021FE1],
  104.       # 最大高度/32+1
  105.       :h2 => [0x00021F5D]
  106.     }
  107.     # 更新
  108.     w0 = [width].pack("L")
  109.     addr[:w0].each{|ofs| return false if !write_memory(rgsshandle + ofs, w0)}
  110.     h0 = [height].pack("L")
  111.     addr[:h0].each{|ofs| return false if !write_memory(rgsshandle + ofs, h0)}
  112.     w1 = [width + 32].pack("L")
  113.     addr[:w1].each{|ofs| return false if !write_memory(rgsshandle + ofs, w1)}
  114.     h1 = [height + 32].pack("L")
  115.     addr[:h1].each{|ofs| return false if !write_memory(rgsshandle + ofs, h1)}
  116.     w2 = [width / 32 + 1].pack("C")
  117.     addr[:w2].each{|ofs| return false if !write_memory(rgsshandle + ofs, w2)}
  118.     h2 = [height / 32 + 1].pack("C")
  119.     addr[:h2].each{|ofs| return false if !write_memory(rgsshandle + ofs, h2)}
  120.     # 重启
  121.     rgssgamemain = Win32API.new(buff, "RGSSGameMain", "ipp", "v")
  122.     rgssgamemain.call(FindWindow.call("RGSS Player", title), scripts, "")
  123.     # 补丁成功
  124.     return true
  125.   end
  126.  
  127.   def write_memory(addr, str)
  128.     old = 0.chr * 4
  129.     return false if 0 == VirtualProtect.call(addr, str.size, 0x40, old)
  130.     RtlMoveMemoryLP.call(addr, str, str.size)
  131.     return false if 0 == VirtualProtect.call(addr, str.size, old.unpack("L").first, old)
  132.     return true
  133.   end
  134.   private_class_method :write_memory
  135.  
  136.   def read_byte(addr)
  137.     dst = 0.chr * 1
  138.     RtlMoveMemory.call(dst, addr, dst.size)
  139.     return dst.unpack("C").first
  140.   end
  141.   private_class_method :read_byte
  142.  
  143.   def read_dword(addr)
  144.     dst = 0.chr * 4
  145.     RtlMoveMemory.call(dst, addr, dst.size)
  146.     return dst.unpack("L").first
  147.   end
  148.   private_class_method :read_dword
  149.  
  150. end
  151.  
  152. unless $ace_patched
  153.   $ace_patched = true
  154.   raise "应用分辨率补丁失败!" unless AceResolutionMemoryPatch.patch
  155.   #raise RGSSReset.new
  156. end
  157.  
  158. Graphics.resize_screen(1024, 768)

这是修改装备栏的脚本:
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - 装备系统 v1.06
  4. # -- 最后更新: 2014.05.01
  5. # -- 使用难度: 普通, 困难
  6. # -- 需要脚本: 无
  7. #先获得物品,然后事件脚本
  8. #$game_actors[x].change_equip_by_id(y, z)
  9.  
  10. #x为数据库角色编号
  11. #y为y号装备槽位置【从0开始】(相对于角色的装备槽)
  12. #z为数据库装备编号
  13. #
  14. #==============================================================================
  15.  
  16. $imported = {} if $imported.nil?
  17. $imported["YEA-AceEquipEngine"] = true
  18.  
  19. #==============================================================================
  20. # ▼ Updates
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # 2014.05.01 - Bug Fixed: Refresh Equip Item List when change slot.
  23. # 2012.02.02 - Bug Fixed: Crash when changing classes to different equip slots.
  24. # 2012.01.22 - Bug Fixed: <equip slot> notetags updated to factor in spaces.
  25. # 2012.01.05 - Compatibility Update: Equip Dynamic Stats
  26. # 2011.12.30 - Bug Fixed: Stats didn't update.
  27. # 2011.12.23 - Script efficiency optimized.
  28. # 2011.12.18 - Script efficiency optimized.
  29. # 2011.12.13 - Started Script and Finished.
  30. #
  31. #==============================================================================
  32. # ▼ 介绍
  33. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  34. # 默认的装备系统十分基础,本脚本为装备系统添加诸多功能,如指定角色装备类型(包
  35. # 括角色可以拥有多个相同的装备类型)、设定新的装备类型(这里说的装备类型不同于
  36. # 于数据库中的武器类型、护甲类型,可以说装备类型包括武器、防具、饰品等)。
  37. #
  38. #==============================================================================
  39. # ▼ 安装方式
  40. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  41. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  42. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  43. #
  44. # -----------------------------------------------------------------------------
  45. # 角色备注 - 在数据库-角色中可以使用的备注.
  46. # -----------------------------------------------------------------------------
  47. # <装备槽>
  48. #  内容
  49. #  内容
  50. # </装备槽>
  51. # 设定该角色可装备的装备类型,及装备类型的顺序。将"内容"替换为该角色可用的装备
  52. # 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚,
  53. # 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面
  54. # 有讲。
  55. #
  56. # <初始装备: x>
  57. # <初始装备: x, x>
  58. # 设定该角色的初始装备类型,x为装备类型的id。在数据库中没有新装备槽的初始装备设
  59. # 定时可以使用。
  60. #
  61. # <固定装备: x>
  62. # <固定装备: x, x>
  63. # 固定该角色的x号装备类型。
  64. #
  65. # <禁用装备: x>
  66. # <禁用装备: x, x>
  67. # 禁用该角色的x号装备类型。意思是装备无法放置在该装备槽中。
  68. #
  69. # -----------------------------------------------------------------------------
  70. # 职业备注 - 在数据库-职业中可以使用的备注.
  71. # -----------------------------------------------------------------------------
  72. # <装备槽>
  73. #  内容
  74. #  内容
  75. # </装备槽>
  76. # 设定该职业可装备的装备类型,及装备类型的顺序。将"内容"替换为该职业可用的装备
  77. # 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚,
  78. # 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面
  79. # 有讲
  80. #
  81. # <固定装备: x>
  82. # <固定装备: x, x>
  83. # 固定该职业的x号装备类型。
  84. #
  85. # <禁用装备: x>
  86. # <禁用装备: x, x>
  87. # 禁用该职业的x号装备类型。意思是装备无法放置在该装备槽中。
  88. #
  89. # -----------------------------------------------------------------------------
  90. # 武器备注 - 在数据库-武器中可以使用的备注.
  91. # -----------------------------------------------------------------------------
  92. # <固定装备: x>
  93. # <固定装备: x, x>
  94. # 装备该武器后固定x号装备类型。
  95. #
  96. # <禁用装备: x>
  97. # <禁用装备: x, x>
  98. # 装备该武器后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。
  99. #
  100. # -----------------------------------------------------------------------------
  101. # 护甲备注 - 在数据库-护甲中可以使用的备注.
  102. # -----------------------------------------------------------------------------
  103. # <装备类型: x>
  104. # <装备类型: 文本>
  105. # x替换为装备名称(本脚本下面)或装备类型ID,此备注将该护甲归类/视为x号装备类型
  106. #
  107. # <固定装备: x>
  108. # <固定装备: x, x>
  109. # 装备该护甲后固定x号装备类型。
  110. #
  111. # <禁用装备: x>
  112. # <禁用装备: x, x>
  113. # 装备该护甲后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。
  114. #
  115. # -----------------------------------------------------------------------------
  116. # 状态备注 - 在数据库-状态中可以使用的备注.
  117. # -----------------------------------------------------------------------------
  118. # <固定装备: x>
  119. # <固定装备: x, x>
  120. # 获得该状态后固定x号装备类型。(配合脚本"战斗中更换装备")
  121. #
  122. # <禁用装备: x>
  123. # <禁用装备: x, x>
  124. # 获得该状态后禁用x号装备类型。意思是装备无法放置在该装备槽中。(配合脚本"战斗中
  125. # 更换装备")
  126. #
  127. #==============================================================================
  128. # ▼ 兼容性
  129. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  130. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  131. #
  132. #==============================================================================
  133.  
  134. module YEA
  135.   module EQUIP
  136.  
  137.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  138.     # - 通用装备设置 -
  139.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  140.     # 调整默认装备设置,你可以添加新的装备类型,建议不要改得太多,以免出现问题。
  141.     # 下面是默认id对应的装备类型
  142.     #
  143.     # ID   装备类型
  144.     # ---  ------------
  145.     #  0   武器
  146.     #  1   盾牌
  147.     #  2   头盔
  148.     #  3   铠甲
  149.     #  4   饰品
  150.     #
  151.     # 无论你怎么修改以下顺序,武器双持的情况都是不变的:第二个装备类型变为武器(0).
  152.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  153.     # 下面这个数组是默认的可用装备槽即其顺序,应用于一切未通过备注自定义装备槽
  154.     # 的角色。
  155.     DEFAULT_BASE_SLOTS = [0,0,0,0,0,1,2,3,4,5,5,5,5,5,6,7]
  156.  
  157.     # 下面这个哈希表用来添加新的装备类型(id为 4+). 你还可以设定其能否被移除,
  158.     # 是否能通过"最强装备"自动选择最强的装备。
  159.     TYPES ={
  160.     # TypeID => ["类型名称", 能否移除?, 能否使用"最强装备"?],
  161.            0 => [   "心灵",       true,     false],
  162.            1 => [   "衣服",       true,     false],
  163.            2 => [   "下装",       true,     false],
  164.            3 => [   "袜子",       true,     false],
  165.            4 => [   "鞋子",       true,     false],
  166.            5 => [   "其它",       true,     false],
  167.     } # 别动这个括号.
  168.  
  169.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  170.     # - 装备指令列表 -
  171.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  172.     # 在这里调整装备指令列表(甚至是移除某些指令)下面是指令的解释:
  173.     #
  174.     # -------------------------------------------------------------------------
  175.     # :指令            解释
  176.     # -------------------------------------------------------------------------
  177.     # :equip           激活装备选择窗口. 默认.
  178.     # :optimize        自动为角色选择最强装备. 默认.
  179.     # :clear           移除角色身上的全部装备. 默认
  180.     #
  181.     # 以上为默认的全部可用指令。
  182.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  183.     # 在数组中放置可用的指令.
  184.     COMMAND_LIST =[
  185.       :equip,
  186. #      :optimize,
  187.       :clear,
  188.     # :custom1,
  189.     # :custom2,
  190.     ] # 不要动这个括号.
  191.  
  192.     #--------------------------------------------------------------------------
  193.     # - 装备自定义指令 -
  194.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  195.     # 对于那些希望通过本脚本来为装备场景添加特殊效果的人,可以使用下面的哈希表
  196.     # 来管理装备场景中的指令。你可以使用开关来禁用/隐藏指令。如果你不想把指令与
  197.     # 开关相关联,把开关设定为0就行。
  198.     #--------------------------------------------------------------------------
  199.     CUSTOM_EQUIP_COMMANDS ={
  200.     # :指令    => [       "文本",     启用开关,   显示开关,       处理方法],
  201.       :custom1 => [ "自定义名称",            0,          0, :command_name1],
  202.       :custom2 => [ "自定义文本",            0,          0, :command_name2],
  203.     } # 不要动这个括号.
  204.  
  205.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  206.     # - 其他窗口设置 -
  207.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  208.     # 调整装备窗口的视觉效果.
  209.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  210.     # 改变右下角能力值数字的字体大小
  211.     STATUS_FONT_SIZE = 20
  212.  
  213.     # 在更换装备指令中,移除装备指令的图标和文本设定
  214.     REMOVE_EQUIP_ICON = 0
  215.     REMOVE_EQUIP_TEXT = "<移除>"
  216.  
  217.     # 装备槽中,无装备的图标和文本.
  218.     NOTHING_ICON = 0
  219.     NOTHING_TEXT = "<空>"
  220.  
  221.   end # EQUIP
  222. end # YEA
  223.  
  224. #==============================================================================
  225. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  226. # 所以编辑了后果自负。
  227. #==============================================================================
  228.  
  229. module YEA
  230.   module REGEXP
  231.   module BASEITEM
  232.  
  233.     EQUIP_SLOTS_ON  = /<(?:EQUIP_SLOTS|装备槽)>/i
  234.     EQUIP_SLOTS_OFF = /<\/(?:EQUIP_SLOTS|装备槽)>/i
  235.  
  236.     EQUIP_TYPE_INT = /<(?:EQUIP_TYPE|装备类型):[ ]*(\d+)>/i
  237.     EQUIP_TYPE_STR = /<(?:EQUIP_TYPE|装备类型):[ ]*(.*)>/i
  238.  
  239.     STARTING_GEAR = /<(?:STARTING_GEAR|初始装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  240.  
  241.     FIXED_EQUIP = /<(?:FIXED_EQUIP|固定装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  242.     SEALED_EQUIP = /<(?:SEALED_EQUIP|禁用装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  243.  
  244.   end # BASEITEM
  245.   end # REGEXP
  246. end # YEA
  247.  
  248. #==============================================================================
  249. # ■ Vocab
  250. #==============================================================================
  251.  
  252. module Vocab
  253.  
  254.   #--------------------------------------------------------------------------
  255.   # overwrite method: self.etype
  256.   #--------------------------------------------------------------------------
  257.   def self.etype(etype)
  258.     return $data_system.terms.etypes[etype] if [0,1,2,3,4].include?(etype)
  259.     return YEA::EQUIP::TYPES[etype][0] if YEA::EQUIP::TYPES.include?(etype)
  260.     return ""
  261.   end
  262.  
  263. end # Vocab
  264.  
  265. #==============================================================================
  266. # ■ Icon
  267. #==============================================================================
  268.  
  269. module Icon
  270.  
  271.   #--------------------------------------------------------------------------
  272.   # self.remove_equip
  273.   #--------------------------------------------------------------------------
  274.   def self.remove_equip; return YEA::EQUIP::REMOVE_EQUIP_ICON; end
  275.  
  276.   #--------------------------------------------------------------------------
  277.   # self.nothing_equip
  278.   #--------------------------------------------------------------------------
  279.   def self.nothing_equip; return YEA::EQUIP::NOTHING_ICON; end
  280.  
  281. end # Icon
  282.  
  283. #==============================================================================
  284. # ■ Numeric
  285. #==============================================================================
  286.  
  287. class Numeric
  288.  
  289.   #--------------------------------------------------------------------------
  290.   # new method: group_digits
  291.   #--------------------------------------------------------------------------
  292.   unless $imported["YEA-CoreEngine"]
  293.   def group; return self.to_s; end
  294.   end # $imported["YEA-CoreEngine"]
  295.  
  296. end # Numeric
  297.  
  298. #==============================================================================
  299. # ■ DataManager
  300. #==============================================================================
  301.  
  302. module DataManager
  303.  
  304.   #--------------------------------------------------------------------------
  305.   # alias method: load_database
  306.   #--------------------------------------------------------------------------
  307.   class <<self; alias load_database_aee load_database; end
  308.   def self.load_database
  309.     load_database_aee
  310.     load_notetags_aee
  311.   end
  312.  
  313.   #--------------------------------------------------------------------------
  314.   # new method: load_notetags_aee
  315.   #--------------------------------------------------------------------------
  316.   def self.load_notetags_aee
  317.     groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
  318.       $data_states]
  319.     for group in groups
  320.       for obj in group
  321.         next if obj.nil?
  322.         obj.load_notetags_aee
  323.       end
  324.     end
  325.   end
  326.  
  327. end # DataManager
  328.  
  329. #==============================================================================
  330. # ■ RPG::BaseItem
  331. #==============================================================================
  332.  
  333. class RPG::BaseItem
  334.  
  335.   #--------------------------------------------------------------------------
  336.   # public instance variables
  337.   #--------------------------------------------------------------------------
  338.   attr_accessor :base_equip_slots
  339.   attr_accessor :fixed_equip_type
  340.   attr_accessor :sealed_equip_type
  341.   attr_accessor :extra_starting_equips
  342.  
  343.   #--------------------------------------------------------------------------
  344.   # common cache: load_notetags_aee
  345.   #--------------------------------------------------------------------------
  346.   def load_notetags_aee
  347.     @base_equip_slots = []
  348.     @equip_slots_on = false
  349.     @fixed_equip_type = []
  350.     @sealed_equip_type = []
  351.     @extra_starting_equips = []
  352.     #---
  353.     self.note.split(/[\r\n]+/).each { |line|
  354.       case line
  355.       #---
  356.       when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_ON
  357.         next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
  358.         @equip_slots_on = true
  359.       when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_OFF
  360.         next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
  361.         @equip_slots_on = false
  362.       #---
  363.       when YEA::REGEXP::BASEITEM::STARTING_GEAR
  364.         next unless self.is_a?(RPG::Actor)
  365.         $1.scan(/\d+/).each { |num|
  366.         @extra_starting_equips.push(num.to_i) if num.to_i > 0 }
  367.       when YEA::REGEXP::BASEITEM::FIXED_EQUIP
  368.         $1.scan(/\d+/).each { |num|
  369.         @fixed_equip_type.push(num.to_i) if num.to_i > 0 }
  370.       when YEA::REGEXP::BASEITEM::SEALED_EQUIP
  371.         $1.scan(/\d+/).each { |num|
  372.         @sealed_equip_type.push(num.to_i) if num.to_i > 0 }
  373.       #---
  374.       when YEA::REGEXP::BASEITEM::EQUIP_TYPE_INT
  375.         next unless self.is_a?(RPG::Armor)
  376.         @etype_id = [1, $1.to_i].max
  377.       when YEA::REGEXP::BASEITEM::EQUIP_TYPE_STR
  378.         next unless self.is_a?(RPG::Armor)
  379.         for key in YEA::EQUIP::TYPES
  380.           id = key[0]
  381.           next if YEA::EQUIP::TYPES[id][0].upcase != $1.to_s.upcase
  382.           @etype_id = [1, id].max
  383.           break
  384.         end
  385.       #---
  386.       else
  387.         if @equip_slots_on
  388.           case line.upcase
  389.           when /装备类型[ ](\d+)/i, /装备类型:[ ](\d+)/i
  390.             id = $1.to_i
  391.             @base_equip_slots.push(id) if [0,1,2,3,4].include?(id)
  392.             @base_equip_slots.push(id) if YEA::EQUIP::TYPES.include?(id)
  393.           when /WEAPON/i
  394.             @base_equip_slots.push(0)
  395.           when /SHIELD/i
  396.             @base_equip_slots.push(1)
  397.           when /HEAD/i
  398.             @base_equip_slots.push(2)
  399.           when /BODY/i, /ARMOR/i, /ARMOUR/i
  400.             @base_equip_slots.push(3)
  401.           when /ETC/i, /OTHER/i, /ACCESSOR/i
  402.             @base_equip_slots.push(4)
  403.           else
  404.             text = line.upcase.delete(" ")
  405.             for key in YEA::EQUIP::TYPES
  406.               id = key[0]
  407.               next if YEA::EQUIP::TYPES[id][0].upcase.delete(" ")!= text
  408.               @base_equip_slots.push(id)
  409.               break
  410.             end
  411.           end
  412.         end
  413.       end
  414.     } # self.note.split
  415.     #---
  416.     return unless self.is_a?(RPG::Class)
  417.     if @base_equip_slots.empty?
  418.       @base_equip_slots = YEA::EQUIP::DEFAULT_BASE_SLOTS.clone
  419.     end
  420.   end
  421.  
  422. end # RPG::BaseItem
  423.  
  424. #==============================================================================
  425. # ■ Game_Temp
  426. #==============================================================================
  427.  
  428. class Game_Temp
  429.  
  430.   #--------------------------------------------------------------------------
  431.   # public instance variables
  432.   #--------------------------------------------------------------------------
  433.   attr_accessor :eds_actor
  434.   attr_accessor :scene_equip_index
  435.   attr_accessor :scene_equip_oy
  436.  
  437. end # Game_Temp
  438.  
  439. #==============================================================================
  440. # ■ Game_BaseItem
  441. #==============================================================================
  442.  
  443. class Game_BaseItem
  444.  
  445.   #--------------------------------------------------------------------------
  446.   # public instance variables
  447.   #--------------------------------------------------------------------------
  448.   attr_accessor :item_id
  449.  
  450. end # Game_BaseItem
  451.  
  452. #==============================================================================
  453. # ■ Game_BattlerBase
  454. #==============================================================================
  455.  
  456. class Game_BattlerBase
  457.  
  458.   #--------------------------------------------------------------------------
  459.   # alias method: equip_type_fixed?
  460.   #--------------------------------------------------------------------------
  461.   alias game_battlerbase_equip_type_fixed_aee equip_type_fixed?
  462.   def equip_type_fixed?(etype_id)
  463.     return true if fixed_etypes.include?(etype_id) if actor?
  464.     return game_battlerbase_equip_type_fixed_aee(etype_id)
  465.   end
  466.  
  467.   #--------------------------------------------------------------------------
  468.   # alias method: equip_type_sealed?
  469.   #--------------------------------------------------------------------------
  470.   alias game_battlerbase_equip_type_sealed_aee equip_type_sealed?
  471.   def equip_type_sealed?(etype_id)
  472.     return true if sealed_etypes.include?(etype_id) if actor?
  473.     return game_battlerbase_equip_type_sealed_aee(etype_id)
  474.   end
  475.  
  476. end # Game_BattlerBase
  477.  
  478. #==============================================================================
  479. # ■ Game_Actor
  480. #==============================================================================
  481.  
  482. class Game_Actor < Game_Battler
  483.  
  484.   #--------------------------------------------------------------------------
  485.   # alias method: init_equips
  486.   #--------------------------------------------------------------------------
  487.   alias game_actor_init_equips_aee init_equips
  488.   def init_equips(equips)
  489.     game_actor_init_equips_aee(equips)
  490.     equip_extra_starting_equips
  491.   end
  492.  
  493.   #--------------------------------------------------------------------------
  494.   # new method: equip_extra_starting_equips
  495.   #--------------------------------------------------------------------------
  496.   def equip_extra_starting_equips
  497.     for equip_id in actor.extra_starting_equips
  498.       armour = $data_armors[equip_id]
  499.       next if armour.nil?
  500.       etype_id = armour.etype_id
  501.       next unless equip_slots.include?(etype_id)
  502.       slot_id = empty_slot(etype_id)
  503.       @equips[slot_id].set_equip(etype_id == 0, armour.id)
  504.     end
  505.     refresh
  506.   end
  507.  
  508.   #--------------------------------------------------------------------------
  509.   # overwrite method: equip_slots
  510.   #--------------------------------------------------------------------------
  511.   def equip_slots
  512.     return equip_slots_dual if dual_wield?
  513.     return equip_slots_normal
  514.   end
  515.  
  516.   #--------------------------------------------------------------------------
  517.   # new method: equip_slots_normal
  518.   #--------------------------------------------------------------------------
  519.   def equip_slots_normal
  520.     return self.actor.base_equip_slots if self.actor.base_equip_slots != []
  521.     return self.class.base_equip_slots
  522.   end
  523.  
  524.   #--------------------------------------------------------------------------
  525.   # new method: equip_slots_dual
  526.   #--------------------------------------------------------------------------
  527.   def equip_slots_dual
  528.     array = equip_slots_normal.clone
  529.     array[1] = 0 if array.size >= 2
  530.     return array
  531.   end
  532.  
  533.   #--------------------------------------------------------------------------
  534.   # new method: fixed_etypes
  535.   #--------------------------------------------------------------------------
  536.   def fixed_etypes
  537.     array = []
  538.     array |= self.actor.fixed_equip_type
  539.     array |= self.class.fixed_equip_type
  540.     for equip in equips
  541.       next if equip.nil?
  542.       array |= equip.fixed_equip_type
  543.     end
  544.     for state in states
  545.       next if state.nil?
  546.       array |= state.fixed_equip_type
  547.     end
  548.     return array
  549.   end
  550.  
  551.   #--------------------------------------------------------------------------
  552.   # new method: sealed_etypes
  553.   #--------------------------------------------------------------------------
  554.   def sealed_etypes
  555.     array = []
  556.     array |= self.actor.sealed_equip_type
  557.     array |= self.class.sealed_equip_type
  558.     for equip in equips
  559.       next if equip.nil?
  560.       array |= equip.sealed_equip_type
  561.     end
  562.     for state in states
  563.       next if state.nil?
  564.       array |= state.sealed_equip_type
  565.     end
  566.     return array
  567.   end
  568.  
  569.   #--------------------------------------------------------------------------
  570.   # alias method: change_equip
  571.   #--------------------------------------------------------------------------
  572.   alias game_actor_change_equip_aee change_equip
  573.   def change_equip(slot_id, item)
  574.     if item.nil? && !@optimize_clear
  575.       etype_id = equip_slots[slot_id]
  576.       return unless YEA::EQUIP::TYPES[etype_id][1]
  577.     elsif item.nil? && @optimize_clear
  578.       etype_id = equip_slots[slot_id]
  579.       return unless YEA::EQUIP::TYPES[etype_id][2]
  580.     end
  581.     @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
  582.     game_actor_change_equip_aee(slot_id, item)
  583.   end
  584.  
  585.   #--------------------------------------------------------------------------
  586.   # overwrite method: optimize_equipments
  587.   #--------------------------------------------------------------------------
  588.   def optimize_equipments
  589.     $game_temp.eds_actor = self
  590.     @optimize_clear = true
  591.     clear_equipments
  592.     @optimize_clear = false
  593.     equip_slots.size.times do |i|
  594.       next if !equip_change_ok?(i)
  595.       next unless can_optimize?(i)
  596.       items = $game_party.equip_items.select do |item|
  597.         item.etype_id == equip_slots[i] &&
  598.         equippable?(item) && item.performance >= 0
  599.       end
  600.       change_equip(i, items.max_by {|item| item.performance })
  601.     end
  602.     $game_temp.eds_actor = nil
  603.   end
  604.  
  605.   #--------------------------------------------------------------------------
  606.   # new method: can_optimize?
  607.   #--------------------------------------------------------------------------
  608.   def can_optimize?(slot_id)
  609.     etype_id = equip_slots[slot_id]
  610.     return YEA::EQUIP::TYPES[etype_id][2]
  611.   end
  612.  
  613.   #--------------------------------------------------------------------------
  614.   # alias method: force_change_equip
  615.   #--------------------------------------------------------------------------
  616.   alias game_actor_force_change_equip_aee force_change_equip
  617.   def force_change_equip(slot_id, item)
  618.     @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
  619.     game_actor_force_change_equip_aee(slot_id, item)
  620.   end
  621.  
  622.   #--------------------------------------------------------------------------
  623.   # alias method: weapons
  624.   #--------------------------------------------------------------------------
  625.   alias game_actor_weapons_aee weapons
  626.   def weapons
  627.     anti_crash_equips
  628.     return game_actor_weapons_aee
  629.   end
  630.  
  631.   #--------------------------------------------------------------------------
  632.   # alias method: armors
  633.   #--------------------------------------------------------------------------
  634.   alias game_actor_armors_aee armors
  635.   def armors
  636.     anti_crash_equips
  637.     return game_actor_armors_aee
  638.   end
  639.  
  640.   #--------------------------------------------------------------------------
  641.   # alias method: equips
  642.   #--------------------------------------------------------------------------
  643.   alias game_actor_equips_aee equips
  644.   def equips
  645.     anti_crash_equips
  646.     return game_actor_equips_aee
  647.   end
  648.  
  649.   #--------------------------------------------------------------------------
  650.   # new method: equips
  651.   #--------------------------------------------------------------------------
  652.   def anti_crash_equips
  653.     for i in 0...@equips.size
  654.       next unless @equips[i].nil?
  655.       @equips[i] = Game_BaseItem.new
  656.     end
  657.   end
  658.  
  659. end # Game_Actor
  660.  
  661. #==============================================================================
  662. # ■ Game_Interpreter
  663. #==============================================================================
  664.  
  665. class Game_Interpreter
  666.  
  667.   #--------------------------------------------------------------------------
  668.   # overwrite method: change equip
  669.   #--------------------------------------------------------------------------
  670.   def command_319
  671.     actor = $game_actors[@params[0]]
  672.     return if actor.nil?
  673.     if @params[1] == 0 && @params[2] != 0
  674.       item = $data_weapons[@params[2]]
  675.       return unless actor.equip_slots.include?(0)
  676.       slot_id = actor.empty_slot(0)
  677.     elsif @params[2] != 0
  678.       item = $data_armors[@params[2]]
  679.       return unless actor.equip_slots.include?(item.etype_id)
  680.       slot_id = actor.empty_slot(item.etype_id)
  681.     else
  682.       slot_id = @params[1]
  683.     end
  684.     actor.change_equip_by_id(slot_id, @params[2])
  685.   end
  686.  
  687. end # Game_Interpreter
  688.  
  689. #==============================================================================
  690. # ■ Window_EquipStatus
  691. #==============================================================================
  692.  
  693. class Window_EquipStatus < Window_Base
  694.  
  695.   #--------------------------------------------------------------------------
  696.   # overwrite method: initialize
  697.   #--------------------------------------------------------------------------
  698.   def initialize(dx, dy)
  699.     super(dx, dy, window_width, Graphics.height - dy)
  700.     @actor = nil
  701.     @temp_actor = nil
  702.     refresh
  703.   end
  704.  
  705.   #--------------------------------------------------------------------------
  706.   # overwrite method: window_width
  707.   #--------------------------------------------------------------------------
  708.   def window_width; return Graphics.width * 2 / 5; end
  709.  
  710.   #--------------------------------------------------------------------------
  711.   # overwrite method: refresh
  712.   #--------------------------------------------------------------------------
  713.   def refresh
  714.     contents.clear
  715.     8.times {|i| draw_item(0, line_height * i, i) }
  716.   end
  717.  
  718.   #--------------------------------------------------------------------------
  719.   # overwrite method: draw_item
  720.   #--------------------------------------------------------------------------
  721.   def draw_item(dx, dy, param_id)
  722.     draw_background_colour(dx, dy)
  723.     draw_param_name(dx + 4, dy, param_id)
  724.     draw_current_param(dx + 4, dy, param_id) if @actor
  725.     drx = (contents.width + 22) / 2
  726.     draw_right_arrow(drx, dy)
  727.     draw_new_param(drx + 22, dy, param_id) if @temp_actor
  728.     reset_font_settings
  729.   end
  730.  
  731.   #--------------------------------------------------------------------------
  732.   # new method: draw_background_colour
  733.   #--------------------------------------------------------------------------
  734.   def draw_background_colour(dx, dy)
  735.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  736.     rect = Rect.new(dx+1, dy+1, contents.width - 2, line_height - 2)
  737.     contents.fill_rect(rect, colour)
  738.   end
  739.  
  740.   #--------------------------------------------------------------------------
  741.   # overwrite method: draw_param_name
  742.   #--------------------------------------------------------------------------
  743.   def draw_param_name(dx, dy, param_id)
  744.     contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
  745.     change_color(system_color)
  746.     draw_text(dx, dy, contents.width, line_height, Vocab::param(param_id))
  747.   end
  748.  
  749.   #--------------------------------------------------------------------------
  750.   # overwrite method: draw_current_param
  751.   #--------------------------------------------------------------------------
  752.   def draw_current_param(dx, dy, param_id)
  753.     change_color(normal_color)
  754.     dw = (contents.width + 22) / 2
  755.     draw_text(0, dy, dw, line_height, @actor.param(param_id).group, 2)
  756.     reset_font_settings
  757.   end
  758.  
  759.   #--------------------------------------------------------------------------
  760.   # overwrite method: draw_new_param
  761.   #--------------------------------------------------------------------------
  762.   def draw_new_param(dx, dy, param_id)
  763.     contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
  764.     new_value = @temp_actor.param(param_id)
  765.     change_color(param_change_color(new_value - @actor.param(param_id)))
  766.     draw_text(0, dy, contents.width-4, line_height, new_value.group, 2)
  767.     reset_font_settings
  768.   end
  769.  
  770. end # Window_EquipStatus
  771.  
  772. #==============================================================================
  773. # ■ Window_EquipCommand
  774. #==============================================================================
  775.  
  776. class Window_EquipCommand < Window_HorzCommand
  777.  
  778.   #--------------------------------------------------------------------------
  779.   # overwrite method: make_command_list
  780.   #--------------------------------------------------------------------------
  781.   def make_command_list
  782.     for command in YEA::EQUIP::COMMAND_LIST
  783.       case command
  784.       when :equip
  785.         add_command(Vocab::equip2, :equip)
  786. #      when :optimize
  787. #        add_command(Vocab::optimize, :optimize)
  788.       when :clear
  789.         add_command(Vocab::clear, :clear)
  790.       else
  791.         process_custom_command(command)
  792.       end
  793.     end
  794.   end
  795.  
  796.   #--------------------------------------------------------------------------
  797.   # process_ok
  798.   #--------------------------------------------------------------------------
  799.   def process_ok
  800.     $game_temp.scene_equip_index = index
  801.     $game_temp.scene_equip_oy = self.oy
  802.     super
  803.   end
  804.  
  805.   #--------------------------------------------------------------------------
  806.   # new method: process_custom_command
  807.   #--------------------------------------------------------------------------
  808.   def process_custom_command(command)
  809.     return unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
  810.     show = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][2]
  811.     continue = show <= 0 ? true : $game_switches[show]
  812.     return unless continue
  813.     text = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][0]
  814.     switch = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][1]
  815.     enabled = switch <= 0 ? true : $game_switches[switch]
  816.     add_command(text, command, enabled)
  817.   end
  818.  
  819.   #--------------------------------------------------------------------------
  820.   # overwrite method: window_width
  821.   #--------------------------------------------------------------------------
  822.   def window_width; return 160; end
  823.  
  824.   #--------------------------------------------------------------------------
  825.   # overwrite method: contents_width
  826.   #--------------------------------------------------------------------------
  827.   def contents_width; return width - standard_padding * 2; end
  828.  
  829.   #--------------------------------------------------------------------------
  830.   # overwrite method: contents_height
  831.   #--------------------------------------------------------------------------
  832.   def contents_height
  833.     ch = height - standard_padding * 2
  834.     return [ch - ch % item_height, row_max * item_height].max
  835.   end
  836.  
  837.   #--------------------------------------------------------------------------
  838.   # overwrite method: visible_line_number
  839.   #--------------------------------------------------------------------------
  840.   def visible_line_number; return 4; end
  841.  
  842.   #--------------------------------------------------------------------------
  843.   # overwrite method: col_max
  844.   #--------------------------------------------------------------------------
  845.   def col_max; return 1; end
  846.  
  847.   #--------------------------------------------------------------------------
  848.   # overwrite method: item_rect
  849.   #--------------------------------------------------------------------------
  850.   def item_rect(index)
  851.     rect = Rect.new
  852.     rect.width = item_width
  853.     rect.height = item_height
  854.     rect.x = index % col_max * (item_width + spacing)
  855.     rect.y = index / col_max * item_height
  856.     rect
  857.   end
  858.  
  859.   #--------------------------------------------------------------------------
  860.   # overwrite method: ensure_cursor_visible
  861.   #--------------------------------------------------------------------------
  862.   def ensure_cursor_visible
  863.     self.top_row = row if row < top_row
  864.     self.bottom_row = row if row > bottom_row
  865.   end
  866.  
  867.   #--------------------------------------------------------------------------
  868.   # overwrite method: cursor_down
  869.   #--------------------------------------------------------------------------
  870.   def cursor_down(wrap = false)
  871.     if index < item_max - col_max || (wrap && col_max == 1)
  872.       select((index + col_max) % item_max)
  873.     end
  874.   end
  875.  
  876.   #--------------------------------------------------------------------------
  877.   # overwrite method: cursor_up
  878.   #--------------------------------------------------------------------------
  879.   def cursor_up(wrap = false)
  880.     if index >= col_max || (wrap && col_max == 1)
  881.       select((index - col_max + item_max) % item_max)
  882.     end
  883.   end
  884.  
  885.   #--------------------------------------------------------------------------
  886.   # overwrite method: process_pageup
  887.   #--------------------------------------------------------------------------
  888.   def process_pageup
  889.     Sound.play_cursor
  890.     Input.update
  891.     deactivate
  892.     call_handler(:pageup)
  893.   end
  894.  
  895.   #--------------------------------------------------------------------------
  896.   # overwrite method: process_pagedown
  897.   #--------------------------------------------------------------------------
  898.   def process_pagedown
  899.     Sound.play_cursor
  900.     Input.update
  901.     deactivate
  902.     call_handler(:pagedown)
  903.   end
  904.  
  905. end # Window_EquipCommand
  906.  
  907. #==============================================================================
  908. # ■ Window_EquipSlot
  909. #==============================================================================
  910.  
  911. class Window_EquipSlot < Window_Selectable
  912.  
  913.   #--------------------------------------------------------------------------
  914.   # overwrite method: initialize
  915.   #--------------------------------------------------------------------------
  916.   def initialize(dx, dy, dw)
  917.     super(dx, dy, dw, Graphics.height - dy)
  918.     @actor = nil
  919.     refresh
  920.   end
  921.  
  922.   #--------------------------------------------------------------------------
  923.   # overwrite method: window_height
  924.   #--------------------------------------------------------------------------
  925.   def window_height; return self.height; end
  926.  
  927.   #--------------------------------------------------------------------------
  928.   # overwrite method: visible_line_number
  929.   #--------------------------------------------------------------------------
  930.   def visible_line_number; return item_max; end
  931.  
  932.   #--------------------------------------------------------------------------
  933.   # overwrite method: refresh
  934.   #--------------------------------------------------------------------------
  935.   def refresh
  936.     create_contents
  937.     super
  938.   end
  939.  
  940.   #--------------------------------------------------------------------------
  941.   # overwrite method: draw_item
  942.   #--------------------------------------------------------------------------
  943.   def draw_item(index)
  944.     return unless @actor
  945.     rect = item_rect_for_text(index)
  946.     change_color(system_color, enable?(index))
  947.     draw_text(rect.x, rect.y, 92, line_height, slot_name(index))
  948.     item = @actor.equips[index]
  949.     dx = rect.x + 92
  950.     dw = contents.width - dx - 24
  951.     if item.nil?
  952.       draw_nothing_equip(dx, rect.y, false, dw)
  953.     else
  954.       draw_item_name(item, dx, rect.y, enable?(index), dw)
  955.     end
  956.   end
  957.  
  958.   #--------------------------------------------------------------------------
  959.   # new method: draw_nothing_equip
  960.   #--------------------------------------------------------------------------
  961.   def draw_nothing_equip(dx, dy, enabled, dw)
  962.     change_color(normal_color, enabled)
  963.     draw_icon(Icon.nothing_equip, dx, dy, enabled)
  964.     text = YEA::EQUIP::NOTHING_TEXT
  965.     draw_text(dx + 24, dy, dw - 24, line_height, text)
  966.   end
  967.  
  968. end # Window_EquipSlot
  969.  
  970. #==============================================================================
  971. # ■ Window_EquipItem
  972. #==============================================================================
  973.  
  974. class Window_EquipItem < Window_ItemList
  975.  
  976.   #--------------------------------------------------------------------------
  977.   # overwrite method: col_max
  978.   #--------------------------------------------------------------------------
  979.   def col_max; return 1; end
  980.  
  981.   #--------------------------------------------------------------------------
  982.   # overwrite method: slot_id=
  983.   #--------------------------------------------------------------------------
  984.   def slot_id=(slot_id)
  985.     return if @slot_id == slot_id
  986.     @slot_id = slot_id
  987.     @last_item = nil
  988.     self.oy = 0
  989.     refresh
  990.   end
  991.  
  992.   #--------------------------------------------------------------------------
  993.   # overwrite method: draw_item
  994.   #--------------------------------------------------------------------------
  995.   def draw_item(index)
  996.     item = @data[index]
  997.     rect = item_rect(index)
  998.     rect.width -= 4
  999.     if item.nil?
  1000.       draw_remove_equip(rect)
  1001.       return
  1002.     end
  1003.     dw = contents.width - rect.x - 24
  1004.     draw_item_name(item, rect.x, rect.y, enable?(item), dw)
  1005.     draw_item_number(rect, item)
  1006.   end
  1007.  
  1008.   #--------------------------------------------------------------------------
  1009.   # new method: draw_remove_equip
  1010.   #--------------------------------------------------------------------------
  1011.   def draw_remove_equip(rect)
  1012.     draw_icon(Icon.remove_equip, rect.x, rect.y)
  1013.     text = YEA::EQUIP::REMOVE_EQUIP_TEXT
  1014.     rect.x += 24
  1015.     rect.width -= 24
  1016.     draw_text(rect, text)
  1017.   end
  1018.  
  1019.   #--------------------------------------------------------------------------
  1020.   # overwrite method: include?
  1021.   #--------------------------------------------------------------------------
  1022.   def include?(item)
  1023.     if item.nil? && !@actor.nil?
  1024.       etype_id = @actor.equip_slots[@slot_id]
  1025.       return YEA::EQUIP::TYPES[etype_id][1]
  1026.     end
  1027.     return true if item.nil?
  1028.     return false unless item.is_a?(RPG::EquipItem)
  1029.     return false if @slot_id < 0
  1030.     return false if item.etype_id != @actor.equip_slots[@slot_id]
  1031.     return @actor.equippable?(item)
  1032.   end
  1033.  
  1034.   #--------------------------------------------------------------------------
  1035.   # overwrite method: enable?
  1036.   #--------------------------------------------------------------------------
  1037.   def enable?(item)
  1038.     if item.nil? && !@actor.nil?
  1039.       etype_id = @actor.equip_slots[@slot_id]
  1040.       return YEA::EQUIP::TYPES[etype_id][1]
  1041.     end
  1042.     return @actor.equippable?(item)
  1043.   end
  1044.  
  1045.   #--------------------------------------------------------------------------
  1046.   # new method: show
  1047.   #--------------------------------------------------------------------------
  1048.   def show
  1049.     @last_item = 0
  1050.     update_help
  1051.     super
  1052.   end
  1053.  
  1054.   #--------------------------------------------------------------------------
  1055.   # overwrite method: update_help
  1056.   #--------------------------------------------------------------------------
  1057.   def update_help
  1058.     super
  1059.     return if @actor.nil?
  1060.     return if @status_window.nil?
  1061.     return if @last_item == item
  1062.     @last_item = item
  1063.     temp_actor = Marshal.load(Marshal.dump(@actor))
  1064.     temp_actor.force_change_equip(@slot_id, item)
  1065.     @status_window.set_temp_actor(temp_actor)
  1066.   end
  1067.  
  1068. end # Window_EquipItem
  1069.  
  1070. #==============================================================================
  1071. # ■ Window_EquipActor
  1072. #==============================================================================
  1073.  
  1074. class Window_EquipActor < Window_Base
  1075.  
  1076.   #--------------------------------------------------------------------------
  1077.   # initialize
  1078.   #--------------------------------------------------------------------------
  1079.   def initialize(dx, dy)
  1080.     super(dx, dy, window_width, fitting_height(4))
  1081.     @actor = nil
  1082.   end
  1083.  
  1084.   #--------------------------------------------------------------------------
  1085.   # window_width
  1086.   #--------------------------------------------------------------------------
  1087.   def window_width; return Graphics.width - 160; end
  1088.  
  1089.   #--------------------------------------------------------------------------
  1090.   # actor=
  1091.   #--------------------------------------------------------------------------
  1092.   def actor=(actor)
  1093.     return if @actor == actor
  1094.     @actor = actor
  1095.     refresh
  1096.   end
  1097.  
  1098.   #--------------------------------------------------------------------------
  1099.   # refresh
  1100.   #--------------------------------------------------------------------------
  1101.   def refresh
  1102.     contents.clear
  1103.     return unless @actor
  1104.     draw_actor_face(@actor, 0, 0)
  1105.     draw_actor_simple_status(@actor, 108, line_height / 2)
  1106.   end
  1107.  
  1108. end # Window_EquipActor
  1109.  
  1110. #==============================================================================
  1111. # ■ Scene_Equip
  1112. #==============================================================================
  1113.  
  1114. class Scene_Equip < Scene_MenuBase
  1115.  
  1116.   #--------------------------------------------------------------------------
  1117.   # overwrite method: create_status_window
  1118.   #--------------------------------------------------------------------------
  1119.   def create_status_window
  1120.     wx = Graphics.width - (Graphics.width * 2 / 5)
  1121.     wy = @help_window.height + 120
  1122.     @status_window = Window_EquipStatus.new(wx, wy)
  1123.     @status_window.viewport = @viewport
  1124.     @status_window.actor = @actor
  1125.   end
  1126.  
  1127.   #--------------------------------------------------------------------------
  1128.   # overwrite method: create_command_window
  1129.   #--------------------------------------------------------------------------
  1130.   def create_command_window
  1131.     wx = 0
  1132.     wy = @help_window.height
  1133.     ww = 160
  1134.     @command_window = Window_EquipCommand.new(wx, wy, ww)
  1135.     @command_window.viewport = @viewport
  1136.     @command_window.help_window = @help_window
  1137.     if !$game_temp.scene_equip_index.nil?
  1138.       @command_window.select($game_temp.scene_equip_index)
  1139.       @command_window.oy = $game_temp.scene_equip_oy
  1140.     end
  1141.     $game_temp.scene_equip_index = nil
  1142.     $game_temp.scene_equip_oy = nil
  1143.     @command_window.set_handler(:equip,    method(:command_equip))
  1144. #    @command_window.set_handler(:optimize, method(:command_optimize))
  1145.     @command_window.set_handler(:clear,    method(:command_clear))
  1146.     @command_window.set_handler(:cancel,   method(:return_scene))
  1147.     @command_window.set_handler(:pagedown, method(:next_actor))
  1148.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1149.     process_custom_equip_commands
  1150.     create_actor_window
  1151.   end
  1152.  
  1153.   #--------------------------------------------------------------------------
  1154.   # new method: create_actor_window
  1155.   #--------------------------------------------------------------------------
  1156.   def create_actor_window
  1157.     wy = @help_window.height
  1158.     @actor_window = Window_EquipActor.new(@command_window.width, wy)
  1159.     @actor_window.viewport = @viewport
  1160.     @actor_window.actor = @actor
  1161.   end
  1162.  
  1163.   #--------------------------------------------------------------------------
  1164.   # new method: process_custom_equip_commands
  1165.   #--------------------------------------------------------------------------
  1166.   def process_custom_equip_commands
  1167.     for command in YEA::EQUIP::COMMAND_LIST
  1168.       next unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
  1169.       called_method = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][3]
  1170.       @command_window.set_handler(command, method(called_method))
  1171.     end
  1172.   end
  1173.  
  1174.   #--------------------------------------------------------------------------
  1175.   # overwrite method: create_slot_window
  1176.   #--------------------------------------------------------------------------
  1177.   def create_slot_window
  1178.     wx = 0
  1179.     wy = @command_window.y + @command_window.height
  1180.     ww = Graphics.width - @status_window.width
  1181.     @slot_window = Window_EquipSlot.new(wx, wy, ww)
  1182.     @slot_window.viewport = @viewport
  1183.     @slot_window.help_window = @help_window
  1184.     @slot_window.status_window = @status_window
  1185.     @slot_window.actor = @actor
  1186.     @slot_window.set_handler(:ok,       method(:on_slot_ok))
  1187.     @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  1188.   end
  1189.  
  1190.   #--------------------------------------------------------------------------
  1191.   # overwrite method: create_item_window
  1192.   #--------------------------------------------------------------------------
  1193.   def create_item_window
  1194.     wx = @slot_window.x
  1195.     wy = @slot_window.y
  1196.     ww = @slot_window.width
  1197.     wh = @slot_window.height
  1198.     @item_window = Window_EquipItem.new(wx, wy, ww, wh)
  1199.     @item_window.viewport = @viewport
  1200.     @item_window.help_window = @help_window
  1201.     @item_window.status_window = @status_window
  1202.     @item_window.actor = @actor
  1203.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1204.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1205.     @slot_window.item_window = @item_window
  1206.     @item_window.hide
  1207.   end
  1208.  
  1209.   #--------------------------------------------------------------------------
  1210.   # alias method: command_optimize
  1211.   #--------------------------------------------------------------------------
  1212. #  alias scene_equip_command_optimize_aee command_optimize
  1213. # def command_optimize
  1214. #    scene_equip_command_optimize_aee
  1215. #    @actor_window.refresh
  1216. #  end
  1217.  
  1218.   #--------------------------------------------------------------------------
  1219.   # alias method: command_clear
  1220.   #--------------------------------------------------------------------------
  1221.   alias scene_equip_command_clear_aee command_clear
  1222.   def command_clear
  1223.     scene_equip_command_clear_aee
  1224.     @actor_window.refresh
  1225.   end
  1226.  
  1227.   #--------------------------------------------------------------------------
  1228.   # alias method: on_slot_ok
  1229.   #--------------------------------------------------------------------------
  1230.   alias scene_equip_on_slot_ok_aee on_slot_ok
  1231.   def on_slot_ok
  1232.     scene_equip_on_slot_ok_aee
  1233.     @slot_window.hide
  1234.     @item_window.refresh
  1235.     @item_window.show
  1236.   end
  1237.  
  1238.   #--------------------------------------------------------------------------
  1239.   # alias method: on_item_ok
  1240.   #--------------------------------------------------------------------------
  1241.   alias scene_equip_on_item_ok_aee on_item_ok
  1242.   def on_item_ok
  1243.     scene_equip_on_item_ok_aee
  1244.     @actor_window.refresh
  1245.     @slot_window.show
  1246.     @item_window.hide
  1247.   end
  1248.  
  1249.   #--------------------------------------------------------------------------
  1250.   # alias method: on_item_cancel
  1251.   #--------------------------------------------------------------------------
  1252.   alias scene_equip_on_item_cancel_aee on_item_cancel
  1253.   def on_item_cancel
  1254.     scene_equip_on_item_cancel_aee
  1255.     @slot_window.show
  1256.     @item_window.hide
  1257.   end
  1258.  
  1259.   #--------------------------------------------------------------------------
  1260.   # alias method: on_actor_change
  1261.   #--------------------------------------------------------------------------
  1262.   alias scene_equip_on_actor_change_aee on_actor_change
  1263.   def on_actor_change
  1264.     scene_equip_on_actor_change_aee
  1265.     @actor_window.actor = @actor
  1266.   end
  1267.  
  1268.   #--------------------------------------------------------------------------
  1269.   # new method: command_name1
  1270.   #--------------------------------------------------------------------------
  1271.   def command_name1
  1272.     # Do nothing.
  1273.   end
  1274.  
  1275.   #--------------------------------------------------------------------------
  1276.   # new method: command_name2
  1277.   #--------------------------------------------------------------------------
  1278.   def command_name2
  1279.     # Do nothing.
  1280.   end
  1281.  
  1282. end # Scene_Equip
  1283.  
  1284. #==============================================================================
  1285. #
  1286. # ▼ End of File
  1287. #
  1288. #==============================================================================

这是显示伤害的脚本:
RUBY 代码复制
  1. #==============================================================================
  2. # +++ MOG - 伤害显示  (v4.5) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]https://atelierrgss.wordpress.com/[/url]
  6. #==============================================================================
  7. # 用图片显示伤害数字.
  8. #==============================================================================
  9. # 需要以下图片
  10. #
  11. # Critical
  12. # Evaded
  13. # Exp
  14. # Gold
  15. # Level Up
  16. # Missed
  17. # MP
  18. # Number
  19. # TP
  20. #
  21. # 全部放在 /GRAPHICS/DAMAGE/
  22. #==============================================================================
  23.  
  24. #==============================================================================
  25. # 行走图上显示伤害数字 (事件)
  26. #==============================================================================
  27. # 如果你想要在地图上或战斗中手动显示伤害数字,使用以下脚本:
  28. #
  29. # damage_popup(目标ID,数值,"类型")
  30. #
  31. # 目标ID
  32. #      1...999    - 地图上的事件ID
  33. #      0          - 玩家
  34. #      -1...-3    - 队友
  35. #
  36. # 数值
  37. #       显示伤害的数值(可以是负值)或文本.当类型为"States"时为状态的ID,不能为负值
  38. #
  39. # 类型 (可选)
  40. #      "Exp" - 显示EXP.
  41. #      "Gold" - 显示金币.
  42. #      "States" - 显示状态图标.
  43. #
  44. #==============================================================================
  45. #
  46. # damage_popup(1,999)
  47. # damage_popup(4,"存档点.")
  48. # damage_popup(0,"我饿了!!!")     <- 玩家
  49. # damage_popup(-1,"Booo!")        <- 1号队友(离玩家最近的队友,不是ID=1的队友)
  50. # damage_popup(0,2000,"Exp")      <- 显示 2000 Exp
  51. # damage_popup(0,5000,"Gold")     <- 显示 5000 金币
  52. #
  53. #==============================================================================
  54. # 使用以下脚本来在全部队友的头顶显示伤害数字.:
  55. #
  56. # damage_popup_party(目标ID,数值,"类型")
  57. #
  58. #==============================================================================
  59. # 地图上显示/不显示伤害数字.
  60. #==============================================================================
  61. # 使用以下脚本来在地图上显示/不显示伤害数字:
  62. #
  63. # damage_popup_map(true)        -> 或 (false)
  64. #  
  65. #==============================================================================
  66. # ● Histórico (Version History)
  67. #==============================================================================
  68. # v 4.5 - Correção de ativar o dano quando o alvo é morto e o dano é zero.
  69. #==============================================================================
  70.  
  71. $imported = {} if $imported.nil?
  72. $imported[:mog_damage_popup] = true
  73.  
  74. module MOG_DAMAGEPOPUP
  75.   #是否允许在地图上显示伤害数字. (默认)
  76.   DAMAGE_POPUP_MAP = false
  77.   #是否在获得物品时显示该物品图标. (仅在地图上).
  78.   ITEM_POPUP_MAP = false
  79.   #是否允许在敌人身上显示EXP和金币.
  80.   EXP_GOLD_POPUP_BATTLE = false
  81.   EXP_GOLD_POPUP_MAP = false
  82.   #是否显示升级
  83.   LEVEL_POPUP_BATTLE = false
  84.   LEVEL_POPUP_MAP = false
  85.   #是否显示状态图标
  86.   STATES_POPUP_BATTLE = true
  87.   STATES_POPUP_MAP = true
  88.   #设定字体 (物品名/状态名/ etc...).
  89.   FONT_SIZE = 28
  90.   FONT_BOLD = true
  91.   FONT_ITALIC = false
  92.   FONT_COLOR = Color.new(255,255,255)
  93.   FONT_COLOR_ITEM = Color.new(255,255,255)
  94.   FONT_COLOR_STATUS_PLUS = Color.new(155,155,255)
  95.   FONT_COLOR_STATUS_MINUS = Color.new(255,150,150)
  96.   #每条伤害间的距离(竖直距离).
  97.   Y_SPACE = 28
  98.   #伤害数字的Z坐标
  99.   DAMAGE_Z = 151
  100. end
  101.  
  102. #==============================================================================
  103. # ■ Game_System
  104. #==============================================================================
  105. class Game_System
  106.   attr_accessor :damage_popup_map
  107.  
  108.   #--------------------------------------------------------------------------
  109.   # ● Initialize
  110.   #--------------------------------------------------------------------------         
  111.   alias mog_damage_popup_initialize initialize
  112.   def initialize
  113.       @damage_popup_map = MOG_DAMAGEPOPUP::DAMAGE_POPUP_MAP
  114.       mog_damage_popup_initialize
  115.   end
  116.  
  117.   #--------------------------------------------------------------------------
  118.   # ● Damage Popup Clear
  119.   #--------------------------------------------------------------------------         
  120.   def damage_popup_clear
  121.       $game_party.character_members.each {|t|
  122.       t.actor.damage.clear; t.actor.skip_dmg_popup = false ;
  123.       t.damage.clear; t.skip_dmg_popup = false} rescue nil
  124.       $game_map.events.values.each {|t| t.damage.clear ;
  125.       t.skip_dmg_popup = false} rescue nil
  126.   end
  127.  
  128. end  
  129.  
  130. #==============================================================================
  131. # ■ Game Temp
  132. #==============================================================================
  133. class Game_Temp
  134.  
  135.   attr_accessor :battle_end
  136.  
  137.   #--------------------------------------------------------------------------
  138.   # ● Initialize
  139.   #--------------------------------------------------------------------------   
  140.   alias mog_damage_temp_opup_initialize initialize
  141.   def initialize
  142.       @battle_end = false
  143.       mog_damage_temp_opup_initialize
  144.   end
  145.  
  146.   #--------------------------------------------------------------------------
  147.   # ● Sprite Visible
  148.   #--------------------------------------------------------------------------   
  149.   def sprite_visible
  150.       return false if $game_message.visible
  151.       return false if $game_temp.battle_end
  152.       return true
  153.   end
  154.  
  155. end
  156. #==============================================================================
  157. # ■ Game CharacterBase
  158. #==============================================================================
  159. class Game_CharacterBase
  160.  
  161.   attr_accessor :damage ,:battler ,:skip_dmg_popup
  162.  
  163.   #--------------------------------------------------------------------------
  164.   # ● Ini Public Members
  165.   #--------------------------------------------------------------------------         
  166.   alias mog_damage_popup_init_public_members init_public_members
  167.   def init_public_members
  168.       @damage = [] ; @skip_dmg_popup = false
  169.       mog_damage_popup_init_public_members
  170.   end
  171.  
  172.   #--------------------------------------------------------------------------
  173.   # ● Damage Popup
  174.   #--------------------------------------------------------------------------         
  175.   def damage_popup(value,type = "String")      
  176.       @damage.push([value,type])
  177.   end  
  178.  
  179. end
  180.  
  181. #==============================================================================
  182. # ■ Scene Map
  183. #==============================================================================
  184. class Scene_Map < Scene_Base  
  185.   #--------------------------------------------------------------------------
  186.   # ● Start
  187.   #--------------------------------------------------------------------------
  188.   alias mog_damage_popup_start start
  189.   def start
  190.       $game_system.damage_popup_clear ; $game_temp.battle_end = false
  191.       mog_damage_popup_start
  192.   end  
  193. end
  194.  
  195. #==============================================================================
  196. # ■ Game Player
  197. #==============================================================================
  198. class Game_Player < Game_Character   
  199.   #--------------------------------------------------------------------------
  200.   # ● Battler
  201.   #--------------------------------------------------------------------------
  202.   def battler
  203.       actor
  204.   end   
  205. end
  206.  
  207. #==============================================================================
  208. # ■ Game Follower
  209. #==============================================================================
  210. class Game_Follower < Game_Character  
  211.   #--------------------------------------------------------------------------
  212.   # ● Battler
  213.   #--------------------------------------------------------------------------
  214.   def battler
  215.       actor
  216.   end   
  217. end
  218.  
  219. #==============================================================================
  220. # ■ Game_BattlerBase
  221. #==============================================================================
  222. class Game_BattlerBase  
  223.   #--------------------------------------------------------------------------
  224.   # ● Change HP
  225.   #--------------------------------------------------------------------------         
  226.   alias mog_damage_popup_change_hp change_hp
  227.   def change_hp(value, enable_death)
  228.       mog_damage_popup_change_hp(value, enable_death)
  229.       self.damage.push([-value,"Hp"])
  230.   end   
  231. end
  232.  
  233. #==============================================================================
  234. # ■ Game_Battler
  235. #==============================================================================
  236. class Game_Battler < Game_BattlerBase  
  237.   include MOG_DAMAGEPOPUP
  238.   attr_accessor :damage , :skip_dmg_popup
  239.  
  240.   #--------------------------------------------------------------------------
  241.   # ● Initialize
  242.   #--------------------------------------------------------------------------         
  243.   alias mog_damage_sprite_initialize initialize
  244.   def initialize      
  245.       @damage = [] ; @skip_dmg_popup = false
  246.       mog_damage_sprite_initialize
  247.   end  
  248.  
  249.   #--------------------------------------------------------------------------
  250.   # ● Item Apply
  251.   #--------------------------------------------------------------------------  
  252.    alias mog_damage_pop_item_apply item_apply
  253.    def item_apply(user, item)
  254.        mog_damage_pop_item_apply(user, item)
  255.        execute_damage_popup(user,item)
  256.   end
  257.  
  258.   #--------------------------------------------------------------------------
  259.   # ● Execute Damage Popup
  260.   #--------------------------------------------------------------------------
  261.   def execute_damage_popup(user,item)
  262.       if !@result.missed and !@result.evaded and @result.hit?
  263.         self.damage.push([@result.hp_damage,"HP",@result.critical]) if item.damage.to_hp? or @result.hp_damage != 0
  264.         user.damage.push([-@result.hp_drain,"HP",@result.critical]) if item.damage.type == 5
  265.         self.damage.push([@result.mp_damage,"MP",@result.critical]) if item.damage.to_mp? or @result.mp_damage != 0
  266.         user.damage.push([-@result.mp_drain,"MP",@result.critical]) if item.damage.type == 6
  267.         self.damage.push([@result.tp_damage,"TP",@result.critical]) if @result.tp_damage != 0
  268.      elsif !self.dead?
  269.         if @result.missed ; self.damage.push(["Missed","Missed"])
  270.         elsif @result.evaded ; self.damage.push(["Evaded","Evaded"])
  271.         end        
  272.       end
  273.   end
  274.  
  275.   #--------------------------------------------------------------------------
  276.   # ● Regenerate HP
  277.   #--------------------------------------------------------------------------
  278.   alias mog_damage_pop_regenerate_hp regenerate_hp
  279.   def regenerate_hp
  280.       mog_damage_pop_regenerate_hp
  281.       self.damage.push(["Regenerate",""]) if @result.hp_damage < 0  
  282.       self.damage.push([@result.hp_damage,"HP"]) if @result.hp_damage != 0
  283.   end
  284.  
  285.   #--------------------------------------------------------------------------
  286.   # ● Regenerate MP
  287.   #--------------------------------------------------------------------------
  288.   alias mog_damage_pop_regenerate_mp regenerate_mp
  289.   def regenerate_mp
  290.       mog_damage_pop_regenerate_mp
  291.       self.damage.push([@result.mp_damage,"MP"]) if @result.mp_damage != 0
  292.   end
  293.  
  294.   #--------------------------------------------------------------------------
  295.   # ● Regenerate TP
  296.   #--------------------------------------------------------------------------
  297.   alias mog_damage_pop_regenerate_tp regenerate_tp
  298.   def regenerate_tp
  299.       mog_damage_pop_regenerate_tp
  300.       tp_damage = 100 * trg
  301.       self.damage.push([tp_damage,"TP"]) if tp_damage != 0
  302.   end
  303.  
  304.   #--------------------------------------------------------------------------
  305.   # ● Added New State
  306.   #--------------------------------------------------------------------------  
  307.   alias mog_damage_pop_add_new_state add_new_state
  308.   def add_new_state(state_id)
  309.       mog_damage_pop_add_new_state(state_id)
  310.       execute_popup_add_new_state(state_id)
  311.   end
  312.  
  313.   #--------------------------------------------------------------------------
  314.   # ● Execute Popup Add New State
  315.   #--------------------------------------------------------------------------  
  316. def execute_popup_add_new_state(state_id)
  317.       st = $data_states[state_id]
  318.       if self.hp > 0
  319.          unless (SceneManager.scene_is?(Scene_Battle) and !STATES_POPUP_BATTLE) or
  320.                 (SceneManager.scene_is?(Scene_Map) and !STATES_POPUP_MAP)
  321.                 self.damage.push([st.name.to_s,"States Plus",false,st.icon_index])
  322.          end
  323.       end
  324.   end
  325.  
  326.   #--------------------------------------------------------------------------
  327.   # ● Remove State
  328.   #--------------------------------------------------------------------------  
  329.   alias mog_damage_pop_remove_state remove_state
  330.   def remove_state(state_id)
  331.       execute_popup_remove_state(state_id)  
  332.       mog_damage_pop_remove_state(state_id)
  333.   end      
  334.  
  335.   #--------------------------------------------------------------------------
  336.   # ● Execute Popup Remove State
  337.   #--------------------------------------------------------------------------  
  338.   def execute_popup_remove_state(state_id)  
  339.       if state?(state_id) and self.hp > 0
  340.          st = $data_states[state_id]
  341.          unless (SceneManager.scene_is?(Scene_Battle) and !STATES_POPUP_BATTLE) or
  342.                 (SceneManager.scene_is?(Scene_Map) and !STATES_POPUP_MAP)
  343.                 self.damage.push([st.name.to_s,"States Minus",false,st.icon_index]) unless BattleManager.escape?
  344.          end
  345.       end
  346.   end     
  347.  
  348. end
  349.  
  350. #==============================================================================
  351. # ■ BattleManager
  352. #==============================================================================
  353. module BattleManager
  354.   #--------------------------------------------------------------------------
  355.   # ● Escape?
  356.   #--------------------------------------------------------------------------
  357.   def self.escape?
  358.       @phase == nil
  359.   end  
  360. end
  361.  
  362. #==============================================================================
  363. # ■ Game_Temp
  364. #==============================================================================
  365. class Game_Temp
  366.   attr_accessor :dmg_battle_mode
  367.  
  368.   #--------------------------------------------------------------------------
  369.   # ● Initialize
  370.   #--------------------------------------------------------------------------         
  371.   alias mog_damage_popup_initialize initialize
  372.   def initialize
  373.       @dmg_battle_mode = false
  374.       mog_damage_popup_initialize
  375.   end
  376.  
  377. end
  378.  
  379. #==============================================================================
  380. # ■ Scene Battle
  381. #==============================================================================
  382. class Scene_Battle < Scene_Base
  383.  
  384.   #--------------------------------------------------------------------------
  385.   # ● Start
  386.   #--------------------------------------------------------------------------         
  387.   alias mog_damage_popup_start start
  388.   def start
  389.       $game_temp.dmg_battle_mode = true
  390.       mog_damage_popup_start
  391.   end
  392.  
  393.   #--------------------------------------------------------------------------
  394.   # ● Terminate
  395.   #--------------------------------------------------------------------------         
  396.   alias mog_damage_popup_terminate terminate
  397.   def terminate
  398.       mog_damage_popup_terminate
  399.       $game_temp.dmg_battle_mode = false
  400.   end
  401.  
  402. end
  403.  
  404. #==============================================================================
  405. # ■ Game Party
  406. #==============================================================================
  407. class Game_Party < Game_Unit
  408.  
  409.   #--------------------------------------------------------------------------
  410.   # ● Character Members
  411.   #--------------------------------------------------------------------------         
  412.   def character_members
  413.       char_m = [] ; char_m.push($game_player)
  414.       $game_player.followers.each do |f| char_m.push(f) end
  415.       return char_m
  416.   end
  417.  
  418.   #--------------------------------------------------------------------------
  419.   # ● Gain Gold
  420.   #--------------------------------------------------------------------------         
  421.   alias mog_damage_popup_gain_gold gain_gold
  422.   def gain_gold(amount)
  423.       mog_damage_popup_gain_gold(amount)
  424.       $game_party.members[0].damage.push([amount,"Gold"]) if can_damage_popup_gold?
  425.   end  
  426.  
  427.   #--------------------------------------------------------------------------
  428.   # ● Can Damage Popup Gold
  429.   #--------------------------------------------------------------------------         
  430.   def can_damage_popup_gold?
  431.       return false if !SceneManager.scene_is?(Scene_Map)
  432.       return false if $game_temp.dmg_battle_mode
  433.       return false if !MOG_DAMAGEPOPUP::EXP_GOLD_POPUP_MAP
  434.       return false if !$game_system.damage_popup_map
  435.       return false if !$game_party.members[0]
  436.       return true
  437.   end
  438.  
  439. #--------------------------------------------------------------------------
  440. # ● Gain Item
  441. #--------------------------------------------------------------------------
  442. alias mog_damage_popup_gain_item gain_item
  443. def gain_item(item, amount, include_equip = false)
  444.      mog_damage_popup_gain_item(item, amount, include_equip)
  445.      execute_item_popup(item) if can_damage_popup_item?(item)
  446. end
  447.  
  448. #--------------------------------------------------------------------------
  449. # ● Can Damage Poupup Item
  450. #--------------------------------------------------------------------------
  451. def can_damage_popup_item?(item)
  452.      return false if item == nil
  453.      return false if !MOG_DAMAGEPOPUP::ITEM_POPUP_MAP
  454.      return false if !$game_system.damage_popup_map
  455.      return false if SceneManager.scene_is?(Scene_Battle)
  456.      return false if !$game_party.members[0]
  457.      return false if $game_temp.dmg_battle_mode
  458.      return true     
  459. end
  460.  
  461. #--------------------------------------------------------------------------
  462. # ● Execute Item Popup
  463. #--------------------------------------------------------------------------
  464. def execute_item_popup(item)
  465.      it = $data_items[item.id] if item.is_a?(RPG::Item)
  466.      it = $data_weapons[item.id] if item.is_a?(RPG::Weapon)
  467.      it = $data_armors[item.id] if item.is_a?(RPG::Armor)   
  468.      $game_party.members[0].damage.push([it.name.to_s,"Item",false,it.icon_index])
  469. end
  470.  
  471. end
  472.  
  473. #==============================================================================
  474. # ■ Game Interpreter
  475. #==============================================================================
  476. class Game_Interpreter
  477.  
  478. #--------------------------------------------------------------------------
  479. # ● Damage Popup Map
  480. #--------------------------------------------------------------------------
  481.   def damage_popup_map(value)
  482.       $game_system.damage_popup_map = value
  483.   end   
  484.  
  485.   #--------------------------------------------------------------------------
  486.   # ● Damage Popup
  487.   #--------------------------------------------------------------------------
  488.   def damage_popup(target_id, value,type = "")
  489.       return if !$game_system.damage_popup_map
  490.       target = set_target_dmg(target_id) rescue nil
  491.       target.damage.push([value,type]) if target
  492.   end
  493.  
  494.   #--------------------------------------------------------------------------
  495.   # ● Set Target Dmg
  496.   #--------------------------------------------------------------------------
  497.   def set_target_dmg(target)
  498.       return $game_player.battler if target == 0
  499.       return $game_player.followers.battler[(target_id + 1).abs] if target < 0
  500.       $game_map.events.values.each do |event|
  501.       return event.battler if event.id == target_id and event.battler
  502.       return event if event.id == target_id
  503.       end
  504.   end
  505.  
  506.   #--------------------------------------------------------------------------
  507.   # * Change MP
  508.   #--------------------------------------------------------------------------
  509.   alias mog_damage_popup_command_312 command_312
  510.   def command_312
  511.       value = operate_value(@params[2], @params[3], @params[4])
  512.       iterate_actor_var(@params[0], @params[1]) do |actor|
  513.       actor.damage.push([-value,"MP"])
  514.       end   
  515.       mog_damage_popup_command_312
  516.   end  
  517.  
  518. end
  519.  
  520. #==============================================================================
  521. # ■ Game Actor
  522. #==============================================================================
  523. class Game_Actor < Game_Battler
  524.   include MOG_DAMAGEPOPUP
  525.   #--------------------------------------------------------------------------
  526.   # ● Level UP
  527.   #--------------------------------------------------------------------------         
  528.    alias mog_damage_pop_level_up level_up
  529.    def level_up
  530.        mog_damage_pop_level_up      
  531.        execute_level_popup
  532.    end
  533.  
  534.   #--------------------------------------------------------------------------
  535.   # ● Execute Level Popup
  536.   #--------------------------------------------------------------------------         
  537.    def execute_level_popup
  538.        if (SceneManager.scene_is?(Scene_Battle) and LEVEL_POPUP_BATTLE) or
  539.           (SceneManager.scene_is?(Scene_Map) and LEVEL_POPUP_MAP)
  540.           @damage.push(["Level UP","Level_UP"]) unless @skip_dmg_popup
  541.           @skip_dmg_popup = true
  542.        end     
  543.    end
  544.  
  545.   #--------------------------------------------------------------------------
  546.   # ● Change Exp
  547.   #--------------------------------------------------------------------------         
  548.   alias mog_damage_popup_change_exp change_exp
  549.   def change_exp(exp, show)
  550.       n_exp = self.exp
  551.       mog_damage_popup_change_exp(exp, show)
  552.       c_exp = n_exp - self.exp
  553.       @damage.push([c_exp.abs,"Exp"]) if can_popup_exp?(exp)
  554.   end   
  555.  
  556.   #--------------------------------------------------------------------------
  557.   # ● Can Popup EXP
  558.   #--------------------------------------------------------------------------         
  559.   def can_popup_exp?(exp)
  560.       return false if !EXP_GOLD_POPUP_MAP
  561.       return false if exp <= 0
  562.       return false if self.skip_dmg_popup
  563.       return false if self.max_level?
  564.       return true
  565.   end
  566.  
  567. end
  568.  
  569. #==============================================================================
  570. # ■ Scene_Battle
  571. #==============================================================================
  572. class Scene_Battle < Scene_Base
  573.  
  574.   #--------------------------------------------------------------------------
  575.   # ● Invoke Counter Attack
  576.   #--------------------------------------------------------------------------        
  577.   alias mog_damage_popup_invoke_counter_attack invoke_counter_attack
  578.   def invoke_counter_attack(target, item)
  579.       mog_damage_popup_invoke_counter_attack(target, item)
  580.       target.damage.push(["Counter","Counter"])
  581.   end  
  582.  
  583.   #--------------------------------------------------------------------------
  584.   # ● Invoke Counter Attack
  585.   #--------------------------------------------------------------------------        
  586.   alias mog_damage_popup_invoke_magic_reflection invoke_magic_reflection
  587.   def invoke_magic_reflection(target, item)
  588.       mog_damage_popup_invoke_magic_reflection(target, item)
  589.       target.damage.push(["Reflection","Reflection"])
  590.   end  
  591.  
  592. end
  593.  
  594. #==============================================================================
  595. # ■ Cache
  596. #==============================================================================
  597. module Cache
  598.  
  599.   #--------------------------------------------------------------------------
  600.   # * Damage
  601.   #--------------------------------------------------------------------------
  602.   def self.damage(filename)
  603.       load_bitmap("Graphics/Damage/", filename)
  604.   end
  605.  
  606. end
  607.  
  608. #==============================================================================
  609. # ■ Game Temp
  610. #==============================================================================
  611. class Game_Temp
  612.  
  613.   attr_accessor :pre_cache_damage
  614.  
  615.   #--------------------------------------------------------------------------
  616.   # ● Initialize
  617.   #--------------------------------------------------------------------------  
  618.   alias mog_damage_pop_initialize initialize
  619.   def initialize
  620.       mog_damage_pop_initialize
  621.       pre_cache_damage_temp
  622.   end
  623.  
  624.   #--------------------------------------------------------------------------
  625.   # ● Pre Cache Damage Temp
  626.   #--------------------------------------------------------------------------   
  627.   def pre_cache_damage_temp
  628.       return if @pre_cache_damage != nil
  629.       @pre_cache_damage = []
  630.       @pre_cache_damage.push(Cache.damage("HP_Number"))
  631.       @pre_cache_damage.push(Cache.damage("MP"))
  632.       @pre_cache_damage.push(Cache.damage("TP"))
  633.       @pre_cache_damage.push(Cache.damage("Missed"))
  634.       @pre_cache_damage.push(Cache.damage("Evaded"))
  635.       @pre_cache_damage.push(Cache.damage("Critical"))
  636.       @pre_cache_damage.push(Cache.damage("Exp"))
  637.       @pre_cache_damage.push(Cache.damage("Gold"))
  638.       @pre_cache_damage.push(Cache.damage("Level UP"))
  639.       @pre_cache_damage.push(Cache.damage("Counter"))
  640.       @pre_cache_damage.push(Cache.damage("Reflection"))
  641.       @pre_cache_damage.push(Cache.damage("MP_Number"))
  642.       @pre_cache_damage.push(Cache.damage("TP_Number"))
  643.       @pre_cache_damage.push(Cache.damage("EG_Number"))
  644.       @pre_cache_damage.push(Cache.system("Iconset"))
  645.   end
  646.  
  647. end
  648.  
  649. #==============================================================================
  650. # ■ Sprite Base
  651. #==============================================================================
  652. class Sprite_Base < Sprite
  653.  
  654.   #--------------------------------------------------------------------------
  655.   # ● Initialize
  656.   #--------------------------------------------------------------------------  
  657.   alias mog_damage_popup_sprite_initialize initialize
  658.   def initialize(viewport = nil)
  659.       mog_damage_popup_sprite_initialize(viewport)
  660.       damage_popup_setup
  661.   end
  662.  
  663.   #--------------------------------------------------------------------------
  664.   # ● Damage Popup Setup
  665.   #--------------------------------------------------------------------------  
  666.   def damage_popup_setup      
  667.       $game_temp.pre_cache_damage_temp ; @damage_sprites = []
  668.       $game_system.damage_popup_clear
  669.   end
  670.  
  671.   #--------------------------------------------------------------------------
  672.   # ● Dispose
  673.   #--------------------------------------------------------------------------  
  674.   alias mog_damage_popup_sprite_dispose dispose
  675.   def dispose      
  676.       mog_damage_popup_sprite_dispose
  677.       dispose_damage_sprites
  678.   end
  679.  
  680.   #--------------------------------------------------------------------------
  681.   # ● Dispose Damage Sprites
  682.   #--------------------------------------------------------------------------   
  683.   def dispose_damage_sprites
  684.       return if @damage_sprites == nil
  685.       @damage_sprites.each {|sprite| sprite.dispose_damage }
  686.   end  
  687.  
  688.   #--------------------------------------------------------------------------
  689.   # ● Update
  690.   #--------------------------------------------------------------------------  
  691.   alias mog_damage_popup_sprite_update update
  692.   def update
  693.       mog_damage_popup_sprite_update
  694.       update_damage_popup
  695.   end  
  696.  
  697.   #--------------------------------------------------------------------------
  698.   # ● Update Damage Popup
  699.   #--------------------------------------------------------------------------   
  700.   def update_damage_popup
  701.       return if @damage_sprites == nil
  702.       create_damage_sprite if can_create_damage?
  703.       update_damage_sprite if !@damage_sprites.empty?
  704.   end  
  705.  
  706.   #--------------------------------------------------------------------------
  707.   # ● Can Create Damage?
  708.   #--------------------------------------------------------------------------     
  709.   def can_create_damage?      
  710.       return false if $game_message.visible
  711.       if @battler
  712.          return false if @battler.damage == nil
  713.          return false if @battler.damage.empty?
  714.          if $game_temp.battle_end and @battler.is_a?(Game_Actor)
  715.             return false if $game_message.visible
  716.             return false if $imported[:mog_battler_result] and $game_temp.result
  717.          end
  718.       elsif @character
  719.          return false if !$game_system.damage_popup_map
  720.          if @character.battler
  721.             return false if @character.battler.damage == nil
  722.             return false if @character.battler.damage.empty?
  723.          else
  724.             return false if @character.damage == nil
  725.             return false if @character.damage.empty?            
  726.          end  
  727.       end
  728.       return false if @battler == nil and @character == nil      
  729.       return true
  730.   end
  731.  
  732.   #--------------------------------------------------------------------------
  733.   # ● Create Damage Sprite
  734.   #--------------------------------------------------------------------------     
  735.   def create_damage_sprite
  736.       target = @battler ? @battler : @character
  737.       screen_x_available = target.screen_x rescue nil
  738.       return if screen_x_available == nil
  739.       sx = target.screen_x != nil ? target.screen_x : self.x
  740.       sy = target.screen_y != nil ? target.screen_y : self.y
  741.       @damage_sprites = [] if @damage_sprites == nil  
  742.       target = @character.battler if @character and @character.battler
  743.       target.damage.each_with_index do |i, index|
  744.       @damage_sprites.push(Damage_Sprite.new(nil,sx,sy,i,index,@damage_sprites.size,self)) end
  745.       if SceneManager.scene_is?(Scene_Battle)
  746.       @damage_sprites.each_with_index do |i, index| i.set_duration(index) end
  747.       end
  748.       target.damage.clear ; target.skip_dmg_popup = false
  749.   end  
  750.  
  751.   #--------------------------------------------------------------------------
  752.   # ● Update Damage Sprite
  753.   #--------------------------------------------------------------------------     
  754.   def update_damage_sprite
  755.       clear = true
  756.       @damage_sprites.each_with_index do |sprite, i|
  757.           sprite.update_damage(@damage_sprites.size,i,@battler)
  758.           sprite.dispose_damage if sprite.duration <= 0
  759.           clear = false if sprite.duration > 0
  760.       end   
  761.       @damage_sprites.clear if clear
  762.   end  
  763.  
  764. end
  765.  
  766. #==============================================================================
  767. # ■ Damage Sprite
  768. #==============================================================================
  769. class Damage_Sprite < Sprite
  770.    include MOG_DAMAGEPOPUP
  771.    attr_accessor :duration
  772.  
  773.   #--------------------------------------------------------------------------
  774.   # ● Initialize
  775.   #--------------------------------------------------------------------------      
  776.   def initialize(viewport = nil , x,y, value ,index,index_max,target)
  777.       super(viewport)
  778.       dispose_damage ; setup_base(value,x,y,index,index_max,target) ; create_sprites
  779.   end   
  780.  
  781.   #--------------------------------------------------------------------------
  782.   # ● Setup Base
  783.   #--------------------------------------------------------------------------      
  784.   def setup_base(value,x,y,index,index_max,target)
  785.       @target = target ; y2 = 0
  786.       if @target.bitmap != nil ; y2 = SceneManager.scene_is?(Scene_Battle) ? @target.bitmap.height / 2 : 0 ; end
  787.       @animation_type = 0 ; @index = index ; @index_max = index_max + 1
  788.       @image = $game_temp.pre_cache_damage ; self.z = index + DAMAGE_Z
  789.       @cw = @image[0].width / 10 ; @ch = @image[0].height / 2 ; @cw2 = 0
  790.       @x = x ; @y = y - y2 ; @value = value[0] ; @type = value[1] ; @ch2 = 0
  791.       @critical = (value[2] and @value.to_i >= 0) ? true : false; self.opacity = 0
  792.       @state_index = value[3] ; @oxy = [0,0,0,0] ; @org_xy = [0,0] ; @spxy = [0,0]
  793.       @duration = 92 ; @org_oxy = [0,0,0,0]
  794.       self.visible = false ;set_initial_position(index,nil)
  795.   end
  796.  
  797.   #--------------------------------------------------------------------------
  798.   # ● Set Duration
  799.   #--------------------------------------------------------------------------      
  800.   def set_duration(index,pre_index = nil)
  801.       return if @duration != 0
  802.       @duration = 82 + (2 * index) if @animation_type == 0
  803.   end
  804.  
  805.   #--------------------------------------------------------------------------
  806.   # ● Set Initial Position
  807.   #--------------------------------------------------------------------------      
  808.   def set_initial_position(index,old_duration)
  809.       @org_xy = [@x,@y]
  810.       self.zoom_y = self.zoom_x
  811.   end
  812.  
  813.   #--------------------------------------------------------------------------
  814.   # ● Dispose Damage
  815.   #--------------------------------------------------------------------------      
  816.   def dispose_damage
  817.       (self.bitmap.dispose ; self.bitmap = nil) if self.bitmap
  818.       (@sup_sprite.bitmap.dispose ; @sup_sprite.dispose) if @sup_sprite  
  819.       @duration = -1
  820.   end
  821.  
  822.   #--------------------------------------------------------------------------
  823.   # ● Create Sprites
  824.   #--------------------------------------------------------------------------      
  825.   def create_sprites
  826.       if @value.is_a?(Numeric)
  827.          create_number         
  828.       elsif ["Missed","Evaded","Level UP","Counter","Reflection"].include?(@value.to_s)
  829.          create_miss
  830.       else
  831.          create_string
  832.       end      
  833.       set_damage_position
  834.   end
  835.  
  836.   #--------------------------------------------------------------------------
  837.   # ● Set Damage Position
  838.   #--------------------------------------------------------------------------      
  839.   def set_damage_position
  840.       return if self.bitmap == nil
  841.       self.ox = (self.bitmap.width - @cw2) / 2
  842.       self.oy = self.bitmap.height / 2 ; self.x = @x ; self.y = @y
  843.       @org_oxy[0] = self.ox
  844.       @org_oxy[1] = self.oy
  845.       set_animation_type
  846.       if @sup_sprite
  847.          @sup_sprite.ox = self.bitmap.width / 2 ;
  848.          @sup_sprite.oy = self.bitmap.height / 2
  849.          @org_oxy[2] = @sup_sprite.ox
  850.          @org_oxy[3] = @sup_sprite.oy
  851.          if @critical
  852.             @sup_sprite.x = @x - (@sup_sprite.bitmap.width / 2) + ((@cw / 2) * @number_value.size)
  853.             @sup_sprite.y = self.y
  854.          end   
  855.          update_sup_position(@index_max - @index)
  856.       end
  857.   end   
  858.  
  859.   #--------------------------------------------------------------------------
  860.   # ● Set Damage Position
  861.   #--------------------------------------------------------------------------      
  862.   def set_animation_type
  863.       s = rand(2) ; s2 = (rand(10) * 0.1).round(2)
  864.       @oxy[2] = s == 1 ? s2 : -s2
  865.   end
  866.  
  867.   #--------------------------------------------------------------------------
  868.   # ● Create Number
  869.   #--------------------------------------------------------------------------      
  870.   def create_number
  871.       case @type
  872.       when "MP"
  873.       number_image = @image[11] ;h = @value >= 0 ? 0 : @ch ; create_sup_sprite
  874.       when "TP"
  875.       number_image = @image[12] ;h = @value >= 0 ? 0 : @ch ; create_sup_sprite
  876.       when "Exp"
  877.       number_image = @image[13] ;h = 0 ; create_sup_sprite
  878.       when "Gold"
  879.       number_image = @image[13] ;h = @ch ; create_sup_sprite            
  880.       else
  881.       number_image = @image[0] ; h = @value >= 0 ? 0 : @ch
  882.       end
  883.       @number_value = @value.abs.truncate.to_s.split(//)
  884.       self.bitmap = Bitmap.new(@cw * @number_value.size, @ch)
  885.       for r in 0...@number_value.size        
  886.           number_value_abs = @number_value[r].to_i
  887.           src_rect = Rect.new(@cw * number_value_abs, h, @cw, @ch)
  888.           self.bitmap.blt(@cw *  r, 0, number_image, src_rect)
  889.       end   
  890.       create_sup_sprite if @critical
  891.   end
  892.  
  893.   #--------------------------------------------------------------------------
  894.   # ● Create Sup Sprite
  895.   #--------------------------------------------------------------------------      
  896.   def create_sup_sprite
  897.       return if @sup_sprite != nil
  898.       @sup_sprite = Sprite.new ; @sup_sprite.visible = false ; fy = 0 ; sp = [0,0]
  899.       if @type == "MP" ; @sup_sprite.bitmap = @image[1].dup
  900.       elsif @type == "TP" ; @sup_sprite.bitmap = @image[2].dup
  901.       elsif @critical
  902.          @sup_sprite.bitmap = @image[5].dup
  903.          @cw2 = 0 ; @ch2 = @sup_sprite.bitmap.height  
  904.          return
  905.       elsif @type == "Exp"
  906.          @sup_sprite.bitmap = @image[6].dup ; fy = @ch ; sp[1] = 1.0
  907.       elsif @type == "Gold"
  908.          @sup_sprite.bitmap = @image[7].dup ; fy = (@ch * 2) ; sp[1] = 0.5
  909.      end  
  910.      fy = 0 if !SceneManager.scene_is?(Scene_Battle)
  911.      @y += fy ; @org_xy[1] += 0
  912.      @cw2 = @sup_sprite.bitmap.width + @cw
  913.      @spxy = [sp[0],sp[1]]
  914.   end
  915.  
  916.   #--------------------------------------------------------------------------
  917.   # ● Update Sup Position
  918.   #--------------------------------------------------------------------------      
  919.   def update_sup_position(dif_y)
  920.       @sup_sprite.x = self.x - @cw unless @critical
  921.       @sup_sprite.y = @critical ? self.y - @ch2 : self.y
  922.       @sup_sprite.opacity = self.opacity ; @sup_sprite.angle = self.angle
  923.       @sup_sprite.zoom_x = self.zoom_x ; @sup_sprite.zoom_y = self.zoom_y
  924.       @sup_sprite.z = self.z ; @sup_sprite.viewport = self.viewport
  925.       @sup_sprite.visible = self.visible
  926.   end  
  927.  
  928.   #--------------------------------------------------------------------------
  929.   # ● Create Miss
  930.   #--------------------------------------------------------------------------      
  931.   def create_miss
  932.       self.bitmap = @image[3].dup if @value == "Missed"
  933.       self.bitmap = @image[4].dup if @value == "Evaded"
  934.       self.bitmap = @image[8].dup if @value == "Level UP"
  935.       self.bitmap = @image[9].dup if @value == "Counter"
  936.       self.bitmap = @image[10].dup if @value == "Reflection"
  937.   end
  938.  
  939.   #--------------------------------------------------------------------------
  940.   # ● Create Spring
  941.   #--------------------------------------------------------------------------               
  942.   def create_string
  943.       string_size = @value.to_s.split(//) ; fsize = FONT_SIZE > 10 ? FONT_SIZE : 10
  944.       @stg_size = string_size.size > 0 ? ((1 + string_size.size ) * ((fsize / 2) - 2)) : 32      
  945.       self.bitmap = Bitmap.new(@stg_size,32)
  946.       self.bitmap.font.color = FONT_COLOR
  947.       self.bitmap.font.size = fsize ; self.bitmap.font.bold = FONT_BOLD
  948.       self.bitmap.font.italic = FONT_ITALIC
  949.       if @type == "Item"
  950.          self.bitmap.font.color = FONT_COLOR_ITEM
  951.       elsif @type == "States Plus"
  952.          self.bitmap.font.color = FONT_COLOR_STATUS_PLUS
  953.       elsif @type == "States Minus"
  954.          self.bitmap.font.color = FONT_COLOR_STATUS_MINUS
  955.       end      
  956.       self.bitmap.draw_text(0, 0, self.bitmap.width, self.bitmap.height, @value.to_s,0)
  957.       draw_states if @state_index != nil
  958.   end
  959.  
  960.   #--------------------------------------------------------------------------
  961.   # ● Draw States
  962.   #--------------------------------------------------------------------------               
  963.   def draw_states
  964.       @sup_sprite = Sprite.new ; @sup_sprite.bitmap = Bitmap.new(24,24)
  965.       rect = Rect.new(@state_index % 16 * 24, @state_index / 16 * 24, 24, 24)
  966.       @image[14] = Cache.system("Iconset") if @image[14]== nil or @image[14].disposed?
  967.       @sup_sprite.bitmap.blt(0, 0, @image[14].dup, rect)
  968.       (@org_xy[1] += (@ch + 5) ; @y += (@ch + 5)) unless !SceneManager.is_a?(Scene_Battle)
  969.       @cw2 = @sup_sprite.bitmap.width + @cw / 2 ; @sup_sprite.visible = false
  970.   end  
  971.  
  972.   #--------------------------------------------------------------------------
  973.   # ● Update Damage
  974.   #--------------------------------------------------------------------------               
  975.   def update_damage(index_max,index,battler)
  976.       @index_max = index_max ; @index = index
  977.       return if self.bitmap == nil or self.bitmap.disposed?
  978.       @duration -= 1
  979.       self.visible = @duration > 90 ? false : true
  980.       return if !self.visible
  981.       dif_y = (@index_max - @index)
  982.       update_animation(dif_y)
  983.       update_sprite_position(dif_y,battler)
  984.       update_sup_position(dif_y) if @sup_sprite
  985.       dispose_damage if @duration <= 0
  986.   end
  987.  
  988.   #--------------------------------------------------------------------------
  989.   # ● Update Sprite Position
  990.   #--------------------------------------------------------------------------               
  991.   def update_sprite_position(dif_y,battler)
  992.       execute_move(0,self,@org_xy[0] + @oxy[0])
  993.       execute_move(1,self,@org_xy[1] + @oxy[1] - (dif_y * Y_SPACE))
  994.       self.zoom_y = self.zoom_x
  995.       update_battle_camera if oxy_camera?(battler)
  996.   end   
  997.  
  998.   #--------------------------------------------------------------------------
  999.   # ● Update Battle Camera
  1000.   #--------------------------------------------------------------------------               
  1001.   def update_battle_camera
  1002.       self.ox = $game_temp.viewport_oxy[0] + @org_oxy[0]
  1003.       self.oy = $game_temp.viewport_oxy[1] + @org_oxy[1]
  1004.       @sup_sprite.ox = $game_temp.viewport_oxy[0] + @org_oxy[2] if @sup_sprite != nil
  1005.       @sup_sprite.oy = $game_temp.viewport_oxy[1] + @org_oxy[3] if @sup_sprite != nil
  1006.   end  
  1007.  
  1008.   #--------------------------------------------------------------------------
  1009.   # ● OXY_CAMERA
  1010.   #--------------------------------------------------------------------------               
  1011.   def oxy_camera?(battler)
  1012.       return false if $imported[:mog_battle_camera] == nil
  1013.       if battler.is_a?(Game_Actor)
  1014.          return false if $imported[:mog_battle_hud_ex] and SceneManager.face_battler?
  1015.       end
  1016.       return true
  1017.   end
  1018.  
  1019.   #--------------------------------------------------------------------------
  1020.   # ● Execute Move
  1021.   #--------------------------------------------------------------------------      
  1022.   def execute_move(type,sprite,np)
  1023.       cp = type == 0 ? sprite.x : sprite.y
  1024.       sp = 1 + ((cp - np).abs / 10)
  1025.       sp = 1 if @duration < 60
  1026.       if cp > np ;    cp -= sp ; cp = np if cp < np
  1027.       elsif cp < np ; cp += sp ; cp = np if cp > np
  1028.       end     
  1029.       sprite.x = cp if type == 0 ; sprite.y = cp if type == 1
  1030.   end   
  1031.  
  1032.   #--------------------------------------------------------------------------
  1033.   # ● Update Animation
  1034.   #--------------------------------------------------------------------------               
  1035.   def update_animation(dif_y)
  1036.      @oxy[1] -= 1
  1037.      case @duration
  1038.      when 60..90 ; self.opacity += 15
  1039.      when 30..60 ; self.opacity = 255
  1040.      when 0..30  ; self.opacity -= 9
  1041.      end
  1042.   end
  1043.  
  1044. end
  1045.  
  1046. #==============================================================================
  1047. # ■ Sprite Battler
  1048. #==============================================================================
  1049. class Sprite_Battler < Sprite_Base
  1050.  
  1051.   #--------------------------------------------------------------------------
  1052.   # ● Update Collapse
  1053.   #--------------------------------------------------------------------------  
  1054.   alias mog_damage_pop_update_collapse update_collapse
  1055.   def update_collapse
  1056.       mog_damage_pop_update_collapse
  1057.       execute_exp_pop
  1058.   end
  1059.  
  1060.   #--------------------------------------------------------------------------
  1061.   # ● Update Instant Collapse
  1062.   #--------------------------------------------------------------------------  
  1063.   alias mog_damage_pop_update_instant_collapse update_instant_collapse
  1064.   def update_instant_collapse
  1065.       mog_damage_pop_update_instant_collapse
  1066.       execute_exp_pop
  1067.   end   
  1068.  
  1069.   #--------------------------------------------------------------------------
  1070.   # ● Update Boss Collapse
  1071.   #--------------------------------------------------------------------------  
  1072.   alias mog_damage_pop_update_boss_collapse update_boss_collapse
  1073.   def update_boss_collapse
  1074.       mog_damage_pop_update_boss_collapse
  1075.       execute_exp_pop
  1076.   end
  1077.  
  1078.   #--------------------------------------------------------------------------
  1079.   # ● Execute Exp Pop
  1080.   #--------------------------------------------------------------------------  
  1081.   def execute_exp_pop
  1082.       return if !MOG_DAMAGEPOPUP::EXP_GOLD_POPUP_BATTLE or @dam_exp != nil
  1083.       return if @battler == nil or @battler.is_a?(Game_Actor)
  1084.       @dam_exp = true
  1085.       if $imported[:mog_active_bonus_gauge] != nil
  1086.          real_exp = $game_troop.bonus_exp? ? @battler.exp * 2 : @battler.exp
  1087.          real_gold = $game_troop.bonus_gold? ? @battler.gold * 2 : @battler.gold
  1088.       else
  1089.          real_exp = @battler.exp ;  real_gold = @battler.gold
  1090.       end
  1091.       @battler.damage.push([real_exp,"Exp"]) if @battler.exp > 0
  1092.       @battler.damage.push([real_gold,"Gold"]) if @battler.gold > 0
  1093.   end   
  1094.  
  1095. end

这三个脚本中任意两个一起使用都没问题,但是一旦三个一起使用,则装备栏脚本会出错,显示伤害的脚本会无法起作用。这是怎么回事?而且出错时的弹窗说了“group”之类的,我个脚本盲完全不明白。

显示伤害脚本需要用到的图片.zip

131.56 KB, 下载次数: 11

最佳答案

查看完整内容

把"修改游戏分辨率的脚本"放在"装备栏脚本"的下方能解決"出错时的弹窗说了"group”" "显示伤害的脚本会无法起作用" 有起作用吧,,,只不过显示的是白字而不是图片素材数字 大约825行的 def create_sprites if @value.is_a?(Numeric) create_number 红色的部分不知道为啥, 加了"修改游戏分辨率的脚本"后, 会由true变成了false 另建议別用这个"修改游戏分辨率的脚本" 另你DEFAULT_BASE_SLOTS = [0,0,0,0, ...

Lv5.捕梦者

梦石
0
星屑
24464
在线时间
5072 小时
注册时间
2016-3-8
帖子
1623
2
发表于 2021-10-12 19:10:20 | 只看该作者
本帖最后由 alexncf125 于 2021-10-12 20:35 编辑

把"修改游戏分辨率的脚本"放在"装备栏脚本"的下方能解決"出错时的弹窗说了"group”"

"显示伤害的脚本会无法起作用"
有起作用吧,,,只不过显示的是白字而不是图片素材数字
大约825行的
  def create_sprites
     if @value.is_a?(Numeric)
         create_number         
红色的部分不知道为啥, 加了"修改游戏分辨率的脚本"后, 会由true变成了false

另建议別用这个"修改游戏分辨率的脚本"

另你DEFAULT_BASE_SLOTS = [0,0,0,0,0,1,2,3,4,5,5,5,5,5,6,7]
下方
    TYPES ={
    # TypeID => ["类型名称", 能否移除?, 能否使用"最强装备"?],
           0 => [   "心灵",       true,     false],
           1 => [   "衣服",       true,     false],
           2 => [   "下装",       true,     false],
           3 => [   "袜子",       true,     false],
           4 => [   "鞋子",       true,     false],
           5 => [   "其它",       true,     false],
    } # 别动这个括号.
得补上6和7
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7098
在线时间
887 小时
注册时间
2015-2-10
帖子
248
3
 楼主| 发表于 2021-10-12 20:49:00 | 只看该作者
alexncf125 发表于 2021-10-12 20:20
把"修改游戏分辨率的脚本"放在"装备栏脚本"的下方能解決"出错时的弹窗说了"group”"

"显示伤害的脚本会无 ...

这是我搜索了整个Project1后找到的最简单方便的改分辨率的脚本了……你能提供一个不会和这些脚本产生冲突的改分辨率的脚本吗?
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7098
在线时间
887 小时
注册时间
2015-2-10
帖子
248
4
 楼主| 发表于 2021-10-13 16:38:57 | 只看该作者
alexncf125 发表于 2021-10-12 20:20
把"修改游戏分辨率的脚本"放在"装备栏脚本"的下方能解決"出错时的弹窗说了"group”"

"显示伤害的脚本会无 ...

谢谢了,我已经找到一个不和这两个脚本冲突的改分辨率的脚本了。
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-12 13:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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