赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 0 |
经验 | 0 |
最后登录 | 2012-1-27 |
在线时间 | 20 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 370
- 在线时间
- 20 小时
- 注册时间
- 2011-11-30
- 帖子
- 1
|
防具的- #==============================================================================
- # ★ LY0_Costants
- #------------------------------------------------------------------------------
- # 独自的定数的定义
- #==============================================================================
- #------------------------------------------------------------------------------
- # ◆ 基本設定
- #------------------------------------------------------------------------------
- # 装备技能(识別用文字列 + [技能 ID|技能 ID|...]) ※ 最大数 4
- LY0_ARMOR_SKILL_SIGNATURE = "*ARMORSKILL"
- #==============================================================================
- # ★ LY0_Module
- #------------------------------------------------------------------------------
- # 独自的机能添加
- #==============================================================================
- module LY0
- #--------------------------------------------------------------------------
- # ☆ 属性道具取得
- # id : 属性 ID
- #--------------------------------------------------------------------------
- def self.element_icon(id)
- return LY0_ELEMENT_ICON[id - 1]
- end
- #--------------------------------------------------------------------------
- # ☆ 防具技能的附加
- # item : 防具号
- #--------------------------------------------------------------------------
- def self.armor_skill(item)
- result = []
- if item.is_a?(RPG::Armor)
- sig = LY0_ARMOR_SKILL_SIGNATURE
- reg = /#{Regexp.quote sig}\[((\d+\|?)+)\]/
- if item.note.scan(reg).to_a[0]
- r = $~[0].gsub(/#{Regexp.quote sig}\[/, "").gsub(/\]/, "")
- for s in r.split(/\s*\|\s*/)
- skill = $data_skills[s.to_i]
- result.push(skill) if skill.is_a?(RPG::Skill)
- end
- end
- end
- return result
- end
- end
- class Game_Actor
- alias _ly0sys_skill_can_use? skill_can_use?
- #--------------------------------------------------------------------------
- # ☆ 技能配列取得
- #--------------------------------------------------------------------------
- def armor_skills
- result = []
- for armor in self.armors
- for skill in LY0::armor_skill(armor)
- result.push(skill)
- end
- end
- return result
- end
- #--------------------------------------------------------------------------
- # ○ 技能使用可能判定 (再定義)
- # skill : 技能
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- # 防具
- for a_skill in armor_skills
- return super if a_skill.id == skill.id
- end
- return _ly0sys_skill_can_use?(skill)
- end
- end
- #==============================================================================
- # ★ LY0_Window
- #------------------------------------------------------------------------------
- #==============================================================================
- class Window_Base
- #--------------------------------------------------------------------------
- # ☆ システムメッセージの下地を描画
- #--------------------------------------------------------------------------
- def draw_system_base
- self.opacity = 0
- rect = Rect.new(0, 0, contents.width, self.contents.height)
- self.contents.fill_rect(rect, system_color)
- rect = Rect.new(2, 2, contents.width - 4, self.contents.height - 4)
- color = Color.new(24, 8, 4)
- self.contents.fill_rect(rect, color)
- end
- end
- #==============================================================================
- # ■ Window_Skill
- #------------------------------------------------------------------------------
- # 特技画面中、显示可以使用的特技浏览的窗口
- #==============================================================================
- class Window_Skill
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- temp = []
- for skill in @actor.skills
- next if $game_temp.in_battle and not skill.battle_ok?
- temp.push(skill)
- end
- # 防具加技能
- for skill in @actor.armor_skills
- next if $game_temp.in_battle and not skill.battle_ok?
- temp.push(skill) unless temp.include?(skill)
- end
- temp.sort! {|a, b| a.id <=> b.id}
- @data = []
- for skill in temp
- @data.push(skill)
- if skill.id == @actor.last_skill_id
- self.index = @data.size - 1
- end
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- class Scene_Equip
- alias _ly0mequip_start start
- alias _ly0mequip_terminate terminate
- alias _ly0mequip_update update
- alias _ly0mequip_update_equip_selection update_equip_selection
- alias _ly0mequip_update_item_windows update_item_windows
- #--------------------------------------------------------------------------
- # ○ 開始処理 (追加定義)
- #--------------------------------------------------------------------------
- def start
- _ly0mequip_start
- @skill_window = LY0_WindowItemSpec.new(0, 248, 288, [@actor])
- @skill_window.y = 416 - @skill_window.height
- @skill_window.active = true
- @skill_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ○ 終了処理 (追加定義)
- #--------------------------------------------------------------------------
- def terminate
- _ly0mequip_terminate
- @skill_window.dispose
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新 (追加定義)
- #--------------------------------------------------------------------------
- def update
- _ly0mequip_update
- @skill_window.update
- end
- #--------------------------------------------------------------------------
- # ○ 装備部位選択の更新 (追加定義)
- #--------------------------------------------------------------------------
- def update_equip_selection
- _ly0mequip_update_equip_selection
- @skill_window.x = 544 - 288
- @skill_window.item = @equip_window.item
- end
- #--------------------------------------------------------------------------
- # ○ アイテムウィンドウの更新 (追加定義)
- #--------------------------------------------------------------------------
- def update_item_windows
- _ly0mequip_update_item_windows
- @skill_window.x = @item_window.index % 2 == 0 ? 544 - 288 : 0
- @skill_window.item = @item_window.item
- end
- end
- #==============================================================================
- # ★ LY0_WindowItemSpec
- #------------------------------------------------------------------------------
- # 装备技能 属性的显示
- #==============================================================================
- class LY0_WindowItemSpec < Window_Base
- #--------------------------------------------------------------------------
- # ☆ オブジェクト初期化
- # actors : アクターの配列
- #--------------------------------------------------------------------------
- def initialize(x, y, width, actors)
- super(x, y, width, WLH * 5 + 48)
- @actors = actors
- @item = nil
- self.opacity = 0
- self.active = false
- refresh
- end
- #--------------------------------------------------------------------------
- # ☆ リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if self.active and @item != nil
- draw_system_base
- if @item.is_a?(RPG::Armor)
- draw_armor_skill
- else
- self.visible = false
- end
- end
- end
- #--------------------------------------------------------------------------
- # ☆防具技能的描画
- #--------------------------------------------------------------------------
- def draw_armor_skill
- cw = contents.width - @actors.size * 24 - 8
- #draw_system_font("ARMOR_SKILL", 8, 8)
- self.contents.draw_text(8, 8, 110, 24, "ARMOR SKILL")
- self.contents.font.color = normal_color
- skills = LY0::armor_skill(@item)
- for i in 0..3
- y = WLH * (i + 1) + 8
- if skills[i] != nil
- for actor in @actors
- x = cw + (@actors.size > 1 ? actor.index * 24 : -8)
- draw_actor_status_character(actor, x + 16, 32)
- if actor.skill_learn?(skills[i])
- #draw_system_icon("CHECK1", x, y, 24)
- self.contents.draw_text(x, y, 24, 2,"RE")
- elsif actor.armor_skills.include?(skills[i])
- #draw_system_icon("CHECK2", x, y, 24)
- self.contents.draw_text(x, y, 24, 24, "ON")
- end
- end
- draw_item_name(skills[i], 8, y)
- else
- self.contents.draw_text(32, y, cw, WLH, "------------")
- end
- end
- self.visible = (not skills.empty?)
- end
- #--------------------------------------------------------------------------
- # ☆ 技能图用步行图の描画
- # actor : 角色
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # opacity : 不透明度
- #--------------------------------------------------------------------------
- def draw_actor_status_character(actor, x, y)
- bitmap = Cache.character(actor.character_name)
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- n = actor.character_index
- src_rect = Rect.new((n%4*3+1)*cw + 5, (n/4*4)*ch, 22, 22)
- self.contents.blt(x - cw / 2 + 1, y - ch + 9, bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # ☆ 道具的設定
- # item : 新变更的道具
- #--------------------------------------------------------------------------
- def item=(item)
- if @item != item
- @item = item
- refresh
- end
- end
- end
复制代码- #==============================================================================
- # ★ MQ0_Costants
- #------------------------------------------------------------------------------
- # 独自的定数的定义
- #==============================================================================
- 武器的
- #------------------------------------------------------------------------------
- # ◆ 基本設定
- #------------------------------------------------------------------------------
- # 装备技能(识別用文字列 + [技能 ID|技能 ID|...]) ※ 最大数 4
- MQ0_WEAPONSKILL_SIGNATURE = "*WEAPONSKILL"
- #==============================================================================
- # ★ MQ0_Module
- #------------------------------------------------------------------------------
- # 独自的机能添加
- #==============================================================================
-
- module MQ0
- #--------------------------------------------------------------------------
- # ☆ 防具技能的附加
- # item : 防具号
- #--------------------------------------------------------------------------
- def self.weapon_skill(item)
- result = []
- if item.is_a?(RPG::Weapon)
- sig = MQ0_WEAPONSKILL_SIGNATURE
- reg = /#{Regexp.quote sig}\[((\d+\|?)+)\]/
- if item.note.scan(reg).to_a[0]
- r = $~[0].gsub(/#{Regexp.quote sig}\[/, "").gsub(/\]/, "")
- for s in r.split(/\s*\|\s*/)
- skill = $data_skills[s.to_i]
- result.push(skill) if skill.is_a?(RPG::Skill)
- end
- end
- end
- return result
- end
-
- end
- class Game_Actor
- alias _mq0sys_skill_can_use? skill_can_use?
- #--------------------------------------------------------------------------
- # ☆ 技能配列取得
- #--------------------------------------------------------------------------
- def weapon_skills
- result = []
- for weapon in self.weapons
- for skill in MQ0::weapon_skill(weapon)
- result.push(skill)
- end
- end
- return result
- end
- #--------------------------------------------------------------------------
- # ○ 技能使用可能判定 (再定義)
- # skill : 技能
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- # ウェポンスキル
- for w_skill in weapon_skills
- return super if w_skill.id == skill.id
- end
- return _mq0sys_skill_can_use?(skill)
- end
- end
- #==============================================================================
- # ★ MQ0_Window
- #------------------------------------------------------------------------------
- #==============================================================================
- class Window_Base
-
- #--------------------------------------------------------------------------
- # ☆ システムメッセージの下地を描画
- #--------------------------------------------------------------------------
- def draw_system_base
- self.opacity = 0
- rect = Rect.new(0, 0, contents.width, self.contents.height)
- self.contents.fill_rect(rect, system_color)
- rect = Rect.new(2, 2, contents.width - 4, self.contents.height - 4)
- color = Color.new(24, 8, 4)
- self.contents.fill_rect(rect, color)
- end
-
-
- end
- #==============================================================================
- # ■ Window_Skill
- #------------------------------------------------------------------------------
- # 特技画面中、显示可以使用的特技浏览的窗口
- #==============================================================================
- class Window_Skill
-
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- temp = []
- for skill in @actor.skills
- next if $game_temp.in_battle and not skill.battle_ok?
- temp.push(skill)
- end
- # ウェポンスキル
- for skill in @actor.weapon_skills
- next if $game_temp.in_battle and not skill.battle_ok?
- temp.push(skill) unless temp.include?(skill)
- end
- temp.sort! {|a, b| a.id <=> b.id}
- @data = []
- for skill in temp
- @data.push(skill)
- if skill.id == @actor.last_skill_id
- self.index = @data.size - 1
- end
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- class Scene_Equip
- alias _mq0mequip_start start
- alias _mq0mequip_terminate terminate
- alias _mq0mequip_update update
- alias _mq0mequip_update_equip_selection update_equip_selection
- alias _mq0mequip_update_item_windows update_item_windows
- #--------------------------------------------------------------------------
- # ○ 開始処理 (追加定義)
- #--------------------------------------------------------------------------
- def start
- _mq0mequip_start
- @skill_window = MQ0_WindowItemSpec.new(0, 248, 288, [@actor])
- @skill_window.y = 416 - @skill_window.height
- @skill_window.active = true
- @skill_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ○ 終了処理 (追加定義)
- #--------------------------------------------------------------------------
- def terminate
- _mq0mequip_terminate
- @skill_window.dispose
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新 (追加定義)
- #--------------------------------------------------------------------------
- def update
- _mq0mequip_update
- @skill_window.update
- end
- #--------------------------------------------------------------------------
- # ○ 装備部位選択の更新 (追加定義)
- #--------------------------------------------------------------------------
- def update_equip_selection
- _mq0mequip_update_equip_selection
- @skill_window.x = 544 - 288
- @skill_window.item = @equip_window.item
- end
- #--------------------------------------------------------------------------
- # ○ アイテムウィンドウの更新 (追加定義)
- #--------------------------------------------------------------------------
- def update_item_windows
- _mq0mequip_update_item_windows
- @skill_window.x = @item_window.index % 2 == 0 ? 544 - 288 : 0
- @skill_window.item = @item_window.item
- end
- end
- #==============================================================================
- # ★ MQ0_WindowItemSpec
- #------------------------------------------------------------------------------
- # 装备技能 属性的显示
- #==============================================================================
- class MQ0_WindowItemSpec < Window_Base
- #--------------------------------------------------------------------------
- # ☆ オブジェクト初期化
- # actors : アクターの配列
- #--------------------------------------------------------------------------
- def initialize(x, y, width, actors)
- super(x, y, width, WLH * 5 + 48)
- @actors = actors
- @item = nil
- self.opacity = 0
- self.active = false
- refresh
- end
- #--------------------------------------------------------------------------
- # ☆ リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if self.active and @item != nil
- draw_system_base
- if @item.is_a?(RPG::Weapon)
- draw_weapon_skill
- else
- self.visible = false
- end
- end
- end
- #--------------------------------------------------------------------------
- # ☆防具技能的描画
- #--------------------------------------------------------------------------
- def draw_weapon_skill
- cw = contents.width - @actors.size * 24 - 8
- #draw_system_font("WEAPON_SKILL", 8, 8)
- self.contents.draw_text(8, 8, 110, 24, "WEAPON_SKILL")
- self.contents.font.color = normal_color
- skills = MQ0::weapon_skill(@item)
- for i in 0..3
- y = WLH * (i + 1) + 8
- if skills[i] != nil
- for actor in @actors
- x = cw + (@actors.size > 1 ? actor.index * 24 : -8)
- draw_actor_status_character(actor, x + 16, 32)
- if actor.skill_learn?(skills[i])
- #这里表示角色已经学会
- #draw_system_icon("CHECK1", x, y, 24)
- self.contents.draw_text(x, y, 24, 2, "RD")
- elsif actor.weapon_skills.include?(skills[i])
- #这里表示角色装备后学会
- #draw_system_icon("CHECK2", x, y, 24)
- self.contents.draw_text(x, y, 24, 24, "OK")
- end
- end
- draw_item_name(skills[i], 8, y)
- else
- self.contents.draw_text(32, y, cw, WLH, "------------")
- end
- end
- self.visible = (not skills.empty?)
- end
- #--------------------------------------------------------------------------
- # ☆ 技能图用步行图の描画
- # actor : 角色
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # opacity : 不透明度
- #--------------------------------------------------------------------------
- def draw_actor_status_character(actor, x, y)
- bitmap = Cache.character(actor.character_name)
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- n = actor.character_index
- src_rect = Rect.new((n%4*3+1)*cw + 5, (n/4*4)*ch, 22, 22)
- self.contents.blt(x - cw / 2 + 1, y - ch + 9, bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # ☆ 道具的設定
- # item : 新变更的道具
- #--------------------------------------------------------------------------
- def item=(item)
- if @item != item
- @item = item
- refresh
- end
- end
- end
复制代码 刚刚接触RMVX,谁能帮我解决一下这 |
|