赞 3  
 
VIP 0 
 
好人卡 0 
 
积分 2  
经验 45777 
 
最后登录 2018-5-25 
 
在线时间 248 小时 
 
 
 
Lv1.梦旅人 
	梦石 0  星屑 199  
        在线时间 248 小时 
        注册时间 2012-4-29 
        帖子 386  
 
 
	
3 楼 
 
 楼主
| 
发表于 2013-10-31 17:06:57 
| 
只看该作者 
 
 
 
 本帖最后由 76213585 于 2013-10-31 20:12 编辑  tan12345 发表于 2013-10-31 13:26  #encoding:utf-8 
#============================================================================== 
# ■ LBQ's Equip Randomization Script - Beta 
#------------------------------------------------------------------------------ 
#  Author: LBQ                                                  lbq.mist.so 
#============================================================================== 
# ■ Version History 
#------------------------------------------------------------------------------ 
#   - 10/21/2013 Started 
#   - 10/25/2013 Beta Version Finished 
#   - 10/26/2013 Patch 1 Finished 
#   - 10/26/2013 Finished Refoging and Enchanting 
#============================================================================== 
# ■ Compatibility 
#------------------------------------------------------------------------------ 
#   - Because this almost rewrite the item system so do not expect any compati- 
#     bility 
#   - Only Works in RPG Maker VX Ace 
#============================================================================== 
# ■ Manual 
#------------------------------------------------------------------------------ 
#   - Use these in event scripts 
#     -- gain_enchanted_armor(id,[possible_effects]) 
#          - This can give you a randomnized armor 
#     -- gain_enchanted_weapon(id,[possible_effects]) 
#============================================================================== 
 
 
 
$imported  ||= { } 
$imported [ :lbq_equip_randomnization ]  = 'beta' 
module  LBQ_Delegate
  def  delegate_item
    self .object 
  end 
 
 
  def  can_delegate?( id) 
    if  self .object .respond_to ? id
      return  true 
    end 
 
    return  false 
 
  end 
 
 
 
 
  def  method_missing( id,*args,&block) 
    return  nil  if  is_nil?
    return  ''  unless  object
    if  can_delegate?( id) 
      delegate_item.send ( id,*args,&block) 
    else 
      super 
    end 
 
  end 
 
end 
 
 
class  Unique_Equip < Game_BaseItem
 
  attr_accessor :pos 
  def  initialize
    super 
    @pos  = 0 
  end 
 
  def  etype_id
    return  self .object .etype_id 
  end 
 
 
 
  def  empty?
    return  true  unless  @class 
    return  false 
  end 
 
 
  def  icon_index
    return  0  if  is_nil?
    return  self .object .icon_index 
  end 
 
 
  def  params
    return_value = Marshal .load ( Marshal .dump ( self .object .params ) ) 
 
 
    prefix_objects.each  do  |o|
      o.params .each_with_index  do  |v,i|
        return_value[ i]  += v
      end 
    end 
 
 
    return_value.each_with_index  do  |v,i|
      return_value[ i] *=@param_randomness[ i] 
      return_value[ i]  = return_value[ i] .to_i 
    end 
 
 
 
 
 
    return  [ ]  if  is_nil?
    return  return_value
  end 
 
 
  def  price
    return  0  if  is_nil?
    return  object.price 
  end 
 
end 
 
class  Unique_Item < Game_BaseItem
  include  LBQ_Delegate
  attr_accessor :pos 
  def  initialize
    super 
    @pos  = 0 
  end 
 
  def  itype_id
    return  self .object .itype_id 
  end 
 
 
  def  battle_ok?
    return  true 
  end 
 
 
end 
 
 
class  Game_Actor
  #-------------------------------------------------------------------------- 
  # ● 初始化装备 
  #     equips : 初期装备的数组 
  #-------------------------------------------------------------------------- 
  def  init_equips( equips) 
    @equips  = Array .new ( equip_slots.size )  {  Unique_Equip.new  } 
    equips.each_with_index  do  |item_id, i|
      etype_id = index_to_etype_id( i) 
      slot_id = empty_slot( etype_id) 
      @equips [ slot_id] .set_equip ( etype_id == 0 , item_id)  if  slot_id
    end 
    refresh
  end 
 
 
  def  change_equip( slot_id, item) 
    return  unless  trade_item_with_party( item, @equips [ slot_id] ) 
    return  if  item && equip_slots[ slot_id]  != item.etype_id 
    if  item.nil ?
      @equips [ slot_id]  = Unique_Equip.new 
    else 
      @equips [ slot_id]  = item
    end 
    refresh
  end 
 
 
  def  trade_item_with_party( new_item, old_item) 
    $game_party .gain_item ( old_item, 1 ) 
    $game_party .lose_item ( new_item, 1 ) 
    return  true 
  end 
end 
 
 
 
class  Game_Party
  attr_reader :items ,:weapons,:armors
 
  def  items
    @items  = @items .select { |i| !i.is_nil ?} 
    @items  = @items .compact 
    return  @items 
  end 
 
  alias  lbq_ue_init_items init_all_items
  def  init_all_items
    lbq_ue_init_items
    @items  = [ ] 
    @weapons  = [ ] 
    @armors  = [ ] 
  end 
 
  alias  lbq_ue_gain_item gain_item
  def  gain_item( item, amount, include_equip = false ) 
    if  item.class  == RPG::Weapon 
      amount.times  do 
        new_one = Unique_Equip.new 
        new_one.object  = item
        @weapons  << new_one
      end 
    elsif  item.class  == RPG::Armor 
      amount.times  do 
        new_one = Unique_Equip.new 
        new_one.object  = item
        @armors  << new_one
      end 
    elsif  item.class  == Unique_Equip && item.is_armor ?
      if  amount == 1 
        @armors .push  item
      else 
        @armors .delete ( item) 
      end 
    elsif  item.class  == Unique_Equip && item.is_weapon ?
      if  amount == 1 
        @weapons .push  item
      else 
        @weapons .delete ( item) 
      end 
    elsif  item.class  == Unique_Item
      puts  amount
      if  amount ==1 
        @items .push  item
      else 
        @items .each  do  |i|
 
          if  i.name  == item.name 
            @items .delete ( i)  
            break 
          end 
        end 
 
      end 
 
    else 
      amount.times  do 
        new_one = Unique_Item.new 
        new_one.object  = item
        @items  << new_one
      end 
    end  # if 
    sort_all
  end 
 
 
 
 
  def  sort( x) 
    #x.sort! { |a, b|  a.item_id <=> b.item_id } 
    x.each_with_index  do  |item,i|
      x.delete ( item)  unless  i.class 
      item.pos  = i
    end 
  end 
 
  def  sort_all
    sort_weapon
    sort_armor
    sort_item
  end 
 
 
  def  sort_weapon
    sort( @weapons) 
  end 
 
 
  def  sort_armor
    sort( @armors) 
  end 
 
  def  sort_item
    sort( @items) 
  end 
 
 
  #-------------------------------------------------------------------------- 
  # ● 消耗物品 
  #    减少 1 个持有数。 
  #-------------------------------------------------------------------------- 
  def  consume_item( item) 
    lose_item( item, 1 )  if  item.is_a ?( Unique_Item)  && item.consumable 
  end 
 
end 
 
class  Game_Battler < Game_BattlerBase
  #-------------------------------------------------------------------------- 
  # ● 技能/使用物品 
  #    对使用目标使用完毕后,应用对于使用目标以外的效果。 
  #-------------------------------------------------------------------------- 
  def  use_item( item) 
    pay_skill_cost( item)  if  item.is_a ?( RPG::Skill ) 
    consume_item( item)    if  item.is_a ?( Unique_Item) 
    item.effects .each  { |effect| item_global_effect_apply( effect)  } 
  end 
end 
 
 
 
class  Game_Action
  #-------------------------------------------------------------------------- 
  # ● 设置物品 
  #-------------------------------------------------------------------------- 
  def  set_item( item_id) 
    new_one = $data_items [ item_id] 
    @item  = Unique_Item.new 
    @item .object  = new_one
    self 
  end 
end 
 
 
#============================================================================== 
# ■ Game_BaseItem 
#------------------------------------------------------------------------------ 
#  管理技能、物品、武器、护甲的统一类。会根据自己的所属类别而管理不同的数据。 
#============================================================================== 
 
class  Game_BaseItem
 
 
  attr_reader  :item_id 
 
 
  def  id
    return  nil  if  is_nil?
    return  object.id 
  end 
end 
 
 
class  Window_ItemList < Window_Selectable
  #-------------------------------------------------------------------------- 
  # ● 查询列表中是否含有此物品 
  #-------------------------------------------------------------------------- 
  def  include ?( item) 
    case  @category 
    when  :item 
      item.is_a ?( Unique_Item)  &&! item.is_nil ?
    when  :weapon 
      item.is_a ?( Unique_Equip)  && item.object .is_a ?( RPG::Weapon ) 
    when  :armor 
      item.is_a ?( Unique_Equip)  && item.object .is_a ?( RPG::Armor ) 
    when  :key_item 
      false 
    else 
      false 
    end 
  end 
 
  #-------------------------------------------------------------------------- 
  # ● 绘制项目 
  #-------------------------------------------------------------------------- 
  def  draw_item( index) 
    item = @data [ index] 
    if  item
      rect = item_rect( index) 
      rect.width  -= 4 
      draw_item_name( item, rect.x , rect.y , enable?( item) )  unless  item.is_nil ? || item.object .nil ?
    end 
  end 
 
end 
 
 
class  Window_EquipItem < Window_ItemList
  #-------------------------------------------------------------------------- 
  # ● 查询使用列表中是否含有此物品 
  #-------------------------------------------------------------------------- 
  alias  lbq_ue_we_include? include ?
  def  include ?( item) 
 
    return  true  if  item == nil 
    return  false  unless  item.is_a ?( Unique_Equip) 
    return  lbq_ue_we_include?( item.object ) 
  end 
end 
 
class  Game_BattlerBase
  #-------------------------------------------------------------------------- 
  # ● 判定技能/使用物品是否可用 
  #-------------------------------------------------------------------------- 
  def  usable?( item) 
    if  item
      puts  item.name .to_s  + " -- "  + item.class .inspect  if  item.name 
    end 
 
    #puts skill_conditions_met?(item) if item.is_a?(RPG::Sk 
    return  skill_conditions_met?( item)  if  item.is_a ?( RPG::Skill ) 
    puts  "Item Conditions Met? #{item_conditions_met?(item)  if item.is_a?(Unique_Item)}" 
    return  item_conditions_met?( item)   if  item.is_a ?( Unique_Item) 
    return  false 
  end 
end 
 
class  Game_Party
  def  has_item?( item, include_equip = false ) 
    puts  "Has Item Check Class: #{item.class}"  
    return  false  if  item.name .nil ?
    puts  "The Item has a Name" 
 
    #puts "Items Array: #{items.collect{|i|i.name}}" 
    puts  "This Item: #{item}" 
 
 
 
    result = false 
    @items .each  do  |i|
      puts  "Comparing: #{i.name} vs #{item.name}" 
      if  i.name  == item.name 
 
        result = true 
      end 
    end 
 
 
    puts  "Found this Item in the item array"  if  result
    puts  "Does not have it in the item array"  unless  result
 
    return  result if  result
 
    return  true  if  @items .include ?( item)  || @armors .include ?( item)  || @weapons .include ?( item) 
    return  include_equip ? members_equip_include?( item)  : false 
  end 
 
end 
 
class  Game_Action
  #-------------------------------------------------------------------------- 
  # ● 获取物品实例 
  #-------------------------------------------------------------------------- 
  def  item
    puts  @item .is_a ?( Unique_Item) 
    return  @item  if  @item .is_a ?( Unique_Item) 
    return  @item .object 
  end 
end 
 
 
class  Window_ItemList
  #-------------------------------------------------------------------------- 
  # ● 查询此物品是否可用 
  #-------------------------------------------------------------------------- 
  def  enable?( item) 
    return  false  unless  item
    $game_party .usable ?( item) 
  end 
end 
 
 
 
module  ADE
  class  << self 
    def  get_all_prefix( mode = :weapon ) 
      db = $data_weapons  if  mode == :weapon 
      db = $data_armors  if  mode == :armor 
      db = $data_items   if  mode == :items 
      objects = db.select  do  |w|
        if  w
          w.note .include ? "<PREFIX>" 
        else 
          false 
        end 
 
      end 
 
      return  objects.collect { |o| o.id } 
    end 
  end 
end 
 
 
 
 
class  Unique_Equip
  include  LBQ_Delegate
  attr_accessor :prefixes 
  alias  lbq_unique_equip_prefix_init initialize
  def  initialize
    lbq_unique_equip_prefix_init
    # PREFIX - All Integers 
    @prefixes  = [ ] 
    @prefix_features  = { } 
    @param_randomness  = Array .new ( 8 ,1.0 ) 
    @price_randomness  = 1.0 
    regenerate_prefix_features
  end 
 
  def  generate_price_randomness
    @price_randomness  = the_rand_num
  end 
 
 
  def  generate_param_randomness
    @param_randomness  = @param_randomness .map { |v| the_rand_num} 
  end 
 
  def  the_rand_num
    num = rand ( 40 )  + 80 
    return  num/100.0 
  end 
 
  def  enchant( id) 
    @prefixes .push ( id) 
    regenerate_prefix_feature_about id
    puts  "Prefixes: #{@prefix_features[id]}" 
  end 
 
  def  price
    return  0  if  is_nil?
    value = object.price 
    self .prefix_objects .each  do  |o|
      value+=o.price 
    end 
 
    value*=@price_randomness
    return  value.to_i 
 
  end 
 
 
 
  def  regenerate_prefix_features
    self .prefix_objects .each_with_index  do  |o,i|
      regenerate_prefix_feature_about( i) 
    end 
  end 
 
 
 
  def  regenerate_prefix_feature_about( id) 
    feature_arrays = [ ] 
      object_thing = $data_weapons [ id] 
      object_thing = $data_armors [ id]  if  is_armor?
 
 
 
    object_thing.features .each  do  |f|
      clone_f = Marshal .load ( Marshal .dump ( f) ) 
 
      multi = ( rand ( 40 ) .to_f  + 80.0 ) /100.0 
      multi = multi.round ( 2 ) 
      clone_f.value  = clone_f.value*multi 
      clone_f.value  = clone_f.value .round ( 2 ) 
      feature_arrays << clone_f
    end 
    @prefix_features [ id]  = feature_arrays
  end 
 
 
  def  prefix_objects
    @prefixes .collect  { |p| db[ p ] } 
  end 
 
 
  def  db
    is_weapon? ? $data_weapons  : $data_armors 
  end 
 
 
 
 
  def  name
    return  nil  if  is_nil?
    return  ''  unless  object.respond_to ? :name 
    return  add_suffix( self .object .name ) 
  end 
 
  def  add_suffix( str) 
 
    s = '' 
 
    @prefixes .each  do  |p|
      name = db[ p ] .name 
      s+=name
    end 
 
    s = s + "的"  unless  s.empty ?
    str = s + str
    return  str
  end 
 
 
  def  features
    return  @prefix_features .values .inject ( [ ] ) { |b,r| b+=r} 
    return  weapon_features if  is_weapon?
    return  armor_features  if  is_armor?
    return  [ ] 
  end 
 
  def  weapon_features
    return_value = [ ] 
    @prefixes .each  do  |x|
      return_value += $data_weapons [ x] .features 
    end 
    return  return_value
  end 
 
  def  armor_features
    return_value = [ ] 
    @prefixes .each  do  |x|
      return_value += $data_armors [ x] .features 
    end 
    return  return_value
  end 
 
 
 
end 
 
class  Game_Actor
  #-------------------------------------------------------------------------- 
  # ● 获取装备实例的数组 
  #-------------------------------------------------------------------------- 
  def  equips
    new_value = @equips .collect  do  |item| 
      item.object 
    end 
    return  new_value
  end 
 
  #-------------------------------------------------------------------------- 
  # ● 以数组方式获取拥有特性所有实例 
  #-------------------------------------------------------------------------- 
  def  feature_objects
    super  + [ actor]  + [ self .class ]  + equips.compact  + @equips 
  end 
 
 
  #-------------------------------------------------------------------------- 
  # ● 获取武器实例的数组 
  #-------------------------------------------------------------------------- 
  def  weapons
    @equips .select  { |item| item.is_weapon ? } .collect { |i| i.object } 
  end 
  #-------------------------------------------------------------------------- 
  # ● 获取护甲实例的数组 
  #-------------------------------------------------------------------------- 
  def  armors
    @equips .select  { |item| item.is_armor ? } .collect { |i| i.object } 
  end 
end 
 
class  Game_Actor
  #-------------------------------------------------------------------------- 
  # ● 获取装备实例的数组 
  #-------------------------------------------------------------------------- 
  def  drawn_equips
    @equips .collect { |e| e} 
  end 
end 
 
class  Window_EquipSlot
  #-------------------------------------------------------------------------- 
  # ● 绘制项目 
  #-------------------------------------------------------------------------- 
  def  draw_item( index) 
    return  unless  @actor 
    rect = item_rect_for_text( index) 
    change_color( system_color, enable?( index) ) 
    draw_text( rect.x , rect.y , 92 , line_height, slot_name( index) ) 
    draw_item_name( @actor.drawn_equips [ index] , rect.x  + 92 , rect.y , enable?( index) ) 
  end 
end 
 
class  Game_Actor
  #-------------------------------------------------------------------------- 
  # ● 强制更换装备 
  #     slot_id : 装备栏 ID 
  #     item    : 武器/护甲(为 nil 时装备解除) 
  #-------------------------------------------------------------------------- 
  def  force_change_equip( slot_id, item) 
    if  item.nil ?
      @equips [ slot_id]  = Unique_Equip.new 
    else 
      @equips [ slot_id]  = item
    end 
    release_unequippable_items( false ) 
    refresh
  end 
end 
 
class  Game_Party
  def  gain_enchanted_weapon( *args) 
    item_id = args[ 0 ] 
    new_one = Unique_Equip.new 
    new_one.object  = $data_weapons [ item_id] 
    if  args.length  == 1 
#~       case rand(10) 
#~       when 0..4 
#~         gp = [prefixes.sample] 
#~       when 5..7 
#~         gp = [prefixes.sample,prefixes.sample] 
#~         gp = gp.uniq 
#~       else 
#~         gp = [] 
#~       end 
      gp = Prefix_Gen.generate_prefix ( :weapon ) 
    else 
      gp = args[ 1 ] 
    end 
    gp.each  do  |p|
      new_one.enchant ( p ) 
    end 
 
    new_one.generate_param_randomness 
    new_one.generate_price_randomness 
    @weapons  << new_one
  end 
 
  def  prefixes
    return  ADE.get_all_prefix 
  end 
 
 
  def  armor_prefixes
    return  ADE.get_all_prefix ( :armor ) 
  end 
 
 
 
  def  gain_enchanted_armor( *args) 
    item_id = args[ 0 ] 
    new_one = Unique_Equip.new 
    new_one.object  = $data_armors [ item_id] 
    if  args.length  == 1 
#~       case rand(10) 
#~       when 0..4 
#~         gp = [armor_prefixes.sample] 
#~       when 5..7 
#~         gp = [armor_prefixes.sample,armor_prefixes.sample] 
#~         gp = gp.uniq 
#~       else 
#~         gp = [] 
#~       end 
      gp = Prefix_Gen.generate_prefix ( :armor ) 
    else 
      gp = args[ 1 ] 
    end 
    gp.each  do  |p|
      new_one.enchant ( p ) 
    end 
    new_one.generate_param_randomness 
    new_one.generate_price_randomness 
    @armors  << new_one
  end 
 
end 
 
class  Unique_Item
  attr_reader :prefixes 
 
  alias  lbq_ui_uni_i_init initialize
  def  initialize
    lbq_ui_uni_i_init
    @prefixes  = [ ] 
    @prefix_effects  = { } 
    create_all_effects
  end 
 
 
  def  name
    return  nil  if  is_nil?
    begin 
      object.name 
    rescue 
      return  '' 
    end 
 
    $game_party .items 
    ori_name = object.name 
    new_name = prefix_objects.inject ( '' )  do  |o,n|
      o+=n.name 
    end 
 
    connect_string = '' 
    connect_string = '的'  unless  new_name.empty ?
 
    final_name = new_name + connect_string + ori_name
 
    return  final_name
  end 
 
 
  def  prefix_objects
    @prefixes .collect { |p| $data_items [ p ] } 
  end 
 
 
 
  def  enchant( x) 
    @prefixes  << x
    create_single_effect( x) 
  end 
 
 
  def  create_all_effects
    @prefixes .each  do  |p|
      create_single_effect( p ) 
    end 
 
  end 
 
 
  def  create_single_effect( id) 
    clone_e = Marshal .load ( Marshal .dump ( $data_items[ id] .effects ) ) 
    clone_e.each  do  |e| 
      if  e
        e.value1* =the_rand_num
        e.value2* =the_rand_num
      end 
 
    end 
 
    @prefix_effects [ id]  = clone_e
  end 
 
  def  the_rand_num
    num = rand ( 40 )  + 80 
    return  num/100.0 
  end 
 
 
 
  def  effects
    return  @prefix_effects .values .inject ( object.effects )  do  |o,n|
      o += n
    end 
  end 
 
end 
 
class  Game_Party
  def  item_prefixes
    ADE.get_all_prefix ( :items ) 
  end 
 
  def  gain_enchanted_item( *args) 
    item_id = args[ 0 ] 
    new_one = Unique_Item.new 
    new_one.object  = $data_items [ item_id] 
    if  args.length  == 1 
      case  rand ( 10 ) 
      when  0 ..4 
        gp = [ item_prefixes.sample ] 
      when  5 ..7 
        gp = [ item_prefixes.sample ,item_prefixes.sample ] 
        gp = gp.uniq 
      else 
        gp = [ ] 
      end 
    else 
      gp = args[ 1 ] 
    end 
 
    gp = [ ] 
 
    puts  "This thing's GP is #{gp}" 
    gp.each  do  |p|
      new_one.enchant ( p ) 
    end 
 
    @items  << new_one
  end 
 
end 
 
class  Game_Interpreter
  def  gain_enchanted_item( *args) 
    $game_party .gain_enchanted_item ( *args) 
  end 
 
  def  gain_enchanted_armor( *args) 
    $game_party .gain_enchanted_armor ( *args) 
  end 
 
  def  gain_enchanted_weapon( *args) 
    $game_party .gain_enchanted_weapon ( *args) 
  end 
end 
 
 
class  Game_Actor
  #-------------------------------------------------------------------------- 
  # ● 获取普通能力的附加值 
  #-------------------------------------------------------------------------- 
  def  param_plus( param_id) 
    @equips .select { |e| e.name !=nil } .inject ( super )  do  |r, item|
      r += item.params [ param_id] 
    end 
  end 
 
 
 
end 
class  Window_Base
  #-------------------------------------------------------------------------- 
  # ● 绘制物品名称 
  #     enabled : 有效的标志。false 的时候使用半透明效果绘制 
  #-------------------------------------------------------------------------- 
  def  draw_item_name( item, x, y, enabled = true , width = 250 ) 
    return  unless  item
    draw_icon( item.icon_index , x, y, enabled) 
    change_color( normal_color, enabled) 
    draw_text( x + 24 , y, width, line_height, item.name ) 
  end 
end 
#encoding:utf-8 
#============================================================================== 
# ■ LBQ's Equip Randomization Script - Beta 
#------------------------------------------------------------------------------ 
#  Author: LBQ                                                  lbq.mist.so 
#============================================================================== 
# ■ Version History 
#------------------------------------------------------------------------------ 
#   - 10/21/2013 Started 
#   - 10/25/2013 Beta Version Finished 
#   - 10/26/2013 Patch 1 Finished 
#   - 10/26/2013 Finished Refoging and Enchanting 
#============================================================================== 
# ■ Compatibility 
#------------------------------------------------------------------------------ 
#   - Because this almost rewrite the item system so do not expect any compati- 
#     bility 
#   - Only Works in RPG Maker VX Ace 
#============================================================================== 
# ■ Manual 
#------------------------------------------------------------------------------ 
#   - Use these in event scripts 
#     -- gain_enchanted_armor(id,[possible_effects]) 
#          - This can give you a randomnized armor 
#     -- gain_enchanted_weapon(id,[possible_effects]) 
#============================================================================== 
 
 
 
$imported  ||= { } 
$imported [ :lbq_equip_randomnization ]  = 'beta' 
module  LBQ_Delegate
  def  delegate_item
    self .object 
  end 
 
 
  def  can_delegate?( id) 
    if  self .object .respond_to ? id
      return  true 
    end 
 
    return  false 
 
  end 
 
 
 
 
  def  method_missing( id,*args,&block) 
    return  nil  if  is_nil?
    return  ''  unless  object
    if  can_delegate?( id) 
      delegate_item.send ( id,*args,&block) 
    else 
      super 
    end 
 
  end 
 
end 
 
 
class  Unique_Equip < Game_BaseItem
 
  attr_accessor :pos 
  def  initialize
    super 
    @pos  = 0 
  end 
 
  def  etype_id
    return  self .object .etype_id 
  end 
 
 
 
  def  empty?
    return  true  unless  @class 
    return  false 
  end 
 
 
  def  icon_index
    return  0  if  is_nil?
    return  self .object .icon_index 
  end 
 
 
  def  params
    return_value = Marshal .load ( Marshal .dump ( self .object .params ) ) 
 
 
    prefix_objects.each  do  |o|
      o.params .each_with_index  do  |v,i|
        return_value[ i]  += v
      end 
    end 
 
 
    return_value.each_with_index  do  |v,i|
      return_value[ i] *=@param_randomness[ i] 
      return_value[ i]  = return_value[ i] .to_i 
    end 
 
 
 
 
 
    return  [ ]  if  is_nil?
    return  return_value
  end 
 
 
  def  price
    return  0  if  is_nil?
    return  object.price 
  end 
 
end 
 
class  Unique_Item < Game_BaseItem
  include  LBQ_Delegate
  attr_accessor :pos 
  def  initialize
    super 
    @pos  = 0 
  end 
 
  def  itype_id
    return  self .object .itype_id 
  end 
 
 
  def  battle_ok?
    return  true 
  end 
 
 
end 
 
 
class  Game_Actor
  #-------------------------------------------------------------------------- 
  # ● 初始化装备 
  #     equips : 初期装备的数组 
  #-------------------------------------------------------------------------- 
  def  init_equips( equips) 
    @equips  = Array .new ( equip_slots.size )  {  Unique_Equip.new  } 
    equips.each_with_index  do  |item_id, i|
      etype_id = index_to_etype_id( i) 
      slot_id = empty_slot( etype_id) 
      @equips [ slot_id] .set_equip ( etype_id == 0 , item_id)  if  slot_id
    end 
    refresh
  end 
 
 
  def  change_equip( slot_id, item) 
    return  unless  trade_item_with_party( item, @equips [ slot_id] ) 
    return  if  item && equip_slots[ slot_id]  != item.etype_id 
    if  item.nil ?
      @equips [ slot_id]  = Unique_Equip.new 
    else 
      @equips [ slot_id]  = item
    end 
    refresh
  end 
 
 
  def  trade_item_with_party( new_item, old_item) 
    $game_party .gain_item ( old_item, 1 ) 
    $game_party .lose_item ( new_item, 1 ) 
    return  true 
  end 
end 
 
 
 
class  Game_Party
  attr_reader :items ,:weapons,:armors
 
  def  items
    @items  = @items .select { |i| !i.is_nil ?} 
    @items  = @items .compact 
    return  @items 
  end 
 
  alias  lbq_ue_init_items init_all_items
  def  init_all_items
    lbq_ue_init_items
    @items  = [ ] 
    @weapons  = [ ] 
    @armors  = [ ] 
  end 
 
  alias  lbq_ue_gain_item gain_item
  def  gain_item( item, amount, include_equip = false ) 
    if  item.class  == RPG::Weapon 
      amount.times  do 
        new_one = Unique_Equip.new 
        new_one.object  = item
        @weapons  << new_one
      end 
    elsif  item.class  == RPG::Armor 
      amount.times  do 
        new_one = Unique_Equip.new 
        new_one.object  = item
        @armors  << new_one
      end 
    elsif  item.class  == Unique_Equip && item.is_armor ?
      if  amount == 1 
        @armors .push  item
      else 
        @armors .delete ( item) 
      end 
    elsif  item.class  == Unique_Equip && item.is_weapon ?
      if  amount == 1 
        @weapons .push  item
      else 
        @weapons .delete ( item) 
      end 
    elsif  item.class  == Unique_Item
      puts  amount
      if  amount ==1 
        @items .push  item
      else 
        @items .each  do  |i|
 
          if  i.name  == item.name 
            @items .delete ( i)  
            break 
          end 
        end 
 
      end 
 
    else 
      amount.times  do 
        new_one = Unique_Item.new 
        new_one.object  = item
        @items  << new_one
      end 
    end  # if 
    sort_all
  end 
 
 
 
 
  def  sort( x) 
    #x.sort! { |a, b|  a.item_id <=> b.item_id } 
    x.each_with_index  do  |item,i|
      x.delete ( item)  unless  i.class 
      item.pos  = i
    end 
  end 
 
  def  sort_all
    sort_weapon
    sort_armor
    sort_item
  end 
 
 
  def  sort_weapon
    sort( @weapons) 
  end 
 
 
  def  sort_armor
    sort( @armors) 
  end 
 
  def  sort_item
    sort( @items) 
  end 
 
 
  #-------------------------------------------------------------------------- 
  # ● 消耗物品 
  #    减少 1 个持有数。 
  #-------------------------------------------------------------------------- 
  def  consume_item( item) 
    lose_item( item, 1 )  if  item.is_a ?( Unique_Item)  && item.consumable 
  end 
 
end 
 
class  Game_Battler < Game_BattlerBase
  #-------------------------------------------------------------------------- 
  # ● 技能/使用物品 
  #    对使用目标使用完毕后,应用对于使用目标以外的效果。 
  #-------------------------------------------------------------------------- 
  def  use_item( item) 
    pay_skill_cost( item)  if  item.is_a ?( RPG::Skill ) 
    consume_item( item)    if  item.is_a ?( Unique_Item) 
    item.effects .each  { |effect| item_global_effect_apply( effect)  } 
  end 
end 
 
 
 
class  Game_Action
  #-------------------------------------------------------------------------- 
  # ● 设置物品 
  #-------------------------------------------------------------------------- 
  def  set_item( item_id) 
    new_one = $data_items [ item_id] 
    @item  = Unique_Item.new 
    @item .object  = new_one
    self 
  end 
end 
 
 
#============================================================================== 
# ■ Game_BaseItem 
#------------------------------------------------------------------------------ 
#  管理技能、物品、武器、护甲的统一类。会根据自己的所属类别而管理不同的数据。 
#============================================================================== 
 
class  Game_BaseItem
 
 
  attr_reader  :item_id 
 
 
  def  id
    return  nil  if  is_nil?
    return  object.id 
  end 
end 
 
 
class  Window_ItemList < Window_Selectable
  #-------------------------------------------------------------------------- 
  # ● 查询列表中是否含有此物品 
  #-------------------------------------------------------------------------- 
  def  include ?( item) 
    case  @category 
    when  :item 
      item.is_a ?( Unique_Item)  &&! item.is_nil ?
    when  :weapon 
      item.is_a ?( Unique_Equip)  && item.object .is_a ?( RPG::Weapon ) 
    when  :armor 
      item.is_a ?( Unique_Equip)  && item.object .is_a ?( RPG::Armor ) 
    when  :key_item 
      false 
    else 
      false 
    end 
  end 
 
  #-------------------------------------------------------------------------- 
  # ● 绘制项目 
  #-------------------------------------------------------------------------- 
  def  draw_item( index) 
    item = @data [ index] 
    if  item
      rect = item_rect( index) 
      rect.width  -= 4 
      draw_item_name( item, rect.x , rect.y , enable?( item) )  unless  item.is_nil ? || item.object .nil ?
    end 
  end 
 
end 
 
 
class  Window_EquipItem < Window_ItemList
  #-------------------------------------------------------------------------- 
  # ● 查询使用列表中是否含有此物品 
  #-------------------------------------------------------------------------- 
  alias  lbq_ue_we_include? include ?
  def  include ?( item) 
 
    return  true  if  item == nil 
    return  false  unless  item.is_a ?( Unique_Equip) 
    return  lbq_ue_we_include?( item.object ) 
  end 
end 
 
class  Game_BattlerBase
  #-------------------------------------------------------------------------- 
  # ● 判定技能/使用物品是否可用 
  #-------------------------------------------------------------------------- 
  def  usable?( item) 
    if  item
      puts  item.name .to_s  + " -- "  + item.class .inspect  if  item.name 
    end 
 
    #puts skill_conditions_met?(item) if item.is_a?(RPG::Sk 
    return  skill_conditions_met?( item)  if  item.is_a ?( RPG::Skill ) 
    puts  "Item Conditions Met? #{item_conditions_met?(item)  if item.is_a?(Unique_Item)}" 
    return  item_conditions_met?( item)   if  item.is_a ?( Unique_Item) 
    return  false 
  end 
end 
 
class  Game_Party
  def  has_item?( item, include_equip = false ) 
    puts  "Has Item Check Class: #{item.class}"  
    return  false  if  item.name .nil ?
    puts  "The Item has a Name" 
 
    #puts "Items Array: #{items.collect{|i|i.name}}" 
    puts  "This Item: #{item}" 
 
 
 
    result = false 
    @items .each  do  |i|
      puts  "Comparing: #{i.name} vs #{item.name}" 
      if  i.name  == item.name 
 
        result = true 
      end 
    end 
 
 
    puts  "Found this Item in the item array"  if  result
    puts  "Does not have it in the item array"  unless  result
 
    return  result if  result
 
    return  true  if  @items .include ?( item)  || @armors .include ?( item)  || @weapons .include ?( item) 
    return  include_equip ? members_equip_include?( item)  : false 
  end 
 
end 
 
class  Game_Action
  #-------------------------------------------------------------------------- 
  # ● 获取物品实例 
  #-------------------------------------------------------------------------- 
  def  item
    puts  @item .is_a ?( Unique_Item) 
    return  @item  if  @item .is_a ?( Unique_Item) 
    return  @item .object 
  end 
end 
 
 
class  Window_ItemList
  #-------------------------------------------------------------------------- 
  # ● 查询此物品是否可用 
  #-------------------------------------------------------------------------- 
  def  enable?( item) 
    return  false  unless  item
    $game_party .usable ?( item) 
  end 
end 
 
 
 
module  ADE
  class  << self 
    def  get_all_prefix( mode = :weapon ) 
      db = $data_weapons  if  mode == :weapon 
      db = $data_armors  if  mode == :armor 
      db = $data_items   if  mode == :items 
      objects = db.select  do  |w|
        if  w
          w.note .include ? "<PREFIX>" 
        else 
          false 
        end 
 
      end 
 
      return  objects.collect { |o| o.id } 
    end 
  end 
end 
 
 
 
 
class  Unique_Equip
  include  LBQ_Delegate
  attr_accessor :prefixes 
  alias  lbq_unique_equip_prefix_init initialize
  def  initialize
    lbq_unique_equip_prefix_init
    # PREFIX - All Integers 
    @prefixes  = [ ] 
    @prefix_features  = { } 
    @param_randomness  = Array .new ( 8 ,1.0 ) 
    @price_randomness  = 1.0 
    regenerate_prefix_features
  end 
 
  def  generate_price_randomness
    @price_randomness  = the_rand_num
  end 
 
 
  def  generate_param_randomness
    @param_randomness  = @param_randomness .map { |v| the_rand_num} 
  end 
 
  def  the_rand_num
    num = rand ( 40 )  + 80 
    return  num/100.0 
  end 
 
  def  enchant( id) 
    @prefixes .push ( id) 
    regenerate_prefix_feature_about id
    puts  "Prefixes: #{@prefix_features[id]}" 
  end 
 
  def  price
    return  0  if  is_nil?
    value = object.price 
    self .prefix_objects .each  do  |o|
      value+=o.price 
    end 
 
    value*=@price_randomness
    return  value.to_i 
 
  end 
 
 
 
  def  regenerate_prefix_features
    self .prefix_objects .each_with_index  do  |o,i|
      regenerate_prefix_feature_about( i) 
    end 
  end 
 
 
 
  def  regenerate_prefix_feature_about( id) 
    feature_arrays = [ ] 
      object_thing = $data_weapons [ id] 
      object_thing = $data_armors [ id]  if  is_armor?
 
 
 
    object_thing.features .each  do  |f|
      clone_f = Marshal .load ( Marshal .dump ( f) ) 
 
      multi = ( rand ( 40 ) .to_f  + 80.0 ) /100.0 
      multi = multi.round ( 2 ) 
      clone_f.value  = clone_f.value*multi 
      clone_f.value  = clone_f.value .round ( 2 ) 
      feature_arrays << clone_f
    end 
    @prefix_features [ id]  = feature_arrays
  end 
 
 
  def  prefix_objects
    @prefixes .collect  { |p| db[ p ] } 
  end 
 
 
  def  db
    is_weapon? ? $data_weapons  : $data_armors 
  end 
 
 
 
 
  def  name
    return  nil  if  is_nil?
    return  ''  unless  object.respond_to ? :name 
    return  add_suffix( self .object .name ) 
  end 
 
  def  add_suffix( str) 
 
    s = '' 
 
    @prefixes .each  do  |p|
      name = db[ p ] .name 
      s+=name
    end 
 
    s = s + "的"  unless  s.empty ?
    str = s + str
    return  str
  end 
 
 
  def  features
    return  @prefix_features .values .inject ( [ ] ) { |b,r| b+=r} 
    return  weapon_features if  is_weapon?
    return  armor_features  if  is_armor?
    return  [ ] 
  end 
 
  def  weapon_features
    return_value = [ ] 
    @prefixes .each  do  |x|
      return_value += $data_weapons [ x] .features 
    end 
    return  return_value
  end 
 
  def  armor_features
    return_value = [ ] 
    @prefixes .each  do  |x|
      return_value += $data_armors [ x] .features 
    end 
    return  return_value
  end 
 
 
 
end 
 
class  Game_Actor
  #-------------------------------------------------------------------------- 
  # ● 获取装备实例的数组 
  #-------------------------------------------------------------------------- 
  def  equips
    new_value = @equips .collect  do  |item| 
      item.object 
    end 
    return  new_value
  end 
 
  #-------------------------------------------------------------------------- 
  # ● 以数组方式获取拥有特性所有实例 
  #-------------------------------------------------------------------------- 
  def  feature_objects
    super  + [ actor]  + [ self .class ]  + equips.compact  + @equips 
  end 
 
 
  #-------------------------------------------------------------------------- 
  # ● 获取武器实例的数组 
  #-------------------------------------------------------------------------- 
  def  weapons
    @equips .select  { |item| item.is_weapon ? } .collect { |i| i.object } 
  end 
  #-------------------------------------------------------------------------- 
  # ● 获取护甲实例的数组 
  #-------------------------------------------------------------------------- 
  def  armors
    @equips .select  { |item| item.is_armor ? } .collect { |i| i.object } 
  end 
end 
 
class  Game_Actor
  #-------------------------------------------------------------------------- 
  # ● 获取装备实例的数组 
  #-------------------------------------------------------------------------- 
  def  drawn_equips
    @equips .collect { |e| e} 
  end 
end 
 
class  Window_EquipSlot
  #-------------------------------------------------------------------------- 
  # ● 绘制项目 
  #-------------------------------------------------------------------------- 
  def  draw_item( index) 
    return  unless  @actor 
    rect = item_rect_for_text( index) 
    change_color( system_color, enable?( index) ) 
    draw_text( rect.x , rect.y , 92 , line_height, slot_name( index) ) 
    draw_item_name( @actor.drawn_equips [ index] , rect.x  + 92 , rect.y , enable?( index) ) 
  end 
end 
 
class  Game_Actor
  #-------------------------------------------------------------------------- 
  # ● 强制更换装备 
  #     slot_id : 装备栏 ID 
  #     item    : 武器/护甲(为 nil 时装备解除) 
  #-------------------------------------------------------------------------- 
  def  force_change_equip( slot_id, item) 
    if  item.nil ?
      @equips [ slot_id]  = Unique_Equip.new 
    else 
      @equips [ slot_id]  = item
    end 
    release_unequippable_items( false ) 
    refresh
  end 
end 
 
class  Game_Party
  def  gain_enchanted_weapon( *args) 
    item_id = args[ 0 ] 
    new_one = Unique_Equip.new 
    new_one.object  = $data_weapons [ item_id] 
    if  args.length  == 1 
#~       case rand(10) 
#~       when 0..4 
#~         gp = [prefixes.sample] 
#~       when 5..7 
#~         gp = [prefixes.sample,prefixes.sample] 
#~         gp = gp.uniq 
#~       else 
#~         gp = [] 
#~       end 
      gp = Prefix_Gen.generate_prefix ( :weapon ) 
    else 
      gp = args[ 1 ] 
    end 
    gp.each  do  |p|
      new_one.enchant ( p ) 
    end 
 
    new_one.generate_param_randomness 
    new_one.generate_price_randomness 
    @weapons  << new_one
  end 
 
  def  prefixes
    return  ADE.get_all_prefix 
  end 
 
 
  def  armor_prefixes
    return  ADE.get_all_prefix ( :armor ) 
  end 
 
 
 
  def  gain_enchanted_armor( *args) 
    item_id = args[ 0 ] 
    new_one = Unique_Equip.new 
    new_one.object  = $data_armors [ item_id] 
    if  args.length  == 1 
#~       case rand(10) 
#~       when 0..4 
#~         gp = [armor_prefixes.sample] 
#~       when 5..7 
#~         gp = [armor_prefixes.sample,armor_prefixes.sample] 
#~         gp = gp.uniq 
#~       else 
#~         gp = [] 
#~       end 
      gp = Prefix_Gen.generate_prefix ( :armor ) 
    else 
      gp = args[ 1 ] 
    end 
    gp.each  do  |p|
      new_one.enchant ( p ) 
    end 
    new_one.generate_param_randomness 
    new_one.generate_price_randomness 
    @armors  << new_one
  end 
 
end 
 
class  Unique_Item
  attr_reader :prefixes 
 
  alias  lbq_ui_uni_i_init initialize
  def  initialize
    lbq_ui_uni_i_init
    @prefixes  = [ ] 
    @prefix_effects  = { } 
    create_all_effects
  end 
 
 
  def  name
    return  nil  if  is_nil?
    begin 
      object.name 
    rescue 
      return  '' 
    end 
 
    $game_party .items 
    ori_name = object.name 
    new_name = prefix_objects.inject ( '' )  do  |o,n|
      o+=n.name 
    end 
 
    connect_string = '' 
    connect_string = '的'  unless  new_name.empty ?
 
    final_name = new_name + connect_string + ori_name
 
    return  final_name
  end 
 
 
  def  prefix_objects
    @prefixes .collect { |p| $data_items [ p ] } 
  end 
 
 
 
  def  enchant( x) 
    @prefixes  << x
    create_single_effect( x) 
  end 
 
 
  def  create_all_effects
    @prefixes .each  do  |p|
      create_single_effect( p ) 
    end 
 
  end 
 
 
  def  create_single_effect( id) 
    clone_e = Marshal .load ( Marshal .dump ( $data_items[ id] .effects ) ) 
    clone_e.each  do  |e| 
      if  e
        e.value1* =the_rand_num
        e.value2* =the_rand_num
      end 
 
    end 
 
    @prefix_effects [ id]  = clone_e
  end 
 
  def  the_rand_num
    num = rand ( 40 )  + 80 
    return  num/100.0 
  end 
 
 
 
  def  effects
    return  @prefix_effects .values .inject ( object.effects )  do  |o,n|
      o += n
    end 
  end 
 
end 
 
class  Game_Party
  def  item_prefixes
    ADE.get_all_prefix ( :items ) 
  end 
 
  def  gain_enchanted_item( *args) 
    item_id = args[ 0 ] 
    new_one = Unique_Item.new 
    new_one.object  = $data_items [ item_id] 
    if  args.length  == 1 
      case  rand ( 10 ) 
      when  0 ..4 
        gp = [ item_prefixes.sample ] 
      when  5 ..7 
        gp = [ item_prefixes.sample ,item_prefixes.sample ] 
        gp = gp.uniq 
      else 
        gp = [ ] 
      end 
    else 
      gp = args[ 1 ] 
    end 
 
    gp = [ ] 
 
    puts  "This thing's GP is #{gp}" 
    gp.each  do  |p|
      new_one.enchant ( p ) 
    end 
 
    @items  << new_one
  end 
 
end 
 
class  Game_Interpreter
  def  gain_enchanted_item( *args) 
    $game_party .gain_enchanted_item ( *args) 
  end 
 
  def  gain_enchanted_armor( *args) 
    $game_party .gain_enchanted_armor ( *args) 
  end 
 
  def  gain_enchanted_weapon( *args) 
    $game_party .gain_enchanted_weapon ( *args) 
  end 
end 
 
 
class  Game_Actor
  #-------------------------------------------------------------------------- 
  # ● 获取普通能力的附加值 
  #-------------------------------------------------------------------------- 
  def  param_plus( param_id) 
    @equips .select { |e| e.name !=nil } .inject ( super )  do  |r, item|
      r += item.params [ param_id] 
    end 
  end 
 
 
 
end 
class  Window_Base
  #-------------------------------------------------------------------------- 
  # ● 绘制物品名称 
  #     enabled : 有效的标志。false 的时候使用半透明效果绘制 
  #-------------------------------------------------------------------------- 
  def  draw_item_name( item, x, y, enabled = true , width = 250 ) 
    return  unless  item
    draw_icon( item.icon_index , x, y, enabled) 
    change_color( normal_color, enabled) 
    draw_text( x + 24 , y, width, line_height, item.name ) 
  end 
end 
#encoding:utf-8 
#============================================================================== 
# ■ Equip Help by wyongcan - LBQ Equip Randomnization Special Version 
#------------------------------------------------------------------------------ 
#  修改了说明窗口,增强了装备的说明 作者:wyongcan  发布于66RPG   转载请注明 
#============================================================================== 
module  Help
  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  => "经验获得加成" } 
#~   #效果范围 
#~         SCOPE ={ 
#~                 0 => "特殊", 
#~                 1 => "单个敌人", 
#~                 2 => "全体敌人" , 
#~                 3 => "一个随机敌人", 
#~                 4 => "两个随机敌人", 
#~                 5 => "三个随机敌人", 
#~                 6 => "四个随机敌人", 
#~                 7 => "单个队友", 
#~                 8 => "全体队友", 
#~                 9 => "单个队友(无法战斗)", 
#~                 10 => "全体队友(无法战斗)", 
#~                 11 => "使用者"} 
        @队伍能力 ={ 
                0  => "遇敌几率减半" ,
                1  => "随机遇敌无效" ,
                2  => "敌人偷袭无效" ,
                3  => "先制攻击几率上升" ,
                4  => "获得金钱数量双倍" ,
                5  => "物品掉落几率双倍" } 
  def  self .ready 
    @状态 = { } 
    @武器类型 = { } 
    @防具类型 = { } 
    @属性 = { } 
    $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_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_Help < Window_Base
  #-------------------------------------------------------------------------- 
  # ● 初始化对象 
  #-------------------------------------------------------------------------- 
  def  initialize( line_number = 0 ) 
    super ( 0 , 0 , 210 , fitting_height( line_number) ) 
    self .z  = 150 
    contents.font .size  = 10 
    hide
  end 
  #-------------------------------------------------------------------------- 
  # ● 设置内容 
  #-------------------------------------------------------------------------- 
  def  set_text( text) 
    if  text != @text 
      @text  = text
      refresh
    end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 清除 
  #-------------------------------------------------------------------------- 
  def  clear
    set_text( "" ) 
  end 
  #-------------------------------------------------------------------------- 
  # ● 更新帮助位置 
  #-------------------------------------------------------------------------- 
  def  uppos( index,rect,window) 
    self .height  = fitting_height2( Help.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 ?( Unique_Equip)  || item.is_a ?( Unique_Item) 
    @xtext  += Help.getequiphelp ( item)  if  item.is_a ?( Unique_Equip) 
    @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
    Help.ready 
  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_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 
#encoding:utf-8 
#============================================================================== 
# ■ Equip Help by wyongcan - LBQ Equip Randomnization Special Version 
#------------------------------------------------------------------------------ 
#  修改了说明窗口,增强了装备的说明 作者:wyongcan  发布于66RPG   转载请注明 
#============================================================================== 
module  Help
  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  => "经验获得加成" } 
#~   #效果范围 
#~         SCOPE ={ 
#~                 0 => "特殊", 
#~                 1 => "单个敌人", 
#~                 2 => "全体敌人" , 
#~                 3 => "一个随机敌人", 
#~                 4 => "两个随机敌人", 
#~                 5 => "三个随机敌人", 
#~                 6 => "四个随机敌人", 
#~                 7 => "单个队友", 
#~                 8 => "全体队友", 
#~                 9 => "单个队友(无法战斗)", 
#~                 10 => "全体队友(无法战斗)", 
#~                 11 => "使用者"} 
        @队伍能力 ={ 
                0  => "遇敌几率减半" ,
                1  => "随机遇敌无效" ,
                2  => "敌人偷袭无效" ,
                3  => "先制攻击几率上升" ,
                4  => "获得金钱数量双倍" ,
                5  => "物品掉落几率双倍" } 
  def  self .ready 
    @状态 = { } 
    @武器类型 = { } 
    @防具类型 = { } 
    @属性 = { } 
    $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_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_Help < Window_Base
  #-------------------------------------------------------------------------- 
  # ● 初始化对象 
  #-------------------------------------------------------------------------- 
  def  initialize( line_number = 0 ) 
    super ( 0 , 0 , 210 , fitting_height( line_number) ) 
    self .z  = 150 
    contents.font .size  = 10 
    hide
  end 
  #-------------------------------------------------------------------------- 
  # ● 设置内容 
  #-------------------------------------------------------------------------- 
  def  set_text( text) 
    if  text != @text 
      @text  = text
      refresh
    end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 清除 
  #-------------------------------------------------------------------------- 
  def  clear
    set_text( "" ) 
  end 
  #-------------------------------------------------------------------------- 
  # ● 更新帮助位置 
  #-------------------------------------------------------------------------- 
  def  uppos( index,rect,window) 
    self .height  = fitting_height2( Help.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 ?( Unique_Equip)  || item.is_a ?( Unique_Item) 
    @xtext  += Help.getequiphelp ( item)  if  item.is_a ?( Unique_Equip) 
    @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
    Help.ready 
  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_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 
#encoding:utf-8 
#============================================================================== 
# ■ Equip Randomnization - Quality Color based on PS0 
#------------------------------------------------------------------------------ 
#  Author: 仲秋启明(PS0颜色绘制), LBQ 
#============================================================================== 
 
unless  $imported [ :lbq_equip_randomnization ] 
  msgbox "Require LBQ Equip Randomnization Script" 
  exit 
end 
 
 
class  RPG::EquipItem 
  def  good_quality?
    return  !self .note .include ?( "<BAD>" ) 
  end 
 
  def  great_quality?
    return  self .note .include ?( "<GREAT>" ) 
  end 
 
end 
 
 
module  Quality
  def  quality
    value = 1 
    self .prefix_objects .each  do  |p|
       if  p .good_quality ?
         value += 1 
       else 
         value -= 1 
       end 
       value += 1  if  p .great_quality ?
    end 
 
    return  value
  end 
end 
 
 
class  Unique_Equip
  include  Quality
end 
 
 
#============================================================================== 
# [PS0]物品颜色描绘 
#      Window_Base_Itemcolor 
#------------------------------------------------------------------------------ 
#     在物品、技能选项中显示物品品质并显示品质框和修改物品名颜色。 
#============================================================================== 
# [更新记录] 
#    - 2012.01.03 By 仲秋启明 
#      * 修改为VA定义 
#    - 2011.12.27 By 仲秋启明 
#      * 移植至RGSS3,遵循PS0协议; 
#      * 优化数据库备注中设定方法 
#    - 2011.08.22 By 冰舞蝶恋 
#      * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框) 
#    - 2010.08.06 By 仲秋启明 
#      * 蓝本(物品颜色描绘脚本(完整无冲突版)) 
#------------------------------------------------------------------------------ 
# [使用方法] 
#    - 替换原Window_Base中的draw_item_name定义或复制到Main之前 
#============================================================================== 
$_PS0  = { }  if  $_PS0  == nil   
$_PS0 [ "Window_Base_Itemcolor" ]  = 20111227 
#============================================================================== 
# [PS0] 通用配置模块   
#============================================================================== 
module  PS0
  module  Window_Base_Itemcolor
    Color0 = Color.new ( 137 , 137 , 137 ) 
    Color1 = Color.new ( 255 , 255 , 255 )   # 一般品质的色彩(白,1) 
    Color2 = Color.new ( 128 , 255 , 128 )   # 平庸品质的色彩(绿,2) 
    Color3 = Color.new ( 128 , 128 , 255 )   # 精良品质的色彩(蓝,3) 
    Color4 = Color.new ( 255 , 0 , 255 )     # 卓越品质的色彩(紫,4) 
    Color5 = Color.new ( 255 , 128 , 128 )   # 神秘品质的色彩(红,5) 
    Color6 = Color.new ( 255 , 128 , 0 )     # 传说品质的色彩(橙,6) 
    Color7 = Color.new ( 255 , 255 , 128 )   # 特殊品质的色彩(黄,7) 
  end 
end 
#============================================================================== 
# ■ Window_Base 
#============================================================================== 
class  Window_Base < Window
  def  draw_item_name( item, x, y, enabled = true , width = 172 ) 
    if  item != nil 
      n = item.note 
 
      c = 1 
      c = item.quality  if  item.respond_to ? :quality 
      if  c <= 0 
        color = PS0::Window_Base_Itemcolor::Color0 
      elsif  c == 1 
        color = PS0::Window_Base_Itemcolor::Color1 
      elsif  c == 2 
        color = PS0::Window_Base_Itemcolor::Color2 
      elsif  c == 3 
        color = PS0::Window_Base_Itemcolor::Color3 
      elsif  c == 4 
        color = PS0::Window_Base_Itemcolor::Color4 
      elsif  c == 5 
        color = PS0::Window_Base_Itemcolor::Color5 
      elsif  c == 6 
        color = PS0::Window_Base_Itemcolor::Color6 
      elsif  c == 7 
        color = PS0::Window_Base_Itemcolor::Color7 
      else 
        color = Color.new ( 0 , 0 , 0 , 0 ) 
      end 
      draw_icon( item.icon_index , x, y, enabled) 
      change_color( color, enabled) 
      draw_text( x + 24 , y, width, line_height, item.name ) 
    end 
  end 
end 
#============================================================================== 
# [PS0] End of Script 
#============================================================================== 
#encoding:utf-8 
#============================================================================== 
# ■ Equip Randomnization - Quality Color based on PS0 
#------------------------------------------------------------------------------ 
#  Author: 仲秋启明(PS0颜色绘制), LBQ 
#============================================================================== 
 
unless  $imported [ :lbq_equip_randomnization ] 
  msgbox "Require LBQ Equip Randomnization Script" 
  exit 
end 
 
 
class  RPG::EquipItem 
  def  good_quality?
    return  !self .note .include ?( "<BAD>" ) 
  end 
 
  def  great_quality?
    return  self .note .include ?( "<GREAT>" ) 
  end 
 
end 
 
 
module  Quality
  def  quality
    value = 1 
    self .prefix_objects .each  do  |p|
       if  p .good_quality ?
         value += 1 
       else 
         value -= 1 
       end 
       value += 1  if  p .great_quality ?
    end 
 
    return  value
  end 
end 
 
 
class  Unique_Equip
  include  Quality
end 
 
 
#============================================================================== 
# [PS0]物品颜色描绘 
#      Window_Base_Itemcolor 
#------------------------------------------------------------------------------ 
#     在物品、技能选项中显示物品品质并显示品质框和修改物品名颜色。 
#============================================================================== 
# [更新记录] 
#    - 2012.01.03 By 仲秋启明 
#      * 修改为VA定义 
#    - 2011.12.27 By 仲秋启明 
#      * 移植至RGSS3,遵循PS0协议; 
#      * 优化数据库备注中设定方法 
#    - 2011.08.22 By 冰舞蝶恋 
#      * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框) 
#    - 2010.08.06 By 仲秋启明 
#      * 蓝本(物品颜色描绘脚本(完整无冲突版)) 
#------------------------------------------------------------------------------ 
# [使用方法] 
#    - 替换原Window_Base中的draw_item_name定义或复制到Main之前 
#============================================================================== 
$_PS0  = { }  if  $_PS0  == nil   
$_PS0 [ "Window_Base_Itemcolor" ]  = 20111227 
#============================================================================== 
# [PS0] 通用配置模块   
#============================================================================== 
module  PS0
  module  Window_Base_Itemcolor
    Color0 = Color.new ( 137 , 137 , 137 ) 
    Color1 = Color.new ( 255 , 255 , 255 )   # 一般品质的色彩(白,1) 
    Color2 = Color.new ( 128 , 255 , 128 )   # 平庸品质的色彩(绿,2) 
    Color3 = Color.new ( 128 , 128 , 255 )   # 精良品质的色彩(蓝,3) 
    Color4 = Color.new ( 255 , 0 , 255 )     # 卓越品质的色彩(紫,4) 
    Color5 = Color.new ( 255 , 128 , 128 )   # 神秘品质的色彩(红,5) 
    Color6 = Color.new ( 255 , 128 , 0 )     # 传说品质的色彩(橙,6) 
    Color7 = Color.new ( 255 , 255 , 128 )   # 特殊品质的色彩(黄,7) 
  end 
end 
#============================================================================== 
# ■ Window_Base 
#============================================================================== 
class  Window_Base < Window
  def  draw_item_name( item, x, y, enabled = true , width = 172 ) 
    if  item != nil 
      n = item.note 
 
      c = 1 
      c = item.quality  if  item.respond_to ? :quality 
      if  c <= 0 
        color = PS0::Window_Base_Itemcolor::Color0 
      elsif  c == 1 
        color = PS0::Window_Base_Itemcolor::Color1 
      elsif  c == 2 
        color = PS0::Window_Base_Itemcolor::Color2 
      elsif  c == 3 
        color = PS0::Window_Base_Itemcolor::Color3 
      elsif  c == 4 
        color = PS0::Window_Base_Itemcolor::Color4 
      elsif  c == 5 
        color = PS0::Window_Base_Itemcolor::Color5 
      elsif  c == 6 
        color = PS0::Window_Base_Itemcolor::Color6 
      elsif  c == 7 
        color = PS0::Window_Base_Itemcolor::Color7 
      else 
        color = Color.new ( 0 , 0 , 0 , 0 ) 
      end 
      draw_icon( item.icon_index , x, y, enabled) 
      change_color( color, enabled) 
      draw_text( x + 24 , y, width, line_height, item.name ) 
    end 
  end 
end 
#============================================================================== 
# [PS0] End of Script 
#============================================================================== 
#encoding:utf-8 
#============================================================================== 
# ■ Gain Enchanted Item after Battle - beta plugin 
#------------------------------------------------------------------------------ 
#  Author: LBQ                                                  lbq.mist.so 
#============================================================================== 
unless  $imported [ :lbq_equip_randomnization ] 
  msgbox "Require LBQ Equip Randomnization Script" 
  exit 
end 
 
class  << BattleManager
  #-------------------------------------------------------------------------- 
  # ● 显示获得的物品 
  #-------------------------------------------------------------------------- 
  def  gain_drop_items
    $game_troop .make_drop_items .each  do  |item|
      puts  "The Class of the Item: #{item.class}" 
      if  item.is_a ? RPG::Weapon 
        $game_party .gain_enchanted_weapon ( item.id ) 
        new_item = $game_party .weapons .last 
      elsif  item.is_a ? RPG::Armor 
        $game_party .gain_enchanted_armor ( item.id ) 
        new_item = $game_party .armors .last 
      else 
        $game_party .gain_item ( item, 1 ) 
        new_item = $game_party .items .last 
      end 
      $game_message .add ( sprintf ( Vocab::ObtainItem , new_item.name ) ) 
    end 
    wait_for_message
  end 
end 
#encoding:utf-8 
#============================================================================== 
# ■ Gain Enchanted Item after Battle - beta plugin 
#------------------------------------------------------------------------------ 
#  Author: LBQ                                                  lbq.mist.so 
#============================================================================== 
unless  $imported [ :lbq_equip_randomnization ] 
  msgbox "Require LBQ Equip Randomnization Script" 
  exit 
end 
 
class  << BattleManager
  #-------------------------------------------------------------------------- 
  # ● 显示获得的物品 
  #-------------------------------------------------------------------------- 
  def  gain_drop_items
    $game_troop .make_drop_items .each  do  |item|
      puts  "The Class of the Item: #{item.class}" 
      if  item.is_a ? RPG::Weapon 
        $game_party .gain_enchanted_weapon ( item.id ) 
        new_item = $game_party .weapons .last 
      elsif  item.is_a ? RPG::Armor 
        $game_party .gain_enchanted_armor ( item.id ) 
        new_item = $game_party .armors .last 
      else 
        $game_party .gain_item ( item, 1 ) 
        new_item = $game_party .items .last 
      end 
      $game_message .add ( sprintf ( Vocab::ObtainItem , new_item.name ) ) 
    end 
    wait_for_message
  end 
end 
#encoding:utf-8 
#============================================================================== 
# ■ Prefix Generator - Beta : Generate the prefix according to f(x)=log2(x) 
#------------------------------------------------------------------------------ 
#  Author: LBQ                                                  lbq.mist.so 
#============================================================================== 
unless  $imported [ :lbq_equip_randomnization ] 
  msgbox "Require LBQ Equip Randomnization Script" 
  exit 
end 
 
module  Prefix_Gen
  class  << self 
    def  generate_prefix( type) 
      num = function
      if  num>=3 
        num -=1 
        num = 3  if  num>3 
      end 
 
      dic = ADE.get_all_prefix ( type) 
      return_value = Array .new ( num,0 ) 
      return_value.map ! do  |v|
        dic.sample 
      end 
      return_value = return_value.uniq 
      return  return_value
    end 
 
 
    def  function
      return  ( -Math .log ( rand ,2 ) ) .round 
    end 
  end 
end 
#encoding:utf-8 
#============================================================================== 
# ■ Prefix Generator - Beta : Generate the prefix according to f(x)=log2(x) 
#------------------------------------------------------------------------------ 
#  Author: LBQ                                                  lbq.mist.so 
#============================================================================== 
unless  $imported [ :lbq_equip_randomnization ] 
  msgbox "Require LBQ Equip Randomnization Script" 
  exit 
end 
 
module  Prefix_Gen
  class  << self 
    def  generate_prefix( type) 
      num = function
      if  num>=3 
        num -=1 
        num = 3  if  num>3 
      end 
 
      dic = ADE.get_all_prefix ( type) 
      return_value = Array .new ( num,0 ) 
      return_value.map ! do  |v|
        dic.sample 
      end 
      return_value = return_value.uniq 
      return  return_value
    end 
 
 
    def  function
      return  ( -Math .log ( rand ,2 ) ) .round 
    end 
  end 
end 
-@reforge_window.item.reforge_price )-@add_window.get_price (@select_window.item))-@remove_window.get_price (@select_window.item))