######################## 攻撃の対象を選べるようになる ######################## # # # スキルやアイテム、攻撃の対象を敵 / 味方選べるようになり、 # # また手動で対象を「単体 / 全体」の選択がができるスキルとアイテムを # # 設定可能になるスクリプトです。 # # # # 「範囲:全域可」の属性を持ったものに関しては敵カーソル時に上、 # # あるいは味方カーソル状態で下キーを押すと対象を全体にできます。 # # メニューからアイテムを使用した場合には全体化はできません。 # # 全体化することで威力を低下させたい場合はSET_ALL_DISPOINTに設定して下さい。 # # ただし、最初から設定で「味方全体」あるいは「敵全体」としているものは # # 全域化およびSET_ALL_DISPOINTの設定を無視します。 # # # # 「目標:変更可」の属性を持ったものに関しては、敵カーソル時に下、 # # あるいは味方カーソル時に上キーを押すことで対象を変更できます。 # # 全体化と同時に導入することも可能ですし、 # # 最初から対象が全体のものについてもこの属性をつけることが可能です。 # # # # また、通常攻撃に関してもパーティーを攻撃の対象にするかどうか設定可能です。 # # # # なお、かなりの範囲で根本から書き換えています。 # # 戦闘系のスクリプトを導入している場合は確認してください。 # # これはAnnexの公開物についても同様なので、予めご了承ください。 # # # # 例えば「ヒール」というスキルに「範囲:全域可」と「目標:変更可」の属性を、 # # そして対象を「味方単体」とした場合は、下を押すことで味方全体に、 # # 上を押すことで対象を敵に、さらにもう一度上を押すことで敵全体にと、 # # スキルの対象を変更することが可能になります。 # # # ############################################################################## # ココから設定 module Annex # この属性を持ったスキル(アイテム)は全体化可能 CAN_SET_ALL = "範囲:全域可" # この属性を持ったスキル(アイテム)は敵 / 味方の変更可能 CAN_CHANGE_TARGET = "目標:変更可" # 全体攻撃した場合の威力はこの割合に変更(%) SET_ALL_DISPOINT = 70 # 味方を通常攻撃の対象にできるか CAN_ATTACK_PARTY = true end # ココまで設定 #============================================================================== # ■ Game_BattleAction #============================================================================== class Game_BattleAction #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :target_inverse # 対象の敵 / 味方を逆転させるか attr_accessor :target_all # 対象を「全体化」しているか #-------------------------------------------------------------------------- # ○ クリア #-------------------------------------------------------------------------- alias cursor_extend_clear clear def clear cursor_extend_clear @target_inverse = false @target_all = false end end #============================================================================== # ■ Arrow_Base #============================================================================== class Arrow_Base < Sprite #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- alias cursor_extend_initialize initialize def initialize(viewport, scope = 2) @temp_index = 0 @scope = scope # scopeが2(敵全体)か4(味方全体)ならall_flagはtrue @all_flag = (scope == 2 or scope == 4) cursor_extend_initialize(viewport) end #-------------------------------------------------------------------------- # ◎ 追加:全体化する #-------------------------------------------------------------------------- def set_all # 現在のindexを保存 @temp_index = @index # 全体化フラグをセット @all_flag = true end #-------------------------------------------------------------------------- # ◎ 追加:全体化を解除 #-------------------------------------------------------------------------- def reset_index # indexを取得 @index = @temp_index # 全体化フラグを解除 @all_flag = false end #-------------------------------------------------------------------------- # ◎ 追加:全体化されているかどうかの確認 #-------------------------------------------------------------------------- def all_setted? return @all_flag end #-------------------------------------------------------------------------- # ◎ 追加:範囲が「使用者」になっているかどうか #-------------------------------------------------------------------------- def user_only? return @scope == 7 end end #============================================================================== # ■ Arrow_Enemy #============================================================================== class Arrow_Enemy < Arrow_Base #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- alias cursor_extend_update update def update # 全体化されている場合 if @all_flag super # indexを1増やす if Graphics.frame_count % 2 == 0 @index += 1 @index %= $game_troop.enemies.size # 存在しないエネミーを指していたら飛ばす $game_troop.enemies.size.times do break if self.enemy.exist? @index += 1 @index %= $game_troop.enemies.size end # スプライトの座標を設定 if self.enemy != nil self.x = self.enemy.screen_x self.y = self.enemy.screen_y end end return end # 呼び戻す cursor_extend_update end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- alias cursor_extend_update_help update_help def update_help if @all_flag # 全体化されている場合テキストに「敵全体」と表示 @help_window.set_text("敵全体", 1) else # 呼び戻し cursor_extend_update_help end end end #============================================================================== # ■ Arrow_Actor #============================================================================== class Arrow_Actor < Arrow_Base #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- alias cursor_extend_update update def update # 全体化されている場合 if @all_flag super if Graphics.frame_count % 2 == 0 # indexを1増やす @index += 1 @index %= $game_party.actors.size # スプライトの座標を設定 if self.actor != nil self.x = self.actor.screen_x self.y = self.actor.screen_y end end return end # scopeが7(自分自身)の場合はカーソル移動を受け付けない if user_only? super if self.actor != nil self.x = self.actor.screen_x self.y = self.actor.screen_y end return end # 呼び戻す cursor_extend_update end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- alias cursor_extend_update_help update_help def update_help if @all_flag # 全体化されている場合テキストに「味方全体」と表示 @help_window.set_text("味方全体", 1) else # 呼び戻し cursor_extend_update_help end end end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● スキルの効果適用 (再定義) #   Annexでアナウンスしている # 「命中率が99%以下になると一切の攻撃スキルが命中しなくなるバグ 」 # は再定義の際に対応済み。 # user : スキルの使用者 (バトラー) # skill : スキル #-------------------------------------------------------------------------- def skill_effect(user, skill) # クリティカルフラグをクリア self.critical = false # スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、 # またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合 if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1) # メソッド終了 return false end # 有効フラグをクリア effective = false # コモンイベント ID が有効の場合は有効フラグをセット effective |= skill.common_event_id > 0 # 第一命中判定 hit = skill.atk_f > 0 ? skill.hit * user.hit / 100 : skill.hit hit_result = (rand(100) < hit) # 不確実なスキルの場合は有効フラグをセット effective |= hit < 100 # 命中の場合 if hit_result == true # 威力を計算 power = skill.power + user.atk * skill.atk_f / 100 if power > 0 power -= self.pdef * skill.pdef_f / 200 power -= self.mdef * skill.mdef_f / 200 power = [power, 0].max end # 倍率を計算 rate = 20 rate += (user.str * skill.str_f / 100) rate += (user.dex * skill.dex_f / 100) rate += (user.agi * skill.agi_f / 100) rate += (user.int * skill.int_f / 100) # 基本ダメージを計算 self.damage = power * rate / 20 # 属性修正 self.damage *= elements_correct(skill.element_set) self.damage /= 100 # ☆ココから追加 # 全体攻撃フラグがtrueの場合 if user.current_action.target_all # 全体化修正 self.damage *= Annex::SET_ALL_DISPOINT self.damage /= 100 end # ☆ココまで追加 # ダメージの符号が正の場合 if self.damage > 0 # 防御修正 if self.guarding? self.damage /= 2 end end # 分散 if skill.variance > 0 and self.damage.abs > 0 amp = [self.damage.abs * skill.variance / 100, 1].max self.damage += rand(amp+1) + rand(amp+1) - amp end # 第二命中判定 eva = 8 * self.agi / user.dex + self.eva hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100 hit = self.cant_evade? ? 100 : hit hit_result = (rand(100) < hit) # 不確実なスキルの場合は有効フラグをセット effective |= hit < 100 end # 命中の場合 if hit_result == true # 威力 0 以外の物理攻撃の場合 if skill.power != 0 and skill.atk_f > 0 # ステート衝撃解除 remove_states_shock # 有効フラグをセット effective = true end # HP からダメージを減算 last_hp = self.hp self.hp -= self.damage effective |= self.hp != last_hp # ステート変化 @state_changed = false effective |= states_plus(skill.plus_state_set) effective |= states_minus(skill.minus_state_set) # 威力が 0 の場合 if skill.power == 0 # ダメージに空文字列を設定 self.damage = "" # ステートに変化がない場合 unless @state_changed # ダメージに "Miss" を設定 self.damage = "Miss" end end # ミスの場合 else # ダメージに "Miss" を設定 self.damage = "Miss" end # 戦闘中でない場合 unless $game_temp.in_battle # ダメージに nil を設定 self.damage = nil end # メソッド終了 return effective end #-------------------------------------------------------------------------- # ● アイテムの効果適用 (再定義) # item : アイテム # to_all_flag : 全体攻撃フラグ #-------------------------------------------------------------------------- def item_effect(item, to_all_flag = false) # クリティカルフラグをクリア self.critical = false # アイテムの効果範囲が HP 1 以上の味方で、自分の HP が 0、 # またはアイテムの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合 if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or ((item.scope == 5 or item.scope == 6) and self.hp >= 1) # メソッド終了 return false end # 有効フラグをクリア effective = false # コモンイベント ID が有効の場合は有効フラグをセット effective |= item.common_event_id > 0 # 命中判定 hit_result = (rand(100) < item.hit) # 不確実なスキルの場合は有効フラグをセット effective |= item.hit < 100 # 命中の場合 if hit_result == true # 回復量を計算 recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp if recover_hp < 0 recover_hp += self.pdef * item.pdef_f / 20 recover_hp += self.mdef * item.mdef_f / 20 recover_hp = [recover_hp, 0].min end # 属性修正 recover_hp *= elements_correct(item.element_set) recover_hp /= 100 recover_sp *= elements_correct(item.element_set) recover_sp /= 100 # ☆ココから追加 # 全体攻撃フラグがtrueの場合 if to_all_flag # 全体化修正 recover_hp *= Annex::SET_ALL_DISPOINT recover_hp /= 100 recover_sp *= Annex::SET_ALL_DISPOINT recover_sp /= 100 end # ☆ココまで追加 # 分散 if item.variance > 0 and recover_hp.abs > 0 amp = [recover_hp.abs * item.variance / 100, 1].max recover_hp += rand(amp+1) + rand(amp+1) - amp end if item.variance > 0 and recover_sp.abs > 0 amp = [recover_sp.abs * item.variance / 100, 1].max recover_sp += rand(amp+1) + rand(amp+1) - amp end # 回復量の符号が負の場合 if recover_hp < 0 # 防御修正 if self.guarding? recover_hp /= 2 end end # HP 回復量の符号を反転し、ダメージの値に設定 self.damage = -recover_hp # HP および SP を回復 last_hp = self.hp last_sp = self.sp self.hp += recover_hp self.sp += recover_sp effective |= self.hp != last_hp effective |= self.sp != last_sp # ステート変化 @state_changed = false effective |= states_plus(item.plus_state_set) effective |= states_minus(item.minus_state_set) # パラメータ上昇値が有効の場合 if item.parameter_type > 0 and item.parameter_points != 0 # パラメータで分岐 case item.parameter_type when 1 # MaxHP @maxhp_plus += item.parameter_points when 2 # MaxSP @maxsp_plus += item.parameter_points when 3 # 腕力 @str_plus += item.parameter_points when 4 # 器用さ @dex_plus += item.parameter_points when 5 # 素早さ @agi_plus += item.parameter_points when 6 # 魔力 @int_plus += item.parameter_points end # 有効フラグをセット effective = true end # HP 回復率と回復量が 0 の場合 if item.recover_hp_rate == 0 and item.recover_hp == 0 # ダメージに空文字列を設定 self.damage = "" # SP 回復率と回復量が 0、パラメータ上昇値が無効の場合 if item.recover_sp_rate == 0 and item.recover_sp == 0 and (item.parameter_type == 0 or item.parameter_points == 0) # ステートに変化がない場合 unless @state_changed # ダメージに "Miss" を設定 self.damage = "Miss" end end end # ミスの場合 else # ダメージに "Miss" を設定 self.damage = "Miss" end # 戦闘中でない場合 unless $game_temp.in_battle # ダメージに nil を設定 self.damage = nil end # メソッド終了 return effective end end #============================================================================== # ■ Scene_Item #============================================================================== class Scene_Item #-------------------------------------------------------------------------- # ● フレーム更新 (ターゲットウィンドウがアクティブの場合) #-------------------------------------------------------------------------- alias cursor_extend_update_target update_target def update_target # 左か右が押された場合 if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::LEFT) # 道具が全体化可能な場合 if include_element?(@item.element_set, Annex::CAN_SET_ALL) # 既に全体化している場合 if @target_window.index == -1 # indexを呼び戻す @target_window.index = @temp # 効果音を鳴らす $game_system.se_play($data_system.cursor_se) return end if @target_window.index != -1 # indexを一時保存 @temp = @target_window.index # 効果音を鳴らす $game_system.se_play($data_system.cursor_se) @target_window.index = -1 return end end 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 # アイテムが全体化されているかのフラグ to_all_flag = include_element?(@item.element_set, Annex::CAN_SET_ALL) for i in $game_party.actors used |= i.item_effect(@item, to_all_flag) 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) # アイテムウィンドウの項目を再描画 @item_window.draw_item(@item_window.index) end # ターゲットウィンドウの内容を再作成 @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 return end # アイテムを使わなかった場合 unless used # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end end # 元の処理を呼び戻す cursor_extend_update_target end #-------------------------------------------------------------------------- # ◎ 追加:任意の属性配列にその属性が含まれるか否か #-------------------------------------------------------------------------- def include_element?(element_set, name) return element_set.include?($data_system.elements.index(name)) end end #============================================================================== # ■ Scene_Skill #============================================================================== class Scene_Skill #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # actor_index : アクターインデックス #-------------------------------------------------------------------------- alias cursor_extend_initialize initialize def initialize(actor_index = 0, equip_index = 0) # 呼び戻し cursor_extend_initialize(actor_index, equip_index) # カレントアクションをクリア $game_party.actors[@actor_index].current_action.clear end #-------------------------------------------------------------------------- # ○ フレーム更新 (ターゲットウィンドウがアクティブの場合) #-------------------------------------------------------------------------- alias cursor_extend_update_target update_target def update_target # 左か右が押された場合 if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::LEFT) # スキルが全体化可能な場合 if include_element?(@skill.element_set, Annex::CAN_SET_ALL) # 既に全体化している場合 if @target_window.index == -1 # indexを呼び戻す @target_window.index = @temp # 効果音を鳴らす $game_system.se_play($data_system.cursor_se) # アクターのカレントアクションを再設定 @actor.current_action.target_all = false return end if @target_window.index != -1 # indexを一時保存 @temp = @target_window.index # 効果音を鳴らす $game_system.se_play($data_system.cursor_se) @target_window.index = -1 # アクターのカレントアクションを再設定 @actor.current_action.target_all = true return end end end # B ボタンが押された場合 if Input.trigger?(Input::B) # アクションをクリア @actor.current_action.clear end # 元の処理を呼び戻す cursor_extend_update_target end #-------------------------------------------------------------------------- # ◎ 追加:任意の属性配列にその属性が含まれるか否か #-------------------------------------------------------------------------- def include_element?(element_set, name) return element_set.include?($data_system.elements.index(name)) end end #============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● フレーム更新 (アクターコマンドフェーズ : スキル選択) (再定義) #-------------------------------------------------------------------------- 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 @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 or @skill.scope == 2 # エネミーの選択を開始 start_enemy_select # 効果範囲が味方の場合 elsif @skill.scope > 2 # アクターの選択を開始 start_actor_select # 効果範囲が0(なし)の場合 # ☆ココまで変更 else # スキルの選択を終了 end_skill_select # 次のアクターのコマンド入力へ phase3_next_actor end return end end #-------------------------------------------------------------------------- # ● フレーム更新 (アクターコマンドフェーズ : アイテム選択) (再定義) #-------------------------------------------------------------------------- def update_phase3_item_select # アイテムウィンドウを可視状態にする @item_window.visible = true # アイテムウィンドウを更新 @item_window.update # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # アイテムの選択を終了 end_item_select return end # C ボタンが押された場合 if Input.trigger?(Input::C) # アイテムウィンドウで現在選択されているデータを取得 @item = @item_window.item # 使用できない場合 unless $game_party.item_can_use?(@item.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.item_id = @item.id # アイテムウィンドウを不可視状態にする @item_window.visible = false # ☆ココから変更 # 効果範囲が敵の場合 if @item.scope == 1 or @item.scope == 2 # エネミーの選択を開始 start_enemy_select # 効果範囲が味方の場合 elsif @item.scope > 2 # アクターの選択を開始 start_actor_select # 効果範囲が0(なし)の場合 # ☆ココまで変更 else # アイテムの選択を終了 end_item_select # 次のアクターのコマンド入力へ phase3_next_actor end return end end #-------------------------------------------------------------------------- # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択) (再定義) #-------------------------------------------------------------------------- def update_phase3_enemy_select # エネミーアローを更新 @enemy_arrow.update # ☆ココから追加 # 方向ボタンの上が押された場合 if Input.trigger?(Input::UP) # 既に全体化してるなら以下の処理は行わない return if @enemy_arrow.all_setted? # 全体化可能で敵の数が二体以上ならばカーソルを全体に if can_select_all? and can_attack_all?($game_troop.enemies) $game_system.se_play($data_system.cursor_se) @enemy_arrow.set_all end return end # 方向ボタンの下が押された場合 if Input.trigger?(Input::DOWN) # 既に全体化している場合 if @enemy_arrow.all_setted? # 全体化可能なものに関しては戻す if can_select_all? $game_system.se_play($data_system.cursor_se) # indexを戻す @enemy_arrow.reset_index return end end # 味方を対象にできる場合 if can_change_target? # アクター選択に変更 $game_system.se_play($data_system.cursor_se) set_to_actor_select return end end # ☆ココまで追加 # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # エネミーの選択を終了 end_enemy_select return end # C ボタンが押された場合 if Input.trigger?(Input::C) # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アクションを設定 @active_battler.current_action.target_index = @enemy_arrow.index # 全体化の場合全体化命令 @active_battler.current_action.target_all = @enemy_arrow.all_setted? # エネミーの選択を終了 end_enemy_select # スキルウィンドウ表示中の場合 if @skill_window != nil # ☆ココから追加 # スキルのscopeが 3(味方単体) か 4(味方全体) の場合、 # target_inverseを true に @active_battler.current_action.target_inverse = (@skill.scope == 3 or @skill.scope == 4) # ☆ココまで追加 # スキルの選択を終了 end_skill_select end # アイテムウィンドウ表示中の場合 if @item_window != nil # ☆ココから追加 # アイテムのscopeが 3(味方単体) か 4(味方全体) の場合、 # target_inverseを true に @active_battler.current_action.target_inverse = (@item.scope == 3 or @item.scope == 4) # ☆ココまで追加 # アイテムの選択を終了 end_item_select end # 次のアクターのコマンド入力へ phase3_next_actor end end #-------------------------------------------------------------------------- # ● フレーム更新 (アクターコマンドフェーズ : アクター選択) (再定義) #-------------------------------------------------------------------------- def update_phase3_actor_select # アクターアローを更新 @actor_arrow.update # ☆ココから追加 # 方向ボタンの下が押された場合 if Input.trigger?(Input::DOWN) # 既に全体化してるなら以下の処理は行わない return if @actor_arrow.all_setted? # 全体化可能なら全体化 if can_select_all? and can_attack_all?($game_party.actors) $game_system.se_play($data_system.cursor_se) @actor_arrow.set_all end return end # 方向ボタンの上が押された場合 if Input.trigger?(Input::UP) # 既に全体化している場合 if @actor_arrow.all_setted? # 全体化可能なものに関しては戻す if can_select_all? # indexを戻す @actor_arrow.reset_index return end end # 敵を対象にできる場合 if can_change_target? # エネミー選択に変更 $game_system.se_play($data_system.cursor_se) set_to_enemy_select return end end # ☆ココまで追加 # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # アクターの選択を終了 end_actor_select return end # C ボタンが押された場合 if Input.trigger?(Input::C) # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アクションを設定 @active_battler.current_action.target_index = @actor_arrow.index # ☆ココから追加 # 全体化の場合全体化命令 @active_battler.current_action.target_all = @actor_arrow.all_setted? # ☆ココまで追加 # アクターの選択を終了 end_actor_select # スキルウィンドウ表示中の場合 if @skill_window != nil # ☆ココから追加 # スキルのscopeが 1(敵単体) か 2(敵全体)の場合、 # target_inverseを true に @active_battler.current_action.target_inverse = (@skill.scope == 1 or @skill.scope == 2) # ☆ココまで追加 # スキルの選択を終了 end_skill_select end # アイテムウィンドウ表示中の場合 if @item_window != nil # ☆ココから追加 # アイテムのscopeが 1(敵単体) か 2(敵全体)の場合、 # target_inverseを true に @active_battler.current_action.target_inverse = (@item.scope == 1 or @item.scope == 2) # ☆ココまで追加 # アイテムの選択を終了 end_item_select end # 通常攻撃の場合target_inverseを true に if @active_battler.current_action.kind == 0 and @active_battler.current_action.basic == 0 @active_battler.current_action.target_inverse = true end # 次のアクターのコマンド入力へ phase3_next_actor end end #-------------------------------------------------------------------------- # ● エネミー選択開始 (再定義) #-------------------------------------------------------------------------- def start_enemy_select # ☆ココから変更 scope = get_scope # エネミーアローを作成 @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1, scope) # ☆ココまで変更 # ヘルプウィンドウを関連付け @enemy_arrow.help_window = @help_window # アクターコマンドウィンドウを無効化 @actor_command_window.active = false @actor_command_window.visible = false end #-------------------------------------------------------------------------- # ● アクター選択開始 (再定義) #-------------------------------------------------------------------------- def start_actor_select # ☆ココから変更 scope = get_scope # アクターアローを作成 @actor_arrow = Arrow_Actor.new(@spriteset.viewport2, scope) # ☆ココまで変更 @actor_arrow.index = @actor_index # ヘルプウィンドウを関連付け @actor_arrow.help_window = @help_window # アクターコマンドウィンドウを無効化 @actor_command_window.active = false @actor_command_window.visible = false end #-------------------------------------------------------------------------- # ○ アクター選択終了 #-------------------------------------------------------------------------- alias cursor_extend_end_actor_select end_actor_select def end_actor_select # コマンドが [戦う] の場合 if @actor_command_window.index == 0 # アクターコマンドウィンドウを有効化 @actor_command_window.active = true @actor_command_window.visible = true # ヘルプウィンドウを隠す @help_window.visible = false end # 呼び戻し cursor_extend_end_actor_select end #-------------------------------------------------------------------------- # ◎ 追加:アクター選択に切り替え #-------------------------------------------------------------------------- def set_to_actor_select # 敵選択終了 end_enemy_select # アクター選択開始 start_actor_select end #-------------------------------------------------------------------------- # ◎ 追加:エネミー選択に切り替え #-------------------------------------------------------------------------- def set_to_enemy_select # 敵選択終了 end_actor_select # アクター選択開始 start_enemy_select end #-------------------------------------------------------------------------- # ○ 基本アクション 結果作成 #-------------------------------------------------------------------------- alias cursor_extend_make_basic_action_result make_basic_action_result def make_basic_action_result # 対象が逆転している場合 if @active_battler.current_action.target_inverse and @active_battler.current_action.basic == 0 # アニメーション ID を設定 @animation1_id = @active_battler.animation1_id @animation2_id = @active_battler.animation2_id # 対象をアクターに変更 # (エネミーは攻撃対象が逆転しないため) index = @active_battler.current_action.target_index target = $game_party.smooth_target_actor(index) # 対象側バトラーの配列を設定 @target_battlers = [target] # 通常攻撃の効果を適用 for target in @target_battlers target.attack_effect(@active_battler) end return end # 呼び戻し cursor_extend_make_basic_action_result end #-------------------------------------------------------------------------- # ● アイテムアクション 結果作成 (再定義) #-------------------------------------------------------------------------- def make_item_action_result # アイテムを取得 @item = $data_items[@active_battler.current_action.item_id] # アイテム切れなどで使用できなくなった場合 unless $game_party.item_can_use?(@item.id) # ステップ 1 に移行 @phase4_step = 1 return end # 消耗品の場合 if @item.consumable # 使用したアイテムを 1 減らす $game_party.lose_item(@item.id, 1) end # ヘルプウィンドウにアイテム名を表示 @help_window.set_text(@item.name, 1) # アニメーション ID を設定 @animation1_id = @item.animation1_id @animation2_id = @item.animation2_id # コモンイベント ID を設定 @common_event_id = @item.common_event_id # ☆ココから変更 set_target_battlers(@item.scope) # アイテムの効果を適用 for target in @target_battlers target.item_effect(@item, @active_battler.current_action.target_all) end # ☆ココまで変更 end #-------------------------------------------------------------------------- # ○ スキルまたはアイテムの対象側バトラー設定 # scope : スキルまたはアイテムの効果範囲 #-------------------------------------------------------------------------- alias cursor_extend_set_target_battlers set_target_battlers def set_target_battlers(scope) # 行動側バトラーがアクターの場合 if @active_battler.is_a?(Game_Actor) # scope が 1(敵単体) の場合 if scope == 1 # 全体化フラグがtrueならばscopeを1増加 (全体化) if @active_battler.current_action.target_all scope += 1 end # 対象が逆転しているならscopeを2増加 (対象を味方に) if @active_battler.current_action.target_inverse scope += 2 end # scope が 2(敵全体) の場合 elsif scope == 2 # 対象が逆転しているならscopeを2増加 (対象を味方に) if @active_battler.current_action.target_inverse scope += 2 end # scope が 3(味方単体) の場合 elsif scope == 3 # 全体化フラグがtrueならばscopeを1増加 (全体化) if @active_battler.current_action.target_all scope += 1 end # 対象が逆転しているならscopeを2減算 (対象を敵に) if @active_battler.current_action.target_inverse scope -= 2 end # scope が 4(味方全体) の場合 elsif scope == 4 # 対象が逆転しているならscopeを2減算 (対象を敵に) if @active_battler.current_action.target_inverse scope -= 2 end end end # 呼び戻し cursor_extend_set_target_battlers(scope) end #-------------------------------------------------------------------------- # ◎ 追加:選ばれているスキル / アイテムのscopeを取得 #-------------------------------------------------------------------------- def get_scope # スキルの場合 if @skill_window != nil return @skill.scope end # アイテムの場合 if @item_window != nil return @item.scope end # 通常攻撃ならscopeは1(敵単体)。 return 1 end #-------------------------------------------------------------------------- # ◎ 追加:選ばれているスキル / アイテムが全体化できるかどうかの確認 #-------------------------------------------------------------------------- def can_select_all? scope = get_scope # 対象た単体で無い場合はfalse if scope != 1 and scope != 3 return false end # 全体化可能なスキルの場合 if @skill_window != nil and include_element?(@skill.element_set, Annex::CAN_SET_ALL) return true end # 全体化可能なアイテムの場合 if @item_window != nil and include_element?(@item.element_set, Annex::CAN_SET_ALL) return true end return false end #-------------------------------------------------------------------------- # ◎ 追加:選ばれているスキル / アイテムの対象を敵/味方入れ替えられるかの確認 #-------------------------------------------------------------------------- def can_change_target? scope = get_scope # HP0 / 使用者が対象ならばfalse if scope > 4 return false end # 変更可能なスキルの場合 if @skill_window != nil return include_element?(@skill.element_set, Annex::CAN_CHANGE_TARGET) end # 変更可能なアイテムの場合 if @item_window != nil return include_element?(@item.element_set, Annex::CAN_CHANGE_TARGET) end # 通常攻撃の場合 if @active_battler.current_action.kind == 0 and @active_battler.current_action.basic == 0 return Annex::CAN_ATTACK_PARTY end return false end #-------------------------------------------------------------------------- # ◎ 追加:全体化可能か否か (パーティー / トループの生存者数が2人以上か否か) #-------------------------------------------------------------------------- def can_attack_all?(members) total = 0 for battler in members if battler.exist? total += 1 end end return total > 1 end #-------------------------------------------------------------------------- # ◎ 追加:任意の属性配列にその属性が含まれるか否か #-------------------------------------------------------------------------- def include_element?(element_set, name) return element_set.include?($data_system.elements.index(name)) end end