赞 | 12 |
VIP | 0 |
好人卡 | 0 |
积分 | 79 |
经验 | 12026 |
最后登录 | 2024-11-15 |
在线时间 | 957 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 7932
- 在线时间
- 957 小时
- 注册时间
- 2015-2-10
- 帖子
- 248
|
50星屑
本帖最后由 fbeds 于 2021-10-12 19:11 编辑
这是修改游戏分辨率的脚本:
#encoding:utf-8 #============================================================================== # ■ String #------------------------------------------------------------------------------ # String 类追加定义。 #============================================================================== class String #---------------------------------------------------------------------------- # ● API #---------------------------------------------------------------------------- @@MultiByteToWideChar = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i') @@WideCharToMultiByte = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i') #---------------------------------------------------------------------------- # ● UTF-8 转 Unicode #---------------------------------------------------------------------------- def u2w i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0) buffer = "\0" * (i*2) @@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i) buffer.chop! return buffer end #---------------------------------------------------------------------------- # ● UTF-8 转系统编码 #---------------------------------------------------------------------------- def u2s i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0) buffer = "\0" * (i*2) @@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i) i = @@WideCharToMultiByte.call(0, 0, buffer, -1, nil, 0, nil, nil) result = "\0" * i @@WideCharToMultiByte.call(0, 0, buffer, -1, result, i, nil, nil) result.chop! return result end #---------------------------------------------------------------------------- # ● 系统编码转 UTF-8 #---------------------------------------------------------------------------- def s2u i = @@MultiByteToWideChar.call(0, 0, self, -1, nil, 0) buffer = "\0" * (i*2) @@MultiByteToWideChar.call(0, 0, self, -1, buffer, buffer.size / 2) i = @@WideCharToMultiByte.call(65001, 0, buffer, -1, nil, 0, nil, nil) result = "\0" * i @@WideCharToMultiByte.call(65001, 0, buffer, -1, result, result.size, nil, nil) result.chop! return result end end #============================================================================== # ■ AceResolutionMemoryPatch #------------------------------------------------------------------------------ # 用于调整RMACE分辨率的内存补丁脚本,免修改DLL。 # # by 灼眼的夏娜(感谢fux2君提供内存地址) #============================================================================== # 更多脚本请转到 [url]www.66rpg.com[/url]。 #============================================================================== module AceResolutionMemoryPatch GetModuleFileName = Win32API.new("kernel32", "GetModuleFileName", "lpl", "l") GetPrivateProfileString = Win32API.new("kernel32", "GetPrivateProfileString", "pppplp", "l") GetModuleHandle = Win32API.new("kernel32", "GetModuleHandle", "p", "l") RtlMoveMemory = Win32API.new("kernel32", "RtlMoveMemory", "pli", "v") RtlMoveMemoryLP = Win32API.new("kernel32", "RtlMoveMemory", "lpi", "v") VirtualProtect = Win32API.new("kernel32", "VirtualProtect", "lllp", "i") FindWindow = Win32API.new("user32", "FindWindow", "pp", "l") module_function def patch(width = 1024, height = 768) # 获取句柄 path = 0.chr * 256 return false if 0 == GetModuleFileName.call(0, path, path.size) path = path.s2u.gsub!(/.exe/ ,".ini").u2s buff = 0.chr * 256 return false if 0 == GetPrivateProfileString.call("Game", "Library", nil, buff, buff.size, path) buff.delete!("\0") rgsshandle = GetModuleHandle.call(buff) # 获取标题名和脚本名字 title = 0.chr * 256 return false if 0 == GetPrivateProfileString.call("Game", "Title", nil, title, title.size, path) title = title.s2u.delete("\0").u2s scripts = 0.chr * 256 return false if 0 == GetPrivateProfileString.call("Game", "Scripts", nil, scripts, scripts.size, path) scripts = scripts.s2u.delete("\0").u2w # 地址表 addr = { # 直接宽度替换 :w0 => [0x000016EE, 0x000020F6, 0x000020FF, 0x0010DFED, 0x0010E025, 0x0010E059, 0x0010E08D, 0x000019AA, 0x00001A5B, 0x0001C528, 0x0001F49C, 0x0010E7E7, 0x0010EFE9], # 直接高度替换 :h0 => [0x000016E9, 0x00002106, 0x0000210F, 0x0010DFE8, 0x0010E020, 0x0010E054, 0x0010E088, 0x000019A5, 0x00001A56, 0x0001C523, 0x0001F497, 0x0010E803, 0x0010EFF9], # 宽度+32 :w1 => [0x000213E4], # 高度+32 :h1 => [0x000213DF], # 最大宽度/32+1 :w2 => [0x00021FE1], # 最大高度/32+1 :h2 => [0x00021F5D] } # 更新 w0 = [width].pack("L") addr[:w0].each{|ofs| return false if !write_memory(rgsshandle + ofs, w0)} h0 = [height].pack("L") addr[:h0].each{|ofs| return false if !write_memory(rgsshandle + ofs, h0)} w1 = [width + 32].pack("L") addr[:w1].each{|ofs| return false if !write_memory(rgsshandle + ofs, w1)} h1 = [height + 32].pack("L") addr[:h1].each{|ofs| return false if !write_memory(rgsshandle + ofs, h1)} w2 = [width / 32 + 1].pack("C") addr[:w2].each{|ofs| return false if !write_memory(rgsshandle + ofs, w2)} h2 = [height / 32 + 1].pack("C") addr[:h2].each{|ofs| return false if !write_memory(rgsshandle + ofs, h2)} # 重启 rgssgamemain = Win32API.new(buff, "RGSSGameMain", "ipp", "v") rgssgamemain.call(FindWindow.call("RGSS Player", title), scripts, "") # 补丁成功 return true end def write_memory(addr, str) old = 0.chr * 4 return false if 0 == VirtualProtect.call(addr, str.size, 0x40, old) RtlMoveMemoryLP.call(addr, str, str.size) return false if 0 == VirtualProtect.call(addr, str.size, old.unpack("L").first, old) return true end private_class_method :write_memory def read_byte(addr) dst = 0.chr * 1 RtlMoveMemory.call(dst, addr, dst.size) return dst.unpack("C").first end private_class_method :read_byte def read_dword(addr) dst = 0.chr * 4 RtlMoveMemory.call(dst, addr, dst.size) return dst.unpack("L").first end private_class_method :read_dword end unless $ace_patched $ace_patched = true raise "应用分辨率补丁失败!" unless AceResolutionMemoryPatch.patch #raise RGSSReset.new end Graphics.resize_screen(1024, 768)
#encoding:utf-8
#==============================================================================
# ■ String
#------------------------------------------------------------------------------
# String 类追加定义。
#==============================================================================
class String
#----------------------------------------------------------------------------
# ● API
#----------------------------------------------------------------------------
@@MultiByteToWideChar = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
@@WideCharToMultiByte = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
#----------------------------------------------------------------------------
# ● UTF-8 转 Unicode
#----------------------------------------------------------------------------
def u2w
i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0)
buffer = "\0" * (i*2)
@@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i)
buffer.chop!
return buffer
end
#----------------------------------------------------------------------------
# ● UTF-8 转系统编码
#----------------------------------------------------------------------------
def u2s
i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0)
buffer = "\0" * (i*2)
@@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i)
i = @@WideCharToMultiByte.call(0, 0, buffer, -1, nil, 0, nil, nil)
result = "\0" * i
@@WideCharToMultiByte.call(0, 0, buffer, -1, result, i, nil, nil)
result.chop!
return result
end
#----------------------------------------------------------------------------
# ● 系统编码转 UTF-8
#----------------------------------------------------------------------------
def s2u
i = @@MultiByteToWideChar.call(0, 0, self, -1, nil, 0)
buffer = "\0" * (i*2)
@@MultiByteToWideChar.call(0, 0, self, -1, buffer, buffer.size / 2)
i = @@WideCharToMultiByte.call(65001, 0, buffer, -1, nil, 0, nil, nil)
result = "\0" * i
@@WideCharToMultiByte.call(65001, 0, buffer, -1, result, result.size, nil, nil)
result.chop!
return result
end
end
#==============================================================================
# ■ AceResolutionMemoryPatch
#------------------------------------------------------------------------------
# 用于调整RMACE分辨率的内存补丁脚本,免修改DLL。
#
# by 灼眼的夏娜(感谢fux2君提供内存地址)
#==============================================================================
# 更多脚本请转到 [url]www.66rpg.com[/url]。
#==============================================================================
module AceResolutionMemoryPatch
GetModuleFileName = Win32API.new("kernel32", "GetModuleFileName", "lpl", "l")
GetPrivateProfileString = Win32API.new("kernel32", "GetPrivateProfileString", "pppplp", "l")
GetModuleHandle = Win32API.new("kernel32", "GetModuleHandle", "p", "l")
RtlMoveMemory = Win32API.new("kernel32", "RtlMoveMemory", "pli", "v")
RtlMoveMemoryLP = Win32API.new("kernel32", "RtlMoveMemory", "lpi", "v")
VirtualProtect = Win32API.new("kernel32", "VirtualProtect", "lllp", "i")
FindWindow = Win32API.new("user32", "FindWindow", "pp", "l")
module_function
def patch(width = 1024, height = 768)
# 获取句柄
path = 0.chr * 256
return false if 0 == GetModuleFileName.call(0, path, path.size)
path = path.s2u.gsub!(/.exe/ ,".ini").u2s
buff = 0.chr * 256
return false if 0 == GetPrivateProfileString.call("Game", "Library", nil, buff, buff.size, path)
buff.delete!("\0")
rgsshandle = GetModuleHandle.call(buff)
# 获取标题名和脚本名字
title = 0.chr * 256
return false if 0 == GetPrivateProfileString.call("Game", "Title", nil, title, title.size, path)
title = title.s2u.delete("\0").u2s
scripts = 0.chr * 256
return false if 0 == GetPrivateProfileString.call("Game", "Scripts", nil, scripts, scripts.size, path)
scripts = scripts.s2u.delete("\0").u2w
# 地址表
addr =
{
# 直接宽度替换
:w0 => [0x000016EE, 0x000020F6, 0x000020FF, 0x0010DFED, 0x0010E025, 0x0010E059, 0x0010E08D, 0x000019AA, 0x00001A5B, 0x0001C528, 0x0001F49C, 0x0010E7E7, 0x0010EFE9],
# 直接高度替换
:h0 => [0x000016E9, 0x00002106, 0x0000210F, 0x0010DFE8, 0x0010E020, 0x0010E054, 0x0010E088, 0x000019A5, 0x00001A56, 0x0001C523, 0x0001F497, 0x0010E803, 0x0010EFF9],
# 宽度+32
:w1 => [0x000213E4],
# 高度+32
:h1 => [0x000213DF],
# 最大宽度/32+1
:w2 => [0x00021FE1],
# 最大高度/32+1
:h2 => [0x00021F5D]
}
# 更新
w0 = [width].pack("L")
addr[:w0].each{|ofs| return false if !write_memory(rgsshandle + ofs, w0)}
h0 = [height].pack("L")
addr[:h0].each{|ofs| return false if !write_memory(rgsshandle + ofs, h0)}
w1 = [width + 32].pack("L")
addr[:w1].each{|ofs| return false if !write_memory(rgsshandle + ofs, w1)}
h1 = [height + 32].pack("L")
addr[:h1].each{|ofs| return false if !write_memory(rgsshandle + ofs, h1)}
w2 = [width / 32 + 1].pack("C")
addr[:w2].each{|ofs| return false if !write_memory(rgsshandle + ofs, w2)}
h2 = [height / 32 + 1].pack("C")
addr[:h2].each{|ofs| return false if !write_memory(rgsshandle + ofs, h2)}
# 重启
rgssgamemain = Win32API.new(buff, "RGSSGameMain", "ipp", "v")
rgssgamemain.call(FindWindow.call("RGSS Player", title), scripts, "")
# 补丁成功
return true
end
def write_memory(addr, str)
old = 0.chr * 4
return false if 0 == VirtualProtect.call(addr, str.size, 0x40, old)
RtlMoveMemoryLP.call(addr, str, str.size)
return false if 0 == VirtualProtect.call(addr, str.size, old.unpack("L").first, old)
return true
end
private_class_method :write_memory
def read_byte(addr)
dst = 0.chr * 1
RtlMoveMemory.call(dst, addr, dst.size)
return dst.unpack("C").first
end
private_class_method :read_byte
def read_dword(addr)
dst = 0.chr * 4
RtlMoveMemory.call(dst, addr, dst.size)
return dst.unpack("L").first
end
private_class_method :read_dword
end
unless $ace_patched
$ace_patched = true
raise "应用分辨率补丁失败!" unless AceResolutionMemoryPatch.patch
#raise RGSSReset.new
end
Graphics.resize_screen(1024, 768)
这是修改装备栏的脚本:
#============================================================================== # # ▼ Yanfly Engine Ace - 装备系统 v1.06 # -- 最后更新: 2014.05.01 # -- 使用难度: 普通, 困难 # -- 需要脚本: 无 #先获得物品,然后事件脚本 #$game_actors[x].change_equip_by_id(y, z) #x为数据库角色编号 #y为y号装备槽位置【从0开始】(相对于角色的装备槽) #z为数据库装备编号 # #============================================================================== $imported = {} if $imported.nil? $imported["YEA-AceEquipEngine"] = true #============================================================================== # ▼ Updates # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 2014.05.01 - Bug Fixed: Refresh Equip Item List when change slot. # 2012.02.02 - Bug Fixed: Crash when changing classes to different equip slots. # 2012.01.22 - Bug Fixed: <equip slot> notetags updated to factor in spaces. # 2012.01.05 - Compatibility Update: Equip Dynamic Stats # 2011.12.30 - Bug Fixed: Stats didn't update. # 2011.12.23 - Script efficiency optimized. # 2011.12.18 - Script efficiency optimized. # 2011.12.13 - Started Script and Finished. # #============================================================================== # ▼ 介绍 # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 默认的装备系统十分基础,本脚本为装备系统添加诸多功能,如指定角色装备类型(包 # 括角色可以拥有多个相同的装备类型)、设定新的装备类型(这里说的装备类型不同于 # 于数据库中的武器类型、护甲类型,可以说装备类型包括武器、防具、饰品等)。 # #============================================================================== # ▼ 安装方式 # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新 # 脚本页/槽中.记得保存你的工程以使脚本生效. # # ----------------------------------------------------------------------------- # 角色备注 - 在数据库-角色中可以使用的备注. # ----------------------------------------------------------------------------- # <装备槽> # 内容 # 内容 # </装备槽> # 设定该角色可装备的装备类型,及装备类型的顺序。将"内容"替换为该角色可用的装备 # 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚, # 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面 # 有讲。 # # <初始装备: x> # <初始装备: x, x> # 设定该角色的初始装备类型,x为装备类型的id。在数据库中没有新装备槽的初始装备设 # 定时可以使用。 # # <固定装备: x> # <固定装备: x, x> # 固定该角色的x号装备类型。 # # <禁用装备: x> # <禁用装备: x, x> # 禁用该角色的x号装备类型。意思是装备无法放置在该装备槽中。 # # ----------------------------------------------------------------------------- # 职业备注 - 在数据库-职业中可以使用的备注. # ----------------------------------------------------------------------------- # <装备槽> # 内容 # 内容 # </装备槽> # 设定该职业可装备的装备类型,及装备类型的顺序。将"内容"替换为该职业可用的装备 # 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚, # 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面 # 有讲 # # <固定装备: x> # <固定装备: x, x> # 固定该职业的x号装备类型。 # # <禁用装备: x> # <禁用装备: x, x> # 禁用该职业的x号装备类型。意思是装备无法放置在该装备槽中。 # # ----------------------------------------------------------------------------- # 武器备注 - 在数据库-武器中可以使用的备注. # ----------------------------------------------------------------------------- # <固定装备: x> # <固定装备: x, x> # 装备该武器后固定x号装备类型。 # # <禁用装备: x> # <禁用装备: x, x> # 装备该武器后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。 # # ----------------------------------------------------------------------------- # 护甲备注 - 在数据库-护甲中可以使用的备注. # ----------------------------------------------------------------------------- # <装备类型: x> # <装备类型: 文本> # x替换为装备名称(本脚本下面)或装备类型ID,此备注将该护甲归类/视为x号装备类型 # # <固定装备: x> # <固定装备: x, x> # 装备该护甲后固定x号装备类型。 # # <禁用装备: x> # <禁用装备: x, x> # 装备该护甲后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。 # # ----------------------------------------------------------------------------- # 状态备注 - 在数据库-状态中可以使用的备注. # ----------------------------------------------------------------------------- # <固定装备: x> # <固定装备: x, x> # 获得该状态后固定x号装备类型。(配合脚本"战斗中更换装备") # # <禁用装备: x> # <禁用装备: x, x> # 获得该状态后禁用x号装备类型。意思是装备无法放置在该装备槽中。(配合脚本"战斗中 # 更换装备") # #============================================================================== # ▼ 兼容性 # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX. # #============================================================================== module YEA module EQUIP #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - 通用装备设置 - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # 调整默认装备设置,你可以添加新的装备类型,建议不要改得太多,以免出现问题。 # 下面是默认id对应的装备类型 # # ID 装备类型 # --- ------------ # 0 武器 # 1 盾牌 # 2 头盔 # 3 铠甲 # 4 饰品 # # 无论你怎么修改以下顺序,武器双持的情况都是不变的:第二个装备类型变为武器(0). #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # 下面这个数组是默认的可用装备槽即其顺序,应用于一切未通过备注自定义装备槽 # 的角色。 DEFAULT_BASE_SLOTS = [0,0,0,0,0,1,2,3,4,5,5,5,5,5,6,7] # 下面这个哈希表用来添加新的装备类型(id为 4+). 你还可以设定其能否被移除, # 是否能通过"最强装备"自动选择最强的装备。 TYPES ={ # TypeID => ["类型名称", 能否移除?, 能否使用"最强装备"?], 0 => [ "心灵", true, false], 1 => [ "衣服", true, false], 2 => [ "下装", true, false], 3 => [ "袜子", true, false], 4 => [ "鞋子", true, false], 5 => [ "其它", true, false], } # 别动这个括号. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - 装备指令列表 - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # 在这里调整装备指令列表(甚至是移除某些指令)下面是指令的解释: # # ------------------------------------------------------------------------- # :指令 解释 # ------------------------------------------------------------------------- # :equip 激活装备选择窗口. 默认. # :optimize 自动为角色选择最强装备. 默认. # :clear 移除角色身上的全部装备. 默认 # # 以上为默认的全部可用指令。 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # 在数组中放置可用的指令. COMMAND_LIST =[ :equip, # :optimize, :clear, # :custom1, # :custom2, ] # 不要动这个括号. #-------------------------------------------------------------------------- # - 装备自定义指令 - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # 对于那些希望通过本脚本来为装备场景添加特殊效果的人,可以使用下面的哈希表 # 来管理装备场景中的指令。你可以使用开关来禁用/隐藏指令。如果你不想把指令与 # 开关相关联,把开关设定为0就行。 #-------------------------------------------------------------------------- CUSTOM_EQUIP_COMMANDS ={ # :指令 => [ "文本", 启用开关, 显示开关, 处理方法], :custom1 => [ "自定义名称", 0, 0, :command_name1], :custom2 => [ "自定义文本", 0, 0, :command_name2], } # 不要动这个括号. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - 其他窗口设置 - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # 调整装备窗口的视觉效果. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # 改变右下角能力值数字的字体大小 STATUS_FONT_SIZE = 20 # 在更换装备指令中,移除装备指令的图标和文本设定 REMOVE_EQUIP_ICON = 0 REMOVE_EQUIP_TEXT = "<移除>" # 装备槽中,无装备的图标和文本. NOTHING_ICON = 0 NOTHING_TEXT = "<空>" end # EQUIP end # YEA #============================================================================== # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭 # 所以编辑了后果自负。 #============================================================================== module YEA module REGEXP module BASEITEM EQUIP_SLOTS_ON = /<(?:EQUIP_SLOTS|装备槽)>/i EQUIP_SLOTS_OFF = /<\/(?:EQUIP_SLOTS|装备槽)>/i EQUIP_TYPE_INT = /<(?:EQUIP_TYPE|装备类型):[ ]*(\d+)>/i EQUIP_TYPE_STR = /<(?:EQUIP_TYPE|装备类型):[ ]*(.*)>/i STARTING_GEAR = /<(?:STARTING_GEAR|初始装备):[ ](\d+(?:\s*,\s*\d+)*)>/i FIXED_EQUIP = /<(?:FIXED_EQUIP|固定装备):[ ](\d+(?:\s*,\s*\d+)*)>/i SEALED_EQUIP = /<(?:SEALED_EQUIP|禁用装备):[ ](\d+(?:\s*,\s*\d+)*)>/i end # BASEITEM end # REGEXP end # YEA #============================================================================== # ■ Vocab #============================================================================== module Vocab #-------------------------------------------------------------------------- # overwrite method: self.etype #-------------------------------------------------------------------------- def self.etype(etype) return $data_system.terms.etypes[etype] if [0,1,2,3,4].include?(etype) return YEA::EQUIP::TYPES[etype][0] if YEA::EQUIP::TYPES.include?(etype) return "" end end # Vocab #============================================================================== # ■ Icon #============================================================================== module Icon #-------------------------------------------------------------------------- # self.remove_equip #-------------------------------------------------------------------------- def self.remove_equip; return YEA::EQUIP::REMOVE_EQUIP_ICON; end #-------------------------------------------------------------------------- # self.nothing_equip #-------------------------------------------------------------------------- def self.nothing_equip; return YEA::EQUIP::NOTHING_ICON; end end # Icon #============================================================================== # ■ Numeric #============================================================================== class Numeric #-------------------------------------------------------------------------- # new method: group_digits #-------------------------------------------------------------------------- unless $imported["YEA-CoreEngine"] def group; return self.to_s; end end # $imported["YEA-CoreEngine"] end # Numeric #============================================================================== # ■ DataManager #============================================================================== module DataManager #-------------------------------------------------------------------------- # alias method: load_database #-------------------------------------------------------------------------- class <<self; alias load_database_aee load_database; end def self.load_database load_database_aee load_notetags_aee end #-------------------------------------------------------------------------- # new method: load_notetags_aee #-------------------------------------------------------------------------- def self.load_notetags_aee groups = [$data_actors, $data_classes, $data_weapons, $data_armors, $data_states] for group in groups for obj in group next if obj.nil? obj.load_notetags_aee end end end end # DataManager #============================================================================== # ■ RPG::BaseItem #============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :base_equip_slots attr_accessor :fixed_equip_type attr_accessor :sealed_equip_type attr_accessor :extra_starting_equips #-------------------------------------------------------------------------- # common cache: load_notetags_aee #-------------------------------------------------------------------------- def load_notetags_aee @base_equip_slots = [] @equip_slots_on = false @fixed_equip_type = [] @sealed_equip_type = [] @extra_starting_equips = [] #--- self.note.split(/[\r\n]+/).each { |line| case line #--- when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_ON next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class) @equip_slots_on = true when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_OFF next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class) @equip_slots_on = false #--- when YEA::REGEXP::BASEITEM::STARTING_GEAR next unless self.is_a?(RPG::Actor) $1.scan(/\d+/).each { |num| @extra_starting_equips.push(num.to_i) if num.to_i > 0 } when YEA::REGEXP::BASEITEM::FIXED_EQUIP $1.scan(/\d+/).each { |num| @fixed_equip_type.push(num.to_i) if num.to_i > 0 } when YEA::REGEXP::BASEITEM::SEALED_EQUIP $1.scan(/\d+/).each { |num| @sealed_equip_type.push(num.to_i) if num.to_i > 0 } #--- when YEA::REGEXP::BASEITEM::EQUIP_TYPE_INT next unless self.is_a?(RPG::Armor) @etype_id = [1, $1.to_i].max when YEA::REGEXP::BASEITEM::EQUIP_TYPE_STR next unless self.is_a?(RPG::Armor) for key in YEA::EQUIP::TYPES id = key[0] next if YEA::EQUIP::TYPES[id][0].upcase != $1.to_s.upcase @etype_id = [1, id].max break end #--- else if @equip_slots_on case line.upcase when /装备类型[ ](\d+)/i, /装备类型:[ ](\d+)/i id = $1.to_i @base_equip_slots.push(id) if [0,1,2,3,4].include?(id) @base_equip_slots.push(id) if YEA::EQUIP::TYPES.include?(id) when /WEAPON/i @base_equip_slots.push(0) when /SHIELD/i @base_equip_slots.push(1) when /HEAD/i @base_equip_slots.push(2) when /BODY/i, /ARMOR/i, /ARMOUR/i @base_equip_slots.push(3) when /ETC/i, /OTHER/i, /ACCESSOR/i @base_equip_slots.push(4) else text = line.upcase.delete(" ") for key in YEA::EQUIP::TYPES id = key[0] next if YEA::EQUIP::TYPES[id][0].upcase.delete(" ")!= text @base_equip_slots.push(id) break end end end end } # self.note.split #--- return unless self.is_a?(RPG::Class) if @base_equip_slots.empty? @base_equip_slots = YEA::EQUIP::DEFAULT_BASE_SLOTS.clone end end end # RPG::BaseItem #============================================================================== # ■ Game_Temp #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :eds_actor attr_accessor :scene_equip_index attr_accessor :scene_equip_oy end # Game_Temp #============================================================================== # ■ Game_BaseItem #============================================================================== class Game_BaseItem #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :item_id end # Game_BaseItem #============================================================================== # ■ Game_BattlerBase #============================================================================== class Game_BattlerBase #-------------------------------------------------------------------------- # alias method: equip_type_fixed? #-------------------------------------------------------------------------- alias game_battlerbase_equip_type_fixed_aee equip_type_fixed? def equip_type_fixed?(etype_id) return true if fixed_etypes.include?(etype_id) if actor? return game_battlerbase_equip_type_fixed_aee(etype_id) end #-------------------------------------------------------------------------- # alias method: equip_type_sealed? #-------------------------------------------------------------------------- alias game_battlerbase_equip_type_sealed_aee equip_type_sealed? def equip_type_sealed?(etype_id) return true if sealed_etypes.include?(etype_id) if actor? return game_battlerbase_equip_type_sealed_aee(etype_id) end end # Game_BattlerBase #============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # alias method: init_equips #-------------------------------------------------------------------------- alias game_actor_init_equips_aee init_equips def init_equips(equips) game_actor_init_equips_aee(equips) equip_extra_starting_equips end #-------------------------------------------------------------------------- # new method: equip_extra_starting_equips #-------------------------------------------------------------------------- def equip_extra_starting_equips for equip_id in actor.extra_starting_equips armour = $data_armors[equip_id] next if armour.nil? etype_id = armour.etype_id next unless equip_slots.include?(etype_id) slot_id = empty_slot(etype_id) @equips[slot_id].set_equip(etype_id == 0, armour.id) end refresh end #-------------------------------------------------------------------------- # overwrite method: equip_slots #-------------------------------------------------------------------------- def equip_slots return equip_slots_dual if dual_wield? return equip_slots_normal end #-------------------------------------------------------------------------- # new method: equip_slots_normal #-------------------------------------------------------------------------- def equip_slots_normal return self.actor.base_equip_slots if self.actor.base_equip_slots != [] return self.class.base_equip_slots end #-------------------------------------------------------------------------- # new method: equip_slots_dual #-------------------------------------------------------------------------- def equip_slots_dual array = equip_slots_normal.clone array[1] = 0 if array.size >= 2 return array end #-------------------------------------------------------------------------- # new method: fixed_etypes #-------------------------------------------------------------------------- def fixed_etypes array = [] array |= self.actor.fixed_equip_type array |= self.class.fixed_equip_type for equip in equips next if equip.nil? array |= equip.fixed_equip_type end for state in states next if state.nil? array |= state.fixed_equip_type end return array end #-------------------------------------------------------------------------- # new method: sealed_etypes #-------------------------------------------------------------------------- def sealed_etypes array = [] array |= self.actor.sealed_equip_type array |= self.class.sealed_equip_type for equip in equips next if equip.nil? array |= equip.sealed_equip_type end for state in states next if state.nil? array |= state.sealed_equip_type end return array end #-------------------------------------------------------------------------- # alias method: change_equip #-------------------------------------------------------------------------- alias game_actor_change_equip_aee change_equip def change_equip(slot_id, item) if item.nil? && !@optimize_clear etype_id = equip_slots[slot_id] return unless YEA::EQUIP::TYPES[etype_id][1] elsif item.nil? && @optimize_clear etype_id = equip_slots[slot_id] return unless YEA::EQUIP::TYPES[etype_id][2] end @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil? game_actor_change_equip_aee(slot_id, item) end #-------------------------------------------------------------------------- # overwrite method: optimize_equipments #-------------------------------------------------------------------------- def optimize_equipments $game_temp.eds_actor = self @optimize_clear = true clear_equipments @optimize_clear = false equip_slots.size.times do |i| next if !equip_change_ok?(i) next unless can_optimize?(i) items = $game_party.equip_items.select do |item| item.etype_id == equip_slots[i] && equippable?(item) && item.performance >= 0 end change_equip(i, items.max_by {|item| item.performance }) end $game_temp.eds_actor = nil end #-------------------------------------------------------------------------- # new method: can_optimize? #-------------------------------------------------------------------------- def can_optimize?(slot_id) etype_id = equip_slots[slot_id] return YEA::EQUIP::TYPES[etype_id][2] end #-------------------------------------------------------------------------- # alias method: force_change_equip #-------------------------------------------------------------------------- alias game_actor_force_change_equip_aee force_change_equip def force_change_equip(slot_id, item) @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil? game_actor_force_change_equip_aee(slot_id, item) end #-------------------------------------------------------------------------- # alias method: weapons #-------------------------------------------------------------------------- alias game_actor_weapons_aee weapons def weapons anti_crash_equips return game_actor_weapons_aee end #-------------------------------------------------------------------------- # alias method: armors #-------------------------------------------------------------------------- alias game_actor_armors_aee armors def armors anti_crash_equips return game_actor_armors_aee end #-------------------------------------------------------------------------- # alias method: equips #-------------------------------------------------------------------------- alias game_actor_equips_aee equips def equips anti_crash_equips return game_actor_equips_aee end #-------------------------------------------------------------------------- # new method: equips #-------------------------------------------------------------------------- def anti_crash_equips for i in 0...@equips.size next unless @equips[i].nil? @equips[i] = Game_BaseItem.new end end end # Game_Actor #============================================================================== # ■ Game_Interpreter #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # overwrite method: change equip #-------------------------------------------------------------------------- def command_319 actor = $game_actors[@params[0]] return if actor.nil? if @params[1] == 0 && @params[2] != 0 item = $data_weapons[@params[2]] return unless actor.equip_slots.include?(0) slot_id = actor.empty_slot(0) elsif @params[2] != 0 item = $data_armors[@params[2]] return unless actor.equip_slots.include?(item.etype_id) slot_id = actor.empty_slot(item.etype_id) else slot_id = @params[1] end actor.change_equip_by_id(slot_id, @params[2]) end end # Game_Interpreter #============================================================================== # ■ Window_EquipStatus #============================================================================== class Window_EquipStatus < Window_Base #-------------------------------------------------------------------------- # overwrite method: initialize #-------------------------------------------------------------------------- def initialize(dx, dy) super(dx, dy, window_width, Graphics.height - dy) @actor = nil @temp_actor = nil refresh end #-------------------------------------------------------------------------- # overwrite method: window_width #-------------------------------------------------------------------------- def window_width; return Graphics.width * 2 / 5; end #-------------------------------------------------------------------------- # overwrite method: refresh #-------------------------------------------------------------------------- def refresh contents.clear 8.times {|i| draw_item(0, line_height * i, i) } end #-------------------------------------------------------------------------- # overwrite method: draw_item #-------------------------------------------------------------------------- def draw_item(dx, dy, param_id) draw_background_colour(dx, dy) draw_param_name(dx + 4, dy, param_id) draw_current_param(dx + 4, dy, param_id) if @actor drx = (contents.width + 22) / 2 draw_right_arrow(drx, dy) draw_new_param(drx + 22, dy, param_id) if @temp_actor reset_font_settings end #-------------------------------------------------------------------------- # new method: draw_background_colour #-------------------------------------------------------------------------- def draw_background_colour(dx, dy) colour = Color.new(0, 0, 0, translucent_alpha/2) rect = Rect.new(dx+1, dy+1, contents.width - 2, line_height - 2) contents.fill_rect(rect, colour) end #-------------------------------------------------------------------------- # overwrite method: draw_param_name #-------------------------------------------------------------------------- def draw_param_name(dx, dy, param_id) contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE change_color(system_color) draw_text(dx, dy, contents.width, line_height, Vocab::param(param_id)) end #-------------------------------------------------------------------------- # overwrite method: draw_current_param #-------------------------------------------------------------------------- def draw_current_param(dx, dy, param_id) change_color(normal_color) dw = (contents.width + 22) / 2 draw_text(0, dy, dw, line_height, @actor.param(param_id).group, 2) reset_font_settings end #-------------------------------------------------------------------------- # overwrite method: draw_new_param #-------------------------------------------------------------------------- def draw_new_param(dx, dy, param_id) contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE new_value = @temp_actor.param(param_id) change_color(param_change_color(new_value - @actor.param(param_id))) draw_text(0, dy, contents.width-4, line_height, new_value.group, 2) reset_font_settings end end # Window_EquipStatus #============================================================================== # ■ Window_EquipCommand #============================================================================== class Window_EquipCommand < Window_HorzCommand #-------------------------------------------------------------------------- # overwrite method: make_command_list #-------------------------------------------------------------------------- def make_command_list for command in YEA::EQUIP::COMMAND_LIST case command when :equip add_command(Vocab::equip2, :equip) # when :optimize # add_command(Vocab::optimize, :optimize) when :clear add_command(Vocab::clear, :clear) else process_custom_command(command) end end end #-------------------------------------------------------------------------- # process_ok #-------------------------------------------------------------------------- def process_ok $game_temp.scene_equip_index = index $game_temp.scene_equip_oy = self.oy super end #-------------------------------------------------------------------------- # new method: process_custom_command #-------------------------------------------------------------------------- def process_custom_command(command) return unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command) show = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][2] continue = show <= 0 ? true : $game_switches[show] return unless continue text = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][0] switch = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][1] enabled = switch <= 0 ? true : $game_switches[switch] add_command(text, command, enabled) end #-------------------------------------------------------------------------- # overwrite method: window_width #-------------------------------------------------------------------------- def window_width; return 160; end #-------------------------------------------------------------------------- # overwrite method: contents_width #-------------------------------------------------------------------------- def contents_width; return width - standard_padding * 2; end #-------------------------------------------------------------------------- # overwrite method: contents_height #-------------------------------------------------------------------------- def contents_height ch = height - standard_padding * 2 return [ch - ch % item_height, row_max * item_height].max end #-------------------------------------------------------------------------- # overwrite method: visible_line_number #-------------------------------------------------------------------------- def visible_line_number; return 4; end #-------------------------------------------------------------------------- # overwrite method: col_max #-------------------------------------------------------------------------- def col_max; return 1; end #-------------------------------------------------------------------------- # overwrite method: item_rect #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new rect.width = item_width rect.height = item_height rect.x = index % col_max * (item_width + spacing) rect.y = index / col_max * item_height rect end #-------------------------------------------------------------------------- # overwrite method: ensure_cursor_visible #-------------------------------------------------------------------------- def ensure_cursor_visible self.top_row = row if row < top_row self.bottom_row = row if row > bottom_row end #-------------------------------------------------------------------------- # overwrite method: cursor_down #-------------------------------------------------------------------------- def cursor_down(wrap = false) if index < item_max - col_max || (wrap && col_max == 1) select((index + col_max) % item_max) end end #-------------------------------------------------------------------------- # overwrite method: cursor_up #-------------------------------------------------------------------------- def cursor_up(wrap = false) if index >= col_max || (wrap && col_max == 1) select((index - col_max + item_max) % item_max) end end #-------------------------------------------------------------------------- # overwrite method: process_pageup #-------------------------------------------------------------------------- def process_pageup Sound.play_cursor Input.update deactivate call_handler(:pageup) end #-------------------------------------------------------------------------- # overwrite method: process_pagedown #-------------------------------------------------------------------------- def process_pagedown Sound.play_cursor Input.update deactivate call_handler(:pagedown) end end # Window_EquipCommand #============================================================================== # ■ Window_EquipSlot #============================================================================== class Window_EquipSlot < Window_Selectable #-------------------------------------------------------------------------- # overwrite method: initialize #-------------------------------------------------------------------------- def initialize(dx, dy, dw) super(dx, dy, dw, Graphics.height - dy) @actor = nil refresh end #-------------------------------------------------------------------------- # overwrite method: window_height #-------------------------------------------------------------------------- def window_height; return self.height; end #-------------------------------------------------------------------------- # overwrite method: visible_line_number #-------------------------------------------------------------------------- def visible_line_number; return item_max; end #-------------------------------------------------------------------------- # overwrite method: refresh #-------------------------------------------------------------------------- def refresh create_contents super end #-------------------------------------------------------------------------- # overwrite method: draw_item #-------------------------------------------------------------------------- def draw_item(index) return unless @actor rect = item_rect_for_text(index) change_color(system_color, enable?(index)) draw_text(rect.x, rect.y, 92, line_height, slot_name(index)) item = @actor.equips[index] dx = rect.x + 92 dw = contents.width - dx - 24 if item.nil? draw_nothing_equip(dx, rect.y, false, dw) else draw_item_name(item, dx, rect.y, enable?(index), dw) end end #-------------------------------------------------------------------------- # new method: draw_nothing_equip #-------------------------------------------------------------------------- def draw_nothing_equip(dx, dy, enabled, dw) change_color(normal_color, enabled) draw_icon(Icon.nothing_equip, dx, dy, enabled) text = YEA::EQUIP::NOTHING_TEXT draw_text(dx + 24, dy, dw - 24, line_height, text) end end # Window_EquipSlot #============================================================================== # ■ Window_EquipItem #============================================================================== class Window_EquipItem < Window_ItemList #-------------------------------------------------------------------------- # overwrite method: col_max #-------------------------------------------------------------------------- def col_max; return 1; end #-------------------------------------------------------------------------- # overwrite method: slot_id= #-------------------------------------------------------------------------- def slot_id=(slot_id) return if @slot_id == slot_id @slot_id = slot_id @last_item = nil self.oy = 0 refresh end #-------------------------------------------------------------------------- # overwrite method: draw_item #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] rect = item_rect(index) rect.width -= 4 if item.nil? draw_remove_equip(rect) return end dw = contents.width - rect.x - 24 draw_item_name(item, rect.x, rect.y, enable?(item), dw) draw_item_number(rect, item) end #-------------------------------------------------------------------------- # new method: draw_remove_equip #-------------------------------------------------------------------------- def draw_remove_equip(rect) draw_icon(Icon.remove_equip, rect.x, rect.y) text = YEA::EQUIP::REMOVE_EQUIP_TEXT rect.x += 24 rect.width -= 24 draw_text(rect, text) end #-------------------------------------------------------------------------- # overwrite method: include? #-------------------------------------------------------------------------- def include?(item) if item.nil? && !@actor.nil? etype_id = @actor.equip_slots[@slot_id] return YEA::EQUIP::TYPES[etype_id][1] end return true if item.nil? return false unless item.is_a?(RPG::EquipItem) return false if @slot_id < 0 return false if item.etype_id != @actor.equip_slots[@slot_id] return @actor.equippable?(item) end #-------------------------------------------------------------------------- # overwrite method: enable? #-------------------------------------------------------------------------- def enable?(item) if item.nil? && !@actor.nil? etype_id = @actor.equip_slots[@slot_id] return YEA::EQUIP::TYPES[etype_id][1] end return @actor.equippable?(item) end #-------------------------------------------------------------------------- # new method: show #-------------------------------------------------------------------------- def show @last_item = 0 update_help super end #-------------------------------------------------------------------------- # overwrite method: update_help #-------------------------------------------------------------------------- def update_help super return if @actor.nil? return if @status_window.nil? return if @last_item == item @last_item = item temp_actor = Marshal.load(Marshal.dump(@actor)) temp_actor.force_change_equip(@slot_id, item) @status_window.set_temp_actor(temp_actor) end end # Window_EquipItem #============================================================================== # ■ Window_EquipActor #============================================================================== class Window_EquipActor < Window_Base #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(dx, dy) super(dx, dy, window_width, fitting_height(4)) @actor = nil end #-------------------------------------------------------------------------- # window_width #-------------------------------------------------------------------------- def window_width; return Graphics.width - 160; end #-------------------------------------------------------------------------- # actor= #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor refresh end #-------------------------------------------------------------------------- # refresh #-------------------------------------------------------------------------- def refresh contents.clear return unless @actor draw_actor_face(@actor, 0, 0) draw_actor_simple_status(@actor, 108, line_height / 2) end end # Window_EquipActor #============================================================================== # ■ Scene_Equip #============================================================================== class Scene_Equip < Scene_MenuBase #-------------------------------------------------------------------------- # overwrite method: create_status_window #-------------------------------------------------------------------------- def create_status_window wx = Graphics.width - (Graphics.width * 2 / 5) wy = @help_window.height + 120 @status_window = Window_EquipStatus.new(wx, wy) @status_window.viewport = @viewport @status_window.actor = @actor end #-------------------------------------------------------------------------- # overwrite method: create_command_window #-------------------------------------------------------------------------- def create_command_window wx = 0 wy = @help_window.height ww = 160 @command_window = Window_EquipCommand.new(wx, wy, ww) @command_window.viewport = @viewport @command_window.help_window = @help_window if !$game_temp.scene_equip_index.nil? @command_window.select($game_temp.scene_equip_index) @command_window.oy = $game_temp.scene_equip_oy end $game_temp.scene_equip_index = nil $game_temp.scene_equip_oy = nil @command_window.set_handler(:equip, method(:command_equip)) # @command_window.set_handler(:optimize, method(:command_optimize)) @command_window.set_handler(:clear, method(:command_clear)) @command_window.set_handler(:cancel, method(:return_scene)) @command_window.set_handler(:pagedown, method(:next_actor)) @command_window.set_handler(:pageup, method(:prev_actor)) process_custom_equip_commands create_actor_window end #-------------------------------------------------------------------------- # new method: create_actor_window #-------------------------------------------------------------------------- def create_actor_window wy = @help_window.height @actor_window = Window_EquipActor.new(@command_window.width, wy) @actor_window.viewport = @viewport @actor_window.actor = @actor end #-------------------------------------------------------------------------- # new method: process_custom_equip_commands #-------------------------------------------------------------------------- def process_custom_equip_commands for command in YEA::EQUIP::COMMAND_LIST next unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command) called_method = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][3] @command_window.set_handler(command, method(called_method)) end end #-------------------------------------------------------------------------- # overwrite method: create_slot_window #-------------------------------------------------------------------------- def create_slot_window wx = 0 wy = @command_window.y + @command_window.height ww = Graphics.width - @status_window.width @slot_window = Window_EquipSlot.new(wx, wy, ww) @slot_window.viewport = @viewport @slot_window.help_window = @help_window @slot_window.status_window = @status_window @slot_window.actor = @actor @slot_window.set_handler(:ok, method(:on_slot_ok)) @slot_window.set_handler(:cancel, method(:on_slot_cancel)) end #-------------------------------------------------------------------------- # overwrite method: create_item_window #-------------------------------------------------------------------------- def create_item_window wx = @slot_window.x wy = @slot_window.y ww = @slot_window.width wh = @slot_window.height @item_window = Window_EquipItem.new(wx, wy, ww, wh) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.status_window = @status_window @item_window.actor = @actor @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @slot_window.item_window = @item_window @item_window.hide end #-------------------------------------------------------------------------- # alias method: command_optimize #-------------------------------------------------------------------------- # alias scene_equip_command_optimize_aee command_optimize # def command_optimize # scene_equip_command_optimize_aee # @actor_window.refresh # end #-------------------------------------------------------------------------- # alias method: command_clear #-------------------------------------------------------------------------- alias scene_equip_command_clear_aee command_clear def command_clear scene_equip_command_clear_aee @actor_window.refresh end #-------------------------------------------------------------------------- # alias method: on_slot_ok #-------------------------------------------------------------------------- alias scene_equip_on_slot_ok_aee on_slot_ok def on_slot_ok scene_equip_on_slot_ok_aee @slot_window.hide @item_window.refresh @item_window.show end #-------------------------------------------------------------------------- # alias method: on_item_ok #-------------------------------------------------------------------------- alias scene_equip_on_item_ok_aee on_item_ok def on_item_ok scene_equip_on_item_ok_aee @actor_window.refresh @slot_window.show @item_window.hide end #-------------------------------------------------------------------------- # alias method: on_item_cancel #-------------------------------------------------------------------------- alias scene_equip_on_item_cancel_aee on_item_cancel def on_item_cancel scene_equip_on_item_cancel_aee @slot_window.show @item_window.hide end #-------------------------------------------------------------------------- # alias method: on_actor_change #-------------------------------------------------------------------------- alias scene_equip_on_actor_change_aee on_actor_change def on_actor_change scene_equip_on_actor_change_aee @actor_window.actor = @actor end #-------------------------------------------------------------------------- # new method: command_name1 #-------------------------------------------------------------------------- def command_name1 # Do nothing. end #-------------------------------------------------------------------------- # new method: command_name2 #-------------------------------------------------------------------------- def command_name2 # Do nothing. end end # Scene_Equip #============================================================================== # # ▼ End of File # #==============================================================================
#==============================================================================
#
# ▼ Yanfly Engine Ace - 装备系统 v1.06
# -- 最后更新: 2014.05.01
# -- 使用难度: 普通, 困难
# -- 需要脚本: 无
#先获得物品,然后事件脚本
#$game_actors[x].change_equip_by_id(y, z)
#x为数据库角色编号
#y为y号装备槽位置【从0开始】(相对于角色的装备槽)
#z为数据库装备编号
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-AceEquipEngine"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2014.05.01 - Bug Fixed: Refresh Equip Item List when change slot.
# 2012.02.02 - Bug Fixed: Crash when changing classes to different equip slots.
# 2012.01.22 - Bug Fixed: <equip slot> notetags updated to factor in spaces.
# 2012.01.05 - Compatibility Update: Equip Dynamic Stats
# 2011.12.30 - Bug Fixed: Stats didn't update.
# 2011.12.23 - Script efficiency optimized.
# 2011.12.18 - Script efficiency optimized.
# 2011.12.13 - Started Script and Finished.
#
#==============================================================================
# ▼ 介绍
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 默认的装备系统十分基础,本脚本为装备系统添加诸多功能,如指定角色装备类型(包
# 括角色可以拥有多个相同的装备类型)、设定新的装备类型(这里说的装备类型不同于
# 于数据库中的武器类型、护甲类型,可以说装备类型包括武器、防具、饰品等)。
#
#==============================================================================
# ▼ 安装方式
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
# 脚本页/槽中.记得保存你的工程以使脚本生效.
#
# -----------------------------------------------------------------------------
# 角色备注 - 在数据库-角色中可以使用的备注.
# -----------------------------------------------------------------------------
# <装备槽>
# 内容
# 内容
# </装备槽>
# 设定该角色可装备的装备类型,及装备类型的顺序。将"内容"替换为该角色可用的装备
# 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚,
# 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面
# 有讲。
#
# <初始装备: x>
# <初始装备: x, x>
# 设定该角色的初始装备类型,x为装备类型的id。在数据库中没有新装备槽的初始装备设
# 定时可以使用。
#
# <固定装备: x>
# <固定装备: x, x>
# 固定该角色的x号装备类型。
#
# <禁用装备: x>
# <禁用装备: x, x>
# 禁用该角色的x号装备类型。意思是装备无法放置在该装备槽中。
#
# -----------------------------------------------------------------------------
# 职业备注 - 在数据库-职业中可以使用的备注.
# -----------------------------------------------------------------------------
# <装备槽>
# 内容
# 内容
# </装备槽>
# 设定该职业可装备的装备类型,及装备类型的顺序。将"内容"替换为该职业可用的装备
# 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚,
# 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面
# 有讲
#
# <固定装备: x>
# <固定装备: x, x>
# 固定该职业的x号装备类型。
#
# <禁用装备: x>
# <禁用装备: x, x>
# 禁用该职业的x号装备类型。意思是装备无法放置在该装备槽中。
#
# -----------------------------------------------------------------------------
# 武器备注 - 在数据库-武器中可以使用的备注.
# -----------------------------------------------------------------------------
# <固定装备: x>
# <固定装备: x, x>
# 装备该武器后固定x号装备类型。
#
# <禁用装备: x>
# <禁用装备: x, x>
# 装备该武器后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。
#
# -----------------------------------------------------------------------------
# 护甲备注 - 在数据库-护甲中可以使用的备注.
# -----------------------------------------------------------------------------
# <装备类型: x>
# <装备类型: 文本>
# x替换为装备名称(本脚本下面)或装备类型ID,此备注将该护甲归类/视为x号装备类型
#
# <固定装备: x>
# <固定装备: x, x>
# 装备该护甲后固定x号装备类型。
#
# <禁用装备: x>
# <禁用装备: x, x>
# 装备该护甲后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。
#
# -----------------------------------------------------------------------------
# 状态备注 - 在数据库-状态中可以使用的备注.
# -----------------------------------------------------------------------------
# <固定装备: x>
# <固定装备: x, x>
# 获得该状态后固定x号装备类型。(配合脚本"战斗中更换装备")
#
# <禁用装备: x>
# <禁用装备: x, x>
# 获得该状态后禁用x号装备类型。意思是装备无法放置在该装备槽中。(配合脚本"战斗中
# 更换装备")
#
#==============================================================================
# ▼ 兼容性
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
#
#==============================================================================
module YEA
module EQUIP
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - 通用装备设置 -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# 调整默认装备设置,你可以添加新的装备类型,建议不要改得太多,以免出现问题。
# 下面是默认id对应的装备类型
#
# ID 装备类型
# --- ------------
# 0 武器
# 1 盾牌
# 2 头盔
# 3 铠甲
# 4 饰品
#
# 无论你怎么修改以下顺序,武器双持的情况都是不变的:第二个装备类型变为武器(0).
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# 下面这个数组是默认的可用装备槽即其顺序,应用于一切未通过备注自定义装备槽
# 的角色。
DEFAULT_BASE_SLOTS = [0,0,0,0,0,1,2,3,4,5,5,5,5,5,6,7]
# 下面这个哈希表用来添加新的装备类型(id为 4+). 你还可以设定其能否被移除,
# 是否能通过"最强装备"自动选择最强的装备。
TYPES ={
# TypeID => ["类型名称", 能否移除?, 能否使用"最强装备"?],
0 => [ "心灵", true, false],
1 => [ "衣服", true, false],
2 => [ "下装", true, false],
3 => [ "袜子", true, false],
4 => [ "鞋子", true, false],
5 => [ "其它", true, false],
} # 别动这个括号.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - 装备指令列表 -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# 在这里调整装备指令列表(甚至是移除某些指令)下面是指令的解释:
#
# -------------------------------------------------------------------------
# :指令 解释
# -------------------------------------------------------------------------
# :equip 激活装备选择窗口. 默认.
# :optimize 自动为角色选择最强装备. 默认.
# :clear 移除角色身上的全部装备. 默认
#
# 以上为默认的全部可用指令。
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# 在数组中放置可用的指令.
COMMAND_LIST =[
:equip,
# :optimize,
:clear,
# :custom1,
# :custom2,
] # 不要动这个括号.
#--------------------------------------------------------------------------
# - 装备自定义指令 -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# 对于那些希望通过本脚本来为装备场景添加特殊效果的人,可以使用下面的哈希表
# 来管理装备场景中的指令。你可以使用开关来禁用/隐藏指令。如果你不想把指令与
# 开关相关联,把开关设定为0就行。
#--------------------------------------------------------------------------
CUSTOM_EQUIP_COMMANDS ={
# :指令 => [ "文本", 启用开关, 显示开关, 处理方法],
:custom1 => [ "自定义名称", 0, 0, :command_name1],
:custom2 => [ "自定义文本", 0, 0, :command_name2],
} # 不要动这个括号.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - 其他窗口设置 -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# 调整装备窗口的视觉效果.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# 改变右下角能力值数字的字体大小
STATUS_FONT_SIZE = 20
# 在更换装备指令中,移除装备指令的图标和文本设定
REMOVE_EQUIP_ICON = 0
REMOVE_EQUIP_TEXT = "<移除>"
# 装备槽中,无装备的图标和文本.
NOTHING_ICON = 0
NOTHING_TEXT = "<空>"
end # EQUIP
end # YEA
#==============================================================================
# ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
# 所以编辑了后果自负。
#==============================================================================
module YEA
module REGEXP
module BASEITEM
EQUIP_SLOTS_ON = /<(?:EQUIP_SLOTS|装备槽)>/i
EQUIP_SLOTS_OFF = /<\/(?:EQUIP_SLOTS|装备槽)>/i
EQUIP_TYPE_INT = /<(?:EQUIP_TYPE|装备类型):[ ]*(\d+)>/i
EQUIP_TYPE_STR = /<(?:EQUIP_TYPE|装备类型):[ ]*(.*)>/i
STARTING_GEAR = /<(?:STARTING_GEAR|初始装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
FIXED_EQUIP = /<(?:FIXED_EQUIP|固定装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
SEALED_EQUIP = /<(?:SEALED_EQUIP|禁用装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
end # BASEITEM
end # REGEXP
end # YEA
#==============================================================================
# ■ Vocab
#==============================================================================
module Vocab
#--------------------------------------------------------------------------
# overwrite method: self.etype
#--------------------------------------------------------------------------
def self.etype(etype)
return $data_system.terms.etypes[etype] if [0,1,2,3,4].include?(etype)
return YEA::EQUIP::TYPES[etype][0] if YEA::EQUIP::TYPES.include?(etype)
return ""
end
end # Vocab
#==============================================================================
# ■ Icon
#==============================================================================
module Icon
#--------------------------------------------------------------------------
# self.remove_equip
#--------------------------------------------------------------------------
def self.remove_equip; return YEA::EQUIP::REMOVE_EQUIP_ICON; end
#--------------------------------------------------------------------------
# self.nothing_equip
#--------------------------------------------------------------------------
def self.nothing_equip; return YEA::EQUIP::NOTHING_ICON; end
end # Icon
#==============================================================================
# ■ Numeric
#==============================================================================
class Numeric
#--------------------------------------------------------------------------
# new method: group_digits
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
def group; return self.to_s; end
end # $imported["YEA-CoreEngine"]
end # Numeric
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_aee load_database; end
def self.load_database
load_database_aee
load_notetags_aee
end
#--------------------------------------------------------------------------
# new method: load_notetags_aee
#--------------------------------------------------------------------------
def self.load_notetags_aee
groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
$data_states]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_aee
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :base_equip_slots
attr_accessor :fixed_equip_type
attr_accessor :sealed_equip_type
attr_accessor :extra_starting_equips
#--------------------------------------------------------------------------
# common cache: load_notetags_aee
#--------------------------------------------------------------------------
def load_notetags_aee
@base_equip_slots = []
@equip_slots_on = false
@fixed_equip_type = []
@sealed_equip_type = []
@extra_starting_equips = []
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_ON
next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
@equip_slots_on = true
when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_OFF
next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
@equip_slots_on = false
#---
when YEA::REGEXP::BASEITEM::STARTING_GEAR
next unless self.is_a?(RPG::Actor)
$1.scan(/\d+/).each { |num|
@extra_starting_equips.push(num.to_i) if num.to_i > 0 }
when YEA::REGEXP::BASEITEM::FIXED_EQUIP
$1.scan(/\d+/).each { |num|
@fixed_equip_type.push(num.to_i) if num.to_i > 0 }
when YEA::REGEXP::BASEITEM::SEALED_EQUIP
$1.scan(/\d+/).each { |num|
@sealed_equip_type.push(num.to_i) if num.to_i > 0 }
#---
when YEA::REGEXP::BASEITEM::EQUIP_TYPE_INT
next unless self.is_a?(RPG::Armor)
@etype_id = [1, $1.to_i].max
when YEA::REGEXP::BASEITEM::EQUIP_TYPE_STR
next unless self.is_a?(RPG::Armor)
for key in YEA::EQUIP::TYPES
id = key[0]
next if YEA::EQUIP::TYPES[id][0].upcase != $1.to_s.upcase
@etype_id = [1, id].max
break
end
#---
else
if @equip_slots_on
case line.upcase
when /装备类型[ ](\d+)/i, /装备类型:[ ](\d+)/i
id = $1.to_i
@base_equip_slots.push(id) if [0,1,2,3,4].include?(id)
@base_equip_slots.push(id) if YEA::EQUIP::TYPES.include?(id)
when /WEAPON/i
@base_equip_slots.push(0)
when /SHIELD/i
@base_equip_slots.push(1)
when /HEAD/i
@base_equip_slots.push(2)
when /BODY/i, /ARMOR/i, /ARMOUR/i
@base_equip_slots.push(3)
when /ETC/i, /OTHER/i, /ACCESSOR/i
@base_equip_slots.push(4)
else
text = line.upcase.delete(" ")
for key in YEA::EQUIP::TYPES
id = key[0]
next if YEA::EQUIP::TYPES[id][0].upcase.delete(" ")!= text
@base_equip_slots.push(id)
break
end
end
end
end
} # self.note.split
#---
return unless self.is_a?(RPG::Class)
if @base_equip_slots.empty?
@base_equip_slots = YEA::EQUIP::DEFAULT_BASE_SLOTS.clone
end
end
end # RPG::BaseItem
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :eds_actor
attr_accessor :scene_equip_index
attr_accessor :scene_equip_oy
end # Game_Temp
#==============================================================================
# ■ Game_BaseItem
#==============================================================================
class Game_BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :item_id
end # Game_BaseItem
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: equip_type_fixed?
#--------------------------------------------------------------------------
alias game_battlerbase_equip_type_fixed_aee equip_type_fixed?
def equip_type_fixed?(etype_id)
return true if fixed_etypes.include?(etype_id) if actor?
return game_battlerbase_equip_type_fixed_aee(etype_id)
end
#--------------------------------------------------------------------------
# alias method: equip_type_sealed?
#--------------------------------------------------------------------------
alias game_battlerbase_equip_type_sealed_aee equip_type_sealed?
def equip_type_sealed?(etype_id)
return true if sealed_etypes.include?(etype_id) if actor?
return game_battlerbase_equip_type_sealed_aee(etype_id)
end
end # Game_BattlerBase
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# alias method: init_equips
#--------------------------------------------------------------------------
alias game_actor_init_equips_aee init_equips
def init_equips(equips)
game_actor_init_equips_aee(equips)
equip_extra_starting_equips
end
#--------------------------------------------------------------------------
# new method: equip_extra_starting_equips
#--------------------------------------------------------------------------
def equip_extra_starting_equips
for equip_id in actor.extra_starting_equips
armour = $data_armors[equip_id]
next if armour.nil?
etype_id = armour.etype_id
next unless equip_slots.include?(etype_id)
slot_id = empty_slot(etype_id)
@equips[slot_id].set_equip(etype_id == 0, armour.id)
end
refresh
end
#--------------------------------------------------------------------------
# overwrite method: equip_slots
#--------------------------------------------------------------------------
def equip_slots
return equip_slots_dual if dual_wield?
return equip_slots_normal
end
#--------------------------------------------------------------------------
# new method: equip_slots_normal
#--------------------------------------------------------------------------
def equip_slots_normal
return self.actor.base_equip_slots if self.actor.base_equip_slots != []
return self.class.base_equip_slots
end
#--------------------------------------------------------------------------
# new method: equip_slots_dual
#--------------------------------------------------------------------------
def equip_slots_dual
array = equip_slots_normal.clone
array[1] = 0 if array.size >= 2
return array
end
#--------------------------------------------------------------------------
# new method: fixed_etypes
#--------------------------------------------------------------------------
def fixed_etypes
array = []
array |= self.actor.fixed_equip_type
array |= self.class.fixed_equip_type
for equip in equips
next if equip.nil?
array |= equip.fixed_equip_type
end
for state in states
next if state.nil?
array |= state.fixed_equip_type
end
return array
end
#--------------------------------------------------------------------------
# new method: sealed_etypes
#--------------------------------------------------------------------------
def sealed_etypes
array = []
array |= self.actor.sealed_equip_type
array |= self.class.sealed_equip_type
for equip in equips
next if equip.nil?
array |= equip.sealed_equip_type
end
for state in states
next if state.nil?
array |= state.sealed_equip_type
end
return array
end
#--------------------------------------------------------------------------
# alias method: change_equip
#--------------------------------------------------------------------------
alias game_actor_change_equip_aee change_equip
def change_equip(slot_id, item)
if item.nil? && !@optimize_clear
etype_id = equip_slots[slot_id]
return unless YEA::EQUIP::TYPES[etype_id][1]
elsif item.nil? && @optimize_clear
etype_id = equip_slots[slot_id]
return unless YEA::EQUIP::TYPES[etype_id][2]
end
@equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
game_actor_change_equip_aee(slot_id, item)
end
#--------------------------------------------------------------------------
# overwrite method: optimize_equipments
#--------------------------------------------------------------------------
def optimize_equipments
$game_temp.eds_actor = self
@optimize_clear = true
clear_equipments
@optimize_clear = false
equip_slots.size.times do |i|
next if !equip_change_ok?(i)
next unless can_optimize?(i)
items = $game_party.equip_items.select do |item|
item.etype_id == equip_slots[i] &&
equippable?(item) && item.performance >= 0
end
change_equip(i, items.max_by {|item| item.performance })
end
$game_temp.eds_actor = nil
end
#--------------------------------------------------------------------------
# new method: can_optimize?
#--------------------------------------------------------------------------
def can_optimize?(slot_id)
etype_id = equip_slots[slot_id]
return YEA::EQUIP::TYPES[etype_id][2]
end
#--------------------------------------------------------------------------
# alias method: force_change_equip
#--------------------------------------------------------------------------
alias game_actor_force_change_equip_aee force_change_equip
def force_change_equip(slot_id, item)
@equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
game_actor_force_change_equip_aee(slot_id, item)
end
#--------------------------------------------------------------------------
# alias method: weapons
#--------------------------------------------------------------------------
alias game_actor_weapons_aee weapons
def weapons
anti_crash_equips
return game_actor_weapons_aee
end
#--------------------------------------------------------------------------
# alias method: armors
#--------------------------------------------------------------------------
alias game_actor_armors_aee armors
def armors
anti_crash_equips
return game_actor_armors_aee
end
#--------------------------------------------------------------------------
# alias method: equips
#--------------------------------------------------------------------------
alias game_actor_equips_aee equips
def equips
anti_crash_equips
return game_actor_equips_aee
end
#--------------------------------------------------------------------------
# new method: equips
#--------------------------------------------------------------------------
def anti_crash_equips
for i in 0...@equips.size
next unless @equips[i].nil?
@equips[i] = Game_BaseItem.new
end
end
end # Game_Actor
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# overwrite method: change equip
#--------------------------------------------------------------------------
def command_319
actor = $game_actors[@params[0]]
return if actor.nil?
if @params[1] == 0 && @params[2] != 0
item = $data_weapons[@params[2]]
return unless actor.equip_slots.include?(0)
slot_id = actor.empty_slot(0)
elsif @params[2] != 0
item = $data_armors[@params[2]]
return unless actor.equip_slots.include?(item.etype_id)
slot_id = actor.empty_slot(item.etype_id)
else
slot_id = @params[1]
end
actor.change_equip_by_id(slot_id, @params[2])
end
end # Game_Interpreter
#==============================================================================
# ■ Window_EquipStatus
#==============================================================================
class Window_EquipStatus < Window_Base
#--------------------------------------------------------------------------
# overwrite method: initialize
#--------------------------------------------------------------------------
def initialize(dx, dy)
super(dx, dy, window_width, Graphics.height - dy)
@actor = nil
@temp_actor = nil
refresh
end
#--------------------------------------------------------------------------
# overwrite method: window_width
#--------------------------------------------------------------------------
def window_width; return Graphics.width * 2 / 5; end
#--------------------------------------------------------------------------
# overwrite method: refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
8.times {|i| draw_item(0, line_height * i, i) }
end
#--------------------------------------------------------------------------
# overwrite method: draw_item
#--------------------------------------------------------------------------
def draw_item(dx, dy, param_id)
draw_background_colour(dx, dy)
draw_param_name(dx + 4, dy, param_id)
draw_current_param(dx + 4, dy, param_id) if @actor
drx = (contents.width + 22) / 2
draw_right_arrow(drx, dy)
draw_new_param(drx + 22, dy, param_id) if @temp_actor
reset_font_settings
end
#--------------------------------------------------------------------------
# new method: draw_background_colour
#--------------------------------------------------------------------------
def draw_background_colour(dx, dy)
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(dx+1, dy+1, contents.width - 2, line_height - 2)
contents.fill_rect(rect, colour)
end
#--------------------------------------------------------------------------
# overwrite method: draw_param_name
#--------------------------------------------------------------------------
def draw_param_name(dx, dy, param_id)
contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
change_color(system_color)
draw_text(dx, dy, contents.width, line_height, Vocab::param(param_id))
end
#--------------------------------------------------------------------------
# overwrite method: draw_current_param
#--------------------------------------------------------------------------
def draw_current_param(dx, dy, param_id)
change_color(normal_color)
dw = (contents.width + 22) / 2
draw_text(0, dy, dw, line_height, @actor.param(param_id).group, 2)
reset_font_settings
end
#--------------------------------------------------------------------------
# overwrite method: draw_new_param
#--------------------------------------------------------------------------
def draw_new_param(dx, dy, param_id)
contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
new_value = @temp_actor.param(param_id)
change_color(param_change_color(new_value - @actor.param(param_id)))
draw_text(0, dy, contents.width-4, line_height, new_value.group, 2)
reset_font_settings
end
end # Window_EquipStatus
#==============================================================================
# ■ Window_EquipCommand
#==============================================================================
class Window_EquipCommand < Window_HorzCommand
#--------------------------------------------------------------------------
# overwrite method: make_command_list
#--------------------------------------------------------------------------
def make_command_list
for command in YEA::EQUIP::COMMAND_LIST
case command
when :equip
add_command(Vocab::equip2, :equip)
# when :optimize
# add_command(Vocab::optimize, :optimize)
when :clear
add_command(Vocab::clear, :clear)
else
process_custom_command(command)
end
end
end
#--------------------------------------------------------------------------
# process_ok
#--------------------------------------------------------------------------
def process_ok
$game_temp.scene_equip_index = index
$game_temp.scene_equip_oy = self.oy
super
end
#--------------------------------------------------------------------------
# new method: process_custom_command
#--------------------------------------------------------------------------
def process_custom_command(command)
return unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
show = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][2]
continue = show <= 0 ? true : $game_switches[show]
return unless continue
text = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][0]
switch = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][1]
enabled = switch <= 0 ? true : $game_switches[switch]
add_command(text, command, enabled)
end
#--------------------------------------------------------------------------
# overwrite method: window_width
#--------------------------------------------------------------------------
def window_width; return 160; end
#--------------------------------------------------------------------------
# overwrite method: contents_width
#--------------------------------------------------------------------------
def contents_width; return width - standard_padding * 2; end
#--------------------------------------------------------------------------
# overwrite method: contents_height
#--------------------------------------------------------------------------
def contents_height
ch = height - standard_padding * 2
return [ch - ch % item_height, row_max * item_height].max
end
#--------------------------------------------------------------------------
# overwrite method: visible_line_number
#--------------------------------------------------------------------------
def visible_line_number; return 4; end
#--------------------------------------------------------------------------
# overwrite method: col_max
#--------------------------------------------------------------------------
def col_max; return 1; end
#--------------------------------------------------------------------------
# overwrite method: item_rect
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * item_height
rect
end
#--------------------------------------------------------------------------
# overwrite method: ensure_cursor_visible
#--------------------------------------------------------------------------
def ensure_cursor_visible
self.top_row = row if row < top_row
self.bottom_row = row if row > bottom_row
end
#--------------------------------------------------------------------------
# overwrite method: cursor_down
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
if index < item_max - col_max || (wrap && col_max == 1)
select((index + col_max) % item_max)
end
end
#--------------------------------------------------------------------------
# overwrite method: cursor_up
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
if index >= col_max || (wrap && col_max == 1)
select((index - col_max + item_max) % item_max)
end
end
#--------------------------------------------------------------------------
# overwrite method: process_pageup
#--------------------------------------------------------------------------
def process_pageup
Sound.play_cursor
Input.update
deactivate
call_handler(:pageup)
end
#--------------------------------------------------------------------------
# overwrite method: process_pagedown
#--------------------------------------------------------------------------
def process_pagedown
Sound.play_cursor
Input.update
deactivate
call_handler(:pagedown)
end
end # Window_EquipCommand
#==============================================================================
# ■ Window_EquipSlot
#==============================================================================
class Window_EquipSlot < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: initialize
#--------------------------------------------------------------------------
def initialize(dx, dy, dw)
super(dx, dy, dw, Graphics.height - dy)
@actor = nil
refresh
end
#--------------------------------------------------------------------------
# overwrite method: window_height
#--------------------------------------------------------------------------
def window_height; return self.height; end
#--------------------------------------------------------------------------
# overwrite method: visible_line_number
#--------------------------------------------------------------------------
def visible_line_number; return item_max; end
#--------------------------------------------------------------------------
# overwrite method: refresh
#--------------------------------------------------------------------------
def refresh
create_contents
super
end
#--------------------------------------------------------------------------
# overwrite method: draw_item
#--------------------------------------------------------------------------
def draw_item(index)
return unless @actor
rect = item_rect_for_text(index)
change_color(system_color, enable?(index))
draw_text(rect.x, rect.y, 92, line_height, slot_name(index))
item = @actor.equips[index]
dx = rect.x + 92
dw = contents.width - dx - 24
if item.nil?
draw_nothing_equip(dx, rect.y, false, dw)
else
draw_item_name(item, dx, rect.y, enable?(index), dw)
end
end
#--------------------------------------------------------------------------
# new method: draw_nothing_equip
#--------------------------------------------------------------------------
def draw_nothing_equip(dx, dy, enabled, dw)
change_color(normal_color, enabled)
draw_icon(Icon.nothing_equip, dx, dy, enabled)
text = YEA::EQUIP::NOTHING_TEXT
draw_text(dx + 24, dy, dw - 24, line_height, text)
end
end # Window_EquipSlot
#==============================================================================
# ■ Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_ItemList
#--------------------------------------------------------------------------
# overwrite method: col_max
#--------------------------------------------------------------------------
def col_max; return 1; end
#--------------------------------------------------------------------------
# overwrite method: slot_id=
#--------------------------------------------------------------------------
def slot_id=(slot_id)
return if @slot_id == slot_id
@slot_id = slot_id
@last_item = nil
self.oy = 0
refresh
end
#--------------------------------------------------------------------------
# overwrite method: draw_item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
rect = item_rect(index)
rect.width -= 4
if item.nil?
draw_remove_equip(rect)
return
end
dw = contents.width - rect.x - 24
draw_item_name(item, rect.x, rect.y, enable?(item), dw)
draw_item_number(rect, item)
end
#--------------------------------------------------------------------------
# new method: draw_remove_equip
#--------------------------------------------------------------------------
def draw_remove_equip(rect)
draw_icon(Icon.remove_equip, rect.x, rect.y)
text = YEA::EQUIP::REMOVE_EQUIP_TEXT
rect.x += 24
rect.width -= 24
draw_text(rect, text)
end
#--------------------------------------------------------------------------
# overwrite method: include?
#--------------------------------------------------------------------------
def include?(item)
if item.nil? && !@actor.nil?
etype_id = @actor.equip_slots[@slot_id]
return YEA::EQUIP::TYPES[etype_id][1]
end
return true if item.nil?
return false unless item.is_a?(RPG::EquipItem)
return false if @slot_id < 0
return false if item.etype_id != @actor.equip_slots[@slot_id]
return @actor.equippable?(item)
end
#--------------------------------------------------------------------------
# overwrite method: enable?
#--------------------------------------------------------------------------
def enable?(item)
if item.nil? && !@actor.nil?
etype_id = @actor.equip_slots[@slot_id]
return YEA::EQUIP::TYPES[etype_id][1]
end
return @actor.equippable?(item)
end
#--------------------------------------------------------------------------
# new method: show
#--------------------------------------------------------------------------
def show
@last_item = 0
update_help
super
end
#--------------------------------------------------------------------------
# overwrite method: update_help
#--------------------------------------------------------------------------
def update_help
super
return if @actor.nil?
return if @status_window.nil?
return if @last_item == item
@last_item = item
temp_actor = Marshal.load(Marshal.dump(@actor))
temp_actor.force_change_equip(@slot_id, item)
@status_window.set_temp_actor(temp_actor)
end
end # Window_EquipItem
#==============================================================================
# ■ Window_EquipActor
#==============================================================================
class Window_EquipActor < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(dx, dy)
super(dx, dy, window_width, fitting_height(4))
@actor = nil
end
#--------------------------------------------------------------------------
# window_width
#--------------------------------------------------------------------------
def window_width; return Graphics.width - 160; end
#--------------------------------------------------------------------------
# actor=
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
return unless @actor
draw_actor_face(@actor, 0, 0)
draw_actor_simple_status(@actor, 108, line_height / 2)
end
end # Window_EquipActor
#==============================================================================
# ■ Scene_Equip
#==============================================================================
class Scene_Equip < Scene_MenuBase
#--------------------------------------------------------------------------
# overwrite method: create_status_window
#--------------------------------------------------------------------------
def create_status_window
wx = Graphics.width - (Graphics.width * 2 / 5)
wy = @help_window.height + 120
@status_window = Window_EquipStatus.new(wx, wy)
@status_window.viewport = @viewport
@status_window.actor = @actor
end
#--------------------------------------------------------------------------
# overwrite method: create_command_window
#--------------------------------------------------------------------------
def create_command_window
wx = 0
wy = @help_window.height
ww = 160
@command_window = Window_EquipCommand.new(wx, wy, ww)
@command_window.viewport = @viewport
@command_window.help_window = @help_window
if !$game_temp.scene_equip_index.nil?
@command_window.select($game_temp.scene_equip_index)
@command_window.oy = $game_temp.scene_equip_oy
end
$game_temp.scene_equip_index = nil
$game_temp.scene_equip_oy = nil
@command_window.set_handler(:equip, method(:command_equip))
# @command_window.set_handler(:optimize, method(:command_optimize))
@command_window.set_handler(:clear, method(:command_clear))
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:pagedown, method(:next_actor))
@command_window.set_handler(:pageup, method(:prev_actor))
process_custom_equip_commands
create_actor_window
end
#--------------------------------------------------------------------------
# new method: create_actor_window
#--------------------------------------------------------------------------
def create_actor_window
wy = @help_window.height
@actor_window = Window_EquipActor.new(@command_window.width, wy)
@actor_window.viewport = @viewport
@actor_window.actor = @actor
end
#--------------------------------------------------------------------------
# new method: process_custom_equip_commands
#--------------------------------------------------------------------------
def process_custom_equip_commands
for command in YEA::EQUIP::COMMAND_LIST
next unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
called_method = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][3]
@command_window.set_handler(command, method(called_method))
end
end
#--------------------------------------------------------------------------
# overwrite method: create_slot_window
#--------------------------------------------------------------------------
def create_slot_window
wx = 0
wy = @command_window.y + @command_window.height
ww = Graphics.width - @status_window.width
@slot_window = Window_EquipSlot.new(wx, wy, ww)
@slot_window.viewport = @viewport
@slot_window.help_window = @help_window
@slot_window.status_window = @status_window
@slot_window.actor = @actor
@slot_window.set_handler(:ok, method(:on_slot_ok))
@slot_window.set_handler(:cancel, method(:on_slot_cancel))
end
#--------------------------------------------------------------------------
# overwrite method: create_item_window
#--------------------------------------------------------------------------
def create_item_window
wx = @slot_window.x
wy = @slot_window.y
ww = @slot_window.width
wh = @slot_window.height
@item_window = Window_EquipItem.new(wx, wy, ww, wh)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.status_window = @status_window
@item_window.actor = @actor
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@slot_window.item_window = @item_window
@item_window.hide
end
#--------------------------------------------------------------------------
# alias method: command_optimize
#--------------------------------------------------------------------------
# alias scene_equip_command_optimize_aee command_optimize
# def command_optimize
# scene_equip_command_optimize_aee
# @actor_window.refresh
# end
#--------------------------------------------------------------------------
# alias method: command_clear
#--------------------------------------------------------------------------
alias scene_equip_command_clear_aee command_clear
def command_clear
scene_equip_command_clear_aee
@actor_window.refresh
end
#--------------------------------------------------------------------------
# alias method: on_slot_ok
#--------------------------------------------------------------------------
alias scene_equip_on_slot_ok_aee on_slot_ok
def on_slot_ok
scene_equip_on_slot_ok_aee
@slot_window.hide
@item_window.refresh
@item_window.show
end
#--------------------------------------------------------------------------
# alias method: on_item_ok
#--------------------------------------------------------------------------
alias scene_equip_on_item_ok_aee on_item_ok
def on_item_ok
scene_equip_on_item_ok_aee
@actor_window.refresh
@slot_window.show
@item_window.hide
end
#--------------------------------------------------------------------------
# alias method: on_item_cancel
#--------------------------------------------------------------------------
alias scene_equip_on_item_cancel_aee on_item_cancel
def on_item_cancel
scene_equip_on_item_cancel_aee
@slot_window.show
@item_window.hide
end
#--------------------------------------------------------------------------
# alias method: on_actor_change
#--------------------------------------------------------------------------
alias scene_equip_on_actor_change_aee on_actor_change
def on_actor_change
scene_equip_on_actor_change_aee
@actor_window.actor = @actor
end
#--------------------------------------------------------------------------
# new method: command_name1
#--------------------------------------------------------------------------
def command_name1
# Do nothing.
end
#--------------------------------------------------------------------------
# new method: command_name2
#--------------------------------------------------------------------------
def command_name2
# Do nothing.
end
end # Scene_Equip
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
这是显示伤害的脚本:
#============================================================================== # +++ MOG - 伤害显示 (v4.5) +++ #============================================================================== # By Moghunter # [url]https://atelierrgss.wordpress.com/[/url] #============================================================================== # 用图片显示伤害数字. #============================================================================== # 需要以下图片 # # Critical # Evaded # Exp # Gold # Level Up # Missed # MP # Number # TP # # 全部放在 /GRAPHICS/DAMAGE/ #============================================================================== #============================================================================== # 行走图上显示伤害数字 (事件) #============================================================================== # 如果你想要在地图上或战斗中手动显示伤害数字,使用以下脚本: # # damage_popup(目标ID,数值,"类型") # # 目标ID # 1...999 - 地图上的事件ID # 0 - 玩家 # -1...-3 - 队友 # # 数值 # 显示伤害的数值(可以是负值)或文本.当类型为"States"时为状态的ID,不能为负值 # # 类型 (可选) # "Exp" - 显示EXP. # "Gold" - 显示金币. # "States" - 显示状态图标. # #============================================================================== # # damage_popup(1,999) # damage_popup(4,"存档点.") # damage_popup(0,"我饿了!!!") <- 玩家 # damage_popup(-1,"Booo!") <- 1号队友(离玩家最近的队友,不是ID=1的队友) # damage_popup(0,2000,"Exp") <- 显示 2000 Exp # damage_popup(0,5000,"Gold") <- 显示 5000 金币 # #============================================================================== # 使用以下脚本来在全部队友的头顶显示伤害数字.: # # damage_popup_party(目标ID,数值,"类型") # #============================================================================== # 地图上显示/不显示伤害数字. #============================================================================== # 使用以下脚本来在地图上显示/不显示伤害数字: # # damage_popup_map(true) -> 或 (false) # #============================================================================== # ● Histórico (Version History) #============================================================================== # v 4.5 - Correção de ativar o dano quando o alvo é morto e o dano é zero. #============================================================================== $imported = {} if $imported.nil? $imported[:mog_damage_popup] = true module MOG_DAMAGEPOPUP #是否允许在地图上显示伤害数字. (默认) DAMAGE_POPUP_MAP = false #是否在获得物品时显示该物品图标. (仅在地图上). ITEM_POPUP_MAP = false #是否允许在敌人身上显示EXP和金币. EXP_GOLD_POPUP_BATTLE = false EXP_GOLD_POPUP_MAP = false #是否显示升级 LEVEL_POPUP_BATTLE = false LEVEL_POPUP_MAP = false #是否显示状态图标 STATES_POPUP_BATTLE = true STATES_POPUP_MAP = true #设定字体 (物品名/状态名/ etc...). FONT_SIZE = 28 FONT_BOLD = true FONT_ITALIC = false FONT_COLOR = Color.new(255,255,255) FONT_COLOR_ITEM = Color.new(255,255,255) FONT_COLOR_STATUS_PLUS = Color.new(155,155,255) FONT_COLOR_STATUS_MINUS = Color.new(255,150,150) #每条伤害间的距离(竖直距离). Y_SPACE = 28 #伤害数字的Z坐标 DAMAGE_Z = 151 end #============================================================================== # ■ Game_System #============================================================================== class Game_System attr_accessor :damage_popup_map #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_damage_popup_initialize initialize def initialize @damage_popup_map = MOG_DAMAGEPOPUP::DAMAGE_POPUP_MAP mog_damage_popup_initialize end #-------------------------------------------------------------------------- # ● Damage Popup Clear #-------------------------------------------------------------------------- def damage_popup_clear $game_party.character_members.each {|t| t.actor.damage.clear; t.actor.skip_dmg_popup = false ; t.damage.clear; t.skip_dmg_popup = false} rescue nil $game_map.events.values.each {|t| t.damage.clear ; t.skip_dmg_popup = false} rescue nil end end #============================================================================== # ■ Game Temp #============================================================================== class Game_Temp attr_accessor :battle_end #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_damage_temp_opup_initialize initialize def initialize @battle_end = false mog_damage_temp_opup_initialize end #-------------------------------------------------------------------------- # ● Sprite Visible #-------------------------------------------------------------------------- def sprite_visible return false if $game_message.visible return false if $game_temp.battle_end return true end end #============================================================================== # ■ Game CharacterBase #============================================================================== class Game_CharacterBase attr_accessor :damage ,:battler ,:skip_dmg_popup #-------------------------------------------------------------------------- # ● Ini Public Members #-------------------------------------------------------------------------- alias mog_damage_popup_init_public_members init_public_members def init_public_members @damage = [] ; @skip_dmg_popup = false mog_damage_popup_init_public_members end #-------------------------------------------------------------------------- # ● Damage Popup #-------------------------------------------------------------------------- def damage_popup(value,type = "String") @damage.push([value,type]) end end #============================================================================== # ■ Scene Map #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ● Start #-------------------------------------------------------------------------- alias mog_damage_popup_start start def start $game_system.damage_popup_clear ; $game_temp.battle_end = false mog_damage_popup_start end end #============================================================================== # ■ Game Player #============================================================================== class Game_Player < Game_Character #-------------------------------------------------------------------------- # ● Battler #-------------------------------------------------------------------------- def battler actor end end #============================================================================== # ■ Game Follower #============================================================================== class Game_Follower < Game_Character #-------------------------------------------------------------------------- # ● Battler #-------------------------------------------------------------------------- def battler actor end end #============================================================================== # ■ Game_BattlerBase #============================================================================== class Game_BattlerBase #-------------------------------------------------------------------------- # ● Change HP #-------------------------------------------------------------------------- alias mog_damage_popup_change_hp change_hp def change_hp(value, enable_death) mog_damage_popup_change_hp(value, enable_death) self.damage.push([-value,"Hp"]) end end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler < Game_BattlerBase include MOG_DAMAGEPOPUP attr_accessor :damage , :skip_dmg_popup #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_damage_sprite_initialize initialize def initialize @damage = [] ; @skip_dmg_popup = false mog_damage_sprite_initialize end #-------------------------------------------------------------------------- # ● Item Apply #-------------------------------------------------------------------------- alias mog_damage_pop_item_apply item_apply def item_apply(user, item) mog_damage_pop_item_apply(user, item) execute_damage_popup(user,item) end #-------------------------------------------------------------------------- # ● Execute Damage Popup #-------------------------------------------------------------------------- def execute_damage_popup(user,item) if !@result.missed and !@result.evaded and @result.hit? self.damage.push([@result.hp_damage,"HP",@result.critical]) if item.damage.to_hp? or @result.hp_damage != 0 user.damage.push([-@result.hp_drain,"HP",@result.critical]) if item.damage.type == 5 self.damage.push([@result.mp_damage,"MP",@result.critical]) if item.damage.to_mp? or @result.mp_damage != 0 user.damage.push([-@result.mp_drain,"MP",@result.critical]) if item.damage.type == 6 self.damage.push([@result.tp_damage,"TP",@result.critical]) if @result.tp_damage != 0 elsif !self.dead? if @result.missed ; self.damage.push(["Missed","Missed"]) elsif @result.evaded ; self.damage.push(["Evaded","Evaded"]) end end end #-------------------------------------------------------------------------- # ● Regenerate HP #-------------------------------------------------------------------------- alias mog_damage_pop_regenerate_hp regenerate_hp def regenerate_hp mog_damage_pop_regenerate_hp self.damage.push(["Regenerate",""]) if @result.hp_damage < 0 self.damage.push([@result.hp_damage,"HP"]) if @result.hp_damage != 0 end #-------------------------------------------------------------------------- # ● Regenerate MP #-------------------------------------------------------------------------- alias mog_damage_pop_regenerate_mp regenerate_mp def regenerate_mp mog_damage_pop_regenerate_mp self.damage.push([@result.mp_damage,"MP"]) if @result.mp_damage != 0 end #-------------------------------------------------------------------------- # ● Regenerate TP #-------------------------------------------------------------------------- alias mog_damage_pop_regenerate_tp regenerate_tp def regenerate_tp mog_damage_pop_regenerate_tp tp_damage = 100 * trg self.damage.push([tp_damage,"TP"]) if tp_damage != 0 end #-------------------------------------------------------------------------- # ● Added New State #-------------------------------------------------------------------------- alias mog_damage_pop_add_new_state add_new_state def add_new_state(state_id) mog_damage_pop_add_new_state(state_id) execute_popup_add_new_state(state_id) end #-------------------------------------------------------------------------- # ● Execute Popup Add New State #-------------------------------------------------------------------------- def execute_popup_add_new_state(state_id) st = $data_states[state_id] if self.hp > 0 unless (SceneManager.scene_is?(Scene_Battle) and !STATES_POPUP_BATTLE) or (SceneManager.scene_is?(Scene_Map) and !STATES_POPUP_MAP) self.damage.push([st.name.to_s,"States Plus",false,st.icon_index]) end end end #-------------------------------------------------------------------------- # ● Remove State #-------------------------------------------------------------------------- alias mog_damage_pop_remove_state remove_state def remove_state(state_id) execute_popup_remove_state(state_id) mog_damage_pop_remove_state(state_id) end #-------------------------------------------------------------------------- # ● Execute Popup Remove State #-------------------------------------------------------------------------- def execute_popup_remove_state(state_id) if state?(state_id) and self.hp > 0 st = $data_states[state_id] unless (SceneManager.scene_is?(Scene_Battle) and !STATES_POPUP_BATTLE) or (SceneManager.scene_is?(Scene_Map) and !STATES_POPUP_MAP) self.damage.push([st.name.to_s,"States Minus",false,st.icon_index]) unless BattleManager.escape? end end end end #============================================================================== # ■ BattleManager #============================================================================== module BattleManager #-------------------------------------------------------------------------- # ● Escape? #-------------------------------------------------------------------------- def self.escape? @phase == nil end end #============================================================================== # ■ Game_Temp #============================================================================== class Game_Temp attr_accessor :dmg_battle_mode #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_damage_popup_initialize initialize def initialize @dmg_battle_mode = false mog_damage_popup_initialize end end #============================================================================== # ■ Scene Battle #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● Start #-------------------------------------------------------------------------- alias mog_damage_popup_start start def start $game_temp.dmg_battle_mode = true mog_damage_popup_start end #-------------------------------------------------------------------------- # ● Terminate #-------------------------------------------------------------------------- alias mog_damage_popup_terminate terminate def terminate mog_damage_popup_terminate $game_temp.dmg_battle_mode = false end end #============================================================================== # ■ Game Party #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ● Character Members #-------------------------------------------------------------------------- def character_members char_m = [] ; char_m.push($game_player) $game_player.followers.each do |f| char_m.push(f) end return char_m end #-------------------------------------------------------------------------- # ● Gain Gold #-------------------------------------------------------------------------- alias mog_damage_popup_gain_gold gain_gold def gain_gold(amount) mog_damage_popup_gain_gold(amount) $game_party.members[0].damage.push([amount,"Gold"]) if can_damage_popup_gold? end #-------------------------------------------------------------------------- # ● Can Damage Popup Gold #-------------------------------------------------------------------------- def can_damage_popup_gold? return false if !SceneManager.scene_is?(Scene_Map) return false if $game_temp.dmg_battle_mode return false if !MOG_DAMAGEPOPUP::EXP_GOLD_POPUP_MAP return false if !$game_system.damage_popup_map return false if !$game_party.members[0] return true end #-------------------------------------------------------------------------- # ● Gain Item #-------------------------------------------------------------------------- alias mog_damage_popup_gain_item gain_item def gain_item(item, amount, include_equip = false) mog_damage_popup_gain_item(item, amount, include_equip) execute_item_popup(item) if can_damage_popup_item?(item) end #-------------------------------------------------------------------------- # ● Can Damage Poupup Item #-------------------------------------------------------------------------- def can_damage_popup_item?(item) return false if item == nil return false if !MOG_DAMAGEPOPUP::ITEM_POPUP_MAP return false if !$game_system.damage_popup_map return false if SceneManager.scene_is?(Scene_Battle) return false if !$game_party.members[0] return false if $game_temp.dmg_battle_mode return true end #-------------------------------------------------------------------------- # ● Execute Item Popup #-------------------------------------------------------------------------- def execute_item_popup(item) it = $data_items[item.id] if item.is_a?(RPG::Item) it = $data_weapons[item.id] if item.is_a?(RPG::Weapon) it = $data_armors[item.id] if item.is_a?(RPG::Armor) $game_party.members[0].damage.push([it.name.to_s,"Item",false,it.icon_index]) end end #============================================================================== # ■ Game Interpreter #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ● Damage Popup Map #-------------------------------------------------------------------------- def damage_popup_map(value) $game_system.damage_popup_map = value end #-------------------------------------------------------------------------- # ● Damage Popup #-------------------------------------------------------------------------- def damage_popup(target_id, value,type = "") return if !$game_system.damage_popup_map target = set_target_dmg(target_id) rescue nil target.damage.push([value,type]) if target end #-------------------------------------------------------------------------- # ● Set Target Dmg #-------------------------------------------------------------------------- def set_target_dmg(target) return $game_player.battler if target == 0 return $game_player.followers.battler[(target_id + 1).abs] if target < 0 $game_map.events.values.each do |event| return event.battler if event.id == target_id and event.battler return event if event.id == target_id end end #-------------------------------------------------------------------------- # * Change MP #-------------------------------------------------------------------------- alias mog_damage_popup_command_312 command_312 def command_312 value = operate_value(@params[2], @params[3], @params[4]) iterate_actor_var(@params[0], @params[1]) do |actor| actor.damage.push([-value,"MP"]) end mog_damage_popup_command_312 end end #============================================================================== # ■ Game Actor #============================================================================== class Game_Actor < Game_Battler include MOG_DAMAGEPOPUP #-------------------------------------------------------------------------- # ● Level UP #-------------------------------------------------------------------------- alias mog_damage_pop_level_up level_up def level_up mog_damage_pop_level_up execute_level_popup end #-------------------------------------------------------------------------- # ● Execute Level Popup #-------------------------------------------------------------------------- def execute_level_popup if (SceneManager.scene_is?(Scene_Battle) and LEVEL_POPUP_BATTLE) or (SceneManager.scene_is?(Scene_Map) and LEVEL_POPUP_MAP) @damage.push(["Level UP","Level_UP"]) unless @skip_dmg_popup @skip_dmg_popup = true end end #-------------------------------------------------------------------------- # ● Change Exp #-------------------------------------------------------------------------- alias mog_damage_popup_change_exp change_exp def change_exp(exp, show) n_exp = self.exp mog_damage_popup_change_exp(exp, show) c_exp = n_exp - self.exp @damage.push([c_exp.abs,"Exp"]) if can_popup_exp?(exp) end #-------------------------------------------------------------------------- # ● Can Popup EXP #-------------------------------------------------------------------------- def can_popup_exp?(exp) return false if !EXP_GOLD_POPUP_MAP return false if exp <= 0 return false if self.skip_dmg_popup return false if self.max_level? return true end end #============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● Invoke Counter Attack #-------------------------------------------------------------------------- alias mog_damage_popup_invoke_counter_attack invoke_counter_attack def invoke_counter_attack(target, item) mog_damage_popup_invoke_counter_attack(target, item) target.damage.push(["Counter","Counter"]) end #-------------------------------------------------------------------------- # ● Invoke Counter Attack #-------------------------------------------------------------------------- alias mog_damage_popup_invoke_magic_reflection invoke_magic_reflection def invoke_magic_reflection(target, item) mog_damage_popup_invoke_magic_reflection(target, item) target.damage.push(["Reflection","Reflection"]) end end #============================================================================== # ■ Cache #============================================================================== module Cache #-------------------------------------------------------------------------- # * Damage #-------------------------------------------------------------------------- def self.damage(filename) load_bitmap("Graphics/Damage/", filename) end end #============================================================================== # ■ Game Temp #============================================================================== class Game_Temp attr_accessor :pre_cache_damage #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_damage_pop_initialize initialize def initialize mog_damage_pop_initialize pre_cache_damage_temp end #-------------------------------------------------------------------------- # ● Pre Cache Damage Temp #-------------------------------------------------------------------------- def pre_cache_damage_temp return if @pre_cache_damage != nil @pre_cache_damage = [] @pre_cache_damage.push(Cache.damage("HP_Number")) @pre_cache_damage.push(Cache.damage("MP")) @pre_cache_damage.push(Cache.damage("TP")) @pre_cache_damage.push(Cache.damage("Missed")) @pre_cache_damage.push(Cache.damage("Evaded")) @pre_cache_damage.push(Cache.damage("Critical")) @pre_cache_damage.push(Cache.damage("Exp")) @pre_cache_damage.push(Cache.damage("Gold")) @pre_cache_damage.push(Cache.damage("Level UP")) @pre_cache_damage.push(Cache.damage("Counter")) @pre_cache_damage.push(Cache.damage("Reflection")) @pre_cache_damage.push(Cache.damage("MP_Number")) @pre_cache_damage.push(Cache.damage("TP_Number")) @pre_cache_damage.push(Cache.damage("EG_Number")) @pre_cache_damage.push(Cache.system("Iconset")) end end #============================================================================== # ■ Sprite Base #============================================================================== class Sprite_Base < Sprite #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_damage_popup_sprite_initialize initialize def initialize(viewport = nil) mog_damage_popup_sprite_initialize(viewport) damage_popup_setup end #-------------------------------------------------------------------------- # ● Damage Popup Setup #-------------------------------------------------------------------------- def damage_popup_setup $game_temp.pre_cache_damage_temp ; @damage_sprites = [] $game_system.damage_popup_clear end #-------------------------------------------------------------------------- # ● Dispose #-------------------------------------------------------------------------- alias mog_damage_popup_sprite_dispose dispose def dispose mog_damage_popup_sprite_dispose dispose_damage_sprites end #-------------------------------------------------------------------------- # ● Dispose Damage Sprites #-------------------------------------------------------------------------- def dispose_damage_sprites return if @damage_sprites == nil @damage_sprites.each {|sprite| sprite.dispose_damage } end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- alias mog_damage_popup_sprite_update update def update mog_damage_popup_sprite_update update_damage_popup end #-------------------------------------------------------------------------- # ● Update Damage Popup #-------------------------------------------------------------------------- def update_damage_popup return if @damage_sprites == nil create_damage_sprite if can_create_damage? update_damage_sprite if !@damage_sprites.empty? end #-------------------------------------------------------------------------- # ● Can Create Damage? #-------------------------------------------------------------------------- def can_create_damage? return false if $game_message.visible if @battler return false if @battler.damage == nil return false if @battler.damage.empty? if $game_temp.battle_end and @battler.is_a?(Game_Actor) return false if $game_message.visible return false if $imported[:mog_battler_result] and $game_temp.result end elsif @character return false if !$game_system.damage_popup_map if @character.battler return false if @character.battler.damage == nil return false if @character.battler.damage.empty? else return false if @character.damage == nil return false if @character.damage.empty? end end return false if @battler == nil and @character == nil return true end #-------------------------------------------------------------------------- # ● Create Damage Sprite #-------------------------------------------------------------------------- def create_damage_sprite target = @battler ? @battler : @character screen_x_available = target.screen_x rescue nil return if screen_x_available == nil sx = target.screen_x != nil ? target.screen_x : self.x sy = target.screen_y != nil ? target.screen_y : self.y @damage_sprites = [] if @damage_sprites == nil target = @character.battler if @character and @character.battler target.damage.each_with_index do |i, index| @damage_sprites.push(Damage_Sprite.new(nil,sx,sy,i,index,@damage_sprites.size,self)) end if SceneManager.scene_is?(Scene_Battle) @damage_sprites.each_with_index do |i, index| i.set_duration(index) end end target.damage.clear ; target.skip_dmg_popup = false end #-------------------------------------------------------------------------- # ● Update Damage Sprite #-------------------------------------------------------------------------- def update_damage_sprite clear = true @damage_sprites.each_with_index do |sprite, i| sprite.update_damage(@damage_sprites.size,i,@battler) sprite.dispose_damage if sprite.duration <= 0 clear = false if sprite.duration > 0 end @damage_sprites.clear if clear end end #============================================================================== # ■ Damage Sprite #============================================================================== class Damage_Sprite < Sprite include MOG_DAMAGEPOPUP attr_accessor :duration #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize(viewport = nil , x,y, value ,index,index_max,target) super(viewport) dispose_damage ; setup_base(value,x,y,index,index_max,target) ; create_sprites end #-------------------------------------------------------------------------- # ● Setup Base #-------------------------------------------------------------------------- def setup_base(value,x,y,index,index_max,target) @target = target ; y2 = 0 if @target.bitmap != nil ; y2 = SceneManager.scene_is?(Scene_Battle) ? @target.bitmap.height / 2 : 0 ; end @animation_type = 0 ; @index = index ; @index_max = index_max + 1 @image = $game_temp.pre_cache_damage ; self.z = index + DAMAGE_Z @cw = @image[0].width / 10 ; @ch = @image[0].height / 2 ; @cw2 = 0 @x = x ; @y = y - y2 ; @value = value[0] ; @type = value[1] ; @ch2 = 0 @critical = (value[2] and @value.to_i >= 0) ? true : false; self.opacity = 0 @state_index = value[3] ; @oxy = [0,0,0,0] ; @org_xy = [0,0] ; @spxy = [0,0] @duration = 92 ; @org_oxy = [0,0,0,0] self.visible = false ;set_initial_position(index,nil) end #-------------------------------------------------------------------------- # ● Set Duration #-------------------------------------------------------------------------- def set_duration(index,pre_index = nil) return if @duration != 0 @duration = 82 + (2 * index) if @animation_type == 0 end #-------------------------------------------------------------------------- # ● Set Initial Position #-------------------------------------------------------------------------- def set_initial_position(index,old_duration) @org_xy = [@x,@y] self.zoom_y = self.zoom_x end #-------------------------------------------------------------------------- # ● Dispose Damage #-------------------------------------------------------------------------- def dispose_damage (self.bitmap.dispose ; self.bitmap = nil) if self.bitmap (@sup_sprite.bitmap.dispose ; @sup_sprite.dispose) if @sup_sprite @duration = -1 end #-------------------------------------------------------------------------- # ● Create Sprites #-------------------------------------------------------------------------- def create_sprites if @value.is_a?(Numeric) create_number elsif ["Missed","Evaded","Level UP","Counter","Reflection"].include?(@value.to_s) create_miss else create_string end set_damage_position end #-------------------------------------------------------------------------- # ● Set Damage Position #-------------------------------------------------------------------------- def set_damage_position return if self.bitmap == nil self.ox = (self.bitmap.width - @cw2) / 2 self.oy = self.bitmap.height / 2 ; self.x = @x ; self.y = @y @org_oxy[0] = self.ox @org_oxy[1] = self.oy set_animation_type if @sup_sprite @sup_sprite.ox = self.bitmap.width / 2 ; @sup_sprite.oy = self.bitmap.height / 2 @org_oxy[2] = @sup_sprite.ox @org_oxy[3] = @sup_sprite.oy if @critical @sup_sprite.x = @x - (@sup_sprite.bitmap.width / 2) + ((@cw / 2) * @number_value.size) @sup_sprite.y = self.y end update_sup_position(@index_max - @index) end end #-------------------------------------------------------------------------- # ● Set Damage Position #-------------------------------------------------------------------------- def set_animation_type s = rand(2) ; s2 = (rand(10) * 0.1).round(2) @oxy[2] = s == 1 ? s2 : -s2 end #-------------------------------------------------------------------------- # ● Create Number #-------------------------------------------------------------------------- def create_number case @type when "MP" number_image = @image[11] ;h = @value >= 0 ? 0 : @ch ; create_sup_sprite when "TP" number_image = @image[12] ;h = @value >= 0 ? 0 : @ch ; create_sup_sprite when "Exp" number_image = @image[13] ;h = 0 ; create_sup_sprite when "Gold" number_image = @image[13] ;h = @ch ; create_sup_sprite else number_image = @image[0] ; h = @value >= 0 ? 0 : @ch end @number_value = @value.abs.truncate.to_s.split(//) self.bitmap = Bitmap.new(@cw * @number_value.size, @ch) for r in 0...@number_value.size number_value_abs = @number_value[r].to_i src_rect = Rect.new(@cw * number_value_abs, h, @cw, @ch) self.bitmap.blt(@cw * r, 0, number_image, src_rect) end create_sup_sprite if @critical end #-------------------------------------------------------------------------- # ● Create Sup Sprite #-------------------------------------------------------------------------- def create_sup_sprite return if @sup_sprite != nil @sup_sprite = Sprite.new ; @sup_sprite.visible = false ; fy = 0 ; sp = [0,0] if @type == "MP" ; @sup_sprite.bitmap = @image[1].dup elsif @type == "TP" ; @sup_sprite.bitmap = @image[2].dup elsif @critical @sup_sprite.bitmap = @image[5].dup @cw2 = 0 ; @ch2 = @sup_sprite.bitmap.height return elsif @type == "Exp" @sup_sprite.bitmap = @image[6].dup ; fy = @ch ; sp[1] = 1.0 elsif @type == "Gold" @sup_sprite.bitmap = @image[7].dup ; fy = (@ch * 2) ; sp[1] = 0.5 end fy = 0 if !SceneManager.scene_is?(Scene_Battle) @y += fy ; @org_xy[1] += 0 @cw2 = @sup_sprite.bitmap.width + @cw @spxy = [sp[0],sp[1]] end #-------------------------------------------------------------------------- # ● Update Sup Position #-------------------------------------------------------------------------- def update_sup_position(dif_y) @sup_sprite.x = self.x - @cw unless @critical @sup_sprite.y = @critical ? self.y - @ch2 : self.y @sup_sprite.opacity = self.opacity ; @sup_sprite.angle = self.angle @sup_sprite.zoom_x = self.zoom_x ; @sup_sprite.zoom_y = self.zoom_y @sup_sprite.z = self.z ; @sup_sprite.viewport = self.viewport @sup_sprite.visible = self.visible end #-------------------------------------------------------------------------- # ● Create Miss #-------------------------------------------------------------------------- def create_miss self.bitmap = @image[3].dup if @value == "Missed" self.bitmap = @image[4].dup if @value == "Evaded" self.bitmap = @image[8].dup if @value == "Level UP" self.bitmap = @image[9].dup if @value == "Counter" self.bitmap = @image[10].dup if @value == "Reflection" end #-------------------------------------------------------------------------- # ● Create Spring #-------------------------------------------------------------------------- def create_string string_size = @value.to_s.split(//) ; fsize = FONT_SIZE > 10 ? FONT_SIZE : 10 @stg_size = string_size.size > 0 ? ((1 + string_size.size ) * ((fsize / 2) - 2)) : 32 self.bitmap = Bitmap.new(@stg_size,32) self.bitmap.font.color = FONT_COLOR self.bitmap.font.size = fsize ; self.bitmap.font.bold = FONT_BOLD self.bitmap.font.italic = FONT_ITALIC if @type == "Item" self.bitmap.font.color = FONT_COLOR_ITEM elsif @type == "States Plus" self.bitmap.font.color = FONT_COLOR_STATUS_PLUS elsif @type == "States Minus" self.bitmap.font.color = FONT_COLOR_STATUS_MINUS end self.bitmap.draw_text(0, 0, self.bitmap.width, self.bitmap.height, @value.to_s,0) draw_states if @state_index != nil end #-------------------------------------------------------------------------- # ● Draw States #-------------------------------------------------------------------------- def draw_states @sup_sprite = Sprite.new ; @sup_sprite.bitmap = Bitmap.new(24,24) rect = Rect.new(@state_index % 16 * 24, @state_index / 16 * 24, 24, 24) @image[14] = Cache.system("Iconset") if @image[14]== nil or @image[14].disposed? @sup_sprite.bitmap.blt(0, 0, @image[14].dup, rect) (@org_xy[1] += (@ch + 5) ; @y += (@ch + 5)) unless !SceneManager.is_a?(Scene_Battle) @cw2 = @sup_sprite.bitmap.width + @cw / 2 ; @sup_sprite.visible = false end #-------------------------------------------------------------------------- # ● Update Damage #-------------------------------------------------------------------------- def update_damage(index_max,index,battler) @index_max = index_max ; @index = index return if self.bitmap == nil or self.bitmap.disposed? @duration -= 1 self.visible = @duration > 90 ? false : true return if !self.visible dif_y = (@index_max - @index) update_animation(dif_y) update_sprite_position(dif_y,battler) update_sup_position(dif_y) if @sup_sprite dispose_damage if @duration <= 0 end #-------------------------------------------------------------------------- # ● Update Sprite Position #-------------------------------------------------------------------------- def update_sprite_position(dif_y,battler) execute_move(0,self,@org_xy[0] + @oxy[0]) execute_move(1,self,@org_xy[1] + @oxy[1] - (dif_y * Y_SPACE)) self.zoom_y = self.zoom_x update_battle_camera if oxy_camera?(battler) end #-------------------------------------------------------------------------- # ● Update Battle Camera #-------------------------------------------------------------------------- def update_battle_camera self.ox = $game_temp.viewport_oxy[0] + @org_oxy[0] self.oy = $game_temp.viewport_oxy[1] + @org_oxy[1] @sup_sprite.ox = $game_temp.viewport_oxy[0] + @org_oxy[2] if @sup_sprite != nil @sup_sprite.oy = $game_temp.viewport_oxy[1] + @org_oxy[3] if @sup_sprite != nil end #-------------------------------------------------------------------------- # ● OXY_CAMERA #-------------------------------------------------------------------------- def oxy_camera?(battler) return false if $imported[:mog_battle_camera] == nil if battler.is_a?(Game_Actor) return false if $imported[:mog_battle_hud_ex] and SceneManager.face_battler? end return true end #-------------------------------------------------------------------------- # ● Execute Move #-------------------------------------------------------------------------- def execute_move(type,sprite,np) cp = type == 0 ? sprite.x : sprite.y sp = 1 + ((cp - np).abs / 10) sp = 1 if @duration < 60 if cp > np ; cp -= sp ; cp = np if cp < np elsif cp < np ; cp += sp ; cp = np if cp > np end sprite.x = cp if type == 0 ; sprite.y = cp if type == 1 end #-------------------------------------------------------------------------- # ● Update Animation #-------------------------------------------------------------------------- def update_animation(dif_y) @oxy[1] -= 1 case @duration when 60..90 ; self.opacity += 15 when 30..60 ; self.opacity = 255 when 0..30 ; self.opacity -= 9 end end end #============================================================================== # ■ Sprite Battler #============================================================================== class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # ● Update Collapse #-------------------------------------------------------------------------- alias mog_damage_pop_update_collapse update_collapse def update_collapse mog_damage_pop_update_collapse execute_exp_pop end #-------------------------------------------------------------------------- # ● Update Instant Collapse #-------------------------------------------------------------------------- alias mog_damage_pop_update_instant_collapse update_instant_collapse def update_instant_collapse mog_damage_pop_update_instant_collapse execute_exp_pop end #-------------------------------------------------------------------------- # ● Update Boss Collapse #-------------------------------------------------------------------------- alias mog_damage_pop_update_boss_collapse update_boss_collapse def update_boss_collapse mog_damage_pop_update_boss_collapse execute_exp_pop end #-------------------------------------------------------------------------- # ● Execute Exp Pop #-------------------------------------------------------------------------- def execute_exp_pop return if !MOG_DAMAGEPOPUP::EXP_GOLD_POPUP_BATTLE or @dam_exp != nil return if @battler == nil or @battler.is_a?(Game_Actor) @dam_exp = true if $imported[:mog_active_bonus_gauge] != nil real_exp = $game_troop.bonus_exp? ? @battler.exp * 2 : @battler.exp real_gold = $game_troop.bonus_gold? ? @battler.gold * 2 : @battler.gold else real_exp = @battler.exp ; real_gold = @battler.gold end @battler.damage.push([real_exp,"Exp"]) if @battler.exp > 0 @battler.damage.push([real_gold,"Gold"]) if @battler.gold > 0 end end
#==============================================================================
# +++ MOG - 伤害显示 (v4.5) +++
#==============================================================================
# By Moghunter
# [url]https://atelierrgss.wordpress.com/[/url]
#==============================================================================
# 用图片显示伤害数字.
#==============================================================================
# 需要以下图片
#
# Critical
# Evaded
# Exp
# Gold
# Level Up
# Missed
# MP
# Number
# TP
#
# 全部放在 /GRAPHICS/DAMAGE/
#==============================================================================
#==============================================================================
# 行走图上显示伤害数字 (事件)
#==============================================================================
# 如果你想要在地图上或战斗中手动显示伤害数字,使用以下脚本:
#
# damage_popup(目标ID,数值,"类型")
#
# 目标ID
# 1...999 - 地图上的事件ID
# 0 - 玩家
# -1...-3 - 队友
#
# 数值
# 显示伤害的数值(可以是负值)或文本.当类型为"States"时为状态的ID,不能为负值
#
# 类型 (可选)
# "Exp" - 显示EXP.
# "Gold" - 显示金币.
# "States" - 显示状态图标.
#
#==============================================================================
#
# damage_popup(1,999)
# damage_popup(4,"存档点.")
# damage_popup(0,"我饿了!!!") <- 玩家
# damage_popup(-1,"Booo!") <- 1号队友(离玩家最近的队友,不是ID=1的队友)
# damage_popup(0,2000,"Exp") <- 显示 2000 Exp
# damage_popup(0,5000,"Gold") <- 显示 5000 金币
#
#==============================================================================
# 使用以下脚本来在全部队友的头顶显示伤害数字.:
#
# damage_popup_party(目标ID,数值,"类型")
#
#==============================================================================
# 地图上显示/不显示伤害数字.
#==============================================================================
# 使用以下脚本来在地图上显示/不显示伤害数字:
#
# damage_popup_map(true) -> 或 (false)
#
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 4.5 - Correção de ativar o dano quando o alvo é morto e o dano é zero.
#==============================================================================
$imported = {} if $imported.nil?
$imported[:mog_damage_popup] = true
module MOG_DAMAGEPOPUP
#是否允许在地图上显示伤害数字. (默认)
DAMAGE_POPUP_MAP = false
#是否在获得物品时显示该物品图标. (仅在地图上).
ITEM_POPUP_MAP = false
#是否允许在敌人身上显示EXP和金币.
EXP_GOLD_POPUP_BATTLE = false
EXP_GOLD_POPUP_MAP = false
#是否显示升级
LEVEL_POPUP_BATTLE = false
LEVEL_POPUP_MAP = false
#是否显示状态图标
STATES_POPUP_BATTLE = true
STATES_POPUP_MAP = true
#设定字体 (物品名/状态名/ etc...).
FONT_SIZE = 28
FONT_BOLD = true
FONT_ITALIC = false
FONT_COLOR = Color.new(255,255,255)
FONT_COLOR_ITEM = Color.new(255,255,255)
FONT_COLOR_STATUS_PLUS = Color.new(155,155,255)
FONT_COLOR_STATUS_MINUS = Color.new(255,150,150)
#每条伤害间的距离(竖直距离).
Y_SPACE = 28
#伤害数字的Z坐标
DAMAGE_Z = 151
end
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :damage_popup_map
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_damage_popup_initialize initialize
def initialize
@damage_popup_map = MOG_DAMAGEPOPUP::DAMAGE_POPUP_MAP
mog_damage_popup_initialize
end
#--------------------------------------------------------------------------
# ● Damage Popup Clear
#--------------------------------------------------------------------------
def damage_popup_clear
$game_party.character_members.each {|t|
t.actor.damage.clear; t.actor.skip_dmg_popup = false ;
t.damage.clear; t.skip_dmg_popup = false} rescue nil
$game_map.events.values.each {|t| t.damage.clear ;
t.skip_dmg_popup = false} rescue nil
end
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :battle_end
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_damage_temp_opup_initialize initialize
def initialize
@battle_end = false
mog_damage_temp_opup_initialize
end
#--------------------------------------------------------------------------
# ● Sprite Visible
#--------------------------------------------------------------------------
def sprite_visible
return false if $game_message.visible
return false if $game_temp.battle_end
return true
end
end
#==============================================================================
# ■ Game CharacterBase
#==============================================================================
class Game_CharacterBase
attr_accessor :damage ,:battler ,:skip_dmg_popup
#--------------------------------------------------------------------------
# ● Ini Public Members
#--------------------------------------------------------------------------
alias mog_damage_popup_init_public_members init_public_members
def init_public_members
@damage = [] ; @skip_dmg_popup = false
mog_damage_popup_init_public_members
end
#--------------------------------------------------------------------------
# ● Damage Popup
#--------------------------------------------------------------------------
def damage_popup(value,type = "String")
@damage.push([value,type])
end
end
#==============================================================================
# ■ Scene Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● Start
#--------------------------------------------------------------------------
alias mog_damage_popup_start start
def start
$game_system.damage_popup_clear ; $game_temp.battle_end = false
mog_damage_popup_start
end
end
#==============================================================================
# ■ Game Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● Battler
#--------------------------------------------------------------------------
def battler
actor
end
end
#==============================================================================
# ■ Game Follower
#==============================================================================
class Game_Follower < Game_Character
#--------------------------------------------------------------------------
# ● Battler
#--------------------------------------------------------------------------
def battler
actor
end
end
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# ● Change HP
#--------------------------------------------------------------------------
alias mog_damage_popup_change_hp change_hp
def change_hp(value, enable_death)
mog_damage_popup_change_hp(value, enable_death)
self.damage.push([-value,"Hp"])
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
include MOG_DAMAGEPOPUP
attr_accessor :damage , :skip_dmg_popup
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_damage_sprite_initialize initialize
def initialize
@damage = [] ; @skip_dmg_popup = false
mog_damage_sprite_initialize
end
#--------------------------------------------------------------------------
# ● Item Apply
#--------------------------------------------------------------------------
alias mog_damage_pop_item_apply item_apply
def item_apply(user, item)
mog_damage_pop_item_apply(user, item)
execute_damage_popup(user,item)
end
#--------------------------------------------------------------------------
# ● Execute Damage Popup
#--------------------------------------------------------------------------
def execute_damage_popup(user,item)
if !@result.missed and !@result.evaded and @result.hit?
self.damage.push([@result.hp_damage,"HP",@result.critical]) if item.damage.to_hp? or @result.hp_damage != 0
user.damage.push([-@result.hp_drain,"HP",@result.critical]) if item.damage.type == 5
self.damage.push([@result.mp_damage,"MP",@result.critical]) if item.damage.to_mp? or @result.mp_damage != 0
user.damage.push([-@result.mp_drain,"MP",@result.critical]) if item.damage.type == 6
self.damage.push([@result.tp_damage,"TP",@result.critical]) if @result.tp_damage != 0
elsif !self.dead?
if @result.missed ; self.damage.push(["Missed","Missed"])
elsif @result.evaded ; self.damage.push(["Evaded","Evaded"])
end
end
end
#--------------------------------------------------------------------------
# ● Regenerate HP
#--------------------------------------------------------------------------
alias mog_damage_pop_regenerate_hp regenerate_hp
def regenerate_hp
mog_damage_pop_regenerate_hp
self.damage.push(["Regenerate",""]) if @result.hp_damage < 0
self.damage.push([@result.hp_damage,"HP"]) if @result.hp_damage != 0
end
#--------------------------------------------------------------------------
# ● Regenerate MP
#--------------------------------------------------------------------------
alias mog_damage_pop_regenerate_mp regenerate_mp
def regenerate_mp
mog_damage_pop_regenerate_mp
self.damage.push([@result.mp_damage,"MP"]) if @result.mp_damage != 0
end
#--------------------------------------------------------------------------
# ● Regenerate TP
#--------------------------------------------------------------------------
alias mog_damage_pop_regenerate_tp regenerate_tp
def regenerate_tp
mog_damage_pop_regenerate_tp
tp_damage = 100 * trg
self.damage.push([tp_damage,"TP"]) if tp_damage != 0
end
#--------------------------------------------------------------------------
# ● Added New State
#--------------------------------------------------------------------------
alias mog_damage_pop_add_new_state add_new_state
def add_new_state(state_id)
mog_damage_pop_add_new_state(state_id)
execute_popup_add_new_state(state_id)
end
#--------------------------------------------------------------------------
# ● Execute Popup Add New State
#--------------------------------------------------------------------------
def execute_popup_add_new_state(state_id)
st = $data_states[state_id]
if self.hp > 0
unless (SceneManager.scene_is?(Scene_Battle) and !STATES_POPUP_BATTLE) or
(SceneManager.scene_is?(Scene_Map) and !STATES_POPUP_MAP)
self.damage.push([st.name.to_s,"States Plus",false,st.icon_index])
end
end
end
#--------------------------------------------------------------------------
# ● Remove State
#--------------------------------------------------------------------------
alias mog_damage_pop_remove_state remove_state
def remove_state(state_id)
execute_popup_remove_state(state_id)
mog_damage_pop_remove_state(state_id)
end
#--------------------------------------------------------------------------
# ● Execute Popup Remove State
#--------------------------------------------------------------------------
def execute_popup_remove_state(state_id)
if state?(state_id) and self.hp > 0
st = $data_states[state_id]
unless (SceneManager.scene_is?(Scene_Battle) and !STATES_POPUP_BATTLE) or
(SceneManager.scene_is?(Scene_Map) and !STATES_POPUP_MAP)
self.damage.push([st.name.to_s,"States Minus",false,st.icon_index]) unless BattleManager.escape?
end
end
end
end
#==============================================================================
# ■ BattleManager
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# ● Escape?
#--------------------------------------------------------------------------
def self.escape?
@phase == nil
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :dmg_battle_mode
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_damage_popup_initialize initialize
def initialize
@dmg_battle_mode = false
mog_damage_popup_initialize
end
end
#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Start
#--------------------------------------------------------------------------
alias mog_damage_popup_start start
def start
$game_temp.dmg_battle_mode = true
mog_damage_popup_start
end
#--------------------------------------------------------------------------
# ● Terminate
#--------------------------------------------------------------------------
alias mog_damage_popup_terminate terminate
def terminate
mog_damage_popup_terminate
$game_temp.dmg_battle_mode = false
end
end
#==============================================================================
# ■ Game Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● Character Members
#--------------------------------------------------------------------------
def character_members
char_m = [] ; char_m.push($game_player)
$game_player.followers.each do |f| char_m.push(f) end
return char_m
end
#--------------------------------------------------------------------------
# ● Gain Gold
#--------------------------------------------------------------------------
alias mog_damage_popup_gain_gold gain_gold
def gain_gold(amount)
mog_damage_popup_gain_gold(amount)
$game_party.members[0].damage.push([amount,"Gold"]) if can_damage_popup_gold?
end
#--------------------------------------------------------------------------
# ● Can Damage Popup Gold
#--------------------------------------------------------------------------
def can_damage_popup_gold?
return false if !SceneManager.scene_is?(Scene_Map)
return false if $game_temp.dmg_battle_mode
return false if !MOG_DAMAGEPOPUP::EXP_GOLD_POPUP_MAP
return false if !$game_system.damage_popup_map
return false if !$game_party.members[0]
return true
end
#--------------------------------------------------------------------------
# ● Gain Item
#--------------------------------------------------------------------------
alias mog_damage_popup_gain_item gain_item
def gain_item(item, amount, include_equip = false)
mog_damage_popup_gain_item(item, amount, include_equip)
execute_item_popup(item) if can_damage_popup_item?(item)
end
#--------------------------------------------------------------------------
# ● Can Damage Poupup Item
#--------------------------------------------------------------------------
def can_damage_popup_item?(item)
return false if item == nil
return false if !MOG_DAMAGEPOPUP::ITEM_POPUP_MAP
return false if !$game_system.damage_popup_map
return false if SceneManager.scene_is?(Scene_Battle)
return false if !$game_party.members[0]
return false if $game_temp.dmg_battle_mode
return true
end
#--------------------------------------------------------------------------
# ● Execute Item Popup
#--------------------------------------------------------------------------
def execute_item_popup(item)
it = $data_items[item.id] if item.is_a?(RPG::Item)
it = $data_weapons[item.id] if item.is_a?(RPG::Weapon)
it = $data_armors[item.id] if item.is_a?(RPG::Armor)
$game_party.members[0].damage.push([it.name.to_s,"Item",false,it.icon_index])
end
end
#==============================================================================
# ■ Game Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● Damage Popup Map
#--------------------------------------------------------------------------
def damage_popup_map(value)
$game_system.damage_popup_map = value
end
#--------------------------------------------------------------------------
# ● Damage Popup
#--------------------------------------------------------------------------
def damage_popup(target_id, value,type = "")
return if !$game_system.damage_popup_map
target = set_target_dmg(target_id) rescue nil
target.damage.push([value,type]) if target
end
#--------------------------------------------------------------------------
# ● Set Target Dmg
#--------------------------------------------------------------------------
def set_target_dmg(target)
return $game_player.battler if target == 0
return $game_player.followers.battler[(target_id + 1).abs] if target < 0
$game_map.events.values.each do |event|
return event.battler if event.id == target_id and event.battler
return event if event.id == target_id
end
end
#--------------------------------------------------------------------------
# * Change MP
#--------------------------------------------------------------------------
alias mog_damage_popup_command_312 command_312
def command_312
value = operate_value(@params[2], @params[3], @params[4])
iterate_actor_var(@params[0], @params[1]) do |actor|
actor.damage.push([-value,"MP"])
end
mog_damage_popup_command_312
end
end
#==============================================================================
# ■ Game Actor
#==============================================================================
class Game_Actor < Game_Battler
include MOG_DAMAGEPOPUP
#--------------------------------------------------------------------------
# ● Level UP
#--------------------------------------------------------------------------
alias mog_damage_pop_level_up level_up
def level_up
mog_damage_pop_level_up
execute_level_popup
end
#--------------------------------------------------------------------------
# ● Execute Level Popup
#--------------------------------------------------------------------------
def execute_level_popup
if (SceneManager.scene_is?(Scene_Battle) and LEVEL_POPUP_BATTLE) or
(SceneManager.scene_is?(Scene_Map) and LEVEL_POPUP_MAP)
@damage.push(["Level UP","Level_UP"]) unless @skip_dmg_popup
@skip_dmg_popup = true
end
end
#--------------------------------------------------------------------------
# ● Change Exp
#--------------------------------------------------------------------------
alias mog_damage_popup_change_exp change_exp
def change_exp(exp, show)
n_exp = self.exp
mog_damage_popup_change_exp(exp, show)
c_exp = n_exp - self.exp
@damage.push([c_exp.abs,"Exp"]) if can_popup_exp?(exp)
end
#--------------------------------------------------------------------------
# ● Can Popup EXP
#--------------------------------------------------------------------------
def can_popup_exp?(exp)
return false if !EXP_GOLD_POPUP_MAP
return false if exp <= 0
return false if self.skip_dmg_popup
return false if self.max_level?
return true
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Invoke Counter Attack
#--------------------------------------------------------------------------
alias mog_damage_popup_invoke_counter_attack invoke_counter_attack
def invoke_counter_attack(target, item)
mog_damage_popup_invoke_counter_attack(target, item)
target.damage.push(["Counter","Counter"])
end
#--------------------------------------------------------------------------
# ● Invoke Counter Attack
#--------------------------------------------------------------------------
alias mog_damage_popup_invoke_magic_reflection invoke_magic_reflection
def invoke_magic_reflection(target, item)
mog_damage_popup_invoke_magic_reflection(target, item)
target.damage.push(["Reflection","Reflection"])
end
end
#==============================================================================
# ■ Cache
#==============================================================================
module Cache
#--------------------------------------------------------------------------
# * Damage
#--------------------------------------------------------------------------
def self.damage(filename)
load_bitmap("Graphics/Damage/", filename)
end
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :pre_cache_damage
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_damage_pop_initialize initialize
def initialize
mog_damage_pop_initialize
pre_cache_damage_temp
end
#--------------------------------------------------------------------------
# ● Pre Cache Damage Temp
#--------------------------------------------------------------------------
def pre_cache_damage_temp
return if @pre_cache_damage != nil
@pre_cache_damage = []
@pre_cache_damage.push(Cache.damage("HP_Number"))
@pre_cache_damage.push(Cache.damage("MP"))
@pre_cache_damage.push(Cache.damage("TP"))
@pre_cache_damage.push(Cache.damage("Missed"))
@pre_cache_damage.push(Cache.damage("Evaded"))
@pre_cache_damage.push(Cache.damage("Critical"))
@pre_cache_damage.push(Cache.damage("Exp"))
@pre_cache_damage.push(Cache.damage("Gold"))
@pre_cache_damage.push(Cache.damage("Level UP"))
@pre_cache_damage.push(Cache.damage("Counter"))
@pre_cache_damage.push(Cache.damage("Reflection"))
@pre_cache_damage.push(Cache.damage("MP_Number"))
@pre_cache_damage.push(Cache.damage("TP_Number"))
@pre_cache_damage.push(Cache.damage("EG_Number"))
@pre_cache_damage.push(Cache.system("Iconset"))
end
end
#==============================================================================
# ■ Sprite Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_damage_popup_sprite_initialize initialize
def initialize(viewport = nil)
mog_damage_popup_sprite_initialize(viewport)
damage_popup_setup
end
#--------------------------------------------------------------------------
# ● Damage Popup Setup
#--------------------------------------------------------------------------
def damage_popup_setup
$game_temp.pre_cache_damage_temp ; @damage_sprites = []
$game_system.damage_popup_clear
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_damage_popup_sprite_dispose dispose
def dispose
mog_damage_popup_sprite_dispose
dispose_damage_sprites
end
#--------------------------------------------------------------------------
# ● Dispose Damage Sprites
#--------------------------------------------------------------------------
def dispose_damage_sprites
return if @damage_sprites == nil
@damage_sprites.each {|sprite| sprite.dispose_damage }
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_damage_popup_sprite_update update
def update
mog_damage_popup_sprite_update
update_damage_popup
end
#--------------------------------------------------------------------------
# ● Update Damage Popup
#--------------------------------------------------------------------------
def update_damage_popup
return if @damage_sprites == nil
create_damage_sprite if can_create_damage?
update_damage_sprite if !@damage_sprites.empty?
end
#--------------------------------------------------------------------------
# ● Can Create Damage?
#--------------------------------------------------------------------------
def can_create_damage?
return false if $game_message.visible
if @battler
return false if @battler.damage == nil
return false if @battler.damage.empty?
if $game_temp.battle_end and @battler.is_a?(Game_Actor)
return false if $game_message.visible
return false if $imported[:mog_battler_result] and $game_temp.result
end
elsif @character
return false if !$game_system.damage_popup_map
if @character.battler
return false if @character.battler.damage == nil
return false if @character.battler.damage.empty?
else
return false if @character.damage == nil
return false if @character.damage.empty?
end
end
return false if @battler == nil and @character == nil
return true
end
#--------------------------------------------------------------------------
# ● Create Damage Sprite
#--------------------------------------------------------------------------
def create_damage_sprite
target = @battler ? @battler : @character
screen_x_available = target.screen_x rescue nil
return if screen_x_available == nil
sx = target.screen_x != nil ? target.screen_x : self.x
sy = target.screen_y != nil ? target.screen_y : self.y
@damage_sprites = [] if @damage_sprites == nil
target = @character.battler if @character and @character.battler
target.damage.each_with_index do |i, index|
@damage_sprites.push(Damage_Sprite.new(nil,sx,sy,i,index,@damage_sprites.size,self)) end
if SceneManager.scene_is?(Scene_Battle)
@damage_sprites.each_with_index do |i, index| i.set_duration(index) end
end
target.damage.clear ; target.skip_dmg_popup = false
end
#--------------------------------------------------------------------------
# ● Update Damage Sprite
#--------------------------------------------------------------------------
def update_damage_sprite
clear = true
@damage_sprites.each_with_index do |sprite, i|
sprite.update_damage(@damage_sprites.size,i,@battler)
sprite.dispose_damage if sprite.duration <= 0
clear = false if sprite.duration > 0
end
@damage_sprites.clear if clear
end
end
#==============================================================================
# ■ Damage Sprite
#==============================================================================
class Damage_Sprite < Sprite
include MOG_DAMAGEPOPUP
attr_accessor :duration
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil , x,y, value ,index,index_max,target)
super(viewport)
dispose_damage ; setup_base(value,x,y,index,index_max,target) ; create_sprites
end
#--------------------------------------------------------------------------
# ● Setup Base
#--------------------------------------------------------------------------
def setup_base(value,x,y,index,index_max,target)
@target = target ; y2 = 0
if @target.bitmap != nil ; y2 = SceneManager.scene_is?(Scene_Battle) ? @target.bitmap.height / 2 : 0 ; end
@animation_type = 0 ; @index = index ; @index_max = index_max + 1
@image = $game_temp.pre_cache_damage ; self.z = index + DAMAGE_Z
@cw = @image[0].width / 10 ; @ch = @image[0].height / 2 ; @cw2 = 0
@x = x ; @y = y - y2 ; @value = value[0] ; @type = value[1] ; @ch2 = 0
@critical = (value[2] and @value.to_i >= 0) ? true : false; self.opacity = 0
@state_index = value[3] ; @oxy = [0,0,0,0] ; @org_xy = [0,0] ; @spxy = [0,0]
@duration = 92 ; @org_oxy = [0,0,0,0]
self.visible = false ;set_initial_position(index,nil)
end
#--------------------------------------------------------------------------
# ● Set Duration
#--------------------------------------------------------------------------
def set_duration(index,pre_index = nil)
return if @duration != 0
@duration = 82 + (2 * index) if @animation_type == 0
end
#--------------------------------------------------------------------------
# ● Set Initial Position
#--------------------------------------------------------------------------
def set_initial_position(index,old_duration)
@org_xy = [@x,@y]
self.zoom_y = self.zoom_x
end
#--------------------------------------------------------------------------
# ● Dispose Damage
#--------------------------------------------------------------------------
def dispose_damage
(self.bitmap.dispose ; self.bitmap = nil) if self.bitmap
(@sup_sprite.bitmap.dispose ; @sup_sprite.dispose) if @sup_sprite
@duration = -1
end
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
if @value.is_a?(Numeric)
create_number
elsif ["Missed","Evaded","Level UP","Counter","Reflection"].include?(@value.to_s)
create_miss
else
create_string
end
set_damage_position
end
#--------------------------------------------------------------------------
# ● Set Damage Position
#--------------------------------------------------------------------------
def set_damage_position
return if self.bitmap == nil
self.ox = (self.bitmap.width - @cw2) / 2
self.oy = self.bitmap.height / 2 ; self.x = @x ; self.y = @y
@org_oxy[0] = self.ox
@org_oxy[1] = self.oy
set_animation_type
if @sup_sprite
@sup_sprite.ox = self.bitmap.width / 2 ;
@sup_sprite.oy = self.bitmap.height / 2
@org_oxy[2] = @sup_sprite.ox
@org_oxy[3] = @sup_sprite.oy
if @critical
@sup_sprite.x = @x - (@sup_sprite.bitmap.width / 2) + ((@cw / 2) * @number_value.size)
@sup_sprite.y = self.y
end
update_sup_position(@index_max - @index)
end
end
#--------------------------------------------------------------------------
# ● Set Damage Position
#--------------------------------------------------------------------------
def set_animation_type
s = rand(2) ; s2 = (rand(10) * 0.1).round(2)
@oxy[2] = s == 1 ? s2 : -s2
end
#--------------------------------------------------------------------------
# ● Create Number
#--------------------------------------------------------------------------
def create_number
case @type
when "MP"
number_image = @image[11] ;h = @value >= 0 ? 0 : @ch ; create_sup_sprite
when "TP"
number_image = @image[12] ;h = @value >= 0 ? 0 : @ch ; create_sup_sprite
when "Exp"
number_image = @image[13] ;h = 0 ; create_sup_sprite
when "Gold"
number_image = @image[13] ;h = @ch ; create_sup_sprite
else
number_image = @image[0] ; h = @value >= 0 ? 0 : @ch
end
@number_value = @value.abs.truncate.to_s.split(//)
self.bitmap = Bitmap.new(@cw * @number_value.size, @ch)
for r in 0...@number_value.size
number_value_abs = @number_value[r].to_i
src_rect = Rect.new(@cw * number_value_abs, h, @cw, @ch)
self.bitmap.blt(@cw * r, 0, number_image, src_rect)
end
create_sup_sprite if @critical
end
#--------------------------------------------------------------------------
# ● Create Sup Sprite
#--------------------------------------------------------------------------
def create_sup_sprite
return if @sup_sprite != nil
@sup_sprite = Sprite.new ; @sup_sprite.visible = false ; fy = 0 ; sp = [0,0]
if @type == "MP" ; @sup_sprite.bitmap = @image[1].dup
elsif @type == "TP" ; @sup_sprite.bitmap = @image[2].dup
elsif @critical
@sup_sprite.bitmap = @image[5].dup
@cw2 = 0 ; @ch2 = @sup_sprite.bitmap.height
return
elsif @type == "Exp"
@sup_sprite.bitmap = @image[6].dup ; fy = @ch ; sp[1] = 1.0
elsif @type == "Gold"
@sup_sprite.bitmap = @image[7].dup ; fy = (@ch * 2) ; sp[1] = 0.5
end
fy = 0 if !SceneManager.scene_is?(Scene_Battle)
@y += fy ; @org_xy[1] += 0
@cw2 = @sup_sprite.bitmap.width + @cw
@spxy = [sp[0],sp[1]]
end
#--------------------------------------------------------------------------
# ● Update Sup Position
#--------------------------------------------------------------------------
def update_sup_position(dif_y)
@sup_sprite.x = self.x - @cw unless @critical
@sup_sprite.y = @critical ? self.y - @ch2 : self.y
@sup_sprite.opacity = self.opacity ; @sup_sprite.angle = self.angle
@sup_sprite.zoom_x = self.zoom_x ; @sup_sprite.zoom_y = self.zoom_y
@sup_sprite.z = self.z ; @sup_sprite.viewport = self.viewport
@sup_sprite.visible = self.visible
end
#--------------------------------------------------------------------------
# ● Create Miss
#--------------------------------------------------------------------------
def create_miss
self.bitmap = @image[3].dup if @value == "Missed"
self.bitmap = @image[4].dup if @value == "Evaded"
self.bitmap = @image[8].dup if @value == "Level UP"
self.bitmap = @image[9].dup if @value == "Counter"
self.bitmap = @image[10].dup if @value == "Reflection"
end
#--------------------------------------------------------------------------
# ● Create Spring
#--------------------------------------------------------------------------
def create_string
string_size = @value.to_s.split(//) ; fsize = FONT_SIZE > 10 ? FONT_SIZE : 10
@stg_size = string_size.size > 0 ? ((1 + string_size.size ) * ((fsize / 2) - 2)) : 32
self.bitmap = Bitmap.new(@stg_size,32)
self.bitmap.font.color = FONT_COLOR
self.bitmap.font.size = fsize ; self.bitmap.font.bold = FONT_BOLD
self.bitmap.font.italic = FONT_ITALIC
if @type == "Item"
self.bitmap.font.color = FONT_COLOR_ITEM
elsif @type == "States Plus"
self.bitmap.font.color = FONT_COLOR_STATUS_PLUS
elsif @type == "States Minus"
self.bitmap.font.color = FONT_COLOR_STATUS_MINUS
end
self.bitmap.draw_text(0, 0, self.bitmap.width, self.bitmap.height, @value.to_s,0)
draw_states if @state_index != nil
end
#--------------------------------------------------------------------------
# ● Draw States
#--------------------------------------------------------------------------
def draw_states
@sup_sprite = Sprite.new ; @sup_sprite.bitmap = Bitmap.new(24,24)
rect = Rect.new(@state_index % 16 * 24, @state_index / 16 * 24, 24, 24)
@image[14] = Cache.system("Iconset") if @image[14]== nil or @image[14].disposed?
@sup_sprite.bitmap.blt(0, 0, @image[14].dup, rect)
(@org_xy[1] += (@ch + 5) ; @y += (@ch + 5)) unless !SceneManager.is_a?(Scene_Battle)
@cw2 = @sup_sprite.bitmap.width + @cw / 2 ; @sup_sprite.visible = false
end
#--------------------------------------------------------------------------
# ● Update Damage
#--------------------------------------------------------------------------
def update_damage(index_max,index,battler)
@index_max = index_max ; @index = index
return if self.bitmap == nil or self.bitmap.disposed?
@duration -= 1
self.visible = @duration > 90 ? false : true
return if !self.visible
dif_y = (@index_max - @index)
update_animation(dif_y)
update_sprite_position(dif_y,battler)
update_sup_position(dif_y) if @sup_sprite
dispose_damage if @duration <= 0
end
#--------------------------------------------------------------------------
# ● Update Sprite Position
#--------------------------------------------------------------------------
def update_sprite_position(dif_y,battler)
execute_move(0,self,@org_xy[0] + @oxy[0])
execute_move(1,self,@org_xy[1] + @oxy[1] - (dif_y * Y_SPACE))
self.zoom_y = self.zoom_x
update_battle_camera if oxy_camera?(battler)
end
#--------------------------------------------------------------------------
# ● Update Battle Camera
#--------------------------------------------------------------------------
def update_battle_camera
self.ox = $game_temp.viewport_oxy[0] + @org_oxy[0]
self.oy = $game_temp.viewport_oxy[1] + @org_oxy[1]
@sup_sprite.ox = $game_temp.viewport_oxy[0] + @org_oxy[2] if @sup_sprite != nil
@sup_sprite.oy = $game_temp.viewport_oxy[1] + @org_oxy[3] if @sup_sprite != nil
end
#--------------------------------------------------------------------------
# ● OXY_CAMERA
#--------------------------------------------------------------------------
def oxy_camera?(battler)
return false if $imported[:mog_battle_camera] == nil
if battler.is_a?(Game_Actor)
return false if $imported[:mog_battle_hud_ex] and SceneManager.face_battler?
end
return true
end
#--------------------------------------------------------------------------
# ● Execute Move
#--------------------------------------------------------------------------
def execute_move(type,sprite,np)
cp = type == 0 ? sprite.x : sprite.y
sp = 1 + ((cp - np).abs / 10)
sp = 1 if @duration < 60
if cp > np ; cp -= sp ; cp = np if cp < np
elsif cp < np ; cp += sp ; cp = np if cp > np
end
sprite.x = cp if type == 0 ; sprite.y = cp if type == 1
end
#--------------------------------------------------------------------------
# ● Update Animation
#--------------------------------------------------------------------------
def update_animation(dif_y)
@oxy[1] -= 1
case @duration
when 60..90 ; self.opacity += 15
when 30..60 ; self.opacity = 255
when 0..30 ; self.opacity -= 9
end
end
end
#==============================================================================
# ■ Sprite Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● Update Collapse
#--------------------------------------------------------------------------
alias mog_damage_pop_update_collapse update_collapse
def update_collapse
mog_damage_pop_update_collapse
execute_exp_pop
end
#--------------------------------------------------------------------------
# ● Update Instant Collapse
#--------------------------------------------------------------------------
alias mog_damage_pop_update_instant_collapse update_instant_collapse
def update_instant_collapse
mog_damage_pop_update_instant_collapse
execute_exp_pop
end
#--------------------------------------------------------------------------
# ● Update Boss Collapse
#--------------------------------------------------------------------------
alias mog_damage_pop_update_boss_collapse update_boss_collapse
def update_boss_collapse
mog_damage_pop_update_boss_collapse
execute_exp_pop
end
#--------------------------------------------------------------------------
# ● Execute Exp Pop
#--------------------------------------------------------------------------
def execute_exp_pop
return if !MOG_DAMAGEPOPUP::EXP_GOLD_POPUP_BATTLE or @dam_exp != nil
return if @battler == nil or @battler.is_a?(Game_Actor)
@dam_exp = true
if $imported[:mog_active_bonus_gauge] != nil
real_exp = $game_troop.bonus_exp? ? @battler.exp * 2 : @battler.exp
real_gold = $game_troop.bonus_gold? ? @battler.gold * 2 : @battler.gold
else
real_exp = @battler.exp ; real_gold = @battler.gold
end
@battler.damage.push([real_exp,"Exp"]) if @battler.exp > 0
@battler.damage.push([real_gold,"Gold"]) if @battler.gold > 0
end
end
这三个脚本中任意两个一起使用都没问题,但是一旦三个一起使用,则装备栏脚本会出错,显示伤害的脚本会无法起作用。这是怎么回事?而且出错时的弹窗说了“group”之类的,我个脚本盲完全不明白。 |
最佳答案
查看完整内容
把"修改游戏分辨率的脚本"放在"装备栏脚本"的下方能解決"出错时的弹窗说了"group”"
"显示伤害的脚本会无法起作用"
有起作用吧,,,只不过显示的是白字而不是图片素材数字
大约825行的
def create_sprites
if @value.is_a?(Numeric)
create_number
红色的部分不知道为啥, 加了"修改游戏分辨率的脚本"后, 会由true变成了false
另建议別用这个"修改游戏分辨率的脚本"
另你DEFAULT_BASE_SLOTS = [0,0,0,0, ...
|