#============================================================================== # ■ 追尾攻撃EX Ver. 2.1.1 by Claimh #------------------------------------------------------------------------------ # ・通常攻撃をしたときに右上に表示されるキーをタイミングよく入力することで、 # 追加攻撃が発動する。 # ・オート発動、連続追尾回数も設定可能 # ・追尾攻撃を発動させるキー入力のタイミング # 対象側のアニメーションが表示されている時 # ・クリティカル時にアニメーションを変えることができる # ダメージ一括表示時でも攻撃途中に一度でもクリティカルが出たときは # 最後のダメージ表示時に"CRITICAL"の文字が出る # ・攻撃ミス時には追尾攻撃を中止させることもできる #============================================================================== module Add_attack_ex #============================================================================== # □ カスタマイズSTART #============================================================================== # ダメージ一括表示 ADD_ATK_EX_DMG_ALL = true # 不要ならfalse # 対象側アニメーションの間にウェイトを入れる ADD_ATK_EX_WAIT = 4 # 数値はフレーム数、不要ならnil # 通常攻撃がミスなら追尾しない ADD_ATK_EX_MISS = false # 不要ならfalse # クリティカル発生時にアニメーションを変化させる ADD_ATK_EX_CRITICAL = true # 不要ならfalse # 追尾攻撃成功時に鳴らすSE ADD_ATK_EX_SE = "020-Teleport03" # 不要ならnil # 追尾攻撃設定例 # [アクターID, 追尾攻撃力(%), 発生アニメID, オート発生フラグ, 追尾成功率, # 連続回数, クリティカル時アニメ] ADD_EX1 = [1, 80, 30, true, 100, 5, 31] ADD_EX2 = [2, 150, 33, false, 100, 5, 34] ADD_EX3 = [7, 80, 42, false, 100, 5, 43] ADD_EX4 = [8, 150, 48, false, 100, 5, 49] # 上記配列を羅列 ADD_ATK_EX = [ADD_EX1, ADD_EX2, ADD_EX3, ADD_EX4] #============================================================================== # □ カスタマイズEND #============================================================================== end class Scene_Battle include Add_attack_ex #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備) #-------------------------------------------------------------------------- alias update_phase4_step1_add_atk_ex update_phase4_step1 def update_phase4_step1 update_phase4_step1_add_atk_ex @add_atk_ex_flg = false # 追尾攻撃開始 $add_atk_ex_exercise = false # 追尾攻撃実行中 $add_atk_ex_end = false # 追尾攻撃終了 @add_atk_ex_check_key = false # 追尾判定実行中 @add_atk_ex_success = false # 追尾成功 @add_atk_ex_count = 0 # 追尾数カウント $add_atk_ex_first = true # 初期フラグ $add_atk_ex_complete = false @one_key = false @check_key = [0,0,0,0] end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション) #-------------------------------------------------------------------------- alias update_phase4_step3_add_atk_ex update_phase4_step3 def update_phase4_step3 # 追尾実行中ならステップ4に強制移行 if $add_atk_ex_exercise # ステップ 4 に移行 @phase4_step = 4 return elsif @active_battler.current_action.basic == 0 if @active_battler.is_a?(Game_Actor) # 追尾チェック add_atk_ex_check(@active_battler) end end update_phase4_step3_add_atk_ex # 原物 end #-------------------------------------------------------------------------- # ● 追尾チェック #-------------------------------------------------------------------------- def add_atk_ex_check(actor) for i in 0..ADD_ATK_EX.size-1 $add_atk_ex_set = ADD_ATK_EX[i] # 追尾攻撃に整合 if actor.id == $add_atk_ex_set[0] @add_atk_ex_flg = true return end end end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション) #-------------------------------------------------------------------------- alias update_phase4_step4_add_atk_ex update_phase4_step4 def update_phase4_step4 # 追尾攻撃 if @add_atk_ex_flg # キーチェックを開始する @add_atk_ex_check_key = true #-------------- if !$add_atk_ex_complete @one_key = false @key_window = Window_AddAtkEx.new case ( rand(3) ) when 0 @check_key[0] = Input::UP @check_key[1] = Input::RIGHT @check_key[2] = Input::DOWN @check_key[3] = Input::LEFT @key_window.set_key("↑") when 1 @check_key[0] = Input::RIGHT @check_key[1] = Input::UP @check_key[2] = Input::DOWN @check_key[3] = Input::LEFT @key_window.set_key("→") when 2 @check_key[0] = Input::DOWN @check_key[1] = Input::UP @check_key[2] = Input::RIGHT @check_key[3] = Input::LEFT @key_window.set_key("↓") when 3 @check_key[0] = Input::LEFT @check_key[1] = Input::UP @check_key[2] = Input::RIGHT @check_key[3] = Input::DOWN @key_window.set_key("←") end end #-------------- # 追尾実行中ならアニメーション再セット if $add_atk_ex_exercise @animation2_id = $add_atk_ex_set[2] end # 対象側アニメーション for target in @target_battlers # クリティカルでアニメーション変化 if ADD_ATK_EX_CRITICAL and target.critical and $add_atk_ex_first target.animation_id = $add_atk_ex_set[6] else # 一度でもクリティカルがあった if target.one_critical target.critical = true end target.animation_id = @animation2_id end target.animation_hit = (target.damage != "Miss") end # ウェイトを入れる if ADD_ATK_EX_WAIT != nil @wait_count = ADD_ATK_EX_WAIT end # ステップ 5 に移行 @phase4_step = 5 return end update_phase4_step4_add_atk_ex # 原物 end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示) #-------------------------------------------------------------------------- alias update_phase4_step5_add_atk_ex update_phase4_step5 def update_phase4_step5 # キーチェック終了 @add_atk_ex_check_key = false #-------- if @key_window != nil and @add_atk_ex_flg and !@key_window.disposed? @key_window.dispose end #-------- # 追尾成功 if @add_atk_ex_success # 追尾実行中に移行 $add_atk_ex_exercise = true end # ダメージ一括表示 if ADD_ATK_EX_DMG_ALL and $add_atk_ex_exercise # 追尾終了or追尾失敗 if $add_atk_ex_end or !@add_atk_ex_success $add_atk_ex_exercise = false @add_atk_ex_flg = false $add_atk_ex_end = false # ヘルプウィンドウを隠す @help_window.visible = false # ステータスウィンドウをリフレッシュ @status_window.refresh # 積算ダメージの描写 for target in @target_battlers if target.add_atk_ex_all_dmg != nil target.damage = target.add_atk_ex_all_dmg target.damage_pop = true target.add_atk_ex_all_dmg = nil # 途中で死んでたらトドメをさす if target.add_atk_ex_dead_end target.hp = 0 target.add_atk_ex_dead_end = false end end end # ステップ 6 に移行 @phase4_step = 6 return end else update_phase4_step5_add_atk_ex # 原物 end # 追尾終了or追尾失敗 if $add_atk_ex_end or !@add_atk_ex_success $add_atk_ex_exercise = false @add_atk_ex_flg = false $add_atk_ex_end = false if ADD_ATK_EX_DMG_ALL for target in @target_battlers target.add_atk_ex_all_dmg = nil if target.add_atk_ex_dead_end target.hp = 0 end end end end if $add_atk_ex_exercise @add_atk_ex_success = false # 追尾開始 @phase4_step = 2 end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias update_add_atk_ex update def update if @add_atk_ex_check_key and @add_atk_ex_flg # 追尾攻撃発動チェック if (Input.trigger?(@check_key[0]) or $add_atk_ex_set[3]) and !@one_key @one_key = true # 確率チェック if rand(100) <= $add_atk_ex_set[4] @add_atk_ex_success = true @add_atk_ex_check_key = false @add_atk_ex_count += 1 # 追尾回数チェック if (@add_atk_ex_count > $add_atk_ex_set[5]) or $add_atk_ex_end $add_atk_ex_end = true else if @add_atk_ex_count >= $add_atk_ex_set[5] @key_window.set_message("Complete!!", Color.new(255,0,0)) $add_atk_ex_complete = true else @key_window.set_message("Good!!") end # 追尾成功SEを鳴らしてみる if ADD_ATK_EX_SE != nil and !$add_atk_ex_end Audio.se_play("Audio/SE/" + ADD_ATK_EX_SE) end end end elsif Input.trigger?(@check_key[1]) or Input.trigger?(@check_key[2]) or Input.trigger?(@check_key[3]) and !@one_key $add_atk_ex_end = true @one_key = true @key_window.set_message("Bad!!") end if @one_key and $add_atk_ex_end and !@key_window.disposed? @key_window.contents_opacity -= 20 @key_window.x += 2 end end update_add_atk_ex # 原物 end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ) #-------------------------------------------------------------------------- alias update_phase4_step6_add_atk update_phase4_step6 def update_phase4_step6 @add_atk_flg = false # 追尾攻撃開始 $add_atk_exercise = false # 追尾攻撃実行中 $add_atk_end = false # 追尾攻撃終了 @add_atk_check_key = false # 追尾判定実行中 @add_atk_success = false # 追尾成功 @add_atk_count = 0 # 追尾数カウント $add_atk_first = true # 初期フラグ $add_atk_set = [] update_phase4_step6_add_atk end end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler include Add_attack_ex attr_accessor :add_atk_ex_all_dmg # 積算ダメージ attr_accessor :add_atk_ex_dead_end # 死亡フラグ attr_accessor :one_critical # クリティカルフラグ(一括表示用) #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_skill_add_atk_ex initialize def initialize initialize_skill_add_atk_ex @add_atk_ex_all_dmg = nil @add_atk_ex_dead_end = false @one_critical = false end #-------------------------------------------------------------------------- # ● 通常攻撃の効果適用 # attacker : 攻撃者 (バトラー) #-------------------------------------------------------------------------- alias attack_effect_addition attack_effect def attack_effect(attacker) if $add_atk_ex_exercise # クリティカルフラグをクリア self.critical = false # 基本ダメージを計算 atk = [attacker.atk * $add_atk_ex_set[1]/100 - self.pdef / 2, 0].max self.damage = atk * (20 + attacker.str) / 20 # 属性修正 self.damage *= elements_correct(attacker.element_set) self.damage /= 100 # ダメージの符号が正の場合 if self.damage > 0 # クリティカル修正 if rand(100) < 4 * attacker.dex / self.agi self.damage *= 2 self.critical = true self.one_critical = true end # 防御修正 if self.guarding? self.damage /= 2 end end # 分散 if self.damage.abs > 0 amp = [self.damage.abs * 15 / 100, 1].max self.damage += rand(amp+1) + rand(amp+1) - amp end # 第二命中判定 eva = 8 * self.agi / attacker.dex + self.eva hit = self.damage < 0 ? 100 : 100 - eva hit = self.cant_evade? ? 100 : hit hit_result = (rand(100) < hit) # 命中の場合 if hit_result == true # ステート衝撃解除 remove_states_shock # HP からダメージを減算 self.hp -= self.damage # ステート変化 @state_changed = false states_plus(attacker.plus_state_set) states_minus(attacker.minus_state_set) # ミスの場合 else # ダメージに "Miss" を設定 self.damage = "Miss" # クリティカルフラグをクリア self.critical = false end else attack_effect_addition(attacker) # 原物 end if self.dead? # こいつはもう死んでいる @add_atk_ex_dead_end = true # ダメージ一括表示 if ADD_ATK_EX_DMG_ALL and ($add_atk_ex_exercise or $add_atk_ex_first) # とりあえず生かしておく self.hp = 1 else $add_atk_ex_end = true end end # ダメージ一括表示ならダメージの蓄積 if ADD_ATK_EX_DMG_ALL and self.damage != "Miss" and $add_atk_ex_exercise @add_atk_ex_all_dmg = (@add_atk_ex_all_dmg == nil ? 0 : @add_atk_ex_all_dmg) @add_atk_ex_all_dmg += self.damage self.damage = nil elsif ADD_ATK_EX_DMG_ALL and self.damage != "Miss" and $add_atk_ex_first @add_atk_ex_all_dmg = (@add_atk_ex_all_dmg == nil ? 0 : @add_atk_ex_all_dmg) @add_atk_ex_all_dmg += self.damage $add_atk_ex_first = false else # ダメージミスなら終了 if ADD_ATK_EX_MISS and self.damage == "Miss" $add_atk_ex_end = true $add_atk_ex_complete = true if ADD_ATK_EX_DMG_ALL and @add_atk_ex_all_dmg == nil @add_atk_ex_all_dmg = "Miss" end end end # メソッド終了 return true end end class Window_AddAtkEx < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(480, 120, 160, 100) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 end def set_key(key) self.contents.clear self.contents.font.size = 32 self.contents.draw_text(50, 0, self.width, self.height, key) end def set_message(message, color = normal_color) self.contents.clear self.contents.font.size = 24 self.contents.font.color = color self.contents.draw_text(0, 0, self.width, self.height, message,1) end end