#==============================================================================
# ■ 効果範囲:敵X体 ランダム By 貪藻矢射妥←
#
# VX Aceにある効果範囲:敵X体 ランダムをXPで再現してます。
#
# ※効果範囲を 敵全体 にしてください。
# 若干VX Aceと仕様が違うかもしれません。。
#
#==============================================================================
# 更新っぽいもの
# まだなし
$OuterFlgs = {} if $OuterFlgs == nil
$OuterFlgs["Rand_Select"] = true
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
# Add
attr_accessor :sel_num
attr_accessor :change_list
# Add
end
module Rand_Select
RanSel_WD = "ランダム"
#--------------------------------------------------------------------------
# ○ ターゲット数取得
#--------------------------------------------------------------------------
def get_rand_select
select_num = 0
rand_flg = false
if @skill != nil # スキルの場合
for j in @skill.element_set
ele_set = $data_system.elements[j]
if ele_set != nil
if ele_set =~ /^#{RanSel_WD}([0-9]+)$/
select_num += $1.to_i
rand_flg = true
end
end
end
end
return [select_num, rand_flg]
end
end
class Scene_Battle
include Rand_Select
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
#--------------------------------------------------------------------------
def update_phase4_step1
# ヘルプウィンドウを隠す
@help_window.hide
# 勝敗判定
if judge
# 勝利または敗北の場合 : メソッド終了
return
end
# アクションを強制されているバトラーが存在しない場合
if $game_temp.forcing_battler == nil
# バトルイベントをセットアップ
setup_battle_event
# バトルイベント実行中の場合
if $game_system.battle_interpreter.running?
return
end
end
# アクションを強制されているバトラーが存在する場合
if $game_temp.forcing_battler != nil
# 先頭に追加または移動
@action_battlers.delete($game_temp.forcing_battler)
@action_battlers.unshift($game_temp.forcing_battler)
end
# 未行動バトラーが存在しない場合 (全員行動した)
if @action_battlers.size == 0
# パーティコマンドフェーズ開始
start_phase2
return
end
# アニメーション ID およびコモンイベント ID を初期化
@animation1_id = 0
@animation2_id = 0
@common_event_id = 0
# 攻撃側アニメーション実行フラグを寝かせる
@anime1_execute = false
# 攻撃回数カウンタを初期化
# 連続攻撃
@attakked_num = 0
# 連続攻撃
# Rand_Select
@selected_num = 0
# Rand_Select
# 未行動バトラー配列の先頭からシフト
@active_battler = @action_battlers.shift
# すでに戦闘から外されている場合
if @active_battler.index == nil
return
end
# スリップダメージ
if @active_battler.hp > 0 and @active_battler.slip_damage?
@active_battler.slip_damage_effect
@active_battler.damage_pop = true
end
# ステート自然解除
@active_battler.remove_states_auto
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# ステップ 2 に移行
@phase4_step = 2
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
#--------------------------------------------------------------------------
def update_phase4_step2
# 強制アクションでなければ
unless @active_battler.current_action.forcing
# 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
if @active_battler.restriction == 2 || @active_battler.restriction == 3
# アクションに攻撃を設定
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
# 制約が [行動できない] の場合
if @active_battler.restriction == 4
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# ステップ 1 に移行
@phase4_step = 1
return
end
end
# 対象バトラーをクリア
@target_battlers = []
# アクションの種別で分岐
case @active_battler.current_action.kind
when 0 # 基本
make_basic_action_result
when 1 # スキル
make_skill_action_result
when 2 # アイテム
make_item_action_result
end
if @phase4_step == 2
# 2回目の攻撃は、行動側アニメーション、対象側アニメーションをスキップ
# Rand_Select
if @attakked_num == 0 || @selected_num < $game_system.sel_num
# 行動側アニメーションは一回だけ実行
if !@anime1_execute
# ステップ 3 に移行
@phase4_step = 3
else
# ステップ 4 に移行
@phase4_step = 4
end
else
# ステップ 5 に移行
@phase4_step = 5
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
#--------------------------------------------------------------------------
def update_phase4_step5
# ヘルプウィンドウを隠す
@help_window.hide
# ステータスウィンドウをリフレッシュ
@status_window.refresh
if $game_temp.counter_mode >= 1
$game_temp.counter_mode -= 1
end
# ダメージ表示
for target in @target_battlers
if target.damage != nil
target.damage_pop = true
end
if $SilfeedArks["Special_Attack"]
# 当身技の発動エフェクト もしくは 反撃スキル準備
if ( target.counter[6] )
target.counter[6] = false
if ( target.counter[0] == 1 or target.counter[0] == 2)
target.animation_id = target.counter[5]
end
if ( target.counter[0] == 3 )
target.current_action.kind = 1
target.current_action.skill_id = target.counter[1]
@action_battlers.unshift(target)
$game_temp.counter_mode += 1
end
if ( target.counter[0] == 4 )
@counter_temp = target.current_action.skill_id
target.current_action.kind = 1
target.current_action.skill_id = @active_battler.current_action.skill_id
@action_battlers.unshift(target)
$game_temp.counter_mode += 1
end
end
end # $SilfeedArks["Special_Attack"]
end
# 連続攻撃
# 通常攻撃の場合、攻撃回数を増やす
if @active_battler.current_action.kind == 0 &&
@active_battler.current_action.basic == 0
@attakked_num += 1
end
if $OuterFlgs["Rand_Select"]
# スキルの場合、攻撃対象インデックスを増やす
if @active_battler.current_action.kind == 1
@selected_num += 1
end
end # $OuterFlgs["Rand_Select"]
# 攻撃した敵が生き残っているか確認
f = false
for target in @target_battlers
if target.exist?
f = true
end
end
# ステップ 6 に移行
@phase4_step = 6
# 攻撃した敵が生き残っていれば
if f
# 「基本動作」で、「攻撃」なら
if @active_battler.current_action.kind == 0 &&
@active_battler.current_action.basic == 0
if $OuterFlgs["Multi_Atk_Wep"]
# 武器に設定された最大攻撃数の取得
@max_atk_num = get_max_attack(@active_battler.weapon_id)
end # $OuterFlgs["Multi_Atk_Wep"]
# 攻撃回数が最大攻撃数を超えていない場合
if @attakked_num < @max_atk_num
# ステップ 2 に移行
@phase4_step = 2
return
end
end
if $OuterFlgs["Rand_Select"]
# スキルの場合
if @active_battler.current_action.kind == 1
# ランダムセレクト数が残っている場合
if @selected_num < $game_system.sel_num
# ステップ 2 に移行
@phase4_step = 2
return
end
end
end # $OuterFlgs["Rand_Select"]
end
end
#--------------------------------------------------------------------------
# ● スキルアクション 結果作成
#--------------------------------------------------------------------------
★★★ Change_Window_Skill参照 ★★★
#--------------------------------------------------------------------------
# ● スキルまたはアイテムの対象側バトラー設定
# scope : スキルまたはアイテムの効果範囲
#--------------------------------------------------------------------------
alias set_target_battlers_diamond_rand_select set_target_battlers
def set_target_battlers(scope)
# 呼び戻す
set_target_battlers_diamond_rand_select(scope)
# 初期化
$game_system.sel_num = 0
$game_system.change_list = []
if $OuterFlgs["Rand_Select"]
select_num = get_rand_select
if select_num[1]
# 初期設定
$game_system.sel_num = select_num[0]
@target_battlers = []
# 行動側バトラーがエネミーの場合
if @active_battler.is_a?(Game_Enemy)
# 敵全体の場合ターゲットを選び直す
if scope == 2
for i in 0...select_num[0]
actor = $game_party.actors[rand($game_party.actors.size)]
if actor.exist?
$game_system.change_list.push(actor)
end
end
end
else # Game_Actor
# 敵全体の場合ターゲットを選び直す
if scope == 2
for i in 0...select_num[0]
enemy = $game_troop.enemies[rand($game_troop.enemies.size)]
if enemy.exist?
$game_system.change_list.push(enemy)
end
end
end
end
# とりあえずひとつずつプッシュしてみる。。
@target_battlers.push($game_system.change_list[@selected_num])
end
end # $OuterFlgs["Rand_Select"]
end
end
|