赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 1288 |
最后登录 | 2014-1-30 |
在线时间 | 37 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 37 小时
- 注册时间
- 2009-10-4
- 帖子
- 45
|
本帖最后由 zdb123 于 2012-6-16 18:02 编辑
- # ————————————————————————————————————
- # 本脚本来自www.66rpg.com,转载请保留此信息
- # ————————————————————————————————————
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # 防具类追加
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- module RPG
- class Weapon
- def name
- name = @name.split(/,/)[0]
- return name != nil ? name : ''
- end
- def pic_name
- pic_name = @name.split(/,/)[1]
- return pic_name != nil ? pic_name : ""
- end
- end
- class Armor
- def name
- name = @name.split(/,/)[0]
- return name != nil ? name : ''
- end
- def pic_name
- pic_name = @name.split(/,/)[1]
- return pic_name != nil ? pic_name : ""
- end
- def kind
- kind = @name.split(/,/)[2]
- return kind != nil ? kind.to_i : @kind
- end
- end
- end
- #module RPG
- # class Armor
- # def name
- # name = @name.split(/,/)[0]
- # return name != nil ? name : ''
- # end
- # def kind
- # kind = @name.split(/,/)[1]
- # return kind != nil ? kind.to_i : @kind
- # end
- # end
- #end
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Special_Element
- #--------------------------------------------------------------------------
- # ● 特殊な属性を定義する定数
- #--------------------------------------------------------------------------
- TWO_WEAPONS = "二刀流"
- #--------------------------------------------------------------------------
- # ● 特殊な属性をすべて取得
- #--------------------------------------------------------------------------
- def self.special_elements
- # 特殊な属性をすべて列挙
- elements = [
- TWO_WEAPONS
- ]
- return elements
- end
- #--------------------------------------------------------------------------
- # ● 属性名からその属性のIDを得る
- #--------------------------------------------------------------------------
- def self.get_index(name)
- return $data_system.elements.index(name)
- end
-
- #--------------------------------------------------------------------------
- # ● 正規表現にマッチするすべての属性のIDとマッチ情報を得る
- # 戻り値 : 二次元配列 [n][0]にID、[n][1]にマッチ情報(MatchData)
- #--------------------------------------------------------------------------
- def self.get_indices(regexp)
- indices = []
- for i in 1...$data_system.elements.size
- indices.push([i, $~]) if regexp =~ $data_system.elements[i]
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 特殊な属性を取り除く
- # element_set : 取り除く前の属性IDの配列
- # ignore_elements : 取り除きたい属性 ID?名前?正規表現で指定可能
- # 戻り値 : 取り除いた結果の属性IDの配列
- #--------------------------------------------------------------------------
- def self.delete(element_set)
- result = element_set.dup
- for ignore in Special_Element::special_elements
- case ignore
- when Integer
- result.delete(ignore)
- when String
- result.delete(Special_Element::get_index(ignore))
- when Regexp
- for i in result
- result[i] = nil if ignore =~ $data_system.elements[result[i]]
- end
- result.delete(nil)
- end
- end
- return result
- end
- end
-
-
- class Game_Battler
- #--------------------------------------------------------------------------
- # ● 属性修正の計算
- # element_set : 属性
- #--------------------------------------------------------------------------
- def elements_correct(element_set)
- # --- ここから変更部分 ---
- element_set = Special_Element::delete(element_set)
- # --- 変更部分終わり ---
- # 無属性の場合
- if element_set == []
- # 100 を返す
- return 100
- end
- # 与えられた属性の中で最も弱いものを返す
- # ※メソッド element_rate は、このクラスから継承される Game_Actor
- # および Game_Enemy クラスで定義される
- weakest = -100
- for i in element_set
- weakest = [weakest, self.element_rate(i)].max
- end
- return weakest
- end
- end
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # Game_Actor添加新的防具ID,并对相关方法修正
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- class Game_Actor < Game_Battler
- # --- ここから追加部分 ---
- attr_reader :weapon2_id # 二刀流武器 ID
- # --- 追加部分終わり ---
- attr_reader :armor5_id # 项链 ID
- attr_reader :armor6_id # 鞋 ID
- #--------------------------------------------------------------------------
- # ● 设置
- # actor_id : 角色 ID
- #--------------------------------------------------------------------------
- alias old_setup setup
- def setup(actor_id)
- old_setup(actor_id)
- # --- ここから追加部分 ---
- @weapon2_id = 0
- # --- 追加部分終わり ---
- @armor5_id = 0
- @armor6_id = 0
- update_auto_state(nil, $data_armors[@armor5_id])
- update_auto_state(nil, $data_armors[@armor6_id])
- end
- #--------------------------------------------------------------------------
- # ● 取得属性修正值
- # element_id : 属性 ID
- #--------------------------------------------------------------------------
- def element_rate(element_id)
- # 获取对应属性有效度的数值
- table = [0,200,150,100,50,0,-100]
- result = table[$data_classes[@class_id].element_ranks[element_id]]
- # 防具能防御本属性的情况下效果减半
- for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
- armor = $data_armors[i]
- if armor != nil and armor.guard_element_set.include?(element_id)
- result /= 2
- end
- end
- # 状态能防御本属性的情况下效果减半
- for i in @states
- if $data_states[i].guard_element_set.include?(element_id)
- result /= 2
- end
- end
- # 过程结束
- return result
- end
- #--------------------------------------------------------------------------
- # ● 判定防御属性
- # state_id : 属性 ID
- #--------------------------------------------------------------------------
- def state_guard?(state_id)
- for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
- armor = $data_armors[i]
- if armor != nil
- if armor.guard_state_set.include?(state_id)
- return true
- end
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃の属性取得
- #--------------------------------------------------------------------------
- def element_set
- weapon = $data_weapons[@weapon_id]
- # --- ここから変更部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- result = []
- result.concat(weapon.element_set) if weapon != nil
- result.concat(weapon2.element_set) if weapon2 != nil
- return result
- # --- 変更部分終わり ---
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃のステート変化 (+) 取得
- #--------------------------------------------------------------------------
- def plus_state_set
- weapon = $data_weapons[@weapon_id]
- # --- ここから変更部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- result = []
- result.concat(weapon.plus_state_set) if weapon != nil
- result.concat(weapon2.plus_state_set) if weapon2 != nil
- return result
- # --- 変更部分終わり ---
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃のステート変化 (-) 取得
- #--------------------------------------------------------------------------
- def minus_state_set
- weapon = $data_weapons[@weapon_id]
- # --- ここから変更部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- result = []
- result.concat(weapon.minus_state_set) if weapon != nil
- result.concat(weapon2.minus_state_set) if weapon2 != nil
- return result
- # --- 変更部分終わり ---
- end
- # ● 获取基本力量
- #--------------------------------------------------------------------------
- def base_str
- n = $data_actors[@actor_id].parameters[2, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- # --- ここから追加部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- # そのまま加算すると強すぎなので半分にしてみるテスト
- n += weapon2 != nil ? weapon2.str_plus / 2 : 0
- # --- 追加部分終わり ---
- n += weapon != nil ? weapon.str_plus : 0
- n += armor1 != nil ? armor1.str_plus : 0
- n += armor2 != nil ? armor2.str_plus : 0
- n += armor3 != nil ? armor3.str_plus : 0
- n += armor4 != nil ? armor4.str_plus : 0
- n += armor5 != nil ? armor5.str_plus : 0
- n += armor6 != nil ? armor6.str_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 获取基本灵巧
- #--------------------------------------------------------------------------
- def base_dex
- n = $data_actors[@actor_id].parameters[3, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- # --- ここから追加部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- # そのまま加算すると強すぎなので半分にしてみるテスト
- n += weapon2 != nil ? weapon2.dex_plus / 2 : 0
- # --- 追加部分終わり ---
- n += weapon != nil ? weapon.dex_plus : 0
- n += armor1 != nil ? armor1.dex_plus : 0
- n += armor2 != nil ? armor2.dex_plus : 0
- n += armor3 != nil ? armor3.dex_plus : 0
- n += armor4 != nil ? armor4.dex_plus : 0
- n += armor5 != nil ? armor5.dex_plus : 0
- n += armor6 != nil ? armor6.dex_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 获取基本速度
- #--------------------------------------------------------------------------
- def base_agi
- n = $data_actors[@actor_id].parameters[4, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- # --- ここから追加部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- # そのまま加算すると強すぎなので半分にしてみるテスト
- n += weapon2 != nil ? weapon2.agi_plus / 2 : 0
- # --- 追加部分終わり ---
- n += weapon != nil ? weapon.agi_plus : 0
- n += armor1 != nil ? armor1.agi_plus : 0
- n += armor2 != nil ? armor2.agi_plus : 0
- n += armor3 != nil ? armor3.agi_plus : 0
- n += armor4 != nil ? armor4.agi_plus : 0
- n += armor5 != nil ? armor5.agi_plus : 0
- n += armor6 != nil ? armor6.agi_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 获取基本魔力
- #--------------------------------------------------------------------------
- def base_int
- n = $data_actors[@actor_id].parameters[5, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- # --- ここから追加部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- # そのまま加算すると強すぎなので半分にしてみるテスト
- n += weapon2 != nil ? weapon2.int_plus / 2 : 0
- # --- 追加部分終わり ---
- n += weapon != nil ? weapon.int_plus : 0
- n += armor1 != nil ? armor1.int_plus : 0
- n += armor2 != nil ? armor2.int_plus : 0
- n += armor3 != nil ? armor3.int_plus : 0
- n += armor4 != nil ? armor4.int_plus : 0
- n += armor5 != nil ? armor5.int_plus : 0
- n += armor6 != nil ? armor6.int_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 基本攻撃力の取得
- #--------------------------------------------------------------------------
- def base_atk
- weapon = $data_weapons[@weapon_id]
- # --- ここから変更部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- # そのまま加算すると強すぎなので半分にしてみるテスト
- n = weapon2 != nil ? weapon2.atk / 2 : 0
- return weapon != nil ? weapon.atk + n : n
- # --- 変更部分終わり ---
- end
- #--------------------------------------------------------------------------
- # ● 获取基本物理防御
- #--------------------------------------------------------------------------
- def base_pdef
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- pdef1 = weapon != nil ? weapon.pdef : 0
- pdef2 = armor1 != nil ? armor1.pdef : 0
- pdef3 = armor2 != nil ? armor2.pdef : 0
- pdef4 = armor3 != nil ? armor3.pdef : 0
- pdef5 = armor4 != nil ? armor4.pdef : 0
- pdef6 = armor5 != nil ? armor5.pdef : 0
- pdef7 = armor6 != nil ? armor6.pdef : 0
- # --- ここから追加部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- # そのまま加算すると強すぎなので半分にしてみるテスト
- pdef1 += weapon2 != nil ? weapon2.pdef / 2 : 0
- # --- 追加部分終わり ---
- return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6 + pdef7
- end
- #--------------------------------------------------------------------------
- # ● 获取基本魔法防御
- #--------------------------------------------------------------------------
- def base_mdef
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- mdef1 = weapon != nil ? weapon.mdef : 0
- mdef2 = armor1 != nil ? armor1.mdef : 0
- mdef3 = armor2 != nil ? armor2.mdef : 0
- mdef4 = armor3 != nil ? armor3.mdef : 0
- mdef5 = armor4 != nil ? armor4.mdef : 0
- mdef6 = armor5 != nil ? armor5.mdef : 0
- mdef7 = armor6 != nil ? armor6.mdef : 0
- # --- ここから追加部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- # そのまま加算すると強すぎなので半分にしてみるテスト
- mdef1 += weapon2 != nil ? weapon2.mdef / 2 : 0
- # --- 追加部分終わり ---
- return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6 + mdef7
- end
- #--------------------------------------------------------------------------
- # ● 获取基本回避修正
- #--------------------------------------------------------------------------
- def base_eva
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- eva1 = armor1 != nil ? armor1.eva : 0
- eva2 = armor2 != nil ? armor2.eva : 0
- eva3 = armor3 != nil ? armor3.eva : 0
- eva4 = armor4 != nil ? armor4.eva : 0
- eva5 = armor5 != nil ? armor5.eva : 0
- eva6 = armor6 != nil ? armor6.eva : 0
- return eva1 + eva2 + eva3 + eva4 + eva5 + eva6
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃 攻撃側アニメーション ID の取得
- #--------------------------------------------------------------------------
- # def animation1_id
- # weapon = $data_weapons[@weapon_id]
- # # --- ここから変更部分 ---
- # weapon2 = $data_weapons[@weapon2_id]
- # animations = []
- # animations.push(weapon.animation1_id) if weapon != nil
- # animations.push(weapon2.animation1_id) if weapon2 != nil
- # animations.delete(0)
- # return animations.empty? ? 0 : animations
- # # --- 変更部分終わり ---
- # end
- def animation1_id
- if can_two_weapons?#@active_battler.state_ranks[17] == 1
- weapon = $data_weapons[@weapon_id]
- # --- ここから変更部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- animations = []
- animations.push(weapon.animation1_id) if weapon != nil
- animations.push(weapon2.animation1_id) if weapon2 != nil
- animations.delete(0)
- return animations.empty? ? 0 : animations
- # --- 変更部分終わり ---
- else
- weapon = $data_weapons[@weapon_id]
- return weapon != nil ? weapon.animation1_id : 0
- end
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃 対象側アニメーション ID の取得
- #--------------------------------------------------------------------------
- # def animation2_id
- # weapon = $data_weapons[@weapon_id]
- # # --- ここから変更部分 ---
- # weapon2 = $data_weapons[@weapon2_id]
- # animations = []
- # animations.push(weapon.animation2_id) if weapon != nil
- # animations.push(weapon2.animation2_id) if weapon2 != nil
- # animations.delete(0)
- # return animations.empty? ? 0 : animations
- # # --- 変更部分終わり ---
- # end
- def animation2_id
- if can_two_weapons?#@active_battler.state_ranks[17] == 1
- weapon = $data_weapons[@weapon_id]
- # --- ここから変更部分 ---
- weapon2 = $data_weapons[@weapon2_id]
- animations = []
- animations.push(weapon.animation2_id) if weapon != nil
- animations.push(weapon2.animation2_id) if weapon2 != nil
- animations.delete(0)
- return animations.empty? ? 0 : animations
- # --- 変更部分終わり ---
- else
- weapon = $data_weapons[@weapon_id]
- return weapon != nil ? weapon.animation2_id : 4
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新自动状态
- # old_armor : 卸下防具
- # new_armor : 装备防具
- #--------------------------------------------------------------------------
- def update_auto_state(old_armor, new_armor)
- # 强制解除卸下防具的自动状态
- if old_armor != nil and old_armor.auto_state_id != 0
- remove_state(old_armor.auto_state_id, true)
- end
- # 强制附加装备防具的自动状态
- if new_armor != nil and new_armor.auto_state_id != 0
- add_state(new_armor.auto_state_id, true)
- end
- end
- #--------------------------------------------------------------------------
- # ● 装备固定判定
- # equip_type : 装备类型
- #--------------------------------------------------------------------------
- def equip_fix?(equip_type)
- case equip_type
- when 0 # 武器
- return $data_actors[@actor_id].weapon_fix
- when 1 # 盾
- return $data_actors[@actor_id].armor1_fix
- when 2 # 头
- return $data_actors[@actor_id].armor2_fix
- when 3 # 身体
- return $data_actors[@actor_id].armor3_fix
- when 4 # 装饰品
- return $data_actors[@actor_id].armor4_fix
-
-
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 变更装备
- # equip_type : 装备类型
- # id : 武器 or 防具 ID (0 为解除装备)
- #--------------------------------------------------------------------------
- def equip(equip_type, id)
- case equip_type
- when 0 # 武器
- if id == 0 or $game_party.weapon_number(id) > 0
- $game_party.gain_weapon(@weapon_id, 1)
- @weapon_id = id
- $game_party.lose_weapon(id, 1)
- # --- ここから追加部分 ---
- # 二刀武器じゃないものを装備した場合、盾の部分の二刀武器を外す
- if id != 0 and !$data_weapons[id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
- $game_party.gain_weapon(@weapon2_id, 1)
- @weapon2_id = 0
- end
- # --- 追加部分終わり ---
- end
- when 1 # 盾
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor1_id], $data_armors[id])
- $game_party.gain_armor(@armor1_id, 1)
- @armor1_id = id
- $game_party.lose_armor(id, 1)
- # --- ここから追加部分 ---
- # 二刀武器を装備していた場合は外す
- if id != 0
- $game_party.gain_weapon(@weapon2_id, 1)
- @weapon2_id = 0
- end
- # --- 追加部分終わり ---
- end
- when 2 # 头
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor2_id], $data_armors[id])
- $game_party.gain_armor(@armor2_id, 1)
- @armor2_id = id
- $game_party.lose_armor(id, 1)
- end
- when 3 # 身体
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor3_id], $data_armors[id])
- $game_party.gain_armor(@armor3_id, 1)
- @armor3_id = id
- $game_party.lose_armor(id, 1)
- end
- when 4 # 项链
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor4_id], $data_armors[id])
- $game_party.gain_armor(@armor4_id, 1)
- @armor4_id = id
- $game_party.lose_armor(id, 1)
- end
- when 5 # 戒指
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor5_id], $data_armors[id])
- $game_party.gain_armor(@armor5_id, 1)
- @armor5_id = id
- $game_party.lose_armor(id, 1)
- end
- when 6 # 其余饰品
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor6_id], $data_armors[id])
- $game_party.gain_armor(@armor6_id, 1)
- @armor6_id = id
- $game_party.lose_armor(id, 1)
- end
- # --- ここから追加部分 ---
- when -1 # 二刀流の盾部分の武器
- if id == 0 or $game_party.weapon_number(id) > 0
- $game_party.gain_weapon(@weapon2_id, 1)
- @weapon2_id = id
- $game_party.lose_weapon(id, 1)
- # 盾を外す
- $game_party.gain_armor(@armor1_id, 1)
- @armor1_id = 0
- # 既に装備している武器が二刀武器じゃない場合は外す
- if id != 0 and @weapon_id != 0 and !$data_weapons[@weapon_id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
- $game_party.gain_weapon(@weapon_id, 1)
- @weapon_id = 0
- end
- end
- # --- 追加部分終わり ---
- end
- end
- #--------------------------------------------------------------------------
- # ● 二刀流可能なアクターかどうか
- #--------------------------------------------------------------------------
- def can_two_weapons?
- return class_element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
- end
- #--------------------------------------------------------------------------
- # ● アクターの所属クラスの属性がAのものを取得
- #--------------------------------------------------------------------------
- def class_element_set
- element_set = []
- for i in 1...$data_classes[@class_id].element_ranks.xsize
- element_set.push(i) if $data_classes[@class_id].element_ranks[i] == 1
- end
- return element_set
- end
- #--------------------------------------------------------------------------
- # ● 可以装备判定
- # item : 物品
- #--------------------------------------------------------------------------
- def equippable?(item)
- # 武器的情况
- if item.is_a?(RPG::Weapon)
- # 包含当前的职业可以装备武器的场合
- if $data_classes[@class_id].weapon_set.include?(item.id)
- return true
- end
- end
- # 防具的情况
- if item.is_a?(RPG::Armor)
- # 不包含当前的职业可以装备武器的场合
- if $data_classes[@class_id].armor_set.include?(item.id)
- return true
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 更改职业 ID
- # class_id : 新的职业 ID
- #--------------------------------------------------------------------------
- def class_id=(class_id)
- if $data_classes[class_id] != nil
- @class_id = class_id
- # 避开无法装备的物品
- unless equippable?($data_weapons[@weapon_id])
- equip(0, 0)
- end
- unless equippable?($data_armors[@armor1_id])
- equip(1, 0)
- end
- unless equippable?($data_armors[@armor2_id])
- equip(2, 0)
- end
- unless equippable?($data_armors[@armor3_id])
- equip(3, 0)
- end
- unless equippable?($data_armors[@armor4_id])
- equip(4, 0)
- end
- unless equippable?($data_armors[@armor5_id])
- equip(5, 0)
- end
- unless equippable?($data_armors[@armor6_id])
- equip(6, 0)
- end
- end
- end
- end
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # Window_Base美化,增加属性增减颜色,及全能力值描绘
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # 游戏中全部窗口的超级类。
- #==============================================================================
- class Window_Base < Window
- ################## 属性增减颜色 ##############################
- def up_color
- return Color.new(255, 0, 0)
- end
- def down_color
- return Color.new(0, 255, 0)
- end
- #--------------------------------------------------------------------------
- # ● 描绘能力值
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- # type : 能力值种类 (0~6)
- #--------------------------------------------------------------------------
- def draw_actor_parameter(actor, x, y, type)
- case type
- when 0
- parameter_name = $data_system.words.atk
- parameter_value = actor.atk
- when 1
- parameter_name = $data_system.words.pdef
- parameter_value = actor.pdef
- when 2
- parameter_name = $data_system.words.mdef
- parameter_value = actor.mdef
- when 3
- parameter_name = $data_system.words.str
- parameter_value = actor.str
- when 4
- parameter_name = $data_system.words.dex
- parameter_value = actor.dex
- when 5
- parameter_name = $data_system.words.agi
- parameter_value = actor.agi
- when 6
- parameter_name = $data_system.words.int
- parameter_value = actor.int
- when 7
- parameter_name = "回避"
- parameter_value = actor.eva
- end
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 120, 32, parameter_name)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
- end
- end
- #==============================================================================
- # ■ Harts_Window_EquipTitle
- #==============================================================================
- class Harts_Window_EquipTitle < Window_Base
- #--------------------------------------------------------------------------
- # ● 初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 120, 32, $data_system.words.equip, 1)
- end
- end
- #==============================================================================
- # ■ Harts_Window_EquipCommand
- #==============================================================================
- class Harts_Window_EquipCommand < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初期化
- #--------------------------------------------------------------------------
- def initialize
- super(160, 0, 480, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- @item_max = 2
- @column_max = 2
- #@commands = ["手动", "自动", "退出"]
- @commands = ["变更装备", "返回"]
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目描画
- # index : 項目番号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- x = index * 240 + 4
- self.contents.draw_text(x, 0, 128, 32, @commands[index], 1)
- end
- end
- #==============================================================================
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # 装备窗口美化,全能力值描绘并追加新的防具装备栏
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #==============================================================================
- # ■ Window_EquipRight
- #------------------------------------------------------------------------------
- # 装备画面、显示角色现在装备的物品的窗口。
- #==============================================================================
- class Window_EquipRight < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(272, 64, 368, 252)
- self.contents = Bitmap.new(width - 32, height - 32)
- @actor = actor
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @data = []
- @data.push($data_weapons[@actor.weapon_id])
- # --- ここから変更部分 ---
- @data.push(@actor.weapon2_id != 0 ? $data_weapons[@actor.weapon2_id] : $data_armors[@actor.armor1_id])
- # --- 変更部分終わり ---
- @data.push($data_armors[@actor.armor2_id])
- @data.push($data_armors[@actor.armor3_id])
- @data.push($data_armors[@actor.armor4_id])
- @data.push($data_armors[@actor.armor5_id])
- @data.push($data_armors[@actor.armor6_id])
- @item_max = @data.size
- self.contents.font.color = system_color
- self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
- self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
- self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
- self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
- self.contents.draw_text(4, 32 * 4, 92, 32, $data_system.words.armor4)
- self.contents.draw_text(4, 32 * 5, 92, 32, "戒指")
- self.contents.draw_text(4, 32 * 6, 92, 32, "饰品")
- draw_item_name(@data[0], 92, 32 * 0)
- draw_item_name(@data[1], 92, 32 * 1)
- draw_item_name(@data[2], 92, 32 * 2)
- draw_item_name(@data[3], 92, 32 * 3)
- draw_item_name(@data[4], 92, 32 * 4)
- draw_item_name(@data[5], 92, 32 * 5)
- draw_item_name(@data[6], 92, 32 * 6)
- end
- end
- # ■ Harts_Window_EquipItem
- #==============================================================================
- class Harts_Window_EquipItem < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初期化
- # actor : 角色
- # equip_type : 装備部位 (0~3)
- #--------------------------------------------------------------------------
- def initialize(actor, equip_type)
- super(272, 314, 368, 102)
- @actor = actor
- @equip_type = equip_type
- @column_max = 1
- refresh
- self.active = false
- self.index = -1
- end
- #--------------------------------------------------------------------------
- # ● 物品取得
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 最強id取得
- #--------------------------------------------------------------------------
- def max_item_id
- if @equip_type == 0
- if @actor.weapon_id == 0
- max = 0
- else
- max = $data_weapons[@actor.weapon_id].atk
- end
- # --- ここから追加部分 ---
- # 二刀流可能なアクターの場合は、盾に二刀武器も表示
- elsif @equip_type == 1 and @actor.can_two_weapons?
- if @actor.weapon2_id == 0
- max = 0
- else
- max = $data_weapons[@actor.weapon2_id].atk
- end
- #weapon_set = $data_classes[@actor.class_id].weapon_set
- #for i in 1...$data_weapons.size
- # if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and $data_weapons[i].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
- # @data.push($data_weapons[i])
- # end
- #end
-
- # --- 追加部分終わり ---
- elsif @equip_type == 1
- if @actor.armor1_id == 0
- max = 0
- else
- max = $data_armors[@actor.armor1_id].pdef
- end
- elsif @equip_type == 2
- if @actor.armor2_id == 0
- max = 0
- else
- max = $data_armors[@actor.armor2_id].pdef
- end
- elsif @equip_type == 3
- if @actor.armor3_id == 0
- max = 0
- else
- max = $data_armors[@actor.armor3_id].pdef
- end
- elsif @equip_type == 4
- if @actor.armor4_id == 0
- max = 0
- else
- max = $data_armors[@actor.armor4_id].pdef
- end
- elsif @equip_type == 5
- if @actor.armor5_id == 0
- max = 0
- else
- max = $data_armors[@actor.armor5_id].pdef
- end
- end
- for i in [email protected]
- if @equip_type <= 1 and @actor.can_two_weapons?
- if max <= $data_weapons[@data[i].id].atk
- max = $data_weapons[@data[i].id].atk
- item_id = @data[i].id
- end
- elsif #@equip_type >= 1
- if max <= $data_armors[@data[i].id].pdef
- max = $data_armors[@data[i].id].pdef
- item_id = @data[i].id
- end
- end
- end
- return item_id
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- # 装備可能的武器追加
- if @equip_type == 0
- weapon_set = $data_classes[@actor.class_id].weapon_set
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
- @data.push($data_weapons[i])
- end
- end
- end
- # --- ここから追加部分 ---
- # 二刀流可能なアクターの場合は、盾に二刀武器も表示
- if @equip_type == 1 and @actor.can_two_weapons?
- weapon_set = $data_classes[@actor.class_id].weapon_set
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and $data_weapons[i].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
- @data.push($data_weapons[i])
- end
- end
- end
- # --- 追加部分終わり ---
- ###########################################################################
- # if Kboard.keyboard($R_Key_G)
- # # 演奏取消 SE
- # $game_system.se_play($data_system.cancel_se)
- # # 切换到菜单画面
- # $scene = Scene_Map.new
- # return
- # end
- ###########################################################################
- # 装備可能的防具追加
- if @equip_type != 0
- armor_set = $data_classes[@actor.class_id].armor_set
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0 and armor_set.include?(i)
- if $data_armors[i].kind == @equip_type-1
- @data.push($data_armors[i])
- end
- end
- end
- end
- # 空白追加
- @data.push(nil)
- # 全項目描画
- @item_max = @data.size
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max-1
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目描画
- # index : 項目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- x = 4
- y = index * 32
- case item
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 帮助更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Harts_Window_EquipLeft
- #==============================================================================
- class Harts_Window_EquipLeft < Window_Base
- #--------------------------------------------------------------------------
- # ● 初期化
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 64, 272, 352)
- self.contents = Bitmap.new(width - 32, height - 32)
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_actor_graphic(@actor, 32, 64)
- draw_actor_name(@actor, 4 + 96, 0)
- draw_actor_level(@actor, 4 + 96, 32)
- draw_actor_parameter(@actor, 4, 100, 0)#80=64
- draw_actor_parameter(@actor, 4, 127, 1)#112=96
- draw_actor_parameter(@actor, 4, 154, 2)#144=128
- draw_actor_parameter(@actor, 4, 181, 7)
- draw_actor_parameter(@actor, 4, 211, 3)
- draw_actor_parameter(@actor, 4, 238, 4)
- draw_actor_parameter(@actor, 4, 265, 5)
- draw_actor_parameter(@actor, 4, 292, 6)
- if @new_atk != nil and @new_atk != @actor.atk
- if @new_atk > @actor.atk
- self.contents.font.color = system_color
- else
- self.contents.font.color = disabled_color
- end
- self.contents.draw_text(160, 100, 40, 32, "→", 1)
- self.contents.draw_text(200, 100, 36, 32, @new_atk.to_s, 2)
- end
- if @new_pdef != nil and @new_pdef != @actor.pdef
- if @new_pdef > @actor.pdef
- self.contents.font.color = system_color
- else
- self.contents.font.color = disabled_color
- end
- self.contents.draw_text(160, 127, 40, 32, "→", 1)
- self.contents.draw_text(200, 127, 36, 32, @new_pdef.to_s, 2)
- end
- if @new_mdef != nil and @new_mdef != @actor.mdef
- if @new_mdef > @actor.mdef
- self.contents.font.color = system_color
- else
- self.contents.font.color = disabled_color
- end
- self.contents.draw_text(160, 154, 40, 32, "→", 1)
- self.contents.draw_text(200, 154, 36, 32, @new_mdef.to_s, 2)
- end
- if @new_eva != nil and @new_eva != @actor.eva
- if @new_eva > @actor.eva
- self.contents.font.color = system_color
- else
- self.contents.font.color = disabled_color
- end
- self.contents.draw_text(160, 181, 40, 32, "→", 1)
- self.contents.draw_text(200, 181, 36, 32, @new_mdef.to_s, 2)
- end
- if @new_str != nil and @new_str != @actor.str
- if @new_str > @actor.str
- self.contents.font.color = system_color
- else
- self.contents.font.color = disabled_color
- end
- self.contents.draw_text(160, 211, 40, 32, "→", 1)
- self.contents.draw_text(200, 211, 36, 32, @new_str.to_s, 2)
- end
- if @new_dex != nil and @new_dex != @actor.dex
- if @new_dex > @actor.dex
- self.contents.font.color = system_color
- else
- self.contents.font.color = disabled_color
- end
- self.contents.draw_text(160, 238, 40, 32, "→", 1)
- self.contents.draw_text(200, 238, 36, 32, @new_dex.to_s, 2)
- end
- if @new_agi != nil and @new_agi != @actor.agi
- if @new_agi > @actor.agi
- self.contents.font.color = system_color
- else
- self.contents.font.color = disabled_color
- end
- self.contents.draw_text(160, 265, 40, 32, "→", 1)
- self.contents.draw_text(200, 265, 36, 32, @new_agi.to_s, 2)
- end
- if @new_int != nil and @new_int != @actor.int
- if @new_int > @actor.int
- self.contents.font.color = system_color
- else
- self.contents.font.color = disabled_color
- end
- self.contents.draw_text(160, 292, 40, 32, "→", 1)
- self.contents.draw_text(200, 292, 36, 32, @new_int.to_s, 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● 装備変更後設定
- # new_atk : 装備変更後攻撃力
- # new_pdef : 装備変更後物理防御
- # new_mdef : 装備変更後魔法防御
- #--------------------------------------------------------------------------
- def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
- 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
- @new_atk = new_atk
- @new_pdef = new_pdef
- @new_mdef = new_mdef
- @new_str = new_str
- @new_dex = new_dex
- @new_agi = new_agi
- @new_int = new_int
- refresh
- end
- end
- end
- #==============================================================================
- # ■ Harts_Scene_Equip
- #==============================================================================
- class Scene_Equip
- include OPACITY_66RPG
- #--------------------------------------------------------------------------
- # ● 初期化
- # actor_index : 角色编号
- # equip_index : 装備编号
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0, equip_index = -1, command_index = 0, equip_active = false, command_active = true)
- @actor_index = actor_index
- @equip_index = equip_index
- @command_index = command_index
- @equip_active = equip_active
- @command_active = command_active
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- create_screen
- @actor = $game_party.actors[@actor_index]
- @title_window = Harts_Window_EquipTitle.new
- @command_window = Harts_Window_EquipCommand.new
- @help_window = Window_Help.new
- @help_window.y = 416
- @left_window = Harts_Window_EquipLeft.new(@actor)
- @right_window = Window_EquipRight.new(@actor)
- @item_window0 = Harts_Window_EquipItem.new(@actor, -1)
- @item_window1 = Harts_Window_EquipItem.new(@actor, 0)
- @item_window2 = Harts_Window_EquipItem.new(@actor, 1)
- @item_window3 = Harts_Window_EquipItem.new(@actor, 2)
- @item_window4 = Harts_Window_EquipItem.new(@actor, 3)
- @item_window5 = Harts_Window_EquipItem.new(@actor, 4)
- @item_window6 = Harts_Window_EquipItem.new(@actor, 5)
- @item_window7 = Harts_Window_EquipItem.new(@actor, 6)
- # 关联帮助窗口
- @right_window.help_window = @help_window
- @item_window0.help_window = @help_window
- @item_window1.help_window = @help_window
- @item_window2.help_window = @help_window
- @item_window3.help_window = @help_window
- @item_window4.help_window = @help_window
- @item_window5.help_window = @help_window
- @item_window6.help_window = @help_window
- @item_window7.help_window = @help_window
- ##############
- @equip_window = Window_Equip.new
- ##############
- # 设置光标位置
- @command_window.index = @command_index
- @right_window.index = @equip_index
- @command_window.active = @command_active
- @right_window.active = @equip_active
- testname = @actor.battler_name+"_h.png"
- if FileTest.exist?("Graphics/battlers/#{testname}")
- sp = Sprite.new
- sp.bitmap=Bitmap.new("Graphics/battlers/#{testname}")
- sp.opacity = 120
- end
- refresh
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话的就中断循环
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @title_window.dispose
- @command_window.dispose
- @help_window.dispose
- @left_window.dispose
- @right_window.dispose
- @item_window0.dispose
- @item_window1.dispose
- @item_window2.dispose
- @item_window3.dispose
- @item_window4.dispose
- @item_window5.dispose
- @item_window6.dispose
- @item_window7.dispose
- ##############
- @equip_window.dispose
- ##############
- dispose_screen
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @item_window0.visible = (@right_window.index == -1)
- @item_window1.visible = (@right_window.index == 0)
- @item_window2.visible = (@right_window.index == 1)
- @item_window3.visible = (@right_window.index == 2)
- @item_window4.visible = (@right_window.index == 3)
- @item_window5.visible = (@right_window.index == 4)
- @item_window6.visible = (@right_window.index == 5)
- @item_window7.visible = (@right_window.index == 6)
- # 获取当前装备中的物品
- item1 = @right_window.item
- ##############
- @equip_window.set_item(item1)
- ##############
- # 设置当前的物品窗口到 @item_window
- case @right_window.index
- when -1
- @item_window = @item_window0
- when 0
- @item_window = @item_window1
- when 1
- @item_window = @item_window2
- when 2
- @item_window = @item_window3
- when 3
- @item_window = @item_window4
- when 4
- @item_window = @item_window5
- when 5
- @item_window = @item_window6
- when 6
- @item_window = @item_window7
- end
- # 右窗口被激活的情况下
- if @right_window.active
- # 删除变更装备后的能力
- ###############################################################
- @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
- end
- # 物品窗口被激活的情况下
- if @item_window.active
- # 获取现在选中的物品
- item2 = @item_window.item
- # 变更装备
- last_hp = @actor.hp
- last_sp = @actor.sp
- # --- ここから変更部分 ---
- # 現在の装備を保存(装備の種類を増やしている場合はここを変更)
- equipments = [@actor.weapon2_id, @actor.weapon_id, @actor.armor1_id, @actor.armor2_id, @actor.armor3_id, @actor.armor4_id]
- @actor.equip(equip_type(@right_window.index, item2), item2 == nil ? 0 : item2.id)
- # --- 変更部分終わり ---
- # 装備変更後のパラメータを取得
- ###############################################################
- # 获取变更装备后的能力值
- new_atk = @actor.atk
- new_pdef = @actor.pdef
- new_mdef = @actor.mdef
- new_eva = @actor.eva
- new_str = @actor.str
- new_dex = @actor.dex
- new_agi = @actor.agi
- new_int = @actor.int
- # --- ここから変更部分 ---
- # 装備を戻す
- for i in 0...equipments.size
- @actor.equip(i - 1, equipments[i])
- end
- # --- 変更部分終わり ---
- # 返回到装备
- @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
- @actor.hp = last_hp
- @actor.sp = last_sp
- # 描画左窗口
- ###############################################################
- @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
- ###############################################################
- ##################
- @equip_window.set_item(item2)
- ##################
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- @title_window.update
- @command_window.update
- @left_window.update
- @right_window.update
- @item_window.update
- ##############
- @equip_window.refresh
- ##############
- refresh
- if @command_window.active
- update_command
- return
- end
- if @right_window.active
- update_right
- return
- end
- # 物品窗口被激活的情况下: 调用 update_item
- if @item_window.active
- update_item
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update_command
- # 按下B的场合
- if Input.trigger?(Input::B)
- # 音效演奏
- $game_system.se_play($data_system.cancel_se)
- # 画面切换
- $scene = Scene_Menu.new(2)
- return
- end
- # 按下C的场合
- if Input.trigger?(Input::C)
- case @command_window.index
- # 装備的場合
- when 0
- # 音效演奏
- $game_system.se_play($data_system.decision_se)
- @right_window.active = true
- @command_window.active = false
- @right_window.index = 0
- @command_window.index = -1
- return
- # 最強装備的場合
- =begin
- when 1
-
- # 音效演奏
- $game_system.se_play($data_system.equip_se)
- if @actor.can_two_weapons?
- # 最強装備的取得
- max_weapon_id = @item_window1.max_item_id
- max_weapon2_id = @item_window2.max_item_id
- max_armor2_id = @item_window3.max_item_id
- max_armor3_id = @item_window4.max_item_id
- max_armor4_id = @item_window5.max_item_id
- max_armor5_id = @item_window6.max_item_id
- max_armor6_id = @item_window7.max_item_id
- # 最強装備执行
- @actor.equip(0, max_weapon_id)
- @actor.equip(1, max_weapon2_id)
- @actor.equip(2, max_armor2_id)
- @actor.equip(3, max_armor3_id)
- @actor.equip(4, max_armor4_id)
- @actor.equip(5, max_armor5_id)
- @actor.equip(6, max_armor6_id)
- elsif # 最強装備的取得
- max_weapon_id = @item_window1.max_item_id
- max_armor1_id = @item_window2.max_item_id
- max_armor2_id = @item_window3.max_item_id
- max_armor3_id = @item_window4.max_item_id
- max_armor4_id = @item_window5.max_item_id
- max_armor5_id = @item_window6.max_item_id
- max_armor6_id = @item_window7.max_item_id
- # 最強装備执行
- @actor.equip(0, max_weapon_id)
- @actor.equip(1, max_armor1_id)
- @actor.equip(2, max_armor2_id)
- @actor.equip(3, max_armor3_id)
- @actor.equip(4, max_armor4_id)
- @actor.equip(5, max_armor5_id)
- @actor.equip(6, max_armor6_id)
- end
- @right_window.refresh
- @left_window.refresh
- @item_window1.refresh
- @item_window2.refresh
- @item_window3.refresh
- @item_window4.refresh
- @item_window5.refresh
- @item_window6.refresh
- return
- =end
- when 1
- # 音效演奏
- $game_system.se_play($data_system.cancel_se)
- # 画面切换
- $scene = Scene_Menu.new(2)
- return
- end
- end
- # 按下R的场合
- if Input.trigger?(Input::R)
- # 音效演奏
- $game_system.se_play($data_system.cursor_se)
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # 画面切换
- $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index)
- return
- end
- # 按下L的场合
- if Input.trigger?(Input::L)
- # 音效演奏
- $game_system.se_play($data_system.cursor_se)
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # 画面切换
- $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index)
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新右边窗口
- #--------------------------------------------------------------------------
- def update_right
- # 按下B的场合
- if Input.trigger?(Input::B)
- # 音效演奏
- $game_system.se_play($data_system.cancel_se)
- @right_window.active = false
- @command_window.active = true
- @right_window.index = -1
- @command_window.index = 0
- return
- end
- # 按下C的场合
- if Input.trigger?(Input::C)
- # 装備固定时
- if @actor.equip_fix?(@right_window.index)
- # 音效演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 音效演奏
- $game_system.se_play($data_system.decision_se)
- @right_window.active = false
- @item_window.active = true
- @item_window.index = 0
- return
- end
- # 按下R的场合
- if Input.trigger?(Input::R)
- # 音效演奏
- $game_system.se_play($data_system.cursor_se)
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # 画面切换
- $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index, true, false)
- return
- end
- # 按下L的场合
- if Input.trigger?(Input::L)
- # 音效演奏
- $game_system.se_play($data_system.cursor_se)
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # 画面切换
- $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index, true, false)
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新物品
- #--------------------------------------------------------------------------
- def update_item
- # 按下B的场合
- if Input.trigger?(Input::B)
- # 音效演奏
- $game_system.se_play($data_system.cancel_se)
- @right_window.active = true
- @item_window.active = false
- @item_window.index = -1
- return
- end
- # 按下C的场合
- if Input.trigger?(Input::C)
- # 音效演奏
- $game_system.se_play($data_system.equip_se)
- # アイテムウィンドウで現在選択されているデータを取得
- item = @item_window.item
- # --- ここから変更部分 ---
- # 装備を変更
- # @actor.equip(@right_window.index, item == nil ? 0 : item.id)
- @actor.equip(equip_type(@right_window.index, item), item == nil ? 0 : item.id)
- @actor.equip(@right_window.index, item == nil ? 0 : item.id)
- # --- 変更部分終わり ---
- # ライトウィンドウをアクティブ化
- @right_window.active = true
- @item_window.active = false
- @item_window.index = -1
- # 刷新
- @right_window.refresh
- # --- ここから変更部分 ---
- # めんどくさいのですべてのウィンドウをリフレッシュ
- @item_window1.refresh
- @item_window2.refresh
- @item_window3.refresh
- @item_window4.refresh
- @item_window5.refresh
- @item_window6.refresh
- @item_window7.refresh
- # --- 変更部分終わり ---
- return
- end
-
- end
-
- # --- ここから追加部分 ---
- #--------------------------------------------------------------------------
- # ● 二刀流用の装備部位取得
- #--------------------------------------------------------------------------
- def equip_type(index, item)
- return index * (item.is_a?(RPG::Armor) ? 1 : -1)
- end
- # --- 追加部分終わり ---
- end
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # 状态窗口美化,全防具装备栏描绘
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #==============================================================================
- #---------------------------------------------------
- # 本脚本来自66RPG.com,作者Deathless
- #---------------------------------------------------
- #-----------------------------------------------------
- # 功能设定
- # 当=1和=2,会改变图形的大小
- # =1的时候,图形为每个人自身的能力分配,最大数就是顶点
- # =2的时候,图形为所有人的能力分配,顶点为999
- #
- # 如果不需要999这么大,本脚本中搜索
- # "c[i] = get_position(a[0][0], a[0][1], a[i+1][0], a[i+1][1], b[i] / 999.0)"
- # 把这个999修改了即可。
- #-----------------------------------------------------
- ST_DRAW_SIX_LINES_TYPE = 1
- class Bitmap
- #--------------------------------------------------------------------------
- # ● 描绘直线
- # x1,y1,x2,y2: 直线两端的坐标
- # width: 宽度
- # color: 颜色
- #--------------------------------------------------------------------------
- def drawline(x1, y1, x2, y2, width, color)
- x1 = x1.to_f
- y1 = y1.to_f
- x2 = x2.to_f
- y2 = y2.to_f
- width = width.to_f
- k = (y2 - y1) / (x2 - x1)
- if k.abs > 1
- drawline_x(x1, y1, x2, y2, width, color)
- else
- drawline_y(x1, y1, x2, y2, width, color)
- end
- end
- def drawline_x(x1, y1, x2, y2, width, color)
- l = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 * width / (y1 - y2)
- length = l.abs * 2
- k = (x2 - x1) / (y2 - y1) #x=ky+b
- b = x1 - k * y1
- if l > 0
- for ty in y2.to_i..y1.to_i
- tx = ty * k + b
- fill_rect(tx - l, ty, length, 1, color)
- end
- else
- for ty in y1.to_i..y2.to_i
- tx = ty * k + b
- fill_rect(tx + l, ty, length, 1, color)
- end
- end
- end
- def drawline_y(x1, y1, x2, y2, width, color)
- l = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 * width / (x1 - x2)
- height = l.abs * 2
- k = (y2 - y1) / (x2 - x1) #y=kx+b
- b = y1 - k * x1
- if l > 0
- for tx in x2.to_i..x1.to_i
- ty = tx * k + b
- fill_rect(tx, ty - l, 1, height, color)
- end
- else
- for tx in x1.to_i..x2.to_i
- ty = tx * k + b
- fill_rect(tx, ty + l, 1, height, color)
- end
- end
- end
- end
- # ■ Window_Status
- #------------------------------------------------------------------------------
- # 显示状态画面、完全规格的状态窗口。
- #==============================================================================
- class Window_Status < Window_Base
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def get_position(x_begin, y_begin, x_end, y_end, percent)
- a = []
- a[0] = x_begin + (x_end - x_begin) * percent
- a[1] = y_begin + (y_end - y_begin) * percent
- return a
- end
- def refresh
- self.contents.clear
- x0 = 60 #图表的坐标
- y0 = 220
- r = 100.0 #图表的大小,友情提示:浮点数后面的.0不要省略了
- h = 3 ** 0.5 * r / 2
- a = [] #六边形的顶点和圆心
- a[0] = [r, h] #圆心
- a[1] = [r / 2, 0.0]
- a[2] = [r * 3 / 2, 0.0]
- a[6] = [0.0, h]
- a[3] = [r * 2, h]
- a[5] = [r / 2, h * 2]
- a[4] = [r * 3 / 2, h * 2]
- for i in a
- i[0] += x0
- i[1] += y0
- end
- self.contents.font.color = Color.new(128, 255, 255, 255)
- self.contents.draw_text(a[1][0] - 16 , a[1][1] - 32, 80, 32, "攻击")
- self.contents.draw_text(a[2][0] - 4, a[2][1] - 32, 80, 32, "防御")
- self.contents.draw_text(a[6][0] - 28, a[6][1] - 16, 80, 32, "力量")
- self.contents.draw_text(a[5][0] - 16, a[5][1], 80, 32, "敏捷")
- self.contents.draw_text(a[4][0] - 4, a[4][1], 80, 32, "速度")
- self.contents.draw_text(a[3][0] + 8, a[3][1] - 16, 80, 32, "魔力")
- #描绘边框
- for i in 1...a.size
- self.contents.drawline(a[0][0], a[0][1], a[i][0], a[i][1], 1, disabled_color)
- end
- self.contents.drawline(a[1][0], a[1][1], a[2][0], a[2][1], 1, text_color(6))
- self.contents.drawline(a[2][0], a[2][1], a[3][0], a[3][1], 1, text_color(6))
- self.contents.drawline(a[3][0], a[3][1], a[4][0], a[4][1], 1, text_color(6))
- self.contents.drawline(a[4][0], a[4][1], a[5][0], a[5][1], 1, text_color(6))
- self.contents.drawline(a[5][0], a[5][1], a[6][0], a[6][1], 1, text_color(6))
- self.contents.drawline(a[6][0], a[6][1], a[1][0], a[1][1], 1, text_color(6))
- #描绘能力曲线
- b = [] #获取能力值
- b.push(@actor.atk)
- b.push(@actor.pdef)
- b.push(@actor.int)
- b.push(@actor.agi)
- b.push(@actor.dex)
- b.push(@actor.str)
- case ST_DRAW_SIX_LINES_TYPE
- when 2
- #跟999作比较
- c = []
- for i in 0...b.size
- c[i] = get_position(a[0][0], a[0][1], a[i+1][0], a[i+1][1], b[i] / 999.0)
- end
- for i in 0...c.size
- self.contents.drawline(c[i][0], c[i][1], c[i-1][0], c[i-1][1], 1, text_color(3))
- end
- when 1
- #跟最高能力值比较
- max_abi = 0
- b.each{|i| max_abi = [max_abi, i].max}
- max_abi = max_abi.to_f
- c = [] #获得能力值的坐标
- for i in 0...b.size
- c[i] = get_position(a[0][0], a[0][1], a[i+1][0], a[i+1][1], b[i] / max_abi)
- end
- for i in 0...c.size
- self.contents.drawline(c[i][0], c[i][1], c[i-1][0], c[i-1][1], 1, text_color(3))
- end
- end
- #描绘能力数值
- self.contents.font.color = knockout_color
- self.contents.font.size = 14
- for i in 0...b.size
- self.contents.draw_text(c[i][0], c[i][1], 32, 24, b[i].to_s)
- end
- self.contents.font.size = 22
- #以下未修改
- draw_actor_graphic(@actor, 40, 112)
- draw_actor_name(@actor, 4, 0)
- draw_actor_class(@actor, 4 + 144, 0)
- draw_actor_level(@actor, 96, 32)
- draw_actor_state(@actor, 96, 64)
- draw_actor_hp(@actor, 96, 112, 172)
- draw_actor_sp(@actor, 96, 144, 172)
- draw_actor_parameter(@actor, 96, 192, 0)
- draw_actor_parameter(@actor, 96, 224, 1)
- draw_actor_parameter(@actor, 96, 256, 2)
- draw_actor_parameter(@actor, 96, 304, 3)
- draw_actor_parameter(@actor, 96, 336, 4)
- draw_actor_parameter(@actor, 96, 368, 5)
- draw_actor_parameter(@actor, 96, 400, 6)
- self.contents.font.color = system_color
- self.contents.draw_text(320, 48, 80, 32, "EXP")
- self.contents.draw_text(320, 80, 80, 32, "NEXT")
- self.contents.font.color = normal_color
- self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
- self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(320, 160, 96, 32, "装备")
- draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
- draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 240)
- draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 272)
- draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 304)
- draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 336)
- draw_item_name($data_armors[@actor.armor5_id], 320 + 16, 368)
- draw_item_name($data_armors[@actor.armor6_id], 320 + 16, 400)
- end
- def dummy
- self.contents.font.color = system_color
- self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
- self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
- self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
- self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
- self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
- draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
- draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
- draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
- draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
- draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
- end
- end
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # 商店购买窗口美化,增加对新装备位置的描述
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #==============================================================================
- # ■ Window_ShopStatus
- #------------------------------------------------------------------------------
- # 商店画面、显示物品所持数与角色装备的窗口。
- #==============================================================================
- class Window_ShopStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if @item == nil
- return
- end
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 200, 32, "所持数")
- self.contents.font.color = normal_color
- self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
- if @item.is_a?(RPG::Item)
- return
- end
- # 添加装备品信息
- for i in 0...$game_party.actors.size
- # 获取角色
- actor = $game_party.actors[i]
- # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
- if actor.equippable?(@item)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- # 描绘角色名字
- self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
- # 获取当前的装备品
- if @item.is_a?(RPG::Weapon)
- item1 = $data_weapons[actor.weapon_id]
- elsif @item.kind == 0
- item1 = $data_armors[actor.armor1_id]
- elsif @item.kind == 1
- item1 = $data_armors[actor.armor2_id]
- elsif @item.kind == 2
- item1 = $data_armors[actor.armor3_id]
- elsif @item.kind == 3
- item1 = $data_armors[actor.armor4_id]
- elsif @item.kind == 4
- item1 = $data_armors[actor.armor5_id]
- else# if @item.kind == 5
- item1 = $data_armors[actor.armor6_id]
- end
- # 可以装备的情况
- if actor.equippable?(@item)
- # 武器的情况
- if @item.is_a?(RPG::Weapon)
- atk1 = item1 != nil ? item1.atk : 0
- atk2 = @item != nil ? @item.atk : 0
- change = atk2 - atk1
- end
- # 防具的情况
- if @item.is_a?(RPG::Armor)
- pdef1 = item1 != nil ? item1.pdef : 0
- mdef1 = item1 != nil ? item1.mdef : 0
- pdef2 = @item != nil ? @item.pdef : 0
- mdef2 = @item != nil ? @item.mdef : 0
- change = pdef2 - pdef1 + mdef2 - mdef1
- end
- # 描绘能力值变化
- self.contents.draw_text(124, 64 + 64 * i, 112, 32,
- sprintf("%+d", change), 2)
- end
- # 描绘物品
- if item1 != nil
- x = 4
- y = 64 + 64 * i + 32
- bitmap = RPG::Cache.icon(item1.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item1.name)
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_Equip
- #------------------------------------------------------------------------------
- # 装备物品大图标显示。
- #==============================================================================
- class Window_Equip < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(500, 64, 640, 480)
- @item = nil
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if @item != nil
- bitmap = RPG::Cache.picture(@item.pic_name)
- pic_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(0, 0, bitmap, pic_rect)
- end
- end
- def set_item(item)
- @item = item
- end
- end
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● 基本アクション 結果作成
- #--------------------------------------------------------------------------
- def dong_make_basic_action_result
- # 攻撃の場合
- if @active_battler.current_action.basic == 0
- # --- ここから変更部分 ---
- # アニメーション ID を設定
- @animation1_id = @active_battler.animation1_id.is_a?(Array) ? @active_battler.animation1_id.dup : @active_battler.animation1_id
- @animation2_id = @active_battler.animation2_id.is_a?(Array) ? @active_battler.animation2_id.dup : @active_battler.animation2_id
- # --- 変更部分終わり ---
- # 行動側バトラーがエネミーの場合
- if @active_battler.is_a?(Game_Enemy)
- if @active_battler.restriction == 3
- target = $game_troop.random_target_enemy
- elsif @active_battler.restriction == 2
- target = $game_party.random_target_actor
- else
- index = @active_battler.current_action.target_index
- target = $game_party.smooth_target_actor(index)
- end
- end
- # 行動側バトラーがアクターの場合
- if @active_battler.is_a?(Game_Actor)
- if @active_battler.restriction == 3
- target = $game_party.random_target_actor
- elsif @active_battler.restriction == 2
- target = $game_troop.random_target_enemy
- else
- index = @active_battler.current_action.target_index
- target = $game_troop.smooth_target_enemy(index)
- end
- end
- # 対象側バトラーの配列を設定
- @target_battlers = [target]
- # 通常攻撃の効果を適用
- for target in @target_battlers
- target.attack_effect(@active_battler)
- end
- return
- end
- # 防御の場合
- if @active_battler.current_action.basic == 1
- # ヘルプウィンドウに "防御" を表示
- @help_window.set_text($data_system.words.guard, 1)
- return
- end
- # 逃げるの場合
- if @active_battler.is_a?(Game_Enemy) and
- @active_battler.current_action.basic == 2
- # ヘルプウィンドウに "逃げる" を表示
- @help_window.set_text("逃げる", 1)
- # 逃げる
- @active_battler.escape
- return
- end
- # 何もしないの場合
- if @active_battler.current_action.basic == 3
- # アクション強制対象のバトラーをクリア
- $game_temp.forcing_battler = nil
- # ステップ 1 に移行
- @phase4_step = 1
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
- #--------------------------------------------------------------------------
- def dong_update_phase4_step3
- # --- ここから変更部分 ---
- # アニメーションの配列の先頭を取り出す
- if @animation1_id.is_a?(Integer)
- @animation1_id = [@animation1_id]
- end
- animation = @animation1_id.shift
- # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
- if animation == 0
- @active_battler.white_flash = true
- else
- @active_battler.animation_id = animation
- @active_battler.animation_hit = true
- end
- # アニメーションがなくなったらステップ 4 に移行
- @phase4_step = 4 if @animation1_id.empty?
- # --- 変更部分終わり ---
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
- #--------------------------------------------------------------------------
- def dong_update_phase4_step4
- # --- ここから変更部分 ---
- # アニメーションの配列の先頭を取り出す
- if @animation2_id.is_a?(Integer)
- @animation2_id = [@animation2_id]
- end
- animation = @animation2_id.shift
- # 対象側アニメーション
- for target in @target_battlers
- target.animation_id = animation
- target.animation_hit = (target.damage != "Miss")
- end
- # アニメーションの長さにかかわらず、最低 8 フレーム待つ
- @wait_count = 8
- # アニメーションがなくなったらステップ 5 に移行
- @phase4_step = 5 if @animation2_id.empty?
- # --- 変更部分終わり ---
- end
- end
-
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 rt 我想用六围描绘的脚本 但和原本的图像重叠了 我想知道如何去除状态栏里的基本数值?
|
|