TheoAllen

BattleManager+ Encounter Control

Aug 23rd, 2014
522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.76 KB | None | 0 0
  1. #==============================================================================
  2. # ■ BattleManager
  3. #------------------------------------------------------------------------------
  4. #  戦闘の進行を管理するモジュールです。
  5. #=============================================================================
  6. module BattleManager
  7.   #--------------------------------------------------------------------------
  8.   # ● インスタンスの複製
  9.   #--------------------------------------------------------------------------
  10.   instance_eval {alias ums_specific_event_battle_battle_start
  11.     battle_start}
  12.   instance_eval {alias ums_specific_event_battle_make_escape_ratio
  13.     make_escape_ratio}
  14.   #--------------------------------------------------------------------------
  15.   # ● 戦闘開始
  16.   #--------------------------------------------------------------------------
  17.   def self.battle_start
  18.     if @event_proc
  19.       if $game_system.force_surprise_event
  20.         @surprise = 100
  21.         $game_system.force_surprise_event = false
  22.       elsif $game_system.force_preemptive_event
  23.         @preemptive = 100
  24.         $game_system.force_preemptive_event = false
  25.       elsif $game_system.same_on_encounter
  26.         on_encounter
  27.         $game_system.same_on_encounter = false
  28.       end
  29.     end
  30.     ums_specific_event_battle_battle_start
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 逃走成功率の作成
  34.   #--------------------------------------------------------------------------
  35.   def self.make_escape_ratio
  36.     if $game_system.force_escape_event
  37.       $game_system.force_escape_event = false
  38.       @escape_ratio = 100
  39.       return
  40.     end
  41.     ums_specific_event_battle_make_escape_ratio
  42.   end
  43. end
  44. #==============================================================================
  45. # ■ Game_System
  46. #------------------------------------------------------------------------------
  47. #  システム周りのデータを扱うクラスです。セーブやメニューの禁止状態などを保存
  48. # します。このクラスのインスタンスは $game_system で参照されます。
  49. #==============================================================================
  50. class Game_System
  51.   alias ums_specific_event_battle_initialize initialize
  52.   #--------------------------------------------------------------------------
  53.   # ● 公開インスタンス変数
  54.   #--------------------------------------------------------------------------
  55.   attr_accessor :force_preemptive_event
  56.   attr_accessor :force_surprise_event
  57.   attr_accessor :same_on_encounter
  58.   attr_accessor :force_escape_event
  59.   #--------------------------------------------------------------------------
  60.   # ● オブジェクト初期化
  61.   #--------------------------------------------------------------------------
  62.   def initialize
  63.     ums_specific_event_battle_initialize
  64.     @force_preemptive_event = false
  65.     @force_surprise_event = false
  66.     @same_on_encounter = false
  67.     @force_escape_event = false
  68.   end
  69. end
  70. #==============================================================================
  71. # ■ Game_Interpreter
  72. #------------------------------------------------------------------------------
  73. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  74. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  75. #==============================================================================
  76. class Game_Interpreter
  77.   #--------------------------------------------------------------------------
  78.   # ● 次のイベント戦を必ず先制攻撃にする
  79.   #--------------------------------------------------------------------------
  80.   def next_preemptive(value = true)
  81.     $game_system.force_preemptive_event = value
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 次のイベント戦を必ず不意打ちにする
  85.   #--------------------------------------------------------------------------
  86.   def next_surprise(value = true)
  87.     $game_system.force_surprise_event = value
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● 次のイベント戦にて、先制攻撃か不意打ちを“起こり得る”ようにする
  91.   #--------------------------------------------------------------------------
  92.   def next_same_on_encount(value = true)
  93.     $game_system.same_on_encounter = value
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 次のイベント戦を必ず逃走成功にする
  97.   #--------------------------------------------------------------------------
  98.   def next_surely_escape(value = true)
  99.     $game_system.force_escape_event = value
  100.   end
  101. end
Advertisement
Add Comment
Please, Sign In to add comment