Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ■ Preemptive Switch
- # @version 0.1 12/01/22
- # @author sabakan
- # @license: MIT License
- #------------------------------------------------------------------------------
- # Able to control Preemptive Strike with a switch
- #==============================================================================
- module Saba
- module Preemptive
- PREEMPTIVE_SWITCH = 79 # If this switch is ON, you'll go first in battle
- SURPRISE_SWITCH = 80 # If this switch is ON, expect a surprise from enemy
- end
- end
- class << BattleManager
- include Saba::Preemptive
- #--------------------------------------------------------------------------
- # ● Setup
- #--------------------------------------------------------------------------
- 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
- #--------------------------------------------------------------------------
- # ● Process on encounter
- #--------------------------------------------------------------------------
- alias saba_preemptive_on_encounter on_encounter
- def on_encounter
- saba_preemptive_on_encounter
- setup_preemptive_switch
- end
- #--------------------------------------------------------------------------
- # ○ Setup for preemptive or surprise switch
- #--------------------------------------------------------------------------
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement