查看: 2969|回复: 3

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

[复制链接]
梦石
0
星屑
10510
在线时间
1118 小时
注册时间
2015-2-10
回帖
164
发表于 2021-10-12 19:10:19 | 显示全部楼层 |阅读模式
悬赏50星屑已解决
本帖最后由 fbeds 于 2021-10-12 19:11 编辑

这是修改游戏分辨率的脚本:
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ String
  4. #------------------------------------------------------------------------------
  5. #  String 类追加定义。
  6. #==============================================================================

  7. class String
  8.   #----------------------------------------------------------------------------
  9.   # ● API
  10.   #----------------------------------------------------------------------------
  11.   @@MultiByteToWideChar  = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
  12.   @@WideCharToMultiByte  = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
  13.   #----------------------------------------------------------------------------
  14.   # ● UTF-8 转 Unicode
  15.   #----------------------------------------------------------------------------
  16.   def u2w
  17.     i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0)
  18.     buffer = "\0" * (i*2)
  19.     @@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i)
  20.     buffer.chop!
  21.     return buffer
  22.   end  
  23.   #----------------------------------------------------------------------------
  24.   # ● UTF-8 转系统编码
  25.   #----------------------------------------------------------------------------
  26.   def u2s
  27.     i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0)
  28.     buffer = "\0" * (i*2)
  29.     @@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i)
  30.     i = @@WideCharToMultiByte.call(0, 0, buffer, -1, nil, 0, nil, nil)
  31.     result = "\0" * i
  32.     @@WideCharToMultiByte.call(0, 0, buffer, -1, result, i, nil, nil)
  33.     result.chop!
  34.     return result
  35.   end
  36.   #----------------------------------------------------------------------------
  37.   # ● 系统编码转 UTF-8
  38.   #----------------------------------------------------------------------------
  39.   def s2u
  40.     i = @@MultiByteToWideChar.call(0, 0, self, -1, nil, 0)
  41.     buffer = "\0" * (i*2)
  42.     @@MultiByteToWideChar.call(0, 0, self, -1, buffer, buffer.size / 2)
  43.     i = @@WideCharToMultiByte.call(65001, 0, buffer, -1, nil, 0, nil, nil)
  44.     result = "\0" * i
  45.     @@WideCharToMultiByte.call(65001, 0, buffer, -1, result, result.size, nil, nil)
  46.     result.chop!
  47.     return result
  48.   end
  49. end

  50. #==============================================================================
  51. # ■ AceResolutionMemoryPatch
  52. #------------------------------------------------------------------------------
  53. #  用于调整RMACE分辨率的内存补丁脚本,免修改DLL。
  54. #
  55. #   by 灼眼的夏娜(感谢fux2君提供内存地址)
  56. #==============================================================================
  57. # 更多脚本请转到 [url]www.66rpg.com[/url]。
  58. #==============================================================================
  59. module AceResolutionMemoryPatch

  60.   GetModuleFileName       = Win32API.new("kernel32", "GetModuleFileName", "lpl", "l")
  61.   GetPrivateProfileString = Win32API.new("kernel32", "GetPrivateProfileString", "pppplp", "l")
  62.   GetModuleHandle         = Win32API.new("kernel32", "GetModuleHandle", "p", "l")
  63.   RtlMoveMemory           = Win32API.new("kernel32", "RtlMoveMemory", "pli", "v")
  64.   RtlMoveMemoryLP         = Win32API.new("kernel32", "RtlMoveMemory", "lpi", "v")
  65.   VirtualProtect          = Win32API.new("kernel32", "VirtualProtect", "lllp", "i")
  66.   FindWindow              = Win32API.new("user32", "FindWindow", "pp", "l")

  67.   module_function

  68.   def patch(width = 1024, height = 768)
  69.     # 获取句柄
  70.     path = 0.chr * 256
  71.     return false if 0 == GetModuleFileName.call(0, path, path.size)
  72.     path = path.s2u.gsub!(/.exe/ ,".ini").u2s
  73.     buff = 0.chr * 256
  74.     return false if 0 == GetPrivateProfileString.call("Game", "Library", nil, buff, buff.size, path)
  75.     buff.delete!("\0")
  76.     rgsshandle = GetModuleHandle.call(buff)
  77.     # 获取标题名和脚本名字
  78.     title = 0.chr * 256
  79.     return false if 0 == GetPrivateProfileString.call("Game", "Title", nil, title, title.size, path)
  80.     title = title.s2u.delete("\0").u2s
  81.     scripts = 0.chr * 256
  82.     return false if 0 == GetPrivateProfileString.call("Game", "Scripts", nil, scripts, scripts.size, path)
  83.     scripts = scripts.s2u.delete("\0").u2w
  84.     # 地址表
  85.     addr =
  86.     {
  87.       # 直接宽度替换
  88.       :w0 => [0x000016EE, 0x000020F6, 0x000020FF, 0x0010DFED, 0x0010E025, 0x0010E059, 0x0010E08D, 0x000019AA, 0x00001A5B, 0x0001C528, 0x0001F49C, 0x0010E7E7, 0x0010EFE9],
  89.       # 直接高度替换
  90.       :h0 => [0x000016E9, 0x00002106, 0x0000210F, 0x0010DFE8, 0x0010E020, 0x0010E054, 0x0010E088, 0x000019A5, 0x00001A56, 0x0001C523, 0x0001F497, 0x0010E803, 0x0010EFF9],

  91.       # 宽度+32
  92.       :w1 => [0x000213E4],
  93.       # 高度+32
  94.       :h1 => [0x000213DF],

  95.       # 最大宽度/32+1
  96.       :w2 => [0x00021FE1],
  97.       # 最大高度/32+1
  98.       :h2 => [0x00021F5D]
  99.     }
  100.     # 更新
  101.     w0 = [width].pack("L")
  102.     addr[:w0].each{|ofs| return false if !write_memory(rgsshandle + ofs, w0)}
  103.     h0 = [height].pack("L")
  104.     addr[:h0].each{|ofs| return false if !write_memory(rgsshandle + ofs, h0)}
  105.     w1 = [width + 32].pack("L")
  106.     addr[:w1].each{|ofs| return false if !write_memory(rgsshandle + ofs, w1)}
  107.     h1 = [height + 32].pack("L")
  108.     addr[:h1].each{|ofs| return false if !write_memory(rgsshandle + ofs, h1)}
  109.     w2 = [width / 32 + 1].pack("C")
  110.     addr[:w2].each{|ofs| return false if !write_memory(rgsshandle + ofs, w2)}
  111.     h2 = [height / 32 + 1].pack("C")
  112.     addr[:h2].each{|ofs| return false if !write_memory(rgsshandle + ofs, h2)}
  113.     # 重启
  114.     rgssgamemain = Win32API.new(buff, "RGSSGameMain", "ipp", "v")
  115.     rgssgamemain.call(FindWindow.call("RGSS Player", title), scripts, "")
  116.     # 补丁成功
  117.     return true
  118.   end

  119.   def write_memory(addr, str)
  120.     old = 0.chr * 4
  121.     return false if 0 == VirtualProtect.call(addr, str.size, 0x40, old)
  122.     RtlMoveMemoryLP.call(addr, str, str.size)
  123.     return false if 0 == VirtualProtect.call(addr, str.size, old.unpack("L").first, old)
  124.     return true
  125.   end
  126.   private_class_method :write_memory

  127.   def read_byte(addr)
  128.     dst = 0.chr * 1
  129.     RtlMoveMemory.call(dst, addr, dst.size)
  130.     return dst.unpack("C").first
  131.   end
  132.   private_class_method :read_byte

  133.   def read_dword(addr)
  134.     dst = 0.chr * 4
  135.     RtlMoveMemory.call(dst, addr, dst.size)
  136.     return dst.unpack("L").first
  137.   end
  138.   private_class_method :read_dword

  139. end

  140. unless $ace_patched
  141.   $ace_patched = true
  142.   raise "应用分辨率补丁失败!" unless AceResolutionMemoryPatch.patch
  143.   #raise RGSSReset.new
  144. end

  145. Graphics.resize_screen(1024, 768)
复制代码

这是修改装备栏的脚本:
  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. #x为数据库角色编号
  10. #y为y号装备槽位置【从0开始】(相对于角色的装备槽)
  11. #z为数据库装备编号
  12. #
  13. #==============================================================================

  14. $imported = {} if $imported.nil?
  15. $imported["YEA-AceEquipEngine"] = true

  16. #==============================================================================
  17. # ▼ Updates
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # 2014.05.01 - Bug Fixed: Refresh Equip Item List when change slot.
  20. # 2012.02.02 - Bug Fixed: Crash when changing classes to different equip slots.
  21. # 2012.01.22 - Bug Fixed: <equip slot> notetags updated to factor in spaces.
  22. # 2012.01.05 - Compatibility Update: Equip Dynamic Stats
  23. # 2011.12.30 - Bug Fixed: Stats didn't update.
  24. # 2011.12.23 - Script efficiency optimized.
  25. # 2011.12.18 - Script efficiency optimized.
  26. # 2011.12.13 - Started Script and Finished.
  27. #
  28. #==============================================================================
  29. # ▼ 介绍
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # 默认的装备系统十分基础,本脚本为装备系统添加诸多功能,如指定角色装备类型(包
  32. # 括角色可以拥有多个相同的装备类型)、设定新的装备类型(这里说的装备类型不同于
  33. # 于数据库中的武器类型、护甲类型,可以说装备类型包括武器、防具、饰品等)。
  34. #
  35. #==============================================================================
  36. # ▼ 安装方式
  37. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  38. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  39. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  40. #
  41. # -----------------------------------------------------------------------------
  42. # 角色备注 - 在数据库-角色中可以使用的备注.
  43. # -----------------------------------------------------------------------------
  44. # <装备槽>
  45. #  内容
  46. #  内容
  47. # </装备槽>
  48. # 设定该角色可装备的装备类型,及装备类型的顺序。将"内容"替换为该角色可用的装备
  49. # 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚,
  50. # 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面
  51. # 有讲。
  52. #
  53. # <初始装备: x>
  54. # <初始装备: x, x>
  55. # 设定该角色的初始装备类型,x为装备类型的id。在数据库中没有新装备槽的初始装备设
  56. # 定时可以使用。
  57. #
  58. # <固定装备: x>
  59. # <固定装备: x, x>
  60. # 固定该角色的x号装备类型。
  61. #
  62. # <禁用装备: x>
  63. # <禁用装备: x, x>
  64. # 禁用该角色的x号装备类型。意思是装备无法放置在该装备槽中。
  65. #
  66. # -----------------------------------------------------------------------------
  67. # 职业备注 - 在数据库-职业中可以使用的备注.
  68. # -----------------------------------------------------------------------------
  69. # <装备槽>
  70. #  内容
  71. #  内容
  72. # </装备槽>
  73. # 设定该职业可装备的装备类型,及装备类型的顺序。将"内容"替换为该职业可用的装备
  74. # 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚,
  75. # 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面
  76. # 有讲
  77. #
  78. # <固定装备: x>
  79. # <固定装备: x, x>
  80. # 固定该职业的x号装备类型。
  81. #
  82. # <禁用装备: x>
  83. # <禁用装备: x, x>
  84. # 禁用该职业的x号装备类型。意思是装备无法放置在该装备槽中。
  85. #
  86. # -----------------------------------------------------------------------------
  87. # 武器备注 - 在数据库-武器中可以使用的备注.
  88. # -----------------------------------------------------------------------------
  89. # <固定装备: x>
  90. # <固定装备: x, x>
  91. # 装备该武器后固定x号装备类型。
  92. #
  93. # <禁用装备: x>
  94. # <禁用装备: x, x>
  95. # 装备该武器后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。
  96. #
  97. # -----------------------------------------------------------------------------
  98. # 护甲备注 - 在数据库-护甲中可以使用的备注.
  99. # -----------------------------------------------------------------------------
  100. # <装备类型: x>
  101. # <装备类型: 文本>
  102. # x替换为装备名称(本脚本下面)或装备类型ID,此备注将该护甲归类/视为x号装备类型
  103. #
  104. # <固定装备: x>
  105. # <固定装备: x, x>
  106. # 装备该护甲后固定x号装备类型。
  107. #
  108. # <禁用装备: x>
  109. # <禁用装备: x, x>
  110. # 装备该护甲后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。
  111. #
  112. # -----------------------------------------------------------------------------
  113. # 状态备注 - 在数据库-状态中可以使用的备注.
  114. # -----------------------------------------------------------------------------
  115. # <固定装备: x>
  116. # <固定装备: x, x>
  117. # 获得该状态后固定x号装备类型。(配合脚本"战斗中更换装备")
  118. #
  119. # <禁用装备: x>
  120. # <禁用装备: x, x>
  121. # 获得该状态后禁用x号装备类型。意思是装备无法放置在该装备槽中。(配合脚本"战斗中
  122. # 更换装备")
  123. #
  124. #==============================================================================
  125. # ▼ 兼容性
  126. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  127. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  128. #
  129. #==============================================================================

  130. module YEA
  131.   module EQUIP
  132.    
  133.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  134.     # - 通用装备设置 -
  135.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  136.     # 调整默认装备设置,你可以添加新的装备类型,建议不要改得太多,以免出现问题。
  137.     # 下面是默认id对应的装备类型
  138.     #
  139.     # ID   装备类型
  140.     # ---  ------------
  141.     #  0   武器
  142.     #  1   盾牌
  143.     #  2   头盔
  144.     #  3   铠甲
  145.     #  4   饰品
  146.     #
  147.     # 无论你怎么修改以下顺序,武器双持的情况都是不变的:第二个装备类型变为武器(0).
  148.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  149.     # 下面这个数组是默认的可用装备槽即其顺序,应用于一切未通过备注自定义装备槽
  150.     # 的角色。
  151.     DEFAULT_BASE_SLOTS = [0,0,0,0,0,1,2,3,4,5,5,5,5,5,6,7]
  152.    
  153.     # 下面这个哈希表用来添加新的装备类型(id为 4+). 你还可以设定其能否被移除,
  154.     # 是否能通过"最强装备"自动选择最强的装备。
  155.     TYPES ={
  156.     # TypeID => ["类型名称", 能否移除?, 能否使用"最强装备"?],
  157.            0 => [   "心灵",       true,     false],
  158.            1 => [   "衣服",       true,     false],
  159.            2 => [   "下装",       true,     false],
  160.            3 => [   "袜子",       true,     false],
  161.            4 => [   "鞋子",       true,     false],
  162.            5 => [   "其它",       true,     false],
  163.     } # 别动这个括号.
  164.    
  165.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  166.     # - 装备指令列表 -
  167.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  168.     # 在这里调整装备指令列表(甚至是移除某些指令)下面是指令的解释:
  169.     #
  170.     # -------------------------------------------------------------------------
  171.     # :指令            解释
  172.     # -------------------------------------------------------------------------
  173.     # :equip           激活装备选择窗口. 默认.
  174.     # :optimize        自动为角色选择最强装备. 默认.
  175.     # :clear           移除角色身上的全部装备. 默认
  176.     #
  177.     # 以上为默认的全部可用指令。
  178.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  179.     # 在数组中放置可用的指令.
  180.     COMMAND_LIST =[
  181.       :equip,
  182. #      :optimize,
  183.       :clear,
  184.     # :custom1,
  185.     # :custom2,
  186.     ] # 不要动这个括号.
  187.    
  188.     #--------------------------------------------------------------------------
  189.     # - 装备自定义指令 -
  190.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  191.     # 对于那些希望通过本脚本来为装备场景添加特殊效果的人,可以使用下面的哈希表
  192.     # 来管理装备场景中的指令。你可以使用开关来禁用/隐藏指令。如果你不想把指令与
  193.     # 开关相关联,把开关设定为0就行。
  194.     #--------------------------------------------------------------------------
  195.     CUSTOM_EQUIP_COMMANDS ={
  196.     # :指令    => [       "文本",     启用开关,   显示开关,       处理方法],
  197.       :custom1 => [ "自定义名称",            0,          0, :command_name1],
  198.       :custom2 => [ "自定义文本",            0,          0, :command_name2],
  199.     } # 不要动这个括号.
  200.    
  201.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  202.     # - 其他窗口设置 -
  203.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  204.     # 调整装备窗口的视觉效果.
  205.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  206.     # 改变右下角能力值数字的字体大小
  207.     STATUS_FONT_SIZE = 20
  208.    
  209.     # 在更换装备指令中,移除装备指令的图标和文本设定
  210.     REMOVE_EQUIP_ICON = 0
  211.     REMOVE_EQUIP_TEXT = "<移除>"
  212.    
  213.     # 装备槽中,无装备的图标和文本.
  214.     NOTHING_ICON = 0
  215.     NOTHING_TEXT = "<空>"
  216.    
  217.   end # EQUIP
  218. end # YEA

  219. #==============================================================================
  220. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  221. # 所以编辑了后果自负。
  222. #==============================================================================

  223. module YEA
  224.   module REGEXP
  225.   module BASEITEM
  226.    
  227.     EQUIP_SLOTS_ON  = /<(?:EQUIP_SLOTS|装备槽)>/i
  228.     EQUIP_SLOTS_OFF = /<\/(?:EQUIP_SLOTS|装备槽)>/i
  229.    
  230.     EQUIP_TYPE_INT = /<(?:EQUIP_TYPE|装备类型):[ ]*(\d+)>/i
  231.     EQUIP_TYPE_STR = /<(?:EQUIP_TYPE|装备类型):[ ]*(.*)>/i
  232.    
  233.     STARTING_GEAR = /<(?:STARTING_GEAR|初始装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  234.    
  235.     FIXED_EQUIP = /<(?:FIXED_EQUIP|固定装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  236.     SEALED_EQUIP = /<(?:SEALED_EQUIP|禁用装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  237.    
  238.   end # BASEITEM
  239.   end # REGEXP
  240. end # YEA

  241. #==============================================================================
  242. # ■ Vocab
  243. #==============================================================================

  244. module Vocab
  245.   
  246.   #--------------------------------------------------------------------------
  247.   # overwrite method: self.etype
  248.   #--------------------------------------------------------------------------
  249.   def self.etype(etype)
  250.     return $data_system.terms.etypes[etype] if [0,1,2,3,4].include?(etype)
  251.     return YEA::EQUIP::TYPES[etype][0] if YEA::EQUIP::TYPES.include?(etype)
  252.     return ""
  253.   end
  254.   
  255. end # Vocab

  256. #==============================================================================
  257. # ■ Icon
  258. #==============================================================================

  259. module Icon
  260.   
  261.   #--------------------------------------------------------------------------
  262.   # self.remove_equip
  263.   #--------------------------------------------------------------------------
  264.   def self.remove_equip; return YEA::EQUIP::REMOVE_EQUIP_ICON; end
  265.   
  266.   #--------------------------------------------------------------------------
  267.   # self.nothing_equip
  268.   #--------------------------------------------------------------------------
  269.   def self.nothing_equip; return YEA::EQUIP::NOTHING_ICON; end
  270.    
  271. end # Icon

  272. #==============================================================================
  273. # ■ Numeric
  274. #==============================================================================

  275. class Numeric
  276.   
  277.   #--------------------------------------------------------------------------
  278.   # new method: group_digits
  279.   #--------------------------------------------------------------------------
  280.   unless $imported["YEA-CoreEngine"]
  281.   def group; return self.to_s; end
  282.   end # $imported["YEA-CoreEngine"]
  283.    
  284. end # Numeric

  285. #==============================================================================
  286. # ■ DataManager
  287. #==============================================================================

  288. module DataManager
  289.   
  290.   #--------------------------------------------------------------------------
  291.   # alias method: load_database
  292.   #--------------------------------------------------------------------------
  293.   class <<self; alias load_database_aee load_database; end
  294.   def self.load_database
  295.     load_database_aee
  296.     load_notetags_aee
  297.   end
  298.   
  299.   #--------------------------------------------------------------------------
  300.   # new method: load_notetags_aee
  301.   #--------------------------------------------------------------------------
  302.   def self.load_notetags_aee
  303.     groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
  304.       $data_states]
  305.     for group in groups
  306.       for obj in group
  307.         next if obj.nil?
  308.         obj.load_notetags_aee
  309.       end
  310.     end
  311.   end
  312.   
  313. end # DataManager

  314. #==============================================================================
  315. # ■ RPG::BaseItem
  316. #==============================================================================

  317. class RPG::BaseItem
  318.   
  319.   #--------------------------------------------------------------------------
  320.   # public instance variables
  321.   #--------------------------------------------------------------------------
  322.   attr_accessor :base_equip_slots
  323.   attr_accessor :fixed_equip_type
  324.   attr_accessor :sealed_equip_type
  325.   attr_accessor :extra_starting_equips
  326.   
  327.   #--------------------------------------------------------------------------
  328.   # common cache: load_notetags_aee
  329.   #--------------------------------------------------------------------------
  330.   def load_notetags_aee
  331.     @base_equip_slots = []
  332.     @equip_slots_on = false
  333.     @fixed_equip_type = []
  334.     @sealed_equip_type = []
  335.     @extra_starting_equips = []
  336.     #---
  337.     self.note.split(/[\r\n]+/).each { |line|
  338.       case line
  339.       #---
  340.       when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_ON
  341.         next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
  342.         @equip_slots_on = true
  343.       when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_OFF
  344.         next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
  345.         @equip_slots_on = false
  346.       #---
  347.       when YEA::REGEXP::BASEITEM::STARTING_GEAR
  348.         next unless self.is_a?(RPG::Actor)
  349.         $1.scan(/\d+/).each { |num|
  350.         @extra_starting_equips.push(num.to_i) if num.to_i > 0 }
  351.       when YEA::REGEXP::BASEITEM::FIXED_EQUIP
  352.         $1.scan(/\d+/).each { |num|
  353.         @fixed_equip_type.push(num.to_i) if num.to_i > 0 }
  354.       when YEA::REGEXP::BASEITEM::SEALED_EQUIP
  355.         $1.scan(/\d+/).each { |num|
  356.         @sealed_equip_type.push(num.to_i) if num.to_i > 0 }
  357.       #---
  358.       when YEA::REGEXP::BASEITEM::EQUIP_TYPE_INT
  359.         next unless self.is_a?(RPG::Armor)
  360.         @etype_id = [1, $1.to_i].max
  361.       when YEA::REGEXP::BASEITEM::EQUIP_TYPE_STR
  362.         next unless self.is_a?(RPG::Armor)
  363.         for key in YEA::EQUIP::TYPES
  364.           id = key[0]
  365.           next if YEA::EQUIP::TYPES[id][0].upcase != $1.to_s.upcase
  366.           @etype_id = [1, id].max
  367.           break
  368.         end
  369.       #---
  370.       else
  371.         if @equip_slots_on
  372.           case line.upcase
  373.           when /装备类型[ ](\d+)/i, /装备类型:[ ](\d+)/i
  374.             id = $1.to_i
  375.             @base_equip_slots.push(id) if [0,1,2,3,4].include?(id)
  376.             @base_equip_slots.push(id) if YEA::EQUIP::TYPES.include?(id)
  377.           when /WEAPON/i
  378.             @base_equip_slots.push(0)
  379.           when /SHIELD/i
  380.             @base_equip_slots.push(1)
  381.           when /HEAD/i
  382.             @base_equip_slots.push(2)
  383.           when /BODY/i, /ARMOR/i, /ARMOUR/i
  384.             @base_equip_slots.push(3)
  385.           when /ETC/i, /OTHER/i, /ACCESSOR/i
  386.             @base_equip_slots.push(4)
  387.           else
  388.             text = line.upcase.delete(" ")
  389.             for key in YEA::EQUIP::TYPES
  390.               id = key[0]
  391.               next if YEA::EQUIP::TYPES[id][0].upcase.delete(" ")!= text
  392.               @base_equip_slots.push(id)
  393.               break
  394.             end
  395.           end
  396.         end
  397.       end
  398.     } # self.note.split
  399.     #---
  400.     return unless self.is_a?(RPG::Class)
  401.     if @base_equip_slots.empty?
  402.       @base_equip_slots = YEA::EQUIP::DEFAULT_BASE_SLOTS.clone
  403.     end
  404.   end
  405.   
  406. end # RPG::BaseItem

  407. #==============================================================================
  408. # ■ Game_Temp
  409. #==============================================================================

  410. class Game_Temp
  411.   
  412.   #--------------------------------------------------------------------------
  413.   # public instance variables
  414.   #--------------------------------------------------------------------------
  415.   attr_accessor :eds_actor
  416.   attr_accessor :scene_equip_index
  417.   attr_accessor :scene_equip_oy
  418.   
  419. end # Game_Temp

  420. #==============================================================================
  421. # ■ Game_BaseItem
  422. #==============================================================================

  423. class Game_BaseItem
  424.   
  425.   #--------------------------------------------------------------------------
  426.   # public instance variables
  427.   #--------------------------------------------------------------------------
  428.   attr_accessor :item_id
  429.   
  430. end # Game_BaseItem

  431. #==============================================================================
  432. # ■ Game_BattlerBase
  433. #==============================================================================

  434. class Game_BattlerBase
  435.   
  436.   #--------------------------------------------------------------------------
  437.   # alias method: equip_type_fixed?
  438.   #--------------------------------------------------------------------------
  439.   alias game_battlerbase_equip_type_fixed_aee equip_type_fixed?
  440.   def equip_type_fixed?(etype_id)
  441.     return true if fixed_etypes.include?(etype_id) if actor?
  442.     return game_battlerbase_equip_type_fixed_aee(etype_id)
  443.   end
  444.   
  445.   #--------------------------------------------------------------------------
  446.   # alias method: equip_type_sealed?
  447.   #--------------------------------------------------------------------------
  448.   alias game_battlerbase_equip_type_sealed_aee equip_type_sealed?
  449.   def equip_type_sealed?(etype_id)
  450.     return true if sealed_etypes.include?(etype_id) if actor?
  451.     return game_battlerbase_equip_type_sealed_aee(etype_id)
  452.   end
  453.   
  454. end # Game_BattlerBase

  455. #==============================================================================
  456. # ■ Game_Actor
  457. #==============================================================================

  458. class Game_Actor < Game_Battler
  459.   
  460.   #--------------------------------------------------------------------------
  461.   # alias method: init_equips
  462.   #--------------------------------------------------------------------------
  463.   alias game_actor_init_equips_aee init_equips
  464.   def init_equips(equips)
  465.     game_actor_init_equips_aee(equips)
  466.     equip_extra_starting_equips
  467.   end
  468.   
  469.   #--------------------------------------------------------------------------
  470.   # new method: equip_extra_starting_equips
  471.   #--------------------------------------------------------------------------
  472.   def equip_extra_starting_equips
  473.     for equip_id in actor.extra_starting_equips
  474.       armour = $data_armors[equip_id]
  475.       next if armour.nil?
  476.       etype_id = armour.etype_id
  477.       next unless equip_slots.include?(etype_id)
  478.       slot_id = empty_slot(etype_id)
  479.       @equips[slot_id].set_equip(etype_id == 0, armour.id)
  480.     end
  481.     refresh
  482.   end
  483.   
  484.   #--------------------------------------------------------------------------
  485.   # overwrite method: equip_slots
  486.   #--------------------------------------------------------------------------
  487.   def equip_slots
  488.     return equip_slots_dual if dual_wield?
  489.     return equip_slots_normal
  490.   end
  491.   
  492.   #--------------------------------------------------------------------------
  493.   # new method: equip_slots_normal
  494.   #--------------------------------------------------------------------------
  495.   def equip_slots_normal
  496.     return self.actor.base_equip_slots if self.actor.base_equip_slots != []
  497.     return self.class.base_equip_slots
  498.   end
  499.   
  500.   #--------------------------------------------------------------------------
  501.   # new method: equip_slots_dual
  502.   #--------------------------------------------------------------------------
  503.   def equip_slots_dual
  504.     array = equip_slots_normal.clone
  505.     array[1] = 0 if array.size >= 2
  506.     return array
  507.   end
  508.   
  509.   #--------------------------------------------------------------------------
  510.   # new method: fixed_etypes
  511.   #--------------------------------------------------------------------------
  512.   def fixed_etypes
  513.     array = []
  514.     array |= self.actor.fixed_equip_type
  515.     array |= self.class.fixed_equip_type
  516.     for equip in equips
  517.       next if equip.nil?
  518.       array |= equip.fixed_equip_type
  519.     end
  520.     for state in states
  521.       next if state.nil?
  522.       array |= state.fixed_equip_type
  523.     end
  524.     return array
  525.   end
  526.   
  527.   #--------------------------------------------------------------------------
  528.   # new method: sealed_etypes
  529.   #--------------------------------------------------------------------------
  530.   def sealed_etypes
  531.     array = []
  532.     array |= self.actor.sealed_equip_type
  533.     array |= self.class.sealed_equip_type
  534.     for equip in equips
  535.       next if equip.nil?
  536.       array |= equip.sealed_equip_type
  537.     end
  538.     for state in states
  539.       next if state.nil?
  540.       array |= state.sealed_equip_type
  541.     end
  542.     return array
  543.   end
  544.   
  545.   #--------------------------------------------------------------------------
  546.   # alias method: change_equip
  547.   #--------------------------------------------------------------------------
  548.   alias game_actor_change_equip_aee change_equip
  549.   def change_equip(slot_id, item)
  550.     if item.nil? && !@optimize_clear
  551.       etype_id = equip_slots[slot_id]
  552.       return unless YEA::EQUIP::TYPES[etype_id][1]
  553.     elsif item.nil? && @optimize_clear
  554.       etype_id = equip_slots[slot_id]
  555.       return unless YEA::EQUIP::TYPES[etype_id][2]
  556.     end
  557.     @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
  558.     game_actor_change_equip_aee(slot_id, item)
  559.   end
  560.   
  561.   #--------------------------------------------------------------------------
  562.   # overwrite method: optimize_equipments
  563.   #--------------------------------------------------------------------------
  564.   def optimize_equipments
  565.     $game_temp.eds_actor = self
  566.     @optimize_clear = true
  567.     clear_equipments
  568.     @optimize_clear = false
  569.     equip_slots.size.times do |i|
  570.       next if !equip_change_ok?(i)
  571.       next unless can_optimize?(i)
  572.       items = $game_party.equip_items.select do |item|
  573.         item.etype_id == equip_slots[i] &&
  574.         equippable?(item) && item.performance >= 0
  575.       end
  576.       change_equip(i, items.max_by {|item| item.performance })
  577.     end
  578.     $game_temp.eds_actor = nil
  579.   end
  580.   
  581.   #--------------------------------------------------------------------------
  582.   # new method: can_optimize?
  583.   #--------------------------------------------------------------------------
  584.   def can_optimize?(slot_id)
  585.     etype_id = equip_slots[slot_id]
  586.     return YEA::EQUIP::TYPES[etype_id][2]
  587.   end
  588.   
  589.   #--------------------------------------------------------------------------
  590.   # alias method: force_change_equip
  591.   #--------------------------------------------------------------------------
  592.   alias game_actor_force_change_equip_aee force_change_equip
  593.   def force_change_equip(slot_id, item)
  594.     @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
  595.     game_actor_force_change_equip_aee(slot_id, item)
  596.   end
  597.   
  598.   #--------------------------------------------------------------------------
  599.   # alias method: weapons
  600.   #--------------------------------------------------------------------------
  601.   alias game_actor_weapons_aee weapons
  602.   def weapons
  603.     anti_crash_equips
  604.     return game_actor_weapons_aee
  605.   end
  606.   
  607.   #--------------------------------------------------------------------------
  608.   # alias method: armors
  609.   #--------------------------------------------------------------------------
  610.   alias game_actor_armors_aee armors
  611.   def armors
  612.     anti_crash_equips
  613.     return game_actor_armors_aee
  614.   end
  615.   
  616.   #--------------------------------------------------------------------------
  617.   # alias method: equips
  618.   #--------------------------------------------------------------------------
  619.   alias game_actor_equips_aee equips
  620.   def equips
  621.     anti_crash_equips
  622.     return game_actor_equips_aee
  623.   end
  624.   
  625.   #--------------------------------------------------------------------------
  626.   # new method: equips
  627.   #--------------------------------------------------------------------------
  628.   def anti_crash_equips
  629.     for i in 0...@equips.size
  630.       next unless @equips[i].nil?
  631.       @equips[i] = Game_BaseItem.new
  632.     end
  633.   end
  634.   
  635. end # Game_Actor

  636. #==============================================================================
  637. # ■ Game_Interpreter
  638. #==============================================================================

  639. class Game_Interpreter
  640.   
  641.   #--------------------------------------------------------------------------
  642.   # overwrite method: change equip
  643.   #--------------------------------------------------------------------------
  644.   def command_319
  645.     actor = $game_actors[@params[0]]
  646.     return if actor.nil?
  647.     if @params[1] == 0 && @params[2] != 0
  648.       item = $data_weapons[@params[2]]
  649.       return unless actor.equip_slots.include?(0)
  650.       slot_id = actor.empty_slot(0)
  651.     elsif @params[2] != 0
  652.       item = $data_armors[@params[2]]
  653.       return unless actor.equip_slots.include?(item.etype_id)
  654.       slot_id = actor.empty_slot(item.etype_id)
  655.     else
  656.       slot_id = @params[1]
  657.     end
  658.     actor.change_equip_by_id(slot_id, @params[2])
  659.   end
  660.   
  661. end # Game_Interpreter

  662. #==============================================================================
  663. # ■ Window_EquipStatus
  664. #==============================================================================

  665. class Window_EquipStatus < Window_Base
  666.   
  667.   #--------------------------------------------------------------------------
  668.   # overwrite method: initialize
  669.   #--------------------------------------------------------------------------
  670.   def initialize(dx, dy)
  671.     super(dx, dy, window_width, Graphics.height - dy)
  672.     @actor = nil
  673.     @temp_actor = nil
  674.     refresh
  675.   end
  676.   
  677.   #--------------------------------------------------------------------------
  678.   # overwrite method: window_width
  679.   #--------------------------------------------------------------------------
  680.   def window_width; return Graphics.width * 2 / 5; end
  681.   
  682.   #--------------------------------------------------------------------------
  683.   # overwrite method: refresh
  684.   #--------------------------------------------------------------------------
  685.   def refresh
  686.     contents.clear
  687.     8.times {|i| draw_item(0, line_height * i, i) }
  688.   end
  689.   
  690.   #--------------------------------------------------------------------------
  691.   # overwrite method: draw_item
  692.   #--------------------------------------------------------------------------
  693.   def draw_item(dx, dy, param_id)
  694.     draw_background_colour(dx, dy)
  695.     draw_param_name(dx + 4, dy, param_id)
  696.     draw_current_param(dx + 4, dy, param_id) if @actor
  697.     drx = (contents.width + 22) / 2
  698.     draw_right_arrow(drx, dy)
  699.     draw_new_param(drx + 22, dy, param_id) if @temp_actor
  700.     reset_font_settings
  701.   end
  702.   
  703.   #--------------------------------------------------------------------------
  704.   # new method: draw_background_colour
  705.   #--------------------------------------------------------------------------
  706.   def draw_background_colour(dx, dy)
  707.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  708.     rect = Rect.new(dx+1, dy+1, contents.width - 2, line_height - 2)
  709.     contents.fill_rect(rect, colour)
  710.   end
  711.   
  712.   #--------------------------------------------------------------------------
  713.   # overwrite method: draw_param_name
  714.   #--------------------------------------------------------------------------
  715.   def draw_param_name(dx, dy, param_id)
  716.     contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
  717.     change_color(system_color)
  718.     draw_text(dx, dy, contents.width, line_height, Vocab::param(param_id))
  719.   end
  720.   
  721.   #--------------------------------------------------------------------------
  722.   # overwrite method: draw_current_param
  723.   #--------------------------------------------------------------------------
  724.   def draw_current_param(dx, dy, param_id)
  725.     change_color(normal_color)
  726.     dw = (contents.width + 22) / 2
  727.     draw_text(0, dy, dw, line_height, @actor.param(param_id).group, 2)
  728.     reset_font_settings
  729.   end
  730.   
  731.   #--------------------------------------------------------------------------
  732.   # overwrite method: draw_new_param
  733.   #--------------------------------------------------------------------------
  734.   def draw_new_param(dx, dy, param_id)
  735.     contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
  736.     new_value = @temp_actor.param(param_id)
  737.     change_color(param_change_color(new_value - @actor.param(param_id)))
  738.     draw_text(0, dy, contents.width-4, line_height, new_value.group, 2)
  739.     reset_font_settings
  740.   end
  741.   
  742. end # Window_EquipStatus

  743. #==============================================================================
  744. # ■ Window_EquipCommand
  745. #==============================================================================

  746. class Window_EquipCommand < Window_HorzCommand
  747.   
  748.   #--------------------------------------------------------------------------
  749.   # overwrite method: make_command_list
  750.   #--------------------------------------------------------------------------
  751.   def make_command_list
  752.     for command in YEA::EQUIP::COMMAND_LIST
  753.       case command
  754.       when :equip
  755.         add_command(Vocab::equip2, :equip)
  756. #      when :optimize
  757. #        add_command(Vocab::optimize, :optimize)
  758.       when :clear
  759.         add_command(Vocab::clear, :clear)
  760.       else
  761.         process_custom_command(command)
  762.       end
  763.     end
  764.   end
  765.   
  766.   #--------------------------------------------------------------------------
  767.   # process_ok
  768.   #--------------------------------------------------------------------------
  769.   def process_ok
  770.     $game_temp.scene_equip_index = index
  771.     $game_temp.scene_equip_oy = self.oy
  772.     super
  773.   end
  774.   
  775.   #--------------------------------------------------------------------------
  776.   # new method: process_custom_command
  777.   #--------------------------------------------------------------------------
  778.   def process_custom_command(command)
  779.     return unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
  780.     show = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][2]
  781.     continue = show <= 0 ? true : $game_switches[show]
  782.     return unless continue
  783.     text = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][0]
  784.     switch = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][1]
  785.     enabled = switch <= 0 ? true : $game_switches[switch]
  786.     add_command(text, command, enabled)
  787.   end
  788.   
  789.   #--------------------------------------------------------------------------
  790.   # overwrite method: window_width
  791.   #--------------------------------------------------------------------------
  792.   def window_width; return 160; end
  793.   
  794.   #--------------------------------------------------------------------------
  795.   # overwrite method: contents_width
  796.   #--------------------------------------------------------------------------
  797.   def contents_width; return width - standard_padding * 2; end
  798.   
  799.   #--------------------------------------------------------------------------
  800.   # overwrite method: contents_height
  801.   #--------------------------------------------------------------------------
  802.   def contents_height
  803.     ch = height - standard_padding * 2
  804.     return [ch - ch % item_height, row_max * item_height].max
  805.   end
  806.   
  807.   #--------------------------------------------------------------------------
  808.   # overwrite method: visible_line_number
  809.   #--------------------------------------------------------------------------
  810.   def visible_line_number; return 4; end
  811.   
  812.   #--------------------------------------------------------------------------
  813.   # overwrite method: col_max
  814.   #--------------------------------------------------------------------------
  815.   def col_max; return 1; end
  816.    
  817.   #--------------------------------------------------------------------------
  818.   # overwrite method: item_rect
  819.   #--------------------------------------------------------------------------
  820.   def item_rect(index)
  821.     rect = Rect.new
  822.     rect.width = item_width
  823.     rect.height = item_height
  824.     rect.x = index % col_max * (item_width + spacing)
  825.     rect.y = index / col_max * item_height
  826.     rect
  827.   end
  828.   
  829.   #--------------------------------------------------------------------------
  830.   # overwrite method: ensure_cursor_visible
  831.   #--------------------------------------------------------------------------
  832.   def ensure_cursor_visible
  833.     self.top_row = row if row < top_row
  834.     self.bottom_row = row if row > bottom_row
  835.   end
  836.    
  837.   #--------------------------------------------------------------------------
  838.   # overwrite method: cursor_down
  839.   #--------------------------------------------------------------------------
  840.   def cursor_down(wrap = false)
  841.     if index < item_max - col_max || (wrap && col_max == 1)
  842.       select((index + col_max) % item_max)
  843.     end
  844.   end
  845.   
  846.   #--------------------------------------------------------------------------
  847.   # overwrite method: cursor_up
  848.   #--------------------------------------------------------------------------
  849.   def cursor_up(wrap = false)
  850.     if index >= col_max || (wrap && col_max == 1)
  851.       select((index - col_max + item_max) % item_max)
  852.     end
  853.   end
  854.   
  855.   #--------------------------------------------------------------------------
  856.   # overwrite method: process_pageup
  857.   #--------------------------------------------------------------------------
  858.   def process_pageup
  859.     Sound.play_cursor
  860.     Input.update
  861.     deactivate
  862.     call_handler(:pageup)
  863.   end
  864.   
  865.   #--------------------------------------------------------------------------
  866.   # overwrite method: process_pagedown
  867.   #--------------------------------------------------------------------------
  868.   def process_pagedown
  869.     Sound.play_cursor
  870.     Input.update
  871.     deactivate
  872.     call_handler(:pagedown)
  873.   end
  874.   
  875. end # Window_EquipCommand

  876. #==============================================================================
  877. # ■ Window_EquipSlot
  878. #==============================================================================

  879. class Window_EquipSlot < Window_Selectable
  880.   
  881.   #--------------------------------------------------------------------------
  882.   # overwrite method: initialize
  883.   #--------------------------------------------------------------------------
  884.   def initialize(dx, dy, dw)
  885.     super(dx, dy, dw, Graphics.height - dy)
  886.     @actor = nil
  887.     refresh
  888.   end
  889.   
  890.   #--------------------------------------------------------------------------
  891.   # overwrite method: window_height
  892.   #--------------------------------------------------------------------------
  893.   def window_height; return self.height; end
  894.   
  895.   #--------------------------------------------------------------------------
  896.   # overwrite method: visible_line_number
  897.   #--------------------------------------------------------------------------
  898.   def visible_line_number; return item_max; end
  899.   
  900.   #--------------------------------------------------------------------------
  901.   # overwrite method: refresh
  902.   #--------------------------------------------------------------------------
  903.   def refresh
  904.     create_contents
  905.     super
  906.   end
  907.   
  908.   #--------------------------------------------------------------------------
  909.   # overwrite method: draw_item
  910.   #--------------------------------------------------------------------------
  911.   def draw_item(index)
  912.     return unless @actor
  913.     rect = item_rect_for_text(index)
  914.     change_color(system_color, enable?(index))
  915.     draw_text(rect.x, rect.y, 92, line_height, slot_name(index))
  916.     item = @actor.equips[index]
  917.     dx = rect.x + 92
  918.     dw = contents.width - dx - 24
  919.     if item.nil?
  920.       draw_nothing_equip(dx, rect.y, false, dw)
  921.     else
  922.       draw_item_name(item, dx, rect.y, enable?(index), dw)
  923.     end
  924.   end
  925.   
  926.   #--------------------------------------------------------------------------
  927.   # new method: draw_nothing_equip
  928.   #--------------------------------------------------------------------------
  929.   def draw_nothing_equip(dx, dy, enabled, dw)
  930.     change_color(normal_color, enabled)
  931.     draw_icon(Icon.nothing_equip, dx, dy, enabled)
  932.     text = YEA::EQUIP::NOTHING_TEXT
  933.     draw_text(dx + 24, dy, dw - 24, line_height, text)
  934.   end
  935.   
  936. end # Window_EquipSlot

  937. #==============================================================================
  938. # ■ Window_EquipItem
  939. #==============================================================================

  940. class Window_EquipItem < Window_ItemList
  941.   
  942.   #--------------------------------------------------------------------------
  943.   # overwrite method: col_max
  944.   #--------------------------------------------------------------------------
  945.   def col_max; return 1; end
  946.   
  947.   #--------------------------------------------------------------------------
  948.   # overwrite method: slot_id=
  949.   #--------------------------------------------------------------------------
  950.   def slot_id=(slot_id)
  951.     return if @slot_id == slot_id
  952.     @slot_id = slot_id
  953.     @last_item = nil
  954.     self.oy = 0
  955.     refresh
  956.   end
  957.   
  958.   #--------------------------------------------------------------------------
  959.   # overwrite method: draw_item
  960.   #--------------------------------------------------------------------------
  961.   def draw_item(index)
  962.     item = @data[index]
  963.     rect = item_rect(index)
  964.     rect.width -= 4
  965.     if item.nil?
  966.       draw_remove_equip(rect)
  967.       return
  968.     end
  969.     dw = contents.width - rect.x - 24
  970.     draw_item_name(item, rect.x, rect.y, enable?(item), dw)
  971.     draw_item_number(rect, item)
  972.   end
  973.   
  974.   #--------------------------------------------------------------------------
  975.   # new method: draw_remove_equip
  976.   #--------------------------------------------------------------------------
  977.   def draw_remove_equip(rect)
  978.     draw_icon(Icon.remove_equip, rect.x, rect.y)
  979.     text = YEA::EQUIP::REMOVE_EQUIP_TEXT
  980.     rect.x += 24
  981.     rect.width -= 24
  982.     draw_text(rect, text)
  983.   end
  984.   
  985.   #--------------------------------------------------------------------------
  986.   # overwrite method: include?
  987.   #--------------------------------------------------------------------------
  988.   def include?(item)
  989.     if item.nil? && !@actor.nil?
  990.       etype_id = @actor.equip_slots[@slot_id]
  991.       return YEA::EQUIP::TYPES[etype_id][1]
  992.     end
  993.     return true if item.nil?
  994.     return false unless item.is_a?(RPG::EquipItem)
  995.     return false if @slot_id < 0
  996.     return false if item.etype_id != @actor.equip_slots[@slot_id]
  997.     return @actor.equippable?(item)
  998.   end
  999.   
  1000.   #--------------------------------------------------------------------------
  1001.   # overwrite method: enable?
  1002.   #--------------------------------------------------------------------------
  1003.   def enable?(item)
  1004.     if item.nil? && !@actor.nil?
  1005.       etype_id = @actor.equip_slots[@slot_id]
  1006.       return YEA::EQUIP::TYPES[etype_id][1]
  1007.     end
  1008.     return @actor.equippable?(item)
  1009.   end
  1010.   
  1011.   #--------------------------------------------------------------------------
  1012.   # new method: show
  1013.   #--------------------------------------------------------------------------
  1014.   def show
  1015.     @last_item = 0
  1016.     update_help
  1017.     super
  1018.   end
  1019.   
  1020.   #--------------------------------------------------------------------------
  1021.   # overwrite method: update_help
  1022.   #--------------------------------------------------------------------------
  1023.   def update_help
  1024.     super
  1025.     return if @actor.nil?
  1026.     return if @status_window.nil?
  1027.     return if @last_item == item
  1028.     @last_item = item
  1029.     temp_actor = Marshal.load(Marshal.dump(@actor))
  1030.     temp_actor.force_change_equip(@slot_id, item)
  1031.     @status_window.set_temp_actor(temp_actor)
  1032.   end
  1033.   
  1034. end # Window_EquipItem

  1035. #==============================================================================
  1036. # ■ Window_EquipActor
  1037. #==============================================================================

  1038. class Window_EquipActor < Window_Base
  1039.   
  1040.   #--------------------------------------------------------------------------
  1041.   # initialize
  1042.   #--------------------------------------------------------------------------
  1043.   def initialize(dx, dy)
  1044.     super(dx, dy, window_width, fitting_height(4))
  1045.     @actor = nil
  1046.   end
  1047.   
  1048.   #--------------------------------------------------------------------------
  1049.   # window_width
  1050.   #--------------------------------------------------------------------------
  1051.   def window_width; return Graphics.width - 160; end
  1052.   
  1053.   #--------------------------------------------------------------------------
  1054.   # actor=
  1055.   #--------------------------------------------------------------------------
  1056.   def actor=(actor)
  1057.     return if @actor == actor
  1058.     @actor = actor
  1059.     refresh
  1060.   end
  1061.   
  1062.   #--------------------------------------------------------------------------
  1063.   # refresh
  1064.   #--------------------------------------------------------------------------
  1065.   def refresh
  1066.     contents.clear
  1067.     return unless @actor
  1068.     draw_actor_face(@actor, 0, 0)
  1069.     draw_actor_simple_status(@actor, 108, line_height / 2)
  1070.   end
  1071.   
  1072. end # Window_EquipActor

  1073. #==============================================================================
  1074. # ■ Scene_Equip
  1075. #==============================================================================

  1076. class Scene_Equip < Scene_MenuBase
  1077.   
  1078.   #--------------------------------------------------------------------------
  1079.   # overwrite method: create_status_window
  1080.   #--------------------------------------------------------------------------
  1081.   def create_status_window
  1082.     wx = Graphics.width - (Graphics.width * 2 / 5)
  1083.     wy = @help_window.height + 120
  1084.     @status_window = Window_EquipStatus.new(wx, wy)
  1085.     @status_window.viewport = @viewport
  1086.     @status_window.actor = @actor
  1087.   end
  1088.   
  1089.   #--------------------------------------------------------------------------
  1090.   # overwrite method: create_command_window
  1091.   #--------------------------------------------------------------------------
  1092.   def create_command_window
  1093.     wx = 0
  1094.     wy = @help_window.height
  1095.     ww = 160
  1096.     @command_window = Window_EquipCommand.new(wx, wy, ww)
  1097.     @command_window.viewport = @viewport
  1098.     @command_window.help_window = @help_window
  1099.     if !$game_temp.scene_equip_index.nil?
  1100.       @command_window.select($game_temp.scene_equip_index)
  1101.       @command_window.oy = $game_temp.scene_equip_oy
  1102.     end
  1103.     $game_temp.scene_equip_index = nil
  1104.     $game_temp.scene_equip_oy = nil
  1105.     @command_window.set_handler(:equip,    method(:command_equip))
  1106. #    @command_window.set_handler(:optimize, method(:command_optimize))
  1107.     @command_window.set_handler(:clear,    method(:command_clear))
  1108.     @command_window.set_handler(:cancel,   method(:return_scene))
  1109.     @command_window.set_handler(:pagedown, method(:next_actor))
  1110.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1111.     process_custom_equip_commands
  1112.     create_actor_window
  1113.   end
  1114.   
  1115.   #--------------------------------------------------------------------------
  1116.   # new method: create_actor_window
  1117.   #--------------------------------------------------------------------------
  1118.   def create_actor_window
  1119.     wy = @help_window.height
  1120.     @actor_window = Window_EquipActor.new(@command_window.width, wy)
  1121.     @actor_window.viewport = @viewport
  1122.     @actor_window.actor = @actor
  1123.   end
  1124.   
  1125.   #--------------------------------------------------------------------------
  1126.   # new method: process_custom_equip_commands
  1127.   #--------------------------------------------------------------------------
  1128.   def process_custom_equip_commands
  1129.     for command in YEA::EQUIP::COMMAND_LIST
  1130.       next unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
  1131.       called_method = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][3]
  1132.       @command_window.set_handler(command, method(called_method))
  1133.     end
  1134.   end
  1135.   
  1136.   #--------------------------------------------------------------------------
  1137.   # overwrite method: create_slot_window
  1138.   #--------------------------------------------------------------------------
  1139.   def create_slot_window
  1140.     wx = 0
  1141.     wy = @command_window.y + @command_window.height
  1142.     ww = Graphics.width - @status_window.width
  1143.     @slot_window = Window_EquipSlot.new(wx, wy, ww)
  1144.     @slot_window.viewport = @viewport
  1145.     @slot_window.help_window = @help_window
  1146.     @slot_window.status_window = @status_window
  1147.     @slot_window.actor = @actor
  1148.     @slot_window.set_handler(:ok,       method(:on_slot_ok))
  1149.     @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  1150.   end
  1151.   
  1152.   #--------------------------------------------------------------------------
  1153.   # overwrite method: create_item_window
  1154.   #--------------------------------------------------------------------------
  1155.   def create_item_window
  1156.     wx = @slot_window.x
  1157.     wy = @slot_window.y
  1158.     ww = @slot_window.width
  1159.     wh = @slot_window.height
  1160.     @item_window = Window_EquipItem.new(wx, wy, ww, wh)
  1161.     @item_window.viewport = @viewport
  1162.     @item_window.help_window = @help_window
  1163.     @item_window.status_window = @status_window
  1164.     @item_window.actor = @actor
  1165.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1166.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1167.     @slot_window.item_window = @item_window
  1168.     @item_window.hide
  1169.   end
  1170.   
  1171.   #--------------------------------------------------------------------------
  1172.   # alias method: command_optimize
  1173.   #--------------------------------------------------------------------------
  1174. #  alias scene_equip_command_optimize_aee command_optimize
  1175. # def command_optimize
  1176. #    scene_equip_command_optimize_aee
  1177. #    @actor_window.refresh
  1178. #  end
  1179.   
  1180.   #--------------------------------------------------------------------------
  1181.   # alias method: command_clear
  1182.   #--------------------------------------------------------------------------
  1183.   alias scene_equip_command_clear_aee command_clear
  1184.   def command_clear
  1185.     scene_equip_command_clear_aee
  1186.     @actor_window.refresh
  1187.   end
  1188.   
  1189.   #--------------------------------------------------------------------------
  1190.   # alias method: on_slot_ok
  1191.   #--------------------------------------------------------------------------
  1192.   alias scene_equip_on_slot_ok_aee on_slot_ok
  1193.   def on_slot_ok
  1194.     scene_equip_on_slot_ok_aee
  1195.     @slot_window.hide
  1196.     @item_window.refresh
  1197.     @item_window.show
  1198.   end
  1199.   
  1200.   #--------------------------------------------------------------------------
  1201.   # alias method: on_item_ok
  1202.   #--------------------------------------------------------------------------
  1203.   alias scene_equip_on_item_ok_aee on_item_ok
  1204.   def on_item_ok
  1205.     scene_equip_on_item_ok_aee
  1206.     @actor_window.refresh
  1207.     @slot_window.show
  1208.     @item_window.hide
  1209.   end
  1210.   
  1211.   #--------------------------------------------------------------------------
  1212.   # alias method: on_item_cancel
  1213.   #--------------------------------------------------------------------------
  1214.   alias scene_equip_on_item_cancel_aee on_item_cancel
  1215.   def on_item_cancel
  1216.     scene_equip_on_item_cancel_aee
  1217.     @slot_window.show
  1218.     @item_window.hide
  1219.   end
  1220.   
  1221.   #--------------------------------------------------------------------------
  1222.   # alias method: on_actor_change
  1223.   #--------------------------------------------------------------------------
  1224.   alias scene_equip_on_actor_change_aee on_actor_change
  1225.   def on_actor_change
  1226.     scene_equip_on_actor_change_aee
  1227.     @actor_window.actor = @actor
  1228.   end
  1229.   
  1230.   #--------------------------------------------------------------------------
  1231.   # new method: command_name1
  1232.   #--------------------------------------------------------------------------
  1233.   def command_name1
  1234.     # Do nothing.
  1235.   end
  1236.   
  1237.   #--------------------------------------------------------------------------
  1238.   # new method: command_name2
  1239.   #--------------------------------------------------------------------------
  1240.   def command_name2
  1241.     # Do nothing.
  1242.   end
  1243.   
  1244. end # Scene_Equip

  1245. #==============================================================================
  1246. #
  1247. # ▼ End of File
  1248. #
  1249. #==============================================================================
复制代码

这是显示伤害的脚本:
  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. # damage_popup(目标ID,数值,"类型")
  29. #
  30. # 目标ID
  31. #      1...999    - 地图上的事件ID
  32. #      0          - 玩家
  33. #      -1...-3    - 队友
  34. #
  35. # 数值
  36. #       显示伤害的数值(可以是负值)或文本.当类型为"States"时为状态的ID,不能为负值
  37. #
  38. # 类型 (可选)
  39. #      "Exp" - 显示EXP.
  40. #      "Gold" - 显示金币.
  41. #      "States" - 显示状态图标.
  42. #
  43. #==============================================================================
  44. #
  45. # damage_popup(1,999)
  46. # damage_popup(4,"存档点.")
  47. # damage_popup(0,"我饿了!!!")     <- 玩家
  48. # damage_popup(-1,"Booo!")        <- 1号队友(离玩家最近的队友,不是ID=1的队友)
  49. # damage_popup(0,2000,"Exp")      <- 显示 2000 Exp
  50. # damage_popup(0,5000,"Gold")     <- 显示 5000 金币
  51. #
  52. #==============================================================================
  53. # 使用以下脚本来在全部队友的头顶显示伤害数字.:
  54. #
  55. # damage_popup_party(目标ID,数值,"类型")
  56. #
  57. #==============================================================================
  58. # 地图上显示/不显示伤害数字.
  59. #==============================================================================
  60. # 使用以下脚本来在地图上显示/不显示伤害数字:
  61. #
  62. # damage_popup_map(true)        -> 或 (false)
  63. #  
  64. #==============================================================================
  65. # ● Histórico (Version History)
  66. #==============================================================================
  67. # v 4.5 - Correção de ativar o dano quando o alvo é morto e o dano é zero.
  68. #==============================================================================

  69. $imported = {} if $imported.nil?
  70. $imported[:mog_damage_popup] = true

  71. module MOG_DAMAGEPOPUP
  72.   #是否允许在地图上显示伤害数字. (默认)
  73.   DAMAGE_POPUP_MAP = false
  74.   #是否在获得物品时显示该物品图标. (仅在地图上).
  75.   ITEM_POPUP_MAP = false
  76.   #是否允许在敌人身上显示EXP和金币.
  77.   EXP_GOLD_POPUP_BATTLE = false
  78.   EXP_GOLD_POPUP_MAP = false
  79.   #是否显示升级
  80.   LEVEL_POPUP_BATTLE = false
  81.   LEVEL_POPUP_MAP = false
  82.   #是否显示状态图标
  83.   STATES_POPUP_BATTLE = true
  84.   STATES_POPUP_MAP = true
  85.   #设定字体 (物品名/状态名/ etc...).
  86.   FONT_SIZE = 28
  87.   FONT_BOLD = true
  88.   FONT_ITALIC = false
  89.   FONT_COLOR = Color.new(255,255,255)
  90.   FONT_COLOR_ITEM = Color.new(255,255,255)
  91.   FONT_COLOR_STATUS_PLUS = Color.new(155,155,255)
  92.   FONT_COLOR_STATUS_MINUS = Color.new(255,150,150)
  93.   #每条伤害间的距离(竖直距离).
  94.   Y_SPACE = 28
  95.   #伤害数字的Z坐标
  96.   DAMAGE_Z = 151
  97. end

  98. #==============================================================================
  99. # ■ Game_System
  100. #==============================================================================
  101. class Game_System
  102.   attr_accessor :damage_popup_map
  103.   
  104.   #--------------------------------------------------------------------------
  105.   # ● Initialize
  106.   #--------------------------------------------------------------------------         
  107.   alias mog_damage_popup_initialize initialize
  108.   def initialize
  109.       @damage_popup_map = MOG_DAMAGEPOPUP::DAMAGE_POPUP_MAP
  110.       mog_damage_popup_initialize
  111.   end
  112.   
  113.   #--------------------------------------------------------------------------
  114.   # ● Damage Popup Clear
  115.   #--------------------------------------------------------------------------         
  116.   def damage_popup_clear
  117.       $game_party.character_members.each {|t|
  118.       t.actor.damage.clear; t.actor.skip_dmg_popup = false ;
  119.       t.damage.clear; t.skip_dmg_popup = false} rescue nil
  120.       $game_map.events.values.each {|t| t.damage.clear ;
  121.       t.skip_dmg_popup = false} rescue nil
  122.   end
  123.   
  124. end  

  125. #==============================================================================
  126. # ■ Game Temp
  127. #==============================================================================
  128. class Game_Temp
  129.   
  130.   attr_accessor :battle_end

  131.   #--------------------------------------------------------------------------
  132.   # ● Initialize
  133.   #--------------------------------------------------------------------------   
  134.   alias mog_damage_temp_opup_initialize initialize
  135.   def initialize
  136.       @battle_end = false
  137.       mog_damage_temp_opup_initialize
  138.   end
  139.   
  140.   #--------------------------------------------------------------------------
  141.   # ● Sprite Visible
  142.   #--------------------------------------------------------------------------   
  143.   def sprite_visible
  144.       return false if $game_message.visible
  145.       return false if $game_temp.battle_end
  146.       return true
  147.   end
  148.    
  149. end
  150. #==============================================================================
  151. # ■ Game CharacterBase
  152. #==============================================================================
  153. class Game_CharacterBase
  154.   
  155.   attr_accessor :damage ,:battler ,:skip_dmg_popup
  156.   
  157.   #--------------------------------------------------------------------------
  158.   # ● Ini Public Members
  159.   #--------------------------------------------------------------------------         
  160.   alias mog_damage_popup_init_public_members init_public_members
  161.   def init_public_members
  162.       @damage = [] ; @skip_dmg_popup = false
  163.       mog_damage_popup_init_public_members
  164.   end
  165.   
  166.   #--------------------------------------------------------------------------
  167.   # ● Damage Popup
  168.   #--------------------------------------------------------------------------         
  169.   def damage_popup(value,type = "String")      
  170.       @damage.push([value,type])
  171.   end  
  172.   
  173. end

  174. #==============================================================================
  175. # ■ Scene Map
  176. #==============================================================================
  177. class Scene_Map < Scene_Base  
  178.   #--------------------------------------------------------------------------
  179.   # ● Start
  180.   #--------------------------------------------------------------------------
  181.   alias mog_damage_popup_start start
  182.   def start
  183.       $game_system.damage_popup_clear ; $game_temp.battle_end = false
  184.       mog_damage_popup_start
  185.   end  
  186. end

  187. #==============================================================================
  188. # ■ Game Player
  189. #==============================================================================
  190. class Game_Player < Game_Character   
  191.   #--------------------------------------------------------------------------
  192.   # ● Battler
  193.   #--------------------------------------------------------------------------
  194.   def battler
  195.       actor
  196.   end   
  197. end

  198. #==============================================================================
  199. # ■ Game Follower
  200. #==============================================================================
  201. class Game_Follower < Game_Character  
  202.   #--------------------------------------------------------------------------
  203.   # ● Battler
  204.   #--------------------------------------------------------------------------
  205.   def battler
  206.       actor
  207.   end   
  208. end

  209. #==============================================================================
  210. # ■ Game_BattlerBase
  211. #==============================================================================
  212. class Game_BattlerBase  
  213.   #--------------------------------------------------------------------------
  214.   # ● Change HP
  215.   #--------------------------------------------------------------------------         
  216.   alias mog_damage_popup_change_hp change_hp
  217.   def change_hp(value, enable_death)
  218.       mog_damage_popup_change_hp(value, enable_death)
  219.       self.damage.push([-value,"Hp"])
  220.   end   
  221. end

  222. #==============================================================================
  223. # ■ Game_Battler
  224. #==============================================================================
  225. class Game_Battler < Game_BattlerBase  
  226.   include MOG_DAMAGEPOPUP
  227.   attr_accessor :damage , :skip_dmg_popup
  228.   
  229.   #--------------------------------------------------------------------------
  230.   # ● Initialize
  231.   #--------------------------------------------------------------------------         
  232.   alias mog_damage_sprite_initialize initialize
  233.   def initialize      
  234.       @damage = [] ; @skip_dmg_popup = false
  235.       mog_damage_sprite_initialize
  236.   end  
  237.    
  238.   #--------------------------------------------------------------------------
  239.   # ● Item Apply
  240.   #--------------------------------------------------------------------------  
  241.    alias mog_damage_pop_item_apply item_apply
  242.    def item_apply(user, item)
  243.        mog_damage_pop_item_apply(user, item)
  244.        execute_damage_popup(user,item)
  245.   end
  246.   
  247.   #--------------------------------------------------------------------------
  248.   # ● Execute Damage Popup
  249.   #--------------------------------------------------------------------------
  250.   def execute_damage_popup(user,item)
  251.       if !@result.missed and !@result.evaded and @result.hit?
  252.         self.damage.push([@result.hp_damage,"HP",@result.critical]) if item.damage.to_hp? or @result.hp_damage != 0
  253.         user.damage.push([-@result.hp_drain,"HP",@result.critical]) if item.damage.type == 5
  254.         self.damage.push([@result.mp_damage,"MP",@result.critical]) if item.damage.to_mp? or @result.mp_damage != 0
  255.         user.damage.push([-@result.mp_drain,"MP",@result.critical]) if item.damage.type == 6
  256.         self.damage.push([@result.tp_damage,"TP",@result.critical]) if @result.tp_damage != 0
  257.      elsif !self.dead?
  258.         if @result.missed ; self.damage.push(["Missed","Missed"])
  259.         elsif @result.evaded ; self.damage.push(["Evaded","Evaded"])
  260.         end        
  261.       end
  262.   end
  263.      
  264.   #--------------------------------------------------------------------------
  265.   # ● Regenerate HP
  266.   #--------------------------------------------------------------------------
  267.   alias mog_damage_pop_regenerate_hp regenerate_hp
  268.   def regenerate_hp
  269.       mog_damage_pop_regenerate_hp
  270.       self.damage.push(["Regenerate",""]) if @result.hp_damage < 0  
  271.       self.damage.push([@result.hp_damage,"HP"]) if @result.hp_damage != 0
  272.   end

  273.   #--------------------------------------------------------------------------
  274.   # ● Regenerate MP
  275.   #--------------------------------------------------------------------------
  276.   alias mog_damage_pop_regenerate_mp regenerate_mp
  277.   def regenerate_mp
  278.       mog_damage_pop_regenerate_mp
  279.       self.damage.push([@result.mp_damage,"MP"]) if @result.mp_damage != 0
  280.   end
  281.   
  282.   #--------------------------------------------------------------------------
  283.   # ● Regenerate TP
  284.   #--------------------------------------------------------------------------
  285.   alias mog_damage_pop_regenerate_tp regenerate_tp
  286.   def regenerate_tp
  287.       mog_damage_pop_regenerate_tp
  288.       tp_damage = 100 * trg
  289.       self.damage.push([tp_damage,"TP"]) if tp_damage != 0
  290.   end

  291.   #--------------------------------------------------------------------------
  292.   # ● Added New State
  293.   #--------------------------------------------------------------------------  
  294.   alias mog_damage_pop_add_new_state add_new_state
  295.   def add_new_state(state_id)
  296.       mog_damage_pop_add_new_state(state_id)
  297.       execute_popup_add_new_state(state_id)
  298.   end
  299.    
  300.   #--------------------------------------------------------------------------
  301.   # ● Execute Popup Add New State
  302.   #--------------------------------------------------------------------------  
  303. def execute_popup_add_new_state(state_id)
  304.       st = $data_states[state_id]
  305.       if self.hp > 0
  306.          unless (SceneManager.scene_is?(Scene_Battle) and !STATES_POPUP_BATTLE) or
  307.                 (SceneManager.scene_is?(Scene_Map) and !STATES_POPUP_MAP)
  308.                 self.damage.push([st.name.to_s,"States Plus",false,st.icon_index])
  309.          end
  310.       end
  311.   end
  312.   
  313.   #--------------------------------------------------------------------------
  314.   # ● Remove State
  315.   #--------------------------------------------------------------------------  
  316.   alias mog_damage_pop_remove_state remove_state
  317.   def remove_state(state_id)
  318.       execute_popup_remove_state(state_id)  
  319.       mog_damage_pop_remove_state(state_id)
  320.   end      
  321.   
  322.   #--------------------------------------------------------------------------
  323.   # ● Execute Popup Remove State
  324.   #--------------------------------------------------------------------------  
  325.   def execute_popup_remove_state(state_id)  
  326.       if state?(state_id) and self.hp > 0
  327.          st = $data_states[state_id]
  328.          unless (SceneManager.scene_is?(Scene_Battle) and !STATES_POPUP_BATTLE) or
  329.                 (SceneManager.scene_is?(Scene_Map) and !STATES_POPUP_MAP)
  330.                 self.damage.push([st.name.to_s,"States Minus",false,st.icon_index]) unless BattleManager.escape?
  331.          end
  332.       end
  333.   end     

  334. end

  335. #==============================================================================
  336. # ■ BattleManager
  337. #==============================================================================
  338. module BattleManager
  339.   #--------------------------------------------------------------------------
  340.   # ● Escape?
  341.   #--------------------------------------------------------------------------
  342.   def self.escape?
  343.       @phase == nil
  344.   end  
  345. end

  346. #==============================================================================
  347. # ■ Game_Temp
  348. #==============================================================================
  349. class Game_Temp
  350.   attr_accessor :dmg_battle_mode
  351.   
  352.   #--------------------------------------------------------------------------
  353.   # ● Initialize
  354.   #--------------------------------------------------------------------------         
  355.   alias mog_damage_popup_initialize initialize
  356.   def initialize
  357.       @dmg_battle_mode = false
  358.       mog_damage_popup_initialize
  359.   end
  360.   
  361. end

  362. #==============================================================================
  363. # ■ Scene Battle
  364. #==============================================================================
  365. class Scene_Battle < Scene_Base

  366.   #--------------------------------------------------------------------------
  367.   # ● Start
  368.   #--------------------------------------------------------------------------         
  369.   alias mog_damage_popup_start start
  370.   def start
  371.       $game_temp.dmg_battle_mode = true
  372.       mog_damage_popup_start
  373.   end
  374.    
  375.   #--------------------------------------------------------------------------
  376.   # ● Terminate
  377.   #--------------------------------------------------------------------------         
  378.   alias mog_damage_popup_terminate terminate
  379.   def terminate
  380.       mog_damage_popup_terminate
  381.       $game_temp.dmg_battle_mode = false
  382.   end
  383.   
  384. end

  385. #==============================================================================
  386. # ■ Game Party
  387. #==============================================================================
  388. class Game_Party < Game_Unit

  389.   #--------------------------------------------------------------------------
  390.   # ● Character Members
  391.   #--------------------------------------------------------------------------         
  392.   def character_members
  393.       char_m = [] ; char_m.push($game_player)
  394.       $game_player.followers.each do |f| char_m.push(f) end
  395.       return char_m
  396.   end
  397.   
  398.   #--------------------------------------------------------------------------
  399.   # ● Gain Gold
  400.   #--------------------------------------------------------------------------         
  401.   alias mog_damage_popup_gain_gold gain_gold
  402.   def gain_gold(amount)
  403.       mog_damage_popup_gain_gold(amount)
  404.       $game_party.members[0].damage.push([amount,"Gold"]) if can_damage_popup_gold?
  405.   end  
  406.   
  407.   #--------------------------------------------------------------------------
  408.   # ● Can Damage Popup Gold
  409.   #--------------------------------------------------------------------------         
  410.   def can_damage_popup_gold?
  411.       return false if !SceneManager.scene_is?(Scene_Map)
  412.       return false if $game_temp.dmg_battle_mode
  413.       return false if !MOG_DAMAGEPOPUP::EXP_GOLD_POPUP_MAP
  414.       return false if !$game_system.damage_popup_map
  415.       return false if !$game_party.members[0]
  416.       return true
  417.   end
  418.   
  419. #--------------------------------------------------------------------------
  420. # ● Gain Item
  421. #--------------------------------------------------------------------------
  422. alias mog_damage_popup_gain_item gain_item
  423. def gain_item(item, amount, include_equip = false)
  424.      mog_damage_popup_gain_item(item, amount, include_equip)
  425.      execute_item_popup(item) if can_damage_popup_item?(item)
  426. end
  427.   
  428. #--------------------------------------------------------------------------
  429. # ● Can Damage Poupup Item
  430. #--------------------------------------------------------------------------
  431. def can_damage_popup_item?(item)
  432.      return false if item == nil
  433.      return false if !MOG_DAMAGEPOPUP::ITEM_POPUP_MAP
  434.      return false if !$game_system.damage_popup_map
  435.      return false if SceneManager.scene_is?(Scene_Battle)
  436.      return false if !$game_party.members[0]
  437.      return false if $game_temp.dmg_battle_mode
  438.      return true     
  439. end

  440. #--------------------------------------------------------------------------
  441. # ● Execute Item Popup
  442. #--------------------------------------------------------------------------
  443. def execute_item_popup(item)
  444.      it = $data_items[item.id] if item.is_a?(RPG::Item)
  445.      it = $data_weapons[item.id] if item.is_a?(RPG::Weapon)
  446.      it = $data_armors[item.id] if item.is_a?(RPG::Armor)   
  447.      $game_party.members[0].damage.push([it.name.to_s,"Item",false,it.icon_index])
  448. end

  449. end

  450. #==============================================================================
  451. # ■ Game Interpreter
  452. #==============================================================================
  453. class Game_Interpreter

  454. #--------------------------------------------------------------------------
  455. # ● Damage Popup Map
  456. #--------------------------------------------------------------------------
  457.   def damage_popup_map(value)
  458.       $game_system.damage_popup_map = value
  459.   end   
  460.   
  461.   #--------------------------------------------------------------------------
  462.   # ● Damage Popup
  463.   #--------------------------------------------------------------------------
  464.   def damage_popup(target_id, value,type = "")
  465.       return if !$game_system.damage_popup_map
  466.       target = set_target_dmg(target_id) rescue nil
  467.       target.damage.push([value,type]) if target
  468.   end
  469.   
  470.   #--------------------------------------------------------------------------
  471.   # ● Set Target Dmg
  472.   #--------------------------------------------------------------------------
  473.   def set_target_dmg(target)
  474.       return $game_player.battler if target == 0
  475.       return $game_player.followers.battler[(target_id + 1).abs] if target < 0
  476.       $game_map.events.values.each do |event|
  477.       return event.battler if event.id == target_id and event.battler
  478.       return event if event.id == target_id
  479.       end
  480.   end
  481.   
  482.   #--------------------------------------------------------------------------
  483.   # * Change MP
  484.   #--------------------------------------------------------------------------
  485.   alias mog_damage_popup_command_312 command_312
  486.   def command_312
  487.       value = operate_value(@params[2], @params[3], @params[4])
  488.       iterate_actor_var(@params[0], @params[1]) do |actor|
  489.       actor.damage.push([-value,"MP"])
  490.       end   
  491.       mog_damage_popup_command_312
  492.   end  
  493.   
  494. end

  495. #==============================================================================
  496. # ■ Game Actor
  497. #==============================================================================
  498. class Game_Actor < Game_Battler
  499.   include MOG_DAMAGEPOPUP
  500.   #--------------------------------------------------------------------------
  501.   # ● Level UP
  502.   #--------------------------------------------------------------------------         
  503.    alias mog_damage_pop_level_up level_up
  504.    def level_up
  505.        mog_damage_pop_level_up      
  506.        execute_level_popup
  507.    end

  508.   #--------------------------------------------------------------------------
  509.   # ● Execute Level Popup
  510.   #--------------------------------------------------------------------------         
  511.    def execute_level_popup
  512.        if (SceneManager.scene_is?(Scene_Battle) and LEVEL_POPUP_BATTLE) or
  513.           (SceneManager.scene_is?(Scene_Map) and LEVEL_POPUP_MAP)
  514.           @damage.push(["Level UP","Level_UP"]) unless @skip_dmg_popup
  515.           @skip_dmg_popup = true
  516.        end     
  517.    end
  518.      
  519.   #--------------------------------------------------------------------------
  520.   # ● Change Exp
  521.   #--------------------------------------------------------------------------         
  522.   alias mog_damage_popup_change_exp change_exp
  523.   def change_exp(exp, show)
  524.       n_exp = self.exp
  525.       mog_damage_popup_change_exp(exp, show)
  526.       c_exp = n_exp - self.exp
  527.       @damage.push([c_exp.abs,"Exp"]) if can_popup_exp?(exp)
  528.   end   
  529.    
  530.   #--------------------------------------------------------------------------
  531.   # ● Can Popup EXP
  532.   #--------------------------------------------------------------------------         
  533.   def can_popup_exp?(exp)
  534.       return false if !EXP_GOLD_POPUP_MAP
  535.       return false if exp <= 0
  536.       return false if self.skip_dmg_popup
  537.       return false if self.max_level?
  538.       return true
  539.   end
  540.   
  541. end

  542. #==============================================================================
  543. # ■ Scene_Battle
  544. #==============================================================================
  545. class Scene_Battle < Scene_Base
  546.   
  547.   #--------------------------------------------------------------------------
  548.   # ● Invoke Counter Attack
  549.   #--------------------------------------------------------------------------        
  550.   alias mog_damage_popup_invoke_counter_attack invoke_counter_attack
  551.   def invoke_counter_attack(target, item)
  552.       mog_damage_popup_invoke_counter_attack(target, item)
  553.       target.damage.push(["Counter","Counter"])
  554.   end  
  555.   
  556.   #--------------------------------------------------------------------------
  557.   # ● Invoke Counter Attack
  558.   #--------------------------------------------------------------------------        
  559.   alias mog_damage_popup_invoke_magic_reflection invoke_magic_reflection
  560.   def invoke_magic_reflection(target, item)
  561.       mog_damage_popup_invoke_magic_reflection(target, item)
  562.       target.damage.push(["Reflection","Reflection"])
  563.   end  
  564.   
  565. end

  566. #==============================================================================
  567. # ■ Cache
  568. #==============================================================================
  569. module Cache

  570.   #--------------------------------------------------------------------------
  571.   # * Damage
  572.   #--------------------------------------------------------------------------
  573.   def self.damage(filename)
  574.       load_bitmap("Graphics/Damage/", filename)
  575.   end

  576. end

  577. #==============================================================================
  578. # ■ Game Temp
  579. #==============================================================================
  580. class Game_Temp
  581.   
  582.   attr_accessor :pre_cache_damage
  583.   
  584.   #--------------------------------------------------------------------------
  585.   # ● Initialize
  586.   #--------------------------------------------------------------------------  
  587.   alias mog_damage_pop_initialize initialize
  588.   def initialize
  589.       mog_damage_pop_initialize
  590.       pre_cache_damage_temp
  591.   end
  592.   
  593.   #--------------------------------------------------------------------------
  594.   # ● Pre Cache Damage Temp
  595.   #--------------------------------------------------------------------------   
  596.   def pre_cache_damage_temp
  597.       return if @pre_cache_damage != nil
  598.       @pre_cache_damage = []
  599.       @pre_cache_damage.push(Cache.damage("HP_Number"))
  600.       @pre_cache_damage.push(Cache.damage("MP"))
  601.       @pre_cache_damage.push(Cache.damage("TP"))
  602.       @pre_cache_damage.push(Cache.damage("Missed"))
  603.       @pre_cache_damage.push(Cache.damage("Evaded"))
  604.       @pre_cache_damage.push(Cache.damage("Critical"))
  605.       @pre_cache_damage.push(Cache.damage("Exp"))
  606.       @pre_cache_damage.push(Cache.damage("Gold"))
  607.       @pre_cache_damage.push(Cache.damage("Level UP"))
  608.       @pre_cache_damage.push(Cache.damage("Counter"))
  609.       @pre_cache_damage.push(Cache.damage("Reflection"))
  610.       @pre_cache_damage.push(Cache.damage("MP_Number"))
  611.       @pre_cache_damage.push(Cache.damage("TP_Number"))
  612.       @pre_cache_damage.push(Cache.damage("EG_Number"))
  613.       @pre_cache_damage.push(Cache.system("Iconset"))
  614.   end
  615.   
  616. end

  617. #==============================================================================
  618. # ■ Sprite Base
  619. #==============================================================================
  620. class Sprite_Base < Sprite

  621.   #--------------------------------------------------------------------------
  622.   # ● Initialize
  623.   #--------------------------------------------------------------------------  
  624.   alias mog_damage_popup_sprite_initialize initialize
  625.   def initialize(viewport = nil)
  626.       mog_damage_popup_sprite_initialize(viewport)
  627.       damage_popup_setup
  628.   end

  629.   #--------------------------------------------------------------------------
  630.   # ● Damage Popup Setup
  631.   #--------------------------------------------------------------------------  
  632.   def damage_popup_setup      
  633.       $game_temp.pre_cache_damage_temp ; @damage_sprites = []
  634.       $game_system.damage_popup_clear
  635.   end

  636.   #--------------------------------------------------------------------------
  637.   # ● Dispose
  638.   #--------------------------------------------------------------------------  
  639.   alias mog_damage_popup_sprite_dispose dispose
  640.   def dispose      
  641.       mog_damage_popup_sprite_dispose
  642.       dispose_damage_sprites
  643.   end
  644.   
  645.   #--------------------------------------------------------------------------
  646.   # ● Dispose Damage Sprites
  647.   #--------------------------------------------------------------------------   
  648.   def dispose_damage_sprites
  649.       return if @damage_sprites == nil
  650.       @damage_sprites.each {|sprite| sprite.dispose_damage }
  651.   end  
  652.   
  653.   #--------------------------------------------------------------------------
  654.   # ● Update
  655.   #--------------------------------------------------------------------------  
  656.   alias mog_damage_popup_sprite_update update
  657.   def update
  658.       mog_damage_popup_sprite_update
  659.       update_damage_popup
  660.   end  
  661.   
  662.   #--------------------------------------------------------------------------
  663.   # ● Update Damage Popup
  664.   #--------------------------------------------------------------------------   
  665.   def update_damage_popup
  666.       return if @damage_sprites == nil
  667.       create_damage_sprite if can_create_damage?
  668.       update_damage_sprite if !@damage_sprites.empty?
  669.   end  
  670.   
  671.   #--------------------------------------------------------------------------
  672.   # ● Can Create Damage?
  673.   #--------------------------------------------------------------------------     
  674.   def can_create_damage?      
  675.       return false if $game_message.visible
  676.       if @battler
  677.          return false if @battler.damage == nil
  678.          return false if @battler.damage.empty?
  679.          if $game_temp.battle_end and @battler.is_a?(Game_Actor)
  680.             return false if $game_message.visible
  681.             return false if $imported[:mog_battler_result] and $game_temp.result
  682.          end
  683.       elsif @character
  684.          return false if !$game_system.damage_popup_map
  685.          if @character.battler
  686.             return false if @character.battler.damage == nil
  687.             return false if @character.battler.damage.empty?
  688.          else
  689.             return false if @character.damage == nil
  690.             return false if @character.damage.empty?            
  691.          end  
  692.       end
  693.       return false if @battler == nil and @character == nil      
  694.       return true
  695.   end
  696.   
  697.   #--------------------------------------------------------------------------
  698.   # ● Create Damage Sprite
  699.   #--------------------------------------------------------------------------     
  700.   def create_damage_sprite
  701.       target = @battler ? @battler : @character
  702.       screen_x_available = target.screen_x rescue nil
  703.       return if screen_x_available == nil
  704.       sx = target.screen_x != nil ? target.screen_x : self.x
  705.       sy = target.screen_y != nil ? target.screen_y : self.y
  706.       @damage_sprites = [] if @damage_sprites == nil  
  707.       target = @character.battler if @character and @character.battler
  708.       target.damage.each_with_index do |i, index|
  709.       @damage_sprites.push(Damage_Sprite.new(nil,sx,sy,i,index,@damage_sprites.size,self)) end
  710.       if SceneManager.scene_is?(Scene_Battle)
  711.       @damage_sprites.each_with_index do |i, index| i.set_duration(index) end
  712.       end
  713.       target.damage.clear ; target.skip_dmg_popup = false
  714.   end  
  715.   
  716.   #--------------------------------------------------------------------------
  717.   # ● Update Damage Sprite
  718.   #--------------------------------------------------------------------------     
  719.   def update_damage_sprite
  720.       clear = true
  721.       @damage_sprites.each_with_index do |sprite, i|
  722.           sprite.update_damage(@damage_sprites.size,i,@battler)
  723.           sprite.dispose_damage if sprite.duration <= 0
  724.           clear = false if sprite.duration > 0
  725.       end   
  726.       @damage_sprites.clear if clear
  727.   end  
  728.   
  729. end

  730. #==============================================================================
  731. # ■ Damage Sprite
  732. #==============================================================================
  733. class Damage_Sprite < Sprite
  734.    include MOG_DAMAGEPOPUP
  735.    attr_accessor :duration
  736.   
  737.   #--------------------------------------------------------------------------
  738.   # ● Initialize
  739.   #--------------------------------------------------------------------------      
  740.   def initialize(viewport = nil , x,y, value ,index,index_max,target)
  741.       super(viewport)
  742.       dispose_damage ; setup_base(value,x,y,index,index_max,target) ; create_sprites
  743.   end   
  744.      
  745.   #--------------------------------------------------------------------------
  746.   # ● Setup Base
  747.   #--------------------------------------------------------------------------      
  748.   def setup_base(value,x,y,index,index_max,target)
  749.       @target = target ; y2 = 0
  750.       if @target.bitmap != nil ; y2 = SceneManager.scene_is?(Scene_Battle) ? @target.bitmap.height / 2 : 0 ; end
  751.       @animation_type = 0 ; @index = index ; @index_max = index_max + 1
  752.       @image = $game_temp.pre_cache_damage ; self.z = index + DAMAGE_Z
  753.       @cw = @image[0].width / 10 ; @ch = @image[0].height / 2 ; @cw2 = 0
  754.       @x = x ; @y = y - y2 ; @value = value[0] ; @type = value[1] ; @ch2 = 0
  755.       @critical = (value[2] and @value.to_i >= 0) ? true : false; self.opacity = 0
  756.       @state_index = value[3] ; @oxy = [0,0,0,0] ; @org_xy = [0,0] ; @spxy = [0,0]
  757.       @duration = 92 ; @org_oxy = [0,0,0,0]
  758.       self.visible = false ;set_initial_position(index,nil)
  759.   end
  760.   
  761.   #--------------------------------------------------------------------------
  762.   # ● Set Duration
  763.   #--------------------------------------------------------------------------      
  764.   def set_duration(index,pre_index = nil)
  765.       return if @duration != 0
  766.       @duration = 82 + (2 * index) if @animation_type == 0
  767.   end
  768.   
  769.   #--------------------------------------------------------------------------
  770.   # ● Set Initial Position
  771.   #--------------------------------------------------------------------------      
  772.   def set_initial_position(index,old_duration)
  773.       @org_xy = [@x,@y]
  774.       self.zoom_y = self.zoom_x
  775.   end
  776.   
  777.   #--------------------------------------------------------------------------
  778.   # ● Dispose Damage
  779.   #--------------------------------------------------------------------------      
  780.   def dispose_damage
  781.       (self.bitmap.dispose ; self.bitmap = nil) if self.bitmap
  782.       (@sup_sprite.bitmap.dispose ; @sup_sprite.dispose) if @sup_sprite  
  783.       @duration = -1
  784.   end
  785.   
  786.   #--------------------------------------------------------------------------
  787.   # ● Create Sprites
  788.   #--------------------------------------------------------------------------      
  789.   def create_sprites
  790.       if @value.is_a?(Numeric)
  791.          create_number         
  792.       elsif ["Missed","Evaded","Level UP","Counter","Reflection"].include?(@value.to_s)
  793.          create_miss
  794.       else
  795.          create_string
  796.       end      
  797.       set_damage_position
  798.   end
  799.   
  800.   #--------------------------------------------------------------------------
  801.   # ● Set Damage Position
  802.   #--------------------------------------------------------------------------      
  803.   def set_damage_position
  804.       return if self.bitmap == nil
  805.       self.ox = (self.bitmap.width - @cw2) / 2
  806.       self.oy = self.bitmap.height / 2 ; self.x = @x ; self.y = @y
  807.       @org_oxy[0] = self.ox
  808.       @org_oxy[1] = self.oy
  809.       set_animation_type
  810.       if @sup_sprite
  811.          @sup_sprite.ox = self.bitmap.width / 2 ;
  812.          @sup_sprite.oy = self.bitmap.height / 2
  813.          @org_oxy[2] = @sup_sprite.ox
  814.          @org_oxy[3] = @sup_sprite.oy
  815.          if @critical
  816.             @sup_sprite.x = @x - (@sup_sprite.bitmap.width / 2) + ((@cw / 2) * @number_value.size)
  817.             @sup_sprite.y = self.y
  818.          end   
  819.          update_sup_position(@index_max - @index)
  820.       end
  821.   end   
  822.   
  823.   #--------------------------------------------------------------------------
  824.   # ● Set Damage Position
  825.   #--------------------------------------------------------------------------      
  826.   def set_animation_type
  827.       s = rand(2) ; s2 = (rand(10) * 0.1).round(2)
  828.       @oxy[2] = s == 1 ? s2 : -s2
  829.   end
  830.   
  831.   #--------------------------------------------------------------------------
  832.   # ● Create Number
  833.   #--------------------------------------------------------------------------      
  834.   def create_number
  835.       case @type
  836.       when "MP"
  837.       number_image = @image[11] ;h = @value >= 0 ? 0 : @ch ; create_sup_sprite
  838.       when "TP"
  839.       number_image = @image[12] ;h = @value >= 0 ? 0 : @ch ; create_sup_sprite
  840.       when "Exp"
  841.       number_image = @image[13] ;h = 0 ; create_sup_sprite
  842.       when "Gold"
  843.       number_image = @image[13] ;h = @ch ; create_sup_sprite            
  844.       else
  845.       number_image = @image[0] ; h = @value >= 0 ? 0 : @ch
  846.       end
  847.       @number_value = @value.abs.truncate.to_s.split(//)
  848.       self.bitmap = Bitmap.new(@cw * @number_value.size, @ch)
  849.       for r in 0...@number_value.size        
  850.           number_value_abs = @number_value[r].to_i
  851.           src_rect = Rect.new(@cw * number_value_abs, h, @cw, @ch)
  852.           self.bitmap.blt(@cw *  r, 0, number_image, src_rect)
  853.       end   
  854.       create_sup_sprite if @critical
  855.   end
  856.   
  857.   #--------------------------------------------------------------------------
  858.   # ● Create Sup Sprite
  859.   #--------------------------------------------------------------------------      
  860.   def create_sup_sprite
  861.       return if @sup_sprite != nil
  862.       @sup_sprite = Sprite.new ; @sup_sprite.visible = false ; fy = 0 ; sp = [0,0]
  863.       if @type == "MP" ; @sup_sprite.bitmap = @image[1].dup
  864.       elsif @type == "TP" ; @sup_sprite.bitmap = @image[2].dup
  865.       elsif @critical
  866.          @sup_sprite.bitmap = @image[5].dup
  867.          @cw2 = 0 ; @ch2 = @sup_sprite.bitmap.height  
  868.          return
  869.       elsif @type == "Exp"
  870.          @sup_sprite.bitmap = @image[6].dup ; fy = @ch ; sp[1] = 1.0
  871.       elsif @type == "Gold"
  872.          @sup_sprite.bitmap = @image[7].dup ; fy = (@ch * 2) ; sp[1] = 0.5
  873.      end  
  874.      fy = 0 if !SceneManager.scene_is?(Scene_Battle)
  875.      @y += fy ; @org_xy[1] += 0
  876.      @cw2 = @sup_sprite.bitmap.width + @cw
  877.      @spxy = [sp[0],sp[1]]
  878.   end

  879.   #--------------------------------------------------------------------------
  880.   # ● Update Sup Position
  881.   #--------------------------------------------------------------------------      
  882.   def update_sup_position(dif_y)
  883.       @sup_sprite.x = self.x - @cw unless @critical
  884.       @sup_sprite.y = @critical ? self.y - @ch2 : self.y
  885.       @sup_sprite.opacity = self.opacity ; @sup_sprite.angle = self.angle
  886.       @sup_sprite.zoom_x = self.zoom_x ; @sup_sprite.zoom_y = self.zoom_y
  887.       @sup_sprite.z = self.z ; @sup_sprite.viewport = self.viewport
  888.       @sup_sprite.visible = self.visible
  889.   end  
  890.   
  891.   #--------------------------------------------------------------------------
  892.   # ● Create Miss
  893.   #--------------------------------------------------------------------------      
  894.   def create_miss
  895.       self.bitmap = @image[3].dup if @value == "Missed"
  896.       self.bitmap = @image[4].dup if @value == "Evaded"
  897.       self.bitmap = @image[8].dup if @value == "Level UP"
  898.       self.bitmap = @image[9].dup if @value == "Counter"
  899.       self.bitmap = @image[10].dup if @value == "Reflection"
  900.   end
  901.   
  902.   #--------------------------------------------------------------------------
  903.   # ● Create Spring
  904.   #--------------------------------------------------------------------------               
  905.   def create_string
  906.       string_size = @value.to_s.split(//) ; fsize = FONT_SIZE > 10 ? FONT_SIZE : 10
  907.       @stg_size = string_size.size > 0 ? ((1 + string_size.size ) * ((fsize / 2) - 2)) : 32      
  908.       self.bitmap = Bitmap.new(@stg_size,32)
  909.       self.bitmap.font.color = FONT_COLOR
  910.       self.bitmap.font.size = fsize ; self.bitmap.font.bold = FONT_BOLD
  911.       self.bitmap.font.italic = FONT_ITALIC
  912.       if @type == "Item"
  913.          self.bitmap.font.color = FONT_COLOR_ITEM
  914.       elsif @type == "States Plus"
  915.          self.bitmap.font.color = FONT_COLOR_STATUS_PLUS
  916.       elsif @type == "States Minus"
  917.          self.bitmap.font.color = FONT_COLOR_STATUS_MINUS
  918.       end      
  919.       self.bitmap.draw_text(0, 0, self.bitmap.width, self.bitmap.height, @value.to_s,0)
  920.       draw_states if @state_index != nil
  921.   end
  922.   
  923.   #--------------------------------------------------------------------------
  924.   # ● Draw States
  925.   #--------------------------------------------------------------------------               
  926.   def draw_states
  927.       @sup_sprite = Sprite.new ; @sup_sprite.bitmap = Bitmap.new(24,24)
  928.       rect = Rect.new(@state_index % 16 * 24, @state_index / 16 * 24, 24, 24)
  929.       @image[14] = Cache.system("Iconset") if @image[14]== nil or @image[14].disposed?
  930.       @sup_sprite.bitmap.blt(0, 0, @image[14].dup, rect)
  931.       (@org_xy[1] += (@ch + 5) ; @y += (@ch + 5)) unless !SceneManager.is_a?(Scene_Battle)
  932.       @cw2 = @sup_sprite.bitmap.width + @cw / 2 ; @sup_sprite.visible = false
  933.   end  
  934.   
  935.   #--------------------------------------------------------------------------
  936.   # ● Update Damage
  937.   #--------------------------------------------------------------------------               
  938.   def update_damage(index_max,index,battler)
  939.       @index_max = index_max ; @index = index
  940.       return if self.bitmap == nil or self.bitmap.disposed?
  941.       @duration -= 1
  942.       self.visible = @duration > 90 ? false : true
  943.       return if !self.visible
  944.       dif_y = (@index_max - @index)
  945.       update_animation(dif_y)
  946.       update_sprite_position(dif_y,battler)
  947.       update_sup_position(dif_y) if @sup_sprite
  948.       dispose_damage if @duration <= 0
  949.   end
  950.   
  951.   #--------------------------------------------------------------------------
  952.   # ● Update Sprite Position
  953.   #--------------------------------------------------------------------------               
  954.   def update_sprite_position(dif_y,battler)
  955.       execute_move(0,self,@org_xy[0] + @oxy[0])
  956.       execute_move(1,self,@org_xy[1] + @oxy[1] - (dif_y * Y_SPACE))
  957.       self.zoom_y = self.zoom_x
  958.       update_battle_camera if oxy_camera?(battler)
  959.   end   
  960.   
  961.   #--------------------------------------------------------------------------
  962.   # ● Update Battle Camera
  963.   #--------------------------------------------------------------------------               
  964.   def update_battle_camera
  965.       self.ox = $game_temp.viewport_oxy[0] + @org_oxy[0]
  966.       self.oy = $game_temp.viewport_oxy[1] + @org_oxy[1]
  967.       @sup_sprite.ox = $game_temp.viewport_oxy[0] + @org_oxy[2] if @sup_sprite != nil
  968.       @sup_sprite.oy = $game_temp.viewport_oxy[1] + @org_oxy[3] if @sup_sprite != nil
  969.   end  
  970.   
  971.   #--------------------------------------------------------------------------
  972.   # ● OXY_CAMERA
  973.   #--------------------------------------------------------------------------               
  974.   def oxy_camera?(battler)
  975.       return false if $imported[:mog_battle_camera] == nil
  976.       if battler.is_a?(Game_Actor)
  977.          return false if $imported[:mog_battle_hud_ex] and SceneManager.face_battler?
  978.       end
  979.       return true
  980.   end
  981.   
  982.   #--------------------------------------------------------------------------
  983.   # ● Execute Move
  984.   #--------------------------------------------------------------------------      
  985.   def execute_move(type,sprite,np)
  986.       cp = type == 0 ? sprite.x : sprite.y
  987.       sp = 1 + ((cp - np).abs / 10)
  988.       sp = 1 if @duration < 60
  989.       if cp > np ;    cp -= sp ; cp = np if cp < np
  990.       elsif cp < np ; cp += sp ; cp = np if cp > np
  991.       end     
  992.       sprite.x = cp if type == 0 ; sprite.y = cp if type == 1
  993.   end   
  994.   
  995.   #--------------------------------------------------------------------------
  996.   # ● Update Animation
  997.   #--------------------------------------------------------------------------               
  998.   def update_animation(dif_y)
  999.      @oxy[1] -= 1
  1000.      case @duration
  1001.      when 60..90 ; self.opacity += 15
  1002.      when 30..60 ; self.opacity = 255
  1003.      when 0..30  ; self.opacity -= 9
  1004.      end
  1005.   end

  1006. end

  1007. #==============================================================================
  1008. # ■ Sprite Battler
  1009. #==============================================================================
  1010. class Sprite_Battler < Sprite_Base
  1011.   
  1012.   #--------------------------------------------------------------------------
  1013.   # ● Update Collapse
  1014.   #--------------------------------------------------------------------------  
  1015.   alias mog_damage_pop_update_collapse update_collapse
  1016.   def update_collapse
  1017.       mog_damage_pop_update_collapse
  1018.       execute_exp_pop
  1019.   end
  1020.   
  1021.   #--------------------------------------------------------------------------
  1022.   # ● Update Instant Collapse
  1023.   #--------------------------------------------------------------------------  
  1024.   alias mog_damage_pop_update_instant_collapse update_instant_collapse
  1025.   def update_instant_collapse
  1026.       mog_damage_pop_update_instant_collapse
  1027.       execute_exp_pop
  1028.   end   
  1029.   
  1030.   #--------------------------------------------------------------------------
  1031.   # ● Update Boss Collapse
  1032.   #--------------------------------------------------------------------------  
  1033.   alias mog_damage_pop_update_boss_collapse update_boss_collapse
  1034.   def update_boss_collapse
  1035.       mog_damage_pop_update_boss_collapse
  1036.       execute_exp_pop
  1037.   end
  1038.   
  1039.   #--------------------------------------------------------------------------
  1040.   # ● Execute Exp Pop
  1041.   #--------------------------------------------------------------------------  
  1042.   def execute_exp_pop
  1043.       return if !MOG_DAMAGEPOPUP::EXP_GOLD_POPUP_BATTLE or @dam_exp != nil
  1044.       return if @battler == nil or @battler.is_a?(Game_Actor)
  1045.       @dam_exp = true
  1046.       if $imported[:mog_active_bonus_gauge] != nil
  1047.          real_exp = $game_troop.bonus_exp? ? @battler.exp * 2 : @battler.exp
  1048.          real_gold = $game_troop.bonus_gold? ? @battler.gold * 2 : @battler.gold
  1049.       else
  1050.          real_exp = @battler.exp ;  real_gold = @battler.gold
  1051.       end
  1052.       @battler.damage.push([real_exp,"Exp"]) if @battler.exp > 0
  1053.       @battler.damage.push([real_gold,"Gold"]) if @battler.gold > 0
  1054.   end   
  1055.   
  1056. 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, ...
梦石
0
星屑
30103
在线时间
5741 小时
注册时间
2016-3-8
回帖
1662
发表于 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
回复

使用道具 举报

梦石
0
星屑
10510
在线时间
1118 小时
注册时间
2015-2-10
回帖
164
 楼主| 发表于 2021-10-12 20:49:00 | 显示全部楼层
alexncf125 发表于 2021-10-12 20:20
把"修改游戏分辨率的脚本"放在"装备栏脚本"的下方能解決"出错时的弹窗说了"group”"

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

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

使用道具 举报

梦石
0
星屑
10510
在线时间
1118 小时
注册时间
2015-2-10
回帖
164
 楼主| 发表于 2021-10-13 16:38:57 | 显示全部楼层
alexncf125 发表于 2021-10-12 20:20
把"修改游戏分辨率的脚本"放在"装备栏脚本"的下方能解決"出错时的弹窗说了"group”"

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

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

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部