# # 銃システム #  (C)2007 TYPE74RX-T # #============================================================================== # ★ 再定義ポイント #------------------------------------------------------------------------------ # class Window_MenuStatus # def refresh # class Window_Skill # def draw_item # class Window_Target # def refresh # class Window_BattleStatus # def refresh # class Scene_Item # def update_target # class Scene_Equip # def update_item # class Scene_Battle # def update_phase3_skill_select # def make_basic_action_result # def make_skill_action_result # class Scene_Shop # def update_buy #============================================================================== module RPG class Weapon alias rx_rgsss19_initialize initialize def initialize # メソッドを呼び戻す rx_rgsss19_initialize # 使用に必要な弾のアイテムIDと装弾できる弾数 # 通常攻撃した時の消費弾数を新たなパラメータとして設定 @rx_bullet_id = 0 @rx_max_bullets = 0 @rx_bullet_cost = 0 end #-------------------------------------------------------------------------- # ★ 特殊設定用文字列を取り除いた説明文を取得 #-------------------------------------------------------------------------- def description new_description = @description.split(/[\s\-]+/) return new_description[0] end #-------------------------------------------------------------------------- # ★ 必要な弾のアイテムID #-------------------------------------------------------------------------- def rx_bullet_id @rx_bullet_id = rx_get_bullet_id return @rx_bullet_id end #-------------------------------------------------------------------------- # ★ 弾数 #-------------------------------------------------------------------------- def rx_max_bullets @rx_max_bullets = rx_get_max_bullets return @rx_max_bullets end #-------------------------------------------------------------------------- # ★ 消費弾数 #-------------------------------------------------------------------------- def rx_bullet_cost @rx_bullet_cost = rx_get_bullet_cost return @rx_bullet_cost end #-------------------------------------------------------------------------- # ★ 銃系武器であるか #-------------------------------------------------------------------------- def rx_gun? return @description.include?("弾数") ? true : false end #-------------------------------------------------------------------------- # ★ オートリロード形式であるか #-------------------------------------------------------------------------- def rx_auto_reload? return @description.include?("自動装填") ? true : false end #-------------------------------------------------------------------------- # ★ 必要な弾のアイテムIDの取得 #-------------------------------------------------------------------------- def rx_get_bullet_id if @description.include?("弾ID") # 最後に「弾ID」と書かれた場所以降の文字列を取得 description_loc = @description.rindex("弾ID") # 文字位置取得 new_description = @description[description_loc, @description.length - 1] # 文字列取得 # 数字文字列を取得 param = new_description.scan(/\d+/) rx_bullet_id = param[0].to_i else rx_bullet_id = 0 end return rx_bullet_id end #-------------------------------------------------------------------------- # ★ 弾数の取得 #-------------------------------------------------------------------------- def rx_get_max_bullets if @description.include?("弾数") # 最後に「弾数」と書かれた場所以降の文字列を取得 description_loc = @description.rindex("弾数") # 文字位置取得 new_description = @description[description_loc, @description.length - 1] # 文字列取得 # 数字文字列を取得 param = new_description.scan(/\d+/) rx_max_bullets = param[0].to_i else rx_max_bullets = 0 end return rx_max_bullets end #-------------------------------------------------------------------------- # ★ 消費弾数の取得 #-------------------------------------------------------------------------- def rx_get_bullet_cost if @description.include?("弾消費数") # 最後に「弾消費数」と書かれた場所以降の文字列を取得 description_loc = @description.rindex("弾消費数") # 文字位置取得 new_description = @description[description_loc, @description.length - 1] # 文字列取得 # 数字文字列を取得 param = new_description.scan(/\d+/) rx_bullet_cost = param[0].to_i else rx_bullet_cost = 0 end return rx_bullet_cost end end class Skill alias rx_rgsss19_initialize initialize def initialize # メソッドを呼び戻す rx_rgsss19_initialize # 消費弾数を新たなパラメータとして設定 @rx_bullet_cost = 0 end #-------------------------------------------------------------------------- # ★ 特殊設定用文字列を取り除いた名前を取得 #-------------------------------------------------------------------------- def name new_name = @name.split(/[\s\-]+/) return new_name[0] end #-------------------------------------------------------------------------- # ★ 消費弾数 #-------------------------------------------------------------------------- def rx_bullet_cost @rx_bullet_cost = rx_get_bullet_cost return @rx_bullet_cost end #-------------------------------------------------------------------------- # ★ 消費弾数の取得 #-------------------------------------------------------------------------- def rx_get_bullet_cost if @name.include?("弾消費数") # 最後に「弾消費数」と書かれた場所以降の文字列を取得 name_loc = @name.rindex("弾消費数") # 文字位置取得 new_name = @name[name_loc, @name.length - 1] # 文字列取得 # 数字文字列を取得 param = new_name.scan(/\d+/) rx_bullet_cost = param[0].to_i else rx_bullet_cost = 0 end return rx_bullet_cost end end class Item alias rx_rgsss19_initialize initialize def initialize # メソッドを呼び戻す rx_rgsss19_initialize # 銃弾か否かのフラグを新たなパラメータとして設定 @rx_bullets = false end #-------------------------------------------------------------------------- # ★ 特殊設定用文字列を取り除いた名前を取得 #-------------------------------------------------------------------------- def name new_name = @name.split(/[\s\-]+/) return new_name[0] end #-------------------------------------------------------------------------- # ★ 銃弾判定 #-------------------------------------------------------------------------- def rx_bullets return @name.include?("") ? true : false end end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ # スのスーパークラスとして使用されます。 #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias rx_rgsss19_initialize initialize def initialize # メソッドを呼び戻す rx_rgsss19_initialize # 弾数と最大弾数を新たなパラメータとして設定 @rx_bullets = 0 @rx_max_bullets = 0 end #-------------------------------------------------------------------------- # ★ BP(弾数)を取得(アクターのみ) #-------------------------------------------------------------------------- def rx_bullets # 経験値リストが nil でないなら(=アクターバトラーなら) if @exp_list != nil return @rx_bullets end return nil end #-------------------------------------------------------------------------- # ★ 銃を装備しているか(アクターのみ) #-------------------------------------------------------------------------- def rx_equip_gun? if @weapon_id == nil return false end return @weapon_id > 0 ? $data_weapons[@weapon_id].rx_gun? : false end #-------------------------------------------------------------------------- # ★ MaxBP の取得 #-------------------------------------------------------------------------- def rx_max_bullets if @weapon_id == 0 return 0 end if $data_weapons[@weapon_id].rx_max_bullets != nil or $data_weapons[@weapon_id].rx_max_bullets <= 0 return $data_weapons[@weapon_id].rx_max_bullets else return 0 end end #-------------------------------------------------------------------------- # ★ BP(弾数)の変更 #-------------------------------------------------------------------------- def rx_bullets=(bullets) @rx_bullets = [[bullets, rx_max_bullets].min, 0].max end #-------------------------------------------------------------------------- # ● アイテムの効果適用 # item : アイテム #-------------------------------------------------------------------------- alias rx_rgsss19_item_effect item_effect def item_effect(item) # ★ 銃弾アイテムであるか if item.rx_bullets # 次の条件を満たしていなければ # 1.武器を装備している # 2.銃を装備している(装弾可能な数が1以上) # 3.使用アイテムに対応した武器を装備している unless self.weapon_id > 0 and $data_weapons[self.weapon_id].rx_max_bullets > 0 and item.id == $data_weapons[self.weapon_id].rx_bullet_id return false end # 弾が充分に装填されている場合 if self.rx_bullets == $data_weapons[self.weapon_id].rx_max_bullets return false end # 装填できる弾数を取得 rx_get_bullets = $data_weapons[self.weapon_id].rx_max_bullets - self.rx_bullets # 銃弾をセット self.set_rx_bullets_from_item(rx_get_bullets) return true end # メソッドを呼び戻す rx_rgsss19_item_effect(item) end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors) # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ★ 銃弾をセット(装備時) #-------------------------------------------------------------------------- def set_rx_bullets if @weapon_id == nil or @weapon_id < 1 return end if $data_weapons[@weapon_id].rx_bullet_id > 0 # 装備している銃に対応した弾を取得 get_bullets = $game_party.item_number($data_weapons[@weapon_id].rx_bullet_id) if get_bullets > 0 if $data_weapons[@weapon_id].rx_max_bullets > get_bullets @rx_bullets = get_bullets $game_party.lose_item($data_weapons[@weapon_id].rx_bullet_id, get_bullets) else @rx_bullets = $data_weapons[@weapon_id].rx_max_bullets $game_party.lose_item($data_weapons[@weapon_id].rx_bullet_id, $data_weapons[@weapon_id].rx_max_bullets) end end end end #-------------------------------------------------------------------------- # ★ 銃弾をセット(アイテム使用&リロード時) #-------------------------------------------------------------------------- def set_rx_bullets_from_item(set_bullets) if @weapon_id == nil or @weapon_id < 1 or set_bullets < 1 return end if $data_weapons[@weapon_id].rx_bullet_id > 0 # 装備している銃に対応した弾を取得 get_bullets = $game_party.item_number($data_weapons[@weapon_id].rx_bullet_id) if get_bullets > 0 if set_bullets > get_bullets @rx_bullets += get_bullets $game_party.lose_item($data_weapons[@weapon_id].rx_bullet_id, get_bullets) else @rx_bullets += set_bullets $game_party.lose_item($data_weapons[@weapon_id].rx_bullet_id, set_bullets) end end end end #-------------------------------------------------------------------------- # ★ 装備している銃に対応した弾を外す #-------------------------------------------------------------------------- def rebirth_rx_bullets if @weapon_id == nil or @weapon_id < 1 return end if $data_weapons[@weapon_id].rx_bullet_id > 0 # 装弾していた弾の分だけアイテムを増やす $game_party.gain_item($data_weapons[@weapon_id].rx_bullet_id, @rx_bullets) # 装弾数を 0 に @rx_bullets = 0 end end #-------------------------------------------------------------------------- # ★ 銃で攻撃できるか判定(弾数が足りなければ行動不可能) #-------------------------------------------------------------------------- def rx_g_act_judge(cost, bullets) if bullets >= cost return true else # オートリロード形式の銃なら if $data_weapons[@weapon_id].rx_auto_reload? # 装填できる弾数を取得 rx_get_bullets = $data_weapons[@weapon_id].rx_max_bullets - @rx_bullets # 弾を装填 set_rx_bullets_from_item(rx_get_bullets) # スキル使用に掛かるコスト以上の弾を持っていれば if @rx_bullets >= cost return true else return false end else return false end end end #-------------------------------------------------------------------------- # ★ 銃スキルを選択できるか判定(弾数が足りなければ選択不可能) #-------------------------------------------------------------------------- def rx_g_sel_judge(cost, bullets) if bullets >= cost return true else # オートリロード形式の銃なら if $data_weapons[@weapon_id].rx_auto_reload? # 装備している銃に対応した弾の弾数を取得 bullets_plus = $game_party.item_number($data_weapons[@weapon_id].rx_bullet_id) # 装弾数とストックを仮に合計させる bullets += bullets_plus if bullets >= cost return true else return false end else return false end end end end #============================================================================== # ■ Game_Party #------------------------------------------------------------------------------ #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク # ラスのインスタンスは $game_party で参照されます。 #============================================================================== class Game_Party #-------------------------------------------------------------------------- # ● アイテムの増加 (減少) # item_id : アイテム ID # n : 個数 #-------------------------------------------------------------------------- alias rx_rgsss19_gain_item gain_item def gain_item(item_id, n) # ★ ハッシュの個数データを更新(銃弾アイテムの時) if item_id > 0 and $data_items[item_id].rx_bullets @items[item_id] = [[item_number(item_id) + n, 0].max, 999].min return end # メソッドを呼び戻す rx_rgsss19_gain_item(item_id, n) end end #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ #  ゲーム中のすべてのウィンドウのスーパークラスです。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ★ BP の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 描画先の幅 #-------------------------------------------------------------------------- def draw_actor_rx_bullets(actor, x, y, width = 144) reload = false # 文字列 "SP" を描画 self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, "BP") # MaxSP を描画するスペースがあるか計算 if width - 32 >= 108 bp_x = x + width - 108 flag = true elsif width - 32 >= 48 bp_x = x + width - 48 flag = false end # 銃を使用するのに弾数が足りない場合(オートリロード形式のものを除く) if actor.rx_equip_gun? and actor.rx_bullets < $data_weapons[actor.weapon_id].rx_bullet_cost and not $data_weapons[actor.weapon_id].rx_auto_reload? flag = false # リロードを促す画像データを取得 reload = RPG::Cache.picture("reload.png") # 「Reload」を表示。戦闘中であるか否かで座標を変える if $scene.kind_of?(Scene_Battle) self.contents.blt(bp_x - 20, y + 10, reload, Rect.new(0, 0, 68, 14)) else self.contents.blt(bp_x + 20, y + 10, reload, Rect.new(0, 0, 68, 14)) end # リロードフラグを立てる reload = true end # BP を描画(リロードの必要が無ければ) unless reload self.contents.font.color = actor.rx_bullets == 0 ? knockout_color : normal_color # 銃を装備していなければ unless actor.rx_equip_gun? bp_x = x + width - 48 flag = false self.contents.font.color = normal_color # 「----」を表示。戦闘中であるか否かで座標を変える if $scene.kind_of?(Scene_Battle) self.contents.draw_text(bp_x, y, 48, 32, "----", 2) else self.contents.draw_text(bp_x - 28, y, 48, 32, "----") end else self.contents.draw_text(bp_x, y, 48, 32, actor.rx_bullets.to_s, 2) end end # MaxBP を描画 if flag self.contents.font.color = normal_color self.contents.draw_text(bp_x + 48, y, 12, 32, "/", 1) self.contents.draw_text(bp_x + 60, y, 48, 32, actor.rx_max_bullets.to_s) end end end #============================================================================== # ■ Window_Command #------------------------------------------------------------------------------ #  一般的なコマンド選択を行うウィンドウです。 #============================================================================== class Window_Command < Window_Selectable #-------------------------------------------------------------------------- # ★ ウインドウコマンドの変更 #-------------------------------------------------------------------------- def commands=(commands) @commands = commands refresh end end #============================================================================== # ■ Window_MenuStatus #------------------------------------------------------------------------------ #  メニュー画面でパーティメンバーのステータスを表示するウィンドウです。 #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size x = 64 y = i * 116 actor = $game_party.actors[i] draw_actor_graphic(actor, x - 40, y + 80) draw_actor_name(actor, x, y) draw_actor_class(actor, x + 144, y) draw_actor_level(actor, x, y + 32) draw_actor_state(actor, x + 90, y + 32) draw_actor_exp(actor, x, y + 64) #++++++++++++++++++++++++++++++★改造事項++++++++++++++++++++++++++++++ draw_actor_hp(actor, x + 236, y + 24) draw_actor_sp(actor, x + 236, y + 44) draw_actor_rx_bullets(actor, x + 236, y + 64) #++++++++++++++++++++++++++++★改造ここまで++++++++++++++++++++++++++++ end end end #============================================================================== # ■ Window_Skill #------------------------------------------------------------------------------ #  スキル画面、バトル画面で、使用できるスキルの一覧を表示するウィンドウです。 #============================================================================== class Window_Skill < Window_Selectable #-------------------------------------------------------------------------- # ● 項目の描画(銃を装備しているバトラーの場合) # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) skill = @data[index] #++++++++++++++++++++++++++++++★改造事項++++++++++++++++++++++++++++++ # 銃スキル使用不可フラグを初期化 rx_g_disable = false # 銃を装備しているか if @actor.rx_equip_gun? # スキルを使うのに弾数が足りているか unless @actor.rx_g_sel_judge(skill.rx_bullet_cost, @actor.rx_bullets) self.contents.font.color = disabled_color # 銃スキル使用不可フラグを立てる rx_g_disable = true end # 消費弾数の概念があるスキルであるか elsif skill.rx_bullet_cost > 0 # ブザー SE を演奏 self.contents.font.color = disabled_color # 銃スキル使用不可フラグを立てる rx_g_disable = true end if @actor.skill_can_use?(skill.id) and not rx_g_disable self.contents.font.color = normal_color else self.contents.font.color = disabled_color end #++++++++++++++++++++++++++++★改造ここまで++++++++++++++++++++++++++++ x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(skill.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) #++++++++++++++++++++++++++++++★追加事項++++++++++++++++++++++++++++++ # 銃を装備していて、スキルに消費弾数が設定されていれば if @actor.rx_equip_gun? and skill.rx_bullet_cost > 0 self.contents.draw_text(x + 28, y, 172, 32, skill.name, 0) # 消費 SP に加え、消費弾数も表示 self.contents.draw_text(x + 184, y, 96, 32, skill.sp_cost.to_s + "(" + skill.rx_bullet_cost.to_s + ")", 2) else self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0) self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2) end #++++++++++++++++++++++++++++★追加ここまで++++++++++++++++++++++++++++ end end #============================================================================== # ■ Window_Target #------------------------------------------------------------------------------ #  アイテム画面とスキル画面で、使用対象のアクターを選択するウィンドウです。 #============================================================================== class Window_Target < Window_Selectable #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...$game_party.actors.size x = 4 y = i * 116 actor = $game_party.actors[i] draw_actor_name(actor, x, y) draw_actor_class(actor, x + 144, y) draw_actor_level(actor, x + 8, y + 32) draw_actor_state(actor, x + 8, y + 64) #++++++++++++++++++++++++++++++★改造事項++++++++++++++++++++++++++++++ draw_actor_hp(actor, x + 152, y + 24) draw_actor_sp(actor, x + 152, y + 44) draw_actor_rx_bullets(actor, x + 152, y + 64) #++++++++++++++++++++++++++++★改造ここまで++++++++++++++++++++++++++++ end end end #============================================================================== # ■ Window_BattleStatus #------------------------------------------------------------------------------ #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。 #============================================================================== class Window_BattleStatus < Window_Base #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size actor = $game_party.actors[i] actor_x = i * 160 + 4 draw_actor_name(actor, actor_x, 0) #++++++++++++++++++++++++++++++★改造事項++++++++++++++++++++++++++++++ draw_actor_hp(actor, actor_x, 24, 120) draw_actor_sp(actor, actor_x, 48, 120) draw_actor_rx_bullets(actor, actor_x, 72, 120) if @level_up_flags[i] self.contents.font.color = normal_color self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!") else draw_actor_state(actor, actor_x, 96) end #++++++++++++++++++++++++++++★改造ここまで++++++++++++++++++++++++++++ end end end #============================================================================== # ■ Window_ShopBuy #------------------------------------------------------------------------------ #  ショップ画面で、購入できる商品の一覧を表示するウィンドウです。 #============================================================================== class Window_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] #++++++++++++++++++++++++++++++★改造事項++++++++++++++++++++++++++++++ # 銃弾フラグの初期化 rx_bullets = false # アイテムの所持数を取得 case item when RPG::Item number = $game_party.item_number(item.id) # 銃弾アイテムならば、銃弾フラグを立てる if $data_items[item.id].rx_bullets rx_bullets = true end when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end # 銃弾アイテムなら上限値を 999 に item_max = (rx_bullets ? 999 : 99) # 価格が所持金以下、かつ所持数が 上限値 でなければ通常文字色に、 # そうでなければ無効文字色に設定 if item.price <= $game_party.gold and number < item_max self.contents.font.color = normal_color else self.contents.font.color = disabled_color end #++++++++++++++++++++++++++++★改造ここまで++++++++++++++++++++++++++++ x = 4 y = index * 32 rect = Rect.new(x, y, self.width - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2) end end #============================================================================== # ■ Scene_Item #------------------------------------------------------------------------------ #  アイテム画面の処理を行うクラスです。 #============================================================================== class Scene_Item #-------------------------------------------------------------------------- # ● フレーム更新 (ターゲットウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_target # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # アイテム切れなどで使用できなくなった場合 unless $game_party.item_can_use?(@item.id) # アイテムウィンドウの内容を再作成 @item_window.refresh end # ターゲットウィンドウを消去 @item_window.active = true @target_window.visible = false @target_window.active = false return end # C ボタンが押された場合 if Input.trigger?(Input::C) # アイテムを使い切った場合 if $game_party.item_number(@item.id) == 0 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # ターゲットが全体の場合 if @target_window.index == -1 # パーティ全体にアイテムの使用効果を適用 used = false for i in $game_party.actors used |= i.item_effect(@item) end end # ターゲットが単体の場合 if @target_window.index >= 0 # ターゲットのアクターにアイテムの使用効果を適用 target = $game_party.actors[@target_window.index] used = target.item_effect(@item) end # アイテムを使った場合 if used # アイテムの使用時 SE を演奏 $game_system.se_play(@item.menu_se) #++++++++++++++++++++++++++++++★改造事項++++++++++++++++++++++++++++++ # 消耗品の場合 if @item.consumable # 使用したアイテムを 1 減らす $game_party.lose_item(@item.id, 1) end # アイテムウィンドウの項目を再描画 @item_window.draw_item(@item_window.index) #++++++++++++++++++++++++++++★改造ここまで++++++++++++++++++++++++++++ # ターゲットウィンドウの内容を再作成 @target_window.refresh # 全滅の場合 if $game_party.all_dead? # ゲームオーバー画面に切り替え $scene = Scene_Gameover.new return end # コモンイベント ID が有効の場合 if @item.common_event_id > 0 # コモンイベント呼び出し予約 $game_temp.common_event_id = @item.common_event_id # マップ画面に切り替え $scene = Scene_Map.new return end end # アイテムを使わなかった場合 unless used # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) end return end end end #============================================================================== # ■ Scene_Equip #------------------------------------------------------------------------------ #  装備画面の処理を行うクラスです。 #============================================================================== class Scene_Equip #-------------------------------------------------------------------------- # ● フレーム更新 (アイテムウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_item # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # ライトウィンドウをアクティブ化 @right_window.active = true @item_window.active = false @item_window.index = -1 return end # C ボタンが押された場合 if Input.trigger?(Input::C) # 装備 SE を演奏 $game_system.se_play($data_system.equip_se) # アイテムウィンドウで現在選択されているデータを取得 item = @item_window.item #++++++++++++++++++++++++++++++★改造事項++++++++++++++++++++++++++++++ # 銃を装備している場合 if @actor.rx_equip_gun? # 銃弾を全て外す @actor.rebirth_rx_bullets end # 装備を変更 @actor.equip(@right_window.index, item == nil ? 0 : item.id) # 銃を装備している場合、銃弾をセット if @actor.rx_equip_gun? @actor.set_rx_bullets end #++++++++++++++++++++++++++++★改造ここまで++++++++++++++++++++++++++++ # ライトウィンドウをアクティブ化 @right_window.active = true @item_window.active = false @item_window.index = -1 # ライトウィンドウ、アイテムウィンドウの内容を再作成 @right_window.refresh @item_window.refresh return end end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● アクターコマンドウィンドウのセットアップ #-------------------------------------------------------------------------- alias rx_rgsss19_phase3_setup_command_window phase3_setup_command_window def phase3_setup_command_window s1 = $data_system.words.attack s2 = $data_system.words.skill s3 = $data_system.words.guard s4 = $data_system.words.item # ★ 銃を装備していればコマンド名を変更 if @active_battler.rx_equip_gun? @actor_command_window.commands = [s1, s2, "防御/リロード", s4] else @actor_command_window.commands = [s1, s2, s3, s4] end # メソッドを呼び戻す rx_rgsss19_phase3_setup_command_window end #-------------------------------------------------------------------------- # ● フレーム更新 (アクターコマンドフェーズ : スキル選択) #-------------------------------------------------------------------------- def update_phase3_skill_select # スキルウィンドウを可視状態にする @skill_window.visible = true # スキルウィンドウを更新 @skill_window.update # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # スキルの選択を終了 end_skill_select return end # C ボタンが押された場合 if Input.trigger?(Input::C) # スキルウィンドウで現在選択されているデータを取得 @skill = @skill_window.skill #++++++++++++++++++++++++++++++★追加事項++++++++++++++++++++++++++++++ # 銃を装備しているか if @active_battler.rx_equip_gun? # スキルを使うのに弾数が足りているか unless @active_battler.rx_g_sel_judge(@skill.rx_bullet_cost, @active_battler.rx_bullets) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 消費弾数の概念があるスキルであるか elsif @skill.rx_bullet_cost > 0 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end #++++++++++++++++++++++++++++★追加ここまで++++++++++++++++++++++++++++ # 使用できない場合 if @skill == nil or not @active_battler.skill_can_use?(@skill.id) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アクションを設定 @active_battler.current_action.skill_id = @skill.id # スキルウィンドウを不可視状態にする @skill_window.visible = false # 効果範囲が敵単体の場合 if @skill.scope == 1 # エネミーの選択を開始 start_enemy_select # 効果範囲が味方単体の場合 elsif @skill.scope == 3 or @skill.scope == 5 # アクターの選択を開始 start_actor_select # 効果範囲が単体ではない場合 else # スキルの選択を終了 end_skill_select # 次のアクターのコマンド入力へ phase3_next_actor end return end end #-------------------------------------------------------------------------- # ● 基本アクション 結果作成 #-------------------------------------------------------------------------- def make_basic_action_result # 攻撃の場合 if @active_battler.current_action.basic == 0 # アニメーション ID を設定 @animation1_id = @active_battler.animation1_id @animation2_id = @active_battler.animation2_id # 行動側バトラーがエネミーの場合 if @active_battler.is_a?(Game_Enemy) if @active_battler.restriction == 3 target = $game_troop.random_target_enemy elsif @active_battler.restriction == 2 target = $game_party.random_target_actor else index = @active_battler.current_action.target_index target = $game_party.smooth_target_actor(index) end end # 行動側バトラーがアクターの場合 if @active_battler.is_a?(Game_Actor) if @active_battler.restriction == 3 target = $game_party.random_target_actor elsif @active_battler.restriction == 2 target = $game_troop.random_target_enemy else index = @active_battler.current_action.target_index target = $game_troop.smooth_target_enemy(index) end end # 対象側バトラーの配列を設定 @target_battlers = [target] #++++++++++++++++++++++++++++++★追加事項++++++++++++++++++++++++++++++ # ★ 銃を装備していれば if @active_battler.rx_equip_gun? rx_bullet_cost = $data_weapons[@active_battler.weapon_id].rx_bullet_cost # 弾数が足りていなければ unless @active_battler.rx_g_act_judge(rx_bullet_cost, @active_battler.rx_bullets) # アクション強制対象のバトラーをクリア $game_temp.forcing_battler = nil # ステップ 1 に移行 @phase4_step = 1 return else # 弾数消費 @active_battler.rx_bullets -= rx_bullet_cost # ステータスウィンドウをリフレッシュ @status_window.refresh end end #++++++++++++++++++++++++++++★追加ここまで++++++++++++++++++++++++++++ # 通常攻撃の効果を適用 for target in @target_battlers target.attack_effect(@active_battler) end return end # 防御の場合 if @active_battler.current_action.basic == 1 #++++++++++++++++++++++++++++++★追加事項++++++++++++++++++++++++++++++ # ★ 銃を装備していれば if @active_battler.rx_equip_gun? # 装填できる弾数を取得 rx_get_bullets = $data_weapons[@active_battler.weapon_id].rx_max_bullets - @active_battler.rx_bullets # 装弾数が最大なら if rx_get_bullets == 0 # ヘルプウィンドウに "防御" を表示 @help_window.set_text($data_system.words.guard, 1) return else # ヘルプウィンドウに "リロード" を表示 @help_window.set_text("リロード", 1) # 銃弾をセット @active_battler.set_rx_bullets_from_item(rx_get_bullets) # ステータスウィンドウをリフレッシュ @status_window.refresh return end else # ヘルプウィンドウに "防御" を表示 @help_window.set_text($data_system.words.guard, 1) return end #++++++++++++++++++++++++++++★追加ここまで++++++++++++++++++++++++++++ end # 逃げるの場合 if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2 # ヘルプウィンドウに "逃げる" を表示 @help_window.set_text("逃げる", 1) # 逃げる @active_battler.escape return end # 何もしないの場合 if @active_battler.current_action.basic == 3 # アクション強制対象のバトラーをクリア $game_temp.forcing_battler = nil # ステップ 1 に移行 @phase4_step = 1 return end end #-------------------------------------------------------------------------- # ● スキルアクション 結果作成 #-------------------------------------------------------------------------- def make_skill_action_result # スキルを取得 @skill = $data_skills[@active_battler.current_action.skill_id] # 強制アクションでなければ unless @active_battler.current_action.forcing # SP 切れなどで使用できなくなった場合 unless @active_battler.skill_can_use?(@skill.id) # アクション強制対象のバトラーをクリア $game_temp.forcing_battler = nil # ステップ 1 に移行 @phase4_step = 1 return end end #++++++++++++++++++++++++++++++★追加事項++++++++++++++++++++++++++++++ # ★ スキルに消費弾数が設定されていれば if @skill.rx_bullet_cost > 0 # 弾数が足りていなければ unless @active_battler.rx_g_act_judge(@skill.rx_bullet_cost, @active_battler.rx_bullets) # アクション強制対象のバトラーをクリア $game_temp.forcing_battler = nil # ステップ 1 に移行 @phase4_step = 1 return else # 弾数消費 @active_battler.rx_bullets -= @skill.rx_bullet_cost end end #++++++++++++++++++++++++++++★追加ここまで++++++++++++++++++++++++++++ # SP 消費 @active_battler.sp -= @skill.sp_cost # ステータスウィンドウをリフレッシュ @status_window.refresh # ヘルプウィンドウにスキル名を表示 @help_window.set_text(@skill.name, 1) # アニメーション ID を設定 @animation1_id = @skill.animation1_id @animation2_id = @skill.animation2_id # コモンイベント ID を設定 @common_event_id = @skill.common_event_id # 対象側バトラーを設定 set_target_battlers(@skill.scope) # スキルの効果を適用 for target in @target_battlers target.skill_effect(@active_battler, @skill) end end end #============================================================================== # ■ Scene_Shop #------------------------------------------------------------------------------ #  ショップ画面の処理を行うクラスです。 #============================================================================== class Scene_Shop #-------------------------------------------------------------------------- # ● フレーム更新 (購入ウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_buy # ステータスウィンドウのアイテムを設定 @status_window.item = @buy_window.item # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # ウィンドウの状態を初期モードへ @command_window.active = true @dummy_window.visible = true @buy_window.active = false @buy_window.visible = false @status_window.visible = false @status_window.item = nil # ヘルプテキストを消去 @help_window.set_text("") return end # C ボタンが押された場合 if Input.trigger?(Input::C) # アイテムを取得 @item = @buy_window.item # アイテムが無効の場合、または価格が所持金より上の場合 if @item == nil or @item.price > $game_party.gold # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end #++++++++++++++++++++++++++++++★改造事項++++++++++++++++++++++++++++++ # 銃弾フラグの初期化 rx_bullets = false # アイテムの所持数を取得 case @item when RPG::Item number = $game_party.item_number(@item.id) # 銃弾アイテムならば、銃弾フラグを立てる if $data_items[@item.id].rx_bullets rx_bullets = true end when RPG::Weapon number = $game_party.weapon_number(@item.id) when RPG::Armor number = $game_party.armor_number(@item.id) end # 銃弾アイテムである場合 if @item.kind_of?(RPG::Item) and rx_bullets # すでに 999 個所持している場合 if number == 999 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end else # すでに 99 個所持している場合 if number == 99 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # 最大購入可能個数を計算 # 銃弾アイテムか否かで買える個数を変化させる if @item.kind_of?(RPG::Item) and rx_bullets max = @item.price == 0 ? 999 : $game_party.gold / @item.price max = [max, 999 - number].min else max = @item.price == 0 ? 99 : $game_party.gold / @item.price max = [max, 99 - number].min end #++++++++++++++++++++++++++++★改造ここまで++++++++++++++++++++++++++++ # ウィンドウの状態を個数入力モードへ @buy_window.active = false @buy_window.visible = false @number_window.set(@item, max, @item.price) @number_window.active = true @number_window.visible = true end end end