king-exit/Scripts/_.77.rb
2024-08-31 14:17:23 -05:00

96 lines
No EOL
4.1 KiB
Ruby
Raw Permalink 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 エンカウント条件 Ver1.01 by 星潟
#------------------------------------------------------------------------------
# ランダムエンカウント時、敵グループに対してエンカウント条件を付けます。
# 条件を満たさない敵グループはエンカウント対象から除外されます。
#------------------------------------------------------------------------------
# ★設定方法(全てマップのメモ欄を使用します)
#------------------------------------------------------------------------------
# ☆スイッチID10がONの場合に敵グループID1のエンカウントを有効にする場合
#
# <エンカウント条件:1,$game_switches[10]>
#------------------------------------------------------------------------------
# ☆スイッチID15がOFFの場合に敵グループID2のエンカウントを有効にする場合
#
# <エンカウント条件:2,!$game_switches[15]>
#------------------------------------------------------------------------------
# ☆変数ID20が10以上の場合に敵グループID3のエンカウントを有効にする場合
#
# <エンカウント条件:3,$game_variables[20]>=10>
#------------------------------------------------------------------------------
# ☆変数ID25が30の場合に敵グループID4のエンカウントを有効にする場合
#
# <エンカウント条件:4,$game_variables[20]==30>
#------------------------------------------------------------------------------
# ☆徒歩ではない場合に敵グループID5のエンカウントを有効にする場合
#
# <エンカウント条件:5,!$game_player.normal_walk?>
#------------------------------------------------------------------------------
# evalを用いた判定の為、工夫すれば上記以外の様々な要素でも判定できます。
#------------------------------------------------------------------------------
# Ver1.01 致命的不具合と説明文を修正しました。
#==============================================================================
module ENCOUNT_CONDITION
#エンカウント条件リスト設定用のキーワードを指定します。
WORD = "エンカウント条件"
end
class Game_Map
#--------------------------------------------------------------------------
# エンカウントリストの取得
#--------------------------------------------------------------------------
alias encounter_list_conditions encounter_list
def encounter_list
#エンカウントリストを取得し、複製する。
data = encounter_list_conditions.clone
#真のエンカウントリスト用の配列を作成する。
true_data = []
#複製したエンカウントリストをそれぞれ条件リストで判別し
#条件が設定されていないか、条件を満たした物のみ配列に加える。
data.each {|d|
next if @map.encount_seal_troop_ids[d.troop_id] != nil && !eval(@map.encount_seal_troop_ids[d.troop_id])
true_data.push(d)
}
#真のエンカウントリストを返す。
true_data
end
end
class RPG::Map
#--------------------------------------------------------------------------
# エンカウント条件リストの取得
#--------------------------------------------------------------------------
def encount_seal_troop_ids
#キャッシュがあればキャッシュを返す。
return @encount_seal_troop_ids if @encount_seal_troop_ids != nil
#エンカウント条件リストのハッシュを生成。
@encount_seal_troop_ids = {}
#マップのメモ欄からデータを取得。
self.note.each_line {|l|
data = l.scan(/<#{ENCOUNT_CONDITION::WORD}[:](\S+),(\S+)>/).flatten
#データが存在する場合のみ条件リストに加える。
@encount_seal_troop_ids[data[0].to_i] = data[1].to_s if data != nil && data.size == 2
}
#エンカウント条件リストを返す。
@encount_seal_troop_ids
end
end