#============================================================================== # ■ XP-RGSS-18 スキルBP制 [Ver.2.3.3] by Claimh #------------------------------------------------------------------------------ #・戦闘時にBP(バトルポイント)を消費させてスキルを発動させます(アクターのみ) #・BPは各アクターごとに異なり、戦闘中は毎ターン回復します。 #・戦闘中にBPが不足している状態ではスキルを使用できません。 #・BPの初期値、最大値、回復値等はレベル上昇に従い変化します。 # ※アイコン表示を使用する場合 # ・アイコン用の画像ファイルはGraphics/Iconsにインポートしてください # ・スペースの関係上、最大値、回復値は表示しません # ・デフォルトアイコンでは5個ぐらいしか表示できませんので…ご注意を #------------------------------------------------------------------------------ # 【再定義】 # Game_Battler#skill_can_use? # Scene_Battle#make_skill_action_result #============================================================================== module SysSkill_BP #============================================================================== # カスタマイズSTART #============================================================================== # 戦闘中はSP消費を使用する BATTLE_SP_USE = true # true:SP消費とBP消費 # false:BP消費のみ # BP用のウィンドウを表示させる? WINDOW_BP_USE = true # true:表示する false:表示しない # 現在のBP値をアイコン表示させる USE_BP_ICON = false # true:アイコン表示にする # ※BP最大値、BP回復値は表示されません # false:テキスト表示にする # ※現在のBP、BP最大値、BP回復値を表示します # 表示するアイコンのファイル名(アイコン表示にしない場合は設定不要) BP_ICON = "036-Item05" # 各スキルの消費BP設定 # (注)設定が場合は全て1になります。 SKILL_BP = { # スキルID => 消費BP 1 => 2, 2 => 5, 3 =>7, 4 => 2, 5 => 5, 6 => 5, 7 => 2, 8 => 4, 9 => 6, 10 => 2, 11 => 4, 12 => 6, 13 => 2, 14 => 4, 15 => 6, 16 => 2, 17 => 4, 18 => 6, 19 => 2, 20 => 4, 21 => 6, 22 => 2, 23 => 4, 24 => 6, 25 => 2, 26 => 4, 27 => 6, 28 => 2, 29 => 4, 30 => 6, 31 => 3, 32 => 7, 33 => 1, 34 => 4, 35 => 1, 36 => 4, 37 => 1, 38 => 4, 39 => 1, 40 => 4, 41 => 1, 42 => 4, 43 => 1, 44 => 4, 45 => 1, 46 => 4, 47 => 1, 48 => 4, 49 => 1, 50 => 4, 51 => 1, 52 => 4, 53 => 3, 54 => 3, 55 => 3, 56 => 3, 57 => 2, 58 => 4, 59 => 6, 60 => 9, 61 => 2, 62 => 4, 63 => 6, 64 => 9, 65 => 2, 66 => 4, 67 => 6, 68 => 9, 69 => 2, 70 => 4, 71 => 6, 72 => 9, 73 => 2, 74 => 4, 75 => 6, 76 => 9, 77 => 2, 78 => 4, 79 => 6, 80 => 9 } # 各アクターごとのBP初期値設定 ACT_BP = { # アクターID => [BP初期値, BP最大値, BP回復値] 1 => [0, 10, 3], 2 => [4, 9, 4], 3 => [2, 13, 3], 4 => [4, 9, 2], 5 => [2, 10, 4], 6 => [3, 10, 2], 7 => [4, 12, 3], 8 => [4, 15, 2] } # BP初期値を上昇させるレベルを設定 ACT_INIT_BP_LVUP = { # アクターID => [レベル,レベル・・・] 1 => [5,10,15,25,30,40], 2 => [5,10,15,25,30,40], 3 => [5,10,15,25,30,40], 4 => [5,10,15,25,30,40], 5 => [5,10,15,25,30,40], 6 => [5,10,15,25,30,40], 7 => [5,10,15,25,30,40], 8 => [5,10,15,25,30,40] } # BP最大値を上昇させるレベルを設定 ACT_MAX_BP_LVUP = { # アクターID => [レベル,レベル・・・] 1 => [5,10,15,25,30,40], 2 => [5,10,15,25,30,40], 3 => [5,10,15,25,30,40], 4 => [5,10,15,25,30,40], 5 => [5,10,15,25,30,40], 6 => [5,10,15,25,30,40], 7 => [5,10,15,25,30,40], 8 => [5,10,15,25,30,40] } # BP回復値を上昇させるレベルを設定 ACT_REST_BP_LVUP = { # アクターID => [レベル,レベル・・・] 1 => [5,10,15,25,30,40], 2 => [5,10,15,25,30,40], 3 => [5,10,15,25,30,40], 4 => [5,10,15,25,30,40], 5 => [5,10,15,25,30,40], 6 => [5,10,15,25,30,40], 7 => [5,10,15,25,30,40], 8 => [5,10,15,25,30,40] } #============================================================================== # カスタマイズEND #============================================================================== module_function # 消費BP取得 : SysSkill_BP.bp_cost(skill_id) def bp_cost(skill_id) return SKILL_BP[skill_id].nil? ? 1 : SKILL_BP[skill_id] end end class Game_Actor attr_accessor :bp # BP attr_accessor :init_bp # BP初期値 attr_accessor :max_bp # BP最大値 attr_accessor :rest_bp # BP回復値 #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor_id : アクター ID #-------------------------------------------------------------------------- alias initialize_use_limit initialize def initialize(actor_id) initialize_use_limit(actor_id) act_bp = SysSkill_BP::ACT_BP[actor_id] @bp = act_bp[0] @init_bp = act_bp[0] @max_bp = act_bp[1] @rest_bp = act_bp[2] end #-------------------------------------------------------------------------- # ● BP の変更 # bp : 新しい BP #-------------------------------------------------------------------------- def bp=(bp) @bp = [[bp, @max_bp].min, 0].max end #-------------------------------------------------------------------------- # ● EXP の変更 # exp : 新しい EXP #-------------------------------------------------------------------------- alias exp_bp exp= def exp=(exp) cp_level = @level # EXP獲得以前のレベルをコピー exp_bp(exp) # 原物 # レベルアップ/レベルダウンによるBPパラメータ再設定 if cp_level < @level # レベルアップ counter_num = 1 elsif cp_level > @level # レベルダウン counter_num = -1 else # レベル変化なし return end # BPパラメータの変化するレベルになった場合、BPパラメータを変化させる for lv_index in cp_level...@level # 戦闘開始時BP if SysSkill_BP::ACT_INIT_BP_LVUP[self.id].include?(lv_index) @init_bp += counter_num end # BP最大値 if SysSkill_BP::ACT_MAX_BP_LVUP[self.id].include?(lv_index) @max_bp += counter_num end # BP回復値 if SysSkill_BP::ACT_REST_BP_LVUP[self.id].include?(lv_index) @rest_bp += counter_num end end end end class Game_Battler #-------------------------------------------------------------------------- # ● スキルの使用可能判定 【再定義】 # skill_id : スキル ID #-------------------------------------------------------------------------- def skill_can_use?(skill_id) flag = true if defined?(SysFlash) and SysFlash::FLASH_COST and self.flash_flg # 閃き時は SP/BPの判定はしない。 else # SP が足りない場合は使用不可 if defined?(SkillUpdate) and self.is_a?(Game_Actor) and SkillUpdate::SP_COST_DOWN flag = false if self.skill[skill_id].sp_cost > self.sp elsif $data_skills[skill_id].sp_cost > self.sp flag = false end if defined?(SysSkill_BP) and self.is_a?(Game_Actor) and $scene.is_a?(Scene_Battle) # SP消費なしなら一旦trueにする flag = true if !SysSkill_BP::BATTLE_SP_USE # BP が足りない場合は使用不可 flag = false if self.bp < SysSkill_BP.bp_cost(skill_id) end end return false unless flag # SP/BPが足りない # SP消費以外のその他の要因を再チェック[オリジナルからSP判定以外をコピー] # 戦闘不能の場合は使用不可 return false if dead? # 沈黙状態の場合、物理スキル以外は使用不可 return false if $data_skills[skill_id].atk_f == 0 and self.restriction == 1 # 使用可能時を取得 occasion = $data_skills[skill_id].occasion # 戦闘中の場合:[常時] または [バトルのみ] なら使用可 return (occasion == 0 or occasion == 1) if $game_temp.in_battle # 戦闘中ではない場合:[常時] または [メニューのみ] なら使用可 return (occasion == 0 or occasion == 2) end end class Scene_Battle #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- alias main_use_limit main def main # 戦闘開始時にアクターのBPを初期化 for actor in $game_party.actors actor.bp = actor.init_bp end main_use_limit end #-------------------------------------------------------------------------- # ● スキル選択開始 #-------------------------------------------------------------------------- alias start_skill_select_limit start_skill_select def start_skill_select start_skill_select_limit # BPウィンドウ作成 if SysSkill_BP::WINDOW_BP_USE @actor_bp_window = Window_Battle_Point.new(@actor_index * 160, @active_battler) end end #-------------------------------------------------------------------------- # ● スキル選択終了 #-------------------------------------------------------------------------- alias end_skill_select_limit end_skill_select def end_skill_select # BPウィンドウを解放 if SysSkill_BP::WINDOW_BP_USE @actor_bp_window.dispose @actor_bp_window = nil end end_skill_select_limit end #-------------------------------------------------------------------------- # ● スキルアクション 結果作成 #-------------------------------------------------------------------------- def make_skill_action_result enable_cnt = true # 閃き時には熟練度やスキルアップデートのカウントはしない if defined?(SysFlash) # 閃き判定(エネミー閃き時を考慮するとこのタイミング) SysFlash.skill_flash(@active_battler) enable_cnt = false if @active_battler.flash_flg end # スキルを取得 @skill = $data_skills[@active_battler.current_action.skill_id] # 強制アクションでなければ unless @active_battler.current_action.forcing # SP 切れなどで使用できなくなった場合 unless @active_battler.skill_can_use?(@skill.id) # アクション強制対象のバトラーをクリア $game_temp.forcing_battler = nil # ステップ 1 に移行 @phase4_step = 1 return end end if enable_cnt # 閃いてないときだけ。 enable_attr_lvup = true if defined?(SkillUpdate) and @active_battler.is_a?(Game_Actor) and SkillUpdate.can_update?(@active_battler) old_level = @active_battler.skill[@skill.id].level # スキル使用回数を加算 @active_battler.skill[@skill.id].use_cnt += 1 @actor_skill_lv_up = (old_level < @active_battler.skill[@skill.id].level ? true : false) enable_attr_lvup = false if @actor_skill_lv_up end if defined?(SysUpdate) and @active_battler.is_a?(Game_Actor) and enable_attr_lvup # 熟練度計算 SysUpdate.element_use_count(@active_battler, @skill.element_set) end end # SP 消費 if defined?(SysFlash) and SysFlash::FLASH_COST and @active_battler.flash_flg # 閃き時はSP消費なし elsif defined?(SysSkill_BP) and !SysSkill_BP::BATTLE_SP_USE # スキルBP制で戦闘中のSP消費なしなら何もしない elsif defined?(SkillUpdate) and SkillUpdate::SP_COST_DOWN and @active_battler.is_a?(Game_Actor) @active_battler.sp -= @active_battler.skill[@skill.id].sp_cost else # 原型 @active_battler.sp -= @skill.sp_cost end # BP消費 if defined?(SysSkill_BP) @active_battler.bp -= SysSkill_BP.bp_cost(@skill.id) end # ステータスウィンドウをリフレッシュ @status_window.refresh # ヘルプウィンドウにスキル名を表示 @help_window.set_text(@skill.name, 1) # アニメーション ID を設定 @animation1_id = @skill.animation1_id # アニメーション変化 if defined?(SkillUpdate) and SkillUpdate::USE_S_ANIME @animation2_id = SkillUpdate.skill_anime(@skill, @active_battler) else @animation2_id = @skill.animation2_id end # コモンイベント ID を設定 @common_event_id = @skill.common_event_id # 対象側バトラーを設定 set_target_battlers(@skill.scope) miss_flag = true # スキルの効果を適用 for target in @target_battlers target.skill_effect(@active_battler, @skill) miss_flag = false if target.damage != "Miss" # 一体でも命中ならOK. end if miss_flag and enable_cnt # ミス時はカウント戻す if defined?(SkillUpdate) and @active_battler.is_a?(Game_Actor) and SkillUpdate.can_update?(@active_battler) @active_battler.skill[@skill.id].use_cnt -= 1 @actor_skill_lv_up = false end if defined?(SysUpdate) and @active_battler.is_a?(Game_Actor) and enable_attr_lvup SysUpdate.element_use_recount(@active_battler, @skill.element_set) end end # スキル名表示を閃きアニメーションの後にする if defined?(SysFlash) and SysFlash::FLASH_SKILL_TEXT and @active_battler.flash_flg @help_window.visible = false # ヘルプ消去 @flash_skill_text = false # 消去したことを記憶 end end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ) #-------------------------------------------------------------------------- alias update_phase4_step6_limit update_phase4_step6 def update_phase4_step6 update_phase4_step6_limit # BP値回復 @active_battler.bp += @active_battler.rest_bp if @active_battler.is_a?(Game_Actor) end end #============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● SP の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_actor_bp(actor, x, y) # 文字列 "BP" を描画 self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, "BP") # MaxSP を描画するスペースがあるか計算 width = 144 if width - 32 >= 108 sp_x = x + width - 124 flag = true elsif width - 32 >= 48 sp_x = x + width - 48 flag = false end # BP を描画 self.contents.font.color = actor.bp == 0 ? knockout_color : actor.bp <= actor.max_bp / 4 ? crisis_color : normal_color self.contents.draw_text(sp_x, y, 36, 32, actor.bp.to_s, 2) # MaxBP を描画 if flag self.contents.font.color = normal_color self.contents.draw_text(sp_x + 36, y, 12, 32, "/", 1) self.contents.draw_text(sp_x + 48, y, 48, 32, actor.max_bp.to_s) self.contents.font.color = knockout_color self.contents.draw_text(sp_x + 72, y, 12, 32, "+", 1) self.contents.draw_text(sp_x + 84, y, 48, 32, actor.rest_bp.to_s) self.contents.font.color = normal_color end end #-------------------------------------------------------------------------- # ● BPアイコンの描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_actor_bp_icon(actor, x, y) bitmap = RPG::Cache.icon(SysSkill_BP::BP_ICON) cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) for i in 0...actor.bp self.contents.blt(x + cw - bitmap.width, y - ch + 30, bitmap, src_rect) cw += bitmap.width end end end class Window_Battle_Point < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, actor) super(x, 255, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) set_actor_bp(actor) end #-------------------------------------------------------------------------- # ● アクターBP表示 # actor : ステータスを表示するアクター #-------------------------------------------------------------------------- def set_actor_bp(actor) self.contents.clear if SysSkill_BP::USE_BP_ICON draw_actor_bp_icon(actor, 4, 0) else draw_actor_bp(actor, 4, 0) end end end