#==============================================================================
#                   「決定キー以外でイベント起動」(ACE) ver1.0  by奈々
#   製作者:奈々(なな)
#   へぷたなすくろーる http://heptanas.mamagoto.com/
#
#   ◇使用規約
#   使用される場合はスクリプト作成者として「奈々」を明記して下さい。
#   このスクリプトを改変したり、改変したものを配布するなどは自由ですが
#   その場合も元のスクリプトの作成者として名前は載せて下さい。
#   その他、詳しい利用規約はブログを参照して下さい。
#
#------------------------------------------------------------------------------
#
#   トリガー:決定キーで起動するイベントを
#   Cボタン(決定キー)以外でも起動できるようになるスクリプトです。
#   どのボタンで起動したかはスイッチで判別できるので
#   例えば「Cボタンで話しかける、Xボタンで戦闘する」イベントなどが組めます。
#
#==============================================================================
module Nana
module Event_Key
# ◇初期設定
#

  KEY_X_SW = 1      #Xボタンでイベントが起動されたときにONになるスイッチNo.
  KEY_Y_SW = 1      #Yボタンでイベントが起動されたときにONになるスイッチNo.
  KEY_Z_SW = 1      #Zボタンでイベントが起動されたときにONになるスイッチNo.
  KEY_L_SW = 1      #Lボタンでイベントが起動されたときにONになるスイッチNo.
  KEY_R_SW = 1      #Rボタンでイベントが起動されたときにONになるスイッチNo.
  KEY_A_SW = 1      #Aボタンでイベントが起動されたときにONになるスイッチNo.
                    #↑0以下の指定で、そのボタンでのイベント起動が無効となる。
  
  KEY_B_SW = 0      #Bボタンでイベントが起動されたときにONになるスイッチNo.
                    #イベント起動を行うのは、メニュー禁止時のみ。
                    #↑0以下の指定で、そのボタンでのイベント起動が無効となる。

  KEY_C_SW = 0      #Cボタンでイベントが起動されたときにONになるスイッチNo.
                    #↑0以下の指定で、スイッチがONにならない。イベント起動は常に有効。
  
end
end
#
#------------------------------------------------------------------------------

#==============================================================================
# ■ Game_Player
#------------------------------------------------------------------------------
#  プレイヤーを扱うクラスです。イベントの起動判定や、マップのスクロールなどの
# 機能を持っています。このクラスのインスタンスは $game_player で参照されます。
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # ● 移動中でない場合の処理
  #     last_moving : 直前に移動中だったか
  #--------------------------------------------------------------------------
  def update_nonmoving(last_moving)
    return if $game_map.interpreter.running?
    if last_moving
      $game_party.on_player_walk
      return if check_touch_event
    end
    if movable?
      if Input.trigger?(:C)
        return if get_on_off_vehicle
        
        if Nana::Event_Key::KEY_C_SW > 0
          $game_switches[Nana::Event_Key::KEY_C_SW] = check_action_event
          return if $game_switches[Nana::Event_Key::KEY_C_SW]
        else
          return if check_action_event
        end
      end
      if Input.trigger?(:B) && Nana::Event_Key::KEY_B_SW > 0 && $game_system.menu_disabled
        $game_switches[Nana::Event_Key::KEY_B_SW] = check_action_event
        return if $game_switches[Nana::Event_Key::KEY_B_SW]
      end
      
      if Input.trigger?(:A) && Nana::Event_Key::KEY_A_SW > 0
        $game_switches[Nana::Event_Key::KEY_A_SW] = check_action_event
        return if $game_switches[Nana::Event_Key::KEY_A_SW]
      end
      if Input.trigger?(:X) && Nana::Event_Key::KEY_X_SW > 0
        $game_switches[Nana::Event_Key::KEY_X_SW] = check_action_event
        return if $game_switches[Nana::Event_Key::KEY_X_SW]
      end
      if Input.trigger?(:Y) && Nana::Event_Key::KEY_Y_SW > 0
        $game_switches[Nana::Event_Key::KEY_Y_SW] = check_action_event
        return if $game_switches[Nana::Event_Key::KEY_Y_SW]
      end
      if Input.trigger?(:Z) && Nana::Event_Key::KEY_Z_SW > 0
        $game_switches[Nana::Event_Key::KEY_Z_SW] = check_action_event
        return if $game_switches[Nana::Event_Key::KEY_Z_SW]
      end
      if Input.trigger?(:L) && Nana::Event_Key::KEY_L_SW > 0
        $game_switches[Nana::Event_Key::KEY_L_SW] = check_action_event
        return if $game_switches[Nana::Event_Key::KEY_L_SW]
      end
      if Input.trigger?(:R) && Nana::Event_Key::KEY_R_SW > 0
        $game_switches[Nana::Event_Key::KEY_R_SW] = check_action_event
        return if $game_switches[Nana::Event_Key::KEY_R_SW]
      end
      
    end
    update_encounter if last_moving
  end
end