# # 回復不能ステート(RGSS2) #  (C)2008 TYPE74RX-T # #-------------------------------------------------------------------------- # ★ システムワードの登録:HP回復不能、MP回復不能 #-------------------------------------------------------------------------- module RPG class State alias rx_rgss2b20_rx_extract_sys_str_from_note rx_extract_sys_str_from_note def rx_extract_sys_str_from_note rx_get_sys = RX_T.get_system_word_in_note(@note, "HP回復不能") unless rx_get_sys == "" @@rx_copy_str += rx_get_sys @note = @note.sub(rx_get_sys, "") @note = @note.sub("\r\n", "") end @rx_sys_str = @@rx_copy_str rx_get_sys = RX_T.get_system_word_in_note(@note, "MP回復不能") unless rx_get_sys == "" @@rx_copy_str += rx_get_sys @note = @note.sub(rx_get_sys, "") @note = @note.sub("\r\n", "") end @rx_sys_str = @@rx_copy_str # メソッドを呼び戻す rx_rgss2b20_rx_extract_sys_str_from_note end end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ # スのスーパークラスとして使用されます。 #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias rx_rgss2b20_initialize initialize def initialize # メソッドを呼び戻す rx_rgss2b20_initialize @rx_hp_cannot_heal = false # ★ HP回復不能フラグ @rx_mp_cannot_heal = false # ★ MP回復不能フラグ end #-------------------------------------------------------------------------- # ★ HP回復不能フラグ #-------------------------------------------------------------------------- def rx_hp_cannot_heal return @rx_hp_cannot_heal end #-------------------------------------------------------------------------- # ★ MP回復不能フラグ #-------------------------------------------------------------------------- def rx_mp_cannot_heal return @rx_mp_cannot_heal end #-------------------------------------------------------------------------- # ★ HPMP回復不能フラグ #-------------------------------------------------------------------------- def rx_hpmp_cannot_heal return @rx_hpmp_cannot_heal end #-------------------------------------------------------------------------- # ★ 回復不能判定 #-------------------------------------------------------------------------- def rx_get_cannot_heal @rx_hp_cannot_heal = false @rx_mp_cannot_heal = false for state in states @rx_hp_cannot_heal = true if state.rx_sys_str.include?("HP回復不能") @rx_mp_cannot_heal = true if state.rx_sys_str.include?("MP回復不能") end end #-------------------------------------------------------------------------- # ● 制約の取得 # 現在付加されているステートから最大の restriction を取得する。 #-------------------------------------------------------------------------- alias rx_rgss2b20_restriction restriction def restriction # ★ 回復不能判定 rx_get_cannot_heal # メソッドを呼び戻す rx_rgss2b20_restriction end #-------------------------------------------------------------------------- # ● ダメージの反映 # user : スキルかアイテムの使用者 # 呼び出し前に @hp_damage、@mp_damage、@absorbed が設定されていること。 #-------------------------------------------------------------------------- alias rx_rgss2b20_execute_damage execute_damage def execute_damage(user) # ★ HP回復不能状態なら回復値を0に @hp_damage = 0 if self.rx_hp_cannot_heal and @hp_damage < 0 # ★ MP回復不能状態なら回復値を0に @mp_damage = 0 if self.rx_mp_cannot_heal and @mp_damage < 0 # ★ HP回復不能状態の使用者には吸収を無効に。 if user.rx_hp_cannot_heal and @absorbed and @hp_damage > 0 @absorbed = false end # ★ MP回復不能状態の使用者には吸収を無効に。 if user.rx_mp_cannot_heal and @absorbed and @mp_damage > 0 @absorbed = false end # メソッドを呼び戻す rx_rgss2b20_execute_damage(user) end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● HP ダメージ表示 # target : 対象者 # obj : スキルまたはアイテム #-------------------------------------------------------------------------- alias rx_rgss2b20_display_hp_damage display_hp_damage def display_hp_damage(target, obj = nil) if target.hp_damage == 0 # ノーダメージ return if obj != nil and obj.damage_to_mp return if obj != nil and obj.base_damage == 0 # ★ HP回復不能ステートの対象に回復系のスキルまたはアイテムを使った場合 if obj != nil and obj.base_damage < 0 and target.rx_hp_cannot_heal # 「効かなかった」表示 text = sprintf(Vocab::ActionFailure, target.name) @message_window.add_instant_text(text) wait(30) return end end # メソッドを呼び戻す rx_rgss2b20_display_hp_damage(target, obj) end end