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

Project1

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

[已经过期] 装备扩展问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
176 小时
注册时间
2009-9-4
帖子
181
跳转到指定楼层
1
发表于 2010-9-12 14:07:10 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本来打算用10装备的装备扩展,结果事后发现BUG好多。。只好换回原来的,不过还是有一个问题,具体如图



最后两项没有文字显示

脚本如下:
  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.   attr_reader   :armor7_id                # 护具 ID
  27.   attr_reader   :armor8_id                # 其他 ID
  28.   #--------------------------------------------------------------------------
  29.   # ● 设置
  30.   #     actor_id : 角色 ID
  31.   #--------------------------------------------------------------------------
  32.   alias old_setup setup
  33.   def setup(actor_id)
  34.     old_setup(actor_id)
  35.     @armor5_id = 0
  36.     @armor6_id = 0
  37.     @armor7_id = 0
  38.     @armor8_id = 0
  39.     update_auto_state(nil, $data_armors[@armor5_id])
  40.     update_auto_state(nil, $data_armors[@armor6_id])
  41.     update_auto_state(nil, $data_armors[@armor7_id])
  42.     update_auto_state(nil, $data_armors[@armor8_id])
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 取得属性修正值
  46.   #     element_id : 属性 ID
  47.   #--------------------------------------------------------------------------
  48.   def element_rate(element_id)
  49.     # 获取对应属性有效度的数值
  50.     table = [0,200,150,100,50,0,-100]
  51.     result = table[$data_classes[@class_id].element_ranks[element_id]]
  52.     # 防具能防御本属性的情况下效果减半
  53.     for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
  54.       armor = $data_armors[i]
  55.       if armor != nil and armor.guard_element_set.include?(element_id)
  56.         result /= 2
  57.       end
  58.     end
  59.     # 状态能防御本属性的情况下效果减半
  60.     for i in @states
  61.       if $data_states[i].guard_element_set.include?(element_id)
  62.         result /= 2
  63.       end
  64.     end
  65.     # 过程结束
  66.     return result
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 判定防御属性
  70.   #     state_id : 属性 ID
  71.   #--------------------------------------------------------------------------
  72.   def state_guard?(state_id)
  73.     for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
  74.       armor = $data_armors[i]
  75.       if armor != nil
  76.         if armor.guard_state_set.include?(state_id)
  77.           return true
  78.         end
  79.       end
  80.     end
  81.     return false
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 获取基本力量
  85.   #--------------------------------------------------------------------------
  86.   def base_str
  87.     n = $data_actors[@actor_id].parameters[2, @level]
  88.     weapon = $data_weapons[@weapon_id]
  89.     armor1 = $data_armors[@armor1_id]
  90.     armor2 = $data_armors[@armor2_id]
  91.     armor3 = $data_armors[@armor3_id]
  92.     armor4 = $data_armors[@armor4_id]
  93.     armor5 = $data_armors[@armor5_id]
  94.     armor6 = $data_armors[@armor6_id]
  95.     armor7 = $data_armors[@armor7_id]
  96.     armor8 = $data_armors[@armor8_id]
  97.     n += weapon != nil ? weapon.str_plus : 0
  98.     n += armor1 != nil ? armor1.str_plus : 0
  99.     n += armor2 != nil ? armor2.str_plus : 0
  100.     n += armor3 != nil ? armor3.str_plus : 0
  101.     n += armor4 != nil ? armor4.str_plus : 0
  102.     n += armor5 != nil ? armor5.str_plus : 0
  103.     n += armor6 != nil ? armor6.str_plus : 0
  104.     n += armor7 != nil ? armor7.str_plus : 0
  105.     n += armor8 != nil ? armor8.str_plus : 0
  106.     return [[n, 1].max, 999].min
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ● 获取基本灵巧
  110.   #--------------------------------------------------------------------------
  111.   def base_dex
  112.     n = $data_actors[@actor_id].parameters[3, @level]
  113.     weapon = $data_weapons[@weapon_id]
  114.     armor1 = $data_armors[@armor1_id]
  115.     armor2 = $data_armors[@armor2_id]
  116.     armor3 = $data_armors[@armor3_id]
  117.     armor4 = $data_armors[@armor4_id]
  118.     armor5 = $data_armors[@armor5_id]
  119.     armor6 = $data_armors[@armor6_id]
  120.     armor7 = $data_armors[@armor7_id]
  121.     armor8 = $data_armors[@armor8_id]
  122.     n += weapon != nil ? weapon.dex_plus : 0
  123.     n += armor1 != nil ? armor1.dex_plus : 0
  124.     n += armor2 != nil ? armor2.dex_plus : 0
  125.     n += armor3 != nil ? armor3.dex_plus : 0
  126.     n += armor4 != nil ? armor4.dex_plus : 0
  127.     n += armor5 != nil ? armor5.dex_plus : 0
  128.     n += armor6 != nil ? armor6.dex_plus : 0
  129.     n += armor7 != nil ? armor7.str_plus : 0
  130.     n += armor8 != nil ? armor8.str_plus : 0
  131.     return [[n, 1].max, 999].min
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 获取基本速度
  135.   #--------------------------------------------------------------------------
  136.   def base_agi
  137.     n = $data_actors[@actor_id].parameters[4, @level]
  138.     weapon = $data_weapons[@weapon_id]
  139.     armor1 = $data_armors[@armor1_id]
  140.     armor2 = $data_armors[@armor2_id]
  141.     armor3 = $data_armors[@armor3_id]
  142.     armor4 = $data_armors[@armor4_id]
  143.     armor5 = $data_armors[@armor5_id]
  144.     armor6 = $data_armors[@armor6_id]
  145.     armor7 = $data_armors[@armor7_id]
  146.     armor8 = $data_armors[@armor8_id]
  147.     n += weapon != nil ? weapon.agi_plus : 0
  148.     n += armor1 != nil ? armor1.agi_plus : 0
  149.     n += armor2 != nil ? armor2.agi_plus : 0
  150.     n += armor3 != nil ? armor3.agi_plus : 0
  151.     n += armor4 != nil ? armor4.agi_plus : 0
  152.     n += armor5 != nil ? armor5.agi_plus : 0
  153.     n += armor6 != nil ? armor6.agi_plus : 0
  154.     n += armor7 != nil ? armor7.str_plus : 0
  155.     n += armor8 != nil ? armor8.str_plus : 0
  156.     return [[n, 1].max, 999].min
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 获取基本魔力
  160.   #--------------------------------------------------------------------------
  161.   def base_int
  162.     n = $data_actors[@actor_id].parameters[5, @level]
  163.     weapon = $data_weapons[@weapon_id]
  164.     armor1 = $data_armors[@armor1_id]
  165.     armor2 = $data_armors[@armor2_id]
  166.     armor3 = $data_armors[@armor3_id]
  167.     armor4 = $data_armors[@armor4_id]
  168.     armor5 = $data_armors[@armor5_id]
  169.     armor6 = $data_armors[@armor6_id]
  170.     armor7 = $data_armors[@armor7_id]
  171.     armor8 = $data_armors[@armor8_id]
  172.     n += weapon != nil ? weapon.int_plus : 0
  173.     n += armor1 != nil ? armor1.int_plus : 0
  174.     n += armor2 != nil ? armor2.int_plus : 0
  175.     n += armor3 != nil ? armor3.int_plus : 0
  176.     n += armor4 != nil ? armor4.int_plus : 0
  177.     n += armor5 != nil ? armor5.int_plus : 0
  178.     n += armor6 != nil ? armor6.int_plus : 0
  179.     n += armor7 != nil ? armor7.str_plus : 0
  180.     n += armor8 != nil ? armor8.str_plus : 0
  181.     return [[n, 1].max, 999].min
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 获取基本物理防御
  185.   #--------------------------------------------------------------------------
  186.   def base_pdef
  187.     weapon = $data_weapons[@weapon_id]
  188.     armor1 = $data_armors[@armor1_id]
  189.     armor2 = $data_armors[@armor2_id]
  190.     armor3 = $data_armors[@armor3_id]
  191.     armor4 = $data_armors[@armor4_id]
  192.     armor5 = $data_armors[@armor5_id]
  193.     armor6 = $data_armors[@armor6_id]
  194.     armor7 = $data_armors[@armor7_id]
  195.     armor8 = $data_armors[@armor8_id]
  196.     pdef1 = weapon != nil ? weapon.pdef : 0
  197.     pdef2 = armor1 != nil ? armor1.pdef : 0
  198.     pdef3 = armor2 != nil ? armor2.pdef : 0
  199.     pdef4 = armor3 != nil ? armor3.pdef : 0
  200.     pdef5 = armor4 != nil ? armor4.pdef : 0
  201.     pdef6 = armor5 != nil ? armor5.pdef : 0
  202.     pdef7 = armor6 != nil ? armor6.pdef : 0
  203.     pdef8 = armor7 != nil ? armor7.pdef : 0
  204.     pdef9 = armor8 != nil ? armor8.pdef : 0
  205.     return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6 + pdef7 + pdef8 + pdef9
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● 获取基本魔法防御
  209.   #--------------------------------------------------------------------------
  210.   def base_mdef
  211.     weapon = $data_weapons[@weapon_id]
  212.     armor1 = $data_armors[@armor1_id]
  213.     armor2 = $data_armors[@armor2_id]
  214.     armor3 = $data_armors[@armor3_id]
  215.     armor4 = $data_armors[@armor4_id]
  216.     armor5 = $data_armors[@armor5_id]
  217.     armor6 = $data_armors[@armor6_id]
  218.     armor7 = $data_armors[@armor7_id]
  219.     armor8 = $data_armors[@armor8_id]
  220.     mdef1 = weapon != nil ? weapon.mdef : 0
  221.     mdef2 = armor1 != nil ? armor1.mdef : 0
  222.     mdef3 = armor2 != nil ? armor2.mdef : 0
  223.     mdef4 = armor3 != nil ? armor3.mdef : 0
  224.     mdef5 = armor4 != nil ? armor4.mdef : 0
  225.     mdef6 = armor5 != nil ? armor5.mdef : 0
  226.     mdef7 = armor6 != nil ? armor6.mdef : 0
  227.     mdef8 = armor7 != nil ? armor7.mdef : 0
  228.     mdef9 = armor8 != nil ? armor8.mdef : 0
  229.     return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6 + mdef7 + mdef8 + mdef9
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ● 获取基本回避修正
  233.   #--------------------------------------------------------------------------
  234.   def base_eva
  235.     armor1 = $data_armors[@armor1_id]
  236.     armor2 = $data_armors[@armor2_id]
  237.     armor3 = $data_armors[@armor3_id]
  238.     armor4 = $data_armors[@armor4_id]
  239.     armor5 = $data_armors[@armor5_id]
  240.     armor6 = $data_armors[@armor6_id]
  241.     armor7 = $data_armors[@armor7_id]
  242.     armor8 = $data_armors[@armor8_id]
  243.     eva1 = armor1 != nil ? armor1.eva : 0
  244.     eva2 = armor2 != nil ? armor2.eva : 0
  245.     eva3 = armor3 != nil ? armor3.eva : 0
  246.     eva4 = armor4 != nil ? armor4.eva : 0
  247.     eva5 = armor5 != nil ? armor5.eva : 0
  248.     eva6 = armor6 != nil ? armor6.eva : 0
  249.     eva7 = armor7 != nil ? armor7.eva : 0
  250.     eva8 = armor8 != nil ? armor8.eva : 0
  251.     return eva1 + eva2 + eva3 + eva4 + eva5 + eva6 + eva7 + eva8
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ● 装备固定判定
  255.   #     equip_type : 装备类型
  256.   #--------------------------------------------------------------------------
  257.   def equip_fix?(equip_type)
  258.     case equip_type
  259.     when 0  # 武器
  260.       return $data_actors[@actor_id].weapon_fix
  261.     when 1  # 盾
  262.       return $data_actors[@actor_id].armor1_fix
  263.     when 2  # 头
  264.       return $data_actors[@actor_id].armor2_fix
  265.     when 3  # 身体
  266.       return $data_actors[@actor_id].armor3_fix
  267.     when 4  # 装饰品
  268.       return $data_actors[@actor_id].armor4_fix
  269.     end
  270.     return false
  271.   end
  272.   #--------------------------------------------------------------------------
  273.   # ● 变更装备
  274.   #     equip_type : 装备类型
  275.   #     id    : 武器 or 防具 ID  (0 为解除装备)
  276.   #--------------------------------------------------------------------------
  277.   def equip(equip_type, id)
  278.     case equip_type
  279.     when 0  # 武器
  280.       if id == 0 or $game_party.weapon_number(id) > 0
  281.         $game_party.gain_weapon(@weapon_id, 1)
  282.         @weapon_id = id
  283.         $game_party.lose_weapon(id, 1)
  284.       end
  285.     when 1  # 盾
  286.       if id == 0 or $game_party.armor_number(id) > 0
  287.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  288.         $game_party.gain_armor(@armor1_id, 1)
  289.         @armor1_id = id
  290.         $game_party.lose_armor(id, 1)
  291.       end
  292.     when 2  # 头
  293.       if id == 0 or $game_party.armor_number(id) > 0
  294.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  295.         $game_party.gain_armor(@armor2_id, 1)
  296.         @armor2_id = id
  297.         $game_party.lose_armor(id, 1)
  298.       end
  299.     when 3  # 身体
  300.       if id == 0 or $game_party.armor_number(id) > 0
  301.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  302.         $game_party.gain_armor(@armor3_id, 1)
  303.         @armor3_id = id
  304.         $game_party.lose_armor(id, 1)
  305.       end
  306.     when 4  # 装饰品
  307.       if id == 0 or $game_party.armor_number(id) > 0
  308.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  309.         $game_party.gain_armor(@armor4_id, 1)
  310.         @armor4_id = id
  311.         $game_party.lose_armor(id, 1)
  312.       end
  313.     when 5  # 裤子
  314.       if id == 0 or $game_party.armor_number(id) > 0
  315.         update_auto_state($data_armors[@armor5_id], $data_armors[id])
  316.         $game_party.gain_armor(@armor5_id, 1)
  317.         @armor5_id = id
  318.         $game_party.lose_armor(id, 1)
  319.       end
  320.     when 6  # 鞋
  321.       if id == 0 or $game_party.armor_number(id) > 0
  322.         update_auto_state($data_armors[@armor6_id], $data_armors[id])
  323.         $game_party.gain_armor(@armor6_id, 1)
  324.         @armor6_id = id
  325.         $game_party.lose_armor(id, 1)
  326.       end
  327.     when 7  # 护具
  328.       if id == 0 or $game_party.armor_number(id) > 0
  329.         update_auto_state($data_armors[@armor7_id], $data_armors[id])
  330.         $game_party.gain_armor(@armor7_id, 1)
  331.         @armor7_id = id
  332.         $game_party.lose_armor(id, 1)
  333.       end
  334.     when 8  # 其他
  335.       if id == 0 or $game_party.armor_number(id) > 0
  336.         update_auto_state($data_armors[@armor8_id], $data_armors[id])
  337.         $game_party.gain_armor(@armor8_id, 1)
  338.         @armor8_id = id
  339.         $game_party.lose_armor(id, 1)
  340.       end
  341.     end
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● 更改职业 ID
  345.   #     class_id : 新的职业 ID
  346.   #--------------------------------------------------------------------------
  347.   def class_id=(class_id)
  348.     if $data_classes[class_id] != nil
  349.       @class_id = class_id
  350.       # 避开无法装备的物品
  351.       unless equippable?($data_weapons[@weapon_id])
  352.         equip(0, 0)
  353.       end
  354.       unless equippable?($data_armors[@armor1_id])
  355.         equip(1, 0)
  356.       end
  357.       unless equippable?($data_armors[@armor2_id])
  358.         equip(2, 0)
  359.       end
  360.       unless equippable?($data_armors[@armor3_id])
  361.         equip(3, 0)
  362.       end
  363.       unless equippable?($data_armors[@armor4_id])
  364.         equip(4, 0)
  365.       end
  366.       unless equippable?($data_armors[@armor5_id])
  367.         equip(5, 0)
  368.       end
  369.       unless equippable?($data_armors[@armor6_id])
  370.         equip(6, 0)
  371.       end
  372.       unless equippable?($data_armors[@armor7_id])
  373.         equip(7, 0)
  374.       end
  375.       unless equippable?($data_armors[@armor8_id])
  376.         equip(8, 0)
  377.       end
  378.     end
  379.   end
  380. end
  381. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  382. #
  383. #              Window_Base美化,增加属性增减颜色,及全能力值描绘
  384. #
  385. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  386. #==============================================================================
  387. # ■ Window_Base
  388. #------------------------------------------------------------------------------
  389. #  游戏中全部窗口的超级类。
  390. #==============================================================================

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

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

  498. #==============================================================================
  499. # ■ Window_EquipLeft
  500. #------------------------------------------------------------------------------
  501. #  装备画面的、显示角色能力值变化的窗口。
  502. #==============================================================================

  503. class Window_EquipLeft < Window_Base
  504.   #--------------------------------------------------------------------------
  505.   # ● 初始化对像
  506.   #     actor : 角色
  507.   #--------------------------------------------------------------------------
  508.   def initialize(actor)
  509.     super(0, 64, 272, 416)
  510.     self.contents = Bitmap.new(width - 32, height - 32)
  511.     @actor = actor
  512.     refresh
  513.   end
  514.   #--------------------------------------------------------------------------
  515.   # ● 刷新
  516.   #--------------------------------------------------------------------------
  517.   def refresh
  518.     self.contents.clear
  519.     draw_actor_name(@actor, 4, 0)
  520.     draw_actor_level(@actor, 4, 32)

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

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

  650. class Scene_Equip
  651.   #--------------------------------------------------------------------------
  652.   # ● 主处理
  653.   #--------------------------------------------------------------------------
  654.   def main
  655.     # 获取角色
  656.     @actor = $game_party.actors[@actor_index]
  657.     # 生成窗口
  658.     @help_window = Window_Help.new
  659.     @left_window = Window_EquipLeft.new(@actor)
  660.     @right_window = Window_EquipRight.new(@actor)
  661.     @item_window1 = Window_EquipItem.new(@actor, 0)
  662.     @item_window2 = Window_EquipItem.new(@actor, 1)
  663.     @item_window3 = Window_EquipItem.new(@actor, 2)
  664.     @item_window4 = Window_EquipItem.new(@actor, 3)
  665.     @item_window5 = Window_EquipItem.new(@actor, 4)
  666.     @item_window6 = Window_EquipItem.new(@actor, 5)
  667.     @item_window7 = Window_EquipItem.new(@actor, 6)
  668.     @item_window8 = Window_EquipItem.new(@actor, 8)
  669.     @item_window9 = Window_EquipItem.new(@actor, 9)
  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.     @item_window8.help_window = @help_window
  680.     @item_window9.help_window = @help_window
  681.     # 设置光标位置
  682.     @right_window.index = @equip_index
  683.     refresh
  684.     # 执行过渡
  685.     Graphics.transition
  686.     # 主循环
  687.     loop do
  688.       # 刷新游戏画面
  689.       Graphics.update
  690.       # 刷新输入信息
  691.       Input.update
  692.       # 刷新画面
  693.       update
  694.       # 如果画面切换的话的就中断循环
  695.       if $scene != self
  696.         break
  697.       end
  698.     end
  699.     # 准备过渡
  700.     Graphics.freeze
  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.     @item_window8.dispose
  713.     @item_window9.dispose
  714.   end
  715.   #--------------------------------------------------------------------------
  716.   # ● 刷新
  717.   #--------------------------------------------------------------------------
  718.   def refresh
  719.     # 设置物品窗口的可视状态
  720.     @item_window1.visible = (@right_window.index == 0)
  721.     @item_window2.visible = (@right_window.index == 1)
  722.     @item_window3.visible = (@right_window.index == 2)
  723.     @item_window4.visible = (@right_window.index == 3)
  724.     @item_window5.visible = (@right_window.index == 4)
  725.     @item_window6.visible = (@right_window.index == 5)
  726.     @item_window7.visible = (@right_window.index == 6)
  727.     @item_window8.visible = (@right_window.index == 7)
  728.     @item_window9.visible = (@right_window.index == 8)
  729.     # 获取当前装备中的物品
  730.     item1 = @right_window.item
  731.     # 设置当前的物品窗口到 @item_window
  732.     case @right_window.index
  733.     when 0
  734.       @item_window = @item_window1
  735.     when 1
  736.       @item_window = @item_window2
  737.     when 2
  738.       @item_window = @item_window3
  739.     when 3
  740.       @item_window = @item_window4
  741.     when 4
  742.       @item_window = @item_window5
  743.     when 5
  744.       @item_window = @item_window6
  745.     when 6
  746.       @item_window = @item_window7
  747.     when 7
  748.       @item_window = @item_window8
  749.     when 8
  750.       @item_window = @item_window9
  751.     end
  752.     # 右窗口被激活的情况下
  753.     if @right_window.active
  754.       # 删除变更装备后的能力
  755.     ###############################################################
  756.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
  757.     end
  758.     # 物品窗口被激活的情况下
  759.     if @item_window.active
  760.       # 获取现在选中的物品
  761.       item2 = @item_window.item
  762.       # 变更装备
  763.       last_hp = @actor.hp
  764.       last_sp = @actor.sp
  765.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  766.     ###############################################################
  767.       # 获取变更装备后的能力值
  768.       new_atk = @actor.atk
  769.       new_pdef = @actor.pdef
  770.       new_mdef = @actor.mdef
  771.       new_eva = @actor.eva
  772.       new_str = @actor.str
  773.       new_dex = @actor.dex
  774.       new_agi = @actor.agi
  775.       new_int = @actor.int
  776.       # 返回到装备
  777.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  778.       @actor.hp = last_hp
  779.       @actor.sp = last_sp
  780.       # 描画左窗口
  781.     ###############################################################
  782.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  783.     ###############################################################
  784.     end
  785.   end
  786. end
  787. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  788. #
  789. #              状态窗口美化,全防具装备栏描绘
  790. #
  791. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  792. #==============================================================================
  793. # ■ Window_Status
  794. #------------------------------------------------------------------------------
  795. #  显示状态画面、完全规格的状态窗口。
  796. #==============================================================================

  797. class Window_Status < Window_Base
  798.   #--------------------------------------------------------------------------
  799.   # ● 刷新
  800.   #--------------------------------------------------------------------------
  801.   def refresh
  802.     self.contents.clear
  803.     draw_actor_graphic(@actor, 40, 112)
  804.     draw_actor_name(@actor, 4, 0)
  805.     draw_actor_class(@actor, 4 + 144, 0)
  806.     draw_actor_level(@actor, 96, 32)
  807.     draw_actor_state(@actor, 96, 64)
  808.     draw_actor_hp(@actor, 96, 112, 172)
  809.     draw_actor_sp(@actor, 96, 144, 172)
  810.     draw_actor_parameter(@actor, 96, 192, 0)
  811.     draw_actor_parameter(@actor, 96, 224, 1)
  812.     draw_actor_parameter(@actor, 96, 256, 2)
  813.     draw_actor_parameter(@actor, 96, 304, 3)
  814.     draw_actor_parameter(@actor, 96, 336, 4)
  815.     draw_actor_parameter(@actor, 96, 368, 5)
  816.     draw_actor_parameter(@actor, 96, 400, 6)
  817.     self.contents.font.color = system_color
  818.     self.contents.draw_text(320, 48, 80, 32, "EXP")
  819.     self.contents.draw_text(320, 80, 80, 32, "NEXT")
  820.     self.contents.font.color = normal_color
  821.     self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
  822.     self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
  823.     self.contents.font.color = system_color
  824.     self.contents.draw_text(320, 160, 96, 32, "装备")
  825.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
  826.     draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 240)
  827.     draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 272)
  828.     draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 304)
  829.     draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 336)
  830.     draw_item_name($data_armors[@actor.armor5_id], 320 + 16, 368)
  831.     draw_item_name($data_armors[@actor.armor6_id], 320 + 16, 400)
  832.   end
  833.   def dummy
  834.     self.contents.font.color = system_color
  835.     self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
  836.     self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
  837.     self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
  838.     self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
  839.     self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
  840.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
  841.     draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
  842.     draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
  843.     draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
  844.     draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
  845.   end
  846. end
  847. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  848. #
  849. #              商店购买窗口美化,增加对新装备位置的描述
  850. #
  851. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  852. #==============================================================================
  853. # ■ Window_ShopStatus
  854. #------------------------------------------------------------------------------
  855. #  商店画面、显示物品所持数与角色装备的窗口。
  856. #==============================================================================

  857. class Window_ShopStatus < Window_Base
  858.   #--------------------------------------------------------------------------
  859.   # ● 刷新
  860.   #--------------------------------------------------------------------------
  861.   def refresh
  862.     self.contents.clear
  863.     if @item == nil
  864.       return
  865.     end
  866.     case @item
  867.     when RPG::Item
  868.       number = $game_party.item_number(@item.id)
  869.     when RPG::Weapon
  870.       number = $game_party.weapon_number(@item.id)
  871.     when RPG::Armor
  872.       number = $game_party.armor_number(@item.id)
  873.     end
  874.     self.contents.font.color = system_color
  875.     self.contents.draw_text(4, 0, 200, 32, "所持数")
  876.     self.contents.font.color = normal_color
  877.     self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
  878.     if @item.is_a?(RPG::Item)
  879.       return
  880.     end
  881.     # 添加装备品信息
  882.     for i in 0...$game_party.actors.size
  883.       # 获取角色
  884.       actor = $game_party.actors[i]
  885.       # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
  886.       if actor.equippable?(@item)
  887.         self.contents.font.color = normal_color
  888.       else
  889.         self.contents.font.color = disabled_color
  890.       end
  891.       # 描绘角色名字
  892.       self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  893.       # 获取当前的装备品
  894.       if @item.is_a?(RPG::Weapon)
  895.         item1 = $data_weapons[actor.weapon_id]
  896.       elsif @item.kind == 0
  897.         item1 = $data_armors[actor.armor1_id]
  898.       elsif @item.kind == 1
  899.         item1 = $data_armors[actor.armor2_id]
  900.       elsif @item.kind == 2
  901.         item1 = $data_armors[actor.armor3_id]
  902.       elsif @item.kind == 3
  903.         item1 = $data_armors[actor.armor4_id]
  904.       elsif @item.kind == 4
  905.         item1 = $data_armors[actor.armor5_id]
  906.       else# if @item.kind == 5
  907.         item1 = $data_armors[actor.armor6_id]
  908.       end
  909.       # 可以装备的情况
  910.       if actor.equippable?(@item)
  911.         # 武器的情况
  912.         if @item.is_a?(RPG::Weapon)
  913.           atk1 = item1 != nil ? item1.atk : 0
  914.           atk2 = @item != nil ? @item.atk : 0
  915.           change = atk2 - atk1
  916.         end
  917.         # 防具的情况
  918.         if @item.is_a?(RPG::Armor)
  919.           pdef1 = item1 != nil ? item1.pdef : 0
  920.           mdef1 = item1 != nil ? item1.mdef : 0
  921.           pdef2 = @item != nil ? @item.pdef : 0
  922.           mdef2 = @item != nil ? @item.mdef : 0
  923.           change = pdef2 - pdef1 + mdef2 - mdef1
  924.         end
  925.         # 描绘能力值变化
  926.         self.contents.draw_text(124, 64 + 64 * i, 112, 32,
  927.           sprintf("%+d", change), 2)
  928.       end
  929.       # 描绘物品
  930.       if item1 != nil
  931.         x = 4
  932.         y = 64 + 64 * i + 32
  933.         bitmap = RPG::Cache.icon(item1.icon_name)
  934.         opacity = self.contents.font.color == normal_color ? 255 : 128
  935.         self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  936.         self.contents.draw_text(x + 28, y, 212, 32, item1.name)
  937.       end
  938.     end
  939.   end
  940. end
复制代码

点评

换成哪个啊?  发表于 2010-9-28 11:51
这个脚本写的不好,推荐你换一个吧  发表于 2010-9-28 01:47
绯色の弦月

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
42471
在线时间
7606 小时
注册时间
2009-7-6
帖子
13506

开拓者贵宾

2
发表于 2010-9-12 14:13:57 | 只看该作者
回复 lcg0593 的帖子


    回复 lcg0593 的帖子

我要哭了,我原来也有类似的问题,但是解决了,可是忘了怎么弄的
你看看这里把
http://rpg.blue/forum.php?mod=vi ... 47280&from=home
   
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
176 小时
注册时间
2009-9-4
帖子
181
3
 楼主| 发表于 2010-9-13 19:02:41 | 只看该作者
自顶一下。。。。。。这个问题没那么难吧。。。都没人回答。。。。。。。。。。

fhx2你那个帖子看不懂诶。。。。。。。。。。。

点评

就是我自己都看不懂就会了才难以回答。。  发表于 2010-9-13 20:09
绯色の弦月
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
26 小时
注册时间
2011-11-5
帖子
41
4
发表于 2012-2-12 11:24:30 | 只看该作者
@fux2帖子看不到了······能发我一下么····
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-12-1 07:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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