Permanent
Creation

RPGツクールXP/VX用のRGSS素材です。
一部英語版対応です。 (A few materials can be used for English RPG MAKER XP/VX.)
競合率はルファーの独断と偏見なのでたまにハズレます。


スクリーンショット
↑スクリーンショット (クリックで拡大)
#==============================================================================
# ■ 死ぬ
#------------------------------------------------------------------------------
#  アクターの HP を -1 にします。イベント演出にどうぞ。
# (C) ルファー
# WebSite  https://tkoolerlufar.pages.dev/
#==============================================================================

=begin
  =対応RGSS
  1

  =他の素材との競合の可能性
  !.. 少し低い

  =導入方法
  Window_Base より下に新セクションを作成して、
  このプログラムをそこにコピーする

  = 死んでいるときのステート文字の変更方法。
  Lufar モジュールの中の「DIE_TEXT」の右にある
  半角の「=」の右に値を入れます。
  半角の引用符('←これ)の中に任意の文字列を入力してください。
  二重引用符の中の文字列は全角でも構いません。

  = 使い方。
  イベントコマンド「スクリプト」で以下の式を入れるだけ。
  n は目的のアクターの ID です。
  * $game_actors[n].die
  ・・・死にます。
  * $game_actors[n].revive
  ・・・生き返ります。

  = 小技。
  * その1
  $game_party.actors[n].(die/revive)
  ・・・パーティの(n+1)番目のメンバーをどうこうします。
  * その2
  $game_party.actors.each { |actor|
    actor.revive
  }
  ・・・パーティ全員を生き返らせます。
  * その3
  $game_actors.each { |actor|
    actor.revive
  }
  ・・・すべてのアクターを生き返らせます。

  = 「生き返る (revive)」について
  生き返った直後の HP と SP は 25% です。

  = ほかの使い方
  死ぬ以外にも、いろいろな使い方を考えてみてください。

  = 更新履歴
  2009/06/07 公開

  =再定義しているメソッド
  Window_Base#draw_actor_state (エイリアス使用)
  Window_Base#draw_actor_hp (エイリアス使用)
  Window_Base#draw_actor_sp (エイリアス使用)

  =新規定義しているメソッド
  Game_Actor#dead?
  Game_Actor#hp0?
  Game_Actor#skill_effect
  Game_Actor#item_effect
  Game_Actor#die
  Game_Actor#revive
=end
#----------------------------------------------------------------------------
# ◇ Lufar モジュール
#----------------------------------------------------------------------------
module Lufar
  #--------------------------------------------------------------------------
  # ◆ 素材ユーザーによる設定項目 (実体は定数)
  #--------------------------------------------------------------------------
  DIE_TEXT = '゚д゚'                       # 死んでいるときのステート文字
  DIE_SHOW_HP = true                      # false にすると死亡時 HP を隠す
end
#----------------------------------------------------------------------------
# ◆ Game_Actor クラス
#----------------------------------------------------------------------------
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 戦闘不能判定
  #--------------------------------------------------------------------------
  def dead?
    return (@hp <= 0 and not @immortal)
  end
  #--------------------------------------------------------------------------
  # ● HP 0 判定
  #--------------------------------------------------------------------------
  def hp0?
    return (not @hidden and @hp <= 0)
  end
  #--------------------------------------------------------------------------
  # ● スキルの効果適用
  #     user  : スキルの使用者 (バトラー)
  #     skill : スキル
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    # クリティカルフラグをクリア
    self.critical = false
    ## スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0 以下、
    ## またはスキルの効果範囲が HP 0 の味方で、自分の HP が 0 以外の場合
    if ((skill.scope == 3 or skill.scope == 4) and self.hp <= 0) or
       ((skill.scope == 5 or skill.scope == 6) and self.hp != 0)
      # メソッド終了
      return false
    end
    super
  end
  #--------------------------------------------------------------------------
  # ● アイテムの効果適用
  #     item : アイテム
  #--------------------------------------------------------------------------
  def item_effect(item)
    # クリティカルフラグをクリア
    self.critical = false
    # アイテムの効果範囲が HP 1 以上の味方で、自分の HP が 0 以下、
    # またはアイテムの効果範囲が HP 0 の味方で、自分の HP が 0 以外の場合
    if ((item.scope == 3 or item.scope == 4) and self.hp <= 0) or
       ((item.scope == 5 or item.scope == 6) and self.hp != 0)
      # メソッド終了
      return false
    end
    super
  end
  #--------------------------------------------------------------------------
  # ○ 死ぬ
  #--------------------------------------------------------------------------
  def die
    # 戦闘不能を付加
    for i in 1...$data_states.size
      if $data_states[i].zero_hp
        add_state(i)
      end
    end
    @hp = -1
  end
  #--------------------------------------------------------------------------
  # ○ 生き返る
  #--------------------------------------------------------------------------
  def revive
    return if @hp > -1
    self.hp = self.maxhp / 4
    self.sp = self.maxsp / 4
  end
end
#----------------------------------------------------------------------------
# ◆ Window_Base クラス
#----------------------------------------------------------------------------
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● ステートの描画
  #     actor : アクター
  #     x     : 描画先 X 座標
  #     y     : 描画先 Y 座標
  #     width : 描画先の幅
  #--------------------------------------------------------------------------
  alias lufar9_old_dast draw_actor_state
  def draw_actor_state(actor, x, y, width = 120)
    if actor.hp == -1
      self.contents.font.color = knockout_color
      self.contents.draw_text(x, y, width, 32, "[#{Lufar::DIE_TEXT}]")
    else
      lufar9_old_dast(actor, x, y, width)
    end
  end
  #--------------------------------------------------------------------------
  # ● HP の描画
  #     actor : アクター
  #     x     : 描画先 X 座標
  #     y     : 描画先 Y 座標
  #     width : 描画先の幅
  #--------------------------------------------------------------------------
  alias lufar9_old_dah draw_actor_hp
  def draw_actor_hp(actor, x, y, width = 144)
    if actor.hp == -1
      # 文字列 "HP" を描画
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
      hp_x = x + width - 48
      # HP を描画
      self.contents.font.color =
        Lufar::DIE_SHOW_HP ? knockout_color : disabled_color
      self.contents.draw_text(hp_x, y, 48, 32,
        Lufar::DIE_SHOW_HP ? actor.hp.to_s : "----", 2)
    else
      lufar9_old_dah(actor, x, y, width)
    end
  end
  #--------------------------------------------------------------------------
  # ● SP の描画
  #     actor : アクター
  #     x     : 描画先 X 座標
  #     y     : 描画先 Y 座標
  #     width : 描画先の幅
  #--------------------------------------------------------------------------
  alias lufar9_old_dasp draw_actor_sp
  def draw_actor_sp(actor, x, y, width = 144)
    if actor.hp == -1
      # 文字列 "SP" を描画
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
      sp_x = x + width - 48
      # SP を描画
      self.contents.font.color =
        Lufar::DIE_SHOW_HP ? normal_color : disabled_color
      self.contents.draw_text(sp_x, y, 48, 32, "----", 2)
    else
      lufar9_old_dasp(actor, x, y, width)
    end
  end
end

戻る