#============================================================================ # # ■アクター毎のアイテム所持・スクリプト □Ver2.50 □製作者:月紳士 # ・RPGツクールVX用 RGSS2スクリプト # # ●…書き換えメソッド(競合注意) ◎…メソッドのエイリアス ○…新規メソッド # # ※二次配布禁止!配布元には利用規約があります。必ずそちらを見てください。 #---------------------------------------------------------------------------- # 更新履歴 # Ver2.50 スタックアイテムを自分に渡した際の不具合修正。 # Ver2.49 預かり所の挙動修正。 # Ver2.48 装備時のステータスがベース表示であった為、実値表示に修正。 # Ver2.47 袋内での装備入れ直し時の不具合の修正。 # Ver2.46 使用時アイテム効果装備の効果範囲が単体である場合の不具合修正。 # Ver2.45 貴重品に設定したアイテムが個人へ入手されてしまう不具合の修正。 # Ver2.44 戦闘時アイテム消耗の際・袋の中の装備品表示の際、不具合修正。 # Ver2.43 注釈使用オプション機能整理。呪い解除時の装備破壊の仕様追加。 # Ver2.42 アイテム装備テストの不具合修正。 # Ver2.41 追加スクリプト用の微調整。 # Ver2.40 ドロップアイテム入手処理の仕様変更。 # Ver2.31 防具劣化と戦闘テスト、戦闘中装備変更の不具合修正。 # Ver2.30 アイテム詳細画面に関する仕様調整。 # Ver2.21 捨てる実行時の不具合修正。 # Ver2.20 呪い装備復活。細部調整。 # Ver2.11 装備コマンド使用時の不具合修正とスキルによる劣化を武器にも対応。 # Ver2.10 機能拡張スクリプトに向けての準備。 # 劣化武器・防具を消失時アクション(変化・消失文表示)に対応。 # Ver2.01 前回更新部の不具合修正。 # Ver2.00 ショップによるチャージ充填、アイテム修復機能を追加。 # アイテムチャージ消費量の設定を廃止。 # Game_Actor・Game_Party共通部をモジュール化して内容量削減。 # 追加部位の追加方法等、仕様の変更。 # アイテム毎画面のヘルプ文強化。 # Ver1.23 アイテム減少時の不具合修正。 # Ver1.22 チャージアイテムの売買に関する不具合修正。 # Ver1.21 不具合修正。 # Ver1.20 スタックアイテムの入手に関する仕様変更。防具の劣化の仕様変更。 # Ver1.12 装備品を預ける時の処理の調整。 # Ver1.11 前回アップ時よりの不具合修正と自作スクリプト併用準備。 # Ver1.10 オプション整理とマニュアル追記。 #============================================================================ =begin  このスクリプトは、アイテムシステムを大幅に改造するものです。    RPGツクールVX本来のアイテム管理では   ・パーティー全体で   ・アイテムがあるか、否か(0 ならリストに表示されない)   ・どのアイテムをいくつ持っているか(1〜99)  ということを要点に管理しています。  これを、   ・アクター個々に所持  というスタイルに変更するスクリプトです。 ※ 詳しくはマニュアルをご覧下さい。 #------------------------------------------------------------------------------  <注意!>  アイテムの管理方法に大幅に手を加えているほか、  戦闘時のアイテム使用関連など、上書きしているメソッドも多くあります。  環境に合わせての改変が必須になる上級者向けスクリプトであると言えます。  (単体に近い形での使用をに除く)  他スクリプトとの併用化に関しましては、月紳士で行う予定はありません。  ご自分で改変して使っていただくことを前提として公開しています。  どうかご容赦願います。  ※ ご自分で併用化をなさることのサポートを放棄するわけではありません。  当スクリプトの仕組みなどでわからないことがありましたら  出来る範囲でご相談にのりたいと思います。配布元へご連絡ください。 #------------------------------------------------------------------------------  ※このスクリプトを導入することで   ショップ画面(Scene_Shop)は新設の物(Scene_AIS_Shop)に変更されます。   そして、このスクリプトでは   アイテム画面(Scene_Item) と装備画面(Scene_Equip)の代わりに   新設の個別アイテム画面(Scene_Actor_Item)を使用するのですが…   メニュー画面の改変に関しては特に競合率が高い為、   「アクター毎アイテムを Menu に」という別のスクリプトに分けてあります。   この「アクター毎アイテムを Menu に」をそのまま入れていただければ結構ですが、   他様のメニュー追加系スクリプトをご使用の場合は、   その環境によっては「アクター毎アイテムを Menu に」を使わず、   該当箇所を改変したほうが良いかもしれません。   Scene_Item と Scene_Equip の替わりに、   新設した Scene_Actor_Item がメニューに組み込めればOKです。   ※ Scene_Itemはそのまま「貴重品画面」として流用されています。     貴重品画面を使う場合はScene_Itemもメニューに組み込む必要があります。     (貴重品に関してはマニュアル参照) =end #============================================================================== # □ カスタマイズ項目 #============================================================================== module Actor_Item ITEM_MAX = 10 #→# アイテム所持数の最大数の初期設定。(全キャラクター共通) #-- 袋関連 BAG_MAX = 10 #→# 袋に入れられるアイテムの最大数の初期設定。 BAG_USE = false #→# 袋を表示(使用)するか?の初期設定。 # = true でゲーム開始時から袋が有。= false では開始時には袋がない状態。 BAG_NAME = "ふくろ" #→# 袋の名前の初期設定。"" 内を書き換えてください。 #-- 預かり所関連 KEEP_ITEM_SORT_PRICE = true #→# 預かり所のアイテムを値段順で並び替えするか? # 並び替えする場合 = true / 並び替えしない場合 = false KEEP_ITEM_SORT_KIND = true #→# 預かり所のアイテムを種類別で並び替えするか? # 並び替えする場合 = true / 並び替えしない場合 = false SORT_SHOP = true #→# 上記、預かり所と同じルールでショップの並び替えをするか? # 並び替えする場合 = true / 並び替えしない場合 = false #-- 貴重品関連 # この他にも別スクリプト【アクター毎アイテムを Menu に】にて # カスタマイズ項目があります。(メニューへの登録に関する部分) HIDE_VALUABLES_ONE = true #→# 貴重品ウインドウで、単品の場合の数表示を隠す # = true で単品の個数表示(: 1)がされない。 = false で表示。 VALUABLES_DISPLAY_USE = false #→# 貴重品ウインドウで使用可否を分けて描画する # ※ trueで使用不可アイテムが半透明 = 普通のアイテムウインドウの表示 # false であればすべて濃い色で表示される(使用不可ばかりでも見やすい) # 下の VALUABLES_DISPLAY_SWITCH が true なら切替可。 # その際はこの VALUABLES_DISPLAY_USE がデフォルト表示になる。 VALUABLES_DISPLAY_SWITCH = true #→# 貴重品ウインドウで表示の切替を行えるようにする # = true でShiftキーで使用不可アイテムの半透明を切替出来るようになる。 #-- 装備・戦闘関連 EX_EQUIP = ["追加部位"] #→# 追加部位の名前。"" 内を書き換えてください。 # ※ 部位を追加して名前を付けたい場合は = ["靴", "小手", "マント"] # というように "" で囲んだ名前を , で区切って並べます。 CHANGE_EQUIP_BATTLE = [0, 1, 4, 5] #→# 戦闘中に装備変更を許可する部位。 # [] 内に半角 , で仕切る形で下記の半角数字を。許可する部位だけ記入。 # 0:武器 / 1:盾 / 2:頭 / 3:身体 / 4:装飾品 / 5(以降):追加部位 CHANGE_EQUIP_BATTLE_MODE = true #→# 戦闘中の装備変更のルールを設定します。 # = true / 装備したい武器・防具を使用すると、ターン内で装備を変更します。 # ひとつの変更で1ターンを消費することになります。 # = false / Cボタン(Shiftキー)を押しながら決定ボタンを押すと、 # 装備を変更できます。いくつでもターンは消費しません。 SORT_EQUIP = [0, 1, 2, 3, 4, 5] #→# 装備品の並び順を上記順に変更。アイテムソート時とステータス画面に影響。 # [] 内に半角 , で仕切る形で下記の半角数字を。記入漏れは自動で末尾に追加。 # 0:武器 / 1:盾 / 2:頭 / 3:身体 / 4:装飾品 / 5(以降):追加部位 SHIELD_USE_TYPE = [0] #→# 盾の使用を許可する武器タイプ。 # 0 はタイプ未設定武器。 # ここで設定しなかったタイプの武器を装備すると盾が外れます。(逆もまた然り) EQUIP_SKILL_ICON_CHANGE = true #→# 装備品から習得したスキルのアイコンを装備品のアイコンに変更するか? # = true で変更。 = false でスキル本来のアイコンのまま。 BATTLE_EQUIP_SPEED = 1500 #→# 戦闘中に装備を変更した際の順番が回ってくる速さ。 # 防御した表示の後・通常行動の前にくるようにしています。 HIDE_ELEMENT = [] #→# 装備品の性能表示で隠したい属性のIDを記入します。 # データベース一番上の属性IDが 1 です。[] 内に半角 , で区切って登録。 HIDE_STATE = [] #→# 装備品の性能表示で隠したいステートのIDを記入します。 # データベース一番上の属性IDが 1 です。[] 内に半角 , で区切って登録。 #-- スタックアイテム入手 STACK_ITEM_FRACTION_GAIN = true #→# イベントコマンド・アイテムの増減における、 # スタックアイテムの端数入手(および減少)をするか。 STACK_ITEM_FRACTION_SHOP = true #→# ショップにおいてスタックアイテムの # 端数購入・端数売却を許可するか。 STACK_ITEM_DROP_TYPE = 2 #→# スタックアイテムの、エネミードロップ時の数量決定の形式。(基本設定) # = 0 (スタック最大数) # = 1 (単数) # = 2 (1 〜 最大の1/2のランダム) # = 3 (1 〜 最大の1/3のランダム) # = 4 (1 〜 最大のランダム) #-- 特殊ショップ FILL_COMMAND = "充填する" #→# ショップコマンド:「充填」のコマンド表示 REPAIR_COMMAND = "修復する" #→# ショップコマンド:「修復」のコマンド表示 # 上記、改変用にコマンド部分を抜き出していますが、 # 修復・充填といった用語を変更するならば # 他にも変更すべき箇所がいくつかあります。 # “カスタマイズ”もしくは # “修復”“充填”といった用語で直接スクリプト内検索を! # (比較的簡単にカスタマイズ可能な部分です) FILL_ANIMATION_ID = 40 #→# 充填時にウインドウ上に表示するアニメーションのIDです。 # = 0 (ゼロ)でアニメーション非表示になります。 REPAIR_ANIMATION_ID = 38 #→# 修復時にウインドウ上に表示するアニメーションのIDです。 # = 0 (ゼロ)でアニメーション非表示になります。 #-- その他・表示関連 USE_ITEM_ANALYZE = true #→# アイテム詳細ウインドウを使用するか? # 使用する場合 = true / 使用しない場合 = false ITEM_COMMAND_SORT = [] #→# アイテム画面のコマンド順の並び替え。 # 0:使う / 1:装備 / 2:渡す / 3:ふくろ / 4:捨てる # = [0, 1, 2, 4, 3] # というように変更します。(変更しない場合は = [] でOK。) ITEM_COMMAND_COLUMN_MAX = 1 #→# アイテム画面のコマンドの横並びの数を変更できます。 # 例えば、= 2 にすれば4つの項目なら横2項目×縦2項目となります。 # 今後、追加スクリプトにて項目が増えた際への配慮です。 CUSTOM_OPACITY_1 = 223 CUSTOM_OPACITY_2 = 239 #→# アイテムウインドウ等では普通とは異なる透過度のウインドウを使用しています。 # ここで一括でそれらを変更できるようにしてあります。 # 透過薄めにする為です。(255 で不透過、0 で透過) # 他にも比較的簡単にカスタマイズ可能な部分があります。 # “カスタマイズ”でスクリプト内検索を! # 表示文章の書き換えをしたい場合は、 # 実際に書き換えたい元の用語・文章で検索するのが良い方法です。 # # 初心者の方へ "" 内の書き換えは比較的安全に出来る改変です。 # 是非チャレンジを! ただし、バックアップを取るのを忘れずに! end #============================================================================== # ■ Vocab(テキストカスタマイズ可能部分) #------------------------------------------------------------------------------ #  用語とメッセージを定義するモジュールです。定数でメッセージなどを直接定義す # るほか、グローバル変数 $data_system から用語データを取得します。 #============================================================================== module Vocab ## 戦闘時用 追加メッセージ # アイテムを装備した場合 Equip = "%sは%sを装備した!" # アイテム装備で呪われた場合 Equip_Curse = "%sは呪われてしまった!" # スタックアイテムを補充した場合 Replenish = "%sは%sを補充した!" # (攻撃・防御で)チャージが尽きた場合 Equip_Break = "%sの%sは壊れてしまった!" # (攻撃で)スタックアイテムが尽きた場合 Spent_Stack = "%sの%sがなくなった。" # 戦闘後のアイテムを複数入手した場合(2〜9) ObtainItemS = "%sを %sつ 手に入れた!" # 戦闘後のアイテムを複数入手した場合(10〜) ObtainItemSb = "%sを %s 手に入れた!" # 戦闘後にアイテム入手し一杯になった場合 ItemFull = "アイテムが一杯になった。" # すでにアイテムが一杯で新たな入手に失敗した場合 GainFailure = "アイテムが一杯だった。" end #============================================================================== # ■ Sound(効果音のカスタマイズはここを直接書き換えて下さい) #------------------------------------------------------------------------------ #  効果音を演奏するモジュールです。グローバル変数 $data_system からデータベー # スで設定された SE の内容を取得し、演奏します。 #============================================================================== module Sound # 渡す def self.play_pass Audio.se_play("Audio/SE/Key", 80, 85) end # 渡す→持ち物が一杯の時のアラート音(交換処理の開始) def self.play_item_full Audio.se_play("Audio/SE/Decision1", 80, 80) end # 捨てる def self.play_throws Audio.se_play("Audio/SE/Equip", 80, 140) end # 充填する def self.play_fill Audio.se_play("Audio/SE/Heal7", 80, 100) end # 修復する def self.play_repair Audio.se_play("Audio/SE/Up", 80, 100) end # 呪いのアイテム装備 def self.play_curse Audio.me_stop # 連続で呪われた場合等の為に、一度MEを止めます。 Audio.me_play("Audio/ME/Shock", 80, 100) Graphics.wait(120) # 演奏中の画面停止をします。 end end ## クラス・ゲーム ## #============================================================================== # ■ Game_Actor_Item #------------------------------------------------------------------------------ #  Game_Actorクラス及び、Game_Party内で共通して使用するメソッドをまとめた # モジュールです。Game_Party内では主に袋のアイテム用の処理となります。 #============================================================================== module Game_Actor_Item #--------------------------------------------------------------------------- # ○ アイテムの更新 #--------------------------------------------------------------------------- def carry_items_refresh @carry_items_data.compact! equip_index_refresh if actor? end #-------------------------------------------------------------------------- # ○ アイテムデータクローン作成 #-------------------------------------------------------------------------- def make_carry_items_data_clone clone_carry_items_data = [] @carry_items_data.each do |data| clone_data = {} data.each_pair do |key, value| if value.is_a?(Array) new_value = [] value.each{|i|new_value.push(i)} value = new_value end clone_data[key] = value end clone_carry_items_data.push(clone_data) end @carry_items_data = clone_carry_items_data end #--------------------------------------------------------------------------- # ○ indexアイテムの価格 # ※ アイテム個々のデータにより価値を変更可能(拡張スクリプト用) #--------------------------------------------------------------------------- def carry_item_price(price, index) return price end #-------------------------------------------------------------------------- # ○ indexから所持アイテムを取得 #-------------------------------------------------------------------------- def carry_item(index) return nil if index == nil return nil if @carry_items_data[index] == nil case @carry_items_data[index]["object"][0] when 0 ; return $data_items[@carry_items_data[index]["object"][1]] when 1 ; return $data_weapons[@carry_items_data[index]["object"][1]] when 2 ; return $data_armors[@carry_items_data[index]["object"][1]] end end #-------------------------------------------------------------------------- # ○ indexから所持アイテム名を取得 #-------------------------------------------------------------------------- def carry_item_name(index) return carry_item(index).name end #-------------------------------------------------------------------------- # ○ 所持アイテムをすべて取得 #-------------------------------------------------------------------------- def carry_items data = [] @carry_items_data.size.times do |index| data.push(carry_item(index)) end return data end #-------------------------------------------------------------------------- # ○ アイテム所持数を取得 # include_equip : 装備品も含める #-------------------------------------------------------------------------- def carry_number(include_equip = false) if include_equip or not actor? return carry_items.size else number = 0 @carry_items_data.size.times do |index| next if equipping?(index) number += 1 end return number end end #-------------------------------------------------------------------------- # ○ 指定アイテム所持indexを配列で取得 # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def carry_item_hold_address(item, include_equip = false) return [] if item == nil result = [] @carry_items_data.size.times do |index| next if actor? and not include_equip and equipping?(index) if same_item_index?(index, item) result.push(index) end end return result end #-------------------------------------------------------------------------- # ○ 指定アイテム所持数取得 # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def carry_item_number(item, include_equip = false) return carry_item_hold_address(item, include_equip).size end #-------------------------------------------------------------------------- # ○ 指定アイテムを所持しているか? # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def carrying_item?(item, include_equip = false) return carry_item_number(item, include_equip) >= 1 end #-------------------------------------------------------------------------- # ○ 空き所持数に余裕があるか? #-------------------------------------------------------------------------- def carry_room? return (carry_items.size < @item_max) end #-------------------------------------------------------------------------- # ○ 空き所持数 #-------------------------------------------------------------------------- def carry_room_number return [(@item_max - carry_items.size), 0].max end #-------------------------------------------------------------------------- # ○ indexのアイテムの最大チャージ数取得 #-------------------------------------------------------------------------- def item_max_charge(index) return carry_item(index).charge end #-------------------------------------------------------------------------- # ○ indexのアイテムと同じアイテムか? #-------------------------------------------------------------------------- def same_item_index?(index, check_item) return check_item.same_item?(carry_item(index)) end #-------------------------------------------------------------------------- # ○ indexのアイテムが破棄可能か? #-------------------------------------------------------------------------- def can_throw_index?(index) item = carry_item(index) return false if item == nil return false if actor? and equipping?(index) return false if item.price == 0 return true end #-------------------------------------------------------------------------- # ○ indexのアイテムが売却可能か? #-------------------------------------------------------------------------- def can_sell_index?(index) item = carry_item(index) return false if item == nil return false if actor? and equip_lock_index?(index) return false if item.price == 0 return true end #-------------------------------------------------------------------------- # ○ indexのアイテムを預けることが出来るか? #-------------------------------------------------------------------------- def can_entrust_index?(index) return false if @carry_items_data[index] == nil return false if actor? and equip_lock_index?(index) if @carry_items_data[index]["charge"] return false if @carry_items_data[index]["charge"] != item_max_charge(index) end return true end #-------------------------------------------------------------------------- # ○ indexのアイテムが充填可能か? #-------------------------------------------------------------------------- def item_can_fill?(index, test = false) item = carry_item(index) return false if item == nil return false if item.fill_prohibition return false if item.charge == nil return false if item_max_charge(index) == 1 return false if item.stack_item? return false if item_can_repair?(index, true) if test return true else return item_need_charge?(index) end end #-------------------------------------------------------------------------- # ○ indexのアイテムが修復可能か? #-------------------------------------------------------------------------- def item_can_repair?(index, test = false) item = carry_item(index) return false if item == nil return false if item.repair_prohibition return false if item.stack_item? return true if item_broken?(index) return false if item.charge == nil if item.is_a?(RPG::Weapon) and (item.hit_consumable or item.can_repair) return test ? true : item_need_charge?(index) elsif item.is_a?(RPG::Armor) and (item.damage_consumable or item.can_repair) return test ? true : item_need_charge?(index) elsif item.consumable_change or item.can_repair return test ? true : item_need_charge?(index) else return false end end #-------------------------------------------------------------------------- # ○ indexのアイテムがチャージできるか?(フルチャージでない) #-------------------------------------------------------------------------- def item_need_charge?(index) item = carry_item(index) return false if item == nil return false if item.charge == nil return false if item.stack_item? return carry_items_data[index]["charge"] != item_max_charge(index) end #-------------------------------------------------------------------------- # ○ indexのアイテムがこわれたアイテムか? #-------------------------------------------------------------------------- def item_broken?(index) item = carry_item(index) return false if item == nil if @carry_items_data[index]["broken_kind"] return true else datas = item.repair_item_change if datas data = datas[rand(datas.size)] @carry_items_data[index]["broken_kind"] = data[0] @carry_items_data[index]["broken_id"] = data[1] return true else return false end end end #-------------------------------------------------------------------------- # ○ 修復時変化アイテム取得 #-------------------------------------------------------------------------- def repaired_change_item(index) return nil unless item_broken?(index) kind = @carry_items_data[index]["broken_kind"] id = @carry_items_data[index]["broken_id"] case kind when 0 ; return $data_items[id] when 1 ; return $data_weapons[id] when 2 ; return $data_armors[id] end return nil end #-------------------------------------------------------------------------- # ○ 指定スタックアイテムの合計スタック数を取得 # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def total_stack(item, include_equip = false) return 0 unless item.stack_item? result = 0 @carry_items_data.size.times do |index| if actor? and not include_equip and not carry_item(index).is_a?(RPG::Item) next if equipping?(index) end if item.same_item?(carry_item(index)) result += @carry_items_data[index]["charge"] end end return result end #-------------------------------------------------------------------------- # ○ 指定スタックアイテムの入手可能スタック数 #-------------------------------------------------------------------------- def stack_room_number(item) return 0 unless item.stack_item? number = carry_room_number * item.charge number += stack_fraction_room_number(item) return number end #-------------------------------------------------------------------------- # ○ 指定スタックアイテムの入手可能端数 #-------------------------------------------------------------------------- def stack_fraction_room_number(item) return 0 unless item.stack_item? result = 0 @carry_items_data.size.times do |index| next if carry_item(index) == nil if carry_item(index).same_item?(item) result += carry_item(index).charge - @carry_items_data[index]["charge"] end end return result end #-------------------------------------------------------------------------- # ○ アイテムの増加 # item : データの基本となるアイテム(オブジェクト) # over : 所持限界オーバーを許可するか?の真偽値 # tags : 特殊状態でのアイテム入手用・情報タグ #-------------------------------------------------------------------------- def obtain_item(item, over = false, tags = []) cant_obtain = ((not carry_room? and not over)) item_data = obtain_item_data(item, tags) @carry_items_data.push(item_data) $game_party.last_gain_item_name = carry_item_name(-1) if cant_obtain @carry_items_data.pop return false else return true end end #-------------------------------------------------------------------------- # ○ アイテムの増加用アイテムデータの作成 #-------------------------------------------------------------------------- def obtain_item_data(item, tags) item_data = Hash.new case item when RPG::Item ; kind = 0 when RPG::Weapon ; kind = 1 when RPG::Armor ; kind = 2 end item_data["object"] = [kind, item.id] if item.charge item_data["charge"] = item.charge end return item_data end #-------------------------------------------------------------------------- # ○ アイテムの減少 # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def remove_item(item, include_equip = false) carry_items.size.times do |index| next unless item.same_item?(carry_item(index)) if actor? and equipping?(index) next unless include_equip remove_equipment_index(index) end if actor? and $game_temp.in_battle remove_equipment_index(index) @carry_items_data[index] = nil else @carry_items_data.delete_at(index) end return true end return false end #-------------------------------------------------------------------------- # ○ アイテムの減少(index指定) # index : 所持index # include_equip : 装備品も含める #-------------------------------------------------------------------------- def remove_item_index(index, include_equip = false) return false if index > carry_items.size if actor? and equipping?(index) return false unless include_equip remove_equipment_index(index) end if actor? and $game_temp.in_battle @carry_items_data[index] = nil else @carry_items_data.delete_at(index) end return true end #-------------------------------------------------------------------------- # ○ スタックアイテムの増加(端数による増加) # ※ いくつ増加できたか、を結果として返す。 #-------------------------------------------------------------------------- def obtain_stack_item(item, stack_number, over = false) return 0 unless item.stack_item? # スタックアイテムでない場合、失敗 $game_party.last_gain_item_name = item.name return 0 if stack_room_number(item) == 0 and not over # 余裕がない場合失敗 stack_number = [stack_number, stack_room_number(item)].min unless over item_number = stack_number / item.charge fraction = stack_number % item.charge item_number.times{ obtain_item(item, true) } # フルスタックとしての入手分 obtain_item(item, true) # 端数の入手分 @carry_items_data[carry_items.size - 1]["charge"] = fraction aoto_transfer_charge return stack_number end #-------------------------------------------------------------------------- # ○ スタックアイテムの減少(端数による減少) # ※ いくつ減少できたか、を結果として返す。 #-------------------------------------------------------------------------- def remove_stack_item(item, stack_number, include_equip = false) return 0 unless item.stack_item? # スタックアイテムでない場合、失敗 return 0 unless carrying_item?(item, include_equip) # 未所持の場合、失敗 stack_number = [stack_number, total_stack(item, include_equip)].min removed = 0 (carry_items.size - 1).downto(0) do |index| if item.same_item?(carry_item(index)) if not include_equip and not item.is_a?(RPG::Item) next if equipping?(index) end remove = [stack_number - removed, @carry_items_data[index]["charge"]].min @carry_items_data[index]["charge"] -= remove removed += remove if @carry_items_data[index]["charge"] == 0 remove_item_index(index, true) end break if removed == stack_number end end return removed end #-------------------------------------------------------------------------- # ○ 預かり所からのアイテム返却 #-------------------------------------------------------------------------- def obtain_item_return(item, over = false) return false if not carry_room? and not over item_data = Hash.new(false) case item when RPG::Item ; kind = 0 when RPG::Weapon ; kind = 1 when RPG::Armor ; kind = 2 end item_data["object"] = [kind, item.id] if item.charge item_data["charge"] = item.charge end @carry_items_data.push(item_data) return true end #--------------------------------------------------------------------------- # ○ インデックスのアイテム変化 #--------------------------------------------------------------------------- def change_item(index, kind, item_id) return false if carry_item(index) == nil case kind when 0 ; item = $data_items[item_id] when 1 ; item = $data_weapons[item_id] when 2 ; item = $data_armors[item_id] end return false if item == nil #- 装備状態の引継ぎ準備 if actor? equip = equipping?(index) remove_equipment_index(index) else equip = false end #- オブジェクト変更 @carry_items_data[index]["object"] = [kind, item_id] acquires_equipment(index) if equip #- チャージの初期化 if @carry_items_data[index]["charge"] and not item.charge @carry_items_data[index].delete("charge") # チャージ抹消 else @carry_items_data[index]["charge"] = item_max_charge(index) # 変化後の最大 end return true end #--------------------------------------------------------------------------- # ○ indexのアイテムの消耗時変化 #--------------------------------------------------------------------------- def consumable_change_item(index, kind, item_id) unless @carry_items_data[index]["broken_kind"] broken_item = carry_item(index) case broken_item when RPG::Item ; broken_kind = 0 when RPG::Weapon ; broken_kind = 1 when RPG::Armor ; broken_kind = 2 end @carry_items_data[index]["broken_kind"] = broken_kind @carry_items_data[index]["broken_id"] = broken_item.id end change_item(index, kind, item_id) end #-------------------------------------------------------------------------- # ○ indexのアイテムの修復 #-------------------------------------------------------------------------- def repair_item(index) item = carry_item(index) return false if item == nil return false unless item_can_repair?(index) if item_broken?(index) kind = @carry_items_data[index]["broken_kind"] id = @carry_items_data[index]["broken_id"] @carry_items_data[index].delete("broken_kind") @carry_items_data[index].delete("broken_id") return change_item(index, kind, id) end @carry_items_data[index]["charge"] = item_max_charge(index) return true end #-------------------------------------------------------------------------- # ○ 他アクターへのアイテム移動・コピー # 参照元リンクが起きないように処理する。 #-------------------------------------------------------------------------- def item_move_other(index, other, copy = false) other = $game_party if other == nil data = @carry_items_data[index] unless copy @carry_items_data.delete_at(index) end move_data = {} data.each_pair {|key, value| move_data[key] = value} other.carry_items_data.push(move_data) other.aoto_transfer_charge end #-------------------------------------------------------------------------- # ○ アイテム交換(移動・渡す) # 自身のitem_indexのアイテムをotherへ移し、 # otherのothers_item_indexのアイテムを自身へ移す。 # others_item_index が nil の場合は渡すのみ。 #-------------------------------------------------------------------------- def item_trading(index, other, others_index = nil) other = $game_party if other == nil other.item_move_other(others_index, self) if others_index != nil item_move_other(index, other) end #-------------------------------------------------------------------------- # ○ アイテムをパーティーへ振り分け #-------------------------------------------------------------------------- def item_distributes(include_equip = false) @gain_drop_items_data = Hash.new(0) if self.is_a?(Game_Temp) @carry_items_data.reverse! (@carry_items_data.size - 1).downto(0) do |index| next if actor? and not item_can_pass?(index, false) members = $game_party.members members.push($game_party) if $game_party.bag_can_use? for other_actor in members next if other_actor == self next unless other_actor.carry_room? if actor? and equipping?(index) next unless include_equip remove_equipment_index(index) end if self.is_a?(Game_Temp) number = carry_item(index).stack_item? ? @carry_items_data[index]["charge"] : 1 @gain_drop_items_data[carry_item_name(index)] += number end item_trading(index, other_actor) break end break unless $game_party.carry_room? end @carry_items_data.reverse! end #--------------------------------------------------------------------------- # ○ チャージ移動となるか? # index_a : 選択したアイテム # index_b : チャージ移行先のアイテム #--------------------------------------------------------------------------- def charge_action?(index_a, index_b = nil) return false if carry_item(index_a) == nil if index_b == nil equip_type = carry_item(index_a).sub_weapon? ? 1 : carry_item(index_a).equip_type index_b = equip_item_index(equip_type) return false if carry_item(index_b) == nil end return false unless carry_item(index_a).stack_item? return false unless carry_item(index_a).same_item?(carry_item(index_b)) return false if @carry_items_data[index_b]["charge"] == carry_item(index_b).charge return true end #--------------------------------------------------------------------------- # ○ アイテムチャージ移動 # index_a : 選択したアイテム # index_b : チャージ移行先のアイテム #--------------------------------------------------------------------------- def transfer_charge(index_a, index_b) return false unless charge_action?(index_a, index_b) max_charge = carry_item(index_a).charge @carry_items_data[index_b]["charge"] += @carry_items_data[index_a]["charge"] @carry_items_data[index_a]["charge"] = @carry_items_data[index_b]["charge"] - max_charge @carry_items_data[index_b]["charge"] = [max_charge, @carry_items_data[index_b]["charge"]].min return true end #--------------------------------------------------------------------------- # ○ 自動アイテムチャージ移動 #--------------------------------------------------------------------------- def aoto_transfer_charge (carry_items.size - 1).downto(0) do |index_a| next if carry_item(index_a) == nil next unless carry_item(index_a).stack_item? (index_a - 1).downto(0) do |index_b| transfer_charge(index_a, index_b) if @carry_items_data[index_a]["charge"] <= 0 remove_item_index(index_a, true) break end end end carry_items_refresh end end #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ○ モジュール取り込み #-------------------------------------------------------------------------- include Game_Actor_Item #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :carry_items_data # 所持アイテムデータ attr_accessor :gain_drop_items_data # 入手したドロップアイテムのデータ attr_accessor :ex_shop # 特殊ショップ attr_accessor :ex_shop_handling_tags # 特殊ショップ・取り扱いタグ attr_accessor :curse_equip_break_off # 呪い解除による装備破壊オフ フラグ #-------------------------------------------------------------------------- # ◎ オブジェクト初期化 #-------------------------------------------------------------------------- alias tig_ais_initialize initialize def initialize tig_ais_initialize @carry_items_data = [] @item_max = 99 # 仮の最大数値 @ex_shop = {} @ex_shop_handling_tags = [] @curse_equip_break_off = false end #-------------------------------------------------------------------------- # ○ アクターか否かの判定 #-------------------------------------------------------------------------- def actor? return false end #-------------------------------------------------------------------------- # ○ このアイテムを取り扱うショップか? #-------------------------------------------------------------------------- def shop_handling?(item) return true if @ex_shop_handling_tags.empty? if item.item_tags.empty? return @ex_shop_handling_tags.include?("無印") else item.item_tags.each{|tag|return true if @ex_shop_handling_tags.include?(tag)} end return false end #-------------------------------------------------------------------------- # ○ ドロップアイテムを一時保管場所に生成 # ※ スタックアイテムの入手形式毎の入手数判定はここでおこなう。 #-------------------------------------------------------------------------- def make_drop_carry_items(drop_items) @carry_items_data = [] for item in drop_items next if item.is_a?(RPG::Item) and item.valuables? if item.stack_item? case item.stack_drop_type when 0 ; stack_number = item.charge when 1 ; stack_number = 1 when 2 ; stack_number = (rand(item.charge) / 2 + 1) when 3 ; stack_number = (rand(item.charge) / 3 + 1) else ; stack_number = (rand(item.charge) + 1) end obtain_stack_item(item, stack_number, true) else obtain_item(item, true, ["drop"]) end end @carry_items_data = @carry_items_data.sort_by{rand} end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ # スのスーパークラスとして使用されます。 #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ◎ 通常攻撃の効果適用 # attacker : 攻撃者 #-------------------------------------------------------------------------- # ※攻撃者武器・ダメージ側防具の打撃時チャージ劣化処理の追加 #-------------------------------------------------------------------------- alias tig_ais_attack_effect attack_effect def attack_effect(attacker) tig_ais_attack_effect(attacker) return if @skipped hit = true hit = false if @missed or @evaded or @hp_damage == 0 if attacker.actor? attacker.weapons.size.times do |i| weapon = attacker.weapons[i] next if weapon == nil if weapon.attack_consumable or ( weapon.hit_consumable and hit ) if rand(weapon.hit_consumable_probability) == 0 attacker.carry_items_data.each do |data| data["charge"] -= 1 if data["equip"] == i end end end end end if actor? and hit armors.size.times do |i| armor = armors[i] next if armor == nil next if i == 0 if armor.damage_consumable if rand(armor.damage_consumable_probability) == 0 index = equip_item_index(armor.equip_type) @carry_items_data[index]["charge"] -= 1 end end end end end #-------------------------------------------------------------------------- # ◎ スキルの効果適用 # user : スキルの使用者 # skill : スキル #-------------------------------------------------------------------------- # ※使用者武器・ダメージ側防具の打撃時チャージ劣化処理の追加 #-------------------------------------------------------------------------- alias tig_ais_skill_effect skill_effect def skill_effect(user, skill) tig_ais_skill_effect(user, skill) return if skill.atk_f == 0 # 打撃関係度がゼロなら劣化しない return if skill.ignore_defense # 防御力無視なら劣化しない return if @skipped if not @missed and not @evaded and @hp_damage > 0 if user.actor? user.weapons.size.times do |i| weapon = user.weapons[i] next if weapon == nil if weapon.attack_consumable or weapon.hit_consumable if rand(weapon.hit_consumable_probability) == 0 user.carry_items_data.each do |data| data["charge"] -= 1 if data["equip"] == i end end end end end return unless actor? armors.size.times do |i| armor = armors[i] next if armor == nil if armor.damage_consumable if rand(armor.damage_consumable_probability) == 0 index = equip_item_index(armor.equip_type) @carry_items_data[index]["charge"] -= 1 end end end end end #-------------------------------------------------------------------------- # ◎ アイテムの効果適用 # user : アイテムの使用者 # item : アイテム #-------------------------------------------------------------------------- # ※防具の被打撃時チャージ劣化処理の追加 #-------------------------------------------------------------------------- alias tig_ais_item_effect item_effect def item_effect(user, item) tig_ais_item_effect(user, item) return unless actor? return if item.atk_f == 0 # 打撃関係度がゼロなら劣化しない return if item.ignore_defense # 防御力無視なら劣化しない return if @skipped if not @missed and not @evaded and @hp_damage > 0 armors.size.times do |i| armor = armors[i] next if armor == nil if armor.damage_consumable if rand(armor.damage_consumable_probability) == 0 index = equip_item_index(armor.equip_type) @carry_items_data[index]["charge"] -= 1 end end end end end end #============================================================================== # ■ Game_BattleAction #------------------------------------------------------------------------------ #  戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され # ます。 #============================================================================== class Game_BattleAction #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :item_index #-------------------------------------------------------------------------- # ◎ クリア #-------------------------------------------------------------------------- alias tig_ais_clear clear def clear tig_ais_clear @item_index = 0 end #-------------------------------------------------------------------------- # ○ アイテムindexを設定 # item_id : アイテム ID #-------------------------------------------------------------------------- def set_item_index(item_index) @item_index = item_index end #-------------------------------------------------------------------------- # ● アイテムオブジェクト取得 # ※ “使える装備品”の場合はその効果となるアイテムを返す #-------------------------------------------------------------------------- def item item = battler.carry_item(item_index) if battler.equipping?(item_index) and item.item_power > 0 if $data_items[item.item_power] != nil item = $data_items[item.item_power] end end return item end #-------------------------------------------------------------------------- # ● 行動が有効か否かの判定 # イベントコマンドによる [戦闘行動の強制] ではないとき、ステートの制限 # やアイテム切れなどで予定の行動ができなければ false を返す。 #-------------------------------------------------------------------------- def valid? return false if nothing? # 何もしない return true if @forcing # 行動強制中 return false unless battler.movable? # 行動不能 if skill? # スキル return false unless battler.skill_can_use?(skill) elsif item? # アイテム return false unless battler.item_can_use_index?(@item_index) ## 変更部分 end return true end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors) # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ○ モジュール取り込み #-------------------------------------------------------------------------- include Game_Actor_Item #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :carry_items_data # 所持アイテムデータ attr_accessor :equip_index # 装備品インデックス attr_accessor :item_max # アイテムの最大所持数 attr_reader :weapon2_id # 武器2 ID #-------------------------------------------------------------------------- # ◎ オブジェクト初期化 #-------------------------------------------------------------------------- alias tig_ais_initialize initialize def initialize(actor_id) @item_max = Actor_Item::ITEM_MAX @carry_items_data = [] @equip_index = [] tig_ais_initialize(actor_id) gain_initial_equipment end #-------------------------------------------------------------------------- # ○ クローン用データの作成 #-------------------------------------------------------------------------- def make_clone @equip_index = @equip_index.clone make_carry_items_data_clone end #-------------------------------------------------------------------------- # ● 武器オブジェクトの配列取得 #-------------------------------------------------------------------------- def weapons result = equips.slice(0, 2) return result ? result : [] end #-------------------------------------------------------------------------- # ● 防具オブジェクトの配列取得 #-------------------------------------------------------------------------- def armors result = equips.slice(2, equips.size) return result ? result : [] end #-------------------------------------------------------------------------- # ● 装備品オブジェクトの配列取得 #-------------------------------------------------------------------------- def equips result = [] @equip_index.size.times do |i| result[i] = carry_item(@equip_index[i]) end return result end #-------------------------------------------------------------------------- # ● 通常攻撃 アニメーション ID の取得 #-------------------------------------------------------------------------- def atk_animation_id if weapons[1] and weapons[1].prior_animation return 0 end if two_swords_style return weapons[0].animation_id if weapons[0] != nil return weapons[1] == nil ? 1 : 0 else return weapons[0] == nil ? 1 : weapons[0].animation_id end end #-------------------------------------------------------------------------- # ● 通常攻撃 アニメーション ID の取得 (二刀流:武器2) #-------------------------------------------------------------------------- def atk_animation_id2 if weapons[1] and weapons[1].prior_animation return weapons[1].animation_id end if two_swords_style return weapons[1] == nil ? 0 : weapons[1].animation_id else return 0 end end #-------------------------------------------------------------------------- # ○ 初期アイテムの入手処理 #-------------------------------------------------------------------------- def gain_initial_equipment unless @weapon_id == 0 obtain_item($data_weapons[@weapon_id]) @carry_items_data[carry_items.size - 1]["equip"] = 0 end unless @armor1_id == 0 if two_swords_style obtain_item($data_weapons[@armor1_id]) @carry_items_data[carry_items.size - 1]["equip"] = 1 @weapon2_id = @armor1_id @armor1_id = 0 else obtain_item($data_armors[@armor1_id]) @carry_items_data[carry_items.size - 1]["equip"] = 2 end end unless @armor2_id == 0 obtain_item($data_armors[@armor2_id]) @carry_items_data[carry_items.size - 1]["equip"] = 3 end unless @armor3_id == 0 obtain_item($data_armors[@armor3_id]) @carry_items_data[carry_items.size - 1]["equip"] = 4 end unless @armor4_id == 0 obtain_item($data_armors[@armor4_id]) @carry_items_data[carry_items.size - 1]["equip"] = 5 end equip_index_refresh equipment_fixation if actor.fix_equipment add_equip_states_all end #-------------------------------------------------------------------------- # ○ 装備品indexのリフレッシュ #-------------------------------------------------------------------------- def equip_index_refresh @equip_index = [] carry_items.size.times do |index| next unless equipping?(index) @equip_index[@carry_items_data[index]["equip"]] = index end end #-------------------------------------------------------------------------- # ○ 部位から装備中のアイテムのindexを取得 #-------------------------------------------------------------------------- def equip_item_index(equip_type) case equip_type when 0 search_type = 0 when 1 search_type = weapons[1] ? 1 : 2 else search_type = equip_type + 1 end carry_items.size.times do |index| next if carry_item(index) == nil return index if @carry_items_data[index]["equip"] == search_type end return nil end #-------------------------------------------------------------------------- # ○ 武器タイプが適切か? #-------------------------------------------------------------------------- def weapon_type_match?(item) return true unless item.sub_weapon? return false if weapons[0] == nil return item.sub_weapon_type.include?(weapons[0].object_type) end #-------------------------------------------------------------------------- # ○ indexのアイテムを装備中か? #-------------------------------------------------------------------------- def equipping?(index) return false if @carry_items_data[index] == nil return @carry_items_data[index]["equip"] end #-------------------------------------------------------------------------- # ○ 同種のアイテムを装備中か? #-------------------------------------------------------------------------- def same_item_equipping?(check_item) carry_items.size.times do |index| next if carry_item(index) == nil return true if same_item_index?(index, check_item) and equipping?(index) end return false end #-------------------------------------------------------------------------- # ○ indexの装備が固定されているか?(様々な要素を含む) #-------------------------------------------------------------------------- def equip_lock_index?(index) return true if equipping?(index) and state?(carry_item(index).curse_states) return fix_equipment?(index) end #-------------------------------------------------------------------------- # ○ indexのアイテムが装備固定設定か? #-------------------------------------------------------------------------- def fix_equipment?(index) return true if actor.fix_equipment return @carry_items_data[index]["fix_equipment"] == true end #-------------------------------------------------------------------------- # ○ indexのアイテムが使用可能か?(基本) #-------------------------------------------------------------------------- def item_can_use_index?(index) return false if dead? or not movable? item = carry_item(index) return false if item == nil if $game_temp.in_battle unless equipping?(index) if item.equip_type >= 0 if Actor_Item::CHANGE_EQUIP_BATTLE_MODE and Actor_Item::CHANGE_EQUIP_BATTLE.include?(item.equip_type) return true if equipable_index?(index) end end end end return false unless addition_item_can_use?(item) if defined? $game_player.check_event_trigger_object case item when RPG::Item ; object_id = item.id when RPG::Weapon ; object_id = item.id + 2000 when RPG::Armor ; object_id = item.id + 3000 end return true if $game_player.check_event_trigger_object(object_id, true) end unless item.is_a?(RPG::Item) if equipping?(index) and item.item_power > 0 item = $data_items[item.item_power] return false if item == nil end end if $game_temp.in_battle return item.battle_ok? if item.is_a?(RPG::Item) else if item.is_a?(RPG::Item) return item.common_event_id > 0 if item.scope == 0 return item.menu_ok? end end return false end #-------------------------------------------------------------------------- # ○ indexのアイテムが使用可能か?(追加用) #-------------------------------------------------------------------------- def addition_item_can_use?(item) unless item.use_qualification_class == [] return false unless item.use_qualification_class.include?(@class_id) end return false if @level < item.use_qualification_level return true end #-------------------------------------------------------------------------- # ○ indexのアイテムが譲渡可能か? # equip : 装備状態を考慮するか #-------------------------------------------------------------------------- def item_can_pass?(index, equip = true) return false if @carry_items_data[index] == nil return false if equip and equipping?(index) return true end #-------------------------------------------------------------------------- # ○ indexのアイテムが装備可能か? #-------------------------------------------------------------------------- def equipable_index?(index) item = carry_item(index) return false unless equipable_item?(item) return false if equipping?(index) and fix_equipment?(index) return false unless test_acquires_equipment(index) return true end #-------------------------------------------------------------------------- # ○ アイテムが装備可能か?(アイテム種類別) #-------------------------------------------------------------------------- def equipable_item?(item) return false if item == nil return false if item.is_a?(RPG::Item) return false unless weapon_type_match?(item) return false unless equippable?(item) return false if @level < item.equip_qualification_level return true end #-------------------------------------------------------------------------- # ○ アイテムの消耗 # index : 所持index # 指定されたindexのアイテムが消耗アイテムであれば判定を行い減らす。 #-------------------------------------------------------------------------- def consume_item(index) item = carry_item(index) return false if item == nil if item.consumable and # 使用時消耗 rand(item.consumable_probability) == 0 # かつ消耗確率チェックが真 if @carry_items_data[index]["charge"] -= 1 return false if @carry_items_data[index]["charge"] > 0 end if item.consumable_change consumable_change_item(index, item.consumable_change[0], item.consumable_change[1]) else remove_item_index(index, true) end return true end return false end #-------------------------------------------------------------------------- # ○ アイテムの装備スキル使用時の消耗 # index : アイテム # skill : 装備スキル使用時の消耗(消耗確定) #-------------------------------------------------------------------------- def item_skill_consumable(index, skill_id) item = carry_item(index) return false if item == nil return false unless item.skill_consumable(skill_id) if rand(item.skill_consumable_probability(skill_id)) == 0 # 消耗率チェック if @carry_items_data[index]["charge"] -= 1 return false if @carry_items_data[index]["charge"] > 0 end if item.consumable_change consumable_change_item(index, item.consumable_change[0], item.consumable_change[1]) else remove_item_index(index, true) end return true end return false end #--------------------------------------------------------------------------- # ○ 使用した装備スキルIDから消耗させるべき装備品のindexを取得 #--------------------------------------------------------------------------- def skill_consumable_index(skill_id) carry_items.size.times do |index| next unless equipping?(index) next unless @carry_items_data[index]["skill"] @carry_items_data[index]["skill"].size.times do |i| if @carry_items_data[index]["skill"][i] == skill_id return index if carry_item(index).skill_consumable(skill_id) end end end return nil end #--------------------------------------------------------------------------- # ○ 装備品の並び順を取得 # full == true → 0:武器 / 1:盾 / 2:頭 … と数えていく方法 # full == false → 0:武器 / 1:補助武器/ 2:盾 / 3:頭 … と数えていく方法 #--------------------------------------------------------------------------- def equip_order(full = false) if full order = [] for i in Actor_Item::SORT_EQUIP case i when 0 order.push(0) when 1 order.push(1) order.push(2) else order.push(i + 1) end end array = Array.new(equips.size + 1){|i| i } else order = Actor_Item::SORT_EQUIP array = Array.new(equips.size){|i| i } end return order + (array - order) # カスタマイズ項目の記入漏れを補完 end #--------------------------------------------------------------------------- # ○ アイテム自動整理 # ※ 装備品→非装備品 の順にソートを行う処理。 #--------------------------------------------------------------------------- def item_aoto_sort result = [] for equip_id_index in equip_order(true) @carry_items_data.each do |data| next if data == nil next unless data["equip"] == equip_id_index result.push(data) @carry_items_data.delete(data) end end @carry_items_data = result + @carry_items_data carry_items_refresh end #--------------------------------------------------------------------------- # ○ 装備品へのチャージ移動 # index_a : 選択したアイテム (index_b : 装備中のアイテム) #--------------------------------------------------------------------------- def transfer_charge_equip(index_a) return if carry_item(index_a) == nil equip_type = carry_item(index_a).sub_weapon? ? 1 : carry_item(index_a).equip_type index_b = equip_item_index(equip_type) result = transfer_charge(index_a, index_b) if result and @carry_items_data[index_a]["charge"] <= 0 remove_item_index(index_a, true) end return result end #-------------------------------------------------------------------------- # ○ 装備テスト #-------------------------------------------------------------------------- def test_acquires_equipment(index) temp_actor = self.clone temp_actor.make_clone return temp_actor.acquires_equipment(index, true) end #-------------------------------------------------------------------------- # ○ 装備する (indexで指定 or test用アイテム指定) #-------------------------------------------------------------------------- def acquires_equipment(index, test = false) return false if actor.fix_equipment item = carry_item(index) return if item == nil return if transfer_charge_equip(index) case item.equip_type when 0 # 武器 if item.two_handed # 両手持ちの場合 return false unless remove_equipment_parts(1, test, true) return false unless remove_equipment_parts(0, test, true) @carry_items_data[index]["equip"] = 0 @equip_index[0] = index elsif item.sub_weapon? return false unless remove_equipment_parts(1, test, true) @carry_items_data[index]["equip"] = 1 @equip_index[1] = index elsif two_swords_style and not item.no_two_swords and weapons[1] == nil and weapons[0] and not weapons[0].no_two_swords and not weapons[0].two_handed @carry_items_data[index]["equip"] = 1 @equip_index[1] = index else if weapons[1] and item.no_two_swords and not weapons[1].sub_weapon? return false unless remove_equipment_parts(1, test, true) end if armors[0] and not Actor_Item::SHIELD_USE_TYPE.include?(item.object_type) return false unless remove_equipment_parts(1, test, true) end return false unless remove_equipment_parts(0, test, true) @carry_items_data[index]["equip"] = 0 @equip_index[0] = index if weapons[1] and weapons[1].sub_weapon? and not weapons[1].sub_weapon_type.include?(item.object_type) @carry_items_data[equip_item_index(1)]["equip"] = nil @equip_index[1] = nil end end when 1 # 盾 if weapons[0] and ( weapons[0].two_handed or not Actor_Item::SHIELD_USE_TYPE.include?(weapons[0].object_type) ) return false unless remove_equipment_parts(0, test, true) end return false unless remove_equipment_parts(1, test, true) @carry_items_data[index]["equip"] = item.equip_part @equip_index[2] = index else # その他防具 return false unless remove_equipment_parts(item.equip_type, test, true) @carry_items_data[index]["equip"] = item.equip_part @equip_index[item.equip_type + 1] = index end unless test add_equip_states(index) learn_equip_skills(index) end return true end #-------------------------------------------------------------------------- # ○ 装備を外す(部位指定) #-------------------------------------------------------------------------- def remove_equipment_parts(equip_type, test = false, acquires = false) index = equip_item_index(equip_type) return remove_equipment_index(index, test, acquires) end #-------------------------------------------------------------------------- # ○ 装備を外す(index指定) # acquires : acquires_equipment メソッドからの呼び出しか? #-------------------------------------------------------------------------- def remove_equipment_index(index, test = false, acquires = false) return false if actor.fix_equipment return true if carry_item(index) == nil return true if @carry_items_data[index]["equip"] == nil return false if equip_lock_index?(index) equip_id_index = @carry_items_data[index]["equip"] @equip_index[equip_id_index] = nil @carry_items_data[index]["equip"] = nil unless acquires if equip_id_index == 0 and weapons[1] and weapons[1].sub_weapon? @carry_items_data[equip_item_index(1)]["equip"] = nil @equip_index[1] = nil end if two_swords_style and carry_item(index).equip_type == 0 and @equip_index[1] != nil @carry_items_data[equip_item_index(1)]["equip"] = 0 @equip_index[0] = @equip_index[1] @equip_index[1] = nil end end unless test remove_equip_states(index) forget_equip_skills(index) end return true end #-------------------------------------------------------------------------- # ○ すべての装備を外す #-------------------------------------------------------------------------- def remove_equipment_all @equip_index.each{|i|remove_equipment_index(i)} end #-------------------------------------------------------------------------- # ● 装備の変更 (オブジェクトで指定) # equip_type : 装備部位 # item : 武器 or 防具 (nil なら装備解除) # change : true なら装備品を変化 false なら装備命令(所持時のみ変更) #-------------------------------------------------------------------------- def change_equip(equip_type, item, change = false) return if actor.fix_equipment if change index = equip_item_index(equip_type) remove_item_index(index, true) if index != nil if item != nil obtain_item(item) acquires_equipment(carry_items.size - 1) end else if item == nil remove_equipment_parts(equip_type) else carry_items.size.times do |index| next unless item.same_item?(carry_item(index)) next if equipping?(index) acquires_equipment(index) break end end end item_aoto_sort end #-------------------------------------------------------------------------- # ○ 装備の固定 #-------------------------------------------------------------------------- def equipment_fixation actor.fix_equipment = true carry_items.size.times do |index| next unless equipping?(index) equipment_fixation_part(carry_item(index).equip_type) end end #-------------------------------------------------------------------------- # ○ 装備の固定解除 #-------------------------------------------------------------------------- def equipment_fixation_off carry_items.size.times do |index| next unless equipping?(index) equipment_fixation_part_off(carry_item(index).equip_type) end end #-------------------------------------------------------------------------- # ○ 装備の部分固定 #-------------------------------------------------------------------------- def equipment_fixation_part(equip_type) return if equip_item_index(equip_type) == nil return if carry_item(equip_item_index(equip_type)).sub_weapon? @carry_items_data[equip_item_index(equip_type)]["fix_equipment"] = true end #-------------------------------------------------------------------------- # ○ 装備固定の部分解除 #-------------------------------------------------------------------------- def equipment_fixation_part_off(equip_type) actor.fix_equipment = false return if equip_item_index(equip_type) == nil @carry_items_data[equip_item_index(equip_type)].delete("fix_equipment") end #-------------------------------------------------------------------------- # ○ 呪いの装備解除 #-------------------------------------------------------------------------- def remove_curse_equip(index) remove_equipment_index(index) if rand(100) < carry_item(index).curse_equip_break remove_item_index(index) end end #-------------------------------------------------------------------------- # ○ 装備品スキルを覚える #-------------------------------------------------------------------------- def learn_equip_skills(index) learn = [] for skill_id in carry_item(index).equip_skills next if skill_learn?($data_skills[skill_id]) learn_skill(skill_id) learn.push(skill_id) end @carry_items_data[index]["skill"] = learn unless learn.empty? end #-------------------------------------------------------------------------- # ○ 装備品スキルを忘れる #-------------------------------------------------------------------------- def forget_equip_skills(index) return unless @carry_items_data[index]["skill"] for skill_id in @carry_items_data[index]["skill"] forget_skill(skill_id) end @carry_items_data[index].delete("skill") end #-------------------------------------------------------------------------- # ◎ スキルを覚える #-------------------------------------------------------------------------- alias tig_ais_learn_skill learn_skill def learn_skill(skill_id) carry_items.size.times do |index| next unless equipping?(index) next unless @carry_items_data[index]["skill"] @carry_items_data[index]["skill"].size.times do |i| if @carry_items_data[index]["skill"][i] == skill_id @carry_items_data[index]["skill"].delete_at(i) @item_acquires_skill.push($data_skills[skill_id]) end end if @carry_items_data[index]["skill"].empty? @carry_items_data[index].delete("skill") end end tig_ais_learn_skill(skill_id) end #-------------------------------------------------------------------------- # ○ 装備品ステートの付加 #-------------------------------------------------------------------------- def add_equip_states(index) for state_id in carry_item(index).equip_states next if not $game_temp.in_battle and $data_states[state_id].battle_only add_state(state_id) if state?(state_id) if @carry_items_data[index]["state"] @carry_items_data[index]["state"].push(state_id) else @carry_items_data[index]["state"] = [state_id] end end end end #-------------------------------------------------------------------------- # ○ すべての装備品ステートの付加(戦闘開始時用) #-------------------------------------------------------------------------- def add_equip_states_all carry_items.size.times do |index| next unless equipping?(index) add_equip_states(index) end end #-------------------------------------------------------------------------- # ○ 装備品ステートの解除 #-------------------------------------------------------------------------- def remove_equip_states(index) return unless @carry_items_data[index]["state"] for state_id in carry_item(index).equip_states next unless state?(state_id) @carry_items_data[index]["state"].delete(state_id) if @carry_items_data[index]["state"].empty? @carry_items_data[index].delete("state") end end unless all_equip_states_check(state_id) remove_state(state_id) end end #-------------------------------------------------------------------------- # ◎ ステートの解除 # state_id : ステート ID #-------------------------------------------------------------------------- alias tig_ais_remove_state remove_state unless $@ def remove_state(state_id) tig_ais_remove_state(state_id) carry_items.size.times do |index| next unless equipping?(index) next unless @carry_items_data[index]["state"] for check_state_id in @carry_items_data[index]["state"] if check_state_id == state_id @carry_items_data[index]["state"].delete(state_id) if @carry_items_data[index]["state"].empty? @carry_items_data[index].delete("state") end remove_curse_equip(index) if state_id == carry_item(index).curse_states end end end end #-------------------------------------------------------------------------- # ○ 装備品すべての付加ステートをチェック #-------------------------------------------------------------------------- def all_equip_states_check(state_id) carry_items.size.times do |index| next unless equipping?(index) next unless @carry_items_data[index]["state"] for check_state_id in @carry_items_data[index]["state"] return true if check_state_id == state_id end end return false end #-------------------------------------------------------------------------- # ◎ 経験値の変更 #-------------------------------------------------------------------------- alias tig_ais_change_exp change_exp def change_exp(exp, show) @item_acquires_skill = [] tig_ais_change_exp(exp, show) end #-------------------------------------------------------------------------- # ◎ レベルアップメッセージの表示 #-------------------------------------------------------------------------- alias tig_ais_display_level_up display_level_up def display_level_up(new_skills) new_skills = new_skills + @item_acquires_skill tig_ais_display_level_up(new_skills) end end #============================================================================== # ■ Game_Actors #------------------------------------------------------------------------------ #  アクターの配列を扱うクラスです。このクラスのインスタンスは $game_actors で # 参照されます。 #============================================================================== class Game_Actors #-------------------------------------------------------------------------- # ○ すべてのアクターの取得 # actor_id : アクター ID #-------------------------------------------------------------------------- def all result = [] 1.upto($data_actors.size - 1) do |i| result.push($game_actors[i]) end return result end #-------------------------------------------------------------------------- # ○ 指定アイテムの所持数取得(アクター全体) # item : アイテム # include_equip : 装備品も含める # include_bug : 袋のアイテムも含める #-------------------------------------------------------------------------- def item_number(item, include_equip = false, include_bug = false) return 0 if item == nil if item.is_a?(RPG::Item) and item.valuables? return $game_party.item_number(item, include_equip) end number = 0 for actor in all number += actor.carry_item_number(item, include_equip) end if $game_party.bag_can_use? and include_bug number += $game_party.carry_item_number(item) end return number end #-------------------------------------------------------------------------- # ○ 指定アイテムを所持しているか?(アクター全体) # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def has_item?(item, include_equip = false) return item_number(item, include_equip) > 0 end #-------------------------------------------------------------------------- # ○ 指定スタックアイテムの所持スタック数取得(アクター全体) # item : アイテム # include_equip : 装備品も含める # include_bug : 袋のアイテムも含める #-------------------------------------------------------------------------- def total_stack(item, include_equip = false, include_bug = false) return 0 if item == nil return 0 if item.is_a?(RPG::Item) and item.valuables? number = 0 for actor in all number += actor.total_stack(item, include_equip) end if $game_party.bag_can_use? and include_bug number += $game_party.total_stack(item) end return number end #-------------------------------------------------------------------------- # ○ 指定アイテムを所持するアクターをID配列で取得 # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def item_holder(item, include_equip = false) if item.is_a?(RPG::Item) and item.valuables? return [-1] if $game_party.has_item?(item) end result = [] if $game_party.bag_can_use? if $game_party.carrying_item?(item) result.push(0) end end for actor in all if actor.carrying_item?(item, include_equip) result.push(actor.id) end end return result end end #============================================================================== # ■ Game_Party #------------------------------------------------------------------------------ #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク # ラスのインスタンスは $game_party で参照されます。 #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ○ モジュール取り込み #-------------------------------------------------------------------------- include Game_Actor_Item #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :carry_items_data # 袋アイテムデータ attr_accessor :item_max # 袋に入れられるアイテムの最大数 attr_accessor :bag_use # 袋を使用(表示)するか? attr_accessor :bag_not_open # 袋の使用禁止フラグ attr_accessor :bag_name # 袋の名前 attr_accessor :last_gain_item_name # 最後に手に入れたアイテムの名前 attr_accessor :remove_curse_type # 装備品の呪いを解いた際の処理タイプ #-------------------------------------------------------------------------- # ◎ オブジェクト初期化 #-------------------------------------------------------------------------- alias tig_ais_initialize initialize def initialize tig_ais_initialize @item_max = Actor_Item::BAG_MAX @bag_use = Actor_Item::BAG_USE @bag_not_open = false @bag_name = Actor_Item::BAG_NAME @carry_items_data = [] @last_gain_item_name = "" @item_gain = false end #-------------------------------------------------------------------------- # ○ クローン用データの作成 #-------------------------------------------------------------------------- def make_clone make_carry_items_data_clone end #-------------------------------------------------------------------------- # ○ アクターか否かの判定 #-------------------------------------------------------------------------- def actor? return false end #--------------------------------------------------------------------------- # ○ パーティーのアイテム更新 #-------------------------------------------------------------------------- def party_items_refresh for actor in members actor.item_aoto_sort end end #-------------------------------------------------------------------------- # ○ パーティーの装備品ステートの付加 #-------------------------------------------------------------------------- def add_equip_states for actor in members actor.add_equip_states_all end end #-------------------------------------------------------------------------- # ◎ パーティーの戦闘用ステートの解除 (戦闘終了時に呼び出し) #-------------------------------------------------------------------------- alias tig_ais_remove_states_battle remove_states_battle def remove_states_battle type_backup = @remove_curse_type @remove_curse_type = 0 tig_ais_remove_states_battle @remove_curse_type = type_backup end #-------------------------------------------------------------------------- # ○ 袋が利用可能な状態か? #-------------------------------------------------------------------------- def bag_can_use? return false unless @bag_use return false if @bag_not_open return true end #-------------------------------------------------------------------------- # ● パーティー内の全てのアイテム(メンバー所持+袋) #-------------------------------------------------------------------------- def items result = [] for actor in members result += actor.carry_items end if bag_can_use? result += carry_items end return result end #-------------------------------------------------------------------------- # ● 指定アイテムの所持数取得(パーティー全体) # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def item_number(item, include_equip = false) if item.is_a?(RPG::Item) and item.valuables? number = @items[item.id] return number == nil ? 0 : number end number = 0 for actor in members number += actor.carry_item_number(item, include_equip) end if bag_can_use? number += $game_party.carry_item_number(item) end return number end #-------------------------------------------------------------------------- # ● 指定アイテムの所持判定(パーティー全体) # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def has_item?(item, include_equip = false) return item_number(item, include_equip) > 0 end #-------------------------------------------------------------------------- # ○ 指定アイテムを所持するアクターをID配列で取得 # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def item_holder(item, include_equip = false) if item.is_a?(RPG::Item) and item.valuables? return [-1] if $game_party.has_item?(item) end result = [] for actor in members if actor.carrying_item?(item, include_equip) result.push(actor.id) end end if $game_party.bag_can_use? if $game_party.carrying_item?(item) result.push(0) end end return result end #-------------------------------------------------------------------------- # ○ パーティー全体のアイテム空き所持数に余裕があるか? #-------------------------------------------------------------------------- def item_room? return item_room_number > 0 end #-------------------------------------------------------------------------- # ○ パーティー全体のアイテム空き所持数 #-------------------------------------------------------------------------- def item_room_number result = 0 for actor in members result += actor.carry_room_number end if bag_can_use? result += carry_room_number end return result end #-------------------------------------------------------------------------- # ○ パーティー全体の指定スタックアイテムの合計スタック数を取得 # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def members_total_stack(item, include_equip = false) return 0 unless item.stack_item? result = 0 for actor in members result += actor.total_stack(item, include_equip) end if bag_can_use? result += total_stack(item) end return result end #-------------------------------------------------------------------------- # ○ パーティー全体の指定スタックアイテムの入手可能スタック数 #-------------------------------------------------------------------------- def members_stack_room_number(item) return 0 unless item.stack_item? result = 0 for actor in members result += actor.stack_room_number(item) end if bag_can_use? result += stack_room_number(item) end return result end #-------------------------------------------------------------------------- # ● アイテムの増加 (減少) # ※ いくつ増加(減少)できたか、を結果として返す。 # item : アイテム # n : 個数 # include_equip : 装備品も含める # tags : 特殊状態でのアイテム入手用・情報タグ #-------------------------------------------------------------------------- def gain_item(item, n, include_equip = false, tags = []) #- 貴重品の場合 @item_gain = false if n > 0 if item.is_a?(RPG::Item) and item.valuables? @last_gain_item_name = item.name number = item_number(item) if (0..99) === (number + n) result = [[number + n, 0].max, 99].min @items[item.id] = result @item_gain = true if (result - number) > 0 return (result - number).abs else ; return 0 end end #- 通常アイテムの場合 result = 0 if n > 0 # 増加 for actor in members until n == result break unless actor.obtain_item(item, false, tags) result += 1 end end if bag_can_use? until n == result break unless obtain_item(item, false, tags) result += 1 end end @item_gain = (result > 0) elsif n < 0 # 減少 for actor in members until n.abs == result break unless actor.remove_item(item) result += 1 end end if bag_can_use? until n.abs == result break unless remove_item(item) result += 1 end end if include_equip for actor in members until n.abs == result break unless actor.remove_item(item, true) result += 1 end end end end return result end #-------------------------------------------------------------------------- # ● スタックアイテムの増加 (減少) (端数による増加(減少)) # ※ いくつ増加(減少)できたか、を結果として返す。 # item : アイテム # n : 個数 # include_equip : 装備品も含める #-------------------------------------------------------------------------- def gain_stack_item(item, n, include_equip = false) return if item == nil return gain_item(item, n, include_equip) unless item.stack_item? if n > 0 obtain = 0 for actor in members obtain += actor.obtain_stack_item(item, n - obtain) break if n - obtain == 0 end if n - obtain != 0 and bag_can_use? obtain += obtain_stack_item(item, n - obtain) end @item_gain = (obtain > 0) return obtain elsif n < 0 remove = 0 for actor in members remove += actor.remove_stack_item(item, (n + remove).abs ) break if n + remove == 0 end if n + remove != 0 and bag_can_use? remove -= remove_stack_item(item, (n + remove).abs ) end if n + remove != 0 for actor in members remove += actor.remove_stack_item(item, (n + remove).abs, true) break if n + remove == 0 end end return remove end end #-------------------------------------------------------------------------- # ○ 直前のアイテム入手(減少)が成功したか? # ※ テンプレ宝箱イベント用。単数のみに対応。 #-------------------------------------------------------------------------- def item_gain? return @item_gain end #-------------------------------------------------------------------------- # ○ 預かり所の指定アイテムの預かり数取得 # item : アイテム # include_equip : 装備品も含める #-------------------------------------------------------------------------- def keep_item_number(item) case item when RPG::Item number = @items[item.id] when RPG::Weapon number = @weapons[item.id] when RPG::Armor number = @armors[item.id] end return number == nil ? 0 : number end #-------------------------------------------------------------------------- # ○ 預かり所アイテムオブジェクトの配列取得 (武器と防具を含む) #-------------------------------------------------------------------------- def keep_items result = [] for i in @items.keys.sort next if $data_items[i].valuables? result.push($data_items[i]) if @items[i] > 0 end for i in @weapons.keys.sort result.push($data_weapons[i]) if @weapons[i] > 0 end for i in @armors.keys.sort result.push($data_armors[i]) if @armors[i] > 0 end return result end #-------------------------------------------------------------------------- # ○ 預かり所アイテムの増加 (減少) # item : アイテム # n : 個数 # include_equip : 装備品も含める #-------------------------------------------------------------------------- def change_keep_item_value(item, n) number = keep_item_number(item) case item when RPG::Item @items[item.id] = [[number + n, 0].max, 99].min when RPG::Weapon @weapons[item.id] = [[number + n, 0].max, 99].min when RPG::Armor @armors[item.id] = [[number + n, 0].max, 99].min end end #-------------------------------------------------------------------------- # ○ 貴重品アイテムオブジェクトの配列取得 #-------------------------------------------------------------------------- def valuables_items result = [] for i in @items.keys.sort next unless $data_items[i].valuables? result.push($data_items[i]) if @items[i] > 0 end return result end #-------------------------------------------------------------------------- # ◎ 戦闘テスト用パーティのセットアップ #-------------------------------------------------------------------------- alias tig_ais_setup_battle_test_members setup_battle_test_members def setup_battle_test_members tig_ais_setup_battle_test_members for i in 1...$data_items.size if $data_items[i].battle_ok? @items[i] = 90 unless $data_items[i].name.empty? end end for i in 1...$data_weapons.size @weapons[i] = 90 unless $data_weapons[i].name.empty? end for i in 1...$data_armors.size @armors[i] = 90 unless $data_armors[i].name.empty? end end end ## クラス・ウインドウ ## #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ #  ゲーム中のすべてのウィンドウのスーパークラスです。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ○ ウインドウ用簡易アニメーション #-------------------------------------------------------------------------- def window_animation(id, set_rect = nil) animation = $data_animations[id] return if animation.nil? rect = set_rect ? set_rect : Rect.new(0, 0, self.contents.width, self.contents.height) sprite = Sprite_Base.new sprite.bitmap = Bitmap.new(rect.width, rect.height) sprite.x = self.x + 16 + rect.x sprite.y = self.y + 16 + rect.y sprite.z = 200 sprite.bitmap.blt(0, 0, self.contents, rect) sprite.start_animation(animation) while sprite.animation? sprite.update Graphics.update end sprite.dispose end #-------------------------------------------------------------------------- # ○ インデックスによるアイテム名の描画(アクター毎所持システム用) # item : アイテム (武器、防具でも可) # x : 描画先 X 座標 # y : 描画先 Y 座標 # enabled : 有効フラグ。false のとき半透明で描画 #-------------------------------------------------------------------------- def draw_item_name_ais(item_pos, x, y, enabled = true, charge = nil, icon_index = nil) if item_pos.is_a?(Array) actor = item_pos[0] index = item_pos[1] item = actor.carry_item(index) return if item == nil name = actor.carry_item_name(index) charge = charge == nil ? actor.carry_items_data[index]["charge"] : charge else item = item_pos return if item == nil name = item.name charge = charge == nil ? item.charge : charge end unless icon_index icon_index = item.icon_change(charge) ? item.icon_change(charge) : item.icon_index end draw_icon(icon_index, x, y, enabled) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 if charge and charge > 0 if item.stack_item? name = name + "×" + charge.to_s elsif item.display_charge and @display_charge name = name + " (" + charge.to_s + ")" end end self.contents.draw_text(x + 24, y, 166, WLH, name) end #-------------------------------------------------------------------------- # ○ アイテムのチャージ表示 # item : アイテム (武器、防具でも可) # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_item_charge(item_pos, x, y, width, align = 0) if item_pos.is_a?(Array) actor = item_pos[0] index = item_pos[1] item = actor.carry_item(index) return if item == nil charge = actor.carry_items_data[index]["charge"] max = actor.item_max_charge(index) else item = item_pos return if item == nil charge = max = item.charge end return if charge == nil self.contents.font.color = normal_color if item.stack_item? text = "×" + charge.to_s + "/" + max.to_s elsif not item.hide_charge text = charge.to_s + "/" + max.to_s end self.contents.draw_text(x, y, width, WLH, text, align) end #-------------------------------------------------------------------------- # ○ アイテム数の描画 #-------------------------------------------------------------------------- def draw_actor_possession(actor, x, y, width = 160, enabled = true) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(width - 80, y, 30, WLH, actor.carry_items.size, 2) self.contents.draw_text(width - 40, y, 10, WLH, "/", 2) self.contents.draw_text(width - 30, y, 30, WLH, actor.item_max, 2) end #-------------------------------------------------------------------------- # ○ 装備中アイテムの強調 #-------------------------------------------------------------------------- def draw_equip_frame(x, y, color, width = 190) color.alpha = 96 self.contents.fill_rect(x + 3, y + 5, width - 6, 14, color) color.alpha = 48 self.contents.clear_rect(x + 5, y + 7, width - 10, 10) self.contents.fill_rect(x + 5, y + 7, width - 10, 10, color) end #-------------------------------------------------------------------------- # ○ 装備部位表示 #-------------------------------------------------------------------------- def draw_equip_part(x, y, width, equip_type, item, align = 0, analyze = false) two_handed_name = "両手武器" sub_weapon_name = "補助武器" case equip_type when 0 if item.two_handed name = two_handed_name elsif item.sub_weapon? name = sub_weapon_name else if @actor and @actor.actor? and @actor.two_swords_style and not analyze name = Vocab::weapon1 else name = Vocab::weapon end end when 1 if item.sub_weapon? name = sub_weapon_name else name = Vocab::weapon2 end when 2 name = Vocab::armor1 when 3 name = Vocab::armor2 when 4 name = Vocab::armor3 when 5 name = Vocab::armor4 else if Actor_Item::EX_EQUIP[equip_type - 6] name = Actor_Item::EX_EQUIP[equip_type - 6] # 追加部位の名前(カスタマイズ項目から参照) else name = "" end end self.contents.font.color = system_color self.contents.draw_text(x, y, width, WLH, name, align) end end #============================================================================== # ■ Window_MenuStatus #------------------------------------------------------------------------------ #  メニュー画面でパーティメンバーのステータスを表示するウィンドウです。 #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :drew_face_rect #【メニューで効果アニメ】導入チェック用 end #============================================================================== # ■ Window_Item #------------------------------------------------------------------------------ #  アイテム画面などで、所持アイテムの一覧を表示するウィンドウです。 #============================================================================== class Window_Item < Window_Selectable #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :use_display #-------------------------------------------------------------------------- # ◎ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # width : ウィンドウの幅 # height : ウィンドウの高さ #-------------------------------------------------------------------------- alias tig_ais_initialize initialize def initialize(x, y, width, height) tig_ais_initialize(x, y, width, height) @use_display = Actor_Item::VALUABLES_DISPLAY_USE end #-------------------------------------------------------------------------- # ● アイテムをリストに含めるかどうか # item : アイテム #-------------------------------------------------------------------------- def include?(item) return false if item == nil if $game_temp.in_battle return false unless item.is_a?(RPG::Item) end return true end #-------------------------------------------------------------------------- # ● アイテムを許可状態で表示するかどうか # item : アイテム #-------------------------------------------------------------------------- def enable?(item) return true unless @use_display return $game_party.item_can_use?(item) end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh @data = [] for item in $game_party.valuables_items next unless include?(item) @data.push(item) if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id self.index = @data.size - 1 end end @data.push(nil) if include?(nil) @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil number = $game_party.item_number(item) enabled = enable?(item) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enabled) unless number <= 1 and Actor_Item::HIDE_VALUABLES_ONE self.contents.draw_text(rect, sprintf(":%2d", number), 2) end end end #-------------------------------------------------------------------------- # ○ 表示の切替 #-------------------------------------------------------------------------- def use_display=(use_display) @use_display = use_display $game_party.last_item_id = @item.id refresh end end #============================================================================== # ■ Window_Skill #------------------------------------------------------------------------------ #  スキル画面などで、使用できるスキルの一覧を表示するウィンドウです。 #============================================================================== class Window_Skill < Window_Selectable #-------------------------------------------------------------------------- # ◎ 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- alias tig_ais_draw_item draw_item def draw_item(index) if Actor_Item::EQUIP_SKILL_ICON_CHANGE rect = item_rect(index) self.contents.clear_rect(rect) skill = @data[index] if skill != nil rect.width -= 4 enabled = @actor.skill_can_use?(skill) draw_item_name_ais(skill, rect.x, rect.y, enabled, nil, icon_change(skill)) self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2) end else tig_ais_draw_item(index) # 本来の処理 end end #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def icon_change(skill) @actor.carry_items.size.times do |index| next unless @actor.equipping?(index) next unless @actor.carry_items_data[index]["skill"] if @actor.carry_items_data[index]["skill"].include?(skill.id) return @actor.carry_item(index).icon_index end end return nil end end #============================================================================== # ■ Window_Status #------------------------------------------------------------------------------ #  ステータス画面で表示する、フル仕様のステータスウィンドウです。 #============================================================================== class Window_Status < Window_Base #-------------------------------------------------------------------------- # ● 装備品の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_equipments(x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 120, WLH, Vocab::equip) n = 0 for i in @actor.equip_order n += 1 draw_item_name_ais([@actor, @actor.equip_item_index(i)], x + 16, y + WLH * (n), true) end end end #============================================================================== # ■ Window_Message #------------------------------------------------------------------------------ #  文章表示に使うメッセージウィンドウです。 #============================================================================== class Window_Message < Window_Selectable #-------------------------------------------------------------------------- # ◎ 特殊文字の変換 #-------------------------------------------------------------------------- alias tig_ais_convert_special_characters convert_special_characters def convert_special_characters @text.gsub!(/\\N\[入手アイテム\]/i) { $game_party.last_gain_item_name } tig_ais_convert_special_characters end end #============================================================================== # □ Window_Transforms_Command #------------------------------------------------------------------------------ # 条件により、並び順や項目数を変えることの出来るコマンドウインドウの雛型です。 # ※ このウインドウを制御する際はindexでなくselectで項目指定してください。 #============================================================================== class Window_Transforms_Command < Window_Command #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :order attr_reader :commands #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, command_width, column_max = 1, row_max = 0, spacing = 32) width = (command_width * column_max) + (spacing * (column_max - 1)) + 32 @display_order = [] create_command row_max = [(@commands.size + column_max - 1) / column_max, row_max].min super(width, @commands, column_max, row_max, spacing) self.index = 0 self.x = x self.y = y refresh end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear create_contents for i in 0...@item_max draw_item(i, command_enabled?(i)) end end #-------------------------------------------------------------------------- # ○ コマンド作成 (内容は継承先で定義する) #-------------------------------------------------------------------------- def create_command_original @commands = [] end #-------------------------------------------------------------------------- # ○ ヘルプテキスト作成 (内容は継承先で定義する) #-------------------------------------------------------------------------- def create_help_original @help_text = [] end #-------------------------------------------------------------------------- # ○ コマンド表示条件 (内容は継承先で定義する) #-------------------------------------------------------------------------- def command_display?(command_number) return true end #-------------------------------------------------------------------------- # ○ コマンド選択の条件 (内容は継承先で定義する) #-------------------------------------------------------------------------- def command_enabled?(command_number) return true end #-------------------------------------------------------------------------- # ○ コマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_command create_command_original create_help_original @order = Array.new(@commands.size){|i|i} sort_order command_hiding @item_max = @commands.size end #-------------------------------------------------------------------------- # ○ コマンド表示順の変更 #-------------------------------------------------------------------------- def sort_order new_order = [] new_commands = [] new_help_text = [] for i in @display_order new_order.push(@order[i]) new_commands.push(@commands[i]) new_help_text.push(@help_text[i]) end @order = (new_order+ @order).uniq @commands = (new_commands + @commands).uniq @help_text = (new_help_text + @help_text).uniq end #-------------------------------------------------------------------------- # ○ 非表示コマンドの調整 #-------------------------------------------------------------------------- def command_hiding @commands.size.times do |i| unless command_display?(@order[i]) @order[i] = nil @commands[i] = nil @help_text[i] = nil end end @order.compact! @commands.compact! @help_text.compact! end #-------------------------------------------------------------------------- # ○ 選択項目 #-------------------------------------------------------------------------- def select return @order[self.index] end #-------------------------------------------------------------------------- # ○ 選択中の項目名 #-------------------------------------------------------------------------- def select_item_name return @commands[self.index] end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(@help_text[self.index]) end #-------------------------------------------------------------------------- # ○ 新しいコマンド表示順のセット #-------------------------------------------------------------------------- def set_new_order(order) @display_order = order sort_order command_hiding @item_max = @commands.size refresh end end #============================================================================== # □ Window_Slide_Command #------------------------------------------------------------------------------ #  カテゴリ選択などに使う、横スライド型コマンド選択ウインドウの雛型です。 #============================================================================== class Window_Slide_Command < Window_Selectable #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, width, align = 0, active = true) create_command super(x, y, width, WLH + 32) @column_max = [@commands.size, 1].max @item_max = @commands.size @align = align self.index = 0 self.cursor_rect.empty @last_active = self.active = active refresh end #-------------------------------------------------------------------------- # ○ コマンド作成 (内容は継承先で定義する) #-------------------------------------------------------------------------- def create_command @commands = [] end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update super if @last_active != self.active @last_active = self.active refresh end end #-------------------------------------------------------------------------- # ○ ウィンドウ内容の作成 #-------------------------------------------------------------------------- def create_contents self.contents.dispose if self.active self.contents = Bitmap.new((width - 32) * @commands.size, height - 32) else self.contents = Bitmap.new(width - 32, height - 32) end end #-------------------------------------------------------------------------- # ○ 項目を描画する矩形の取得 # index : 項目番号 #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.width = width - 32 rect.height = WLH rect.x = index * (width - 32) return rect end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear create_contents if self.active for i in 0...@item_max draw_item(i) end else draw_item(@index, true) end end #-------------------------------------------------------------------------- # ○ 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index, one = false) rect = one ? item_rect(0) : item_rect(index) self.contents.clear_rect(rect) self.contents.font.color = normal_color self.contents.draw_text(rect, @commands[index], @align) end #-------------------------------------------------------------------------- # ○ カーソルの更新 #-------------------------------------------------------------------------- def update_cursor if @index >= 0 if self.active self.ox = @index * (width - 32) else self.ox = 0 end end end end #============================================================================== # □ Window_Easy_Choices #------------------------------------------------------------------------------ #  簡単な2択質問を行えるウインドウです。 #============================================================================== class Window_Easy_Choices < Window_Selectable #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 #-------------------------------------------------------------------------- def initialize(text_set, x = nil, y = nil, width = nil) if width == nil width = text_set[0].size * 6 + 32 end x = (544 - width) / 2 if x == nil y = 168 if y == nil super(x, y, width, 2 * WLH + 32) @text_set = text_set @column_max = 2 @item_max = 2 set_contents self.active = true self.index = 0 self.back_opacity = Actor_Item::CUSTOM_OPACITY_1 end #-------------------------------------------------------------------------- # ○ 選択肢の大きさ #-------------------------------------------------------------------------- def choices_size return (self.width - 32) / 2 end #-------------------------------------------------------------------------- # ○ 項目作成 #-------------------------------------------------------------------------- def set_contents self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(0, 0, self.width - 32, WLH, @text_set[0]) self.contents.draw_text(0, WLH, choices_size, WLH, @text_set[1], 1) self.contents.draw_text(choices_size, WLH, choices_size, WLH, @text_set[2], 1) end #-------------------------------------------------------------------------- # ○ カーソルの更新 #-------------------------------------------------------------------------- def update_cursor if @index < 0 self.cursor_rect.empty elsif @index == 0 self.cursor_rect.set(0, WLH, choices_size, WLH) elsif @index == 1 self.cursor_rect.set(choices_size, WLH, choices_size, WLH) end end end #============================================================================== # □ Window_Easy_NumberInput #------------------------------------------------------------------------------ #  数値入力用の小さなウィンドウです。 #============================================================================== class Window_Easy_NumberInput < Window_Base #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :number #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # digits_max : 桁数 #-------------------------------------------------------------------------- def initialize(x, y, max_number, number = nil) @number = number ? number : max_number @max_number = max_number @digits_max = 0 until max_number < 1 @digits_max += 1 max_number /= 10 end super(x, y, @digits_max * 16 + 32, 56) @index = @digits_max - 1 self.active = true refresh update_cursor end #-------------------------------------------------------------------------- # ○ 現在の値が有効な範囲か? #-------------------------------------------------------------------------- def effective_range? return false if @number == 0 return false if @number > @max_number return true end #-------------------------------------------------------------------------- # ○ カーソルを右に移動 # wrap : ラップアラウンド許可 #-------------------------------------------------------------------------- def cursor_right(wrap) if @index < @digits_max - 1 or wrap @index = (@index + 1) % @digits_max end end #-------------------------------------------------------------------------- # ○ カーソルを左に移動 # wrap : ラップアラウンド許可 #-------------------------------------------------------------------------- def cursor_left(wrap) if @index > 0 or wrap @index = (@index + @digits_max - 1) % @digits_max end end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update super if self.active if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN) Sound.play_cursor place = 10 ** (@digits_max - 1 - @index) if Input.repeat?(Input::UP) @number += 1 * place if @number > @max_number while @number - place > 0 @number -= place end end elsif Input.repeat?(Input::DOWN) @number -= 1 * place if @number <= 0 while @number + place <= @max_number @number += place end end end refresh end last_index = @index if Input.repeat?(Input::RIGHT) cursor_right(Input.trigger?(Input::RIGHT)) end if Input.repeat?(Input::LEFT) cursor_left(Input.trigger?(Input::LEFT)) end if @index != last_index Sound.play_cursor end update_cursor end end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh enabled = effective_range? self.contents.clear self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 s = sprintf("%0*d", @digits_max, @number) for i in 0...@digits_max self.contents.draw_text(i * 16, 0, 16, WLH, s[i,1], 1) end end #-------------------------------------------------------------------------- # ○ カーソルの更新 #-------------------------------------------------------------------------- def update_cursor self.cursor_rect.set(@index * 16, 0, 16, WLH) end end #============================================================================== # □ Window_Actor_Item_Command #------------------------------------------------------------------------------ #  アクター毎アイテム画面のコマンドウインドウです。 #============================================================================== class Window_Actor_Item_Command < Window_Transforms_Command #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 82, Actor_Item::ITEM_COMMAND_COLUMN_MAX, 5, 12) end #-------------------------------------------------------------------------- # ○ コマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_command @display_order = Actor_Item::ITEM_COMMAND_SORT super end #-------------------------------------------------------------------------- # ○ コマンド作成(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def create_command_original super @commands[0] = "使う" @commands[1] = "装備" @commands[2] = "渡す" @commands[3] = $game_party.bag_name @commands[4] = "捨てる" if $game_party.members.size == 1 # パーティーひとりならコマンド変更 @commands[2] = "整理" end end #-------------------------------------------------------------------------- # ○ ヘルプテキスト作成(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def create_help_original super @help_text[0] = "アイテムを使います。" @help_text[1] = "アイテムを装備します。" @help_text[2] = "アイテムを入れ替えたり、仲間に渡します。" @help_text[3] = $game_party.bag_name + "のアイテムを取り出します。" @help_text[4] = "アイテムを捨てます。" if $game_party.members.size == 1 # パーティーひとりなら内容変更 @help_text[2] = "アイテムを整理できます。" end if $game_party.bag_not_open # 袋の使用不可時メッセージ @help_text[3] = $game_party.bag_name + "を使うことが出来ません。" end end #-------------------------------------------------------------------------- # ○ コマンド表示条件 #-------------------------------------------------------------------------- def command_display?(command_number) case command_number when 3 return $game_party.bag_use # 袋使用可の時だけコマンドを表示 end return true end #-------------------------------------------------------------------------- # ○ コマンド選択の条件 #-------------------------------------------------------------------------- def command_enabled?(command_number) case command_number when 3 return false if $game_party.bag_not_open # 袋禁止の時はコマンドを不透明に end return true end end #============================================================================== # □ Window_Pass #------------------------------------------------------------------------------ #  アクター毎アイテムのアイテム譲渡メンバー決定用ウインドウです。 #============================================================================== class Window_Pass < Window_Selectable #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- SINGLE_PASS_COMMAND = "アイテムを持ちなおす" #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :increase # フラグ:増加入手用か? attr_accessor :stack_item_data # スタックアイテム情報 #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, max_size, menu = false) @menu = menu item_size = $game_party.members.size if @menu item_size += 1 if $game_party.bag_use else item_size += 1 if $game_party.bag_can_use? end window_size = [item_size, max_size].min super(x, y, 230, WLH * window_size + 32) @item_max = item_size @increase = true # アイテムを増やす(渡す、買う)為に使うなら true 、 # 減らす(売る)為に使うならなら false。 @stack_item_data = [] refresh self.index = 0 self.active = false self.back_opacity = Actor_Item::CUSTOM_OPACITY_1 end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear create_contents self.contents.font.color = normal_color if @menu and $game_party.members.size == 1 self.contents.draw_text(0, 0, 230, WLH, SINGLE_PASS_COMMAND) else $game_party.members.size.times do |i| actor = $game_party.members[i] if @increase if @stack_item_data.empty? enabled = actor.carry_room? else enabled = actor.stack_room_number(@stack_item_data[0]) >= @stack_item_data[1] end else enabled = actor.carry_items.empty? == false end self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(0, i * WLH, 108, WLH, actor.name) draw_actor_possession(actor, 0, i * WLH, 198, enabled) end end if $game_party.bag_use if @increase if @stack_item_data.empty? enabled = $game_party.carry_room? else enabled = $game_party.stack_room_number(@stack_item_data[0]) >= @stack_item_data[1] end else enabled = $game_party.carry_items.empty? == false end enabled = false if $game_party.bag_not_open self.contents.font.color.alpha = enabled ? 255 : 128 if @menu self.contents.draw_text(0, ($game_party.members.size) * WLH, 230, WLH, $game_party.bag_name + "に入れる") else self.contents.draw_text(0, ($game_party.members.size) * WLH, 108, WLH, $game_party.bag_name) draw_actor_possession($game_party, 0, ($game_party.members.size) * WLH, 198, enabled) end end end #-------------------------------------------------------------------------- # ○ カーソルを 1 ページ後ろに移動 #-------------------------------------------------------------------------- def cursor_pagedown end #-------------------------------------------------------------------------- # ○ カーソルを 1 ページ前に移動 #-------------------------------------------------------------------------- def cursor_pageup end #-------------------------------------------------------------------------- # ○ 選択アクター(ID) #-------------------------------------------------------------------------- def select_actor return $game_party if self.index >= $game_party.members.size return $game_party.members[self.index] end end #============================================================================== # □ Window_Actor_Item_Throws #------------------------------------------------------------------------------ #  アクター毎アイテムの破棄確認ウインドウです。 #============================================================================== class Window_Actor_Item_Throws < Window_Selectable #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- THROWS_COMMAND = "アイテムを捨てる" #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 182, WLH + 32) self.index = 0 self.active = false self.back_opacity = Actor_Item::CUSTOM_OPACITY_1 set_contents end #-------------------------------------------------------------------------- # ○ 項目作成 #-------------------------------------------------------------------------- def set_contents self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(0, 0, self.width - 32, WLH, THROWS_COMMAND, 1) end end #============================================================================== # □ Window_Item_Trading #------------------------------------------------------------------------------ #  アクター毎アイテムの売却確認ウインドウです。 #============================================================================== class Window_Item_Trading < Window_Base #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- TRADING = "交換するアイテム" #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :item_index #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 230, WLH * 2 + 32) self.back_opacity = Actor_Item::CUSTOM_OPACITY_1 refresh end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh(actor = nil, item_index = nil) self.contents.clear return if actor == nil or item_index == nil @item_index = item_index self.contents.font.color = system_color self.contents.draw_text(0, 0, self.width - 32, WLH, TRADING) draw_item_name_ais([actor, item_index], 0, WLH, true) end end #============================================================================== # □ Window_Actor_Item_Possession #------------------------------------------------------------------------------ #  アクター毎アイテムウインドウにて、数量を表示するウインドウです。 #============================================================================== class Window_Actor_Item_Possession < Window_Selectable #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor = nil) super(x, y, 282, 56) self.opacity = 0 @actor = actor refresh end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = system_color self.contents.font.size = 16 name = @actor.is_a?(Game_Actor) ? @actor.name : $game_party.bag_name self.contents.draw_text(0, 0, 158, WLH, name + "のアイテム数") self.contents.font.size = 20 draw_actor_possession(@actor, 0, 0, 250) end #-------------------------------------------------------------------------- # ○ アクター変更 #-------------------------------------------------------------------------- def chenge_actor(actor) @actor = actor refresh end end #============================================================================== # □ Window_Actor_Item #------------------------------------------------------------------------------ #  アクターの所持アイテムの一覧を表示するウィンドウです。 #============================================================================== class Window_Actor_Item < Window_Selectable #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :actor attr_accessor :command_window attr_accessor :info_windows attr_accessor :fixation_mode attr_accessor :prior_help_text #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # width : ウィンドウの幅 # height : ウィンドウの高さ #-------------------------------------------------------------------------- def initialize(x, y, width, max_item, actor, column_max = 1) @actor = actor @max_item = max_item height = [@actor.item_max, @max_item].min * WLH + 32 super(x, y, width, height) @column_max = column_max @info_windows = [] @command_window = nil @fixation_mode = nil @prior_help_text = nil @display_charge = true self.active = false self.index = 0 refresh end #-------------------------------------------------------------------------- # ○ アイテム表示モードの取得 #-------------------------------------------------------------------------- def mode return -1 if @fixation_mode == nil and @command_window == nil return @fixation_mode if @fixation_mode != nil return -1 if @command_window.active return @command_window.select end #-------------------------------------------------------------------------- # ○ 選択アイテムオブジェクトの取得 #-------------------------------------------------------------------------- def item return nil if @actor.carry_items_data.empty? return nil if @actor.carry_items_data[@index] == nil return @actor.carry_item(@index) end #-------------------------------------------------------------------------- # ○ 選択項目のアイテムデータの取得 #-------------------------------------------------------------------------- def item_data return nil if @actor.carry_items_data.empty? return nil if @actor.carry_items_data[@index] == nil return @actor.carry_items_data[@index] end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update last_index = @index super info_windows_set_index if @index != last_index @info_windows.each{|window|window.update} end #-------------------------------------------------------------------------- # ○ 情報ウインドウのリフレッシュ #-------------------------------------------------------------------------- def info_windows_set_index for window in @info_windows window.set_item_pos([@actor, @index]) end end #-------------------------------------------------------------------------- # ○ カーソルの更新 #-------------------------------------------------------------------------- def update_cursor if @index < 0 # カーソル位置が 0 未満の場合 self.cursor_rect.empty # カーソルを無効とする else # カーソル位置が 0 以上の場合 row = @index / @column_max # 現在の行を取得 if row < top_row # 表示されている先頭の行より前の場合 self.top_row = row # 現在の行が先頭になるようにスクロール end if row > bottom_row # 表示されている末尾の行より後ろの場合 self.bottom_row = row # 現在の行が末尾になるようにスクロール end rect = item_rect(@index) # 選択されている項目の矩形を取得 rect.width -= 50 if @actor.is_a?(Game_Actor) rect.y -= self.oy # 矩形をスクロール位置に合わせる self.cursor_rect = rect # カーソルの矩形を更新 end end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh @actor.carry_items_refresh if @actor.is_a?(Game_Actor) @data = @actor.carry_items @data.push(nil) if @data.empty? @item_max = @data.size create_contents @item_max.times { |i| draw_item(i) } if @index > 0 @index = [@item_max - 1, @index].min end info_windows_set_index end #-------------------------------------------------------------------------- # ○ 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil rect.width -= 4 if @actor.is_a?(Game_Actor) if @actor.equipping?(index) draw_equip_frame(rect.x, rect.y, equip_color(index)) equip_type = @actor.carry_items_data[index]["equip"] self.contents.font.size = 16 draw_equip_part(rect.x + 192, rect.y, 48, equip_type, @actor.carry_item(index)) self.contents.font.size = 20 end end enabled = item_enabled(mode, index) draw_item_name_ais([@actor, index], rect.x, rect.y, enabled) end end #-------------------------------------------------------------------------- # ○ 装備枠カラー取得 #-------------------------------------------------------------------------- def equip_color(index) if @actor.carry_item(index).curse_states != nil and @actor.state?(@actor.carry_item(index).curse_states) return Color.new(255, 128, 255) end if @actor.fix_equipment?(index) return Color.new(128, 255, 128) else return Color.new(255, 255, 255) end end #-------------------------------------------------------------------------- # ○ 不透明度取得 #-------------------------------------------------------------------------- def item_enabled(mode, index) enabled = true case mode when 0 # 使う enabled = @actor.item_can_use_index?(index) when 1 # 装備 if not $BTEST and $game_temp.in_battle and not Actor_Item::CHANGE_EQUIP_BATTLE_MODE enabled = Actor_Item::CHANGE_EQUIP_BATTLE.include?(@actor.carry_item(index).equip_type) else enabled = @actor.equipable_index?(index) end when 2 # 渡す enabled = @actor.item_can_pass?(index) when 3 # すてる enabled = @actor.can_throw_index?(index) when 4 # 売却 enabled = @actor.can_sell_index?(index) enabled = false unless $game_temp.shop_handling?(@actor.carry_item(index)) when 5 # 預ける enabled = @actor.can_entrust_index?(index) when 6 # 充填 enabled = @actor.item_can_fill?(index) enabled = false unless $game_temp.shop_handling?(@actor.carry_item(index)) when 7 # 修復 enabled = @actor.item_can_repair?(index) enabled = false unless $game_temp.shop_handling?(@actor.carry_item(index)) end return enabled end #-------------------------------------------------------------------------- # ○ ヘルプテキスト生成 #-------------------------------------------------------------------------- def create_help_text(text) if @actor.carry_items_data[@index]["charge"] text = text.gsub(/\\CH/i) { @actor.carry_items_data[@index]["charge"] } end return text end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help text = item == nil ? "" : create_help_text(item.description) text = @prior_help_text if @prior_help_text @help_window.set_text(text) end #-------------------------------------------------------------------------- # ○ カーソルを 1 ページ後ろに移動 #-------------------------------------------------------------------------- def cursor_pagedown end #-------------------------------------------------------------------------- # ○ カーソルを 1 ページ前に移動 #-------------------------------------------------------------------------- def cursor_pageup end #-------------------------------------------------------------------------- # ○ アクター変更 #-------------------------------------------------------------------------- def chenge_actor(actor) @actor = actor self.height = [@actor.item_max, @max_item].min * WLH + 32 @index = 0 if @index != -1 info_windows_set_index @info_windows.each{|window|window.chenge_actor(actor)} refresh end #-------------------------------------------------------------------------- # ○ 不透明度表示モード変更 #-------------------------------------------------------------------------- def fixation_mode=(fixation_mode) @fixation_mode = fixation_mode refresh end end #============================================================================== # □ Window_Actor_Item_Status #------------------------------------------------------------------------------ #  アクター毎アイテムのステータスウインドウです。 #============================================================================== class Window_Actor_Item_Status < Window_Selectable #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :actor #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, 272, 152) @actor = actor @item_max = 1 refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear draw_actor_name(@actor, 0, 0) draw_actor_class(@actor, 120, 0) draw_actor_face(@actor, 2, 26, 92) draw_actor_level(@actor, 120, WLH * 1) draw_actor_state(@actor, 120, WLH * 2) draw_actor_hp(@actor, 120, WLH * 3) draw_actor_mp(@actor, 120, WLH * 4) end #-------------------------------------------------------------------------- # ○ カーソルの更新 #-------------------------------------------------------------------------- def update_cursor if @index < 0 # カーソルなし self.cursor_rect.empty elsif self.cursor_rect.set(0, 0, self.width - 32, self.height - 32) end end #-------------------------------------------------------------------------- # ○ アクター変更 #-------------------------------------------------------------------------- def chenge_actor(actor) @actor = actor refresh end #-------------------------------------------------------------------------- # ○ アイテムをセット #-------------------------------------------------------------------------- def set_item(item) refresh end #-------------------------------------------------------------------------- # ○ アイテム位置情報をセット #-------------------------------------------------------------------------- def set_item_pos(item_pos) refresh end end #============================================================================== # □ Window_Actor_Item_Equip #------------------------------------------------------------------------------ #  アクター毎アイテムの装備変更結果表示用のウインドウです。 #============================================================================== class Window_Actor_Item_Equip < Window_Base #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :actor attr_reader :item attr_reader :item_pos #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, 272, 152) @actor = actor @item_pos = [nil, nil] @item = nil refresh end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh @save_data = nil set_new_parameters self.contents.clear return if @actor == nil draw_actor_name(@actor, 0, 0) draw_actor_class(@actor, 120, 0) draw_parameter(5, WLH * 1, 0) draw_parameter(5, WLH * 2, 1) draw_parameter(5, WLH * 3, 2) draw_parameter(5, WLH * 4, 3) self.contents.font.color = system_color self.contents.draw_text(130, WLH * 1, 110, WLH, annotation, 1) if @save_data @item_pos[1] = @save_data @actor.carry_items_data.delete_at(@actor.carry_items.size - 1) end end #-------------------------------------------------------------------------- # ○ 装備注釈を取得(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def annotation return "" if @item == nil return "" if @item.is_a?(RPG::Item) return "" unless @actor.weapon_type_match?(@item) if item_individual_data? if @actor != @item_pos[0] return "変更不可" if not @actor.test_acquires_equipment(-1) else return "呪い" if @actor.equipping?(@item_pos[1]) and @actor.state?(@item.curse_states) return "固定装備" if @actor.equipping?(@item_pos[1]) and @actor.fix_equipment?(@item_pos[1]) return "装備中" if @actor.equipping?(@item_pos[1]) return "変更不可" if not @actor.test_acquires_equipment(@item_pos[1]) end else return "装備中" if @actor.same_item_equipping?(@item) end return "装備不可" unless @actor.equippable?(@item) return "レベル不足" if @actor.level < @item.equip_qualification_level return "" end #-------------------------------------------------------------------------- # ○ 設定されているアイテムが装備可能か? #-------------------------------------------------------------------------- def equipable? if item_individual_data? return @actor.equipable_index?(@item_pos[1]) else return @actor.equipable_item?(@item) end end #-------------------------------------------------------------------------- # ○ 装備変更後の能力値設定 #-------------------------------------------------------------------------- def set_new_parameters return if @actor == nil if item_individual_data? and @actor != @item_pos[0] @actor.carry_items_data.push(@item_pos[0].carry_items_data[@item_pos[1]]) @save_data = @item_pos[1] @item_pos[1] = @actor.carry_items.size - 1 end if equipable? temp_actor = @actor.clone temp_actor.make_clone if item_individual_data? item = nil index = @item_pos[1] else temp_actor.obtain_item(@item, true) item = @item index = -1 end temp_actor.acquires_equipment(index, true) @new_atk = temp_actor.atk ; @new_def = temp_actor.def @new_spi = temp_actor.spi ; @new_agi = temp_actor.agi else @new_atk = nil ; @new_def = nil @new_spi = nil ; @new_agi = nil end end #-------------------------------------------------------------------------- # ○ 装備変更後の能力値の描画色取得 # old_value : 装備変更前の能力値 # new_value : 装備変更後の能力値 #-------------------------------------------------------------------------- def new_parameter_color(old_value, new_value) if new_value > old_value # 強くなる return power_up_color elsif new_value == old_value # 変わらず return normal_color else # 弱くなる return power_down_color end end #-------------------------------------------------------------------------- # ○ 能力値の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 # type : 能力値の種類 (0〜3) #-------------------------------------------------------------------------- def draw_parameter(x, y, type) case type when 0 name = Vocab::atk value = @actor.atk new_value = @new_atk when 1 name = Vocab::def value = @actor.def new_value = @new_def when 2 name = Vocab::spi value = @actor.spi new_value = @new_spi when 3 name = Vocab::agi value = @actor.agi new_value = @new_agi end self.contents.font.color = system_color self.contents.draw_text(x, y, 75, WLH, name) self.contents.font.color = normal_color self.contents.draw_text(x + 80, y, 30, WLH, value, 2) if annotation == "" and new_value != nil self.contents.font.color = system_color self.contents.draw_text(x + 120, y, 20, WLH, "→", 1) self.contents.font.color = new_parameter_color(value, new_value) self.contents.draw_text(x + 145, y, 30, WLH, new_value, 2) diff = new_value - value if diff != 0 self.contents.draw_text(x + 175, y, 20, WLH, diff < 0 ? "(-" : "(+") self.contents.draw_text(x + 195, y, 40, WLH, diff.abs.to_s + ")") end end end #-------------------------------------------------------------------------- # ○ アクター変更 #-------------------------------------------------------------------------- def chenge_actor(actor) @actor = actor @item_pos[0] = actor if @item_pos refresh end #-------------------------------------------------------------------------- # ○ テストアクターのみ変更 #-------------------------------------------------------------------------- def chenge_test_actor(actor) if actor.is_a?(Game_Actor) @actor = actor else @actor = nil end refresh end #-------------------------------------------------------------------------- # ○ アイテムをセット #-------------------------------------------------------------------------- def set_item(item) @item = item @item_pos = [nil, nil] refresh end #-------------------------------------------------------------------------- # ○ アイテムデータをセット #-------------------------------------------------------------------------- def set_item_pos(item_pos) @item_pos = item_pos @item = item_pos[0].carry_item(item_pos[1]) refresh end #-------------------------------------------------------------------------- # ○ アイテムデータが個別データを持つか? #-------------------------------------------------------------------------- def item_individual_data? return true if @item_pos[0] != nil and @item_pos[1] != nil return false end end #============================================================================== # □ Window_Actor_Item_Analyze #------------------------------------------------------------------------------ #  アクター毎アイテムのアイテム詳細ウインドウです。 #============================================================================== class Window_Actor_Item_Analyze < Window_Base #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :item_pos attr_reader :item #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor = nil) @actor = actor @item_pos = [nil, nil] @item = nil super(x, y, 272, 152) refresh end #-------------------------------------------------------------------------- # ○ リフレッシュ(テキストカスタマイズ可能部分) # ※ 該当する部分(" "内)を直接書き換えてください。 #-------------------------------------------------------------------------- def refresh self.contents.clear return if @item == nil #- 名前の描画(共通) data = item_individual_data? ? @item_pos : @item draw_item_name_ais(data, 0, 0, true) #- 属性の描画(共通) y = 2 self.contents.font.color = normal_color if @item.analyze_text1 text = @item.analyze_text1 else texts = [] self.contents.font.color = normal_color for element_id in @item.element_set next if hide_element?(element_id) texts.push($data_system.elements[element_id]) end if @item.is_a?(RPG::Item) # アイテムのみ追加 texts.push("物理攻撃 ") if @item.physical_attack texts.push("防御力無視") if @item.ignore_defense end text = "" for t in texts text += t break if contents.text_size(text).width > 277 # 表記が長い場合は省略 text += " " end end if text != "" self.contents.draw_text(55, WLH * y, 185, WLH, text) self.contents.font.color = system_color text = @item.is_a?(RPG::Armor) ? "半減:" : "属性:" self.contents.draw_text(0, WLH * y, 55, WLH, text) y += 1 end #- チャージor消耗品の描画 if @item.charge != nil if item_individual_data? and @item_pos[0].item_max_charge(@item_pos[1]) > 1 self.contents.font.size = 15 draw_item_charge(@item_pos, self.width - 50 - 32, 0, 50, 2) self.contents.font.size = 20 elsif not item_individual_data? and @item.charge > 1 unless @item.stack_item? self.contents.font.size = 15 draw_item_charge(@item, self.width - 50 - 32, 0, 50, 2) self.contents.font.size = 20 end else self.contents.font.color = system_color self.contents.font.size = 16 self.contents.draw_text(0, 0, self.width - 32, WLH, "消耗品", 2) self.contents.font.size = 20 end end case @item when RPG::Item #- 効果の描画 self.contents.font.color = system_color self.contents.draw_text(0, WLH * 1, 55, WLH, "効果:") if @item.analyze_text2 text = @item.analyze_text2 else case @item.scope when 0 ; text = "?" when 1 ; text = "敵単体" when 2 ; text = "敵全体" when 3 ; text = "連続で敵単体" when 4 ; text = "ランダムで敵単体" when 5 ; text = "ランダムで敵2体" when 6 ; text = "ランダムで敵3体" when 7, 9 ; text = "味方単体" when 8, 10 ; text = "味方全体" when 11 ; text = "自分" end if @item.scope != 0 if @item.hp_recovery_rate == 100 and @item.mp_recovery_rate == 100 text += "のHP・MP全回復" elsif ( @item.hp_recovery > 0 or @item.hp_recovery_rate > 0 ) and ( @item.mp_recovery > 0 or @item.mp_recovery_rate > 0 ) text += "のHP・MP回復" elsif @item.hp_recovery_rate == 100 text += "のHP全回復" elsif @item.mp_recovery_rate == 100 text += "のMP全回復" elsif @item.hp_recovery > 0 or @item.hp_recovery_rate > 0 text += "のHP回復" elsif @item.mp_recovery > 0 or @item.mp_recovery_rate > 0 text += "のMP回復" elsif @item.base_damage > 0 or @item.atk_f > 0 or @item.spi_f > 0 if @item.damage_to_mp and @item.absorb_damage text += "のMP吸収" elsif @item.absorb_damage text += "からダメージ吸収" elsif @item.damage_to_mp text += "のMPへダメージ" else text += "へダメージ" end end end end self.contents.font.color = normal_color self.contents.draw_text(55, WLH * 1, 185, WLH, text) #- 付加ステート・回復ステートの描画 display_state_set = @item.minus_state_set.collect{|id| hide_state?(id) ? nil : id}.compact unless display_state_set.empty? y += 1 self.contents.font.color = system_color text = "回復:" self.contents.draw_text(0, WLH * (y-1), self.contents.width, WLH, text) x = self.contents.text_size(text).width end for state_id in display_state_set state = $data_states[state_id] draw_icon(state.icon_index, x, WLH * (y-1)) x += 26 break if x + 24 > self.contents.width end display_state_set = @item.plus_state_set.collect{|id| hide_state?(id) ? nil : id}.compact unless display_state_set.empty? y += 1 self.contents.font.color = system_color text = "付加:" self.contents.draw_text(0, WLH * (y-1), self.contents.width, WLH, text) x = self.contents.text_size(text).width end for state_id in display_state_set state = $data_states[state_id] draw_icon(state.icon_index, x, WLH * (y-1)) x += 26 break if x + 24 > self.contents.width end when RPG::Weapon, RPG::Armor #- 装備タイプの描画 draw_equip_part(0, WLH * 1, 80, @item.equip_part, @item, 0, true) #- 装備時の向上能力値の描画 case @item when RPG::Weapon name = Vocab::atk ; value = @item.atk if @item.def > 0 or @item.spi > 0 or @item.agi > 0 bonus = true ; else bonus = false end when RPG::Armor name = Vocab::def ; value = @item.def if @item.atk > 0 or @item.spi > 0 or @item.agi > 0 bonus = true ; else bonus = false end end self.contents.font.color = system_color self.contents.draw_text(102, WLH * 1, 60, WLH, name) self.contents.draw_text(212, WLH * 1, 115, WLH, "+α") if bonus self.contents.font.color = normal_color self.contents.draw_text(157, WLH * 1, 10, WLH, value < 0 ? "-" : " ") self.contents.draw_text(172, WLH * 1, 30, WLH, value.abs) #- 付加ステート・無効ステートの描画 display_state_set = @item.state_set.collect{|id| hide_state?(id) ? nil : id}.compact unless display_state_set.empty? self.contents.font.color = system_color text = @item.is_a?(RPG::Weapon) ? "付加:" : "無効:" self.contents.draw_text(0, WLH * y, self.contents.width, WLH, text) x = self.contents.text_size(text).width end for state_id in display_state_set state = $data_states[state_id] draw_icon(state.icon_index, x, WLH * y) x += 26 break if x + 24 > self.contents.width end #- 補足の描画 if @item.analyze_text3 text = @item.analyze_text3 else texts = [] if @item.item_power != 0 if $data_items[@item.item_power].occasion == 1 texts.push("戦闘時使用効果") else texts.push("使用効果") end end texts.push("スキル習得") unless @item.equip_skills.empty? if @item.is_a?(RPG::Weapon) texts.push("ターン内先制") if @item.fast_attack texts.push("連続攻撃") if @item.dual_attack texts.push("クリティカル頻発") if @item.critical_bonus elsif @item.is_a?(RPG::Armor) texts.push("クリティカル防止") if @item.prevent_critical texts.push("消費MP半分") if @item.half_mp_cost texts.push("経験値2倍") if @item.double_exp_gain texts.push("HP自動回復") if @item.auto_hp_recover end text = "" for t in texts text += t break if contents.text_size(text).width > 360 # 表記が長い場合は省略する text += " " end end self.contents.font.color = normal_color self.contents.draw_text(0, WLH * 4, 240, WLH, text, 2) end end #-------------------------------------------------------------------------- # ○ アクター変更 #-------------------------------------------------------------------------- def chenge_actor(actor) @actor = actor refresh end #-------------------------------------------------------------------------- # ○ アイテムをセット #-------------------------------------------------------------------------- def set_item(item) @item = item @item_pos = [nil, nil] refresh end #-------------------------------------------------------------------------- # ○ アイテムの位置情報をセット #-------------------------------------------------------------------------- def set_item_pos(item_pos) @item_pos = item_pos @item = item_pos[0].carry_item(item_pos[1]) refresh end #-------------------------------------------------------------------------- # ○ アイテムの位置情報が個別データを持つか? #-------------------------------------------------------------------------- def item_individual_data? return item_pos[0] != nil end #-------------------------------------------------------------------------- # ○ 隠すべき属性か? #-------------------------------------------------------------------------- def hide_element?(element_id) return Actor_Item::HIDE_ELEMENT.include?(element_id) end #-------------------------------------------------------------------------- # ○ 隠すべきステートか? #-------------------------------------------------------------------------- def hide_state?(state_id) return true if $data_states[state_id].icon_index == 0 return Actor_Item::HIDE_STATE.include?(state_id) end end #============================================================================== # □ Window_Bag_Command #------------------------------------------------------------------------------ #  アクター毎アイテム画面のふくろ用コマンドウインドウです。 #============================================================================== class Window_Bag_Command < Window_Transforms_Command #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 102) @item_index = nil end #-------------------------------------------------------------------------- # ○ コマンド作成(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def create_command_original super @commands[0] = "取り出す" @commands[1] = "入れなおす" @commands[2] = "捨てる" end #-------------------------------------------------------------------------- # ○ ヘルプテキスト作成(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def create_help_original super @help_text[0] = $game_party.bag_name + "のアイテムを取り出します。" @help_text[1] = $game_party.bag_name + "にアイテムを入れなおします。" @help_text[2] = $game_party.bag_name + "のアイテムを捨てます。" end #-------------------------------------------------------------------------- # ○ コマンド選択の条件 #-------------------------------------------------------------------------- def command_enabled?(command_number) return true if @item_index == nil case command_number when 2 return false unless $game_party.can_throw_index?(@item_index) end return true end #-------------------------------------------------------------------------- # ○ コマンド選択の条件 #-------------------------------------------------------------------------- def set_item_index(item_index) @item_index = item_index refresh end end #============================================================================== # □ Window_AIS_Shop_Command #------------------------------------------------------------------------------ #  アクター毎アイテムのショップ用コマンドウインドウです。 #============================================================================== class Window_AIS_Shop_Command < Window_Transforms_Command #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 102) end #-------------------------------------------------------------------------- # ○ コマンド作成 ※ 初期設定 (module Vocab) が一部継承されています。 #-------------------------------------------------------------------------- def create_command_original @commands = [] @commands.push(Vocab::ShopBuy) @commands.push(Vocab::ShopSell) @commands.push(Actor_Item::FILL_COMMAND) @commands.push(Actor_Item::REPAIR_COMMAND) additional_command_set @commands.push(Vocab::ShopCancel) end #-------------------------------------------------------------------------- # ○ 追加コマンド設定 ※ 追加スクリプトで再定義 #-------------------------------------------------------------------------- def additional_command_set end #-------------------------------------------------------------------------- # ○ ヘルプテキスト作成(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def create_help_original @help_text = [] @help_text.push("購入します。") @help_text.push("売却します。") @help_text.push("アイテムのチャージを充填します。") @help_text.push("壊れたアイテムを修復します。") additional_help_set @help_text.push("取引を終えます。") end #-------------------------------------------------------------------------- # ○ 追加ヘルプテキスト設定 ※ 追加スクリプトで再定義 #-------------------------------------------------------------------------- def additional_help_set end #-------------------------------------------------------------------------- # ○ コマンド表示条件 #-------------------------------------------------------------------------- # このメソッド内の "売却" "充填" といった用語部分は、 # 注釈による特殊ショップ項目指定の判別に使われる部分ですので、 # ここの部分の書き換えは推奨しません。 # (書き換えた場合、特殊ショップ: の後の用語もそれに対応させる必要が出ます) #-------------------------------------------------------------------------- def command_display?(command_number) case command_number when 0 return false if $game_temp.shop_goods.empty? when 1 return true if $game_temp.ex_shop.key?("売却") return false if $game_temp.shop_purchase_only when 2 return $game_temp.ex_shop.key?("充填") when 3 return $game_temp.ex_shop.key?("修復") end return true end end #============================================================================== # □ Window_AIS_ShopBuy #------------------------------------------------------------------------------ # アクター毎のアイテム所持用の、 # ショップ画面で、購入できる商品の一覧を表示するウィンドウです。 #============================================================================== class Window_AIS_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :stacks #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 #-------------------------------------------------------------------------- def initialize(x, y, item_row) height = item_row * WLH + 32 super(x, y, 328, height) @shop_goods = $game_temp.shop_goods @stacks = [] refresh self.index = 0 self.back_opacity = Actor_Item::CUSTOM_OPACITY_2 end #-------------------------------------------------------------------------- # ○ アクター取得 #-------------------------------------------------------------------------- def actor return nil end #-------------------------------------------------------------------------- # ○ アイテムの取得 #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ○ アイテム価格の取得 #-------------------------------------------------------------------------- def price(index = nil) index = self.index if index == nil value = @data[index].price value *= stack(index) if @data[index].stack_item? return value end #-------------------------------------------------------------------------- # ○ リスト表示用スタック数の取得 #-------------------------------------------------------------------------- def stack(index) @stacks[index] = @data[index].charge if @stacks[index] == nil # 初期値設定 return @stacks[index] end #-------------------------------------------------------------------------- # ○ 選択アイテムの位置情報の取得 #-------------------------------------------------------------------------- def item_pos return nil end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh @data = [] for goods_item in @shop_goods case goods_item[0] when 0 item = $data_items[goods_item[1]] next if item.valuables? when 1 item = $data_weapons[goods_item[1]] when 2 item = $data_armors[goods_item[1]] end if item != nil @data.push(item) end end if Actor_Item::SORT_SHOP # アイテムソート処理 @data.sort!{|a,b| a.sort_code <=> b.sort_code } end @item_max = @data.size create_contents @item_max.times { |i| draw_item(i) } end #-------------------------------------------------------------------------- # ○ 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] enabled = (price(index) <= $game_party.gold) rect = item_rect(index) self.contents.clear_rect(rect) self.contents.font.color = normal_color draw_item_name_ais_buy(index, rect.x, rect.y, enabled) rect.width -= 4 cx = contents.text_size(Vocab::gold).width if cx <= 36 self.contents.font.color = system_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(rect, Vocab::gold, 2) rect.width -= ( cx + 2 ) end self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(rect, price(index), 2) end #-------------------------------------------------------------------------- # ○ アイテム名の描画(アクター毎所持システム ショップ購入用) # item : アイテム (武器、防具でも可) # x : 描画先 X 座標 # y : 描画先 Y 座標 # enabled : 有効フラグ。false のとき半透明で描画 #-------------------------------------------------------------------------- def draw_item_name_ais_buy(index, x, y, enabled) item = @data[index] return if item == nil draw_icon(item.icon_index, x, y, enabled) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 name = item.name if item.charge != nil if item.stack_item? name = name + "×" + stack(index).to_s elsif item.display_charge name = name + " (" + item.charge.to_s + ")" end end self.contents.draw_text(x + 24, y, 166, WLH, name) end #-------------------------------------------------------------------------- # ○ ヘルプテキスト生成 #-------------------------------------------------------------------------- def create_help_text(text, item) if text != nil if item.charge != nil text = text.gsub(/\\CH/i) { item.charge } end end return text end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help text = item != nil ? create_help_text(item.description, item) : "" @help_window.set_text(text) end #-------------------------------------------------------------------------- # ○ カーソルを 1 ページ後ろに移動 #-------------------------------------------------------------------------- def cursor_pagedown end #-------------------------------------------------------------------------- # ○ カーソルを 1 ページ前に移動 #-------------------------------------------------------------------------- def cursor_pageup end end #============================================================================== # □ Window_Item_Number #------------------------------------------------------------------------------ #  アクター毎アイテムのアイテム所持数表示です。 #============================================================================== class Window_Item_Number < Window_Base #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- NUMBER = "所持数" #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, 100, WLH * 2 + 32) @actor = actor refresh end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super refresh if @base_window.item != @item end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear return if @base_window == nil @item = @base_window.item return if @item == nil self.contents.font.color = system_color self.contents.draw_text(0, 0, self.width - 32, WLH, NUMBER) self.contents.font.color = normal_color number = @actor.carry_item_number(@item, true) if @item.stack_item? and @actor.total_stack(@item, true) > 0 number = "×" + @actor.total_stack(@item, true).to_s end self.contents.draw_text(0, WLH, self.width - 32, WLH, number, 2) end #-------------------------------------------------------------------------- # ○ アクター変更 #-------------------------------------------------------------------------- def chenge_actor(actor) @actor = actor refresh end #-------------------------------------------------------------------------- # ○ アクター変更 #-------------------------------------------------------------------------- def base_window=(base_window) @base_window = base_window refresh end end #============================================================================== # □ Window_Item_Sell_Price #------------------------------------------------------------------------------ #  アクター毎アイテムの売却確認ウインドウです。 #============================================================================== class Window_Item_Sell_Price < Window_Selectable #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- SELL_PRICE = "売却価格" NOT_HANDLING = "買取不可" CANT_SELL = "売却不可" NO_ITEM = "アイテムがありません" #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :item_index attr_accessor :stack #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 230, WLH * 2 + 32) self.index = -1 self.active = false self.back_opacity = Actor_Item::CUSTOM_OPACITY_1 @item_index = 0 @display_charge = true refresh end #-------------------------------------------------------------------------- # ○ アイテム情報のセット #-------------------------------------------------------------------------- def set_item(actor, item_index) @actor = actor @item_index = item_index if @actor.carry_items_data[@item_index] if @actor.carry_item(@item_index).stack_item? @stack = @actor.carry_items_data[@item_index]["charge"] else @stack = nil end else @stack = nil end refresh end #-------------------------------------------------------------------------- # ○ アイテム売却価格 # ※ アイテム売却価格の計算式的な定義もこのメソッドが兼ねています。 # (ここで算出される価格を元に、売却時の所持金減少をしています) #-------------------------------------------------------------------------- def price value = @actor.carry_item_price(@actor.carry_item(@item_index).price, @item_index) if @item.charge != nil if @item.stack_item? value *= @stack else charge = @actor.carry_items_data[@item_index]["charge"] if @item.charge != 1 and charge != @actor.item_max_charge(@item_index) value *= charge value /= @actor.item_max_charge(@item_index) end end end return value /= 2 end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear return if @actor == nil or @item_index < 0 @item = @actor.carry_item(@item_index) if @item == nil self.contents.font.color = system_color self.contents.draw_text(0, WLH, self.width - 32, WLH, NO_ITEM, 1) return end draw_item_name_ais([@actor, @item_index], 0, 0, true, @stack) if not $game_temp.shop_handling?(@item) self.contents.font.color = system_color self.contents.draw_text(0, WLH, self.width - 32, WLH, NOT_HANDLING, 1) elsif @actor.can_sell_index?(@item_index) self.contents.font.color = system_color self.contents.draw_text(0, WLH, self.width - 32, WLH, SELL_PRICE) w = self.width - 32 cx = contents.text_size(Vocab::gold).width if cx <= 36 self.contents.font.color = system_color self.contents.draw_text(0, WLH, w, WLH, Vocab::gold, 2) w -= ( cx + 2 ) end self.contents.font.color = normal_color self.contents.draw_text(0, WLH, w, WLH, price, 2) else # 売却不可時の表示 self.contents.font.color = system_color self.contents.draw_text(0, WLH, self.width - 32, WLH, CANT_SELL, 1) end end #-------------------------------------------------------------------------- # ○ カーソルの更新 #-------------------------------------------------------------------------- def update_cursor if @index < 0 self.cursor_rect.empty elsif @index == 0 self.cursor_rect.set(0, 0, self.width - 32, self.height - 32) end end end #============================================================================== # □ Window_Keep_Item_Command #------------------------------------------------------------------------------ #  アクター毎アイテムの預かり所コマンドウインドウです。 #============================================================================== class Window_Keep_Item_Command < Window_Transforms_Command #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 102) end #-------------------------------------------------------------------------- # ○ コマンド作成(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def create_command_original super @commands[0] = "預ける" @commands[1] = "受け取る" @commands[2] = "やめる" end #-------------------------------------------------------------------------- # ○ ヘルプテキスト作成(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def create_help_original super @help_text[0] = "アイテムを預けます。" @help_text[1] = "預けたアイテムを受け取ります。" @help_text[2] = "取引を終えます。" end end #============================================================================== # □ Window_Keep_Item_Category #------------------------------------------------------------------------------ #  アクター毎アイテムの預かり所カテゴリのウインドウです。 #============================================================================== class Window_Keep_Item_Category < Window_Slide_Command #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 128, 1) self.opacity = 0 end #-------------------------------------------------------------------------- # ○ コマンド作成(カテゴリ名:テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def create_command super @commands[0] = "すべて" @commands[1] = "道具類" @commands[2] = "武器類" @commands[3] = "防具類" end #-------------------------------------------------------------------------- # ○ コマンド作成(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def include?(item) case @index when 0 return true when 1 return item.is_a?(RPG::Item) when 2 return item.is_a?(RPG::Weapon) when 3 return item.is_a?(RPG::Armor) end end end #============================================================================== # □ Window_Keep_Item_Info #------------------------------------------------------------------------------ #  アクター毎アイテムの預かりアイテム情報のウインドウです。 #============================================================================== class Window_Keep_Item_Info < Window_Selectable #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- KEEP_NUMBER = "預かり数" KEEP_TEXT = "預ける" CANT_KEEP = "預けられません" #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :item_index #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, 230, WLH * 3 + 32) @actor = actor self.active = false refresh end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear return if @actor == nil or @item == nil item_pos = @item_index ? [@actor, @item_index] : @item draw_item_name_ais(item_pos, 0, 0, true) self.contents.font.color = system_color if @item_index and not @actor.can_entrust_index?(@item_index) self.contents.draw_text(0, WLH * 1, self.width - 32, WLH, cant_keep_text(@item_index)) self.contents.draw_text(0, WLH * 2, self.width - 32, WLH, CANT_KEEP, 1) else self.contents.draw_text(20, WLH * 1, self.width, WLH, KEEP_NUMBER) self.contents.font.color = normal_color number = $game_party.keep_item_number(@item) if self.active self.contents.draw_text(0, WLH * 1, self.width - 32, WLH, number.to_s + " → " + (number + 1).to_s, 2) self.contents.draw_text(0, WLH * 2, self.width - 32, WLH, KEEP_TEXT, 1) else self.contents.draw_text(0, WLH * 1, self.width - 32, WLH, number, 2) end end end #-------------------------------------------------------------------------- # ○ 預かり不可時のテキスト取得(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def cant_keep_text(index) if @actor.carry_items_data[index]["charge"] and @actor.carry_items_data[index]["charge"] != @actor.item_max_charge(index) if @actor.carry_item(index).stack_item? text = "×%s のセットでないと" # スタックアイテムの預かり不可 return sprintf(text, @actor.carry_item(index).charge) else text = "使用済みのアイテムは" # チャージアイテムの預かり不可 return text end end return "" end #-------------------------------------------------------------------------- # ○ カーソルの更新 #-------------------------------------------------------------------------- def update_cursor if self.active self.cursor_rect.set(0, WLH * 2, self.width - 32, WLH) else self.cursor_rect.empty end end #-------------------------------------------------------------------------- # ○ アイテムインデックス変更 #-------------------------------------------------------------------------- def set_item_index(item_index) @item_index = item_index @item = @actor.carry_item(@item_index) refresh end #-------------------------------------------------------------------------- # ○ アクター変更 #-------------------------------------------------------------------------- def chenge_actor(actor) @actor = actor @item = @actor.carry_item(@item_index) refresh end end #============================================================================== # □ Window_Keep_Item #------------------------------------------------------------------------------ #  預かり所で、預かりアイテムの一覧を表示するウィンドウです。 #============================================================================== class Window_Keep_Item < Window_Selectable #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :category attr_accessor :category_window #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # width : ウィンドウの幅 # height : ウィンドウの高さ #-------------------------------------------------------------------------- def initialize(x, y, item_row, category_window = nil) height = item_row * WLH + 32 super(x, y, 258, height) self.index = 0 @category_window = category_window refresh end #-------------------------------------------------------------------------- # ○ アクター取得 #-------------------------------------------------------------------------- def actor return nil end #-------------------------------------------------------------------------- # ○ アイテムの取得 #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ○ 選択アイテムの位置情報の取得 #-------------------------------------------------------------------------- def item_pos return nil end #-------------------------------------------------------------------------- # ○ アイテムをリストに含めるかどうか # item : アイテム #-------------------------------------------------------------------------- def include?(item) return false if item == nil if @category_window == nil return true else return @category_window.include?(item) end end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh @category = @category_window.index if @category_window != nil @data = [] for item in $game_party.keep_items next unless include?(item) # 表示カテゴリ以外のアイテムは省く @data.push(item) end @data.sort!{|a,b| a.sort_code <=> b.sort_code } # アイテムソート処理 @data.push(nil) if include?(nil) @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end if self.index > 0 self.index = [@item_max - 1, self.index].min end end #-------------------------------------------------------------------------- # ○ 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil number = $game_party.keep_item_number(item) rect.width -= 4 draw_item_name_ais(item, rect.x, rect.y, true) self.contents.draw_text(rect, sprintf(":%2d", number), 2) end end #-------------------------------------------------------------------------- # ○ ヘルプテキスト生成 #-------------------------------------------------------------------------- def create_help_text(text, item) if text != nil if item.charge != nil text = text.gsub(/\\CH/i) { item.charge } end end return text end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help text = item == nil ? "" : create_help_text(item.description, item) @help_window.set_text(text) end #-------------------------------------------------------------------------- # ○ カーソルを 1 ページ後ろに移動 #-------------------------------------------------------------------------- def cursor_pagedown end #-------------------------------------------------------------------------- # ○ カーソルを 1 ページ前に移動 #-------------------------------------------------------------------------- def cursor_pageup end end #============================================================================== # □ Window_Item_Fill_Price #------------------------------------------------------------------------------ #  アクター毎アイテムの充填確認用ウインドウです。 #============================================================================== class Window_Item_Fill_Price < Window_Selectable #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- CHARGE = "チャージ" FILL_NUMBER = "充填量" FILL_PRICE = "充填費" FILL_FULL = "充填不要" NO_ITEM = "アイテムがありません" #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :item_index attr_reader :actor attr_accessor :fill_number #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 230, WLH * 4 + 32) self.index = -1 self.active = false self.back_opacity = Actor_Item::CUSTOM_OPACITY_1 @item_index = 0 @fill_number = 1 refresh end #-------------------------------------------------------------------------- # ○ アイテム情報のセット #-------------------------------------------------------------------------- def set_item(actor, item_index) @actor = actor @item_index = item_index refresh end #-------------------------------------------------------------------------- # ○ チャージ数 #-------------------------------------------------------------------------- def charge return @actor.carry_items_data[@item_index]["charge"] end #-------------------------------------------------------------------------- # ○ 最大充填量 #-------------------------------------------------------------------------- def max_fill return @actor.item_max_charge(@item_index) - charge end #-------------------------------------------------------------------------- # ○ 充填費 #-------------------------------------------------------------------------- def price return @item.fill_price if @item.fill_price value = @item.price value *= @fill_number value /= @actor.carry_items_data[@item_index]["charge"] return value /= 2 end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear return if @actor == nil or @item_index < 0 @item = @actor.carry_item(@item_index) if @item == nil self.contents.font.color = system_color self.contents.draw_text(0, WLH, self.width - 32, WLH, NO_ITEM, 1) return #- アイテムが無い場合 elsif not @actor.item_can_fill?(@item_index, true) or not $game_temp.shop_handling?(@item) draw_item_name_ais_fill([@actor, @item_index], 0, 0, false) return #- 充填出来ないアイテムの場合 end #- 充填対象アイテムの表示 draw_item_name_ais_fill([@actor, @item_index], 0, 0, true) #- チャージ表示 unless @item.hide_charge self.contents.font.color = system_color self.contents.draw_text(0, WLH, self.width - 32, WLH, CHARGE) draw_item_charge([@actor, @item_index], 0, WLH, self.width - 32, 2) end #- 充填可能アイテム if @actor.item_need_charge?(@item_index) #- 充填量表示 self.contents.font.color = system_color self.contents.draw_text(0, WLH * 2, self.width - 32, WLH, FILL_NUMBER) self.contents.font.color = normal_color text = "+" + @fill_number.to_s self.contents.draw_text(0, WLH * 2, self.width - 32 - 10, WLH, text, 2) #- 充填費表示 self.contents.font.color = system_color self.contents.draw_text(0, WLH * 3, self.width - 32, WLH, FILL_PRICE) w = self.width - 32 cx = contents.text_size(Vocab::gold).width if cx <= 36 self.contents.draw_text(0, WLH * 3, w, WLH, Vocab::gold, 2) w -= ( cx + 2 ) end self.contents.font.color = normal_color self.contents.font.color.alpha = price <= $game_party.gold ? 255 : 128 self.contents.draw_text(0, WLH * 3, w, WLH, price, 2) else #- 充填不要の表示 self.contents.font.color = system_color self.contents.draw_text(0, WLH * 2.5, self.width - 32, WLH, FILL_FULL, 1) end end #-------------------------------------------------------------------------- # ○ アイテム名の描画(アクター毎所持システムショップ充填用) # item : アイテム (武器、防具でも可) # x : 描画先 X 座標 # y : 描画先 Y 座標 # enabled : 有効フラグ。false のとき半透明で描画 #-------------------------------------------------------------------------- def draw_item_name_ais_fill(item_pos, x, y, enabled) actor = item_pos[0] index = item_pos[1] item = actor.carry_item(index) return if item == nil charge = actor.carry_items_data[index]["charge"] icon_index = item.icon_change(charge) ? item.icon_change(charge) : item.icon_index draw_icon(icon_index, x, y, enabled) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 name = item.name if item.charge != nil if item.stack_item? name = item.name + "×" + charge.to_s end end self.contents.draw_text(x + 24, y, 166, WLH, name) end #-------------------------------------------------------------------------- # ○ カーソルの更新 #-------------------------------------------------------------------------- def update_cursor if @index < 0 self.cursor_rect.empty elsif @index == 0 self.cursor_rect.set(0, 0, self.width - 32, self.height - 32) end end end #============================================================================== # □ Window_Item_Repair_Price #------------------------------------------------------------------------------ #  アクター毎アイテムの修復確認用ウインドウです。 #============================================================================== class Window_Item_Repair_Price < Window_Selectable #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- DURABILITY = "耐久力" REPAIR_PRICE = "修復費" REPAIRED = "修復不要" NO_ITEM = "アイテムがありません" #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :item_index attr_reader :actor #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 230, WLH * 3 + 32) self.index = -1 self.active = false self.back_opacity = Actor_Item::CUSTOM_OPACITY_1 @item_index = 0 refresh end #-------------------------------------------------------------------------- # ○ アイテム情報のセット #-------------------------------------------------------------------------- def set_item(actor, item_index) @actor = actor @item_index = item_index refresh end #-------------------------------------------------------------------------- # ○ チャージ数 #-------------------------------------------------------------------------- def charge return @actor.carry_items_data[@item_index]["charge"] end #-------------------------------------------------------------------------- # ○ 修復費 #-------------------------------------------------------------------------- def price if @actor.item_broken?(@item_index) item = @actor.repaired_change_item(@item_index) return item.repair_price if item.repair_price value = item.price return value /= 4 else return @item.repair_price if @item.repair_price value = @item.price return value /= 4 end end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear return if @actor == nil or @item_index < 0 @item = @actor.carry_item(@item_index) if @item == nil self.contents.font.color = system_color self.contents.draw_text(0, WLH, self.width - 32, WLH, NO_ITEM, 1) return #- アイテムが無い場合の記述 elsif not @actor.item_can_repair?(@item_index, true) or not $game_temp.shop_handling?(@item) draw_item_name_ais([@actor, @item_index], 0, 0, false) return #- 修復出来ないアイテムの場合 end #- 修復対象アイテムの表示 draw_item_name_ais([@actor, @item_index], 0, 0, true) if @actor.item_broken?(@item_index) #- 修復時変化アイテム名の表示 draw_item_name_ais(@actor.repaired_change_item(@item_index), 22, WLH, true) self.contents.font.color = system_color self.contents.draw_text(0, WLH, 22, WLH, ">>") else #- 耐久力表示 if @item.charge > 1 and not @item.hide_charge self.contents.font.color = system_color self.contents.draw_text(0, WLH, self.width - 32, WLH, DURABILITY) draw_item_charge([@actor, @item_index], 0, WLH, self.width - 32, 2) end end #- 修復可能アイテム if @actor.item_need_charge?(@item_index) or @actor.item_broken?(@item_index) #- 修復費の表示 self.contents.font.color = system_color self.contents.draw_text(0, WLH * 2, self.width - 32, WLH, REPAIR_PRICE) w = self.width - 32 cx = contents.text_size(Vocab::gold).width if cx <= 36 self.contents.draw_text(0, WLH * 2, w, WLH, Vocab::gold, 2) w -= ( cx + 2 ) end self.contents.font.color = normal_color self.contents.font.color.alpha = price <= $game_party.gold ? 255 : 128 self.contents.draw_text(0, WLH * 2, w, WLH, price, 2) else #- 修復不要の表示 self.contents.font.color = system_color self.contents.draw_text(0, WLH * 2, self.width - 32, WLH, REPAIRED, 1) end end #-------------------------------------------------------------------------- # ○ カーソルの更新 #-------------------------------------------------------------------------- def update_cursor if @index < 0 self.cursor_rect.empty elsif @index == 0 self.cursor_rect.set(0, 0, self.width - 32, self.height - 32) end end end ## クラス・シーン ## #============================================================================== # ■ Scene_Map #------------------------------------------------------------------------------ #  マップ画面の処理を行うクラスです。 #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ● ショップ画面への切り替え #-------------------------------------------------------------------------- def call_shop $game_temp.next_scene = nil $scene = Scene_AIS_Shop.new end #-------------------------------------------------------------------------- # ◎ 画面切り替えの実行 #-------------------------------------------------------------------------- alias tig_ais_update_scene_change update_scene_change def update_scene_change return if $game_player.moving? # プレイヤーの移動中? case $game_temp.next_scene when "keeper" call_item_keeper end tig_ais_update_scene_change end #-------------------------------------------------------------------------- # ○ ショップ画面への切り替え #-------------------------------------------------------------------------- def call_item_keeper $game_temp.next_scene = nil $scene = Scene_Item_Keeper.new end end #============================================================================== # ■ Scene_Item #------------------------------------------------------------------------------ #  アイテム画面の処理を行うクラスです。 #============================================================================== class Scene_Item < Scene_Base #-------------------------------------------------------------------------- # ◎ アイテム選択の更新 #-------------------------------------------------------------------------- alias tig_ais_update_item_selection update_item_selection def update_item_selection if Input.trigger?(Input::A) and Actor_Item::VALUABLES_DISPLAY_SWITCH @item_window.use_display = @item_window.use_display ? false : true Sound.play_decision end tig_ais_update_item_selection end end #============================================================================== # ■ Scene_Skill #------------------------------------------------------------------------------ #  スキル画面の処理を行うクラスです。 #============================================================================== class Scene_Skill < Scene_Base #-------------------------------------------------------------------------- # ◎ スキルの使用 (味方対象以外の使用効果を適用) #-------------------------------------------------------------------------- alias tig_ais_use_skill_nontarget use_skill_nontarget def use_skill_nontarget index = @actor.skill_consumable_index(@skill.id) if index != nil item = @actor.carry_item(index) @actor.item_skill_consumable(index, @skill.id) end tig_ais_use_skill_nontarget $game_party.party_items_refresh end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :another_scene #-------------------------------------------------------------------------- # ◎ フレーム更新 #-------------------------------------------------------------------------- alias tig_ais_update update def update if @another_scene @another_scene.update else tig_ais_update end end #-------------------------------------------------------------------------- # ◎ 開始処理 #-------------------------------------------------------------------------- alias tig_ais_start start def start tig_ais_start $game_party.add_equip_states end #-------------------------------------------------------------------------- # ◎ 終了処理 #-------------------------------------------------------------------------- alias tig_ais_terminate terminate def terminate $game_party.party_items_refresh # 中断時などの更新し忘れを防ぐ tig_ais_terminate end #-------------------------------------------------------------------------- # ◎ ターン終了 #-------------------------------------------------------------------------- alias tig_ais_turn_end turn_end def turn_end $game_party.party_items_refresh tig_ais_turn_end end #-------------------------------------------------------------------------- # ◎ パーティコマンド選択の更新 #-------------------------------------------------------------------------- alias tig_ais_update_party_command_selection update_party_command_selection def update_party_command_selection if Input.trigger?(Input::CTRL) and $BTEST Sound.play_decision @another_scene = Scene_Item_Keeper.new @another_scene.start else tig_ais_update_party_command_selection end end #-------------------------------------------------------------------------- # ● アイテム選択の開始 #-------------------------------------------------------------------------- def start_item_selection @help_window = Window_Help.new @item_window = Window_Actor_Item.new(0, 56, 544, 5, @active_battler, 2) # 変更部分 @item_window.fixation_mode = 0 # 追加部分 @item_window.help_window = @help_window @actor_command_window.active = false end #-------------------------------------------------------------------------- # ● アイテム選択の更新 #-------------------------------------------------------------------------- def update_item_selection @item_window.active = true @item_window.update @help_window.update if Input.trigger?(Input::B) Sound.play_cancel end_item_selection elsif Input.trigger?(Input::C) @item = @active_battler.carry_item(@item_window.index) # 変更部分 return if update_equip_changing_selection # 追加部分 if @item != nil $game_party.last_item_id = @item.id end if @active_battler.item_can_use_index?(@item_window.index) # 変更部分 @active_battler.action.set_item_index(@item_window.index) # 追加部分 Sound.play_decision determine_item else Sound.play_buzzer end else # 追加部分 update_item_window_mode # 追加部分 end end #-------------------------------------------------------------------------- # ○ 装備変更選択時の更新 #-------------------------------------------------------------------------- def update_equip_changing_selection if Input.trigger?(Input::C) and Input.press?(Input::CTRL) and $BTEST equip_changing @status_window.refresh return true elsif Input.trigger?(Input::C) and Input.press?(Input::A) and not Actor_Item::CHANGE_EQUIP_BATTLE_MODE and Actor_Item::CHANGE_EQUIP_BATTLE.include?(@active_battler.carry_item(@item_window.index).equip_type) equip_changing @status_window.refresh return true end return false end #-------------------------------------------------------------------------- # ○ アイテムウインドウの不透明度表示切替の更新 #-------------------------------------------------------------------------- def update_item_window_mode if $BTEST if Input.press?(Input::CTRL) @item_window.fixation_mode = 1 else @item_window.fixation_mode = 0 end elsif not Actor_Item::CHANGE_EQUIP_BATTLE_MODE and Input.press?(Input::A) @item_window.fixation_mode = 1 else @item_window.fixation_mode = 0 end end #-------------------------------------------------------------------------- # ● アイテムの決定 #-------------------------------------------------------------------------- def determine_item @active_battler.action.set_item(@item.id) @item_window.active = false item = @item # 変更部分 if item.need_selection? if item.for_opponent? start_target_enemy_selection else start_target_actor_selection end else end_item_selection next_actor end end #-------------------------------------------------------------------------- # ○ 装備変更 #-------------------------------------------------------------------------- def equip_changing @item = @active_battler.carry_item(@item_window.index) case @item when RPG::Item Sound.play_buzzer when RPG::Weapon, RPG::Armor if @active_battler.equipping?(@item_window.index) if @active_battler.remove_equipment_index(@item_window.index) Sound.play_equip @item_window.refresh else Sound.play_buzzer end else if @active_battler.equipable_index?(@item_window.index) Sound.play_equip @active_battler.acquires_equipment(@item_window.index) if @item_window.item.curse_states != nil and @active_battler.state?(@item_window.item.curse_states) Sound.play_curse end @item_window.refresh else Sound.play_buzzer end end end end #-------------------------------------------------------------------------- # ◎ 戦闘行動の実行 : 攻撃 #-------------------------------------------------------------------------- alias tig_ais_execute_action_attack execute_action_attack def execute_action_attack if @active_battler.actor? if @active_battler.weapons[0] and @active_battler.weapons[0].need_sub_weapon if not @active_battler.weapons[1] or not @active_battler.weapons[1].sub_weapon? return execute_action_no_sub_weapon end end end tig_ais_execute_action_attack # 本来の処理 return unless @active_battler.actor? display_attack_consumable end #-------------------------------------------------------------------------- # ○ 戦闘行動の実行 : 補助武器無し #-------------------------------------------------------------------------- def execute_action_no_sub_weapon text = sprintf(@active_battler.weapons[0].need_sub_weapon, @active_battler.name) @message_window.add_instant_text(text) wait(45) end #-------------------------------------------------------------------------- # ◎ 戦闘行動の実行 : スキル #-------------------------------------------------------------------------- alias tig_ais_execute_action_skill execute_action_skill def execute_action_skill tig_ais_execute_action_skill # 本来の処理 return unless @active_battler.actor? display_attack_consumable skill_id = @active_battler.action.skill.id index = @active_battler.skill_consumable_index(skill_id) if index != nil item = @active_battler.carry_item(index) if @active_battler.item_skill_consumable(index, skill_id) if item.consumable_message != nil @message_window.clear text = sprintf(item.consumable_message, @active_battler.name, item.name) @message_window.add_instant_text(text) wait(60) end end end end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 : アイテム #-------------------------------------------------------------------------- def execute_action_item item = @active_battler.action.item # 効果としてのアイテム true_item = @active_battler.carry_item(@active_battler.action.item_index) # 実際のアイテム(装備品) # 装備の変更 if item.equip_type >= 0 and not @active_battler.equipping?(@active_battler.action.item_index) display_equip(item) wait(45) return end # メッセージ1表示 text = true_item.message1 ? true_item.message1 : Vocab::UseItem @message_window.add_instant_text(sprintf(text, @active_battler.name, true_item.name)) # メッセージ2表示 if true_item.message2 != nil wait(45) @message_window.add_instant_text(sprintf(true_item.message2, true_item.name)) end # 本来の処理に近い部分 targets = @active_battler.action.make_targets display_animation(targets, item.animation_id) $game_temp.common_event_id = item.common_event_id for target in targets target.item_effect(@active_battler, item) display_action_effects(target, item) end # アイテムの消耗処理 actor_consume_item # 使用後装備解除武具の装備解除 if true_item.using_remove_equip @active_battler.remove_equipment_index(@active_battler.action.item_index) end end #-------------------------------------------------------------------------- # ○ 武器劣化時の表示 #-------------------------------------------------------------------------- def display_attack_consumable texts = [] @active_battler.carry_items.size.times do |index| item = @active_battler.carry_item(index) next if item == nil if @active_battler.carry_items_data[index]["charge"] and @active_battler.carry_items_data[index]["charge"] <= 0 item_name = @active_battler.carry_item_name(index) if item.stack_item? @active_battler.remove_item_index(index, true) text = Vocab::Spent_Stack else if item.consumable_change @active_battler.consumable_change_item(index, item.consumable_change[0], item.consumable_change[1]) else @active_battler.remove_item_index(index, true) end text = Vocab::Equip_Break end text = item.consumable_message if item.consumable_message texts.push(sprintf(text, @active_battler.name, item_name)) end end return if texts.empty? @message_window.clear wait(5) for text in texts @message_window.add_instant_text(text) wait(20) end wait(30) end #-------------------------------------------------------------------------- # ○ 装備の表示 #-------------------------------------------------------------------------- def display_equip(item) Sound.play_equip text = @active_battler.charge_action?(@active_battler.action.item_index) ? Vocab::Replenish : Vocab::Equip @message_window.add_instant_text(sprintf(text, @active_battler.name, item.name)) @active_battler.acquires_equipment(@active_battler.action.item_index) if item.curse_states != nil and @active_battler.state?(item.curse_states) wait(20) text = sprintf(Vocab::Equip_Curse, @active_battler.name) @message_window.add_instant_text(text) end end #-------------------------------------------------------------------------- # ○ アイテム消耗処理 #-------------------------------------------------------------------------- def actor_consume_item true_item = @active_battler.carry_item(@active_battler.action.item_index) item = @active_battler.carry_item(@active_battler.action.item_index) if @active_battler.consume_item(@active_battler.action.item_index) if true_item.consumable_message != nil @message_window.clear wait(5) text = sprintf(item.consumable_message, @active_battler.name, true_item.name) @message_window.add_instant_text(text) wait(60) end end end #-------------------------------------------------------------------------- # ◎ ダメージの表示 #-------------------------------------------------------------------------- alias tig_ais_display_damage display_damage def display_damage(target, obj = nil) tig_ais_display_damage(target, obj) return unless target.actor? texts = [] target.carry_items.size.times do |index| next if target.carry_item(index) == nil if target.carry_items_data[index]["charge"] and target.carry_items_data[index]["charge"] <= 0 item = target.carry_item(index) text = item.consumable_message ? item.consumable_message : Vocab::Equip_Break texts.push(sprintf(text, target.name, target.carry_item_name(index))) if item.consumable_change target.consumable_change_item(index, item.consumable_change[0], item.consumable_change[1]) else target.remove_item_index(index, true) end end end return if texts.empty? for text in texts if @message_window.line_number < 4 @message_window.add_instant_text("") end @message_window.replace_instant_text(text) wait(20) end end #-------------------------------------------------------------------------- # ● 獲得したドロップアイテムの表示 # ※ 複数の同アイテム入手時の表示簡略化と # アイテムが持てなくなった際のアラート文表示等をおこなう。 #-------------------------------------------------------------------------- def display_drop_items $game_party.party_items_refresh drop_items = $game_troop.make_drop_items return if drop_items.empty? $game_temp.make_drop_carry_items(drop_items) # 自動入手 $game_temp.item_distributes gain_item = false $game_temp.gain_drop_items_data.each_pair do |item_name, number| case number when 0 ; next when 1 ; text = Vocab::ObtainItem when 2..9 ; text = Vocab::ObtainItemS else ; text = Vocab::ObtainItemSb end $game_message.texts.push(sprintf(text, item_name, number)) gain_item = true end if gain_item # アイテムを入手した場合 wait_for_message if gain_item and $game_party.item_room_number == 0 $game_message.texts.push(Vocab::ItemFull) # 一杯になった表示 wait_for_message end else $game_message.texts.push(Vocab::GainFailure) # 一杯だった表示 end end end #============================================================================== # □ Scene_Actor_Item #------------------------------------------------------------------------------ #  アクター毎のアイテム画面の処理を行うクラスです。 #============================================================================== class Scene_Actor_Item < Scene_Base #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- HELP_PASS_MEMBER_CHOICES = "メンバーを選択してアイテムを渡します。" HELP_PASS_STACK_NUMBER = "渡す数を決定します。" HELP_ITEM_TRADING = "相手から受け取るアイテムを選びます。" HELP_ITEM_TRADING2 = "替わりに袋から取り出すアイテムを選びます。" HELP_ITEM_TRADING3 = "替わりに袋に入れるアイテムを選びます。" # ※ ウインドウの項目依存のヘルプ文はウインドウクラスで指定しています。 #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # actor_index : アクターindex #-------------------------------------------------------------------------- def initialize(actor_index = 0) @actor_index = actor_index @analyze = false @item_used_wait = 0 end #-------------------------------------------------------------------------- # ○ 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background @actor = $game_party.members[@actor_index] @actor.item_aoto_sort @help_window = Window_Help.new @command_window = Window_Actor_Item_Command.new(14, 225) @command_window.help_window = @help_window @status_window = Window_Actor_Item_Status.new(4, 62, @actor) @equip_window = Window_Actor_Item_Equip.new(4, 62, @actor) @analyze_window = Window_Actor_Item_Analyze.new(4, 62, @actor) @item_window = Window_Actor_Item.new(268, 100, 272, 10, @actor) @item_window.command_window = @command_window @item_window.help_window = @help_window @item_window.info_windows = [@status_window, @equip_window, @analyze_window] @possession_window = Window_Actor_Item_Possession.new(268, 62, @actor) @pass_window = Window_Pass.new(22, 284, 5, true) if @pass_window.height > 128 @pass_window.y -= 24 end # 袋使用+パーティー4人の際の位置調整 @bag_window = Window_Actor_Item.new(260, 115, 272, 10, $game_party) if $game_party.item_max < 10 @bag_window.y += (10 - $game_party.item_max) * 24 end # 袋の最大所持数が10以下の時の位置調整 @bag_window.help_window = @help_window @bag_window.info_windows = [@equip_window, @analyze_window] @bag_possession_window = Window_Actor_Item_Possession.new(248, 370, $game_party) @bag_command_window = Window_Bag_Command.new(120, 228) @throws_window = Window_Actor_Item_Throws.new(74, 336) @target_window = Window_MenuStatus.new(0, 0) @trading_window = Window_Item_Trading.new(28, 198) @target_window.back_opacity = 255 @trading_window.visible = false @bag_possession_window.visible = false @bag_command_window.visible = false @bag_window.openness = 0 update_info_windows start_command_selection end #-------------------------------------------------------------------------- # ○ 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @help_window.dispose @target_window.dispose @possession_window.dispose @item_window.dispose @bag_window.dispose @bag_possession_window.dispose @status_window.dispose @equip_window.dispose @analyze_window.dispose @pass_window.dispose @throws_window.dispose @bag_command_window.dispose @command_window.dispose end #-------------------------------------------------------------------------- # ○ 数値入力ウインドウ消去 #-------------------------------------------------------------------------- def window_numberinput_dispose @window_numberinput.dispose @window_numberinput = nil end #-------------------------------------------------------------------------- # ○ 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(0) end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update super update_menu_background update_info_windows @possession_window.update @item_window.update @command_window.update @help_window.update @target_window.update if @target_window.visible @pass_window.update if @pass_window.visible @throws_window.update if @throws_window.openness == 255 @bag_command_window.update if @bag_command_window.visible @bag_window.update if @bag_window.openness == 255 @window_numberinput.update if @window_numberinput != nil if @window_numberinput != nil if @pass_window.visible update_pass_numberinput else update_pass_numberinput_bag end elsif @trading_window.visible if @bag_command_window.visible update_bag_item_putout elsif @bag_window.active update_bag_item_trading else update_item_trading end elsif @target_window.visible == true update_target_selection elsif @status_window.index == 0 update_target_self elsif @pass_window.active update_pass_actor_selection elsif @throws_window.active update_throws elsif @bag_command_window.visible update_bag_command_selection elsif @bag_window.active update_bag_item_selection elsif @item_window.active update_item_selection elsif @command_window.active update_command_selection end end #-------------------------------------------------------------------------- # ○ ステータスウィンドウの更新 #-------------------------------------------------------------------------- def update_info_windows if not @status_window.active and @analyze and (@item_window.index >= 0 or @bag_window.openness > 0) show_analyze_window elsif @command_window.active == false and [1, 2, 3].include?(@command_window.select) show_equip_window else show_status_window end end #-------------------------------------------------------------------------- # ○ アイテム詳細ウインドウの表示 #-------------------------------------------------------------------------- def show_analyze_window @analyze_window.visible = true @equip_window.visible = false @status_window.visible = false end #-------------------------------------------------------------------------- # ○ 装備ウインドウの表示 #-------------------------------------------------------------------------- def show_equip_window @equip_window.visible = true @status_window.visible = false @analyze_window.visible = false end #-------------------------------------------------------------------------- # ○ ステータスウインドウの表示 #-------------------------------------------------------------------------- def show_status_window @status_window.visible = true @equip_window.visible = false @analyze_window.visible = false end #-------------------------------------------------------------------------- # ○ アイテムウィンドウのリフレッシュ #-------------------------------------------------------------------------- def item_window_refresh @item_window.refresh @possession_window.refresh while @item_window.item == nil and @item_window.index > 0 @item_window.index -= 1 end @item_window.info_windows_set_index end #-------------------------------------------------------------------------- # ○ 次のアクターの画面に切り替え #-------------------------------------------------------------------------- def next_actor return if $game_party.members.size == 1 Sound.play_cursor @actor.item_aoto_sort @actor.aoto_transfer_charge @actor_index += 1 @actor_index %= $game_party.members.size @actor = $game_party.members[@actor_index] $game_party.last_actor_index = @actor_index @possession_window.chenge_actor(@actor) @item_window.chenge_actor(@actor) @pass_window.index = @actor_index adjustment_top @bag_window.info_windows_set_index if @bag_window.openness == 255 end #-------------------------------------------------------------------------- # ○ 前のアクターの画面に切り替え #-------------------------------------------------------------------------- def prev_actor return if $game_party.members.size == 1 Sound.play_cursor @actor.item_aoto_sort @actor.aoto_transfer_charge @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size @actor = $game_party.members[@actor_index] $game_party.last_actor_index = @actor_index @possession_window.chenge_actor(@actor) @item_window.chenge_actor(@actor) @pass_window.index = @actor_index adjustment_top @bag_window.info_windows_set_index if @bag_window.openness == 255 end #-------------------------------------------------------------------------- # ○ アイテムの頭出し用 アイテム有効判定 #-------------------------------------------------------------------------- def item_effective?(index, actor = @actor) case @command_window.select when 0 # 使えるか? return actor.item_can_use_index?(index) when 2, 3 # 渡せるか? return actor.item_can_pass?(index) end end #-------------------------------------------------------------------------- # ○ アイテムの頭出し #-------------------------------------------------------------------------- def adjustment_top(actor = @actor) return if @item_window.item == nil return if @item_window.index == -1 @item_window.index = 0 until item_effective?(@item_window.index, actor) if @item_window.index == actor.carry_items.size - 1 @item_window.index = 0 break end @item_window.index += 1 end @item_window.info_windows_set_index end #-------------------------------------------------------------------------- # ○ コマンド選択の開始 #-------------------------------------------------------------------------- def start_command_selection @command_window.active = true @item_window.active = false @item_window.index = -1 @target_window.visible = false @pass_window.visible = false @bag_possession_window.visible = false @throws_window.openness = 0 item_window_refresh end #-------------------------------------------------------------------------- # ○ コマンド選択の更新 #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) case @command_window.select when 0 # 使う Sound.play_decision start_item_selection @item_window.index = 0 adjustment_top when 1, 4 # 装備、捨てる Sound.play_decision start_item_selection @item_window.index = 0 @item_window.info_windows_set_index when 2 # 渡す Sound.play_decision start_pass_item_selection @item_window.index = 0 adjustment_top @pass_window.index = @actor_index when 3 # 袋 if $game_party.bag_not_open Sound.play_buzzer else Sound.play_decision start_bag_item_selection end end elsif Input.trigger?(Input::R) next_actor elsif Input.trigger?(Input::L) prev_actor end end #-------------------------------------------------------------------------- # ○ “使う”&“装備”&“捨てる”アイテム選択の開始 #-------------------------------------------------------------------------- def start_item_selection @command_window.active = false @target_window.active = false @target_window.visible = false @status_window.active = false @status_window.index = -1 @equip_window.chenge_actor(@actor) @throws_window.openness = 0 @throws_window.active = false @item_window.active = true item_window_refresh end #-------------------------------------------------------------------------- # ○ アイテム選択の更新(共通) #-------------------------------------------------------------------------- def update_item_selection if Input.trigger?(Input::A) and Actor_Item::USE_ITEM_ANALYZE Sound.play_cursor @analyze = @analyze ? false : true elsif Input.trigger?(Input::B) Sound.play_cancel @actor.item_aoto_sort if @command_window.select == 1 @actor.aoto_transfer_charge start_command_selection elsif Input.trigger?(Input::C) if @item_window.item == nil Sound.play_buzzer else item_selection_determine(@command_window.select) end elsif Input.trigger?(Input::R) next_actor elsif Input.trigger?(Input::L) prev_actor end end #-------------------------------------------------------------------------- # ○ アイテム選択の決定 #-------------------------------------------------------------------------- def item_selection_determine(select) case select when 0 # 使う if @actor.item_can_use_index?(@item_window.index) Sound.play_decision determine_item else Sound.play_buzzer end when 1 # 装備 case @item_window.item when RPG::Item Sound.play_buzzer when RPG::Weapon, RPG::Armor if @actor.equipping?(@item_window.index) if @actor.remove_equipment_index(@item_window.index) Sound.play_equip @item_window.refresh else Sound.play_buzzer end else if @actor.equipable_index?(@item_window.index) Sound.play_equip @actor.acquires_equipment(@item_window.index) if @item_window.item.curse_states != nil and @actor.state?(@item_window.item.curse_states) Sound.play_curse end @item_window.refresh else Sound.play_buzzer end end end when 2 # 渡す if @actor.item_can_pass?(@item_window.index) Sound.play_decision start_pass_actor_selection else Sound.play_buzzer end when 4 # すてる if @actor.can_throw_index?(@item_window.index) Sound.play_decision open_throws_window else Sound.play_buzzer end end end #-------------------------------------------------------------------------- # ○ “使う”アイテムの決定 #-------------------------------------------------------------------------- def determine_item item = @item_window.item if defined? $game_player.check_event_trigger_object case item when RPG::Item ; object_id = item.id when RPG::Weapon ; object_id = item.id + 2000 when RPG::Armor ; object_id = item.id + 3000 end if $game_player.check_event_trigger_object(object_id) $scene = Scene_Map.new return end end item = $data_items[item.item_power] if item.item_power > 0 if item.for_friend? if item.for_user? or $game_party.members.size == 1 start_target_self else start_target_selection if item.for_all? @target_window.index = 99 else if $game_party.last_target_index < @target_window.item_max @target_window.index = $game_party.last_target_index else @target_window.index = 0 end end end else use_item_nontarget end end #-------------------------------------------------------------------------- # ○ “使う”自分対象確認の開始 #-------------------------------------------------------------------------- def start_target_self @item_window.active = false @status_window.active = true @status_window.index = 0 end #-------------------------------------------------------------------------- # ○ “使う”自分対象確認の更新 #-------------------------------------------------------------------------- def update_target_self if Input.trigger?(Input::B) Sound.play_cancel start_item_selection elsif Input.trigger?(Input::C) @target_window.index = @actor_index determine_target end end #-------------------------------------------------------------------------- # ○ “使う”ターゲット選択の開始 #-------------------------------------------------------------------------- def start_target_selection @item_window.active = false @target_window.refresh @target_window.visible = true @target_window.active = true end #-------------------------------------------------------------------------- # ○ “使う”ターゲット選択の更新 #-------------------------------------------------------------------------- def update_target_selection if Input.trigger?(Input::B) Sound.play_cancel start_item_selection elsif Input.trigger?(Input::C) determine_target end end #-------------------------------------------------------------------------- # ○ “使う”ターゲットの決定 # 効果なしの場合 (戦闘不能にポーションなど) ブザー SE を演奏。 #-------------------------------------------------------------------------- def determine_target item = @item_window.item item = $data_items[item.item_power] if item.item_power > 0 used = false if item.for_user? and $game_party.members[@target_window.index] != @actor Sound.play_buzzer elsif item.for_all? for target in $game_party.members target.item_effect(@actor, item) used = true unless target.skipped end else target = $game_party.members[@target_window.index] targets = [target] $game_party.last_target_index = @target_window.index target.item_effect(@actor, item) used = true unless target.skipped end if used use_item_nontarget else Sound.play_buzzer end end #-------------------------------------------------------------------------- # ○ “使う”アイテムの使用 (味方対象以外の使用効果を適用) #-------------------------------------------------------------------------- def use_item_nontarget item = @item_window.item item = $data_items[item.item_power] if item.item_power > 0 if @target_window.drew_face_rect != nil if item.for_user? or $game_party.members.size == 1 @status_window.face_animation_all(item) else @target_window.display_use_animation(item) end else Sound.play_use_item end result = @actor.consume_item(@item_window.index) $game_party.party_items_refresh item_window_refresh @target_window.refresh @item_window.update_help if $game_party.all_dead? $scene = Scene_Gameover.new elsif item.common_event_id > 0 $game_temp.common_event_id = item.common_event_id $scene = Scene_Map.new end if result Graphics.wait(50) start_item_selection end end #-------------------------------------------------------------------------- # ○ “渡す”アイテム選択の開始 #-------------------------------------------------------------------------- def start_pass_item_selection @command_window.active = false @item_window.active = true @pass_window.visible = true @pass_window.active = false @pass_window.refresh item_window_refresh if $game_party.bag_use and not $game_party.bag_not_open @bag_possession_window.visible = true @bag_possession_window.refresh end @equip_window.chenge_actor(@actor) end #-------------------------------------------------------------------------- # ○ “渡す”アクター選択の開始 #-------------------------------------------------------------------------- def start_pass_actor_selection @item_window.active = false @pass_window.active = true @help_window.set_text(HELP_PASS_MEMBER_CHOICES) if HELP_PASS_MEMBER_CHOICES != "" end #-------------------------------------------------------------------------- # ○ “渡す”アクター選択の更新 #-------------------------------------------------------------------------- def update_pass_actor_selection if @equip_window.actor != @pass_window.select_actor @equip_window.chenge_test_actor(@pass_window.select_actor) end if Input.trigger?(Input::B) Sound.play_cancel start_pass_item_selection elsif Input.trigger?(Input::C) if $game_party.members[@pass_window.index] == nil if $game_party.bag_not_open Sound.play_buzzer elsif not $game_party.carry_room? if Input.press?(Input::A) and $game_party.stack_fraction_room_number(@item_window.item) > 0 Sound.play_decision start_pass_numberinput($game_party.stack_fraction_room_number(@item_window.item)) else Sound.play_item_full start_bag_item_trading end elsif Input.press?(Input::A) and @actor.carry_item(@item_window.index).stack_item? Sound.play_decision start_pass_numberinput else Sound.play_pass determine_pass end elsif @actor != $game_party.members[@pass_window.index] and not @pass_window.select_actor.carry_room? if Input.press?(Input::A) and @pass_window.select_actor.stack_fraction_room_number(@item_window.item) > 0 Sound.play_decision start_pass_numberinput(@pass_window.select_actor.stack_fraction_room_number(@item_window.item)) else Sound.play_item_full start_item_trading end elsif @actor != $game_party.members[@pass_window.index] and Input.press?(Input::A) and @actor.carry_item(@item_window.index).stack_item? Sound.play_decision start_pass_numberinput else Sound.play_pass determine_pass end end end #-------------------------------------------------------------------------- # ○ “渡す”実行 #-------------------------------------------------------------------------- def determine_pass @actor.item_trading(@item_window.index, @pass_window.select_actor) if @actor != $game_party.members[@pass_window.index] @pass_window.select_actor.aoto_transfer_charge end item_window_refresh @pass_window.refresh start_pass_item_selection end #-------------------------------------------------------------------------- # ○ “渡す”スタックアイテム分割の開始 #-------------------------------------------------------------------------- def start_pass_numberinput(max = nil) if max == nil charge = @actor.carry_items_data[@item_window.index]["charge"] else charge = [max, @actor.carry_items_data[@item_window.index]["charge"]].min end @window_numberinput = Window_Easy_NumberInput.new(0, 0, charge) @window_numberinput.x = @item_window.x - @window_numberinput.width + 16 @window_numberinput.y = @item_window.y + @item_window.index * 24 @pass_window.active = false @help_window.set_text(HELP_PASS_STACK_NUMBER) if HELP_PASS_STACK_NUMBER != "" end #-------------------------------------------------------------------------- # ○ “渡す”スタックアイテム分割の更新 #-------------------------------------------------------------------------- def update_pass_numberinput if Input.trigger?(Input::B) Sound.play_cancel window_numberinput_dispose start_pass_actor_selection elsif Input.trigger?(Input::C) if @window_numberinput.effective_range? Sound.play_pass determine_divides window_numberinput_dispose item_window_refresh @pass_window.refresh start_pass_item_selection else Sound.play_buzzer end end end #-------------------------------------------------------------------------- # ○ “渡す”スタックアイテム分割処理 #-------------------------------------------------------------------------- def determine_divides target = @pass_window.select_actor target.obtain_item(@item_window.item, true) target.carry_items_data[target.carry_items.size - 1]["charge"] = @window_numberinput.number target.aoto_transfer_charge @actor.carry_items_data[@item_window.index]["charge"] -= @window_numberinput.number if @actor.carry_items_data[@item_window.index]["charge"] < 1 @actor.remove_item_index(@item_window.index) end end #-------------------------------------------------------------------------- # ○ “渡す”アイテム交換の開始 #-------------------------------------------------------------------------- def start_item_trading @trading_window.visible = true @trading_window.refresh(@actor, @item_window.index) @pass_window.active = false @item_window.active = true @item_window.chenge_actor(@pass_window.select_actor) @item_window.index = 0 adjustment_top(@pass_window.select_actor) @possession_window.chenge_actor(@pass_window.select_actor) @status_window.chenge_actor(@pass_window.select_actor) @equip_window.chenge_test_actor(@actor) @item_window.prior_help_text = HELP_ITEM_TRADING if HELP_ITEM_TRADING != "" end #-------------------------------------------------------------------------- # ○ “渡す”アイテム交換の更新 #-------------------------------------------------------------------------- def update_item_trading if Input.trigger?(Input::A) Sound.play_decision @analyze = @analyze ? false : true elsif Input.trigger?(Input::B) Sound.play_cancel end_item_trading start_pass_actor_selection elsif Input.trigger?(Input::C) if @pass_window.select_actor.item_can_pass?(@item_window.index) Sound.play_pass @actor.item_trading(@trading_window.item_index, @pass_window.select_actor, @item_window.index) @pass_window.select_actor.aoto_transfer_charge end_item_trading start_pass_item_selection else Sound.play_buzzer end end end #-------------------------------------------------------------------------- # ○ “渡す”アイテム交換の終了 #-------------------------------------------------------------------------- def end_item_trading @item_window.chenge_actor(@actor) @item_window.index = @trading_window.item_index item_window_refresh @possession_window.chenge_actor(@actor) @status_window.chenge_actor(@actor) @trading_window.visible = false @item_window.prior_help_text = nil end #-------------------------------------------------------------------------- # ○ “渡す”袋アイテムとの交換の開始 #-------------------------------------------------------------------------- def start_bag_item_trading @trading_window.visible = true @trading_window.refresh(@actor, @item_window.index) @pass_window.active = false open_bag_window @bag_window.active = true @bag_window.prior_help_text = HELP_ITEM_TRADING2 if HELP_ITEM_TRADING2 != "" end #-------------------------------------------------------------------------- # ○ “渡す”袋アイテムとの交換の更新 #-------------------------------------------------------------------------- def update_bag_item_trading if Input.trigger?(Input::A) Sound.play_decision @analyze = @analyze ? false : true elsif Input.trigger?(Input::B) Sound.play_cancel end_bag_item_trading start_pass_actor_selection elsif Input.trigger?(Input::C) Sound.play_pass @actor.item_trading(@trading_window.item_index, nil, @bag_window.index) end_bag_item_trading start_pass_item_selection end end #-------------------------------------------------------------------------- # ○ “渡す”袋アイテムとの交換の終了 #-------------------------------------------------------------------------- def end_bag_item_trading @item_window.index = @trading_window.item_index @trading_window.visible = false close_bag_window @bag_window.prior_help_text = nil end #-------------------------------------------------------------------------- # ○ “袋”ウインドウを開く #-------------------------------------------------------------------------- def open_bag_window return if @bag_window.openness == 255 @item_window.opacity = 200 @item_window.contents_opacity = 200 @bag_window.index = 0 @bag_window.refresh @bag_window.open begin @bag_window.update Graphics.update end until @bag_window.openness == 255 @bag_command_window.index = 0 end #-------------------------------------------------------------------------- # ○ “袋”アイテム選択の開始 #-------------------------------------------------------------------------- def start_bag_item_selection @command_window.active = false @equip_window.chenge_actor(@actor) @bag_window.refresh open_bag_window @bag_window.active = true @bag_possession_window.visible = true @bag_possession_window.refresh @bag_command_window.visible = false @bag_command_window.active = false @bag_window.info_windows_set_index end #-------------------------------------------------------------------------- # ○ “袋”アイテム選択の更新 #-------------------------------------------------------------------------- def update_bag_item_selection if Input.trigger?(Input::A) and Actor_Item::USE_ITEM_ANALYZE Sound.play_decision @analyze = @analyze ? false : true elsif Input.trigger?(Input::B) Sound.play_cancel @bag_possession_window.visible = false close_bag_window start_command_selection elsif Input.trigger?(Input::C) if @bag_window.item == nil Sound.play_buzzer else Sound.play_decision start_bag_command_selection end elsif Input.trigger?(Input::R) next_actor elsif Input.trigger?(Input::L) prev_actor end end #-------------------------------------------------------------------------- # ○ “袋”コマンド選択の開始 #-------------------------------------------------------------------------- def start_bag_command_selection @bag_command_window.set_item_index(@bag_window.index) @bag_command_window.visible = true @bag_command_window.active = true @bag_window.active = false @throws_window.openness = 0 @throws_window.active = false end #-------------------------------------------------------------------------- # ○ “袋”コマンド選択の更新 #-------------------------------------------------------------------------- def update_bag_command_selection if Input.trigger?(Input::B) Sound.play_cancel start_bag_item_selection elsif Input.trigger?(Input::C) case @bag_command_window.index when 0 if not @actor.carry_room? if Input.press?(Input::A) and @actor.stack_fraction_room_number(@bag_window.item) > 0 Sound.play_decision start_pass_numberinput_bag(@actor.stack_fraction_room_number(@bag_window.item)) else Sound.play_item_full start_bag_item_putout end elsif Input.press?(Input::A) and $game_party.carry_item(@bag_window.index).stack_item? Sound.play_decision start_pass_numberinput_bag else Sound.play_pass $game_party.item_trading(@bag_window.index, @actor) @item_window.refresh @possession_window.refresh start_bag_item_selection end when 1 Sound.play_pass $game_party.carry_items_data.push($game_party.carry_items_data[@bag_window.index]) $game_party.remove_item_index(@bag_window.index) start_bag_item_selection when 2 if $game_party.can_throw_index?(@bag_window.index) Sound.play_decision open_throws_window else Sound.play_buzzer end end elsif Input.trigger?(Input::R) next_actor elsif Input.trigger?(Input::L) prev_actor end end #-------------------------------------------------------------------------- # ○ “袋”スタックアイテム分割の開始 #-------------------------------------------------------------------------- def start_pass_numberinput_bag(max = nil) if max == nil charge = $game_party.carry_items_data[@bag_window.index]["charge"] else charge = [max, $game_party.carry_items_data[@bag_window.index]["charge"]].min end @window_numberinput = Window_Easy_NumberInput.new(0, 0, charge) @window_numberinput.x = @bag_window.x - @window_numberinput.width + 16 @window_numberinput.y = @bag_window.y + @bag_window.index * 24 @bag_command_window.active = false @help_window.set_text(HELP_PASS_STACK_NUMBER) if HELP_PASS_STACK_NUMBER != "" end #-------------------------------------------------------------------------- # ○ “袋”スタックアイテム分割の更新 #-------------------------------------------------------------------------- def update_pass_numberinput_bag if Input.trigger?(Input::B) Sound.play_cancel window_numberinput_dispose start_bag_command_selection elsif Input.trigger?(Input::C) if @window_numberinput.effective_range? Sound.play_pass determine_divides_bag window_numberinput_dispose item_window_refresh @bag_window.refresh start_bag_item_selection else Sound.play_buzzer end end end #-------------------------------------------------------------------------- # ○ “袋”スタックアイテム分割処理 #-------------------------------------------------------------------------- def determine_divides_bag @actor.obtain_item(@bag_window.item, true) @actor.carry_items_data[@actor.carry_items.size - 1]["charge"] = @window_numberinput.number @actor.aoto_transfer_charge $game_party.carry_items_data[@bag_window.index]["charge"] -= @window_numberinput.number if $game_party.carry_items_data[@bag_window.index]["charge"] < 1 $game_party.remove_item_index(@bag_window.index) end end #-------------------------------------------------------------------------- # ○ “袋”袋から取り出すアイテムとの交換の開始 #-------------------------------------------------------------------------- def start_bag_item_putout @trading_window.visible = true @trading_window.refresh($game_party, @bag_window.index) @bag_command_window.active = false @item_window.index = 0 adjustment_top @item_window.active = true @item_window.fixation_mode = 2 @item_window.opacity = 255 @item_window.contents_opacity = 255 @item_window.z += 1 @bag_window.opacity = 200 @bag_window.contents_opacity = 200 @item_window.prior_help_text = HELP_ITEM_TRADING3 if HELP_ITEM_TRADING3 != "" end #-------------------------------------------------------------------------- # ○ “袋”袋から取り出すアイテムとの交換の更新 #-------------------------------------------------------------------------- def update_bag_item_putout if Input.trigger?(Input::A) Sound.play_decision @analyze = @analyze ? false : true elsif Input.trigger?(Input::B) Sound.play_cancel end_bag_item_putout start_bag_command_selection elsif Input.trigger?(Input::C) if @actor.item_can_pass?(@item_window.index) Sound.play_pass $game_party.item_trading(@bag_window.index, @actor, @item_window.index) end_bag_item_putout start_bag_command_selection start_bag_item_selection else Sound.play_buzzer end end end #-------------------------------------------------------------------------- # ○ “袋”袋から取り出すアイテムとの交換の終了 #-------------------------------------------------------------------------- def end_bag_item_putout @item_window.active = false @item_window.index = -1 @item_window.fixation_mode = nil @item_window.opacity = 200 @item_window.contents_opacity = 200 @item_window.z -= 1 @bag_window.refresh @bag_window.opacity = 255 @bag_window.contents_opacity = 255 @trading_window.visible = false @bag_command_window.active = true @item_window.prior_help_text = nil @item_window.update_help end #-------------------------------------------------------------------------- # ○ “袋”ウインドウを閉じる #-------------------------------------------------------------------------- def close_bag_window @item_window.contents_opacity = 255 @item_window.opacity = 255 @bag_window.close begin @bag_window.update Graphics.update end until @bag_window.openness == 0 @bag_window.active = false $game_party.aoto_transfer_charge @item_window.refresh end #-------------------------------------------------------------------------- # ○ “捨てる”確認ウインドウを開く #-------------------------------------------------------------------------- def open_throws_window @bag_command_window.active = false @item_window.active = false @throws_window.open begin @throws_window.update Graphics.update end until @throws_window.openness == 255 @throws_window.active = true end #-------------------------------------------------------------------------- # ○ “捨てる”確認ウインドウを閉じる #-------------------------------------------------------------------------- def close_throws_window @throws_window.active = false @throws_window.close begin @throws_window.update Graphics.update end until @throws_window.openness == 0 end #-------------------------------------------------------------------------- # ○ “捨てる”確認の更新 #-------------------------------------------------------------------------- def update_throws if Input.trigger?(Input::A) and Actor_Item::USE_ITEM_ANALYZE Sound.play_decision @analyze = @analyze ? false : true elsif Input.trigger?(Input::B) Sound.play_cancel close_throws_window if @bag_command_window.visible start_bag_command_selection else start_item_selection end elsif Input.trigger?(Input::C) Sound.play_throws if @bag_command_window.visible $game_party.remove_item_index(@bag_window.index) @bag_window.refresh start_bag_command_selection start_bag_item_selection else @actor.remove_item_index(@item_window.index) @item_window.refresh start_item_selection end end end end #============================================================================== # □ Scene_AIS_Shop #------------------------------------------------------------------------------ #  アクター毎アイテム用のショップ画面の処理を行うクラスです。 #============================================================================== class Scene_AIS_Shop < Scene_Base #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- HELP_BUY_MEMBER_CHOICES = "メンバーを選択してアイテムを購入します。" HELP_BUY_STACK_NUMBER = "購入する数を決定します。" HELP_SELL_MEMBER_CHOICES = "アイテムを売却するメンバーを決定します。" HELP_SELL_STACK_NUMBER = "売却する数を決定します。" HELP_SELL_FINAL_REMINDER = "選択したアイテムを売却します。" HELP_FILL_MEMBER_CHOICES = "充填するアイテムを持つメンバーを選択します。" HELP_FILL_NUMBER = "充填する数を決定します。" HELP_FILL_FINAL_REMINDER = "料金を支払いチャージを充填します。" HELP_REPAIR_MEMBER_CHOICES = "修復するアイテムを持つメンバーを選択します。" HELP_REPAIR_FINAL_REMINDER = "料金を支払いアイテムを修復します。" # ※ ウインドウの項目依存のヘルプ文はウインドウクラスで指定しています。 EQUIP_BUY_CHOICES = ["購入品を装備しますか?","はい","いいえ"] EQUIP_SELL_CHOICES = ["装備中ですが売りますか?","はい","いいえ"] #-------------------------------------------------------------------------- # ○ 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background @actor_index = 0 @actor = $game_party.members[@actor_index] #- レイアウト位置 @help_window = Window_Help.new @gold_window = Window_Gold.new(384, 56) @command_window = Window_AIS_Shop_Command.new(10, 76) @equip_window = Window_Actor_Item_Equip.new(20, 258, @actor) @analyze_window = Window_Actor_Item_Analyze.new(20, 258) @item_window = Window_Actor_Item.new(262, 124, 272, 10, @actor) @pass_window = Window_Pass.new(0, 282, 5) # X座標は変動 if @pass_window.height > 128 @pass_window.y -= 24 end # 袋使用+パーティー4人の際の位置調整 @pass_window_left_x = 20 # @pass_window 左位置時のX座標 @pass_window_right_x = 304 # @pass_window 右位置時のX座標 @sell_price_window = Window_Item_Sell_Price.new(20, 142) @buy_window = Window_AIS_ShopBuy.new(30, 46, 8) @item_number_window = Window_Item_Number.new(430, 190, @actor) @item_window.help_window = @help_window @buy_window.help_window = @help_window @command_window.help_window = @help_window @item_number_window.base_window = @buy_window @analyze_window.visible = false start_command_selection end #-------------------------------------------------------------------------- # ○ 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @help_window.dispose @gold_window.dispose @command_window.dispose @equip_window.dispose @item_window.dispose @analyze_window.dispose @pass_window.dispose @sell_price_window.dispose @item_number_window.dispose @buy_window.dispose end #-------------------------------------------------------------------------- # ○ 簡易選択ウインドウ消去 #-------------------------------------------------------------------------- def window_easy_choices_dispose return if @window_easy_choices == nil @window_easy_choices.dispose @window_easy_choices = nil end #-------------------------------------------------------------------------- # ○ 数値入力ウインドウ消去 #-------------------------------------------------------------------------- def window_numberinput_dispose return if @window_numberinput == nil @window_numberinput.dispose @window_numberinput = nil end #-------------------------------------------------------------------------- # ○ 充填価格ウインドウ作成 #-------------------------------------------------------------------------- def create_fill_price_window return if @fill_price_window != nil @fill_price_window = Window_Item_Fill_Price.new(18, 124) end #-------------------------------------------------------------------------- # ○ 充填価格ウインドウ消去 #-------------------------------------------------------------------------- def fill_price_window_dispose return if @fill_price_window == nil @fill_price_window.dispose @fill_price_window = nil end #-------------------------------------------------------------------------- # ○ 修復価格ウインドウ作成 #-------------------------------------------------------------------------- def create_repair_price_window return if @repair_price_window != nil @repair_price_window = Window_Item_Repair_Price.new(18, 124) end #-------------------------------------------------------------------------- # ○ 修復価格ウインドウ消去 #-------------------------------------------------------------------------- def repair_price_window_dispose return if @repair_price_window == nil @repair_price_window.dispose @repair_price_window = nil end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update super update_menu_background update_analyze_window @help_window.update @gold_window.update @command_window.update @buy_window.update @item_window.update @equip_window.update @pass_window.update @sell_price_window.update @item_number_window.update @window_easy_choices.update if @window_easy_choices != nil @window_numberinput.update if @window_numberinput != nil cursor_action_update end #-------------------------------------------------------------------------- # ○ カーソル動作の更新 #-------------------------------------------------------------------------- def cursor_action_update if @window_easy_choices != nil window_easy_choices_update return true elsif @window_numberinput != nil window_numberinput_update return true elsif @pass_window.active pass_window_update return true elsif @buy_window.active update_buy_selection return true elsif @sell_price_window.active update_sell_item_confirmation return true elsif @fill_price_window != nil and @fill_price_window.active @fill_price_window.update update_fill_item_confirmation elsif @repair_price_window != nil and @repair_price_window.active @repair_price_window.update update_repair_item_confirmation elsif @item_window.active item_window_update return true elsif @command_window.active update_command_selection return true end end #-------------------------------------------------------------------------- # ○ @window_easy_choices 動作時の更新 #-------------------------------------------------------------------------- def window_easy_choices_update case @command_window.select when 0 ; update_buy_equip_selection when 1 ; update_equipping_sell_permission end end #-------------------------------------------------------------------------- # ○ @window_numberinput 動作時の更新 #-------------------------------------------------------------------------- def window_numberinput_update case @command_window.select when 0 ; update_buy_stack_item_numberinput when 1 ; update_sell_stack_item_numberinput when 2 ; update_fill_numberinput end end #-------------------------------------------------------------------------- # ○ @pass_window 動作時の更新 #-------------------------------------------------------------------------- def pass_window_update case @command_window.select when 0 ; update_buy_actor_selection when 1 ; update_sell_actor_selection when 2 ; update_fill_actor_selection when 3 ; update_repair_actor_selection end end #-------------------------------------------------------------------------- # ○ @item_window 動作時の更新 #-------------------------------------------------------------------------- def item_window_update case @command_window.select when 1 ; update_sell_item_selection when 2 ; update_fill_item_selection when 3 ; update_repair_item_selection end end #-------------------------------------------------------------------------- # ○ アイテム詳細ウィンドウの更新 #-------------------------------------------------------------------------- def update_analyze_window return unless @buy_window.visible if not Actor_Item::USE_ITEM_ANALYZE or (not @buy_window.item.is_a?(RPG::Item) and (@pass_window.active or @window_easy_choices != nil)) @equip_window.visible = true @analyze_window.visible = false if @equip_window.item != @buy_window.item @equip_window.set_item(@buy_window.item) end @equip_window.update else @analyze_window.visible = true @equip_window.visible = false if @buy_window.item != @analyze_window.item @analyze_window.set_item(@buy_window.item) end @analyze_window.update end end #-------------------------------------------------------------------------- # ○ 次のアクターの画面に切り替え #-------------------------------------------------------------------------- def next_actor return if $game_party.members.size == 1 and not $game_party.bag_can_use? Sound.play_cursor size = $game_party.members.size size += 1 if $game_party.bag_can_use? @actor_index += 1 @actor_index %= size chenge_actor(@actor_index) end #-------------------------------------------------------------------------- # ○ 前のアクターの画面に切り替え #-------------------------------------------------------------------------- def prev_actor return if $game_party.members.size == 1 and not $game_party.bag_can_use? Sound.play_cursor size = $game_party.members.size size += 1 if $game_party.bag_can_use? @actor_index -= 1 @actor_index %= size chenge_actor(@actor_index) end #-------------------------------------------------------------------------- # ○ 指定のindexのアクターの画面に切り替え #-------------------------------------------------------------------------- def chenge_actor(index) return if $game_party.members.size == 1 and not $game_party.bag_can_use? @actor_index = index @actor = $game_party.members[@actor_index] @equip_window.chenge_actor(@actor) @pass_window.index = index @actor = $game_party if @actor == nil @item_window.chenge_actor(@actor) @item_window.index = @pass_window.active ? -1 : 0 @sell_price_window.set_item(@actor, @item_window.index) @item_number_window.chenge_actor(@actor) update_analyze_window end #-------------------------------------------------------------------------- # ○ 取引内容選択コマンドの開始 #-------------------------------------------------------------------------- def start_command_selection chenge_actor(0) @buy_window.visible = false @buy_window.active = false @buy_window.index = 0 @item_window.visible = false @item_window.active = false @item_window.index = 0 @equip_window.visible = false @analyze_window.visible = false @pass_window.visible = false @pass_window.active = false @sell_price_window.visible = false @item_number_window.visible = false @command_window.active = true fill_price_window_dispose repair_price_window_dispose end #-------------------------------------------------------------------------- # ○ 取引内容選択コマンドの更新 #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) case @command_window.select when 0 # 購入する Sound.play_decision start_buy_selection when 1 # 売却する Sound.play_decision start_sell_actor_selection when 2 # 充填する Sound.play_decision start_fill_actor_selection when 3 # 修復する Sound.play_decision start_repair_actor_selection when @command_window.order[-1] # やめる Sound.play_cancel $scene = Scene_Map.new end end end #-------------------------------------------------------------------------- # ○ 購入アイテム選択の開始 #-------------------------------------------------------------------------- def start_buy_selection @command_window.active = false @pass_window.increase = true @pass_window.x = @pass_window_right_x @pass_window.index = @actor_index @pass_window.stack_item_data = [] @pass_window.refresh @pass_window.visible = true @pass_window.active = false @item_number_window.visible = true @buy_window.visible = true @buy_window.active = true @buy_window.refresh end #-------------------------------------------------------------------------- # ○ 購入アイテム選択の更新 #-------------------------------------------------------------------------- def update_buy_selection if Input.trigger?(Input::B) Sound.play_cancel return start_command_selection elsif Input.trigger?(Input::C) @item = @buy_window.item if @item == nil or @buy_window.price > $game_party.gold Sound.play_buzzer elsif Actor_Item::STACK_ITEM_FRACTION_SHOP and @item.stack_item? and Input.press?(Input::A) Sound.play_decision start_buy_stack_item_numberinput(@item) else #- 購入アクター選択の開始 Sound.play_decision if @item.stack_item? @pass_window.stack_item_data = [@buy_window.item, @buy_window.stacks[@buy_window.index]] @pass_window.refresh end @pass_window.active = true @buy_window.active = false @help_window.set_text(HELP_BUY_MEMBER_CHOICES) if HELP_BUY_MEMBER_CHOICES != "" end elsif Input.trigger?(Input::R) next_actor @pass_window.index = @actor_index unless $game_party.members.size == 1 elsif Input.trigger?(Input::L) prev_actor @pass_window.index = @actor_index unless $game_party.members.size == 1 end end #-------------------------------------------------------------------------- # ○ スタックアイテム購入数入力の開始 #-------------------------------------------------------------------------- def start_buy_stack_item_numberinput(item) @window_numberinput = Window_Easy_NumberInput.new(0, 0, @buy_window.item.charge, @buy_window.stacks[@buy_window.index]) @window_numberinput.x = @buy_window.x + @buy_window.width - 16 @window_numberinput.y = @buy_window.y + @buy_window.cursor_rect.y @buy_window.active = false @pass_window.stack_item_data = [@buy_window.item, @buy_window.stacks[@buy_window.index]] @pass_window.refresh @help_window.set_text(HELP_BUY_STACK_NUMBER) if HELP_BUY_STACK_NUMBER != "" end #-------------------------------------------------------------------------- # ○ スタックアイテム購入数入力の更新 #-------------------------------------------------------------------------- def update_buy_stack_item_numberinput if @buy_window.stacks[@buy_window.index] != @window_numberinput.number @buy_window.stacks[@buy_window.index] = @window_numberinput.number @buy_window.refresh @pass_window.stack_item_data = [@buy_window.item, @buy_window.stacks[@buy_window.index]] @pass_window.refresh end if Input.trigger?(Input::B) Sound.play_cancel window_numberinput_dispose @buy_window.active = true elsif Input.trigger?(Input::C) if @item == nil or @buy_window.price > $game_party.gold Sound.play_buzzer else Sound.play_decision window_numberinput_dispose @pass_window.active = true @help_window.set_text(HELP_BUY_MEMBER_CHOICES) if HELP_BUY_MEMBER_CHOICES != "" end end end #-------------------------------------------------------------------------- # ○ 購入アクター選択の更新 #-------------------------------------------------------------------------- def update_buy_actor_selection if Input.trigger?(Input::B) Sound.play_cancel start_buy_selection elsif Input.trigger?(Input::C) if @item.stack_item? # スタックアイテムの購入処理 if @actor.stack_room_number(@item) >= @buy_window.stacks[@buy_window.index] @actor.obtain_stack_item(@item, @buy_window.stacks[@buy_window.index]) end_buy_actor_selection else Sound.play_buzzer end else # 通常の購入処理 if @actor.carry_room? @actor.obtain_item(@item) end_buy_actor_selection else Sound.play_buzzer end end elsif Input.trigger?(Input::R) next_actor @pass_window.index = @actor_index unless $game_party.members.size == 1 elsif Input.trigger?(Input::L) prev_actor @pass_window.index = @actor_index unless $game_party.members.size == 1 elsif @pass_window.index != @actor_index chenge_actor(@pass_window.index) end end #-------------------------------------------------------------------------- # ○ 購入アクター選択の終了処理 #-------------------------------------------------------------------------- def end_buy_actor_selection Sound.play_shop $game_party.lose_gold(@buy_window.price) @actor.aoto_transfer_charge @gold_window.refresh @buy_window.refresh @item_window.refresh @pass_window.refresh @item_number_window.refresh if @actor.is_a?(Game_Actor) and @actor.equipable_index?(@actor.carry_items.size - 1) and not @actor.same_item_equipping?(@item) @window_easy_choices = Window_Easy_Choices.new(EQUIP_BUY_CHOICES) end start_buy_selection end #-------------------------------------------------------------------------- # ○ 購入アイテム装備選択の更新 #-------------------------------------------------------------------------- def update_buy_equip_selection @buy_window.active = false if Input.trigger?(Input::B) Sound.play_cancel window_easy_choices_dispose @buy_window.active = true elsif Input.trigger?(Input::C) if @window_easy_choices.index == 0 Sound.play_equip @actor.acquires_equipment(-1) if @actor.carry_item(-1).curse_states and @actor.state?(@actor.carry_item(-1).curse_states) Sound.play_curse end @actor.item_aoto_sort @actor.aoto_transfer_charge @equip_window.refresh else Sound.play_cancel end window_easy_choices_dispose @buy_window.active = true end end #-------------------------------------------------------------------------- # ○ 売却アクター選択の開始 #-------------------------------------------------------------------------- def start_sell_actor_selection @command_window.active = false @command_window.update_help @item_window.fixation_mode = 4 @item_window.visible = true @item_window.active = false @item_window.index = -1 @pass_window.x = @pass_window_left_x @pass_window.increase = false @pass_window.refresh @pass_window.visible = true @pass_window.active = true @sell_price_window.visible = false if $game_party.members.size == 1 and not $game_party.bag_can_use? @pass_window.index = -1 start_sell_item_selection @sell_price_window.set_item(@actor, 0) @item_window.index = 0 end @help_window.set_text(HELP_SELL_MEMBER_CHOICES) if HELP_SELL_MEMBER_CHOICES != "" end #-------------------------------------------------------------------------- # ○ 売却アクター選択の更新 #-------------------------------------------------------------------------- def update_sell_actor_selection if Input.trigger?(Input::B) Sound.play_cancel start_command_selection elsif Input.trigger?(Input::C) if @actor.carry_items_data.empty? Sound.play_buzzer else Sound.play_decision start_sell_item_selection @sell_price_window.set_item(@actor, 0) @item_window.index = 0 end elsif Input.trigger?(Input::R) unless @pass_window.index == -1 next_actor @pass_window.index = @actor_index end elsif Input.trigger?(Input::L) unless @pass_window.index == -1 prev_actor @pass_window.index = @actor_index end elsif @pass_window.index != -1 and @pass_window.index != @actor_index chenge_actor(@pass_window.index) end end #-------------------------------------------------------------------------- # ○ 売却アイテム選択の開始 #-------------------------------------------------------------------------- def start_sell_item_selection @pass_window.active = false @item_window.active = true @sell_price_window.visible = true @sell_price_window.active = false @sell_price_window.index = -1 end #-------------------------------------------------------------------------- # ○ 売却アイテム選択の更新 #-------------------------------------------------------------------------- def update_sell_item_selection if @item_window.index != @sell_price_window.item_index @sell_price_window.set_item(@actor, @item_window.index) end if Input.trigger?(Input::B) Sound.play_cancel start_sell_actor_selection start_command_selection if $game_party.members.size == 1 and not $game_party.bag_can_use? elsif Input.trigger?(Input::C) if @item_window.item == nil Sound.play_buzzer elsif @actor.can_sell_index?(@item_window.index) and $game_temp.shop_handling?(@item_window.item) Sound.play_decision @item_window.active = false if Actor_Item::STACK_ITEM_FRACTION_SHOP and @actor.carry_item(@item_window.index).stack_item? and Input.press?(Input::A) start_sell_stack_item_numberinput else start_sell_item_confirmation end else Sound.play_buzzer end elsif Input.trigger?(Input::R) unless @pass_window.index == -1 next_actor @pass_window.index = @actor_index end elsif Input.trigger?(Input::L) unless @pass_window.index == -1 prev_actor @pass_window.index = @actor_index end end end #-------------------------------------------------------------------------- # ○ スタックアイテム売却数入力の開始 #-------------------------------------------------------------------------- def start_sell_stack_item_numberinput @window_numberinput = Window_Easy_NumberInput.new(0, 0, @sell_price_window.stack) @window_numberinput.x = @sell_price_window.x + @sell_price_window.width - 16 @window_numberinput.y = @sell_price_window.y @help_window.set_text(HELP_SELL_STACK_NUMBER) if HELP_SELL_STACK_NUMBER != "" end #-------------------------------------------------------------------------- # ○ スタックアイテム売却数入力の更新 #-------------------------------------------------------------------------- def update_sell_stack_item_numberinput if @sell_price_window.stack != @window_numberinput.number @sell_price_window.stack = @window_numberinput.number @sell_price_window.refresh end if Input.trigger?(Input::B) Sound.play_cancel window_numberinput_dispose @sell_price_window.set_item(@actor, @item_window.index) start_sell_item_selection elsif Input.trigger?(Input::C) Sound.play_decision start_sell_item_confirmation end end #-------------------------------------------------------------------------- # ○ アイテム売却の決定確認の開始 #-------------------------------------------------------------------------- def start_sell_item_confirmation window_numberinput_dispose @sell_price_window.index = 0 @sell_price_window.active = true @help_window.set_text(HELP_SELL_FINAL_REMINDER) if HELP_SELL_FINAL_REMINDER != "" end #-------------------------------------------------------------------------- # ○ アイテム売却の決定確認の更新 #-------------------------------------------------------------------------- def update_sell_item_confirmation if Input.trigger?(Input::B) Sound.play_cancel @sell_price_window.set_item(@actor, @item_window.index) start_sell_item_selection elsif Input.trigger?(Input::C) if @actor.is_a?(Game_Actor) and @actor.equipping?(@item_window.index) Sound.play_decision @window_easy_choices = Window_Easy_Choices.new(EQUIP_SELL_CHOICES, nil, 204) @window_easy_choices.index = 1 @sell_price_window.active = false else sell_item_decision end end end #-------------------------------------------------------------------------- # ○ 装備アイテム売却許可選択の更新 #-------------------------------------------------------------------------- def update_equipping_sell_permission if Input.trigger?(Input::B) Sound.play_cancel @sell_price_window.active = true window_easy_choices_dispose elsif Input.trigger?(Input::C) case @window_easy_choices.index when 0 sell_item_decision when 1 Sound.play_cancel start_sell_item_selection end window_easy_choices_dispose end end #-------------------------------------------------------------------------- # ○ アイテム売却処理 #-------------------------------------------------------------------------- def sell_item_decision Sound.play_shop item = @actor.carry_item(@item_window.index) $game_party.gain_gold(@sell_price_window.price) if item.stack_item? @actor.carry_items_data[@item_window.index]["charge"] -= @sell_price_window.stack if @actor.carry_items_data[@item_window.index]["charge"] == 0 @actor.remove_item_index(@item_window.index, true) end else @actor.remove_item_index(@item_window.index, true) end @actor.aoto_transfer_charge @item_window.refresh @sell_price_window.set_item(@actor, @item_window.index) @pass_window.refresh @gold_window.refresh start_sell_item_selection start_sell_actor_selection if @actor.carry_items.empty? end #-------------------------------------------------------------------------- # ○ 充填アクター選択の開始 #-------------------------------------------------------------------------- def start_fill_actor_selection @command_window.active = false @command_window.update_help @item_window.fixation_mode = 6 @item_window.visible = true @item_window.active = false @item_window.index = -1 @pass_window.x = @pass_window_left_x @pass_window.increase = false @pass_window.refresh @pass_window.visible = true @pass_window.active = true fill_price_window_dispose if $game_party.members.size == 1 and not $game_party.bag_can_use? @pass_window.index = -1 start_fill_item_selection @fill_price_window.set_item(@actor, 0) @item_window.index = 0 else @help_window.set_text(HELP_FILL_MEMBER_CHOICES) if HELP_FILL_MEMBER_CHOICES != "" end end #-------------------------------------------------------------------------- # ○ 充填アクター選択の更新 #-------------------------------------------------------------------------- def update_fill_actor_selection if Input.trigger?(Input::B) Sound.play_cancel start_command_selection elsif Input.trigger?(Input::C) if @actor.carry_items_data.empty? Sound.play_buzzer else Sound.play_decision start_fill_item_selection @fill_price_window.set_item(@actor, 0) @item_window.index = 0 end elsif Input.trigger?(Input::R) unless @pass_window.index == -1 next_actor @pass_window.index = @actor_index end elsif Input.trigger?(Input::L) unless @pass_window.index == -1 prev_actor @pass_window.index = @actor_index end elsif @pass_window.index != -1 and @pass_window.index != @actor_index chenge_actor(@pass_window.index) end end #-------------------------------------------------------------------------- # ○ 充填アイテム選択の開始 #-------------------------------------------------------------------------- def start_fill_item_selection @pass_window.active = false @item_window.active = true create_fill_price_window @fill_price_window.active = false @fill_price_window.index = -1 end #-------------------------------------------------------------------------- # ○ 充填アイテム選択の更新 #-------------------------------------------------------------------------- def update_fill_item_selection if @item_window.index != @fill_price_window.item_index or @actor != @fill_price_window.actor @fill_price_window.set_item(@actor, @item_window.index) end if Input.trigger?(Input::B) Sound.play_cancel start_fill_actor_selection start_command_selection if $game_party.members.size == 1 and not $game_party.bag_can_use? elsif Input.trigger?(Input::C) if @item_window.item == nil Sound.play_buzzer elsif @actor.item_can_fill?(@item_window.index) and $game_temp.shop_handling?(@item_window.item) Sound.play_decision if Input.press?(Input::A) and @fill_price_window.max_fill > 1 and not @item_window.item.hide_charge start_fill_numberinput else start_fill_item_confirmation end else Sound.play_buzzer end elsif Input.trigger?(Input::R) unless @pass_window.index == -1 next_actor @pass_window.index = @actor_index end elsif Input.trigger?(Input::L) unless @pass_window.index == -1 prev_actor @pass_window.index = @actor_index end end end #-------------------------------------------------------------------------- # ○ 充填数入力の開始 #-------------------------------------------------------------------------- def start_fill_numberinput @window_numberinput = Window_Easy_NumberInput.new(0, 0, @fill_price_window.max_fill, 1) @window_numberinput.x = @fill_price_window.x + @fill_price_window.width @window_numberinput.y = @fill_price_window.y + 24 * 2 @item_window.active = false @help_window.set_text(HELP_FILL_NUMBER) if HELP_FILL_NUMBER != "" end #-------------------------------------------------------------------------- # ○ 充填数入力の更新 #-------------------------------------------------------------------------- def update_fill_numberinput if @fill_price_window.fill_number != @window_numberinput.number @fill_price_window.fill_number = @window_numberinput.number @fill_price_window.refresh end if Input.trigger?(Input::B) Sound.play_cancel window_numberinput_dispose @fill_price_window.fill_number = 1 @fill_price_window.refresh @item_window.active = true elsif Input.trigger?(Input::C) if @fill_price_window.price > $game_party.gold Sound.play_buzzer else Sound.play_decision start_fill_item_confirmation end end end #-------------------------------------------------------------------------- # ○ アイテム充填の決定確認の開始 #-------------------------------------------------------------------------- def start_fill_item_confirmation @item_window.active = false window_numberinput_dispose @fill_price_window.index = 0 @fill_price_window.active = true @help_window.set_text(HELP_FILL_FINAL_REMINDER) if HELP_FILL_FINAL_REMINDER != "" end #-------------------------------------------------------------------------- # ○ アイテム充填の決定確認の更新 #-------------------------------------------------------------------------- def update_fill_item_confirmation if Input.trigger?(Input::B) Sound.play_cancel @fill_price_window.fill_number = 1 @fill_price_window.refresh start_fill_item_selection elsif Input.trigger?(Input::C) if @fill_price_window.price > $game_party.gold Sound.play_buzzer else Sound.play_shop $game_party.lose_gold(@fill_price_window.price) @gold_window.refresh Graphics.wait(20) @item_window.window_animation(Actor_Item::FILL_ANIMATION_ID, @item_window.cursor_rect) Graphics.wait(20) Sound.play_fill @actor.carry_items_data[@item_window.index]["charge"] += @fill_price_window.fill_number @item_window.refresh @fill_price_window.fill_number = 1 @fill_price_window.refresh start_fill_item_selection end end end #-------------------------------------------------------------------------- # ○ 修復アクター選択の開始 #-------------------------------------------------------------------------- def start_repair_actor_selection @command_window.active = false @command_window.update_help @item_window.fixation_mode = 7 @item_window.visible = true @item_window.active = false @item_window.index = -1 @pass_window.x = @pass_window_left_x @pass_window.increase = false @pass_window.refresh @pass_window.visible = true @pass_window.active = true repair_price_window_dispose if $game_party.members.size == 1 and not $game_party.bag_can_use? @pass_window.index = -1 start_repair_item_selection @repair_price_window.set_item(@actor, 0) @item_window.index = 0 else @help_window.set_text(HELP_REPAIR_MEMBER_CHOICES) if HELP_REPAIR_MEMBER_CHOICES != "" end end #-------------------------------------------------------------------------- # ○ 修復アクター選択の更新 #-------------------------------------------------------------------------- def update_repair_actor_selection if Input.trigger?(Input::B) Sound.play_cancel start_command_selection elsif Input.trigger?(Input::C) if @actor.carry_items_data.empty? Sound.play_buzzer else Sound.play_decision start_repair_item_selection @repair_price_window.set_item(@actor, 0) @item_window.index = 0 end elsif Input.trigger?(Input::R) unless @pass_window.index == -1 next_actor @pass_window.index = @actor_index end elsif Input.trigger?(Input::L) unless @pass_window.index == -1 prev_actor @pass_window.index = @actor_index end elsif @pass_window.index != -1 and @pass_window.index != @actor_index chenge_actor(@pass_window.index) end end #-------------------------------------------------------------------------- # ○ 修復アイテム選択の開始 #-------------------------------------------------------------------------- def start_repair_item_selection @pass_window.active = false @item_window.active = true create_repair_price_window @repair_price_window.active = false @repair_price_window.index = -1 end #-------------------------------------------------------------------------- # ○ 修復アイテム選択の更新 #-------------------------------------------------------------------------- def update_repair_item_selection if @item_window.index != @repair_price_window.item_index or @actor != @repair_price_window.actor @repair_price_window.set_item(@actor, @item_window.index) end if Input.trigger?(Input::B) Sound.play_cancel start_repair_actor_selection start_command_selection if $game_party.members.size == 1 and not $game_party.bag_can_use? elsif Input.trigger?(Input::C) if @item_window.item == nil Sound.play_buzzer elsif @actor.item_can_repair?(@item_window.index) and $game_temp.shop_handling?(@item_window.item) Sound.play_decision start_repair_item_confirmation else Sound.play_buzzer end elsif Input.trigger?(Input::R) unless @pass_window.index == -1 next_actor @pass_window.index = @actor_index end elsif Input.trigger?(Input::L) unless @pass_window.index == -1 prev_actor @pass_window.index = @actor_index end end end #-------------------------------------------------------------------------- # ○ アイテム修復の決定確認の開始 #-------------------------------------------------------------------------- def start_repair_item_confirmation @item_window.active = false window_numberinput_dispose @repair_price_window.index = 0 @repair_price_window.active = true @help_window.set_text(HELP_REPAIR_FINAL_REMINDER) if HELP_REPAIR_FINAL_REMINDER != "" end #-------------------------------------------------------------------------- # ○ アイテム修復の決定確認の更新 #-------------------------------------------------------------------------- def update_repair_item_confirmation if Input.trigger?(Input::B) Sound.play_cancel start_repair_item_selection elsif Input.trigger?(Input::C) if @repair_price_window.price > $game_party.gold Sound.play_buzzer else Sound.play_shop $game_party.lose_gold(@repair_price_window.price) @gold_window.refresh Graphics.wait(20) @item_window.window_animation(Actor_Item::REPAIR_ANIMATION_ID, @item_window.cursor_rect) Graphics.wait(20) Sound.play_repair @actor.repair_item(@item_window.index) @item_window.refresh @repair_price_window.refresh start_repair_item_selection end end end end #============================================================================== # □ Scene_Item_Keeper #------------------------------------------------------------------------------ #  預かり所画面の処理を行うクラスです。 #============================================================================== class Scene_Item_Keeper < Scene_Base #-------------------------------------------------------------------------- # ○ 定数(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- EQUIP_ENTRUST_CHOICES = ["装備中ですが預けますか?","はい","いいえ"] #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # actor_index : アクターindex #-------------------------------------------------------------------------- def initialize @analyze = false end #-------------------------------------------------------------------------- # ○ 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background @actor_index = 0 @actor = $game_party.members[@actor_index] @command_window = Window_Keep_Item_Command.new(10, 76) @help_window = Window_Help.new @pass_window = Window_Pass.new(0, 0, 5) # ※座標の定義は下記  @pass_window_left_x = 20 # @pass_window 左位置時のX座標 @pass_window_left_y = 114 # @pass_window 左位置時のY座標 @pass_window_right_x = 296 # @pass_window 右位置時のX座標 @pass_window_right_y = 258 # @pass_window 右位置時のY座標 @possession_window = Window_Actor_Item_Possession.new(268, 62, @actor) @item_window = Window_Actor_Item.new(268, 100, 272, 10, @actor) @equip_window = Window_Actor_Item_Equip.new(268, 62, @actor) @analyze_window = Window_Actor_Item_Analyze.new(268, 62) @keep_item_window = Window_Keep_Item.new(20, 138, 10) @keep_item_category_window = Window_Keep_Item_Category.new(140, 100) @keep_item_info_window = Window_Keep_Item_Info.new(20, 10, @actor) # @keep_item_info_window のY座標は下記でさらに調整されます。 @keep_item_info_window.y += @pass_window_left_y + @pass_window.height @item_window.fixation_mode = 5 @item_window.help_window = @help_window @keep_item_window.help_window = @help_window @command_window.help_window = @help_window @keep_item_window.category_window = @keep_item_category_window start_command_selection end #-------------------------------------------------------------------------- # ○ 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @command_window.dispose @help_window.dispose @pass_window.dispose @possession_window.dispose @item_window.dispose @keep_item_window.dispose @equip_window.dispose @analyze_window.dispose @keep_item_category_window.dispose @keep_item_info_window.dispose end #-------------------------------------------------------------------------- # ○ 簡易選択ウインドウ消去 #-------------------------------------------------------------------------- def window_easy_choices_dispose @window_easy_choices.dispose @window_easy_choices = nil end #-------------------------------------------------------------------------- # ○ 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene if $scene != self $scene.another_scene = nil self.terminate else $scene = Scene_Map.new end end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update super update_menu_background update_analyze_window @command_window.update @help_window.update @pass_window.update @possession_window.update @item_window.update @keep_item_window.update @equip_window.update @analyze_window.update @keep_item_category_window.update @keep_item_info_window.update @window_easy_choices.update if @window_easy_choices != nil if @window_easy_choices != nil update_equipping_entrust_permission elsif @keep_item_info_window.active update_item_kept elsif @keep_item_window.active update_keep_item_selection elsif @item_window.active update_entrust_item_selection elsif @pass_window.active case @command_window.select when 0 ; update_entrust_actor_selection when 1 ; update_addressee_actor_selection end else update_command_selection end end #-------------------------------------------------------------------------- # ○ アイテム詳細ウィンドウの更新 #-------------------------------------------------------------------------- def update_analyze_window return unless @keep_item_window.visible if @analyze @analyze_window.visible = true @equip_window.visible = false if @keep_item_window.item != @analyze_window.item @analyze_window.set_item(@keep_item_window.item) end @analyze_window.update else @equip_window.visible = true @analyze_window.visible = false if @equip_window.item != @keep_item_window.item @equip_window.set_item(@keep_item_window.item) end @equip_window.update end end #-------------------------------------------------------------------------- # ○ 次のアクターの画面に切り替え #-------------------------------------------------------------------------- def next_actor return if $game_party.members.size == 1 and not $game_party.bag_can_use? Sound.play_cursor size = $game_party.members.size size += 1 if $game_party.bag_can_use? @actor_index += 1 @actor_index %= size chenge_actor(@actor_index) end #-------------------------------------------------------------------------- # ○ 前のアクターの画面に切り替え #-------------------------------------------------------------------------- def prev_actor return if $game_party.members.size == 1 and not $game_party.bag_can_use? Sound.play_cursor size = $game_party.members.size size += 1 if $game_party.bag_can_use? @actor_index -= 1 @actor_index %= size chenge_actor(@actor_index) end #-------------------------------------------------------------------------- # ○ 指定のindexのアクターの画面に切り替え #-------------------------------------------------------------------------- def chenge_actor(index) return if $game_party.members.size == 1 and not $game_party.bag_can_use? @actor_index = index @actor = $game_party.members[@actor_index] @pass_window.index = index @equip_window.chenge_actor(@actor) @actor = $game_party if @actor == nil @possession_window.chenge_actor(@actor) @item_window.chenge_actor(@actor) @keep_item_info_window.chenge_actor(@actor) if @item_window.index != @keep_item_info_window.item_index @keep_item_info_window.set_item_index(@item_window.index) end adjustment_top end #-------------------------------------------------------------------------- # ○ アイテムの頭出し #-------------------------------------------------------------------------- def adjustment_top return if @item_window.item == nil return if @item_window.index == -1 @item_window.index = 0 if @actor.is_a?(Game_Actor) until @actor.item_can_pass?(@item_window.index) if @item_window.index == @actor.carry_items.size - 1 @item_window.index = 0 break end @item_window.index += 1 end end end #-------------------------------------------------------------------------- # ○ コマンド選択の開始 #-------------------------------------------------------------------------- def start_command_selection @pass_window.visible = false @pass_window.active = false @possession_window.visible = false @item_window.visible = false @item_window.active = false @keep_item_window.visible = false @keep_item_window.active = false @equip_window.visible = false @analyze_window.visible = false @keep_item_category_window.visible = false @keep_item_category_window.active = false @keep_item_info_window.visible = false @keep_item_info_window.active = false @command_window.active = true end #-------------------------------------------------------------------------- # ○ コマンド選択の更新 #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) case @command_window.select when 0 # 預ける Sound.play_decision start_entrust_actor_selection when 1 # 受け取る Sound.play_decision start_keep_item_selection when 2 # やめる Sound.play_cancel $scene = Scene_Map.new end end end #-------------------------------------------------------------------------- # ○ アクター選択の開始 #-------------------------------------------------------------------------- def start_entrust_actor_selection @command_window.active = false @command_window.update_help @possession_window.visible = true @item_window.refresh @item_window.visible = true @item_window.active = false @item_window.index = -1 @pass_window.increase = false @pass_window.refresh @pass_window.x = @pass_window_left_x @pass_window.y = @pass_window_left_y @pass_window.visible = true @pass_window.active = true @keep_item_info_window.visible = false if $game_party.members.size == 1 and not $game_party.bag_can_use? @pass_window.index = -1 start_entrust_item_selection @item_window.index = 0 adjustment_top end end #-------------------------------------------------------------------------- # ○ 預けるアクター選択の更新 #-------------------------------------------------------------------------- def update_entrust_actor_selection if Input.trigger?(Input::B) Sound.play_cancel start_command_selection elsif Input.trigger?(Input::C) if @actor.carry_items_data.empty? == false Sound.play_decision start_entrust_item_selection @item_window.index = 0 adjustment_top else Sound.play_buzzer end elsif Input.trigger?(Input::R) unless @pass_window.index == -1 next_actor @pass_window.index = @actor_index end elsif Input.trigger?(Input::L) unless @pass_window.index == -1 prev_actor @pass_window.index = @actor_index end elsif @pass_window.index != @actor_index chenge_actor(@pass_window.index) end end #-------------------------------------------------------------------------- # ○ 預けるアイテム選択の開始 #-------------------------------------------------------------------------- def start_entrust_item_selection @pass_window.active = false @keep_item_info_window.visible = true @keep_item_info_window.active = false @item_window.active = true @item_window.refresh @keep_item_info_window.set_item_index(@item_window.index) end #-------------------------------------------------------------------------- # ○ 預けるアイテム選択の更新 #-------------------------------------------------------------------------- def update_entrust_item_selection if Input.trigger?(Input::B) Sound.play_cancel start_entrust_actor_selection start_command_selection if $game_party.members.size == 1 and not $game_party.bag_can_use? elsif Input.trigger?(Input::C) if @item_window.item != nil and @actor.can_entrust_index?(@item_window.index) Sound.play_decision entrust_item_decision else Sound.play_buzzer end elsif Input.trigger?(Input::R) unless @pass_window.index == -1 next_actor @pass_window.index = @actor_index end elsif Input.trigger?(Input::L) unless @pass_window.index == -1 prev_actor @pass_window.index = @actor_index end elsif @item_window.index != @keep_item_info_window.item_index @keep_item_info_window.set_item_index(@item_window.index) end end #-------------------------------------------------------------------------- # ○ 預けるアイテムの決定 #-------------------------------------------------------------------------- def entrust_item_decision @item_window.active = false @keep_item_info_window.active = true @keep_item_info_window.refresh end #-------------------------------------------------------------------------- # ○ 預ける最終確認の更新 #-------------------------------------------------------------------------- def update_item_kept if Input.trigger?(Input::B) Sound.play_cancel @item_window.active = true @keep_item_info_window.active = false @keep_item_info_window.refresh elsif Input.trigger?(Input::C) if @actor.is_a?(Game_Actor) and @actor.equipping?(@item_window.index) Sound.play_decision @window_easy_choices = Window_Easy_Choices.new(EQUIP_ENTRUST_CHOICES, nil, 196) @window_easy_choices.index = 1 @item_window.active = false else Sound.play_pass entrust_item_last_decision end end end #-------------------------------------------------------------------------- # ○ アイテム装備時でも預けるかの選択の更新 #-------------------------------------------------------------------------- def update_equipping_entrust_permission if Input.trigger?(Input::B) Sound.play_cancel start_entrust_item_selection window_easy_choices_dispose elsif Input.trigger?(Input::C) case @window_easy_choices.index when 0 Sound.play_equip window_easy_choices_dispose entrust_item_last_decision when 1 Sound.play_cancel start_entrust_item_selection window_easy_choices_dispose end end end #-------------------------------------------------------------------------- # ○ 預けるアイテムの最終決定 #-------------------------------------------------------------------------- def entrust_item_last_decision Sound.play_pass $game_party.change_keep_item_value(@item_window.item, 1) @keep_item_info_window.active = false @keep_item_info_window.refresh @actor.remove_item_index(@item_window.index, true) @item_window.refresh @pass_window.refresh @item_window.active = false @keep_item_info_window.set_item_index(@item_window.index) start_entrust_item_selection end #-------------------------------------------------------------------------- # ○ 受け取るアイテム選択の開始 #-------------------------------------------------------------------------- def start_keep_item_selection @command_window.active = false @pass_window.increase = true @pass_window.refresh @pass_window.x = @pass_window_right_x @pass_window.y = @pass_window_right_y @pass_window.visible = true @pass_window.active = false @pass_window.index = @actor_index @keep_item_category_window.active = true @keep_item_category_window.visible = true @keep_item_window.refresh @keep_item_window.visible = true @keep_item_window.active = true end #-------------------------------------------------------------------------- # ○ 受け取るアイテム選択の更新 #-------------------------------------------------------------------------- def update_keep_item_selection if Input.trigger?(Input::A) and Actor_Item::USE_ITEM_ANALYZE Sound.play_cursor @analyze = @analyze ? false : true elsif Input.trigger?(Input::B) Sound.play_cancel start_command_selection elsif Input.trigger?(Input::C) if @keep_item_window.item != nil start_addressee_actor_selection Sound.play_decision else Sound.play_buzzer end elsif Input.trigger?(Input::R) unless @pass_window.index == -1 next_actor @pass_window.index = @actor_index end elsif Input.trigger?(Input::L) unless @pass_window.index == -1 prev_actor @pass_window.index = @actor_index end elsif @keep_item_window.category != @keep_item_category_window.index @keep_item_window.refresh @keep_item_window.index = 0 end end #-------------------------------------------------------------------------- # ○ 受け取るアクター選択の開始 #-------------------------------------------------------------------------- def start_addressee_actor_selection @keep_item_window.active = false @keep_item_category_window.active = false @pass_window.active = true end #-------------------------------------------------------------------------- # ○ 受け取るアクター選択の更新 #-------------------------------------------------------------------------- def update_addressee_actor_selection if Input.trigger?(Input::A) and Actor_Item::USE_ITEM_ANALYZE Sound.play_cursor @analyze = @analyze ? false : true elsif Input.trigger?(Input::B) Sound.play_cancel start_keep_item_selection elsif Input.trigger?(Input::C) if @actor.carry_room? Sound.play_pass @actor.obtain_item_return(@keep_item_window.item) $game_party.change_keep_item_value(@keep_item_window.item, -1) @pass_window.refresh @keep_item_window.refresh start_keep_item_selection else Sound.play_buzzer end elsif Input.trigger?(Input::R) unless @pass_window.index == -1 next_actor @pass_window.index = @actor_index end elsif Input.trigger?(Input::L) unless @pass_window.index == -1 prev_actor @pass_window.index = @actor_index end elsif @pass_window.index != @actor_index chenge_actor(@pass_window.index) end end end ## クラス・RPG ## #============================================================================== # ■ RPG::BaseItem #============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # ○ 特殊ショップ・取り扱い品タグ #-------------------------------------------------------------------------- def item_tags result = [] for tags in self.note.scan(/^[<<]タグ[::](\S+)[>>]/).flatten tags.split(/[\s,, ]/).each{|tag|result.push(tag)} end return result end #-------------------------------------------------------------------------- # ○ アイテム詳細の効果文の変更文章取得 #-------------------------------------------------------------------------- def analyze_text2 if /^[<<]効果文?[::](\S+)[>>]/ =~ self.note return $1 else return nil end end #-------------------------------------------------------------------------- # ○ アイテム詳細の属性文の変更文章取得 #-------------------------------------------------------------------------- def analyze_text1 if /^[<<]属性文?[::](\S+)[>>]/ =~ self.note return $1 else return nil end end #-------------------------------------------------------------------------- # ○ アイテム使用時の変更文章取得 #-------------------------------------------------------------------------- def message1 if /^[<<]文章変更[::](\S+)[>>]/ =~ self.note return $1 else return nil end end #-------------------------------------------------------------------------- # ○ アイテム使用時の追加文章取得 #-------------------------------------------------------------------------- def message2 if /^[<<]追加文章[::](\S+)[>>]/ =~ self.note return $1 else return nil end end #-------------------------------------------------------------------------- # ○ アイテム消失時の文章取得 #-------------------------------------------------------------------------- def consumable_message if /^[<<]消[失費耗]時?文章[::](\S+)[>>]/ =~ self.note return $1 else return nil end end #-------------------------------------------------------------------------- # ○ 使用限定職業取得 #-------------------------------------------------------------------------- def use_qualification_class array = self.note.scan(/^[<<]使用限定職業[::](\d+)[>>]/).flatten return array.collect{|i|i.to_i} end #-------------------------------------------------------------------------- # ○ レベルによる使用資格取得 #-------------------------------------------------------------------------- def use_qualification_level if /^[<<]使用資格レベル[::](\d+)[>>]/ =~ self.note return $1.to_i else return 0 end end #-------------------------------------------------------------------------- # ○ 使用時に消耗するか? #-------------------------------------------------------------------------- def consumable return true if /^[<<]使用時消[費耗][::>>]/ =~ self.note return @consumable end #-------------------------------------------------------------------------- # ○ アイテム使用時のチャージ消耗する確率の取得 # ※ 習得値分の1の確率で消耗する #-------------------------------------------------------------------------- def consumable_probability if /^[<<]使用時消[費耗][::](\d+)[,,>>]/ =~ self.note return $1.to_i else return 1 end end #-------------------------------------------------------------------------- # ○ アイテム消耗後変化 #-------------------------------------------------------------------------- def consumable_change if /^[<<]消[失費耗][後時]変化[::](\d+)[,,]\s*(\d+)[>>]/ =~ self.note return [$1.to_i, $2.to_i] else return nil end end #-------------------------------------------------------------------------- # ○ チャージ数の取得 #-------------------------------------------------------------------------- def charge if /^[<<]スタック数?[::](\d+)[>>]/ =~ self.note return [$1.to_i, 1].max elsif /^[<<]チャージ数?[::](\d+)[>>]/ =~ self.note return [$1.to_i, 1].max else if consumable return 1 else return nil end end end #-------------------------------------------------------------------------- # ○ チャージ数表示(アイテム名に続けてチャージ数を表示するか?) #-------------------------------------------------------------------------- def display_charge return false if hide_charge return true if /^[<<]チャージ数?表示[>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ チャージを隠す #-------------------------------------------------------------------------- def hide_charge return true if /^[<<]チャージ数?非表示[>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ スタック式チャージアイテムの取得 #-------------------------------------------------------------------------- def stack_item? return true if /^[<<]スタック数?[::]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ スタックドロップタイプの取得 #-------------------------------------------------------------------------- def stack_drop_type return nil unless stack_item? if /^[<<]スタックドロップタイプ[::](\d+)[>>]/ =~ self.note return $1.to_i end return Actor_Item::STACK_ITEM_DROP_TYPE end #-------------------------------------------------------------------------- # ○ チャージによるアイコン変更 #-------------------------------------------------------------------------- def icon_change(charge) return nil if charge == nil datas = self.note.scan(/^[<<]アイコン変[更化][::](\d+)[,,]\s*(\d+)[>>]/) for data in datas.sort{|a, b| b[0] <=> a[0]} index = data[1].to_i if data[0].to_i >= charge end return index end #-------------------------------------------------------------------------- # ○ 同じアイテムか判別 #-------------------------------------------------------------------------- def same_item?(item) return false if @id != item.id case item when RPG::Item ; return true if self.is_a?(RPG::Item) when RPG::Weapon ; return true if self.is_a?(RPG::Weapon) when RPG::Armor ; return true if self.is_a?(RPG::Armor) end return false end #-------------------------------------------------------------------------- # ○ 充填不可 #-------------------------------------------------------------------------- def fill_prohibition return true if /^[<<]充填不可[>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 充填費 #-------------------------------------------------------------------------- def fill_price if /^[<<]充填費[::](\d+)[>>]/ =~ self.note return $1.to_i else return nil end end #-------------------------------------------------------------------------- # ○ アイテム修復時変化 #-------------------------------------------------------------------------- def repair_item_change datas = self.note.scan(/^[<<]修復時変化[::](\d+)[,,]\s*(\d+)[>>]/) unless datas.empty? result = [] for data in datas result.push([data[0].to_i, data[1].to_i]) end return result else return nil end end #-------------------------------------------------------------------------- # ○ 修復可能 #-------------------------------------------------------------------------- def can_repair return true if /^[<<]修復可能[>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 修復不可 #-------------------------------------------------------------------------- def repair_prohibition return true if /^[<<]修復不可[>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 修復費 #-------------------------------------------------------------------------- def repair_price if /^[<<]修復費[::](\d+)[>>]/ =~ self.note return $1.to_i else return nil end end end #============================================================================== # ■ RPG::Item #============================================================================== class RPG::Item < RPG::UsableItem #-------------------------------------------------------------------------- # ○ アイテム分類用コード取得 #-------------------------------------------------------------------------- def sort_code code = 10**11 if Actor_Item::KEEP_ITEM_SORT_KIND # 種別でソート code += (object_type + 1) * (7**10) end code += price if Actor_Item::KEEP_ITEM_SORT_PRICE # 価格でソート return code end #-------------------------------------------------------------------------- # ○ 装備タイプ取得 #-------------------------------------------------------------------------- def equip_type return -1 end #-------------------------------------------------------------------------- # ○ 装備部位取得 #-------------------------------------------------------------------------- def equip_part return equip_type end #-------------------------------------------------------------------------- # ○ 道具タイプ取得 #-------------------------------------------------------------------------- def object_type if /^[<<]道具タイプ[::](\d+)[>>]/ =~ self.note return $1.to_i else return 0 end end #-------------------------------------------------------------------------- # ○ アイテム効果取得 #-------------------------------------------------------------------------- def item_power return 0 end #-------------------------------------------------------------------------- # ○ 貴重品か? #-------------------------------------------------------------------------- def valuables? return true if /^[<<]貴重品[>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 使用時装備解除(戦闘用) #-------------------------------------------------------------------------- def using_remove_equip return false end end #============================================================================== # ■ RPG::Weapon #============================================================================== class RPG::Weapon < RPG::BaseItem #-------------------------------------------------------------------------- # ○ アイテム分類用コード取得 #-------------------------------------------------------------------------- def sort_code code = 10**11 if Actor_Item::KEEP_ITEM_SORT_KIND # 種別でソート code += (equip_type + 1) * (10**10) code += 9**10 if sub_weapon? code += (object_type + 1) * (7**10) end code += price if Actor_Item::KEEP_ITEM_SORT_PRICE # 価格でソート return code end #-------------------------------------------------------------------------- # ○ アイテム詳細の補足文の変更文章取得 #-------------------------------------------------------------------------- def analyze_text3 if /^[<<]補足文?[::](\S+)[>>]/ =~ self.note return $1 else return nil end end #-------------------------------------------------------------------------- # ○ 装備タイプ取得 #-------------------------------------------------------------------------- def equip_type return 0 end #-------------------------------------------------------------------------- # ○ 装備部位取得 #-------------------------------------------------------------------------- def equip_part return equip_type end #-------------------------------------------------------------------------- # ○ 武器タイプ取得 #-------------------------------------------------------------------------- def object_type if sub_weapon? return sub_weapon_type[0] elsif /^[<<]武器タイプ[::](\d+)[>>]/ =~ self.note return $1.to_i else return 0 end end #-------------------------------------------------------------------------- # ○ 要補助武器のテキスト取得 #-------------------------------------------------------------------------- def need_sub_weapon if /^[<<]要補助武器[::](\S+)[>>]/ =~ self.note return $1 else return nil end end #-------------------------------------------------------------------------- # ○ 補助武器か? #-------------------------------------------------------------------------- def sub_weapon? return true if /^[<<]補助武器[::>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 補助武器タイプ取得 #-------------------------------------------------------------------------- def sub_weapon_type result = [] for types in self.note.scan(/^[<<]補助武器[::]([\s\d,,]+)[>>]/).flatten types.split(/[,,]/).each{|type|result.push(type.to_i)} end result = [0] if result.empty? return result.sort end #-------------------------------------------------------------------------- # ○ 二刀流不可か? #-------------------------------------------------------------------------- def no_two_swords return true if need_sub_weapon return true if /^[<<]二刀流不可[>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 武器アニメ優先か? #-------------------------------------------------------------------------- def prior_animation return false unless sub_weapon? return true if /^[<<]武器アニメ優先[>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 使用時にターゲット選択が必要か?(使用時アイテム効果用) #-------------------------------------------------------------------------- def need_selection? if item = $data_items[item_power] return item.need_selection? else return false end end #-------------------------------------------------------------------------- # ○ 効果範囲が敵か否か?(使用時アイテム効果用) #-------------------------------------------------------------------------- def for_opponent? if item = $data_items[item_power] return item.for_opponent? else return false end end #-------------------------------------------------------------------------- # ○ バトル中の装備変更時の速度修正 #-------------------------------------------------------------------------- def speed return Actor_Item::BATTLE_EQUIP_SPEED end #-------------------------------------------------------------------------- # ○ レベルによる装備資格取得 #-------------------------------------------------------------------------- def equip_qualification_level if /^[<<]装備資格レベル[::](\d+)[>>]/ =~ self.note return $1.to_i else return 0 end end #-------------------------------------------------------------------------- # ○ 使用時装備解除(戦闘用) #-------------------------------------------------------------------------- def using_remove_equip return true if /^[<<]使用時装備解除[>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 装備時付加ステート取得 #-------------------------------------------------------------------------- def equip_states array = self.note.scan(/^[<<]装備時?ステート[::](\d+)[>>]/).flatten array.push(curse_states) if curse_states != nil return array.collect{|i|i.to_i} end #-------------------------------------------------------------------------- # ○ 呪いのステート取得#### #-------------------------------------------------------------------------- def curse_states if /^[<<]呪いステート[::]\s*(\d+)[,,>>]/ =~ self.note return $1.to_i else return nil end end #-------------------------------------------------------------------------- # ○ 呪い解除時の装備破損率取得 #-------------------------------------------------------------------------- def curse_equip_break return 0 if $game_temp.curse_equip_break_off if /^[<<]呪いステート[::]\s*\d+[,,]\s*(\d+)[>>]/ =~ self.note return $1.to_i else return 0 end end #-------------------------------------------------------------------------- # ○ アイテム効果取得 #-------------------------------------------------------------------------- def item_power if /^[<<]アイテム効果[::](\d+)[>>]/ =~ self.note return $1.to_i else return 0 end end #-------------------------------------------------------------------------- # ○ チャージ数の取得 #-------------------------------------------------------------------------- def charge if /^[<<]スタック数?[::](\d+)[>>]/ =~ self.note return [$1.to_i, 1].max elsif /^[<<]チャージ数?[::](\d+)[>>]/ =~ self.note return [$1.to_i, 1].max elsif consumable or skill_consumable or hit_consumable or attack_consumable return 1 else return nil end end #-------------------------------------------------------------------------- # ○ 使用時に消耗するか? #-------------------------------------------------------------------------- def consumable return true if /^[<<]使用時消[費耗][::>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 攻撃ヒット時に劣化するか? #-------------------------------------------------------------------------- def hit_consumable return true if /^[<<]劣化[::>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 攻撃ヒット時の劣化率の取得 #-------------------------------------------------------------------------- def hit_consumable_probability if /^[<<]劣化[::](\d+)[>>]/ =~ self.note return $1.to_i else return 1 end end #-------------------------------------------------------------------------- # ○ 攻撃時に消耗するか? #-------------------------------------------------------------------------- def attack_consumable return true if /^[<<]攻撃時消[費耗][>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ 装備の間だけ覚えるスキル取得 #-------------------------------------------------------------------------- def equip_skills array = self.note.scan(/^[<<]装備スキル[::](\d+)[,,>>]/).flatten return array.collect{|i|i.to_i} end #-------------------------------------------------------------------------- # ○ 装備スキル使用時に消耗するか? #-------------------------------------------------------------------------- def skill_consumable(skill_id = nil) if skill_id == nil return /^[<<]装備スキル[::]\d+[,,]\s*\d+[>>]/ =~ self.note end return skill_consumable_probability(skill_id) != nil end #-------------------------------------------------------------------------- # ○ 装備スキル使用時の消耗率の取得 #-------------------------------------------------------------------------- def skill_consumable_probability(skill_id) if /^[<<]装備スキル[::]#{skill_id}[,,]\s*(\d+)[>>]/ =~ self.note return $1.to_i else return nil end end end #============================================================================== # ■ RPG::Armor #============================================================================== class RPG::Armor < RPG::BaseItem #-------------------------------------------------------------------------- # ○ アイテム分類用コード取得 #-------------------------------------------------------------------------- def sort_code code = 10**11 if Actor_Item::KEEP_ITEM_SORT_KIND # 種別でソート code += (equip_type + 1) * (10**10) code += (object_type + 1) * (7**10) end code += price if Actor_Item::KEEP_ITEM_SORT_PRICE # 価格でソート return code end #-------------------------------------------------------------------------- # ○ アイテム詳細の補足文の変更文章取得 #-------------------------------------------------------------------------- def analyze_text3 if /^[<<]補足文?[::](\S+)[>>]/ =~ self.note return $1 else return nil end end #-------------------------------------------------------------------------- # ○ 装備タイプ取得 #-------------------------------------------------------------------------- def equip_type if /^[<<]追加部位[>>]/ =~ self.note return 5 elsif /^[<<]追加部位[::](\d+)[>>]/ =~ self.note return [$1.to_i, 1].max + 4 else return @kind + 1 end end #-------------------------------------------------------------------------- # ○ 装備部位取得 #-------------------------------------------------------------------------- def equip_part return equip_type + 1 end #-------------------------------------------------------------------------- # ○ 防具タイプ取得 #-------------------------------------------------------------------------- def object_type if /^[<<]防具タイプ[::](\d+)[>>]/ =~ self.note return $1.to_i else return 0 end end #-------------------------------------------------------------------------- # ○ 補助武器か? #-------------------------------------------------------------------------- def sub_weapon? return false end #-------------------------------------------------------------------------- # ○ 使用時にターゲット選択が必要か?(使用時アイテム効果用) #-------------------------------------------------------------------------- def need_selection? if item = $data_items[item_power] return item.need_selection? else return false end end #-------------------------------------------------------------------------- # ○ 効果範囲が敵か否か?(使用時アイテム効果用) #-------------------------------------------------------------------------- def for_opponent? if item = $data_items[item_power] return item.for_opponent? else return false end end #-------------------------------------------------------------------------- # ○ バトル中の装備変更時の速度修正 #-------------------------------------------------------------------------- def speed return Actor_Item::BATTLE_EQUIP_SPEED end #-------------------------------------------------------------------------- # ○ レベルによる装備資格取得 #-------------------------------------------------------------------------- def equip_qualification_level if /^[<<]装備資格レベル[::](\d+)[>>]/ =~ self.note return $1.to_i else return 0 end end #-------------------------------------------------------------------------- # ○ 使用時装備解除(戦闘用) #-------------------------------------------------------------------------- def using_remove_equip return true if /^[<<]使用時装備解除[>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ アイテム効果取得 #-------------------------------------------------------------------------- def item_power if /^[<<]アイテム効果[::](\d+)[>>]/ =~ self.note return $1.to_i else return 0 end end #-------------------------------------------------------------------------- # ○ 装備時付加ステート取得 #-------------------------------------------------------------------------- def equip_states array = self.note.scan(/^[<<]装備時?ステート[::](\d+)[>>]/).flatten array.push(curse_states) if curse_states != nil return array.collect{|i|i.to_i} end #-------------------------------------------------------------------------- # ○ 呪いのステート取得 #-------------------------------------------------------------------------- def curse_states if /^[<<]呪いステート[::]\s*(\d+)[,,>>]/ =~ self.note return $1.to_i else return nil end end #-------------------------------------------------------------------------- # ○ 呪い解除時の装備破損率取得 #-------------------------------------------------------------------------- def curse_equip_break return 0 if $game_temp.curse_equip_break_off if /^[<<]呪いステート[::]\s*\d+[,,]\s*(\d+)[>>]/ =~ self.note return $1.to_i else return 0 end end #-------------------------------------------------------------------------- # ○ チャージ数の取得 #-------------------------------------------------------------------------- def charge if /^[<<]スタック数?[::](\d+)[>>]/ =~ self.note return [$1.to_i, 1].max elsif /^[<<]チャージ数?[::](\d+)[>>]/ =~ self.note return [$1.to_i, 1].max elsif consumable or skill_consumable or damage_consumable return 1 else return nil end end #-------------------------------------------------------------------------- # ○ 使用時に消耗するか? #-------------------------------------------------------------------------- def consumable return true if /^[<<]使用時消[費耗][::>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ダメージ時に劣化するか? #-------------------------------------------------------------------------- def damage_consumable return true if /^[<<]劣化[::>>]/ =~ self.note return false end #-------------------------------------------------------------------------- # ○ ダメージ時の劣化率の取得 #-------------------------------------------------------------------------- def damage_consumable_probability if /^[<<]劣化[::](\d+)[>>]/ =~ self.note return $1.to_i else return 1 end end #-------------------------------------------------------------------------- # ○ 装備の間だけ覚えるスキル取得 #-------------------------------------------------------------------------- def equip_skills array = self.note.scan(/^[<<]装備スキル[::](\d+)[,,>>]/).flatten return array.collect{|i|i.to_i} end #-------------------------------------------------------------------------- # ○ 装備スキル使用時に消耗するか? #-------------------------------------------------------------------------- def skill_consumable(skill_id = nil) if skill_id == nil return /^[<<]装備スキル[::]\d+[,,]\s*\d+[>>]/ =~ self.note end return skill_consumable_probability(skill_id) != nil end #-------------------------------------------------------------------------- # ○ 装備スキル使用時の消耗率の取得 #-------------------------------------------------------------------------- def skill_consumable_probability(skill_id) if /^[<<]装備スキル[::]#{skill_id}[,,]\s*(\d+)[>>]/ =~ self.note return $1.to_i else return nil end end end #============================================================================== # ■ Game_Interpreter #------------------------------------------------------------------------------ #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、 # Game_Troop クラス、Game_Event クラスの内部で使用されます。 #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ◎ クリア #-------------------------------------------------------------------------- alias tig_ais_clear clear def clear tig_ais_clear $game_temp.ex_shop_handling_tags = [] # 取り扱い品タグリスト初期化 end #-------------------------------------------------------------------------- # ◎ イベントの終了 #-------------------------------------------------------------------------- alias tig_ais_command_end command_end def command_end tig_ais_command_end $game_temp.curse_equip_break_off = false # 呪い解除による装備破壊フラグ初期化 end #-------------------------------------------------------------------------- # ○ 預かり所の呼び出し #-------------------------------------------------------------------------- def call_item_keeper $game_temp.next_scene = "keeper" end #-------------------------------------------------------------------------- # ● アイテムの増減 #-------------------------------------------------------------------------- # ※ アイテムがスタックアイテムだった場合の入手処理分岐追加。 #-------------------------------------------------------------------------- def command_126 value = operate_value(@params[1], @params[2], @params[3]) if Actor_Item::STACK_ITEM_FRACTION_GAIN # 追加部分 $game_party.gain_stack_item($data_items[@params[0]], value) # 追加部分 else # 追加部分 $game_party.gain_item($data_items[@params[0]], value) end # 追加部分 $game_map.need_refresh = true return true end #-------------------------------------------------------------------------- # ● 武器の増減 #-------------------------------------------------------------------------- # ※ アイテムがスタックアイテムだった場合の入手処理分岐追加。 #-------------------------------------------------------------------------- def command_127 value = operate_value(@params[1], @params[2], @params[3]) if Actor_Item::STACK_ITEM_FRACTION_GAIN # 追加部分 $game_party.gain_stack_item($data_weapons[@params[0]], value, @params[4]) # 追加部分 else # 追加部分 $game_party.gain_item($data_weapons[@params[0]], value, @params[4]) end # 追加部分 return true end #-------------------------------------------------------------------------- # ● 防具の増減 #-------------------------------------------------------------------------- # ※ アイテムがスタックアイテムだった場合の入手処理分岐追加。 #-------------------------------------------------------------------------- def command_128 value = operate_value(@params[1], @params[2], @params[3]) if Actor_Item::STACK_ITEM_FRACTION_GAIN # 追加部分 $game_party.gain_stack_item($data_armors[@params[0]], value, @params[4]) # 追加部分 else # 追加部分 $game_party.gain_item($data_armors[@params[0]], value, @params[4]) end # 追加部分 return true end #-------------------------------------------------------------------------- # ● 装備の変更 #-------------------------------------------------------------------------- # ※ アクター自身が指定品を所持していない場合、 # パーティー内から該当アイテムを探し出し、 # 受け取り後に装備するような動作をします。 # (アイテム所持数に余裕がない場合などは失敗します。) #-------------------------------------------------------------------------- def command_319 actor = $game_actors[@params[0]] if actor != nil actor.change_equip_by_id(@params[1], @params[2]) kind = (@params[1] == 0 or (@params[1] == 1 and actor.two_swords_style)) ? 1 : 2 item = things(kind, @params[2]) if item != nil if not actor.same_item_equipping?(item) and actor.equipable_item?(item) if actor.equip_item_index(@params[1]) != nil or actor.carry_room? address = $game_party.item_number(item, false) for member in $game_party.members next if member.id == @params[0] next if not actor.carry_room? and not member.carry_room? for index in member.carry_item_hold_address(item) next unless member.item_can_pass?(index) if not actor.carry_room? and actor.equip_item_index(@params[1]) != nil actor.item_trading(actor.equip_item_index(@params[1]), member) end member.item_trading(index, actor) actor.change_equip_by_id(@params[1], @params[2]) return true end end return true if not actor.carry_room? and not member.carry_room? for index in $game_party.carry_item_hold_address(item) if not actor.carry_room? and actor.equip_item_index(@params[1]) != nil actor.item_trading(actor.equip_item_index(@params[1]), $game_party) end $game_party.item_trading(index, actor) actor.change_equip_by_id(@params[1], @params[2]) return true end end end end end return true end #-------------------------------------------------------------------------- # ◎ ショップの処理 #-------------------------------------------------------------------------- alias tig_ais_command_302 command_302 def command_302 $game_temp.ex_shop = {} tig_ais_command_302 end #-------------------------------------------------------------------------- # ○ 特殊ショップリスト作成 #-------------------------------------------------------------------------- def make_ex_shop_list(text) $game_temp.ex_shop = {} $game_temp.ex_shop["売却"] = true if /売却/ =~ text $game_temp.ex_shop["充填"] = true if /充填/ =~ text $game_temp.ex_shop["修復"] = true if /修復/ =~ text end #-------------------------------------------------------------------------- # ○ 特殊ショップ・取り扱い品タグリスト作成 #-------------------------------------------------------------------------- def make_ex_shop_handling_tags_list(text) $game_temp.ex_shop_handling_tags = text.split(/[\s,, ]/) $game_temp.ex_shop_handling_tags.delete("") end #-------------------------------------------------------------------------- # ◎ イベントコマンドの実行 # ※ 注釈使用オプション取得と特殊ショップコマンドの実行処理の割り込み #-------------------------------------------------------------------------- alias tig_ais_execute_command execute_command def execute_command if @index >= @list.size-1 command_end return true else if @list[@index].code == 108 $game_temp.ex_shop = {} # 特殊ショップは注釈毎に初期化 annotation_option_ais(@list[@index].parameters[0]) while @list[@index+1].code == 408 @index += 1 annotation_option_ais(@list[@index].parameters[0]) end ex_shop_setup if $game_temp.ex_shop != {} return true end end return tig_ais_execute_command end #-------------------------------------------------------------------------- # ○ 注釈使用オプション #-------------------------------------------------------------------------- def annotation_option_ais(text) if /\A特殊ショップ[::]/ =~ text make_ex_shop_list($') elsif /\A特殊ショップ初期化/ =~ text $game_temp.ex_shop = {} elsif /\Aショップタグ[::]/ =~ text make_ex_shop_handling_tags_list($') elsif /\Aショップタグ初期化/ =~ text $game_temp.ex_shop_handling_tags = [] end end #-------------------------------------------------------------------------- # ○ 特殊ショップの処理 #-------------------------------------------------------------------------- def ex_shop_setup $game_temp.next_scene = "shop" $game_temp.shop_goods = [] $game_temp.shop_purchase_only = true if @list[@index+1].code == 302 # 次行が通常ショップの処理場合 @index += 1 $game_temp.shop_goods.push(@list[@index].parameters) $game_temp.shop_purchase_only = @list[@index].parameters[2] loop do if @list[@index+1].code == 605 # ショップ 2 行目以降 @index += 1 $game_temp.shop_goods.push(@list[@index].parameters) else return end end end end #-------------------------------------------------------------------------- # ○ 所持品オブジェクト取得 # kind : 所持品の種別 # id : 所持品のID #-------------------------------------------------------------------------- def things(kind, id) case kind when 0 ; return $data_items[id] when 1 ; return $data_weapons[id] when 2 ; return $data_armors[id] end end #-------------------------------------------------------------------------- # ○ アクターを指定して所持品を入手させる # actor_id : アクターID # kind : 所持品の種別 # id : 所持品のID # tags : 特殊状態でのアイテム入手用・情報タグ(省略可) #-------------------------------------------------------------------------- def actor_gain_item(actor_id, kind, id, tags = []) actor = $game_actors[actor_id] item = things(kind, id) tags = [tags] unless tags.is_a?(Array) return actor.obtain_item(item, false, tags) end #-------------------------------------------------------------------------- # ○ アクターを指定して所持品を減少させる # actor_id : アクターID # kind : 所持品の種別 # id : 所持品のID # include_equip : 装備品も含めるか(省略可、省略時含めない) #-------------------------------------------------------------------------- def actor_lose_item(actor_id, kind, id, include_equip = false) actor = $game_actors[actor_id] item = things(kind, id) return actor.remove_item(item, include_equip) end #-------------------------------------------------------------------------- # ○ 特別な状態の所持品を入手する(パーティー) # kind : 所持品の種別 # id : 所持品のID # tags : 特殊状態でのアイテム入手用・情報タグ # number : 個数(省略可、省略時1個) #-------------------------------------------------------------------------- def party_gain_ex_item(kind, id, tags, number = 1) item = things(kind, id) tags = [tags] unless tags.is_a?(Array) $game_party.gain_item(item, number, false, tags) end #-------------------------------------------------------------------------- # ○ アクターを指定して所持品を装備させる # ※ 装備命令のみ行います。アクター自身が指定品を所持していないと # 失敗に終わる点が通常の装備変更コマンドと違います。 # actor_id : アクターID # kind : 所持品の種別 # id : 所持品のID #-------------------------------------------------------------------------- def actor_equip_change(actor_id, kind, id) actor = $game_actors[actor_id] item = things(kind, id) return actor.change_equip(item.equip_type, item) end #-------------------------------------------------------------------------- # ○ アクターの部位を指定して装備を破棄させる # actor_id : アクターID # equip_type : 装備部位 #-------------------------------------------------------------------------- def actor_equip_discard(actor_id, equip_type) actor = $game_actors[actor_id] index = actor.equip_item_index(equip_type) return true if index == nil return actor.remove_item_index(index, true) end #-------------------------------------------------------------------------- # ○ アクターの所持品を他のパーティー内のアクターに振り分ける # actor_id : アクターID # include_equip : 装備品も含めるか(省略可、省略時含めない) #-------------------------------------------------------------------------- def actor_items_distributes(actor_id, include_equip = false) actor = $game_actors[actor_id] return actor.item_distributes(include_equip) end #-------------------------------------------------------------------------- # ○ アイテムを他のパーティーメンバーに振り分けることが出来るかのテスト # actor_id : アクターID # include_equip : 装備品も含めるか(省略可、省略時含めない) #-------------------------------------------------------------------------- def actor_items_distributes_test(actor_id, include_equip = false) actor = $game_actors[actor_id] party_room = 0 for other_actor in $game_party.members next if other_actor == actor party_room += other_actor.carry_room_number end item_size = 0 actor.carry_items_data.size.times do |index| next if include_equip and actor.equipping?(index) item_size += 1 end return party_room >= item_size end #-------------------------------------------------------------------------- # ○ アクターのアイテムを預かり所に送る # actor_id : アクターID # include_equip : 装備品も含めるか(省略可、省略時含めない) #-------------------------------------------------------------------------- def actor_items_entrusts(actor_id, include_equip = false) actor = $game_actors[actor_id] (actor.carry_items.size - 1).downto(0) do |index| next unless actor.can_entrust_index?(index) unless include_equip next if actor.equipping?(index) end $game_party.change_keep_item_value(actor.carry_item(index), 1) actor.remove_item_index(index, true) end end #-------------------------------------------------------------------------- # ○ アクターの所持品・装備を別アクターにコピーする # actor_id : コピー元のアクターID # other_actor_id : コピー先のアクターID #-------------------------------------------------------------------------- def actor_items_copy(actor_id, other_actor_id) actor = $game_actors[actor_id] other_actor = $game_actors[other_actor_id] actor_items_clear(other_actor_id, true) for index in 0...actor.carry_items_data.size actor.item_move_other(index, other_actor, true) end end #-------------------------------------------------------------------------- # ○ アクターのアイテムをすべて破棄する # actor_id : アクターID # include_equip : 装備品も含めるか(省略可、省略時含めない) #-------------------------------------------------------------------------- def actor_items_clear(actor_id, include_equip = false) actor = $game_actors[actor_id] actor.carry_items_data.reverse! (actor.carry_items_data.size - 1).downto(0) do |index| next if not include_equip and actor.equipping?(index) actor.carry_items_data.delete_at(index) end actor.carry_items_data.reverse! end #-------------------------------------------------------------------------- # ○ 呪い解除による装備破壊オフ #-------------------------------------------------------------------------- def curse_equip_break_off $game_temp.curse_equip_break_off = true end #-------------------------------------------------------------------------- # ○ 呪い解除による装備破壊オン #-------------------------------------------------------------------------- def curse_equip_break_on $game_temp.curse_equip_break_off = false end end