# ▼▲▼ XRXS37. 特殊効果詰め合わせ ActionEX ver.1.9 ▼▲▼ built 220918 # ▼▲▼ XRXS66. イミディエイト・ダメージ ▼▲▼ # by 桜雅 在土 (基本) # Tetra-Z (修正) #============================================================================== # ▽ カスタマイズポイント #============================================================================== module XRXS37 ALL_HIT = true # 相手のHPが0でもヒット回数が残る限り攻撃するか ALL_ACT = true # 相手のHPが0でも行動回数が残る限り攻撃するか ALL_DERIVER = true # 相手のHPが0でも派生が残る限り攻撃するか end #============================================================================== # ■ RPG::Sprite #============================================================================== module RPG class Sprite < ::Sprite def hit(id = nil) if @_animation_hit.is_a?(Array) return @_animation_hit[id] else return @_animation_hit end end def hit_change(id, value) if @_animation_hit.is_a?(Array) return @_animation_hit[id] = value else return @_animation_hit = value end end end end #============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● HP の描画 #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 144) # 文字列 "HP" を描画 self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, $data_system.words.hp) # MaxHP を描画するスペースがあるか計算 if width - 32 >= 108 hp_x = x + width - 108 flag = true elsif width - 32 >= 48 hp_x = x + width - 48 flag = false end # HP を描画 hp = actor.hp.round self.contents.font.color = hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color self.contents.draw_text(hp_x, y, 48, 32, hp.to_s, 2) # MaxHP を描画 if flag self.contents.font.color = normal_color self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1) self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s) end end end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :sprite # バトラースプライト attr_accessor :total_damage # トータルダメージ(計算用) attr_reader :t_immortal # 簡易不死身フラグ attr_accessor :index2 # 対象アニメーションのインデックス #-------------------------------------------------------------------------- # ● セットアップ # actor_id : アクター ID #-------------------------------------------------------------------------- alias :xrxs37_initialize :initialize def initialize xrxs37_initialize @t_immortal = false @total_damage = 0 @index2 = 0 end #-------------------------------------------------------------------------- # ● HP の変更 # hp : 新しい HP #-------------------------------------------------------------------------- def hp=(hp) if $scene.class.method_defined?("dead_ok?") and not $scene.dead_ok? and not @t_immortal @t_immortal = true end @hp = [[hp, maxhp].min, 0].max # 許可されている場合、戦闘不能を付加または解除 for i in 1...$data_states.size if $data_states[i].zero_hp if self.dead? add_state(i) else remove_state(i) end end end end #-------------------------------------------------------------------------- # ● 簡易不死身フラグの設定 #-------------------------------------------------------------------------- def t_immortal=(bool) @t_immortal = bool # 許可されている場合、戦闘不能を付加または解除 for i in 1...$data_states.size if $data_states[i].zero_hp if self.dead? add_state(i) else remove_state(i) end end end end #-------------------------------------------------------------------------- # ● 存在判定 #-------------------------------------------------------------------------- def exist? return (not @hidden and not dead?) end #-------------------------------------------------------------------------- # ● 戦闘不能判定 #-------------------------------------------------------------------------- alias :xrxs37_dead? :dead? def dead? return (xrxs37_dead? and not @t_immortal) end end #============================================================================== # ■ Sprite_Battler #============================================================================== class Sprite_Battler < RPG::Sprite #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias :xrxs37_update :update def update xrxs37_update if @battler != nil @battler.sprite = self end end end class Scene_Battle #-------------------------------------------------------------------------- # ● バトル終了 #-------------------------------------------------------------------------- def battle_end(result) @active_battler = nil # 溜めを解除 for actor in $game_party.actors actor.current_action.cast_duration = 0 # スプライトの関連を解除 actor.sprite = nil end # 呼び戻す xrxs37_battle_end(result) end #-------------------------------------------------------------------------- # ● 基本アクション 結果作成 #-------------------------------------------------------------------------- def make_basic_action_result # 攻撃の場合 if @active_battler.current_action.basic == 0 # 武器IDの取得 @weapon_id = @active_battler.class.method_defined?("weapon_id") ? @active_battler.weapon_id : -1 # 使用する武器の特殊効果の取得 @active_battler.current_action.set_xrxs37_special_effect(@active_battler.equip_element_set) # 特殊効果:行動回数 @phase4_act_times_max = @active_battler.current_action.move_times @phase4_act_times_max = 1 if @phase4_act_times_max == 0 # 0は1にする # 特殊効果:ヒット回数 @phase4_hit_times_max = @active_battler.current_action.hit_times @phase4_hit_times_max = 1 if @phase4_hit_times_max == 0 # 0は1にする end # 呼び戻す xrxs37_make_basic_action_result end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション) #-------------------------------------------------------------------------- if self.class.include?(XRXS_WAIT_COUNT_PLAN) def update_phase4_step4 # 呼び戻す xrxs66_update_phase4_step4 # アニメーションの長さによって、待機フレーム数を設定 if @animation2_id > 0 and @@wait_count_plan.empty? previous_count = 0 for frame in XRXS_TIMINGS.get(@animation2_id) next_count = frame * 2 - previous_count if next_count > 0 @@wait_count_plan.push(next_count) end previous_count = frame end @@wait_count_plan_enable = true end # ウェイトカウント予約をが空でないならシフト @wait_count = @@wait_count_plan.shift unless @@wait_count_plan.empty? end end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示) #-------------------------------------------------------------------------- def update_phase4_step5 # ステータスウィンドウをリフレッシュ @status_window.refresh # ダメージ表示 for target in @target_battlers if target.damage != nil target.damage_pop = true # ヒット変更 hit = (target.damage != "Miss") target.sprite.hit_change(target.index2, hit) end if target.damage.is_a?(Numeric) target.total_damage += target.damage end end # ステップ 6 に移行 @phase4_step = 6 # まずは今回のターゲットを保存 @total_target_battlers += @target_battlers # 連続行動を判定 xrxs37_continuous_action_check # ステップ 6 へ行く場合は総ターゲットを復帰 if @phase4_step == 6 for target in @total_target_battlers.uniq if target.is_a?(Game_Enemy) percent = target.total_damage * 100 / target.maxhp if target.class.method_defined?("overkill") if target.over[0] > 0 and target.over[0] < percent if target.hp <= 0 target.overkill = true unless target.damage_pop target.sprite.damage("", false, true) end end end end end target.total_damage = 0 end @target_battlers = @total_target_battlers end end #-------------------------------------------------------------------------- # ○ 連続行動を判定 (「ヒット回数」「行動回数」「派生」) #-------------------------------------------------------------------------- def xrxs37_continuous_action_check # ターゲットらの判定 target_still_left = false for target in @target_battlers # 戦闘不能による「ため」のキャンセル if target.dead? and target.current_action.cast_duration >= 0 target.current_action.cast_duration = 0 end # 生存判定 target_still_left |= !target.dead? end # # [ヒット回数] # @phase4_hit_times += 1 if target_still_left and @phase4_hit_times < @phase4_hit_times_max @phase4_step = 2 return end # 生存確認 (@target_battlersが変更) target_still_left |= target_battlers_still_arive? # # [行動回数] # @phase4_act_times += 1 if target_still_left and @phase4_act_times < @phase4_act_times_max # 指定行動回数に満たない場合は繰り返す為、ステップ 2 に移行 @phase4_step = 2 @wait_count = 0 @phase4_hit_times = 0 return else # ヘルプウィンドウを隠す @help_window.visible = false end # # 「派生」 # # 属性配列を取得 set = [] case @active_battler.current_action.kind when 0 if @active_battler.current_action.basic == 0 if Game_Battler.method_defined?("multy_element_set") set = @active_battler.multy_element_set else set = @active_battler.equip_element_set end end when 1 set = @active_battler.skill_element_set(@skill) end # ステート異常の場合は属性をクリア set.clear if @active_battler.restriction >= 2 # 派生 ID を取得 @derive_skill_id = -1 amounts = XRXS.element_numbers(set, XRXS37::DERIVER) for derive_id in amounts if @active_battler.skill_can_use?(derive_id) @derive_skill_id = derive_id break end end # 実行!! if @derive_skill_id >= 0 # クリア @phase4_act_times = 0 @phase4_act_times_max = 1 @phase4_hit_times = 0 @phase4_hit_times_max = 1 # 武器攻撃ではなくなった時 @weapon_id を nil 化 if @derive_skill_id > 0 @weapon_id = nil else @weapon_id = @active_battler.weapon_id end # 新しいスキルID @active_battler.current_action.kind = 1 @active_battler.current_action.skill_id = @derive_skill_id set_target_battlers($data_skills[@derive_skill_id].scope) # ターゲットがいる場合はステップ 2 に移行 if @target_battlers.size >= 1 @phase4_step = 2 @wait_count = 0 end else # 全員を一時的に不死身にして対処 ($game_party.actors + $game_troop.enemies).each{|target| if target.t_immortal target.t_immortal = target.immortal end} end end #-------------------------------------------------------------------------- # ○ 戦闘不能を許可するか #-------------------------------------------------------------------------- def dead_ok? if @phase4_hit_times.is_a?(Numeric) if XRXS37::ALL_HIT if XRXS37::ALL_ACT or XRXS37::ALL_DERIVER return false if @phase4_hit_times < @phase4_hit_times_max else return (@phase4_hit_times < @phase4_hit_times_max) end end if XRXS37::ALL_ACT if XRXS37::ALL_DERIVER return false if @phase4_act_times < @phase4_act_times_max else return (@phase4_act_times < @phase4_act_times_max) end end if XRXS37::ALL_DERIVER return false if @derive_skill_id >= 0 end end return true end end