查看: 2069|回复: 1

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

[复制链接]
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2014-12-1 17:07:51 | 显示全部楼层 |阅读模式

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

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

×
可支付宝

完美物品系统
  1. #==============================================================================
  2. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  3. # ■ 使用方法写在发布页
  4. #==============================================================================
  5. =begin

  6. 部分可能在制作中用到的核心算法:

  7. 角色(Game_Actor):
  8. 属性:max_size,最大负重,可在游戏更改。如$game_actors[1].max_size += 1
  9. 属性:items,物品列表,只可读取,不可修改。如$a = $game_actors[1].items[0]
  10. 函数:judge_equip,判断一下是否装备正确。如果不正确就把装备设置为空
  11. 函数:gain_item(item_id, kind=1, n=true),给某角色增减物品。
  12.       item_id : 物品 ID;n: true是增加,false是减少;kind:种类,1是物品,2是武器,3是防具
  13. 函数:item_amount,返回现有负重物品数量
  14. 函数:have_item?(item),判断是否拥有某物
  15. 函数:item_full?,判断背包是不是满了


  16. 队伍(Game_Party):
  17. 属性:max_amount,最大背包中物品数量
  18. 属性:now_amount,背包中现有物品数量
  19. 函数:item_full?,判断背包是否放满
  20. 函数:refresh_item_amount,重新刷新背包中现有物品数量,发生意外的时候用

  21. =end
  22. #==============================================================================
  23. # ■ Game_Actor
  24. #------------------------------------------------------------------------------
  25. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  26. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  27. #==============================================================================
  28. class Game_Actor < Game_Battler
  29.   attr_accessor :max_size
  30.   attr_reader   :items
  31.   #--------------------------------------------------------------------------
  32.   # ● 设置
  33.   #     actor_id : 角色 ID
  34.   #--------------------------------------------------------------------------
  35.   alias final_items_setup setup
  36.   def setup(actor_id)
  37.     final_items_setup(actor_id)   
  38.     #--角色自带的物品建立
  39.     @max_size = 8
  40.     @items = []        
  41.     if @weapon_id >0
  42.       @items.push($data_weapons[@weapon_id])
  43.     end
  44.     if @armor1_id >0
  45.       @items.push($data_armors[@armor1_id])
  46.     end
  47.     if @armor2_id >0
  48.       @items.push($data_armors[@armor2_id])
  49.     end
  50.     if @armor3_id >0
  51.       @items.push($data_armors[@armor3_id])
  52.     end
  53.     if @armor4_id >0
  54.       @items.push($data_armors[@armor4_id])
  55.     end
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● 测试装备是否正确,如果不正确就设置为空
  59.   #--------------------------------------------------------------------------
  60.   def judge_equip
  61.     if @armor1_id>0
  62.       unless @items.include?($data_armors[@armor1_id])
  63.         @armor1_id = 0
  64.       end
  65.     end
  66.     if @armor2_id>0
  67.       unless @items.include?($data_armors[@armor2_id])
  68.         @armor2_id = 0
  69.       end
  70.     end
  71.     if @armor3_id>0
  72.       unless @items.include?($data_armors[@armor3_id])
  73.         @armor3_id = 0
  74.       end
  75.     end
  76.     if @armor4_id>0
  77.       unless @items.include?($data_armors[@armor4_id])
  78.         @armor4_id = 0
  79.       end
  80.     end
  81.     if @weapon_id>0
  82.       unless @items.include?($data_weapons[@weapon_id])
  83.         @weapon_id = 0
  84.       end
  85.     end
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 增加物品 (减少)
  89.   #     item_id : 物品 ID
  90.   #     n       : true是增加,false是减少
  91.   #     kind    : 种类,1是物品,2是武器,3是防具
  92.   #--------------------------------------------------------------------------
  93.   def gain_item(item_id, kind=1, n=true)
  94.     return if item_full?
  95.     if kind == 1
  96.       if item_id > 0 and n==true
  97.         @items.push($data_items[item_id])
  98.       elsif item_id >0 and n==false
  99.         @items.delete($data_items[item_id])
  100.       end
  101.     end
  102.     if kind == 2
  103.       if item_id > 0 and n==true
  104.         @items.push($data_weapons[item_id])
  105.       elsif item_id > 0 and n==false
  106.         @items.push($data_weapons[item_id])
  107.       end
  108.     end
  109.     if kind == 3
  110.       if item_id > 0 and n==true
  111.         @items.push($data_armors[item_id])
  112.       elsif item_id > 0 and n==true
  113.         @items.push($data_armors[item_id])
  114.       end
  115.     end
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ● 返回物品数量
  119.   #--------------------------------------------------------------------------  
  120.   def item_amount
  121.     return @items.size
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 判断是否拥有物品
  125.   #--------------------------------------------------------------------------  
  126.   def have_item?(item)
  127.     return @items.include?(item)
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ● 判断是否物品满了
  131.   #--------------------------------------------------------------------------  
  132.   def item_full?
  133.     return true if @items.size>=@max_size
  134.     return false
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 变更装备
  138.   #     equip_type : 装备类型
  139.   #     id    : 武器 or 防具 ID  (0 为解除装备)
  140.   #--------------------------------------------------------------------------
  141.   def equip(equip_type, id)
  142.     case equip_type
  143.     when 0  # 武器
  144.       if id >= 0
  145.         @weapon_id = id
  146.       end
  147.     when 1  # 盾
  148.       if id >= 0
  149.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  150.         @armor1_id = id
  151.       end
  152.     when 2  # 头
  153.       if id >= 0
  154.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  155.         @armor2_id = id
  156.       end
  157.     when 3  # 身体
  158.       if id >= 0
  159.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  160.         @armor3_id = id
  161.       end
  162.     when 4  # 装饰品
  163.       if id >= 0
  164.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  165.         @armor4_id = id
  166.       end
  167.     end
  168.   end  
  169. end

  170. #==============================================================================
  171. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  172. # ■ 使用方法写在发布页
  173. #==============================================================================
  174. # ■ Game_Party
  175. #------------------------------------------------------------------------------
  176. #  处理同伴的类。包含金钱以及物品的信息。本类的实例
  177. # 请参考 $game_party。
  178. #==============================================================================

  179. class Game_Party
  180.   #--------------------------------------------------------------------------
  181.   # ● 定义实例变量
  182.   #--------------------------------------------------------------------------
  183.   attr_accessor :max_amount
  184.   attr_reader   :now_amount
  185.   #--------------------------------------------------------------------------
  186.   # ● 初始化对像
  187.   #--------------------------------------------------------------------------
  188.   alias final_item_initialize initialize
  189.   def initialize
  190.     final_item_initialize
  191.     @max_amount = 2
  192.     @now_amount = 0
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   #--------------------------------------------------------------------------
  196.   def item_full?
  197.     return true if @now_amount>=@max_amount
  198.     return false
  199.   end
  200.   def refresh_item_amount
  201.     @now_amount = 0
  202.     for i in 1...$data_items.size
  203.       if $game_party.item_number(i) > 0
  204.         @now_amount += $game_party.item_number(i)
  205.       end
  206.     end
  207.     for i in 1...$data_weapons.size
  208.       if $game_party.weapon_number(i) > 0
  209.         @now_amount += $game_party.weapon_number(i)
  210.       end
  211.     end
  212.     for i in 1...$data_armors.size
  213.       if $game_party.armor_number(i) > 0
  214.         @now_amount += $game_party.armor_number(i)
  215.       end
  216.     end
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ● 增加物品 (减少)
  220.   #     item_id : 物品 ID
  221.   #     n       : 个数
  222.   #--------------------------------------------------------------------------
  223.   def gain_item(item_id, n)
  224.     # 更新 hash 的个数数据
  225.     if item_id > 0
  226.       @items[item_id] = [[item_number(item_id) + n, 0].max, @max_amount].min
  227.       refresh_item_amount
  228.     end
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ● 增加武器 (减少)
  232.   #     weapon_id : 武器 ID
  233.   #     n         : 个数
  234.   #--------------------------------------------------------------------------
  235.   def gain_weapon(weapon_id, n)
  236.     # 更新 hash 的个数数据
  237.     if weapon_id > 0
  238.       @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, @max_amount].min
  239.       refresh_item_amount
  240.     end
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # ● 增加防具 (减少)
  244.   #     armor_id : 防具 ID
  245.   #     n        : 个数
  246.   #--------------------------------------------------------------------------
  247.   def gain_armor(armor_id, n)
  248.     # 更新 hash 的个数数据
  249.     if armor_id > 0
  250.       @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, @max_amount].min
  251.       refresh_item_amount
  252.     end
  253.   end  
  254.   #--------------------------------------------------------------------------
  255.   # ● 判断物品可以使用
  256.   #     item_id : 物品 ID
  257.   #--------------------------------------------------------------------------
  258.   def item_can_use?(item_id)
  259.     # 物品个数为 0 的情况
  260.     #if item_number(item_id) == 0
  261.       # 不能使用
  262.       #return false
  263.     #end
  264.     # 获取可以使用的时候
  265.     occasion = $data_items[item_id].occasion
  266.     # 战斗的情况
  267.     if $game_temp.in_battle
  268.       # 可以使用时为 0 (平时) 或者是 1 (战斗时) 可以使用
  269.       return (occasion == 0 or occasion == 1)
  270.     end
  271.     # 可以使用时为 0 (平时) 或者是 2 (菜单时) 可以使用
  272.     return (occasion == 0 or occasion == 2)
  273.   end  
  274. end

  275. #==============================================================================
  276. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  277. # ■ 使用方法写在发布页
  278. #==============================================================================
  279. # ■ Window_Command
  280. #------------------------------------------------------------------------------
  281. #  一般的命令选择行窗口。
  282. #==============================================================================

  283. class Window_Command < Window_Selectable
  284.   #--------------------------------------------------------------------------
  285.   # ● 项目有效化
  286.   #     index : 项目编号
  287.   #--------------------------------------------------------------------------  
  288.   def enable_item(index)
  289.     draw_item(index, normal_color)
  290.   end
  291. end

  292. #==============================================================================
  293. # ■ Window_Item
  294. #------------------------------------------------------------------------------
  295. #  物品画面、战斗画面、显示浏览物品的窗口。
  296. #==============================================================================

  297. class Window_Item < Window_Selectable
  298.   #--------------------------------------------------------------------------
  299.   # ● 初始化对像
  300.   #--------------------------------------------------------------------------
  301.   def initialize(actor=nil)
  302.     @actor=actor
  303.     super(0, 64, 640, 416)
  304.     @column_max = 1
  305.     refresh
  306.     self.index = 0
  307.     # 战斗中的情况下将窗口移至中央并将其半透明化
  308.     if $game_temp.in_battle
  309.       self.y = 64
  310.       self.height = 256
  311.       self.back_opacity = 160
  312.     end
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ● 获取物品
  316.   #--------------------------------------------------------------------------
  317.   def item
  318.     return @data[self.index]
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ● 刷新
  322.   #--------------------------------------------------------------------------
  323.   def refresh
  324.     if self.contents != nil
  325.       self.contents.dispose
  326.       self.contents = nil
  327.     end
  328.     @data = []
  329.     # 添加报务
  330.    
  331.     if @actor==nil   
  332.       for i in 1...$data_items.size
  333.         if $game_party.item_number(i) > 0
  334.           for pushtimes in 0...$game_party.item_number(i)
  335.             @data.push($data_items[i])
  336.           end
  337.         end
  338.       end
  339.       for i in 1...$data_weapons.size
  340.         if $game_party.weapon_number(i) > 0
  341.           for pushtimes in 0...$game_party.weapon_number(i)
  342.             @data.push($data_weapons[i])
  343.           end
  344.         end
  345.       end
  346.       for i in 1...$data_armors.size
  347.         if $game_party.armor_number(i) > 0
  348.           for pushtimes in 0...$game_party.armor_number(i)
  349.             @data.push($data_armors[i])
  350.           end
  351.         end
  352.       end
  353.     else
  354.       for i in [email]0...@actor.items.size[/email]
  355.         if @actor.items[i].is_a?(RPG::Item)
  356.           @data.push(@actor.items[i])
  357.         else         
  358.           if @actor.items[i].is_a?(RPG::Weapon) or @actor.items[i].is_a?(RPG::Armor)
  359.             if @actor.items[i].name==$data_items[@actor.items[i].id].name
  360.               @data.push($data_items[@actor.items[i].id])
  361.               next
  362.             else
  363.               @data.push(@actor.items[i])
  364.               next
  365.             end
  366.           end
  367.         end
  368.       end
  369.     end
  370.     # 如果项目数不是 0 就生成位图、重新描绘全部项目
  371.     @item_max = @data.size
  372.     if @item_max > 0
  373.       self.contents = Bitmap.new(width - 32, row_max * 32)
  374.       self.contents.font.size = 20
  375.       for i in 0...@item_max
  376.         draw_item(i)
  377.       end
  378.     end
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 描绘项目
  382.   #     index : 项目编号
  383.   #--------------------------------------------------------------------------
  384.   def draw_item(index)
  385.     if @actor==nil
  386.       item = @data[index]
  387.       x = 4
  388.       y = index * 32
  389.       rect = Rect.new(x, y, self.width - 32, 32)
  390.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  391.       bitmap = RPG::Cache.icon(item.icon_name)
  392.       opacity = self.contents.font.color == normal_color ? 255 : 128
  393.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  394.       self.contents.font.size = 20
  395.       self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  396.       self.contents.font.size = 14
  397.       self.contents.draw_text(x + 150, y, 400, 42, ":"+item.description, 0)
  398.     else
  399.       item = @data[index]
  400.       #if item.is_a?(RPG::Item) and
  401.         #$game_party.item_can_use?(item.id)
  402.         #self.contents.font.color = normal_color
  403.       #else
  404.         #self.contents.font.color = disabled_color
  405.       #end
  406.       x = 4
  407.       y = index * 32
  408.       rect = Rect.new(x, y, self.width - 32, 32)
  409.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  410.       bitmap = RPG::Cache.icon(item.icon_name)
  411.       opacity = self.contents.font.color == normal_color ? 255 : 128
  412.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  413.       self.contents.font.size = 20
  414.       self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  415.       self.contents.font.size = 14
  416.       self.contents.draw_text(x + 150, y, 400, 42, ":"+item.description, 0)
  417.     end
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ● 刷新帮助文本
  421.   #--------------------------------------------------------------------------
  422.   def update_help
  423.     @help_window.contents.font.size = 18
  424.     if @actor==nil
  425.       @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 )
  426.     else
  427.       @help_window.set_text(@actor.name+"    物品数量:"+@actor.item_amount.to_s+"    最大负重:"+@actor.max_size.to_s)
  428.     end
  429.   end
  430.   def dispose
  431.     super
  432.     @actor.judge_equip if @actor != nil
  433.   end
  434. end

  435. #==============================================================================
  436. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  437. # ■ 使用方法写在发布页
  438. #============================================================================
  439. # ■ Window_EquipItem
  440. #------------------------------------------------------------------------------
  441. #  装备画面、显示浏览变更装备的候补物品的窗口。
  442. #==============================================================================

  443. class Window_EquipItem < Window_Selectable
  444.   #--------------------------------------------------------------------------
  445.   # ● 刷新
  446.   #--------------------------------------------------------------------------
  447.   def refresh
  448.     if self.contents != nil
  449.       self.contents.dispose
  450.       self.contents = nil
  451.     end
  452.     @data = []
  453.    
  454.     # 添加可以装备的武器
  455.     if @equip_type == 0
  456.       weapon_set = $data_classes[@actor.class_id].weapon_set
  457.       for item in @actor.items
  458.         if item.is_a?(RPG::Weapon) and weapon_set.include?(item.id)
  459.           @data.push(item)
  460.         end
  461.       end
  462.     end
  463.     # 添加可以装备的防具
  464.     if @equip_type != 0
  465.       armor_set = $data_classes[@actor.class_id].armor_set
  466.       for item in @actor.items
  467.         if item.is_a?(RPG::Armor) and armor_set.include?(item.id)
  468.           if item.kind == @equip_type-1
  469.             @data.push(item)
  470.           end
  471.         end
  472.       end
  473.     end
  474.     # 添加空白
  475.     @data.push(nil)
  476.     # 生成位图、描绘全部项目
  477.     @item_max = @data.size
  478.     self.contents = Bitmap.new(width - 32, row_max * 32)
  479.     for i in 0...@item_max-1
  480.       draw_item(i)
  481.     end
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # ● 项目的描绘
  485.   #     index : 项目符号
  486.   #--------------------------------------------------------------------------
  487.   def draw_item(index)
  488.     item = @data[index]
  489.     x = 4 + index % 2 * (288 + 32)
  490.     y = index / 2 * 32
  491.     bitmap = RPG::Cache.icon(item.icon_name)
  492.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  493.     self.contents.font.color = normal_color
  494.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  495.   end
  496. end

  497. #==============================================================================
  498. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  499. # ■ 使用方法写在发布页
  500. #==============================================================================
  501. # ■ Window_ShopStatus_New
  502. #------------------------------------------------------------------------------
  503. #  商店画面、显示物品所持数与角色装备的窗口。
  504. #==============================================================================

  505. class Window_ShopStatus_New < Window_Selectable
  506.   #--------------------------------------------------------------------------
  507.   # ● 初始化对像
  508.   #--------------------------------------------------------------------------
  509.   def initialize
  510.     super(368, 128, 272, 352)
  511.     self.contents = Bitmap.new(width - 32, height - 32)
  512.     self.contents.font.size = 18
  513.     @item = nil
  514.     @item_max = $game_party.actors.size + 1
  515.     refresh
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ● 刷新
  519.   #--------------------------------------------------------------------------
  520.   def refresh
  521.     self.contents.clear
  522.     if @item == nil
  523.       return
  524.     end
  525.     case @item
  526.     when RPG::Item
  527.       number = $game_party.item_number(@item.id)
  528.     when RPG::Weapon
  529.       number = $game_party.weapon_number(@item.id)
  530.     when RPG::Armor
  531.       number = $game_party.armor_number(@item.id)
  532.     end
  533.     self.contents.font.color = system_color
  534.     self.contents.draw_text(4, 0, 200, 32, "仓库中本物品数:")
  535.     self.contents.font.color = normal_color
  536.     self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
  537.     self.contents.font.color = system_color
  538.     self.contents.draw_text(4, 32, 200, 32, "仓库目前物品数:")
  539.     self.contents.font.color = normal_color
  540.     self.contents.draw_text(164, 32, 72, 32, $game_party.now_amount.to_s+" / "+$game_party.max_amount.to_s, 2)
  541.     #if @item.is_a?(RPG::Item)
  542.       #return
  543.     #end
  544.     # 添加装备品信息
  545.     for i in 0...$game_party.actors.size
  546.       actor = $game_party.actors[i]
  547.       self.contents.font.color = Color.new(255,255,0)
  548.       self.contents.draw_text(116, 64 + 64 * i, 132, 32, "负重: ")
  549.       self.contents.font.color = normal_color
  550.       self.contents.draw_text(164, 64 + 64 * i, 72, 32, actor.item_amount.to_s+" / "+actor.max_size.to_s,2)
  551.       # 获取当前的装备品
  552.       unless @item == nil or @item.is_a?(RPG::Item)
  553.         if @item.is_a?(RPG::Weapon)
  554.           item1 = $data_weapons[actor.weapon_id]
  555.         elsif @item.kind == 0
  556.           item1 = $data_armors[actor.armor1_id]
  557.         elsif @item.kind == 1
  558.           item1 = $data_armors[actor.armor2_id]
  559.         elsif @item.kind == 2
  560.           item1 = $data_armors[actor.armor3_id]
  561.         else
  562.           item1 = $data_armors[actor.armor4_id]
  563.         end
  564.         # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
  565.         if actor.equippable?(@item)
  566.           self.contents.font.color = normal_color
  567.         else
  568.           self.contents.font.color = disabled_color
  569.         end        
  570.         # 描绘角色名字
  571.         self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  572.         # 可以装备的情况
  573.         if actor.equippable?(@item)
  574.           # 武器的情况
  575.           if @item.is_a?(RPG::Weapon)
  576.             atk1 = item1 != nil ? item1.atk : 0
  577.             atk2 = @item != nil ? @item.atk : 0
  578.             change = atk2 - atk1
  579.           end
  580.           # 防具的情况
  581.           if @item.is_a?(RPG::Armor)
  582.             pdef1 = item1 != nil ? item1.pdef : 0
  583.             mdef1 = item1 != nil ? item1.mdef : 0
  584.             pdef2 = @item != nil ? @item.pdef : 0
  585.             mdef2 = @item != nil ? @item.mdef : 0
  586.             change = pdef2 - pdef1 + mdef2 - mdef1
  587.           end
  588.           # 描绘能力值变化
  589.           self.contents.draw_text(124, 96 + 64 * i, 112, 32,
  590.             sprintf("%+d", change), 2)
  591.         end
  592.         # 描绘物品
  593.         if item1 != nil
  594.           x = 4
  595.           y = 64 + 64 * i + 32
  596.           bitmap = RPG::Cache.icon(item1.icon_name)
  597.           opacity = self.contents.font.color == normal_color ? 255 : 128
  598.           self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  599.           self.contents.draw_text(x + 28, y, 212, 32, item1.name)
  600.         end
  601.       else
  602.         self.contents.font.color = normal_color
  603.         # 描绘角色名字
  604.         self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  605.       end
  606.     end
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # ● 设置物品
  610.   #     item : 新的物品
  611.   #--------------------------------------------------------------------------
  612.   def item=(item)
  613.     if @item != item
  614.       @item = item
  615.       refresh
  616.     end
  617.   end
  618.   #--------------------------------------------------------------------------
  619.   # ● 刷新光标矩形
  620.   #--------------------------------------------------------------------------
  621.   def update_cursor_rect
  622.     if @index < 0
  623.       self.cursor_rect.empty
  624.     else
  625.       self.cursor_rect.set(0, @index * 64, self.width - 32, 64)
  626.     end
  627.   end
  628. end

  629. #==============================================================================
  630. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  631. # ■ 使用方法写在发布页
  632. #==============================================================================
  633. # ■ Scene_Menu
  634. #------------------------------------------------------------------------------
  635. #  处理菜单画面的类。
  636. #==============================================================================

  637. class Scene_Menu
  638.   #--------------------------------------------------------------------------
  639.   # ● 初始化对像
  640.   #     menu_index : 命令光标的初期位置
  641.   #--------------------------------------------------------------------------
  642.   def initialize(menu_index = 0)
  643.     @menu_index = menu_index
  644.   end
  645.   #--------------------------------------------------------------------------
  646.   # ● 主处理
  647.   #--------------------------------------------------------------------------
  648.   def main
  649.     # 生成命令窗口
  650.     s1 = $data_system.words.item
  651.     s2 = $data_system.words.skill
  652.     s3 = $data_system.words.equip
  653.     s4 = "状态"
  654.     s5 = "存档"
  655.     s6 = "结束游戏"
  656.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
  657.     @command_window.index = @menu_index
  658.     @item_command_window = Window_Command.new(160,["仓库物品","个人物品"])
  659.     @item_command_window.x = 120
  660.     @item_command_window.visible = false
  661.     @item_command_window.active = false
  662.     @item_command_window.z = 999
  663.     # 同伴人数为 0 的情况下
  664.     if $game_party.actors.size == 0
  665.       # 物品、特技、装备、状态无效化
  666.       @command_window.disable_item(0)
  667.       @command_window.disable_item(1)
  668.       @command_window.disable_item(2)
  669.       @command_window.disable_item(3)
  670.     end
  671.     # 禁止存档的情况下
  672.     if $game_system.save_disabled
  673.       # 存档无效
  674.       @command_window.disable_item(4)
  675.     end
  676.     # 生成游戏时间窗口
  677.     @playtime_window = Window_PlayTime.new
  678.     @playtime_window.x = 0
  679.     @playtime_window.y = 224
  680.     # 生成步数窗口
  681.     @steps_window = Window_Steps.new
  682.     @steps_window.x = 0
  683.     @steps_window.y = 320
  684.     # 生成金钱窗口
  685.     @gold_window = Window_Gold.new
  686.     @gold_window.x = 0
  687.     @gold_window.y = 416
  688.     # 生成状态窗口
  689.     @status_window = Window_MenuStatus.new
  690.     @status_window.x = 160
  691.     @status_window.y = 0
  692.     # 执行过渡
  693.     Graphics.transition
  694.     # 主循环
  695.     loop do
  696.       # 刷新游戏画面
  697.       Graphics.update
  698.       # 刷新输入信息
  699.       Input.update
  700.       # 刷新画面
  701.       update
  702.       # 如果切换画面就中断循环
  703.       if $scene != self
  704.         break
  705.       end
  706.     end
  707.     # 准备过渡
  708.     Graphics.freeze
  709.     # 释放窗口
  710.     @command_window.dispose
  711.     @playtime_window.dispose
  712.     @steps_window.dispose
  713.     @gold_window.dispose
  714.     @status_window.dispose
  715.     @item_command_window.dispose
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # ● 刷新画面
  719.   #--------------------------------------------------------------------------
  720.   def update
  721.     # 刷新窗口
  722.     @command_window.update
  723.     @playtime_window.update
  724.     @steps_window.update
  725.     @gold_window.update
  726.     @status_window.update
  727.     @item_command_window.update
  728.     # 命令窗口被激活的情况下: 调用 update_command
  729.     if @command_window.active
  730.       update_command
  731.       return
  732.     end
  733.     # 状态窗口被激活的情况下: 调用 update_status
  734.     if @status_window.active
  735.       update_status
  736.       return
  737.     end
  738.     if @item_command_window.active
  739.       update_item_command
  740.       return
  741.     end
  742.   end
  743.   def update_item_command
  744.     if Input.trigger?(Input::B)
  745.       $game_system.se_play($data_system.cancel_se)
  746.       @item_command_window.active = false
  747.       @item_command_window.visible = false
  748.       @command_window.active = true
  749.     end
  750.     if Input.trigger?(Input::C)
  751.       case @item_command_window.index
  752.       when 0
  753.         $game_system.se_play($data_system.decision_se)
  754.         $scene = Scene_Item.new
  755.       when 1
  756.         # 演奏确定 SE
  757.         $game_system.se_play($data_system.decision_se)
  758.         # 激活状态窗口
  759.         @item_command_window.active = false
  760.         @item_command_window.visible = false
  761.         @status_window.active = true
  762.         @status_window.index = 0
  763.       end
  764.     end
  765.   end
  766.   #--------------------------------------------------------------------------
  767.   # ● 刷新画面 (命令窗口被激活的情况下)
  768.   #--------------------------------------------------------------------------
  769.   def update_command
  770.     # 按下 B 键的情况下
  771.     if Input.trigger?(Input::B)
  772.       # 演奏取消 SE
  773.       $game_system.se_play($data_system.cancel_se)
  774.       # 切换的地图画面
  775.       $scene = Scene_Map.new
  776.       return
  777.     end
  778.     # 按下 C 键的情况下
  779.     if Input.trigger?(Input::C)
  780.       # 同伴人数为 0、存档、游戏结束以外的场合
  781.       if $game_party.actors.size == 0 and @command_window.index < 4
  782.         # 演奏冻结 SE
  783.         $game_system.se_play($data_system.buzzer_se)
  784.         return
  785.       end
  786.       # 命令窗口的光标位置分支
  787.       case @command_window.index
  788.       when 0  # 物品
  789.         # 演奏确定 SE
  790.         $game_system.se_play($data_system.decision_se)
  791.         # 激活状态窗口
  792.         @command_window.active = false
  793.         @item_command_window.active = true
  794.         @item_command_window.index = 0
  795.         @item_command_window.visible = true
  796.       when 1  # 特技
  797.         # 演奏确定 SE
  798.         $game_system.se_play($data_system.decision_se)
  799.         # 激活状态窗口
  800.         @command_window.active = false
  801.         @status_window.active = true
  802.         @status_window.index = 0
  803.       when 2  # 装备
  804.         # 演奏确定 SE
  805.         $game_system.se_play($data_system.decision_se)
  806.         # 激活状态窗口
  807.         @command_window.active = false
  808.         @status_window.active = true
  809.         @status_window.index = 0
  810.       when 3  # 状态
  811.         # 演奏确定 SE
  812.         $game_system.se_play($data_system.decision_se)
  813.         # 激活状态窗口
  814.         @command_window.active = false
  815.         @status_window.active = true
  816.         @status_window.index = 0
  817.       when 4  # 存档
  818.         # 禁止存档的情况下
  819.         if $game_system.save_disabled
  820.           # 演奏冻结 SE
  821.           $game_system.se_play($data_system.buzzer_se)
  822.           return
  823.         end
  824.         # 演奏确定 SE
  825.         $game_system.se_play($data_system.decision_se)
  826.         # 切换到存档画面
  827.         $scene = Scene_Save.new
  828.       when 5  # 游戏结束
  829.         # 演奏确定 SE
  830.         $game_system.se_play($data_system.decision_se)
  831.         # 切换到游戏结束画面
  832.         $scene = Scene_End.new
  833.       end
  834.       return
  835.     end
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # ● 刷新画面 (状态窗口被激活的情况下)
  839.   #--------------------------------------------------------------------------
  840.   def update_status
  841.     # 按下 B 键的情况下
  842.     if Input.trigger?(Input::B)
  843.       # 演奏取消 SE
  844.       $game_system.se_play($data_system.cancel_se)
  845.       # 激活命令窗口
  846.       @command_window.active = true
  847.       @status_window.active = false
  848.       @status_window.index = -1
  849.       return
  850.     end
  851.     # 按下 C 键的情况下
  852.     if Input.trigger?(Input::C)
  853.       # 命令窗口的光标位置分支
  854.       case @command_window.index
  855.       when 0  # 物品        
  856.         $game_system.se_play($data_system.decision_se)
  857.         $scene = Scene_Item.new($game_party.actors[@status_window.index])
  858.       when 1  # 特技
  859.         # 本角色的行动限制在 2 以上的情况下
  860.         if $game_party.actors[@status_window.index].restriction >= 2
  861.           # 演奏冻结 SE
  862.           $game_system.se_play($data_system.buzzer_se)
  863.           return
  864.         end
  865.         # 演奏确定 SE
  866.         $game_system.se_play($data_system.decision_se)
  867.         # 切换到特技画面
  868.         $scene = Scene_Skill.new(@status_window.index)
  869.       when 2  # 装备
  870.         # 演奏确定 SE
  871.         $game_system.se_play($data_system.decision_se)
  872.         # 切换的装备画面
  873.         $scene = Scene_Equip.new(@status_window.index)
  874.       when 3  # 状态
  875.         # 演奏确定 SE
  876.         $game_system.se_play($data_system.decision_se)
  877.         # 切换到状态画面
  878.         $scene = Scene_Status.new(@status_window.index)
  879.       end
  880.       return
  881.     end
  882.   end
  883. end

  884. #==============================================================================
  885. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  886. # ■ 使用方法写在发布页
  887. #==============================================================================
  888. # ■ Scene_Item
  889. #------------------------------------------------------------------------------
  890. #  处理物品画面的类。
  891. #==============================================================================

  892. class Scene_Item
  893.   
  894.   #★——添加定义
  895.   def initialize(actor = nil)
  896.     @actor = actor
  897.   end
  898.   
  899.   #--------------------------------------------------------------------------
  900.   # ● 主处理
  901.   #--------------------------------------------------------------------------
  902.   def main
  903.     # 生成帮助窗口、物品窗口
  904.     @help_window = Window_Help.new
  905.     @item_window = Window_Item.new(@actor)
  906.     # 关联帮助窗口
  907.     @item_window.help_window = @help_window
  908.     # 生成目标窗口 (设置为不可见・不活动)
  909.     @target_window = Window_Target.new
  910.     @target_window.visible = false
  911.     @target_window.active = false
  912.     if @actor==nil
  913.       @command_window = Window_Command.new(160,["使用物品","交给他人","丢弃物品"])
  914.     else
  915.       @command_window = Window_Command.new(160,["使用物品","转交他人","丢弃物品","放回仓库"])
  916.     end
  917.     @command_window.x = 240
  918.     @command_window.y = 180
  919.     @command_window.visible = false
  920.     @command_window.active = false
  921.     @command_window.z = 999
  922.     @target_window.z = 10000
  923.     # 执行过度
  924.     Graphics.transition
  925.     # 主循环
  926.     loop do
  927.       # 刷新游戏画面
  928.       Graphics.update
  929.       # 刷新输入信息
  930.       Input.update
  931.       # 刷新画面
  932.       update
  933.       # 如果画面切换就中断循环
  934.       if $scene != self
  935.         break
  936.       end
  937.     end
  938.     # 装备过渡
  939.     Graphics.freeze
  940.     # 释放窗口
  941.     @help_window.dispose
  942.     @item_window.dispose
  943.     @target_window.dispose
  944.     @command_window.dispose
  945.   end
  946.   #--------------------------------------------------------------------------
  947.   # ● 刷新画面
  948.   #--------------------------------------------------------------------------
  949.   def update
  950.     # 刷新窗口
  951.     @help_window.update
  952.     @item_window.update
  953.     @target_window.update
  954.     @command_window.update
  955.     # 物品窗口被激活的情况下: 调用 update_item
  956.     if @item_window.active
  957.       update_item
  958.       return
  959.     end
  960.     # 目标窗口被激活的情况下: 调用 update_target
  961.     if @target_window.active
  962.       update_target
  963.       return
  964.     end
  965.     if @command_window.active
  966.       update_command
  967.       return
  968.     end
  969.   end
  970.   #--------------------------------------------------------------------------
  971.   # ● 刷新画面
  972.   #--------------------------------------------------------------------------
  973.   def update_command
  974.     # 按下 B 键的情况下
  975.     if Input.trigger?(Input::B)
  976.       # 演奏取消 SE
  977.       $game_system.se_play($data_system.cancel_se)
  978.       # 切换到菜单画面
  979.       @command_window.visible = false
  980.       @command_window.active = false
  981.       @item_window.active = true
  982.       return
  983.     end
  984.     # 按下 C 键的情况下
  985.     if Input.trigger?(Input::C)
  986.       case @command_window.index
  987.       when 0
  988.         # 获取物品窗口当前选中的物品数据
  989.         @item = @item_window.item
  990.         # 不使用物品的情况下
  991.         if @actor == nil
  992.           $game_system.se_play($data_system.buzzer_se)
  993.           return
  994.         end
  995.         unless @item.is_a?(RPG::Item)
  996.           # 演奏冻结 SE
  997.           $game_system.se_play($data_system.buzzer_se)
  998.           return
  999.         end
  1000.         # 不能使用的情况下
  1001.         unless $game_party.item_can_use?(@item.id)
  1002.           # 演奏冻结 SE
  1003.           $game_system.se_play($data_system.buzzer_se)
  1004.           return
  1005.         end
  1006.         # 演奏确定 SE
  1007.         $game_system.se_play($data_system.decision_se)
  1008.         # 效果范围是我方的情况下
  1009.         if @item.scope >= 3
  1010.           # 激活目标窗口
  1011.           @command_window.active = false
  1012.           @target_window.x = (@item_window.index + 1) % 2 * 304
  1013.           @target_window.visible = true
  1014.           @target_window.active = true
  1015.           # 设置效果范围 (单体/全体) 的对应光标位置
  1016.           if @item.scope == 4 || @item.scope == 6
  1017.             @target_window.index = -1
  1018.           else
  1019.             @target_window.index = 0
  1020.           end
  1021.         # 效果在我方以外的情况下
  1022.         else
  1023.           # 公共事件 ID 有效的情况下
  1024.           if @item.common_event_id > 0
  1025.             # 预约调用公共事件
  1026.             $game_temp.common_event_id = @item.common_event_id
  1027.             # 演奏物品使用时的 SE
  1028.             $game_system.se_play(@item.menu_se)
  1029.             # 消耗品的情况下
  1030.             if @item.consumable
  1031.               # 使用的物品数减 1
  1032.               if @actor==nil
  1033.                 $game_party.lose_item(@item.id, 1)
  1034.               else
  1035.                 @actor.items.delete_at(@item_window.index)
  1036.               end
  1037.               # 再描绘物品窗口的项目
  1038.               @item_window.draw_item(@item_window.index)
  1039.             end
  1040.             # 切换到地图画面
  1041.             $scene = Scene_Map.new
  1042.             return
  1043.           end
  1044.         end
  1045.         return
  1046.       when 1
  1047.         $game_system.se_play($data_system.decision_se)
  1048.         @command_window.active = false
  1049.         @target_window.visible = true
  1050.         @target_window.index = 0
  1051.         @target_window.active = true
  1052.       when 2
  1053.         $game_system.se_play($data_system.load_se)
  1054.         if @actor != nil
  1055.           @actor.items.delete_at(@item_window.index)
  1056.           @actor.judge_equip
  1057.         else
  1058.           if @item_window.item.is_a?(RPG::Item)
  1059.             $game_party.gain_item(@item_window.item.id,-1)
  1060.           end
  1061.           if @item_window.item.is_a?(RPG::Weapon)
  1062.             $game_party.gain_weapon(@item_window.item.id,-1)
  1063.           end
  1064.           if @item_window.item.is_a?(RPG::Armor)
  1065.             $game_party.gain_armor(@item_window.item.id,-1)
  1066.           end
  1067.         end
  1068.         # 切换到菜单画面
  1069.         @command_window.visible = false
  1070.         @command_window.active = false
  1071.         @item_window.refresh
  1072.         @item_window.active = true
  1073.       when 3
  1074.         if $game_party.item_full?
  1075.           $game_system.se_play($data_system.cancel_se)
  1076.           return
  1077.         end
  1078.         $game_system.se_play($data_system.decision_se)
  1079.         if @item_window.item.is_a?(RPG::Item)
  1080.           $game_party.gain_item(@item_window.item.id,1)
  1081.         end
  1082.         if @item_window.item.is_a?(RPG::Weapon)
  1083.           $game_party.gain_weapon(@item_window.item.id,1)
  1084.         end
  1085.         if @item_window.item.is_a?(RPG::Armor)
  1086.           $game_party.gain_armor(@item_window.item.id,1)
  1087.         end
  1088.         @actor.items.delete_at(@item_window.index)
  1089.         # 切换到菜单画面
  1090.         @command_window.visible = false
  1091.         @command_window.active = false
  1092.         @item_window.refresh
  1093.         @item_window.active = true
  1094.       end
  1095.     end
  1096.   end  
  1097.   #--------------------------------------------------------------------------
  1098.   # ● 刷新画面 (物品窗口被激活的情况下)
  1099.   #--------------------------------------------------------------------------
  1100.   def update_item
  1101.     # 按下 B 键的情况下
  1102.     if Input.trigger?(Input::B)
  1103.       # 演奏取消 SE
  1104.       $game_system.se_play($data_system.cancel_se)
  1105.       # 切换到菜单画面
  1106.       $scene = Scene_Menu.new(0)
  1107.       return
  1108.     end
  1109.     # 按下 C 键的情况下
  1110.     if Input.trigger?(Input::C)
  1111.       # 获取物品窗口当前选中的物品数据
  1112.       @item = @item_window.item
  1113.       $game_system.se_play($data_system.decision_se)
  1114.       if @item.is_a?(RPG::Item) and $game_party.item_can_use?(@item.id) and @actor != nil
  1115.         @command_window.enable_item(0)
  1116.       else
  1117.         @command_window.disable_item(0)
  1118.       end
  1119.       @command_window.index = 0
  1120.       @command_window.visible = true
  1121.       @command_window.active = true
  1122.       @item_window.active = false
  1123.       return
  1124.     end
  1125.     # 按下 R 键的情况下
  1126.     if Input.trigger?(Input::R)
  1127.       $game_system.se_play($data_system.cursor_se)
  1128.       actor_index = 0
  1129.       for i in 0...$game_party.actors.size
  1130.         if @actor==$game_party.actors[i]
  1131.           actor_index = i
  1132.           break
  1133.         end
  1134.       end
  1135.       actor_index += 1
  1136.       actor_index %= $game_party.actors.size
  1137.       # 切换到别的特技画面
  1138.       $scene = Scene_Item.new($game_party.actors[actor_index])
  1139.       return
  1140.     end
  1141.     # 按下 L 键的情况下
  1142.     if Input.trigger?(Input::L)
  1143.       # 演奏光标 SE
  1144.       $game_system.se_play($data_system.cursor_se)      
  1145.       actor_index = 0
  1146.       for i in 0...$game_party.actors.size
  1147.         if @actor==$game_party.actors[i]
  1148.           actor_index = i
  1149.           break
  1150.         end
  1151.       end
  1152.       actor_index -= 1
  1153.       actor_index %= $game_party.actors.size
  1154.       # 切换到别的特技画面
  1155.       $scene = Scene_Item.new($game_party.actors[actor_index])
  1156.       return
  1157.     end
  1158.   end
  1159.   #--------------------------------------------------------------------------
  1160.   # ● 刷新画面 (目标窗口被激活的情况下)
  1161.   #--------------------------------------------------------------------------
  1162.   def update_target
  1163.     # 按下 B 键的情况下
  1164.     if Input.trigger?(Input::B)
  1165.       # 演奏取消 SE
  1166.       $game_system.se_play($data_system.cancel_se)
  1167.       # 由于物品用完而不能使用的场合
  1168.       unless $game_party.item_can_use?(@item.id)
  1169.         # 再次生成物品窗口的内容
  1170.         @item_window.refresh
  1171.       end
  1172.       # 删除目标窗口
  1173.       @command_window.active = true
  1174.       @target_window.visible = false
  1175.       @target_window.active = false
  1176.       return
  1177.     end
  1178.     # 按下 C 键的情况下
  1179.     if Input.trigger?(Input::C)
  1180.       if @command_window.index==0
  1181.         # 目标是全体的情况下
  1182.         if @target_window.index == -1
  1183.           # 对同伴全体应用物品使用效果
  1184.           used = false
  1185.           for i in $game_party.actors
  1186.             used |= i.item_effect(@item)
  1187.           end
  1188.         end
  1189.         # 目标是单体的情况下
  1190.         if @target_window.index >= 0
  1191.           # 对目标角色应用物品的使用效果
  1192.           target = $game_party.actors[@target_window.index]
  1193.           used = target.item_effect(@item)
  1194.         end
  1195.         # 使用物品的情况下
  1196.         if used
  1197.           # 演奏物品使用时的 SE
  1198.           $game_system.se_play(@item.menu_se)
  1199.           # 消耗品的情况下
  1200.           if @item.consumable
  1201.             
  1202.             if @actor == nil
  1203.               # 使用的物品数减 1
  1204.               $game_party.lose_item(@item.id, 1)
  1205.             else
  1206.               @actor.items.delete_at(@item_window.index)
  1207.             end
  1208.             
  1209.             # 再描绘物品窗口的项目
  1210.             @item_window.draw_item(@item_window.index)
  1211.           end
  1212.           # 再生成目标窗口的内容
  1213.           @target_window.refresh
  1214.           # 全灭的情况下
  1215.           if $game_party.all_dead?
  1216.             # 切换到游戏结束画面
  1217.             $scene = Scene_Gameover.new
  1218.             return
  1219.           end
  1220.           # 公共事件 ID 有效的情况下
  1221.           if @item.common_event_id > 0
  1222.             # 预约调用公共事件
  1223.             $game_temp.common_event_id = @item.common_event_id
  1224.             # 切换到地图画面
  1225.             $scene = Scene_Map.new
  1226.             return
  1227.           end
  1228.           @item_window.refresh
  1229.           @item_window.index -= 1 if @item_window.index >0
  1230.         end
  1231.         # 无法使用物品的情况下
  1232.         unless used
  1233.           # 演奏冻结 SE
  1234.           $game_system.se_play($data_system.buzzer_se)
  1235.         end
  1236.         return
  1237.       end
  1238.       if @command_window.index==1
  1239.         if $game_party.actors[@target_window.index].item_full?
  1240.           $game_system.se_play($data_system.buzzer_se)
  1241.           return
  1242.         end
  1243.         if @actor != nil
  1244.           @actor.items.delete_at(@item_window.index)
  1245.         else
  1246.           if @item_window.item.is_a?(RPG::Item)
  1247.             $game_party.lose_item(@item_window.item.id, 1)
  1248.           elsif @item_window.item.is_a?(RPG::Weapon)
  1249.             $game_party.lose_weapon(@item_window.item.id, 1)
  1250.           elsif @item_window.item.is_a?(RPG::Armor)
  1251.             $game_party.lose_armor(@item_window.item.id, 1)
  1252.           end
  1253.         end
  1254.         $game_system.se_play($data_system.decision_se)
  1255.         $game_party.actors[@target_window.index].items.push(@item_window.item)
  1256.         @item_window.refresh
  1257.         @item_window.index -= 1 if @item_window.index>0
  1258.         @item_window.active = true
  1259.         @command_window.visible = false
  1260.         @command_window.active = false
  1261.         @command_window.index = 0
  1262.         @target_window.visible = false
  1263.         @target_window.active = false
  1264.       end
  1265.     end
  1266.   end
  1267. end

  1268. #==============================================================================
  1269. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  1270. # ■ 使用方法写在发布页
  1271. #==============================================================================
  1272. # ■ Scene_Battle (分割定义 3)
  1273. #------------------------------------------------------------------------------
  1274. #  处理战斗画面的类。
  1275. #==============================================================================

  1276. class Scene_Battle
  1277.   #--------------------------------------------------------------------------
  1278.   # ● 开始选择物品
  1279.   #--------------------------------------------------------------------------
  1280.   def start_item_select
  1281.     # 生成物品窗口
  1282.     @item_window = Window_Item.new($game_party.actors[@actor_index])
  1283.     # 关联帮助窗口
  1284.     @item_window.help_window = @help_window
  1285.     # 无效化角色指令窗口
  1286.     @actor_command_window.active = false
  1287.     @actor_command_window.visible = false
  1288.   end
  1289.   #--------------------------------------------------------------------------
  1290.   # ● 刷新画面 (角色命令回合 : 选择物品)
  1291.   #--------------------------------------------------------------------------
  1292.   def update_phase3_item_select
  1293.     # 设置物品窗口为可视状态
  1294.     @item_window.visible = true
  1295.     # 刷新物品窗口
  1296.     @item_window.update
  1297.     # 按下 B 键的情况下
  1298.     if Input.trigger?(Input::B)
  1299.       # 演奏取消 SE
  1300.       $game_system.se_play($data_system.cancel_se)
  1301.       # 选择物品结束
  1302.       end_item_select
  1303.       return
  1304.     end
  1305.     # 按下 C 键的情况下
  1306.     if Input.trigger?(Input::C)
  1307.       # 获取物品窗口现在选择的物品资料
  1308.       @item = @item_window.item
  1309.       unless @item.is_a?(RPG::Item)
  1310.         # 演奏冻结 SE
  1311.         $game_system.se_play($data_system.buzzer_se)
  1312.         return
  1313.       end
  1314.       # 无法使用的情况下
  1315.       unless $game_party.item_can_use?(@item.id)
  1316.         # 演奏冻结 SE
  1317.         $game_system.se_play($data_system.buzzer_se)
  1318.         return
  1319.       end
  1320.       # 演奏确定 SE
  1321.       $game_system.se_play($data_system.decision_se)
  1322.       # 设置行动
  1323.       @active_battler.current_action.item_id = @item.id
  1324.       # 设置物品窗口为不可见状态
  1325.       @item_window.visible = false
  1326.       # 效果范围是敌单体的情况下
  1327.       if @item.scope == 1
  1328.         # 开始选择敌人
  1329.         start_enemy_select
  1330.       # 效果范围是我方单体的情况下
  1331.       elsif @item.scope == 3 or @item.scope == 5
  1332.         # 开始选择角色
  1333.         start_actor_select
  1334.       # 效果范围不是单体的情况下
  1335.       else
  1336.         # 物品选择结束
  1337.         end_item_select
  1338.         # 转到下一位角色的指令输入
  1339.         phase3_next_actor
  1340.       end
  1341.       return
  1342.     end
  1343.   end
  1344. end

  1345. #==============================================================================
  1346. # ■ 本脚本来自[url]www.66rpg.com[/url],作者柳柳,转载使用请保留此信息
  1347. # ■ 使用方法写在发布页
  1348. #==============================================================================
  1349. # ■ Scene_Shop
  1350. #------------------------------------------------------------------------------
  1351. #  处理商店画面的类。
  1352. #==============================================================================

  1353. class Scene_Shop
  1354.   #--------------------------------------------------------------------------
  1355.   # ● 主处理
  1356.   #--------------------------------------------------------------------------
  1357.   def main
  1358.    
  1359.     @type = 0   
  1360.    
  1361.     # 生成帮助窗口
  1362.     @help_window = Window_Help.new
  1363.     # 生成指令窗口
  1364.     @command_window = Window_ShopCommand.new
  1365.     # 生成金钱窗口
  1366.     @gold_window = Window_Gold.new
  1367.     @gold_window.x = 480
  1368.     @gold_window.y = 64
  1369.     # 生成时间窗口
  1370.     @dummy_window = Window_Base.new(0, 128, 640, 352)
  1371.     # 生成购买窗口
  1372.     @buy_window = Window_ShopBuy.new($game_temp.shop_goods)
  1373.     @buy_window.active = false
  1374.     @buy_window.visible = false
  1375.     @buy_window.help_window = @help_window
  1376.     # 生成卖出窗口
  1377.     @sell_window = Window_ShopSell.new
  1378.     @sell_window.active = false
  1379.     @sell_window.visible = false
  1380.     @sell_window.help_window = @help_window
  1381.     # 生成状态窗口
  1382.     @status_window = Window_ShopStatus_New.new
  1383.     @status_window.visible = false
  1384.     @status_window.index = -1
  1385.     # 执行过渡
  1386.     Graphics.transition
  1387.     # 主循环
  1388.     loop do
  1389.       # 刷新游戏画面
  1390.       Graphics.update
  1391.       # 刷新输入信息
  1392.       Input.update
  1393.       # 刷新画面
  1394.       update
  1395.       # 如果画面切换的话就中断循环
  1396.       if $scene != self
  1397.         break
  1398.       end
  1399.     end
  1400.     # 准备过渡
  1401.     Graphics.freeze
  1402.     # 释放窗口
  1403.     @help_window.dispose
  1404.     @command_window.dispose
  1405.     @gold_window.dispose
  1406.     @dummy_window.dispose
  1407.     @buy_window.dispose
  1408.     @sell_window.dispose
  1409.     @status_window.dispose
  1410.   end
  1411.   #--------------------------------------------------------------------------
  1412.   # ● 刷新画面
  1413.   #--------------------------------------------------------------------------
  1414.   def update
  1415.     # 刷新窗口
  1416.     @help_window.update
  1417.     @command_window.update
  1418.     @gold_window.update
  1419.     @dummy_window.update
  1420.     @buy_window.update
  1421.     @sell_window.update
  1422.     @status_window.update
  1423.     # 指令窗口激活的情况下: 调用 update_command
  1424.     if @command_window.active
  1425.       update_command
  1426.       return
  1427.     end
  1428.     # 购买窗口激活的情况下: 调用 update_buy
  1429.     if @buy_window.active
  1430.       update_buy
  1431.       return
  1432.     end
  1433.     # 卖出窗口激活的情况下: 调用 update_sell
  1434.     if @sell_window.active
  1435.       update_sell
  1436.       return
  1437.     end
  1438.     if @type==1
  1439.       update_st1
  1440.       return
  1441.     end
  1442.   end
  1443.   
  1444.   def update_st1
  1445.     if Input.trigger?(Input::B)
  1446.       $game_system.se_play($data_system.cancel_se)
  1447.       @buy_window.active = true
  1448.       @type = 0
  1449.       @status_window.index = -1
  1450.       @status_window.active = false
  1451.       return
  1452.     end
  1453.     if Input.trigger?(Input::C)
  1454.       if @status_window.index == 0        
  1455.         if $game_party.item_full?
  1456.           $game_system.se_play($data_system.cancel_se)
  1457.           return
  1458.         end        
  1459.         # 演奏商店 SE
  1460.         $game_system.se_play($data_system.shop_se)
  1461.         $game_party.lose_gold(@item.price)
  1462.         case @item
  1463.         when RPG::Item
  1464.           $game_party.gain_item(@item.id, 1)
  1465.         when RPG::Weapon
  1466.           $game_party.gain_weapon(@item.id, 1)
  1467.         when RPG::Armor
  1468.           $game_party.gain_armor(@item.id, 1)
  1469.         end
  1470.         # 刷新各窗口
  1471.         @gold_window.refresh
  1472.         @buy_window.refresh
  1473.         @status_window.refresh
  1474.         # 窗口状态转向购买模式
  1475.         @buy_window.active = true
  1476.         @buy_window.visible = true
  1477.         @status_window.active = false
  1478.         @status_window.index = -1
  1479.         @type = 0
  1480.       else
  1481.         if $game_party.actors[@status_window.index-1].item_full?
  1482.           $game_system.se_play($data_system.cancel_se)
  1483.           return
  1484.         end        
  1485.         # 演奏商店 SE
  1486.         $game_system.se_play($data_system.shop_se)
  1487.         $game_party.lose_gold(@item.price)
  1488.         case @item
  1489.         when RPG::Item
  1490.           $game_party.actors[@status_window.index-1].gain_item(@item.id, 1)
  1491.         when RPG::Weapon
  1492.           $game_party.actors[@status_window.index-1].gain_item(@item.id, 2)
  1493.         when RPG::Armor
  1494.           $game_party.actors[@status_window.index-1].gain_item(@item.id, 3)
  1495.         end
  1496.         # 刷新各窗口
  1497.         @gold_window.refresh
  1498.         @buy_window.refresh
  1499.         @status_window.refresh
  1500.         # 窗口状态转向购买模式
  1501.         @buy_window.active = true
  1502.         @status_window.active = false
  1503.         @type = 0
  1504.         @status_window.index = -1
  1505.       end
  1506.     end
  1507.   end
  1508.   #--------------------------------------------------------------------------
  1509.   # ● 刷新画面 (指令窗口激活的情况下)
  1510.   #--------------------------------------------------------------------------
  1511.   def update_command
  1512.     # 按下 B 键的情况下
  1513.     if Input.trigger?(Input::B)
  1514.       # 演奏取消 SE
  1515.       $game_system.se_play($data_system.cancel_se)
  1516.       # 切换到地图画面
  1517.       $scene = Scene_Map.new
  1518.       return
  1519.     end
  1520.     # 按下 C 键的情况下
  1521.     if Input.trigger?(Input::C)
  1522.       # 命令窗口光标位置分支
  1523.       case @command_window.index
  1524.       when 0  # 购买
  1525.         # 演奏确定 SE
  1526.         $game_system.se_play($data_system.decision_se)
  1527.         # 窗口状态转向购买模式
  1528.         @command_window.active = false
  1529.         @dummy_window.visible = false
  1530.         @buy_window.active = true
  1531.         @buy_window.visible = true
  1532.         @buy_window.refresh
  1533.         @status_window.visible = true
  1534.       when 1  # 卖出
  1535.         # 演奏确定 SE
  1536.         $game_system.se_play($data_system.decision_se)
  1537.         # 窗口状态转向卖出模式
  1538.         @command_window.active = false
  1539.         @dummy_window.visible = false
  1540.         @sell_window.active = true
  1541.         @sell_window.visible = true
  1542.         @sell_window.refresh
  1543.       when 2  # 取消
  1544.         # 演奏确定 SE
  1545.         $game_system.se_play($data_system.decision_se)
  1546.         # 切换到地图画面
  1547.         $scene = Scene_Map.new
  1548.       end
  1549.       return
  1550.     end
  1551.   end
  1552.   #--------------------------------------------------------------------------
  1553.   # ● 刷新画面 (购买窗口激活的情况下)
  1554.   #--------------------------------------------------------------------------
  1555.   def update_buy
  1556.     # 设置状态窗口的物品
  1557.     @status_window.item = @buy_window.item
  1558.     # 按下 B 键的情况下
  1559.     if Input.trigger?(Input::B)
  1560.       # 演奏取消 SE
  1561.       $game_system.se_play($data_system.cancel_se)
  1562.       # 窗口状态转向初期模式
  1563.       @command_window.active = true
  1564.       @dummy_window.visible = true
  1565.       @buy_window.active = false
  1566.       @buy_window.visible = false
  1567.       @status_window.visible = false
  1568.       @status_window.item = nil
  1569.       # 删除帮助文本
  1570.       @help_window.set_text("")
  1571.       return
  1572.     end
  1573.     # 按下 C 键的情况下
  1574.     if Input.trigger?(Input::C)
  1575.       # 获取物品
  1576.       @item = @buy_window.item
  1577.       # 物品无效的情况下、或者价格在所持金以上的情况下
  1578.       if @item == nil or @item.price > $game_party.gold
  1579.         # 演奏冻结 SE
  1580.         $game_system.se_play($data_system.buzzer_se)
  1581.         return
  1582.       end
  1583.       # 获取物品所持数
  1584.       #case @item
  1585.       #when RPG::Item
  1586.         #number = $game_party.item_number(@item.id)
  1587.       #when RPG::Weapon
  1588.         #number = $game_party.weapon_number(@item.id)
  1589.       #when RPG::Armor
  1590.         #number = $game_party.armor_number(@item.id)
  1591.       #end
  1592.       # 如果已经拥有了 99 个情况下
  1593.       #if number == 99
  1594.         # 演奏冻结 SE
  1595.         #$game_system.se_play($data_system.buzzer_se)
  1596.         #return
  1597.       #end
  1598.       # 演奏确定 SE
  1599.       $game_system.se_play($data_system.decision_se)
  1600.       # 计算可以最多购买的数量
  1601.       #max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  1602.       #max = [max, 99 - number].min
  1603.       # 窗口状态转向数值输入模式
  1604.       #@buy_window.active = false
  1605.       #@buy_window.visible = false
  1606.       #@number_window.set(@item, max, @item.price)
  1607.       #@number_window.active = true
  1608.       #@number_window.visible = true
  1609.       @buy_window.active = false
  1610.       @status_window.index = 0
  1611.       @type = 1
  1612.       @status_window.active = true
  1613.     end
  1614.   end
  1615.   #--------------------------------------------------------------------------
  1616.   # ● 画面更新 (卖出窗口激活的情况下)
  1617.   #--------------------------------------------------------------------------
  1618.   def update_sell
  1619.     # 按下 B 键的情况下
  1620.     if Input.trigger?(Input::B)
  1621.       # 演奏取消 SE
  1622.       $game_system.se_play($data_system.cancel_se)
  1623.       # 窗口状态转向初期模式
  1624.       @command_window.active = true
  1625.       @dummy_window.visible = true
  1626.       @sell_window.active = false
  1627.       @sell_window.visible = false
  1628.       @status_window.item = nil
  1629.       # 删除帮助文本
  1630.       @help_window.set_text("")
  1631.       return
  1632.     end
  1633.     # 按下 C 键的情况下
  1634.     if Input.trigger?(Input::C)
  1635.       # 获取物品
  1636.       @item = @sell_window.item
  1637.       # 设置状态窗口的物品
  1638.       @status_window.item = @item
  1639.       # 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
  1640.       if @item == nil or @item.price == 0
  1641.         # 演奏冻结 SE
  1642.         $game_system.se_play($data_system.buzzer_se)
  1643.         return
  1644.       end
  1645.       # 演奏确定 SE
  1646.       $game_system.se_play($data_system.decision_se)      
  1647.       # 卖出处理
  1648.       $game_party.gain_gold(@item.price / 2)
  1649.       case @item
  1650.       when RPG::Item
  1651.         $game_party.lose_item(@item.id, 1)
  1652.       when RPG::Weapon
  1653.         $game_party.lose_weapon(@item.id, 1)
  1654.       when RPG::Armor
  1655.         $game_party.lose_armor(@item.id, 1)
  1656.       end
  1657.       # 刷新各窗口
  1658.       @gold_window.refresh
  1659.       @sell_window.refresh
  1660.       @status_window.refresh
  1661.     end
  1662.   end
  1663. end
复制代码


物品詳細幫助窗口
  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. =begin
  142.     name_size = 名字文字大小
  143.     size = 描述文字大小
  144.     word = 每行的描述文字數
  145.     move = 全體描述偏移幅度
  146. =end
  147.     name_size = 18
  148.     size = 14
  149.     word = 12
  150.     move = 80
  151.     #------------------------------------------------------------------------
  152.     # ● 確定背景圖片的高度
  153.     #------------------------------------------------------------------------
  154.     h += (description.size/3/word)
  155.     h += 1 if (description.size/3%word) > 0
  156.     h += 1 if equipment.is_a?(RPG::Weapon)
  157.     now_h = h
  158.     h += 1
  159.     h += 1 unless equipment.pdef.zero?
  160.     h += 1 unless equipment.mdef.zero?
  161.     h += 1 if element_set.size > 0
  162.     h += 1 if element_set.size >= 5
  163.     case equipment
  164.     when RPG::Weapon
  165.       h += 1 unless minus_state_set.empty?
  166.       h += minus_state_set.size
  167.       h += 1 unless plus_state_set.empty?
  168.       h += plus_state_set.size
  169.     when RPG::Armor
  170.       h += 1 unless guard_state_set.empty?
  171.       h += guard_state_set.size
  172.       h += 1 unless auto_state_id.zero?
  173.     end
  174.     h += 1
  175.     h += 1 unless equipment.str_plus.zero?
  176.     h += 1 unless equipment.dex_plus.zero?
  177.     h += 1 unless equipment.agi_plus.zero?
  178.     h += 1 unless equipment.int_plus.zero?
  179.     #h += 1 unless equipment.hp_plus.zero?
  180.     h += materia_height_plus(equipment) unless self.materia.nil?
  181.     #------------------------------------------------------------------------
  182.     # ● 圖片顯示保證高度
  183.     #------------------------------------------------------------------------
  184.     h = 6 + now_h if (h - now_h) < 6
  185.     #------------------------------------------------------------------------
  186.     # ● 換算高度
  187.     #------------------------------------------------------------------------
  188.     self.height = h * size + name_size + 100
  189.     #------------------------------------------------------------------------
  190.     # ● 生成背景
  191.     #------------------------------------------------------------------------
  192.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  193.     self.contents.clear
  194.     #------------------------------------------------------------------------
  195.     # ● 名字描繪
  196.     #------------------------------------------------------------------------
  197.     text = equipment.name
  198.     self.contents.font.color = text_color(1)#(equipment.name_color)
  199.     self.contents.font.size = name_size
  200.     if text.nil?
  201.       self.visible = false
  202.     else
  203.       self.visible = true
  204.       self.contents.draw_text(0, 0, text.size*7, name_size, text, 0)
  205.     end
  206.     #------------------------------------------------------------------------
  207.     # ● 說明描繪
  208.     #------------------------------------------------------------------------
  209.     x = 0
  210.     y += 1
  211.     while ((text = description.slice!(/./m)) != nil)
  212.       self.contents.font.color = system_color
  213.       self.contents.font.size = size
  214.       self.contents.draw_text(x*size, y*size+5, size, size, text, 0)
  215.       x+=1
  216.       if x == word
  217.         x=0
  218.         y+=1   
  219.       end
  220.     end
  221.     #------------------------------------------------------------------------
  222.     # ● 圖標描繪
  223.     #------------------------------------------------------------------------
  224.     bitmap = RPG::Cache.icon(equipment.icon_name)
  225.     opacity = self.contents.font.color == normal_color ? 255 : 128
  226.     self.contents.blt(0 ,y*size + 20, bitmap, Rect.new(0, 0, 95, 100), 225)
  227.     #------------------------------------------------------------------------
  228.     # ● 攻擊力描繪(武器)
  229.     #------------------------------------------------------------------------
  230.     if equipment.is_a?(RPG::Weapon)
  231.       x = 0
  232.       y += 1
  233.       text = $data_system.words.atk+":"+equipment.atk.to_s
  234.       self.contents.font.color = Color.new(255, 0, 0, 255)
  235.       self.contents.font.size = size
  236.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  237.     end
  238.     #------------------------------------------------------------------------
  239.     # ● 價格描繪
  240.     #------------------------------------------------------------------------
  241.     x = 0
  242.     y += 1
  243.     text = phrase["price"] + equipment.price.to_s
  244.     self.contents.font.color = Color.new(255, 255, 0, 255)
  245.     self.contents.font.size = size
  246.     self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  247.     #------------------------------------------------------------------------
  248.     # ● 物理防禦
  249.     #------------------------------------------------------------------------
  250.     unless equipment.pdef.zero?
  251.       x = 0
  252.       y += 1
  253.       text = $data_system.words.pdef+":"+equipment.pdef.to_s
  254.       self.contents.font.color = Color.new(0, 255, 255, 255)
  255.       self.contents.font.size = size
  256.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  257.     end
  258.     #------------------------------------------------------------------------
  259.     # ● 魔法防禦
  260.     #------------------------------------------------------------------------
  261.     unless equipment.mdef.zero?
  262.       x = 0
  263.       y += 1
  264.       text=$data_system.words.mdef+":"+equipment.mdef.to_s
  265.       self.contents.font.color = Color.new(255, 0, 255, 255)
  266.       self.contents.font.size = size
  267.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  268.     end
  269.     #------------------------------------------------------------------------
  270.     # ● 屬性
  271.     #------------------------------------------------------------------------
  272. #------------------------------------------------------------------------
  273.     # ● 屬性
  274.     #------------------------------------------------------------------------
  275.     if element_set.size > 0
  276.       x = 0
  277.       y += 1
  278.       text = phrase["elements"]
  279.       self.contents.font.size = size
  280.       self.contents.font.color = Color.new(255, 0, 255, 255)
  281.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  282.       ax = (phrase["elements"].size)*5+40
  283.       for i in 0...element_set.size
  284.         text = $data_system.elements[element_set[i]]
  285.         self.contents.draw_text(ax, y*size+18, text.size*6, size, text, 0)
  286.         y += 1
  287.       end
  288.     end
  289.     #------------------------------------------------------------------------
  290.     # ● 描述分流 武器/防具
  291.     #------------------------------------------------------------------------
  292.     case equipment
  293.     when RPG::Weapon
  294.       #------------------------------------------------------------------------
  295.       # ● 解除狀態(武器)
  296.       #------------------------------------------------------------------------
  297.       unless minus_state_set.empty?
  298.         x = 0
  299.         y += 1
  300.         text=phrase["minus_states"]
  301.         text=phrase["guard_states"]
  302.         self.contents.font.color = Color.new(0, 255, 255, 255)
  303.         self.contents.font.size = size
  304.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  305.         for i in 0...minus_state_set.size
  306.           y += 1
  307.           text = $data_states[minus_state_set[i]].name        
  308.           self.contents.font.color = Color.new(0, 255, 255, 255)
  309.           self.contents.font.size = size
  310.           self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)        
  311.         end
  312.       end
  313.       #------------------------------------------------------------------------
  314.       # ● 附加狀態(武器)
  315.       #------------------------------------------------------------------------
  316.       unless plus_state_set.empty?
  317.         x = 0
  318.         y += 1
  319.         text = phrase["plus_states"]
  320.         self.contents.font.color = Color.new(255, 0, 0, 255)
  321.         self.contents.font.size = size
  322.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  323.         for i in 0...plus_state_set.size
  324.           y += 1
  325.           text=$data_states[plus_state_set[i]].name        
  326.           self.contents.font.color = Color.new(255, 0, 0, 255)
  327.           self.contents.font.size = size
  328.           self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)        
  329.         end  
  330.       end
  331.     when RPG::Armor
  332.       #------------------------------------------------------------------------
  333.       # ● 防禦狀態(防具)
  334.       #------------------------------------------------------------------------
  335.       unless guard_state_set.empty?
  336.         x = 0
  337.         y += 1
  338.         text=phrase["guard_states"]
  339.         self.contents.font.color = Color.new(0, 255, 0, 255)
  340.         self.contents.font.size = size
  341.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  342.         for i in 0...guard_state_set.size
  343.           y += 1
  344.           text = $data_states[guard_state_set[i]].name        
  345.           self.contents.font.color = Color.new(0, 255, 0, 255)
  346.           self.contents.font.size = size
  347.           self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)        
  348.         end
  349.       end
  350.       #------------------------------------------------------------------------
  351.       # ● 自動狀態(防具)
  352.       #------------------------------------------------------------------------
  353.       unless auto_state_id.zero?
  354.         x = 0
  355.         y += 1
  356.         text = phrase["auto_state"] + $data_states[auto_state_id].name
  357.         self.contents.font.color = Color.new(0, 255, 0, 255)
  358.         self.contents.font.size = size
  359.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  360.       end
  361.     end
  362.     #------------------------------------------------------------------------
  363.     # ● 空行
  364.     #------------------------------------------------------------------------
  365.     y+=1
  366.     #------------------------------------------------------------------------
  367.     # ● 力量
  368.     #------------------------------------------------------------------------
  369.     unless equipment.str_plus.zero?
  370.       x = 0
  371.       y += 1
  372.       h += 1
  373.       if equipment.str_plus > 0
  374.         text=$data_system.words.str+" +"+ equipment.str_plus.to_s
  375.       else
  376.         text=$data_system.words.str+" -"+ (-equipment.str_plus).to_s
  377.       end
  378.       self.contents.font.color = Color.new(255, 0, 0, 255)
  379.       self.contents.font.size = size
  380.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)  
  381.     end
  382.     #------------------------------------------------------------------------
  383.     # ● 靈巧
  384.     #------------------------------------------------------------------------
  385.     unless equipment.dex_plus.zero?
  386.       x = 0
  387.       y += 1
  388.       h += 1
  389.       if equipment.dex_plus > 0
  390.         text=$data_system.words.dex+" +"+ equipment.dex_plus.to_s
  391.       else
  392.         text=$data_system.words.dex+" -"+ (-equipment.dex_plus).to_s
  393.       end
  394.       self.contents.font.color = Color.new(255, 255, 0, 255)
  395.       self.contents.font.size = size
  396.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  397.     end
  398.     #------------------------------------------------------------------------
  399.     # ● 速度
  400.     #------------------------------------------------------------------------
  401.     unless equipment.agi_plus.zero?
  402.       x = 0
  403.       y += 1
  404.       h += 1
  405.       if equipment.agi_plus > 0
  406.         text=$data_system.words.agi+" +"+ equipment.agi_plus.to_s
  407.       else
  408.         text=$data_system.words.agi+" -"+ (-equipment.agi_plus).to_s
  409.       end
  410.       self.contents.font.color = Color.new(0, 255, 255, 255)
  411.       self.contents.font.size = size
  412.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  413.     end
  414.     #------------------------------------------------------------------------
  415.     # ● 智力
  416.     #------------------------------------------------------------------------
  417.     unless equipment.int_plus.zero?
  418.       x = 0
  419.       y += 1
  420.       h += 1
  421.       if equipment.int_plus > 0
  422.         text=$data_system.words.int+" +"+ equipment.int_plus.to_s
  423.       else
  424.         text=$data_system.words.int+" -"+ (-equipment.int_plus).to_s
  425.       end
  426.       self.contents.font.color = Color.new(255, 0, 255, 255)
  427.       self.contents.font.size = size
  428.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  429.     end
  430.     #------------------------------------------------------------------------
  431.     # ● HP MAX增加值
  432.     #------------------------------------------------------------------------
  433.     #unless equipment.hp_plus.zero?
  434.     #  x = 0
  435.     #  y += 1
  436.     #  h += 1
  437.     #  if equipment.hp_plus > 0
  438.     #    text=phrase["hp-max"]+" +"+ equipment.hp_plus.to_s
  439.     #  else
  440.     #    text=phrase["hp-max"]+" -"+ (-equipment.hp_plus).to_s
  441.     #  end
  442.     #  self.contents.font.color = normal_color
  443.      # self.contents.font.size = size
  444.      # self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  445.     #end
  446.     #------------------------------------------------------------------------
  447.     # ● 魔力石描繪
  448.     #------------------------------------------------------------------------
  449.     y += draw_materia(equipment, move, y, size) unless self.materia.nil?
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● 物品幫助窗口
  453.   #--------------------------------------------------------------------------
  454.   def set_item_text(item)
  455.     # 取得描述
  456.     description = item.description.clone
  457.     # 取得屬性、附加狀態、解除狀態之副本
  458.     element_set = item.element_set.clone
  459.     plus_state_set = item.plus_state_set.clone
  460.     minus_state_set = item.minus_state_set.clone
  461.     # 過濾不顯示的描述
  462.     element_set -= @unshow_elements
  463.     plus_state_set -= @unshow_states
  464.     minus_state_set -= @unshow_states
  465.     # 初始化數據設定
  466.     x = 0
  467.     y = 0
  468.     h = 0
  469.     phrase = {}
  470.     scope ={}
  471.     parameter_type = {}
  472.    
  473.     # 基本數據設定
  474. =begin
  475.     name_size = 名字文字大小
  476.     size = 描述文字大小
  477.     word = 每行的描述文字數
  478.     move = 全體描述偏移幅度
  479. =end
  480.     name_size = 18
  481.     size = 14
  482.     word = 12
  483.     move = 80
  484.    
  485.     # 基本文字設定
  486.     phrase["scope"] = "范围:"
  487.     phrase["price"] = "价格:"
  488.     phrase["recover_hp_rate"] = "HP 回复率:"
  489.     phrase["recover_hp"] = "HP 回复:"
  490.     phrase["recover_sp_rate"] = "SP 回复率:"
  491.     phrase["recover_sp"] = "SP 回复:"
  492.     phrase["elements"] = "属性:"
  493.     phrase["plus"] = "附加"
  494.     phrase["minus"] = "解除"
  495.     phrase["states"] = "状态"
  496.     scope[0] = "特殊物品"
  497.     scope[1] = "敌单体"
  498.     scope[2] = "敌全体"
  499.     scope[3] = "己方单体"
  500.     scope[4] = "己方全体"
  501.     scope[5] = "己方单体(HP=0)"
  502.     scope[6] = "己方全体(HP=0)"
  503.     scope[7] = "使用者"
  504.     scope[8] = "使用者"

  505.     parameter_type[1] = "MaxHP"
  506.     parameter_type[2] = "MaxSP"
  507.     parameter_type[3] = $data_system.words.str
  508.     parameter_type[4] = $data_system.words.dex
  509.     parameter_type[5] = $data_system.words.agi
  510.     parameter_type[6] = $data_system.words.int
  511.    
  512.     #依顯示内容確定自身高
  513.     h = (description.size/3/word)
  514.     h +=1 if (description.size/3%word)> 0
  515.     now_h = h
  516.     h +=3  # 空行,效果範圍,價格
  517.     h += 1 unless item.recover_hp_rate.zero?
  518.     h += 1 unless item.recover_hp.zero?
  519.     h += 1 unless item.recover_sp_rate.zero?
  520.     h += 1 unless item.recover_sp.zero?
  521.     h += 1 unless item.parameter_type.zero?
  522.     h += 1 unless element_set[0].nil?
  523.     h += 1 unless element_set[4].nil?
  524.     h += (1+plus_state_set.size) unless plus_state_set.empty?
  525.     h += (1+minus_state_set.size) unless minus_state_set.empty?
  526.     #------------------------------------------------------------------------
  527.     # ● 圖片顯示保證高度
  528.     #------------------------------------------------------------------------
  529.     h = 6 + now_h if (h - now_h) < 6
  530.     #------------------------------------------------------------------------
  531.     # ● 換算高度
  532.     #------------------------------------------------------------------------
  533.     self.height = h * size + name_size + 32
  534.     #------------------------------------------------------------------------
  535.     # ● 生成背景
  536.     #------------------------------------------------------------------------
  537.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  538.     self.contents.clear
  539.     #------------------------------------------------------------------------
  540.     # ● 名字描繪
  541.     #------------------------------------------------------------------------
  542.     text = item.name
  543.     self.contents.font.color = Color.new(0, 0, 255, 255)
  544.     self.contents.font.size = name_size
  545.     if text.nil?
  546.       self.visible = false
  547.     else
  548.       self.visible = true
  549.       self.contents.draw_text(0,0, text.size*7, 20, text, 0)
  550.     end
  551.     #------------------------------------------------------------------------
  552.     # ● 說明描繪
  553.     #------------------------------------------------------------------------
  554.     x = 0
  555.     y += 1
  556.     while ((text = description.slice!(/./m)) != nil)
  557.       self.contents.font.color = system_color
  558.       self.contents.font.size = size
  559.       self.contents.draw_text(x*size, y*size+5, size, size, text, 0)
  560.       x+=1
  561.       if x == word
  562.         x = 0
  563.         y += 1
  564.       end
  565.     end
  566.     #------------------------------------------------------------------------
  567.     # ● 圖標描繪
  568.     #------------------------------------------------------------------------
  569.     bitmap = RPG::Cache.icon(item.icon_name) unless item.icon_name.nil?
  570.     opacity = self.contents.font.color == normal_color ? 255 : 128
  571.     self.contents.blt(0 ,y*size + 20, bitmap, Rect.new(0, 0, 95, 100), 225)
  572.     #------------------------------------------------------------------------
  573.     # ● 魔力石接口
  574.     #------------------------------------------------------------------------
  575.     unless self.materia.nil?
  576.       return if is_materia?(item)
  577.     end
  578.     #------------------------------------------------------------------------
  579.     # ● 效果範圍
  580.     #------------------------------------------------------------------------
  581.     text= phrase["scope"] + scope[item.scope]
  582.     x = 0
  583.     y += 1
  584.     self.contents.font.color = normal_color
  585.     self.contents.font.size = size
  586.     self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  587.     #------------------------------------------------------------------------
  588.     # ● 價格
  589.     #------------------------------------------------------------------------
  590.     x = 0
  591.     y += 1      
  592.     text = phrase["price"] + item.price.to_s
  593.     self.contents.font.color = Color.new(255, 255, 0, 255)
  594.     self.contents.font.size = size
  595.     self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  596.    
  597.     #------------------------------------------------------------------------
  598.     # ● HP回復率
  599.     #------------------------------------------------------------------------
  600.     unless item.recover_hp_rate.zero?  
  601.       x = 0
  602.       y += 1
  603.       text = phrase["recover_hp_rate"] + item.recover_hp_rate.to_s+"%"
  604.       self.contents.font.color = Color.new(255, 0, 0, 255)
  605.       self.contents.font.size = size
  606.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)   
  607.     end
  608.     #------------------------------------------------------------------------
  609.     # ● HP回復量
  610.     #------------------------------------------------------------------------
  611.     unless item.recover_hp.zero?  
  612.       x = 0
  613.       y += 1      
  614.       text = phrase["recover_hp"] + item.recover_hp.to_s
  615.       self.contents.font.color = Color.new(255, 0, 100, 255)
  616.       self.contents.font.size = size
  617.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  618.     end
  619.     #------------------------------------------------------------------------
  620.     # ● SP回復率
  621.     #------------------------------------------------------------------------
  622.     unless item.recover_sp_rate.zero?
  623.       x = 0
  624.       y += 1      
  625.       text = phrase["recover_sp_rate"] + item.recover_sp_rate.to_s+"%"
  626.       self.contents.font.color = Color.new(0, 0, 255, 255)
  627.       self.contents.font.size = size
  628.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  629.     end
  630.     #------------------------------------------------------------------------
  631.     # ● SP回復量
  632.     #------------------------------------------------------------------------
  633.     unless item.recover_sp.zero?  
  634.       x = 0
  635.       y += 1      
  636.       text = phrase["recover_sp"] + item.recover_sp.to_s
  637.       self.contents.font.color = Color.new(0, 100, 255, 255)
  638.       self.contents.font.size = size
  639.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  640.     end
  641.     #------------------------------------------------------------------------
  642.     # ● 能力值增加
  643.     #------------------------------------------------------------------------
  644.     unless item.parameter_type.zero?
  645.       x = 0
  646.       y += 1      
  647.       text= parameter_type[item.parameter_type]+" +"+item.parameter_points.to_s

  648.       self.contents.font.color = Color.new(0, 255, 0, 255)
  649.       self.contents.font.size = size
  650.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  651.     end
  652.     #------------------------------------------------------------------------
  653.     # ● 屬性
  654.     #------------------------------------------------------------------------
  655. #------------------------------------------------------------------------
  656.     # ● 屬性
  657.     #------------------------------------------------------------------------
  658.     if element_set.size > 0
  659.       x = 0
  660.       y += 1
  661.       text = phrase["elements"]
  662.       self.contents.font.size = size
  663.       self.contents.font.color = Color.new(255, 0, 255, 255)
  664.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  665.       ax = (phrase["elements"].size)*5+40
  666.       for i in 0...element_set.size
  667.         text = $data_system.elements[element_set[i]]
  668.         self.contents.draw_text(ax, y*size+18, text.size*6, size, text, 0)
  669.         y += 1
  670.       end
  671.     end
  672.     #------------------------------------------------------------------------
  673.     # ● 狀態添加
  674.     #------------------------------------------------------------------------
  675.     unless plus_state_set.empty?
  676.       text = phrase["plus"]
  677.       x = 0
  678.       y += 1
  679.       self.contents.font.color = normal_color
  680.       self.contents.font.size = size
  681.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  682.       plus_state_set.each do |plus_state|
  683.         y += 1
  684.         text = $data_states[plus_state].name        
  685.         self.contents.font.color = Color.new(255, 100, 0, 255)
  686.         self.contents.font.size = size
  687.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)      
  688.       end  
  689.     end
  690.     #------------------------------------------------------------------------
  691.     # ● 狀態解除
  692.     #------------------------------------------------------------------------
  693.     unless minus_state_set.empty?
  694.       text = phrase["minus"]
  695.       x = 0
  696.       y += 1
  697.       self.contents.font.color = Color.new(100, 0, 200, 255)
  698.       self.contents.font.size = size
  699.       self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)
  700.       minus_state_set.each do |minus_state|
  701.         y += 1
  702.         text = $data_states[minus_state].name
  703.         self.contents.font.color = Color.new(100, 0, 200, 255)
  704.         self.contents.font.size = size
  705.         self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0)   
  706.       end
  707.     end
  708.   end
  709.   #--------------------------------------------------------------------------
  710.   # ● 设置角色
  711.   #     actor : 要显示状态的角色
  712.   #--------------------------------------------------------------------------
  713.   def set_actor(actor)
  714.     if actor != @actor
  715.       self.contents.clear
  716.       draw_actor_name(actor, 4, 0)
  717.       draw_actor_state(actor, 140, 0)
  718.       draw_actor_hp(actor, 284, 0)
  719.       draw_actor_sp(actor, 460, 0)
  720.       @actor = actor
  721.       @text = nil
  722.       self.visible = true
  723.     end
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # ● 設置角色
  727.   #     actor : 要顯示狀態之角色
  728.   #--------------------------------------------------------------------------
  729.   def set_actor(actor)
  730.     self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil?
  731.     if actor != @actor
  732.       self.contents.clear
  733.       draw_actor_name(actor, 4, 0)
  734.       draw_actor_state(actor, 140, 0)
  735.       draw_actor_hp(actor, 284, 0)
  736.       draw_actor_sp(actor, 460, 0)
  737.       @actor = actor
  738.       @text = nil
  739.       self.visible = true
  740.     end
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ● 設置敵人
  744.   #     enemy : 要顯示名字與狀態之敵人
  745.   #--------------------------------------------------------------------------
  746.   def set_enemy(enemy)
  747.     self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil?
  748.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  749.     state_text = make_battler_state_text(enemy, 112, false)
  750.     if state_text != ""
  751.       text += "  " + state_text
  752.     end
  753.     set_text(text, 1)
  754.     self.visible = true
  755.   end
  756.   #--------------------------------------------------------------------------
  757.   # ● 校正帮助窗口位置
  758.   #--------------------------------------------------------------------------
  759.   def set_pos(x,y,width,oy,index,column_max)
  760.     #光标坐标
  761.     cursor_width = width / column_max - 32
  762.     xx = index % column_max * (cursor_width + 32)
  763.     yy = index / column_max * 32 - oy
  764.     self.x=xx+x+150
  765.     self.y=yy+y+30
  766.     if self.x+self.width>640
  767.       self.x=640-self.width
  768.     end
  769.     if self.y+self.height>480
  770.       self.y=480-self.height
  771.     end  
  772.   end
  773.   #------------------------------------------------------------------------
  774.   # ● 裝備名字顔色變化 接口
  775.   #------------------------------------------------------------------------
  776.   def draw_name_color(equipment)
  777.     return normal_color
  778.   end
  779.   #------------------------------------------------------------------------
  780.   # ● 自身身份確認
  781.   #------------------------------------------------------------------------
  782.   def original_help?
  783.     return false
  784.   end
  785. end

  786. #------------------------------------------------------------------------------



  787. #------------------------------------------------------------------------------
  788. #==============================================================================
  789. # ■ Window_Item
  790. #------------------------------------------------------------------------------
  791. #  物品画面、战斗画面、显示浏览物品的窗口。
  792. #==============================================================================

  793. class Window_Item < Window_Selectable
  794.   #--------------------------------------------------------------------------
  795.   # ● 初始化对像
  796.   #--------------------------------------------------------------------------
  797.   def initialize
  798.     super(0, 0, 640, 480)
  799.     @column_max = 2
  800.     unless  $scene.is_a?Scene_Battle
  801.     self.opacity = 0#■■■透明
  802.     end
  803.     refresh
  804.     self.index = 0
  805.     # 战斗中的情况下将窗口移至中央并将其半透明化
  806.     if $game_temp.in_battle
  807.       self.y = 64
  808.       self.height = 256
  809.       self.back_opacity = 160
  810.     end
  811.   end
  812.   #--------------------------------------------------------------------------
  813.   # ● 刷新帮助文本
  814.   #--------------------------------------------------------------------------
  815.   def update_help
  816.     @help_window.set_text(item)
  817.     #校正帮助窗口位置
  818.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  819.   end
  820. end
  821. #==============================================================================
  822. # ■ Window_EquipLeft
  823. #------------------------------------------------------------------------------
  824. #  装备画面的、显示角色能力值变化的窗口。
  825. #==============================================================================
  826. class Window_EquipLeft < Window_Base
  827.   #--------------------------------------------------------------------------
  828.   # ● 初始化对像
  829.   #     actor : 角色
  830.   #--------------------------------------------------------------------------
  831.   def initialize(actor)
  832. # -------------------
  833. # 修改開始
  834.     super(0, 64-64, 272, 416+64)#★★★★★★★★★★★★★★★★★★★★
  835. # 修改終了
  836. # -------------------
  837.     self.contents = Bitmap.new(width - 32, height - 32)
  838.     @actor = actor
  839.     self.opacity = 0#■■■透明
  840.     refresh
  841.   end
  842. end
  843. #------------------------------------------------------------------------------



  844. #------------------------------------------------------------------------------
  845. #==============================================================================
  846. # ■ Window_EquipRight
  847. #------------------------------------------------------------------------------
  848. #  装备画面、显示角色现在装备的物品的窗口。
  849. #==============================================================================

  850. class Window_EquipRight < Window_Selectable
  851.   #--------------------------------------------------------------------------
  852.   # ● 初始化对像
  853.   #     actor : 角色
  854.   #--------------------------------------------------------------------------
  855.   def initialize(actor)
  856. # -------------------
  857. # 修改開始
  858.     super(272, 64-64, 368, 192)#★★★★★★★★★★★★★★★★★★★★
  859. # 修改終了
  860. # -------------------
  861.     self.contents = Bitmap.new(width - 32, height - 32)
  862.     @actor = actor
  863.     self.opacity = 0#■■■透明
  864.     refresh
  865.     self.index = 0
  866.   end
  867.   #--------------------------------------------------------------------------
  868.   # ● 刷新帮助文本
  869.   #--------------------------------------------------------------------------

  870.   def update_help
  871.     @help_window.set_text(item)
  872.     #校正帮助窗口位置
  873.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  874.   end
  875. end
  876. #------------------------------------------------------------------------------



  877. #------------------------------------------------------------------------------
  878. #==============================================================================
  879. # ■ Window_EquipItem
  880. #------------------------------------------------------------------------------
  881. #  装备画面、显示浏览变更装备的候补物品的窗口。
  882. #==============================================================================

  883. class Window_EquipItem < Window_Selectable
  884.   #--------------------------------------------------------------------------
  885.   # ● 初始化对像
  886.   #     actor      : 角色
  887.   #     equip_type : 装备部位 (0~3)
  888.   #--------------------------------------------------------------------------
  889.   def initialize(actor, equip_type)
  890. # -------------------
  891. # 修改開始
  892.     super(272, 320, 368, 160)#★★★★★★★★★★★★★★★★★★★★
  893. # 修改終了
  894. # -------------------
  895.     @actor = actor
  896.     @equip_type = equip_type
  897.     @column_max = 1
  898.     self.opacity = 0#■■■透明
  899.     refresh
  900.     self.active = false
  901.     self.index = -1
  902.   end
  903.   def update_help
  904.     @help_window.set_text(item)
  905.     #校正帮助窗口位置
  906.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  907.   end
  908. end
  909. #------------------------------------------------------------------------------



  910. #------------------------------------------------------------------------------
  911. #==============================================================================
  912. # ■ Window_ShopCommand
  913. #------------------------------------------------------------------------------
  914. #  商店画面、选择要做的事的窗口
  915. #==============================================================================

  916. class Window_ShopCommand < Window_Selectable
  917.   #--------------------------------------------------------------------------
  918.   # ● 初始化对像
  919.   #--------------------------------------------------------------------------
  920.   def initialize
  921. # -------------------
  922. # 修改開始
  923.     super(0, 64-64, 480, 64)#★★★★★★★★★★★★★★★★★
  924. # 修改終了
  925. # -------------------
  926.     self.contents = Bitmap.new(width - 32, height - 32)
  927.     @item_max = 3
  928.     @column_max = 3
  929.     @commands = ["买", "卖", "取消"]
  930.     refresh
  931.     self.index = 0
  932.   end
  933. end
  934. #------------------------------------------------------------------------------



  935. #------------------------------------------------------------------------------
  936. #========================================================================================================================
  937. # ■ Window_ShopBuy
  938. #------------------------------------------------------------------------------
  939. #  商店画面、浏览显示可以购买的商品的窗口。
  940. #==============================================================================

  941. class Window_ShopBuy < Window_Selectable
  942.   #--------------------------------------------------------------------------
  943.   # ● 初始化对像
  944.   #     shop_goods : 商品
  945.   #--------------------------------------------------------------------------
  946.   def initialize(shop_goods)
  947. # -------------------
  948. # 修改開始
  949.     super(0, 128-64, 368, 352+64)#★★★★★★★★★★★★★★★★
  950. # 修改終了
  951. # -------------------
  952.     @shop_goods = shop_goods
  953.     refresh
  954.     self.index = 0
  955.   end
  956.   #--------------------------------------------------------------------------
  957.   # ● 刷新帮助文本
  958.   #--------------------------------------------------------------------------

  959.   def update_help
  960.     @help_window.set_text(item)
  961.     #校正帮助窗口位置
  962.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  963.   end
  964. end
  965. #------------------------------------------------------------------------------



  966. #------------------------------------------------------------------------------
  967. #==============================================================================
  968. # ■ Window_ShopSell
  969. #------------------------------------------------------------------------------
  970. #  商店画面、浏览显示可以卖掉的商品的窗口。
  971. #==============================================================================

  972. class Window_ShopSell < Window_Selectable
  973.   #--------------------------------------------------------------------------
  974.   # ● 初始化对像
  975.   #--------------------------------------------------------------------------
  976.   def initialize
  977. # -------------------
  978. # 修改開始
  979.     super(0, 128-64, 640, 352+64)#★★★★★★★★★★★★★★★★
  980. # 修改終了
  981. # -------------------
  982.     @column_max = 2
  983.     refresh
  984.     self.index = 0
  985.   end
  986.   #--------------------------------------------------------------------------
  987.   # ● 刷新帮助文本
  988.   #--------------------------------------------------------------------------

  989.   def update_help
  990.     @help_window.set_text(item)
  991.     #校正帮助窗口位置
  992.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  993.   end
  994. end
  995. #------------------------------------------------------------------------------



  996. #------------------------------------------------------------------------------
  997. #==============================================================================
  998. # ■ Window_ShopNumber
  999. #------------------------------------------------------------------------------
  1000. #  商店画面、输入买卖数量的窗口。
  1001. #==============================================================================
  1002. class Window_ShopNumber < Window_Base
  1003.   #--------------------------------------------------------------------------
  1004.   # ● 初始化对像
  1005.   #--------------------------------------------------------------------------
  1006.   def initialize
  1007. # -------------------
  1008. # 修改開始
  1009.     super(0, 128-64, 368, 352+64)#★★★★★★★★★★★★★★★★
  1010. # 修改終了
  1011. # -------------------
  1012.     self.contents = Bitmap.new(width - 32, height - 32)
  1013.     @item = nil
  1014.     @max = 1
  1015.     @price = 0
  1016.     @number = 1
  1017.   end
  1018. end
  1019. #------------------------------------------------------------------------------



  1020. #------------------------------------------------------------------------------
  1021. #==============================================================================
  1022. # ■ Window_ShopStatus
  1023. #------------------------------------------------------------------------------
  1024. #  商店画面、显示物品所持数与角色装备的窗口。
  1025. #==============================================================================

  1026. class Window_ShopStatus < Window_Base
  1027.   #--------------------------------------------------------------------------
  1028.   # ● 初始化对像
  1029.   #--------------------------------------------------------------------------
  1030.   def initialize
  1031. # -------------------
  1032. # 修改開始
  1033.     super(368, 128-64, 272, 352+64)#★★★★★★★★★★★★
  1034. # 修改終了
  1035. # -------------------
  1036.     self.contents = Bitmap.new(width - 32, height - 32)
  1037.     @item = nil
  1038.     refresh
  1039.   end
  1040. end
  1041. #------------------------------------------------------------------------------



  1042. #------------------------------------------------------------------------------
  1043. #==============================================================================
  1044. # ■ Scene_Equip
  1045. #------------------------------------------------------------------------------
  1046. #  处理装备画面的类。
  1047. #==============================================================================

  1048. class Scene_Equip
  1049.   #--------------------------------------------------------------------------
  1050.   # ● 刷新画面 (右侧窗口被激活的情况下)
  1051.   #--------------------------------------------------------------------------
  1052.   def update_right
  1053. # -------------------
  1054. # 修改開始
  1055.     if @right_window.item==nil
  1056.         @help_window.visible=false
  1057.     else
  1058.         @help_window.visible=true
  1059.     end
  1060. # 修改終了
  1061. # -------------------
  1062.     # 按下 B 键的情况下
  1063.     if Input.trigger?(Input::B)
  1064.       # 演奏取消 SE
  1065.       $game_system.se_play($data_system.cancel_se)
  1066.       # 切换到菜单画面
  1067.       $scene = Scene_Menu.new(2)
  1068.       return
  1069.     end
  1070.     # 按下 C 键的情况下
  1071.     if Input.trigger?(Input::C)
  1072.       # 固定装备的情况下
  1073.       if @actor.equip_fix?(@right_window.index)
  1074.         # 演奏冻结 SE
  1075.         $game_system.se_play($data_system.buzzer_se)
  1076.         return
  1077.       end
  1078.       # 演奏确定 SE
  1079.       $game_system.se_play($data_system.decision_se)
  1080.       # 激活物品窗口
  1081.       @right_window.active = false
  1082.       @item_window.active = true
  1083.       @item_window.index = 0
  1084.       return
  1085.     end
  1086.     # 按下 R 键的情况下
  1087.     if Input.trigger?(Input::R)
  1088.       # 演奏光标 SE
  1089.       $game_system.se_play($data_system.cursor_se)
  1090.       # 移至下一位角色
  1091.       @actor_index += 1
  1092.       @actor_index %= $game_party.actors.size
  1093.       # 切换到别的装备画面
  1094.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  1095.       return
  1096.     end
  1097.     # 按下 L 键的情况下
  1098.     if Input.trigger?(Input::L)
  1099.       # 演奏光标 SE
  1100.       $game_system.se_play($data_system.cursor_se)
  1101.       # 移至上一位角色
  1102.       @actor_index += $game_party.actors.size - 1
  1103.       @actor_index %= $game_party.actors.size
  1104.       # 切换到别的装备画面
  1105.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  1106.       return
  1107.     end
  1108.   end
  1109.   #--------------------------------------------------------------------------
  1110.   # ● 刷新画面 (物品窗口被激活的情况下)
  1111.   #--------------------------------------------------------------------------
  1112.   def update_item
  1113. # -------------------
  1114. # 修改開始
  1115.     if @item_window.item==nil
  1116.         @help_window.visible=false
  1117.     else
  1118.         @help_window.visible=true
  1119.     end
  1120. # 修改終了
  1121. # -------------------
  1122.     # 按下 B 键的情况下
  1123.     if Input.trigger?(Input::B)
  1124.       # 演奏取消 SE
  1125.       $game_system.se_play($data_system.cancel_se)
  1126.       # 激活右侧窗口
  1127.       @right_window.active = true
  1128.       @item_window.active = false
  1129.       @item_window.index = -1
  1130.       return
  1131.     end
  1132.     # 按下 C 键的情况下
  1133.     if Input.trigger?(Input::C)
  1134.       # 演奏装备 SE
  1135.       $game_system.se_play($data_system.equip_se)
  1136.       # 获取物品窗口现在选择的装备数据
  1137.       item = @item_window.item
  1138.       # 变更装备
  1139.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  1140.       # 激活右侧窗口
  1141.       @right_window.active = true
  1142.       @item_window.active = false
  1143.       @item_window.index = -1
  1144.       # 再生成右侧窗口、物品窗口的内容
  1145.       @right_window.refresh
  1146.       @item_window.refresh
  1147.       @sprite.bitmap.clear
  1148.       @sprite.bitmap.draw_actor_element_radar_graph(@actor,16,255+16)
  1149.       return
  1150.     end
  1151.   end
  1152. end
  1153. #------------------------------------------------------------------------------



  1154. #------------------------------------------------------------------------------
  1155. #========================================================================================================================
  1156. # ■ Scene_Battle (分割定义 3)
  1157. #------------------------------------------------------------------------------
  1158. #  处理战斗画面的类。
  1159. #========================================================================================================================

  1160. class Scene_Battle
  1161.   #--------------------------------------------------------------------------
  1162.   # ● 刷新画面 (角色命令回合 : 选择物品)
  1163.   #--------------------------------------------------------------------------
  1164.   alias first_reupdate_phase3_item_select update_phase3_item_select  
  1165.   def update_phase3_item_select
  1166. # -------------------
  1167. # 修改開始
  1168.     @item_window.help_window.visible = false#★★★★★★★★★★★★
  1169. # 修改終了
  1170. # -------------------
  1171.     first_reupdate_phase3_item_select
  1172.   end
  1173.   #--------------------------------------------------------------------------
  1174.   # ● 开始选择物品
  1175.   #--------------------------------------------------------------------------
  1176.   def start_item_select
  1177.     # 生成物品窗口
  1178.     @item_window = Window_Item.new
  1179.     # 关联帮助窗口
  1180. # -------------------
  1181. # 修改開始
  1182.     @item_window.help_window =  Window_Help.new#★★★★★★★★★★★★
  1183. # 修改終了
  1184. # -------------------
  1185.     # 无效化角色指令窗口
  1186.     @actor_command_window.active = false
  1187.     @actor_command_window.visible = false
  1188.   end
  1189.   #--------------------------------------------------------------------------
  1190.   # ● 结束选择物品
  1191.   #--------------------------------------------------------------------------
  1192.   alias first_update_end_item_select end_item_select
  1193.   def end_item_select
  1194. # -------------------
  1195. # 修改開始
  1196.     @item_window.help_window.visible = false#★★★★★★★★★★★★
  1197. # 修改終了
  1198. # -------------------
  1199.     first_update_end_item_select
  1200.   end
  1201. end
  1202. #------------------------------------------------------------------------------



  1203. #------------------------------------------------------------------------------
  1204. #==============================================================================
  1205. # ■ Scene_Shop
  1206. #------------------------------------------------------------------------------
  1207. #  处理商店画面的类。
  1208. #==============================================================================

  1209. class Scene_Shop
  1210.   #--------------------------------------------------------------------------
  1211.   # ● 主处理
  1212.   #--------------------------------------------------------------------------
  1213. # --------------------
  1214. # 衝突可能
  1215.   def main

  1216.     # 生成帮助窗口
  1217. # -------------------
  1218. # 修改開始
  1219.     @help_window = Window_Help.new#★★★★★★★★★★★★★★★★
  1220. # 修改終了
  1221. # -------------------
  1222.     # 生成指令窗口
  1223.     @command_window = Window_ShopCommand.new
  1224.         # 生成金钱窗口
  1225.     @gold_window = Window_Gold.new
  1226.     @gold_window.x = 480
  1227.     @gold_window.y = 0

  1228. # -------------------
  1229. # 修改終了
  1230. # -------------------
  1231.     # 生成时间窗口
  1232. # -------------------
  1233. # 修改開始
  1234.     @dummy_window = Window_Base.new(0, 128-64, 640, 352+64)#★★★★★★★★★★★★★
  1235. # 修改終了
  1236. # -------------------

  1237.     # 生成购买窗口

  1238.     @buy_window = Window_ShopBuy.new($game_temp.shop_goods)
  1239.     @buy_window.active = false
  1240.     @buy_window.visible = false
  1241.     @buy_window.help_window = @help_window

  1242.     # 生成卖出窗口
  1243.     @sell_window = Window_ShopSell.new
  1244.     @sell_window.active = false
  1245.     @sell_window.visible = false
  1246.     @sell_window.help_window = @help_window
  1247.     # 生成数量输入窗口
  1248.     @number_window = Window_ShopNumber.new
  1249.     @number_window.active = false
  1250.     @number_window.visible = false
  1251.     # 生成状态窗口
  1252.     @status_window = Window_ShopStatus.new
  1253.     @status_window.visible = false
  1254.     # 执行过渡
  1255.     Graphics.transition
  1256.     # 主循环
  1257.     loop do
  1258.       # 刷新游戏画面
  1259.       Graphics.update
  1260.       # 刷新输入信息
  1261.       Input.update
  1262.       # 刷新画面
  1263.       update
  1264.       # 如果画面切换的话就中断循环
  1265.       if $scene != self
  1266.         break
  1267.       end
  1268.     end
  1269.     # 准备过渡
  1270.     Graphics.freeze
  1271.     # 释放窗口

  1272.     @help_window.dispose
  1273.     @command_window.dispose
  1274.     @gold_window.dispose
  1275.     @dummy_window.dispose
  1276.     @buy_window.dispose
  1277.     @sell_window.dispose
  1278.     @number_window.dispose
  1279.     @status_window.dispose
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # ● 刷新画面
  1283.   #--------------------------------------------------------------------------
  1284. # --------------------
  1285. # 衝突可能
  1286.   def update
  1287.     # 刷新窗口
  1288.     @help_window.update
  1289.     @command_window.update
  1290.     @gold_window.update
  1291.     @dummy_window.update
  1292.     @buy_window.update
  1293.     @sell_window.update
  1294.     @number_window.update
  1295.     @status_window.update
  1296.     # 指令窗口激活的情况下: 调用 update_command
  1297.     if @command_window.active
  1298. # -------------------
  1299. # 修改開始
  1300.       @help_window.visible=false
  1301. # 修改終了
  1302. # -------------------
  1303.       update_command
  1304.       return
  1305.     end
  1306.     # 购买窗口激活的情况下: 调用 update_buy
  1307.     if @buy_window.active
  1308. # -------------------
  1309. # 修改開始
  1310.       @help_window.visible=true#★★★★★★★★★★★★★★★★
  1311.       if @buy_window.item==nil#★★★★★★★★★★★★★★★★
  1312.         @help_window.visible=false#★★★★★★★★★★★★★★★★
  1313.       end #★★★★★★★★★★★★★★★★     
  1314. # 修改終了
  1315. # -------------------
  1316.       update_buy
  1317.       return
  1318.     end
  1319.     # 卖出窗口激活的情况下: 调用 update_sell
  1320.     if @sell_window.active
  1321. # -------------------
  1322. # 修改開始
  1323.       @help_window.visible=true#★★★★★★★★★★★★★★★★
  1324.       if @sell_window.item==nil#★★★★★★★★★★★★★★★★
  1325.         @help_window.visible=false#★★★★★★★★★★★★★★★★
  1326.       end #★★★★★★★★★★★★★★★★
  1327. # 修改終了
  1328. # -------------------      
  1329.       update_sell
  1330.       return
  1331.     end
  1332.     # 个数输入窗口激活的情况下: 调用 update_number
  1333.     if @number_window.active
  1334. # -------------------
  1335. # 修改開始
  1336.       @help_window.visible=false#★★★★★★★★★★★★★★★★
  1337. # 修改終了
  1338. # -------------------
  1339.       update_number
  1340.       return
  1341.     end
  1342.   end
  1343. end
复制代码

点评

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

故九江太守

梦石
0
星屑
334
在线时间
2159 小时
注册时间
2012-12-5
回帖
4323
发表于 2014-12-1 18:47:14 | 显示全部楼层
整合.rar (202.49 KB, 下载次数: 58)
窗口位置你自己修改吧

点评

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

评分

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

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部