XP 스크립트

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆毎ターン自動回復 - KGC_AutoRecover◆
#_/----------------------------------------------------------------------------
#_/  毎ターンHP/SPを自動回復する機能を追加します。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================

module KGC
  # ◆回復タイミング
  #  0..行動後  1..パーティコマンド開始時
  #  ※≪Active Count Battle≫使用時は 0 しか使用できません。
  AR_RECOVER_TIMING = 0
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["AutoRecover"] = true

if $game_special_states == nil
  $game_special_states = {}
  $data_states = load_data("Data/States.rxdata")
end
# 毎ターン回復ステート
$game_special_states["auto_recover"] = /(HP|SP)?回復(d+)(%|%)?/i

#==============================================================================
# ■ Scene_Battle (分割定義 2)
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● パーティコマンドフェーズ開始
  #--------------------------------------------------------------------------
  alias start_phase2_KGC_AutoRecover start_phase2
  def start_phase2
    @last_turn = $game_temp.battle_turn if @last_turn == nil
    if KGC::AR_RECOVER_TIMING == 1 && $game_temp.battle_turn != @last_turn
      @last_turn = $game_temp.battle_turn
      ($game_party.actors + $game_troop.enemies).each { |battler|
        apply_auto_recover(battler)
      }
      # ステータスウィンドウをリフレッシュ
      @status_window.refresh
    end

    start_phase2_KGC_AutoRecover
  end
  #--------------------------------------------------------------------------
  # ● 自動回復適用
  #--------------------------------------------------------------------------
  def apply_auto_recover(battler)
    # ステート判定
    battler.states.compact.each { |state|
      # 毎ターン回復ステート判定
      next unless $game_special_states["auto_recover"] =~ $data_states[state].name
      # 回復量を取得
      recover = $2.to_i
      # 回復するパラメータで分岐
      if $1 != nil
        case $1.upcase
        when "HP"  # HPだけの場合
          recover_hp = $3 != nil ? battler.maxhp * recover / 100 : recover
        when "SP"  # SPだけの場合
          recover_sp = $3 != nil ? battler.maxsp * recover / 100 : recover
        end
      else  # HP/SP両方の場合
        if $3 != nil
          recover_hp = battler.maxhp * recover / 100
          recover_sp = battler.maxsp * recover / 100
        else
          recover_hp = recover
          recover_sp = recover
        end
      end
      # 回復処理
      battler.hp += recover_hp if recover_hp != nil
      battler.sp += recover_sp if recover_sp != nil
      # HP回復値が設定されている場合
      if recover_hp != nil && recover_hp > 0
        battler.damage = -recover_hp
        if $imported["SPDamage"] && recover_sp != nil
          if battler.sp_damage != nil
            battler.sp_damage -= recover_sp
          else
            battler.sp_damage = -recover_sp
          end
        end
        battler.damage_pop = true
      # SP回復値のみ設定されている場合
      elsif recover_sp != nil && recover_sp > 0
        battler.damage = nil
        if $imported["SPDamage"]
          if battler.sp_damage != nil
            battler.sp_damage -= recover_sp
          else
            battler.sp_damage = -recover_sp
          end
        else
          battler.damage = "#{$data_system.words.sp}+ #{recover_sp}"
        end
        battler.damage_pop = true
      end
    }
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Battle (分割定義 4)
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  #--------------------------------------------------------------------------
  alias update_phase4_step6_KGC_AutoRecover update_phase4_step6
  def update_phase4_step6
    update_phase4_step6_KGC_AutoRecover

    # 行動者が生存している場合
    if KGC::AR_RECOVER_TIMING == 0 && !@active_battler.dead?
      # 自動回復
      apply_auto_recover(@active_battler)
      # ステータスウィンドウをリフレッシュ
      @status_window.refresh if @active_battler.damage_pop
    end
  end
end



행동 후에 HP/SP를 자동 회복하는 스크립트입니다.
스테이트를 사용하므로, 간단하게 설정 을 할 수가 있습니다.

스크립트가 완료하면, 스테이트를 작성합니다.
스테이트는[저항하지 않는]을 체크해,[레이팅]을 0 으로 해 두어 주세요.
그 외의 설정은 뭐든지 상관하지 않습니다.

스테이트의 서식은
 "[HP|SP]회복{회복량}[%|%]"
입니다.({ }는 수치,[ ]는 생략 가능.그 이외는 필수)

최초의 [HP|SP] 는
「"HP"또는"SP"를 기술, 혹은 생략」이라고 하는 의미입니다.
"HP"라면 HP를,"SP"라면 SP를, 생략 하면 HP/SP양쪽 모두를 회복합니다.

{회복량}[%|%] 에는, HP/SP의 회복량을 입력합니다.
이 때"%"를 생략 하면, 입력한 값이 그대로 회복량이 됩니다.
"%"는 전각에서도 반각에서도 OK입니다.

  기술예
SP회복 5% … 매턴 SP 를 5% 회복.
회복 300 … 매턴 HP/SP 를 300 회복.

그리고는, 전투중에 스테이트를 부가하면 완료입니다.
항상 효과를 적용하고 싶은 경우는, 로드시나 전투 개시시에 스테이트를 부가해 주면 OK입니다.
(잘 모르는 경우는 턴 0의 배틀 이벤트로 부가해 주세요)

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6189
34 전투 KGC_RateDamage(비율 데미지) 3 file 백호 2009.02.22 1656
33 전투 KGC_RankConception(대열 개념) file 백호 2009.02.22 1719
32 전투 KGC_RandomTarget(랜덤 타겟) 1 file 백호 2009.02.22 1499
31 전투 KGC_PreempAttack(선제공격) file 백호 2009.02.22 1406
30 전투 KGC_OverDrive(오버 드라이브) 3 file 백호 2009.02.22 2551
29 전투 KGC_GuardRecover(방어시 HP회복) 4 백호 2009.02.22 1348
28 전투 KGC_FusionEnemy(에너미 융합) 1 백호 2009.02.22 1660
27 전투 KGC_DamageAlter(데미지 표시 개조) 8.24 14 file 백호 2009.02.22 3157
26 전투 KGC_BonusGauge (보너스게이지) 3 file 백호 2009.02.22 2765
25 전투 KGC_BattlerEffect(버틀러 효과) 2 file 백호 2009.02.22 1959
» 전투 KGC_AutoRecover(매턴 자동 회복) 1 백호 2009.02.22 1430
23 전투 KGC_Active Count Battle (7/30일자) 7 file 백호 2009.02.22 1846
22 전투 GubiD's Tactical Battle System 1.5.1.4 (RMXP용) GTBS 2 Alkaid 2010.09.03 2456
21 전투 GTBS 1.4 스크립트 9 아방스 2009.02.05 3028
20 전투 FFX, X-2, FFXII 식으로 대미지 표시하기 by squall@rmxp.org 백호 2009.02.22 1115
19 전투 FF10 전투 대미지 공식 by hydro@rmxp.org 백호 2009.02.22 1141
18 전투 Etude87_Custom_Slip_Damage_XP ver.1.0 5 습작 2012.08.26 1857
17 전투 DerVVulfman's addons for Mr.Mo's ABS file Alkaid 2010.09.10 1645
16 전투 Custom Debugger, Battle Debugger by RPG Advocate file 백호 2009.02.22 1248
15 전투 CTB by Charlie Fleed 3.2 - FF10 스타일의 전투 시스템 7 Alkaid 2010.10.14 3450
Board Pagination Prev 1 2 3 4 5 6 7 8 9 Next
/ 9