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

Project1

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

[已经过期] 谁能给我一个装备扩展脚本和适用方法啊 万谢

[复制链接]

Lv1.梦旅人

梦石
0
星屑
693
在线时间
9 小时
注册时间
2014-4-10
帖子
4
跳转到指定楼层
1
发表于 2014-4-12 23:41:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
rt,求大神了

Lv1.梦旅人

梦石
0
星屑
50
在线时间
192 小时
注册时间
2010-8-23
帖子
161
2
发表于 2014-4-13 10:20:25 | 只看该作者

数据库前的,5与,6代表追加的防具种类

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.   #     equip_type : 装备类型
  222.   #--------------------------------------------------------------------------
  223.   def equip_fix?(equip_type)
  224.     case equip_type
  225.     when 0  # 武器
  226.       return $data_actors[@actor_id].weapon_fix
  227.     when 1  # 盾
  228.       return $data_actors[@actor_id].armor1_fix
  229.     when 2  # 头
  230.       return $data_actors[@actor_id].armor2_fix
  231.     when 3  # 身体
  232.       return $data_actors[@actor_id].armor3_fix
  233.     when 4  # 装饰品
  234.       return $data_actors[@actor_id].armor4_fix
  235.     end
  236.     return false
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● 变更装备
  240.   #     equip_type : 装备类型
  241.   #     id    : 武器 or 防具 ID  (0 为解除装备)
  242.   #--------------------------------------------------------------------------
  243.   def equip(equip_type, id)
  244.     case equip_type
  245.     when 0  # 武器
  246.       if id == 0 or $game_party.weapon_number(id) > 0
  247.         $game_party.gain_weapon(@weapon_id, 1)
  248.         @weapon_id = id
  249.         $game_party.lose_weapon(id, 1)
  250.       end
  251.     when 1  # 盾
  252.       if id == 0 or $game_party.armor_number(id) > 0
  253.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  254.         $game_party.gain_armor(@armor1_id, 1)
  255.         @armor1_id = id
  256.         $game_party.lose_armor(id, 1)
  257.       end
  258.     when 2  # 头
  259.       if id == 0 or $game_party.armor_number(id) > 0
  260.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  261.         $game_party.gain_armor(@armor2_id, 1)
  262.         @armor2_id = id
  263.         $game_party.lose_armor(id, 1)
  264.       end
  265.     when 3  # 身体
  266.       if id == 0 or $game_party.armor_number(id) > 0
  267.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  268.         $game_party.gain_armor(@armor3_id, 1)
  269.         @armor3_id = id
  270.         $game_party.lose_armor(id, 1)
  271.       end
  272.     when 4  # 装饰品
  273.       if id == 0 or $game_party.armor_number(id) > 0
  274.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  275.         $game_party.gain_armor(@armor4_id, 1)
  276.         @armor4_id = id
  277.         $game_party.lose_armor(id, 1)
  278.       end
  279.     when 5  # 项链
  280.       if id == 0 or $game_party.armor_number(id) > 0
  281.         update_auto_state($data_armors[@armor5_id], $data_armors[id])
  282.         $game_party.gain_armor(@armor5_id, 1)
  283.         @armor5_id = id
  284.         $game_party.lose_armor(id, 1)
  285.       end
  286.     when 6  # 鞋
  287.       if id == 0 or $game_party.armor_number(id) > 0
  288.         update_auto_state($data_armors[@armor6_id], $data_armors[id])
  289.         $game_party.gain_armor(@armor6_id, 1)
  290.         @armor6_id = id
  291.         $game_party.lose_armor(id, 1)
  292.       end
  293.     end
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ● 更改职业 ID
  297.   #     class_id : 新的职业 ID
  298.   #--------------------------------------------------------------------------
  299.   def class_id=(class_id)
  300.     if $data_classes[class_id] != nil
  301.       @class_id = class_id
  302.       # 避开无法装备的物品
  303.       unless equippable?($data_weapons[@weapon_id])
  304.         equip(0, 0)
  305.       end
  306.       unless equippable?($data_armors[@armor1_id])
  307.         equip(1, 0)
  308.       end
  309.       unless equippable?($data_armors[@armor2_id])
  310.         equip(2, 0)
  311.       end
  312.       unless equippable?($data_armors[@armor3_id])
  313.         equip(3, 0)
  314.       end
  315.       unless equippable?($data_armors[@armor4_id])
  316.         equip(4, 0)
  317.       end
  318.       unless equippable?($data_armors[@armor5_id])
  319.         equip(5, 0)
  320.       end
  321.       unless equippable?($data_armors[@armor6_id])
  322.         equip(6, 0)
  323.       end
  324.     end
  325.   end
  326. end
  327. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  328. #
  329. #              Window_Base美化,增加属性增减颜色,及全能力值描绘
  330. #
  331. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  332. #==============================================================================
  333. # ■ Window_Base
  334. #------------------------------------------------------------------------------
  335. #  游戏中全部窗口的超级类。
  336. #==============================================================================
  337.  
  338. class Window_Base < Window
  339.   ################## 属性增减颜色 ##############################
  340.   def up_color
  341.     return Color.new(255, 0, 0)
  342.   end
  343.   def down_color
  344.     return Color.new(0, 255, 0)
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ● 描绘能力值
  348.   #     actor : 角色
  349.   #     x     : 描画目标 X 坐标
  350.   #     y     : 描画目标 Y 坐标
  351.   #     type  : 能力值种类 (0~6)
  352.   #--------------------------------------------------------------------------
  353.   def draw_actor_parameter(actor, x, y, type)
  354.     case type
  355.     when 0
  356.       parameter_name = $data_system.words.atk
  357.       parameter_value = actor.atk
  358.     when 1
  359.       parameter_name = $data_system.words.pdef
  360.       parameter_value = actor.pdef
  361.     when 2
  362.       parameter_name = $data_system.words.mdef
  363.       parameter_value = actor.mdef
  364.     when 3
  365.       parameter_name = $data_system.words.str
  366.       parameter_value = actor.str
  367.     when 4
  368.       parameter_name = $data_system.words.dex
  369.       parameter_value = actor.dex
  370.     when 5
  371.       parameter_name = $data_system.words.agi
  372.       parameter_value = actor.agi
  373.     when 6
  374.       parameter_name = $data_system.words.int
  375.       parameter_value = actor.int
  376.     when 7
  377.       parameter_name = "回避"
  378.       parameter_value = actor.eva
  379.     end
  380.     self.contents.font.color = system_color
  381.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  382.     self.contents.font.color = normal_color
  383.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  384.   end
  385. end
  386. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  387. #
  388. #              装备窗口美化,全能力值描绘并追加新的防具装备栏
  389. #
  390. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  391. #==============================================================================
  392. # ■ Window_EquipRight
  393. #------------------------------------------------------------------------------
  394. #  装备画面、显示角色现在装备的物品的窗口。
  395. #==============================================================================
  396.  
  397. class Window_EquipRight < Window_Selectable
  398.   #--------------------------------------------------------------------------
  399.   # ● 初始化对像
  400.   #     actor : 角色
  401.   #--------------------------------------------------------------------------
  402.   def initialize(actor)
  403.     super(272, 64, 368, 256)
  404.     self.contents = Bitmap.new(width - 32, height - 32)
  405.     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  406.     refresh
  407.     self.index = 0
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ● 刷新
  411.   #--------------------------------------------------------------------------
  412.   def refresh
  413.     self.contents.clear
  414.     @data = []
  415.     @data.push($data_weapons[@actor.weapon_id])
  416.     @data.push($data_armors[@actor.armor1_id])
  417.     @data.push($data_armors[@actor.armor2_id])
  418.     @data.push($data_armors[@actor.armor3_id])
  419.     @data.push($data_armors[@actor.armor4_id])
  420.     @data.push($data_armors[@actor.armor5_id])
  421.     @data.push($data_armors[@actor.armor6_id])
  422.     @item_max = @data.size
  423.     self.contents.font.color = system_color
  424.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  425.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  426.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  427.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  428.     self.contents.draw_text(4, 32 * 4, 92, 32, $data_system.words.armor4)
  429.     self.contents.draw_text(4, 32 * 5, 92, 32, "特殊")
  430.     self.contents.draw_text(4, 32 * 6, 92, 32, "鞋")
  431.     draw_item_name(@data[0], 92, 32 * 0)
  432.     draw_item_name(@data[1], 92, 32 * 1)
  433.     draw_item_name(@data[2], 92, 32 * 2)
  434.     draw_item_name(@data[3], 92, 32 * 3)
  435.     draw_item_name(@data[4], 92, 32 * 4)
  436.     draw_item_name(@data[5], 92, 32 * 5)
  437.     draw_item_name(@data[6], 92, 32 * 6)
  438.   end
  439. end
  440.  
  441. #==============================================================================
  442. # ■ Window_EquipLeft
  443. #------------------------------------------------------------------------------
  444. #  装备画面的、显示角色能力值变化的窗口。
  445. #==============================================================================
  446.  
  447. class Window_EquipLeft < Window_Base
  448.   #--------------------------------------------------------------------------
  449.   # ● 初始化对像
  450.   #     actor : 角色
  451.   #--------------------------------------------------------------------------
  452.   def initialize(actor)
  453.     super(0, 64, 272, 416)
  454.     self.contents = Bitmap.new(width - 32, height - 32)
  455.     @actor = actor
  456.     refresh
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # ● 刷新
  460.   #--------------------------------------------------------------------------
  461.   def refresh
  462.     self.contents.clear
  463.     draw_actor_name(@actor, 4, 0)
  464.     draw_actor_level(@actor, 4, 32)
  465.  
  466.     draw_actor_parameter(@actor, 4, 64, 0)
  467.     draw_actor_parameter(@actor, 4, 96, 1)
  468.     draw_actor_parameter(@actor, 4, 128, 2)
  469.     draw_actor_parameter(@actor, 4, 160, 7)
  470.     draw_actor_parameter(@actor, 4, 192, 3)
  471.     draw_actor_parameter(@actor, 4, 224, 4)
  472.     draw_actor_parameter(@actor, 4, 256, 5)
  473.     draw_actor_parameter(@actor, 4, 288, 6)
  474.     if @new_atk != nil
  475.       self.contents.font.color = system_color
  476.       self.contents.draw_text(160, 64, 40, 32, "→", 1)
  477.       self.contents.font.color = @new_atk>@actor.atk ? up_color : down_color
  478.       self.contents.font.color = normal_color if @new_atk == @actor.atk
  479.       self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  480.     end
  481.     if @new_pdef != nil
  482.       self.contents.font.color = system_color
  483.       self.contents.draw_text(160, 96, 40, 32, "→", 1)
  484.       self.contents.font.color = @new_pdef>@actor.pdef ? up_color : down_color
  485.       self.contents.font.color = normal_color if @new_pdef == @actor.pdef
  486.       self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  487.     end
  488.     if @new_mdef != nil
  489.       self.contents.font.color = system_color
  490.       self.contents.draw_text(160, 128, 40, 32, "→", 1)
  491.       self.contents.font.color = @new_mdef>@actor.mdef ? up_color : down_color
  492.       self.contents.font.color = normal_color if @new_mdef == @actor.mdef
  493.       self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  494.     end
  495.     if @new_eva != nil
  496.       self.contents.font.color = system_color
  497.       self.contents.draw_text(160, 160, 40, 32, "→", 1)
  498.       self.contents.font.color = @new_eva>@actor.eva ? up_color : down_color
  499.       self.contents.font.color = normal_color if @new_eva == @actor.eva
  500.       self.contents.draw_text(200, 160, 36, 32, @new_eva.to_s, 2)
  501.     end
  502.     if @new_str != nil
  503.       self.contents.font.color = system_color
  504.       self.contents.draw_text(160, 192, 40, 32, "→", 1)
  505.       self.contents.font.color = @new_str>@actor.str ? up_color : down_color
  506.       self.contents.font.color = normal_color if @new_str == @actor.str
  507.       self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
  508.     end
  509.     if @new_dex != nil
  510.       self.contents.font.color = system_color
  511.       self.contents.draw_text(160, 224, 40, 32, "→", 1)
  512.       self.contents.font.color = @new_dex>@actor.dex ? up_color : down_color
  513.       self.contents.font.color = normal_color if @new_dex == @actor.dex
  514.       self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
  515.     end
  516.     if @new_agi != nil
  517.       self.contents.font.color = system_color
  518.       self.contents.draw_text(160, 256, 40, 32, "→", 1)
  519.       self.contents.font.color = @new_agi>@actor.agi ? up_color : down_color
  520.       self.contents.font.color = normal_color if @new_agi == @actor.agi
  521.       self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
  522.     end
  523.     if @new_int != nil
  524.       self.contents.font.color = system_color
  525.       self.contents.draw_text(160, 288, 40, 32, "→", 1)
  526.       self.contents.font.color = @new_int>@actor.int ? up_color : down_color
  527.       self.contents.font.color = normal_color if @new_int == @actor.int
  528.       self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
  529.     end
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # ● 变更装备后的能力值设置
  533.   #     new_atk  : 变更装备后的攻击力
  534.   #     new_pdef : 变更装备后的物理防御
  535.   #     new_mdef : 变更装备后的魔法防御
  536.   #--------------------------------------------------------------------------
  537.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  538.     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
  539.       @new_atk = new_atk
  540.       @new_pdef = new_pdef
  541.       @new_mdef = new_mdef
  542.       @new_eva = new_eva
  543.       @new_str = new_str
  544.       @new_dex = new_dex
  545.       @new_agi = new_agi
  546.       @new_int = new_int
  547.       refresh
  548.     end
  549.   end
  550. end
  551. #==============================================================================
  552. # ■ Window_EquipItem
  553. #------------------------------------------------------------------------------
  554. #  装备画面、显示浏览变更装备的候补物品的窗口。
  555. #==============================================================================
  556.   def text_color(n)
  557.     case n
  558.     when 0
  559.       return Color.new(255, 255, 255, 255)
  560.     when 1
  561.       return Color.new(124,252,0, 255)
  562.     when 2
  563.       return Color.new(30,144,255, 255)
  564.     when 3
  565.       return Color.new(218,122,214, 255)
  566.     when 4
  567.       return Color.new(255, 235, 128, 255)
  568.     when 5
  569.       return Color.new(255,140,0, 255)
  570.     when 6
  571.       return Color.new(255, 128, 128, 255)
  572.     when 7
  573.       return Color.new(175, 175, 175, 175)
  574.     else
  575.       normal_color
  576.     end
  577.   end
  578. class Window_EquipItem < Window_Selectable
  579.   #--------------------------------------------------------------------------
  580.   # ● 初始化对像
  581.   #     actor      : 角色
  582.   #     equip_type : 装备部位 (0~3)
  583.   #--------------------------------------------------------------------------
  584.   def initialize(actor, equip_type)
  585.     super(272, 320, 368, 160)
  586.     @actor = actor
  587.     @equip_type = equip_type
  588.     @column_max = 1
  589.     refresh
  590.     self.active = false
  591.     self.index = -1
  592.   end
  593.   #--------------------------------------------------------------------------
  594.   # ● 项目的描绘
  595.   #     index : 项目符号
  596.   #--------------------------------------------------------------------------
  597.  
  598.   def draw_item(index)
  599.     item = @data[index]
  600.     x = 4
  601.     y = index * 32
  602.     case item
  603.     when RPG::Weapon
  604.       number = $game_party.weapon_number(item.id)
  605.     when RPG::Armor
  606.       number = $game_party.armor_number(item.id)
  607.     end
  608.     bitmap = RPG::Cache.icon(item.icon_name)
  609.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  610.     #self.contents.font.color = normal_color
  611.     self.contents.font.color = text_color(item.name_color_66RPG)
  612.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  613.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  614.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  615.   end
  616. end
  617.  
  618. class Scene_Equip
  619.   #--------------------------------------------------------------------------
  620.   # ● 主处理
  621.   #--------------------------------------------------------------------------
  622.   def main
  623.     # 获取角色
  624.     @actor = $game_party.actors[@actor_index]
  625.     # 生成窗口
  626.     @help_window = Window_Help.new
  627.     @left_window = Window_EquipLeft.new(@actor)
  628.     @right_window = Window_EquipRight.new(@actor)
  629.     @item_window1 = Window_EquipItem.new(@actor, 0)
  630.     @item_window2 = Window_EquipItem.new(@actor, 1)
  631.     @item_window3 = Window_EquipItem.new(@actor, 2)
  632.     @item_window4 = Window_EquipItem.new(@actor, 3)
  633.     @item_window5 = Window_EquipItem.new(@actor, 4)
  634.     @item_window6 = Window_EquipItem.new(@actor, 5)
  635.     @item_window7 = Window_EquipItem.new(@actor, 6)
  636.     # 关联帮助窗口
  637.     @right_window.help_window = @help_window
  638.     @item_window1.help_window = @help_window
  639.     @item_window2.help_window = @help_window
  640.     @item_window3.help_window = @help_window
  641.     @item_window4.help_window = @help_window
  642.     @item_window5.help_window = @help_window
  643.     @item_window6.help_window = @help_window
  644.     @item_window7.help_window = @help_window
  645.     # 设置光标位置
  646.     @right_window.index = @equip_index
  647.     refresh
  648.     # 执行过渡
  649.     Graphics.transition
  650.     # 主循环
  651.     loop do
  652.       # 刷新游戏画面
  653.       Graphics.update
  654.       # 刷新输入信息
  655.       Input.update
  656.       # 刷新画面
  657.       update
  658.       # 如果画面切换的话的就中断循环
  659.       if $scene != self
  660.         break
  661.       end
  662.     end
  663.     # 准备过渡
  664.     Graphics.freeze
  665.     # 释放窗口
  666.     @help_window.dispose
  667.     @left_window.dispose
  668.     @right_window.dispose
  669.     @item_window1.dispose
  670.     @item_window2.dispose
  671.     @item_window3.dispose
  672.     @item_window4.dispose
  673.     @item_window5.dispose
  674.     @item_window6.dispose
  675.     @item_window7.dispose
  676.   end
  677.   #--------------------------------------------------------------------------
  678.   # ● 刷新
  679.   #--------------------------------------------------------------------------
  680.   def refresh
  681.     # 设置物品窗口的可视状态
  682.     @item_window1.visible = (@right_window.index == 0)
  683.     @item_window2.visible = (@right_window.index == 1)
  684.     @item_window3.visible = (@right_window.index == 2)
  685.     @item_window4.visible = (@right_window.index == 3)
  686.     @item_window5.visible = (@right_window.index == 4)
  687.     @item_window6.visible = (@right_window.index == 5)
  688.     @item_window7.visible = (@right_window.index == 6)
  689.     # 获取当前装备中的物品
  690.     item1 = @right_window.item
  691.     # 设置当前的物品窗口到 @item_window
  692.     case @right_window.index
  693.     when 0
  694.       @item_window = @item_window1
  695.     when 1
  696.       @item_window = @item_window2
  697.     when 2
  698.       @item_window = @item_window3
  699.     when 3
  700.       @item_window = @item_window4
  701.     when 4
  702.       @item_window = @item_window5
  703.     when 5
  704.       @item_window = @item_window6
  705.     when 6
  706.       @item_window = @item_window7
  707.     end
  708.     # 右窗口被激活的情况下
  709.     if @right_window.active
  710.       # 删除变更装备后的能力
  711.     ###############################################################
  712.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
  713.     end
  714.     # 物品窗口被激活的情况下
  715.     if @item_window.active
  716.       # 获取现在选中的物品
  717.       item2 = @item_window.item
  718.       # 变更装备
  719.       last_hp = @actor.hp
  720.       last_sp = @actor.sp
  721.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  722.     ###############################################################
  723.       # 获取变更装备后的能力值
  724.       new_atk = @actor.atk
  725.       new_pdef = @actor.pdef
  726.       new_mdef = @actor.mdef
  727.       new_eva = @actor.eva
  728.       new_str = @actor.str
  729.       new_dex = @actor.dex
  730.       new_agi = @actor.agi
  731.       new_int = @actor.int
  732.       # 返回到装备
  733.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  734.       @actor.hp = last_hp
  735.       @actor.sp = last_sp
  736.       # 描画左窗口
  737.     ###############################################################
  738.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  739.     ###############################################################
  740.     end
  741.   end
  742. end
  743. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  744. #
  745. #              状态窗口美化,全防具装备栏描绘
  746. #
  747. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  748. #==============================================================================
  749. # ■ Window_Status
  750. #------------------------------------------------------------------------------
  751. #  显示状态画面、完全规格的状态窗口。
  752. #==============================================================================
  753.  
  754. class Window_Status < Window_Base
  755.   #--------------------------------------------------------------------------
  756.   # ● 刷新
  757.   #--------------------------------------------------------------------------
  758.   def refresh
  759.     self.contents.clear
  760.     draw_actor_graphic(@actor, 40, 112)
  761.     draw_actor_name(@actor, 4, 0)
  762.     draw_actor_class(@actor, 4 + 144, 0)
  763.     draw_actor_level(@actor, 96, 32)
  764.     draw_actor_state(@actor, 96, 64)
  765.     draw_actor_hp(@actor, 96, 112, 172)
  766.     draw_actor_sp(@actor, 96, 144, 172)
  767.     draw_actor_parameter(@actor, 96, 192, 0)
  768.     draw_actor_parameter(@actor, 96, 224, 1)
  769.     draw_actor_parameter(@actor, 96, 256, 2)
  770.     draw_actor_parameter(@actor, 96, 304, 3)
  771.     draw_actor_parameter(@actor, 96, 336, 4)
  772.     draw_actor_parameter(@actor, 96, 368, 5)
  773.     draw_actor_parameter(@actor, 96, 400, 6)
  774.     self.contents.font.color = system_color
  775.     self.contents.draw_text(320, 48, 80, 32, "EXP")
  776.     self.contents.draw_text(320, 80, 80, 32, "NEXT")
  777.     self.contents.font.color = normal_color
  778.     self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
  779.     self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
  780.     self.contents.font.color = system_color
  781.     self.contents.draw_text(320, 160, 96, 32, "装备")
  782.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
  783.     draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 240)
  784.     draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 272)
  785.     draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 304)
  786.     draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 336)
  787.     draw_item_name($data_armors[@actor.armor5_id], 320 + 16, 368)
  788.     draw_item_name($data_armors[@actor.armor6_id], 320 + 16, 400)
  789.   end
  790.   def dummy
  791.     self.contents.font.color = system_color
  792.     self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
  793.     self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
  794.     self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
  795.     self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
  796.     self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
  797.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
  798.     draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
  799.     draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
  800.     draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
  801.     draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
  802.   end
  803. end
  804. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  805. #
  806. #              商店购买窗口美化,增加对新装备位置的描述
  807. #
  808. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  809. #==============================================================================
  810. # ■ Window_ShopStatus
  811. #------------------------------------------------------------------------------
  812. #  商店画面、显示物品所持数与角色装备的窗口。
  813. #==============================================================================
  814.  
  815. class Window_ShopStatus < Window_Base
  816.   #--------------------------------------------------------------------------
  817.   # ● 刷新
  818.   #--------------------------------------------------------------------------
  819.   def refresh
  820.     self.contents.clear
  821.     if @item == nil
  822.       return
  823.     end
  824.     case @item
  825.     when RPG::Item
  826.       number = $game_party.item_number(@item.id)
  827.     when RPG::Weapon
  828.       number = $game_party.weapon_number(@item.id)
  829.     when RPG::Armor
  830.       number = $game_party.armor_number(@item.id)
  831.     end
  832.     self.contents.font.color = system_color
  833.     self.contents.draw_text(4, 0, 200, 32, "所持数")
  834.     self.contents.font.color = normal_color
  835.     self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
  836.     if @item.is_a?(RPG::Item)
  837.       return
  838.     end
  839.     # 添加装备品信息
  840.     for i in 0...$game_party.actors.size
  841.       # 获取角色
  842.       actor = $game_party.actors[i]
  843.       # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
  844.       if actor.equippable?(@item)
  845.         self.contents.font.color = normal_color
  846.       else
  847.         self.contents.font.color = disabled_color
  848.       end
  849.       # 描绘角色名字
  850.       self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  851.       # 获取当前的装备品
  852.       if @item.is_a?(RPG::Weapon)
  853.         item1 = $data_weapons[actor.weapon_id]
  854.       elsif @item.kind == 0
  855.         item1 = $data_armors[actor.armor1_id]
  856.       elsif @item.kind == 1
  857.         item1 = $data_armors[actor.armor2_id]
  858.       elsif @item.kind == 2
  859.         item1 = $data_armors[actor.armor3_id]
  860.       elsif @item.kind == 3
  861.         item1 = $data_armors[actor.armor4_id]
  862.       elsif @item.kind == 4
  863.         item1 = $data_armors[actor.armor5_id]
  864.       else# if @item.kind == 5
  865.         item1 = $data_armors[actor.armor6_id]
  866.       end
  867.       # 可以装备的情况
  868.       if actor.equippable?(@item)
  869.         # 武器的情况
  870.         if @item.is_a?(RPG::Weapon)
  871.           atk1 = item1 != nil ? item1.atk : 0
  872.           atk2 = @item != nil ? @item.atk : 0
  873.           change = atk2 - atk1
  874.         end
  875.         # 防具的情况
  876.         if @item.is_a?(RPG::Armor)
  877.           pdef1 = item1 != nil ? item1.pdef : 0
  878.           mdef1 = item1 != nil ? item1.mdef : 0
  879.           pdef2 = @item != nil ? @item.pdef : 0
  880.           mdef2 = @item != nil ? @item.mdef : 0
  881.           change = pdef2 - pdef1 + mdef2 - mdef1
  882.         end
  883.         # 描绘能力值变化
  884.         self.contents.draw_text(124, 64 + 64 * i, 112, 32,
  885.           sprintf("%+d", change), 2)
  886.       end
  887.       # 描绘物品
  888.       if item1 != nil
  889.         x = 4
  890.         y = 64 + 64 * i + 32
  891.         bitmap = RPG::Cache.icon(item1.icon_name)
  892.         opacity = self.contents.font.color == normal_color ? 255 : 128
  893.         self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  894.         self.contents.draw_text(x + 28, y, 212, 32, item1.name)
  895.       end
  896.     end
  897.   end
  898. end

评分

参与人数 1星屑 +90 收起 理由
myownroc + 90 塞糖

查看全部评分

其实我是个三流的画师  ←_←
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-25 05:35

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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