查看: 14860|回复: 48

[RMVA发布] 【物品帮助增强】——新版

[复制链接]

无限の剣制

梦石
0
星屑
10445
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2014-10-9 11:34:37 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 VIPArcher 于 2015-7-12 18:58 编辑

这里是原版 @wyongcan2008
尽量的增强了兼容性。如果还是不能解决冲突的话。那就只能劝你放弃这个脚本了
可能的不兼容:其他用到物品列表/技能列表的非默认脚本场景。(例如合成脚本一类的)
解决方法:自行在这些新插入的脚本场景里生成强化帮助窗口。
如有BUG直接回帖报告,我不一定能帮忙修复
另外这个脚本支持显示这个脚本的负重
以后再遇到提问这个脚本出错的时候就可以摔链接了。
[fold=效果截图]
名字里带有\d★的是用到了这个脚本
233fa18b87d6277fc9c91e3a2b381f30e824fc93.jpg 233fa18b87d6277fc9c91e3a2b381f30e824fc93.jpg 233fa18b87d6277fc9c91e3a2b381f30e824fc93.jpg
QQ图片20141009111718.png 233fa18b87d6277fc9c91e3a2b381f30e824fc93.jpg
不要吐槽我为什么在盾牌上附加双持武器。故意做反面教材的,好孩子不要学习。[/fold]
2014.10.10更新,支持装备风格显示
2014.10.16更新,采用@DivineCrow 大大推荐的光标悬停一段时间后才打开窗口的模式来显示帮助窗口。
[fold=脚本本体]
↓↓↓无视它↓↓↓
@Time = 0
↑↑↑无视它↑↑↑
[pre lang="ruby" line="1"]#encoding:utf-8
#==============================================================================
# ■ 技能物品说明增强 蓝本:wyongcan
# 修改 :VIPArcher
#
# 改动说明:
# 改用新的帮助窗口和新定义draw_text_vip方法来增强兼容性
# 更改初始化数据时机以支持跳过标题
# 追加对普通物品和技能的说明内容
# 修改了对帮助窗口行数的计算以支持控制符
# 加上了各种颜色的设置,具体更高级的玩法自己领悟吧
# 改成光标不动一段时间后才会出现帮助窗口
#
#  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:help_ex] = 20141007
$VIPArcherScript[:equip_limit] = false #是否使用了后知后觉的装备能力限制
class << DataManager
  alias_method :vip_load_database, :load_database
  #--------------------------------------------------------------------------
  # ● 读取数据库
  #--------------------------------------------------------------------------
  def load_database
    vip_load_database
    VIPArcher::Equipplus.equiphelpready
  end
end
module VIPArcher;end
module VIPArcher::Equipplus
  TIME = 90 #帮助窗口自动出现的时间(单位帧
  Font_Name = Font.default_name # 推荐"微软雅黑"
  Font_Size = 14                # "微软雅黑"的话就20号字体
  UP   = 24 #能力值提升颜色编号
  DOWN = 25 #能力值下降颜色编号
  VIP  = 14 #特殊能力颜色编号
  MP   = 23
  TP   = 29
  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 => "特技专注"}
  #技能效果范围
  SCOPE ={
    0 => "无",
    1 => "单个敌人",
    2 => "全体敌人",
    3 => "一个随机敌人",
    4 => "两个随机敌人",
    5 => "三个随机敌人",
    6 => "四个随机敌人",
    7 => "单个队友",
    8 => "全体队友",
    9 => "单个队友(战斗不能)",
    10 => "全体队友(战斗不能)",
    11 => "使用者" }
  #技能命中类型
  HIT ={
    0 => "必定命中",
    1 => "物理攻击",
    2 => "魔法攻击"}
  #使用限制
  OCCASION ={
    0 => "随时可用",
    1 => "仅战斗中",
    2 => "仅菜单中",
    3 => "不能使用"}
  #添加能力
  XPARAM ={
    0 => "物理命中几率:",
    1 => "物理闪避几率:",
    2 => "必杀几率:",
    3 => "必杀闪避几率:",
    4 => "魔法闪避几率:",
    5 => "魔法反射几率:",
    6 => "物理反击几率:",
    7 => "体力值再生速度:",
    8 => "魔力值再生速度:",
    9 => "特技值再生速度:"}
  #特殊能力
  SPARAM ={
    0 => "受到攻击的几率",
    1 => "防御效果比率",
    2 => "恢复效果比率",
    3 => "药理知识",
    4 => "MP消费率",
    5 => "TP消耗率",
    6 => "物理伤害加成",
    7 => "魔法伤害加成",
    8 => "地形伤害加成",
    9 => "经验获得加成"}
  #装备风格  require 装备风格扩展脚本
  SLOT_TYPE ={
    0 => "普通",
    1 => "双持武器",
    2 => "索爷三刀流",
    3 => "NPC",
    4 => "233",
    5 => "论坛@的BUG好烦啊"}
  #队伍能力
  PARTY_ABILITY ={
    0 => "遇敌几率减半",
    1 => "随机遇敌无效",
    2 => "敌人偷袭无效",
    3 => "先制攻击几率上升",
    4 => "获得金钱数量双倍",
    5 => "物品掉落几率双倍"}
  #伤害类型
  DAMAGE_TYPE = {
    0 => "无",
    1 => "体力值伤害",
    2 => "魔力值伤害",
    3 => "体力值恢复",
    4 => "魔力值恢复",
    5 => "体力值吸收",
    6 => "魔力值吸收"}
  #普通能力
  #这只是个示范,你也可以依照个人喜好对这些用语添加颜色控制符
  @params ={
    0 => "\\c[17]最大HP",
    1 => "\\c[16]最大MP",
    2 => "\\c[20]物攻",
    3 => "\\c[21]物防",
    4 => "\\c[30]魔攻",
    5 => "\\c[31]魔防",
    6 => "\\c[14]敏捷",
    7 => "\\c[17]幸运"}
  #我举例技能类型的原因就是因为它 短
  @skill_types = { # 这个和下面equiphelpready里注释掉的做的是一样的事
                   # 只是下面是读取数据库添加用语,这里是手动枚举
    1 => "\\c[1]特技",
    2 => "\\c[2]魔法",
    3 => "\\c[3]必杀",
    4 => "\\c[5]卖萌"}
  #初始化数据,当然如果你要用上面那样的控制符改变颜色的话
  #欢迎枚举格式就是上面这样用Hash,用ID做键把用语对应起来
  def self.equiphelpready
    params = $data_system.terms.params
    elements = $data_system.elements
    weapon_types = $data_system.weapon_types
    armor_types = $data_system.armor_types
    etypes = $data_system.terms.etypes
    skill_types = $data_system.skill_types
    @states       ||= {}
    @params       ||= {}
    @weapon_types ||= {}
    @armor_types  ||= {}
    @etypes       ||= {}
    @skill_types  ||= {}
    @elements     ||= {}
    skill_types.each_with_index{|x,y| @skill_types[y] = x if !x.nil?} if @skill_types == {}
    $data_states.each{|x| @states[x.id] = x.name if !x.nil?} if @states == {}
    elements.each_with_index{|x,y| @elements[y] = x if !x.nil?} if @elements == {}
    weapon_types.each_with_index{|x,y| @weapon_types[y] = x if !x.nil?} if @weapon_types == {}
    armor_types.each_with_index{|x,y| @armor_types[y] = x if !x.nil?} if @armor_types == {}
    etypes.each_with_index{|x,y| @etypes[y] = x} if @etypes == {}
    params.each_with_index{|x,y| @params[y] = x} if @params == {}
  end
  #获取装备帮助内容
  def self.getequiphelp(equip)
    help = ""
    param = []
    help += "\\c[16]装备位置:#{Vocab::etype(equip.etype_id)}\\c[0]\n"
    if $VIPArcherScript[:equip_limit] #装备能力限制
      help += "\\c[16]等级需求:#{equip.level_limit}\n" if equip.level_limit > 0
      param_limit = []
      for i in 0..7
        if equip.params_limit(i) != 0
          help += "\\c[16]#{@params}需求:#{equip.params_limit(i)}\\c[0]\n"
        end
      end
    end
    equip.params.each_with_index{|x,y| param.push([@params[y],x])}
    param = param.select{|x| x[1] != 0}
    param.each{|x| help += "\\c[#{x[1]>0? UP : DOWN}]#{x[0]}:\\c[#{x[1]>0? UP : DOWN}]#{"﹢"if x[1]>0}#{x[1].to_int.to_s}\\c[0]\n"}
    features = equip.features
    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 += "\\c[#{x.value<0?DOWN: UP}]#{@params[x.data_id]}#{x.value<0?"﹣":"﹢"}#{(x.value.abs*100).to_i}%\n"}
    featuresparam[1].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{XPARAM[x.data_id]}#{x.value<0?"﹣":"﹢"}#{(x.value.abs*100).to_i}%\n"}
    featuresparam[2].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{SPARAM[x.data_id]}#{x.value<0?"﹣":"﹢"}#{(x.value.abs*100).to_i}%\n"}
    if $VIPArcherScript[:slot_type]
      help += "\\c[#{VIP}]#{CODE[55]}:#{SLOT_TYPE[$1.to_i]}\\c[0]\n" if equip.note =~ /<slot_type\s*[:](.*)>/i
    else
      features.select{|x| x.code == 55}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:双持武器\\c[0]\n"}
    end
    features.select{|x| x.code == 11}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@elements[x.data_id]}×#{(x.value*100).to_i}%\\c[0]\n"}
    features.select{|x| x.code == 12}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@params[x.data_id]}×#{(x.value*100).to_i}%\\c[0]\n"}
    features.select{|x| x.code == 13}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@states[x.data_id]}×#{(x.value*100).to_i}%\\c[0]\n"}
    features.select{|x| x.code == 14}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{@states[x.data_id]}\\c[0]\n"}
    features.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@elements[x.data_id]}\\c[0]\n"}
    features.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@states[x.data_id]}#{(x.value*100).to_i}%\\c[0]\n"}
    features.select{|x| x.code == 33}.each{|x| help += "\\c[#{x.value>0? UP : DOWN}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
    features.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
    features.select{|x| x.code == 41}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@skill_types[x.data_id]}\\c[0]\n"}
    features.select{|x| x.code == 42}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@skill_types[x.data_id]}\\c[0]\n"}
    features.select{|x| x.code == 43}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{$data_skills[x.data_id].name}\\c[0]\n"}
    features.select{|x| x.code == 44}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{$data_skills[x.data_id].name}\\c[0]\n"}
    features.select{|x| x.code == 51}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@weapon_types[x.data_id]}\\c[0]\n"}
    features.select{|x| x.code == 52}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@armor_types[x.data_id]}\\c[0]\n"}
    features.select{|x| x.code == 53}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@etypes[x.data_id]}\\c[0]\n"}
    features.select{|x| x.code == 54}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@etypes[x.data_id]}\\c[0]\n"}
    features.select{|x| x.code == 61}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
    features.select{|x| x.code == 62}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{FLAG[x.data_id]}\\c[0]\n"}
    features.select{|x| x.code == 64}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{PARTY_ABILITY[x.data_id]}\\c[0]\n"}
    help
  end
  #获取技能帮助内容
  def self.getskillhelp(skill)
    help = ""
    effects = skill.effects
    damage  = skill.damage
    r = [skill.required_wtype_id1,skill.required_wtype_id2]
    help += "\\c[16]消耗:\\c[#{MP}]MP:#{skill.mp_cost.to_s} \\c[#{TP}]TP:#{skill.tp_cost.to_s}\\c[0]\n" if skill.mp_cost > 0 && skill.tp_cost > 0
    help += "\\c[16]消耗:\\c[#{MP}]MP:#{skill.mp_cost.to_s}\\c[0]\n" if skill.mp_cost > 0 && skill.tp_cost <= 0
    help += "\\c[16]消耗:\\c[#{TP}]TP:#{skill.tp_cost.to_s}\\c[0]\n" if skill.tp_cost > 0 && skill.mp_cost <= 0
    help += "\\c[#{skill.speed<0?DOWN: UP}]速度修正:#{skill.speed}\\c[0]\n" if skill.speed != 0
    help += "\\c[#{DOWN}]成功率:#{skill.success_rate}%\\c[0]\n" if skill.success_rate != 100
    help += "\\c[16]类型:#{HIT[skill.hit_type]}\\c[0]\n"
    help += "\\c[16]范围:#{SCOPE[skill.scope]}\\c[0]\n" if skill.scope != 0
    help += "\\c[16]效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\\c[0]\n" if damage.type != 0
    effects.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]强化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
    effects.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
    effects.select{|x| x.code == 33}.each{|x| help += "\\c[#{UP}]解除:强化#{@params[x.data_id]}\n"}
    effects.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]解除:弱化#{@params[x.data_id]}\n"}
    effects.select{|x| x.code == 21}.each{|x| help += "\\c[#{UP}]附加:#{x.data_id == 0 ? "普通攻击" : @states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
    effects.select{|x| x.code == 22}.each{|x| help += "\\c[#{UP}]解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
    effects.select{|x| x.code == 41}.each{|x| help += "\\c[#{VIP}]特殊效果:撤退\n"}
    effects.select{|x| x.code == 42}.each{|x| help += "\\c[#{UP}]提升:#{@params[x.data_id]}#{x.value1.to_i}点\\c[0]\n"}
    effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}
    help += "\\c[16]场合:#{OCCASION[skill.occasion]}\n"
    help += "\\c[#{DOWN}]限制:#{$data_system.weapon_types[r[0]] if r[0] != 0} #{$data_system.weapon_types[r[1]] if r[1] != 0}\\c[0]\n" if r != [0,0]
    help
  end
  #获取道具帮助内容
  def self.getitemhelp(item)
    help = ""
    effects = item.effects
    damage  = item.damage
    help += "\\c[16]类型:\\c[#{VIP}]#{"贵重物品  "if item.itype_id != 1}\\c[#{DOWN}]#{item.consumable ? "消耗品":"非消耗品"}\\c[0]\n"
    help += "\\c[16]范围:#{SCOPE[item.scope]}\\c[0]\n" if item.scope != 0
    help += "\\c[16]效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\\c[0]\n" if damage.type != 0
    effects.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]强化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
    effects.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
    effects.select{|x| x.code == 33}.each{|x| help += "\\c[#{UP}]解除:强化#{@params[x.data_id]}\\c[0]\n"}
    effects.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]解除:弱化#{@params[x.data_id]}\\c[0]\n"}
    effects.select{|x| x.code == 21}.each{|x| help += "\\c[#{UP}]附加:#{x.data_id == 0 ? "普通攻击" : @states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
    effects.select{|x| x.code == 22}.each{|x| help += "\\c[#{UP}]解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
    effects.select{|x| x.code == 41}.each{|x| help += "\\c[#{VIP}]特殊效果:撤退\n"}
    effects.select{|x| x.code == 42}.each{|x| help += "\\c[#{VIP}]提升:#{@params[x.data_id]}#{x.value1.to_i}点\\c[0]\n"}
    effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}
    help += "\\c[16]场合:#{OCCASION[item.occasion]}\\c[0]\n"
    help
  end
  #计算行数(有些字体的汉字和[字母,数字,符号]的宽度不同,
  #有可能会照成行数计算不对,尽量用宽度相同的字体吧)
  def self.getline(text,maxtext)
    text_new = ""
    xtext = []
    line = 0
    text.each_line{|x| text_new += x.gsub(/\\\S\[\d+\]/i){}} #去掉控制符
    text_new.each_line{|x| xtext.push x.gsub(/\n/){}}        #去掉换行符
    xtext.each{|x| line += (x.size / (maxtext.to_f + 1).to_i) + 1}
    line
  end
end
#==============================================================================
# ■ Window_Help_Ex
#------------------------------------------------------------------------------
#  加强显示特技和物品等的说明
#==============================================================================

class Window_Help_Ex < Window_Base
  include VIPArcher::Equipplus
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(line_number = 0)
    super(0, 0, 210, 0)
    self.z = 150
    contents.font.size = Font_Size
    @time = 0
  end
  #--------------------------------------------------------------------------
  # ● 设置内容
  #--------------------------------------------------------------------------
  def set_text(text)
    @text = text
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 清除
  #--------------------------------------------------------------------------
  def clear
    set_text("")
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助位置
  #--------------------------------------------------------------------------
  def uppos(index,rect,window)
    self.height = fitting_height_vip(VIPArcher::Equipplus.getline(@xtext,13))
    create_contents
    contents.font.name = Font_Name
    contents.font.size = Font_Size
    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)
    @time = TIME
    self.show
    self.openness = 0
  end
  #--------------------------------------------------------------------------
  # ● 设置物品
  #     item : 技能、物品等
  #--------------------------------------------------------------------------
  def set_item(item)
    if item == nil
      set_text("")
      return
    end
    @xtext = ""
    if $VIPArcherScript[:itemcolor] # require 物品描绘颜色脚本
      @xtext = "\\c[16]名称:\\c[#{VIPArcher::ItemColor::Color_Lv[item.color]}]" +
      "#{item.name}  #{item.color if item.color != 0}#{"★" if item.color != 0}\\c[0]\n"
    else
      @xtext = "\\c[16]名称:\\c[0]#{item.name}\n"
    end
    @xtext += "\\c[16]介绍:\\c[0]#{item.description}\n"
    if $VIPArcherScript[:load]      # require 队伍负重脚本
      @xtext += "\\c[16]售价:#{item.price} 重量:#{item.load}\\c[0]\n"
    else
      @xtext += item.price == 0 ? "\\c[16]售价:\\c[14]无法出售\\c[0]\n":"\\c[16]售价:#{item.price}\\c[0]\n"
    end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
    @xtext += VIPArcher::Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
    @xtext += VIPArcher::Equipplus.getskillhelp(item) if item.is_a?(RPG::Skill)
    @xtext += VIPArcher::Equipplus.getitemhelp(item) if item.is_a?(RPG::Item)
    if $VIPArcherScript[:exdrop_rate]   # require 队伍掉率扩展
      @xtext += "\\c[#{$2.to_i > 0 ? UP : DOWN}]#{$1}掉率: #{$2}%\\c[0]\n" if
      item.note =~ /<(\W+)掉率:\s*([0-9+.-]+)%>/i
    end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Skill)
    @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    self.hide if @text == ""
    draw_text_vip(4, 0, @text,width,40,false)
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    @time -= 1 if @time > 0
    self.open if @time == 0
  end
end
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 计算窗口显示指定行数时的应用高度2*************************
  #--------------------------------------------------------------------------
  def fitting_height_vip(line_number)
    line_number * contents.font.size + standard_padding * 2
  end
  # draw_text_ex的增强,使其可以自动换行  原作者:叶子 修改:wyongcan
  #--------------------------------------------------------------------------
  # ● 绘制带有控制符的文本内容
  #   如果传递了width参数的话,会自动换行
  #--------------------------------------------------------------------------
  def draw_text_vip(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
  #--------------------------------------------------------------------------
  # ● 处理换行文字
  #--------------------------------------------------------------------------
  alias vip_20141007_process_new_line process_new_line
  def process_new_line(text, pos)
    vip_20141007_process_new_line(text, pos)
    pos[:height] = contents.font.size if pos[:width] != nil
  end
end

#==============================================================================
# ■ 设置帮助增强窗口
#==============================================================================
class Window_Selectable < Window_Base
  attr_reader   :help_ex_window
  #--------------------------------------------------------------------------
  # ● 调用帮助窗口的更新方法
  #--------------------------------------------------------------------------
  alias help_ex_call_update_help call_update_help
  def call_update_help
    help_ex_call_update_help
    update_ex_help if active && @help_ex_window
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_ex_help
    @help_ex_window.set_item(item) if @help_ex_window
    if index != -1 && item != nil
      @help_ex_window.uppos(index,item_rect(index),self)
    end
  end
  #--------------------------------------------------------------------------
  # ● 设置帮助增强窗口
  #--------------------------------------------------------------------------
  def help_ex_window=(help_ex_window)
    @help_ex_window = help_ex_window
  end
end
#==============================================================================
# ■ 在各场景处理帮助窗口
#==============================================================================
class Scene_Base
  #--------------------------------------------------------------------------
  # ● 生成帮助增强窗口
  #--------------------------------------------------------------------------
  def create_help_ex
    @help_ex_window  = Window_Help_Ex.new
    @help_ex_window .viewport = @viewport
    @item_window.help_ex_window  = @help_ex_window if @item_window
    @slot_window.help_ex_window  = @help_ex_window if @slot_window
    @skill_window.help_ex_window = @help_ex_window if @skill_window
    @buy_window.help_ex_window   = @help_ex_window if @buy_window
    @sell_window.help_ex_window  = @help_ex_window if @sell_window
  end
end
#道具栏
class Scene_Item < Scene_ItemBase
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  alias help_ex_start start
  def start
    help_ex_start
    create_help_ex
  end
  #--------------------------------------------------------------------------
  # ● 物品“取消”
  #--------------------------------------------------------------------------
  alias help_ex_on_item_cancel on_item_cancel
  def on_item_cancel
    help_ex_on_item_cancel
    @help_ex_window.hide
  end
end
#装备栏
class Scene_Equip < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  alias help_ex_start start
  def start
    help_ex_start
    create_help_ex
  end
  #--------------------------------------------------------------------------
  # ● 装备栏“取消”
  #--------------------------------------------------------------------------
  alias help_ex_on_slot_cancel on_slot_cancel
  def on_slot_cancel
    help_ex_on_slot_cancel
    @help_ex_window.hide
  end
end
#技能栏
class Scene_Skill < Scene_ItemBase
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  alias help_ex_start start
  def start
    help_ex_start
    create_help_ex
  end
  #--------------------------------------------------------------------------
  # ● 物品“确定”
  #--------------------------------------------------------------------------
  alias help_ex_on_item_ok on_item_ok
  def on_item_ok
    help_ex_on_item_ok
    @help_ex_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 物品“取消”
  #--------------------------------------------------------------------------
  alias help_ex_on_item_cancel on_item_cancel
  def on_item_cancel
    help_ex_on_item_cancel
    @help_ex_window.hide
  end
end
#战斗界面
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  alias help_ex_start start
  def start
    help_ex_start
    create_help_ex
  end
  #--------------------------------------------------------------------------
  # ● 技能“确定”
  #--------------------------------------------------------------------------
  alias help_ex_on_skill_ok on_skill_ok
  def on_skill_ok
    help_ex_on_skill_ok
    @help_ex_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 技能“取消”
  #--------------------------------------------------------------------------
  alias help_ex_on_skill_cancel on_skill_cancel
  def on_skill_cancel
    help_ex_on_skill_cancel
    @help_ex_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 物品“确定”
  #--------------------------------------------------------------------------
  alias help_ex_on_item_ok on_item_ok
  def on_item_ok
    help_ex_on_item_ok
    @help_ex_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 物品“取消”
  #--------------------------------------------------------------------------
  alias help_ex_on_item_cancel on_item_cancel
  def on_item_cancel
    help_ex_on_item_cancel
    @help_ex_window.hide
  end
end
#商店界面
class Scene_Shop < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  alias help_ex_start start
  def start
    help_ex_start
    create_help_ex
  end
  #--------------------------------------------------------------------------
  # ● 买入“确定”
  #--------------------------------------------------------------------------
  alias help_ex_on_buy_ok on_buy_ok
  def on_buy_ok
    help_ex_on_buy_ok
    @help_ex_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 买入“取消”
  #--------------------------------------------------------------------------
  alias help_ex_on_buy_cancel on_buy_cancel
  def on_buy_cancel
    help_ex_on_buy_cancel
    @help_ex_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 卖出“确定”
  #--------------------------------------------------------------------------
  alias help_ex_on_sell_ok on_sell_ok
  def on_sell_ok
    help_ex_on_sell_ok
    @help_ex_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 卖出“取消”
  #--------------------------------------------------------------------------
  alias help_ex_on_sell_cancel on_sell_cancel
  def on_sell_cancel
    help_ex_on_sell_cancel
    @help_ex_window.hide
  end
end
[/pre][/fold]   
  1. 如果发生脚本报错请把[url=home.php?mod=space&uid=134219]@Time[/url] 改成@time 试试
复制代码

评分

参与人数 2梦石 +2 赞 +1 收起 理由
669801113 + 1 塞糖
Sion + 2 感谢分享。

查看全部评分

炎

梦石
0
星屑
98
在线时间
1617 小时
注册时间
2013-8-15
回帖
4322
发表于 2014-10-9 13:33:44 | 显示全部楼层
你需要的是掌声,我给你拍手,然后再抱着脚本。加油啊!...
神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦
回复

使用道具 举报

梦石
0
星屑
62
在线时间
839 小时
注册时间
2010-6-26
回帖
652
发表于 2014-10-9 16:18:56 | 显示全部楼层
本帖最后由 企鹅达达 于 2014-10-9 16:26 编辑

如果可以自行在备注里面添加条目就更好了,比如我要在窗口里面添加合成素材的时候,不奢望可以直接翻译已经有的备注,至少可以自己加备注增加说明
比如说技能冷却的脚本备注是<cooldown: x>,如果能自己设定关键字"<cooldown: ","x",">"自动翻译成"冷却时间x回合",然后增加到备注里面,这样最好。如果不行,好歹在后面通过使用你设定的备注形式把冷却时间这个文字加进去

点评

<cooldown: x>?你用的是哪一个技能冷却?  发表于 2014-10-10 21:35
论坛里有几篇正则的教程,你可以去看看。讲得蛮好,大概知道哪些内容就够了(我对正则也不熟, 我的组群里有个正则的网站,很好用的。  发表于 2014-10-9 21:17
新手们!不要被看扁了!我们也会用论坛搜索,我们也会自己找脚本,我们也会自己点击关闭按钮旁边的小问号!
回复

使用道具 举报

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2014-10-9 16:30:18 来自手机 | 显示全部楼层
企鹅达达 发表于 2014-10-9 16:18
如果可以自行在备注里面添加条目就更好了,比如我要在窗口里面添加合成素材的时候,不奢望可以直接翻译已经 ...


学一下正则表达式。这个需求并不需要脚本作者提供,直接改动原脚本即可。

点评

不会正则表达式的话,脚本作者是无法让你自定义设置方式的。会正则表达式的话,不需要脚本作者给你提供自定义的方式  发表于 2014-10-9 17:12
阁下果断戳中我的痛处了 = = || 本鹅的确不会正则……  发表于 2014-10-9 16:37
回复

使用道具 举报

梦石
0
星屑
9292
在线时间
2504 小时
注册时间
2011-5-20
回帖
14521

开拓者

发表于 2014-10-9 21:45:17 | 显示全部楼层
给盾牌加双持武器会出现什么效果···装备上去又被强制脱下来吗- -|||话说要是用了你的那个装备风格增加的话三持武器那些要怎么办?

点评

两个脚本都更新了一下,现在帮助内容可以显示装备的风格了。  发表于 2014-10-10 17:41
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

梦石
0
星屑
62
在线时间
839 小时
注册时间
2010-6-26
回帖
652
发表于 2014-10-11 10:43:11 | 显示全部楼层
企鹅达达 发表于 2014-10-9 16:18
如果可以自行在备注里面添加条目就更好了,比如我要在窗口里面添加合成素材的时候,不奢望可以直接翻译已经 ...

@chd114 用的是Yanfly的Skill_Restrictions
新手们!不要被看扁了!我们也会用论坛搜索,我们也会自己找脚本,我们也会自己点击关闭按钮旁边的小问号!
回复

使用道具 举报

梦石
0
星屑
50
在线时间
184 小时
注册时间
2011-3-2
回帖
54
发表于 2015-1-23 16:40:20 | 显示全部楼层
战斗时使用技能,如帮助窗口弹出,即使选择使用该技能,帮助窗口也不会消失。

点评

如果还是不能解决就去提问区提问并且附上范例  发表于 2015-1-23 20:58
我用默认工程测试后没有发现这样的问题,初步推测是你使用的其他的战斗方面的脚本重定义了某些方法,先把我的脚本放到战斗脚本下面试试  发表于 2015-1-23 20:58
感谢反馈。有空了就修正。修正后呼叫你  发表于 2015-1-23 18:33
回复

使用道具 举报

梦石
0
星屑
50
在线时间
184 小时
注册时间
2011-3-2
回帖
54
发表于 2015-1-24 21:44:57 | 显示全部楼层
是的,刚才检查发现用了脸图战斗脚本。
  1. $脸图战斗 = true
  2. $imported = {} if $imported.nil?
  3. module YEA
  4.   module BATTLE
  5.     SKIP_PARTY_COMMAND = true
  6.     BATTLESTATUS_NAME_FONT_SIZE = 20
  7.     BATTLESTATUS_TEXT_FONT_SIZE = 16
  8.     BATTLESTATUS_NO_ACTION_ICON = 185
  9.     BATTLESTATUS_HPGAUGE_Y_PLUS = 11
  10.     BATTLESTATUS_CENTER_FACES   = false
  11.     HELP_TEXT_ALL_FOES        = "全体敌人"
  12.     HELP_TEXT_ONE_RANDOM_FOE  = "单个敌人"
  13.     HELP_TEXT_MANY_RANDOM_FOE = "%d个随机敌人"
  14.     HELP_TEXT_ALL_ALLIES      = "全体队友"
  15.     HELP_TEXT_ALL_DEAD_ALLIES = "全体死亡队友"
  16.     HELP_TEXT_ONE_RANDOM_ALLY = "单个随机队友"
  17.     HELP_TEXT_RANDOM_ALLIES   = "%d个随机队友"
  18.   end
  19. end
  20. class Game_Battler
  21.   def can_collapse?
  22.     return false unless dead?
  23.     unless actor?
  24.       return false unless sprite.battler_visible
  25.       array = [:collapse, :boss_collapse, :instant_collapse]
  26.       return false if array.include?(sprite.effect_type)
  27.     end
  28.     return true
  29.   end
  30.   def draw_mp?
  31.     return true
  32.   end
  33.   def draw_tp?
  34.     return $data_system.opt_display_tp
  35.   end
  36. end
  37. module Icon
  38.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  39. end
  40. class Game_Temp
  41.   attr_accessor :battle_aid
  42.   attr_accessor :evaluating
  43. end
  44. class Game_Action
  45.   alias evaluate_item_with_target_abe evaluate_item_with_target
  46.   def evaluate_item_with_target(target)
  47.     $game_temp.evaluating = true
  48.     result = evaluate_item_with_target_abe(target)
  49.     $game_temp.evaluating = false
  50.     return result
  51.   end
  52. end
  53. class Game_Actor < Game_Battler
  54.   def draw_mp?
  55.     return true unless draw_tp?
  56.     for skill in skills
  57.       next unless added_skill_types.include?(skill.stype_id)
  58.       return true if skill.mp_cost > 0
  59.     end
  60.     return false
  61.   end
  62.   def draw_tp?
  63.     return false unless $data_system.opt_display_tp
  64.     for skill in skills
  65.       next unless added_skill_types.include?(skill.stype_id)
  66.       return true if skill.tp_cost > 0
  67.     end
  68.     return false
  69.   end
  70. end
  71. class Window_BattleStatus < Window_Selectable
  72.   def initialize
  73.     super(0, 0, window_width, window_height)
  74.     self.openness = 0
  75.     @party = $game_party.battle_members.clone
  76.   end
  77.   def col_max; return $game_party.max_battle_members; end
  78.   def battle_members; return $game_party.battle_members; end
  79.   def actor; return battle_members[@index]; end
  80.   def update
  81.     super
  82.     return if @party == $game_party.battle_members
  83.     @party = $game_party.battle_members.clone
  84.     refresh
  85.   end
  86.   def draw_item(index)
  87.     return if index.nil?
  88.     clear_item(index)
  89.     actor = battle_members[index]
  90.     rect = item_rect(index)
  91.     return if actor.nil?
  92.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
  93.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  94.     draw_actor_action(actor, rect.x, rect.y)
  95.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  96.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  97.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  98.     draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  99.     if draw_tp?(actor) && draw_mp?(actor)
  100.       dw = rect.width/2-2
  101.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  102.       draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  103.       dw = rect.width - rect.width/2 - 2
  104.       draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
  105.     elsif draw_tp?(actor) && !draw_mp?(actor)
  106.       draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
  107.     else
  108.       draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  109.     end
  110.   end
  111.   def item_rect(index)
  112.     rect = Rect.new
  113.     rect.width = contents.width / $game_party.max_battle_members
  114.     rect.height = contents.height
  115.     rect.x = index * rect.width
  116.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  117.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  118.     end
  119.     rect.y = 0
  120.     return rect
  121.   end
  122.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  123.     bitmap = Cache.face(face_name)
  124.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  125.     fy = face_index / 4 * 96 + 2
  126.     fw = [item_rect(0).width - 4, 92].min
  127.     rect = Rect.new(fx, fy, fw, 92)
  128.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  129.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  130.     bitmap.dispose
  131.   end
  132.   def draw_actor_name(actor, dx, dy, dw = 112)
  133.     reset_font_settings
  134.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  135.     change_color(hp_color(actor))
  136.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  137.   end
  138.   def draw_actor_action(actor, dx, dy)
  139.     draw_icon(action_icon(actor), dx, dy)
  140.   end
  141.   def action_icon(actor)
  142.     return Icon.no_action if actor.current_action.nil?
  143.     return Icon.no_action if actor.current_action.item.nil?
  144.     return actor.current_action.item.icon_index
  145.   end
  146.   def draw_tp?(actor)
  147.     return actor.draw_tp?
  148.   end
  149.   def draw_mp?(actor)
  150.     return actor.draw_mp?
  151.   end
  152.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  153.     change_color(color1)
  154.     draw_text(dx, dy, dw, line_height, current.to_s, 2)
  155.   end
  156.   def draw_actor_hp(actor, dx, dy, width = 124)
  157.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  158.     change_color(system_color)
  159.     cy = (Font.default_size - contents.font.size) / 2 + 1
  160.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  161.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  162.       hp_color(actor), normal_color)
  163.     end
  164.   def draw_actor_mp(actor, dx, dy, width = 124)
  165.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  166.     change_color(system_color)
  167.     cy = (Font.default_size - contents.font.size) / 2 + 1
  168.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  169.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  170.       mp_color(actor), normal_color)
  171.     end
  172.   def draw_actor_tp(actor, dx, dy, width = 124)
  173.     draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  174.     change_color(system_color)
  175.     cy = (Font.default_size - contents.font.size) / 2 + 1
  176.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  177.     change_color(tp_color(actor))
  178.     draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  179.   end
  180. end
  181. class Window_BattleActor < Window_BattleStatus
  182.   def show
  183.     create_flags
  184.     super
  185.   end
  186.   def create_flags
  187.     set_select_flag(:any)
  188.     select(0)
  189.     return if $game_temp.battle_aid.nil?
  190.     if $game_temp.battle_aid.need_selection?
  191.       select(0)
  192.       set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  193.     elsif $game_temp.battle_aid.for_user?
  194.       battler = BattleManager.actor
  195.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  196.       select(id)
  197.       set_select_flag(:user)
  198.     elsif $game_temp.battle_aid.for_all?
  199.       select(0)
  200.       set_select_flag(:all)
  201.       set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  202.     elsif $game_temp.battle_aid.for_random?
  203.       select(0)
  204.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  205.     end
  206.   end
  207.   def set_select_flag(flag)
  208.     @select_flag = flag
  209.     case @select_flag
  210.     when :all, :all_dead, :random
  211.       @cursor_all = true
  212.     else
  213.       @cursor_all = false
  214.     end
  215.   end
  216.   def update_cursor
  217.     if @cursor_all
  218.       cursor_rect.set(0, 0, contents.width, contents.height)
  219.       self.top_row = 0
  220.     elsif @index < 0
  221.       cursor_rect.empty
  222.     else
  223.       ensure_cursor_visible
  224.       cursor_rect.set(item_rect(@index))
  225.     end
  226.   end
  227.   def cursor_movable?
  228.     return false if @select_flag == :user
  229.     return super
  230.   end
  231.   def current_item_enabled?
  232.     return true if $game_temp.battle_aid.nil?
  233.     if $game_temp.battle_aid.need_selection?
  234.       member = $game_party.battle_members[@index]
  235.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  236.     elsif $game_temp.battle_aid.for_dead_friend?
  237.       for member in $game_party.battle_members
  238.         return true if member.dead?
  239.       end
  240.       return false
  241.     end
  242.     return true
  243.   end
  244. end
  245. class Window_BattleStatusAid < Window_BattleStatus
  246.   attr_accessor :status_window
  247.   def initialize
  248.     super
  249.     self.visible = false
  250.     self.openness = 255
  251.   end
  252.   def window_width; return 128; end
  253.   def show
  254.     super
  255.     refresh
  256.   end
  257.   def refresh
  258.     contents.clear
  259.     return if @status_window.nil?
  260.     draw_item(@status_window.index)
  261.   end
  262.   def item_rect(index)
  263.     return Rect.new(0, 0, contents.width, contents.height)
  264.   end
  265. end
  266. class Window_BattleEnemy < Window_Selectable
  267.   def initialize(info_viewport)
  268.     super(0, Graphics.height, window_width, fitting_height(1))
  269.     refresh
  270.     self.visible = false
  271.     @info_viewport = info_viewport
  272.   end
  273.   def col_max; return item_max; end
  274.   def show
  275.     create_flags
  276.     super
  277.   end
  278.   def create_flags
  279.     set_select_flag(:any)
  280.     select(0)
  281.     return if $game_temp.battle_aid.nil?
  282.     if $game_temp.battle_aid.need_selection?
  283.       select(0)
  284.     elsif $game_temp.battle_aid.for_all?
  285.       select(0)
  286.       set_select_flag(:all)
  287.     elsif $game_temp.battle_aid.for_random?
  288.       select(0)
  289.       set_select_flag(:random)
  290.     end
  291.   end
  292.   def set_select_flag(flag)
  293.     @select_flag = flag
  294.     case @select_flag
  295.     when :all, :random
  296.       @cursor_all = true
  297.     else
  298.       @cursor_all = false
  299.     end
  300.   end
  301.   def select_all?
  302.     return true if @select_flag == :all
  303.     return true if @select_flag == :random
  304.     return false
  305.   end
  306.   def update_cursor
  307.     if @cursor_all
  308.       cursor_rect.set(0, 0, contents.width, contents.height)
  309.       self.top_row = 0
  310.     elsif @index < 0
  311.       cursor_rect.empty
  312.     else
  313.       ensure_cursor_visible
  314.       cursor_rect.set(item_rect(@index))
  315.     end
  316.   end
  317.   def cursor_movable?
  318.     return false if @select_flag == :user
  319.     return super
  320.   end
  321.   def current_item_enabled?
  322.     return true if $game_temp.battle_aid.nil?
  323.     if $game_temp.battle_aid.need_selection?
  324.       member = $game_party.battle_members[@index]
  325.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  326.     elsif $game_temp.battle_aid.for_dead_friend?
  327.       for member in $game_party.battle_members
  328.         return true if member.dead?
  329.       end
  330.       return false
  331.     end
  332.     return true
  333.   end
  334.   def enemy; @data[index]; end
  335.   def refresh
  336.     make_item_list
  337.     create_contents
  338.     draw_all_items
  339.   end
  340.   def make_item_list
  341.     @data = $game_troop.alive_members
  342.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  343.   end
  344.   def draw_item(index); return; end
  345.   def update
  346.     super
  347.     return unless active
  348.     enemy.sprite_effect_type = :whiten
  349.     return unless select_all?
  350.     for enemy in $game_troop.alive_members
  351.       enemy.sprite_effect_type = :whiten
  352.     end
  353.   end
  354. end
  355. class Window_BattleHelp < Window_Help
  356.   attr_accessor :actor_window
  357.   attr_accessor :enemy_window
  358.   def update
  359.     super
  360.     if !self.visible and @text != ""
  361.       @text = ""
  362.       return refresh
  363.     end
  364.     update_battler_name
  365.   end
  366.   def update_battler_name
  367.     return unless @actor_window.active || @enemy_window.active
  368.     if @actor_window.active
  369.       battler = $game_party.battle_members[@actor_window.index]
  370.     elsif @enemy_window.active
  371.       battler = @enemy_window.enemy
  372.     end
  373.     if special_display?
  374.       refresh_special_case(battler)
  375.     else
  376.       refresh_battler_name(battler) if battler_name(battler) != @text
  377.     end
  378.   end
  379.   def battler_name(battler)
  380.     text = battler.name.clone
  381.     return text
  382.   end
  383.   def refresh_battler_name(battler)
  384.     contents.clear
  385.     reset_font_settings
  386.     change_color(normal_color)
  387.     @text = battler_name(battler)
  388.     icons = battler.state_icons + battler.buff_icons
  389.     dy = icons.size <= 0 ? line_height / 2 : 0
  390.     draw_text(0, dy, contents.width, line_height, @text, 1)
  391.     dx = (contents.width - (icons.size * 24)) / 2
  392.     draw_actor_icons(battler, dx, line_height, contents.width)
  393.   end
  394.   def special_display?
  395.     return false if $game_temp.battle_aid.nil?
  396.     return false if $game_temp.battle_aid.for_user?
  397.     return !$game_temp.battle_aid.need_selection?
  398.   end
  399.   def refresh_special_case(battler)
  400.     if $game_temp.battle_aid.for_opponent?
  401.       if $game_temp.battle_aid.for_all?
  402.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  403.       else
  404.         case $game_temp.battle_aid.number_of_targets
  405.         when 1
  406.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  407.         else
  408.           number = $game_temp.battle_aid.number_of_targets
  409.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  410.         end
  411.       end
  412.     else
  413.       if $game_temp.battle_aid.for_dead_friend?
  414.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  415.       elsif $game_temp.battle_aid.for_random?
  416.         case $game_temp.battle_aid.number_of_targets
  417.         when 1
  418.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  419.         else
  420.           number = $game_temp.battle_aid.number_of_targets
  421.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  422.         end
  423.       else
  424.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  425.       end
  426.     end
  427.     return if text == @text
  428.     @text = text
  429.     contents.clear
  430.     reset_font_settings
  431.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  432.   end
  433. end
  434. class Window_SkillList < Window_Selectable
  435.   def spacing
  436.     return 8 if $game_party.in_battle
  437.     return super
  438.   end
  439. end
  440. class Window_ItemList < Window_Selectable
  441.   def spacing
  442.     return 8 if $game_party.in_battle
  443.     return super
  444.   end
  445. end
  446. class Scene_Battle < Scene_Base
  447.   attr_accessor :enemy_window
  448.   attr_accessor :info_viewport
  449.   attr_accessor :spriteset
  450.   attr_accessor :status_window
  451.   attr_accessor :status_aid_window
  452.   attr_accessor :subject
  453.   alias scene_battle_create_all_windows_abe create_all_windows
  454.   def create_all_windows
  455.     scene_battle_create_all_windows_abe
  456.     create_battle_status_aid_window
  457.     set_help_window
  458.   end
  459.   alias scene_battle_create_info_viewport_abe create_info_viewport
  460.   def create_info_viewport
  461.     scene_battle_create_info_viewport_abe
  462.     @status_window.refresh
  463.   end
  464.   def create_battle_status_aid_window
  465.     @status_aid_window = Window_BattleStatusAid.new
  466.     @status_aid_window.status_window = @status_window
  467.     @status_aid_window.x = Graphics.width - @status_aid_window.width
  468.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  469.   end
  470.   def create_help_window
  471.     @help_window = Window_BattleHelp.new
  472.     @help_window.hide
  473.   end
  474.   def set_help_window
  475.     @help_window.actor_window = @actor_window
  476.     @help_window.enemy_window = @enemy_window
  477.   end
  478.   alias scene_battle_create_skill_window_abe create_skill_window
  479.   def create_skill_window
  480.     scene_battle_create_skill_window_abe
  481.     @skill_window.height = @info_viewport.rect.height
  482.     @skill_window.width = Graphics.width - @actor_command_window.width
  483.     @skill_window.y = Graphics.height - @skill_window.height
  484.   end
  485.   alias scene_battle_create_item_window_abe create_item_window
  486.   def create_item_window
  487.     scene_battle_create_item_window_abe
  488.     @item_window.height = @skill_window.height
  489.     @item_window.width = @skill_window.width
  490.     @item_window.y = Graphics.height - @item_window.height
  491.   end
  492.   alias scene_battle_next_command_abe next_command
  493.   def next_command
  494.     @status_window.show
  495.     redraw_current_status
  496.     @actor_command_window.show
  497.     @status_aid_window.hide
  498.     scene_battle_next_command_abe
  499.   end
  500.   alias scene_battle_prior_command_abe prior_command
  501.   def prior_command
  502.     redraw_current_status
  503.     scene_battle_prior_command_abe
  504.   end
  505.   def redraw_current_status
  506.     return if @status_window.index < 0
  507.     @status_window.draw_item(@status_window.index)
  508.   end
  509.   alias scene_battle_command_attack_abe command_attack
  510.   def command_attack
  511.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  512.     scene_battle_command_attack_abe
  513.   end
  514.   alias scene_battle_command_skill_abe command_skill
  515.   def command_skill
  516.     scene_battle_command_skill_abe
  517.     @status_window.hide
  518.     @actor_command_window.hide
  519.     @status_aid_window.show
  520.   end
  521.   alias scene_battle_command_item_abe command_item
  522.   def command_item
  523.     scene_battle_command_item_abe
  524.     @status_window.hide
  525.     @actor_command_window.hide
  526.     @status_aid_window.show
  527.   end
  528.   def on_skill_ok
  529.     [url=home.php?mod=space&uid=260100]@skill[/url] = @skill_window.item
  530.     $game_temp.battle_aid = @skill
  531.     BattleManager.actor.input.set_skill(@skill.id)
  532.     BattleManager.actor.last_skill.object = @skill
  533.     if @skill.for_opponent?
  534.       select_enemy_selection
  535.     elsif @skill.for_friend?
  536.       select_actor_selection
  537.     else
  538.       @skill_window.hide
  539.       next_command
  540.       $game_temp.battle_aid = nil
  541.     end
  542.   end
  543.   alias scene_battle_on_skill_cancel_abe on_skill_cancel
  544.   def on_skill_cancel
  545.     scene_battle_on_skill_cancel_abe
  546.     @status_window.show
  547.     @actor_command_window.show
  548.     @status_aid_window.hide
  549.   end
  550.   def on_item_ok
  551.     @item = @item_window.item
  552.     $game_temp.battle_aid = @item
  553.     BattleManager.actor.input.set_item(@item.id)
  554.     if @item.for_opponent?
  555.       select_enemy_selection
  556.     elsif @item.for_friend?
  557.       select_actor_selection
  558.     else
  559.       @item_window.hide
  560.       next_command
  561.       $game_temp.battle_aid = nil
  562.     end
  563.     $game_party.last_item.object = @item
  564.   end
  565.   alias scene_battle_on_item_cancel_abe on_item_cancel
  566.   def on_item_cancel
  567.     scene_battle_on_item_cancel_abe
  568.     @status_window.show
  569.     @actor_command_window.show
  570.     @status_aid_window.hide
  571.   end
  572.   alias scene_battle_select_actor_selection_abe select_actor_selection
  573.   def select_actor_selection
  574.     @status_aid_window.refresh
  575.     scene_battle_select_actor_selection_abe
  576.     @status_window.hide
  577.     @skill_window.hide
  578.     @item_window.hide
  579.     @help_window.show
  580.   end
  581.   alias scene_battle_on_actor_ok_abe on_actor_ok
  582.   def on_actor_ok
  583.     $game_temp.battle_aid = nil
  584.     scene_battle_on_actor_ok_abe
  585.     @status_window.show
  586.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  587.       @actor_command_window.visible = !@confirm_command_window.visible
  588.     else
  589.       @actor_command_window.show
  590.     end
  591.     @status_aid_window.hide
  592.   end
  593.   alias scene_battle_on_actor_cancel_abe on_actor_cancel
  594.   def on_actor_cancel
  595.     BattleManager.actor.input.clear
  596.     @status_aid_window.refresh
  597.     $game_temp.battle_aid = nil
  598.     scene_battle_on_actor_cancel_abe
  599.     case @actor_command_window.current_symbol
  600.     when :skill
  601.       @skill_window.show
  602.     when :item
  603.       @item_window.show
  604.     end
  605.   end
  606.   alias scene_battle_select_enemy_selection_abe select_enemy_selection
  607.   def select_enemy_selection
  608.     @status_aid_window.refresh
  609.     scene_battle_select_enemy_selection_abe
  610.     @help_window.show
  611.   end
  612.   alias scene_battle_on_enemy_ok_abe on_enemy_ok
  613.   def on_enemy_ok
  614.     $game_temp.battle_aid = nil
  615.     scene_battle_on_enemy_ok_abe
  616.   end
  617.   alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  618.   def on_enemy_cancel
  619.     BattleManager.actor.input.clear
  620.     @status_aid_window.refresh
  621.     $game_temp.battle_aid = nil
  622.     scene_battle_on_enemy_cancel_abe
  623.     if @skill_window.visible || @item_window.visible
  624.       @help_window.show
  625.     else
  626.       @help_window.hide
  627.     end
  628.   end
  629.   def end_battle_conditions?
  630.     return true if $game_party.members.empty?
  631.     return true if $game_party.all_dead?
  632.     return true if $game_troop.all_dead?
  633.     return true if BattleManager.aborting?
  634.     return false
  635.   end
  636.   def refresh_status
  637.     #如果你是程序员,请顺手帮忙优化下这里,谢谢。
  638.     @status_window.refresh
  639.     for i in $game_party.battle_members
  640.       @status_window.draw_item($game_party.battle_members.index(i))
  641.     end
  642.   end
  643. end
复制代码

点评

如果把我的脚本放在他这个下面还不能解决的话,你就放弃一个好了  发表于 2015-1-24 23:37
回复

使用道具 举报

梦石
0
星屑
85
在线时间
424 小时
注册时间
2009-8-3
回帖
937
发表于 2015-2-27 11:20:51 | 显示全部楼层
有个地方好像错了吧。
279行的
effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_items[x.data_id].name}\\c[0]\n"}

应该是
effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}

评分

参与人数 1星屑 +150 收起 理由
VIPArcher + 150 感谢指出

查看全部评分

回复

使用道具 举报

梦石
0
星屑
677
在线时间
509 小时
注册时间
2011-4-25
回帖
155
发表于 2015-2-27 18:56:09 | 显示全部楼层
在XAS里没有问题
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部