赞 | 0 |
VIP | 2 |
好人卡 | 2 |
积分 | 1 |
经验 | 36666 |
最后登录 | 2017-9-25 |
在线时间 | 641 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 641 小时
- 注册时间
- 2015-7-29
- 帖子
- 211
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
这个日站挖来的脚本,现在里面很多功能不能用,比如耐久度,装备破坏,武器攻击次数为0时也能继续攻击等,求人修复下,万分感谢
这4个脚本是连起来用的。也没有少复制,全部就是这样子。。日站嘛 联系不到作者 所以拜托天朝的大大们了
#============================================================================== # ☆VXAce RGSS3 「個別装備アイテム:設定」☆ # EnDlEss DREamER # URL:[url]http://mitsu-evo.6.ql.bz/[/url] # 製作者 mitsu-evo # Last:2014/4/22 # 武器防具1個ずつに耐久度や弾数・改造度などを設定する。 # ▼ 装備拡張:武器拡張追加よりも下で「▼ 素材」に近い位置に挿入。 #============================================================================== $ed_rgss3 = {} if $ed_rgss3 == nil $ed_rgss3["ed_weapon_count"] = true =begin ☆☆☆☆☆☆ 機能説明 ☆☆☆☆☆☆ ★ 装備のメモ欄の使い方 <耐久力 1000> 装備の耐久力を設定する。 <改造レベル 10> 装備改造を指定段階まで行える <回数 10> 武器限定で使用回数を設定する 無設定の場合は「装備改造システム」の CUSTOM_LEVEL 設定値まで改造可能 耐久力と武器回数は無制限に設定されます。 ★ アイテムのメモ欄の使い方 ★ <武器回復:武器ID,装備ヶ所,回復数> 指定箇所の武器の回数を回復する。 <修理> 指定キャラの装備全てを修復する。 ● 武器回数システム 武器のメモ欄に <回数 10> 等の記述を入れると設定した数値分だけしか その武器で攻撃できなくなります。 無指定なら回数は指定されません。 二刀流の場合は「両手武器のどちらか」が「ゼロ」に なったら攻撃が出来なくなります。 武器の攻撃回数が0になるとその武器では攻撃出来ません。 でも、その武器が破棄されることもありません。 以下、イベントコマンドを使用して回復ショップ画面や コマンドなどで回復することが可能です。 アイテムのメモ欄に「<武器回復:武器ID,装備ヶ所,回復数>」を記入すると 対象アクターの装備中の武器回数を回復することができます。 回復数に「0」を指定すると全回復として処理されます。 なので「HP回復量」も設定値分指定して下さい。 なお「武器ID」に「-1」を指定すると武器IDに関係なく 装備ヶ所の武器を回復出来ます。 ● 耐久力システム 以前に「装備拡張:武器拡張追加」にあった耐久力システムをこちらに移しました。 メモ欄に「<耐久力 100>」などと入れるとその装備に耐久力が設定されます。 別途素材「装備破壊システム」の最新版を導入すると装備が破壊されるようになります。 道具「ポーション」などのメモ欄に「<修理>」と入力するとそのアイテムを 味方に使用した場合、その味方の装備全ての耐久力が復活します。 RGSS3版の新機能として、スキルとアイテムのメモ欄に修理や回数回復が使用でき 戦闘中のスキル・アイテムによる修理や回復が可能となりました。 他、イベントコマンドで耐久力を回復出来ます。 ● 装備破壊システム 攻撃で装備が破壊されます。 RGSS2版と違い、装備拡張:武器拡張追加導入時はエネミーに設定した 装備を破壊することが出来ます。 RGSS3版の新機能として「装備破壊属性」の設定がある武器・スキル・アイテム などは耐久力へ補正した設定値分のダメージを与えていくことができます。 「破損」「大破」の2種類の状態が存在し、破損装備は「黄色」 大破装備は「赤」で表示されます。 「大破」した装備は「能力がゼロ」になり装備としての能力が無くなります。 修復することで元に戻ります。 イベントコマンドでも修復が可能です。 ● 装備改造システム(スクリプト併用時) 武器・防具のメモ欄に「<改造レベル 10>」など任意の値を入れると その装備は指定の段階まで改造が可能になります。 無指定の場合は装備改造・鍛冶屋システムの設定レベルが上限となります。 この機能により個別に改造レベルの設定が可能となります。 装備改造項目全体に改造レベルが適用されます。 ☆☆☆☆☆☆ イベントコマンド ☆☆☆☆☆☆ 「start_weapon_repair」 武器回復ショップ画面を呼び出して「装備中」の武器を お金を出して回復することが出来る。 「start_armor_repair」 装備回復ショップ画面を呼び出して「装備中」の「装備耐久力」を お金を出して回復することが出来る。 「weapon_repair(actor_id)」 actor_id : アクターのID 指定アクターの武器全部の回数を回復する 「party_weapon_repair_all」 パーティ全員の装備中の武器回数を全回復します。 「durability_repair(actor_id)」 actor_id : アクターのID 指定アクターの全装備耐久力を回復します。 「party_durability_repair_all」 パーティ全員の装備耐久力を全回復します。 =end #☆☆☆☆☆☆☆☆ 「メモ欄」の設定 ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ # メモ欄取得用定数 WEAPON_ATK_COUNT = /<(?:count|回数)\s*(\d+)>/i DURABILITY = /<(?:DURABILITY|耐久力)\s*(\-?\d+)>/i INDIVIDUAL_CUSTOM_LEVEL = /<(?:CUSTOM|改造レベル)\s*(\d+)>/i #☆☆☆☆☆☆☆☆ 「装備破壊」の設定 ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ EQUIP_DAMAGE_SE = "Audio/SE/Thunder7" EQUIP_BREAK_SE = "Audio/SE/Explosion7" # ダメージ除算して耐久力減算に反映 BREAK_DAMAGE_REVISION = 2 # 全てのダメージで破壊処理実施するか? SMOOTH_DAMAGE = false # SMOOTH_DAMAGEがfalseの時、指定%以下のダメージ処理を行わない。 BREAK_DAMAGE_PAR = 10 # 装備破壊属性設定 EQUIP_BREAK_ID = 19 # 装備破壊時の乗算補正(100ダメージ攻撃の3倍の耐久力へのダメージなど) EQUIP_BREAK_REVISION = 3 #☆☆☆☆☆☆☆☆ 「個別武器」の設定 ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ # 武器1の回復単価設定(G) # 「0」以外に設定すると武器の回復単価はこの設定が反映される。 # 二刀流の場合は両手ともこの設定が反映される。 # 武器拡張追加導入時の「拡張武器」には一切反映されません。 WEAPON1_REPAIR_UNIT_PRICE = 0 # 武器回数を1回回復の武器価格に対する単価(%) # 上の設定が「0」の場合は「武器価格の%」を1回の単価として設定します。 # 拡張武器は全てこちらの設定が適用されます。 # 武器価格設定が「0」の場合は武器ステータスから自動算出し、この設定を適用します。 REPAIR_COUNT_PRICE = 5 # 価格「0G」武器の価格算出方法 # 価格ゼロは「(攻撃+防御+精神+敏捷) × ZERO_PRICE_RATE」で # 価格を一時的に算出し REPAIR_COUNT_PRICE による計算を行っている。 ZERO_PRICE_RATE = 100 #☆☆☆☆☆☆☆☆ 「耐久力」の設定 ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ # 耐久力を全快するのに必要な金額(購入価格の設定%) # 「破損」ならこの設定の半額が修復金額となります。 DURABILITY_REPAIR_PRICE = 50 #============================================================================== #============================================================================== # ■ Vocab #------------------------------------------------------------------------------ # 用語とメッセージを定義するモジュールです。定数でメッセージなどを直接定義す # るほか、グローバル変数 $data_system から用語データを取得します。 #============================================================================== module Vocab # 装備破壊時のメッセージ Equip_Break_Text = "%sの %sが %sした!" Equip_Repair_Text = "%sの 装備が修復された!" # メモ欄に表示する攻撃回数の文字表示 DESCRIPTION_ATK_CNT = "回数" # 回復単位 COUNT_UNIT = "回" # 回復するのに使われる言葉「xx[回][回復]するのにxxゴールドかかるが・・・」 REPAIR_UNIT = "回復" # # パーティ全員回復に表示する言葉 FULL_REPAIR_UNIT = "全員満タン" # 個別補給時に表示する文章「\x00 == 改行」 # [武器名]を[回復回数][COUNT_UNIT設定文字][REPAIR_UNIT設定文字]すると # [回復価格][金額単位]かかりますがよろしいですか? # という文章表示になる。 EQUIP_COUNT_TEXT = "%sを%s%s%sすると\x00%s%sかかりますがよろしいですか?" # 満タン補給時に表示する文章 # 全員を回復するのに[回復価格][金額単位] # かかりますがよろしいですか? # という文章表示になる。 EQUIP_FULL_COUNT_TEXT = "全員を%sするのに%s%s\x00かかりますがよろしいですか?" # 回復出来ない時の文章 # これでは[REPAIR_UNIT設定文字]できませんね。 # という文章表示になる。 NOT_EQUIP_REPAIR_TEXT = "これは%sできませんね。" # [REPAIR_UNIT設定文字]済みのようですね。と表示される。 FULL_WEAPON_COUNT = "%s済みのようですね。" NOT_GOLD = "お金が足りないみたいですね。" # 装備の破壊度表示 Equip_State = "状態" # 説明文に表示する「状態:正常」など Equip_Green = "正常" # 破損度が正常の状態 Equip_Damage = "破損" # 破損度が耐久力の半分以下の場合 Equip_Break = "大破" # 破損度がゼロの場合 Equip_Durability = "耐久力" # 装備耐久力の表示文字 end module ED #============================================================================== # ■ Command #------------------------------------------------------------------------------ # イベントコマンド「スクリプト」で呼び出されるコマンドです。 #============================================================================== module Command module_function #-------------------------------------------------------------------------- # ● アクターの武器回復 #-------------------------------------------------------------------------- def weapon_repair(actor_id) $game_actors[actor_id].weapons.compact.each{|item|item.weapon_repair} end #-------------------------------------------------------------------------- # ● パーティの武器全回復 #-------------------------------------------------------------------------- def party_weapon_repair_all for actor in $game_party.members weapon_repair(actor.id) end end #-------------------------------------------------------------------------- # ● アクターの装備耐久力回復 #-------------------------------------------------------------------------- def durability_repair(actor_id) $game_actors[actor_id].equips.compact.each{|item|item.durability_repair} end #-------------------------------------------------------------------------- # ● パーティの全装備耐久力全回復 #-------------------------------------------------------------------------- def party_durability_repair_all for actor in $game_party.members durability_repair(actor.id) end end end end class RPG::BaseItem #-------------------------------------------------------------------------- # ○ 修理のキャッシュを作成(/<武器回復[::](0|-?\d+),(\d+)>/) #-------------------------------------------------------------------------- def create_repair_cache self.note.each_line { |line| if line =~ /<修理>/ @repair = true next if @repair == nil end } @repair ||= false end #-------------------------------------------------------------------------- # ○ 修理可能スキルやアイテムであるか? #-------------------------------------------------------------------------- def repair? create_repair_cache if @repair == nil return @repair end #-------------------------------------------------------------------------- # ○ 武器回数修理のキャッシュを作成 #-------------------------------------------------------------------------- def create_weapon_repair_cache self.note.each_line { |line| if line =~ /<武器回復[::](0|-?\d+),(\d+),(\d+)>/ @weapon_repair = true next if @weapon_repair == nil end } @weapon_repair ||= false end #-------------------------------------------------------------------------- # ○ 修理可能スキルやアイテムであるか? #-------------------------------------------------------------------------- def weapon_repair? create_weapon_repair_cache if @weapon_repair == nil return @weapon_repair end end class RPG::EquipItem < RPG::BaseItem attr_accessor :ed_item_key # 武器格納ハッシュキー attr_accessor :durability # 耐久力設定 attr_accessor :durability_max # 最大耐久力 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias ed_weapon_count_a_initialize initialize unless $@ def initialize ed_weapon_count_a_initialize initialize_add_params @ed_item_key = 0 save_state_value end #-------------------------------------------------------------------------- # ● データベース純正要素数のパラメータ #-------------------------------------------------------------------------- def org_params; params[0, 7]; end #-------------------------------------------------------------------------- # ● 元のパラメータ #-------------------------------------------------------------------------- def save_state_value @save_state_value ||= Marshal.load(Marshal.dump(@params)) # 元のパラメータ保存用 end #-------------------------------------------------------------------------- # ● 追加パラメーターの初期化 #-------------------------------------------------------------------------- def initialize_add_params create_equip_durability_cache @customize_level = Array.new(12) {0} create_customize_level_max @params[8] = @customize_level[8] # 改造レベル @params[9] = @customize_level_max # 改造最大レベル @params[10] = @durability # 耐久度 @params[11] = @durability_max = @durability # 最大耐久度 end #-------------------------------------------------------------------------- # ● 装備の価格取得 [価格「0」] #-------------------------------------------------------------------------- def equip_price_set return @price if @price > 0 value = 0 8.times{|i| value+= @params[i]} value *= value *= ZERO_PRICE_RATE return value end #-------------------------------------------------------------------------- # ● 装備武器回数の回復単価 #-------------------------------------------------------------------------- def weapon_atk_count_price (equip_price_set * REPAIR_COUNT_PRICE) / 100 end #-------------------------------------------------------------------------- # ● 装備耐久力の回復単価 #-------------------------------------------------------------------------- def durability_price value = equip_price_set * DURABILITY_REPAIR_PRICE / 100 # 破損なら回復価格の半分 value / 2 if equip_state[2] == Vocab::Equip_Damage # 正常なら価格0 value = 0 if equip_state[2] == Vocab::Equip_Green return value end #-------------------------------------------------------------------------- # ○ 大破でパラメータを0にしたり元に戻したり # value : true = ゼロに false = ロード #-------------------------------------------------------------------------- def param_save_load(value = true) save_state_value if @save_state_value == [0,0,0,0,0,0,0,0] and @durability > 0 # 何らかの原因で大破状態が保持された場合は元の値に戻す。 temp = self.is_a?(RPG::Weapon) ? $data_weapons[@id] : $data_armors[@id] @save_state_value = Marshal.load(Marshal.dump(@params)) end if value # ゼロにする @params.each_index{|index| @params[index] = 0 if @params[index] == 0 and index <= 7} else # もとに戻す @params.each_index{|index| @params[index] = @save_state_value[index] if @params[index] == 0 and index <= 7} end end #-------------------------------------------------------------------------- # ○ 耐久力回復 #-------------------------------------------------------------------------- def durability_repair(number=0) @durability = number == 0 ? @durability_max : number equip_state end #-------------------------------------------------------------------------- # ○ 武器回数回復 #-------------------------------------------------------------------------- def weapon_repair end #-------------------------------------------------------------------------- # ○ 耐久力のキャッシュを作成 #-------------------------------------------------------------------------- def create_equip_durability_cache @durability = 9999999 @durability_max = @durability self.note.each_line { |line| if line =~ DURABILITY # 装備種別 @durability_max = $1.to_i @durability = @durability_max next if @durability_max == nil end } end #-------------------------------------------------------------------------- # ○ 耐久力最大 #-------------------------------------------------------------------------- def durability_max create_equip_durability_cache if @durability_max == nil return @durability_max end #-------------------------------------------------------------------------- # ○ 耐久状態を返す # value 0 : 現在の耐久力 1 : 最大耐久力 2 : 現在の状態(文字列表示) #-------------------------------------------------------------------------- def equip_state value = [] create_equip_durability_cache if @durability_max == nil now = @durability # 現在の耐久度 max = @durability_max # 最大耐久度 break_equip = max / 2 # 破損 = 最大 / 2 : 大破 = 耐久力 0 value[0] = now value[1] = max if now <= break_equip and now > 0 value[2] = Vocab::Equip_Damage param_save_load(false) elsif now == 0 value[2] = Vocab::Equip_Break param_save_load(true) else value[2] = Vocab::Equip_Green param_save_load(false) end return value end #-------------------------------------------------------------------------- # ○ 改造最大レベルのキャッシュを作成 #-------------------------------------------------------------------------- def create_customize_level_max self.note.each_line { |line| if line =~ INDIVIDUAL_CUSTOM_LEVEL @customize_level_max = $1.to_i next if @customize_level_max == nil end } @customize_level_max ||= ED::CUSTOM_LEVEL end #-------------------------------------------------------------------------- # ○ 改造最大レベル #-------------------------------------------------------------------------- def customize_level_max create_customize_level_max if @customize_level_max == nil return @customize_level_max end end class RPG::Weapon < RPG::EquipItem attr_accessor :weapon_atk_count_max # 武器の最大攻撃回数 attr_accessor :weapon_atk_count # 武器の攻撃回数 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias ed_weapon_count_w_initialize initialize unless $@ def initialize ed_weapon_count_w_initialize initialize_add_params save_state_value # 元のパラメータ保存用 end #-------------------------------------------------------------------------- # ○ 武器回数回復 #-------------------------------------------------------------------------- def weapon_repair(number=0) @weapon_atk_count = number == 0 ? @weapon_atk_count_max : number equip_state end #-------------------------------------------------------------------------- # ● 装備の回復単価 #-------------------------------------------------------------------------- def weapon_atk_count_price if WEAPON1_REPAIR_UNIT_PRICE > 0 and @etype_id == 0 return WEAPON1_REPAIR_UNIT_PRICE else # 価格 * 指定% / 100 = 価格の指定% return (equip_price_set * REPAIR_COUNT_PRICE) / 100 end end #-------------------------------------------------------------------------- # ● 最強装備値 #-------------------------------------------------------------------------- def performance params[2] + params[4] + org_params.inject(0) {|r, v| r += v } end #-------------------------------------------------------------------------- # ● 追加パラメーターの初期化 #-------------------------------------------------------------------------- def initialize_add_params super create_weapon_atk_count @params[12] = @weapon_atk_count # 武器回数 @params[13] = @weapon_atk_count_max # 最大武器回数 end #-------------------------------------------------------------------------- # ○ 攻撃回数のキャッシュを作成 #-------------------------------------------------------------------------- def create_weapon_atk_count @weapon_atk_count_max = 999 self.note.each_line { |line| if line =~ WEAPON_ATK_COUNT @weapon_atk_count_max = $1.to_i @weapon_atk_count = @weapon_atk_count_max if @weapon_atk_count == nil next if @weapon_atk_count_max == nil end } @weapon_atk_count = 999 if @weapon_atk_count == nil end #-------------------------------------------------------------------------- # ○ 最大攻撃回数 #-------------------------------------------------------------------------- def weapon_atk_count_max create_weapon_atk_count if @weapon_atk_count_max == nil return @weapon_atk_count_max end unless $@ #-------------------------------------------------------------------------- # ○ 武器の説明欄 #-------------------------------------------------------------------------- def description weapon_atk_count_max if @weapon_atk_count_max != 999 str = Vocab::DESCRIPTION_ATK_CNT + " " + @weapon_atk_count.to_s + " / " + @weapon_atk_count_max.to_s + " " state = Vocab::Equip_State + ":" + equip_state[2] + " " @text = @description if @text == nil # @text には1度だけ説明文を入れる @description = @text + str + state else state = Vocab::Equip_State + ":" + equip_state[2] + " " @text = @description if @text == nil # @text には1度だけ説明文を入れる @description = @text + state end end end end #============================================================================== # ■ RPG::Armor #============================================================================== class RPG::Armor < RPG::EquipItem #-------------------------------------------------------------------------- # ● 最強装備値 #-------------------------------------------------------------------------- def performance params[3] + params[5] + org_params.inject(0) {|r, v| r += v } end unless $@ #-------------------------------------------------------------------------- # ○ 防具の説明欄 #-------------------------------------------------------------------------- def description state = Vocab::Equip_State + ":" + equip_state[2] + " " @text = @description if @text == nil # @text には1度だけ説明文を入れる @description = @text + state end end end
#==============================================================================
# ☆VXAce RGSS3 「個別装備アイテム:設定」☆
# EnDlEss DREamER
# URL:[url]http://mitsu-evo.6.ql.bz/[/url]
# 製作者 mitsu-evo
# Last:2014/4/22
# 武器防具1個ずつに耐久度や弾数・改造度などを設定する。
# ▼ 装備拡張:武器拡張追加よりも下で「▼ 素材」に近い位置に挿入。
#==============================================================================
$ed_rgss3 = {} if $ed_rgss3 == nil
$ed_rgss3["ed_weapon_count"] = true
=begin
☆☆☆☆☆☆ 機能説明 ☆☆☆☆☆☆
★ 装備のメモ欄の使い方
<耐久力 1000> 装備の耐久力を設定する。
<改造レベル 10> 装備改造を指定段階まで行える
<回数 10> 武器限定で使用回数を設定する
無設定の場合は「装備改造システム」の CUSTOM_LEVEL 設定値まで改造可能
耐久力と武器回数は無制限に設定されます。
★ アイテムのメモ欄の使い方 ★
<武器回復:武器ID,装備ヶ所,回復数> 指定箇所の武器の回数を回復する。
<修理> 指定キャラの装備全てを修復する。
● 武器回数システム
武器のメモ欄に
<回数 10> 等の記述を入れると設定した数値分だけしか
その武器で攻撃できなくなります。
無指定なら回数は指定されません。
二刀流の場合は「両手武器のどちらか」が「ゼロ」に
なったら攻撃が出来なくなります。
武器の攻撃回数が0になるとその武器では攻撃出来ません。
でも、その武器が破棄されることもありません。
以下、イベントコマンドを使用して回復ショップ画面や
コマンドなどで回復することが可能です。
アイテムのメモ欄に「<武器回復:武器ID,装備ヶ所,回復数>」を記入すると
対象アクターの装備中の武器回数を回復することができます。
回復数に「0」を指定すると全回復として処理されます。
なので「HP回復量」も設定値分指定して下さい。
なお「武器ID」に「-1」を指定すると武器IDに関係なく
装備ヶ所の武器を回復出来ます。
● 耐久力システム
以前に「装備拡張:武器拡張追加」にあった耐久力システムをこちらに移しました。
メモ欄に「<耐久力 100>」などと入れるとその装備に耐久力が設定されます。
別途素材「装備破壊システム」の最新版を導入すると装備が破壊されるようになります。
道具「ポーション」などのメモ欄に「<修理>」と入力するとそのアイテムを
味方に使用した場合、その味方の装備全ての耐久力が復活します。
RGSS3版の新機能として、スキルとアイテムのメモ欄に修理や回数回復が使用でき
戦闘中のスキル・アイテムによる修理や回復が可能となりました。
他、イベントコマンドで耐久力を回復出来ます。
● 装備破壊システム
攻撃で装備が破壊されます。
RGSS2版と違い、装備拡張:武器拡張追加導入時はエネミーに設定した
装備を破壊することが出来ます。
RGSS3版の新機能として「装備破壊属性」の設定がある武器・スキル・アイテム
などは耐久力へ補正した設定値分のダメージを与えていくことができます。
「破損」「大破」の2種類の状態が存在し、破損装備は「黄色」
大破装備は「赤」で表示されます。
「大破」した装備は「能力がゼロ」になり装備としての能力が無くなります。
修復することで元に戻ります。
イベントコマンドでも修復が可能です。
● 装備改造システム(スクリプト併用時)
武器・防具のメモ欄に「<改造レベル 10>」など任意の値を入れると
その装備は指定の段階まで改造が可能になります。
無指定の場合は装備改造・鍛冶屋システムの設定レベルが上限となります。
この機能により個別に改造レベルの設定が可能となります。
装備改造項目全体に改造レベルが適用されます。
☆☆☆☆☆☆ イベントコマンド ☆☆☆☆☆☆
「start_weapon_repair」
武器回復ショップ画面を呼び出して「装備中」の武器を
お金を出して回復することが出来る。
「start_armor_repair」
装備回復ショップ画面を呼び出して「装備中」の「装備耐久力」を
お金を出して回復することが出来る。
「weapon_repair(actor_id)」
actor_id : アクターのID
指定アクターの武器全部の回数を回復する
「party_weapon_repair_all」
パーティ全員の装備中の武器回数を全回復します。
「durability_repair(actor_id)」
actor_id : アクターのID
指定アクターの全装備耐久力を回復します。
「party_durability_repair_all」
パーティ全員の装備耐久力を全回復します。
=end
#☆☆☆☆☆☆☆☆ 「メモ欄」の設定 ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
# メモ欄取得用定数
WEAPON_ATK_COUNT = /<(?:count|回数)\s*(\d+)>/i
DURABILITY = /<(?:DURABILITY|耐久力)\s*(\-?\d+)>/i
INDIVIDUAL_CUSTOM_LEVEL = /<(?:CUSTOM|改造レベル)\s*(\d+)>/i
#☆☆☆☆☆☆☆☆ 「装備破壊」の設定 ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
EQUIP_DAMAGE_SE = "Audio/SE/Thunder7"
EQUIP_BREAK_SE = "Audio/SE/Explosion7"
# ダメージ除算して耐久力減算に反映
BREAK_DAMAGE_REVISION = 2
# 全てのダメージで破壊処理実施するか?
SMOOTH_DAMAGE = false
# SMOOTH_DAMAGEがfalseの時、指定%以下のダメージ処理を行わない。
BREAK_DAMAGE_PAR = 10
# 装備破壊属性設定
EQUIP_BREAK_ID = 19
# 装備破壊時の乗算補正(100ダメージ攻撃の3倍の耐久力へのダメージなど)
EQUIP_BREAK_REVISION = 3
#☆☆☆☆☆☆☆☆ 「個別武器」の設定 ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
# 武器1の回復単価設定(G)
# 「0」以外に設定すると武器の回復単価はこの設定が反映される。
# 二刀流の場合は両手ともこの設定が反映される。
# 武器拡張追加導入時の「拡張武器」には一切反映されません。
WEAPON1_REPAIR_UNIT_PRICE = 0
# 武器回数を1回回復の武器価格に対する単価(%)
# 上の設定が「0」の場合は「武器価格の%」を1回の単価として設定します。
# 拡張武器は全てこちらの設定が適用されます。
# 武器価格設定が「0」の場合は武器ステータスから自動算出し、この設定を適用します。
REPAIR_COUNT_PRICE = 5
# 価格「0G」武器の価格算出方法
# 価格ゼロは「(攻撃+防御+精神+敏捷) × ZERO_PRICE_RATE」で
# 価格を一時的に算出し REPAIR_COUNT_PRICE による計算を行っている。
ZERO_PRICE_RATE = 100
#☆☆☆☆☆☆☆☆ 「耐久力」の設定 ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
# 耐久力を全快するのに必要な金額(購入価格の設定%)
# 「破損」ならこの設定の半額が修復金額となります。
DURABILITY_REPAIR_PRICE = 50
#==============================================================================
#==============================================================================
# ■ Vocab
#------------------------------------------------------------------------------
# 用語とメッセージを定義するモジュールです。定数でメッセージなどを直接定義す
# るほか、グローバル変数 $data_system から用語データを取得します。
#==============================================================================
module Vocab
# 装備破壊時のメッセージ
Equip_Break_Text = "%sの %sが %sした!"
Equip_Repair_Text = "%sの 装備が修復された!"
# メモ欄に表示する攻撃回数の文字表示
DESCRIPTION_ATK_CNT = "回数"
# 回復単位
COUNT_UNIT = "回"
# 回復するのに使われる言葉「xx[回][回復]するのにxxゴールドかかるが・・・」
REPAIR_UNIT = "回復"
#
# パーティ全員回復に表示する言葉
FULL_REPAIR_UNIT = "全員満タン"
# 個別補給時に表示する文章「\x00 == 改行」
# [武器名]を[回復回数][COUNT_UNIT設定文字][REPAIR_UNIT設定文字]すると
# [回復価格][金額単位]かかりますがよろしいですか?
# という文章表示になる。
EQUIP_COUNT_TEXT = "%sを%s%s%sすると\x00%s%sかかりますがよろしいですか?"
# 満タン補給時に表示する文章
# 全員を回復するのに[回復価格][金額単位]
# かかりますがよろしいですか?
# という文章表示になる。
EQUIP_FULL_COUNT_TEXT = "全員を%sするのに%s%s\x00かかりますがよろしいですか?"
# 回復出来ない時の文章
# これでは[REPAIR_UNIT設定文字]できませんね。
# という文章表示になる。
NOT_EQUIP_REPAIR_TEXT = "これは%sできませんね。"
# [REPAIR_UNIT設定文字]済みのようですね。と表示される。
FULL_WEAPON_COUNT = "%s済みのようですね。"
NOT_GOLD = "お金が足りないみたいですね。"
# 装備の破壊度表示
Equip_State = "状態" # 説明文に表示する「状態:正常」など
Equip_Green = "正常" # 破損度が正常の状態
Equip_Damage = "破損" # 破損度が耐久力の半分以下の場合
Equip_Break = "大破" # 破損度がゼロの場合
Equip_Durability = "耐久力" # 装備耐久力の表示文字
end
module ED
#==============================================================================
# ■ Command
#------------------------------------------------------------------------------
# イベントコマンド「スクリプト」で呼び出されるコマンドです。
#==============================================================================
module Command
module_function
#--------------------------------------------------------------------------
# ● アクターの武器回復
#--------------------------------------------------------------------------
def weapon_repair(actor_id)
$game_actors[actor_id].weapons.compact.each{|item|item.weapon_repair}
end
#--------------------------------------------------------------------------
# ● パーティの武器全回復
#--------------------------------------------------------------------------
def party_weapon_repair_all
for actor in $game_party.members
weapon_repair(actor.id)
end
end
#--------------------------------------------------------------------------
# ● アクターの装備耐久力回復
#--------------------------------------------------------------------------
def durability_repair(actor_id)
$game_actors[actor_id].equips.compact.each{|item|item.durability_repair}
end
#--------------------------------------------------------------------------
# ● パーティの全装備耐久力全回復
#--------------------------------------------------------------------------
def party_durability_repair_all
for actor in $game_party.members
durability_repair(actor.id)
end
end
end
end
class RPG::BaseItem
#--------------------------------------------------------------------------
# ○ 修理のキャッシュを作成(/<武器回復[::](0|-?\d+),(\d+)>/)
#--------------------------------------------------------------------------
def create_repair_cache
self.note.each_line { |line|
if line =~ /<修理>/
@repair = true
next if @repair == nil
end
}
@repair ||= false
end
#--------------------------------------------------------------------------
# ○ 修理可能スキルやアイテムであるか?
#--------------------------------------------------------------------------
def repair?
create_repair_cache if @repair == nil
return @repair
end
#--------------------------------------------------------------------------
# ○ 武器回数修理のキャッシュを作成
#--------------------------------------------------------------------------
def create_weapon_repair_cache
self.note.each_line { |line|
if line =~ /<武器回復[::](0|-?\d+),(\d+),(\d+)>/
@weapon_repair = true
next if @weapon_repair == nil
end
}
@weapon_repair ||= false
end
#--------------------------------------------------------------------------
# ○ 修理可能スキルやアイテムであるか?
#--------------------------------------------------------------------------
def weapon_repair?
create_weapon_repair_cache if @weapon_repair == nil
return @weapon_repair
end
end
class RPG::EquipItem < RPG::BaseItem
attr_accessor :ed_item_key # 武器格納ハッシュキー
attr_accessor :durability # 耐久力設定
attr_accessor :durability_max # 最大耐久力
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias ed_weapon_count_a_initialize initialize unless $@
def initialize
ed_weapon_count_a_initialize
initialize_add_params
@ed_item_key = 0
save_state_value
end
#--------------------------------------------------------------------------
# ● データベース純正要素数のパラメータ
#--------------------------------------------------------------------------
def org_params; params[0, 7]; end
#--------------------------------------------------------------------------
# ● 元のパラメータ
#--------------------------------------------------------------------------
def save_state_value
@save_state_value ||= Marshal.load(Marshal.dump(@params)) # 元のパラメータ保存用
end
#--------------------------------------------------------------------------
# ● 追加パラメーターの初期化
#--------------------------------------------------------------------------
def initialize_add_params
create_equip_durability_cache
@customize_level = Array.new(12) {0}
create_customize_level_max
@params[8] = @customize_level[8] # 改造レベル
@params[9] = @customize_level_max # 改造最大レベル
@params[10] = @durability # 耐久度
@params[11] = @durability_max = @durability # 最大耐久度
end
#--------------------------------------------------------------------------
# ● 装備の価格取得 [価格「0」]
#--------------------------------------------------------------------------
def equip_price_set
return @price if @price > 0
value = 0
8.times{|i| value+= @params[i]}
value *= value *= ZERO_PRICE_RATE
return value
end
#--------------------------------------------------------------------------
# ● 装備武器回数の回復単価
#--------------------------------------------------------------------------
def weapon_atk_count_price
(equip_price_set * REPAIR_COUNT_PRICE) / 100
end
#--------------------------------------------------------------------------
# ● 装備耐久力の回復単価
#--------------------------------------------------------------------------
def durability_price
value = equip_price_set * DURABILITY_REPAIR_PRICE / 100
# 破損なら回復価格の半分
value / 2 if equip_state[2] == Vocab::Equip_Damage
# 正常なら価格0
value = 0 if equip_state[2] == Vocab::Equip_Green
return value
end
#--------------------------------------------------------------------------
# ○ 大破でパラメータを0にしたり元に戻したり
# value : true = ゼロに false = ロード
#--------------------------------------------------------------------------
def param_save_load(value = true)
save_state_value
if @save_state_value == [0,0,0,0,0,0,0,0] and @durability > 0
# 何らかの原因で大破状態が保持された場合は元の値に戻す。
temp = self.is_a?(RPG::Weapon) ? $data_weapons[@id] : $data_armors[@id]
@save_state_value = Marshal.load(Marshal.dump(@params))
end
if value
# ゼロにする
@params.each_index{|index|
@params[index] = 0 if @params[index] == 0 and index <= 7}
else
# もとに戻す
@params.each_index{|index|
@params[index] = @save_state_value[index] if @params[index] == 0 and index <= 7}
end
end
#--------------------------------------------------------------------------
# ○ 耐久力回復
#--------------------------------------------------------------------------
def durability_repair(number=0)
@durability = number == 0 ? @durability_max : number
equip_state
end
#--------------------------------------------------------------------------
# ○ 武器回数回復
#--------------------------------------------------------------------------
def weapon_repair
end
#--------------------------------------------------------------------------
# ○ 耐久力のキャッシュを作成
#--------------------------------------------------------------------------
def create_equip_durability_cache
@durability = 9999999
@durability_max = @durability
self.note.each_line { |line|
if line =~ DURABILITY
# 装備種別
@durability_max = $1.to_i
@durability = @durability_max
next if @durability_max == nil
end
}
end
#--------------------------------------------------------------------------
# ○ 耐久力最大
#--------------------------------------------------------------------------
def durability_max
create_equip_durability_cache if @durability_max == nil
return @durability_max
end
#--------------------------------------------------------------------------
# ○ 耐久状態を返す
# value 0 : 現在の耐久力 1 : 最大耐久力 2 : 現在の状態(文字列表示)
#--------------------------------------------------------------------------
def equip_state
value = []
create_equip_durability_cache if @durability_max == nil
now = @durability # 現在の耐久度
max = @durability_max # 最大耐久度
break_equip = max / 2 # 破損 = 最大 / 2 : 大破 = 耐久力 0
value[0] = now
value[1] = max
if now <= break_equip and now > 0
value[2] = Vocab::Equip_Damage
param_save_load(false)
elsif now == 0
value[2] = Vocab::Equip_Break
param_save_load(true)
else
value[2] = Vocab::Equip_Green
param_save_load(false)
end
return value
end
#--------------------------------------------------------------------------
# ○ 改造最大レベルのキャッシュを作成
#--------------------------------------------------------------------------
def create_customize_level_max
self.note.each_line { |line|
if line =~ INDIVIDUAL_CUSTOM_LEVEL
@customize_level_max = $1.to_i
next if @customize_level_max == nil
end
}
@customize_level_max ||= ED::CUSTOM_LEVEL
end
#--------------------------------------------------------------------------
# ○ 改造最大レベル
#--------------------------------------------------------------------------
def customize_level_max
create_customize_level_max if @customize_level_max == nil
return @customize_level_max
end
end
class RPG::Weapon < RPG::EquipItem
attr_accessor :weapon_atk_count_max # 武器の最大攻撃回数
attr_accessor :weapon_atk_count # 武器の攻撃回数
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias ed_weapon_count_w_initialize initialize unless $@
def initialize
ed_weapon_count_w_initialize
initialize_add_params
save_state_value # 元のパラメータ保存用
end
#--------------------------------------------------------------------------
# ○ 武器回数回復
#--------------------------------------------------------------------------
def weapon_repair(number=0)
@weapon_atk_count = number == 0 ? @weapon_atk_count_max : number
equip_state
end
#--------------------------------------------------------------------------
# ● 装備の回復単価
#--------------------------------------------------------------------------
def weapon_atk_count_price
if WEAPON1_REPAIR_UNIT_PRICE > 0 and @etype_id == 0
return WEAPON1_REPAIR_UNIT_PRICE
else
# 価格 * 指定% / 100 = 価格の指定%
return (equip_price_set * REPAIR_COUNT_PRICE) / 100
end
end
#--------------------------------------------------------------------------
# ● 最強装備値
#--------------------------------------------------------------------------
def performance
params[2] + params[4] + org_params.inject(0) {|r, v| r += v }
end
#--------------------------------------------------------------------------
# ● 追加パラメーターの初期化
#--------------------------------------------------------------------------
def initialize_add_params
super
create_weapon_atk_count
@params[12] = @weapon_atk_count # 武器回数
@params[13] = @weapon_atk_count_max # 最大武器回数
end
#--------------------------------------------------------------------------
# ○ 攻撃回数のキャッシュを作成
#--------------------------------------------------------------------------
def create_weapon_atk_count
@weapon_atk_count_max = 999
self.note.each_line { |line|
if line =~ WEAPON_ATK_COUNT
@weapon_atk_count_max = $1.to_i
@weapon_atk_count = @weapon_atk_count_max if @weapon_atk_count == nil
next if @weapon_atk_count_max == nil
end
}
@weapon_atk_count = 999 if @weapon_atk_count == nil
end
#--------------------------------------------------------------------------
# ○ 最大攻撃回数
#--------------------------------------------------------------------------
def weapon_atk_count_max
create_weapon_atk_count if @weapon_atk_count_max == nil
return @weapon_atk_count_max
end
unless $@
#--------------------------------------------------------------------------
# ○ 武器の説明欄
#--------------------------------------------------------------------------
def description
weapon_atk_count_max
if @weapon_atk_count_max != 999
str = Vocab::DESCRIPTION_ATK_CNT + " " + @weapon_atk_count.to_s +
" / " + @weapon_atk_count_max.to_s + " "
state = Vocab::Equip_State + ":" + equip_state[2] + " "
@text = @description if @text == nil # @text には1度だけ説明文を入れる
@description = @text + str + state
else
state = Vocab::Equip_State + ":" + equip_state[2] + " "
@text = @description if @text == nil # @text には1度だけ説明文を入れる
@description = @text + state
end
end
end
end
#==============================================================================
# ■ RPG::Armor
#==============================================================================
class RPG::Armor < RPG::EquipItem
#--------------------------------------------------------------------------
# ● 最強装備値
#--------------------------------------------------------------------------
def performance
params[3] + params[5] + org_params.inject(0) {|r, v| r += v }
end
unless $@
#--------------------------------------------------------------------------
# ○ 防具の説明欄
#--------------------------------------------------------------------------
def description
state = Vocab::Equip_State + ":" + equip_state[2] + " "
@text = @description if @text == nil # @text には1度だけ説明文を入れる
@description = @text + state
end
end
end
#============================================================================== # ☆VXAce RGSS3 「個別装備アイテム:Game」☆ # EnDlEss DREamER # URL:[url]http://mitsu-evo.6.ql.bz/[/url] # 製作者 mitsu-evo # Last:2014/4/22 # 武器防具1個ずつに耐久度や弾数・改造度などを設定する。 # ▼ 「個別装備アイテム:設定」「Game」「Window」「Scene」の順で導入 #============================================================================== #============================================================================== # ■ Game_Action #------------------------------------------------------------------------------ # 戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され # ます。 #============================================================================== class Game_Action #-------------------------------------------------------------------------- # ● 防御判定 #-------------------------------------------------------------------------- def guard? item == $data_skills[subject.guard_skill_id] end end #============================================================================== # ■ Game_BaseItem #------------------------------------------------------------------------------ # スキル、アイテム、武器、防具を統一的に扱うクラスです。セーブデータに含める # ことができるように、データベースオブジェクト自体への参照は保持しません。 #============================================================================== class Game_BaseItem #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias ed_weapon_count_initialize initialize def initialize ed_weapon_count_initialize @item = nil end #-------------------------------------------------------------------------- # ● アイテムオブジェクトの取得 #-------------------------------------------------------------------------- alias ed_weapon_count_object_object object def object return ed_weapon_count_object_object if is_skill? or is_item? # 個別装備アイテムの為にアイテムそのものを返す return @item if is_weapon? or is_armor? return nil end #-------------------------------------------------------------------------- # ● アイテムオブジェクトの設定 #-------------------------------------------------------------------------- alias ed_weapon_count_object= object= def object=(item) @class = item ? item.class : nil @item_id = item ? item.id : 0 @item = item # 個別装備アイテムの為にアイテムそのものを格納 end end #============================================================================== # ■ Game_ActionResult #------------------------------------------------------------------------------ # 戦闘行動の結果を扱うクラスです。このクラスは Game_Battler クラスの内部で # 使用されます。 #============================================================================== class Game_ActionResult #-------------------------------------------------------------------------- # ● 装備ダメージの文章を取得 #-------------------------------------------------------------------------- def equip_damage_text return @ep_break_text end #-------------------------------------------------------------------------- # ● ダメージの作成 #-------------------------------------------------------------------------- alias ed_break_equip_make_damage make_damage def make_damage(value, item) ed_break_equip_make_damage(value, item) equip_priority(value) if @success and item.damage.to_hp? end #-------------------------------------------------------------------------- # ● 装備の耐久力被ダメージ処理 #-------------------------------------------------------------------------- def equip_priority(damage) return if not @battler.actor? and not $ed_rgss3["ed_equip_extension"] # 各種設定 # ダメージが0以下なら処理しない。 if damage <= 0 or @missed or @evaded or @effect_test @ep_break_text = "" return end if @battler.atk_elements.include?(EQUIP_BREAK_ID) damage *= EQUIP_BREAK_REVISION # 装備破壊属性ある場合の補正処理 end damage /= BREAK_DAMAGE_REVISION # ダメージを除算して調整する @equips = @battler.equips.compact equip_size = @equips.size # 装備要素数の最大サイズ loop_size = equip_size - 1 # 装備配列用の最大サイズ # ダメージ÷最大HPで最大HP%を求める percent = Float(damage) / Float(@battler.mhp) percent *= 100.0 # 100乗算して%表記へ loop_max = equip_size - 1 # 繰り返す最大数(装備項目の最大数) loop_number = 0 @ep_break_text = "" # 破壊処理 loop do # 破壊部位ランダム選択 # ランダムで装備部位を選択 loop_max = rand(loop_size) item = @equips[loop_max] # この場合の「loop_max」はランダム部位選択の結果 # 耐久度が未設定かnilなら次のループ処理へ if item == nil or item.durability_max == 9999999 or item.durability == 0 break if loop_number >= loop_size next loop_number += 1 end #========== ここまでが部位選択処理 ====================================== # 既に大破している部位なら次のループ処理へ if item.equip_state[2] == Vocab::Equip_Break break @ep_break_text = "" if loop_number == loop_size next loop_number += 1 end # 指定%満たさない場合は処理を行わない(SMOOTH_DAMAGEがfalse時) if not percent > BREAK_DAMAGE_PAR and not SMOOTH_DAMAGE break if loop_number >= loop_size next loop_number += 1 end # 装備耐久度のダメージ割合を算出 eq_dmg_per = Float(damage) / Float(item.durability) eq_dmg_per *= 100.0 # 装備耐久力−ダメージを試算 trial = item.durability trial -= damage # 破損割合を算出。 if trial < 0 # 装備耐久力がマイナスなら0を代入 if item.equip_state[2] == Vocab::Equip_Green and not SMOOTH_DAMAGE # 破損していないなら半減 trial = item.durability_max / 2 eq_dmg_per = 50.0 else trial = 0 end end # 装備耐久度の割合別減算処理 if eq_dmg_per >= 100 # SMOOTHDAMAGE時は一気に大破する。 return equip_break(loop_max, damage) if SMOOTH_DAMAGE # ダメージに対する耐久度が100%以上 if item.equip_state[2] == Vocab::Equip_Damage # 大破した時の処理 equip_break(loop_max, damage) return elsif item.equip_state[2] == Vocab::Equip_Green # 100%以上のダメージでもまだ破損してない場合 equip_half_break(loop_max, damage) return end elsif eq_dmg_per >= 50 # ダメージに対する耐久度が50%以上で正常の場合 if item.equip_state[2] == Vocab::Equip_Green equip_half_break(loop_max, damage) return else # 正常以外で耐久度へのダメージが50%以上なら大破処理 equip_break(loop_max, damage) return end else # ダメージがどれも当てはまらない damage -= item.durability item.durability -= damage if SMOOTH_DAMAGE break end # loop doの末端 break if damage <= 0# 残ダメージが0以下なら終了 break if loop_number >= loop_size loop_number += 1 end end #-------------------------------------------------------------------------- # ● 破損処理 #-------------------------------------------------------------------------- def equip_half_break(loop_max, damage) item = @equips[loop_max] return if item.equip_state[2] == Vocab::Equip_Damage item.durability -= damage item.durability = item.durability_max / 2 unless SMOOTH_DAMAGE # ↑ 耐久力ダメージ処理 @ep_break_text = sprintf(Vocab::Equip_Break_Text, @battler.name, item.name, Vocab::Equip_Damage) item.equip_state # 対象装備のパラメーター無効化処理 end #-------------------------------------------------------------------------- # ● 大破処理 #-------------------------------------------------------------------------- def equip_break(loop_max, damage) item = @equips[loop_max] return if item.equip_state[2] == Vocab::Equip_Break item.durability = 0 # ↑ 耐久力ダメージ処理 @ep_break_text = sprintf(Vocab::Equip_Break_Text, @battler.name, item.name, Vocab::Equip_Break) # ダメージ−装備耐久力で残ダメージを算出 damage -= item.durability item.equip_state # 対象装備のパラメーター無効化処理 end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ # スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。 #============================================================================== class Game_Battler < Game_BattlerBase attr_accessor :equip_selected_index #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias ed_weapon_count_initialize initialize def initialize ed_weapon_count_initialize # Item の ed_item_key を格納する配列で、equip_slotsと同じ要素数。 @equip_selected_index = [0,0,0,0,0] end #-------------------------------------------------------------------------- # ● メモ欄から装備を取得 #-------------------------------------------------------------------------- def get_note_equips(index,item_id) @temp_slot ||= equip_slots.clone kind = @temp_slot[index] kind = 0 if kind == 1 and dual_wield? #if ED::Equip_extension::WEAPON_TYPE.include?(kind) if self.weapon_type.include?(kind) # 武器の場合 item = $data_weapons[item_id] else # 防具の場合 item = $data_armors[item_id] end t_item = $game_party.make_equip(item,1,true) # 追加部分。 unless @__equips[index] == nil @__equips[index].object = t_item @__equips[index].set_equip(is_weapon?(kind), item_id) end @temp_slot[index] = nil # 装備済みのスロットにはnil end #-------------------------------------------------------------------------- # ● 武器攻撃回数消費実行 #-------------------------------------------------------------------------- def use_weapon index = $ed_rgss3["ed_equip_extension"] ? select_weapon : 0 use_weapon_count(index) # 武器0選択かつ二刀流の場合。 if dual_wield? and index == 0 size = $ed_rgss3["ed_equip_extension"] ? weapon_number - 1 : 1 use_weapon_count(size) end end #-------------------------------------------------------------------------- # ● 個別装備アイテムの武器攻撃時の回数消費処理(テストにより判別も可能。) #-------------------------------------------------------------------------- def use_weapon_count(index,test=false) item = weapons[index] # アイテムが nil 素手 か999設定 無制限の場合は消費せず戻る。 count = item == nil ? 999 : item.weapon_atk_count return true if count == 999 return false if count == 0 item.weapon_atk_count -= 1 unless test return true end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ # アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors) # の内部で使用され、Game_Party クラス($game_party)からも参照されます。 #============================================================================== class Game_Actor < Game_Battler unless $ed_rgss3["ed_equip_extension"] #-------------------------------------------------------------------------- # ● スロットIDでの武器・防具判定 #-------------------------------------------------------------------------- def is_weapon?(kind) return kind == 0 return false if kind == nil end def is_armor?(kind) return kind > 0 return false if kind == nil end #-------------------------------------------------------------------------- # ● 装備タイプ #-------------------------------------------------------------------------- def equip_type return equip_slots end end #-------------------------------------------------------------------------- # ● 装備品の初期化 # equips : 初期装備の配列 #-------------------------------------------------------------------------- def init_equips(equips) @equips = Array.new(equip_slots.size) { Game_BaseItem.new } equips.each_with_index do |item_id, i| next if item_id == 0 i = 0 if dual_wield? and i == 1 item = is_weapon?(i) ? $data_weapons[item_id] : $data_armors[item_id] item = $game_party.make_equip(item,i,true) kind = $ed_rgss3["ed_equip_extension"] ? item.kind : index_to_etype_id(i) slot_id = empty_slot(kind) next if slot_id == nil #if slot_id # @equips[slot_id].set_equip(is_weapon?(kind), item_id) change_equip(slot_id,item) if slot_id #end end create_equips_cache if $ed_rgss3["ed_equip_extension"] create_equip_selected_index refresh end #-------------------------------------------------------------------------- # ● 装備の個別ID配列を作成(個別装備アイテム用メソッド) #-------------------------------------------------------------------------- def create_equip_selected_index if $ed_rgss3["ed_equip_extension"] super return end @equip_selected_index = [] equip_slots.size.times{|i| @equip_selected_index << 0 } end #-------------------------------------------------------------------------- # ● 装備の変更 # slot_id : 装備スロット ID # item : 武器/防具(nil なら装備解除) #-------------------------------------------------------------------------- def change_equip(slot_id, item) return unless trade_item_with_party(item, equips[slot_id]) return if item && equip_slots[slot_id] != item.etype_id @equips[slot_id].object = item @equip_selected_index[slot_id] = item == nil ? 0 : item.ed_item_key revision_param if $ed_rgss3["ed_equip_extension"] refresh end #-------------------------------------------------------------------------- # ● 装備の強制変更 # slot_id : 装備スロット ID # item : 武器/防具(nil なら装備解除) #-------------------------------------------------------------------------- def force_change_equip(slot_id, item) @equips[slot_id].object = item equip_selected_index[slot_id] = item == nil ? 0 : item.ed_item_key release_unequippable_items(false) revision_param if $ed_rgss3["ed_equip_extension"] refresh end #-------------------------------------------------------------------------- # ● 装備の破棄 # item : 破棄する武器/防具 #-------------------------------------------------------------------------- alias ed_weapon_count_discard_equip discard_equip def discard_equip(item) slot_id = equips.index(item) equip_selected_index[slot_id] = 0 if slot_id ed_weapon_count_discard_equip(item) end #-------------------------------------------------------------------------- # ● 個別装備アイテムのインデックスのスロット変化修正 #-------------------------------------------------------------------------- def insert_selected_index(index,add=true) @weapon_selected_index.insert(index, 0) if add @weapon_selected_index.delete_at(index) unless add @equip_selected_index = weapon_selected_index + armor_selected_index end end #============================================================================== # ■ Game_Party #------------------------------------------------------------------------------ # パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ # スのインスタンスは $game_party で参照されます。 #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ● 武器オブジェクトの配列取得 #-------------------------------------------------------------------------- def weapons @weapons.keys.sort.collect {|id| @weapons[id] } end #-------------------------------------------------------------------------- # ● 防具オブジェクトの配列取得 #-------------------------------------------------------------------------- def armors @armors.keys.sort.collect {|id| @armors[id] } end #-------------------------------------------------------------------------- # ● 全ての装備品オブジェクトの配列取得 #-------------------------------------------------------------------------- def equip_items # 各IDには個別の装備がハッシュとしてあり、それを全て一つの配列データに変換。 result = [] equips = weapons + armors equips.flatten! equips.each {|items|items.each_value {|item| result << item}} return result end #-------------------------------------------------------------------------- # ● 武器個別データ新規作成 #-------------------------------------------------------------------------- def make_weapon(id,number,direct=false,enemy=false) return nil if $data_weapons[id] == nil item = Marshal.load(Marshal.dump($data_weapons[id]))#$data_weapons[id].clone # 追加パラメーターの初期化 item.initialize_add_params # 武器の格納ハッシュキーを保持 if direct @weapons[id] ||= {} number = @weapons[id].size + 1 @weapons[id][number] = item end item.ed_item_key = enemy ? 100 + number : number return item end #-------------------------------------------------------------------------- # ● 防具個別データ新規作成 #-------------------------------------------------------------------------- def make_armor(id,number,direct=false,enemy=false) return nil if $data_armors[id] == nil item = Marshal.load(Marshal.dump($data_armors[id]))#$data_armors[id].clone # 追加パラメーターの初期化 item.initialize_add_params # 武器の格納ハッシュキーを保持 if direct @armors[id] ||= {} number = @armors[id].size + 1 @armors[id][number] = item end item.ed_item_key = enemy ? 100 + number : number return item end #-------------------------------------------------------------------------- # ● 装備データの作成 #-------------------------------------------------------------------------- def make_equip(item,number,direct=false,enemy=false) return nil if item == nil return make_weapon(item.id, number,direct) if item.is_a?(RPG::Weapon) return make_armor(item.id, number,direct) if item.is_a?(RPG::Armor) end #-------------------------------------------------------------------------- # ● アイテムの増加(減少) # include_equip : 装備品も含める #-------------------------------------------------------------------------- def gain_item(item, amount, include_equip = false) container = item_container(item.class) return unless container last_number = item_number(item) new_number = last_number + amount if item.is_a?(RPG::Item) # アイテムの増加処理 container[item.id] = [[new_number, 0].max, max_item_number(item)].min container.delete(item.id) if container[item.id] == 0 else if amount > 0 # 装備の増加処理 unless item.ed_item_key == nil # 装備品などでアイテムキーが有る場合は再格納する。 container[item.id][item.ed_item_key] = item#.ed_item_key return end container[item.id] ||= {} #unless container[item.id].is_a?(Array) add_equip = false # 途中追加フラグ eq = container[item.id] # 追加個数分繰り返し amount.upto(amount){|i| # 売却などで指定の番号[ed_item_key]欠番に新規追加する処理 num = 0 loop do index = i + num # 一番最初から抜けている箇所へ追加処理 if eq[index] == nil eq[index] = make_equip(item, index) add_equip = true break end num += 1 end } unless add_equip # 途中フラグがなく、最後尾に装備を追加する処理。 amount.upto(amount){|num| index = last_number + num container[item.id][index] = make_equip(item, index) } end else # 減らす時に番号が割り振られている場合は指定配列をnilにする。 unless item.ed_item_key == nil eq = container[item.id] i = item.ed_item_key if amount.abs == 1 eq.delete(i) end else eq = container[item.id] amount.abs.times{|num| eq.delete(eq.size) } end end end if include_equip && new_number < 0 discard_members_equip(item, -new_number) end $game_map.need_refresh = true end #-------------------------------------------------------------------------- # ● アイテムの所持数取得 #-------------------------------------------------------------------------- def item_number(item) container = item_container(item.class) if item.class == RPG::Item container ? container[item.id] || 0 : 0 else return 0 if item == nil # 武器防具の場合は配列で格納しているので配列の要素数を返す。 container[item.id] ||= {} #unless container[item.id].is_a?(Hash) container ? container[item.id].size || 0 : 0 end end end #============================================================================== # ■ Game_Interpreter #------------------------------------------------------------------------------ # イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、 # Game_Troop クラス、Game_Event クラスの内部で使用されます。 #============================================================================== class Game_Interpreter include ED::Command #-------------------------------------------------------------------------- # ● 武器弾数回復シーンの遷移処理 #-------------------------------------------------------------------------- def start_weapon_repair return if $game_party.in_battle SceneManager.call(Scene_Repair) SceneManager.scene.prepare(true) Fiber.yield end #-------------------------------------------------------------------------- # ● 装備耐久力回復シーンの遷移処理 #-------------------------------------------------------------------------- def start_armor_repair return if $game_party.in_battle SceneManager.call(Scene_Repair) SceneManager.scene.prepare(false) Fiber.yield end end
#==============================================================================
# ☆VXAce RGSS3 「個別装備アイテム:Game」☆
# EnDlEss DREamER
# URL:[url]http://mitsu-evo.6.ql.bz/[/url]
# 製作者 mitsu-evo
# Last:2014/4/22
# 武器防具1個ずつに耐久度や弾数・改造度などを設定する。
# ▼ 「個別装備アイテム:設定」「Game」「Window」「Scene」の順で導入
#==============================================================================
#==============================================================================
# ■ Game_Action
#------------------------------------------------------------------------------
# 戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され
# ます。
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# ● 防御判定
#--------------------------------------------------------------------------
def guard?
item == $data_skills[subject.guard_skill_id]
end
end
#==============================================================================
# ■ Game_BaseItem
#------------------------------------------------------------------------------
# スキル、アイテム、武器、防具を統一的に扱うクラスです。セーブデータに含める
# ことができるように、データベースオブジェクト自体への参照は保持しません。
#==============================================================================
class Game_BaseItem
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias ed_weapon_count_initialize initialize
def initialize
ed_weapon_count_initialize
@item = nil
end
#--------------------------------------------------------------------------
# ● アイテムオブジェクトの取得
#--------------------------------------------------------------------------
alias ed_weapon_count_object_object object
def object
return ed_weapon_count_object_object if is_skill? or is_item?
# 個別装備アイテムの為にアイテムそのものを返す
return @item if is_weapon? or is_armor?
return nil
end
#--------------------------------------------------------------------------
# ● アイテムオブジェクトの設定
#--------------------------------------------------------------------------
alias ed_weapon_count_object= object=
def object=(item)
@class = item ? item.class : nil
@item_id = item ? item.id : 0
@item = item # 個別装備アイテムの為にアイテムそのものを格納
end
end
#==============================================================================
# ■ Game_ActionResult
#------------------------------------------------------------------------------
# 戦闘行動の結果を扱うクラスです。このクラスは Game_Battler クラスの内部で
# 使用されます。
#==============================================================================
class Game_ActionResult
#--------------------------------------------------------------------------
# ● 装備ダメージの文章を取得
#--------------------------------------------------------------------------
def equip_damage_text
return @ep_break_text
end
#--------------------------------------------------------------------------
# ● ダメージの作成
#--------------------------------------------------------------------------
alias ed_break_equip_make_damage make_damage
def make_damage(value, item)
ed_break_equip_make_damage(value, item)
equip_priority(value) if @success and item.damage.to_hp?
end
#--------------------------------------------------------------------------
# ● 装備の耐久力被ダメージ処理
#--------------------------------------------------------------------------
def equip_priority(damage)
return if not @battler.actor? and not $ed_rgss3["ed_equip_extension"]
# 各種設定
# ダメージが0以下なら処理しない。
if damage <= 0 or @missed or @evaded or @effect_test
@ep_break_text = ""
return
end
if @battler.atk_elements.include?(EQUIP_BREAK_ID)
damage *= EQUIP_BREAK_REVISION # 装備破壊属性ある場合の補正処理
end
damage /= BREAK_DAMAGE_REVISION # ダメージを除算して調整する
@equips = @battler.equips.compact
equip_size = @equips.size # 装備要素数の最大サイズ
loop_size = equip_size - 1 # 装備配列用の最大サイズ
# ダメージ÷最大HPで最大HP%を求める
percent = Float(damage) / Float(@battler.mhp)
percent *= 100.0 # 100乗算して%表記へ
loop_max = equip_size - 1 # 繰り返す最大数(装備項目の最大数)
loop_number = 0
@ep_break_text = ""
# 破壊処理
loop do
# 破壊部位ランダム選択
# ランダムで装備部位を選択
loop_max = rand(loop_size)
item = @equips[loop_max]
# この場合の「loop_max」はランダム部位選択の結果
# 耐久度が未設定かnilなら次のループ処理へ
if item == nil or item.durability_max == 9999999 or item.durability == 0
break if loop_number >= loop_size
next loop_number += 1
end
#========== ここまでが部位選択処理 ======================================
# 既に大破している部位なら次のループ処理へ
if item.equip_state[2] == Vocab::Equip_Break
break @ep_break_text = "" if loop_number == loop_size
next loop_number += 1
end
# 指定%満たさない場合は処理を行わない(SMOOTH_DAMAGEがfalse時)
if not percent > BREAK_DAMAGE_PAR and not SMOOTH_DAMAGE
break if loop_number >= loop_size
next loop_number += 1
end
# 装備耐久度のダメージ割合を算出
eq_dmg_per = Float(damage) / Float(item.durability)
eq_dmg_per *= 100.0
# 装備耐久力−ダメージを試算
trial = item.durability
trial -= damage
# 破損割合を算出。
if trial < 0
# 装備耐久力がマイナスなら0を代入
if item.equip_state[2] == Vocab::Equip_Green and not SMOOTH_DAMAGE
# 破損していないなら半減
trial = item.durability_max / 2
eq_dmg_per = 50.0
else
trial = 0
end
end
# 装備耐久度の割合別減算処理
if eq_dmg_per >= 100
# SMOOTHDAMAGE時は一気に大破する。
return equip_break(loop_max, damage) if SMOOTH_DAMAGE
# ダメージに対する耐久度が100%以上
if item.equip_state[2] == Vocab::Equip_Damage
# 大破した時の処理
equip_break(loop_max, damage)
return
elsif item.equip_state[2] == Vocab::Equip_Green
# 100%以上のダメージでもまだ破損してない場合
equip_half_break(loop_max, damage)
return
end
elsif eq_dmg_per >= 50
# ダメージに対する耐久度が50%以上で正常の場合
if item.equip_state[2] == Vocab::Equip_Green
equip_half_break(loop_max, damage)
return
else
# 正常以外で耐久度へのダメージが50%以上なら大破処理
equip_break(loop_max, damage)
return
end
else
# ダメージがどれも当てはまらない
damage -= item.durability
item.durability -= damage if SMOOTH_DAMAGE
break
end
# loop doの末端
break if damage <= 0# 残ダメージが0以下なら終了
break if loop_number >= loop_size
loop_number += 1
end
end
#--------------------------------------------------------------------------
# ● 破損処理
#--------------------------------------------------------------------------
def equip_half_break(loop_max, damage)
item = @equips[loop_max]
return if item.equip_state[2] == Vocab::Equip_Damage
item.durability -= damage
item.durability = item.durability_max / 2 unless SMOOTH_DAMAGE
# ↑ 耐久力ダメージ処理
@ep_break_text = sprintf(Vocab::Equip_Break_Text, @battler.name, item.name, Vocab::Equip_Damage)
item.equip_state # 対象装備のパラメーター無効化処理
end
#--------------------------------------------------------------------------
# ● 大破処理
#--------------------------------------------------------------------------
def equip_break(loop_max, damage)
item = @equips[loop_max]
return if item.equip_state[2] == Vocab::Equip_Break
item.durability = 0
# ↑ 耐久力ダメージ処理
@ep_break_text = sprintf(Vocab::Equip_Break_Text, @battler.name, item.name, Vocab::Equip_Break)
# ダメージ−装備耐久力で残ダメージを算出
damage -= item.durability
item.equip_state # 対象装備のパラメーター無効化処理
end
end
#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
# スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
# は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
#==============================================================================
class Game_Battler < Game_BattlerBase
attr_accessor :equip_selected_index
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias ed_weapon_count_initialize initialize
def initialize
ed_weapon_count_initialize
# Item の ed_item_key を格納する配列で、equip_slotsと同じ要素数。
@equip_selected_index = [0,0,0,0,0]
end
#--------------------------------------------------------------------------
# ● メモ欄から装備を取得
#--------------------------------------------------------------------------
def get_note_equips(index,item_id)
@temp_slot ||= equip_slots.clone
kind = @temp_slot[index]
kind = 0 if kind == 1 and dual_wield?
#if ED::Equip_extension::WEAPON_TYPE.include?(kind)
if self.weapon_type.include?(kind)
# 武器の場合
item = $data_weapons[item_id]
else
# 防具の場合
item = $data_armors[item_id]
end
t_item = $game_party.make_equip(item,1,true) # 追加部分。
unless @__equips[index] == nil
@__equips[index].object = t_item
@__equips[index].set_equip(is_weapon?(kind), item_id)
end
@temp_slot[index] = nil # 装備済みのスロットにはnil
end
#--------------------------------------------------------------------------
# ● 武器攻撃回数消費実行
#--------------------------------------------------------------------------
def use_weapon
index = $ed_rgss3["ed_equip_extension"] ? select_weapon : 0
use_weapon_count(index)
# 武器0選択かつ二刀流の場合。
if dual_wield? and index == 0
size = $ed_rgss3["ed_equip_extension"] ? weapon_number - 1 : 1
use_weapon_count(size)
end
end
#--------------------------------------------------------------------------
# ● 個別装備アイテムの武器攻撃時の回数消費処理(テストにより判別も可能。)
#--------------------------------------------------------------------------
def use_weapon_count(index,test=false)
item = weapons[index]
# アイテムが nil 素手 か999設定 無制限の場合は消費せず戻る。
count = item == nil ? 999 : item.weapon_atk_count
return true if count == 999
return false if count == 0
item.weapon_atk_count -= 1 unless test
return true
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
# の内部で使用され、Game_Party クラス($game_party)からも参照されます。
#==============================================================================
class Game_Actor < Game_Battler
unless $ed_rgss3["ed_equip_extension"]
#--------------------------------------------------------------------------
# ● スロットIDでの武器・防具判定
#--------------------------------------------------------------------------
def is_weapon?(kind)
return kind == 0
return false if kind == nil
end
def is_armor?(kind)
return kind > 0
return false if kind == nil
end
#--------------------------------------------------------------------------
# ● 装備タイプ
#--------------------------------------------------------------------------
def equip_type
return equip_slots
end
end
#--------------------------------------------------------------------------
# ● 装備品の初期化
# equips : 初期装備の配列
#--------------------------------------------------------------------------
def init_equips(equips)
@equips = Array.new(equip_slots.size) { Game_BaseItem.new }
equips.each_with_index do |item_id, i|
next if item_id == 0
i = 0 if dual_wield? and i == 1
item = is_weapon?(i) ? $data_weapons[item_id] : $data_armors[item_id]
item = $game_party.make_equip(item,i,true)
kind = $ed_rgss3["ed_equip_extension"] ? item.kind : index_to_etype_id(i)
slot_id = empty_slot(kind)
next if slot_id == nil
#if slot_id
# @equips[slot_id].set_equip(is_weapon?(kind), item_id)
change_equip(slot_id,item) if slot_id
#end
end
create_equips_cache if $ed_rgss3["ed_equip_extension"]
create_equip_selected_index
refresh
end
#--------------------------------------------------------------------------
# ● 装備の個別ID配列を作成(個別装備アイテム用メソッド)
#--------------------------------------------------------------------------
def create_equip_selected_index
if $ed_rgss3["ed_equip_extension"]
super
return
end
@equip_selected_index = []
equip_slots.size.times{|i| @equip_selected_index << 0 }
end
#--------------------------------------------------------------------------
# ● 装備の変更
# slot_id : 装備スロット ID
# item : 武器/防具(nil なら装備解除)
#--------------------------------------------------------------------------
def change_equip(slot_id, item)
return unless trade_item_with_party(item, equips[slot_id])
return if item && equip_slots[slot_id] != item.etype_id
@equips[slot_id].object = item
@equip_selected_index[slot_id] = item == nil ? 0 : item.ed_item_key
revision_param if $ed_rgss3["ed_equip_extension"]
refresh
end
#--------------------------------------------------------------------------
# ● 装備の強制変更
# slot_id : 装備スロット ID
# item : 武器/防具(nil なら装備解除)
#--------------------------------------------------------------------------
def force_change_equip(slot_id, item)
@equips[slot_id].object = item
equip_selected_index[slot_id] = item == nil ? 0 : item.ed_item_key
release_unequippable_items(false)
revision_param if $ed_rgss3["ed_equip_extension"]
refresh
end
#--------------------------------------------------------------------------
# ● 装備の破棄
# item : 破棄する武器/防具
#--------------------------------------------------------------------------
alias ed_weapon_count_discard_equip discard_equip
def discard_equip(item)
slot_id = equips.index(item)
equip_selected_index[slot_id] = 0 if slot_id
ed_weapon_count_discard_equip(item)
end
#--------------------------------------------------------------------------
# ● 個別装備アイテムのインデックスのスロット変化修正
#--------------------------------------------------------------------------
def insert_selected_index(index,add=true)
@weapon_selected_index.insert(index, 0) if add
@weapon_selected_index.delete_at(index) unless add
@equip_selected_index = weapon_selected_index + armor_selected_index
end
end
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
# スのインスタンスは $game_party で参照されます。
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 武器オブジェクトの配列取得
#--------------------------------------------------------------------------
def weapons
@weapons.keys.sort.collect {|id| @weapons[id] }
end
#--------------------------------------------------------------------------
# ● 防具オブジェクトの配列取得
#--------------------------------------------------------------------------
def armors
@armors.keys.sort.collect {|id| @armors[id] }
end
#--------------------------------------------------------------------------
# ● 全ての装備品オブジェクトの配列取得
#--------------------------------------------------------------------------
def equip_items
# 各IDには個別の装備がハッシュとしてあり、それを全て一つの配列データに変換。
result = []
equips = weapons + armors
equips.flatten!
equips.each {|items|items.each_value {|item| result << item}}
return result
end
#--------------------------------------------------------------------------
# ● 武器個別データ新規作成
#--------------------------------------------------------------------------
def make_weapon(id,number,direct=false,enemy=false)
return nil if $data_weapons[id] == nil
item = Marshal.load(Marshal.dump($data_weapons[id]))#$data_weapons[id].clone
# 追加パラメーターの初期化
item.initialize_add_params
# 武器の格納ハッシュキーを保持
if direct
@weapons[id] ||= {}
number = @weapons[id].size + 1
@weapons[id][number] = item
end
item.ed_item_key = enemy ? 100 + number : number
return item
end
#--------------------------------------------------------------------------
# ● 防具個別データ新規作成
#--------------------------------------------------------------------------
def make_armor(id,number,direct=false,enemy=false)
return nil if $data_armors[id] == nil
item = Marshal.load(Marshal.dump($data_armors[id]))#$data_armors[id].clone
# 追加パラメーターの初期化
item.initialize_add_params
# 武器の格納ハッシュキーを保持
if direct
@armors[id] ||= {}
number = @armors[id].size + 1
@armors[id][number] = item
end
item.ed_item_key = enemy ? 100 + number : number
return item
end
#--------------------------------------------------------------------------
# ● 装備データの作成
#--------------------------------------------------------------------------
def make_equip(item,number,direct=false,enemy=false)
return nil if item == nil
return make_weapon(item.id, number,direct) if item.is_a?(RPG::Weapon)
return make_armor(item.id, number,direct) if item.is_a?(RPG::Armor)
end
#--------------------------------------------------------------------------
# ● アイテムの増加(減少)
# include_equip : 装備品も含める
#--------------------------------------------------------------------------
def gain_item(item, amount, include_equip = false)
container = item_container(item.class)
return unless container
last_number = item_number(item)
new_number = last_number + amount
if item.is_a?(RPG::Item)
# アイテムの増加処理
container[item.id] = [[new_number, 0].max, max_item_number(item)].min
container.delete(item.id) if container[item.id] == 0
else
if amount > 0
# 装備の増加処理
unless item.ed_item_key == nil
# 装備品などでアイテムキーが有る場合は再格納する。
container[item.id][item.ed_item_key] = item#.ed_item_key
return
end
container[item.id] ||= {} #unless container[item.id].is_a?(Array)
add_equip = false # 途中追加フラグ
eq = container[item.id]
# 追加個数分繰り返し
amount.upto(amount){|i|
# 売却などで指定の番号[ed_item_key]欠番に新規追加する処理
num = 0
loop do
index = i + num # 一番最初から抜けている箇所へ追加処理
if eq[index] == nil
eq[index] = make_equip(item, index)
add_equip = true
break
end
num += 1
end
}
unless add_equip
# 途中フラグがなく、最後尾に装備を追加する処理。
amount.upto(amount){|num|
index = last_number + num
container[item.id][index] = make_equip(item, index) }
end
else
# 減らす時に番号が割り振られている場合は指定配列をnilにする。
unless item.ed_item_key == nil
eq = container[item.id]
i = item.ed_item_key
if amount.abs == 1
eq.delete(i)
end
else
eq = container[item.id]
amount.abs.times{|num| eq.delete(eq.size) }
end
end
end
if include_equip && new_number < 0
discard_members_equip(item, -new_number)
end
$game_map.need_refresh = true
end
#--------------------------------------------------------------------------
# ● アイテムの所持数取得
#--------------------------------------------------------------------------
def item_number(item)
container = item_container(item.class)
if item.class == RPG::Item
container ? container[item.id] || 0 : 0
else
return 0 if item == nil
# 武器防具の場合は配列で格納しているので配列の要素数を返す。
container[item.id] ||= {} #unless container[item.id].is_a?(Hash)
container ? container[item.id].size || 0 : 0
end
end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================
class Game_Interpreter
include ED::Command
#--------------------------------------------------------------------------
# ● 武器弾数回復シーンの遷移処理
#--------------------------------------------------------------------------
def start_weapon_repair
return if $game_party.in_battle
SceneManager.call(Scene_Repair)
SceneManager.scene.prepare(true)
Fiber.yield
end
#--------------------------------------------------------------------------
# ● 装備耐久力回復シーンの遷移処理
#--------------------------------------------------------------------------
def start_armor_repair
return if $game_party.in_battle
SceneManager.call(Scene_Repair)
SceneManager.scene.prepare(false)
Fiber.yield
end
end
#============================================================================== # ☆VXAce RGSS3 「個別装備アイテム:Window」☆ # EnDlEss DREamER # URL:[url]http://mitsu-evo.6.ql.bz/[/url] # 製作者 mitsu-evo # Last:2014/4/22 # 武器防具1個ずつに耐久度や弾数・改造度などを設定する。 # ▼ 「個別装備アイテム:設定」「Game」「Window」「Scene」の順で導入 #============================================================================== =begin =end #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ # ゲーム中の全てのウィンドウのスーパークラスです。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● 耐久力の状態別の表示文字色変更 #-------------------------------------------------------------------------- def equip_state_text_color(item) return change_color(normal_color) if item == nil # アイテムの文字と設定文字がそれぞれ同じなら分岐 if item.equip_state[2] == Vocab::Equip_Damage # 破損 change_color(crisis_color) elsif item.equip_state[2] == Vocab::Equip_Break # 大破 change_color(knockout_color) else # 正常 change_color(normal_color) end end end #============================================================================== # ■ Window_BattleLog #------------------------------------------------------------------------------ # 戦闘の進行を実況表示するウィンドウです。枠は表示しませんが、便宜上ウィンド # ウとして扱います。 #============================================================================== class Window_BattleLog < Window_Selectable #-------------------------------------------------------------------------- # ● 行動結果の表示 #-------------------------------------------------------------------------- alias ed_break_equip_display_action_results display_action_results def display_action_results(target, item) ed_break_equip_display_action_results(target, item) if (target.result.used and item.repair?) or (target.result.used and item.weapon_repair?) target.equips.compact.each{|equip| equip.durability_repair} if item.repair? item_weapon_repair(target, item) if item.weapon_repair? d_text = sprintf(Vocab::Equip_Repair_Text, target.name) add_text(d_text) end wait end #-------------------------------------------------------------------------- # ● アイテムによる武器回数回復の実行 #-------------------------------------------------------------------------- def item_weapon_repair(target, item) e_item = item.note.scan(/<武器回復[::](0|-?\d+),(\d+),(\d+)>/) e_item.flatten!#配列をフラットにする[1,[2]]を[1,2]へ unless e_item == nil or e_item.empty? weapon_id = e_item[0].to_i # メモ欄の武器ID weapon_index = e_item[1].to_i # メモ欄の装備ヶ所 repair_num = e_item[2].to_i # メモ欄の回復数 # 同じ武器が装備中かどうかチェック i = 0 # 装備ヶ所 for equip in target.weapons # 武器IDが同じで装備ヶ所も同じなら回復処理 if equip.id == weapon_id and i == weapon_index equip.weapon_repair(repair_num) return true elsif weapon_id == -1 and i == weapon_index # 武器ID指定がないなら指定量だけ装備ヶ所の武器回数を回復 equip.weapon_repair(repair_num) return true end i += 1 end end return false end #-------------------------------------------------------------------------- # ● HP ダメージ表示 #-------------------------------------------------------------------------- alias ed_break_equip_display_hp_damage display_hp_damage def display_hp_damage(target, item) ed_break_equip_display_hp_damage(target, item) return if target.result.hp_damage == 0 && item && !item.damage.to_hp? if target.result.hp_damage > 0 && target.result.hp_drain == 0 # 装備破壊テキストを追加 d_text = target.result.equip_damage_text if d_text =~ /#{Vocab::Equip_Damage}/ $game_troop.screen.start_flash(Color.new(255,255,0),10) Audio.se_play(EQUIP_DAMAGE_SE,100,100) elsif d_text =~ /#{Vocab::Equip_Break}/ $game_troop.screen.start_flash(Color.new(255,50,50),10) Audio.se_play(EQUIP_BREAK_SE,100,100) end add_text(d_text) unless d_text.empty? end wait end end #============================================================================== # ■ Window_ActorName #------------------------------------------------------------------------------ # アクター名を表示するウィンドウです。 #============================================================================== class Window_ActorName < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor) super(x, y, width, height) @actor = actor refresh end #-------------------------------------------------------------------------- # ● アクターの設定 #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_actor_name(@actor, 0, 0) end end #============================================================================== # ■ Window_YesNoCommand #------------------------------------------------------------------------------ # はい・いいえを選択するウィンドウです。 #============================================================================== class Window_YesNoCommand < Window_HorzCommand #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, window_width) @window_width = window_width super(x, y) end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width @window_width end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 2 end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list add_command("はい", :ok) add_command("いいえ", :cancel) end end #============================================================================== # ■ Window_ItemList #------------------------------------------------------------------------------ # アイテム画面で、所持アイテムの一覧を表示するウィンドウです。 #============================================================================== class Window_ItemList < Window_Selectable #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- alias ed_weapon_count_draw_item draw_item def draw_item(index) item = @data[index] unless item.is_a?(RPG::Item) if item rect = item_rect(index) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enable?(item)) #draw_item_number(rect, item) end else ed_weapon_count_draw_item(index) end end end #============================================================================== # ■ Window_RepairEquipSlot #------------------------------------------------------------------------------ # 装備画面で、アクターが現在装備している武器を表示するウィンドウです。 #============================================================================== class Window_RepairEquipSlot < Window_EquipSlot #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, width, atk_count = false) super(x, y, width) @actor = nil @atk_count = atk_count refresh end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max if @atk_count return @actor ? @actor.weapons.size : 0 else return @actor ? @actor.equip_slots.size : 0 end end #-------------------------------------------------------------------------- # ● アイテムの取得 #-------------------------------------------------------------------------- def item if @atk_count return @actor ? @actor.weapons[index] : nil else return @actor ? @actor.equips[index] : nil end end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) return unless @actor rect = item_rect_for_text(index) change_color(system_color, enable?(index)) draw_text(rect.x, rect.y, 92, line_height, slot_name(index)) if @atk_count draw_item_name(@actor.weapons[index], rect.x + 92, rect.y, enable?(index)) else draw_item_name(@actor.equips[index], rect.x + 92, rect.y, enable?(index)) end end #-------------------------------------------------------------------------- # ● アイテム名の描画 # enabled : 有効フラグ。false のとき半透明で描画 #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x, y, enabled) change_color(normal_color, enabled) draw_text(x + 24, y, width, line_height, item.name) if @atk_count # 武器回数回復の場合は回数を now = item.weapon_atk_count == 999 ? "------" : item.weapon_atk_count.to_s max = item.weapon_atk_count_max == 999 ? "------" : item.weapon_atk_count_max.to_s draw_text(x + 48 + width , y, width, line_height, now) draw_text(x + 112 + width, y, 22, line_height, "/", 1) draw_text(x + 144 + width , y, width, line_height, max) else # 回数回復じゃない場合は状態を equip_state_text_color(item) draw_text(x + 48 + width , y, width, line_height, item.equip_state[2]) end end end #============================================================================== # ■ Window_WeaponRepairCommand #------------------------------------------------------------------------------ # ショップ画面で、購入/売却を選択するウィンドウです。 #============================================================================== class Window_WeaponRepairCommand < Window_HorzCommand #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(window_width, purchase_only) @window_width = window_width @purchase_only = purchase_only super(0, 0) end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width @window_width end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 3 end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list add_command(Vocab::FULL_REPAIR_UNIT, :all) add_command(Vocab::REPAIR_UNIT, :select, !@purchase_only) add_command(Vocab::ShopCancel, :cancel) end end #============================================================================== # ■ Window_RepairShopNumber #------------------------------------------------------------------------------ # リペアショップ画面で、個数を入力するウィンドウです。 #============================================================================== class Window_RepairShopNumber < Window_ShopNumber #-------------------------------------------------------------------------- # ● アイテム、最大個数、価格、通貨単位の設定 #-------------------------------------------------------------------------- def set(item, max, price, currency_unit = nil) super(item, max, price, currency_unit) @number = 0 refresh end #-------------------------------------------------------------------------- # ● 個数の変更 #-------------------------------------------------------------------------- def change_number(amount) @number = [[@number + amount, @max].min, 0].max end end if $ed_rgss3["ed_equip_extension"] #============================================================================== # ■ Window_BattleWeapon #------------------------------------------------------------------------------ # 戦闘画面で武器を一覧を表示するウィンドウです。 #============================================================================== class Window_BattleWeapon < Window_Command #-------------------------------------------------------------------------- # ● 武器コマンドをリストに追加 #-------------------------------------------------------------------------- def add_weapon_command @actor.weapon_number.times{|i| item = @actor.weapons[i] name = item == nil ? "" : item.name # 武器回数を追加表示。 unless item == nil name += item.weapon_atk_count == 999 ? "" : " : " + item.weapon_atk_count.to_s enabled = @actor.attack_usable? ? item.weapon_atk_count > 0 ? true : false : false else enabled = true end add_command(name, :attack, enabled)} end #-------------------------------------------------------------------------- # ● 決定ボタンが押されたときの処理 #-------------------------------------------------------------------------- alias ed_weapon_count_process_ok process_ok def process_ok unless @actor.use_weapon_count(index,true) # 武器を使用可能かテストしてダメなら戻る。 Sound.play_buzzer else ed_weapon_count_process_ok end end #-------------------------------------------------------------------------- # ● SHIFTボタンが押されたときの処理 #-------------------------------------------------------------------------- alias ed_weapon_count_process_shift process_shift def process_shift unless @actor.use_weapon_count(index,true) # 武器を使用可能かテストしてダメなら戻る。 Sound.play_buzzer else ed_weapon_count_process_shift end end end end#$ed_rgss3["ed_equip_extension"] #============================================================================== # ■ Window_Repair #------------------------------------------------------------------------------ # ショップ画面で回復する武器弾数や防具耐久度の装備一覧表示のウィンドウです。 #============================================================================== class Window_Repair < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x,y,height,actor,atk_count=false) super(x, y, window_width, height) @actor = actor @atk_count = atk_count clear_list unselect activate end #-------------------------------------------------------------------------- # ● アクターの設定 #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor refresh end #-------------------------------------------------------------------------- # ● リストに追加 #-------------------------------------------------------------------------- def add_list(value) @repair_list << value end #-------------------------------------------------------------------------- # ● リストをクリア #-------------------------------------------------------------------------- def clear_list @repair_list = [] @number = 0 @item = nil @all_repair = false all_weapon_repair_price if @atk_count all_equips_repair_price unless @atk_count end #-------------------------------------------------------------------------- # ● 全装備回復フラグ #-------------------------------------------------------------------------- def all_repair=(value) @all_repair = value refresh end def all_repair; @all_repair; end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width return Graphics.width end #-------------------------------------------------------------------------- # ● スロットウィンドウの設定 #-------------------------------------------------------------------------- def slot_window=(slot_window) @slot_window = slot_window end #-------------------------------------------------------------------------- # ● ナンバーウィンドウの設定 #-------------------------------------------------------------------------- def number_window=(number_window) @number_window = number_window end #-------------------------------------------------------------------------- # ● ナンバーウィンドウの回復弾数取得 #-------------------------------------------------------------------------- def number @number = @atk_count ? @number_window.number : 1 @item = @slot_window.item @all_repair = false if @atk_count t_price = @item == nil ? 0 : @item.weapon_atk_count_price else t_price = @item == nil ? 0 : @item.durability_price end @repair_list[@slot_window.index] = [@number, t_price * @number] refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_equipments(0,0) end #-------------------------------------------------------------------------- # ● 装備品詳細の描画 #-------------------------------------------------------------------------- def draw_equipments(x, y) i = 0 # 装備のインデックス y2 = 0 # 表示座標の行数 @actor.equips.each do |item| next if item == nil # 武器回数回復の場合は防具を処理しない。 next if not item.is_a?(RPG::Weapon) and @atk_count # 個別回復でスロットウィンドウのアイテムと装備のアイテムが違う場合 next if not @all_repair and @item != item j = y + (line_height * y2) draw_item_name(item, x, j) draw_price(item, x + Graphics.width / 2, j, i) i += 1 y2 += 1 end # 合計の描画 draw_text(x, y + line_height * (y2 + 1), 44, line_height, "合計", 1) draw_currency_value(price,currency_unit,x,y + line_height * (y2 + 1), window_width - (standard_padding * 2)) end #-------------------------------------------------------------------------- # ● 回復個数及び価格描画 #-------------------------------------------------------------------------- def draw_price(item, x, y, index) return if @repair_list.empty? return if @repair_list[index] == nil return unless item change_color(normal_color) count = @repair_list[index][0] if @atk_count price = @repair_list[index][1] if @atk_count # 武器の場合は回復回数を描画 draw_text(x, y, 44, line_height, count.to_s + Vocab::COUNT_UNIT, 1) else # 他は耐久力の状態を描画 text = item.equip_state[2] equip_state_text_color(item) draw_text(x, y, 44, line_height, text, 1) change_color(normal_color) end draw_text(x + 88, y, 44, line_height, price.to_s + currency_unit, 2) end #-------------------------------------------------------------------------- # ● 商品の値段を取得 #-------------------------------------------------------------------------- def price @repair_list ||= [] return 0 if @repair_list.empty? @repair_list.inject(0) {|r,item| next unless item r ||= 0 r + item[1]} end #-------------------------------------------------------------------------- # ● 全武装回復の弾数の価格取得 #-------------------------------------------------------------------------- def all_weapon_repair_price result = 0 @actor.weapons.each do |item| i = item == nil ? 0 : item.weapon_atk_count_max - item.weapon_atk_count r = item == nil ? 0 : i * item.weapon_atk_count_price result += r add_list([i, r]) end refresh return result end #-------------------------------------------------------------------------- # ● 全装備の耐久力の価格取得 #-------------------------------------------------------------------------- def all_equips_repair_price result = 0 @actor.equips.each do |item| i = 0 r = item == nil ? 0 : item.durability_price result += r add_list([i, r]) end refresh return result end #-------------------------------------------------------------------------- # ● 選択項目の有効状態を取得 #-------------------------------------------------------------------------- def current_item_enabled? return $game_party.gold >= self.price && self.price > 0 end #-------------------------------------------------------------------------- # ● 通貨単位の取得 #-------------------------------------------------------------------------- def currency_unit Vocab::currency_unit end end #============================================================================== # ■ Window_Equip_Contents_Custom #------------------------------------------------------------------------------ # 改造するアイテムの詳細を表示するヘルプウィンドウです。 #============================================================================== class Window_Equip_Contents_Custom < Window_Selectable #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :slot_window # スロットウィンドウ attr_reader :number_window # ナンバーウィンドウ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, window_width, Graphics.height - y) @new_item = nil end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width return 208 end #-------------------------------------------------------------------------- # ● 表示行数の取得 #-------------------------------------------------------------------------- def visible_line_number return 4 end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max return 4 end #-------------------------------------------------------------------------- # ● フォントを小さくする #-------------------------------------------------------------------------- def make_font_smaller contents.font.size -= 4 if contents.font.size >= 16 end #-------------------------------------------------------------------------- # ● アイテム詳細の描画 #-------------------------------------------------------------------------- def draw_item_contents(item, new_param=false) return unless item draw_item_name(item, 0, 0) unless new_param draw_right_arrow(new_param_x) if new_param draw_equip_all_param(new_param) draw_equip_durability(0, line_height * 9,item, new_param) draw_equip_weapon_atk_count(0, line_height * 10,item, new_param) if $ed_rgss3["ed_equip_extension"] draw_item_weight(0, line_height * 11,item, new_param) draw_equipment_ep_cost(item, 0 , line_height * 12, new_param) end end #-------------------------------------------------------------------------- # ● 全能力値の描画 #-------------------------------------------------------------------------- def draw_equip_all_param(new_param=false) item = new_param ? @new_item : @item 8.times{|i|# 8 はtimesが0からself -1までだから。 h = (i + 1) * line_height draw_equip_param(item, 0, h, i, new_param)} end #-------------------------------------------------------------------------- # ● 能力値の描画 #-------------------------------------------------------------------------- def draw_equip_param(item, x, y, param_id, new_param=false) x += new_param_x if new_param plus_x = new_param ? 36 : 50 change_color(system_color) draw_text(x, y, 42, line_height, params_text_short(param_id)) unless new_param change_color(normal_color) draw_text(x + plus_x, y, 42, line_height, item.params[param_id], 2) end #-------------------------------------------------------------------------- # ● 装備重量の描画 #-------------------------------------------------------------------------- def draw_item_weight(x, y, item, new_param=false) x += new_param_x if new_param plus_x = new_param ? 36 : 50 change_color(system_color) draw_text(x, y, 42, line_height, ED::Equip_extension::VOCAB_WEIGHT) unless new_param change_color(normal_color) draw_text(x + plus_x, y, 42, line_height, item.equip_weight, 2) end #-------------------------------------------------------------------------- # ● 消費 EP の描画 # item : 武器 or 防具 # rect : 描画する領域 # enabled : 許可状態 #-------------------------------------------------------------------------- def draw_equipment_ep_cost(item, x, y, new_param=false) return unless ED::Equip_extension::USE_EP_SYSTEM return if item == nil x += new_param_x if new_param plus_x = new_param ? 36 : 50 change_color(system_color) draw_text(x, y, 42, line_height, ED::Equip_extension::VOCAB_EP) unless new_param change_color(normal_color) draw_text(x + plus_x , y, 42, line_height, item.ep_cost, 2) end #-------------------------------------------------------------------------- # ● 装備レベルの描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 # item : 装備品 #-------------------------------------------------------------------------- def draw_equip_level(x,y,item, new_param=false) return unless ED::Equip_extension::USE_EQUIP_LEVEL_SYSTEM x += new_param_x if new_param plus_x = new_param ? 36 : 50 change_color(system_color) draw_text(x, y, 36, line_height, Vocab::equip_level) unless new_param change_color(normal_color) draw_text(x + plus_x, y, 42, line_height, item.equip_level, 2) end #-------------------------------------------------------------------------- # ● 装備耐久力の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 # item : 装備品 #-------------------------------------------------------------------------- def draw_equip_durability(x,y,item, new_param=false) x += new_param_x if new_param plus_x = new_param ? 36 : 50 change_color(system_color) draw_text(x, y, 36, line_height, Vocab::Equip_Durability) unless new_param change_color(normal_color) text = item.durability_max >= 9999999 ? "------" : item.durability_max draw_text(x + plus_x, y, 42, line_height, text, 2) end #-------------------------------------------------------------------------- # ● 武器攻撃回数の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 # item : 装備品 #-------------------------------------------------------------------------- def draw_equip_weapon_atk_count(x,y,item, new_param=false) x += new_param_x if new_param plus_x = new_param ? 36 : 50 change_color(system_color) draw_text(x, y, 36, line_height, Vocab::DESCRIPTION_ATK_CNT) unless new_param return unless item.is_a?(RPG::Weapon) change_color(normal_color) text = item.weapon_atk_count_max >= 999 ? "------" : item.weapon_atk_count_max draw_text(x + plus_x, y, 42, line_height, text, 2) end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(x, y, item) draw_current_param(item) draw_right_arrow(x + 126, y) draw_current_param(@new_item, true) if @new_item end #-------------------------------------------------------------------------- # ● 能力値の名前を描画 #-------------------------------------------------------------------------- def draw_param_name(x, y, param_id) change_color(system_color) draw_text(x, y, 80, line_height, Vocab::param(param_id)) end #-------------------------------------------------------------------------- # ● 右向き矢印を描画 #-------------------------------------------------------------------------- def draw_right_arrow(x=0) change_color(system_color) 13.times{|i| next if i == 0 next if i > 10 unless $ed_rgss3["ed_equip_extension"] y = i * line_height draw_text(x, y, 22, line_height, "→", 1)} end #-------------------------------------------------------------------------- # ● 新しいパラメータの表示基準X座標 #-------------------------------------------------------------------------- def new_param_x return window_width / 2 end #-------------------------------------------------------------------------- # ● アイテムの取得 #-------------------------------------------------------------------------- def item @item = @slot_window.item refresh end #-------------------------------------------------------------------------- # ● ナンバーウィンドウの改造レベル取得 #-------------------------------------------------------------------------- def number @number = @number_window.number refresh end #-------------------------------------------------------------------------- # ● 改造後用アイテムの設定 #-------------------------------------------------------------------------- def set_new_item(item) @new_item = item refresh end #-------------------------------------------------------------------------- # ● 改造後用アイテムの取得 #-------------------------------------------------------------------------- def new_item @new_item = @number_window.item refresh end #-------------------------------------------------------------------------- # ● スロットウィンドウの設定 #-------------------------------------------------------------------------- def slot_window=(slot_window) @slot_window = slot_window end #-------------------------------------------------------------------------- # ● ナンバーウィンドウの設定 #-------------------------------------------------------------------------- def number_window=(number_window) @number_window = number_window end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_item_contents(@item,false) draw_item_contents(@new_item,true) if @new_item end #-------------------------------------------------------------------------- # ● カーソルが移動しているか? #-------------------------------------------------------------------------- def other_window_cursor_movable? return true if @slot_window and @slot_window.cursor_movable? return true if @number_window and @number_window.cursor_movable? return false end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super item if other_window_cursor_movable? end #-------------------------------------------------------------------------- # ● 装備変更後の一時アクター設定 #-------------------------------------------------------------------------- def set_temp_actor(temp_actor) return end end if $ed_rgss3["ed_equip_extension"] #============================================================================== # ■ Window_BattleWeapon #------------------------------------------------------------------------------ # 戦闘画面で武器を一覧を表示するウィンドウです。 #============================================================================== class Window_BattleWeapon < Window_Command #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) equip_state_text_color(item) draw_text(item_rect_for_text(index), command_name(index), alignment) end #-------------------------------------------------------------------------- # ● 選択項目の有効状態を取得 #-------------------------------------------------------------------------- def current_item_enabled? return (item == nil ? true : item.equip_state[2] != Vocab::Equip_Break) end #-------------------------------------------------------------------------- # ● 決定ボタンが押されたときの処理 #-------------------------------------------------------------------------- def process_ok if current_item_enabled? Sound.play_ok Input.update deactivate call_ok_handler else Sound.play_buzzer activate end end #-------------------------------------------------------------------------- # ● SHIFTボタンが押されたときの処理 #-------------------------------------------------------------------------- def process_shift if wp_skill_enabled? select(@index) Sound.play_ok Input.update deactivate call_handler(:wp_skill) else Sound.play_buzzer activate end end end end#$ed_rgss3["ed_equip_extension"]
#==============================================================================
# ☆VXAce RGSS3 「個別装備アイテム:Window」☆
# EnDlEss DREamER
# URL:[url]http://mitsu-evo.6.ql.bz/[/url]
# 製作者 mitsu-evo
# Last:2014/4/22
# 武器防具1個ずつに耐久度や弾数・改造度などを設定する。
# ▼ 「個別装備アイテム:設定」「Game」「Window」「Scene」の順で導入
#==============================================================================
=begin
=end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# ゲーム中の全てのウィンドウのスーパークラスです。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 耐久力の状態別の表示文字色変更
#--------------------------------------------------------------------------
def equip_state_text_color(item)
return change_color(normal_color) if item == nil
# アイテムの文字と設定文字がそれぞれ同じなら分岐
if item.equip_state[2] == Vocab::Equip_Damage
# 破損
change_color(crisis_color)
elsif item.equip_state[2] == Vocab::Equip_Break
# 大破
change_color(knockout_color)
else
# 正常
change_color(normal_color)
end
end
end
#==============================================================================
# ■ Window_BattleLog
#------------------------------------------------------------------------------
# 戦闘の進行を実況表示するウィンドウです。枠は表示しませんが、便宜上ウィンド
# ウとして扱います。
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# ● 行動結果の表示
#--------------------------------------------------------------------------
alias ed_break_equip_display_action_results display_action_results
def display_action_results(target, item)
ed_break_equip_display_action_results(target, item)
if (target.result.used and item.repair?) or
(target.result.used and item.weapon_repair?)
target.equips.compact.each{|equip| equip.durability_repair} if item.repair?
item_weapon_repair(target, item) if item.weapon_repair?
d_text = sprintf(Vocab::Equip_Repair_Text, target.name)
add_text(d_text)
end
wait
end
#--------------------------------------------------------------------------
# ● アイテムによる武器回数回復の実行
#--------------------------------------------------------------------------
def item_weapon_repair(target, item)
e_item = item.note.scan(/<武器回復[::](0|-?\d+),(\d+),(\d+)>/)
e_item.flatten!#配列をフラットにする[1,[2]]を[1,2]へ
unless e_item == nil or e_item.empty?
weapon_id = e_item[0].to_i # メモ欄の武器ID
weapon_index = e_item[1].to_i # メモ欄の装備ヶ所
repair_num = e_item[2].to_i # メモ欄の回復数
# 同じ武器が装備中かどうかチェック
i = 0 # 装備ヶ所
for equip in target.weapons
# 武器IDが同じで装備ヶ所も同じなら回復処理
if equip.id == weapon_id and i == weapon_index
equip.weapon_repair(repair_num)
return true
elsif weapon_id == -1 and i == weapon_index
# 武器ID指定がないなら指定量だけ装備ヶ所の武器回数を回復
equip.weapon_repair(repair_num)
return true
end
i += 1
end
end
return false
end
#--------------------------------------------------------------------------
# ● HP ダメージ表示
#--------------------------------------------------------------------------
alias ed_break_equip_display_hp_damage display_hp_damage
def display_hp_damage(target, item)
ed_break_equip_display_hp_damage(target, item)
return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
if target.result.hp_damage > 0 && target.result.hp_drain == 0
# 装備破壊テキストを追加
d_text = target.result.equip_damage_text
if d_text =~ /#{Vocab::Equip_Damage}/
$game_troop.screen.start_flash(Color.new(255,255,0),10)
Audio.se_play(EQUIP_DAMAGE_SE,100,100)
elsif d_text =~ /#{Vocab::Equip_Break}/
$game_troop.screen.start_flash(Color.new(255,50,50),10)
Audio.se_play(EQUIP_BREAK_SE,100,100)
end
add_text(d_text) unless d_text.empty?
end
wait
end
end
#==============================================================================
# ■ Window_ActorName
#------------------------------------------------------------------------------
# アクター名を表示するウィンドウです。
#==============================================================================
class Window_ActorName < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● アクターの設定
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_actor_name(@actor, 0, 0)
end
end
#==============================================================================
# ■ Window_YesNoCommand
#------------------------------------------------------------------------------
# はい・いいえを選択するウィンドウです。
#==============================================================================
class Window_YesNoCommand < Window_HorzCommand
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, window_width)
@window_width = window_width
super(x, y)
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
@window_width
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
add_command("はい", :ok)
add_command("いいえ", :cancel)
end
end
#==============================================================================
# ■ Window_ItemList
#------------------------------------------------------------------------------
# アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
alias ed_weapon_count_draw_item draw_item
def draw_item(index)
item = @data[index]
unless item.is_a?(RPG::Item)
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
#draw_item_number(rect, item)
end
else
ed_weapon_count_draw_item(index)
end
end
end
#==============================================================================
# ■ Window_RepairEquipSlot
#------------------------------------------------------------------------------
# 装備画面で、アクターが現在装備している武器を表示するウィンドウです。
#==============================================================================
class Window_RepairEquipSlot < Window_EquipSlot
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, atk_count = false)
super(x, y, width)
@actor = nil
@atk_count = atk_count
refresh
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
if @atk_count
return @actor ? @actor.weapons.size : 0
else
return @actor ? @actor.equip_slots.size : 0
end
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
if @atk_count
return @actor ? @actor.weapons[index] : nil
else
return @actor ? @actor.equips[index] : nil
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
return unless @actor
rect = item_rect_for_text(index)
change_color(system_color, enable?(index))
draw_text(rect.x, rect.y, 92, line_height, slot_name(index))
if @atk_count
draw_item_name(@actor.weapons[index], rect.x + 92, rect.y, enable?(index))
else
draw_item_name(@actor.equips[index], rect.x + 92, rect.y, enable?(index))
end
end
#--------------------------------------------------------------------------
# ● アイテム名の描画
# enabled : 有効フラグ。false のとき半透明で描画
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, enabled = true, width = 172)
return unless item
draw_icon(item.icon_index, x, y, enabled)
change_color(normal_color, enabled)
draw_text(x + 24, y, width, line_height, item.name)
if @atk_count
# 武器回数回復の場合は回数を
now = item.weapon_atk_count == 999 ? "------" : item.weapon_atk_count.to_s
max = item.weapon_atk_count_max == 999 ? "------" : item.weapon_atk_count_max.to_s
draw_text(x + 48 + width , y, width, line_height, now)
draw_text(x + 112 + width, y, 22, line_height, "/", 1)
draw_text(x + 144 + width , y, width, line_height, max)
else
# 回数回復じゃない場合は状態を
equip_state_text_color(item)
draw_text(x + 48 + width , y, width, line_height, item.equip_state[2])
end
end
end
#==============================================================================
# ■ Window_WeaponRepairCommand
#------------------------------------------------------------------------------
# ショップ画面で、購入/売却を選択するウィンドウです。
#==============================================================================
class Window_WeaponRepairCommand < Window_HorzCommand
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(window_width, purchase_only)
@window_width = window_width
@purchase_only = purchase_only
super(0, 0)
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
@window_width
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return 3
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
add_command(Vocab::FULL_REPAIR_UNIT, :all)
add_command(Vocab::REPAIR_UNIT, :select, !@purchase_only)
add_command(Vocab::ShopCancel, :cancel)
end
end
#==============================================================================
# ■ Window_RepairShopNumber
#------------------------------------------------------------------------------
# リペアショップ画面で、個数を入力するウィンドウです。
#==============================================================================
class Window_RepairShopNumber < Window_ShopNumber
#--------------------------------------------------------------------------
# ● アイテム、最大個数、価格、通貨単位の設定
#--------------------------------------------------------------------------
def set(item, max, price, currency_unit = nil)
super(item, max, price, currency_unit)
@number = 0
refresh
end
#--------------------------------------------------------------------------
# ● 個数の変更
#--------------------------------------------------------------------------
def change_number(amount)
@number = [[@number + amount, @max].min, 0].max
end
end
if $ed_rgss3["ed_equip_extension"]
#==============================================================================
# ■ Window_BattleWeapon
#------------------------------------------------------------------------------
# 戦闘画面で武器を一覧を表示するウィンドウです。
#==============================================================================
class Window_BattleWeapon < Window_Command
#--------------------------------------------------------------------------
# ● 武器コマンドをリストに追加
#--------------------------------------------------------------------------
def add_weapon_command
@actor.weapon_number.times{|i|
item = @actor.weapons[i]
name = item == nil ? "" : item.name
# 武器回数を追加表示。
unless item == nil
name += item.weapon_atk_count == 999 ? "" : " : " + item.weapon_atk_count.to_s
enabled = @actor.attack_usable? ? item.weapon_atk_count > 0 ? true : false : false
else
enabled = true
end
add_command(name, :attack, enabled)}
end
#--------------------------------------------------------------------------
# ● 決定ボタンが押されたときの処理
#--------------------------------------------------------------------------
alias ed_weapon_count_process_ok process_ok
def process_ok
unless @actor.use_weapon_count(index,true)
# 武器を使用可能かテストしてダメなら戻る。
Sound.play_buzzer
else
ed_weapon_count_process_ok
end
end
#--------------------------------------------------------------------------
# ● SHIFTボタンが押されたときの処理
#--------------------------------------------------------------------------
alias ed_weapon_count_process_shift process_shift
def process_shift
unless @actor.use_weapon_count(index,true)
# 武器を使用可能かテストしてダメなら戻る。
Sound.play_buzzer
else
ed_weapon_count_process_shift
end
end
end
end#$ed_rgss3["ed_equip_extension"]
#==============================================================================
# ■ Window_Repair
#------------------------------------------------------------------------------
# ショップ画面で回復する武器弾数や防具耐久度の装備一覧表示のウィンドウです。
#==============================================================================
class Window_Repair < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x,y,height,actor,atk_count=false)
super(x, y, window_width, height)
@actor = actor
@atk_count = atk_count
clear_list
unselect
activate
end
#--------------------------------------------------------------------------
# ● アクターの設定
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● リストに追加
#--------------------------------------------------------------------------
def add_list(value)
@repair_list << value
end
#--------------------------------------------------------------------------
# ● リストをクリア
#--------------------------------------------------------------------------
def clear_list
@repair_list = []
@number = 0
@item = nil
@all_repair = false
all_weapon_repair_price if @atk_count
all_equips_repair_price unless @atk_count
end
#--------------------------------------------------------------------------
# ● 全装備回復フラグ
#--------------------------------------------------------------------------
def all_repair=(value)
@all_repair = value
refresh
end
def all_repair; @all_repair; end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return Graphics.width
end
#--------------------------------------------------------------------------
# ● スロットウィンドウの設定
#--------------------------------------------------------------------------
def slot_window=(slot_window)
@slot_window = slot_window
end
#--------------------------------------------------------------------------
# ● ナンバーウィンドウの設定
#--------------------------------------------------------------------------
def number_window=(number_window)
@number_window = number_window
end
#--------------------------------------------------------------------------
# ● ナンバーウィンドウの回復弾数取得
#--------------------------------------------------------------------------
def number
@number = @atk_count ? @number_window.number : 1
@item = @slot_window.item
@all_repair = false
if @atk_count
t_price = @item == nil ? 0 : @item.weapon_atk_count_price
else
t_price = @item == nil ? 0 : @item.durability_price
end
@repair_list[@slot_window.index] = [@number, t_price * @number]
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_equipments(0,0)
end
#--------------------------------------------------------------------------
# ● 装備品詳細の描画
#--------------------------------------------------------------------------
def draw_equipments(x, y)
i = 0 # 装備のインデックス
y2 = 0 # 表示座標の行数
@actor.equips.each do |item|
next if item == nil
# 武器回数回復の場合は防具を処理しない。
next if not item.is_a?(RPG::Weapon) and @atk_count
# 個別回復でスロットウィンドウのアイテムと装備のアイテムが違う場合
next if not @all_repair and @item != item
j = y + (line_height * y2)
draw_item_name(item, x, j)
draw_price(item, x + Graphics.width / 2, j, i)
i += 1
y2 += 1
end
# 合計の描画
draw_text(x, y + line_height * (y2 + 1), 44, line_height, "合計", 1)
draw_currency_value(price,currency_unit,x,y + line_height * (y2 + 1),
window_width - (standard_padding * 2))
end
#--------------------------------------------------------------------------
# ● 回復個数及び価格描画
#--------------------------------------------------------------------------
def draw_price(item, x, y, index)
return if @repair_list.empty?
return if @repair_list[index] == nil
return unless item
change_color(normal_color)
count = @repair_list[index][0] if @atk_count
price = @repair_list[index][1]
if @atk_count
# 武器の場合は回復回数を描画
draw_text(x, y, 44, line_height, count.to_s + Vocab::COUNT_UNIT, 1)
else
# 他は耐久力の状態を描画
text = item.equip_state[2]
equip_state_text_color(item)
draw_text(x, y, 44, line_height, text, 1)
change_color(normal_color)
end
draw_text(x + 88, y, 44, line_height, price.to_s + currency_unit, 2)
end
#--------------------------------------------------------------------------
# ● 商品の値段を取得
#--------------------------------------------------------------------------
def price
@repair_list ||= []
return 0 if @repair_list.empty?
@repair_list.inject(0) {|r,item|
next unless item
r ||= 0
r + item[1]}
end
#--------------------------------------------------------------------------
# ● 全武装回復の弾数の価格取得
#--------------------------------------------------------------------------
def all_weapon_repair_price
result = 0
@actor.weapons.each do |item|
i = item == nil ? 0 : item.weapon_atk_count_max - item.weapon_atk_count
r = item == nil ? 0 : i * item.weapon_atk_count_price
result += r
add_list([i, r])
end
refresh
return result
end
#--------------------------------------------------------------------------
# ● 全装備の耐久力の価格取得
#--------------------------------------------------------------------------
def all_equips_repair_price
result = 0
@actor.equips.each do |item|
i = 0
r = item == nil ? 0 : item.durability_price
result += r
add_list([i, r])
end
refresh
return result
end
#--------------------------------------------------------------------------
# ● 選択項目の有効状態を取得
#--------------------------------------------------------------------------
def current_item_enabled?
return $game_party.gold >= self.price && self.price > 0
end
#--------------------------------------------------------------------------
# ● 通貨単位の取得
#--------------------------------------------------------------------------
def currency_unit
Vocab::currency_unit
end
end
#==============================================================================
# ■ Window_Equip_Contents_Custom
#------------------------------------------------------------------------------
# 改造するアイテムの詳細を表示するヘルプウィンドウです。
#==============================================================================
class Window_Equip_Contents_Custom < Window_Selectable
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :slot_window # スロットウィンドウ
attr_reader :number_window # ナンバーウィンドウ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, window_width, Graphics.height - y)
@new_item = nil
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return 208
end
#--------------------------------------------------------------------------
# ● 表示行数の取得
#--------------------------------------------------------------------------
def visible_line_number
return 4
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
return 4
end
#--------------------------------------------------------------------------
# ● フォントを小さくする
#--------------------------------------------------------------------------
def make_font_smaller
contents.font.size -= 4 if contents.font.size >= 16
end
#--------------------------------------------------------------------------
# ● アイテム詳細の描画
#--------------------------------------------------------------------------
def draw_item_contents(item, new_param=false)
return unless item
draw_item_name(item, 0, 0) unless new_param
draw_right_arrow(new_param_x) if new_param
draw_equip_all_param(new_param)
draw_equip_durability(0, line_height * 9,item, new_param)
draw_equip_weapon_atk_count(0, line_height * 10,item, new_param)
if $ed_rgss3["ed_equip_extension"]
draw_item_weight(0, line_height * 11,item, new_param)
draw_equipment_ep_cost(item, 0 , line_height * 12, new_param)
end
end
#--------------------------------------------------------------------------
# ● 全能力値の描画
#--------------------------------------------------------------------------
def draw_equip_all_param(new_param=false)
item = new_param ? @new_item : @item
8.times{|i|# 8 はtimesが0からself -1までだから。
h = (i + 1) * line_height
draw_equip_param(item, 0, h, i, new_param)}
end
#--------------------------------------------------------------------------
# ● 能力値の描画
#--------------------------------------------------------------------------
def draw_equip_param(item, x, y, param_id, new_param=false)
x += new_param_x if new_param
plus_x = new_param ? 36 : 50
change_color(system_color)
draw_text(x, y, 42, line_height, params_text_short(param_id)) unless new_param
change_color(normal_color)
draw_text(x + plus_x, y, 42, line_height, item.params[param_id], 2)
end
#--------------------------------------------------------------------------
# ● 装備重量の描画
#--------------------------------------------------------------------------
def draw_item_weight(x, y, item, new_param=false)
x += new_param_x if new_param
plus_x = new_param ? 36 : 50
change_color(system_color)
draw_text(x, y, 42, line_height, ED::Equip_extension::VOCAB_WEIGHT) unless new_param
change_color(normal_color)
draw_text(x + plus_x, y, 42, line_height, item.equip_weight, 2)
end
#--------------------------------------------------------------------------
# ● 消費 EP の描画
# item : 武器 or 防具
# rect : 描画する領域
# enabled : 許可状態
#--------------------------------------------------------------------------
def draw_equipment_ep_cost(item, x, y, new_param=false)
return unless ED::Equip_extension::USE_EP_SYSTEM
return if item == nil
x += new_param_x if new_param
plus_x = new_param ? 36 : 50
change_color(system_color)
draw_text(x, y, 42, line_height, ED::Equip_extension::VOCAB_EP) unless new_param
change_color(normal_color)
draw_text(x + plus_x , y, 42, line_height, item.ep_cost, 2)
end
#--------------------------------------------------------------------------
# ● 装備レベルの描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
# item : 装備品
#--------------------------------------------------------------------------
def draw_equip_level(x,y,item, new_param=false)
return unless ED::Equip_extension::USE_EQUIP_LEVEL_SYSTEM
x += new_param_x if new_param
plus_x = new_param ? 36 : 50
change_color(system_color)
draw_text(x, y, 36, line_height, Vocab::equip_level) unless new_param
change_color(normal_color)
draw_text(x + plus_x, y, 42, line_height, item.equip_level, 2)
end
#--------------------------------------------------------------------------
# ● 装備耐久力の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
# item : 装備品
#--------------------------------------------------------------------------
def draw_equip_durability(x,y,item, new_param=false)
x += new_param_x if new_param
plus_x = new_param ? 36 : 50
change_color(system_color)
draw_text(x, y, 36, line_height, Vocab::Equip_Durability) unless new_param
change_color(normal_color)
text = item.durability_max >= 9999999 ? "------" : item.durability_max
draw_text(x + plus_x, y, 42, line_height, text, 2)
end
#--------------------------------------------------------------------------
# ● 武器攻撃回数の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
# item : 装備品
#--------------------------------------------------------------------------
def draw_equip_weapon_atk_count(x,y,item, new_param=false)
x += new_param_x if new_param
plus_x = new_param ? 36 : 50
change_color(system_color)
draw_text(x, y, 36, line_height, Vocab::DESCRIPTION_ATK_CNT) unless new_param
return unless item.is_a?(RPG::Weapon)
change_color(normal_color)
text = item.weapon_atk_count_max >= 999 ? "------" : item.weapon_atk_count_max
draw_text(x + plus_x, y, 42, line_height, text, 2)
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(x, y, item)
draw_current_param(item)
draw_right_arrow(x + 126, y)
draw_current_param(@new_item, true) if @new_item
end
#--------------------------------------------------------------------------
# ● 能力値の名前を描画
#--------------------------------------------------------------------------
def draw_param_name(x, y, param_id)
change_color(system_color)
draw_text(x, y, 80, line_height, Vocab::param(param_id))
end
#--------------------------------------------------------------------------
# ● 右向き矢印を描画
#--------------------------------------------------------------------------
def draw_right_arrow(x=0)
change_color(system_color)
13.times{|i|
next if i == 0
next if i > 10 unless $ed_rgss3["ed_equip_extension"]
y = i * line_height
draw_text(x, y, 22, line_height, "→", 1)}
end
#--------------------------------------------------------------------------
# ● 新しいパラメータの表示基準X座標
#--------------------------------------------------------------------------
def new_param_x
return window_width / 2
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
@item = @slot_window.item
refresh
end
#--------------------------------------------------------------------------
# ● ナンバーウィンドウの改造レベル取得
#--------------------------------------------------------------------------
def number
@number = @number_window.number
refresh
end
#--------------------------------------------------------------------------
# ● 改造後用アイテムの設定
#--------------------------------------------------------------------------
def set_new_item(item)
@new_item = item
refresh
end
#--------------------------------------------------------------------------
# ● 改造後用アイテムの取得
#--------------------------------------------------------------------------
def new_item
@new_item = @number_window.item
refresh
end
#--------------------------------------------------------------------------
# ● スロットウィンドウの設定
#--------------------------------------------------------------------------
def slot_window=(slot_window)
@slot_window = slot_window
end
#--------------------------------------------------------------------------
# ● ナンバーウィンドウの設定
#--------------------------------------------------------------------------
def number_window=(number_window)
@number_window = number_window
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_item_contents(@item,false)
draw_item_contents(@new_item,true) if @new_item
end
#--------------------------------------------------------------------------
# ● カーソルが移動しているか?
#--------------------------------------------------------------------------
def other_window_cursor_movable?
return true if @slot_window and @slot_window.cursor_movable?
return true if @number_window and @number_window.cursor_movable?
return false
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
item if other_window_cursor_movable?
end
#--------------------------------------------------------------------------
# ● 装備変更後の一時アクター設定
#--------------------------------------------------------------------------
def set_temp_actor(temp_actor)
return
end
end
if $ed_rgss3["ed_equip_extension"]
#==============================================================================
# ■ Window_BattleWeapon
#------------------------------------------------------------------------------
# 戦闘画面で武器を一覧を表示するウィンドウです。
#==============================================================================
class Window_BattleWeapon < Window_Command
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
equip_state_text_color(item)
draw_text(item_rect_for_text(index), command_name(index), alignment)
end
#--------------------------------------------------------------------------
# ● 選択項目の有効状態を取得
#--------------------------------------------------------------------------
def current_item_enabled?
return (item == nil ? true : item.equip_state[2] != Vocab::Equip_Break)
end
#--------------------------------------------------------------------------
# ● 決定ボタンが押されたときの処理
#--------------------------------------------------------------------------
def process_ok
if current_item_enabled?
Sound.play_ok
Input.update
deactivate
call_ok_handler
else
Sound.play_buzzer
activate
end
end
#--------------------------------------------------------------------------
# ● SHIFTボタンが押されたときの処理
#--------------------------------------------------------------------------
def process_shift
if wp_skill_enabled?
select(@index)
Sound.play_ok
Input.update
deactivate
call_handler(:wp_skill)
else
Sound.play_buzzer
activate
end
end
end
end#$ed_rgss3["ed_equip_extension"]
#============================================================================== # ☆VXAce RGSS3 「個別装備アイテム:Scene」☆ # EnDlEss DREamER # URL:[url]http://mitsu-evo.6.ql.bz/[/url] # 製作者 mitsu-evo # Last:2014/4/22 # 武器防具1個ずつに耐久度や弾数・改造度などを設定する。 # ▼ 「個別装備アイテム:設定」「Game」「Window」「Scene」の順で導入 #============================================================================== #============================================================================== # ■ Scene_Shop #------------------------------------------------------------------------------ # ショップ画面の処理を行うクラスです。 #============================================================================== class Scene_Shop < Scene_MenuBase #-------------------------------------------------------------------------- # ● 売却の実行 #-------------------------------------------------------------------------- alias ed_weapon_count_do_sell do_sell def do_sell(number) ed_weapon_count_do_sell(number) repair(number) end #-------------------------------------------------------------------------- # ● 最大売却可能個数の取得 #-------------------------------------------------------------------------- def max_sell # 武器防具なら1個ずつ売却していく。 return 1 if @item.is_a?(RPG::Weapon) or @item.is_a?(RPG::Armor) return $game_party.item_number(@item) end #-------------------------------------------------------------------------- # ● 売却時に装備を回復しておく #-------------------------------------------------------------------------- def repair(number) items = @item.is_a?(RPG::Weapon) ? $game_party.weapons[@item.id] : $game_party.armors[@item.id] unless @item.ed_item_key == nil # 指定アイテムがキーを保持しているなら優先処理 @item.param_save_load(false) @item.initialize_add_params return end # キーを保持していない場合の処理は末尾のアイテムから処理。 item_number = items.size min = item_number - number # 最大所持数から売却個数を引いて残りを算出。所持最大数から最小まで処理。 item_number.downto(min){|num| eq = item[num] next if eq == nil eq.param_save_load(false) eq.initialize_add_params } end end #============================================================================== # ■ Scene_ItemBase #------------------------------------------------------------------------------ # アイテム画面とスキル画面の共通処理を行うクラスです。 #============================================================================== class Scene_ItemBase < Scene_MenuBase #-------------------------------------------------------------------------- # ● アイテムをアクターに対して使用 #-------------------------------------------------------------------------- def use_item_to_actors item_target_actors.each do |target| item.repeats.times { target.item_apply(user, item) item_repair(target) item_weapon_repair(target) } end end #-------------------------------------------------------------------------- # ● 修理の実行 #-------------------------------------------------------------------------- def item_repair(target) # ターゲットがアクターでないなら処理を中断 return unless target.is_a?(Game_Actor) e_item = item.note.scan(/<修理>/) e_item.flatten!#配列をフラットにする[1,[2]]を[1,2]へ unless e_item == nil or e_item.empty? # 修理アイテムなら壊れていない装備の耐久力を元に戻す。 target.equips.each{|item| item.durability_repair} end end #-------------------------------------------------------------------------- # ● アイテムによる武器回数回復の実行 #-------------------------------------------------------------------------- def item_weapon_repair(target) e_item = item.note.scan(/<武器回復[::](0|-?\d+),(\d+)>/) e_item.flatten!#配列をフラットにする[1,[2]]を[1,2]へ unless e_item == nil or e_item.empty? weapon_id = e_item[0].to_i # メモ欄の武器ID weapon_index = e_item[1].to_i # メモ欄の装備ヶ所 # 同じ武器が装備中かどうかチェック i = 0 # 装備ヶ所 for equip in target.weapons # 武器IDが同じで装備ヶ所も同じなら回復処理 if equip.id == weapon_id and i == weapon_index equip.weapon_repair(item.base_damage) return true elsif weapon_id == -1 and i == weapon_index # 武器ID指定がないなら指定量だけ装備ヶ所の武器回数を回復 equip.weapon_repair(item.damage) return true end i += 1 end end return false end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ # バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 武器スロット選択判定(エネミー専用) #-------------------------------------------------------------------------- def use_slot_attack?(item) return false unless item return false unless item.is_a?(RPG::Skill) return false if @subject.actor? return false if @subject.using_weapon == nil return true if item.ed_slot_attack? if @subject.using_weapon.weapon_atk_count == 0 # 選択スロットの武器使用回数が0の場合はメイン武器を使用する。 @subject.select_weapon = 0 @subject.set_attack return false end return false end #-------------------------------------------------------------------------- # ● スキル/アイテムの使用 #-------------------------------------------------------------------------- alias ed_weapon_count_use_item use_item def use_item ed_weapon_count_use_item index = $ed_rgss3["ed_equip_extension"] ? @subject.select_weapon : 0 item = @subject.current_action.item weapon_count_attack(item) end #-------------------------------------------------------------------------- # ● 個別装備武器攻撃処理 #-------------------------------------------------------------------------- def weapon_count_attack(item) # アイテムか防御ならば武器回数消費を行わない。 # スキルの場合はスキル使用でも回数を消費する。 flag = use_slot_attack(item) if $ed_rgss3["ed_equip_extension"] flag = false if item.is_a?(RPG::Item) or @subject.current_action.guard? @subject.use_weapon unless flag end end #============================================================================== # ■ Scene_Repair #------------------------------------------------------------------------------ # 武器回数や耐久力回復の処理を行うクラスです。 #============================================================================== class Scene_Repair < Scene_MenuBase #-------------------------------------------------------------------------- # ● 準備 #-------------------------------------------------------------------------- def prepare(atk_count=true) @atk_count = atk_count # 武器回数が有効か?無効なら耐久力回復 end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_help_window create_gold_window create_command_window create_dummy_window create_name_window create_number_window create_slot_window create_status_window create_repair_window create_choice_window end #-------------------------------------------------------------------------- # ● アクターの名前ウィンドウの作成 #-------------------------------------------------------------------------- def create_name_window wx = Graphics.width - @gold_window.width wy = @help_window.height ww = Graphics.width - @command_window.width wh = @gold_window.height @name_window = Window_ActorName.new(wx, wy, ww, wh, @actor) @name_window.viewport = @viewport end #-------------------------------------------------------------------------- # ● ゴールドウィンドウの作成 #-------------------------------------------------------------------------- def create_gold_window @gold_window = Window_Gold.new @gold_window.viewport = @viewport @gold_window.x = Graphics.width - @gold_window.width @gold_window.y = Graphics.height - @gold_window.height end #-------------------------------------------------------------------------- # ● 修復決定ウィンドウの作成 #-------------------------------------------------------------------------- def create_choice_window wx = 0 wy = Graphics.height - @gold_window.height ww = Graphics.width - @gold_window.width @choice_window = Window_YesNoCommand.new(wx, wy, ww) @choice_window.set_handler(:ok, method(:on_repair_ok)) @choice_window.set_handler(:cancel, method(:on_repair_cancel)) @choice_window.hide.deactivate end #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_command_window @command_window = Window_WeaponRepairCommand.new(@gold_window.x, @purchase_only) @command_window.viewport = @viewport @command_window.y = @help_window.height @command_window.set_handler(:all, method(:command_full_repair)) @command_window.set_handler(:select, method(:command_slot_repair)) @command_window.set_handler(:cancel, method(:return_scene)) @command_window.set_handler(:pagedown, method(:next_actor)) @command_window.set_handler(:pageup, method(:prev_actor)) end #-------------------------------------------------------------------------- # ● ダミーウィンドウの作成 #-------------------------------------------------------------------------- def create_dummy_window wy = @command_window.y + @command_window.height wh = Graphics.height - wy - @gold_window.height @dummy_window = Window_Base.new(0, wy, Graphics.width, wh) @dummy_window.viewport = @viewport end #-------------------------------------------------------------------------- # ● 個数入力ウィンドウの作成 #-------------------------------------------------------------------------- def create_number_window wy = @dummy_window.y wh = @dummy_window.height @number_window = Window_RepairShopNumber.new(0, wy, wh) @number_window.viewport = @viewport @number_window.hide @number_window.set_handler(:ok, method(:on_number_ok)) @number_window.set_handler(:cancel, method(:on_number_cancel)) end #-------------------------------------------------------------------------- # ● 修復ウィンドウの作成 #-------------------------------------------------------------------------- def create_repair_window # 装備修復ウィンドウも作成。 wy = @dummy_window.y wh = @dummy_window.height @repair_window = Window_Repair.new(0,wy,wh,@actor, @atk_count) @repair_window.viewport = @viewport @repair_window.hide @repair_window.number_window = @number_window @repair_window.slot_window = @slot_window end #-------------------------------------------------------------------------- # ● ステータスウィンドウの作成 #-------------------------------------------------------------------------- def create_status_window wx = @slot_window.width wy = @dummy_window.y @status_window = Window_Equip_Contents_Custom.new(wx, wy)#, ww, wh) @status_window.viewport = @viewport @status_window.hide end #-------------------------------------------------------------------------- # ● 装備スロットウィンドウの作成 #-------------------------------------------------------------------------- def create_slot_window wx = @number_window.width ww = Graphics.width wy = @dummy_window.y @slot_window = Window_RepairEquipSlot.new(0, wy, ww, @atk_count)#wh, @goods) @slot_window.actor = @actor @slot_window.viewport = @viewport @slot_window.help_window = @help_window @slot_window.status_window = @status_window @slot_window.hide @slot_window.set_handler(:ok, method(:on_slot_repair_ok)) @slot_window.set_handler(:cancel, method(:on_slot_repair_cancel)) @slot_window.set_handler(:pagedown, method(:next_actor)) @slot_window.set_handler(:pageup, method(:prev_actor)) end #-------------------------------------------------------------------------- # ● 装備スロットウィンドウのアクティブ化 #-------------------------------------------------------------------------- def activate_slot_window @slot_window.show.activate @status_window.show end #-------------------------------------------------------------------------- # ● ウィンドウの非アクティブ化 #-------------------------------------------------------------------------- def deactivate_all_window @gold_window.refresh @status_window.refresh @slot_window.hide.deactivate @number_window.hide.deactivate @repair_window.hide.deactivate @choice_window.hide.deactivate @command_window.activate @help_window.clear @number_window.hide end #-------------------------------------------------------------------------- # ● コマンド[全武装満タン] #-------------------------------------------------------------------------- def command_full_repair @dummy_window.hide activate_full_repair_window end #-------------------------------------------------------------------------- # ● コマンド[個別に回復] #-------------------------------------------------------------------------- def command_slot_repair @dummy_window.hide @slot_window.show.activate @slot_window.select(0) @repair_window.all_repair = false end #-------------------------------------------------------------------------- # ● 個別回復スロット[決定] #-------------------------------------------------------------------------- def on_slot_repair_ok @item = @slot_window.item if max_atk_count == 0 or @item == nil Sound.play_buzzer @dummy_window.show @slot_window.hide.deactivate @command_window.activate return end if @atk_count @number_window.set(@item, max_atk_count, buying_price, currency_unit) @number_window.show.activate else on_number_ok end @slot_window.hide.deactivate end #-------------------------------------------------------------------------- # ● 個別回復スロット[キャンセル] #-------------------------------------------------------------------------- def on_slot_repair_cancel @command_window.activate @dummy_window.show @slot_window.hide.deactivate @status_window.hide @help_window.clear end #-------------------------------------------------------------------------- # ● 個数入力[決定] #-------------------------------------------------------------------------- def on_number_ok case @command_window.current_symbol when :select @slot_window.hide.deactivate @repair_window.number @repair_window.show @repair_window.unselect @choice_window.show.activate end end #-------------------------------------------------------------------------- # ● 個数入力[キャンセル] #-------------------------------------------------------------------------- def on_number_cancel Sound.play_cancel end_number_input end #-------------------------------------------------------------------------- # ● 個数入力の終了 #-------------------------------------------------------------------------- def end_number_input @number_window.hide case @command_window.current_symbol when :all activate_full_repair_window when :select activate_slot_window end end #-------------------------------------------------------------------------- # ● 修復ウィンドウ[決定] #-------------------------------------------------------------------------- def on_repair_ok if @repair_window.price == 0 Sound.play_buzzer deactivate_all_window return end Sound.play_shop case @command_window.current_symbol when :all do_all_repair when :select do_repair(@number_window.number) end deactivate_all_window end #-------------------------------------------------------------------------- # ● 修復ウィンドウ[キャンセル] #-------------------------------------------------------------------------- def on_repair_cancel #Sound.play_cancel @repair_window.clear_list @repair_window.hide.deactivate case @command_window.current_symbol when :all on_slot_repair_cancel @choice_window.hide.deactivate when :select on_slot_repair_ok @repair_window.hide.deactivate @choice_window.hide.deactivate end_number_input end @dummy_window.show end #-------------------------------------------------------------------------- # ● 個別回復の実行 #-------------------------------------------------------------------------- def do_repair(number=0) $game_party.lose_gold(number * buying_price) if @atk_count @item.weapon_atk_count += number if @item.weapon_atk_count > @item.weapon_atk_count_max @item.weapon_atk_count = @item.weapon_atk_count_max end else # 耐久力 @item.durability_repair end end #-------------------------------------------------------------------------- # ● 全回復の実行 #-------------------------------------------------------------------------- def do_all_repair if @atk_count do_weapon_atk_all_repair else do_durability_all_repair end end #-------------------------------------------------------------------------- # ● コマンド選択画面で全員満タンを選択した時 #-------------------------------------------------------------------------- def activate_full_repair_window @repair_window.show @repair_window.unselect @choice_window.show.activate @repair_window.all_repair = true end #-------------------------------------------------------------------------- # ● 全武装回数回復処理 #-------------------------------------------------------------------------- def do_weapon_atk_all_repair @actor.weapons.each do |item| next unless item item.weapon_repair end end #-------------------------------------------------------------------------- # ● 全装備耐久力回復処理 #-------------------------------------------------------------------------- def do_durability_all_repair @actor.equips.each do |item| next unless item item.durability_repair end end #-------------------------------------------------------------------------- # ● 最大購入可能個数の取得 #-------------------------------------------------------------------------- def max_buy max = @item == nil ? 0 : @item.weapon_atk_count_max end #-------------------------------------------------------------------------- # ● 最大回復弾数 #-------------------------------------------------------------------------- def max_atk_count return -1 unless @atk_count max = @item == nil ? 0 : @item.weapon_atk_count_max max -= @item == nil ? 0 : @item.weapon_atk_count return max end #-------------------------------------------------------------------------- # ● 所持金の取得 #-------------------------------------------------------------------------- def money @gold_window.value end #-------------------------------------------------------------------------- # ● 通貨単位の取得 #-------------------------------------------------------------------------- def currency_unit @gold_window.currency_unit end #-------------------------------------------------------------------------- # ● 買値の取得 #-------------------------------------------------------------------------- def buying_price @item == nil ? 0 : @item.weapon_atk_count_price end #-------------------------------------------------------------------------- # ● アクターの切り替え #-------------------------------------------------------------------------- def on_actor_change @slot_window.actor = @actor @name_window.actor = @actor @repair_window.clear_list @repair_window.actor = @actor deactivate_all_window end end
#==============================================================================
# ☆VXAce RGSS3 「個別装備アイテム:Scene」☆
# EnDlEss DREamER
# URL:[url]http://mitsu-evo.6.ql.bz/[/url]
# 製作者 mitsu-evo
# Last:2014/4/22
# 武器防具1個ずつに耐久度や弾数・改造度などを設定する。
# ▼ 「個別装備アイテム:設定」「Game」「Window」「Scene」の順で導入
#==============================================================================
#==============================================================================
# ■ Scene_Shop
#------------------------------------------------------------------------------
# ショップ画面の処理を行うクラスです。
#==============================================================================
class Scene_Shop < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 売却の実行
#--------------------------------------------------------------------------
alias ed_weapon_count_do_sell do_sell
def do_sell(number)
ed_weapon_count_do_sell(number)
repair(number)
end
#--------------------------------------------------------------------------
# ● 最大売却可能個数の取得
#--------------------------------------------------------------------------
def max_sell
# 武器防具なら1個ずつ売却していく。
return 1 if @item.is_a?(RPG::Weapon) or @item.is_a?(RPG::Armor)
return $game_party.item_number(@item)
end
#--------------------------------------------------------------------------
# ● 売却時に装備を回復しておく
#--------------------------------------------------------------------------
def repair(number)
items = @item.is_a?(RPG::Weapon) ?
$game_party.weapons[@item.id] : $game_party.armors[@item.id]
unless @item.ed_item_key == nil
# 指定アイテムがキーを保持しているなら優先処理
@item.param_save_load(false)
@item.initialize_add_params
return
end
# キーを保持していない場合の処理は末尾のアイテムから処理。
item_number = items.size
min = item_number - number
# 最大所持数から売却個数を引いて残りを算出。所持最大数から最小まで処理。
item_number.downto(min){|num|
eq = item[num]
next if eq == nil
eq.param_save_load(false)
eq.initialize_add_params }
end
end
#==============================================================================
# ■ Scene_ItemBase
#------------------------------------------------------------------------------
# アイテム画面とスキル画面の共通処理を行うクラスです。
#==============================================================================
class Scene_ItemBase < Scene_MenuBase
#--------------------------------------------------------------------------
# ● アイテムをアクターに対して使用
#--------------------------------------------------------------------------
def use_item_to_actors
item_target_actors.each do |target|
item.repeats.times { target.item_apply(user, item)
item_repair(target)
item_weapon_repair(target) }
end
end
#--------------------------------------------------------------------------
# ● 修理の実行
#--------------------------------------------------------------------------
def item_repair(target)
# ターゲットがアクターでないなら処理を中断
return unless target.is_a?(Game_Actor)
e_item = item.note.scan(/<修理>/)
e_item.flatten!#配列をフラットにする[1,[2]]を[1,2]へ
unless e_item == nil or e_item.empty?
# 修理アイテムなら壊れていない装備の耐久力を元に戻す。
target.equips.each{|item| item.durability_repair}
end
end
#--------------------------------------------------------------------------
# ● アイテムによる武器回数回復の実行
#--------------------------------------------------------------------------
def item_weapon_repair(target)
e_item = item.note.scan(/<武器回復[::](0|-?\d+),(\d+)>/)
e_item.flatten!#配列をフラットにする[1,[2]]を[1,2]へ
unless e_item == nil or e_item.empty?
weapon_id = e_item[0].to_i # メモ欄の武器ID
weapon_index = e_item[1].to_i # メモ欄の装備ヶ所
# 同じ武器が装備中かどうかチェック
i = 0 # 装備ヶ所
for equip in target.weapons
# 武器IDが同じで装備ヶ所も同じなら回復処理
if equip.id == weapon_id and i == weapon_index
equip.weapon_repair(item.base_damage)
return true
elsif weapon_id == -1 and i == weapon_index
# 武器ID指定がないなら指定量だけ装備ヶ所の武器回数を回復
equip.weapon_repair(item.damage)
return true
end
i += 1
end
end
return false
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# バトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 武器スロット選択判定(エネミー専用)
#--------------------------------------------------------------------------
def use_slot_attack?(item)
return false unless item
return false unless item.is_a?(RPG::Skill)
return false if @subject.actor?
return false if @subject.using_weapon == nil
return true if item.ed_slot_attack?
if @subject.using_weapon.weapon_atk_count == 0
# 選択スロットの武器使用回数が0の場合はメイン武器を使用する。
@subject.select_weapon = 0
@subject.set_attack
return false
end
return false
end
#--------------------------------------------------------------------------
# ● スキル/アイテムの使用
#--------------------------------------------------------------------------
alias ed_weapon_count_use_item use_item
def use_item
ed_weapon_count_use_item
index = $ed_rgss3["ed_equip_extension"] ? @subject.select_weapon : 0
item = @subject.current_action.item
weapon_count_attack(item)
end
#--------------------------------------------------------------------------
# ● 個別装備武器攻撃処理
#--------------------------------------------------------------------------
def weapon_count_attack(item)
# アイテムか防御ならば武器回数消費を行わない。
# スキルの場合はスキル使用でも回数を消費する。
flag = use_slot_attack(item) if $ed_rgss3["ed_equip_extension"]
flag = false if item.is_a?(RPG::Item) or @subject.current_action.guard?
@subject.use_weapon unless flag
end
end
#==============================================================================
# ■ Scene_Repair
#------------------------------------------------------------------------------
# 武器回数や耐久力回復の処理を行うクラスです。
#==============================================================================
class Scene_Repair < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 準備
#--------------------------------------------------------------------------
def prepare(atk_count=true)
@atk_count = atk_count # 武器回数が有効か?無効なら耐久力回復
end
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_help_window
create_gold_window
create_command_window
create_dummy_window
create_name_window
create_number_window
create_slot_window
create_status_window
create_repair_window
create_choice_window
end
#--------------------------------------------------------------------------
# ● アクターの名前ウィンドウの作成
#--------------------------------------------------------------------------
def create_name_window
wx = Graphics.width - @gold_window.width
wy = @help_window.height
ww = Graphics.width - @command_window.width
wh = @gold_window.height
@name_window = Window_ActorName.new(wx, wy, ww, wh, @actor)
@name_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# ● ゴールドウィンドウの作成
#--------------------------------------------------------------------------
def create_gold_window
@gold_window = Window_Gold.new
@gold_window.viewport = @viewport
@gold_window.x = Graphics.width - @gold_window.width
@gold_window.y = Graphics.height - @gold_window.height
end
#--------------------------------------------------------------------------
# ● 修復決定ウィンドウの作成
#--------------------------------------------------------------------------
def create_choice_window
wx = 0
wy = Graphics.height - @gold_window.height
ww = Graphics.width - @gold_window.width
@choice_window = Window_YesNoCommand.new(wx, wy, ww)
@choice_window.set_handler(:ok, method(:on_repair_ok))
@choice_window.set_handler(:cancel, method(:on_repair_cancel))
@choice_window.hide.deactivate
end
#--------------------------------------------------------------------------
# ● コマンドウィンドウの作成
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_WeaponRepairCommand.new(@gold_window.x, @purchase_only)
@command_window.viewport = @viewport
@command_window.y = @help_window.height
@command_window.set_handler(:all, method(:command_full_repair))
@command_window.set_handler(:select, method(:command_slot_repair))
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:pagedown, method(:next_actor))
@command_window.set_handler(:pageup, method(:prev_actor))
end
#--------------------------------------------------------------------------
# ● ダミーウィンドウの作成
#--------------------------------------------------------------------------
def create_dummy_window
wy = @command_window.y + @command_window.height
wh = Graphics.height - wy - @gold_window.height
@dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
@dummy_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# ● 個数入力ウィンドウの作成
#--------------------------------------------------------------------------
def create_number_window
wy = @dummy_window.y
wh = @dummy_window.height
@number_window = Window_RepairShopNumber.new(0, wy, wh)
@number_window.viewport = @viewport
@number_window.hide
@number_window.set_handler(:ok, method(:on_number_ok))
@number_window.set_handler(:cancel, method(:on_number_cancel))
end
#--------------------------------------------------------------------------
# ● 修復ウィンドウの作成
#--------------------------------------------------------------------------
def create_repair_window
# 装備修復ウィンドウも作成。
wy = @dummy_window.y
wh = @dummy_window.height
@repair_window = Window_Repair.new(0,wy,wh,@actor, @atk_count)
@repair_window.viewport = @viewport
@repair_window.hide
@repair_window.number_window = @number_window
@repair_window.slot_window = @slot_window
end
#--------------------------------------------------------------------------
# ● ステータスウィンドウの作成
#--------------------------------------------------------------------------
def create_status_window
wx = @slot_window.width
wy = @dummy_window.y
@status_window = Window_Equip_Contents_Custom.new(wx, wy)#, ww, wh)
@status_window.viewport = @viewport
@status_window.hide
end
#--------------------------------------------------------------------------
# ● 装備スロットウィンドウの作成
#--------------------------------------------------------------------------
def create_slot_window
wx = @number_window.width
ww = Graphics.width
wy = @dummy_window.y
@slot_window = Window_RepairEquipSlot.new(0, wy, ww, @atk_count)#wh, @goods)
@slot_window.actor = @actor
@slot_window.viewport = @viewport
@slot_window.help_window = @help_window
@slot_window.status_window = @status_window
@slot_window.hide
@slot_window.set_handler(:ok, method(:on_slot_repair_ok))
@slot_window.set_handler(:cancel, method(:on_slot_repair_cancel))
@slot_window.set_handler(:pagedown, method(:next_actor))
@slot_window.set_handler(:pageup, method(:prev_actor))
end
#--------------------------------------------------------------------------
# ● 装備スロットウィンドウのアクティブ化
#--------------------------------------------------------------------------
def activate_slot_window
@slot_window.show.activate
@status_window.show
end
#--------------------------------------------------------------------------
# ● ウィンドウの非アクティブ化
#--------------------------------------------------------------------------
def deactivate_all_window
@gold_window.refresh
@status_window.refresh
@slot_window.hide.deactivate
@number_window.hide.deactivate
@repair_window.hide.deactivate
@choice_window.hide.deactivate
@command_window.activate
@help_window.clear
@number_window.hide
end
#--------------------------------------------------------------------------
# ● コマンド[全武装満タン]
#--------------------------------------------------------------------------
def command_full_repair
@dummy_window.hide
activate_full_repair_window
end
#--------------------------------------------------------------------------
# ● コマンド[個別に回復]
#--------------------------------------------------------------------------
def command_slot_repair
@dummy_window.hide
@slot_window.show.activate
@slot_window.select(0)
@repair_window.all_repair = false
end
#--------------------------------------------------------------------------
# ● 個別回復スロット[決定]
#--------------------------------------------------------------------------
def on_slot_repair_ok
@item = @slot_window.item
if max_atk_count == 0 or @item == nil
Sound.play_buzzer
@dummy_window.show
@slot_window.hide.deactivate
@command_window.activate
return
end
if @atk_count
@number_window.set(@item, max_atk_count, buying_price, currency_unit)
@number_window.show.activate
else
on_number_ok
end
@slot_window.hide.deactivate
end
#--------------------------------------------------------------------------
# ● 個別回復スロット[キャンセル]
#--------------------------------------------------------------------------
def on_slot_repair_cancel
@command_window.activate
@dummy_window.show
@slot_window.hide.deactivate
@status_window.hide
@help_window.clear
end
#--------------------------------------------------------------------------
# ● 個数入力[決定]
#--------------------------------------------------------------------------
def on_number_ok
case @command_window.current_symbol
when :select
@slot_window.hide.deactivate
@repair_window.number
@repair_window.show
@repair_window.unselect
@choice_window.show.activate
end
end
#--------------------------------------------------------------------------
# ● 個数入力[キャンセル]
#--------------------------------------------------------------------------
def on_number_cancel
Sound.play_cancel
end_number_input
end
#--------------------------------------------------------------------------
# ● 個数入力の終了
#--------------------------------------------------------------------------
def end_number_input
@number_window.hide
case @command_window.current_symbol
when :all
activate_full_repair_window
when :select
activate_slot_window
end
end
#--------------------------------------------------------------------------
# ● 修復ウィンドウ[決定]
#--------------------------------------------------------------------------
def on_repair_ok
if @repair_window.price == 0
Sound.play_buzzer
deactivate_all_window
return
end
Sound.play_shop
case @command_window.current_symbol
when :all
do_all_repair
when :select
do_repair(@number_window.number)
end
deactivate_all_window
end
#--------------------------------------------------------------------------
# ● 修復ウィンドウ[キャンセル]
#--------------------------------------------------------------------------
def on_repair_cancel
#Sound.play_cancel
@repair_window.clear_list
@repair_window.hide.deactivate
case @command_window.current_symbol
when :all
on_slot_repair_cancel
@choice_window.hide.deactivate
when :select
on_slot_repair_ok
@repair_window.hide.deactivate
@choice_window.hide.deactivate
end_number_input
end
@dummy_window.show
end
#--------------------------------------------------------------------------
# ● 個別回復の実行
#--------------------------------------------------------------------------
def do_repair(number=0)
$game_party.lose_gold(number * buying_price)
if @atk_count
@item.weapon_atk_count += number
if @item.weapon_atk_count > @item.weapon_atk_count_max
@item.weapon_atk_count = @item.weapon_atk_count_max
end
else
# 耐久力
@item.durability_repair
end
end
#--------------------------------------------------------------------------
# ● 全回復の実行
#--------------------------------------------------------------------------
def do_all_repair
if @atk_count
do_weapon_atk_all_repair
else
do_durability_all_repair
end
end
#--------------------------------------------------------------------------
# ● コマンド選択画面で全員満タンを選択した時
#--------------------------------------------------------------------------
def activate_full_repair_window
@repair_window.show
@repair_window.unselect
@choice_window.show.activate
@repair_window.all_repair = true
end
#--------------------------------------------------------------------------
# ● 全武装回数回復処理
#--------------------------------------------------------------------------
def do_weapon_atk_all_repair
@actor.weapons.each do |item|
next unless item
item.weapon_repair end
end
#--------------------------------------------------------------------------
# ● 全装備耐久力回復処理
#--------------------------------------------------------------------------
def do_durability_all_repair
@actor.equips.each do |item|
next unless item
item.durability_repair end
end
#--------------------------------------------------------------------------
# ● 最大購入可能個数の取得
#--------------------------------------------------------------------------
def max_buy
max = @item == nil ? 0 : @item.weapon_atk_count_max
end
#--------------------------------------------------------------------------
# ● 最大回復弾数
#--------------------------------------------------------------------------
def max_atk_count
return -1 unless @atk_count
max = @item == nil ? 0 : @item.weapon_atk_count_max
max -= @item == nil ? 0 : @item.weapon_atk_count
return max
end
#--------------------------------------------------------------------------
# ● 所持金の取得
#--------------------------------------------------------------------------
def money
@gold_window.value
end
#--------------------------------------------------------------------------
# ● 通貨単位の取得
#--------------------------------------------------------------------------
def currency_unit
@gold_window.currency_unit
end
#--------------------------------------------------------------------------
# ● 買値の取得
#--------------------------------------------------------------------------
def buying_price
@item == nil ? 0 : @item.weapon_atk_count_price
end
#--------------------------------------------------------------------------
# ● アクターの切り替え
#--------------------------------------------------------------------------
def on_actor_change
@slot_window.actor = @actor
@name_window.actor = @actor
@repair_window.clear_list
@repair_window.actor = @actor
deactivate_all_window
end
end
|
|