#----------------------------------------------------------------------------
# 魔法反射 貪藻矢射妥←カスタム by 貪藻矢射妥←
#----------------------------------------------------------------------------
# 原作: ◆ 魔法反射 - KGC_SkillReflection ◆
# ◇ Last update : 2007/09/03 ◇
# 原作者: TOMY様
# HP: Kamesoft
# アドレス: http://ytomy.sakura.ne.jp/
#
# ★注意事項
# 隊列概念 貪藻矢射妥←カスタム より下に導入してください。
#
# 改造内容:
# ・物理スキルを反射する機能の追加
#
#============================================================================
# 変更点
# 2024:05:01
# ・固定文字列対応
#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================
module KGC
# ◆反射時アニメーションID
REFLECTION_ANIM_ID = 263
# ◆反射ステート名
REFLECTION_STATE_NAME = "ミラーコート"
# ◆物理反射ステート名
COUNTER_STATE_NAME = "カウンター"
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["SkillReflection"] = true
if $game_special_states == nil
$game_special_states = {}
$data_states = load_data(FIX_PATH::PATH_DATA_STTS)
end
# 魔法反射用ステートID取得
state_a = $data_states.compact.find { |s| s.name == KGC::REFLECTION_STATE_NAME }
$game_special_states["reflection"] = (state_a != nil ? state_a.id : 0)
state_b = $data_states.compact.find { |s| s.name == KGC::COUNTER_STATE_NAME }
$game_special_states["counter"] = (state_b != nil ? state_b.id : 0)
#==============================================================================
# ■ Game_Battler (分割定義 2)
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 反射ステート判定
# skill : 処理対象のスキル
#--------------------------------------------------------------------------
def reflection?(skill)
# 魔法反射ステート付加、かつスキルが魔法の場合
if @states.include?($game_special_states["reflection"]) &&
skill.atk_f == 0 && skill.int_f > 0
return true
end
# 物理反射ステート付加、かつスキルが物理の場合
if @states.include?($game_special_states["counter"]) &&
skill.atk_f > 0 && skill.int_f == 0
return true
end
return false
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Battler (分割定義 3)
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● スキルの効果適用
# user : スキルの使用者 (バトラー)
# skill : スキル
# ★★★ 隊列概念 参照 ★★★
#--------------------------------------------------------------------------
alias skill_effect_KGC_SkillReflection skill_effect
def skill_effect(user, skill)
# 反射できる場合は戻る
if user != self && self.reflection?(skill)
return false
end
return skill_effect_KGC_SkillReflection(user, skill)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Battle (分割定義 1)
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias main_KGC_SkillReflection main
def main
# 反射発動フラグを初期化
@skill_reflected = []
main_KGC_SkillReflection
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Battle (分割定義 4)
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● スキルアクション 結果作成
#--------------------------------------------------------------------------
alias make_skill_action_result_KGC_SkillReflection make_skill_action_result
def make_skill_action_result
make_skill_action_result_KGC_SkillReflection
# 反射発動フラグをクリア
@skill_reflected = []
@target_battlers.each_with_index { |target, i|
# 反射発動判定
@skill_reflected[i] =
( target != @active_battler && target.reflection?(@skill) )
}
if @skill_reflected.any?
# 元の発動者ダメージを初期化
user_damage = 0
@target_battlers.each_with_index { |target, i|
# 反射発動判定
if @skill_reflected[i]
# 発動者に跳ね返す
@active_battler.skill_effect(@active_battler, @skill)
# ダメージが両方数値の場合
if user_damage.is_a?(Numeric) && @active_battler.damage.is_a?(Numeric)
# ダメージを加算
user_damage += @active_battler.damage
else
# そのまま設定
user_damage = @active_battler.damage
end
end
}
# 最終的なダメージを適用
@active_battler.damage = user_damage
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
#--------------------------------------------------------------------------
alias update_phase4_step4_KGC_SkillReflection update_phase4_step4
def update_phase4_step4
update_phase4_step4_KGC_SkillReflection
# 反射が発動した場合
#if @active_battler.current_action.kind == 1 && @skill_reflected.any?
if @skill_reflected.any?
# 対象側アニメーション
@target_battlers.each_with_index { |target, i|
# 対象の反射が発動した場合
if @skill_reflected[i]
# 発動者にアニメーションを返す
@active_battler.animation_id = @animation2_id
@active_battler.animation_hit = (target.damage != "Miss")
# ターゲットに反射発動アニメーションを設定
target.animation_id = KGC::REFLECTION_ANIM_ID
target.animation_hit = true
end
}
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
#--------------------------------------------------------------------------
alias update_phase4_step5_KGC_SkillReflection update_phase4_step5
def update_phase4_step5
update_phase4_step5_KGC_SkillReflection
# 反射が発動した場合
if @skill_reflected != nil && @skill_reflected.any?
# 発動者もダメージ表示
if @active_battler.damage != nil
@active_battler.damage_pop = true
end
@skill_reflected = []
end
end
end
|