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

Project1

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

[已经解决] 防具追加和装备增减hp,sp

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
29 小时
注册时间
2015-3-7
帖子
13
跳转到指定楼层
1
发表于 2015-4-10 01:11:28 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
在论坛上搜到两个装备的脚本,怎么把这两个脚本整合一下啊。
这个是防具追加。
RUBY 代码复制
  1. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  2. #
  3. #                                防具类追加
  4. #
  5. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  6. module RPG
  7.   class Armor
  8.     def name
  9.       name = @name.split(/,/)[0]
  10.       return name != nil ? name : ''
  11.     end
  12.     def kind
  13.       kind  = @name.split(/,/)[1]
  14.       return kind  != nil ? kind.to_i : @kind
  15.     end
  16.   end
  17. end
  18. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  19. #
  20. #                  Game_Actor添加新的防具ID,并对相关方法修正
  21. #
  22. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  23. class Game_Actor < Game_Battler
  24.   attr_reader   :armor5_id                # 项链 ID
  25.   attr_reader   :armor6_id                # 手镯 ID
  26.   #--------------------------------------------------------------------------
  27.   # ● 设置
  28.   #     actor_id : 角色 ID
  29.   #--------------------------------------------------------------------------
  30.   alias old_setup setup
  31.   def setup(actor_id)
  32.     old_setup(actor_id)
  33.     @armor5_id = 0
  34.     @armor6_id = 0
  35.     update_auto_state(nil, $data_armors[@armor5_id])
  36.     update_auto_state(nil, $data_armors[@armor6_id])
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 取得属性修正值
  40.   #     element_id : 属性 ID
  41.   #--------------------------------------------------------------------------
  42.   def element_rate(element_id)
  43.     # 获取对应属性有效度的数值
  44.     table = [0,200,150,100,50,0,-100]
  45.     result = table[$data_classes[@class_id].element_ranks[element_id]]
  46.     # 防具能防御本属性的情况下效果减半
  47.     for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
  48.       armor = $data_armors[i]
  49.       if armor != nil and armor.guard_element_set.include?(element_id)
  50.         result /= 2
  51.       end
  52.     end
  53.     # 状态能防御本属性的情况下效果减半
  54.     for i in @states
  55.       if $data_states[i].guard_element_set.include?(element_id)
  56.         result /= 2
  57.       end
  58.     end
  59.     # 过程结束
  60.     return result
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 判定防御属性
  64.   #     state_id : 属性 ID
  65.   #--------------------------------------------------------------------------
  66.   def state_guard?(state_id)
  67.     for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
  68.       armor = $data_armors[i]
  69.       if armor != nil
  70.         if armor.guard_state_set.include?(state_id)
  71.           return true
  72.         end
  73.       end
  74.     end
  75.     return false
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● 获取基本力量
  79.   #--------------------------------------------------------------------------
  80.   def base_str
  81.     n = $data_actors[@actor_id].parameters[2, @level]
  82.     weapon = $data_weapons[@weapon_id]
  83.     armor1 = $data_armors[@armor1_id]
  84.     armor2 = $data_armors[@armor2_id]
  85.     armor3 = $data_armors[@armor3_id]
  86.     armor4 = $data_armors[@armor4_id]
  87.     armor5 = $data_armors[@armor5_id]
  88.     armor6 = $data_armors[@armor6_id]
  89.     n += weapon != nil ? weapon.str_plus : 0
  90.     n += armor1 != nil ? armor1.str_plus : 0
  91.     n += armor2 != nil ? armor2.str_plus : 0
  92.     n += armor3 != nil ? armor3.str_plus : 0
  93.     n += armor4 != nil ? armor4.str_plus : 0
  94.     n += armor5 != nil ? armor5.str_plus : 0
  95.     n += armor6 != nil ? armor6.str_plus : 0
  96.     return [[n, 1].max, 999].min
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 获取基本灵巧
  100.   #--------------------------------------------------------------------------
  101.   def base_dex
  102.     n = $data_actors[@actor_id].parameters[3, @level]
  103.     weapon = $data_weapons[@weapon_id]
  104.     armor1 = $data_armors[@armor1_id]
  105.     armor2 = $data_armors[@armor2_id]
  106.     armor3 = $data_armors[@armor3_id]
  107.     armor4 = $data_armors[@armor4_id]
  108.     armor5 = $data_armors[@armor5_id]
  109.     armor6 = $data_armors[@armor6_id]
  110.     n += weapon != nil ? weapon.dex_plus : 0
  111.     n += armor1 != nil ? armor1.dex_plus : 0
  112.     n += armor2 != nil ? armor2.dex_plus : 0
  113.     n += armor3 != nil ? armor3.dex_plus : 0
  114.     n += armor4 != nil ? armor4.dex_plus : 0
  115.     n += armor5 != nil ? armor5.dex_plus : 0
  116.     n += armor6 != nil ? armor6.dex_plus : 0
  117.     return [[n, 1].max, 999].min
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 获取基本速度
  121.   #--------------------------------------------------------------------------
  122.   def base_agi
  123.     n = $data_actors[@actor_id].parameters[4, @level]
  124.     weapon = $data_weapons[@weapon_id]
  125.     armor1 = $data_armors[@armor1_id]
  126.     armor2 = $data_armors[@armor2_id]
  127.     armor3 = $data_armors[@armor3_id]
  128.     armor4 = $data_armors[@armor4_id]
  129.     armor5 = $data_armors[@armor5_id]
  130.     armor6 = $data_armors[@armor6_id]
  131.     n += weapon != nil ? weapon.agi_plus : 0
  132.     n += armor1 != nil ? armor1.agi_plus : 0
  133.     n += armor2 != nil ? armor2.agi_plus : 0
  134.     n += armor3 != nil ? armor3.agi_plus : 0
  135.     n += armor4 != nil ? armor4.agi_plus : 0
  136.     n += armor5 != nil ? armor5.agi_plus : 0
  137.     n += armor6 != nil ? armor6.agi_plus : 0
  138.     return [[n, 1].max, 999].min
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 获取基本魔力
  142.   #--------------------------------------------------------------------------
  143.   def base_int
  144.     n = $data_actors[@actor_id].parameters[5, @level]
  145.     weapon = $data_weapons[@weapon_id]
  146.     armor1 = $data_armors[@armor1_id]
  147.     armor2 = $data_armors[@armor2_id]
  148.     armor3 = $data_armors[@armor3_id]
  149.     armor4 = $data_armors[@armor4_id]
  150.     armor5 = $data_armors[@armor5_id]
  151.     armor6 = $data_armors[@armor6_id]
  152.     n += weapon != nil ? weapon.int_plus : 0
  153.     n += armor1 != nil ? armor1.int_plus : 0
  154.     n += armor2 != nil ? armor2.int_plus : 0
  155.     n += armor3 != nil ? armor3.int_plus : 0
  156.     n += armor4 != nil ? armor4.int_plus : 0
  157.     n += armor5 != nil ? armor5.int_plus : 0
  158.     n += armor6 != nil ? armor6.int_plus : 0
  159.     return [[n, 1].max, 999].min
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 获取基本物理防御
  163.   #--------------------------------------------------------------------------
  164.   def base_pdef
  165.     weapon = $data_weapons[@weapon_id]
  166.     armor1 = $data_armors[@armor1_id]
  167.     armor2 = $data_armors[@armor2_id]
  168.     armor3 = $data_armors[@armor3_id]
  169.     armor4 = $data_armors[@armor4_id]
  170.     armor5 = $data_armors[@armor5_id]
  171.     armor6 = $data_armors[@armor6_id]
  172.     pdef1 = weapon != nil ? weapon.pdef : 0
  173.     pdef2 = armor1 != nil ? armor1.pdef : 0
  174.     pdef3 = armor2 != nil ? armor2.pdef : 0
  175.     pdef4 = armor3 != nil ? armor3.pdef : 0
  176.     pdef5 = armor4 != nil ? armor4.pdef : 0
  177.     pdef6 = armor5 != nil ? armor5.pdef : 0
  178.     pdef7 = armor6 != nil ? armor6.pdef : 0
  179.     return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6 + pdef7
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 获取基本魔法防御
  183.   #--------------------------------------------------------------------------
  184.   def base_mdef
  185.     weapon = $data_weapons[@weapon_id]
  186.     armor1 = $data_armors[@armor1_id]
  187.     armor2 = $data_armors[@armor2_id]
  188.     armor3 = $data_armors[@armor3_id]
  189.     armor4 = $data_armors[@armor4_id]
  190.     armor5 = $data_armors[@armor5_id]
  191.     armor6 = $data_armors[@armor6_id]
  192.     mdef1 = weapon != nil ? weapon.mdef : 0
  193.     mdef2 = armor1 != nil ? armor1.mdef : 0
  194.     mdef3 = armor2 != nil ? armor2.mdef : 0
  195.     mdef4 = armor3 != nil ? armor3.mdef : 0
  196.     mdef5 = armor4 != nil ? armor4.mdef : 0
  197.     mdef6 = armor5 != nil ? armor5.mdef : 0
  198.     mdef7 = armor6 != nil ? armor6.mdef : 0
  199.     return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6 + mdef7
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● 获取基本回避修正
  203.   #--------------------------------------------------------------------------
  204.   def base_eva
  205.     armor1 = $data_armors[@armor1_id]
  206.     armor2 = $data_armors[@armor2_id]
  207.     armor3 = $data_armors[@armor3_id]
  208.     armor4 = $data_armors[@armor4_id]
  209.     armor5 = $data_armors[@armor5_id]
  210.     armor6 = $data_armors[@armor6_id]
  211.     eva1 = armor1 != nil ? armor1.eva : 0
  212.     eva2 = armor2 != nil ? armor2.eva : 0
  213.     eva3 = armor3 != nil ? armor3.eva : 0
  214.     eva4 = armor4 != nil ? armor4.eva : 0
  215.     eva5 = armor5 != nil ? armor5.eva : 0
  216.     eva6 = armor6 != nil ? armor6.eva : 0
  217.     return eva1 + eva2 + eva3 + eva4 + eva5 + eva6
  218.   end
  219.  
  220.   #--------------------------------------------------------------------------
  221.   # ● 装备固定判定
  222.   #     equip_type : 装备类型
  223.   #--------------------------------------------------------------------------
  224.   def equip_fix?(equip_type)
  225.     case equip_type
  226.     when 0  # 武器
  227.       return $data_actors[@actor_id].weapon_fix
  228.     when 1  # 盾
  229.       return $data_actors[@actor_id].armor1_fix
  230.     when 2  # 头
  231.       return $data_actors[@actor_id].armor2_fix
  232.     when 3  # 身体
  233.       return $data_actors[@actor_id].armor3_fix
  234.     when 4  # 装饰品
  235.       return $data_actors[@actor_id].armor4_fix
  236.     end
  237.     return false
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # ● 变更装备
  241.   #     equip_type : 装备类型
  242.   #     id    : 武器 or 防具 ID  (0 为解除装备)
  243.   #--------------------------------------------------------------------------
  244.   def equip(equip_type, id)
  245.     case equip_type
  246.     when 0  # 武器
  247.       if id == 0 or $game_party.weapon_number(id) > 0
  248.         $game_party.gain_weapon(@weapon_id, 1)
  249.         @weapon_id = id
  250.         $game_party.lose_weapon(id, 1)
  251.       end
  252.     when 1  # 盾
  253.       if id == 0 or $game_party.armor_number(id) > 0
  254.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  255.         $game_party.gain_armor(@armor1_id, 1)
  256.         @armor1_id = id
  257.         $game_party.lose_armor(id, 1)
  258.       end
  259.     when 2  # 头
  260.       if id == 0 or $game_party.armor_number(id) > 0
  261.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  262.         $game_party.gain_armor(@armor2_id, 1)
  263.         @armor2_id = id
  264.         $game_party.lose_armor(id, 1)
  265.       end
  266.     when 3  # 身体
  267.       if id == 0 or $game_party.armor_number(id) > 0
  268.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  269.         $game_party.gain_armor(@armor3_id, 1)
  270.         @armor3_id = id
  271.         $game_party.lose_armor(id, 1)
  272.       end
  273.     when 4  # 装饰品
  274.       if id == 0 or $game_party.armor_number(id) > 0
  275.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  276.         $game_party.gain_armor(@armor4_id, 1)
  277.         @armor4_id = id
  278.         $game_party.lose_armor(id, 1)
  279.       end
  280.     when 5  # 项链
  281.       if id == 0 or $game_party.armor_number(id) > 0
  282.         update_auto_state($data_armors[@armor5_id], $data_armors[id])
  283.         $game_party.gain_armor(@armor5_id, 1)
  284.         @armor5_id = id
  285.         $game_party.lose_armor(id, 1)
  286.       end
  287.     when 6  # 手镯
  288.       if id == 0 or $game_party.armor_number(id) > 0
  289.         update_auto_state($data_armors[@armor6_id], $data_armors[id])
  290.         $game_party.gain_armor(@armor6_id, 1)
  291.         @armor6_id = id
  292.         $game_party.lose_armor(id, 1)
  293.       end
  294.     end
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● 更改职业 ID
  298.   #     class_id : 新的职业 ID
  299.   #--------------------------------------------------------------------------
  300.   def class_id=(class_id)
  301.     if $data_classes[class_id] != nil
  302.       @class_id = class_id
  303.       # 避开无法装备的物品
  304.       unless equippable?($data_weapons[@weapon_id])
  305.         equip(0, 0)
  306.       end
  307.       unless equippable?($data_armors[@armor1_id])
  308.         equip(1, 0)
  309.       end
  310.       unless equippable?($data_armors[@armor2_id])
  311.         equip(2, 0)
  312.       end
  313.       unless equippable?($data_armors[@armor3_id])
  314.         equip(3, 0)
  315.       end
  316.       unless equippable?($data_armors[@armor4_id])
  317.         equip(4, 0)
  318.       end
  319.       unless equippable?($data_armors[@armor5_id])
  320.         equip(5, 0)
  321.       end
  322.       unless equippable?($data_armors[@armor6_id])
  323.         equip(6, 0)
  324.       end
  325.     end
  326.   end
  327. end
  328. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  329. #
  330. #              Window_Base美化,增加属性增减颜色,及全能力值描绘
  331. #
  332. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  333. #==============================================================================
  334. # ■ Window_Base
  335. #------------------------------------------------------------------------------
  336. #  游戏中全部窗口的超级类。
  337. #==============================================================================
  338.  
  339. class Window_Base < Window
  340.   ################## 属性增减颜色 ##############################
  341.   def up_color
  342.     return Color.new(255, 0, 0)
  343.   end
  344.   def down_color
  345.     return Color.new(0, 255, 0)
  346.   end
  347.   #--------------------------------------------------------------------------
  348.   # ● 描绘能力值
  349.   #     actor : 角色
  350.   #     x     : 描画目标 X 坐标
  351.   #     y     : 描画目标 Y 坐标
  352.   #     type  : 能力值种类 (0~6)
  353.   #--------------------------------------------------------------------------
  354.   def draw_actor_parameter(actor, x, y, type)
  355.     case type
  356.     when 0
  357.       parameter_name = $data_system.words.atk
  358.       parameter_value = actor.atk
  359.     when 1
  360.       parameter_name = $data_system.words.pdef
  361.       parameter_value = actor.pdef
  362.     when 2
  363.       parameter_name = $data_system.words.mdef
  364.       parameter_value = actor.mdef
  365.     when 3
  366.       parameter_name = $data_system.words.str
  367.       parameter_value = actor.str
  368.     when 4
  369.       parameter_name = $data_system.words.dex
  370.       parameter_value = actor.dex
  371.     when 5
  372.       parameter_name = $data_system.words.agi
  373.       parameter_value = actor.agi
  374.     when 6
  375.       parameter_name = $data_system.words.int
  376.       parameter_value = actor.int
  377.     when 7
  378.       parameter_name = "回避"
  379.       parameter_value = actor.eva
  380.     end
  381.     self.contents.font.color = system_color
  382.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  383.     self.contents.font.color = normal_color
  384.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  385.   end
  386. end
  387. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  388. #
  389. #              装备窗口美化,全能力值描绘并追加新的防具装备栏
  390. #
  391. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  392. #==============================================================================
  393. # ■ Window_EquipRight
  394. #------------------------------------------------------------------------------
  395. #  装备画面、显示角色现在装备的物品的窗口。
  396. #==============================================================================
  397.  
  398. class Window_EquipRight < Window_Selectable
  399.   #--------------------------------------------------------------------------
  400.   # ● 初始化对像
  401.   #     actor : 角色
  402.   #--------------------------------------------------------------------------
  403.   def initialize(actor)
  404.     super(272, 64, 368, 256)
  405.     self.contents = Bitmap.new(width - 32, height - 32)
  406.     @actor = actor
  407.     refresh
  408.     self.index = 0
  409.   end
  410.   #--------------------------------------------------------------------------
  411.   # ● 刷新
  412.   #--------------------------------------------------------------------------
  413.   def refresh
  414.     self.contents.clear
  415.     @data = []
  416.     @data.push($data_weapons[@actor.weapon_id])
  417.     @data.push($data_armors[@actor.armor1_id])
  418.     @data.push($data_armors[@actor.armor2_id])
  419.     @data.push($data_armors[@actor.armor3_id])
  420.     @data.push($data_armors[@actor.armor4_id])
  421.     @data.push($data_armors[@actor.armor5_id])
  422.     @data.push($data_armors[@actor.armor6_id])
  423.     @item_max = @data.size
  424.     self.contents.font.color = system_color
  425.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  426.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  427.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  428.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  429.     self.contents.draw_text(4, 32 * 4, 92, 32, $data_system.words.armor4)
  430.     self.contents.draw_text(4, 32 * 5, 92, 32, "法器")
  431.     self.contents.draw_text(4, 32 * 6, 92, 32, "称号")
  432.     draw_item_name(@data[0], 92, 32 * 0)
  433.     draw_item_name(@data[1], 92, 32 * 1)
  434.     draw_item_name(@data[2], 92, 32 * 2)
  435.     draw_item_name(@data[3], 92, 32 * 3)
  436.     draw_item_name(@data[4], 92, 32 * 4)
  437.     draw_item_name(@data[5], 92, 32 * 5)
  438.     draw_item_name(@data[6], 92, 32 * 6)
  439.   end
  440. end
  441.  
  442. #==============================================================================
  443. # ■ Window_EquipLeft
  444. #------------------------------------------------------------------------------
  445. #  装备画面的、显示角色能力值变化的窗口。
  446. #==============================================================================
  447.  
  448. class Window_EquipLeft < Window_Base
  449.   #--------------------------------------------------------------------------
  450.   # ● 初始化对像
  451.   #     actor : 角色
  452.   #--------------------------------------------------------------------------
  453.   def initialize(actor)
  454.     super(0, 64, 272, 416)
  455.     self.contents = Bitmap.new(width - 32, height - 32)
  456.     @actor = actor
  457.     refresh
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # ● 刷新
  461.   #--------------------------------------------------------------------------
  462.   def refresh
  463.     self.contents.clear
  464.     draw_actor_name(@actor, 4, 0)
  465.     draw_actor_level(@actor, 4, 32)
  466.  
  467.     draw_actor_parameter(@actor, 4, 64, 0)
  468.     draw_actor_parameter(@actor, 4, 96, 1)
  469.     draw_actor_parameter(@actor, 4, 128, 2)
  470.     draw_actor_parameter(@actor, 4, 160, 7)
  471.     draw_actor_parameter(@actor, 4, 192, 3)
  472.     draw_actor_parameter(@actor, 4, 224, 4)
  473.     draw_actor_parameter(@actor, 4, 256, 5)
  474.     draw_actor_parameter(@actor, 4, 288, 6)
  475.     if @new_atk != nil
  476.       self.contents.font.color = system_color
  477.       self.contents.draw_text(160, 64, 40, 32, "→", 1)
  478.       self.contents.font.color = @new_atk>@actor.atk ? up_color : down_color
  479.       self.contents.font.color = normal_color if @new_atk == @actor.atk
  480.       self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  481.     end
  482.     if @new_pdef != nil
  483.       self.contents.font.color = system_color
  484.       self.contents.draw_text(160, 96, 40, 32, "→", 1)
  485.       self.contents.font.color = @new_pdef>@actor.pdef ? up_color : down_color
  486.       self.contents.font.color = normal_color if @new_pdef == @actor.pdef
  487.       self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  488.     end
  489.     if @new_mdef != nil
  490.       self.contents.font.color = system_color
  491.       self.contents.draw_text(160, 128, 40, 32, "→", 1)
  492.       self.contents.font.color = @new_mdef>@actor.mdef ? up_color : down_color
  493.       self.contents.font.color = normal_color if @new_mdef == @actor.mdef
  494.       self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  495.     end
  496.     if @new_eva != nil
  497.       self.contents.font.color = system_color
  498.       self.contents.draw_text(160, 160, 40, 32, "→", 1)
  499.       self.contents.font.color = @new_eva>@actor.eva ? up_color : down_color
  500.       self.contents.font.color = normal_color if @new_eva == @actor.eva
  501.       self.contents.draw_text(200, 160, 36, 32, @new_eva.to_s, 2)
  502.     end
  503.     if @new_str != nil
  504.       self.contents.font.color = system_color
  505.       self.contents.draw_text(160, 192, 40, 32, "→", 1)
  506.       self.contents.font.color = @new_str>@actor.str ? up_color : down_color
  507.       self.contents.font.color = normal_color if @new_str == @actor.str
  508.       self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
  509.     end
  510.     if @new_dex != nil
  511.       self.contents.font.color = system_color
  512.       self.contents.draw_text(160, 224, 40, 32, "→", 1)
  513.       self.contents.font.color = @new_dex>@actor.dex ? up_color : down_color
  514.       self.contents.font.color = normal_color if @new_dex == @actor.dex
  515.       self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
  516.     end
  517.     if @new_agi != nil
  518.       self.contents.font.color = system_color
  519.       self.contents.draw_text(160, 256, 40, 32, "→", 1)
  520.       self.contents.font.color = @new_agi>@actor.agi ? up_color : down_color
  521.       self.contents.font.color = normal_color if @new_agi == @actor.agi
  522.       self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
  523.     end
  524.     if @new_int != nil
  525.       self.contents.font.color = system_color
  526.       self.contents.draw_text(160, 288, 40, 32, "→", 1)
  527.       self.contents.font.color = @new_int>@actor.int ? up_color : down_color
  528.       self.contents.font.color = normal_color if @new_int == @actor.int
  529.       self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
  530.     end
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # ● 变更装备后的能力值设置
  534.   #     new_atk  : 变更装备后的攻击力
  535.   #     new_pdef : 变更装备后的物理防御
  536.   #     new_mdef : 变更装备后的魔法防御
  537.   #--------------------------------------------------------------------------
  538.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  539.     if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
  540.       @new_atk = new_atk
  541.       @new_pdef = new_pdef
  542.       @new_mdef = new_mdef
  543.       @new_eva = new_eva
  544.       @new_str = new_str
  545.       @new_dex = new_dex
  546.       @new_agi = new_agi
  547.       @new_int = new_int
  548.       refresh
  549.     end
  550.   end
  551. end
  552. #==============================================================================
  553. # ■ Window_EquipItem
  554. #------------------------------------------------------------------------------
  555. #  装备画面、显示浏览变更装备的候补物品的窗口。
  556. #==============================================================================
  557.  
  558. class Window_EquipItem < Window_Selectable
  559.   #--------------------------------------------------------------------------
  560.   # ● 初始化对像
  561.   #     actor      : 角色
  562.   #     equip_type : 装备部位 (0~3)
  563.   #--------------------------------------------------------------------------
  564.   def initialize(actor, equip_type)
  565.     super(272, 320, 368, 160)
  566.     @actor = actor
  567.     @equip_type = equip_type
  568.     @column_max = 1
  569.     refresh
  570.     self.active = false
  571.     self.index = -1
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ● 项目的描绘
  575.   #     index : 项目符号
  576.   #--------------------------------------------------------------------------
  577.   def draw_item(index)
  578.     item = @data[index]
  579.     x = 4
  580.     y = index * 32
  581.     case item
  582.     when RPG::Weapon
  583.       number = $game_party.weapon_number(item.id)
  584.     when RPG::Armor
  585.       number = $game_party.armor_number(item.id)
  586.     end
  587.     bitmap = RPG::Cache.icon(item.icon_name)
  588.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  589.     self.contents.font.color = normal_color
  590.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  591.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  592.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  593.   end
  594. end
  595.  
  596. class Scene_Equip
  597.   #--------------------------------------------------------------------------
  598.   # ● 主处理
  599.   #--------------------------------------------------------------------------
  600.   def main
  601.     @menu_com = Sprite.new
  602.     @menu_com.bitmap = RPG::Cache.picture("装备.png")
  603.     # 获取角色
  604.     @actor = $game_party.actors[@actor_index]
  605.     # 生成窗口
  606.     @help_window = Window_Movement_Help.new
  607.     @left_window = Window_EquipLeft.new(@actor)
  608.     @right_window = Window_EquipRight.new(@actor)
  609.     @item_window1 = Window_EquipItem.new(@actor, 0)
  610.     @item_window2 = Window_EquipItem.new(@actor, 1)
  611.     @item_window3 = Window_EquipItem.new(@actor, 2)
  612.     @item_window4 = Window_EquipItem.new(@actor, 3)
  613.     @item_window5 = Window_EquipItem.new(@actor, 4)
  614.     @item_window6 = Window_EquipItem.new(@actor, 5)
  615.     @item_window7 = Window_EquipItem.new(@actor, 6)
  616.     @help_window.opacity = 0
  617.     @item_window1.opacity = 0
  618.     @item_window2.opacity = 0
  619.     @item_window3.opacity = 0
  620.     @item_window4.opacity = 0
  621.     @item_window5.opacity = 0
  622.     @item_window6.opacity = 0
  623.     @item_window7.opacity = 0
  624.     @left_window.opacity = 0
  625.     @right_window.opacity = 0
  626.     # 关联帮助窗口
  627.     @right_window.help_window = @help_window
  628.     @item_window1.help_window = @help_window
  629.     @item_window2.help_window = @help_window
  630.     @item_window3.help_window = @help_window
  631.     @item_window4.help_window = @help_window
  632.     @item_window5.help_window = @help_window
  633.     @item_window6.help_window = @help_window
  634.     @item_window7.help_window = @help_window
  635.     # 设置光标位置
  636.     @right_window.index = @equip_index
  637.     refresh
  638.     # 执行过渡
  639.     Graphics.transition
  640.     # 主循环
  641.     loop do
  642.       # 刷新游戏画面
  643.       Graphics.update
  644.       # 刷新输入信息
  645.       Input.update
  646.       # 刷新画面
  647.       update
  648.       # 如果画面切换的话的就中断循环
  649.       if $scene != self
  650.         break
  651.       end
  652.     end
  653.     # 准备过渡
  654.     Graphics.freeze
  655.     @menu_com.bitmap.dispose if @menu_com.bitmap  
  656.     @menu_com.dispose
  657.     # 释放窗口
  658.     @help_window.dispose
  659.     @left_window.dispose
  660.     @right_window.dispose
  661.     @item_window1.dispose
  662.     @item_window2.dispose
  663.     @item_window3.dispose
  664.     @item_window4.dispose
  665.     @item_window5.dispose
  666.     @item_window6.dispose
  667.     @item_window7.dispose
  668.   end
  669.   #--------------------------------------------------------------------------
  670.   # ● 刷新
  671.   #--------------------------------------------------------------------------
  672.   def refresh
  673.     # 设置物品窗口的可视状态
  674.     @item_window1.visible = (@right_window.index == 0)
  675.     @item_window2.visible = (@right_window.index == 1)
  676.     @item_window3.visible = (@right_window.index == 2)
  677.     @item_window4.visible = (@right_window.index == 3)
  678.     @item_window5.visible = (@right_window.index == 4)
  679.     @item_window6.visible = (@right_window.index == 5)
  680.     @item_window7.visible = (@right_window.index == 6)
  681.     # 获取当前装备中的物品
  682.     item1 = @right_window.item
  683.     # 设置当前的物品窗口到 @item_window
  684.     case @right_window.index
  685.     when 0
  686.       @item_window = @item_window1
  687.     when 1
  688.       @item_window = @item_window2
  689.     when 2
  690.       @item_window = @item_window3
  691.     when 3
  692.       @item_window = @item_window4
  693.     when 4
  694.       @item_window = @item_window5
  695.     when 5
  696.       @item_window = @item_window6
  697.     when 6
  698.       @item_window = @item_window7
  699.     end
  700.     # 右窗口被激活的情况下
  701.     if @right_window.active
  702.       # 删除变更装备后的能力
  703.     ###############################################################
  704.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
  705.     end
  706.     # 物品窗口被激活的情况下
  707.     if @item_window.active
  708.       # 获取现在选中的物品
  709.       item2 = @item_window.item
  710.       # 变更装备
  711.       last_hp = @actor.hp
  712.       last_sp = @actor.sp
  713.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  714.     ###############################################################
  715.       # 获取变更装备后的能力值
  716.       new_atk = @actor.atk
  717.       new_pdef = @actor.pdef
  718.       new_mdef = @actor.mdef
  719.       new_eva = @actor.eva
  720.       new_str = @actor.str
  721.       new_dex = @actor.dex
  722.       new_agi = @actor.agi
  723.       new_int = @actor.int
  724.       # 返回到装备
  725.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  726.       @actor.hp = last_hp
  727.       @actor.sp = last_sp
  728.       # 描画左窗口
  729.     ###############################################################
  730.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  731.     ###############################################################
  732.     end
  733.   end
  734. end
  735. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  736. #
  737. #              商店购买窗口美化,增加对新装备位置的描述
  738. #
  739. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  740. #==============================================================================
  741. # ■ Window_ShopStatus
  742. #------------------------------------------------------------------------------
  743. #  商店画面、显示物品所持数与角色装备的窗口。
  744. #==============================================================================
  745.  
  746. class Window_ShopStatus < Window_Base
  747.   #--------------------------------------------------------------------------
  748.   # ● 刷新
  749.   #--------------------------------------------------------------------------
  750.   def refresh
  751.     self.contents.clear
  752.     if @item == nil
  753.       return
  754.     end
  755.     case @item
  756.     when RPG::Item
  757.       number = $game_party.item_number(@item.id)
  758.     when RPG::Weapon
  759.       number = $game_party.weapon_number(@item.id)
  760.     when RPG::Armor
  761.       number = $game_party.armor_number(@item.id)
  762.     end
  763.     self.contents.font.color = system_color
  764.     self.contents.draw_text(4, 0, 200, 32, "持有")
  765.     self.contents.font.color = normal_color
  766.     self.contents.draw_text(180, 0, 32, 32, number.to_s, 2)
  767.     if @item.is_a?(RPG::Item)
  768.       return
  769.     end
  770.     # 添加装备品信息
  771.     for i in 0...$game_party.actors.size
  772.       # 获取角色
  773.       actor = $game_party.actors[i]
  774.       # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
  775.       if actor.equippable?(@item)
  776.         self.contents.font.color = normal_color
  777.       else
  778.         self.contents.font.color = disabled_color
  779.       end
  780.       # 描绘角色名字
  781.       self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  782.       # 获取当前的装备品
  783.       if @item.is_a?(RPG::Weapon)
  784.         item1 = $data_weapons[actor.weapon_id]
  785.       elsif @item.kind == 0
  786.         item1 = $data_armors[actor.armor1_id]
  787.       elsif @item.kind == 1
  788.         item1 = $data_armors[actor.armor2_id]
  789.       elsif @item.kind == 2
  790.         item1 = $data_armors[actor.armor3_id]
  791.       elsif @item.kind == 3
  792.         item1 = $data_armors[actor.armor4_id]
  793.       elsif @item.kind == 4
  794.         item1 = $data_armors[actor.armor5_id]
  795.       else# if @item.kind == 5
  796.         item1 = $data_armors[actor.armor6_id]
  797.       end
  798.       # 可以装备的情况
  799.       if actor.equippable?(@item)
  800.         # 武器的情况
  801.         if @item.is_a?(RPG::Weapon)
  802.           atk1 = item1 != nil ? item1.atk : 0
  803.           atk2 = @item != nil ? @item.atk : 0
  804.           change = atk2 - atk1
  805.         end
  806.         # 防具的情况
  807.         if @item.is_a?(RPG::Armor)
  808.           pdef1 = item1 != nil ? item1.pdef : 0
  809.           mdef1 = item1 != nil ? item1.mdef : 0
  810.           pdef2 = @item != nil ? @item.pdef : 0
  811.           mdef2 = @item != nil ? @item.mdef : 0
  812.           change = pdef2 - pdef1 + mdef2 - mdef1
  813.         end
  814.         # 描绘能力值变化
  815.         self.contents.draw_text(90, 64 + 64 * i, 112, 32,
  816.           sprintf("%+d", change), 2)
  817.       end
  818.       # 描绘物品
  819.       if item1 != nil
  820.         x = 4
  821.         y = 64 + 64 * i + 32
  822.         bitmap = RPG::Cache.icon(item1.icon_name)
  823.         opacity = self.contents.font.color == normal_color ? 255 : 128
  824.         self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  825.         self.contents.draw_text(x + 28, y, 212, 32, item1.name)
  826.       end
  827.     end
  828.   end
  829. end

这个是装备加血加蓝
RUBY 代码复制
  1. #装备附加HP SP
  2. #使用方法 给装备名后用“,”追加数值
  3. #例如:  铜剑,500,200  那个这个武器会增加500点HP和200点SP
  4. #顺序不可改变  如果只需要加 HP 不需要再追加 SP 例如 铜剑,500 只会增加500HP
  5. #如果只需要增加SP 那么HP留0即可 例如 铜剑,0, 200 只增加200点SP
  6.  
  7. module RPG
  8.   class Weapon
  9.     def description
  10.       return @description.split(/,/)[0]
  11.     end
  12.     def hp
  13.       return @description.split(/,/)[1] == nil ? 0 : @description.split(/,/)[1].to_i
  14.     end
  15.     def sp
  16.       return @description.split(/,/)[2] == nil ? 0 : @description.split(/,/)[2].to_i
  17.     end
  18.   end
  19.   class Armor
  20.     def description
  21.       return @description.split(/,/)[0]
  22.     end
  23.     def hp
  24.       return @description.split(/,/)[1] == nil ? 0 : @description.split(/,/)[1].to_i
  25.     end
  26.     def sp
  27.       return @description.split(/,/)[2] == nil ? 0 : @description.split(/,/)[2].to_i
  28.     end
  29.   end
  30. end
  31.  
  32. class Game_Actor < Game_Battler
  33.   #--------------------------------------------------------------------------
  34.   # ● 获取基本 MaxHP
  35.   #--------------------------------------------------------------------------
  36.   def base_maxhp
  37.     a = $data_actors[@actor_id].parameters[0, @level]
  38.     n = 0
  39.     n += $data_weapons[@weapon_id].hp if $data_weapons[@weapon_id] != nil
  40.     n += $data_armors[@armor1_id].hp if $data_armors[@armor1_id] != nil
  41.     n += $data_armors[@armor2_id].hp if $data_armors[@armor2_id] != nil
  42.     n += $data_armors[@armor3_id].hp if $data_armors[@armor3_id] != nil
  43.     n += $data_armors[@armor4_id].hp if $data_armors[@armor4_id] != nil
  44.     n += $data_armors[@armor5_id].hp if $data_armors[@armor5_id] != nil
  45.     n += $data_armors[@armor6_id].hp if $data_armors[@armor6_id] != nil
  46.     return a + n
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 获取基本 MaxSP
  50.   #--------------------------------------------------------------------------
  51.   def base_maxsp
  52.     a = $data_actors[@actor_id].parameters[1, @level]
  53.     n = 0
  54.     n += $data_weapons[@weapon_id].sp if $data_weapons[@weapon_id] != nil
  55.     n += $data_armors[@armor1_id].sp if $data_armors[@armor1_id] != nil
  56.     n += $data_armors[@armor2_id].sp if $data_armors[@armor2_id] != nil
  57.     n += $data_armors[@armor3_id].sp if $data_armors[@armor3_id] != nil
  58.     n += $data_armors[@armor4_id].sp if $data_armors[@armor4_id] != nil
  59.     n += $data_armors[@armor5_id].hp if $data_armors[@armor5_id] != nil
  60.     n += $data_armors[@armor6_id].hp if $data_armors[@armor6_id] != nil
  61.     return a + n
  62.   end
  63.  
  64.  
  65.   alias equip_hp_sp_old_dl equip
  66.   def equip(equip_type, id)
  67.     equip_hp_sp_old_dl(equip_type, id)
  68.     @hp = maxhp if @hp > maxhp
  69.     @sp = maxsp if @sp > maxsp
  70.   end
  71. end

这是错误信息



QQ截图20150410010421.png (16.73 KB, 下载次数: 9)

测试读取存档没问题,但是新开的话会出现这个提示。

测试读取存档没问题,但是新开的话会出现这个提示。

评分

参与人数 1星屑 +35 收起 理由
RyanBern + 35 手动认可奖励

查看全部评分

Lv5.捕梦者

梦石
0
星屑
33482
在线时间
5108 小时
注册时间
2012-11-19
帖子
4878

开拓者

2
发表于 2015-4-10 08:45:48 | 只看该作者
合并了一下,然后修复了一下
  1. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  2. #
  3. #           防具类追加  +   装备增加 HP SP
  4. #
  5. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  6. module RPG
  7.   class Weapon
  8.     def description
  9.       return @description.split(/,/)[0]
  10.     end
  11.     def hp
  12.       return @description.split(/,/)[1] == nil ? 0 : @description.split(/,/)[1].to_i
  13.     end
  14.     def sp
  15.       return @description.split(/,/)[2] == nil ? 0 : @description.split(/,/)[2].to_i
  16.     end
  17.   end
  18.   class Armor
  19.     def name
  20.       name = @name.split(/,/)[0]
  21.       return name != nil ? name : ''
  22.     end
  23.     def kind
  24.       kind  = @name.split(/,/)[1]
  25.       return kind  != nil ? kind.to_i : @kind
  26.     end
  27.     def description
  28.       return @description.split(/,/)[0]
  29.     end
  30.     def hp
  31.       return @description.split(/,/)[1] == nil ? 0 : @description.split(/,/)[1].to_i
  32.     end
  33.     def sp
  34.       return @description.split(/,/)[2] == nil ? 0 : @description.split(/,/)[2].to_i
  35.     end
  36.   end
  37. end
  38. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  39. #
  40. #                  Game_Actor添加新的防具ID,并对相关方法修正
  41. #
  42. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  43. class Game_Actor < Game_Battler
  44.   attr_reader   :armor5_id                # 项链 ID
  45.   attr_reader   :armor6_id                # 手镯 ID
  46.   #--------------------------------------------------------------------------
  47.   # ● 设置
  48.   #     actor_id : 角色 ID
  49.   #--------------------------------------------------------------------------
  50.   alias old_setup setup
  51.   def setup(actor_id)
  52.     @armor5_id = 0
  53.     @armor6_id = 0
  54.     old_setup(actor_id)
  55.     update_auto_state(nil, $data_armors[@armor5_id])
  56.     update_auto_state(nil, $data_armors[@armor6_id])
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 取得属性修正值
  60.   #     element_id : 属性 ID
  61.   #--------------------------------------------------------------------------
  62.   def element_rate(element_id)
  63.     # 获取对应属性有效度的数值
  64.     table = [0,200,150,100,50,0,-100]
  65.     result = table[$data_classes[@class_id].element_ranks[element_id]]
  66.     # 防具能防御本属性的情况下效果减半
  67.     for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
  68.       armor = $data_armors[i]
  69.       if armor != nil and armor.guard_element_set.include?(element_id)
  70.         result /= 2
  71.       end
  72.     end
  73.     # 状态能防御本属性的情况下效果减半
  74.     for i in @states
  75.       if $data_states[i].guard_element_set.include?(element_id)
  76.         result /= 2
  77.       end
  78.     end
  79.     # 过程结束
  80.     return result
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 判定防御属性
  84.   #     state_id : 属性 ID
  85.   #--------------------------------------------------------------------------
  86.   def state_guard?(state_id)
  87.     for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
  88.       armor = $data_armors[i]
  89.       if armor != nil
  90.         if armor.guard_state_set.include?(state_id)
  91.           return true
  92.         end
  93.       end
  94.     end
  95.     return false
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 获取基本 MaxHP
  99.   #--------------------------------------------------------------------------
  100.   def base_maxhp
  101.     a = $data_actors[@actor_id].parameters[0, @level]
  102.     n = 0
  103.     n += $data_weapons[@weapon_id].hp if $data_weapons[@weapon_id] != nil
  104.     n += $data_armors[@armor1_id].hp if $data_armors[@armor1_id] != nil
  105.     n += $data_armors[@armor2_id].hp if $data_armors[@armor2_id] != nil
  106.     n += $data_armors[@armor3_id].hp if $data_armors[@armor3_id] != nil
  107.     n += $data_armors[@armor4_id].hp if $data_armors[@armor4_id] != nil
  108.     n += $data_armors[@armor5_id].hp if $data_armors[@armor5_id] != nil
  109.     n += $data_armors[@armor6_id].hp if $data_armors[@armor6_id] != nil
  110.     return a + n
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ● 获取基本 MaxSP
  114.   #--------------------------------------------------------------------------
  115.   def base_maxsp
  116.     a = $data_actors[@actor_id].parameters[1, @level]
  117.     n = 0
  118.     n += $data_weapons[@weapon_id].sp if $data_weapons[@weapon_id] != nil
  119.     n += $data_armors[@armor1_id].sp if $data_armors[@armor1_id] != nil
  120.     n += $data_armors[@armor2_id].sp if $data_armors[@armor2_id] != nil
  121.     n += $data_armors[@armor3_id].sp if $data_armors[@armor3_id] != nil
  122.     n += $data_armors[@armor4_id].sp if $data_armors[@armor4_id] != nil
  123.     n += $data_armors[@armor5_id].hp if $data_armors[@armor5_id] != nil
  124.     n += $data_armors[@armor6_id].hp if $data_armors[@armor6_id] != nil
  125.     return a + n
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 获取基本力量
  129.   #--------------------------------------------------------------------------
  130.   def base_str
  131.     n = $data_actors[@actor_id].parameters[2, @level]
  132.     weapon = $data_weapons[@weapon_id]
  133.     armor1 = $data_armors[@armor1_id]
  134.     armor2 = $data_armors[@armor2_id]
  135.     armor3 = $data_armors[@armor3_id]
  136.     armor4 = $data_armors[@armor4_id]
  137.     armor5 = $data_armors[@armor5_id]
  138.     armor6 = $data_armors[@armor6_id]
  139.     n += weapon != nil ? weapon.str_plus : 0
  140.     n += armor1 != nil ? armor1.str_plus : 0
  141.     n += armor2 != nil ? armor2.str_plus : 0
  142.     n += armor3 != nil ? armor3.str_plus : 0
  143.     n += armor4 != nil ? armor4.str_plus : 0
  144.     n += armor5 != nil ? armor5.str_plus : 0
  145.     n += armor6 != nil ? armor6.str_plus : 0
  146.     return [[n, 1].max, 999].min
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 获取基本灵巧
  150.   #--------------------------------------------------------------------------
  151.   def base_dex
  152.     n = $data_actors[@actor_id].parameters[3, @level]
  153.     weapon = $data_weapons[@weapon_id]
  154.     armor1 = $data_armors[@armor1_id]
  155.     armor2 = $data_armors[@armor2_id]
  156.     armor3 = $data_armors[@armor3_id]
  157.     armor4 = $data_armors[@armor4_id]
  158.     armor5 = $data_armors[@armor5_id]
  159.     armor6 = $data_armors[@armor6_id]
  160.     n += weapon != nil ? weapon.dex_plus : 0
  161.     n += armor1 != nil ? armor1.dex_plus : 0
  162.     n += armor2 != nil ? armor2.dex_plus : 0
  163.     n += armor3 != nil ? armor3.dex_plus : 0
  164.     n += armor4 != nil ? armor4.dex_plus : 0
  165.     n += armor5 != nil ? armor5.dex_plus : 0
  166.     n += armor6 != nil ? armor6.dex_plus : 0
  167.     return [[n, 1].max, 999].min
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● 获取基本速度
  171.   #--------------------------------------------------------------------------
  172.   def base_agi
  173.     n = $data_actors[@actor_id].parameters[4, @level]
  174.     weapon = $data_weapons[@weapon_id]
  175.     armor1 = $data_armors[@armor1_id]
  176.     armor2 = $data_armors[@armor2_id]
  177.     armor3 = $data_armors[@armor3_id]
  178.     armor4 = $data_armors[@armor4_id]
  179.     armor5 = $data_armors[@armor5_id]
  180.     armor6 = $data_armors[@armor6_id]
  181.     n += weapon != nil ? weapon.agi_plus : 0
  182.     n += armor1 != nil ? armor1.agi_plus : 0
  183.     n += armor2 != nil ? armor2.agi_plus : 0
  184.     n += armor3 != nil ? armor3.agi_plus : 0
  185.     n += armor4 != nil ? armor4.agi_plus : 0
  186.     n += armor5 != nil ? armor5.agi_plus : 0
  187.     n += armor6 != nil ? armor6.agi_plus : 0
  188.     return [[n, 1].max, 999].min
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● 获取基本魔力
  192.   #--------------------------------------------------------------------------
  193.   def base_int
  194.     n = $data_actors[@actor_id].parameters[5, @level]
  195.     weapon = $data_weapons[@weapon_id]
  196.     armor1 = $data_armors[@armor1_id]
  197.     armor2 = $data_armors[@armor2_id]
  198.     armor3 = $data_armors[@armor3_id]
  199.     armor4 = $data_armors[@armor4_id]
  200.     armor5 = $data_armors[@armor5_id]
  201.     armor6 = $data_armors[@armor6_id]
  202.     n += weapon != nil ? weapon.int_plus : 0
  203.     n += armor1 != nil ? armor1.int_plus : 0
  204.     n += armor2 != nil ? armor2.int_plus : 0
  205.     n += armor3 != nil ? armor3.int_plus : 0
  206.     n += armor4 != nil ? armor4.int_plus : 0
  207.     n += armor5 != nil ? armor5.int_plus : 0
  208.     n += armor6 != nil ? armor6.int_plus : 0
  209.     return [[n, 1].max, 999].min
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 获取基本物理防御
  213.   #--------------------------------------------------------------------------
  214.   def base_pdef
  215.     weapon = $data_weapons[@weapon_id]
  216.     armor1 = $data_armors[@armor1_id]
  217.     armor2 = $data_armors[@armor2_id]
  218.     armor3 = $data_armors[@armor3_id]
  219.     armor4 = $data_armors[@armor4_id]
  220.     armor5 = $data_armors[@armor5_id]
  221.     armor6 = $data_armors[@armor6_id]
  222.     pdef1 = weapon != nil ? weapon.pdef : 0
  223.     pdef2 = armor1 != nil ? armor1.pdef : 0
  224.     pdef3 = armor2 != nil ? armor2.pdef : 0
  225.     pdef4 = armor3 != nil ? armor3.pdef : 0
  226.     pdef5 = armor4 != nil ? armor4.pdef : 0
  227.     pdef6 = armor5 != nil ? armor5.pdef : 0
  228.     pdef7 = armor6 != nil ? armor6.pdef : 0
  229.     return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6 + pdef7
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ● 获取基本魔法防御
  233.   #--------------------------------------------------------------------------
  234.   def base_mdef
  235.     weapon = $data_weapons[@weapon_id]
  236.     armor1 = $data_armors[@armor1_id]
  237.     armor2 = $data_armors[@armor2_id]
  238.     armor3 = $data_armors[@armor3_id]
  239.     armor4 = $data_armors[@armor4_id]
  240.     armor5 = $data_armors[@armor5_id]
  241.     armor6 = $data_armors[@armor6_id]
  242.     mdef1 = weapon != nil ? weapon.mdef : 0
  243.     mdef2 = armor1 != nil ? armor1.mdef : 0
  244.     mdef3 = armor2 != nil ? armor2.mdef : 0
  245.     mdef4 = armor3 != nil ? armor3.mdef : 0
  246.     mdef5 = armor4 != nil ? armor4.mdef : 0
  247.     mdef6 = armor5 != nil ? armor5.mdef : 0
  248.     mdef7 = armor6 != nil ? armor6.mdef : 0
  249.     return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6 + mdef7
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ● 获取基本回避修正
  253.   #--------------------------------------------------------------------------
  254.   def base_eva
  255.     armor1 = $data_armors[@armor1_id]
  256.     armor2 = $data_armors[@armor2_id]
  257.     armor3 = $data_armors[@armor3_id]
  258.     armor4 = $data_armors[@armor4_id]
  259.     armor5 = $data_armors[@armor5_id]
  260.     armor6 = $data_armors[@armor6_id]
  261.     eva1 = armor1 != nil ? armor1.eva : 0
  262.     eva2 = armor2 != nil ? armor2.eva : 0
  263.     eva3 = armor3 != nil ? armor3.eva : 0
  264.     eva4 = armor4 != nil ? armor4.eva : 0
  265.     eva5 = armor5 != nil ? armor5.eva : 0
  266.     eva6 = armor6 != nil ? armor6.eva : 0
  267.     return eva1 + eva2 + eva3 + eva4 + eva5 + eva6
  268.   end

  269.   #--------------------------------------------------------------------------
  270.   # ● 装备固定判定
  271.   #     equip_type : 装备类型
  272.   #--------------------------------------------------------------------------
  273.   def equip_fix?(equip_type)
  274.     case equip_type
  275.     when 0  # 武器
  276.       return $data_actors[@actor_id].weapon_fix
  277.     when 1  # 盾
  278.       return $data_actors[@actor_id].armor1_fix
  279.     when 2  # 头
  280.       return $data_actors[@actor_id].armor2_fix
  281.     when 3  # 身体
  282.       return $data_actors[@actor_id].armor3_fix
  283.     when 4  # 装饰品
  284.       return $data_actors[@actor_id].armor4_fix
  285.     end
  286.     return false
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # ● 变更装备
  290.   #     equip_type : 装备类型
  291.   #     id    : 武器 or 防具 ID  (0 为解除装备)
  292.   #--------------------------------------------------------------------------
  293.   def equip(equip_type, id)
  294.     case equip_type
  295.     when 0  # 武器
  296.       if id == 0 or $game_party.weapon_number(id) > 0
  297.         $game_party.gain_weapon(@weapon_id, 1)
  298.         @weapon_id = id
  299.         $game_party.lose_weapon(id, 1)
  300.       end
  301.     when 1  # 盾
  302.       if id == 0 or $game_party.armor_number(id) > 0
  303.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  304.         $game_party.gain_armor(@armor1_id, 1)
  305.         @armor1_id = id
  306.         $game_party.lose_armor(id, 1)
  307.       end
  308.     when 2  # 头
  309.       if id == 0 or $game_party.armor_number(id) > 0
  310.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  311.         $game_party.gain_armor(@armor2_id, 1)
  312.         @armor2_id = id
  313.         $game_party.lose_armor(id, 1)
  314.       end
  315.     when 3  # 身体
  316.       if id == 0 or $game_party.armor_number(id) > 0
  317.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  318.         $game_party.gain_armor(@armor3_id, 1)
  319.         @armor3_id = id
  320.         $game_party.lose_armor(id, 1)
  321.       end
  322.     when 4  # 装饰品
  323.       if id == 0 or $game_party.armor_number(id) > 0
  324.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  325.         $game_party.gain_armor(@armor4_id, 1)
  326.         @armor4_id = id
  327.         $game_party.lose_armor(id, 1)
  328.       end
  329.     when 5  # 项链
  330.       if id == 0 or $game_party.armor_number(id) > 0
  331.         update_auto_state($data_armors[@armor5_id], $data_armors[id])
  332.         $game_party.gain_armor(@armor5_id, 1)
  333.         @armor5_id = id
  334.         $game_party.lose_armor(id, 1)
  335.       end
  336.     when 6  # 手镯
  337.       if id == 0 or $game_party.armor_number(id) > 0
  338.         update_auto_state($data_armors[@armor6_id], $data_armors[id])
  339.         $game_party.gain_armor(@armor6_id, 1)
  340.         @armor6_id = id
  341.         $game_party.lose_armor(id, 1)
  342.       end
  343.     end
  344.     @hp = maxhp if @hp > maxhp
  345.     @sp = maxsp if @sp > maxsp
  346.   end
  347.   #--------------------------------------------------------------------------
  348.   # ● 更改职业 ID
  349.   #     class_id : 新的职业 ID
  350.   #--------------------------------------------------------------------------
  351.   def class_id=(class_id)
  352.     if $data_classes[class_id] != nil
  353.       @class_id = class_id
  354.       # 避开无法装备的物品
  355.       unless equippable?($data_weapons[@weapon_id])
  356.         equip(0, 0)
  357.       end
  358.       unless equippable?($data_armors[@armor1_id])
  359.         equip(1, 0)
  360.       end
  361.       unless equippable?($data_armors[@armor2_id])
  362.         equip(2, 0)
  363.       end
  364.       unless equippable?($data_armors[@armor3_id])
  365.         equip(3, 0)
  366.       end
  367.       unless equippable?($data_armors[@armor4_id])
  368.         equip(4, 0)
  369.       end
  370.       unless equippable?($data_armors[@armor5_id])
  371.         equip(5, 0)
  372.       end
  373.       unless equippable?($data_armors[@armor6_id])
  374.         equip(6, 0)
  375.       end
  376.     end
  377.   end
  378. end
  379. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  380. #
  381. #              Window_Base美化,增加属性增减颜色,及全能力值描绘
  382. #
  383. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  384. #==============================================================================
  385. # ■ Window_Base
  386. #------------------------------------------------------------------------------
  387. #  游戏中全部窗口的超级类。
  388. #==============================================================================

  389. class Window_Base < Window
  390.   ################## 属性增减颜色 ##############################
  391.   def up_color
  392.     return Color.new(255, 0, 0)
  393.   end
  394.   def down_color
  395.     return Color.new(0, 255, 0)
  396.   end
  397.   #--------------------------------------------------------------------------
  398.   # ● 描绘能力值
  399.   #     actor : 角色
  400.   #     x     : 描画目标 X 坐标
  401.   #     y     : 描画目标 Y 坐标
  402.   #     type  : 能力值种类 (0~6)
  403.   #--------------------------------------------------------------------------
  404.   def draw_actor_parameter(actor, x, y, type)
  405.     case type
  406.     when 0
  407.       parameter_name = $data_system.words.atk
  408.       parameter_value = actor.atk
  409.     when 1
  410.       parameter_name = $data_system.words.pdef
  411.       parameter_value = actor.pdef
  412.     when 2
  413.       parameter_name = $data_system.words.mdef
  414.       parameter_value = actor.mdef
  415.     when 3
  416.       parameter_name = $data_system.words.str
  417.       parameter_value = actor.str
  418.     when 4
  419.       parameter_name = $data_system.words.dex
  420.       parameter_value = actor.dex
  421.     when 5
  422.       parameter_name = $data_system.words.agi
  423.       parameter_value = actor.agi
  424.     when 6
  425.       parameter_name = $data_system.words.int
  426.       parameter_value = actor.int
  427.     when 7
  428.       parameter_name = "回避"
  429.       parameter_value = actor.eva
  430.     end
  431.     self.contents.font.color = system_color
  432.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  433.     self.contents.font.color = normal_color
  434.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  435.   end
  436. end
  437. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  438. #
  439. #              装备窗口美化,全能力值描绘并追加新的防具装备栏
  440. #
  441. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  442. #==============================================================================
  443. # ■ Window_EquipRight
  444. #------------------------------------------------------------------------------
  445. #  装备画面、显示角色现在装备的物品的窗口。
  446. #==============================================================================

  447. class Window_EquipRight < Window_Selectable
  448.   #--------------------------------------------------------------------------
  449.   # ● 初始化对像
  450.   #     actor : 角色
  451.   #--------------------------------------------------------------------------
  452.   def initialize(actor)
  453.     super(272, 64, 368, 256)
  454.     self.contents = Bitmap.new(width - 32, height - 32)
  455.     @actor = actor
  456.     refresh
  457.     self.index = 0
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # ● 刷新
  461.   #--------------------------------------------------------------------------
  462.   def refresh
  463.     self.contents.clear
  464.     @data = []
  465.     @data.push($data_weapons[@actor.weapon_id])
  466.     @data.push($data_armors[@actor.armor1_id])
  467.     @data.push($data_armors[@actor.armor2_id])
  468.     @data.push($data_armors[@actor.armor3_id])
  469.     @data.push($data_armors[@actor.armor4_id])
  470.     @data.push($data_armors[@actor.armor5_id])
  471.     @data.push($data_armors[@actor.armor6_id])
  472.     @item_max = @data.size
  473.     self.contents.font.color = system_color
  474.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  475.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  476.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  477.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  478.     self.contents.draw_text(4, 32 * 4, 92, 32, $data_system.words.armor4)
  479.     self.contents.draw_text(4, 32 * 5, 92, 32, "法器")
  480.     self.contents.draw_text(4, 32 * 6, 92, 32, "称号")
  481.     draw_item_name(@data[0], 92, 32 * 0)
  482.     draw_item_name(@data[1], 92, 32 * 1)
  483.     draw_item_name(@data[2], 92, 32 * 2)
  484.     draw_item_name(@data[3], 92, 32 * 3)
  485.     draw_item_name(@data[4], 92, 32 * 4)
  486.     draw_item_name(@data[5], 92, 32 * 5)
  487.     draw_item_name(@data[6], 92, 32 * 6)
  488.   end
  489. end

  490. #==============================================================================
  491. # ■ Window_EquipLeft
  492. #------------------------------------------------------------------------------
  493. #  装备画面的、显示角色能力值变化的窗口。
  494. #==============================================================================

  495. class Window_EquipLeft < Window_Base
  496.   #--------------------------------------------------------------------------
  497.   # ● 初始化对像
  498.   #     actor : 角色
  499.   #--------------------------------------------------------------------------
  500.   def initialize(actor)
  501.     super(0, 64, 272, 416)
  502.     self.contents = Bitmap.new(width - 32, height - 32)
  503.     @actor = actor
  504.     refresh
  505.   end
  506.   #--------------------------------------------------------------------------
  507.   # ● 刷新
  508.   #--------------------------------------------------------------------------
  509.   def refresh
  510.     self.contents.clear
  511.     draw_actor_name(@actor, 4, 0)
  512.     draw_actor_level(@actor, 4, 32)

  513.     draw_actor_parameter(@actor, 4, 64, 0)
  514.     draw_actor_parameter(@actor, 4, 96, 1)
  515.     draw_actor_parameter(@actor, 4, 128, 2)
  516.     draw_actor_parameter(@actor, 4, 160, 7)
  517.     draw_actor_parameter(@actor, 4, 192, 3)
  518.     draw_actor_parameter(@actor, 4, 224, 4)
  519.     draw_actor_parameter(@actor, 4, 256, 5)
  520.     draw_actor_parameter(@actor, 4, 288, 6)
  521.     if @new_atk != nil
  522.       self.contents.font.color = system_color
  523.       self.contents.draw_text(160, 64, 40, 32, "→", 1)
  524.       self.contents.font.color = @new_atk>@actor.atk ? up_color : down_color
  525.       self.contents.font.color = normal_color if @new_atk == @actor.atk
  526.       self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  527.     end
  528.     if @new_pdef != nil
  529.       self.contents.font.color = system_color
  530.       self.contents.draw_text(160, 96, 40, 32, "→", 1)
  531.       self.contents.font.color = @new_pdef>@actor.pdef ? up_color : down_color
  532.       self.contents.font.color = normal_color if @new_pdef == @actor.pdef
  533.       self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  534.     end
  535.     if @new_mdef != nil
  536.       self.contents.font.color = system_color
  537.       self.contents.draw_text(160, 128, 40, 32, "→", 1)
  538.       self.contents.font.color = @new_mdef>@actor.mdef ? up_color : down_color
  539.       self.contents.font.color = normal_color if @new_mdef == @actor.mdef
  540.       self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  541.     end
  542.     if @new_eva != nil
  543.       self.contents.font.color = system_color
  544.       self.contents.draw_text(160, 160, 40, 32, "→", 1)
  545.       self.contents.font.color = @new_eva>@actor.eva ? up_color : down_color
  546.       self.contents.font.color = normal_color if @new_eva == @actor.eva
  547.       self.contents.draw_text(200, 160, 36, 32, @new_eva.to_s, 2)
  548.     end
  549.     if @new_str != nil
  550.       self.contents.font.color = system_color
  551.       self.contents.draw_text(160, 192, 40, 32, "→", 1)
  552.       self.contents.font.color = @new_str>@actor.str ? up_color : down_color
  553.       self.contents.font.color = normal_color if @new_str == @actor.str
  554.       self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
  555.     end
  556.     if @new_dex != nil
  557.       self.contents.font.color = system_color
  558.       self.contents.draw_text(160, 224, 40, 32, "→", 1)
  559.       self.contents.font.color = @new_dex>@actor.dex ? up_color : down_color
  560.       self.contents.font.color = normal_color if @new_dex == @actor.dex
  561.       self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
  562.     end
  563.     if @new_agi != nil
  564.       self.contents.font.color = system_color
  565.       self.contents.draw_text(160, 256, 40, 32, "→", 1)
  566.       self.contents.font.color = @new_agi>@actor.agi ? up_color : down_color
  567.       self.contents.font.color = normal_color if @new_agi == @actor.agi
  568.       self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
  569.     end
  570.     if @new_int != nil
  571.       self.contents.font.color = system_color
  572.       self.contents.draw_text(160, 288, 40, 32, "→", 1)
  573.       self.contents.font.color = @new_int>@actor.int ? up_color : down_color
  574.       self.contents.font.color = normal_color if @new_int == @actor.int
  575.       self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
  576.     end
  577.   end
  578.   #--------------------------------------------------------------------------
  579.   # ● 变更装备后的能力值设置
  580.   #     new_atk  : 变更装备后的攻击力
  581.   #     new_pdef : 变更装备后的物理防御
  582.   #     new_mdef : 变更装备后的魔法防御
  583.   #--------------------------------------------------------------------------
  584.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  585.     if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
  586.       @new_atk = new_atk
  587.       @new_pdef = new_pdef
  588.       @new_mdef = new_mdef
  589.       @new_eva = new_eva
  590.       @new_str = new_str
  591.       @new_dex = new_dex
  592.       @new_agi = new_agi
  593.       @new_int = new_int
  594.       refresh
  595.     end
  596.   end
  597. end
  598. #==============================================================================
  599. # ■ Window_EquipItem
  600. #------------------------------------------------------------------------------
  601. #  装备画面、显示浏览变更装备的候补物品的窗口。
  602. #==============================================================================

  603. class Window_EquipItem < Window_Selectable
  604.   #--------------------------------------------------------------------------
  605.   # ● 初始化对像
  606.   #     actor      : 角色
  607.   #     equip_type : 装备部位 (0~3)
  608.   #--------------------------------------------------------------------------
  609.   def initialize(actor, equip_type)
  610.     super(272, 320, 368, 160)
  611.     @actor = actor
  612.     @equip_type = equip_type
  613.     @column_max = 1
  614.     refresh
  615.     self.active = false
  616.     self.index = -1
  617.   end
  618.   #--------------------------------------------------------------------------
  619.   # ● 项目的描绘
  620.   #     index : 项目符号
  621.   #--------------------------------------------------------------------------
  622.   def draw_item(index)
  623.     item = @data[index]
  624.     x = 4
  625.     y = index * 32
  626.     case item
  627.     when RPG::Weapon
  628.       number = $game_party.weapon_number(item.id)
  629.     when RPG::Armor
  630.       number = $game_party.armor_number(item.id)
  631.     end
  632.     bitmap = RPG::Cache.icon(item.icon_name)
  633.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  634.     self.contents.font.color = normal_color
  635.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  636.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  637.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  638.   end
  639. end

  640. class Scene_Equip
  641.   #--------------------------------------------------------------------------
  642.   # ● 主处理
  643.   #--------------------------------------------------------------------------
  644.   def main
  645.     @menu_com = Sprite.new
  646.     @menu_com.bitmap = RPG::Cache.picture("装备.png")
  647.     # 获取角色
  648.     @actor = $game_party.actors[@actor_index]
  649.     # 生成窗口
  650.     @help_window = Window_Movement_Help.new
  651.     @left_window = Window_EquipLeft.new(@actor)
  652.     @right_window = Window_EquipRight.new(@actor)
  653.     @item_window1 = Window_EquipItem.new(@actor, 0)
  654.     @item_window2 = Window_EquipItem.new(@actor, 1)
  655.     @item_window3 = Window_EquipItem.new(@actor, 2)
  656.     @item_window4 = Window_EquipItem.new(@actor, 3)
  657.     @item_window5 = Window_EquipItem.new(@actor, 4)
  658.     @item_window6 = Window_EquipItem.new(@actor, 5)
  659.     @item_window7 = Window_EquipItem.new(@actor, 6)
  660.     @help_window.opacity = 0
  661.     @item_window1.opacity = 0
  662.     @item_window2.opacity = 0
  663.     @item_window3.opacity = 0
  664.     @item_window4.opacity = 0
  665.     @item_window5.opacity = 0
  666.     @item_window6.opacity = 0
  667.     @item_window7.opacity = 0
  668.     @left_window.opacity = 0
  669.     @right_window.opacity = 0
  670.     # 关联帮助窗口
  671.     @right_window.help_window = @help_window
  672.     @item_window1.help_window = @help_window
  673.     @item_window2.help_window = @help_window
  674.     @item_window3.help_window = @help_window
  675.     @item_window4.help_window = @help_window
  676.     @item_window5.help_window = @help_window
  677.     @item_window6.help_window = @help_window
  678.     @item_window7.help_window = @help_window
  679.     # 设置光标位置
  680.     @right_window.index = @equip_index
  681.     refresh
  682.     # 执行过渡
  683.     Graphics.transition
  684.     # 主循环
  685.     loop do
  686.       # 刷新游戏画面
  687.       Graphics.update
  688.       # 刷新输入信息
  689.       Input.update
  690.       # 刷新画面
  691.       update
  692.       # 如果画面切换的话的就中断循环
  693.       if $scene != self
  694.         break
  695.       end
  696.     end
  697.     # 准备过渡
  698.     Graphics.freeze
  699.     @menu_com.bitmap.dispose if @menu_com.bitmap  
  700.     @menu_com.dispose
  701.     # 释放窗口
  702.     @help_window.dispose
  703.     @left_window.dispose
  704.     @right_window.dispose
  705.     @item_window1.dispose
  706.     @item_window2.dispose
  707.     @item_window3.dispose
  708.     @item_window4.dispose
  709.     @item_window5.dispose
  710.     @item_window6.dispose
  711.     @item_window7.dispose
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● 刷新
  715.   #--------------------------------------------------------------------------
  716.   def refresh
  717.     # 设置物品窗口的可视状态
  718.     @item_window1.visible = (@right_window.index == 0)
  719.     @item_window2.visible = (@right_window.index == 1)
  720.     @item_window3.visible = (@right_window.index == 2)
  721.     @item_window4.visible = (@right_window.index == 3)
  722.     @item_window5.visible = (@right_window.index == 4)
  723.     @item_window6.visible = (@right_window.index == 5)
  724.     @item_window7.visible = (@right_window.index == 6)
  725.     # 获取当前装备中的物品
  726.     item1 = @right_window.item
  727.     # 设置当前的物品窗口到 @item_window
  728.     case @right_window.index
  729.     when 0
  730.       @item_window = @item_window1
  731.     when 1
  732.       @item_window = @item_window2
  733.     when 2
  734.       @item_window = @item_window3
  735.     when 3
  736.       @item_window = @item_window4
  737.     when 4
  738.       @item_window = @item_window5
  739.     when 5
  740.       @item_window = @item_window6
  741.     when 6
  742.       @item_window = @item_window7
  743.     end
  744.     # 右窗口被激活的情况下
  745.     if @right_window.active
  746.       # 删除变更装备后的能力
  747.     ###############################################################
  748.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
  749.     end
  750.     # 物品窗口被激活的情况下
  751.     if @item_window.active
  752.       # 获取现在选中的物品
  753.       item2 = @item_window.item
  754.       # 变更装备
  755.       last_hp = @actor.hp
  756.       last_sp = @actor.sp
  757.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  758.     ###############################################################
  759.       # 获取变更装备后的能力值
  760.       new_atk = @actor.atk
  761.       new_pdef = @actor.pdef
  762.       new_mdef = @actor.mdef
  763.       new_eva = @actor.eva
  764.       new_str = @actor.str
  765.       new_dex = @actor.dex
  766.       new_agi = @actor.agi
  767.       new_int = @actor.int
  768.       # 返回到装备
  769.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  770.       @actor.hp = last_hp
  771.       @actor.sp = last_sp
  772.       # 描画左窗口
  773.     ###############################################################
  774.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  775.     ###############################################################
  776.     end
  777.   end
  778. end
  779. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  780. #
  781. #              商店购买窗口美化,增加对新装备位置的描述
  782. #
  783. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  784. #==============================================================================
  785. # ■ Window_ShopStatus
  786. #------------------------------------------------------------------------------
  787. #  商店画面、显示物品所持数与角色装备的窗口。
  788. #==============================================================================

  789. class Window_ShopStatus < Window_Base
  790.   #--------------------------------------------------------------------------
  791.   # ● 刷新
  792.   #--------------------------------------------------------------------------
  793.   def refresh
  794.     self.contents.clear
  795.     if @item == nil
  796.       return
  797.     end
  798.     case @item
  799.     when RPG::Item
  800.       number = $game_party.item_number(@item.id)
  801.     when RPG::Weapon
  802.       number = $game_party.weapon_number(@item.id)
  803.     when RPG::Armor
  804.       number = $game_party.armor_number(@item.id)
  805.     end
  806.     self.contents.font.color = system_color
  807.     self.contents.draw_text(4, 0, 200, 32, "持有")
  808.     self.contents.font.color = normal_color
  809.     self.contents.draw_text(180, 0, 32, 32, number.to_s, 2)
  810.     if @item.is_a?(RPG::Item)
  811.       return
  812.     end
  813.     # 添加装备品信息
  814.     for i in 0...$game_party.actors.size
  815.       # 获取角色
  816.       actor = $game_party.actors[i]
  817.       # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
  818.       if actor.equippable?(@item)
  819.         self.contents.font.color = normal_color
  820.       else
  821.         self.contents.font.color = disabled_color
  822.       end
  823.       # 描绘角色名字
  824.       self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  825.       # 获取当前的装备品
  826.       if @item.is_a?(RPG::Weapon)
  827.         item1 = $data_weapons[actor.weapon_id]
  828.       elsif @item.kind == 0
  829.         item1 = $data_armors[actor.armor1_id]
  830.       elsif @item.kind == 1
  831.         item1 = $data_armors[actor.armor2_id]
  832.       elsif @item.kind == 2
  833.         item1 = $data_armors[actor.armor3_id]
  834.       elsif @item.kind == 3
  835.         item1 = $data_armors[actor.armor4_id]
  836.       elsif @item.kind == 4
  837.         item1 = $data_armors[actor.armor5_id]
  838.       else# if @item.kind == 5
  839.         item1 = $data_armors[actor.armor6_id]
  840.       end
  841.       # 可以装备的情况
  842.       if actor.equippable?(@item)
  843.         # 武器的情况
  844.         if @item.is_a?(RPG::Weapon)
  845.           atk1 = item1 != nil ? item1.atk : 0
  846.           atk2 = @item != nil ? @item.atk : 0
  847.           change = atk2 - atk1
  848.         end
  849.         # 防具的情况
  850.         if @item.is_a?(RPG::Armor)
  851.           pdef1 = item1 != nil ? item1.pdef : 0
  852.           mdef1 = item1 != nil ? item1.mdef : 0
  853.           pdef2 = @item != nil ? @item.pdef : 0
  854.           mdef2 = @item != nil ? @item.mdef : 0
  855.           change = pdef2 - pdef1 + mdef2 - mdef1
  856.         end
  857.         # 描绘能力值变化
  858.         self.contents.draw_text(90, 64 + 64 * i, 112, 32,
  859.           sprintf("%+d", change), 2)
  860.       end
  861.       # 描绘物品
  862.       if item1 != nil
  863.         x = 4
  864.         y = 64 + 64 * i + 32
  865.         bitmap = RPG::Cache.icon(item1.icon_name)
  866.         opacity = self.contents.font.color == normal_color ? 255 : 128
  867.         self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  868.         self.contents.draw_text(x + 28, y, 212, 32, item1.name)
  869.       end
  870.     end
  871.   end
  872. end
复制代码

点评

谢谢大大  发表于 2015-4-10 16:22

评分

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

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-26 06:35

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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