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

Project1

 找回密码
 注册会员
搜索
查看: 1681|回复: 1
打印 上一主题 下一主题

[已经解决] 10元求整合,完美物品系统和物品詳細幫助窗口

[复制链接]

Lv4.逐梦者

梦石
0
星屑
12157
在线时间
4435 小时
注册时间
2014-4-11
帖子
5955

开拓者

跳转到指定楼层
1
发表于 2014-12-1 17:07:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
可支付宝

完美物品系统
RUBY 代码复制
  1. #==============================================================================
  2. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  3. # ■ 使用方法写在发布页
  4. #==============================================================================
  5. =begin
  6.  
  7. 部分可能在制作中用到的核心算法:
  8.  
  9. 角色(Game_Actor):
  10. 属性:max_size,最大负重,可在游戏更改。如$game_actors[1].max_size += 1
  11. 属性:items,物品列表,只可读取,不可修改。如$a = $game_actors[1].items[0]
  12. 函数:judge_equip,判断一下是否装备正确。如果不正确就把装备设置为空
  13. 函数:gain_item(item_id, kind=1, n=true),给某角色增减物品。
  14.       item_id : 物品 ID;n: true是增加,false是减少;kind:种类,1是物品,2是武器,3是防具
  15. 函数:item_amount,返回现有负重物品数量
  16. 函数:have_item?(item),判断是否拥有某物
  17. 函数:item_full?,判断背包是不是满了
  18.  
  19.  
  20. 队伍(Game_Party):
  21. 属性:max_amount,最大背包中物品数量
  22. 属性:now_amount,背包中现有物品数量
  23. 函数:item_full?,判断背包是否放满
  24. 函数:refresh_item_amount,重新刷新背包中现有物品数量,发生意外的时候用
  25.  
  26. =end
  27. #==============================================================================
  28. # ■ Game_Actor
  29. #------------------------------------------------------------------------------
  30. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  31. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  32. #==============================================================================
  33. class Game_Actor < Game_Battler
  34.   attr_accessor :max_size
  35.   attr_reader   :items
  36.   #--------------------------------------------------------------------------
  37.   # ● 设置
  38.   #     actor_id : 角色 ID
  39.   #--------------------------------------------------------------------------
  40.   alias final_items_setup setup
  41.   def setup(actor_id)
  42.     final_items_setup(actor_id)   
  43.     #--角色自带的物品建立
  44.     @max_size = 8
  45.     @items = []        
  46.     if @weapon_id >0
  47.       @items.push($data_weapons[@weapon_id])
  48.     end
  49.     if @armor1_id >0
  50.       @items.push($data_armors[@armor1_id])
  51.     end
  52.     if @armor2_id >0
  53.       @items.push($data_armors[@armor2_id])
  54.     end
  55.     if @armor3_id >0
  56.       @items.push($data_armors[@armor3_id])
  57.     end
  58.     if @armor4_id >0
  59.       @items.push($data_armors[@armor4_id])
  60.     end
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 测试装备是否正确,如果不正确就设置为空
  64.   #--------------------------------------------------------------------------
  65.   def judge_equip
  66.     if @armor1_id>0
  67.       unless @items.include?($data_armors[@armor1_id])
  68.         @armor1_id = 0
  69.       end
  70.     end
  71.     if @armor2_id>0
  72.       unless @items.include?($data_armors[@armor2_id])
  73.         @armor2_id = 0
  74.       end
  75.     end
  76.     if @armor3_id>0
  77.       unless @items.include?($data_armors[@armor3_id])
  78.         @armor3_id = 0
  79.       end
  80.     end
  81.     if @armor4_id>0
  82.       unless @items.include?($data_armors[@armor4_id])
  83.         @armor4_id = 0
  84.       end
  85.     end
  86.     if @weapon_id>0
  87.       unless @items.include?($data_weapons[@weapon_id])
  88.         @weapon_id = 0
  89.       end
  90.     end
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 增加物品 (减少)
  94.   #     item_id : 物品 ID
  95.   #     n       : true是增加,false是减少
  96.   #     kind    : 种类,1是物品,2是武器,3是防具
  97.   #--------------------------------------------------------------------------
  98.   def gain_item(item_id, kind=1, n=true)
  99.     return if item_full?
  100.     if kind == 1
  101.       if item_id > 0 and n==true
  102.         @items.push($data_items[item_id])
  103.       elsif item_id >0 and n==false
  104.         @items.delete($data_items[item_id])
  105.       end
  106.     end
  107.     if kind == 2
  108.       if item_id > 0 and n==true
  109.         @items.push($data_weapons[item_id])
  110.       elsif item_id > 0 and n==false
  111.         @items.push($data_weapons[item_id])
  112.       end
  113.     end
  114.     if kind == 3
  115.       if item_id > 0 and n==true
  116.         @items.push($data_armors[item_id])
  117.       elsif item_id > 0 and n==true
  118.         @items.push($data_armors[item_id])
  119.       end
  120.     end
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 返回物品数量
  124.   #--------------------------------------------------------------------------  
  125.   def item_amount
  126.     return @items.size
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● 判断是否拥有物品
  130.   #--------------------------------------------------------------------------  
  131.   def have_item?(item)
  132.     return @items.include?(item)
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● 判断是否物品满了
  136.   #--------------------------------------------------------------------------  
  137.   def item_full?
  138.     return true if @items.size>=@max_size
  139.     return false
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● 变更装备
  143.   #     equip_type : 装备类型
  144.   #     id    : 武器 or 防具 ID  (0 为解除装备)
  145.   #--------------------------------------------------------------------------
  146.   def equip(equip_type, id)
  147.     case equip_type
  148.     when 0  # 武器
  149.       if id >= 0
  150.         @weapon_id = id
  151.       end
  152.     when 1  # 盾
  153.       if id >= 0
  154.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  155.         @armor1_id = id
  156.       end
  157.     when 2  # 头
  158.       if id >= 0
  159.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  160.         @armor2_id = id
  161.       end
  162.     when 3  # 身体
  163.       if id >= 0
  164.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  165.         @armor3_id = id
  166.       end
  167.     when 4  # 装饰品
  168.       if id >= 0
  169.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  170.         @armor4_id = id
  171.       end
  172.     end
  173.   end  
  174. end
  175.  
  176. #==============================================================================
  177. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  178. # ■ 使用方法写在发布页
  179. #==============================================================================
  180. # ■ Game_Party
  181. #------------------------------------------------------------------------------
  182. #  处理同伴的类。包含金钱以及物品的信息。本类的实例
  183. # 请参考 $game_party。
  184. #==============================================================================
  185.  
  186. class Game_Party
  187.   #--------------------------------------------------------------------------
  188.   # ● 定义实例变量
  189.   #--------------------------------------------------------------------------
  190.   attr_accessor :max_amount
  191.   attr_reader   :now_amount
  192.   #--------------------------------------------------------------------------
  193.   # ● 初始化对像
  194.   #--------------------------------------------------------------------------
  195.   alias final_item_initialize initialize
  196.   def initialize
  197.     final_item_initialize
  198.     @max_amount = 2
  199.     @now_amount = 0
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   #--------------------------------------------------------------------------
  203.   def item_full?
  204.     return true if @now_amount>=@max_amount
  205.     return false
  206.   end
  207.   def refresh_item_amount
  208.     @now_amount = 0
  209.     for i in 1...$data_items.size
  210.       if $game_party.item_number(i) > 0
  211.         @now_amount += $game_party.item_number(i)
  212.       end
  213.     end
  214.     for i in 1...$data_weapons.size
  215.       if $game_party.weapon_number(i) > 0
  216.         @now_amount += $game_party.weapon_number(i)
  217.       end
  218.     end
  219.     for i in 1...$data_armors.size
  220.       if $game_party.armor_number(i) > 0
  221.         @now_amount += $game_party.armor_number(i)
  222.       end
  223.     end
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● 增加物品 (减少)
  227.   #     item_id : 物品 ID
  228.   #     n       : 个数
  229.   #--------------------------------------------------------------------------
  230.   def gain_item(item_id, n)
  231.     # 更新 hash 的个数数据
  232.     if item_id > 0
  233.       @items[item_id] = [[item_number(item_id) + n, 0].max, @max_amount].min
  234.       refresh_item_amount
  235.     end
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ● 增加武器 (减少)
  239.   #     weapon_id : 武器 ID
  240.   #     n         : 个数
  241.   #--------------------------------------------------------------------------
  242.   def gain_weapon(weapon_id, n)
  243.     # 更新 hash 的个数数据
  244.     if weapon_id > 0
  245.       @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, @max_amount].min
  246.       refresh_item_amount
  247.     end
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 增加防具 (减少)
  251.   #     armor_id : 防具 ID
  252.   #     n        : 个数
  253.   #--------------------------------------------------------------------------
  254.   def gain_armor(armor_id, n)
  255.     # 更新 hash 的个数数据
  256.     if armor_id > 0
  257.       @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, @max_amount].min
  258.       refresh_item_amount
  259.     end
  260.   end  
  261.   #--------------------------------------------------------------------------
  262.   # ● 判断物品可以使用
  263.   #     item_id : 物品 ID
  264.   #--------------------------------------------------------------------------
  265.   def item_can_use?(item_id)
  266.     # 物品个数为 0 的情况
  267.     #if item_number(item_id) == 0
  268.       # 不能使用
  269.       #return false
  270.     #end
  271.     # 获取可以使用的时候
  272.     occasion = $data_items[item_id].occasion
  273.     # 战斗的情况
  274.     if $game_temp.in_battle
  275.       # 可以使用时为 0 (平时) 或者是 1 (战斗时) 可以使用
  276.       return (occasion == 0 or occasion == 1)
  277.     end
  278.     # 可以使用时为 0 (平时) 或者是 2 (菜单时) 可以使用
  279.     return (occasion == 0 or occasion == 2)
  280.   end  
  281. end
  282.  
  283. #==============================================================================
  284. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  285. # ■ 使用方法写在发布页
  286. #==============================================================================
  287. # ■ Window_Command
  288. #------------------------------------------------------------------------------
  289. #  一般的命令选择行窗口。
  290. #==============================================================================
  291.  
  292. class Window_Command < Window_Selectable
  293.   #--------------------------------------------------------------------------
  294.   # ● 项目有效化
  295.   #     index : 项目编号
  296.   #--------------------------------------------------------------------------  
  297.   def enable_item(index)
  298.     draw_item(index, normal_color)
  299.   end
  300. end
  301.  
  302. #==============================================================================
  303. # ■ Window_Item
  304. #------------------------------------------------------------------------------
  305. #  物品画面、战斗画面、显示浏览物品的窗口。
  306. #==============================================================================
  307.  
  308. class Window_Item < Window_Selectable
  309.   #--------------------------------------------------------------------------
  310.   # ● 初始化对像
  311.   #--------------------------------------------------------------------------
  312.   def initialize(actor=nil)
  313.     @actor=actor
  314.     super(0, 64, 640, 416)
  315.     @column_max = 1
  316.     refresh
  317.     self.index = 0
  318.     # 战斗中的情况下将窗口移至中央并将其半透明化
  319.     if $game_temp.in_battle
  320.       self.y = 64
  321.       self.height = 256
  322.       self.back_opacity = 160
  323.     end
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● 获取物品
  327.   #--------------------------------------------------------------------------
  328.   def item
  329.     return @data[self.index]
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● 刷新
  333.   #--------------------------------------------------------------------------
  334.   def refresh
  335.     if self.contents != nil
  336.       self.contents.dispose
  337.       self.contents = nil
  338.     end
  339.     @data = []
  340.     # 添加报务
  341.  
  342.     if @actor==nil   
  343.       for i in 1...$data_items.size
  344.         if $game_party.item_number(i) > 0
  345.           for pushtimes in 0...$game_party.item_number(i)
  346.             @data.push($data_items[i])
  347.           end
  348.         end
  349.       end
  350.       for i in 1...$data_weapons.size
  351.         if $game_party.weapon_number(i) > 0
  352.           for pushtimes in 0...$game_party.weapon_number(i)
  353.             @data.push($data_weapons[i])
  354.           end
  355.         end
  356.       end
  357.       for i in 1...$data_armors.size
  358.         if $game_party.armor_number(i) > 0
  359.           for pushtimes in 0...$game_party.armor_number(i)
  360.             @data.push($data_armors[i])
  361.           end
  362.         end
  363.       end
  364.     else
  365.       for i in [email]0...@actor.items.size[/email]
  366.         if @actor.items[i].is_a?(RPG::Item)
  367.           @data.push(@actor.items[i])
  368.         else         
  369.           if @actor.items[i].is_a?(RPG::Weapon) or @actor.items[i].is_a?(RPG::Armor)
  370.             if @actor.items[i].name==$data_items[@actor.items[i].id].name
  371.               @data.push($data_items[@actor.items[i].id])
  372.               next
  373.             else
  374.               @data.push(@actor.items[i])
  375.               next
  376.             end
  377.           end
  378.         end
  379.       end
  380.     end
  381.     # 如果项目数不是 0 就生成位图、重新描绘全部项目
  382.     @item_max = @data.size
  383.     if @item_max > 0
  384.       self.contents = Bitmap.new(width - 32, row_max * 32)
  385.       self.contents.font.size = 20
  386.       for i in 0...@item_max
  387.         draw_item(i)
  388.       end
  389.     end
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # ● 描绘项目
  393.   #     index : 项目编号
  394.   #--------------------------------------------------------------------------
  395.   def draw_item(index)
  396.     if @actor==nil
  397.       item = @data[index]
  398.       x = 4
  399.       y = index * 32
  400.       rect = Rect.new(x, y, self.width - 32, 32)
  401.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  402.       bitmap = RPG::Cache.icon(item.icon_name)
  403.       opacity = self.contents.font.color == normal_color ? 255 : 128
  404.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  405.       self.contents.font.size = 20
  406.       self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  407.       self.contents.font.size = 14
  408.       self.contents.draw_text(x + 150, y, 400, 42, ":"+item.description, 0)
  409.     else
  410.       item = @data[index]
  411.       #if item.is_a?(RPG::Item) and
  412.         #$game_party.item_can_use?(item.id)
  413.         #self.contents.font.color = normal_color
  414.       #else
  415.         #self.contents.font.color = disabled_color
  416.       #end
  417.       x = 4
  418.       y = index * 32
  419.       rect = Rect.new(x, y, self.width - 32, 32)
  420.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  421.       bitmap = RPG::Cache.icon(item.icon_name)
  422.       opacity = self.contents.font.color == normal_color ? 255 : 128
  423.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  424.       self.contents.font.size = 20
  425.       self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  426.       self.contents.font.size = 14
  427.       self.contents.draw_text(x + 150, y, 400, 42, ":"+item.description, 0)
  428.     end
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # ● 刷新帮助文本
  432.   #--------------------------------------------------------------------------
  433.   def update_help
  434.     @help_window.contents.font.size = 18
  435.     if @actor==nil
  436.       @help_window.set_text(self.item == nil ? ""+"    ★仓库目前物品数:"+$game_party.now_amount.to_s+" / "+$game_party.max_amount.to_s : self.item.description+"    ★仓库目前物品数:"+$game_party.now_amount.to_s+" / "+$game_party.max_amount.to_s )
  437.     else
  438.       @help_window.set_text(@actor.name+"    物品数量:"+@actor.item_amount.to_s+"    最大负重:"+@actor.max_size.to_s)
  439.     end
  440.   end
  441.   def dispose
  442.     super
  443.     @actor.judge_equip if @actor != nil
  444.   end
  445. end
  446.  
  447. #==============================================================================
  448. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  449. # ■ 使用方法写在发布页
  450. #============================================================================
  451. # ■ Window_EquipItem
  452. #------------------------------------------------------------------------------
  453. #  装备画面、显示浏览变更装备的候补物品的窗口。
  454. #==============================================================================
  455.  
  456. class Window_EquipItem < Window_Selectable
  457.   #--------------------------------------------------------------------------
  458.   # ● 刷新
  459.   #--------------------------------------------------------------------------
  460.   def refresh
  461.     if self.contents != nil
  462.       self.contents.dispose
  463.       self.contents = nil
  464.     end
  465.     @data = []
  466.  
  467.     # 添加可以装备的武器
  468.     if @equip_type == 0
  469.       weapon_set = $data_classes[@actor.class_id].weapon_set
  470.       for item in @actor.items
  471.         if item.is_a?(RPG::Weapon) and weapon_set.include?(item.id)
  472.           @data.push(item)
  473.         end
  474.       end
  475.     end
  476.     # 添加可以装备的防具
  477.     if @equip_type != 0
  478.       armor_set = $data_classes[@actor.class_id].armor_set
  479.       for item in @actor.items
  480.         if item.is_a?(RPG::Armor) and armor_set.include?(item.id)
  481.           if item.kind == @equip_type-1
  482.             @data.push(item)
  483.           end
  484.         end
  485.       end
  486.     end
  487.     # 添加空白
  488.     @data.push(nil)
  489.     # 生成位图、描绘全部项目
  490.     @item_max = @data.size
  491.     self.contents = Bitmap.new(width - 32, row_max * 32)
  492.     for i in 0...@item_max-1
  493.       draw_item(i)
  494.     end
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # ● 项目的描绘
  498.   #     index : 项目符号
  499.   #--------------------------------------------------------------------------
  500.   def draw_item(index)
  501.     item = @data[index]
  502.     x = 4 + index % 2 * (288 + 32)
  503.     y = index / 2 * 32
  504.     bitmap = RPG::Cache.icon(item.icon_name)
  505.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  506.     self.contents.font.color = normal_color
  507.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  508.   end
  509. end
  510.  
  511. #==============================================================================
  512. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  513. # ■ 使用方法写在发布页
  514. #==============================================================================
  515. # ■ Window_ShopStatus_New
  516. #------------------------------------------------------------------------------
  517. #  商店画面、显示物品所持数与角色装备的窗口。
  518. #==============================================================================
  519.  
  520. class Window_ShopStatus_New < Window_Selectable
  521.   #--------------------------------------------------------------------------
  522.   # ● 初始化对像
  523.   #--------------------------------------------------------------------------
  524.   def initialize
  525.     super(368, 128, 272, 352)
  526.     self.contents = Bitmap.new(width - 32, height - 32)
  527.     self.contents.font.size = 18
  528.     @item = nil
  529.     @item_max = $game_party.actors.size + 1
  530.     refresh
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # ● 刷新
  534.   #--------------------------------------------------------------------------
  535.   def refresh
  536.     self.contents.clear
  537.     if @item == nil
  538.       return
  539.     end
  540.     case @item
  541.     when RPG::Item
  542.       number = $game_party.item_number(@item.id)
  543.     when RPG::Weapon
  544.       number = $game_party.weapon_number(@item.id)
  545.     when RPG::Armor
  546.       number = $game_party.armor_number(@item.id)
  547.     end
  548.     self.contents.font.color = system_color
  549.     self.contents.draw_text(4, 0, 200, 32, "仓库中本物品数:")
  550.     self.contents.font.color = normal_color
  551.     self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
  552.     self.contents.font.color = system_color
  553.     self.contents.draw_text(4, 32, 200, 32, "仓库目前物品数:")
  554.     self.contents.font.color = normal_color
  555.     self.contents.draw_text(164, 32, 72, 32, $game_party.now_amount.to_s+" / "+$game_party.max_amount.to_s, 2)
  556.     #if @item.is_a?(RPG::Item)
  557.       #return
  558.     #end
  559.     # 添加装备品信息
  560.     for i in 0...$game_party.actors.size
  561.       actor = $game_party.actors[i]
  562.       self.contents.font.color = Color.new(255,255,0)
  563.       self.contents.draw_text(116, 64 + 64 * i, 132, 32, "负重: ")
  564.       self.contents.font.color = normal_color
  565.       self.contents.draw_text(164, 64 + 64 * i, 72, 32, actor.item_amount.to_s+" / "+actor.max_size.to_s,2)
  566.       # 获取当前的装备品
  567.       unless @item == nil or @item.is_a?(RPG::Item)
  568.         if @item.is_a?(RPG::Weapon)
  569.           item1 = $data_weapons[actor.weapon_id]
  570.         elsif @item.kind == 0
  571.           item1 = $data_armors[actor.armor1_id]
  572.         elsif @item.kind == 1
  573.           item1 = $data_armors[actor.armor2_id]
  574.         elsif @item.kind == 2
  575.           item1 = $data_armors[actor.armor3_id]
  576.         else
  577.           item1 = $data_armors[actor.armor4_id]
  578.         end
  579.         # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
  580.         if actor.equippable?(@item)
  581.           self.contents.font.color = normal_color
  582.         else
  583.           self.contents.font.color = disabled_color
  584.         end        
  585.         # 描绘角色名字
  586.         self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  587.         # 可以装备的情况
  588.         if actor.equippable?(@item)
  589.           # 武器的情况
  590.           if @item.is_a?(RPG::Weapon)
  591.             atk1 = item1 != nil ? item1.atk : 0
  592.             atk2 = @item != nil ? @item.atk : 0
  593.             change = atk2 - atk1
  594.           end
  595.           # 防具的情况
  596.           if @item.is_a?(RPG::Armor)
  597.             pdef1 = item1 != nil ? item1.pdef : 0
  598.             mdef1 = item1 != nil ? item1.mdef : 0
  599.             pdef2 = @item != nil ? @item.pdef : 0
  600.             mdef2 = @item != nil ? @item.mdef : 0
  601.             change = pdef2 - pdef1 + mdef2 - mdef1
  602.           end
  603.           # 描绘能力值变化
  604.           self.contents.draw_text(124, 96 + 64 * i, 112, 32,
  605.             sprintf("%+d", change), 2)
  606.         end
  607.         # 描绘物品
  608.         if item1 != nil
  609.           x = 4
  610.           y = 64 + 64 * i + 32
  611.           bitmap = RPG::Cache.icon(item1.icon_name)
  612.           opacity = self.contents.font.color == normal_color ? 255 : 128
  613.           self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  614.           self.contents.draw_text(x + 28, y, 212, 32, item1.name)
  615.         end
  616.       else
  617.         self.contents.font.color = normal_color
  618.         # 描绘角色名字
  619.         self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  620.       end
  621.     end
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ● 设置物品
  625.   #     item : 新的物品
  626.   #--------------------------------------------------------------------------
  627.   def item=(item)
  628.     if @item != item
  629.       @item = item
  630.       refresh
  631.     end
  632.   end
  633.   #--------------------------------------------------------------------------
  634.   # ● 刷新光标矩形
  635.   #--------------------------------------------------------------------------
  636.   def update_cursor_rect
  637.     if @index < 0
  638.       self.cursor_rect.empty
  639.     else
  640.       self.cursor_rect.set(0, @index * 64, self.width - 32, 64)
  641.     end
  642.   end
  643. end
  644.  
  645. #==============================================================================
  646. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  647. # ■ 使用方法写在发布页
  648. #==============================================================================
  649. # ■ Scene_Menu
  650. #------------------------------------------------------------------------------
  651. #  处理菜单画面的类。
  652. #==============================================================================
  653.  
  654. class Scene_Menu
  655.   #--------------------------------------------------------------------------
  656.   # ● 初始化对像
  657.   #     menu_index : 命令光标的初期位置
  658.   #--------------------------------------------------------------------------
  659.   def initialize(menu_index = 0)
  660.     @menu_index = menu_index
  661.   end
  662.   #--------------------------------------------------------------------------
  663.   # ● 主处理
  664.   #--------------------------------------------------------------------------
  665.   def main
  666.     # 生成命令窗口
  667.     s1 = $data_system.words.item
  668.     s2 = $data_system.words.skill
  669.     s3 = $data_system.words.equip
  670.     s4 = "状态"
  671.     s5 = "存档"
  672.     s6 = "结束游戏"
  673.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
  674.     @command_window.index = @menu_index
  675.     @item_command_window = Window_Command.new(160,["仓库物品","个人物品"])
  676.     @item_command_window.x = 120
  677.     @item_command_window.visible = false
  678.     @item_command_window.active = false
  679.     @item_command_window.z = 999
  680.     # 同伴人数为 0 的情况下
  681.     if $game_party.actors.size == 0
  682.       # 物品、特技、装备、状态无效化
  683.       @command_window.disable_item(0)
  684.       @command_window.disable_item(1)
  685.       @command_window.disable_item(2)
  686.       @command_window.disable_item(3)
  687.     end
  688.     # 禁止存档的情况下
  689.     if $game_system.save_disabled
  690.       # 存档无效
  691.       @command_window.disable_item(4)
  692.     end
  693.     # 生成游戏时间窗口
  694.     @playtime_window = Window_PlayTime.new
  695.     @playtime_window.x = 0
  696.     @playtime_window.y = 224
  697.     # 生成步数窗口
  698.     @steps_window = Window_Steps.new
  699.     @steps_window.x = 0
  700.     @steps_window.y = 320
  701.     # 生成金钱窗口
  702.     @gold_window = Window_Gold.new
  703.     @gold_window.x = 0
  704.     @gold_window.y = 416
  705.     # 生成状态窗口
  706.     @status_window = Window_MenuStatus.new
  707.     @status_window.x = 160
  708.     @status_window.y = 0
  709.     # 执行过渡
  710.     Graphics.transition
  711.     # 主循环
  712.     loop do
  713.       # 刷新游戏画面
  714.       Graphics.update
  715.       # 刷新输入信息
  716.       Input.update
  717.       # 刷新画面
  718.       update
  719.       # 如果切换画面就中断循环
  720.       if $scene != self
  721.         break
  722.       end
  723.     end
  724.     # 准备过渡
  725.     Graphics.freeze
  726.     # 释放窗口
  727.     @command_window.dispose
  728.     @playtime_window.dispose
  729.     @steps_window.dispose
  730.     @gold_window.dispose
  731.     @status_window.dispose
  732.     @item_command_window.dispose
  733.   end
  734.   #--------------------------------------------------------------------------
  735.   # ● 刷新画面
  736.   #--------------------------------------------------------------------------
  737.   def update
  738.     # 刷新窗口
  739.     @command_window.update
  740.     @playtime_window.update
  741.     @steps_window.update
  742.     @gold_window.update
  743.     @status_window.update
  744.     @item_command_window.update
  745.     # 命令窗口被激活的情况下: 调用 update_command
  746.     if @command_window.active
  747.       update_command
  748.       return
  749.     end
  750.     # 状态窗口被激活的情况下: 调用 update_status
  751.     if @status_window.active
  752.       update_status
  753.       return
  754.     end
  755.     if @item_command_window.active
  756.       update_item_command
  757.       return
  758.     end
  759.   end
  760.   def update_item_command
  761.     if Input.trigger?(Input::B)
  762.       $game_system.se_play($data_system.cancel_se)
  763.       @item_command_window.active = false
  764.       @item_command_window.visible = false
  765.       @command_window.active = true
  766.     end
  767.     if Input.trigger?(Input::C)
  768.       case @item_command_window.index
  769.       when 0
  770.         $game_system.se_play($data_system.decision_se)
  771.         $scene = Scene_Item.new
  772.       when 1
  773.         # 演奏确定 SE
  774.         $game_system.se_play($data_system.decision_se)
  775.         # 激活状态窗口
  776.         @item_command_window.active = false
  777.         @item_command_window.visible = false
  778.         @status_window.active = true
  779.         @status_window.index = 0
  780.       end
  781.     end
  782.   end
  783.   #--------------------------------------------------------------------------
  784.   # ● 刷新画面 (命令窗口被激活的情况下)
  785.   #--------------------------------------------------------------------------
  786.   def update_command
  787.     # 按下 B 键的情况下
  788.     if Input.trigger?(Input::B)
  789.       # 演奏取消 SE
  790.       $game_system.se_play($data_system.cancel_se)
  791.       # 切换的地图画面
  792.       $scene = Scene_Map.new
  793.       return
  794.     end
  795.     # 按下 C 键的情况下
  796.     if Input.trigger?(Input::C)
  797.       # 同伴人数为 0、存档、游戏结束以外的场合
  798.       if $game_party.actors.size == 0 and @command_window.index < 4
  799.         # 演奏冻结 SE
  800.         $game_system.se_play($data_system.buzzer_se)
  801.         return
  802.       end
  803.       # 命令窗口的光标位置分支
  804.       case @command_window.index
  805.       when 0  # 物品
  806.         # 演奏确定 SE
  807.         $game_system.se_play($data_system.decision_se)
  808.         # 激活状态窗口
  809.         @command_window.active = false
  810.         @item_command_window.active = true
  811.         @item_command_window.index = 0
  812.         @item_command_window.visible = true
  813.       when 1  # 特技
  814.         # 演奏确定 SE
  815.         $game_system.se_play($data_system.decision_se)
  816.         # 激活状态窗口
  817.         @command_window.active = false
  818.         @status_window.active = true
  819.         @status_window.index = 0
  820.       when 2  # 装备
  821.         # 演奏确定 SE
  822.         $game_system.se_play($data_system.decision_se)
  823.         # 激活状态窗口
  824.         @command_window.active = false
  825.         @status_window.active = true
  826.         @status_window.index = 0
  827.       when 3  # 状态
  828.         # 演奏确定 SE
  829.         $game_system.se_play($data_system.decision_se)
  830.         # 激活状态窗口
  831.         @command_window.active = false
  832.         @status_window.active = true
  833.         @status_window.index = 0
  834.       when 4  # 存档
  835.         # 禁止存档的情况下
  836.         if $game_system.save_disabled
  837.           # 演奏冻结 SE
  838.           $game_system.se_play($data_system.buzzer_se)
  839.           return
  840.         end
  841.         # 演奏确定 SE
  842.         $game_system.se_play($data_system.decision_se)
  843.         # 切换到存档画面
  844.         $scene = Scene_Save.new
  845.       when 5  # 游戏结束
  846.         # 演奏确定 SE
  847.         $game_system.se_play($data_system.decision_se)
  848.         # 切换到游戏结束画面
  849.         $scene = Scene_End.new
  850.       end
  851.       return
  852.     end
  853.   end
  854.   #--------------------------------------------------------------------------
  855.   # ● 刷新画面 (状态窗口被激活的情况下)
  856.   #--------------------------------------------------------------------------
  857.   def update_status
  858.     # 按下 B 键的情况下
  859.     if Input.trigger?(Input::B)
  860.       # 演奏取消 SE
  861.       $game_system.se_play($data_system.cancel_se)
  862.       # 激活命令窗口
  863.       @command_window.active = true
  864.       @status_window.active = false
  865.       @status_window.index = -1
  866.       return
  867.     end
  868.     # 按下 C 键的情况下
  869.     if Input.trigger?(Input::C)
  870.       # 命令窗口的光标位置分支
  871.       case @command_window.index
  872.       when 0  # 物品        
  873.         $game_system.se_play($data_system.decision_se)
  874.         $scene = Scene_Item.new($game_party.actors[@status_window.index])
  875.       when 1  # 特技
  876.         # 本角色的行动限制在 2 以上的情况下
  877.         if $game_party.actors[@status_window.index].restriction >= 2
  878.           # 演奏冻结 SE
  879.           $game_system.se_play($data_system.buzzer_se)
  880.           return
  881.         end
  882.         # 演奏确定 SE
  883.         $game_system.se_play($data_system.decision_se)
  884.         # 切换到特技画面
  885.         $scene = Scene_Skill.new(@status_window.index)
  886.       when 2  # 装备
  887.         # 演奏确定 SE
  888.         $game_system.se_play($data_system.decision_se)
  889.         # 切换的装备画面
  890.         $scene = Scene_Equip.new(@status_window.index)
  891.       when 3  # 状态
  892.         # 演奏确定 SE
  893.         $game_system.se_play($data_system.decision_se)
  894.         # 切换到状态画面
  895.         $scene = Scene_Status.new(@status_window.index)
  896.       end
  897.       return
  898.     end
  899.   end
  900. end
  901.  
  902. #==============================================================================
  903. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  904. # ■ 使用方法写在发布页
  905. #==============================================================================
  906. # ■ Scene_Item
  907. #------------------------------------------------------------------------------
  908. #  处理物品画面的类。
  909. #==============================================================================
  910.  
  911. class Scene_Item
  912.  
  913.   #★——添加定义
  914.   def initialize(actor = nil)
  915.     @actor = actor
  916.   end
  917.  
  918.   #--------------------------------------------------------------------------
  919.   # ● 主处理
  920.   #--------------------------------------------------------------------------
  921.   def main
  922.     # 生成帮助窗口、物品窗口
  923.     @help_window = Window_Help.new
  924.     @item_window = Window_Item.new(@actor)
  925.     # 关联帮助窗口
  926.     @item_window.help_window = @help_window
  927.     # 生成目标窗口 (设置为不可见・不活动)
  928.     @target_window = Window_Target.new
  929.     @target_window.visible = false
  930.     @target_window.active = false
  931.     if @actor==nil
  932.       @command_window = Window_Command.new(160,["使用物品","交给他人","丢弃物品"])
  933.     else
  934.       @command_window = Window_Command.new(160,["使用物品","转交他人","丢弃物品","放回仓库"])
  935.     end
  936.     @command_window.x = 240
  937.     @command_window.y = 180
  938.     @command_window.visible = false
  939.     @command_window.active = false
  940.     @command_window.z = 999
  941.     @target_window.z = 10000
  942.     # 执行过度
  943.     Graphics.transition
  944.     # 主循环
  945.     loop do
  946.       # 刷新游戏画面
  947.       Graphics.update
  948.       # 刷新输入信息
  949.       Input.update
  950.       # 刷新画面
  951.       update
  952.       # 如果画面切换就中断循环
  953.       if $scene != self
  954.         break
  955.       end
  956.     end
  957.     # 装备过渡
  958.     Graphics.freeze
  959.     # 释放窗口
  960.     @help_window.dispose
  961.     @item_window.dispose
  962.     @target_window.dispose
  963.     @command_window.dispose
  964.   end
  965.   #--------------------------------------------------------------------------
  966.   # ● 刷新画面
  967.   #--------------------------------------------------------------------------
  968.   def update
  969.     # 刷新窗口
  970.     @help_window.update
  971.     @item_window.update
  972.     @target_window.update
  973.     @command_window.update
  974.     # 物品窗口被激活的情况下: 调用 update_item
  975.     if @item_window.active
  976.       update_item
  977.       return
  978.     end
  979.     # 目标窗口被激活的情况下: 调用 update_target
  980.     if @target_window.active
  981.       update_target
  982.       return
  983.     end
  984.     if @command_window.active
  985.       update_command
  986.       return
  987.     end
  988.   end
  989.   #--------------------------------------------------------------------------
  990.   # ● 刷新画面
  991.   #--------------------------------------------------------------------------
  992.   def update_command
  993.     # 按下 B 键的情况下
  994.     if Input.trigger?(Input::B)
  995.       # 演奏取消 SE
  996.       $game_system.se_play($data_system.cancel_se)
  997.       # 切换到菜单画面
  998.       @command_window.visible = false
  999.       @command_window.active = false
  1000.       @item_window.active = true
  1001.       return
  1002.     end
  1003.     # 按下 C 键的情况下
  1004.     if Input.trigger?(Input::C)
  1005.       case @command_window.index
  1006.       when 0
  1007.         # 获取物品窗口当前选中的物品数据
  1008.         @item = @item_window.item
  1009.         # 不使用物品的情况下
  1010.         if @actor == nil
  1011.           $game_system.se_play($data_system.buzzer_se)
  1012.           return
  1013.         end
  1014.         unless @item.is_a?(RPG::Item)
  1015.           # 演奏冻结 SE
  1016.           $game_system.se_play($data_system.buzzer_se)
  1017.           return
  1018.         end
  1019.         # 不能使用的情况下
  1020.         unless $game_party.item_can_use?(@item.id)
  1021.           # 演奏冻结 SE
  1022.           $game_system.se_play($data_system.buzzer_se)
  1023.           return
  1024.         end
  1025.         # 演奏确定 SE
  1026.         $game_system.se_play($data_system.decision_se)
  1027.         # 效果范围是我方的情况下
  1028.         if @item.scope >= 3
  1029.           # 激活目标窗口
  1030.           @command_window.active = false
  1031.           @target_window.x = (@item_window.index + 1) % 2 * 304
  1032.           @target_window.visible = true
  1033.           @target_window.active = true
  1034.           # 设置效果范围 (单体/全体) 的对应光标位置
  1035.           if @item.scope == 4 || @item.scope == 6
  1036.             @target_window.index = -1
  1037.           else
  1038.             @target_window.index = 0
  1039.           end
  1040.         # 效果在我方以外的情况下
  1041.         else
  1042.           # 公共事件 ID 有效的情况下
  1043.           if @item.common_event_id > 0
  1044.             # 预约调用公共事件
  1045.             $game_temp.common_event_id = @item.common_event_id
  1046.             # 演奏物品使用时的 SE
  1047.             $game_system.se_play(@item.menu_se)
  1048.             # 消耗品的情况下
  1049.             if @item.consumable
  1050.               # 使用的物品数减 1
  1051.               if @actor==nil
  1052.                 $game_party.lose_item(@item.id, 1)
  1053.               else
  1054.                 @actor.items.delete_at(@item_window.index)
  1055.               end
  1056.               # 再描绘物品窗口的项目
  1057.               @item_window.draw_item(@item_window.index)
  1058.             end
  1059.             # 切换到地图画面
  1060.             $scene = Scene_Map.new
  1061.             return
  1062.           end
  1063.         end
  1064.         return
  1065.       when 1
  1066.         $game_system.se_play($data_system.decision_se)
  1067.         @command_window.active = false
  1068.         @target_window.visible = true
  1069.         @target_window.index = 0
  1070.         @target_window.active = true
  1071.       when 2
  1072.         $game_system.se_play($data_system.load_se)
  1073.         if @actor != nil
  1074.           @actor.items.delete_at(@item_window.index)
  1075.           @actor.judge_equip
  1076.         else
  1077.           if @item_window.item.is_a?(RPG::Item)
  1078.             $game_party.gain_item(@item_window.item.id,-1)
  1079.           end
  1080.           if @item_window.item.is_a?(RPG::Weapon)
  1081.             $game_party.gain_weapon(@item_window.item.id,-1)
  1082.           end
  1083.           if @item_window.item.is_a?(RPG::Armor)
  1084.             $game_party.gain_armor(@item_window.item.id,-1)
  1085.           end
  1086.         end
  1087.         # 切换到菜单画面
  1088.         @command_window.visible = false
  1089.         @command_window.active = false
  1090.         @item_window.refresh
  1091.         @item_window.active = true
  1092.       when 3
  1093.         if $game_party.item_full?
  1094.           $game_system.se_play($data_system.cancel_se)
  1095.           return
  1096.         end
  1097.         $game_system.se_play($data_system.decision_se)
  1098.         if @item_window.item.is_a?(RPG::Item)
  1099.           $game_party.gain_item(@item_window.item.id,1)
  1100.         end
  1101.         if @item_window.item.is_a?(RPG::Weapon)
  1102.           $game_party.gain_weapon(@item_window.item.id,1)
  1103.         end
  1104.         if @item_window.item.is_a?(RPG::Armor)
  1105.           $game_party.gain_armor(@item_window.item.id,1)
  1106.         end
  1107.         @actor.items.delete_at(@item_window.index)
  1108.         # 切换到菜单画面
  1109.         @command_window.visible = false
  1110.         @command_window.active = false
  1111.         @item_window.refresh
  1112.         @item_window.active = true
  1113.       end
  1114.     end
  1115.   end  
  1116.   #--------------------------------------------------------------------------
  1117.   # ● 刷新画面 (物品窗口被激活的情况下)
  1118.   #--------------------------------------------------------------------------
  1119.   def update_item
  1120.     # 按下 B 键的情况下
  1121.     if Input.trigger?(Input::B)
  1122.       # 演奏取消 SE
  1123.       $game_system.se_play($data_system.cancel_se)
  1124.       # 切换到菜单画面
  1125.       $scene = Scene_Menu.new(0)
  1126.       return
  1127.     end
  1128.     # 按下 C 键的情况下
  1129.     if Input.trigger?(Input::C)
  1130.       # 获取物品窗口当前选中的物品数据
  1131.       @item = @item_window.item
  1132.       $game_system.se_play($data_system.decision_se)
  1133.       if @item.is_a?(RPG::Item) and $game_party.item_can_use?(@item.id) and @actor != nil
  1134.         @command_window.enable_item(0)
  1135.       else
  1136.         @command_window.disable_item(0)
  1137.       end
  1138.       @command_window.index = 0
  1139.       @command_window.visible = true
  1140.       @command_window.active = true
  1141.       @item_window.active = false
  1142.       return
  1143.     end
  1144.     # 按下 R 键的情况下
  1145.     if Input.trigger?(Input::R)
  1146.       $game_system.se_play($data_system.cursor_se)
  1147.       actor_index = 0
  1148.       for i in 0...$game_party.actors.size
  1149.         if @actor==$game_party.actors[i]
  1150.           actor_index = i
  1151.           break
  1152.         end
  1153.       end
  1154.       actor_index += 1
  1155.       actor_index %= $game_party.actors.size
  1156.       # 切换到别的特技画面
  1157.       $scene = Scene_Item.new($game_party.actors[actor_index])
  1158.       return
  1159.     end
  1160.     # 按下 L 键的情况下
  1161.     if Input.trigger?(Input::L)
  1162.       # 演奏光标 SE
  1163.       $game_system.se_play($data_system.cursor_se)      
  1164.       actor_index = 0
  1165.       for i in 0...$game_party.actors.size
  1166.         if @actor==$game_party.actors[i]
  1167.           actor_index = i
  1168.           break
  1169.         end
  1170.       end
  1171.       actor_index -= 1
  1172.       actor_index %= $game_party.actors.size
  1173.       # 切换到别的特技画面
  1174.       $scene = Scene_Item.new($game_party.actors[actor_index])
  1175.       return
  1176.     end
  1177.   end
  1178.   #--------------------------------------------------------------------------
  1179.   # ● 刷新画面 (目标窗口被激活的情况下)
  1180.   #--------------------------------------------------------------------------
  1181.   def update_target
  1182.     # 按下 B 键的情况下
  1183.     if Input.trigger?(Input::B)
  1184.       # 演奏取消 SE
  1185.       $game_system.se_play($data_system.cancel_se)
  1186.       # 由于物品用完而不能使用的场合
  1187.       unless $game_party.item_can_use?(@item.id)
  1188.         # 再次生成物品窗口的内容
  1189.         @item_window.refresh
  1190.       end
  1191.       # 删除目标窗口
  1192.       @command_window.active = true
  1193.       @target_window.visible = false
  1194.       @target_window.active = false
  1195.       return
  1196.     end
  1197.     # 按下 C 键的情况下
  1198.     if Input.trigger?(Input::C)
  1199.       if @command_window.index==0
  1200.         # 目标是全体的情况下
  1201.         if @target_window.index == -1
  1202.           # 对同伴全体应用物品使用效果
  1203.           used = false
  1204.           for i in $game_party.actors
  1205.             used |= i.item_effect(@item)
  1206.           end
  1207.         end
  1208.         # 目标是单体的情况下
  1209.         if @target_window.index >= 0
  1210.           # 对目标角色应用物品的使用效果
  1211.           target = $game_party.actors[@target_window.index]
  1212.           used = target.item_effect(@item)
  1213.         end
  1214.         # 使用物品的情况下
  1215.         if used
  1216.           # 演奏物品使用时的 SE
  1217.           $game_system.se_play(@item.menu_se)
  1218.           # 消耗品的情况下
  1219.           if @item.consumable
  1220.  
  1221.             if @actor == nil
  1222.               # 使用的物品数减 1
  1223.               $game_party.lose_item(@item.id, 1)
  1224.             else
  1225.               @actor.items.delete_at(@item_window.index)
  1226.             end
  1227.  
  1228.             # 再描绘物品窗口的项目
  1229.             @item_window.draw_item(@item_window.index)
  1230.           end
  1231.           # 再生成目标窗口的内容
  1232.           @target_window.refresh
  1233.           # 全灭的情况下
  1234.           if $game_party.all_dead?
  1235.             # 切换到游戏结束画面
  1236.             $scene = Scene_Gameover.new
  1237.             return
  1238.           end
  1239.           # 公共事件 ID 有效的情况下
  1240.           if @item.common_event_id > 0
  1241.             # 预约调用公共事件
  1242.             $game_temp.common_event_id = @item.common_event_id
  1243.             # 切换到地图画面
  1244.             $scene = Scene_Map.new
  1245.             return
  1246.           end
  1247.           @item_window.refresh
  1248.           @item_window.index -= 1 if @item_window.index >0
  1249.         end
  1250.         # 无法使用物品的情况下
  1251.         unless used
  1252.           # 演奏冻结 SE
  1253.           $game_system.se_play($data_system.buzzer_se)
  1254.         end
  1255.         return
  1256.       end
  1257.       if @command_window.index==1
  1258.         if $game_party.actors[@target_window.index].item_full?
  1259.           $game_system.se_play($data_system.buzzer_se)
  1260.           return
  1261.         end
  1262.         if @actor != nil
  1263.           @actor.items.delete_at(@item_window.index)
  1264.         else
  1265.           if @item_window.item.is_a?(RPG::Item)
  1266.             $game_party.lose_item(@item_window.item.id, 1)
  1267.           elsif @item_window.item.is_a?(RPG::Weapon)
  1268.             $game_party.lose_weapon(@item_window.item.id, 1)
  1269.           elsif @item_window.item.is_a?(RPG::Armor)
  1270.             $game_party.lose_armor(@item_window.item.id, 1)
  1271.           end
  1272.         end
  1273.         $game_system.se_play($data_system.decision_se)
  1274.         $game_party.actors[@target_window.index].items.push(@item_window.item)
  1275.         @item_window.refresh
  1276.         @item_window.index -= 1 if @item_window.index>0
  1277.         @item_window.active = true
  1278.         @command_window.visible = false
  1279.         @command_window.active = false
  1280.         @command_window.index = 0
  1281.         @target_window.visible = false
  1282.         @target_window.active = false
  1283.       end
  1284.     end
  1285.   end
  1286. end
  1287.  
  1288. #==============================================================================
  1289. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  1290. # ■ 使用方法写在发布页
  1291. #==============================================================================
  1292. # ■ Scene_Battle (分割定义 3)
  1293. #------------------------------------------------------------------------------
  1294. #  处理战斗画面的类。
  1295. #==============================================================================
  1296.  
  1297. class Scene_Battle
  1298.   #--------------------------------------------------------------------------
  1299.   # ● 开始选择物品
  1300.   #--------------------------------------------------------------------------
  1301.   def start_item_select
  1302.     # 生成物品窗口
  1303.     @item_window = Window_Item.new($game_party.actors[@actor_index])
  1304.     # 关联帮助窗口
  1305.     @item_window.help_window = @help_window
  1306.     # 无效化角色指令窗口
  1307.     @actor_command_window.active = false
  1308.     @actor_command_window.visible = false
  1309.   end
  1310.   #--------------------------------------------------------------------------
  1311.   # ● 刷新画面 (角色命令回合 : 选择物品)
  1312.   #--------------------------------------------------------------------------
  1313.   def update_phase3_item_select
  1314.     # 设置物品窗口为可视状态
  1315.     @item_window.visible = true
  1316.     # 刷新物品窗口
  1317.     @item_window.update
  1318.     # 按下 B 键的情况下
  1319.     if Input.trigger?(Input::B)
  1320.       # 演奏取消 SE
  1321.       $game_system.se_play($data_system.cancel_se)
  1322.       # 选择物品结束
  1323.       end_item_select
  1324.       return
  1325.     end
  1326.     # 按下 C 键的情况下
  1327.     if Input.trigger?(Input::C)
  1328.       # 获取物品窗口现在选择的物品资料
  1329.       @item = @item_window.item
  1330.       unless @item.is_a?(RPG::Item)
  1331.         # 演奏冻结 SE
  1332.         $game_system.se_play($data_system.buzzer_se)
  1333.         return
  1334.       end
  1335.       # 无法使用的情况下
  1336.       unless $game_party.item_can_use?(@item.id)
  1337.         # 演奏冻结 SE
  1338.         $game_system.se_play($data_system.buzzer_se)
  1339.         return
  1340.       end
  1341.       # 演奏确定 SE
  1342.       $game_system.se_play($data_system.decision_se)
  1343.       # 设置行动
  1344.       @active_battler.current_action.item_id = @item.id
  1345.       # 设置物品窗口为不可见状态
  1346.       @item_window.visible = false
  1347.       # 效果范围是敌单体的情况下
  1348.       if @item.scope == 1
  1349.         # 开始选择敌人
  1350.         start_enemy_select
  1351.       # 效果范围是我方单体的情况下
  1352.       elsif @item.scope == 3 or @item.scope == 5
  1353.         # 开始选择角色
  1354.         start_actor_select
  1355.       # 效果范围不是单体的情况下
  1356.       else
  1357.         # 物品选择结束
  1358.         end_item_select
  1359.         # 转到下一位角色的指令输入
  1360.         phase3_next_actor
  1361.       end
  1362.       return
  1363.     end
  1364.   end
  1365. end
  1366.  
  1367. #==============================================================================
  1368. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  1369. # ■ 使用方法写在发布页
  1370. #==============================================================================
  1371. # ■ Scene_Shop
  1372. #------------------------------------------------------------------------------
  1373. #  处理商店画面的类。
  1374. #==============================================================================
  1375.  
  1376. class Scene_Shop
  1377.   #--------------------------------------------------------------------------
  1378.   # ● 主处理
  1379.   #--------------------------------------------------------------------------
  1380.   def main
  1381.  
  1382.     @type = 0   
  1383.  
  1384.     # 生成帮助窗口
  1385.     @help_window = Window_Help.new
  1386.     # 生成指令窗口
  1387.     @command_window = Window_ShopCommand.new
  1388.     # 生成金钱窗口
  1389.     @gold_window = Window_Gold.new
  1390.     @gold_window.x = 480
  1391.     @gold_window.y = 64
  1392.     # 生成时间窗口
  1393.     @dummy_window = Window_Base.new(0, 128, 640, 352)
  1394.     # 生成购买窗口
  1395.     @buy_window = Window_ShopBuy.new($game_temp.shop_goods)
  1396.     @buy_window.active = false
  1397.     @buy_window.visible = false
  1398.     @buy_window.help_window = @help_window
  1399.     # 生成卖出窗口
  1400.     @sell_window = Window_ShopSell.new
  1401.     @sell_window.active = false
  1402.     @sell_window.visible = false
  1403.     @sell_window.help_window = @help_window
  1404.     # 生成状态窗口
  1405.     @status_window = Window_ShopStatus_New.new
  1406.     @status_window.visible = false
  1407.     @status_window.index = -1
  1408.     # 执行过渡
  1409.     Graphics.transition
  1410.     # 主循环
  1411.     loop do
  1412.       # 刷新游戏画面
  1413.       Graphics.update
  1414.       # 刷新输入信息
  1415.       Input.update
  1416.       # 刷新画面
  1417.       update
  1418.       # 如果画面切换的话就中断循环
  1419.       if $scene != self
  1420.         break
  1421.       end
  1422.     end
  1423.     # 准备过渡
  1424.     Graphics.freeze
  1425.     # 释放窗口
  1426.     @help_window.dispose
  1427.     @command_window.dispose
  1428.     @gold_window.dispose
  1429.     @dummy_window.dispose
  1430.     @buy_window.dispose
  1431.     @sell_window.dispose
  1432.     @status_window.dispose
  1433.   end
  1434.   #--------------------------------------------------------------------------
  1435.   # ● 刷新画面
  1436.   #--------------------------------------------------------------------------
  1437.   def update
  1438.     # 刷新窗口
  1439.     @help_window.update
  1440.     @command_window.update
  1441.     @gold_window.update
  1442.     @dummy_window.update
  1443.     @buy_window.update
  1444.     @sell_window.update
  1445.     @status_window.update
  1446.     # 指令窗口激活的情况下: 调用 update_command
  1447.     if @command_window.active
  1448.       update_command
  1449.       return
  1450.     end
  1451.     # 购买窗口激活的情况下: 调用 update_buy
  1452.     if @buy_window.active
  1453.       update_buy
  1454.       return
  1455.     end
  1456.     # 卖出窗口激活的情况下: 调用 update_sell
  1457.     if @sell_window.active
  1458.       update_sell
  1459.       return
  1460.     end
  1461.     if @type==1
  1462.       update_st1
  1463.       return
  1464.     end
  1465.   end
  1466.  
  1467.   def update_st1
  1468.     if Input.trigger?(Input::B)
  1469.       $game_system.se_play($data_system.cancel_se)
  1470.       @buy_window.active = true
  1471.       @type = 0
  1472.       @status_window.index = -1
  1473.       @status_window.active = false
  1474.       return
  1475.     end
  1476.     if Input.trigger?(Input::C)
  1477.       if @status_window.index == 0        
  1478.         if $game_party.item_full?
  1479.           $game_system.se_play($data_system.cancel_se)
  1480.           return
  1481.         end        
  1482.         # 演奏商店 SE
  1483.         $game_system.se_play($data_system.shop_se)
  1484.         $game_party.lose_gold(@item.price)
  1485.         case @item
  1486.         when RPG::Item
  1487.           $game_party.gain_item(@item.id, 1)
  1488.         when RPG::Weapon
  1489.           $game_party.gain_weapon(@item.id, 1)
  1490.         when RPG::Armor
  1491.           $game_party.gain_armor(@item.id, 1)
  1492.         end
  1493.         # 刷新各窗口
  1494.         @gold_window.refresh
  1495.         @buy_window.refresh
  1496.         @status_window.refresh
  1497.         # 窗口状态转向购买模式
  1498.         @buy_window.active = true
  1499.         @buy_window.visible = true
  1500.         @status_window.active = false
  1501.         @status_window.index = -1
  1502.         @type = 0
  1503.       else
  1504.         if $game_party.actors[@status_window.index-1].item_full?
  1505.           $game_system.se_play($data_system.cancel_se)
  1506.           return
  1507.         end        
  1508.         # 演奏商店 SE
  1509.         $game_system.se_play($data_system.shop_se)
  1510.         $game_party.lose_gold(@item.price)
  1511.         case @item
  1512.         when RPG::Item
  1513.           $game_party.actors[@status_window.index-1].gain_item(@item.id, 1)
  1514.         when RPG::Weapon
  1515.           $game_party.actors[@status_window.index-1].gain_item(@item.id, 2)
  1516.         when RPG::Armor
  1517.           $game_party.actors[@status_window.index-1].gain_item(@item.id, 3)
  1518.         end
  1519.         # 刷新各窗口
  1520.         @gold_window.refresh
  1521.         @buy_window.refresh
  1522.         @status_window.refresh
  1523.         # 窗口状态转向购买模式
  1524.         @buy_window.active = true
  1525.         @status_window.active = false
  1526.         @type = 0
  1527.         @status_window.index = -1
  1528.       end
  1529.     end
  1530.   end
  1531.   #--------------------------------------------------------------------------
  1532.   # ● 刷新画面 (指令窗口激活的情况下)
  1533.   #--------------------------------------------------------------------------
  1534.   def update_command
  1535.     # 按下 B 键的情况下
  1536.     if Input.trigger?(Input::B)
  1537.       # 演奏取消 SE
  1538.       $game_system.se_play($data_system.cancel_se)
  1539.       # 切换到地图画面
  1540.       $scene = Scene_Map.new
  1541.       return
  1542.     end
  1543.     # 按下 C 键的情况下
  1544.     if Input.trigger?(Input::C)
  1545.       # 命令窗口光标位置分支
  1546.       case @command_window.index
  1547.       when 0  # 购买
  1548.         # 演奏确定 SE
  1549.         $game_system.se_play($data_system.decision_se)
  1550.         # 窗口状态转向购买模式
  1551.         @command_window.active = false
  1552.         @dummy_window.visible = false
  1553.         @buy_window.active = true
  1554.         @buy_window.visible = true
  1555.         @buy_window.refresh
  1556.         @status_window.visible = true
  1557.       when 1  # 卖出
  1558.         # 演奏确定 SE
  1559.         $game_system.se_play($data_system.decision_se)
  1560.         # 窗口状态转向卖出模式
  1561.         @command_window.active = false
  1562.         @dummy_window.visible = false
  1563.         @sell_window.active = true
  1564.         @sell_window.visible = true
  1565.         @sell_window.refresh
  1566.       when 2  # 取消
  1567.         # 演奏确定 SE
  1568.         $game_system.se_play($data_system.decision_se)
  1569.         # 切换到地图画面
  1570.         $scene = Scene_Map.new
  1571.       end
  1572.       return
  1573.     end
  1574.   end
  1575.   #--------------------------------------------------------------------------
  1576.   # ● 刷新画面 (购买窗口激活的情况下)
  1577.   #--------------------------------------------------------------------------
  1578.   def update_buy
  1579.     # 设置状态窗口的物品
  1580.     @status_window.item = @buy_window.item
  1581.     # 按下 B 键的情况下
  1582.     if Input.trigger?(Input::B)
  1583.       # 演奏取消 SE
  1584.       $game_system.se_play($data_system.cancel_se)
  1585.       # 窗口状态转向初期模式
  1586.       @command_window.active = true
  1587.       @dummy_window.visible = true
  1588.       @buy_window.active = false
  1589.       @buy_window.visible = false
  1590.       @status_window.visible = false
  1591.       @status_window.item = nil
  1592.       # 删除帮助文本
  1593.       @help_window.set_text("")
  1594.       return
  1595.     end
  1596.     # 按下 C 键的情况下
  1597.     if Input.trigger?(Input::C)
  1598.       # 获取物品
  1599.       @item = @buy_window.item
  1600.       # 物品无效的情况下、或者价格在所持金以上的情况下
  1601.       if @item == nil or @item.price > $game_party.gold
  1602.         # 演奏冻结 SE
  1603.         $game_system.se_play($data_system.buzzer_se)
  1604.         return
  1605.       end
  1606.       # 获取物品所持数
  1607.       #case @item
  1608.       #when RPG::Item
  1609.         #number = $game_party.item_number(@item.id)
  1610.       #when RPG::Weapon
  1611.         #number = $game_party.weapon_number(@item.id)
  1612.       #when RPG::Armor
  1613.         #number = $game_party.armor_number(@item.id)
  1614.       #end
  1615.       # 如果已经拥有了 99 个情况下
  1616.       #if number == 99
  1617.         # 演奏冻结 SE
  1618.         #$game_system.se_play($data_system.buzzer_se)
  1619.         #return
  1620.       #end
  1621.       # 演奏确定 SE
  1622.       $game_system.se_play($data_system.decision_se)
  1623.       # 计算可以最多购买的数量
  1624.       #max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  1625.       #max = [max, 99 - number].min
  1626.       # 窗口状态转向数值输入模式
  1627.       #@buy_window.active = false
  1628.       #@buy_window.visible = false
  1629.       #@number_window.set(@item, max, @item.price)
  1630.       #@number_window.active = true
  1631.       #@number_window.visible = true
  1632.       @buy_window.active = false
  1633.       @status_window.index = 0
  1634.       @type = 1
  1635.       @status_window.active = true
  1636.     end
  1637.   end
  1638.   #--------------------------------------------------------------------------
  1639.   # ● 画面更新 (卖出窗口激活的情况下)
  1640.   #--------------------------------------------------------------------------
  1641.   def update_sell
  1642.     # 按下 B 键的情况下
  1643.     if Input.trigger?(Input::B)
  1644.       # 演奏取消 SE
  1645.       $game_system.se_play($data_system.cancel_se)
  1646.       # 窗口状态转向初期模式
  1647.       @command_window.active = true
  1648.       @dummy_window.visible = true
  1649.       @sell_window.active = false
  1650.       @sell_window.visible = false
  1651.       @status_window.item = nil
  1652.       # 删除帮助文本
  1653.       @help_window.set_text("")
  1654.       return
  1655.     end
  1656.     # 按下 C 键的情况下
  1657.     if Input.trigger?(Input::C)
  1658.       # 获取物品
  1659.       @item = @sell_window.item
  1660.       # 设置状态窗口的物品
  1661.       @status_window.item = @item
  1662.       # 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
  1663.       if @item == nil or @item.price == 0
  1664.         # 演奏冻结 SE
  1665.         $game_system.se_play($data_system.buzzer_se)
  1666.         return
  1667.       end
  1668.       # 演奏确定 SE
  1669.       $game_system.se_play($data_system.decision_se)      
  1670.       # 卖出处理
  1671.       $game_party.gain_gold(@item.price / 2)
  1672.       case @item
  1673.       when RPG::Item
  1674.         $game_party.lose_item(@item.id, 1)
  1675.       when RPG::Weapon
  1676.         $game_party.lose_weapon(@item.id, 1)
  1677.       when RPG::Armor
  1678.         $game_party.lose_armor(@item.id, 1)
  1679.       end
  1680.       # 刷新各窗口
  1681.       @gold_window.refresh
  1682.       @sell_window.refresh
  1683.       @status_window.refresh
  1684.     end
  1685.   end
  1686. end


物品詳細幫助窗口
RUBY 代码复制
  1. #==============================================================================
  2. # 禾西製作 / Created by Quarcy
  3. #==============================================================================
  4. class Window_Help < Window_Base
  5.   attr_reader :materia
  6.   #--------------------------------------------------------------------------
  7.   # ● 定義不顯示的屬性與狀態
  8.   #--------------------------------------------------------------------------
  9.   def unshown
  10.     @unshow_elements = [23,24]
  11.     @unshow_states = []
  12.   end
  13.   #--------------------------------------------------------------------------
  14.   # ● 初始化對象
  15.   #--------------------------------------------------------------------------
  16.   def initialize
  17.     super(0, 0, 640, 64)
  18.     self.opacity = 225
  19.     self.z=150
  20.     self.visible = false
  21.     unless $scene.is_a?Scene_Shop or $scene.is_a?Scene_Battle or $scene.is_a?Scene_Item or $scene.is_a?Scene_Equip
  22.     self.opacity = 0
  23.     end
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 設置文本
  27.   #     data  : 窗口顯示的字符串/物品資料
  28.   #     align : 對齊方式 (0..左對齊、1..中間對齊、2..右對齊)
  29.   #--------------------------------------------------------------------------
  30.   def set_text(data, align=0)
  31.     #------------------------------------------------------------------------
  32.     # ● 當資料爲文字時候
  33.     #------------------------------------------------------------------------
  34.     # 如果文本或對齊方式至少一方与上次的不同
  35.     if data != @text or align != @align
  36.       if data.is_a?(String)
  37.         # 再描繪文本
  38.         self.width = 640
  39.         self.height = 64
  40.         self.x=0
  41.         self.y=0
  42.         self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil?
  43.         self.contents.clear
  44.         self.contents.font.color = normal_color
  45.         self.contents.font.size = 20
  46.         self.contents.draw_text(4, 0, self.width - 40, 32, data, align)
  47.         @text = data
  48.         @align = align
  49.         @actor = nil
  50.         self.visible = true
  51.       end
  52.     end
  53.     return if data.is_a?(String)
  54.     #------------------------------------------------------------------------
  55.     # ● 當沒有資料時候
  56.     #------------------------------------------------------------------------
  57.     if data.nil?
  58.       self.visible=false
  59.     else
  60.       self.visible=true
  61.     end
  62.     #------------------------------------------------------------------------
  63.     # ● 當資料爲物品/技能時候
  64.     #------------------------------------------------------------------------
  65.     if data != nil && @data != data
  66.       self.width = 210
  67.       self.height = 430
  68.       self.x=0
  69.       self.y=200
  70.       unshown
  71.       non_auto_update(data)
  72.     else
  73.       return
  74.     end
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 更新帮助窗口
  78.   #--------------------------------------------------------------------------
  79.   def non_auto_update(data=@data)
  80.     @data = data
  81.     case @data
  82.     when RPG::Item
  83.       set_item_text(@data)
  84.     when RPG::Weapon
  85.       set_equipment_text(@data)
  86.     when RPG::Armor
  87.       set_equipment_text(@data)
  88.     end
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ● 裝備帮助窗口
  92.   #--------------------------------------------------------------------------
  93.   def set_equipment_text(equipment)
  94.     #------------------------------------------------------------------------
  95.     # ● 取得基本質料
  96.     #------------------------------------------------------------------------
  97.     # 取得屬性、附加狀態、解除狀態之副本
  98.     case equipment
  99.     when RPG::Weapon
  100.       element_set = equipment.element_set.clone
  101.       plus_state_set = equipment.plus_state_set.clone
  102.       minus_state_set = equipment.minus_state_set.clone
  103.       #----------------------#
  104.       # 過濾不顯示的狀態描述 #
  105.       #----------------------#
  106.       plus_state_set -= @unshow_states
  107.       minus_state_set -= @unshow_states
  108.     when RPG::Armor
  109.       element_set = equipment.guard_element_set.clone
  110.       guard_state_set = equipment.guard_state_set.clone
  111.       #----------------------#
  112.       # 過濾不顯示的狀態描述 #
  113.       #----------------------#
  114.       auto_state_id = equipment.auto_state_id
  115.       guard_state_set -= @unshow_states
  116.     end
  117.     #----------------------#
  118.     # 過濾不顯示的屬性描述 #
  119.     #----------------------#
  120.     element_set -= @unshow_elements
  121.     #--------------#
  122.     # 取得說明文字 #
  123.     #--------------#
  124.     description = equipment.description.clone
  125.     # 初始化數據設定
  126.     x = 0
  127.     y = 0
  128.     h = 0
  129.     phrase = {}
  130.  
  131.     # 基本文字設定
  132.     phrase["price"] = "价格:"
  133.     phrase["elements"] = "属性:"
  134.     phrase["minus_states"] = "解除状态:"
  135.     phrase["plus_states"] = "附加状态:"
  136.     phrase["guard_elements"] = "防御属性"
  137.     phrase["guard_states"] = "防御状态"
  138.     phrase["auto_state"] = "附加:"
  139.     phrase["hp-max"] = "HP MAX:"
  140.  
  141.     # 基本數據設定
  142. =begin
  143.     name_size = 名字文字大小
  144.     size = 描述文字大小
  145.     word = 每行的描述文字數
  146.     move = 全體描述偏移幅度
  147. =end
  148.     name_size = 18
  149.     size = 14
  150.     word = 12
  151.     move = 80
  152.     #------------------------------------------------------------------------
  153.     # ● 確定背景圖片的高度
  154.     #------------------------------------------------------------------------
  155.     h += (description.size/3/word)
  156.     h += 1 if (description.size/3%word) > 0
  157.     h += 1 if equipment.is_a?(RPG::Weapon)
  158.     now_h = h
  159.     h += 1
  160.     h += 1 unless equipment.pdef.zero?
  161.     h += 1 unless equipment.mdef.zero?
  162.     h += 1 if element_set.size > 0
  163.     h += 1 if element_set.size >= 5
  164.     case equipment
  165.     when RPG::Weapon
  166.       h += 1 unless minus_state_set.empty?
  167.       h += minus_state_set.size
  168.       h += 1 unless plus_state_set.empty?
  169.       h += plus_state_set.size
  170.     when RPG::Armor
  171.       h += 1 unless guard_state_set.empty?
  172.       h += guard_state_set.size
  173.       h += 1 unless auto_state_id.zero?
  174.     end
  175.     h += 1
  176.     h += 1 unless equipment.str_plus.zero?
  177.     h += 1 unless equipment.dex_plus.zero?
  178.     h += 1 unless equipment.agi_plus.zero?
  179.     h += 1 unless equipment.int_plus.zero?
  180.     #h += 1 unless equipment.hp_plus.zero?
  181.     h += materia_height_plus(equipment) unless self.materia.nil?
  182.     #------------------------------------------------------------------------
  183.     # ● 圖片顯示保證高度
  184.     #------------------------------------------------------------------------
  185.     h = 6 + now_h if (h - now_h) < 6
  186.     #------------------------------------------------------------------------
  187.     # ● 換算高度
  188.     #------------------------------------------------------------------------
  189.     self.height = h * size + name_size + 100
  190.     #------------------------------------------------------------------------
  191.     # ● 生成背景
  192.     #------------------------------------------------------------------------
  193.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  194.     self.contents.clear
  195.     #------------------------------------------------------------------------
  196.     # ● 名字描繪
  197.     #------------------------------------------------------------------------
  198.     text = equipment.name
  199.     self.contents.font.color = text_color(1)#(equipment.name_color)
  200.     self.contents.font.size = name_size
  201.     if text.nil?
  202.       self.visible = false
  203.     else
  204.       self.visible = true
  205.       self.contents.draw_text(0, 0, text.size*7, name_size, text, 0)
  206.     end
  207.     #------------------------------------------------------------------------
  208.     # ● 說明描繪
  209.     #------------------------------------------------------------------------
  210.     x = 0
  211.     y += 1
  212.     while ((text = description.slice!(/./m)) != nil)
  213.       self.contents.font.color = system_color
  214.       self.contents.font.size = size
  215.       self.contents.draw_text(x*size, y*size+5, size, size, text, 0)
  216.       x+=1
  217.       if x == word
  218.         x=0
  219.         y+=1   
  220.       end
  221.     end
  222.     #------------------------------------------------------------------------
  223.     # ● 圖標描繪
  224.     #------------------------------------------------------------------------
  225.     bitmap = RPG::Cache.icon(equipment.icon_name)
  226.     opacity = self.contents.font.color == normal_color ? 255 : 128
  227.     self.contents.blt(0 ,y*size + 20, bitmap, Rect.new(0, 0, 95, 100), 225)
  228.     #------------------------------------------------------------------------
  229.     # ● 攻擊力描繪(武器)
  230.     #------------------------------------------------------------------------
  231.     if equipment.is_a?(RPG::Weapon)
  232.       x = 0
  233.       y += 1
  234.       text = $data_system.words.atk+":"+equipment.atk.to_s
  235.       self.contents.font.color = Color.new(255, 0, 0, 255)
  236.       self.contents.font.size = size
  237.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  238.     end
  239.     #------------------------------------------------------------------------
  240.     # ● 價格描繪
  241.     #------------------------------------------------------------------------
  242.     x = 0
  243.     y += 1
  244.     text = phrase["price"] + equipment.price.to_s
  245.     self.contents.font.color = Color.new(255, 255, 0, 255)
  246.     self.contents.font.size = size
  247.     self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  248.     #------------------------------------------------------------------------
  249.     # ● 物理防禦
  250.     #------------------------------------------------------------------------
  251.     unless equipment.pdef.zero?
  252.       x = 0
  253.       y += 1
  254.       text = $data_system.words.pdef+":"+equipment.pdef.to_s
  255.       self.contents.font.color = Color.new(0, 255, 255, 255)
  256.       self.contents.font.size = size
  257.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  258.     end
  259.     #------------------------------------------------------------------------
  260.     # ● 魔法防禦
  261.     #------------------------------------------------------------------------
  262.     unless equipment.mdef.zero?
  263.       x = 0
  264.       y += 1
  265.       text=$data_system.words.mdef+":"+equipment.mdef.to_s
  266.       self.contents.font.color = Color.new(255, 0, 255, 255)
  267.       self.contents.font.size = size
  268.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  269.     end
  270.     #------------------------------------------------------------------------
  271.     # ● 屬性
  272.     #------------------------------------------------------------------------
  273. #------------------------------------------------------------------------
  274.     # ● 屬性
  275.     #------------------------------------------------------------------------
  276.     if element_set.size > 0
  277.       x = 0
  278.       y += 1
  279.       text = phrase["elements"]
  280.       self.contents.font.size = size
  281.       self.contents.font.color = Color.new(255, 0, 255, 255)
  282.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  283.       ax = (phrase["elements"].size)*5+40
  284.       for i in 0...element_set.size
  285.         text = $data_system.elements[element_set[i]]
  286.         self.contents.draw_text(ax, y*size+18, text.size*6, size, text, 0)
  287.         y += 1
  288.       end
  289.     end
  290.     #------------------------------------------------------------------------
  291.     # ● 描述分流 武器/防具
  292.     #------------------------------------------------------------------------
  293.     case equipment
  294.     when RPG::Weapon
  295.       #------------------------------------------------------------------------
  296.       # ● 解除狀態(武器)
  297.       #------------------------------------------------------------------------
  298.       unless minus_state_set.empty?
  299.         x = 0
  300.         y += 1
  301.         text=phrase["minus_states"]
  302.         text=phrase["guard_states"]
  303.         self.contents.font.color = Color.new(0, 255, 255, 255)
  304.         self.contents.font.size = size
  305.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  306.         for i in 0...minus_state_set.size
  307.           y += 1
  308.           text = $data_states[minus_state_set[i]].name        
  309.           self.contents.font.color = Color.new(0, 255, 255, 255)
  310.           self.contents.font.size = size
  311.           self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)        
  312.         end
  313.       end
  314.       #------------------------------------------------------------------------
  315.       # ● 附加狀態(武器)
  316.       #------------------------------------------------------------------------
  317.       unless plus_state_set.empty?
  318.         x = 0
  319.         y += 1
  320.         text = phrase["plus_states"]
  321.         self.contents.font.color = Color.new(255, 0, 0, 255)
  322.         self.contents.font.size = size
  323.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  324.         for i in 0...plus_state_set.size
  325.           y += 1
  326.           text=$data_states[plus_state_set[i]].name        
  327.           self.contents.font.color = Color.new(255, 0, 0, 255)
  328.           self.contents.font.size = size
  329.           self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)        
  330.         end  
  331.       end
  332.     when RPG::Armor
  333.       #------------------------------------------------------------------------
  334.       # ● 防禦狀態(防具)
  335.       #------------------------------------------------------------------------
  336.       unless guard_state_set.empty?
  337.         x = 0
  338.         y += 1
  339.         text=phrase["guard_states"]
  340.         self.contents.font.color = Color.new(0, 255, 0, 255)
  341.         self.contents.font.size = size
  342.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  343.         for i in 0...guard_state_set.size
  344.           y += 1
  345.           text = $data_states[guard_state_set[i]].name        
  346.           self.contents.font.color = Color.new(0, 255, 0, 255)
  347.           self.contents.font.size = size
  348.           self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)        
  349.         end
  350.       end
  351.       #------------------------------------------------------------------------
  352.       # ● 自動狀態(防具)
  353.       #------------------------------------------------------------------------
  354.       unless auto_state_id.zero?
  355.         x = 0
  356.         y += 1
  357.         text = phrase["auto_state"] + $data_states[auto_state_id].name
  358.         self.contents.font.color = Color.new(0, 255, 0, 255)
  359.         self.contents.font.size = size
  360.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  361.       end
  362.     end
  363.     #------------------------------------------------------------------------
  364.     # ● 空行
  365.     #------------------------------------------------------------------------
  366.     y+=1
  367.     #------------------------------------------------------------------------
  368.     # ● 力量
  369.     #------------------------------------------------------------------------
  370.     unless equipment.str_plus.zero?
  371.       x = 0
  372.       y += 1
  373.       h += 1
  374.       if equipment.str_plus > 0
  375.         text=$data_system.words.str+" +"+ equipment.str_plus.to_s
  376.       else
  377.         text=$data_system.words.str+" -"+ (-equipment.str_plus).to_s
  378.       end
  379.       self.contents.font.color = Color.new(255, 0, 0, 255)
  380.       self.contents.font.size = size
  381.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)  
  382.     end
  383.     #------------------------------------------------------------------------
  384.     # ● 靈巧
  385.     #------------------------------------------------------------------------
  386.     unless equipment.dex_plus.zero?
  387.       x = 0
  388.       y += 1
  389.       h += 1
  390.       if equipment.dex_plus > 0
  391.         text=$data_system.words.dex+" +"+ equipment.dex_plus.to_s
  392.       else
  393.         text=$data_system.words.dex+" -"+ (-equipment.dex_plus).to_s
  394.       end
  395.       self.contents.font.color = Color.new(255, 255, 0, 255)
  396.       self.contents.font.size = size
  397.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  398.     end
  399.     #------------------------------------------------------------------------
  400.     # ● 速度
  401.     #------------------------------------------------------------------------
  402.     unless equipment.agi_plus.zero?
  403.       x = 0
  404.       y += 1
  405.       h += 1
  406.       if equipment.agi_plus > 0
  407.         text=$data_system.words.agi+" +"+ equipment.agi_plus.to_s
  408.       else
  409.         text=$data_system.words.agi+" -"+ (-equipment.agi_plus).to_s
  410.       end
  411.       self.contents.font.color = Color.new(0, 255, 255, 255)
  412.       self.contents.font.size = size
  413.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  414.     end
  415.     #------------------------------------------------------------------------
  416.     # ● 智力
  417.     #------------------------------------------------------------------------
  418.     unless equipment.int_plus.zero?
  419.       x = 0
  420.       y += 1
  421.       h += 1
  422.       if equipment.int_plus > 0
  423.         text=$data_system.words.int+" +"+ equipment.int_plus.to_s
  424.       else
  425.         text=$data_system.words.int+" -"+ (-equipment.int_plus).to_s
  426.       end
  427.       self.contents.font.color = Color.new(255, 0, 255, 255)
  428.       self.contents.font.size = size
  429.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  430.     end
  431.     #------------------------------------------------------------------------
  432.     # ● HP MAX增加值
  433.     #------------------------------------------------------------------------
  434.     #unless equipment.hp_plus.zero?
  435.     #  x = 0
  436.     #  y += 1
  437.     #  h += 1
  438.     #  if equipment.hp_plus > 0
  439.     #    text=phrase["hp-max"]+" +"+ equipment.hp_plus.to_s
  440.     #  else
  441.     #    text=phrase["hp-max"]+" -"+ (-equipment.hp_plus).to_s
  442.     #  end
  443.     #  self.contents.font.color = normal_color
  444.      # self.contents.font.size = size
  445.      # self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  446.     #end
  447.     #------------------------------------------------------------------------
  448.     # ● 魔力石描繪
  449.     #------------------------------------------------------------------------
  450.     y += draw_materia(equipment, move, y, size) unless self.materia.nil?
  451.   end
  452.   #--------------------------------------------------------------------------
  453.   # ● 物品幫助窗口
  454.   #--------------------------------------------------------------------------
  455.   def set_item_text(item)
  456.     # 取得描述
  457.     description = item.description.clone
  458.     # 取得屬性、附加狀態、解除狀態之副本
  459.     element_set = item.element_set.clone
  460.     plus_state_set = item.plus_state_set.clone
  461.     minus_state_set = item.minus_state_set.clone
  462.     # 過濾不顯示的描述
  463.     element_set -= @unshow_elements
  464.     plus_state_set -= @unshow_states
  465.     minus_state_set -= @unshow_states
  466.     # 初始化數據設定
  467.     x = 0
  468.     y = 0
  469.     h = 0
  470.     phrase = {}
  471.     scope ={}
  472.     parameter_type = {}
  473.  
  474.     # 基本數據設定
  475. =begin
  476.     name_size = 名字文字大小
  477.     size = 描述文字大小
  478.     word = 每行的描述文字數
  479.     move = 全體描述偏移幅度
  480. =end
  481.     name_size = 18
  482.     size = 14
  483.     word = 12
  484.     move = 80
  485.  
  486.     # 基本文字設定
  487.     phrase["scope"] = "范围:"
  488.     phrase["price"] = "价格:"
  489.     phrase["recover_hp_rate"] = "HP 回复率:"
  490.     phrase["recover_hp"] = "HP 回复:"
  491.     phrase["recover_sp_rate"] = "SP 回复率:"
  492.     phrase["recover_sp"] = "SP 回复:"
  493.     phrase["elements"] = "属性:"
  494.     phrase["plus"] = "附加"
  495.     phrase["minus"] = "解除"
  496.     phrase["states"] = "状态"
  497.     scope[0] = "特殊物品"
  498.     scope[1] = "敌单体"
  499.     scope[2] = "敌全体"
  500.     scope[3] = "己方单体"
  501.     scope[4] = "己方全体"
  502.     scope[5] = "己方单体(HP=0)"
  503.     scope[6] = "己方全体(HP=0)"
  504.     scope[7] = "使用者"
  505.     scope[8] = "使用者"
  506.  
  507.     parameter_type[1] = "MaxHP"
  508.     parameter_type[2] = "MaxSP"
  509.     parameter_type[3] = $data_system.words.str
  510.     parameter_type[4] = $data_system.words.dex
  511.     parameter_type[5] = $data_system.words.agi
  512.     parameter_type[6] = $data_system.words.int
  513.  
  514.     #依顯示内容確定自身高
  515.     h = (description.size/3/word)
  516.     h +=1 if (description.size/3%word)> 0
  517.     now_h = h
  518.     h +=3  # 空行,效果範圍,價格
  519.     h += 1 unless item.recover_hp_rate.zero?
  520.     h += 1 unless item.recover_hp.zero?
  521.     h += 1 unless item.recover_sp_rate.zero?
  522.     h += 1 unless item.recover_sp.zero?
  523.     h += 1 unless item.parameter_type.zero?
  524.     h += 1 unless element_set[0].nil?
  525.     h += 1 unless element_set[4].nil?
  526.     h += (1+plus_state_set.size) unless plus_state_set.empty?
  527.     h += (1+minus_state_set.size) unless minus_state_set.empty?
  528.     #------------------------------------------------------------------------
  529.     # ● 圖片顯示保證高度
  530.     #------------------------------------------------------------------------
  531.     h = 6 + now_h if (h - now_h) < 6
  532.     #------------------------------------------------------------------------
  533.     # ● 換算高度
  534.     #------------------------------------------------------------------------
  535.     self.height = h * size + name_size + 32
  536.     #------------------------------------------------------------------------
  537.     # ● 生成背景
  538.     #------------------------------------------------------------------------
  539.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  540.     self.contents.clear
  541.     #------------------------------------------------------------------------
  542.     # ● 名字描繪
  543.     #------------------------------------------------------------------------
  544.     text = item.name
  545.     self.contents.font.color = Color.new(0, 0, 255, 255)
  546.     self.contents.font.size = name_size
  547.     if text.nil?
  548.       self.visible = false
  549.     else
  550.       self.visible = true
  551.       self.contents.draw_text(0,0, text.size*7, 20, text, 0)
  552.     end
  553.     #------------------------------------------------------------------------
  554.     # ● 說明描繪
  555.     #------------------------------------------------------------------------
  556.     x = 0
  557.     y += 1
  558.     while ((text = description.slice!(/./m)) != nil)
  559.       self.contents.font.color = system_color
  560.       self.contents.font.size = size
  561.       self.contents.draw_text(x*size, y*size+5, size, size, text, 0)
  562.       x+=1
  563.       if x == word
  564.         x = 0
  565.         y += 1
  566.       end
  567.     end
  568.     #------------------------------------------------------------------------
  569.     # ● 圖標描繪
  570.     #------------------------------------------------------------------------
  571.     bitmap = RPG::Cache.icon(item.icon_name) unless item.icon_name.nil?
  572.     opacity = self.contents.font.color == normal_color ? 255 : 128
  573.     self.contents.blt(0 ,y*size + 20, bitmap, Rect.new(0, 0, 95, 100), 225)
  574.     #------------------------------------------------------------------------
  575.     # ● 魔力石接口
  576.     #------------------------------------------------------------------------
  577.     unless self.materia.nil?
  578.       return if is_materia?(item)
  579.     end
  580.     #------------------------------------------------------------------------
  581.     # ● 效果範圍
  582.     #------------------------------------------------------------------------
  583.     text= phrase["scope"] + scope[item.scope]
  584.     x = 0
  585.     y += 1
  586.     self.contents.font.color = normal_color
  587.     self.contents.font.size = size
  588.     self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  589.     #------------------------------------------------------------------------
  590.     # ● 價格
  591.     #------------------------------------------------------------------------
  592.     x = 0
  593.     y += 1      
  594.     text = phrase["price"] + item.price.to_s
  595.     self.contents.font.color = Color.new(255, 255, 0, 255)
  596.     self.contents.font.size = size
  597.     self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  598.  
  599.     #------------------------------------------------------------------------
  600.     # ● HP回復率
  601.     #------------------------------------------------------------------------
  602.     unless item.recover_hp_rate.zero?  
  603.       x = 0
  604.       y += 1
  605.       text = phrase["recover_hp_rate"] + item.recover_hp_rate.to_s+"%"
  606.       self.contents.font.color = Color.new(255, 0, 0, 255)
  607.       self.contents.font.size = size
  608.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)   
  609.     end
  610.     #------------------------------------------------------------------------
  611.     # ● HP回復量
  612.     #------------------------------------------------------------------------
  613.     unless item.recover_hp.zero?  
  614.       x = 0
  615.       y += 1      
  616.       text = phrase["recover_hp"] + item.recover_hp.to_s
  617.       self.contents.font.color = Color.new(255, 0, 100, 255)
  618.       self.contents.font.size = size
  619.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  620.     end
  621.     #------------------------------------------------------------------------
  622.     # ● SP回復率
  623.     #------------------------------------------------------------------------
  624.     unless item.recover_sp_rate.zero?
  625.       x = 0
  626.       y += 1      
  627.       text = phrase["recover_sp_rate"] + item.recover_sp_rate.to_s+"%"
  628.       self.contents.font.color = Color.new(0, 0, 255, 255)
  629.       self.contents.font.size = size
  630.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  631.     end
  632.     #------------------------------------------------------------------------
  633.     # ● SP回復量
  634.     #------------------------------------------------------------------------
  635.     unless item.recover_sp.zero?  
  636.       x = 0
  637.       y += 1      
  638.       text = phrase["recover_sp"] + item.recover_sp.to_s
  639.       self.contents.font.color = Color.new(0, 100, 255, 255)
  640.       self.contents.font.size = size
  641.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  642.     end
  643.     #------------------------------------------------------------------------
  644.     # ● 能力值增加
  645.     #------------------------------------------------------------------------
  646.     unless item.parameter_type.zero?
  647.       x = 0
  648.       y += 1      
  649.       text= parameter_type[item.parameter_type]+" +"+item.parameter_points.to_s
  650.  
  651.       self.contents.font.color = Color.new(0, 255, 0, 255)
  652.       self.contents.font.size = size
  653.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  654.     end
  655.     #------------------------------------------------------------------------
  656.     # ● 屬性
  657.     #------------------------------------------------------------------------
  658. #------------------------------------------------------------------------
  659.     # ● 屬性
  660.     #------------------------------------------------------------------------
  661.     if element_set.size > 0
  662.       x = 0
  663.       y += 1
  664.       text = phrase["elements"]
  665.       self.contents.font.size = size
  666.       self.contents.font.color = Color.new(255, 0, 255, 255)
  667.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  668.       ax = (phrase["elements"].size)*5+40
  669.       for i in 0...element_set.size
  670.         text = $data_system.elements[element_set[i]]
  671.         self.contents.draw_text(ax, y*size+18, text.size*6, size, text, 0)
  672.         y += 1
  673.       end
  674.     end
  675.     #------------------------------------------------------------------------
  676.     # ● 狀態添加
  677.     #------------------------------------------------------------------------
  678.     unless plus_state_set.empty?
  679.       text = phrase["plus"]
  680.       x = 0
  681.       y += 1
  682.       self.contents.font.color = normal_color
  683.       self.contents.font.size = size
  684.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  685.       plus_state_set.each do |plus_state|
  686.         y += 1
  687.         text = $data_states[plus_state].name        
  688.         self.contents.font.color = Color.new(255, 100, 0, 255)
  689.         self.contents.font.size = size
  690.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)      
  691.       end  
  692.     end
  693.     #------------------------------------------------------------------------
  694.     # ● 狀態解除
  695.     #------------------------------------------------------------------------
  696.     unless minus_state_set.empty?
  697.       text = phrase["minus"]
  698.       x = 0
  699.       y += 1
  700.       self.contents.font.color = Color.new(100, 0, 200, 255)
  701.       self.contents.font.size = size
  702.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  703.       minus_state_set.each do |minus_state|
  704.         y += 1
  705.         text = $data_states[minus_state].name
  706.         self.contents.font.color = Color.new(100, 0, 200, 255)
  707.         self.contents.font.size = size
  708.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)   
  709.       end
  710.     end
  711.   end
  712.   #--------------------------------------------------------------------------
  713.   # ● 设置角色
  714.   #     actor : 要显示状态的角色
  715.   #--------------------------------------------------------------------------
  716.   def set_actor(actor)
  717.     if actor != @actor
  718.       self.contents.clear
  719.       draw_actor_name(actor, 4, 0)
  720.       draw_actor_state(actor, 140, 0)
  721.       draw_actor_hp(actor, 284, 0)
  722.       draw_actor_sp(actor, 460, 0)
  723.       @actor = actor
  724.       @text = nil
  725.       self.visible = true
  726.     end
  727.   end
  728.   #--------------------------------------------------------------------------
  729.   # ● 設置角色
  730.   #     actor : 要顯示狀態之角色
  731.   #--------------------------------------------------------------------------
  732.   def set_actor(actor)
  733.     self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil?
  734.     if actor != @actor
  735.       self.contents.clear
  736.       draw_actor_name(actor, 4, 0)
  737.       draw_actor_state(actor, 140, 0)
  738.       draw_actor_hp(actor, 284, 0)
  739.       draw_actor_sp(actor, 460, 0)
  740.       @actor = actor
  741.       @text = nil
  742.       self.visible = true
  743.     end
  744.   end
  745.   #--------------------------------------------------------------------------
  746.   # ● 設置敵人
  747.   #     enemy : 要顯示名字與狀態之敵人
  748.   #--------------------------------------------------------------------------
  749.   def set_enemy(enemy)
  750.     self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil?
  751.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  752.     state_text = make_battler_state_text(enemy, 112, false)
  753.     if state_text != ""
  754.       text += "  " + state_text
  755.     end
  756.     set_text(text, 1)
  757.     self.visible = true
  758.   end
  759.   #--------------------------------------------------------------------------
  760.   # ● 校正帮助窗口位置
  761.   #--------------------------------------------------------------------------
  762.   def set_pos(x,y,width,oy,index,column_max)
  763.     #光标坐标
  764.     cursor_width = width / column_max - 32
  765.     xx = index % column_max * (cursor_width + 32)
  766.     yy = index / column_max * 32 - oy
  767.     self.x=xx+x+150
  768.     self.y=yy+y+30
  769.     if self.x+self.width>640
  770.       self.x=640-self.width
  771.     end
  772.     if self.y+self.height>480
  773.       self.y=480-self.height
  774.     end  
  775.   end
  776.   #------------------------------------------------------------------------
  777.   # ● 裝備名字顔色變化 接口
  778.   #------------------------------------------------------------------------
  779.   def draw_name_color(equipment)
  780.     return normal_color
  781.   end
  782.   #------------------------------------------------------------------------
  783.   # ● 自身身份確認
  784.   #------------------------------------------------------------------------
  785.   def original_help?
  786.     return false
  787.   end
  788. end
  789.  
  790. #------------------------------------------------------------------------------
  791.  
  792.  
  793.  
  794. #------------------------------------------------------------------------------
  795. #==============================================================================
  796. # ■ Window_Item
  797. #------------------------------------------------------------------------------
  798. #  物品画面、战斗画面、显示浏览物品的窗口。
  799. #==============================================================================
  800.  
  801. class Window_Item < Window_Selectable
  802.   #--------------------------------------------------------------------------
  803.   # ● 初始化对像
  804.   #--------------------------------------------------------------------------
  805.   def initialize
  806.     super(0, 0, 640, 480)
  807.     @column_max = 2
  808.     unless  $scene.is_a?Scene_Battle
  809.     self.opacity = 0#■■■透明
  810.     end
  811.     refresh
  812.     self.index = 0
  813.     # 战斗中的情况下将窗口移至中央并将其半透明化
  814.     if $game_temp.in_battle
  815.       self.y = 64
  816.       self.height = 256
  817.       self.back_opacity = 160
  818.     end
  819.   end
  820.   #--------------------------------------------------------------------------
  821.   # ● 刷新帮助文本
  822.   #--------------------------------------------------------------------------
  823.   def update_help
  824.     @help_window.set_text(item)
  825.     #校正帮助窗口位置
  826.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  827.   end
  828. end
  829. #==============================================================================
  830. # ■ Window_EquipLeft
  831. #------------------------------------------------------------------------------
  832. #  装备画面的、显示角色能力值变化的窗口。
  833. #==============================================================================
  834. class Window_EquipLeft < Window_Base
  835.   #--------------------------------------------------------------------------
  836.   # ● 初始化对像
  837.   #     actor : 角色
  838.   #--------------------------------------------------------------------------
  839.   def initialize(actor)
  840. # -------------------
  841. # 修改開始
  842.     super(0, 64-64, 272, 416+64)#★★★★★★★★★★★★★★★★★★★★
  843. # 修改終了
  844. # -------------------
  845.     self.contents = Bitmap.new(width - 32, height - 32)
  846.     @actor = actor
  847.     self.opacity = 0#■■■透明
  848.     refresh
  849.   end
  850. end
  851. #------------------------------------------------------------------------------
  852.  
  853.  
  854.  
  855. #------------------------------------------------------------------------------
  856. #==============================================================================
  857. # ■ Window_EquipRight
  858. #------------------------------------------------------------------------------
  859. #  装备画面、显示角色现在装备的物品的窗口。
  860. #==============================================================================
  861.  
  862. class Window_EquipRight < Window_Selectable
  863.   #--------------------------------------------------------------------------
  864.   # ● 初始化对像
  865.   #     actor : 角色
  866.   #--------------------------------------------------------------------------
  867.   def initialize(actor)
  868. # -------------------
  869. # 修改開始
  870.     super(272, 64-64, 368, 192)#★★★★★★★★★★★★★★★★★★★★
  871. # 修改終了
  872. # -------------------
  873.     self.contents = Bitmap.new(width - 32, height - 32)
  874.     @actor = actor
  875.     self.opacity = 0#■■■透明
  876.     refresh
  877.     self.index = 0
  878.   end
  879.   #--------------------------------------------------------------------------
  880.   # ● 刷新帮助文本
  881.   #--------------------------------------------------------------------------
  882.  
  883.   def update_help
  884.     @help_window.set_text(item)
  885.     #校正帮助窗口位置
  886.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  887.   end
  888. end
  889. #------------------------------------------------------------------------------
  890.  
  891.  
  892.  
  893. #------------------------------------------------------------------------------
  894. #==============================================================================
  895. # ■ Window_EquipItem
  896. #------------------------------------------------------------------------------
  897. #  装备画面、显示浏览变更装备的候补物品的窗口。
  898. #==============================================================================
  899.  
  900. class Window_EquipItem < Window_Selectable
  901.   #--------------------------------------------------------------------------
  902.   # ● 初始化对像
  903.   #     actor      : 角色
  904.   #     equip_type : 装备部位 (0~3)
  905.   #--------------------------------------------------------------------------
  906.   def initialize(actor, equip_type)
  907. # -------------------
  908. # 修改開始
  909.     super(272, 320, 368, 160)#★★★★★★★★★★★★★★★★★★★★
  910. # 修改終了
  911. # -------------------
  912.     @actor = actor
  913.     @equip_type = equip_type
  914.     @column_max = 1
  915.     self.opacity = 0#■■■透明
  916.     refresh
  917.     self.active = false
  918.     self.index = -1
  919.   end
  920.   def update_help
  921.     @help_window.set_text(item)
  922.     #校正帮助窗口位置
  923.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  924.   end
  925. end
  926. #------------------------------------------------------------------------------
  927.  
  928.  
  929.  
  930. #------------------------------------------------------------------------------
  931. #==============================================================================
  932. # ■ Window_ShopCommand
  933. #------------------------------------------------------------------------------
  934. #  商店画面、选择要做的事的窗口
  935. #==============================================================================
  936.  
  937. class Window_ShopCommand < Window_Selectable
  938.   #--------------------------------------------------------------------------
  939.   # ● 初始化对像
  940.   #--------------------------------------------------------------------------
  941.   def initialize
  942. # -------------------
  943. # 修改開始
  944.     super(0, 64-64, 480, 64)#★★★★★★★★★★★★★★★★★
  945. # 修改終了
  946. # -------------------
  947.     self.contents = Bitmap.new(width - 32, height - 32)
  948.     @item_max = 3
  949.     @column_max = 3
  950.     @commands = ["买", "卖", "取消"]
  951.     refresh
  952.     self.index = 0
  953.   end
  954. end
  955. #------------------------------------------------------------------------------
  956.  
  957.  
  958.  
  959. #------------------------------------------------------------------------------
  960. #========================================================================================================================
  961. # ■ Window_ShopBuy
  962. #------------------------------------------------------------------------------
  963. #  商店画面、浏览显示可以购买的商品的窗口。
  964. #==============================================================================
  965.  
  966. class Window_ShopBuy < Window_Selectable
  967.   #--------------------------------------------------------------------------
  968.   # ● 初始化对像
  969.   #     shop_goods : 商品
  970.   #--------------------------------------------------------------------------
  971.   def initialize(shop_goods)
  972. # -------------------
  973. # 修改開始
  974.     super(0, 128-64, 368, 352+64)#★★★★★★★★★★★★★★★★
  975. # 修改終了
  976. # -------------------
  977.     @shop_goods = shop_goods
  978.     refresh
  979.     self.index = 0
  980.   end
  981.   #--------------------------------------------------------------------------
  982.   # ● 刷新帮助文本
  983.   #--------------------------------------------------------------------------
  984.  
  985.   def update_help
  986.     @help_window.set_text(item)
  987.     #校正帮助窗口位置
  988.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  989.   end
  990. end
  991. #------------------------------------------------------------------------------
  992.  
  993.  
  994.  
  995. #------------------------------------------------------------------------------
  996. #==============================================================================
  997. # ■ Window_ShopSell
  998. #------------------------------------------------------------------------------
  999. #  商店画面、浏览显示可以卖掉的商品的窗口。
  1000. #==============================================================================
  1001.  
  1002. class Window_ShopSell < Window_Selectable
  1003.   #--------------------------------------------------------------------------
  1004.   # ● 初始化对像
  1005.   #--------------------------------------------------------------------------
  1006.   def initialize
  1007. # -------------------
  1008. # 修改開始
  1009.     super(0, 128-64, 640, 352+64)#★★★★★★★★★★★★★★★★
  1010. # 修改終了
  1011. # -------------------
  1012.     @column_max = 2
  1013.     refresh
  1014.     self.index = 0
  1015.   end
  1016.   #--------------------------------------------------------------------------
  1017.   # ● 刷新帮助文本
  1018.   #--------------------------------------------------------------------------
  1019.  
  1020.   def update_help
  1021.     @help_window.set_text(item)
  1022.     #校正帮助窗口位置
  1023.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  1024.   end
  1025. end
  1026. #------------------------------------------------------------------------------
  1027.  
  1028.  
  1029.  
  1030. #------------------------------------------------------------------------------
  1031. #==============================================================================
  1032. # ■ Window_ShopNumber
  1033. #------------------------------------------------------------------------------
  1034. #  商店画面、输入买卖数量的窗口。
  1035. #==============================================================================
  1036. class Window_ShopNumber < Window_Base
  1037.   #--------------------------------------------------------------------------
  1038.   # ● 初始化对像
  1039.   #--------------------------------------------------------------------------
  1040.   def initialize
  1041. # -------------------
  1042. # 修改開始
  1043.     super(0, 128-64, 368, 352+64)#★★★★★★★★★★★★★★★★
  1044. # 修改終了
  1045. # -------------------
  1046.     self.contents = Bitmap.new(width - 32, height - 32)
  1047.     @item = nil
  1048.     @max = 1
  1049.     @price = 0
  1050.     @number = 1
  1051.   end
  1052. end
  1053. #------------------------------------------------------------------------------
  1054.  
  1055.  
  1056.  
  1057. #------------------------------------------------------------------------------
  1058. #==============================================================================
  1059. # ■ Window_ShopStatus
  1060. #------------------------------------------------------------------------------
  1061. #  商店画面、显示物品所持数与角色装备的窗口。
  1062. #==============================================================================
  1063.  
  1064. class Window_ShopStatus < Window_Base
  1065.   #--------------------------------------------------------------------------
  1066.   # ● 初始化对像
  1067.   #--------------------------------------------------------------------------
  1068.   def initialize
  1069. # -------------------
  1070. # 修改開始
  1071.     super(368, 128-64, 272, 352+64)#★★★★★★★★★★★★
  1072. # 修改終了
  1073. # -------------------
  1074.     self.contents = Bitmap.new(width - 32, height - 32)
  1075.     @item = nil
  1076.     refresh
  1077.   end
  1078. end
  1079. #------------------------------------------------------------------------------
  1080.  
  1081.  
  1082.  
  1083. #------------------------------------------------------------------------------
  1084. #==============================================================================
  1085. # ■ Scene_Equip
  1086. #------------------------------------------------------------------------------
  1087. #  处理装备画面的类。
  1088. #==============================================================================
  1089.  
  1090. class Scene_Equip
  1091.   #--------------------------------------------------------------------------
  1092.   # ● 刷新画面 (右侧窗口被激活的情况下)
  1093.   #--------------------------------------------------------------------------
  1094.   def update_right
  1095. # -------------------
  1096. # 修改開始
  1097.     if @right_window.item==nil
  1098.         @help_window.visible=false
  1099.     else
  1100.         @help_window.visible=true
  1101.     end
  1102. # 修改終了
  1103. # -------------------
  1104.     # 按下 B 键的情况下
  1105.     if Input.trigger?(Input::B)
  1106.       # 演奏取消 SE
  1107.       $game_system.se_play($data_system.cancel_se)
  1108.       # 切换到菜单画面
  1109.       $scene = Scene_Menu.new(2)
  1110.       return
  1111.     end
  1112.     # 按下 C 键的情况下
  1113.     if Input.trigger?(Input::C)
  1114.       # 固定装备的情况下
  1115.       if @actor.equip_fix?(@right_window.index)
  1116.         # 演奏冻结 SE
  1117.         $game_system.se_play($data_system.buzzer_se)
  1118.         return
  1119.       end
  1120.       # 演奏确定 SE
  1121.       $game_system.se_play($data_system.decision_se)
  1122.       # 激活物品窗口
  1123.       @right_window.active = false
  1124.       @item_window.active = true
  1125.       @item_window.index = 0
  1126.       return
  1127.     end
  1128.     # 按下 R 键的情况下
  1129.     if Input.trigger?(Input::R)
  1130.       # 演奏光标 SE
  1131.       $game_system.se_play($data_system.cursor_se)
  1132.       # 移至下一位角色
  1133.       @actor_index += 1
  1134.       @actor_index %= $game_party.actors.size
  1135.       # 切换到别的装备画面
  1136.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  1137.       return
  1138.     end
  1139.     # 按下 L 键的情况下
  1140.     if Input.trigger?(Input::L)
  1141.       # 演奏光标 SE
  1142.       $game_system.se_play($data_system.cursor_se)
  1143.       # 移至上一位角色
  1144.       @actor_index += $game_party.actors.size - 1
  1145.       @actor_index %= $game_party.actors.size
  1146.       # 切换到别的装备画面
  1147.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  1148.       return
  1149.     end
  1150.   end
  1151.   #--------------------------------------------------------------------------
  1152.   # ● 刷新画面 (物品窗口被激活的情况下)
  1153.   #--------------------------------------------------------------------------
  1154.   def update_item
  1155. # -------------------
  1156. # 修改開始
  1157.     if @item_window.item==nil
  1158.         @help_window.visible=false
  1159.     else
  1160.         @help_window.visible=true
  1161.     end
  1162. # 修改終了
  1163. # -------------------
  1164.     # 按下 B 键的情况下
  1165.     if Input.trigger?(Input::B)
  1166.       # 演奏取消 SE
  1167.       $game_system.se_play($data_system.cancel_se)
  1168.       # 激活右侧窗口
  1169.       @right_window.active = true
  1170.       @item_window.active = false
  1171.       @item_window.index = -1
  1172.       return
  1173.     end
  1174.     # 按下 C 键的情况下
  1175.     if Input.trigger?(Input::C)
  1176.       # 演奏装备 SE
  1177.       $game_system.se_play($data_system.equip_se)
  1178.       # 获取物品窗口现在选择的装备数据
  1179.       item = @item_window.item
  1180.       # 变更装备
  1181.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  1182.       # 激活右侧窗口
  1183.       @right_window.active = true
  1184.       @item_window.active = false
  1185.       @item_window.index = -1
  1186.       # 再生成右侧窗口、物品窗口的内容
  1187.       @right_window.refresh
  1188.       @item_window.refresh
  1189.       @sprite.bitmap.clear
  1190.       @sprite.bitmap.draw_actor_element_radar_graph(@actor,16,255+16)
  1191.       return
  1192.     end
  1193.   end
  1194. end
  1195. #------------------------------------------------------------------------------
  1196.  
  1197.  
  1198.  
  1199. #------------------------------------------------------------------------------
  1200. #========================================================================================================================
  1201. # ■ Scene_Battle (分割定义 3)
  1202. #------------------------------------------------------------------------------
  1203. #  处理战斗画面的类。
  1204. #========================================================================================================================
  1205.  
  1206. class Scene_Battle
  1207.   #--------------------------------------------------------------------------
  1208.   # ● 刷新画面 (角色命令回合 : 选择物品)
  1209.   #--------------------------------------------------------------------------
  1210.   alias first_reupdate_phase3_item_select update_phase3_item_select  
  1211.   def update_phase3_item_select
  1212. # -------------------
  1213. # 修改開始
  1214.     @item_window.help_window.visible = false#★★★★★★★★★★★★
  1215. # 修改終了
  1216. # -------------------
  1217.     first_reupdate_phase3_item_select
  1218.   end
  1219.   #--------------------------------------------------------------------------
  1220.   # ● 开始选择物品
  1221.   #--------------------------------------------------------------------------
  1222.   def start_item_select
  1223.     # 生成物品窗口
  1224.     @item_window = Window_Item.new
  1225.     # 关联帮助窗口
  1226. # -------------------
  1227. # 修改開始
  1228.     @item_window.help_window =  Window_Help.new#★★★★★★★★★★★★
  1229. # 修改終了
  1230. # -------------------
  1231.     # 无效化角色指令窗口
  1232.     @actor_command_window.active = false
  1233.     @actor_command_window.visible = false
  1234.   end
  1235.   #--------------------------------------------------------------------------
  1236.   # ● 结束选择物品
  1237.   #--------------------------------------------------------------------------
  1238.   alias first_update_end_item_select end_item_select
  1239.   def end_item_select
  1240. # -------------------
  1241. # 修改開始
  1242.     @item_window.help_window.visible = false#★★★★★★★★★★★★
  1243. # 修改終了
  1244. # -------------------
  1245.     first_update_end_item_select
  1246.   end
  1247. end
  1248. #------------------------------------------------------------------------------
  1249.  
  1250.  
  1251.  
  1252. #------------------------------------------------------------------------------
  1253. #==============================================================================
  1254. # ■ Scene_Shop
  1255. #------------------------------------------------------------------------------
  1256. #  处理商店画面的类。
  1257. #==============================================================================
  1258.  
  1259. class Scene_Shop
  1260.   #--------------------------------------------------------------------------
  1261.   # ● 主处理
  1262.   #--------------------------------------------------------------------------
  1263. # --------------------
  1264. # 衝突可能
  1265.   def main
  1266.  
  1267.     # 生成帮助窗口
  1268. # -------------------
  1269. # 修改開始
  1270.     @help_window = Window_Help.new#★★★★★★★★★★★★★★★★
  1271. # 修改終了
  1272. # -------------------
  1273.     # 生成指令窗口
  1274.     @command_window = Window_ShopCommand.new
  1275.         # 生成金钱窗口
  1276.     @gold_window = Window_Gold.new
  1277.     @gold_window.x = 480
  1278.     @gold_window.y = 0
  1279.  
  1280. # -------------------
  1281. # 修改終了
  1282. # -------------------
  1283.     # 生成时间窗口
  1284. # -------------------
  1285. # 修改開始
  1286.     @dummy_window = Window_Base.new(0, 128-64, 640, 352+64)#★★★★★★★★★★★★★
  1287. # 修改終了
  1288. # -------------------
  1289.  
  1290.     # 生成购买窗口
  1291.  
  1292.     @buy_window = Window_ShopBuy.new($game_temp.shop_goods)
  1293.     @buy_window.active = false
  1294.     @buy_window.visible = false
  1295.     @buy_window.help_window = @help_window
  1296.  
  1297.     # 生成卖出窗口
  1298.     @sell_window = Window_ShopSell.new
  1299.     @sell_window.active = false
  1300.     @sell_window.visible = false
  1301.     @sell_window.help_window = @help_window
  1302.     # 生成数量输入窗口
  1303.     @number_window = Window_ShopNumber.new
  1304.     @number_window.active = false
  1305.     @number_window.visible = false
  1306.     # 生成状态窗口
  1307.     @status_window = Window_ShopStatus.new
  1308.     @status_window.visible = false
  1309.     # 执行过渡
  1310.     Graphics.transition
  1311.     # 主循环
  1312.     loop do
  1313.       # 刷新游戏画面
  1314.       Graphics.update
  1315.       # 刷新输入信息
  1316.       Input.update
  1317.       # 刷新画面
  1318.       update
  1319.       # 如果画面切换的话就中断循环
  1320.       if $scene != self
  1321.         break
  1322.       end
  1323.     end
  1324.     # 准备过渡
  1325.     Graphics.freeze
  1326.     # 释放窗口
  1327.  
  1328.     @help_window.dispose
  1329.     @command_window.dispose
  1330.     @gold_window.dispose
  1331.     @dummy_window.dispose
  1332.     @buy_window.dispose
  1333.     @sell_window.dispose
  1334.     @number_window.dispose
  1335.     @status_window.dispose
  1336.   end
  1337.   #--------------------------------------------------------------------------
  1338.   # ● 刷新画面
  1339.   #--------------------------------------------------------------------------
  1340. # --------------------
  1341. # 衝突可能
  1342.   def update
  1343.     # 刷新窗口
  1344.     @help_window.update
  1345.     @command_window.update
  1346.     @gold_window.update
  1347.     @dummy_window.update
  1348.     @buy_window.update
  1349.     @sell_window.update
  1350.     @number_window.update
  1351.     @status_window.update
  1352.     # 指令窗口激活的情况下: 调用 update_command
  1353.     if @command_window.active
  1354. # -------------------
  1355. # 修改開始
  1356.       @help_window.visible=false
  1357. # 修改終了
  1358. # -------------------
  1359.       update_command
  1360.       return
  1361.     end
  1362.     # 购买窗口激活的情况下: 调用 update_buy
  1363.     if @buy_window.active
  1364. # -------------------
  1365. # 修改開始
  1366.       @help_window.visible=true#★★★★★★★★★★★★★★★★
  1367.       if @buy_window.item==nil#★★★★★★★★★★★★★★★★
  1368.         @help_window.visible=false#★★★★★★★★★★★★★★★★
  1369.       end #★★★★★★★★★★★★★★★★     
  1370. # 修改終了
  1371. # -------------------
  1372.       update_buy
  1373.       return
  1374.     end
  1375.     # 卖出窗口激活的情况下: 调用 update_sell
  1376.     if @sell_window.active
  1377. # -------------------
  1378. # 修改開始
  1379.       @help_window.visible=true#★★★★★★★★★★★★★★★★
  1380.       if @sell_window.item==nil#★★★★★★★★★★★★★★★★
  1381.         @help_window.visible=false#★★★★★★★★★★★★★★★★
  1382.       end #★★★★★★★★★★★★★★★★
  1383. # 修改終了
  1384. # -------------------      
  1385.       update_sell
  1386.       return
  1387.     end
  1388.     # 个数输入窗口激活的情况下: 调用 update_number
  1389.     if @number_window.active
  1390. # -------------------
  1391. # 修改開始
  1392.       @help_window.visible=false#★★★★★★★★★★★★★★★★
  1393. # 修改終了
  1394. # -------------------
  1395.       update_number
  1396.       return
  1397.     end
  1398.   end
  1399. end

点评

10元能干嘛?吃顿饭都不止10元。(反正我不会用XP就来捣乱233  发表于 2014-12-1 18:19

Lv2.观梦者

故九江太守

梦石
0
星屑
559
在线时间
2160 小时
注册时间
2012-12-5
帖子
4463
2
发表于 2014-12-1 18:47:14 | 只看该作者
整合.rar (202.49 KB, 下载次数: 58)
窗口位置你自己修改吧

点评

认可答案  发表于 2014-12-1 19:16

评分

参与人数 1梦石 +2 收起 理由
RyanBern + 2 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 12:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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