赞 | 3 |
VIP | 0 |
好人卡 | 1 |
积分 | 4 |
经验 | 5316 |
最后登录 | 2024-11-15 |
在线时间 | 101 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 395
- 在线时间
- 101 小时
- 注册时间
- 2009-2-3
- 帖子
- 318
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 wxx45600 于 2014-2-3 21:28 编辑
在VA中的战斗显示脸图和装备介绍增强之间的问题。。就是无法兼容。。
不知道有没有大神能帮忙解决
代码:
装备增强:
#encoding:utf-8 #============================================================================== # ■ 装备说明增强 By wyongcan #============================================================================== module Equipplus CODE ={ 11 => "属性抗性", 12 => "弱化抗性", 13 => "状态抗性", 14 => "状态免疫", 21 => "普通能力", 22 => "添加能力", 23 => "特殊能力", 31 => "攻击附带属性", 32 => "攻击附带状态", 33 => "修正攻击速度", 34 => "添加攻击次数", 41 => "添加技能类型", 42 => "禁用技能类型", 43 => "添加技能", 44 => "禁用技能", 51 => "可装备武器类型", 52 => "可装备护甲类型", 53 => "固定装备", 54 => "禁用装备", 55 => "装备风格", 61 => "添加行动次数", 62 => "特殊标志", 63 => "消失效果", 64 => "队伍能力"} #特殊标志 FLAG ={ 0 => "自动战斗", 1 => "擅长防御", 2 => "保护弱者", 3 => "特技专注"} #普通能力 PARAM ={ 0 => "最大HP", 1 => "最大MP", 2 => "物理攻击", 3 => "物理防御", 4 => "魔法攻击", 5 => "魔法防御", 6 => "敏 捷 值", 7 => "幸 运 值"} #添加能力 XPARAM ={ 0 => "物理命中几率:", 1 => "物理闪避几率:", 2 => "必杀几率:", 3 => "必杀闪避几率:", 4 => "魔法闪避几率:", 5 => "魔法反射几率:", 6 => "物理反击几率:", 7 => "体力值再生速度:", 8 => "魔力值再生速度:", 9 => "特技值再生速度:"} #特殊能力 SPARAM ={ 0 => "受到攻击的几率", 1 => "防御效果比率", 2 => "恢复效果比率", 3 => "药理知识", 4 => "MP消费率", 5 => "TP消耗率", 6 => "物理伤害加成", 7 => "魔法伤害加成", 8 => "地形伤害加成", 9 => "经验获得加成"} @队伍能力 ={ 0 => "遇敌几率减半", 1 => "随机遇敌无效", 2 => "敌人偷袭无效", 3 => "先制攻击几率上升", 4 => "获得金钱数量双倍", 5 => "物品掉落几率双倍"} def self.equiphelpready @状态 = {} @武器类型 = {} @防具类型 = {} @属性 = {} $data_states.each{|x| @状态[x.id] = x.name if x != nil} elements = $data_system.elements weapon_types = $data_system.weapon_types armor_types = $data_system.armor_types elements.each_with_index{|x,y| @属性[y] = x if x != ""} weapon_types.each_with_index{|x,y| @武器类型[y] = x if x != ""} armor_types.each_with_index{|x,y| @防具类型[y] = x if x != ""} end def self.getequiphelp(equip) help = "" param = [] equip.params.each_with_index{|x,y| param.push([PARAM[y],x])} param = param.select{|x| x[1] != 0} param.each{|x| help += x[0] + ":" + x[1].to_int.to_s + "\n"} features = equip.features features.select{|x| x.code == 55}.each{|x| help += CODE[x.code] + ":双持武器" + "\n"} features.select{|x| x.code == 11}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "*" + x.value.to_s + "\n"} features.select{|x| x.code == 12}.each{|x| help += CODE[x.code] + ":" + PARAM[x.data_id] + "*" + x.value.to_s + "\n"} features.select{|x| x.code == 13}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "*" + x.value.to_s + "\n"} features.select{|x| x.code == 14}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "\n"} features.select{|x| x.code == 31}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "\n"} features.select{|x| x.code == 32}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "+" + x.value.to_s + "\n"} features.select{|x| x.code == 33}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"} features.select{|x| x.code == 34}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"} features.select{|x| x.code == 41}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法") + "\n"} features.select{|x| x.code == 42}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法") + "\n"} features.select{|x| x.code == 43}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name + "\n"} features.select{|x| x.code == 44}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name + "\n"} features.select{|x| x.code == 51}.each{|x| help += CODE[x.code] + ":" + @武器类型[x.data_id] + "\n"} features.select{|x| x.code == 52}.each{|x| help += CODE[x.code] + ":" + @防具类型[x.data_id] + "\n"} features.select{|x| x.code == 61}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"} features.select{|x| x.code == 62}.each{|x| help += CODE[x.code] + ":" + FLAG[x.data_id] + "\n"} features.select{|x| x.code == 64}.each{|x| help += CODE[x.code] + ":" + @队伍能力[x.data_id] + "\n"} featuresparam = [] featuresparam.push features.select{|x| x.code == 21} featuresparam.push features.select{|x| x.code == 22} featuresparam.push features.select{|x| x.code == 23} featuresparam[0].each{|x| help += PARAM[x.data_id] + "*" + x.value.to_s + "\n"} featuresparam[1].each{|x| help += XPARAM[x.data_id] + x.value.to_s + "\n"} featuresparam[2].each{|x| help += SPARAM[x.data_id] + "*" + x.value.to_s + "\n"} help end def self.getline(text,maxtext) xtext = [] line = 0 text.each_line{|x| xtext.push x.sub(/\n/){}} xtext.each{|x| x.size % maxtext != 0 ? line += x.size / maxtext + 1 : line += x.size / maxtext} line end end #============================================================================== # ■ Window_Help #------------------------------------------------------------------------------ # 显示特技和物品等的说明、以及角色状态的窗口 #============================================================================== class Window_Help2 < Window_Base #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- def initialize(line_number = 0) super(0, 0, 210, 0) self.z = 150 contents.font.size = 14 hide end #-------------------------------------------------------------------------- # ● 设置内容 #-------------------------------------------------------------------------- def set_text(text) @text = text refresh end #-------------------------------------------------------------------------- # ● 清除 #-------------------------------------------------------------------------- def clear set_text("") end #-------------------------------------------------------------------------- # ● 更新帮助位置 #-------------------------------------------------------------------------- def uppos(index,rect,window) self.height = fitting_height2(Equipplus.getline(@xtext,13)) create_contents contents.font.size = 14 rect.x -= window.ox rect.y -= window.oy ax = rect.x + rect.width + 10 ax = rect.x - self.width + 10 if ax + self.width > window.width + 10 ax += window.x ax = 0 if ax < 0 ay = rect.y + rect.height ay = rect.y - self.height if ay + self.height > window.height ay += window.y ay = 0 if ay < 0 self.x = ax self.y = ay set_text(@xtext) show end #-------------------------------------------------------------------------- # ● 设置物品 # item : 技能、物品等 #-------------------------------------------------------------------------- def set_item(item) if item == nil set_text("") return end @xtext = "" @xtext = "名称:" + item.name + "\n" @xtext += "介绍:" + item.description + "\n" @xtext += "价格:" + item.price.to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item) @xtext += Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem) @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n" end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh contents.clear hide if @text == "" draw_text_ex(4, 0, @text,width,40,false) end end class Window_Base < Window #-------------------------------------------------------------------------- # ● 计算窗口显示指定行数时的应用高度2************************* #-------------------------------------------------------------------------- def fitting_height2(line_number) line_number * contents.font.size + standard_padding * 2 end #~ draw_text_ex的增强,使其可以自动换行 原作者:叶子 修改:wyongcan #-------------------------------------------------------------------------- # ● 绘制带有控制符的文本内容 # 如果传递了width参数的话,会自动换行 #-------------------------------------------------------------------------- def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true) reset_font_settings if normalfont == true text = convert_escape_characters(text) pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)} if width != nil pos[:height] = contents.font.size pos[:width] = width pos[:textwidth] = textwidth end process_character(text.slice!(0, 1), text, pos) until text.empty? end #-------------------------------------------------------------------------- # ● 文字的处理 # c : 文字 # text : 绘制处理中的字符串缓存(字符串可能会被修改) # pos : 绘制位置 {:x, :y, :new_x, :height} #-------------------------------------------------------------------------- def process_character(c, text, pos) case c when "\r" # 回车 return when "\n" # 换行 process_new_line(text, pos) when "\f" # 翻页 process_new_page(text, pos) when "\e" # 控制符 process_escape_character(obtain_escape_code(text), text, pos) else # 普通文字 pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth] if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width] process_new_line(text, pos) end process_normal_character(c, pos) end end end class Window_ItemList < Window_Selectable #-------------------------------------------------------------------------- # ● 更新帮助内容 #-------------------------------------------------------------------------- def update_help @help_window.set_item(item) @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil end end class Window_SkillList < Window_Selectable #-------------------------------------------------------------------------- # ● 更新帮助内容 #-------------------------------------------------------------------------- def update_help @help_window.set_item(item) @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil end end class Window_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- # ● 更新帮助内容 #-------------------------------------------------------------------------- def update_help @help_window.set_item(item) if @help_window @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window @status_window.item = item if @status_window end end class Window_EquipSlot < Window_Selectable #-------------------------------------------------------------------------- # ● 更新帮助内容 #-------------------------------------------------------------------------- def update_help super @help_window.set_item(item) if @help_window @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window @status_window.set_temp_actor(nil) if @status_window end end class Scene_Shop < Scene_MenuBase alias on_sell_ok_old on_sell_ok def on_sell_ok on_sell_ok_old @help_window.hide end alias on_buy_ok_old on_buy_ok def on_buy_ok on_buy_ok_old @help_window.hide end alias on_number_ok_old on_number_ok def on_number_ok on_number_ok_old @help_window.refresh @help_window.show end alias on_number_cancel_old on_number_cancel def on_number_cancel on_number_cancel_old @help_window.refresh @help_window.show end end class Scene_Title < Scene_Base alias start_old start def start start_old Equipplus.equiphelpready end end class Scene_ItemBase < Scene_MenuBase alias old_on_actor_cancel on_actor_cancel def on_actor_cancel old_on_actor_cancel @help_window.refresh end alias old_on_actor_ok on_actor_ok def on_actor_ok old_on_actor_ok @help_window.refresh end end class Window_Base < Window alias old_process_new_line process_new_line def process_new_line(text, pos) old_process_new_line(text, pos) pos[:height] = contents.font.size if pos[:width] != nil end end class Scene_MenuBase < Scene_Base def create_help_window @help_window = Window_Help2.new @help_window.viewport = @viewport end end class Scene_Battle < Scene_Base def create_help_window @help_window = Window_Help2.new @help_window.visible = false end end
#encoding:utf-8
#==============================================================================
# ■ 装备说明增强 By wyongcan
#==============================================================================
module Equipplus
CODE ={
11 => "属性抗性",
12 => "弱化抗性",
13 => "状态抗性",
14 => "状态免疫",
21 => "普通能力",
22 => "添加能力",
23 => "特殊能力",
31 => "攻击附带属性",
32 => "攻击附带状态",
33 => "修正攻击速度",
34 => "添加攻击次数",
41 => "添加技能类型",
42 => "禁用技能类型",
43 => "添加技能",
44 => "禁用技能",
51 => "可装备武器类型",
52 => "可装备护甲类型",
53 => "固定装备",
54 => "禁用装备",
55 => "装备风格",
61 => "添加行动次数",
62 => "特殊标志",
63 => "消失效果",
64 => "队伍能力"}
#特殊标志
FLAG ={
0 => "自动战斗",
1 => "擅长防御",
2 => "保护弱者",
3 => "特技专注"}
#普通能力
PARAM ={
0 => "最大HP",
1 => "最大MP",
2 => "物理攻击",
3 => "物理防御",
4 => "魔法攻击",
5 => "魔法防御",
6 => "敏 捷 值",
7 => "幸 运 值"}
#添加能力
XPARAM ={
0 => "物理命中几率:",
1 => "物理闪避几率:",
2 => "必杀几率:",
3 => "必杀闪避几率:",
4 => "魔法闪避几率:",
5 => "魔法反射几率:",
6 => "物理反击几率:",
7 => "体力值再生速度:",
8 => "魔力值再生速度:",
9 => "特技值再生速度:"}
#特殊能力
SPARAM ={
0 => "受到攻击的几率",
1 => "防御效果比率",
2 => "恢复效果比率",
3 => "药理知识",
4 => "MP消费率",
5 => "TP消耗率",
6 => "物理伤害加成",
7 => "魔法伤害加成",
8 => "地形伤害加成",
9 => "经验获得加成"}
@队伍能力 ={
0 => "遇敌几率减半",
1 => "随机遇敌无效",
2 => "敌人偷袭无效",
3 => "先制攻击几率上升",
4 => "获得金钱数量双倍",
5 => "物品掉落几率双倍"}
def self.equiphelpready
@状态 = {}
@武器类型 = {}
@防具类型 = {}
@属性 = {}
$data_states.each{|x| @状态[x.id] = x.name if x != nil}
elements = $data_system.elements
weapon_types = $data_system.weapon_types
armor_types = $data_system.armor_types
elements.each_with_index{|x,y| @属性[y] = x if x != ""}
weapon_types.each_with_index{|x,y| @武器类型[y] = x if x != ""}
armor_types.each_with_index{|x,y| @防具类型[y] = x if x != ""}
end
def self.getequiphelp(equip)
help = ""
param = []
equip.params.each_with_index{|x,y| param.push([PARAM[y],x])}
param = param.select{|x| x[1] != 0}
param.each{|x| help += x[0] + ":" + x[1].to_int.to_s + "\n"}
features = equip.features
features.select{|x| x.code == 55}.each{|x| help += CODE[x.code] + ":双持武器" + "\n"}
features.select{|x| x.code == 11}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "*" + x.value.to_s + "\n"}
features.select{|x| x.code == 12}.each{|x| help += CODE[x.code] + ":" + PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
features.select{|x| x.code == 13}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "*" + x.value.to_s + "\n"}
features.select{|x| x.code == 14}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "\n"}
features.select{|x| x.code == 31}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "\n"}
features.select{|x| x.code == 32}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "+" + x.value.to_s + "\n"}
features.select{|x| x.code == 33}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
features.select{|x| x.code == 34}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
features.select{|x| x.code == 41}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法") + "\n"}
features.select{|x| x.code == 42}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法") + "\n"}
features.select{|x| x.code == 43}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name + "\n"}
features.select{|x| x.code == 44}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name + "\n"}
features.select{|x| x.code == 51}.each{|x| help += CODE[x.code] + ":" + @武器类型[x.data_id] + "\n"}
features.select{|x| x.code == 52}.each{|x| help += CODE[x.code] + ":" + @防具类型[x.data_id] + "\n"}
features.select{|x| x.code == 61}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
features.select{|x| x.code == 62}.each{|x| help += CODE[x.code] + ":" + FLAG[x.data_id] + "\n"}
features.select{|x| x.code == 64}.each{|x| help += CODE[x.code] + ":" + @队伍能力[x.data_id] + "\n"}
featuresparam = []
featuresparam.push features.select{|x| x.code == 21}
featuresparam.push features.select{|x| x.code == 22}
featuresparam.push features.select{|x| x.code == 23}
featuresparam[0].each{|x| help += PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
featuresparam[1].each{|x| help += XPARAM[x.data_id] + x.value.to_s + "\n"}
featuresparam[2].each{|x| help += SPARAM[x.data_id] + "*" + x.value.to_s + "\n"}
help
end
def self.getline(text,maxtext)
xtext = []
line = 0
text.each_line{|x| xtext.push x.sub(/\n/){}}
xtext.each{|x| x.size % maxtext != 0 ? line += x.size / maxtext + 1 : line += x.size / maxtext}
line
end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 显示特技和物品等的说明、以及角色状态的窗口
#==============================================================================
class Window_Help2 < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(line_number = 0)
super(0, 0, 210, 0)
self.z = 150
contents.font.size = 14
hide
end
#--------------------------------------------------------------------------
# ● 设置内容
#--------------------------------------------------------------------------
def set_text(text)
@text = text
refresh
end
#--------------------------------------------------------------------------
# ● 清除
#--------------------------------------------------------------------------
def clear
set_text("")
end
#--------------------------------------------------------------------------
# ● 更新帮助位置
#--------------------------------------------------------------------------
def uppos(index,rect,window)
self.height = fitting_height2(Equipplus.getline(@xtext,13))
create_contents
contents.font.size = 14
rect.x -= window.ox
rect.y -= window.oy
ax = rect.x + rect.width + 10
ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
ax += window.x
ax = 0 if ax < 0
ay = rect.y + rect.height
ay = rect.y - self.height if ay + self.height > window.height
ay += window.y
ay = 0 if ay < 0
self.x = ax
self.y = ay
set_text(@xtext)
show
end
#--------------------------------------------------------------------------
# ● 设置物品
# item : 技能、物品等
#--------------------------------------------------------------------------
def set_item(item)
if item == nil
set_text("")
return
end
@xtext = ""
@xtext = "名称:" + item.name + "\n"
@xtext += "介绍:" + item.description + "\n"
@xtext += "价格:" + item.price.to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
@xtext += Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
@xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
hide if @text == ""
draw_text_ex(4, 0, @text,width,40,false)
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 计算窗口显示指定行数时的应用高度2*************************
#--------------------------------------------------------------------------
def fitting_height2(line_number)
line_number * contents.font.size + standard_padding * 2
end
#~ draw_text_ex的增强,使其可以自动换行 原作者:叶子 修改:wyongcan
#--------------------------------------------------------------------------
# ● 绘制带有控制符的文本内容
# 如果传递了width参数的话,会自动换行
#--------------------------------------------------------------------------
def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true)
reset_font_settings if normalfont == true
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
if width != nil
pos[:height] = contents.font.size
pos[:width] = width
pos[:textwidth] = textwidth
end
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
#--------------------------------------------------------------------------
# ● 文字的处理
# c : 文字
# text : 绘制处理中的字符串缓存(字符串可能会被修改)
# pos : 绘制位置 {:x, :y, :new_x, :height}
#--------------------------------------------------------------------------
def process_character(c, text, pos)
case c
when "\r" # 回车
return
when "\n" # 换行
process_new_line(text, pos)
when "\f" # 翻页
process_new_page(text, pos)
when "\e" # 控制符
process_escape_character(obtain_escape_code(text), text, pos)
else # 普通文字
pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
process_new_line(text, pos)
end
process_normal_character(c, pos)
end
end
end
class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
end
end
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
end
end
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item) if @help_window
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
@status_window.item = item if @status_window
end
end
class Window_EquipSlot < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
super
@help_window.set_item(item) if @help_window
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
@status_window.set_temp_actor(nil) if @status_window
end
end
class Scene_Shop < Scene_MenuBase
alias on_sell_ok_old on_sell_ok
def on_sell_ok
on_sell_ok_old
@help_window.hide
end
alias on_buy_ok_old on_buy_ok
def on_buy_ok
on_buy_ok_old
@help_window.hide
end
alias on_number_ok_old on_number_ok
def on_number_ok
on_number_ok_old
@help_window.refresh
@help_window.show
end
alias on_number_cancel_old on_number_cancel
def on_number_cancel
on_number_cancel_old
@help_window.refresh
@help_window.show
end
end
class Scene_Title < Scene_Base
alias start_old start
def start
start_old
Equipplus.equiphelpready
end
end
class Scene_ItemBase < Scene_MenuBase
alias old_on_actor_cancel on_actor_cancel
def on_actor_cancel
old_on_actor_cancel
@help_window.refresh
end
alias old_on_actor_ok on_actor_ok
def on_actor_ok
old_on_actor_ok
@help_window.refresh
end
end
class Window_Base < Window
alias old_process_new_line process_new_line
def process_new_line(text, pos)
old_process_new_line(text, pos)
pos[:height] = contents.font.size if pos[:width] != nil
end
end
class Scene_MenuBase < Scene_Base
def create_help_window
@help_window = Window_Help2.new
@help_window.viewport = @viewport
end
end
class Scene_Battle < Scene_Base
def create_help_window
@help_window = Window_Help2.new
@help_window.visible = false
end
end
战斗脸图:
$脸图战斗 = true $imported = {} if $imported.nil? module YEA module BATTLE SKIP_PARTY_COMMAND = true BATTLESTATUS_NAME_FONT_SIZE = 20 BATTLESTATUS_TEXT_FONT_SIZE = 16 BATTLESTATUS_NO_ACTION_ICON = 185 BATTLESTATUS_HPGAUGE_Y_PLUS = 11 BATTLESTATUS_CENTER_FACES = false HELP_TEXT_ALL_FOES = "全体敌人" HELP_TEXT_ONE_RANDOM_FOE = "单个敌人" HELP_TEXT_MANY_RANDOM_FOE = "%d个随机敌人" HELP_TEXT_ALL_ALLIES = "全体队友" HELP_TEXT_ALL_DEAD_ALLIES = "全体死亡队友" HELP_TEXT_ONE_RANDOM_ALLY = "单个随机队友" HELP_TEXT_RANDOM_ALLIES = "%d个随机队友" end end class Game_Battler def can_collapse? return false unless dead? unless actor? return false unless sprite.battler_visible array = [:collapse, :boss_collapse, :instant_collapse] return false if array.include?(sprite.effect_type) end return true end def draw_mp? return true end def draw_tp? return $data_system.opt_display_tp end end module Icon def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end end class Game_Temp attr_accessor :battle_aid attr_accessor :evaluating end class Game_Action alias evaluate_item_with_target_abe evaluate_item_with_target def evaluate_item_with_target(target) $game_temp.evaluating = true result = evaluate_item_with_target_abe(target) $game_temp.evaluating = false return result end end class Game_Actor < Game_Battler def draw_mp? return true unless draw_tp? for skill in skills next unless added_skill_types.include?(skill.stype_id) return true if skill.mp_cost > 0 end return false end def draw_tp? return false unless $data_system.opt_display_tp for skill in skills next unless added_skill_types.include?(skill.stype_id) return true if skill.tp_cost > 0 end return false end end class Window_BattleStatus < Window_Selectable def initialize super(0, 0, window_width, window_height) self.openness = 0 @party = $game_party.battle_members.clone end def col_max; return $game_party.max_battle_members; end def battle_members; return $game_party.battle_members; end def actor; return battle_members[@index]; end def update super return if @party == $game_party.battle_members @party = $game_party.battle_members.clone refresh end def draw_item(index) return if index.nil? clear_item(index) actor = battle_members[index] rect = item_rect(index) return if actor.nil? draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?) draw_actor_name(actor, rect.x, rect.y, rect.width-8) draw_actor_action(actor, rect.x, rect.y) draw_actor_icons(actor, rect.x, line_height*1, rect.width) gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4) if draw_tp?(actor) && draw_mp?(actor) dw = rect.width/2-2 dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE draw_actor_tp(actor, rect.x+2, line_height*3, dw) dw = rect.width - rect.width/2 - 2 draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw) elsif draw_tp?(actor) && !draw_mp?(actor) draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4) else draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4) end end def item_rect(index) rect = Rect.new rect.width = contents.width / $game_party.max_battle_members rect.height = contents.height rect.x = index * rect.width if YEA::BATTLE::BATTLESTATUS_CENTER_FACES rect.x += (contents.width - $game_party.members.size * rect.width) / 2 end rect.y = 0 return rect end def draw_face(face_name, face_index, dx, dy, enabled = true) bitmap = Cache.face(face_name) fx = [(96 - item_rect(0).width + 1) / 2, 0].max fy = face_index / 4 * 96 + 2 fw = [item_rect(0).width - 4, 92].min rect = Rect.new(fx, fy, fw, 92) rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92) contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha) bitmap.dispose end def draw_actor_name(actor, dx, dy, dw = 112) reset_font_settings contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE change_color(hp_color(actor)) draw_text(dx+24, dy, dw-24, line_height, actor.name) end def draw_actor_action(actor, dx, dy) draw_icon(action_icon(actor), dx, dy) end def action_icon(actor) return Icon.no_action if actor.current_action.nil? return Icon.no_action if actor.current_action.item.nil? return actor.current_action.item.icon_index end def draw_tp?(actor) return actor.draw_tp? end def draw_mp?(actor) return actor.draw_mp? end def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2) change_color(color1) draw_text(dx, dy, dw, line_height, current.to_s, 2) end def draw_actor_hp(actor, dx, dy, width = 124) draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2) change_color(system_color) cy = (Font.default_size - contents.font.size) / 2 + 1 draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a) draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp, hp_color(actor), normal_color) end def draw_actor_mp(actor, dx, dy, width = 124) draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2) change_color(system_color) cy = (Font.default_size - contents.font.size) / 2 + 1 draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a) draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp, mp_color(actor), normal_color) end def draw_actor_tp(actor, dx, dy, width = 124) draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2) change_color(system_color) cy = (Font.default_size - contents.font.size) / 2 + 1 draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a) change_color(tp_color(actor)) draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2) end end class Window_BattleActor < Window_BattleStatus def show create_flags super end def create_flags set_select_flag(:any) select(0) return if $game_temp.battle_aid.nil? if $game_temp.battle_aid.need_selection? select(0) set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend? elsif $game_temp.battle_aid.for_user? battler = BattleManager.actor id = battler.nil? ? 0 : $game_party.battle_members.index(battler) select(id) set_select_flag(:user) elsif $game_temp.battle_aid.for_all? select(0) set_select_flag(:all) set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend? elsif $game_temp.battle_aid.for_random? select(0) set_select_flag(:random) if $game_temp.battle_aid.for_random? end end def set_select_flag(flag) @select_flag = flag case @select_flag when :all, :all_dead, :random @cursor_all = true else @cursor_all = false end end def update_cursor if @cursor_all cursor_rect.set(0, 0, contents.width, contents.height) self.top_row = 0 elsif [url=home.php?mod=space&uid=370741]@Index[/url] < 0 cursor_rect.empty else ensure_cursor_visible cursor_rect.set(item_rect(@index)) end end def cursor_movable? return false if @select_flag == :user return super end def current_item_enabled? return true if $game_temp.battle_aid.nil? if $game_temp.battle_aid.need_selection? member = $game_party.battle_members[@index] return member.dead? if $game_temp.battle_aid.for_dead_friend? elsif $game_temp.battle_aid.for_dead_friend? for member in $game_party.battle_members return true if member.dead? end return false end return true end end class Window_BattleStatusAid < Window_BattleStatus attr_accessor :status_window def initialize super self.visible = false self.openness = 255 end def window_width; return 128; end def show super refresh end def refresh contents.clear return if @status_window.nil? draw_item(@status_window.index) end def item_rect(index) return Rect.new(0, 0, contents.width, contents.height) end end class Window_BattleEnemy < Window_Selectable def initialize(info_viewport) super(0, Graphics.height, window_width, fitting_height(1)) refresh self.visible = false @info_viewport = info_viewport end def col_max; return item_max; end def show create_flags super end def create_flags set_select_flag(:any) select(0) return if $game_temp.battle_aid.nil? if $game_temp.battle_aid.need_selection? select(0) elsif $game_temp.battle_aid.for_all? select(0) set_select_flag(:all) elsif $game_temp.battle_aid.for_random? select(0) set_select_flag(:random) end end def set_select_flag(flag) @select_flag = flag case @select_flag when :all, :random @cursor_all = true else @cursor_all = false end end def select_all? return true if @select_flag == :all return true if @select_flag == :random return false end def update_cursor if @cursor_all cursor_rect.set(0, 0, contents.width, contents.height) self.top_row = 0 elsif [url=home.php?mod=space&uid=370741]@Index[/url] < 0 cursor_rect.empty else ensure_cursor_visible cursor_rect.set(item_rect(@index)) end end def cursor_movable? return false if @select_flag == :user return super end def current_item_enabled? return true if $game_temp.battle_aid.nil? if $game_temp.battle_aid.need_selection? member = $game_party.battle_members[@index] return member.dead? if $game_temp.battle_aid.for_dead_friend? elsif $game_temp.battle_aid.for_dead_friend? for member in $game_party.battle_members return true if member.dead? end return false end return true end def enemy; @data[index]; end def refresh make_item_list create_contents draw_all_items end def make_item_list @data = $game_troop.alive_members @data.sort! { |a,b| a.screen_x <=> b.screen_x } end def draw_item(index); return; end def update super return unless active enemy.sprite_effect_type = :whiten return unless select_all? for enemy in $game_troop.alive_members enemy.sprite_effect_type = :whiten end end end class Window_BattleHelp < Window_Help attr_accessor :actor_window attr_accessor :enemy_window def update super if !self.visible and @text != "" @text = "" return refresh end update_battler_name end def update_battler_name return unless @actor_window.active || @enemy_window.active if @actor_window.active battler = $game_party.battle_members[@actor_window.index] elsif @enemy_window.active battler = @enemy_window.enemy end if special_display? refresh_special_case(battler) else refresh_battler_name(battler) if battler_name(battler) != @text end end def battler_name(battler) text = battler.name.clone return text end def refresh_battler_name(battler) contents.clear reset_font_settings change_color(normal_color) @text = battler_name(battler) icons = battler.state_icons + battler.buff_icons dy = icons.size <= 0 ? line_height / 2 : 0 draw_text(0, dy, contents.width, line_height, @text, 1) dx = (contents.width - (icons.size * 24)) / 2 draw_actor_icons(battler, dx, line_height, contents.width) end def special_display? return false if $game_temp.battle_aid.nil? return false if $game_temp.battle_aid.for_user? return !$game_temp.battle_aid.need_selection? end def refresh_special_case(battler) if $game_temp.battle_aid.for_opponent? if $game_temp.battle_aid.for_all? text = YEA::BATTLE::HELP_TEXT_ALL_FOES else case $game_temp.battle_aid.number_of_targets when 1 text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE else number = $game_temp.battle_aid.number_of_targets text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number) end end else if $game_temp.battle_aid.for_dead_friend? text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES elsif $game_temp.battle_aid.for_random? case $game_temp.battle_aid.number_of_targets when 1 text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY else number = $game_temp.battle_aid.number_of_targets text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number) end else text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES end end return if text == @text @text = text contents.clear reset_font_settings draw_text(0, 0, contents.width, line_height*2, @text, 1) end end class Window_SkillList < Window_Selectable def spacing return 8 if $game_party.in_battle return super end end class Window_ItemList < Window_Selectable def spacing return 8 if $game_party.in_battle return super end end class Scene_Battle < Scene_Base attr_accessor :enemy_window attr_accessor :info_viewport attr_accessor :spriteset attr_accessor :status_window attr_accessor :status_aid_window attr_accessor :subject alias scene_battle_create_all_windows_abe create_all_windows def create_all_windows scene_battle_create_all_windows_abe create_battle_status_aid_window set_help_window end alias scene_battle_create_info_viewport_abe create_info_viewport def create_info_viewport scene_battle_create_info_viewport_abe @status_window.refresh end def create_battle_status_aid_window @status_aid_window = Window_BattleStatusAid.new @status_aid_window.status_window = @status_window @status_aid_window.x = Graphics.width - @status_aid_window.width @status_aid_window.y = Graphics.height - @status_aid_window.height end def create_help_window @help_window = Window_BattleHelp.new @help_window.hide end def set_help_window @help_window.actor_window = @actor_window @help_window.enemy_window = @enemy_window end alias scene_battle_create_skill_window_abe create_skill_window def create_skill_window scene_battle_create_skill_window_abe @skill_window.height = @info_viewport.rect.height @skill_window.width = Graphics.width - @actor_command_window.width @skill_window.y = Graphics.height - @skill_window.height end alias scene_battle_create_item_window_abe create_item_window def create_item_window scene_battle_create_item_window_abe @item_window.height = @skill_window.height @item_window.width = @skill_window.width @item_window.y = Graphics.height - @item_window.height end alias scene_battle_next_command_abe next_command def next_command @status_window.show redraw_current_status @actor_command_window.show @status_aid_window.hide scene_battle_next_command_abe end alias scene_battle_prior_command_abe prior_command def prior_command redraw_current_status scene_battle_prior_command_abe end def redraw_current_status return if @status_window.index < 0 @status_window.draw_item(@status_window.index) end alias scene_battle_command_attack_abe command_attack def command_attack $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id] scene_battle_command_attack_abe end alias scene_battle_command_skill_abe command_skill def command_skill scene_battle_command_skill_abe @status_window.hide @actor_command_window.hide @status_aid_window.show end alias scene_battle_command_item_abe command_item def command_item scene_battle_command_item_abe @status_window.hide @actor_command_window.hide @status_aid_window.show end def on_skill_ok [url=home.php?mod=space&uid=260100]@skill[/url] = @skill_window.item $game_temp.battle_aid = @skill BattleManager.actor.input.set_skill(@skill.id) BattleManager.actor.last_skill.object = @skill if @skill.for_opponent? select_enemy_selection elsif @skill.for_friend? select_actor_selection else @skill_window.hide next_command $game_temp.battle_aid = nil end end alias scene_battle_on_skill_cancel_abe on_skill_cancel def on_skill_cancel scene_battle_on_skill_cancel_abe @status_window.show @actor_command_window.show @status_aid_window.hide end def on_item_ok @item = @item_window.item $game_temp.battle_aid = @item BattleManager.actor.input.set_item(@item.id) if @item.for_opponent? select_enemy_selection elsif @item.for_friend? select_actor_selection else @item_window.hide next_command $game_temp.battle_aid = nil end $game_party.last_item.object = @item end alias scene_battle_on_item_cancel_abe on_item_cancel def on_item_cancel scene_battle_on_item_cancel_abe @status_window.show @actor_command_window.show @status_aid_window.hide end alias scene_battle_select_actor_selection_abe select_actor_selection def select_actor_selection @status_aid_window.refresh scene_battle_select_actor_selection_abe @status_window.hide @skill_window.hide @item_window.hide @help_window.show end alias scene_battle_on_actor_ok_abe on_actor_ok def on_actor_ok $game_temp.battle_aid = nil scene_battle_on_actor_ok_abe @status_window.show if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil? @actor_command_window.visible = !@confirm_command_window.visible else @actor_command_window.show end @status_aid_window.hide end alias scene_battle_on_actor_cancel_abe on_actor_cancel def on_actor_cancel BattleManager.actor.input.clear @status_aid_window.refresh $game_temp.battle_aid = nil scene_battle_on_actor_cancel_abe case @actor_command_window.current_symbol when :skill @skill_window.show when :item @item_window.show end end alias scene_battle_select_enemy_selection_abe select_enemy_selection def select_enemy_selection @status_aid_window.refresh scene_battle_select_enemy_selection_abe @help_window.show end alias scene_battle_on_enemy_ok_abe on_enemy_ok def on_enemy_ok $game_temp.battle_aid = nil scene_battle_on_enemy_ok_abe end alias scene_battle_on_enemy_cancel_abe on_enemy_cancel def on_enemy_cancel BattleManager.actor.input.clear @status_aid_window.refresh $game_temp.battle_aid = nil scene_battle_on_enemy_cancel_abe if @skill_window.visible || @item_window.visible @help_window.show else @help_window.hide end end def end_battle_conditions? return true if $game_party.members.empty? return true if $game_party.all_dead? return true if $game_troop.all_dead? return true if BattleManager.aborting? return false end def refresh_status #如果你是程序员,请顺手帮忙优化下这里,谢谢。 @status_window.refresh for i in $game_party.battle_members @status_window.draw_item($game_party.battle_members.index(i)) end end end
$脸图战斗 = true
$imported = {} if $imported.nil?
module YEA
module BATTLE
SKIP_PARTY_COMMAND = true
BATTLESTATUS_NAME_FONT_SIZE = 20
BATTLESTATUS_TEXT_FONT_SIZE = 16
BATTLESTATUS_NO_ACTION_ICON = 185
BATTLESTATUS_HPGAUGE_Y_PLUS = 11
BATTLESTATUS_CENTER_FACES = false
HELP_TEXT_ALL_FOES = "全体敌人"
HELP_TEXT_ONE_RANDOM_FOE = "单个敌人"
HELP_TEXT_MANY_RANDOM_FOE = "%d个随机敌人"
HELP_TEXT_ALL_ALLIES = "全体队友"
HELP_TEXT_ALL_DEAD_ALLIES = "全体死亡队友"
HELP_TEXT_ONE_RANDOM_ALLY = "单个随机队友"
HELP_TEXT_RANDOM_ALLIES = "%d个随机队友"
end
end
class Game_Battler
def can_collapse?
return false unless dead?
unless actor?
return false unless sprite.battler_visible
array = [:collapse, :boss_collapse, :instant_collapse]
return false if array.include?(sprite.effect_type)
end
return true
end
def draw_mp?
return true
end
def draw_tp?
return $data_system.opt_display_tp
end
end
module Icon
def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
end
class Game_Temp
attr_accessor :battle_aid
attr_accessor :evaluating
end
class Game_Action
alias evaluate_item_with_target_abe evaluate_item_with_target
def evaluate_item_with_target(target)
$game_temp.evaluating = true
result = evaluate_item_with_target_abe(target)
$game_temp.evaluating = false
return result
end
end
class Game_Actor < Game_Battler
def draw_mp?
return true unless draw_tp?
for skill in skills
next unless added_skill_types.include?(skill.stype_id)
return true if skill.mp_cost > 0
end
return false
end
def draw_tp?
return false unless $data_system.opt_display_tp
for skill in skills
next unless added_skill_types.include?(skill.stype_id)
return true if skill.tp_cost > 0
end
return false
end
end
class Window_BattleStatus < Window_Selectable
def initialize
super(0, 0, window_width, window_height)
self.openness = 0
@party = $game_party.battle_members.clone
end
def col_max; return $game_party.max_battle_members; end
def battle_members; return $game_party.battle_members; end
def actor; return battle_members[@index]; end
def update
super
return if @party == $game_party.battle_members
@party = $game_party.battle_members.clone
refresh
end
def draw_item(index)
return if index.nil?
clear_item(index)
actor = battle_members[index]
rect = item_rect(index)
return if actor.nil?
draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
draw_actor_name(actor, rect.x, rect.y, rect.width-8)
draw_actor_action(actor, rect.x, rect.y)
draw_actor_icons(actor, rect.x, line_height*1, rect.width)
gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
if draw_tp?(actor) && draw_mp?(actor)
dw = rect.width/2-2
dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
draw_actor_tp(actor, rect.x+2, line_height*3, dw)
dw = rect.width - rect.width/2 - 2
draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
elsif draw_tp?(actor) && !draw_mp?(actor)
draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
else
draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
end
end
def item_rect(index)
rect = Rect.new
rect.width = contents.width / $game_party.max_battle_members
rect.height = contents.height
rect.x = index * rect.width
if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
rect.x += (contents.width - $game_party.members.size * rect.width) / 2
end
rect.y = 0
return rect
end
def draw_face(face_name, face_index, dx, dy, enabled = true)
bitmap = Cache.face(face_name)
fx = [(96 - item_rect(0).width + 1) / 2, 0].max
fy = face_index / 4 * 96 + 2
fw = [item_rect(0).width - 4, 92].min
rect = Rect.new(fx, fy, fw, 92)
rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
def draw_actor_name(actor, dx, dy, dw = 112)
reset_font_settings
contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
change_color(hp_color(actor))
draw_text(dx+24, dy, dw-24, line_height, actor.name)
end
def draw_actor_action(actor, dx, dy)
draw_icon(action_icon(actor), dx, dy)
end
def action_icon(actor)
return Icon.no_action if actor.current_action.nil?
return Icon.no_action if actor.current_action.item.nil?
return actor.current_action.item.icon_index
end
def draw_tp?(actor)
return actor.draw_tp?
end
def draw_mp?(actor)
return actor.draw_mp?
end
def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
change_color(color1)
draw_text(dx, dy, dw, line_height, current.to_s, 2)
end
def draw_actor_hp(actor, dx, dy, width = 124)
draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
hp_color(actor), normal_color)
end
def draw_actor_mp(actor, dx, dy, width = 124)
draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
mp_color(actor), normal_color)
end
def draw_actor_tp(actor, dx, dy, width = 124)
draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
change_color(tp_color(actor))
draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
end
end
class Window_BattleActor < Window_BattleStatus
def show
create_flags
super
end
def create_flags
set_select_flag(:any)
select(0)
return if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
select(0)
set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_user?
battler = BattleManager.actor
id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
select(id)
set_select_flag(:user)
elsif $game_temp.battle_aid.for_all?
select(0)
set_select_flag(:all)
set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_random?
select(0)
set_select_flag(:random) if $game_temp.battle_aid.for_random?
end
end
def set_select_flag(flag)
@select_flag = flag
case @select_flag
when :all, :all_dead, :random
@cursor_all = true
else
@cursor_all = false
end
end
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, contents.height)
self.top_row = 0
elsif [url=home.php?mod=space&uid=370741]@Index[/url] < 0
cursor_rect.empty
else
ensure_cursor_visible
cursor_rect.set(item_rect(@index))
end
end
def cursor_movable?
return false if @select_flag == :user
return super
end
def current_item_enabled?
return true if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
member = $game_party.battle_members[@index]
return member.dead? if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_dead_friend?
for member in $game_party.battle_members
return true if member.dead?
end
return false
end
return true
end
end
class Window_BattleStatusAid < Window_BattleStatus
attr_accessor :status_window
def initialize
super
self.visible = false
self.openness = 255
end
def window_width; return 128; end
def show
super
refresh
end
def refresh
contents.clear
return if @status_window.nil?
draw_item(@status_window.index)
end
def item_rect(index)
return Rect.new(0, 0, contents.width, contents.height)
end
end
class Window_BattleEnemy < Window_Selectable
def initialize(info_viewport)
super(0, Graphics.height, window_width, fitting_height(1))
refresh
self.visible = false
@info_viewport = info_viewport
end
def col_max; return item_max; end
def show
create_flags
super
end
def create_flags
set_select_flag(:any)
select(0)
return if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
select(0)
elsif $game_temp.battle_aid.for_all?
select(0)
set_select_flag(:all)
elsif $game_temp.battle_aid.for_random?
select(0)
set_select_flag(:random)
end
end
def set_select_flag(flag)
@select_flag = flag
case @select_flag
when :all, :random
@cursor_all = true
else
@cursor_all = false
end
end
def select_all?
return true if @select_flag == :all
return true if @select_flag == :random
return false
end
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, contents.height)
self.top_row = 0
elsif [url=home.php?mod=space&uid=370741]@Index[/url] < 0
cursor_rect.empty
else
ensure_cursor_visible
cursor_rect.set(item_rect(@index))
end
end
def cursor_movable?
return false if @select_flag == :user
return super
end
def current_item_enabled?
return true if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
member = $game_party.battle_members[@index]
return member.dead? if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_dead_friend?
for member in $game_party.battle_members
return true if member.dead?
end
return false
end
return true
end
def enemy; @data[index]; end
def refresh
make_item_list
create_contents
draw_all_items
end
def make_item_list
@data = $game_troop.alive_members
@data.sort! { |a,b| a.screen_x <=> b.screen_x }
end
def draw_item(index); return; end
def update
super
return unless active
enemy.sprite_effect_type = :whiten
return unless select_all?
for enemy in $game_troop.alive_members
enemy.sprite_effect_type = :whiten
end
end
end
class Window_BattleHelp < Window_Help
attr_accessor :actor_window
attr_accessor :enemy_window
def update
super
if !self.visible and @text != ""
@text = ""
return refresh
end
update_battler_name
end
def update_battler_name
return unless @actor_window.active || @enemy_window.active
if @actor_window.active
battler = $game_party.battle_members[@actor_window.index]
elsif @enemy_window.active
battler = @enemy_window.enemy
end
if special_display?
refresh_special_case(battler)
else
refresh_battler_name(battler) if battler_name(battler) != @text
end
end
def battler_name(battler)
text = battler.name.clone
return text
end
def refresh_battler_name(battler)
contents.clear
reset_font_settings
change_color(normal_color)
@text = battler_name(battler)
icons = battler.state_icons + battler.buff_icons
dy = icons.size <= 0 ? line_height / 2 : 0
draw_text(0, dy, contents.width, line_height, @text, 1)
dx = (contents.width - (icons.size * 24)) / 2
draw_actor_icons(battler, dx, line_height, contents.width)
end
def special_display?
return false if $game_temp.battle_aid.nil?
return false if $game_temp.battle_aid.for_user?
return !$game_temp.battle_aid.need_selection?
end
def refresh_special_case(battler)
if $game_temp.battle_aid.for_opponent?
if $game_temp.battle_aid.for_all?
text = YEA::BATTLE::HELP_TEXT_ALL_FOES
else
case $game_temp.battle_aid.number_of_targets
when 1
text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
else
number = $game_temp.battle_aid.number_of_targets
text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
end
end
else
if $game_temp.battle_aid.for_dead_friend?
text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
elsif $game_temp.battle_aid.for_random?
case $game_temp.battle_aid.number_of_targets
when 1
text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
else
number = $game_temp.battle_aid.number_of_targets
text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
end
else
text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
end
end
return if text == @text
@text = text
contents.clear
reset_font_settings
draw_text(0, 0, contents.width, line_height*2, @text, 1)
end
end
class Window_SkillList < Window_Selectable
def spacing
return 8 if $game_party.in_battle
return super
end
end
class Window_ItemList < Window_Selectable
def spacing
return 8 if $game_party.in_battle
return super
end
end
class Scene_Battle < Scene_Base
attr_accessor :enemy_window
attr_accessor :info_viewport
attr_accessor :spriteset
attr_accessor :status_window
attr_accessor :status_aid_window
attr_accessor :subject
alias scene_battle_create_all_windows_abe create_all_windows
def create_all_windows
scene_battle_create_all_windows_abe
create_battle_status_aid_window
set_help_window
end
alias scene_battle_create_info_viewport_abe create_info_viewport
def create_info_viewport
scene_battle_create_info_viewport_abe
@status_window.refresh
end
def create_battle_status_aid_window
@status_aid_window = Window_BattleStatusAid.new
@status_aid_window.status_window = @status_window
@status_aid_window.x = Graphics.width - @status_aid_window.width
@status_aid_window.y = Graphics.height - @status_aid_window.height
end
def create_help_window
@help_window = Window_BattleHelp.new
@help_window.hide
end
def set_help_window
@help_window.actor_window = @actor_window
@help_window.enemy_window = @enemy_window
end
alias scene_battle_create_skill_window_abe create_skill_window
def create_skill_window
scene_battle_create_skill_window_abe
@skill_window.height = @info_viewport.rect.height
@skill_window.width = Graphics.width - @actor_command_window.width
@skill_window.y = Graphics.height - @skill_window.height
end
alias scene_battle_create_item_window_abe create_item_window
def create_item_window
scene_battle_create_item_window_abe
@item_window.height = @skill_window.height
@item_window.width = @skill_window.width
@item_window.y = Graphics.height - @item_window.height
end
alias scene_battle_next_command_abe next_command
def next_command
@status_window.show
redraw_current_status
@actor_command_window.show
@status_aid_window.hide
scene_battle_next_command_abe
end
alias scene_battle_prior_command_abe prior_command
def prior_command
redraw_current_status
scene_battle_prior_command_abe
end
def redraw_current_status
return if @status_window.index < 0
@status_window.draw_item(@status_window.index)
end
alias scene_battle_command_attack_abe command_attack
def command_attack
$game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
scene_battle_command_attack_abe
end
alias scene_battle_command_skill_abe command_skill
def command_skill
scene_battle_command_skill_abe
@status_window.hide
@actor_command_window.hide
@status_aid_window.show
end
alias scene_battle_command_item_abe command_item
def command_item
scene_battle_command_item_abe
@status_window.hide
@actor_command_window.hide
@status_aid_window.show
end
def on_skill_ok
[url=home.php?mod=space&uid=260100]@skill[/url] = @skill_window.item
$game_temp.battle_aid = @skill
BattleManager.actor.input.set_skill(@skill.id)
BattleManager.actor.last_skill.object = @skill
if @skill.for_opponent?
select_enemy_selection
elsif @skill.for_friend?
select_actor_selection
else
@skill_window.hide
next_command
$game_temp.battle_aid = nil
end
end
alias scene_battle_on_skill_cancel_abe on_skill_cancel
def on_skill_cancel
scene_battle_on_skill_cancel_abe
@status_window.show
@actor_command_window.show
@status_aid_window.hide
end
def on_item_ok
@item = @item_window.item
$game_temp.battle_aid = @item
BattleManager.actor.input.set_item(@item.id)
if @item.for_opponent?
select_enemy_selection
elsif @item.for_friend?
select_actor_selection
else
@item_window.hide
next_command
$game_temp.battle_aid = nil
end
$game_party.last_item.object = @item
end
alias scene_battle_on_item_cancel_abe on_item_cancel
def on_item_cancel
scene_battle_on_item_cancel_abe
@status_window.show
@actor_command_window.show
@status_aid_window.hide
end
alias scene_battle_select_actor_selection_abe select_actor_selection
def select_actor_selection
@status_aid_window.refresh
scene_battle_select_actor_selection_abe
@status_window.hide
@skill_window.hide
@item_window.hide
@help_window.show
end
alias scene_battle_on_actor_ok_abe on_actor_ok
def on_actor_ok
$game_temp.battle_aid = nil
scene_battle_on_actor_ok_abe
@status_window.show
if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
@actor_command_window.visible = !@confirm_command_window.visible
else
@actor_command_window.show
end
@status_aid_window.hide
end
alias scene_battle_on_actor_cancel_abe on_actor_cancel
def on_actor_cancel
BattleManager.actor.input.clear
@status_aid_window.refresh
$game_temp.battle_aid = nil
scene_battle_on_actor_cancel_abe
case @actor_command_window.current_symbol
when :skill
@skill_window.show
when :item
@item_window.show
end
end
alias scene_battle_select_enemy_selection_abe select_enemy_selection
def select_enemy_selection
@status_aid_window.refresh
scene_battle_select_enemy_selection_abe
@help_window.show
end
alias scene_battle_on_enemy_ok_abe on_enemy_ok
def on_enemy_ok
$game_temp.battle_aid = nil
scene_battle_on_enemy_ok_abe
end
alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
def on_enemy_cancel
BattleManager.actor.input.clear
@status_aid_window.refresh
$game_temp.battle_aid = nil
scene_battle_on_enemy_cancel_abe
if @skill_window.visible || @item_window.visible
@help_window.show
else
@help_window.hide
end
end
def end_battle_conditions?
return true if $game_party.members.empty?
return true if $game_party.all_dead?
return true if $game_troop.all_dead?
return true if BattleManager.aborting?
return false
end
def refresh_status
#如果你是程序员,请顺手帮忙优化下这里,谢谢。
@status_window.refresh
for i in $game_party.battle_members
@status_window.draw_item($game_party.battle_members.index(i))
end
end
end
|
|