设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 400|回复: 1

[已经过期] 【ACE】 如何修改此腳本的參數

[复制链接]

Lv1.梦旅人

梦石
0
星屑
95
在线时间
7 小时
注册时间
2022-6-9
帖子
2
发表于 2022-7-27 23:16:08 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 奉先 于 2022-7-29 22:02 编辑

此腳本在網上找回來

如何修改參數 令前綴(is_maho?) 已知 影響此項由 make_prefix function 的 prefix_lv 參數決定  

令前綴 裝備中的NOTE : 對應我想要的橙等級

RUBY 代码复制
  1. class Array
  2.   def data
  3.     @data.to_s
  4.   end
  5. end
  6. module Options
  7.   #
  8.   #
  9.   #
  10.   #RANK   0   1   2   3   4   5   6   7   8   9   #特性
  11.   f = [[  0,  3, 10, 15, 30, 40, 70, 90,150,190], #白/无
  12.        [ 10, 11, 15, 20, 33, 43, 72, 92,152,192], #绿
  13.        [ 30, 31, 33, 35, 40, 50, 77, 97,156,196], #蓝
  14.        [ 70, 71, 73, 74, 79, 81, 90,110,167,207], #紫
  15.        [150,151,153,154,158,161,169,174,190,230]] #橙
  16.   a = Table.new(10,5)
  17.   10.times{|x| 5.times{|y| a[x,y] = f[y][x] }}
  18. #<=以上内容请不要修改=======================================================>
  19.   S初始评价 = a        
  20.   S使用耐久 = false   
  21.   S每级强化评价 = 1   
  22.   S宝石评价_白 =  1   
  23.   S宝石评价_绿 =  2
  24.   S宝石评价_蓝 =  4
  25.   S宝石评价_紫 =  8
  26.   S宝石评价_橙 = 16
  27.   S品质_白 =   0      
  28.   S品质_绿 =  10
  29.   S品质_蓝 =  30
  30.   S品质_紫 =  70
  31.   S品质_橙 = 150
  32.   S品质掉率_绿 = 0   #315
  33.   S品质掉率_蓝 =  0   #63
  34.   S品质掉率_紫 =   0   #9
  35.   S品质掉率_橙 =  100000   #1
  36.   S嵌孔掉率_1 = 315   
  37.   S嵌孔掉率_2 = 100
  38.   S嵌孔掉率_3 =  63
  39.   S嵌孔掉率_4 =  18
  40.   S嵌孔掉率_5 =   4
  41. #<=以下内容请不要修改=======================================================>
  42.   def self.dataA
  43.     S初始评价
  44.   end
  45.   def self.dataB
  46.     S每级强化评价
  47.   end
  48.   def self.dataC
  49.     [S品质_白, S品质_绿, S品质_蓝, S品质_紫, S品质_橙]
  50.   end
  51.   def self.dataD
  52.     [S品质掉率_橙, S品质掉率_紫, S品质掉率_蓝, S品质掉率_绿]
  53.   end
  54.   def self.dataE
  55.     [S嵌孔掉率_5, S嵌孔掉率_4, S嵌孔掉率_3, S嵌孔掉率_2, S嵌孔掉率_1]
  56.   end
  57.   def self.dataF
  58.     [S宝石评价_白, S宝石评价_绿, S宝石评价_蓝, S宝石评价_紫, S宝石评价_橙]
  59.   end
  60.   def self.cf(a, b)
  61.     self.dataA[a, b]
  62.   end
  63.   def self.lf(e=0)
  64.     self.dataD.each_with_index do |r, i|
  65.       return 4-i if (r * ( r ** -0.05 + 0.4 ) ** e).to_i >= rand(1000)
  66.     end
  67.     return 0
  68.   end
  69.   def self.qf(e=0)
  70.     self.dataE.each_with_index do |r, i|
  71.       return 5-i if (r * ( r ** -0.05 + 0.4 ) ** e).to_i >= rand(1000)
  72.     end
  73.     return 0
  74.   end
  75. end
  76. module RPG
  77.   class BaseItem
  78.     def is_maho?
  79.       note.include?("<前缀>")
  80.     end
  81.     def is_item?
  82.       self.is_a?(RPG::Item) && is_gem?
  83.     end
  84.     def is_gem?
  85.       note.include?("<宝石>")
  86.     end
  87.     def rank
  88.       lv = note[/<品质\s*(.*)>/, 1].to_s
  89.       ["白","绿","蓝","紫","橙", ""].index(lv) % 5 #"白","绿","蓝","紫","橙", "" %5
  90.     end
  91.     def rank_lv
  92.       note[/<RANK\s*(\d*)>/, 1].to_i
  93.     end
  94.     def features
  95.       @features + features_note
  96.     end
  97.     def kind_id
  98.       self.class.to_s + self.id.to_s
  99.     end
  100.     def features_note
  101.       note.scan(/<特性 (.*) (.*)>/).inject([]) do |r, i|
  102.         case i[0]
  103.         when "吸收"
  104.           r.push RPG::BaseItem::Feature.new(22,10,(i[1].to_i)/100.0)
  105.         end
  106.       end
  107.     end
  108.   end
  109. end
  110. module Vocab
  111.   def self.xparam(id)
  112.     ["命中率","回避率","会心率","会心回避率","魔法回避率","魔法反射率","反击率","HP再生率","MP再生率","TP再生率","生命吸收"][id]
  113.   end
  114.   def self.sparam(id)
  115.     ["受到攻击的几率","防御效果率","恢复效果率","药物知识","MP消费率","TP消耗率","物理伤害率","魔法伤害率","针板伤害率","经验获得率"][id]
  116.   end
  117.   def self.zparam(id)
  118.     ["遇敌机率减半","随机遇敌无效","偷袭无效","先发攻击率提升","获得2倍现金","物品获得机率翻倍"][id]
  119.   end
  120.   def self.elements(id)
  121.     $data_system.elements[id]
  122.   end
  123.   def self.weapon_types(id)
  124.     $data_system.weapon_types[id]
  125.   end
  126.   def self.armor_types(id)
  127.     $data_system.armor_types[id]
  128.   end
  129. end
  130. module DataManager
  131.   def self.create_game_objects
  132.     $game_temp          = Game_Temp.new
  133.     $game_system        = Game_System.new
  134.     $game_timer         = Game_Timer.new
  135.     $game_message       = Game_Message.new
  136.     $game_switches      = Game_Switches.new
  137.     $game_variables     = Game_Variables.new
  138.     $game_self_switches = Game_SelfSwitches.new
  139.     $game_actors        = Game_Actors.new
  140.     $game_party         = Game_Party.new
  141.     $game_troop         = Game_Troop.new
  142.     $game_map           = Game_Map.new
  143.     $game_player        = Game_Player.new
  144.     $game_items         = Game_Items.new
  145.   end
  146.   def self.make_save_contents
  147.     contents = {}
  148.     contents[:system]        = $game_system
  149.     contents[:timer]         = $game_timer
  150.     contents[:message]       = $game_message
  151.     contents[:switches]      = $game_switches
  152.     contents[:variables]     = $game_variables
  153.     contents[:self_switches] = $game_self_switches
  154.     contents[:actors]        = $game_actors
  155.     contents[:party]         = $game_party
  156.     contents[:troop]         = $game_troop
  157.     contents[:map]           = $game_map
  158.     contents[:player]        = $game_player
  159.     contents[:items]         = $game_items
  160.     contents
  161.   end
  162.   def self.extract_save_contents(contents)
  163.     $game_system        = contents[:system]
  164.     $game_timer         = contents[:timer]
  165.     $game_message       = contents[:message]
  166.     $game_switches      = contents[:switches]
  167.     $game_variables     = contents[:variables]
  168.     $game_self_switches = contents[:self_switches]
  169.     $game_actors        = contents[:actors]
  170.     $game_party         = contents[:party]
  171.     $game_troop         = contents[:troop]
  172.     $game_map           = contents[:map]
  173.     $game_player        = contents[:player]
  174.     $game_items         = contents[:items]
  175.   end
  176. end
  177. module BattleManager
  178.   def self.gain_drop_items
  179.     $game_troop.make_drop_items.each do |item|
  180.       $game_party.add_item(item, 1, true)
  181.       $game_message.add(sprintf(Vocab::ObtainItem, item.name))
  182.     end
  183.     wait_for_message
  184.   end
  185. end
  186. class Game_Items < Array
  187.   def idForNewItem(item, rand=false)
  188.     if item.is_a?(RPG::Item) || item.is_gem?
  189.       item = Game_UsableItem.new(item)
  190.     else
  191.       item = Game_EquipItem.new(item, rand)
  192.     end
  193.     self.push item
  194.     return self.size - 1
  195.   end
  196.   def items
  197.     self.collect {|item| item.is_item? }
  198.   end
  199.   def gems
  200.     self.collect {|item| item.is_gem? }
  201.   end
  202.   def weapons
  203.     self.collect {|item| item.is_weapon? }
  204.   end
  205.   def armors
  206.     self.collect {|item| item.is_armor? }
  207.   end
  208. end
  209. class Game_BaoItem
  210.   def initialize(id = nil)
  211.     @id = id
  212.   end
  213.   def add_item(id)
  214.     @id = id
  215.   end
  216.   def unadd_item
  217.     @id = nil
  218.   end
  219.   def name
  220.     item ? item.name : "空插槽"
  221.   end
  222.   def rank
  223.     item ? item.rank : 0
  224.   end
  225.   def features
  226.     item.features if item
  227.   end
  228.   def item
  229.     $game_items[@id] if @id
  230.   end
  231. end
  232. class Game_Item
  233.   def initialize(item)
  234.     @item = item
  235.     @id = $game_items.size
  236.   end
  237.   def is_a?(kind); item.is_a?(kind);                    end
  238.   def is_item?;    item.is_a?(RPG::Item) || is_gem?;    end
  239.   def is_gem?;     item.is_gem?;                        end
  240.   def is_weapon?;  item.is_a?(RPG::Weapon) && !is_gem?; end
  241.   def is_armor?;   item.is_a?(RPG::Armor);              end
  242.   def is_equip?;   is_weapon? || is_armor?;             end
  243.   def item
  244.     @item
  245.   end
  246.   def id
  247.     @id
  248.   end
  249.   def id=(id)
  250.     @id = id
  251.   end
  252.   def rank
  253.     item.rank
  254.   end
  255.   def item_id
  256.     item.id
  257.   end
  258.   def kind_id
  259.     item.class.to_s + item.id.to_s
  260.   end
  261.   def note
  262.     item.note
  263.   end
  264.   def price
  265.     item.price
  266.   end
  267.   def icon_index
  268.     item.icon_index
  269.   end
  270.   def description
  271.     item.description
  272.   end
  273.   def features
  274.     item.features
  275.   end
  276. end
  277. class Game_UsableItem < Game_Item
  278.   def initialize(item)
  279.     super(item)
  280.     @number = 0
  281.   end
  282.   def number
  283.     @number
  284.   end
  285.   def number=(n)
  286.     @number = n
  287.   end
  288.   def performance
  289.     Options.dataC[item.rank]
  290.   end
  291.   def name;              item.name;                           end #物品名
  292.   def itype_id;          item.itype_id;                       end #贵重品值
  293.   def scope;             item.scope;                          end #使用范围
  294.   def occasion;          item.occasion;                       end #使用时刻
  295.   def effects;           item.effects;                        end #使用效果
  296.   def damage;            item.damage;                         end #使用伤害
  297.   def repeats;           item.repeats;                        end #连续回数
  298.   def success_rate;      item.success_rate;                   end #成功率
  299.   def tp_gain;           item.tp_gain;                        end #获得TP
  300.   def animation_id;      item.animation_id;                   end #动画编号
  301.   def speed;             item.speed;                          end #速度補正
  302.   def key_item?;         itype_id == 2;                       end #贵重品判定
  303.   def consumable;        item.consumable;                     end #消耗判定
  304.   def for_opponent?;     [1, 2, 3, 4, 5, 6].include?(scope);  end
  305.   def for_friend?;       [7, 8, 9, 10, 11].include?(scope);   end
  306.   def for_dead_friend?;  [9, 10].include?(scope);             end
  307.   def for_user?;         scope == 11;                         end
  308.   def for_one?;          [1, 3, 7, 9, 11].include?(scope);    end
  309.   def for_random?;       [3, 4, 5, 6].include?(scope);        end
  310.   def number_of_targets; for_random? ? scope - 2 : 0;         end
  311.   def for_all?;          [2, 8, 10].include?(scope);          end
  312.   def need_selection?;   [1, 7, 9].include?(scope);           end
  313.   def battle_ok?;        [0, 1].include?(occasion);           end
  314.   def menu_ok?;          [0, 2].include?(occasion);           end
  315.   def certain?;          @hit_type == 0;                      end #技能用?
  316.   def physical?;         @hit_type == 1;                      end #技能用?
  317.   def magical?;          @hit_type == 2;                      end #技能用?
  318. end
  319. class Game_EquipItem < Game_Item
  320.   def initialize(item, rand = true)
  321.     super(item)
  322.     @lv = rand ? make_lv : 0
  323.     @params = make_params(rand)
  324.     @prefix = 0
  325.     @prefix_lv = 0
  326.     @dongshu = []
  327.     make_prefix if rand
  328.     make_dongshu if rand
  329.     make_naijiu(rand)
  330.   end
  331.   def dongshu
  332.     @dongshu
  333.   end
  334.   def wtype_id; item.wtype_id; end #武器类型
  335.   def atype_id; item.atype_id; end #防具类型
  336.   def etype_id; item.etype_id; end #装备部位
  337.   def animation_id; item.animation_id; end
  338.   def lv;         @lv;     end
  339.   def naijiu;     @naijiu;     end
  340.   def naijiu_max; @naijiu_max; end
  341.   def lv_up
  342.     @lv += 1
  343.   end
  344.   def make_naijiu(rand)
  345.     @naijiu_max = 100
  346.     @naijiu = rand ? rand(51)+50 : @naijiu_max
  347.   end
  348.   def make_dongshu
  349.     n = Options.qf(0)
  350.     n.times{add_ds}
  351.   end
  352.   def add_ds
  353.     @dongshu.push Game_BaoItem.new
  354.   end
  355.   def make_lv
  356.     u = 0
  357.     max_lv = 5 + 0   #提高0 可提高强化等级
  358.     max_le = 200 + 0 #提高0 可提高强化概率
  359.     max_lv.times{
  360.       return u if rand(max_le) < 100
  361.       u += 1
  362.     }
  363.     u
  364.   end
  365.   def make_params(rand)
  366.     return item.params unless rand
  367.     item.params.collect do |param|
  368.       num = ([(param).abs, 1].max**-0.5*param).truncate
  369.       ts = param - num + rand(num*2+1)
  370.       ts == 0 ? param : ts
  371.     end
  372.   end
  373.   def make_prefix
  374.     @prefix_lv = Options.lf(0)
  375.     return if @prefix_lv == 0
  376.     items = pzqz(@prefix_lv)
  377.     @prefix = items[rand(items.size)].id
  378.   end
  379.   def features
  380.     base_features + ds_features
  381.   end
  382.   def base_features
  383.     item.features + prefix_item_features
  384.   end
  385.   def ds_features
  386.     result = []
  387.     @dongshu.each {|item|
  388.       if item.item
  389.         features = item.features
  390.         if is_armor?
  391.           data = $data_armors.compact.find {|i| i.name == item.name }
  392.           features = data.features if data
  393.         end
  394.         result += features
  395.       end
  396.     }
  397.     result
  398.   end
  399.   def prefix_item_features
  400.     @prefix > 0 ? prefix_item.features : []
  401.   end
  402.   def prefix_item
  403.     equip = $data_weapons[@prefix]
  404.     if is_armor?
  405.       data = $data_armors.compact.find {|i| i.name == equip.name }
  406.       equip = data if data
  407.     end
  408.     equip
  409.   end
  410.   def allqz
  411.     $data_weapons.select {|item| item ? item.is_maho? : false}
  412.   end
  413.   def pzqz(n)
  414.     n = 5 #TEST
  415.     allqz.select{|item| item.rank == n}
  416.   end
  417.   def ds
  418.     prefix_item.description if @prefix > 0
  419.   end
  420.   def name
  421.     tn = ""
  422.     tn = tn + prefix_item.name + "的" if @prefix > 0
  423.     tn += item.name
  424.     tn += (@lv == 0 ? "" :  sprintf("%+d", @lv))
  425.     tn
  426.   end
  427.   def price
  428.     all_lv_price = (@lv * @lv + @lv)*(50+base_performance*2)/2
  429.     super + all_lv_price + 2 ** @prefix_lv * 1000
  430.   end
  431.   def params
  432.     r = 0.0
  433.     @params.each_with_index do |e, i|
  434.       if e > 0
  435.         case i
  436.         when 0
  437.           r += 0.8
  438.         when 1
  439.           r += 0.9
  440.         else
  441.           r += 1
  442.         end
  443.       end
  444.     end
  445.     #g = @params.inject(0) {|r, i| i > 0 ? r + 1 : r }
  446.     r = (r == 0 ? 0 : r ** -0.6 / 2.0)
  447.     8.times.collect do |i|
  448.       pa = @params[i]
  449.       case i
  450.       when 0
  451.        (pa + @lv * pa * [pa.abs, 1].max ** -0.5 * r * (pa < 0 ? 0.2 : 2)).round
  452.       when 1
  453.        (pa + @lv * pa * [pa.abs, 1].max ** -0.5 * r * (pa < 0 ? 0.12 : 1.2)).round
  454.       else
  455.        (pa + @lv * pa * [pa.abs, 1].max ** -0.5 * r * (pa < 0 ? 0.1 : 1)).round
  456.       end
  457.     end
  458.     #@params.collect do |param|
  459.     #end
  460.   end
  461.   def rank
  462.     case performance
  463.     when   0...10  ; 0
  464.     when  10...30  ; 1
  465.     when  30...70  ; 2
  466.     when  70...150 ; 3
  467.     when 150...310 ; 4
  468.     when 310...999 ; 5
  469.     end
  470.   end
  471.   def dakongg
  472.     2 ** dongshu.size * (100+base_performance*10)
  473.   end
  474.   def lv_price
  475.     (@lv + 1) * (100+base_performance)
  476.   end
  477.   def base_performance
  478.     Options.cf(item.rank_lv, @prefix_lv)
  479.   end
  480.   def ds_performance
  481.     @dongshu.inject(0) {|r, i| r + Options.dataF[i.rank] }
  482.   end
  483.   def performance
  484.     @lv + base_performance + ds_performance
  485.   end
  486. end
  487. class Game_Party < Game_Unit
  488.   def initialize
  489.     super
  490.     @gold = 0
  491.     @steps = 0
  492.     @last_item = Game_BaseItem.new
  493.     @menu_actor_id = 0
  494.     @target_actor_id = 0
  495.     @actors = []
  496.     @items = []
  497.   end
  498.   def consume_item(item)
  499.     lose_item(item.id, 1) if item.is_a?(RPG::Item) && item.consumable
  500.   end
  501.   def item_number(item)
  502.     return unless item
  503.     n = 0
  504.     all_items.each do |i|
  505.       if i.kind_id == item.kind_id
  506.         n += i.is_item? ? i.number : 1
  507.       end
  508.     end
  509.     n
  510.   end
  511.   def setup_battle_test_items
  512.     $data_items.each do |item|
  513.       add_item(item, max_item_number(item)) if item && !item.name.empty?
  514.     end
  515.   end
  516.   def has_item?(item, include_equip = false)
  517.     return true if item_number(item) > 0
  518.    #return include_equip ? members_equip_include?(item) : false
  519.   end
  520.   def members_equip_include?(item)
  521. msgbox "判定队伍成员是否装备着指定物品"
  522.     members.any? {|actor| actor.equips.any?{|it|it.item_id == item.item_id }}
  523.   end
  524.   def add_item(item, amount, rand = true)
  525.     return unless item
  526.     return if amount == 0
  527.     return unadd_item(item, amount) if amount < 0
  528.     if item.class == RPG::Item
  529.       gain_item($game_items.idForNewItem(item), amount)
  530.     else
  531.       amount.times{ gain_item($game_items.idForNewItem(item, rand)) }
  532.     end
  533.     $game_map.need_refresh = true
  534.   end
  535.   def unadd_item(item, amount)
  536.     amount.abs.times do
  537.       all_items.each do |i|
  538.         if i.kind_id == item.kind_id
  539.           lose_item(i.id, 1)
  540.           break
  541.         end
  542.       end
  543.     end
  544.     $game_map.need_refresh = true
  545.   end
  546.   def add_shopitem(item, number)
  547.     if item.is_item?
  548.       $game_items.push item
  549.       gain_item($game_items.size-1, number)
  550.     else
  551.       id = item.item_id
  552.       item = item.is_weapon? ? $data_weapons[id] : $data_armors[id]
  553.       add_item(item, number, false)
  554.     end
  555.   end
  556.   def gain_item(id, n=1)
  557.     return unless id
  558.     if $game_items[id].is_item?
  559.       items.each do |item|
  560.         if $game_items[id].kind_id == item.kind_id
  561.           maxn = [item.number + n, 99].min - item.number
  562.           n -= maxn
  563.           item.number += maxn
  564.         end
  565.       end
  566.       if n > 0
  567.         $game_items[id].number = n
  568.         @items.push(id)
  569.       end
  570.     else
  571.       @items.push(id)
  572.     end
  573.     all_items_sort
  574.   end
  575.   def lose_item(id, n=1)
  576.     return unless id
  577.     if $game_items[id].is_item?
  578.       items.reverse_each do |item|
  579.         if $game_items[id].kind_id == item.kind_id
  580.           maxn = [item.number, n].min
  581.           item.number -= maxn
  582.           n -= maxn
  583.           @items.delete(item.id) if item.number == 0
  584.         end
  585.       end
  586.     else
  587.       @items.delete(id)
  588.     end
  589.   end
  590.   def all_items_sort
  591.     @items.sort!{|a, b|$game_items[a].item_id - $game_items[b].item_id}
  592.   end
  593.   def items
  594.     @items.collect {|id| $game_items[id] }.select {|item| item.is_item? }
  595.   end
  596.   def gems
  597.     @items.collect {|id| $game_items[id] }.select {|item| item.is_gem? }
  598.   end
  599.   def weapons
  600.     @items.collect {|id| $game_items[id] }.select {|item| item.is_weapon? }
  601.   end
  602.   def armors
  603.     @items.collect {|id| $game_items[id] }.select {|item| item.is_armor? }
  604.   end
  605. end
  606. class Game_Battler < Game_BattlerBase
  607.   def make_damage_value(user, item)
  608.     value = item.damage.eval(user, self, $game_variables)
  609.     value *= item_element_rate(user, item)
  610.     value *= pdr if item.physical?
  611.     value *= mdr if item.magical?
  612.     value *= rec if item.damage.recover?
  613.     value = apply_critical(value) if @result.critical
  614.     value = apply_variance(value, item.damage.variance)
  615.     value = apply_guard(value)
  616.     @result.make_damage(value.to_i, user, item)
  617.   end
  618. end
  619. class Game_Actor < Game_Battler
  620.   def init_equips(equips)
  621.     @equips = Array.new(equip_slots.size)
  622.     equips.each_with_index do |item_id, i|
  623.       next if item_id == 0
  624.       etype_id = equip_slots[i]
  625.       item = etype_id == 0 ? $data_weapons[item_id] : $data_armors[item_id]
  626.       @equips[i] = $game_items.idForNewItem(item, false)
  627.     end
  628.     refresh
  629.   end
  630.   def param_rate(param_id)
  631.     features_sum_pi(FEATURE_PARAM, param_id)
  632.   end
  633.   def sparam(sparam_id)
  634.     features_sum_pi(FEATURE_SPARAM, sparam_id)
  635.   end
  636.   def features_sum_pi(code, id)
  637.     r_features_pi(code, id) * r_features_sum(code, id)
  638.   end
  639.   def r_features_pi(code, id)
  640.     rsum_features_with_id(code, id).inject(1.0) {|r, ft| r += (ft.value-1) }
  641.   end
  642.   def r_features_sum(code, id)
  643.     rpi_features_with_id(code, id).inject(1.0) {|r, ft| r *= ft.value }
  644.   end
  645.   def rsum_features_with_id(code, id)
  646.     rsum_all_features.select {|ft| ft.code == code && ft.data_id == id }
  647.   end
  648.   def rpi_features_with_id(code, id)
  649.     rpi_all_features.select {|ft| ft.code == code && ft.data_id == id }
  650.   end
  651.   def rsum_all_features
  652.     rsum_feature_objects.inject([]) {|r, obj| r + obj.features }
  653.   end
  654.   def rpi_all_features
  655.     rpi_feature_objects.inject([]) {|r, obj| r + obj.features }
  656.   end
  657.   def rsum_feature_objects
  658.     [actor] + [self.class] + equips.compact
  659.   end
  660.   def rpi_feature_objects
  661.     states
  662.   end
  663.   def equip_slots
  664.     return [0,0,2,3,4,4] if dual_wield?
  665.     return [0,1,2,3,4,4]
  666.   end
  667.   def weapons
  668.     @equips.select {|i| i ? $game_items[i].is_weapon? : false }.collect {|i| $game_items[i] }
  669.   end
  670.   def armors
  671.     @equips.select {|i| i ? $game_items[i].is_armor? : false }.collect {|i| $game_items[i] }
  672.   end
  673.   def equips
  674.     @equips.collect {|i| i ? $game_items[i] : nil }
  675.   end
  676.   def equip_change_ok?(slot_id)
  677.     return true
  678.     return false if equip_type_fixed?(equip_slots[slot_id])
  679.     return false if equip_type_sealed?(equip_slots[slot_id])
  680.     return true
  681.   end
  682.   def release_unequippable_items(item_gain = true)
  683.     equips.each_with_index do |item, i|
  684.       next if item
  685.       if !equippable?(item) || item.etype_id != equip_slots[i]
  686.         trade_item_with_party(nil, @equips[i]) if item_gain
  687.       end
  688.     end
  689.   end
  690.   def clear_equipments
  691.     equip_slots.size.times do |i|
  692.       change_equip(i, nil) if equip_change_ok?(i)
  693.     end
  694.   end
  695.   def change_equip(slot_id, item)
  696.     return unless trade_item_with_party(item, equips[slot_id])
  697.     return if item && equip_slots[slot_id] != item.etype_id
  698.     @equips[slot_id] = item ? item.id : nil
  699.     refresh
  700.   end
  701.   def force_change_equip(slot_id, item)
  702.     @equips[slot_id] = item ? item.id : nil
  703.     release_unequippable_items(false)
  704.     refresh
  705.   end
  706.   def trade_item_with_party(new_item, old_item)
  707.     return false if new_item && !$game_party.has_item?(new_item)
  708.     $game_party.gain_item(old_item ? old_item.id : nil)
  709.     $game_party.lose_item(new_item ? new_item.id : nil)
  710.     return true
  711.   end
  712.   def change_equip_by_id(slot_id, item_id)
  713. msgbox "变更装备(用 ID 指定)"
  714.     if equip_slots[slot_id] == 0
  715.       change_equip(slot_id, item_id)
  716.     else
  717.       change_equip(slot_id, item_id)
  718.     end
  719.   end
  720. end
  721. class Game_Action
  722.   def clear
  723.     @item = nil
  724.     @target_index = -1
  725.     @value = 0
  726.   end
  727.   def set_skill(skill_id)
  728.     @item = $data_skills[skill_id]
  729.     self
  730.   end
  731.   def set_item(item)
  732.     @item = item
  733.     self
  734.   end
  735.   def item
  736.     @item
  737.   end
  738. end
  739. class Game_ActionResult
  740.   def make_damage(value, user, item)
  741.     @critical = false if value == 0
  742.     @hp_damage = value if item.damage.to_hp?
  743.     @mp_damage = value if item.damage.to_mp?
  744.     @mp_damage = [@battler.mp, @mp_damage].min
  745.     @hp_drain = make_drain_hp(user, item)
  746.     @mp_drain = @mp_damage if item.damage.drain?
  747.     @hp_drain = [@battler.hp, @hp_drain].min
  748.     @success = true if item.damage.to_hp? || @mp_damage != 0
  749.   end
  750.   def make_drain_hp(user, item)
  751.     hp_damage = (@hp_damage * @battler.element_rate(2)).to_i
  752.     return hp_damage if item.damage.drain?
  753.     return (hp_damage * [user.xparam(10), 1].min).to_i if user.xparam(10) > 0
  754.     return 0
  755.   end
  756.   alias celica_hp_damage_text hp_damage_text
  757.   def hp_damage_text
  758.     celica_hp_damage_text
  759.     if @hp_damage > 0
  760.       fmt = @battler.actor? ? Vocab::ActorDamage : Vocab::EnemyDamage
  761.       sprintf(fmt, @battler.name, @hp_damage)
  762.     elsif @hp_damage < 0
  763.       fmt = @battler.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery
  764.       sprintf(fmt, @battler.name, Vocab::hp, -hp_damage)
  765.     else
  766.       fmt = @battler.actor? ? Vocab::ActorNoDamage : Vocab::EnemyNoDamage
  767.       sprintf(fmt, @battler.name)
  768.     end
  769.   end
  770.   def hp_drain_text
  771.     fmt = @battler.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain
  772.     sprintf("吸收了%s点%s", @hp_drain, Vocab::hp)
  773.   end
  774. end
  775. class Game_Interpreter
  776.   def command_126
  777.     value = operate_value(@params[1], @params[2], @params[3])
  778.     $game_party.add_item($data_items[@params[0]], value)
  779.   end
  780.   def command_127
  781.     value = operate_value(@params[1], @params[2], @params[3])
  782.     $game_party.add_item($data_weapons[@params[0]], value, true)
  783.   end
  784.   def command_128
  785.     value = operate_value(@params[1], @params[2], @params[3])
  786.     $game_party.add_item($data_armors[@params[0]], value, true)
  787.   end
  788.   def 开启强化画面
  789.     SceneManager.call(Scene_MakeEquip)
  790.   end
  791. end
  792. class Window_Base < Window
  793.   def draw_item_name(item, x, y, enabled = true, width = 300)
  794.     return unless item
  795.     draw_icon(item.icon_index, x, y, enabled)
  796.     change_color(performance_color(item), enabled)
  797.     draw_text(x + 24, y, width, line_height, item.name)
  798.   end
  799.   def performance_color(item)
  800.     return text_color(0) if item.is_a?(RPG::Skill)
  801.     pf = item.performance
  802.     if pf < 10
  803.       performance_rank(0)
  804.     elsif pf < 30
  805.       performance_rank(1)
  806.     elsif pf < 70
  807.       performance_rank(2)
  808.     elsif pf < 150
  809.       performance_rank(3)
  810.     elsif pf < 310
  811.       performance_rank(4)
  812.     else
  813.       performance_rank(5)
  814.     end
  815.   end
  816.   def performance_rank(n)
  817.                #白 绿 蓝 紫 橙 粉
  818.     text_color([ 0,28, 9,30,20,27][n])
  819.   end
  820. end
  821. class Window_Selectable < Window_Base
  822.   def active=(active)
  823.     super
  824.     update_cursor
  825.     call_update_help
  826.     call_update_equiphelp
  827.   end
  828.   def index=(index)
  829.     @index = index
  830.     update_cursor
  831.     call_update_help
  832.     call_update_equiphelp
  833.   end
  834.   def call_update_equiphelp
  835.     update_equiphelp if active && @equiphelp_window
  836.   end
  837.   def update_equiphelp
  838.     @equiphelp_window.clear
  839.   end
  840.   def drx
  841.     x + index % col_max * (item_width + spacing) + item_width / 4
  842.   end
  843.   def dry
  844.     y + index / col_max * item_height + item_height - oy
  845.   end
  846.   def equiphelp_window=(equiphelp_window)
  847.     @equiphelp_window = equiphelp_window
  848.     call_update_equiphelp
  849.   end
  850. end
  851. class Window_EquipHelp < Window_Base
  852.   def initialize
  853.     super(0,0,200,600)
  854.     self.opacity = 0
  855.   end
  856.   def standard_padding
  857.     return 0
  858.   end
  859.   def item
  860.     @item
  861.   end
  862.   def set_item(window, item)
  863.     @item = item
  864.     @window = window
  865.     refresh
  866.   end
  867.   def clear
  868.     contents.clear
  869.   end
  870.   def refresh
  871.     clear
  872.     return unless item
  873.     @dy = 0
  874.     draw_start               #描画上外框
  875.     draw_name                #描画物品名
  876.     if item.is_equip?
  877.       draw_equip_kind        #描画装备类型
  878.       draw_equip_attack_type #描画武器攻击类型
  879.       draw_equip_params      #描画装备能力值
  880.       draw_equip_features    #描画装备特性
  881.       draw_equip_dongshu     #描画装备插槽
  882.       draw_description       #描画说明
  883.     elsif item.is_gem?
  884.       draw_gem_type          #描画宝石类型
  885.       draw_gem_features      #描画宝石特性
  886.     else
  887.       draw_item_type         #描画物品类型
  888.       draw_item_effects      #描画物品使用效果
  889.     end
  890.     draw_price               #描画售格
  891.     draw_end                 #描画下外框
  892.     move_coordinate          #移动坐标
  893.   end
  894.   def draw_start
  895.     pf_color = performance_color(item)
  896.     contents.fill_rect(2,0,200-4,600,pf_color)
  897.     contents.fill_rect(0,2,200,600-4,pf_color)
  898.     contents.fill_rect(2+2,2,200-4-4,600-4,Color.new(0,0,64,160))
  899.     contents.fill_rect(2,2+2,200-4,600-4-4,Color.new(0,0,64,160))
  900.   end
  901.   def draw_name
  902.     contents.font.size = 16
  903.     contents.font.name = "宋体"
  904.     contents.font.bold = true
  905.     contents.font.color = performance_color(item)
  906.     contents.draw_text(6,6+@dy*16,200+8,16,item.name,0)
  907.     contents.font.size = 15
  908.     contents.font.name = "黑体"
  909.     contents.font.bold = false
  910.     contents.font.color = text_color(0)
  911.     @dy += 1
  912.   end
  913.   def draw_description
  914.     if item.ds
  915.       if item.ds != ""
  916.         contents.font.color = text_color(21)
  917.         contents.draw_text(6, 6+@dy*16, 200, 16, item.ds)
  918.         contents.font.color = text_color(0)
  919.         @dy += 1
  920.       end
  921.     end
  922.   end
  923.   def draw_price
  924.     str = item.price == 0 ? "无法出售" : "售价:#{item.price / 2}"
  925.     contents.draw_text(6, 6+@dy*16, 200, 16, str)
  926.     @dy += 1
  927.   end
  928.   def draw_gem_type
  929.     contents.draw_text(6, 6+@dy*16, 200, 16, "宝石", 0)
  930.     @dy += 1
  931.   end
  932.   def draw_gem_features
  933.     item2 = $data_armors.compact.find {|t| t.name == item.name }
  934.     contents.font.color = text_color(25)
  935.     if item2
  936.       contents.draw_text(6, 6+@dy*16, 200, 16, "镶嵌武器")
  937.     else
  938.       contents.draw_text(6, 6+@dy*16, 200, 16, "镶嵌通用")
  939.     end
  940.     @dy += 1
  941.     item.features.each do |ft|
  942.       str = feature_text(ft)
  943.       next unless str
  944.       contents.font.color = text_color(24)
  945.       contents.draw_text(6, 6+@dy*16, 200, 16, str)
  946.       @dy += 1
  947.     end
  948.     if item2
  949.       contents.font.color = text_color(25)
  950.       contents.draw_text(6, 6+@dy*16, 200, 16, "镶嵌防具")
  951.       @dy += 1
  952.       item2.features.each do |ft|
  953.         str = feature_text(ft)
  954.         next unless str
  955.         contents.font.color = text_color(24)
  956.         contents.draw_text(6, 6+@dy*16, 200, 16, str)
  957.         @dy += 1
  958.       end
  959.     end
  960.     contents.font.color = text_color(0)
  961.   end
  962.   def draw_item_type
  963.     str = item.consumable ? "消耗品" : "非消耗品"
  964.     contents.draw_text(6, 6+@dy*16, 200, 16, str, 0)
  965.     @dy += 1
  966.   end
  967.   def draw_item_effects
  968.     contents.font.color = text_color(24)
  969.     item.effects.each do |ft|
  970.       str = "特性显示未定义"
  971.       case ft.code
  972.       when 11
  973.         str = "回复#{ft.value2.to_i}点#{Vocab::hp}" if ft.value2 != 0
  974.         str = "回复#{(ft.value1*100).to_i.to_s}%#{Vocab::hp}" if ft.value1 != 0
  975.       when 12
  976.         str = "回复#{ft.value2.to_i}点#{Vocab::mp}" if ft.value2 != 0
  977.         str = "回复#{(ft.value1*100).to_i.to_s}%#{Vocab::mp}" if ft.value1 != 0
  978.       when 13
  979.         str = "回复#{ft.value2.to_i}点#{Vocab::tp}" if ft.value2 != 0
  980.         str = "回复#{(ft.value1*100).to_i.to_s}%#{Vocab::tp}" if ft.value1 != 0
  981.       when 21
  982.         str = "附加 #{$data_states[ft.data_id].name}"
  983.       when 22
  984.         str = "解除 #{$data_states[ft.data_id].name}"
  985.       when 31
  986.       when 32
  987.       when 33
  988.       when 34
  989.       when 41
  990.       when 42
  991.         str = "#{Vocab::param(ft.data_id)}永久增加#{ft.value1.to_i}点"
  992.       when 43
  993.         str = "永久习得 #{$data_skills[ft.data_id].name}"
  994.       when 44
  995.         next
  996.       end
  997.       contents.draw_text(6, 6+@dy*16, 200, 16, str)
  998.       @dy += 1
  999.     end
  1000.     contents.font.color = text_color(0)
  1001.   end
  1002.   def draw_equip_kind
  1003.     if item.is_a?(RPG::Armor)
  1004.       strA = Vocab::etype(item.etype_id)
  1005.       strB = Vocab::armor_types(item.atype_id)
  1006.     else
  1007.       bo = (item.features.select{|ft| ft.code == 54 }).any?{|ft| ft.data_id == 1}
  1008.       strA = bo ? "双手" : "单手"
  1009.       strB = Vocab::weapon_types(item.wtype_id)
  1010.     end
  1011.     contents.draw_text(6, 6+@dy*16, 200, 16, strA, 0)
  1012.     contents.draw_text(6, 6+@dy*16, 200-12, 16, strB, 2)
  1013.     @dy += 1
  1014.   end
  1015.   def draw_equip_attack_type
  1016.     str = ""
  1017.     (item.features.select{|ft| ft.code == 31 }).each do |ft|
  1018.       ts = Vocab::elements(ft.data_id)
  1019.       str += (ts + " ") unless str.include?(ts)
  1020.     end
  1021.     if str != ""
  1022.       contents.font.color = text_color(24)
  1023.       contents.draw_text(6, 6+@dy*16, 200, 16, str)
  1024.       contents.font.color = text_color(0)
  1025.       @dy += 1
  1026.     end
  1027.   end
  1028.   def draw_equip_params
  1029.     item.params.each_with_index do |param, index|
  1030.       if param != 0
  1031.         str = sprintf("%+d #{Vocab::param(index)}",param)
  1032.         contents.draw_text(6, 6+@dy*16, 200, 16, str)
  1033.         @dy += 1
  1034.       end
  1035.     end
  1036.   end
  1037.   def draw_equip_features
  1038.     contents.font.color = text_color(24)
  1039.     item.base_features.each do |ft|
  1040.       next if ft.code == 31
  1041.       str = feature_text(ft)
  1042.       next unless str
  1043.       contents.draw_text(6, 6+@dy*16, 200, 16, str)
  1044.       @dy += 1
  1045.     end
  1046.     contents.font.color = text_color(0)
  1047.   end
  1048.   def draw_equip_dongshu
  1049.     item.dongshu.each do |i|
  1050.       rect1 = Rect.new(6+1, 6+@dy*16+1, 14, 14)
  1051.       rect2 = Rect.new(120, 96, 8, 8)
  1052.       contents.stretch_blt(rect1, windowskin, rect2, 128)
  1053.       if i.item
  1054.         color = performance_color(i.item)
  1055.         contents.font.color = color
  1056.         bitmap = Cache.system("Iconset")
  1057.         rect2 = Rect.new(i.item.icon_index % 16 * 24, i.item.icon_index / 16 * 24, 24, 24)
  1058.         contents.stretch_blt(rect1, bitmap, rect2)
  1059.       else
  1060.         contents.font.color = text_color(0)
  1061.         contents.font.color.alpha = 160
  1062.       end
  1063.       contents.draw_text(6+16, 6+@dy*16, 200, 16, i.name)
  1064.       @dy += 1
  1065.       if i.item
  1066.         if item.is_armor?
  1067.           data = $data_armors.compact.find {|t| t.name == i.name }
  1068.           i = data if data
  1069.         end
  1070.         contents.font.color = text_color(24)
  1071.         i.features.each do |ft|
  1072.           next if ft.code == 31
  1073.           str = feature_text(ft)
  1074.          #next unless str
  1075.           contents.draw_text(6+16, 6+@dy*16, 200, 16, str)
  1076.           @dy += 1
  1077.         end
  1078.       end
  1079.     end
  1080.     contents.font.color = text_color(0)
  1081.   end
  1082.   def draw_end
  1083.     pf_color = performance_color(item)
  1084.     contents.clear_rect(0,10+@dy*16,200,600)
  1085.     contents.fill_rect(0,8+@dy*16,200,2,pf_color)
  1086.     contents.fill_rect(4,8+@dy*16,200-8,2,Color.new(0,0,64,160))
  1087.     contents.fill_rect(2,10+@dy*16,200-4,2,pf_color)
  1088.   end
  1089.   def move_coordinate
  1090.     self.x = @window.drx
  1091.     self.y = @window.dry
  1092.     endy = self.y + 12+@dy*16 - @window.y
  1093.     self.y -= [endy - @window.height + 6, 0].max
  1094.     self.y = [self.y, 0].max
  1095.   end
  1096.   def feature_text(ft)
  1097.     str = "特性显示未定义"
  1098.     case ft.code
  1099.     when 11
  1100.       str = (ft.value*100).to_i.to_s + "%" + Vocab::elements(ft.data_id) + "有效度"
  1101.     when 12
  1102.       str = (ft.value*100).to_i.to_s + "%" + Vocab::param(ft.data_id) + "弱化有效度"
  1103.     when 13
  1104.       str = (ft.value*100).to_i.to_s + "%" + $data_states[ft.data_id].name + "有效度"
  1105.     when 14
  1106.       str = $data_states[ft.data_id].name + "状态无效化"
  1107.     when 21
  1108.      #str = (ft.value*100).to_i.to_s + "% " + Vocab::param(ft.data_id)
  1109.       str = sprintf("%+d%%#{Vocab::param(ft.data_id)}", (ft.value*100-100).to_i)
  1110.     when 22
  1111.       return if ft.value == 0
  1112.       str = sprintf("%+d%%#{Vocab::xparam(ft.data_id)}", (ft.value*100).to_i)
  1113.     when 23
  1114.      #str = (ft.value*100).to_i.to_s + "% " + Vocab::sparam(ft.data_id)
  1115.       str = sprintf("%+d%%#{Vocab::xparam(ft.data_id)}", (ft.value*100-100).to_i)
  1116.     when 31
  1117.       str = "攻击属性附加 " + Vocab::elements(ft.data_id)
  1118.     when 32
  1119.       str = "+" + (ft.value*100).to_i.to_s + "%附加" + $data_states[ft.data_id].name + "状态"
  1120.     when 33
  1121.       str = sprintf("%+d 攻击速度", ft.value.to_i)
  1122.     when 34
  1123.       str = sprintf("%+d 攻击回数", ft.value.to_i)
  1124.     when 41
  1125.     when 42
  1126.     when 43
  1127.       str = "习得#{$data_skills[ft.data_id].name}"
  1128.     when 44
  1129.       str = "禁用#{$data_skills[ft.data_id].name}"
  1130.     when 51
  1131.     when 52
  1132.     when 53
  1133.     when 54
  1134.     when 55
  1135.     when 61
  1136.       str = sprintf("%+d 行动回数", ft.value.to_i)
  1137.     when 62
  1138.     when 63
  1139.     when 64
  1140.       str = Vocab.zparam(ft.data_id)
  1141.     end
  1142.   end
  1143. end
  1144. class Window_ItemList < Window_Selectable
  1145.   def include?(item)
  1146.     return unless item
  1147.     case @category
  1148.     when :item
  1149.       item.is_gem? || (item.is_item? && !item.key_item?)
  1150.     when :weapon
  1151.       item.is_weapon?
  1152.     when :armor
  1153.       item.is_armor?
  1154.     when :key_item
  1155.       !item.is_gem? && item.is_item? && item.key_item?
  1156.     else
  1157.       false
  1158.     end
  1159.   end
  1160.   def draw_item(index)
  1161.     item = @data[index]
  1162.     if item
  1163.       rect = item_rect(index)
  1164.       rect.width -= 4
  1165.       draw_item_name(item, rect.x, rect.y)#, enable?(item))
  1166.       draw_item_number(rect, item)
  1167.     end
  1168.   end
  1169.   def draw_item_number(rect, item)
  1170.    #draw_text(rect, sprintf(":%2d", item.number), 2) if item.is_allitem?
  1171.     draw_text(rect, sprintf(":%2d", item.number), 2) if item.is_item?
  1172.   end
  1173.   def update_equiphelp
  1174.     @equiphelp_window.set_item(self, item)
  1175.   end
  1176. end
  1177. class Window_EquipStatus < Window_Base
  1178.   def visible_line_number
  1179.     return 8
  1180.   end
  1181. end
  1182. class Window_EquipSlot < Window_Selectable
  1183.   def visible_line_number
  1184.     6
  1185.   end
  1186.   def drx
  1187.     super + 92
  1188.   end
  1189.   def update_equiphelp
  1190.     @equiphelp_window.set_item(self, item)
  1191.   end
  1192. end
  1193. class Window_EquipItem < Window_ItemList
  1194.   def include?(item)
  1195.     return true if item == nil
  1196.     return false unless item.is_equip?
  1197.     return false if @slot_id < 0
  1198.     return false if item.etype_id != @actor.equip_slots[@slot_id]
  1199.     return @actor.equippable?(item)
  1200.   end
  1201. end
  1202. class Window_ShopBuy < Window_Selectable
  1203.   def window_width
  1204.     return 400
  1205.   end
  1206.   def make_item_list
  1207.     @data = []
  1208.     @price = {}
  1209.     @shop_goods.each do |goods|
  1210.       case goods[0]
  1211.       when 0;  item = $data_items[goods[1]]
  1212.       when 1;  item = $data_weapons[goods[1]]
  1213.       when 2;  item = $data_armors[goods[1]]
  1214.       end
  1215.       if item
  1216.         if item.is_a?(RPG::Item) || item.is_gem?
  1217.           item = Game_UsableItem.new(item)
  1218.         else
  1219.           item = Game_EquipItem.new(item, false)
  1220.         end
  1221.         @data.push(item)
  1222.         @price[item] = goods[2] == 0 ? item.price : goods[3]
  1223.       end
  1224.     end
  1225.   end
  1226.   def enable?(item)
  1227.     item && price(item) <= @money
  1228.   end
  1229.   def update_equiphelp
  1230.     @equiphelp_window.set_item(self, item)
  1231.   end
  1232. end
  1233. class Window_ShopNumber < Window_Selectable
  1234.   def window_width
  1235.     return 400
  1236.   end
  1237.   def dry
  1238.     y + item_y + line_height
  1239.   end
  1240.   def update_equiphelp
  1241.     @equiphelp_window.set_item(self, @item)
  1242.   end
  1243.   def figures
  1244.     return 3
  1245.   end
  1246. end
  1247. class Window_ShopStatus < Window_Base
  1248.   def refresh
  1249.     contents.clear
  1250.     draw_possession(4, 0)
  1251.     return unless @item
  1252.     draw_equip_info(4, line_height * 2) if @item.is_equip?
  1253.   end
  1254. end
  1255. class Window_BattleLog < Window_Selectable
  1256.   def display_hp_damage(target, item)
  1257.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  1258.     if target.result.hp_damage > 0
  1259.       target.perform_damage_effect
  1260.     end
  1261.     Sound.play_recovery if target.result.hp_damage < 0
  1262.     add_text(target.result.hp_damage_text)
  1263.     wait
  1264.     if target.result.hp_drain > 0
  1265.       add_text(target.result.hp_drain_text)
  1266.       wait
  1267.     end
  1268.   end
  1269. end
  1270. class Window_MakeCommand < Window_HorzCommand
  1271.   def initialize(window_width)
  1272.     @window_width = window_width
  1273.     super(0, 0)
  1274.   end
  1275.   def window_width
  1276.     @window_width
  1277.   end
  1278.   def col_max
  1279.     return 4
  1280.   end
  1281.   def make_command_list
  1282.     add_command("强化装备", :a)
  1283.     add_command("镶嵌装备", :b)
  1284.     add_command("合成装备", :c, false)
  1285.     add_command("离开",     :cancel)
  1286.   end
  1287.   def current_item_enabled?
  1288.     index == 2 ? false : true
  1289.   end
  1290. end
  1291. class Window_MakeA_ItemLise < Window_ItemList
  1292.   def initialize(x, y, width, height)
  1293.     super(x, y, width, height)
  1294.   end
  1295.   def col_max
  1296.     return 1
  1297.   end
  1298.   def current_item_enabled?
  1299.     return false unless item
  1300.     item.lv_price <= $game_party.gold
  1301.   end
  1302.   def make_item_list
  1303.     @data = $game_party.equip_items
  1304.   end
  1305.   def status_window=(status_window)
  1306.     @status_window = status_window
  1307.     call_update_help
  1308.   end
  1309.   def update_help
  1310.     super
  1311.     @help_window.set_item(item) if @help_window
  1312.     @status_window.item = item if @status_window
  1313.   end
  1314.   def update_equiphelp
  1315.     @equiphelp_window.set_item(self, item)
  1316.   end
  1317. end
  1318. class Window_MakeA_Ok < Window_Command
  1319.   def initialize
  1320.     super(Graphics.width/2-60, Graphics.height/2)
  1321.     self.hide.deactivate
  1322.   end
  1323.   def window_width
  1324.     120
  1325.   end
  1326.   def col_max
  1327.     return 1
  1328.   end
  1329.   def alignment
  1330.     return 1
  1331.   end
  1332.   def make_command_list
  1333.     add_command("强化", :ok)
  1334.     add_command("取消", :cancel)
  1335.   end
  1336. end
  1337. class Window_MakeA_Status < Window_Base
  1338.   def initialize(x, y, width, height)
  1339.     super(x, y, width, height)
  1340.     @item = nil
  1341.     @page_index = 0
  1342.     refresh
  1343.   end
  1344.   def refresh
  1345.     contents.clear
  1346.     return unless @item
  1347.     draw_A(4, 0)
  1348.     draw_B(4, 0)
  1349.     draw_C(4, 0)
  1350.   end
  1351.   def item=(item)
  1352.     @item = item
  1353.     refresh
  1354.   end
  1355.   def draw_A(x, y)
  1356.     change_color(system_color)
  1357.     draw_text(x, line_height*(y+0), 300, 24, "强化费用")
  1358.     change_color(normal_color)
  1359.     draw_text(x, line_height*(y+1), 300, 24, @item.lv_price, 2)
  1360.   end
  1361.   def draw_B(x, y)
  1362.     change_color(system_color)
  1363.     draw_text(x, line_height*(y+2), 300, 24, "强化材料")
  1364.   end
  1365.   def draw_C(x, y)
  1366.     change_color(system_color)
  1367.     draw_text(x, line_height*(y+6), 300, 24, "属性变化")
  1368.   end
  1369. end
  1370. class Window_MakeB_ItemLise < Window_ItemList
  1371.   def initialize(x, y, width, height)
  1372.     super(x, y, width, height)
  1373.   end
  1374.   def col_max
  1375.     return 1
  1376.   end
  1377.   def current_item_enabled?
  1378.     true
  1379.   end
  1380.   def make_item_list(syt)
  1381.     if syt == "A"
  1382.       @data = $game_party.equip_items
  1383.     else
  1384.       @data = $game_party.gems
  1385.     end
  1386.     @data.push(nil)
  1387.   end
  1388.   def status_window=(status_window)
  1389.     @status_window = status_window
  1390.     call_update_help
  1391.   end
  1392.   def update_help
  1393.     super
  1394.     @help_window.set_item(item) if @help_window
  1395.     @status_window.item = item if @status_window
  1396.   end
  1397.   def refresh(syt)
  1398.     make_item_list(syt)
  1399.     create_contents
  1400.     draw_all_items
  1401.     select(0)
  1402.   end
  1403.   def clear
  1404.     @data = []
  1405.     select(-1)
  1406.     create_contents
  1407.     draw_all_items
  1408.   end
  1409.   def update_equiphelp
  1410.     @equiphelp_window.set_item(self, item)
  1411.   end
  1412. end
  1413. class Window_MakeB_Ok < Window_Selectable
  1414.   def initialize(x, y, width, height)
  1415.     super(x, y, width, height)
  1416.     self.hide.deactivate
  1417.     @item = nil
  1418.   end
  1419.   def window_width
  1420.   end
  1421.   def item_max
  1422.     item ? 1 + [item.dongshu.size+1, 5].min : 1
  1423.   end
  1424.   def refresh
  1425.     contents.clear
  1426.     change_color(system_color)
  1427.     y = 0
  1428.     draw_text(4, y, 92, line_height, "装备")
  1429.     if item
  1430.       draw_item_name(item, 64, 0)
  1431.       item.dongshu.each{|d|
  1432.         y += 1
  1433.         change_color(system_color)
  1434.         draw_text(4, y*line_height, 92, line_height, "插槽")
  1435.         change_color(normal_color)
  1436.         draw_item_name(d.item, 64, y*line_height)
  1437.        #dest_rect = Rect.new(64, (1+i)*line_height+4, 240, 16)
  1438.        #src_bitmap = self.windowskin
  1439.        #src_rect = Rect.new(120,96+8,8,8)
  1440.        #contents.stretch_blt(dest_rect, src_bitmap, src_rect, 128)
  1441.        #change_color(normal_color)
  1442.        #draw_text(64, (1+i)*line_height, 240, line_height, "不可更改",1)
  1443.        #draw_text(64, (1+i)*line_height, 92, line_height, d.name)
  1444.       }
  1445.       if item.dongshu.size < 5
  1446.         y += 1
  1447.         change_color(system_color)
  1448.         draw_text(4, y*line_height, 92, line_height, "打孔")
  1449.         change_color(normal_color)
  1450.         draw_text(64+24, y*line_height, 240, line_height, "花费: #{item.dakongg}")
  1451.       end
  1452.       y += 2
  1453.       gold = 50 + item.base_performance * 5
  1454.       change_color(normal_color)
  1455.       draw_text(0, y*line_height, 240, line_height, "镶嵌宝石花费: #{gold}")
  1456.       y += 1
  1457.       draw_text(0, y*line_height, 240, line_height, "取出宝石花费: #{gold*2}")
  1458.     else
  1459.       change_color(normal_color, false)
  1460.       draw_text(64, 0,142, line_height, "请选择一件装备")
  1461.     end
  1462.   end
  1463.   def item
  1464.     @item
  1465.   end
  1466.   def item=(item)
  1467.     @item = item
  1468.     refresh
  1469.   end
  1470.   def kind
  1471.     index == 0 ? 0 : index == item_max-1 && item.dongshu.size != 5 ? 2 : 1
  1472.   end
  1473.   def eq_gem(ritem)
  1474.     if eitem && ritem
  1475.       return if eitem.kind_id == ritem.kind_id
  1476.     end
  1477.     gold = 50 + item.base_performance * 5
  1478.     if ritem
  1479.       if eitem
  1480.         $game_party.gain_item(eitem.id)                       
  1481.         $game_party.lose_gold(gold * 2)                       
  1482.       end
  1483.       item.dongshu[index-1].add_item(ritem.id)               
  1484.       $game_party.lose_gold(50 + item.base_performance * 5)   
  1485.       $game_party.lose_item(ritem.id)                        
  1486.     else
  1487.       if eitem
  1488.         $game_party.lose_gold(gold * 2)                       
  1489.         $game_party.gain_item(eitem.id)                       
  1490.         item.dongshu[index-1].unadd_item                     
  1491.       end
  1492.     end
  1493.     refresh
  1494.   end
  1495.   def add_ds
  1496.     $game_party.lose_gold(item.dakongg)
  1497.     item.add_ds
  1498.     refresh
  1499.   end
  1500.   def current_item_enabled?
  1501.     case kind
  1502.     when 0
  1503.       true
  1504.     when 1
  1505.       50 + item.base_performance * 5 <= $game_party.gold
  1506.     when 2
  1507.       item.dakongg <= $game_party.gold
  1508.     end
  1509.   end
  1510.   def eitem
  1511.     case kind
  1512.     when 0
  1513.       item
  1514.     when 1
  1515.       item.dongshu[index-1].item if item
  1516.     end
  1517.   end
  1518.   def update_equiphelp
  1519.     @equiphelp_window.set_item(self, eitem)
  1520.   end
  1521. end
  1522. class Window_MakeB_Status < Window_Base
  1523.   def initialize(x, y, width, height)
  1524.     super(x, y, width, height)
  1525.     @item = nil
  1526.     @page_index = 0
  1527.     refresh
  1528.   end
  1529.   def refresh
  1530.     contents.clear
  1531.     return unless @item
  1532.    #draw_A(4, 0)
  1533.   end
  1534.   def item=(item)
  1535.     @item = item
  1536.   #refresh
  1537.   end
  1538.   def draw_A(x, y)
  1539.     @item.dongshu.each_with_index{|item,index|
  1540.       contents.fill_rect(x+1,line_height * (y+5+index)+1,22,22, Color.new(128,128,128))
  1541.     }
  1542.   end
  1543. end
  1544. =begin
  1545.  合成解释
  1546.    1.种类保留
  1547.      ├不同部位的合成 => 合成失败,获得材料
  1548.      └同部位的合成 => 保留高等级的一件,特性按以下方式计算
  1549.        └有配方的情况按配方,特性按以下方式计算
  1550.    2.特性保留  
  1551.      ├强化等级 => 高强化等级 + 低强化等级的高强化等级的一半每1
  1552.      │     max = [a.lv, b.lv].max
  1553.      │     min = [a.lv, b.lv].min
  1554.      │      lv = max + (min/(max/2)).ceil
  1555.      │
  1556.      ├前缀   => 相加, 超2个的情况随机保留最大等级2个
  1557.      └嵌孔数 => 保留嵌孔少的一个
  1558.        └宝石 => 随机保留最大等级
  1559. =end
  1560. class Scene_MenuBase < Scene_Base
  1561.   def create_help_window
  1562.     @help_window = Window_Help.new
  1563.     @help_window.viewport = @viewport
  1564.   end
  1565.   def create_equiphelp_window
  1566.     @equiphelp_window = Window_EquipHelp.new
  1567.     @equiphelp_window.viewport = @viewport
  1568.     @equiphelp_window.z += 1000
  1569.   end
  1570. end
  1571. class Scene_Item < Scene_ItemBase
  1572.   def start
  1573.     super
  1574.     create_help_window
  1575.     create_equiphelp_window
  1576.     create_category_window
  1577.     create_item_window
  1578.   end
  1579.   def create_category_window
  1580.     @category_window = Window_ItemCategory.new
  1581.     @category_window.viewport = @viewport
  1582.     @category_window.help_window = @help_window
  1583.     @category_window.equiphelp_window = @equiphelp_window
  1584.     @category_window.y = @help_window.height
  1585.     @category_window.set_handler(:ok,     method(:on_category_ok))
  1586.     @category_window.set_handler(:cancel, method(:return_scene))
  1587.   end
  1588.   def create_item_window
  1589.     wy = @category_window.y + @category_window.height
  1590.     wh = Graphics.height - wy
  1591.     @item_window = Window_ItemList.new(0, wy, Graphics.width, wh)
  1592.     @item_window.viewport = @viewport
  1593.     @item_window.help_window = @help_window
  1594.     @item_window.equiphelp_window = @equiphelp_window
  1595.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1596.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1597.     @category_window.item_window = @item_window
  1598.   end
  1599. end
  1600. class Scene_Equip < Scene_MenuBase
  1601.   def start
  1602.     super
  1603.     create_help_window
  1604.     create_equiphelp_window
  1605.     create_status_window
  1606.     create_command_window
  1607.     create_slot_window
  1608.     create_item_window
  1609.   end
  1610.   def create_command_window
  1611.     wx = @status_window.width
  1612.     wy = @help_window.height
  1613.     ww = Graphics.width - @status_window.width
  1614.     @command_window = Window_EquipCommand.new(wx, wy, ww)
  1615.     @command_window.viewport = @viewport
  1616.     @command_window.help_window = @help_window
  1617.     @command_window.equiphelp_window = @equiphelp_window
  1618.     @command_window.set_handler(:equip,    method(:command_equip))
  1619.     @command_window.set_handler(:optimize, method(:command_optimize))
  1620.     @command_window.set_handler(:clear,    method(:command_clear))
  1621.     @command_window.set_handler(:cancel,   method(:return_scene))
  1622.     @command_window.set_handler(:pagedown, method(:next_actor))
  1623.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1624.   end
  1625.   def create_item_window
  1626.     wx = 0
  1627.     wy = @slot_window.y + @slot_window.height
  1628.     ww = Graphics.width
  1629.     wh = Graphics.height - wy
  1630.     @item_window = Window_EquipItem.new(wx, wy, ww, wh)
  1631.     @item_window.viewport = @viewport
  1632.     @item_window.help_window = @help_window
  1633.     @item_window.equiphelp_window = @equiphelp_window
  1634.     @item_window.status_window = @status_window
  1635.     @item_window.actor = @actor
  1636.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1637.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1638.     @slot_window.item_window = @item_window
  1639.   end
  1640.   def create_slot_window
  1641.     wx = @status_window.width
  1642.     wy = @command_window.y + @command_window.height
  1643.     ww = Graphics.width - @status_window.width
  1644.     @slot_window = Window_EquipSlot.new(wx, wy, ww)
  1645.     @slot_window.viewport = @viewport
  1646.     @slot_window.help_window = @help_window
  1647.     @slot_window.equiphelp_window = @equiphelp_window
  1648.     @slot_window.status_window = @status_window
  1649.     @slot_window.actor = @actor
  1650.     @slot_window.set_handler(:ok,       method(:on_slot_ok))
  1651.     @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  1652.   end
  1653. end
  1654. class Scene_MakeEquip < Scene_MenuBase
  1655.   def start
  1656.     super
  1657.     create_help_window
  1658.     create_equiphelp_window
  1659.     create_gold_window
  1660.     create_command_window
  1661.     create_dummy_window
  1662.     create_A_window
  1663.     create_B_window
  1664.   end
  1665.   def create_gold_window
  1666.     @gold_window = Window_Gold.new
  1667.     @gold_window.viewport = @viewport
  1668.     @gold_window.x = Graphics.width - @gold_window.width
  1669.     @gold_window.y = @help_window.height
  1670.   end
  1671.   def create_command_window
  1672.     @command_window = Window_MakeCommand.new(@gold_window.x)
  1673.     @command_window.viewport = @viewport
  1674.     @command_window.y = @help_window.height
  1675.     @command_window.equiphelp_window = @equiphelp_window
  1676.     @command_window.set_handler(:a,      method(:command_A))
  1677.     @command_window.set_handler(:b,      method(:command_B))
  1678.     @command_window.set_handler(:c,      method(:command_C))
  1679.     @command_window.set_handler(:cancel, method(:return_scene))
  1680.   end
  1681.   def create_dummy_window
  1682.     wy = @command_window.y + @command_window.height
  1683.     wh = Graphics.height - wy
  1684.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  1685.     @dummy_window.viewport = @viewport
  1686.   end
  1687.   def create_A_window
  1688.     @makeA_status_window = Window_MakeA_Status.new(400, 120, 400, 480)
  1689.     @makeA_status_window.viewport = @viewport
  1690.     @makeA_status_window.hide
  1691.     @makeA_itemlist_window = Window_MakeA_ItemLise.new(0, 120, 400, 480)
  1692.     @makeA_itemlist_window.viewport = @viewport
  1693.     @makeA_itemlist_window.help_window = @help_window
  1694.     @makeA_itemlist_window.equiphelp_window = @equiphelp_window
  1695.     @makeA_itemlist_window.status_window = @makeA_status_window
  1696.     @makeA_itemlist_window.hide
  1697.     @makeA_itemlist_window.set_handler(:ok,     method(:on_A_ok))
  1698.     @makeA_itemlist_window.set_handler(:cancel, method(:on_A_cancel))
  1699.     @makeA_ok_window = Window_MakeA_Ok.new
  1700.     @makeA_ok_window.viewport = @viewport
  1701.     @makeA_ok_window.set_handler(:ok,     method(:on_A_ok_ok))
  1702.     @makeA_ok_window.set_handler(:cancel, method(:on_A_ok_cancel))
  1703.   end
  1704.   def create_B_window
  1705.     @makeB_status_window = Window_MakeB_Status.new(800, 120, 400, 480)
  1706.     @makeB_status_window.viewport = @viewport
  1707.     @makeB_status_window.hide
  1708.     @makeB_itemlist_window = Window_MakeB_ItemLise.new(400, 120, 400, 480)
  1709.     @makeB_itemlist_window.viewport = @viewport
  1710.     @makeB_itemlist_window.help_window = @help_window
  1711.     @makeB_itemlist_window.equiphelp_window = @equiphelp_window
  1712.     @makeB_itemlist_window.status_window = @makeB_status_window
  1713.     @makeB_itemlist_window.hide
  1714.     @makeB_itemlist_window.set_handler(:ok,     method(:on_B_ok))
  1715.     @makeB_itemlist_window.set_handler(:cancel, method(:on_B_cancel))
  1716.     @makeB_ok_window = Window_MakeB_Ok.new(0, 120, 400, 480)
  1717.     @makeB_ok_window.viewport = @viewport
  1718.     @makeB_ok_window.equiphelp_window = @equiphelp_window
  1719.     @makeB_ok_window.set_handler(:ok,     method(:on_B_ok_ok))
  1720.     @makeB_ok_window.set_handler(:cancel, method(:on_B_ok_cancel))
  1721.   end
  1722.   def command_A
  1723.     @dummy_window.hide
  1724.     @makeA_itemlist_window.show.activate
  1725.     @makeA_itemlist_window.refresh
  1726.     @makeA_itemlist_window.select(0)
  1727.     @makeA_status_window.show
  1728.   end
  1729.   def command_B
  1730.     @dummy_window.hide
  1731.     @makeB_itemlist_window.show
  1732.    #@makeB_itemlist_window.refresh
  1733.    #@makeA_itemlist_window.select(0)
  1734.    #@makeB_status_window.show
  1735.     @makeB_ok_window.show.activate
  1736.     @makeB_ok_window.refresh
  1737.     @makeB_ok_window.select(0)
  1738.   end
  1739.   def command_C
  1740.     @dummy_window.hide
  1741.     @category_window.show.activate
  1742.     @sell_window.show
  1743.     @sell_window.unselect
  1744.     @sell_window.refresh
  1745.   end
  1746.   def on_A_ok
  1747.     @item = @makeA_itemlist_window.item
  1748.     @makeA_itemlist_window.deactivate
  1749.     @makeA_ok_window.show.activate
  1750.   end
  1751.   def on_A_cancel
  1752.     @command_window.activate
  1753.     @dummy_window.show
  1754.     @makeA_itemlist_window.hide
  1755.     @makeA_status_window.hide
  1756.     @makeA_status_window.item = nil
  1757.     @help_window.clear
  1758.     @equiphelp_window.clear
  1759.   end
  1760.   def on_A_ok_ok
  1761.     $game_party.lose_gold(@item.lv_price)
  1762.     @item.lv_up
  1763.     @makeA_itemlist_window.activate
  1764.     @makeA_itemlist_window.refresh
  1765.     @makeA_ok_window.hide
  1766.     @gold_window.refresh
  1767.   end
  1768.   def on_A_ok_cancel
  1769.     @makeA_itemlist_window.activate
  1770.     @makeA_ok_window.hide
  1771.   end
  1772.   def on_B_ok
  1773.     case @makeB_ok_window.kind
  1774.     when 0
  1775.       @makeB_ok_window.item = @makeB_itemlist_window.item
  1776.     when 1
  1777.       @makeB_ok_window.eq_gem(@makeB_itemlist_window.item)
  1778.       @gold_window.refresh
  1779.     when 2
  1780.     end
  1781.     on_B_cancel
  1782.   end
  1783.   def on_B_cancel
  1784.     @makeB_ok_window.activate
  1785.     @makeB_itemlist_window.clear
  1786.     @help_window.clear
  1787.    #@equiphelp_window.clear
  1788.   end
  1789.   def on_B_ok_ok
  1790.     case @makeB_ok_window.kind
  1791.     when 0
  1792.       @makeB_ok_window.deactivate
  1793.       @makeB_itemlist_window.activate
  1794.       @makeB_itemlist_window.refresh("A")
  1795.     when 1
  1796.       @makeB_ok_window.deactivate
  1797.       @makeB_itemlist_window.activate
  1798.       @makeB_itemlist_window.refresh("B")
  1799.     when 2
  1800.       @makeB_ok_window.add_ds
  1801.       @makeB_ok_window.activate
  1802.     end
  1803.     @gold_window.refresh
  1804.   end
  1805.   def on_B_ok_cancel
  1806.     @command_window.activate
  1807.     @dummy_window.show
  1808.     @makeB_ok_window.item = nil
  1809.     @makeB_ok_window.hide
  1810.     @makeB_itemlist_window.hide
  1811.     @help_window.clear
  1812.    #@equiphelp_window.clear
  1813.   end
  1814.   def money
  1815.     @gold_window.value
  1816.   end
  1817.   def currency_unit
  1818.     @gold_window.currency_unit
  1819.   end
  1820.   def buying_price
  1821.     @buy_window.price(@item)
  1822.   end
  1823.   def selling_price
  1824.     @item.price / 2
  1825.   end
  1826. end
  1827. class Scene_Shop < Scene_MenuBase
  1828.   def start
  1829.     super
  1830.     create_help_window
  1831.     create_equiphelp_window
  1832.     create_gold_window
  1833.     create_command_window
  1834.     create_dummy_window
  1835.     create_number_window
  1836.     create_status_window
  1837.     create_buy_window
  1838.     create_category_window
  1839.     create_sell_window
  1840.   end
  1841.   def create_command_window
  1842.     @command_window = Window_ShopCommand.new(@gold_window.x, @purchase_only)
  1843.     @command_window.viewport = @viewport
  1844.     @command_window.y = @help_window.height
  1845.     @command_window.equiphelp_window = @equiphelp_window
  1846.     @command_window.set_handler(:buy,    method(:command_buy))
  1847.     @command_window.set_handler(:sell,   method(:command_sell))
  1848.     @command_window.set_handler(:cancel, method(:return_scene))
  1849.   end
  1850.   def create_number_window
  1851.     wy = @dummy_window.y
  1852.     wh = @dummy_window.height
  1853.     @number_window = Window_ShopNumber.new(0, wy, wh)
  1854.     @number_window.viewport = @viewport
  1855.     @number_window.equiphelp_window = @equiphelp_window
  1856.     @number_window.hide
  1857.     @number_window.set_handler(:ok,     method(:on_number_ok))
  1858.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  1859.   end
  1860.   def create_buy_window
  1861.     wy = @dummy_window.y
  1862.     wh = @dummy_window.height
  1863.     @buy_window = Window_ShopBuy.new(0, wy, wh, @goods)
  1864.     @buy_window.viewport = @viewport
  1865.     @buy_window.help_window = @help_window
  1866.     @buy_window.equiphelp_window = @equiphelp_window
  1867.     @buy_window.status_window = @status_window
  1868.     @buy_window.hide
  1869.     @buy_window.set_handler(:ok,     method(:on_buy_ok))
  1870.     @buy_window.set_handler(:cancel, method(:on_buy_cancel))
  1871.   end
  1872.   def create_category_window
  1873.     @category_window = Window_ItemCategory.new
  1874.     @category_window.viewport = @viewport
  1875.     @category_window.help_window = @help_window
  1876.     @category_window.equiphelp_window = @equiphelp_window
  1877.     @category_window.y = @dummy_window.y
  1878.     @category_window.hide.deactivate
  1879.     @category_window.set_handler(:ok,     method(:on_category_ok))
  1880.     @category_window.set_handler(:cancel, method(:on_category_cancel))
  1881.   end
  1882.   def create_sell_window
  1883.     wy = @category_window.y + @category_window.height
  1884.     wh = Graphics.height - wy
  1885.     @sell_window = Window_ShopSell.new(0, wy, Graphics.width, wh)
  1886.     @sell_window.viewport = @viewport
  1887.     @sell_window.help_window = @help_window
  1888.     @sell_window.equiphelp_window = @equiphelp_window
  1889.     @sell_window.hide
  1890.     @sell_window.set_handler(:ok,     method(:on_sell_ok))
  1891.     @sell_window.set_handler(:cancel, method(:on_sell_cancel))
  1892.     @category_window.item_window = @sell_window
  1893.   end
  1894.   def del_on_buy_cancel
  1895.     @command_window.activate
  1896.     @dummy_window.show
  1897.     @buy_window.hide
  1898.     @status_window.hide
  1899.     @status_window.item = nil
  1900.     @help_window.clear
  1901.     @equiphelp_window.clear
  1902.   end
  1903.   def del_on_sell_cancel
  1904.     @sell_window.unselect
  1905.     @category_window.activate
  1906.     @status_window.item = nil
  1907.     @help_window.clear
  1908.     @equiphelp_window.clear
  1909.   end
  1910.   def do_buy(number)
  1911.     $game_party.lose_gold(number * buying_price)
  1912.     $game_party.add_shopitem(@item, number)
  1913.   end
  1914.   def do_sell(number)
  1915.     $game_party.gain_gold(number * selling_price)
  1916.     $game_party.lose_item(@item.id, number)
  1917.   end
  1918.   def max_buy
  1919.     buying_price == 0 ? 99 : [99, money / buying_price].min
  1920.   end
  1921.   def max_sell
  1922.     @item.is_item? ? $game_party.item_number(@item) : 1
  1923.   end
  1924. end
  1925. class Scene_Battle < Scene_Base
  1926.   def on_item_ok
  1927.     @item = @item_window.item
  1928.     BattleManager.actor.input.set_item(@item)
  1929.     if !@item.need_selection?
  1930.       @item_window.hide
  1931.       next_command
  1932.     elsif @item.for_opponent?
  1933.       select_enemy_selection
  1934.     else
  1935.       select_actor_selection
  1936.     end
  1937.     $game_party.last_item.object = @item
  1938.   end
  1939. end

Lv1.梦旅人

梦石
0
星屑
95
在线时间
7 小时
注册时间
2022-6-9
帖子
2
 楼主| 发表于 2022-7-31 22:22:49 | 显示全部楼层
求大神解答

评分

参与人数 1+1 收起 理由
alexncf125 + 1 这种一看用中文做常量的脚本不用就对了.

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-3-29 09:58

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表