47 lines
1.7 KiB
Ruby
47 lines
1.7 KiB
Ruby
|
|
|
|
#==============================================================================
|
|
# ■ 先制スイッチ1
|
|
# @version 0.1 12/01/22
|
|
# @author さば缶
|
|
#------------------------------------------------------------------------------
|
|
# 戦闘の先制、不意打ちをスイッチで制御します
|
|
#==============================================================================
|
|
module Saba
|
|
module Preemptive
|
|
PREEMPTIVE_SWITCH = 129 # このスイッチがONだと先制
|
|
SURPRISE_SWITCH = 130 # このスイッチがONだと不意打ち
|
|
end
|
|
end
|
|
|
|
class << BattleManager
|
|
include Saba::Preemptive
|
|
#--------------------------------------------------------------------------
|
|
# ● セットアップ
|
|
#--------------------------------------------------------------------------
|
|
alias saba_preemptive_setup setup
|
|
def setup(troop_id, can_escape = true, can_lose = false)
|
|
saba_preemptive_setup(troop_id, can_escape, can_lose)
|
|
setup_preemptive_switch
|
|
end
|
|
#--------------------------------------------------------------------------
|
|
# ● エンカウント時の処理
|
|
#--------------------------------------------------------------------------
|
|
alias saba_preemptive_on_encounter on_encounter
|
|
def on_encounter
|
|
saba_preemptive_on_encounter
|
|
setup_preemptive_switch
|
|
end
|
|
#--------------------------------------------------------------------------
|
|
# ○ スイッチによる先制、不意打ちの設定
|
|
#--------------------------------------------------------------------------
|
|
def setup_preemptive_switch
|
|
if $game_switches[PREEMPTIVE_SWITCH]
|
|
@preemptive = true
|
|
@surprise = false
|
|
elsif $game_switches[SURPRISE_SWITCH]
|
|
@preemptive = false
|
|
@surprise = true
|
|
end
|
|
end
|
|
end
|