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

Project1

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

[已经过期] 关于RMVX武器附带技能与防具附带技能同时使用的冲突

[复制链接]

Lv1.梦旅人

梦石
0
星屑
370
在线时间
20 小时
注册时间
2011-11-30
帖子
1
跳转到指定楼层
1
发表于 2012-1-16 11:56:16 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式
防具的
  1. #==============================================================================
  2. # ★ LY0_Costants
  3. #------------------------------------------------------------------------------
  4. #  独自的定数的定义
  5. #==============================================================================
  6. #------------------------------------------------------------------------------
  7. # ◆ 基本設定
  8. #------------------------------------------------------------------------------
  9. # 装备技能(识別用文字列 + [技能 ID|技能 ID|...]) ※ 最大数 4
  10. LY0_ARMOR_SKILL_SIGNATURE = "*ARMORSKILL"

  11. #==============================================================================
  12. # ★ LY0_Module
  13. #------------------------------------------------------------------------------
  14. #  独自的机能添加
  15. #==============================================================================
  16. module LY0
  17. #--------------------------------------------------------------------------
  18. # ☆ 属性道具取得
  19. # id : 属性 ID
  20. #--------------------------------------------------------------------------
  21. def self.element_icon(id)
  22. return LY0_ELEMENT_ICON[id - 1]
  23. end
  24. #--------------------------------------------------------------------------
  25. # ☆ 防具技能的附加
  26. # item : 防具号
  27. #--------------------------------------------------------------------------
  28. def self.armor_skill(item)
  29. result = []
  30. if item.is_a?(RPG::Armor)
  31. sig = LY0_ARMOR_SKILL_SIGNATURE
  32. reg = /#{Regexp.quote sig}\[((\d+\|?)+)\]/
  33. if item.note.scan(reg).to_a[0]
  34. r = $~[0].gsub(/#{Regexp.quote sig}\[/, "").gsub(/\]/, "")
  35. for s in r.split(/\s*\|\s*/)
  36. skill = $data_skills[s.to_i]
  37. result.push(skill) if skill.is_a?(RPG::Skill)
  38. end
  39. end
  40. end
  41. return result
  42. end
  43. end

  44. class Game_Actor
  45. alias _ly0sys_skill_can_use? skill_can_use?
  46. #--------------------------------------------------------------------------
  47. # ☆ 技能配列取得
  48. #--------------------------------------------------------------------------
  49. def armor_skills
  50. result = []
  51. for armor in self.armors
  52. for skill in LY0::armor_skill(armor)
  53. result.push(skill)
  54. end
  55. end
  56. return result
  57. end
  58. #--------------------------------------------------------------------------
  59. # ○ 技能使用可能判定 (再定義)
  60. # skill : 技能
  61. #--------------------------------------------------------------------------
  62. def skill_can_use?(skill)
  63. # 防具
  64. for a_skill in armor_skills
  65. return super if a_skill.id == skill.id
  66. end
  67. return _ly0sys_skill_can_use?(skill)
  68. end
  69. end
  70. #==============================================================================
  71. # ★ LY0_Window
  72. #------------------------------------------------------------------------------
  73. #==============================================================================
  74. class Window_Base
  75. #--------------------------------------------------------------------------
  76. # ☆ システムメッセージの下地を描画
  77. #--------------------------------------------------------------------------
  78. def draw_system_base
  79. self.opacity = 0
  80. rect = Rect.new(0, 0, contents.width, self.contents.height)
  81. self.contents.fill_rect(rect, system_color)
  82. rect = Rect.new(2, 2, contents.width - 4, self.contents.height - 4)
  83. color = Color.new(24, 8, 4)
  84. self.contents.fill_rect(rect, color)
  85. end

  86. end
  87. #==============================================================================
  88. # ■ Window_Skill
  89. #------------------------------------------------------------------------------
  90. #  特技画面中、显示可以使用的特技浏览的窗口
  91. #==============================================================================
  92. class Window_Skill
  93. #--------------------------------------------------------------------------
  94. # ● 刷新
  95. #--------------------------------------------------------------------------
  96. def refresh
  97. temp = []
  98. for skill in @actor.skills
  99. next if $game_temp.in_battle and not skill.battle_ok?
  100. temp.push(skill)
  101. end
  102. # 防具加技能
  103. for skill in @actor.armor_skills
  104. next if $game_temp.in_battle and not skill.battle_ok?
  105. temp.push(skill) unless temp.include?(skill)
  106. end
  107. temp.sort! {|a, b| a.id <=> b.id}
  108. @data = []
  109. for skill in temp
  110. @data.push(skill)
  111. if skill.id == @actor.last_skill_id
  112. self.index = @data.size - 1
  113. end
  114. end
  115. @item_max = @data.size
  116. create_contents
  117. for i in 0...@item_max
  118. draw_item(i)
  119. end
  120. end
  121. end

  122. class Scene_Equip
  123. alias _ly0mequip_start start
  124. alias _ly0mequip_terminate terminate
  125. alias _ly0mequip_update update
  126. alias _ly0mequip_update_equip_selection update_equip_selection
  127. alias _ly0mequip_update_item_windows update_item_windows
  128. #--------------------------------------------------------------------------
  129. # ○ 開始処理 (追加定義)
  130. #--------------------------------------------------------------------------
  131. def start
  132. _ly0mequip_start
  133. @skill_window = LY0_WindowItemSpec.new(0, 248, 288, [@actor])
  134. @skill_window.y = 416 - @skill_window.height
  135. @skill_window.active = true
  136. @skill_window.visible = false
  137. end
  138. #--------------------------------------------------------------------------
  139. # ○ 終了処理 (追加定義)
  140. #--------------------------------------------------------------------------
  141. def terminate
  142. _ly0mequip_terminate
  143. @skill_window.dispose
  144. end
  145. #--------------------------------------------------------------------------
  146. # ○ フレーム更新 (追加定義)
  147. #--------------------------------------------------------------------------
  148. def update
  149. _ly0mequip_update
  150. @skill_window.update
  151. end
  152. #--------------------------------------------------------------------------
  153. # ○ 装備部位選択の更新 (追加定義)
  154. #--------------------------------------------------------------------------
  155. def update_equip_selection
  156. _ly0mequip_update_equip_selection
  157. @skill_window.x = 544 - 288
  158. @skill_window.item = @equip_window.item
  159. end
  160. #--------------------------------------------------------------------------
  161. # ○ アイテムウィンドウの更新 (追加定義)
  162. #--------------------------------------------------------------------------
  163. def update_item_windows
  164. _ly0mequip_update_item_windows
  165. @skill_window.x = @item_window.index % 2 == 0 ? 544 - 288 : 0
  166. @skill_window.item = @item_window.item
  167. end
  168. end
  169. #==============================================================================
  170. # ★ LY0_WindowItemSpec
  171. #------------------------------------------------------------------------------
  172. #  装备技能 属性的显示
  173. #==============================================================================
  174. class LY0_WindowItemSpec < Window_Base
  175. #--------------------------------------------------------------------------
  176. # ☆ オブジェクト初期化
  177. # actors : アクターの配列
  178. #--------------------------------------------------------------------------
  179. def initialize(x, y, width, actors)
  180. super(x, y, width, WLH * 5 + 48)
  181. @actors = actors
  182. @item = nil
  183. self.opacity = 0
  184. self.active = false
  185. refresh
  186. end
  187. #--------------------------------------------------------------------------
  188. # ☆ リフレッシュ
  189. #--------------------------------------------------------------------------
  190. def refresh
  191. self.contents.clear
  192. if self.active and @item != nil
  193. draw_system_base
  194. if @item.is_a?(RPG::Armor)
  195. draw_armor_skill
  196. else
  197. self.visible = false
  198. end
  199. end
  200. end
  201. #--------------------------------------------------------------------------
  202. # ☆防具技能的描画
  203. #--------------------------------------------------------------------------
  204. def draw_armor_skill
  205. cw = contents.width - @actors.size * 24 - 8
  206. #draw_system_font("ARMOR_SKILL", 8, 8)
  207. self.contents.draw_text(8, 8, 110, 24, "ARMOR SKILL")
  208. self.contents.font.color = normal_color
  209. skills = LY0::armor_skill(@item)
  210. for i in 0..3
  211. y = WLH * (i + 1) + 8
  212. if skills[i] != nil
  213. for actor in @actors
  214. x = cw + (@actors.size > 1 ? actor.index * 24 : -8)
  215. draw_actor_status_character(actor, x + 16, 32)
  216. if actor.skill_learn?(skills[i])
  217. #draw_system_icon("CHECK1", x, y, 24)
  218. self.contents.draw_text(x, y, 24, 2,"RE")
  219. elsif actor.armor_skills.include?(skills[i])
  220. #draw_system_icon("CHECK2", x, y, 24)
  221. self.contents.draw_text(x, y, 24, 24, "ON")
  222. end
  223. end
  224. draw_item_name(skills[i], 8, y)
  225. else
  226. self.contents.draw_text(32, y, cw, WLH, "------------")
  227. end
  228. end
  229. self.visible = (not skills.empty?)
  230. end
  231. #--------------------------------------------------------------------------
  232. # ☆ 技能图用步行图の描画
  233. # actor : 角色
  234. # x : 描画先 X 座標
  235. # y : 描画先 Y 座標
  236. # opacity : 不透明度
  237. #--------------------------------------------------------------------------
  238. def draw_actor_status_character(actor, x, y)
  239. bitmap = Cache.character(actor.character_name)
  240. cw = bitmap.width / 12
  241. ch = bitmap.height / 8
  242. n = actor.character_index
  243. src_rect = Rect.new((n%4*3+1)*cw + 5, (n/4*4)*ch, 22, 22)
  244. self.contents.blt(x - cw / 2 + 1, y - ch + 9, bitmap, src_rect)
  245. end
  246. #--------------------------------------------------------------------------
  247. # ☆ 道具的設定
  248. # item : 新变更的道具
  249. #--------------------------------------------------------------------------
  250. def item=(item)
  251. if @item != item
  252. @item = item
  253. refresh
  254. end
  255. end
  256. end
复制代码
  1. #==============================================================================
  2. # ★ MQ0_Costants
  3. #------------------------------------------------------------------------------
  4. #  独自的定数的定义
  5. #==============================================================================
  6. 武器的
  7. #------------------------------------------------------------------------------
  8. # ◆ 基本設定
  9. #------------------------------------------------------------------------------

  10. # 装备技能(识別用文字列 + [技能 ID|技能 ID|...]) ※ 最大数 4
  11. MQ0_WEAPONSKILL_SIGNATURE = "*WEAPONSKILL"

  12. #==============================================================================
  13. # ★ MQ0_Module
  14. #------------------------------------------------------------------------------
  15. #  独自的机能添加
  16. #==============================================================================

  17. module MQ0
  18.   #--------------------------------------------------------------------------
  19.   # ☆ 防具技能的附加
  20.   #     item : 防具号
  21.   #--------------------------------------------------------------------------
  22.   def self.weapon_skill(item)
  23.     result = []
  24.     if item.is_a?(RPG::Weapon)
  25.       sig = MQ0_WEAPONSKILL_SIGNATURE
  26.       reg = /#{Regexp.quote sig}\[((\d+\|?)+)\]/
  27.       if item.note.scan(reg).to_a[0]
  28.         r = $~[0].gsub(/#{Regexp.quote sig}\[/, "").gsub(/\]/, "")
  29.         for s in r.split(/\s*\|\s*/)
  30.           skill = $data_skills[s.to_i]
  31.           result.push(skill) if skill.is_a?(RPG::Skill)
  32.         end
  33.       end
  34.     end
  35.     return result
  36.   end
  37.   
  38. end


  39. class Game_Actor
  40.   alias _mq0sys_skill_can_use? skill_can_use?
  41.   #--------------------------------------------------------------------------
  42.   # ☆ 技能配列取得
  43.   #--------------------------------------------------------------------------
  44.   def weapon_skills
  45.     result = []
  46.     for weapon in self.weapons
  47.       for skill in MQ0::weapon_skill(weapon)
  48.         result.push(skill)
  49.       end
  50.     end
  51.     return result
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ○ 技能使用可能判定 (再定義)
  55.   #     skill : 技能
  56.   #--------------------------------------------------------------------------
  57.   def skill_can_use?(skill)
  58.     # ウェポンスキル
  59.     for w_skill in weapon_skills
  60.       return super if w_skill.id == skill.id
  61.     end
  62.     return _mq0sys_skill_can_use?(skill)
  63.   end
  64. end

  65. #==============================================================================
  66. # ★ MQ0_Window
  67. #------------------------------------------------------------------------------
  68. #==============================================================================

  69. class Window_Base
  70.   
  71.   #--------------------------------------------------------------------------
  72.   # ☆ システムメッセージの下地を描画
  73.   #--------------------------------------------------------------------------
  74.   def draw_system_base
  75.     self.opacity = 0
  76.     rect = Rect.new(0, 0, contents.width, self.contents.height)
  77.     self.contents.fill_rect(rect, system_color)
  78.     rect = Rect.new(2, 2, contents.width - 4, self.contents.height - 4)
  79.     color = Color.new(24, 8, 4)
  80.     self.contents.fill_rect(rect, color)
  81.   end
  82.   
  83.   
  84. end

  85. #==============================================================================
  86. # ■ Window_Skill
  87. #------------------------------------------------------------------------------
  88. #  特技画面中、显示可以使用的特技浏览的窗口
  89. #==============================================================================

  90. class Window_Skill
  91.   
  92.   #--------------------------------------------------------------------------
  93.   # ● 刷新
  94.   #--------------------------------------------------------------------------
  95.   def refresh
  96.     temp = []
  97.     for skill in @actor.skills
  98.       next if $game_temp.in_battle and not skill.battle_ok?
  99.       temp.push(skill)
  100.     end
  101.     # ウェポンスキル
  102.     for skill in @actor.weapon_skills
  103.       next if $game_temp.in_battle and not skill.battle_ok?
  104.       temp.push(skill) unless temp.include?(skill)
  105.     end
  106.     temp.sort! {|a, b| a.id <=> b.id}
  107.     @data = []
  108.     for skill in temp
  109.       @data.push(skill)
  110.       if skill.id == @actor.last_skill_id
  111.         self.index = @data.size - 1
  112.       end
  113.     end
  114.     @item_max = @data.size
  115.     create_contents
  116.     for i in 0...@item_max
  117.       draw_item(i)
  118.     end
  119.   end
  120. end


  121. class Scene_Equip
  122. alias _mq0mequip_start start
  123.   alias _mq0mequip_terminate terminate
  124.   alias _mq0mequip_update update
  125.   alias _mq0mequip_update_equip_selection update_equip_selection
  126.   alias _mq0mequip_update_item_windows update_item_windows
  127.   #--------------------------------------------------------------------------
  128.   # ○ 開始処理 (追加定義)
  129.   #--------------------------------------------------------------------------
  130.    def start
  131.     _mq0mequip_start
  132.     @skill_window = MQ0_WindowItemSpec.new(0, 248, 288, [@actor])
  133.     @skill_window.y = 416 - @skill_window.height
  134.     @skill_window.active = true
  135.     @skill_window.visible = false
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ○ 終了処理 (追加定義)
  139.   #--------------------------------------------------------------------------
  140. def terminate
  141.     _mq0mequip_terminate
  142.     @skill_window.dispose
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ○ フレーム更新 (追加定義)
  146.   #--------------------------------------------------------------------------
  147.   def update
  148.     _mq0mequip_update
  149.     @skill_window.update
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ○ 装備部位選択の更新 (追加定義)
  153.   #--------------------------------------------------------------------------
  154.   def update_equip_selection
  155.     _mq0mequip_update_equip_selection
  156.     @skill_window.x = 544 - 288
  157.     @skill_window.item = @equip_window.item
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ○ アイテムウィンドウの更新 (追加定義)
  161.   #--------------------------------------------------------------------------
  162.   def update_item_windows
  163.     _mq0mequip_update_item_windows
  164.     @skill_window.x = @item_window.index % 2 == 0 ? 544 - 288 : 0
  165.     @skill_window.item = @item_window.item
  166.   end
  167. end
  168. #==============================================================================
  169. # ★ MQ0_WindowItemSpec
  170. #------------------------------------------------------------------------------
  171. #  装备技能 属性的显示
  172. #==============================================================================

  173. class MQ0_WindowItemSpec < Window_Base
  174.   #--------------------------------------------------------------------------
  175.   # ☆ オブジェクト初期化
  176.   #     actors   : アクターの配列
  177.   #--------------------------------------------------------------------------
  178.   def initialize(x, y, width, actors)
  179.     super(x, y, width, WLH * 5 + 48)
  180.     @actors = actors
  181.     @item = nil
  182.     self.opacity = 0
  183.     self.active = false
  184.     refresh
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ☆ リフレッシュ
  188.   #--------------------------------------------------------------------------
  189.   def refresh
  190.     self.contents.clear
  191.     if self.active and @item != nil
  192.       draw_system_base
  193.        if @item.is_a?(RPG::Weapon)
  194.         draw_weapon_skill
  195.       else
  196.         self.visible = false
  197.       end
  198.     end
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ☆防具技能的描画
  202.   #--------------------------------------------------------------------------
  203.   def draw_weapon_skill
  204.     cw = contents.width - @actors.size * 24 - 8
  205.     #draw_system_font("WEAPON_SKILL", 8, 8)
  206.     self.contents.draw_text(8, 8, 110, 24, "WEAPON_SKILL")
  207.     self.contents.font.color = normal_color
  208.     skills = MQ0::weapon_skill(@item)
  209.     for i in 0..3
  210.       y = WLH * (i + 1) + 8
  211.       if skills[i] != nil
  212.         for actor in @actors
  213.           x = cw + (@actors.size > 1 ? actor.index * 24 : -8)
  214.           draw_actor_status_character(actor, x + 16, 32)
  215.           if actor.skill_learn?(skills[i])
  216.             #这里表示角色已经学会
  217.             #draw_system_icon("CHECK1", x, y, 24)
  218.             self.contents.draw_text(x, y, 24, 2, "RD")
  219.           elsif actor.weapon_skills.include?(skills[i])
  220.             #这里表示角色装备后学会
  221.             #draw_system_icon("CHECK2", x, y, 24)
  222.             self.contents.draw_text(x, y, 24, 24, "OK")
  223.           end
  224.         end
  225.         draw_item_name(skills[i], 8, y)
  226.       else
  227.         self.contents.draw_text(32, y, cw, WLH, "------------")
  228.       end
  229.     end
  230.     self.visible = (not skills.empty?)
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   # ☆ 技能图用步行图の描画
  234.   #     actor           : 角色
  235.   #     x               : 描画先 X 座標
  236.   #     y               : 描画先 Y 座標
  237.   #     opacity         : 不透明度
  238.   #--------------------------------------------------------------------------
  239.   def draw_actor_status_character(actor, x, y)
  240.     bitmap = Cache.character(actor.character_name)
  241.     cw = bitmap.width / 12
  242.     ch = bitmap.height / 8
  243.     n = actor.character_index
  244.     src_rect = Rect.new((n%4*3+1)*cw + 5, (n/4*4)*ch, 22, 22)
  245.     self.contents.blt(x - cw / 2 + 1, y - ch + 9, bitmap, src_rect)
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ☆ 道具的設定
  249.   #     item : 新变更的道具
  250.   #--------------------------------------------------------------------------
  251.   def item=(item)
  252.     if @item != item
  253.       @item = item
  254.       refresh
  255.     end
  256.   end
  257. end
复制代码
刚刚接触RMVX,谁能帮我解决一下这
    个问题
    :'( :'( :'(

9L94{LRBAW(6]PKQY]FR~85.jpg (11.64 KB, 下载次数: 11)

9L94{LRBAW(6]PKQY]FR~85.jpg
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-11-15 15:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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