lunariafantasia/Scripts/_.29.rb
2024-01-12 03:12:38 -06:00

107 lines
No EOL
4.9 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ■ RGSS3 エンカウント条件 Ver2.01 by 星潟
#------------------------------------------------------------------------------
# ランダムエンカウント時、敵グループに対してエンカウント条件を付けます。
# 条件を満たさない敵グループはエンカウント対象から除外されます。
# どのタイミングで除外されるかをご利用の他スクリプトに合わせて
# 2パターンのどちらかで指定できます。
#------------------------------------------------------------------------------
# マップのメモ欄で指定。
#------------------------------------------------------------------------------
# <エンカウント条件:1,$game_switches[10]>
#
# スイッチID10がONの場合のみ敵グループID1のエンカウントが有効。
#------------------------------------------------------------------------------
# <エンカウント条件:2,!$game_switches[15]>
#
# スイッチID15がOFFの場合のみ敵グループID2のエンカウントが有効。
#------------------------------------------------------------------------------
# <エンカウント条件:3,$game_variables[20]>=10>
#
# 変数ID20が10以上の場合のみ敵グループID3のエンカウントが有効。
#------------------------------------------------------------------------------
# <エンカウント条件:4,$game_variables[25]==30>
#
# 変数ID25が30の場合のみ敵グループID4のエンカウントが有効。
#------------------------------------------------------------------------------
# <エンカウント条件:5,!$game_player.normal_walk?>
#
# 徒歩ではない場合のみ敵グループID5のエンカウントが有効。
#------------------------------------------------------------------------------
# <エンカウント条件:6,$game_player.in_boat?>
#
# 小型船に乗っている場合のみ敵グループID6のエンカウントが有効。
#------------------------------------------------------------------------------
# <エンカウント条件:7,$game_player.in_ship?>
#
# 大型型船に乗っている場合のみ敵グループID7のエンカウントが有効。
#------------------------------------------------------------------------------
# <エンカウント条件:8,$game_player.in_boat?or$game_player.in_ship?>
#
# 大型型船に乗っている場合のみ敵グループID8のエンカウントが有効。
#------------------------------------------------------------------------------
# evalを用いた判定の為、工夫すれば上記以外の様々な要素でも判定できます。
#==============================================================================
module ENCOUNT_CONDITION
#エンカウント条件リスト設定用のキーワードを指定します。
Word = "エンカウント条件"
#エンカウント条件の処理位置を指定。
#trueの時、エンカウントリージョン判定の際。
#falseの時、エンカウントリスト取得の際。
Type = true
end
if ENCOUNT_CONDITION::Type
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# エンカウント項目の採用可能判定
#--------------------------------------------------------------------------
alias encounter_ok_encount_condition? encounter_ok?
def encounter_ok?(encounter)
c = $game_map.encount_conditions[encounter.troop_id]
return false if c && !eval(c)
encounter_ok_encount_condition?(encounter)
end
end
else
class Game_Map
#--------------------------------------------------------------------------
# エンカウントリストの取得
#--------------------------------------------------------------------------
alias encounter_list_conditions encounter_list
def encounter_list
encounter_list_conditions.select {|encounter|
c = encount_conditions[encounter.troop_id]
c ? eval(c) : true}
end
end
end
class Game_Map
#--------------------------------------------------------------------------
# エンカウント条件リストの取得
#--------------------------------------------------------------------------
def encount_conditions
@map.encount_conditions
end
end
class RPG::Map
#--------------------------------------------------------------------------
# エンカウント条件リストの取得
#--------------------------------------------------------------------------
def encount_conditions
@encount_conditions ||= create_encount_conditions
end
#--------------------------------------------------------------------------
# エンカウント条件リストの作成
#--------------------------------------------------------------------------
def create_encount_conditions
h = {}
note.each_line {|l|
h[$1.to_i] = $2.to_s if /<#{ENCOUNT_CONDITION::Word}[:](\S+),(\S+)>/ =~ l}
h
end
end