Advertisement
Jragyn

[VXa] XAS Core

Jun 10th, 2015
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 261.43 KB | None | 0 0
  1. =begin
  2. #===============================================================================
  3. # ■ TERMS OF USE
  4. #===============================================================================
  5.  - You need to give credits to Xiderowng.
  6.  - You need to link the official Xiderowng website.
  7.    http://xrxs.at-ninja.jp/
  8. =end
  9. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  10. # XAS - SETUP
  11. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  12. module XAS_SYSTEM
  13.   # Enable or disable the XAS battle system with this script command.
  14.   # $game_system.xas_battle = true/false
  15.   # $game_system.hud_visible = true/false
  16.  
  17.   BATTLE_SYSTEM = true
  18.   DAMAGE_POP = true
  19.   CHARACTER_POSE_NAME = true
  20.   CHARACTER_SPRITE_EFFECTS = true
  21.   DASH_SYSTEM = true
  22.   PLAYER_DIAGONAL_MOVEMENT  = true
  23.   EVENT_DIAGONAL_MOVEMENT  = true
  24.   STATE_SYSTEM = true
  25.  
  26.   ACTION_TEMPLATE_MAP_ID = 1
  27.   # This identifies the map that houses all the "Actions" for Action IDs.
  28.  
  29.   HIT_ID = 23
  30.   # This is the variable that you can identify an event that only reacts
  31.   # to a particular type of attack or skill.
  32. end
  33.  
  34. #===============================================================================
  35. # ■ XAS BUTTON SETTING
  36. #===============================================================================
  37. module XAS_BUTTON
  38.   ACTION_1_BUTTON = Input::C      # Swing weapon
  39.   ACTION_2_BUTTON = Input::X      # Block with shield or use offhand weapon
  40.   SKILL_BUTTON    = Input::Z      # Use skill/cast spell
  41.   ITEM_BUTTON     = Input::Y      # Use an equipped item (non-conventional)
  42.   DASH_BUTTON     = Input::A      # Dash!
  43.   CHANGE_LEADER_BUTTON = Input::R # Switch leader between various members
  44.   # Input::L is used for bringing up the quick menu for equippable skills/items
  45.  
  46.   ENABLE_ACTION_1_BUTTON = true
  47.   ENABLE_ACTION_2_BUTTON = true
  48.   ENABLE_SKILL_BUTTON = true
  49.   ENABLE_ITEM_BUTTON = true
  50.   ENABLE_DASH_BUTTON = true
  51.   ENABLE_CHANGE_LEADER_BUTTON = true
  52. end
  53.  
  54. #===============================================================================
  55. # ■ WORD SETTING
  56. #===============================================================================
  57. module XAS_WORD
  58.   ENABLE_WORD = true
  59.   GUARD = "Guard"
  60.   NO_MP = "No MP!"
  61.   NO_ITEM = "No Ammo!"  
  62.   LEVEL_UP = "Level Up!"
  63.   SEAL = "Sealed!"
  64.   INVINCIBLE = "Invincible!"
  65.   EXP = "XP"
  66.   EVADED = "Evaded!"
  67.   MISSED = "Missed!"
  68.   COUNTER = "Counter"
  69.   REFLECT = "Reflected"
  70. end
  71.  
  72. #===============================================================================
  73. # ■ DAMAGE POP
  74. #===============================================================================
  75. module XAS_DAMAGE_POP
  76.   DAMAGE_FONT_NAME = "Visitor TT2 BRK"
  77.   DAMAGE_FONT_SIZE = 18
  78.   DAMAGE_FONT_BOLD = false
  79.   DAMAGE_FONT_ITALIC = false
  80.   DAMAGE_CRITICAL_ZOOM = true
  81.   DAMAGE_EXP_GOLD_POP = true  
  82.   DAMAGE_STATE_POP = true
  83.   DAMAGE_ITEM_POP = true
  84.   DAMAGE_DEFAULT_FONT_COLOR = Color.new(255, 255, 255)
  85.   DAMAGE_EXP_FONT_COLOR = Color.new(0, 255, 100)
  86.   DAMAGE_GOLD_FONT_COLOR = Color.new(255, 255, 50)
  87.   DAMAGE_ITEM_FONT_COLOR = Color.new(136, 204, 255)
  88. end
  89.  
  90. #===============================================================================
  91. # ■ SOUND SETTING
  92. #===============================================================================
  93. module XAS_SOUND
  94.   ITEM_DROP = "Key"
  95.   LEVEL_UP = "Chime1"
  96.   ACTION_COST = "Cursor1"
  97. end
  98.  
  99. #===============================================================================
  100. # ■ ANIMATION SETTING
  101. #===============================================================================
  102. module XAS_ANIMATION
  103.   GUARD_ANIMATION_ID = 127
  104.   CHANGE_LEADER_ANIMATION_ID = 135
  105.   INVINCIBLE_ANIMATION_ID = 36
  106.   CHARGE_ANIMATION1_ID = 155
  107.   CHARGE_ANIMATION2_ID = 123
  108.   CAST_TIME_ANIMATION_ID = 120
  109.   LOOP_ANIMATIONS_SPEED = 60
  110.   REFLECT_ANIMATION_ID = 128
  111. end
  112.  
  113. #===============================================================================
  114. # ■ GENERAL BATTLER SETTING
  115. #===============================================================================
  116. module XAS_BA
  117.   CHANGE_LEADER_WAIT_TIME = 10
  118.   HUD_VISIBLE_AT_STARTUP = false
  119.   SENSOR_SELF_SWITCH = "D"
  120.   DEFAULT_SENSOR_RANGE_VARIABLE_ID = 4
  121.   DEFAULT_KNOCK_BACK_DURATION = 60
  122.   KNOCKBACKING_SHAKE = false
  123.   BASE_MOVE_SPEED = 4.2
  124.   DASH_MOVE_SPEED = 0.6
  125.   DIAGONAL_DURATION_ENABLE = false
  126.   DIAGONAL_DURATION = 15
  127.   # Definitions:
  128.   # 0 - EXP for only the killer who defeated the enemy.
  129.   # 1 - EXP fully for all members.
  130.   # 2 - EXP divided by all members of the group.
  131.   # 3 - EXP is cut in half for inactive members.
  132.   EXP_TYPE = 3
  133.   TREASURE_ERASE_TIME = 15
  134.   FADE_TREASURE_SPRITE = true
  135.   FLOAT_TREASURE_SPRITE = true
  136.   FIX_BALLOON_POSITION = true
  137.   BALLOON_HEIGHT = 48
  138. end  
  139.  
  140. #===============================================================================
  141. # ■ ENEMY SETTING
  142. #===============================================================================
  143.  
  144. module XAS_BA_ENEMY
  145.   # Definição de quais habilidades o inimigo será invunerável.
  146.   #
  147.   # INVUNERABLE_ACTIONS = { A=>[B,B,B,B],  A=>[B,B,B,B], ...}
  148.   # A - ID do inimigo.
  149.   # B - ID da habilidade.
  150.   INVUNERABLE_ACTIONS = {
  151. #  6=>[39,40,41,42,43],
  152.   }
  153.   # Definição das direções que o inimigo será invunerável.
  154.   # GUARD_DIRECTIONS = { A=>[B],  A=>[B,B,B,B], ...}
  155.   # A - ID do inimigo
  156.   # B - Direções de Invulnerabilidade.
  157.   #     -> 2 = Abaixo.   -> 4 = Esquerda.
  158.   #     -> 6 = Direita.  -> 8 = Acima.
  159.   GUARD_DIRECTIONS = {
  160.   }  
  161.   # Definição das habilidades de Counter Attack
  162.   #
  163.   # COUNTER_ATTACK = { A=>[B,B,B,B],  A=>[B,B,B,B], ...}
  164.   COUNTER_ATTACK = {
  165.   }
  166.  
  167. end  
  168. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  169. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  170. #■ INITIALIZE
  171. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  172. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  173.  
  174.  
  175. #===============================================================================
  176. # ■ Game_Temp
  177. #===============================================================================
  178. class Game_Temp
  179.   attr_accessor :change_leader_wait_time
  180.   attr_accessor :reset_battler_time
  181.   attr_accessor :tool_event
  182.   attr_accessor :animation_garbage
  183.  
  184.   #--------------------------------------------------------------------------
  185.   # ● Initialize
  186.   #--------------------------------------------------------------------------  
  187.   alias xas_initialize initialize
  188.   def initialize
  189.       @change_leader_wait_time = 0
  190.       @reset_battler_time = 0
  191.       @tool_event = nil
  192.       @animation_garbage = []
  193.       xas_initialize
  194.   end
  195.  
  196. end
  197.  
  198. #===============================================================================
  199. # ■ Game_System
  200. #===============================================================================
  201. class Game_System
  202.   attr_accessor :tools_on_map
  203.   attr_accessor :old_interpreter_running
  204.   attr_accessor :hud_visible
  205.   attr_accessor :enable_hud
  206.   attr_accessor :command_enable
  207.   attr_accessor :pre_leader_id
  208.   attr_accessor :xas_battle
  209.   #--------------------------------------------------------------------------
  210.   # ● Initialize
  211.   #--------------------------------------------------------------------------  
  212.   alias x_initialize initialize
  213.   def initialize
  214.       @tools_on_map = []
  215.       @old_interpreter_running = false
  216.       @hud_visible = XAS_BA::HUD_VISIBLE_AT_STARTUP
  217.       @enable_hud = false
  218.       @command_enable  = true
  219.       @pre_leader_id = 0
  220.       @xas_battle = XAS_SYSTEM::BATTLE_SYSTEM
  221.       x_initialize
  222.   end  
  223. end  
  224.  
  225. #===============================================================================
  226. # ■ Game_Battler
  227. #===============================================================================
  228. class Game_Battler
  229.   attr_accessor :damage_pop
  230.   attr_accessor :damage
  231.   attr_accessor :damage_type
  232.   attr_accessor :critical
  233.   attr_accessor :invunerable_duration
  234.   attr_accessor :shield
  235.   attr_accessor :invunerable_actions
  236.   attr_accessor :guard_directions
  237.   attr_accessor :guard
  238.   attr_accessor :invunerable
  239.   attr_accessor :x_combo
  240.   attr_accessor :cast_action
  241.   attr_accessor :defeated
  242.   attr_accessor :death_zoom_effect
  243.   attr_accessor :counter_action
  244.   attr_accessor :knockback_duration
  245.   attr_accessor :hp_damage
  246.   attr_accessor :mp_damage
  247.  
  248.  #--------------------------------------------------------------------------
  249.  # ● Initialize
  250.  #--------------------------------------------------------------------------  
  251.   alias x_initialize initialize
  252.   def initialize
  253.       @damage = 0
  254.       @damage_pop = false
  255.       @damage_type = 0
  256.       @critical = false
  257.       @invunerable_duration = 0
  258.       @shield = false
  259.       @invunerable_actions = []
  260.       @guard_directions = []
  261.       @guard = true
  262.       @invunerable = false
  263.       @x_combo = [0,-1,0]
  264.       @defeated = false
  265.       @death_zoom_effect = 0
  266.       @cast_action = [0,0,0,0,0]
  267.       @counter_action = [0,0,true]
  268.       @knockback_duration = XAS_BA::DEFAULT_KNOCK_BACK_DURATION
  269.       x_initialize
  270.   end
  271.  
  272.  #--------------------------------------------------------------------------
  273.  # ● Add Invunerable Actions
  274.  #--------------------------------------------------------------------------    
  275.  def add_inv(action_id = 0)
  276.      return if action_id == nil or action_id <= 0
  277.      return if @invunerable_actions.include?(action_id)
  278.      @invunerable_actions.push(action_id)    
  279.  end
  280.  
  281.  #--------------------------------------------------------------------------
  282.  # ● Remove Invunerable Actions
  283.  #--------------------------------------------------------------------------    
  284.  def remove_inv(action_id = 0)
  285.      return if action_id == nil or action_id <= 0
  286.      return unless @invunerable_actions.include?(action_id)
  287.      @invunerable_actions.delete(action_id)    
  288.  end
  289.    
  290.  #--------------------------------------------------------------------------
  291.  # ● Add Guard Directions
  292.  #--------------------------------------------------------------------------    
  293.  def add_guard_dir(direction = 0)
  294.      return if direction == nil or direction <= 0
  295.      return if @guard_directions.include?(direction)
  296.      @guard_directions.push(direction)    
  297.  end
  298.  
  299.  #--------------------------------------------------------------------------
  300.  # ● Remove Guard Directions
  301.  #--------------------------------------------------------------------------    
  302.  def remove_guard_dir(direction = 0)
  303.      return if direction == nil or direction <= 0
  304.      return unless @guard_directions.include?(direction)
  305.      @guard_directions.delete(direction)    
  306.  end  
  307.  
  308. end  
  309.  
  310. #===============================================================================
  311. # ■ Game Actor
  312. #===============================================================================
  313. class Game_Actor < Game_Battler
  314.  
  315.   attr_accessor :x_action1_id
  316.   attr_accessor :x_action2_id
  317.   attr_accessor :skill_id
  318.   attr_accessor :x_item_id
  319.   attr_accessor :x_charge_action
  320.   attr_accessor :old_equipment_id
  321.   attr_accessor :item_id
  322.   attr_accessor :old_level
  323.   attr_reader :actor_id
  324.  
  325.  #--------------------------------------------------------------------------
  326.  # ● Setup
  327.  #--------------------------------------------------------------------------    
  328.  alias x_setup setup
  329.  def setup(actor_id)
  330.       @x_action1_id = 0
  331.       @x_action2_id = 0
  332.       @skill_id = 0
  333.       @x_item_id = 0
  334.       @item_id = 0
  335.       @x_charge_action = [0,0,0,0]
  336.       @old_level = @level
  337.       @old_equipment_id = [0,0,0,0,0]
  338.       x_setup(actor_id)
  339.  end
  340.  
  341.  #--------------------------------------------------------------------------
  342.  # ● Display Level Up
  343.  #--------------------------------------------------------------------------    
  344.   alias x_display_level_up display_level_up
  345.   def display_level_up(new_skills)
  346.       return unless $game_party.in_battle
  347.       x_display_level_up(new_skills)
  348.   end
  349.  
  350. end
  351.  
  352. #===============================================================================
  353. # ■ Character
  354. #===============================================================================
  355. class Game_Character < Game_CharacterBase
  356.  
  357.   attr_accessor :tool_id
  358.   attr_accessor :tool_effect  
  359.   attr_accessor :target
  360.   attr_accessor :target2
  361.   attr_accessor :old_x
  362.   attr_accessor :old_y
  363.   attr_accessor :pre_x
  364.   attr_accessor :pre_y
  365.   attr_accessor :temp_id
  366.   attr_accessor :angle
  367.   attr_accessor :force_action_times
  368.   attr_accessor :force_action
  369.   attr_accessor :move_frequency
  370.   attr_accessor :move_speed
  371.   attr_accessor :direction_fix
  372.   attr_accessor :walk_anime
  373.   attr_accessor :step_anime
  374.   attr_accessor :x
  375.   attr_accessor :y
  376.   attr_accessor :pattern
  377.   attr_accessor :pattern_count  
  378.   attr_accessor :jump_count
  379.   attr_accessor :jump_peak
  380.   attr_accessor :dash_active
  381.   attr_accessor :direction
  382.   attr_accessor :through
  383.   attr_accessor :bush_depth  
  384.   attr_accessor :blend_type
  385.   attr_accessor :priority_type  
  386.   attr_accessor :jump_count
  387.   attr_accessor :zoom_x
  388.   attr_accessor :zoom_y
  389.   attr_accessor :stop
  390.   attr_accessor :force_update
  391.   attr_accessor :treasure_time
  392.   attr_accessor :treasure_float
  393.   attr_accessor :can_update
  394.   attr_accessor :pre_move_speed
  395.   attr_accessor :knock_back_duration
  396.   attr_accessor :orig_pos_x
  397.   attr_accessor :orig_pos_y
  398.   attr_accessor :shoot_time
  399.   #--------------------------------------------------------------------------
  400.   # ● Initialize
  401.   #--------------------------------------------------------------------------    
  402.   alias x_initialize initialize
  403.   def initialize
  404.       x_initialize
  405.       @tool_id = 0
  406.       @tool_effect = ""
  407.       @target = false
  408.       @target2 = nil
  409.       @old_x = @x
  410.       @old_y = @y
  411.       @pre_x = @x
  412.       @pre_y = @y  
  413.       @orig_pos_x = @x
  414.       @orig_pos_y = @y
  415.       @angle = 0
  416.       @force_action_times = 0
  417.       @force_action = ""
  418.       @dash_active = false
  419.       @zoom_x = 1.00
  420.       @zoom_y = 1.00
  421.       @stop = false
  422.       @force_update = false
  423.       @treasure_time = 0
  424.       @treasure_float = [0,0,0,0]
  425.       @can_update = true
  426.       @temp_id = 0
  427.       @pre_move_speed = @move_speed
  428.       @shoot_time = [0,0]
  429.   end
  430.  
  431.   #--------------------------------------------------------------------------
  432.   # ● Invunerable
  433.   #--------------------------------------------------------------------------      
  434.   def invunerable(enable = false)
  435.       return if @battler == nil or @battler.dead?
  436.       @battler.invunerable = enable
  437.   end  
  438.  
  439.   #--------------------------------------------------------------------------
  440.   # ● Fast Breath
  441.   #--------------------------------------------------------------------------        
  442.   def fast_breath(enable = true)
  443.      return if @battler == nil or @battler.dead?
  444.      @battler.fast_breath_effect = enable
  445.   end
  446. end
  447.  
  448. #===============================================================================
  449. # ■ Game_Event
  450. #===============================================================================
  451. class Game_Event < Game_Character
  452.   attr_accessor :target
  453.   attr_reader   :name
  454.   attr_accessor :collision_attack
  455.  
  456.  #--------------------------------------------------------------------------
  457.  # ● Object
  458.  #--------------------------------------------------------------------------      
  459.  alias x_event_initialize initialize
  460.  def initialize(map_id, event)
  461.      x_event_initialize(map_id, event)
  462.      @collision_attack = false
  463.      if @event.name =~ /<O(\d+)>/i
  464.         @opacity = $1.to_i  
  465.      end  
  466.      if @event.name =~ /<B(\d+)>/i  
  467.         @blend_type = $1.to_i
  468.      end  
  469.  end  
  470.    
  471.  #--------------------------------------------------------------------------
  472.  # ● Erase
  473.  #--------------------------------------------------------------------------        
  474.  alias x_event_erase erase
  475.  def erase
  476.      if self.tool_id > 0
  477.         $game_system.tools_on_map.delete(self.tool_id)
  478.      end  
  479.      x_event_erase
  480.  end    
  481.  
  482.  #--------------------------------------------------------------------------
  483.  # ● Event Name
  484.  #--------------------------------------------------------------------------
  485.   def name
  486.       return @event.name  
  487.   end  
  488.  
  489. end
  490.  
  491. #===============================================================================
  492. # ■ Game Followers
  493. #===============================================================================
  494. class Game_Followers
  495.  
  496.  #--------------------------------------------------------------------------
  497.  # ● Initialize
  498.  #--------------------------------------------------------------------------  
  499.   alias x_party_initialize initialize
  500.   def initialize(leader)
  501.       x_party_initialize(leader)
  502.       if $xas_party_system == nil
  503.          @visible = false
  504.       end  
  505.   end  
  506. end  
  507.  
  508. #===============================================================================
  509. # ■ Game Map
  510. #===============================================================================
  511. class Game_Map  
  512.  
  513.  #--------------------------------------------------------------------------
  514.  # ● Setup
  515.  #--------------------------------------------------------------------------  
  516.   alias x_initial_setup setup
  517.   def setup(map_id)
  518.       x_initial_setup(map_id)
  519.       xas_initial_setup(map_id)
  520.   end
  521.  
  522.  #--------------------------------------------------------------------------
  523.  # ● XAS Initial Setup
  524.  #--------------------------------------------------------------------------  
  525.   def xas_initial_setup(map_id)
  526.       for actor in $game_party.members
  527.           setup_initial_members(actor)
  528.       end  
  529.   end  
  530.    
  531.  #--------------------------------------------------------------------------
  532.  # ● Setup Initial Membes
  533.  #--------------------------------------------------------------------------    
  534.   def setup_initial_members(actor)
  535.      
  536.   end  
  537. end  
  538.  
  539.  
  540. #==============================================================================
  541. # ■ Scene_Map
  542. #==============================================================================
  543. class Scene_Map < Scene_Base
  544.  
  545.   #--------------------------------------------------------------------------
  546.   # ● Call Menu
  547.   #--------------------------------------------------------------------------    
  548.   alias x_call_menu call_menu
  549.   def call_menu
  550.       return if $game_player.action != nil
  551.       $game_player.reset_charge_temp
  552.       x_call_menu
  553.   end
  554.    
  555. end    
  556. #===============================================================================
  557. # ■ Scene_Refresh
  558. #===============================================================================
  559. class Scene_Refresh
  560.  
  561.  #--------------------------------------------------------------------------
  562.  # ● Main
  563.  #--------------------------------------------------------------------------
  564.   def main
  565.       SceneManager.call(Scene_Map)
  566.   end
  567. end
  568.  
  569. #==============================================================================
  570. # ■ Game_Player
  571. #==============================================================================
  572. class Game_Player < Game_Character
  573.  
  574.  #--------------------------------------------------------------------------
  575.  # ● Leader Changed
  576.  #--------------------------------------------------------------------------  
  577.   def leader_changed?(actor)
  578.       if $game_party.members[0] == nil
  579.          return true if actor != nil
  580.       elsif $game_party.members[0] != nil
  581.          return true if actor == nil    
  582.          return true if actor.actor_id != $game_party.members[0].actor_id        
  583.       end  
  584.       return false
  585.   end
  586.  
  587. end  
  588. $xas = true
  589.  
  590.  
  591. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  592. #■ MOVEMENT - DIAGONAL MOVEMENT
  593. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  594.  
  595.  
  596. #===============================================================================
  597. # ■ Game Character
  598. #===============================================================================
  599. class Game_CharacterBase
  600.  
  601.   #--------------------------------------------------------------------------
  602.   # ● Set Direction
  603.   #--------------------------------------------------------------------------          
  604.    alias diagonal_set_direction set_direction
  605.    def set_direction(d)
  606.        diagonal_set_direction(d)
  607.        @diagonal_direction = 0
  608.        reset_diagonal
  609.    end
  610.    
  611. end  
  612.  
  613. #===============================================================================
  614. # ■  Game Character
  615. #===============================================================================
  616. class Game_Character < Game_CharacterBase
  617.  
  618.   attr_accessor :diagonal
  619.   attr_accessor :diagonal_direction
  620.   attr_accessor :sprite_angle_enable
  621.   attr_accessor :diagonal_time
  622.  
  623.   #--------------------------------------------------------------------------
  624.   # ● Initialize
  625.   #--------------------------------------------------------------------------        
  626.   alias diagonal_initialize initialize
  627.   def initialize
  628.       diagonal_initialize
  629.       if XAS_SYSTEM::EVENT_DIAGONAL_MOVEMENT
  630.          @diagonal = true
  631.       else  
  632.          @diagonal = false
  633.       end  
  634.       @diagonal_direction = 0
  635.       @sprite_angle_enable = false
  636.       @diagonal_time = 0
  637.   end  
  638.    
  639.   #--------------------------------------------------------------------------
  640.   # ● Reset Diagonal
  641.   #--------------------------------------------------------------------------            
  642.   def reset_diagonal
  643.       return if @direction_fix
  644.       return if @diagonal == false
  645.       @diagonal_direction = 0    
  646.       @diagonal_time = 0
  647.       @angle = 0 if @sprite_angle_enable
  648.   end  
  649.  
  650.   #--------------------------------------------------------------------------
  651.   # ● Enable Diagonal
  652.   #--------------------------------------------------------------------------            
  653.   def enable_diagonal(dir = 0)
  654.      return if @direction_fix
  655.      return if @diagonal == false
  656.      return if dir == 0
  657.      @diagonal_direction = dir
  658.      @diagonal_time = XAS_BA::DIAGONAL_DURATION
  659.      @angle = 315 if @sprite_angle_enable
  660.   end  
  661.  
  662.   #--------------------------------------------------------------------------
  663.   # ● Turn Upper Right
  664.   #--------------------------------------------------------------------------  
  665.   def turn_upper_right
  666.       enable_diagonal(9)
  667.       @direction = 8 unless @direction_fix
  668.   end  
  669.  
  670.   #--------------------------------------------------------------------------
  671.   # ● Turn Upper Left
  672.   #--------------------------------------------------------------------------  
  673.   def turn_upper_left
  674.       enable_diagonal(7)
  675.       @direction = 4 unless @direction_fix
  676.   end  
  677.  
  678.   #--------------------------------------------------------------------------
  679.   # ● Turn Lower Right
  680.   #--------------------------------------------------------------------------  
  681.   def turn_lower_right
  682.       enable_diagonal(3)
  683.       @direction = 6 unless @direction_fix
  684.   end      
  685.  
  686.   #--------------------------------------------------------------------------
  687.   # ● Turn Lower Left
  688.   #--------------------------------------------------------------------------  
  689.   def turn_lower_left
  690.       enable_diagonal(1)
  691.       @direction = 2 unless @direction_fix
  692.   end  
  693.    
  694.   #--------------------------------------------------------------------------
  695.   # ● Move forward
  696.   #--------------------------------------------------------------------------                
  697.   alias diagonal_move_forward move_forward
  698.   def move_forward
  699.       return if move_forward_diagonal?
  700.       diagonal_move_forward
  701.   end
  702.  
  703.   #--------------------------------------------------------------------------
  704.   # ● Move forward Diagonal?
  705.   #--------------------------------------------------------------------------                  
  706.   def move_forward_diagonal?
  707.       return false if @diagonal == false
  708.       if @diagonal_direction != 0
  709.          case @diagonal_direction
  710.               when 1 #Lower Left
  711.                  move_diagonal(4, 2)
  712.                  @direction = 2
  713.               when 3 #Lower Right
  714.                  move_diagonal(6, 2)
  715.                  @direction = 6
  716.               when 7 #Upper Left
  717.                  move_diagonal(4, 8)
  718.                  @direction = 4
  719.               when 9 #Upper Right
  720.                  move_diagonal(6, 8)
  721.                  @direction = 8
  722.           end
  723.           enable_diagonal(@diagonal_direction)      
  724.          return true
  725.       end  
  726.       return false
  727.   end
  728.  
  729.   #--------------------------------------------------------------------------
  730.   # ● Move Backward
  731.   #--------------------------------------------------------------------------                
  732.   alias diagonal_move_backward move_backward
  733.   def move_backward
  734.       return if move_backward_diagonal?
  735.       diagonal_move_backward
  736.   end
  737.  
  738.   #--------------------------------------------------------------------------
  739.   # ● Move Backward Diagonal?
  740.   #--------------------------------------------------------------------------                  
  741.   def move_backward_diagonal?
  742.       return false if @diagonal == false
  743.       if @diagonal_direction != 0
  744.          last_direction_fix = @direction_fix
  745.          @direction_fix = true      
  746.          case @diagonal_direction
  747.               when 1
  748.                  move_diagonal(6, 8)
  749.                  @direction = 6
  750.               when 3
  751.                  move_diagonal(4, 8)
  752.                  @direction = 4
  753.               when 7
  754.                  move_diagonal(6, 2)
  755.                  @direction = 6
  756.               when 9        
  757.                  move_diagonal(4, 2)
  758.                  @direction = 2
  759.          end
  760.          enable_diagonal(@diagonal_direction)      
  761.          @direction_fix = last_direction_fix
  762.          return true
  763.       end  
  764.       return false
  765.   end  
  766.  
  767.   #--------------------------------------------------------------------------
  768.   # ● Turn Toward Player
  769.   #--------------------------------------------------------------------------
  770.   alias turn_toward_player_diagonal turn_toward_player
  771.   def turn_toward_player
  772.       if @diagonal
  773.          diagonal_turn_toward_player
  774.          return
  775.       end
  776.       turn_toward_player_diagonal
  777.   end  
  778.  
  779.   #--------------------------------------------------------------------------
  780.   # ● Diagonal Turn Toward Player
  781.   #--------------------------------------------------------------------------
  782.   def diagonal_turn_toward_player
  783.       sx = distance_x_from($game_player.x)
  784.       sy = distance_y_from($game_player.y)
  785.       sd = sx.abs - sy.abs
  786.       sdx = sd.abs - sx.abs
  787.       sdy = sd.abs - sy.abs
  788.       return if sx == 0 and sy == 0
  789.       #Turn Upper Right
  790.       if sx < 0 and sy > 0
  791.          if sx.abs > sy.abs and sdx.abs < sd.abs
  792.             set_direction(6)
  793.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  794.             set_direction(8)
  795.          else
  796.             turn_upper_right
  797.          end
  798.          enable_diagonal(9)
  799.       #Turn Upper Left
  800.       elsif sx > 0 and sy > 0
  801.          if sx.abs > sy.abs and sdx.abs < sd.abs
  802.             set_direction(4)
  803.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  804.             set_direction(8)            
  805.          else
  806.             set_direction(4)
  807.             turn_upper_left
  808.          end
  809.          enable_diagonal(7)  
  810.       #Turn Lower Left  
  811.       elsif sx > 0 and sy < 0
  812.          if sx.abs > sy.abs and sdx.abs < sd.abs
  813.             set_direction(4)
  814.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  815.             set_direction(2)        
  816.          else                    
  817.             turn_lower_left
  818.          end
  819.          enable_diagonal(1)  
  820.        #Turn Lower Right    
  821.        elsif sx < 0 and sy < 0        
  822.          if sx.abs > sy.abs and sdx.abs < sd.abs
  823.             set_direction(6)
  824.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  825.             set_direction(2)          
  826.          else        
  827.             turn_lower_right
  828.          end
  829.          enable_diagonal(3)
  830.       elsif sx < 0
  831.          set_direction(6)
  832.       elsif sx > 0
  833.          set_direction(4)
  834.       elsif sy > 0
  835.          set_direction(8)
  836.       elsif sy < 0
  837.          set_direction(2)  
  838.       end    
  839.  
  840.   end  
  841.  
  842.   #--------------------------------------------------------------------------
  843.   # ● Move toward Player
  844.   #--------------------------------------------------------------------------
  845.   alias move_toward_player_diagonal move_toward_player
  846.   def move_toward_player
  847.       if @diagonal
  848.          diagonal_move_toward_player
  849.          return  
  850.       end
  851.       move_toward_player_diagonal
  852.   end  
  853.    
  854.   #--------------------------------------------------------------------------
  855.   # ● Diagonal Move Toward Player
  856.   #--------------------------------------------------------------------------  
  857.   def diagonal_move_toward_player
  858.       sx = distance_x_from($game_player.x)
  859.       sy = distance_y_from($game_player.y)
  860.       if sx == 0 and sy == 0
  861.          return
  862.       end
  863.       abs_sx = sx.abs
  864.       abs_sy = sy.abs
  865.       if abs_sx == abs_sy
  866.         rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
  867.       end
  868.       if abs_sx
  869.          if sx < 0 and sy > 0
  870.             move_diagonal(6, 8)
  871.             move_random unless moving?
  872.             enable_diagonal(9)
  873.          elsif sx > 0 and sy > 0
  874.             move_diagonal(4, 8)
  875.             move_random unless moving?
  876.             enable_diagonal(7)
  877.          elsif sx > 0 and sy < 0
  878.             move_diagonal(4, 2)
  879.             move_random unless moving?
  880.             enable_diagonal(1)
  881.          elsif sx < 0 and sy < 0
  882.             move_diagonal(6, 2)
  883.             move_random unless moving?
  884.             enable_diagonal(3)
  885.          elsif sx < 0
  886.             move_straight(6)
  887.          elsif sx > 0
  888.             move_straight(4)
  889.          elsif sy > 0
  890.             move_straight(8)
  891.          elsif sy < 0
  892.             move_straight(2)
  893.          end
  894.          if abs_sx != 1 and abs_sy != 1
  895.             move_random unless moving?
  896.          end  
  897.       end
  898.  end
  899.  
  900.  #--------------------------------------------------------------------------
  901.  # ● turn_right_45
  902.  #--------------------------------------------------------------------------      
  903.  def turn_right_45
  904.      if @diagonal and @diagonal_direction != 0    
  905.         case @diagonal_direction
  906.           when 1;  set_direction(4)
  907.           when 3;  set_direction(2)
  908.           when 7;  set_direction(8)
  909.           when 9;  set_direction(6)  
  910.         end
  911.      else  
  912.         case @direction
  913.           when 2;  turn_lower_left
  914.           when 4;  turn_upper_left
  915.           when 6;  turn_lower_right
  916.           when 8;  turn_upper_right
  917.         end
  918.      end  
  919.  end
  920.  
  921.  #--------------------------------------------------------------------------
  922.  # ● turn_left_45
  923.  #--------------------------------------------------------------------------  
  924.  def turn_left_45
  925.      if @diagonal and @diagonal_direction != 0    
  926.         case @diagonal_direction
  927.           when 1;  set_direction(2)
  928.           when 3;  set_direction(6)
  929.           when 7;  set_direction(4)
  930.           when 9;  set_direction(8)
  931.         end
  932.      else  
  933.         case @direction
  934.           when 2;  turn_lower_right
  935.           when 4;  turn_lower_left
  936.           when 6;  turn_upper_right
  937.           when 8;  turn_upper_left
  938.         end
  939.      end  
  940.  end
  941.  
  942.  #--------------------------------------------------------------------------
  943.  # ● turn_right_90
  944.  #--------------------------------------------------------------------------  
  945.  alias diagonal_turn_right_90 turn_right_90
  946.   def turn_right_90
  947.       if @diagonal and @diagonal_direction != 0
  948.          turn_diagonal_right_90
  949.          return
  950.       end  
  951.       diagonal_turn_right_90
  952.   end
  953.  
  954.  #--------------------------------------------------------------------------
  955.  # ● turn_diagonal_right_90
  956.  #--------------------------------------------------------------------------    
  957.   def turn_diagonal_right_90
  958.       case @diagonal_direction
  959.          when 1;  turn_upper_left
  960.          when 3;  turn_lower_left
  961.          when 7;  turn_upper_right
  962.          when 9;  turn_lower_right
  963.       end
  964.   end
  965.    
  966.  #--------------------------------------------------------------------------
  967.  # ● turn_left_90
  968.  #--------------------------------------------------------------------------    
  969.   alias diagonal_turn_left_90 turn_left_90
  970.   def turn_left_90
  971.       if @diagonal and @diagonal_direction != 0
  972.          turn_diagonal_left_90
  973.          return
  974.       end
  975.       diagonal_turn_left_90
  976.   end  
  977.    
  978.  #--------------------------------------------------------------------------
  979.  # ● turn_diagonal_left_90
  980.  #--------------------------------------------------------------------------    
  981.   def turn_diagonal_left_90
  982.       case @diagonal_direction
  983.          when 1;  turn_lower_right
  984.          when 3;  turn_upper_right
  985.          when 7;  turn_lower_left
  986.          when 9;  turn_upper_left
  987.       end
  988.   end    
  989.    
  990.   #--------------------------------------------------------------------------
  991.   # ● diagonal_turn_180
  992.   #--------------------------------------------------------------------------
  993.   alias diagonal_turn_180 turn_180
  994.   def turn_180  
  995.       if @diagonal and @diagonal_direction != 0
  996.          turn_diagonal_180
  997.          return
  998.       end
  999.       diagonal_turn_180
  1000.   end
  1001.  
  1002.  #--------------------------------------------------------------------------
  1003.  # ● turn_diagonal_180
  1004.  #--------------------------------------------------------------------------    
  1005.   def turn_diagonal_180
  1006.       case @diagonal_direction
  1007.          when 1;  turn_upper_right
  1008.          when 3;  turn_upper_left
  1009.          when 7;  turn_lower_right
  1010.          when 9;  turn_lower_left
  1011.       end
  1012.   end  
  1013.    
  1014.  #--------------------------------------------------------------------------
  1015.  # ● turn_random
  1016.  #--------------------------------------------------------------------------    
  1017.   alias diagonal_turn_random turn_random
  1018.   def turn_random
  1019.       if @diagonal
  1020.          turn_diagonal_random
  1021.          return
  1022.       end  
  1023.       diagonal_turn_random
  1024.   end  
  1025.  
  1026.  #--------------------------------------------------------------------------
  1027.  # ● turn_diagonal_random
  1028.  #--------------------------------------------------------------------------    
  1029.   def turn_diagonal_random
  1030.       case rand(8)
  1031.           when 0;  set_direction(8)
  1032.           when 1;  set_direction(6)
  1033.           when 2;  set_direction(4)
  1034.           when 3;  set_direction(2)
  1035.           when 4;  turn_lower_left  
  1036.           when 5;  turn_lower_right
  1037.           when 6;  turn_upper_left  
  1038.           when 7;  turn_upper_right
  1039.       end
  1040.   end
  1041.  
  1042. end    
  1043.  
  1044. #===============================================================================
  1045. # ■ Game_Player
  1046. #===============================================================================
  1047. class Game_Player < Game_Character
  1048.  
  1049.   #--------------------------------------------------------------------------
  1050.   # ● Move By Input
  1051.   #--------------------------------------------------------------------------    
  1052.   alias diagonal_move_by_input move_by_input
  1053.   def move_by_input
  1054.     if XAS_SYSTEM::PLAYER_DIAGONAL_MOVEMENT
  1055.        player_diagonal_move_by_input
  1056. #~        update_sprite_diagonal
  1057.        update_return_direction
  1058.        return
  1059.     end
  1060.     diagonal_move_by_input
  1061.   end  
  1062.   #--------------------------------------------------------------------------
  1063.   # ● Update Sprite Diagonal
  1064.   #--------------------------------------------------------------------------        
  1065.   def update_sprite_diagonal
  1066.       return if @diagonal_direction == 0
  1067.       return if self.action != nil
  1068.       return if @dash_active
  1069.       make_pose("_Diagonal", 2)
  1070.   end  
  1071.  
  1072.   #--------------------------------------------------------------------------
  1073.   # ● Update Return Direction
  1074.   #--------------------------------------------------------------------------          
  1075.   def update_return_direction
  1076.       return if XAS_BA::DIAGONAL_DURATION_ENABLE == false
  1077.       return if @diagonal_time == 0
  1078.       return if moving? or @stop
  1079.       @diagonal_time -= 1
  1080.       @diagonal_direction = 0 if @diagonal_time == 0
  1081.   end
  1082.   #--------------------------------------------------------------------------
  1083.   # ● Player Diagonal Move By Input
  1084.   #--------------------------------------------------------------------------      
  1085.   def player_diagonal_move_by_input    
  1086.     return unless movable?
  1087.     return if $game_map.interpreter.running?
  1088.     case Input.dir8
  1089.       when 2, 4, 6, 8; move_straight(Input.dir4); @diagonal_direction = 0
  1090.       when 1
  1091.         move_diagonal(4, 2)
  1092.         unless moving?
  1093.           move_straight(4)
  1094.           move_straight(2)                
  1095.         end
  1096.         @diagonal_direction = 1
  1097.       when 3
  1098.         move_diagonal(6, 2)
  1099.         unless moving?
  1100.           move_straight(6)
  1101.           move_straight(2)
  1102.         end
  1103.         @diagonal_direction = 3
  1104.       when 7
  1105.         move_diagonal(4, 8)
  1106.         unless moving?
  1107.           move_straight(4)
  1108.           move_straight(8)
  1109.         end
  1110.         @diagonal_direction = 7
  1111.       when 9  
  1112.         move_diagonal(6, 8)
  1113.         unless moving?
  1114.           move_straight(6)
  1115.           move_straight(8)
  1116.         end
  1117.         @diagonal_direction = 9
  1118.     end
  1119.   end#def
  1120. end
  1121.  
  1122.  
  1123. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1124. #■ MOVEMENT - FORCE ACTION
  1125. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1126.  
  1127.  
  1128. #===============================================================================
  1129. # ■ Game Character
  1130. #===============================================================================
  1131. class Game_Character < Game_CharacterBase
  1132.  
  1133.   #--------------------------------------------------------------------------
  1134.   # ● moving 2?
  1135.   #--------------------------------------------------------------------------  
  1136.   def moving2?
  1137.       @real_x != @x || @real_y != @y
  1138.   end  
  1139.  
  1140.   #--------------------------------------------------------------------------
  1141.   # ● Can Force Action?
  1142.   #--------------------------------------------------------------------------          
  1143.   def can_force_action?
  1144.       return false if @force_action_times  == 0
  1145.       return false if self.moving2?
  1146.       return false if self.jumping?
  1147.       return false if self.knockbacking?
  1148.       return false if self.stop
  1149.       return true
  1150.   end
  1151.    
  1152.   #--------------------------------------------------------------------------
  1153.   # ● Update Force Action
  1154.   #--------------------------------------------------------------------------        
  1155.   def update_force_action
  1156.       @force_action_times -= 1
  1157.       execute_force_action
  1158.       execute_force_action_tool_effect if @tool_id > 0 and @tool_effect != ""
  1159.       reset_auto_action if @force_action_times == 0
  1160.   end
  1161.  
  1162.   #--------------------------------------------------------------------------
  1163.   # ● Execute Force Action
  1164.   #--------------------------------------------------------------------------          
  1165.   def execute_force_action  
  1166.       case @force_action
  1167.         when "Forward"
  1168.             move_forward
  1169.         when "Backward"
  1170.             move_backward
  1171.         when "Toward Player"  
  1172.             move_toward_player
  1173.         when "Move Left"    
  1174.             move_straight(4)
  1175.         when "Move Right"
  1176.             move_straight(6)
  1177.         when "Move Up"    
  1178.             move_straight(8)
  1179.         when "Move Down"
  1180.             move_straight(2)
  1181.         when "All Shoot"  
  1182.               if self.action != nil
  1183.                  turn_right_45
  1184.                  self.shoot(self.action.id) unless @force_action_times == 0
  1185.               end
  1186.         when "Four Shoot"  
  1187.               if self.action != nil
  1188.                  turn_right_90
  1189.                  self.shoot(self.action.id) unless @force_action_times == 0
  1190.               end              
  1191.         when "Three Shoot"  
  1192.               if self.action != nil
  1193.                  case @force_action_times
  1194.                      when 2
  1195.                        turn_right_45
  1196.                      when 1
  1197.                        turn_left_90
  1198.                      when 0
  1199.                        turn_right_45
  1200.                  end  
  1201.                  self.shoot(self.action.id) unless @force_action_times == 0
  1202.               end      
  1203.         when "Two Shoot"  
  1204.               if self.action != nil
  1205.                  turn_180
  1206.                  self.shoot(self.action.id) unless @force_action_times == 0
  1207.               end  
  1208.         end  
  1209.   end  
  1210.  
  1211.   #--------------------------------------------------------------------------
  1212.   # ● Execute Force Action Tool Effect
  1213.   #--------------------------------------------------------------------------
  1214.   def execute_force_action_tool_effect
  1215.       action_effect_during_move    
  1216.       action_effect_after_move if @force_action_times == 0
  1217.   end  
  1218.  
  1219.   #--------------------------------------------------------------------------
  1220.   # ● Auto Action Effect During Move
  1221.   #--------------------------------------------------------------------------            
  1222.   def reset_auto_action  
  1223.       @force_action = ""
  1224.       @force_action_times = 0
  1225.       @anime_count = 0
  1226.   end
  1227.  
  1228.   #--------------------------------------------------------------------------
  1229.   # ● Action Effect During Move
  1230.   #--------------------------------------------------------------------------          
  1231.   def action_effect_during_move  
  1232.       if @tool_effect == "Boomerang" and @force_action == "Toward Player"  
  1233.          if @x == $game_player.x and @y == $game_player.y  
  1234.             self.action.duration = 15
  1235.             @force_action_times = 0
  1236.             @force_action_type = ""            
  1237.           end
  1238.       end
  1239.   end  
  1240.  
  1241.   #--------------------------------------------------------------------------
  1242.   # ● Action Effect After Move
  1243.   #--------------------------------------------------------------------------            
  1244.   def action_effect_after_move
  1245.       if @tool_effect == "Boomerang"
  1246.          @force_action_times = 30
  1247.          @force_action = "Toward Player"  
  1248.          @move_frequency = 6
  1249.          @move_speed = 5.5          
  1250.       end    
  1251.   end      
  1252.      
  1253. end  
  1254.  
  1255.  
  1256. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1257. #■ MOVEMENT - EXTRA MOVEMENT
  1258. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1259.  
  1260.  
  1261. #===============================================================================
  1262. # ■ Game Character
  1263. #===============================================================================
  1264. class Game_Character < Game_CharacterBase
  1265.  
  1266.   #--------------------------------------------------------------------------
  1267.   # ● Check XY
  1268.   #--------------------------------------------------------------------------      
  1269.   def check_xy
  1270.       @pre_x = @x
  1271.       @pre_y = @y
  1272.   end    
  1273.  
  1274.   #--------------------------------------------------------------------------
  1275.   # ● Turn Reverse
  1276.   #--------------------------------------------------------------------------          
  1277.   def turn_reverse(dir)
  1278.       case dir    
  1279.         when 2; set_direction(8)
  1280.         when 4; set_direction(6)
  1281.         when 6; set_direction(4)
  1282.         when 8; set_direction(2)
  1283.       end    
  1284.   end
  1285.  
  1286.   #--------------------------------------------------------------------------
  1287.   # ● Org Here
  1288.   #--------------------------------------------------------------------------        
  1289.   def org_here
  1290.       @orig_pos_x = @x
  1291.       @orig_pos_y = @y
  1292.   end  
  1293.  
  1294.   #--------------------------------------------------------------------------
  1295.   # ● return_org
  1296.   #--------------------------------------------------------------------------          
  1297.   def return_org(type = 0)
  1298.       if type == 1
  1299.          moveto(@orig_pos_x,@orig_pos_x)
  1300.       else  
  1301.          jump(0,0)
  1302.       end
  1303.       @x = @orig_pos_x
  1304.       @y = @orig_pos_y
  1305.   end  
  1306.  
  1307.   #--------------------------------------------------------------------------
  1308.   # ● Dual Switch
  1309.   #--------------------------------------------------------------------------    
  1310.   def dual_switch(switch_on, switch_off,percentage = 100)
  1311.       enable_per = rand(100)
  1312.       if enable_per <= percentage
  1313.          $game_switches[switch_on] = true    
  1314.          $game_switches[switch_off] = false
  1315.          $game_map.need_refresh = true
  1316.       end  
  1317.   end  
  1318.  
  1319.   #--------------------------------------------------------------------------
  1320.   # ● Move Forward 2
  1321.   #--------------------------------------------------------------------------  
  1322.   def move_forward2
  1323.       return if moving2?
  1324.       move_forward
  1325.   end  
  1326.  
  1327.   #--------------------------------------------------------------------------
  1328.   # ● Bounce Direction
  1329.   #--------------------------------------------------------------------------  
  1330.   def bounce_direction
  1331.       @diagonal = true
  1332.       turn_random  
  1333.   end
  1334.  
  1335.   #--------------------------------------------------------------------------
  1336.   # ● Turn_back
  1337.   #--------------------------------------------------------------------------            
  1338.   def turn_back
  1339.       if @diagonal_direction != 0
  1340.          case @diagonal_direction
  1341.               when 1
  1342.                 turn_upper_right
  1343.               when 3
  1344.                 turn_upper_left
  1345.               when 7
  1346.                 turn_lower_right
  1347.               when 9        
  1348.                 turn_lower_left
  1349.          end
  1350.       else
  1351.           case @direction
  1352.                when 2;   set_direction(8)
  1353.                when 4;   @direction = 6#move_straight(6)#set_direction(6)
  1354.                when 6;   set_direction(4)
  1355.                when 8;   set_direction(2)
  1356.           end
  1357.       end    
  1358.   end  
  1359.  
  1360.   #--------------------------------------------------------------------------
  1361.   # ● Jump_high
  1362.   #--------------------------------------------------------------------------
  1363.   def jump_high(x_plus,y_plus,high = 10)    
  1364.       @x += x_plus
  1365.       @y += y_plus
  1366.       distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
  1367.       @jump_peak = high + distance - @move_speed
  1368.       @jump_count = @jump_peak * 2
  1369.       @stop_count = 0
  1370.       straighten
  1371.   end
  1372.  
  1373.   #--------------------------------------------------------------------------
  1374.   # ● Passable Temp
  1375.   #--------------------------------------------------------------------------    
  1376.  def passable_temp_id?(x, y)
  1377.      return false unless $game_map.valid?(x, y)    
  1378.      return true if @through or debug_through?    
  1379.      return false unless map_passable?(x, y,@direction)        
  1380.      return false if collide_with_characters_temp_id?(x, y)
  1381.      return true                                  
  1382.   end
  1383.  
  1384.   #--------------------------------------------------------------------------
  1385.   # ● Collide With Characters
  1386.   #--------------------------------------------------------------------------      
  1387.   def collide_with_characters_temp_id?(x, y)
  1388.       for event in $game_map.events_xy(x, y)        
  1389.           unless event.through or event.battler != nil    
  1390.              return true if self.is_a?(Game_Event)      
  1391.              return true if event.priority_type >= 1    
  1392.           end
  1393.       end
  1394.       return false
  1395.   end  
  1396.  
  1397.   #--------------------------------------------------------------------------
  1398.   # ● Force Move Route
  1399.   #--------------------------------------------------------------------------
  1400.   alias x_force_move_route force_move_route
  1401.   def force_move_route(move_route)
  1402.       if self.battler != nil and self.is_a?(Game_Event)
  1403.          return
  1404.       end  
  1405.       x_force_move_route(move_route)
  1406.   end  
  1407. end  
  1408.  
  1409.  
  1410. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1411. #■ MOVEMENT - PLAYER COMMANDS
  1412. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1413.  
  1414.  
  1415. #==============================================================================
  1416. # ■ Game_Player
  1417. #==============================================================================
  1418. class Game_Player < Game_Character
  1419.   include XAS_BUTTON
  1420.  
  1421.   #--------------------------------------------------------------------------
  1422.   # ● Update Action Command
  1423.   #--------------------------------------------------------------------------  
  1424.   def update_action_command
  1425.       update_check_battler_equipment if can_check_battler_equipment?
  1426.       update_dash_button
  1427.       update_auto_target_shoot
  1428.       update_combo_time
  1429.       update_action_1_button
  1430.       update_action_2_button
  1431.       update_skill_button
  1432.       update_item_button
  1433.       update_change_leader_button
  1434.       update_charge_button
  1435.   end  
  1436.  
  1437.   #--------------------------------------------------------------------------
  1438.   # ● Can Use Command?
  1439.   #--------------------------------------------------------------------------      
  1440.   def can_use_command?
  1441.       return false if $game_map.interpreter.running?
  1442.       return false if $game_message.visible
  1443.       return false if self.battler == nil
  1444.       return false if self.action != nil
  1445.       return false if self.knockbacking?      
  1446.       return false if @stop
  1447.       return true
  1448.   end    
  1449.  
  1450.   #--------------------------------------------------------------------------
  1451.   # ● Update Check Battler Equipment
  1452.   #--------------------------------------------------------------------------      
  1453.   def update_check_battler_equipment
  1454.  
  1455.   end  
  1456.  
  1457.   #--------------------------------------------------------------------------
  1458.   # ● Can Check Battler Equipment
  1459.   #--------------------------------------------------------------------------        
  1460.   def can_check_battler_equipment?
  1461.       if self.battler.old_equipment_id[0] != self.battler.equips[0] or
  1462.          self.battler.old_equipment_id[1] != self.battler.equips[1] or
  1463.          self.battler.old_equipment_id[2] != self.battler.equips[2] or
  1464.          self.battler.old_equipment_id[3] != self.battler.equips[3] or
  1465.          self.battler.old_equipment_id[4] != self.battler.equips[4]
  1466.          self.battler.old_equipment_id[0] = self.battler.equips[0]
  1467.          self.battler.old_equipment_id[1] = self.battler.equips[1]
  1468.          self.battler.old_equipment_id[2] = self.battler.equips[2]
  1469.          self.battler.old_equipment_id[3] = self.battler.equips[3]
  1470.          self.battler.old_equipment_id[4] = self.battler.equips[4]      
  1471.          return true
  1472.       end  
  1473.       return false
  1474.   end
  1475.  
  1476.   #--------------------------------------------------------------------------
  1477.   # ● Update Charge Button
  1478.   #--------------------------------------------------------------------------    
  1479.   def update_charge_button
  1480.       return unless can_charge_command?
  1481.       if Input.press?(ACTION_1_BUTTON) and ENABLE_ACTION_1_BUTTON
  1482.          update_charge_effect(0)
  1483.          reset_charge_temp if Input.press?(ACTION_2_BUTTON) and ENABLE_ACTION_2_BUTTON
  1484.       elsif Input.press?(ACTION_2_BUTTON)
  1485.          update_charge_effect(1)
  1486.          reset_charge_temp if Input.press?(ACTION_1_BUTTON)
  1487.       else
  1488.          if self.battler.x_charge_action[2] >= self.battler.x_charge_action[1]
  1489.             self.shoot(self.battler.x_charge_action[0])
  1490.          end
  1491.         reset_charge_temp
  1492.       end  
  1493.   end
  1494.  
  1495.   #--------------------------------------------------------------------------
  1496.   # ● Update Charge Effect
  1497.   #--------------------------------------------------------------------------        
  1498.   def update_charge_effect(type)
  1499.       if self.battler.x_charge_action[2] == 0
  1500.          return unless equipped_charge_action?(type)
  1501.       end  
  1502.       if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
  1503.          self.battler.x_charge_action[2] += 1
  1504.       end
  1505.       self.battler.x_charge_action[3] += 1
  1506.       if self.battler.x_charge_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
  1507.          self.battler.x_charge_action[3] = 0
  1508.          if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
  1509.             self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION1_ID
  1510.          else
  1511.             self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION2_ID
  1512.          end  
  1513.       end
  1514.   end
  1515.  
  1516.   #--------------------------------------------------------------------------
  1517.   # ● Equipped Charge Action
  1518.   #--------------------------------------------------------------------------          
  1519.   def equipped_charge_action?(type)
  1520.       case type
  1521.          when 0
  1522.            weapon = self.battler.equips[0]
  1523.          when 1
  1524.            weapon = self.battler.equips[1]
  1525.       end
  1526.       if weapon == nil
  1527.          return false
  1528.          reset_charge_temp
  1529.       end
  1530.       if weapon.note =~ /<Charge Action = (\d+) - (\d+)>/  
  1531.          self.battler.x_charge_action[0] = $1.to_i rescue 0#Skill ID
  1532.          self.battler.x_charge_action[1] = $2.to_i rescue 0#Max Time
  1533.          self.battler.x_charge_action[2] = 0#Current Time
  1534.          self.battler.x_charge_action[3] = 0#Loop Anime Time
  1535.          return true
  1536.       end            
  1537.       return false    
  1538.       reset_charge_temp
  1539.   end
  1540.  
  1541.   #--------------------------------------------------------------------------
  1542.   # ● Update Combo Time
  1543.   #--------------------------------------------------------------------------        
  1544.   def update_combo_time
  1545.       return if self.battler.x_combo[2] == 0
  1546.       self.battler.x_combo[2] -= 1
  1547.       if self.battler.x_combo[2] == 0
  1548.          self.battler.x_combo[0] = 0
  1549.          self.battler.x_combo[1] = -1
  1550.       end  
  1551.   end  
  1552.  
  1553.   #--------------------------------------------------------------------------
  1554.   # ● Can Use Weapon Command?
  1555.   #--------------------------------------------------------------------------    
  1556.   def can_use_weapon_command?
  1557.       return false if $game_system.command_enable == false
  1558.       return false unless ENABLE_ACTION_1_BUTTON
  1559.       return false if self.battler.shield
  1560.       return false if self.battler.cast_action[4] > 0
  1561.       return false if self.battler.x_charge_action[2] > 0
  1562.       return true
  1563.   end
  1564.  
  1565.   #--------------------------------------------------------------------------
  1566.   # ● Can Use Shield Command?
  1567.   #--------------------------------------------------------------------------      
  1568.   def can_use_shield_command?
  1569.       return false if $game_system.command_enable == false
  1570.       return false unless ENABLE_ACTION_2_BUTTON
  1571.       return false if self.battler.equips[1] == nil
  1572.       return false if self.battler.equips[1].id == 0
  1573.       return false if self.battler.cast_action[4] > 0
  1574.       return false if self.battler.x_charge_action[2] > 0
  1575.       return true
  1576.   end
  1577.  
  1578.   #--------------------------------------------------------------------------
  1579.   # ● Can Use Skill Command?
  1580.   #--------------------------------------------------------------------------    
  1581.   def can_use_skill_command?
  1582.       return false if $game_system.command_enable == false
  1583.       return false unless ENABLE_SKILL_BUTTON
  1584.       return false if self.battler.shield
  1585.       return false if self.battler.cast_action[4] > 0
  1586.       return false if self.battler.x_charge_action[2] > 0
  1587.       return true
  1588.   end    
  1589.  
  1590.   #--------------------------------------------------------------------------
  1591.   # ● Can Use Item Command?
  1592.   #--------------------------------------------------------------------------    
  1593.   def can_use_item_command?
  1594.       return false if $game_system.command_enable == false
  1595.       return false unless ENABLE_ITEM_BUTTON
  1596.       return false if self.battler.shield    
  1597.       return false if self.battler.cast_action[4] > 0
  1598.       return false if self.battler.x_charge_action[2] > 0
  1599.       return true
  1600.   end      
  1601.  
  1602.   #--------------------------------------------------------------------------
  1603.   # ● Can Charge Command
  1604.   #--------------------------------------------------------------------------      
  1605.   def can_charge_command?
  1606.       return false if $game_system.command_enable == false
  1607.       return false if self.battler.cast_action[4] > 0
  1608.       return false if self.battler.shield      
  1609.       return true
  1610.   end  
  1611.  
  1612.   #--------------------------------------------------------------------------
  1613.   # ● Can Use Change Leader Command?
  1614.   #--------------------------------------------------------------------------      
  1615.   def can_use_change_leader_command?
  1616.       return false unless ENABLE_CHANGE_LEADER_BUTTON
  1617.       return false if self.battler.shield    
  1618.       return false if self.battler.cast_action[4] > 0
  1619.       return false if self.battler.x_charge_action[2] > 0
  1620.       return false if $game_temp.change_leader_wait_time > 0
  1621.       return true
  1622.   end
  1623.  
  1624.   #--------------------------------------------------------------------------
  1625.   # ● State_Seal Command
  1626.   #--------------------------------------------------------------------------        
  1627.   def state_seal_command?(type)
  1628.       seal = false
  1629.       case type  
  1630.          when 0
  1631.             seal = true if self.battler.state_mute
  1632.             seal = true if self.battler.state_seal_attack
  1633.          when 1
  1634.             seal = true if self.battler.state_mute
  1635.             seal = true if self.battler.state_seal_attack
  1636.          when 2
  1637.             seal = true if self.battler.state_mute
  1638.             seal = true if self.battler.state_seal_skill
  1639.          when 3  
  1640.             seal = true if self.battler.state_mute  
  1641.             seal = true if self.battler.state_seal_item
  1642.       end
  1643.       if seal
  1644.          seal_effect
  1645.          return true
  1646.       end  
  1647.       return false      
  1648.   end  
  1649.  
  1650.   #--------------------------------------------------------------------------
  1651.   # ● Check Equipped Action
  1652.   #--------------------------------------------------------------------------    
  1653.   def check_equipped_action(command_type)
  1654.       case command_type
  1655.          when 0 # Weapon 1
  1656.             weapon = self.battler.equips[0]
  1657.             if weapon == nil
  1658.                self.battler.x_action1_id = 0
  1659.                return
  1660.             end
  1661.             weapon.note =~ /<Action ID = (\d+)>/  
  1662.             action_id =  $1.to_i
  1663.             action_id = 0 if action_id == nil
  1664.             self.battler.x_action1_id = action_id
  1665.          when 1 # Weapon 2
  1666.             weapon = self.battler.equips[1]
  1667.             if weapon == nil
  1668.                self.battler.x_action2_id = 0
  1669.                return
  1670.             end  
  1671.             weapon.note =~ /<Action ID = (\d+)>/
  1672.             action_id =  $1.to_i
  1673.             action_id = 0 if action_id == nil            
  1674.             self.battler.x_action2_id = action_id
  1675.          when 2 # Skill  
  1676.            
  1677.          when 3 # Item
  1678.             item_id = $data_items[self.battler.item_id]
  1679.             if item_id == nil            
  1680.                self.battler.x_item_id =  0
  1681.                return
  1682.             end  
  1683.             item_id.note =~ /<Action ID = (\d+)>/
  1684.             action_id =  $1.to_i
  1685.             action_id = 0 if action_id == nil    
  1686.             self.battler.x_item_id = action_id
  1687.       end    
  1688.   end
  1689.    
  1690.   #--------------------------------------------------------------------------
  1691.   # ● Execute Combo
  1692.   #--------------------------------------------------------------------------        
  1693.   def execute_combo?(type)  
  1694.       if type == self.battler.x_combo[1] and self.battler.x_combo[0] != 0
  1695.          return if state_seal_command?(type)        
  1696.          self.shoot(self.battler.x_combo[0])
  1697.          self.battler.x_combo[1] = type
  1698.          return true
  1699.       end  
  1700.       self.battler.x_combo[0] = 0
  1701.       self.battler.x_combo[1] = type
  1702.       self.battler.x_combo[2] = 0
  1703.       return false
  1704.   end
  1705.  
  1706.   #--------------------------------------------------------------------------
  1707.   # ● Update Change Leader Button
  1708.   #--------------------------------------------------------------------------        
  1709.   def update_change_leader_button
  1710.       if Input.trigger?(CHANGE_LEADER_BUTTON)
  1711.          return unless can_use_change_leader_command?
  1712.          change_leader    
  1713.       end
  1714.   end
  1715.  
  1716.   #--------------------------------------------------------------------------
  1717.   # ● Update Action 1 Button
  1718.   #--------------------------------------------------------------------------      
  1719.   def update_action_1_button
  1720.       if Input.trigger?(ACTION_1_BUTTON)
  1721.          type = 0
  1722.          return unless can_use_weapon_command?
  1723.          return if execute_combo?(type)
  1724.          check_equipped_action(type)
  1725.          action_id = self.battler.x_action1_id
  1726.          return if action_id == 0
  1727.          return if state_seal_command?(type)
  1728.          self.shoot(action_id)
  1729.       end    
  1730.   end
  1731.    
  1732.   #--------------------------------------------------------------------------
  1733.   # ● Update Action 2 Button
  1734.   #--------------------------------------------------------------------------    
  1735.   def update_action_2_button
  1736.       if Input.trigger?(ACTION_2_BUTTON)
  1737.          if self.battler.equips[1].is_a?(RPG::Weapon)
  1738.             type = 1
  1739.             return unless can_use_weapon_command?
  1740.             return if execute_combo?(type)
  1741.             check_equipped_action(type)
  1742.             action_id = self.battler.x_action2_id
  1743.             return if action_id == 0
  1744.             return if state_seal_command?(type)            
  1745.             self.shoot(action_id)
  1746.             return
  1747.          end  
  1748.       end        
  1749.       update_shield_button
  1750.   end
  1751.  
  1752.   #--------------------------------------------------------------------------
  1753.   # ● Update Shield Button
  1754.   #--------------------------------------------------------------------------        
  1755.   def update_shield_button
  1756.       if Input.press?(ACTION_2_BUTTON)
  1757.          if can_use_shield_command?
  1758.             unless self.battler.shield  
  1759.                 shield = self.battler.equips[1]
  1760.                 if shield.note =~ /<Action>/
  1761.                    if shield.note =~ /<Pose = (\w+)>/
  1762.                       make_pose($1.to_s, 2)
  1763.                    end
  1764.                 else  
  1765.                    self.battler.shield = false
  1766.                    return
  1767.                 end
  1768.             end
  1769.             self.x_pose_duration = 2
  1770.             self.battler.shield = true
  1771.             update_shield_diretion_button
  1772.          else
  1773.             self.battler.shield = false
  1774.          end  
  1775.       else  
  1776.          self.battler.shield = false
  1777.       end      
  1778.   end
  1779.  
  1780.   #--------------------------------------------------------------------------
  1781.   # ● update_shield_direction_button
  1782.   #--------------------------------------------------------------------------          
  1783.   def update_shield_diretion_button
  1784.       return if @direction_fix
  1785.       case Input.dir4
  1786.          when 2;  set_direction(2)  
  1787.          when 4;  set_direction(4)  
  1788.          when 6;  set_direction(6)  
  1789.          when 8;  set_direction(8)  
  1790.       end
  1791.   end
  1792.  
  1793.   #--------------------------------------------------------------------------
  1794.   # ● Update Skill Button
  1795.   #--------------------------------------------------------------------------      
  1796.   def update_skill_button
  1797.       if Input.trigger?(SKILL_BUTTON)
  1798.          type = 2
  1799.          return unless can_use_skill_command?
  1800.          return if execute_combo?(type)
  1801.          check_equipped_action(type)
  1802.          action_id = self.battler.skill_id
  1803.          return if action_id == 0
  1804.          return if state_seal_command?(type)        
  1805.          self.shoot(action_id)
  1806.       end    
  1807.   end
  1808.  
  1809.   #--------------------------------------------------------------------------
  1810.   # ● Update Item Button
  1811.   #--------------------------------------------------------------------------      
  1812.   def update_item_button
  1813.       if Input.trigger?(ITEM_BUTTON)
  1814.          type = 3        
  1815.          return unless can_use_item_command?
  1816.          return if execute_combo?(type)
  1817.          check_equipped_action(type)
  1818.          action_id = self.battler.x_item_id
  1819.          return if action_id == 0
  1820.          return if state_seal_command?(type)        
  1821.          self.shoot(action_id)
  1822.       end  
  1823.   end
  1824.  
  1825.   #--------------------------------------------------------------------------
  1826.   # ● Update Auto Target Shoot
  1827.   #--------------------------------------------------------------------------
  1828.   def update_auto_target_shoot
  1829.       return if $game_temp.xas_target_time == 0
  1830.       return if $game_temp.xas_target_shoot_id == 0
  1831.       return if $game_temp.xas_target_x == 0 and $game_temp.xas_target_y == 0  
  1832.       $game_temp.xas_target_time -= 1
  1833.       if $game_temp.xas_target_time == 0
  1834.          self.shoot($game_temp.xas_target_shoot_id)
  1835.          $game_temp.xas_target_shoot_id = 0
  1836.       end  
  1837.   end  
  1838.  
  1839.  #--------------------------------------------------------------------------
  1840.  # ● Dash?
  1841.  #--------------------------------------------------------------------------            
  1842.  alias x_dash dash?
  1843.  def dash?  
  1844.      return false if XAS_SYSTEM::DASH_SYSTEM
  1845.      x_dash
  1846.  end
  1847.  
  1848.  #--------------------------------------------------------------------------
  1849.  # ● Can Dash?
  1850.  #--------------------------------------------------------------------------              
  1851.  def can_dash?
  1852.      return false unless XAS_BUTTON::ENABLE_DASH_BUTTON
  1853.      return false if self.battler.shield
  1854.      return true if Input.press?(XAS_BUTTON::DASH_BUTTON)
  1855.      @dash_active = false
  1856.      return false
  1857.  end
  1858.  
  1859.  #--------------------------------------------------------------------------
  1860.  # ● Update Dash Command
  1861.  #--------------------------------------------------------------------------            
  1862.  def update_dash_button
  1863.      return unless can_dash?
  1864.      @dash_active = true
  1865.      @anime_count -= 0.5 if moving?
  1866.      update_dash_sprite_name
  1867.  end  
  1868.  
  1869.  #--------------------------------------------------------------------------
  1870.  # ● Update Dash Sprite Name
  1871.  #--------------------------------------------------------------------------              
  1872.  def update_dash_sprite_name
  1873.      make_pose("_Dash", 2)
  1874.  end
  1875.  
  1876. end
  1877.  
  1878.  
  1879. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1880. #■ TOOL - INITIALIZE
  1881. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1882.  
  1883.  
  1884. #===============================================================================
  1885. # ■ Game_Map
  1886. #===============================================================================
  1887. class Game_Map
  1888.  
  1889.   attr_accessor :need_refresh_token
  1890.  
  1891.   #--------------------------------------------------------------------------
  1892.   # ● need_add_tokens
  1893.   #--------------------------------------------------------------------------  
  1894.   def need_add_tokens
  1895.       @need_add_tokens = [] if @need_add_tokens == nil
  1896.       return @need_add_tokens
  1897.   end
  1898.  
  1899.   #--------------------------------------------------------------------------
  1900.   # ● need_remove_tokens
  1901.   #--------------------------------------------------------------------------
  1902.   def need_remove_tokens
  1903.       @need_remove_tokens = [] if @need_remove_tokens == nil
  1904.       return @need_remove_tokens
  1905.   end
  1906.  
  1907.   #--------------------------------------------------------------------------
  1908.   # ● add_token
  1909.   #--------------------------------------------------------------------------
  1910.   def add_token(token_event)
  1911.       $game_temp.tool_event = [] if $game_temp.tool_event == nil
  1912.       $game_temp.tool_event.push(token_event)
  1913.       self.need_add_tokens.push(token_event)
  1914.       self.need_refresh_token = true
  1915.   end
  1916.  
  1917.   #--------------------------------------------------------------------------
  1918.   # ● remove_token
  1919.   #--------------------------------------------------------------------------
  1920.   def remove_token(token_event)
  1921.       @events.delete(token_event.id)
  1922.       self.need_remove_tokens.push(token_event)
  1923.       self.need_refresh_token = true
  1924.   end
  1925.  
  1926.   #--------------------------------------------------------------------------
  1927.   # ● clear_tokens
  1928.   #--------------------------------------------------------------------------
  1929.   def clear_tokens
  1930.       $game_system.tools_on_map.clear
  1931.       $game_system.tools_on_map = []
  1932.       for event in @events.values.dup
  1933.           remove_token(event) if event.is_a?(Token_Event)
  1934.       end
  1935.       channels = ["A", "B", "C", "D"]
  1936.       for id in 1001..(token_id_shift - 1)
  1937.           for a in channels
  1938.               key = [self.map_id, id, a]
  1939.               $game_self_switches.delete(key)
  1940.           end
  1941.       end
  1942.       clear_token_id
  1943.   end
  1944.    
  1945.   #--------------------------------------------------------------------------
  1946.   # ● Update
  1947.   #--------------------------------------------------------------------------      
  1948.   alias x_temp_tool_hash_update update
  1949.   def update(main = false)
  1950.       x_temp_tool_hash_update(main)
  1951.       update_add_tool_hash
  1952.   end
  1953.  
  1954.   #--------------------------------------------------------------------------
  1955.   # ● Update Add Toll Hash
  1956.   #--------------------------------------------------------------------------      
  1957.   def update_add_tool_hash  
  1958.       return if $game_temp.tool_event == nil
  1959.       for i in $game_temp.tool_event
  1960.           $game_map.events[i.id] = i
  1961.           execute_tool_effects_hash(i)
  1962.       end  
  1963.       $game_temp.tool_event.clear
  1964.       $game_temp.tool_event = nil
  1965.   end
  1966.    
  1967.   #--------------------------------------------------------------------------
  1968.   # ● Execute Toll Effects Hash
  1969.   #--------------------------------------------------------------------------        
  1970.   def execute_tool_effects_hash(i)
  1971.      
  1972.   end  
  1973. end
  1974.  
  1975. #===============================================================================
  1976. # ■ Game_SelfSwitches  
  1977. #===============================================================================
  1978. class Game_SelfSwitches
  1979.   def delete(key)
  1980.       @data.delete(key)
  1981.   end
  1982. end
  1983.  
  1984. #===============================================================================
  1985. # ■ Game_Map  
  1986. #===============================================================================
  1987. class Game_Map
  1988.    
  1989.   attr_accessor :token_id
  1990.  
  1991.   #--------------------------------------------------------------------------
  1992.   # ● token_id_shift
  1993.   #--------------------------------------------------------------------------  
  1994.   def token_id_shift
  1995.       @token_id  = 1000 if @token_id == nil
  1996.       @token_id += 1
  1997.       return @token_id
  1998.   end
  1999.  
  2000.   #--------------------------------------------------------------------------
  2001.   # ● clear_token_id
  2002.   #--------------------------------------------------------------------------  
  2003.   def clear_token_id
  2004.       @token_id = nil
  2005.   end
  2006. end
  2007.  
  2008. #===============================================================================
  2009. # ■ XRXS_CTS_RefreshToken
  2010. #===============================================================================
  2011. module XRXS_CTS_RefreshToken
  2012.  
  2013.   #--------------------------------------------------------------------------
  2014.   # ● refresh_token
  2015.   #--------------------------------------------------------------------------  
  2016.   def refresh_token
  2017.       for event in $game_map.need_add_tokens
  2018.           @character_sprites.push(Sprite_Character.new(@viewport1, event))
  2019.       end
  2020.       $game_map.need_add_tokens.clear
  2021.       for sprite in @character_sprites.dup
  2022.           if $game_map.need_remove_tokens.empty?
  2023.              break
  2024.           end
  2025.           if $game_map.need_remove_tokens.delete(sprite.character)
  2026.              @character_sprites.delete(sprite)
  2027.              sprite.dispose
  2028.           end
  2029.       end
  2030.       $game_map.need_refresh_token = false
  2031.   end
  2032. end
  2033.  
  2034. #===============================================================================
  2035. # ■  Spriteset_Map
  2036. #===============================================================================
  2037. class Spriteset_Map
  2038.   include XRXS_CTS_RefreshToken
  2039.  
  2040.   #--------------------------------------------------------------------------
  2041.   # ● Initialize
  2042.   #--------------------------------------------------------------------------    
  2043.   alias x_smap_initialize initialize
  2044.   def initialize
  2045.       setup_start
  2046.       x_smap_initialize
  2047.   end
  2048.  
  2049.   #--------------------------------------------------------------------------
  2050.   # ● Setup Start
  2051.   #--------------------------------------------------------------------------      
  2052.   def setup_start
  2053.       $game_player.reset_old_level(true)
  2054.   end
  2055.  
  2056. end
  2057.  
  2058. #===============================================================================
  2059. # ■ Game_Player
  2060. #===============================================================================
  2061. class Game_Player < Game_Character
  2062.  
  2063.   #--------------------------------------------------------------------------
  2064.   # ● x_reserve_transfer
  2065.   #--------------------------------------------------------------------------    
  2066.   alias x_reserve_transfer reserve_transfer
  2067.   def reserve_transfer(map_id, x, y, direction)
  2068.       $game_map.clear_tokens
  2069.       if $game_temp.tool_event != nil
  2070.          $game_temp.tool_event.clear
  2071.          $game_temp.tool_event = nil
  2072.       end  
  2073.       x_reserve_transfer(map_id, x, y, direction)
  2074.   end
  2075.  
  2076. end
  2077.  
  2078. #===============================================================================
  2079. # ■ Token_Event
  2080. #===============================================================================
  2081. class Token_Event < Game_Event
  2082.  
  2083.   #--------------------------------------------------------------------------
  2084.   # ● Token_Event
  2085.   #--------------------------------------------------------------------------
  2086.   def initialize(map_id, event)
  2087.       event.id = $game_map.token_id_shift
  2088.       super
  2089.   end
  2090.  
  2091.   #--------------------------------------------------------------------------
  2092.   # ● erase
  2093.   #--------------------------------------------------------------------------
  2094.   def erase
  2095.       super
  2096.       $game_map.remove_token(self)
  2097.   end
  2098. end
  2099.  
  2100.  
  2101. #===============================================================================
  2102. # ■  XRXS_ActionTemplate
  2103. #===============================================================================
  2104. module XRXS_ActionTemplate
  2105.   map_id = XAS_SYSTEM::ACTION_TEMPLATE_MAP_ID
  2106.   map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  2107.   @@events = map.events
  2108. end
  2109.  
  2110. #===============================================================================
  2111. # ■  Token_Event
  2112. #===============================================================================
  2113. class Token_Event < Game_Event
  2114.   include XRXS_ActionTemplate
  2115. end
  2116.  
  2117. #===============================================================================
  2118. # ■  Game_Temp
  2119. #===============================================================================
  2120. class Game_Temp
  2121.   attr_accessor :active_token
  2122. end
  2123.  
  2124.  
  2125.  
  2126. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2127. #■ TOOL - SHOOT COMMAND
  2128. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2129.  
  2130.  
  2131. #===============================================================================
  2132. # ■ XAS ACTION
  2133. #===============================================================================
  2134. module XAS_ACTION
  2135.   attr_reader   :action
  2136.   attr_reader   :erased
  2137.  
  2138.   #--------------------------------------------------------------------------
  2139.   # ● shoot
  2140.   #--------------------------------------------------------------------------
  2141.   def shoot(action_id = 0)
  2142.       return if action_id == 0
  2143.       skill = $data_skills[action_id]
  2144.       return unless can_shoot?(skill)
  2145.       execute_user_effects(skill)
  2146.       execute_call_event(action_id)      
  2147.       self.action_attachment(action_id)
  2148.       execute_set_pose(action_id)
  2149.   end
  2150.  
  2151.   #--------------------------------------------------------------------------
  2152.   # ● Can Shoot
  2153.   #--------------------------------------------------------------------------    
  2154.   def can_shoot?(skill)
  2155.       if self.battler == nil and self.tool_id > 0
  2156.          @battler = self.action.user.battler
  2157.       end  
  2158.       return false if self.battler == nil
  2159.       return false if skill == nil
  2160.       return true if ignore_can_shoot?(skill)
  2161.       enough_cost = true
  2162.       return false if tools_on_map?(skill.id)      
  2163.       if self.battler.state_mute  
  2164.          seal_effect
  2165.          return false
  2166.       end  
  2167.       if self.battler.cast_action[4].between?(1,self.battler.cast_action[1] -1)
  2168.          return false
  2169.       end
  2170.       return false if check_cast_action?(skill)
  2171.       return false if check_auto_target_select?(skill)
  2172.       unless enough_skill_cost?(skill)
  2173.          Audio.se_play("Audio/SE/" + XAS_SOUND::ACTION_COST , 100, 100)
  2174.          return false
  2175.       end
  2176.       return true
  2177.   end
  2178.  
  2179.   #--------------------------------------------------------------------------
  2180.   # ● Ignore Can Shoot?    
  2181.   #--------------------------------------------------------------------------                
  2182.   def ignore_can_shoot?(skill)
  2183.       return false
  2184.   end
  2185.  
  2186.   #--------------------------------------------------------------------------
  2187.   # ● Tools on Map
  2188.   #--------------------------------------------------------------------------              
  2189.   def tools_on_map?(skill_id)
  2190.       return true if $game_system.tools_on_map.include?(skill_id)
  2191.       return false
  2192.   end  
  2193.  
  2194.   #--------------------------------------------------------------------------
  2195.   # ● Check Cast Action
  2196.   #--------------------------------------------------------------------------            
  2197.   def check_cast_action?(skill)
  2198.       if self.battler.cast_action[0] != 0
  2199.          self.battler.cast_action[0] = 0
  2200.          self.battler.cast_action[1] = 0
  2201.          self.battler.cast_action[2] = 0
  2202.          self.battler.cast_action[3] = 0
  2203.          self.battler.cast_action[4] = 0
  2204.          return false
  2205.       end  
  2206.       if skill.note =~ /<Cast Time = (\d+)>/ and
  2207.          $game_temp.xas_target_shoot_id == 0 and
  2208.          self.force_action_times == 0
  2209.          self.battler.cast_action[0] = skill.id
  2210.          self.battler.cast_action[1] = $1.to_i rescue 0
  2211.          self.battler.cast_action[2] = XAS_ANIMATION::CAST_TIME_ANIMATION_ID
  2212.          self.battler.cast_action[3] = 0
  2213.          self.battler.cast_action[4] = 0
  2214.          self.animation_id = self.battler.cast_action[2]
  2215.          return true
  2216.       end      
  2217.       return false
  2218.   end
  2219.  
  2220.   #--------------------------------------------------------------------------
  2221.   # ● Check Auto Target Select
  2222.   #--------------------------------------------------------------------------          
  2223.   def check_auto_target_select?(skill)
  2224.       return false if self.is_a?(Game_Event)
  2225.       if skill.note =~ /<Auto Target>/
  2226.          if $game_temp.xas_target_shoot_id == 0
  2227.             $game_temp.xas_target_shoot_id = skill.id
  2228.             $game_map.check_events_on_screen
  2229.             SceneManager.call(Scene_Target_Select)
  2230.             return true
  2231.          end          
  2232.       end  
  2233.       return false
  2234.   end
  2235.  
  2236.   #--------------------------------------------------------------------------
  2237.   # ● enough_skill_cost?
  2238.   #--------------------------------------------------------------------------          
  2239.   def enough_skill_cost?(skill)
  2240.       return false unless enough_mp_cost?(skill)        
  2241.       return false unless enough_item_cost?(skill)      
  2242.       return true
  2243.   end
  2244.    
  2245.   #--------------------------------------------------------------------------
  2246.   # ● Enough MP Cost
  2247.   #--------------------------------------------------------------------------        
  2248.   def enough_mp_cost?(skill)  
  2249.       if @force_action_times > 0
  2250.          return true if @force_action == "All Shoot"
  2251.          return true if @force_action == "Four Shoot"  
  2252.          return true if @force_action == "Three Shoot"
  2253.          return true if @force_action == "Two Shoot"
  2254.       end
  2255.       if self.battler.mp < skill.mp_cost
  2256.          self.battler.damage = XAS_WORD::NO_MP
  2257.          self.battler.damage_pop = true
  2258.          return false
  2259.       else  
  2260.          self.battler.mp -= skill.mp_cost
  2261.          return true
  2262.       end
  2263.       return true
  2264.   end  
  2265.  
  2266.   #--------------------------------------------------------------------------
  2267.   # ● Enough MP Cost
  2268.   #--------------------------------------------------------------------------      
  2269.   def enough_item_cost?(skill)
  2270.       return true if self.battler.is_a?(Game_Enemy)
  2271.       if @force_action_times > 0
  2272.          return true if @force_action == "All Shoot"
  2273.          return true if @force_action == "Four Shoot"
  2274.          return true if @force_action == "Three Shoot"
  2275.          return true if @force_action == "Two Shoot"
  2276.       end      
  2277.       skill.note =~ /<Item Cost = (\d+)>/
  2278.       item_id = $1.to_i
  2279.       if item_id != nil and item_id != 0
  2280.          item_cost = $data_items[item_id]
  2281.          number = $game_party.item_number(item_cost)
  2282.          if number == 0 or number == nil
  2283.             self.battler.damage = XAS_WORD::NO_ITEM
  2284.             self.battler.damage_pop = true
  2285.             return false
  2286.          else
  2287.             $game_party.lose_item(item_cost, 1, false)
  2288.             return true
  2289.          end            
  2290.       end    
  2291.       return true
  2292.   end    
  2293.  
  2294.   #--------------------------------------------------------------------------
  2295.   # ● Execute User Effects
  2296.   #--------------------------------------------------------------------------  
  2297.   def execute_user_effects(skill)
  2298.       self.battler.shield = false
  2299.       #Animation
  2300.       if skill.note =~ /<Cast Ani = (\d+)>/
  2301.          ani_id = $1.to_i    
  2302.          if ani_id != nil
  2303.             self.animation_id = ani_id
  2304.          end  
  2305.       end
  2306.       unless @force_action_times > 0
  2307.           #All Directions
  2308.           if skill.note =~ /<All Directions>/
  2309.              @force_action = "All Shoot"
  2310.              @force_action_times = 8        
  2311.           elsif skill.note =~ /<Four Directions>/
  2312.              @force_action = "Four Shoot"
  2313.              @force_action_times = 4      
  2314.           elsif skill.note =~ /<Three Directions>/
  2315.              @force_action = "Three Shoot"
  2316.              @force_action_times = 3        
  2317.           elsif skill.note =~ /<Two Directions>/
  2318.              @force_action = "Two Shoot"
  2319.              @force_action_times = 2        
  2320.           end  
  2321.       end  
  2322.   end
  2323.    
  2324.   #--------------------------------------------------------------------------
  2325.   # ● Execute Set Pose
  2326.   #--------------------------------------------------------------------------      
  2327.   def execute_set_pose(action_id)
  2328.       @action.duration = @action.sunflag
  2329.       make_pose(@action.self_motion, @action.sunflag )
  2330.       @pattern = 0
  2331.       @pattern_count  = 0
  2332.       @step_anime = true
  2333.       @self_motion = nil      
  2334.       self.need_refresh = true if self.is_a?(Game_Player)
  2335.   end  
  2336.    
  2337.   #--------------------------------------------------------------------------
  2338.   # ● execute_call_event
  2339.   #--------------------------------------------------------------------------  
  2340.   def execute_call_event(action_id)
  2341.       bullet_token = Token_Bullet.new(self, action_id)
  2342.       $game_map.add_token(bullet_token)
  2343.       return bullet_token
  2344.   end
  2345.      
  2346.   #--------------------------------------------------------------------------
  2347.   # ● action_attachment
  2348.   #--------------------------------------------------------------------------
  2349.   def action_attachment(action_id)
  2350.       @action = Game_Action_XAS.new(self, action_id)
  2351.       @action.attachment(action_id)
  2352.   end
  2353.  
  2354. end  
  2355.  
  2356.  
  2357. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2358. #■ TOOL - SHOOT SETTING
  2359. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2360.  
  2361.  
  2362. #===============================================================================
  2363. # ■ Game_Action_XAS
  2364. #===============================================================================
  2365. class Game_Action_XAS
  2366.  
  2367.   attr_accessor   :user
  2368.   attr_accessor   :id                    
  2369.   attr_accessor   :attack_id            
  2370.   attr_accessor   :attack_range
  2371.   attr_accessor   :attack_range_type
  2372.   attr_accessor   :hit_events
  2373.   attr_accessor   :now_count
  2374.   attr_accessor   :pre_now_count
  2375.   attr_accessor   :duration
  2376.   attr_accessor   :blow_power
  2377.   attr_accessor   :piercing
  2378.   attr_accessor   :ignore_knockback_invincible
  2379.   attr_accessor   :target_invunerable_duration
  2380.   attr_accessor   :multi_hit
  2381.   attr_accessor   :ally_damage
  2382.   attr_accessor   :all_damage
  2383.   attr_accessor   :sunflag
  2384.   attr_accessor   :self_motion
  2385.   attr_accessor   :second_animation_id
  2386.   attr_accessor   :third_animation_id
  2387.   attr_accessor   :attack_range_type
  2388.   attr_accessor   :attack_range_plan
  2389.   attr_accessor   :blow_power
  2390.   attr_accessor   :ignore_guard
  2391.   attr_accessor   :user_invincible  
  2392.   attr_accessor   :short_range
  2393.   attr_accessor   :first_impact_time
  2394.   attr_accessor   :animation_time
  2395.   attr_accessor   :duration
  2396.   attr_accessor   :item_cost
  2397.   attr_accessor   :hit_shake
  2398.   attr_accessor   :hit_hold_target
  2399.   attr_accessor   :hit_bounce
  2400.   attr_accessor   :sticky
  2401.   attr_accessor   :reflectable
  2402.   attr_accessor   :can_reflect
  2403.   attr_accessor   :attack_id_plan
  2404.   attr_accessor   :hit_action
  2405.   attr_accessor   :fake_id
  2406.   attr_accessor   :impact
  2407.  
  2408.   #--------------------------------------------------------------------------
  2409.   # ● initialize
  2410.   #--------------------------------------------------------------------------
  2411.   def initialize(user, action_id)
  2412.       @user        = user
  2413.       @id          = action_id
  2414.       @now_count   = 0
  2415.       @duration    = nil
  2416.       @attack_id   = 0
  2417.       @attack_range = 0
  2418.       @hit_events  = []
  2419.       @blow_power  = 0
  2420.       @skill = $data_skills[action_id]
  2421.       @ignore_knockback_invincible = false
  2422.       @multi_hit = false
  2423.       @piercing = false
  2424.       @all_damage = false
  2425.       @ally_damage = false
  2426.       @ignore_guard = false
  2427.       @sunflag = 10
  2428.       @duration = 10
  2429.       @self_motion = ""
  2430.       @attack_range_type = 1
  2431.       @attack_range_plan = 1
  2432.       @blow_power = 1
  2433.       @first_impact_time  = 0
  2434.       @animation_time = []
  2435.       @target_invunerable_duration = 10
  2436.       @second_animation_id = 0
  2437.       @third_animation_id = 0
  2438.       @user_invincible = false
  2439.       @short_range = false
  2440.       @item_cost = 0
  2441.       @hit_shake = false
  2442.       @hit_hold_target = false
  2443.       @hit_bounce = false
  2444.       @sticky = false
  2445.       @reflectable = false
  2446.       @can_reflect = false
  2447.       @hit_action = 0
  2448.       @fake_id = false
  2449.       @impact = true
  2450.   end
  2451.  
  2452.   #--------------------------------------------------------------------------
  2453.   # ● attachment
  2454.   #--------------------------------------------------------------------------
  2455.   def attachment(action_id)
  2456.       @attack_id_plan = [action_id]
  2457.       if @skill.note =~ /<Sunflag = (\d+)>/
  2458.          @sunflag = $1.to_i
  2459.       end
  2460.       if @skill.note =~ /<Duration = (\d+)>/  
  2461.          @duration = $1.to_i
  2462.       end
  2463.       if @skill.note =~ /<Pose = (\S+)>/  
  2464.          @self_motion = $1.to_s
  2465.       end
  2466.       if @skill.note =~ /<Area = (\w+)>/
  2467.          case $1
  2468.             when "CROSS"  
  2469.                area = 7
  2470.             when "WALL"
  2471.                area = 6        
  2472.             when "FRONTRHOMBUS"  
  2473.                area = 5
  2474.             when "FRONTSQUARE"
  2475.                area = 4
  2476.             when "LINE"
  2477.                area = 3
  2478.             when "SQUARE"
  2479.                area = 2              
  2480.             else  
  2481.                area = 1
  2482.          end    
  2483.          @attack_range_type = area
  2484.        end
  2485.       if @skill.note =~ /<Range = (\d+)>/  
  2486.          @attack_range_plan = [$1.to_i]
  2487.       end
  2488.       if @skill.note =~ /<Blow Power = (\d+)>/  
  2489.          @blow_power = $1.to_i
  2490.       end  
  2491.       if @skill.note =~ /<Impact Time  = (\d+)>/  
  2492.          @first_impact_time = $1.to_i
  2493.  
  2494.        end  
  2495.       if @skill.note =~ /<Animation Time  = (\d+) - (\d+)>/  
  2496.          @animation_time[0] = $1.to_i
  2497.          @animation_time[1] = $2.to_i
  2498.       end
  2499.       if @skill.note =~ /<Target Invunerable = (\d+)>/
  2500.          @target_invunerable_duration = $1.to_i
  2501.       end  
  2502.       if @skill.note =~ /<Tool Hit Ani = (\d+)>/      
  2503.          @second_animation_id = $1.to_i
  2504.       end        
  2505.       if @skill.note =~ /<User Hit Ani = (\d+)>/      
  2506.          @third_animation_id = $1.to_i
  2507.       end  
  2508.       if @skill.note =~ /<Item Cost = (\d+)>/    
  2509.          @item_cost = $1.to_i
  2510.       end        
  2511.       if @skill.note =~ /<Link Action ID = (\d+)>/    
  2512.          if user.battler != nil
  2513.             user.battler.x_combo[0] = $1.to_i
  2514.             user.battler.x_combo[2] = @sunflag + 20
  2515.          end
  2516.       else    
  2517.          if user.battler != nil
  2518.             user.battler.x_combo[0] = 0
  2519.             user.battler.x_combo[1] = 0
  2520.             user.battler.x_combo[2] = 0
  2521.          end            
  2522.       end  
  2523.       if @skill.note =~ /<Hit Action ID = (\d+)>/
  2524.          @hit_action = $1.to_i
  2525.       end
  2526.       if @skill.note =~ /<Ignore Knockback>/
  2527.          @ignore_knockback_invincible = true
  2528.       end      
  2529.       if @skill.note =~ /<Multi Hit>/
  2530.          @multi_hit = true  
  2531.       end        
  2532.       if @skill.note =~ /<Piercing>/
  2533.          @piercing = true
  2534.       end
  2535.       if @skill.note =~ /<All Damage>/
  2536.          @all_damage = true
  2537.       end
  2538.       if @skill.note =~ /<Ally Damage>/
  2539.          @ally_damage = true
  2540.       end      
  2541.       if @skill.note =~ /<User Invincible>/
  2542.          @user_invincible = true
  2543.       end      
  2544.       if @skill.note =~ /<Ignore Guard>/
  2545.          @ignore_guard = true
  2546.       end      
  2547.       if @skill.note =~ /<One Action>/
  2548.          unless $game_system.tools_on_map.include?(action_id)  
  2549.                 $game_system.tools_on_map.push(action_id)
  2550.          end
  2551.       end      
  2552.       if @skill.note =~ /<Shake>/
  2553.          @hit_shake = true
  2554.       end
  2555.       if @skill.note =~ /<User Range>/
  2556.          @short_range = true
  2557.       end      
  2558.       if @skill.note =~ /<Hit Hold Target>/
  2559.          @hit_hold_target = true
  2560.       end        
  2561.       if @skill.note =~ /<Hit Sticky Target>/
  2562.          @sticky = true
  2563.       end        
  2564.       if @skill.note =~ /<Hit Bounce Direction>/
  2565.          @hit_bounce = true
  2566.       end  
  2567.       if @skill.note =~ /<Reflectable>/
  2568.          @reflectable = true
  2569.       end        
  2570.       if @skill.note =~ /<Can Reflect>/
  2571.          @can_reflect = true
  2572.       end  
  2573.       if @skill.note =~ /<Disable Hit>/
  2574.          @impact = false
  2575.       end
  2576.       @sunflag = 1 if @sunflag <= 0
  2577.   end
  2578.  
  2579.   #--------------------------------------------------------------------------
  2580.   # ● update
  2581.   #--------------------------------------------------------------------------
  2582.   def update
  2583.       @first_impact_time -= 1 if @first_impact_time > 0
  2584.       if @attack_id_plan != nil
  2585.          id = @attack_id_plan[@now_count]
  2586.          unless id.nil?
  2587.            @attack_id = id
  2588.            @hit_events.clear
  2589.            @hit_events.push(self.user) unless @all_damage or @ally_damage
  2590.          end
  2591.       end
  2592.       if @attack_range_plan != nil
  2593.          range = @attack_range_plan[@now_count]
  2594.          @attack_range = range unless range.nil?
  2595.       end
  2596.       @now_count += 1
  2597.   end  
  2598.  
  2599.   #--------------------------------------------------------------------------
  2600.   # ● done?
  2601.   #--------------------------------------------------------------------------
  2602.   def done?
  2603.       return (self.duration.to_i > 0 and self.now_count >= self.duration)
  2604.   end
  2605. end
  2606.  
  2607. #===============================================================================
  2608. # ■ Token_Bullet  
  2609. #===============================================================================
  2610. class Token_Bullet < Token_Event
  2611. include XRXS_ActionTemplate
  2612.   #--------------------------------------------------------------------------
  2613.   # ● initialize
  2614.   #--------------------------------------------------------------------------
  2615.   def initialize(user, action_id)
  2616.       event_id = action_id
  2617.       skill = $data_skills[action_id]
  2618.       if skill.note =~ /<Event ID = (\d+)>/
  2619.          event_id = $1.to_i
  2620.       end  
  2621.       original_event = @@events[event_id]
  2622.       if original_event == nil
  2623.          msgbox("There's no Event ID " + event_id.to_s + " on Tool Map!")
  2624.          SceneManager.exit
  2625.          return
  2626.       end  
  2627.       event = original_event.dup
  2628.       event.x = user.x
  2629.       event.y = user.y
  2630.       pre_direction = event.pages[0].graphic.direction
  2631.       event.pages[0].graphic.direction = user.direction
  2632.       @character_name = event.pages[0].graphic
  2633.       super($game_map.map_id, event)
  2634.       self.action_attachment(action_id)
  2635.       self.tool_id = action_id
  2636.       self.diagonal = false
  2637.       self.diagonal_direction = 0
  2638.       self.sprite_angle_enable = false
  2639.       @action.user = user
  2640.       @remain_for_an_act = @action.duration.is_a?(Numeric)
  2641.       check_tool_effects(user,skill,pre_direction)
  2642.   end
  2643.  
  2644.   #--------------------------------------------------------------------------
  2645.   # ● update
  2646.   #--------------------------------------------------------------------------
  2647.   def update
  2648.       super
  2649.       if @action == nil and @remain_for_an_act
  2650.          erase
  2651.          $game_system.tools_on_map.delete(self.tool_id)
  2652.       end
  2653.       check_event_trigger_attack
  2654.   end
  2655. end
  2656.  
  2657. #===============================================================================
  2658. # ■ Game Player
  2659. #===============================================================================
  2660. class Game_Player < Game_Character
  2661.   attr_accessor :need_refresh
  2662. end
  2663.  
  2664. #===============================================================================
  2665. # ■ Token_Bullet  
  2666. #===============================================================================
  2667. class Token_Bullet < Token_Event
  2668.  
  2669.   #--------------------------------------------------------------------------
  2670.   # ● Check Tool Effects
  2671.   #--------------------------------------------------------------------------
  2672.   def check_tool_effects(user,skill,pre_direction)
  2673.       if @action.ally_damage or @action.all_damage    
  2674.          user.battler.invunerable_duration = 0
  2675.       end
  2676.      # Force Update Out Screen
  2677.      if user.battler.sensor_range >= 15 or
  2678.         skill.note =~ /<Update Out Screen>/
  2679.         self.force_update = true
  2680.      end  
  2681.      #Diagonal Effect
  2682.      if skill.note =~ /<Diagonal>/ or
  2683.         skill.note =~ /<All Direction>/ or
  2684.         skill.note =~ /<Three Direction>/
  2685.         self.diagonal = true
  2686.         self.diagonal_direction = user.diagonal_direction
  2687.         self.sprite_angle_enable = true
  2688.         user.diagonal_time = XAS_BA::DIAGONAL_DURATION if user.diagonal_direction != 0
  2689.         user.diagonal = true if user.tool_id > 0        
  2690.      end
  2691.      #Auto Target
  2692.      if skill.note =~ /<Auto Target>/
  2693.         if user.is_a?(Game_Event)
  2694.            self.moveto($game_player.x, $game_player.y)
  2695.         else  
  2696.            moveto($game_temp.xas_target_x, $game_temp.xas_target_y)
  2697.            $game_temp.xas_target_x = 0
  2698.            $game_temp.xas_target_y = 0      
  2699.            $game_temp.xas_target_time = 0
  2700.            $game_temp.xas_target_shoot_id = 0
  2701.         end  
  2702.      end
  2703.      #Barrier
  2704.      if skill.note =~ /<Barrier>/
  2705.         self.tool_effect = "Barrier"
  2706.      end
  2707.      #Boomerang
  2708.      if skill.note =~ /<Boomerang = (\d+)>/
  2709.         self.tool_effect = "Boomerang"
  2710.         self.action.duration = 1000
  2711.         self.diagonal = true
  2712.         self.diagonal_direction = user.diagonal_direction
  2713.         self.force_update = true
  2714.         @move_frequency = 6
  2715.         @move_speed = 5
  2716.         @direction_fix = false
  2717.         @walk_anime = true
  2718.         @step_anime = true
  2719.         @force_action = "Forward"
  2720.         @force_action_times = $1.to_i
  2721.      end    
  2722.      
  2723.    end
  2724. end
  2725.  
  2726.  
  2727.  
  2728. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2729. #■ TOOL - AREA
  2730. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2731.  
  2732.  
  2733. #===============================================================================
  2734. # ■ XAS ACTION
  2735. #===============================================================================
  2736. module XAS_ACTION
  2737.  
  2738.   #--------------------------------------------------------------------------
  2739.   # ● action_update
  2740.   #--------------------------------------------------------------------------
  2741.   def action_update
  2742.       return unless @action.is_a?(Game_Action_XAS)
  2743.       if @action.animation_time != [] and
  2744.          @action.animation_time[0] == @action.now_count
  2745.          animation_id = @action.animation_time[1]
  2746.          unless self.is_a?(Game_Player) or self.tool_id == 0
  2747.              self.animation_id = animation_id
  2748.          end
  2749.       end
  2750.       @action.update
  2751.   end
  2752.    
  2753.   #--------------------------------------------------------------------------
  2754.   # ● Can Impact Target
  2755.   #--------------------------------------------------------------------------  
  2756.   def can_impact_target?
  2757.       return false if @action.nil?
  2758.       return false if @action.attack_id == 0
  2759.       return false if @action.first_impact_time > 0
  2760.       return false if @action.impact == false
  2761.       return false if self.jumping?
  2762.       return true
  2763.   end  
  2764.  
  2765.   #--------------------------------------------------------------------------
  2766.   # ● check_event_trigger_attack
  2767.   #--------------------------------------------------------------------------
  2768.   def check_event_trigger_attack()
  2769.       return unless can_impact_target?
  2770.       hit_check = false
  2771.       range = @action.attack_range
  2772.       hit = []
  2773.       targets = [$game_player] + $game_map.events.values
  2774.       for event in targets
  2775.         next if event == self or
  2776.                 @action.hit_events.include?(event) or event.erased
  2777.         body_size      = event.body_size
  2778.         event_center_x = event.x
  2779.         event_center_y = event.y - body_size
  2780.         if @action.short_range
  2781.            dx = event_center_x - $game_player.x
  2782.            dy = event_center_y - $game_player.y
  2783.         else
  2784.            dx = event_center_x - self.x
  2785.            dy = event_center_y - self.y
  2786.          end
  2787.         dx = (dx >= 0 ? [dx - body_size, 0].max : [dx + body_size, 0].min)
  2788.         dy = (dy >= 0 ? [dy - body_size, 0].max : [dy + body_size, 0].min)
  2789.         hit_check = true if in_range?(dx,dy,event,range)
  2790.         hit.push(event) if hit_check
  2791.         hit_check = false
  2792.       end
  2793.       for event in hit
  2794.           if event.action_effect(self, self.action.attack_id)
  2795.              hit_check = true
  2796.           end
  2797.           if event.action_effect_page(self, self.action.attack_id)
  2798.              hit_check = true
  2799.          end        
  2800.          @action.hit_events.push(event) unless @action.multi_hit
  2801.          end
  2802.       if hit_check
  2803.          $game_temp.active_token = self
  2804.       end
  2805.   end
  2806.  
  2807.   #--------------------------------------------------------------------------
  2808.   # ● In Range?
  2809.   #--------------------------------------------------------------------------  
  2810.   def in_range?(dx,dy,event,range)
  2811.       case @action.attack_range_type
  2812.             when 1 #RHOMBUS
  2813.               return true if (dx.abs + dy.abs <= range)
  2814.             when 2 #SQUARE
  2815.               return true if (dx.abs <= range and dy.abs <= range)
  2816.             when 3 #LINE
  2817.               case self.direction
  2818.                   when 2
  2819.                     return true if (dx == 0 and dy >= 0 and dy <= range)
  2820.                   when 8
  2821.                     return true if (dx == 0 and dy <= 0 and dy >= -range)
  2822.                   when 6
  2823.                     return true if (dy == 0 and dx >= 0 and dx <= range)
  2824.                   when 4
  2825.                     return true if (dy == 0 and dx <= 0 and dx >= -range)
  2826.               end
  2827.             when 4  #FRONT SQUARE  
  2828.               case self.direction
  2829.                  when 2
  2830.                     return true if (dx.abs <= range and dy >= 0 and dy.abs <= range)
  2831.                  when 4
  2832.                     return true if (dx.abs <= range and dx <= 0 and dy.abs <= range)  
  2833.                  when 6
  2834.                     return true if (dx.abs <= range and dx >= 0 and dy.abs <= range)
  2835.                  when 8
  2836.                     return true if (dx.abs <= range and dy <= 0 and dy.abs <= range)
  2837.               end              
  2838.             when 5  #FRONT RHOMBUS    
  2839.               case self.direction
  2840.                   when 2
  2841.                     return true if (dx.abs + dy.abs <= range and dy >= 0)
  2842.                   when 8
  2843.                     return true if (dx.abs + dy.abs <= range and dy <= 0)
  2844.                   when 6
  2845.                     return true if (dx.abs + dy.abs <= range and dx >= 0)
  2846.                   when 4
  2847.                     return true if (dx.abs + dy.abs <= range and dx <= 0)
  2848.               end          
  2849.             when 6  #WALL
  2850.               case self.direction
  2851.                  when 2
  2852.                     return true if (dx.abs <= range and dy == 0 )
  2853.                  when 4
  2854.                     return true if (dy.abs <= range and dx == 0)  
  2855.                  when 6
  2856.                     return true if (dy.abs <= range and dx == 0)
  2857.                  when 8
  2858.                     return true if (dx.abs <= range and dy == 0)
  2859.                end  
  2860.             when 7 #CROSS
  2861.                  return true if (dx.abs <= range and dy == 0)
  2862.                  return true if (dy.abs <= range and dx == 0)  
  2863.             end
  2864.      return false      
  2865.   end      
  2866.  
  2867.   #--------------------------------------------------------------------------
  2868.   # ●  action_effect Page
  2869.   #--------------------------------------------------------------------------
  2870.   def action_effect_page(attacker, attack_id)
  2871.       return false unless self.is_a?(Game_Event)
  2872.       return false if attacker.action.fake_id
  2873.       if attacker.action != nil
  2874.          check_auto_effect_page(attacker, attack_id)
  2875.          check_reflectable_skills(attacker, attack_id)
  2876.       end
  2877.       for page in @event.pages
  2878.           if page.condition.variable_valid and
  2879.              page.condition.variable_id == XAS_SYSTEM::HIT_ID and
  2880.              page.condition.variable_value == attack_id
  2881.              self.reaction_valid_attack_id = attack_id
  2882.              self.refresh
  2883.              @trigger = 0
  2884.              self.start
  2885.              return true
  2886.           end
  2887.       end
  2888.       return false
  2889.   end
  2890.  
  2891.   #--------------------------------------------------------------------------
  2892.   # ● Check Reflectable Skills
  2893.   #--------------------------------------------------------------------------    
  2894.   def check_reflectable_skills(attacker, attack_id)
  2895.       return if self.tool_id == 0
  2896.       return unless self.action.reflectable
  2897.       return unless attacker.action.can_reflect
  2898.       self.action.user = attacker.action.user
  2899.       self.action.hit_events = []  
  2900.       self.turn_back
  2901.   end  
  2902.  
  2903.   #--------------------------------------------------------------------------
  2904.   # ● Check Auto Effect Page
  2905.   #--------------------------------------------------------------------------  
  2906.   def check_auto_effect_page(attacker, attack_id)
  2907.       if self.treasure_time > 0
  2908.          if can_hit_take_treasure?(attacker, attack_id)
  2909.             execute_take_treasure(attacker, attack_id)
  2910.          elsif self.temp_id == 0 and can_hold_treasure?(attacker, attack_id)  
  2911.             execute_hold_treasure(attacker, attack_id)
  2912.          end  
  2913.       end
  2914.   end
  2915.  
  2916.   #--------------------------------------------------------------------------
  2917.   # ● Can Hit Take Treasure
  2918.   #--------------------------------------------------------------------------      
  2919.   def can_hit_take_treasure?(attacker, attack_id)
  2920.       return true if attacker.action.short_range
  2921.       return false
  2922.   end
  2923.  
  2924.   #--------------------------------------------------------------------------
  2925.   # ● Can Hold Treasure?
  2926.   #--------------------------------------------------------------------------        
  2927.   def can_hold_treasure?(attacker, attack_id)
  2928.       return true if attacker.tool_effect == "Boomerang"  
  2929.       return false
  2930.   end  
  2931.  
  2932.   #--------------------------------------------------------------------------
  2933.   # ● Execute Hold Treasure
  2934.   #--------------------------------------------------------------------------      
  2935.   def execute_hold_treasure(attacker, attack_id)
  2936.       tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
  2937.       return if self.treasure_time > tr_time
  2938.       self.temp_id = attacker.id    
  2939.   end  
  2940.  
  2941.   #--------------------------------------------------------------------------
  2942.   # ● Execute Take Treasure
  2943.   #--------------------------------------------------------------------------      
  2944.   def execute_take_treasure(attacker, attack_id)
  2945.       tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
  2946.       return if self.treasure_time > tr_time
  2947.       self.x = $game_player.x
  2948.       self.y = $game_player.y
  2949.   end
  2950.  
  2951.   #--------------------------------------------------------------------------
  2952.   # ● body_size
  2953.   #--------------------------------------------------------------------------
  2954.   def body_size
  2955.       return 0
  2956.   end
  2957.  
  2958.   #--------------------------------------------------------------------------
  2959.   # ● action_clear
  2960.   #--------------------------------------------------------------------------
  2961.   def action_clear
  2962.       @action = nil
  2963.       @step_anime = false
  2964.   end
  2965. end
  2966.  
  2967. #===============================================================================
  2968. # ■ Game_Character
  2969. #===============================================================================
  2970. class Game_Character < Game_CharacterBase
  2971.     include XAS_ACTION
  2972. end
  2973.  
  2974. #===============================================================================
  2975. # ■  Game_Event
  2976. #===============================================================================
  2977. class Game_Event < Game_Character
  2978.  
  2979.   #--------------------------------------------------------------------------
  2980.   # * Refresh
  2981.   #--------------------------------------------------------------------------
  2982.   alias x_conditions_met conditions_met?
  2983.   def conditions_met?(page)
  2984.       c = page.condition
  2985.       if c.variable_valid
  2986.          if c.variable_id == XAS_SYSTEM::HIT_ID and
  2987.             c.variable_value == self.reaction_valid_attack_id
  2988.             return true
  2989.          end
  2990.        end
  2991.       x_conditions_met(page)
  2992.   end
  2993.  
  2994. end  
  2995.  
  2996. #===============================================================================
  2997. # ■  XAS_Dispose
  2998. #===============================================================================
  2999. module XAS_Dispose
  3000.  
  3001.   #--------------------------------------------------------------------------
  3002.   # ● update
  3003.   #--------------------------------------------------------------------------  
  3004.   def update
  3005.       action_update
  3006.       super
  3007.       if @action.is_a?(Game_Action_XAS) and @action.done?
  3008.          self.action_clear
  3009.       end
  3010.   end
  3011. end
  3012.  
  3013. #===============================================================================
  3014. # ■  Game_Player
  3015. #===============================================================================
  3016. class Game_Player < Game_Character
  3017.   include XAS_Dispose
  3018. end
  3019.  
  3020. #===============================================================================
  3021. # ■  Game_Event
  3022. #===============================================================================
  3023. class Game_Event < Game_Character
  3024.   include XAS_Dispose
  3025. end
  3026.  
  3027. #===============================================================================
  3028. # ■ XAS_StopToAction
  3029. #===============================================================================
  3030. module XAS_StopToAction
  3031.  
  3032.   #--------------------------------------------------------------------------
  3033.   # ● acting?
  3034.   #--------------------------------------------------------------------------  
  3035.   def acting?
  3036.       return false if self.battler == nil
  3037.       return true if self.battler.shield
  3038.       return true if self.action != nil
  3039.       return false
  3040.   end
  3041.  
  3042.   #--------------------------------------------------------------------------
  3043.   # ● moving?
  3044.   #--------------------------------------------------------------------------  
  3045.   def moving?
  3046.       return (super or self.acting? or self.stop)
  3047.   end
  3048.    
  3049. end
  3050.  
  3051. #===============================================================================
  3052. # ■ Game_Player  
  3053. #===============================================================================
  3054. class Game_Player < Game_Character
  3055.   include XAS_StopToAction
  3056. end
  3057.  
  3058. #===============================================================================
  3059. # ■ Game_Event  
  3060. #===============================================================================
  3061. class Game_Event < Game_Character
  3062.   attr_accessor :reaction_valid_attack_id
  3063. end
  3064.  
  3065.  
  3066. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3067. #■ TOOL - HIT EFFECT
  3068. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3069.  
  3070.  
  3071. #===============================================================================
  3072. # ■ XRXS_BattlerAttachment
  3073. #==============================================================================
  3074. module XRXS_BattlerAttachment
  3075.  
  3076.   #--------------------------------------------------------------------------
  3077.   # ● Can Hit Base?
  3078.   #--------------------------------------------------------------------------    
  3079.   def can_hit_base?(bullet, action_id)
  3080.       return false unless $game_system.xas_battle
  3081.       return false if self.battler == nil
  3082.       return false if bullet == nil
  3083.       return false if action_id == nil or action_id <= 0
  3084.       return false if self.can_update == false
  3085.       return true
  3086.   end  
  3087.  
  3088.   #--------------------------------------------------------------------------
  3089.   # ● Action Effect
  3090.   #--------------------------------------------------------------------------  
  3091.   def action_effect(bullet, action_id)
  3092.       return unless can_hit_base?(bullet, action_id)
  3093.       skill = $data_skills[action_id]
  3094.       user = bullet.action.user
  3095.       attacker = (user == nil ? nil : user.battler)    
  3096.       tar_invu = bullet.action.target_invunerable_duration
  3097.       #CAN HIT?
  3098.       return unless action_can_hit_target?(bullet, user, skill, tar_invu)
  3099.       #REFLECT STATE
  3100.       return if reflect_state?(bullet, skill)
  3101.       #SHIELD
  3102.       if target_shield_enabled?(attacker, skill, bullet)
  3103.          execute_guard_effect(user, skill, bullet, tar_invu)
  3104.          return
  3105.       end
  3106.       #INVUNERABLE ACTIONS
  3107.       if target_invunerable_actions?(user, skill, bullet)
  3108.          execute_guard_effect(user, skill, bullet, tar_invu, false)
  3109.          return
  3110.       end  
  3111.       #GUARD DIRECTIONS
  3112.       if target_guard_directions?(user, skill, bullet)
  3113.          execute_guard_effect(user, skill, bullet, tar_invu)
  3114.          return        
  3115.       end  
  3116.       execute_hit_effect(attacker,skill, bullet , user, tar_invu )
  3117.       if self.is_a?(Game_Player)
  3118.          self.need_refresh = true
  3119.       end
  3120.   end
  3121.  
  3122.   #--------------------------------------------------------------------------
  3123.   # ● Reflect State?
  3124.   #--------------------------------------------------------------------------                
  3125.   def reflect_state?(bullet, skill)
  3126.       if  bullet.action.reflectable and self.battler.state_reflect
  3127.           if skill.note =~ /<Auto Target>/
  3128.              bullet.moveto(bullet.action.user.x,bullet.action.user.y)
  3129.           else  
  3130.              bullet.turn_back
  3131.           end  
  3132.           bullet.action.user = self
  3133.           bullet.action.hit_events = []          
  3134.           bullet.turn_back
  3135. #          bullet.jump(0,0)
  3136.           bullet.turn_back
  3137.           self.battler.damage = XAS_WORD::REFLECT
  3138.           self.battler.damage_pop = true
  3139.           self.animation_id = XAS_ANIMATION::REFLECT_ANIMATION_ID
  3140.           self.battler.invunerable_duration = 20
  3141.          return true
  3142.      end
  3143.      return false    
  3144.   end
  3145.  
  3146.  #--------------------------------------------------------------------------
  3147.  # ● Target Guard Directions?
  3148.  #--------------------------------------------------------------------------    
  3149.  def target_guard_directions?(user, skill, bullet)
  3150.      return false if self.battler.guard == false
  3151.      return false if bullet.action.ignore_guard
  3152.      if self.battler.guard_directions.include?(2) and
  3153.         ((self.direction == 2 and bullet.direction == 8) or
  3154.          (self.direction == 8 and bullet.direction == 2) or
  3155.          (self.direction == 6 and bullet.direction == 4) or
  3156.          (self.direction == 4 and bullet.direction == 6))
  3157.          return true
  3158.      elsif self.battler.guard_directions.include?(8) and
  3159.         ((self.direction == 8 and bullet.direction == 8) or
  3160.          (self.direction == 2 and bullet.direction == 2) or
  3161.          (self.direction == 6 and bullet.direction == 6) or
  3162.          (self.direction == 4 and bullet.direction == 4))
  3163.          return true
  3164.      elsif self.battler.guard_directions.include?(4) and
  3165.         ((self.direction == 2 and bullet.direction == 4) or
  3166.          (self.direction == 8 and bullet.direction == 6) or
  3167.          (self.direction == 6 and bullet.direction == 2) or
  3168.          (self.direction == 4 and bullet.direction == 8))
  3169.          return true        
  3170.      elsif self.battler.guard_directions.include?(6) and
  3171.         ((self.direction == 2 and bullet.direction == 6) or
  3172.          (self.direction == 8 and bullet.direction == 4) or
  3173.          (self.direction == 6 and bullet.direction == 8) or
  3174.          (self.direction == 4 and bullet.direction == 2))
  3175.          return true
  3176.      end      
  3177.      return false
  3178.   end
  3179.      
  3180.   #--------------------------------------------------------------------------
  3181.   # ● Target Invunerable Actions?
  3182.   #--------------------------------------------------------------------------            
  3183.   def target_invunerable_actions?(user, skill, bullet)
  3184.       return true if self.battler.invunerable_actions.include?(skill.id)
  3185.       return false
  3186.   end
  3187.  
  3188.   #--------------------------------------------------------------------------
  3189.   # ● Shoot Target Shield
  3190.   #--------------------------------------------------------------------------          
  3191.   def shoot_target_shield?(bullet,user, skill)
  3192.       return false unless self.battler.shield
  3193.       return false if bullet.action.ignore_guard
  3194.       return true if face_direction?(bullet)
  3195.       return false
  3196.   end
  3197.  
  3198.   #--------------------------------------------------------------------------
  3199.   # ● Action can hit target?
  3200.   #--------------------------------------------------------------------------        
  3201.   def action_can_hit_target?(bullet, user, skill,tar_invu)
  3202.       if user == nil
  3203.          return false
  3204.       end  
  3205.       if self.battler.invunerable
  3206.          return false
  3207.       end  
  3208.       if self.battler.dead?
  3209.          return false
  3210.       end  
  3211.       if self.battler.invunerable_duration > 0
  3212.          return false
  3213.       end  
  3214.       if @knock_back_duration != nil
  3215.          return false unless bullet.action.ignore_knockback_invincible
  3216.       end
  3217.       if bullet.action.first_impact_time > 0
  3218.          return false
  3219.       end
  3220.       if self.action != nil and self.action.user_invincible
  3221.          unless self.action.ally_damage and bullet.action.user == self.action.user
  3222.              return false
  3223.          end
  3224.       end  
  3225.       unless bullet.action.all_damage
  3226.              if bullet.action.ally_damage
  3227.                 if user.battler.is_a?(Game_Actor)
  3228.                    return false if self.battler.is_a?(Game_Enemy)
  3229.                 elsif user.battler.is_a?(Game_Enemy)
  3230.                    return false if self.battler.is_a?(Game_Actor)
  3231.                 end
  3232.              else    
  3233.                 if user.battler.is_a?(Game_Actor)
  3234.                    return false if self.battler.is_a?(Game_Actor)
  3235.                 elsif user.battler.is_a?(Game_Enemy)
  3236.                    return false if self.battler.is_a?(Game_Enemy)
  3237.                 end                
  3238.              end              
  3239.       end
  3240.       return false if target_state_invunerable?(tar_invu)
  3241.       #return false if target_reflect_action?(bullet, user)
  3242.       return true
  3243.   end
  3244.  
  3245.   #--------------------------------------------------------------------------
  3246.   # ● Target Relfect Action
  3247.   #--------------------------------------------------------------------------          
  3248.   def target_reflect_action?(bullet, user)
  3249.       return false unless bullet.action.reflectable
  3250.       for i in $game_map.events.values
  3251.           if i.tool_id > 0 and i.action.can_reflect and
  3252.              i.tool_effect == "Barrier"# and i.action.user.battler.is_a?(self.battler)
  3253.              bullet.action.user = self
  3254.              bullet.action.hit_events = []  
  3255.              bullet.turn_back
  3256.              return true
  3257.              break
  3258.           end  
  3259.       end
  3260.       return false  
  3261.   end
  3262.  
  3263.   #--------------------------------------------------------------------------
  3264.   # ● Target State Invunerable
  3265.   #--------------------------------------------------------------------------        
  3266.   def target_state_invunerable?(tar_invu)
  3267.       if self.battler.state_invunerable
  3268.          self.battler.damage = XAS_WORD::INVINCIBLE
  3269.          self.battler.damage_pop = true
  3270.          self.animation_id = XAS_ANIMATION::INVINCIBLE_ANIMATION_ID
  3271.          self.battler.invunerable_duration = tar_invu
  3272.          return true
  3273.       end
  3274.       return false
  3275.   end
  3276.  
  3277.   #--------------------------------------------------------------------------
  3278.   # ● Execute Hit Effect
  3279.   #--------------------------------------------------------------------------      
  3280.   def execute_hit_effect(attacker, skill, bullet, user, tar_invu)
  3281.       shoot_effect_before_damage(skill, bullet, user)
  3282.       execute_battler_skill_effect(attacker, skill, user)
  3283.       if target_missed?(attacker)
  3284.          self.battler.invunerable_duration = 30
  3285.          return
  3286.       end
  3287.       execute_damage_pop(attacker,skill)
  3288.       shoot_effect_after_damage(skill, bullet, user) if can_damage_after_effect?
  3289.       execute_state_effect(skill, user,  bullet)    
  3290.       bullet.action.duration = 1 if remove_tool_after_hit?(skill, bullet, user)
  3291.       self.battler.invunerable_duration = tar_invu
  3292.       execute_blow_effect(skill,bullet) if can_blow_effect?
  3293.       execute_animation(skill, bullet, user)
  3294.       execute_tool_effects(skill, bullet , user)
  3295.   end
  3296.  
  3297.   #--------------------------------------------------------------------------
  3298.   # ● Execute Tool Effects
  3299.   #--------------------------------------------------------------------------              
  3300.   def execute_tool_effects(skill, bullet , user)
  3301.       execute_sticky_effect(skill, bullet, user)
  3302.       execute_bounce_effect(skill, bullet, user)
  3303.       execute_hit_action_effect(skill, bullet, user)
  3304.   end
  3305.    
  3306.   #--------------------------------------------------------------------------
  3307.   # ● Remove Tool After Hit?
  3308.   #--------------------------------------------------------------------------            
  3309.   def remove_tool_after_hit?(skill, bullet, user)
  3310.       return true if bullet.action.piercing == false
  3311.       return false
  3312.   end  
  3313.  
  3314.   #--------------------------------------------------------------------------
  3315.   # ● Execute Battler Skill Effect
  3316.   #--------------------------------------------------------------------------          
  3317.   def execute_battler_skill_effect(attacker ,skill, user)
  3318.       self.battler.item_apply(attacker, skill)
  3319.   end
  3320.  
  3321.   #--------------------------------------------------------------------------
  3322.   # ● Target Missed?
  3323.   #--------------------------------------------------------------------------        
  3324.   def target_missed?(attacker)
  3325.       if self.battler.result.missed
  3326.          self.battler.damage = XAS_WORD::MISSED
  3327.          self.battler.damage_pop = true        
  3328.          return true
  3329.       end    
  3330.       if self.battler.result.evaded
  3331.          self.battler.damage = XAS_WORD::EVADED
  3332.          self.battler.damage_pop = true            
  3333.          return true
  3334.       end  
  3335.       return false
  3336.   end  
  3337.   #--------------------------------------------------------------------------
  3338.   # ● Shoot Effect Before Damage
  3339.   #--------------------------------------------------------------------------        
  3340.   def shoot_effect_before_damage(skill, bullet, user)
  3341.   end
  3342.  
  3343.   #--------------------------------------------------------------------------
  3344.   # ● Shoot Effect After Damage
  3345.   #--------------------------------------------------------------------------          
  3346.   def shoot_effect_after_damage(skill, bullet, user)
  3347.       check_counter_attack(skill)
  3348.       self.battler.passive = false
  3349.   end
  3350.  
  3351.   #--------------------------------------------------------------------------
  3352.   # ● Shoot Effect After Damage
  3353.   #--------------------------------------------------------------------------            
  3354.   def check_counter_attack(skill)
  3355.       return if self.battler.is_a?(Game_Actor)
  3356.       return if self.battler.counter_action[2] == false
  3357.       return if self.battler.counter_action[1] > 0
  3358.       counter = XAS_BA_ENEMY::COUNTER_ATTACK[self.battler.enemy_id]
  3359.       if counter != nil
  3360.          counter_action_id = counter[rand(counter.size)]
  3361.          self.battler.counter_action[0] = counter_action_id
  3362.          self.battler.counter_action[1] = 15
  3363.       end  
  3364.   end  
  3365.  
  3366.   #--------------------------------------------------------------------------
  3367.   # ● Execute Bounce Effect
  3368.   #--------------------------------------------------------------------------            
  3369.   def execute_bounce_effect(skill, bullet, user)
  3370.       return false if bullet.action.hit_bounce == false
  3371.       bullet.bounce_direction
  3372.   end
  3373.  
  3374.   #--------------------------------------------------------------------------
  3375.   # ● Execute Stick Effect
  3376.   #--------------------------------------------------------------------------          
  3377.   def execute_sticky_effect(skill, bullet, user)
  3378.       return unless bullet.action.sticky
  3379.       return if bullet.temp_id !=  0
  3380.       bullet.pre_move_speed = bullet.move_speed
  3381.       bullet.temp_id = self.id
  3382.   end
  3383.  
  3384.   #--------------------------------------------------------------------------
  3385.   # ● Execute Hit Action Effect
  3386.   #--------------------------------------------------------------------------            
  3387.   def execute_hit_action_effect(skill, bullet, user)
  3388.       return if bullet.action.hit_action == 0
  3389.       self.battler.invunerable_duration = 1
  3390.       bullet.shoot(bullet.action.hit_action)
  3391.       bullet.action.duration = 9
  3392.       bullet.action.multi_hit = false
  3393.       bullet.character_name = ""
  3394.       bullet.x_pose_duration = 0
  3395.       bullet.x_pose_name = ""
  3396.       bullet.x_pose_original_name = ""      
  3397.   end
  3398.  
  3399.   #--------------------------------------------------------------------------
  3400.   # ● Can Damage Effect
  3401.   #--------------------------------------------------------------------------          
  3402.   def can_damage_after_effect?
  3403.       return false if self.battler.damage == nil
  3404.       return false unless self.battler.damage.is_a?(Numeric)
  3405.       return true
  3406.   end  
  3407.  
  3408.   #--------------------------------------------------------------------------
  3409.   # ● Execute State Effect
  3410.   #--------------------------------------------------------------------------        
  3411.   def execute_state_effect(skill, user,  bullet)  
  3412.       if user.battler.states.size != 0
  3413.          for i in user.battler.states
  3414.              execute_state_effect_user(skill, user, bullet,i)
  3415.          end    
  3416.       end
  3417.       if self.battler.states.size != 0
  3418.          for i in self.battler.states
  3419.              execute_state_effect_target(skill, user, bullet,i)
  3420.          end    
  3421.       end
  3422.   end
  3423.  
  3424.   #--------------------------------------------------------------------------
  3425.   # ● Execute State Effect User
  3426.   #--------------------------------------------------------------------------          
  3427.   def execute_state_effect_user(skill, user, bullet,i)
  3428.  
  3429.   end
  3430.  
  3431.   #--------------------------------------------------------------------------
  3432.   # ● Execute State Target
  3433.   #--------------------------------------------------------------------------          
  3434.   def execute_state_effect_target(skill, user, bullet,i)
  3435.       #Sleep
  3436.       if self.battler.damage.is_a?(Numeric) and self.battler.damage > 0
  3437.          if i.note =~ /<Sleep>/  
  3438.             self.battler.remove_state(i.id)
  3439.          end
  3440.       end  
  3441.   end  
  3442.  
  3443.   #--------------------------------------------------------------------------
  3444.   # ● Execute Blow Effect
  3445.   #--------------------------------------------------------------------------      
  3446.   def execute_blow_effect(skill,bullet)
  3447.       if bullet.action.hit_hold_target and self.temp_id == 0    
  3448.          self.temp_id = bullet.id
  3449.          self.pre_move_speed = self.move_speed        
  3450.          self.moveto(bullet.x, bullet.y)
  3451.       end  
  3452.       $game_map.screen.start_shake(5, 5, 60) if bullet.action.hit_shake
  3453.       p = bullet.action.blow_power.to_i  
  3454.       d = bullet.direction    
  3455.       return if self.battler.damage.to_i <= 0
  3456.       return if p < 0
  3457.       self.blow(d, p)  
  3458.   end
  3459.    
  3460.   #--------------------------------------------------------------------------
  3461.   # ● Execute Animation
  3462.   #--------------------------------------------------------------------------        
  3463.   def execute_animation(skill, bullet, user)    
  3464.       self.animation_id = skill.animation_id
  3465.       tool_animation = bullet.action.second_animation_id
  3466.       user_animation = bullet.action.third_animation_id
  3467.       bullet.animation_id = tool_animation if tool_animation != 0
  3468.       user.animation_id = user_animation if user_animation != 0
  3469.   end  
  3470.    
  3471.   #--------------------------------------------------------------------------
  3472.   # ● Knock Back Disable
  3473.   #--------------------------------------------------------------------------      
  3474.   def knock_back_disable
  3475.     return false
  3476.   end
  3477.  
  3478.   #--------------------------------------------------------------------------
  3479.   # ● Dead?
  3480.   #--------------------------------------------------------------------------          
  3481.   def dead?
  3482.     return self.battler == nil ? false : self.battler.dead?
  3483.   end
  3484.  
  3485. end
  3486.  
  3487.  
  3488. #===============================================================================
  3489. # ■ XRXS_BattlerAttachment
  3490. #==============================================================================
  3491. module XRXS_BattlerAttachment
  3492.  
  3493.   #--------------------------------------------------------------------------
  3494.   # ● Shoot Target Shield
  3495.   #--------------------------------------------------------------------------          
  3496.   def target_shield_enabled?(attacker, skill, bullet)
  3497.       return false unless self.battler.shield
  3498.       if bullet != nil
  3499.          return false if bullet.action.ignore_guard
  3500.          return true if face_direction?(bullet)        
  3501.       else  
  3502.          return false if attacker.battler.ignore_guard
  3503.          return true if face_direction?(attacker)        
  3504.       end  
  3505.       return false
  3506.   end  
  3507.  
  3508.   #--------------------------------------------------------------------------
  3509.   # ● Can Blow Effect
  3510.   #--------------------------------------------------------------------------        
  3511.   def can_blow_effect?
  3512.       return false if self.battler.no_knockback
  3513.       return false if $game_map.interpreter.running?
  3514.       return true
  3515.   end  
  3516.  
  3517.  #--------------------------------------------------------------------------
  3518.  # ● Execute Guard Effect
  3519.  #--------------------------------------------------------------------------      
  3520.  def execute_guard_effect(attacker, skill, bullet, inv, erase_bullet = true)
  3521.      self.battler.invunerable_duration = inv
  3522.      damage_pop(XAS_WORD::GUARD)
  3523.      guard_animation_id = XAS_ANIMATION::GUARD_ANIMATION_ID
  3524.      self.animation_id = guard_animation_id if guard_animation_id != 0  
  3525.      if bullet != nil
  3526.         bullet.erase if erase_bullet
  3527.      else  
  3528.         blow_reverse(attacker) unless attacker.battler.no_knockback
  3529.      end  
  3530.  end
  3531.    
  3532.  #--------------------------------------------------------------------------
  3533.  # ● Blow Reverse
  3534.  #--------------------------------------------------------------------------      
  3535.  def blow_reverse(attacker)
  3536.      return if attacker.battler.no_knockback
  3537.      case attacker.direction
  3538.         when 2
  3539.            d = 8
  3540.         when 4
  3541.            d = 6
  3542.         when 6
  3543.            d = 4
  3544.         when 8  
  3545.            d = 2
  3546.      end
  3547.      attacker.jump(0,0)  
  3548.      attacker.blow(d,1)
  3549.  end
  3550.  
  3551.  #--------------------------------------------------------------------------
  3552.  # ● Can Attack Effect
  3553.  #--------------------------------------------------------------------------      
  3554.  def damage_pop(text)
  3555.      return unless XAS_WORD::ENABLE_WORD
  3556.      self.battler.damage = text
  3557.      self.battler.damage_pop = true
  3558.  end
  3559.  
  3560.  #--------------------------------------------------------------------------
  3561.  # ● Shd Direction?
  3562.  #--------------------------------------------------------------------------      
  3563.  def face_direction?(attacker)
  3564.      target = self.direction  
  3565.      case target
  3566.           when 2
  3567.              return true if attacker.direction == 8
  3568.           when 4
  3569.              return true if attacker.direction == 6
  3570.           when 6
  3571.              return true if attacker.direction == 4
  3572.           when 8  
  3573.              return true if attacker.direction == 2    
  3574.      end
  3575.      return false
  3576.  end  
  3577.  
  3578.  #--------------------------------------------------------------------------
  3579.  # ● Execute Damage Pop
  3580.  #--------------------------------------------------------------------------      
  3581.  def execute_damage_pop(attacker,skill = nil)
  3582.      if skill != nil
  3583.         return if skill.note =~ /<No Damage Pop>/
  3584.         if skill.damage.to_mp?
  3585.            dam = self.battler.result.mp_damage
  3586.            self.battler.damage_type = "Mp"      
  3587.         elsif skill.damage.to_hp?
  3588.            dam = self.battler.result.hp_damage
  3589.            self.battler.damage_type = "Critical"  if self.battler.result.critical
  3590.         end  
  3591.         if dam != nil
  3592.            if skill.damage.drain? or skill.damage.drain?
  3593.               attacker.damage = -dam
  3594.               attacker.damage_type = self.battler.damage_type
  3595.               attacker.damage_pop = true
  3596.            end  
  3597.            self.battler.damage = dam
  3598.            self.battler.damage_pop = true
  3599.         end
  3600.      else
  3601.         if self.battler.result.hp_damage != nil
  3602.            self.battler.damage = self.battler.result.hp_damage
  3603.            self.battler.damage_type = "Critical" if self.battler.result.critical  
  3604.            self.battler.damage_pop = true      
  3605.         end  
  3606.      end  
  3607.  end  
  3608.  
  3609. end  
  3610.  
  3611.  
  3612.  
  3613. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3614. #■ TOOL - EQUIP
  3615. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3616.  
  3617.  
  3618. #==============================================================================
  3619. # ■ Window Skill List
  3620. #==============================================================================
  3621. class Window_SkillList < Window_Selectable
  3622.  
  3623.   #--------------------------------------------------------------------------
  3624.   # ● Process OK
  3625.   #--------------------------------------------------------------------------                  
  3626.   alias x_skill_process_ok process_ok
  3627.   def process_ok
  3628.       return if can_equip_skill_action?
  3629.       x_skill_process_ok
  3630.   end
  3631.  
  3632.   #--------------------------------------------------------------------------
  3633.   # ● Can Equip Skill Action
  3634.   #--------------------------------------------------------------------------                    
  3635.   def can_equip_skill_action?
  3636.       return false if $game_party.in_battle
  3637.       skill = @data[index]
  3638.       if skill != nil and skill.note =~ /<Duration = (\d+)>/
  3639.          @actor.skill_id = skill.id
  3640.          Sound.play_equip
  3641.          return true        
  3642.       end
  3643.       return false
  3644.   end
  3645.  
  3646. end
  3647.  
  3648. #==============================================================================
  3649. # ■ Window Item List
  3650. #==============================================================================
  3651. class Window_ItemList < Window_Selectable
  3652.  
  3653.   #--------------------------------------------------------------------------
  3654.   # ● Process OK
  3655.   #--------------------------------------------------------------------------                  
  3656.   alias x_item_process_ok process_ok
  3657.   def process_ok
  3658.       return if can_equip_item_action?
  3659.       x_item_process_ok
  3660.   end
  3661.  
  3662.   #--------------------------------------------------------------------------
  3663.   # ● Can Equip Item Action
  3664.   #--------------------------------------------------------------------------                    
  3665.   def can_equip_item_action?
  3666.       return false if $game_party.in_battle
  3667.       item = @data[index]
  3668.       if item != nil and item.is_a?(RPG::Item) and
  3669.          item.note =~ /<Action ID = (\d+)>/
  3670.          actor = $game_party.members[0]
  3671.          actor.item_id = item.id
  3672.          Sound.play_equip
  3673.          return true        
  3674.       end
  3675.       return false
  3676.   end
  3677.  
  3678. end
  3679.  
  3680.  
  3681.  
  3682. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3683. #■ BATTLER - INITIALIZE
  3684. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3685.  
  3686.  
  3687. #===============================================================================
  3688. # ■ Game Character
  3689. #==============================================================================
  3690. class Game_Character < Game_CharacterBase
  3691.  
  3692.   #--------------------------------------------------------------------------
  3693.   # ● Update Battler
  3694.   #--------------------------------------------------------------------------      
  3695.   def update_battler
  3696.       update_battler_pose
  3697.       update_battler_parameters
  3698.       update_battler_stop_movement
  3699.       update_battler_knockbacking
  3700.       update_battler_counter_action
  3701.       unless self.battler.hp == 0
  3702.           update_battler_cast_action    
  3703.           update_battler_move_speed if can_update_battler_move_speed?
  3704.           update_battler_states_effect
  3705.           update_battler_attacking
  3706.       else
  3707.           update_battler_defeat_process
  3708.       end
  3709.   end  
  3710.  
  3711. end
  3712.  
  3713. #===============================================================================
  3714. # ■ Game Player
  3715. #===============================================================================
  3716. class Game_Player < Game_Character
  3717.   include XRXS_BattlerAttachment
  3718.  
  3719.   #--------------------------------------------------------------------------
  3720.   # ● Battler
  3721.   #--------------------------------------------------------------------------  
  3722.   def battler
  3723.       return $game_party.members[0]
  3724.   end
  3725.  
  3726.   #--------------------------------------------------------------------------
  3727.   # ● Refresh Interpreter Effect
  3728.   #--------------------------------------------------------------------------        
  3729.   def refresh_interpreter_effect
  3730.       $game_system.old_interpreter_running = $game_map.interpreter.running?
  3731.       if $game_system.old_interpreter_running
  3732.          $game_temp.reset_battler_time = 60 * 4
  3733.       end  
  3734.       reset_battler_setting  
  3735.   end  
  3736.  
  3737.   #--------------------------------------------------------------------------
  3738.   # ● Update Battler Setting Time
  3739.   #--------------------------------------------------------------------------          
  3740.   def update_reset_battler_setting_time
  3741.       return if $game_temp.reset_battler_time == 0
  3742.       $game_temp.reset_battler_time -= 1
  3743.       reset_battler_setting_running if $game_temp.reset_battler_time == 0
  3744.   end
  3745.  
  3746.   #--------------------------------------------------------------------------
  3747.   # ● Update Battler Setting
  3748.   #--------------------------------------------------------------------------        
  3749.   def reset_battler_setting
  3750.       reset_player_parameters
  3751.       for ally in $game_party.members
  3752.          reset_members_parameters(ally)
  3753.       end
  3754.       for enemy in $game_map.events.values
  3755.           reset_enemies_parameters(enemy) if enemy.battler != nil
  3756.       end    
  3757.       $game_map.need_refresh = true  
  3758.   end  
  3759.  
  3760.   #--------------------------------------------------------------------------
  3761.   # ● Update Battler Setting Running
  3762.   #--------------------------------------------------------------------------        
  3763.   def reset_battler_setting_running
  3764.       reset_player_parameters_running
  3765.       for ally in $game_party.members
  3766.          reset_members_parameters_running(ally)
  3767.       end
  3768.       for enemy in $game_map.events.values
  3769.           reset_enemies_parameters(enemy) if enemy.battler != nil
  3770.       end    
  3771.       $game_map.need_refresh = true  
  3772.   end    
  3773.  
  3774.   #--------------------------------------------------------------------------
  3775.   # ● Reset Enemies Parameters
  3776.   #--------------------------------------------------------------------------          
  3777.   def reset_enemies_parameters(enemy)
  3778.       enemy.battler.cast_action[0] = 0
  3779.       enemy.battler.cast_action[1] = 0
  3780.       enemy.battler.cast_action[2] = 0
  3781.       enemy.battler.cast_action[3] = 0  
  3782.       enemy.battler.cast_action[4] = 0
  3783.       enemy.battler.counter_action[0] = 0
  3784.       enemy.battler.counter_action[1] = 0
  3785.       enemy.battler.counter_action[2] = true
  3786.       enemy.battler.invunerable_duration = 0
  3787.       enemy.knock_back_duration = nil
  3788.   end  
  3789.  
  3790.   #--------------------------------------------------------------------------
  3791.   # ● Reset Members Parameters
  3792.   #--------------------------------------------------------------------------          
  3793.   def reset_members_parameters(ally)
  3794.       ally.old_level = ally.level
  3795.       ally.shield = false
  3796.       ally.x_charge_action[0] = 0
  3797.       ally.x_charge_action[1] = 0
  3798.       ally.x_charge_action[2] = 0
  3799.       ally.x_charge_action[3] = 0
  3800.       ally.cast_action[0] = 0
  3801.       ally.cast_action[1] = 0
  3802.       ally.cast_action[2] = 0
  3803.       ally.cast_action[3] = 0  
  3804.       ally.cast_action[4] = 0
  3805.       ally.counter_action[0] = 0
  3806.       ally.counter_action[1] = 0
  3807.       ally.counter_action[2] = true
  3808.       ally.invunerable_duration = 0
  3809.   end
  3810.  
  3811.   #--------------------------------------------------------------------------
  3812.   # ● Reset Player Parameters
  3813.   #--------------------------------------------------------------------------          
  3814.   def reset_player_parameters
  3815.       make_pose("", 1) unless $game_player.action != nil
  3816.       $game_temp.xas_target_time = 0
  3817.       $game_temp.xas_target_shoot_id = 0
  3818.       $game_temp.xas_target_x = 0      
  3819.       @knock_back_duration = nil
  3820.       @dash_active = false
  3821.   end
  3822.    
  3823.  
  3824.   #--------------------------------------------------------------------------
  3825.   # ● Reset Members Parameters Running
  3826.   #--------------------------------------------------------------------------          
  3827.   def reset_members_parameters_running(ally)
  3828.       ally.old_level = ally.level
  3829.       ally.shield = false
  3830.       unless ally.x_charge_action[1] > 0
  3831.       ally.x_charge_action[0] = 0
  3832.       ally.x_charge_action[1] = 0
  3833.       ally.x_charge_action[2] = 0
  3834.       ally.x_charge_action[3] = 0
  3835.       end
  3836.       unless ally.cast_action[1] > 0
  3837.          ally.cast_action[0] = 0
  3838.          ally.cast_action[1] = 0
  3839.          ally.cast_action[2] = 0
  3840.          ally.cast_action[3] = 0  
  3841.          ally.cast_action[4] = 0
  3842.       end
  3843.       ally.counter_action[0] = 0
  3844.       ally.counter_action[1] = 0
  3845.       ally.counter_action[2] = true
  3846.       ally.invunerable_duration = 0
  3847.   end
  3848.  
  3849.   #--------------------------------------------------------------------------
  3850.   # ● Reset Player Parameters Running
  3851.   #--------------------------------------------------------------------------          
  3852.   def reset_player_parameters_running
  3853.       $game_temp.xas_target_time = 0
  3854.       $game_temp.xas_target_shoot_id = 0
  3855.       $game_temp.xas_target_x = 0      
  3856.       @knock_back_duration = nil
  3857.       @dash_active = false
  3858.   end
  3859.  
  3860. end
  3861.  
  3862. #===============================================================================
  3863. # ■ Game Follower
  3864. #===============================================================================
  3865. class Game_Follower < Game_Character
  3866.   include XRXS_BattlerAttachment
  3867.  
  3868.   #--------------------------------------------------------------------------
  3869.   # ● Battler
  3870.   #--------------------------------------------------------------------------    
  3871.   def battler
  3872.       return $game_party.members[@member_index]
  3873.   end
  3874. end
  3875.  
  3876. #===============================================================================
  3877. # ■ Game Follower
  3878. #===============================================================================
  3879. class Game_Followers
  3880.   include XRXS_BattlerAttachment
  3881.  
  3882.   #--------------------------------------------------------------------------
  3883.   # ● Battler
  3884.   #--------------------------------------------------------------------------    
  3885.   def battler
  3886.       return $game_party.members[@member_index]
  3887.   end
  3888. end
  3889. #===============================================================================
  3890. # ■ Game_Vehicle
  3891. #===============================================================================
  3892. class Game_Vehicle < Game_Character
  3893.   include XRXS_BattlerAttachment
  3894.   attr_reader   :collision_attack
  3895.  
  3896.   #--------------------------------------------------------------------------
  3897.   # ● Battler
  3898.   #--------------------------------------------------------------------------      
  3899.   def battler
  3900.      return @battler
  3901.   end  
  3902. end  
  3903.  
  3904. #===============================================================================
  3905. # ■ Game Event
  3906. #===============================================================================
  3907. class Game_Event < Game_Character
  3908.  
  3909.   include XRXS_BattlerAttachment
  3910.  
  3911.   #--------------------------------------------------------------------------
  3912.   # ● Battler
  3913.   #--------------------------------------------------------------------------    
  3914.   def battler
  3915.     return @battler
  3916.   end
  3917.  
  3918.  #--------------------------------------------------------------------------
  3919.  # ● Battler?
  3920.  #--------------------------------------------------------------------------          
  3921.  def battler?
  3922.      return false if self.erased
  3923.      return false if self.battler == nil
  3924.      return false if self.dead?
  3925.      return false if self.battler.no_damage_pop
  3926.      return false if self.battler.invunerable
  3927.      return true
  3928.  end  
  3929.  
  3930.   #--------------------------------------------------------------------------
  3931.   # ● Refresh
  3932.   #--------------------------------------------------------------------------    
  3933.   alias xrxs64c_refresh refresh
  3934.   def refresh
  3935.       xrxs64c_refresh
  3936.       self.battler_recheck
  3937.   end
  3938.    
  3939.   #--------------------------------------------------------------------------
  3940.   # ● Battler Recheck
  3941.   #--------------------------------------------------------------------------    
  3942.   def battler_recheck
  3943.       return if @battler != nil
  3944.       return if @page == nil
  3945.       if self.name =~ /<Actor>/      
  3946.          actor = $game_party.members[0]
  3947.          @battler = Game_Actor.new(actor.id)
  3948.          return
  3949.       else
  3950.          @enemy_id = 0
  3951.          if self.name =~ /<E(\d+)>/i
  3952.             @enemy_id = $1.to_i    
  3953.          end          
  3954.          return if @enemy_id <= 0
  3955.          @battler = Game_Enemy.new(1, @enemy_id)
  3956.          self.force_update = true #if self.battler.sensor_range >= 15        
  3957.       end  
  3958.   end
  3959.    
  3960.   #--------------------------------------------------------------------------
  3961.   # ● Battler Recheck
  3962.   #--------------------------------------------------------------------------      
  3963.   def enemy_id
  3964.       return @enemy_id
  3965.   end
  3966.  
  3967.   #--------------------------------------------------------------------------
  3968.   # ● body_size
  3969.   #--------------------------------------------------------------------------        
  3970.   def body_size
  3971.       if self.battler != nil
  3972.          return self.battler.body_size
  3973.       else
  3974.          return 0
  3975.       end  
  3976.   end
  3977.  
  3978. end
  3979.  
  3980.  
  3981. #===============================================================================
  3982. # ■ Game_Battler
  3983. #===============================================================================
  3984. class Game_Battler
  3985.   attr_accessor :sensor_range
  3986.   attr_accessor :body_size
  3987.   attr_accessor :breath_effect
  3988.   attr_accessor :breath_duration
  3989.   attr_accessor :fast_breath_effect
  3990.   attr_accessor :no_knockback
  3991.   attr_accessor :passive  
  3992.   attr_accessor :attack_animation_id
  3993.   attr_accessor :ignore_guard
  3994.   attr_accessor :no_damage_pop
  3995.  
  3996.   #--------------------------------------------------------------------------
  3997.   # ● Initialize
  3998.   #--------------------------------------------------------------------------      
  3999.   alias x_e_initialize initialize
  4000.   def initialize  
  4001.       x_e_initialize
  4002.       @sensor_range = 4
  4003.       @body_size = 0
  4004.       @breath_effect = false
  4005.       @breath_duration = 0
  4006.       @fast_breath_effect = false
  4007.       @no_knockback = false
  4008.       @passive = false    
  4009.       @attack_animation_id = 0
  4010.       @ignore_guard = false
  4011.       @no_damage_pop = false
  4012.   end  
  4013. end
  4014.  
  4015. #===============================================================================
  4016. # ■ Game_Enemy
  4017. #===============================================================================
  4018. class Game_Enemy < Game_Battler
  4019.    
  4020.   #--------------------------------------------------------------------------
  4021.   # ● Initialize
  4022.   #--------------------------------------------------------------------------      
  4023.   alias x_e2_initialize initialize
  4024.   def initialize(index, enemy_id)
  4025.       x_e2_initialize(index, enemy_id)
  4026.       enemy = $data_enemies[@enemy_id]
  4027.       setup_enemy_note(enemy)
  4028.   end  
  4029.  
  4030.   #--------------------------------------------------------------------------
  4031.   # ● Setup X Note Elements
  4032.   #--------------------------------------------------------------------------          
  4033.   def setup_enemy_note(enemy)
  4034.       if enemy.note =~ /<Sensor Range = (\d+)>/
  4035.          @sensor_range = $1.to_i
  4036.       end  
  4037.       if enemy.note =~ /<Body Size = (\d+)>/
  4038.          @body_size = $1.to_i
  4039.       end
  4040.       if enemy.note =~ /<Attack Animation = (\d+)>/
  4041.          @attack_animation_id = $1.to_i
  4042.       end  
  4043.       if enemy.note =~ /<Death Zoom = (\d+)>/
  4044.          @death_zoom_effect = $1.to_i
  4045.       end
  4046.       if enemy.note =~ /<Knockback Duration = (\d+)>/
  4047.          @knockback_duration = $1.to_i
  4048.       end      
  4049.       if enemy.note =~ /<Ignore Guard>/
  4050.          @ignore_shield = true
  4051.       end
  4052.       if enemy.note =~ /<Invunerable>/
  4053.          @invunerable = true
  4054.       end
  4055.       if enemy.note =~ /<Breath Effect>/  
  4056.          @breath_effect = true
  4057.       end
  4058.       if enemy.note =~ /<Knockback Disable>/        
  4059.          @no_knockback = true
  4060.       end
  4061.       if enemy.note =~ /<Passive>/  
  4062.          @passive = true
  4063.       end
  4064.       if enemy.note =~ /<No Damage Pop>/  
  4065.          @no_damage_pop = true
  4066.       end  
  4067.       invunerable_actions_ids = XAS_BA_ENEMY::INVUNERABLE_ACTIONS[@enemy_id]
  4068.       if invunerable_actions_ids != nil
  4069.          @invunerable_actions = invunerable_actions_ids
  4070.       end  
  4071.       guard_directions_ids = XAS_BA_ENEMY::GUARD_DIRECTIONS[@enemy_id]
  4072.       if guard_directions_ids != nil
  4073.          @guard_directions = guard_directions_ids
  4074.       end          
  4075.   end
  4076.  
  4077.  
  4078. end  
  4079.  
  4080.  
  4081. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4082. #■ BATTLER - EVENT SENSOR
  4083. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4084.  
  4085.  
  4086. #===============================================================================
  4087. # ■ XRXS_Enemy_Sensor
  4088. #===============================================================================
  4089. module XRXS_EnemySensor
  4090.  
  4091.   #--------------------------------------------------------------------------
  4092.   # ● Update Sensor
  4093.   #--------------------------------------------------------------------------        
  4094.   def update_sensor
  4095.       if self.battler != nil and self.battler.sensor_range > 0  
  4096.          sensor_area = self.battler.sensor_range
  4097.       else  
  4098.          sensor_area = $game_variables[XAS_BA::DEFAULT_SENSOR_RANGE_VARIABLE_ID]
  4099.       end
  4100.       sensor_area = -1 if cancel_sensor?
  4101.       distance = ($game_player.x - self.x).abs + ($game_player.y - self.y).abs
  4102.       enable   = (distance <= sensor_area)
  4103.       key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
  4104.       last_enable = $game_self_switches[key]
  4105.       last_enable = false if last_enable == nil
  4106.       if enable != last_enable
  4107.          touch_attack(false)
  4108.          @collision_attack = false
  4109.          @pattern = 0
  4110.          @pattern_count = 0              
  4111.          $game_self_switches[key] = enable
  4112.          self.refresh
  4113.       end
  4114.   end
  4115.  
  4116.   #--------------------------------------------------------------------------
  4117.   # ● Can Update Sensor
  4118.   #--------------------------------------------------------------------------            
  4119.   def can_update_sensor?
  4120.       return false if @sensor_enable == false
  4121.       return false if self.dead?
  4122.       return false if self.erased
  4123.       return false if self.stop
  4124.       return false if self.knockbacking?
  4125.       return true
  4126.   end
  4127.  
  4128.   #--------------------------------------------------------------------------
  4129.   # ● refresh_sensor
  4130.   #--------------------------------------------------------------------------          
  4131.   def refresh_sensor
  4132.       touch_attack(false)
  4133.       key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
  4134.       $game_self_switches[key] = false
  4135.       @pattern = 0
  4136.       @pattern_count  = 0        
  4137.       self.refresh        
  4138.   end  
  4139.  
  4140.   #--------------------------------------------------------------------------
  4141.   # ● Cancel Sensor
  4142.   #--------------------------------------------------------------------------          
  4143.   def cancel_sensor?  
  4144.       return false if self.battler == nil
  4145.       return true if self.battler.passive
  4146.       return false
  4147.   end
  4148.  
  4149. end
  4150.  
  4151. #===============================================================================
  4152. # ■  Game Event
  4153. #===============================================================================
  4154. class Game_Event < Game_Character
  4155.  
  4156.   attr_accessor :sensor_enable
  4157.  
  4158.   #--------------------------------------------------------------------------
  4159.   # ● Initialize
  4160.   #--------------------------------------------------------------------------            
  4161.   alias x_sensor_initialize initialize
  4162.   def initialize(map_id, event)
  4163.       @sensor_enable = false
  4164.       x_sensor_initialize(map_id, event)
  4165.   end  
  4166.  
  4167.   #--------------------------------------------------------------------------
  4168.   # ● Conditions Met
  4169.   #--------------------------------------------------------------------------
  4170.   alias x_sensor_conditions_met conditions_met?
  4171.   def conditions_met?(page)
  4172.       c = page.condition
  4173.       if c.self_switch_ch == XAS_BA::SENSOR_SELF_SWITCH
  4174.          @sensor_enable = true
  4175.       end
  4176.       x_sensor_conditions_met(page)    
  4177.   end
  4178. end
  4179.  
  4180. #===============================================================================
  4181. # ■  Game Event
  4182. #===============================================================================
  4183. class Game_Character < Game_CharacterBase
  4184.       include XRXS_EnemySensor
  4185. end
  4186.  
  4187. #===============================================================================
  4188. # ■  Game Character
  4189. #===============================================================================
  4190. class Game_Character < Game_CharacterBase
  4191.       attr_writer   :opacity
  4192. end
  4193.  
  4194.  
  4195.  
  4196. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4197. #■ BATTLER - ACTION
  4198. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4199.  
  4200.  
  4201. #===============================================================================
  4202. # ■ Game Character
  4203. #==============================================================================
  4204. class Game_Character < Game_CharacterBase
  4205.  
  4206.   #--------------------------------------------------------------------------
  4207.   # ● Can Update Battler Move Speed
  4208.   #--------------------------------------------------------------------------                  
  4209.   def can_update_battler_move_speed?
  4210.       return false if @temp_id > 0
  4211.       return false if moving?    
  4212.       return true
  4213.   end  
  4214.  
  4215.   #--------------------------------------------------------------------------
  4216.   # ● Can Update Battler?
  4217.   #--------------------------------------------------------------------------                
  4218.   def can_update_battler?
  4219.       return false unless $game_system.xas_battle
  4220.       return false if self.battler == nil
  4221.       return false unless party_system?
  4222.       return true
  4223.   end  
  4224.  
  4225.   #--------------------------------------------------------------------------
  4226.   # ● Party System
  4227.   #--------------------------------------------------------------------------                  
  4228.   def party_system?
  4229.       return false if self.battler == nil
  4230.       if $xas_party_system == nil and self.battler.is_a?(Game_Actor)
  4231.          return false if self.battler.actor_id != $game_party.members[0].actor_id
  4232.       end
  4233.       return true
  4234.   end
  4235.  
  4236.   #--------------------------------------------------------------------------
  4237.   # ● Reset Battler Temp
  4238.   #--------------------------------------------------------------------------                  
  4239.   def reset_battler_temp
  4240.       reset_cast_temp  
  4241.       reset_charge_temp
  4242.   end  
  4243.  
  4244.   #--------------------------------------------------------------------------
  4245.   # ● Reset Charge Temp
  4246.   #--------------------------------------------------------------------------                    
  4247.   def reset_charge_temp  
  4248.       return if self.battler == nil
  4249.       return if self.battler.is_a?(Game_Enemy)
  4250.       self.battler.x_charge_action[0] = 0
  4251.       self.battler.x_charge_action[1] = 0
  4252.       self.battler.x_charge_action[2] = 0
  4253.       self.battler.x_charge_action[3] = 0
  4254.   end
  4255.  
  4256.   #--------------------------------------------------------------------------
  4257.   # ● Reset Battler Temp
  4258.   #--------------------------------------------------------------------------                    
  4259.   def reset_cast_temp  
  4260.       return if self.battler == nil
  4261.       self.battler.cast_action[0] = 0
  4262.       self.battler.cast_action[1] = 0
  4263.       self.battler.cast_action[2] = 0
  4264.       self.battler.cast_action[3] = 0  
  4265.       self.battler.cast_action[4] = 0
  4266.   end
  4267.    
  4268.   #--------------------------------------------------------------------------
  4269.   # ● update_battler_parameters
  4270.   #--------------------------------------------------------------------------    
  4271.   def update_battler_parameters
  4272.       @stop_count = -1 if can_stop_battler?
  4273.       self.battler.invunerable_duration -= 1 if self.battler.invunerable_duration > 0
  4274.       unless @stop
  4275.          @knock_back_duration = 30 if @temp_id > 0
  4276.       end  
  4277.   end    
  4278.  
  4279.   #--------------------------------------------------------------------------
  4280.   # ● Can Stop Battler
  4281.   #--------------------------------------------------------------------------      
  4282.   def can_stop_battler?
  4283.       return false if self.is_a?(Game_Player)
  4284.       return true if self.knockbacking?
  4285.       return true if self.dead?
  4286.       return true if self.stop
  4287.       return false
  4288.   end
  4289.  
  4290.   #--------------------------------------------------------------------------
  4291.   # ● Update Battler Counter Action
  4292.   #--------------------------------------------------------------------------                    
  4293.   def update_battler_counter_action
  4294.       return if self.battler.counter_action[1] == 0
  4295.       self.battler.counter_action[1] -= 1
  4296.       if self.battler.counter_action[1] == 0
  4297.          turn_toward_player
  4298.          self.battler.damage = XAS_WORD::COUNTER
  4299.          self.battler.damage_pop = true
  4300.          self.shoot(self.battler.counter_action[0])
  4301.          self.battler.counter_action[0] = 0
  4302.       end  
  4303.   end  
  4304.  
  4305.   #--------------------------------------------------------------------------
  4306.   # ● Update Cast Action
  4307.   #--------------------------------------------------------------------------          
  4308.   def update_battler_cast_action    
  4309.       return unless can_update_cast_action?
  4310.       self.battler.cast_action[3] += 1
  4311.       if self.battler.cast_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
  4312.          self.battler.cast_action[3] = 0
  4313.          self.animation_id =  self.battler.cast_action[2]
  4314.       end  
  4315.       self.battler.cast_action[4] += 1
  4316.       if self.battler.cast_action[4] >= self.battler.cast_action[1]
  4317.           self.shoot(self.battler.cast_action[0])
  4318.       end
  4319.   end  
  4320.  
  4321.   #--------------------------------------------------------------------------
  4322.   # ● Can Update Cast Action
  4323.   #--------------------------------------------------------------------------            
  4324.   def can_update_cast_action?
  4325.       return false if self.battler.cast_action[1] == 0    
  4326.       return false if @stop
  4327.       return true
  4328.   end
  4329.  
  4330.   #--------------------------------------------------------------------------
  4331.   # ● Can Blow Effect
  4332.   #--------------------------------------------------------------------------              
  4333.   def can_blow?
  4334.       return false if self.stop and not self.battler.state_sleep
  4335.       return false if self.battler.no_knockback    
  4336.       return false if self.is_a?(Game_Player) and self.action != nil
  4337.       return true
  4338.   end  
  4339.    
  4340.   #--------------------------------------------------------------------------
  4341.   # ● Blow Effect
  4342.   #--------------------------------------------------------------------------        
  4343.   def blow(d, power = 1)
  4344.       return unless can_blow?
  4345.       jump(0,0)
  4346.       self.battler.invunerable_duration = 30 if self.battler.invunerable_duration <= 0
  4347.       if self.is_a?(Game_Event)
  4348.          @collision_attack = false  
  4349.       end
  4350.       @knock_back_duration = self.battler.knockback_duration
  4351.       refresh_sensor if self.is_a?(Game_Event)
  4352.       pre_direction = self.direction
  4353.       pre_direction_fix = self.direction_fix
  4354.       self.turn_reverse(d)      
  4355.       self.direction_fix = true
  4356.       power.times do
  4357.         case d
  4358.            when 2; @y += 1 if passable?(@x, @y, d)
  4359.            when 4; @x -= 1 if passable?(@x, @y, d)
  4360.            when 6; @x += 1 if passable?(@x, @y, d)
  4361.            when 8; @y -= 1 if passable?(@x, @y, d)
  4362.         end
  4363.       end
  4364.       self.direction_fix = pre_direction_fix
  4365.       self.direction = pre_direction
  4366.   end
  4367.  
  4368.   #--------------------------------------------------------------------------
  4369.   # ● Can Stop Battler Movement
  4370.   #--------------------------------------------------------------------------            
  4371.   def can_stop_battler_movement?
  4372.       return false if self.dead?  
  4373.       return true if self.battler.state_sleep
  4374.       return true if self.battler.state_stop
  4375.       return false
  4376.   end  
  4377.  
  4378.   #--------------------------------------------------------------------------
  4379.   # ● Impact
  4380.   #--------------------------------------------------------------------------              
  4381.   def impact(enable = true)
  4382.       return if self.tool_id == 0
  4383.       return if self.action == nil
  4384.       self.action.impact = enable
  4385.   end
  4386.  
  4387.   #--------------------------------------------------------------------------
  4388.   # ● Update Battler Stop Movement
  4389.   #--------------------------------------------------------------------------              
  4390.   def update_battler_stop_movement
  4391.       unless can_stop_battler_movement?
  4392.           @stop = false  
  4393.           return
  4394.       end
  4395.       @knock_back_duration = nil
  4396.       @stop = true      
  4397.       @step_anime = false    
  4398.       reset_battler_temp
  4399.       if self.battler.state_sleep
  4400.          make_pose("_Hit", 2)  
  4401.       else
  4402.          make_pose("", 2)
  4403.       end  
  4404.       if self.is_a?(Game_Event)
  4405.          @collision_attack = false
  4406.       end  
  4407.   end
  4408.    
  4409.   #--------------------------------------------------------------------------
  4410.   # ● Update Attacking
  4411.   #--------------------------------------------------------------------------              
  4412.   def update_battler_attacking
  4413.       return unless can_update_attacking?
  4414.       make_pose("_Atk", 2)
  4415.   end
  4416.  
  4417.   #--------------------------------------------------------------------------
  4418.   # ● Can Update Attacking
  4419.   #--------------------------------------------------------------------------              
  4420.   def can_update_attacking?
  4421.       return false if self.battler.is_a?(Game_Actor)
  4422.       return false if @collision_attack == false  
  4423.       return true
  4424.   end  
  4425.  
  4426.   #--------------------------------------------------------------------------
  4427.   # ● Update Battler Knobacking
  4428.   #--------------------------------------------------------------------------            
  4429.   def update_battler_knockbacking
  4430.        return unless self.knockbacking?
  4431.        @pattern = 0
  4432.        @knock_back_duration -= 1 if can_remove_knockback?
  4433.        make_pose("_Hit", 2)        
  4434.        if self.is_a?(Game_Event)
  4435.           @collision_attack = false
  4436.        end        
  4437.        if @knock_back_duration <= 0
  4438.           @knock_back_duration = nil
  4439.           make_pose("", 0)
  4440.           touch_attack(false) if self.is_a?(Game_Event)
  4441.           @character_name = @x_pose_original_name
  4442.        end
  4443.   end  
  4444.    
  4445.   #--------------------------------------------------------------------------
  4446.   # ● Can Remove Knockback
  4447.   #--------------------------------------------------------------------------              
  4448.   def can_remove_knockback?
  4449.       return true
  4450.   end
  4451.  
  4452.   #--------------------------------------------------------------------------
  4453.   # ● knockbacking?
  4454.   #--------------------------------------------------------------------------            
  4455.   def knockbacking?
  4456.       return false if self.battler == nil
  4457.       return false if @stop
  4458.       return true if @knock_back_duration != nil
  4459.       return false
  4460.   end
  4461.  
  4462.   #--------------------------------------------------------------------------
  4463.   # ● collapsing?
  4464.   #--------------------------------------------------------------------------          
  4465.   def collapsing?
  4466.       return self.collapse_duration.to_i > 0
  4467.   end
  4468.    
  4469.   #--------------------------------------------------------------------------
  4470.   # ● Seal Effect
  4471.   #--------------------------------------------------------------------------          
  4472.   def seal_effect
  4473.       Sound.play_buzzer
  4474.       if XAS_WORD::ENABLE_WORD
  4475.          self.battler.damage = XAS_WORD::SEAL
  4476.          self.battler.damage_pop = true
  4477.       end  
  4478.   end    
  4479.  
  4480. end
  4481.  
  4482. #===============================================================================
  4483. # ■ XAS_DamageStop
  4484. #===============================================================================
  4485. module XAS_DamageStop
  4486.  
  4487.   #--------------------------------------------------------------------------
  4488.   # ● Acting
  4489.   #--------------------------------------------------------------------------            
  4490.   def acting?
  4491.       return (super or self.knockbacking? or self.collapsing? or self.stop)
  4492.   end
  4493. end
  4494.  
  4495. #===============================================================================
  4496. # ■ Game_Player
  4497. #===============================================================================
  4498. class Game_Player < Game_Character
  4499.       include XAS_DamageStop
  4500. end
  4501.  
  4502. #===============================================================================
  4503. # ■ Game_Event
  4504. #===============================================================================
  4505. class Game_Event < Game_Character
  4506.       include XAS_DamageStop
  4507. end
  4508.  
  4509.  
  4510.  
  4511. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4512. #■ BATTLER - TOUCH EFFECT
  4513. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4514.  
  4515.  
  4516. #===============================================================================
  4517. # ■ XRXS_BattlerAttachment
  4518. #==============================================================================
  4519. module XRXS_BattlerAttachment
  4520.  
  4521.   #--------------------------------------------------------------------------
  4522.   # ● Attack Effect
  4523.   #--------------------------------------------------------------------------    
  4524.   def attack_effect(attacker)
  4525.       return false unless $game_system.xas_battle    
  4526.       return if self.battler == nil or attacker == nil
  4527.       return unless can_attack_effect?(attacker)
  4528.       if target_shield_enabled?(attacker, nil, nil)
  4529.          execute_guard_effect(attacker, nil, nil, 30)
  4530.          return
  4531.       end  
  4532.       execute_attack_effect(attacker)
  4533.  end
  4534.    
  4535.  #--------------------------------------------------------------------------
  4536.  # ● Can Attack Effect
  4537.  #--------------------------------------------------------------------------    
  4538.  def can_attack_effect?(attacker)
  4539.      return false if self.can_update == false
  4540.      return false if @knock_back_duration != nil
  4541.      return false if attacker.stop
  4542.      return false if self.battler.invunerable
  4543.      return false if self.battler.invunerable_duration > 0
  4544.      return false if self.action != nil and self.action.user_invincible
  4545.      return false if seal_attack?(attacker.battler)    
  4546.      return false if target_state_invunerable?(30)
  4547.      return true
  4548.  end  
  4549.  
  4550.  #--------------------------------------------------------------------------
  4551.  # ● Attack Target Shield
  4552.  #--------------------------------------------------------------------------    
  4553.  def attack_target_shield?(attacker)
  4554.      return false if attacker.battler.ignore_shield  
  4555.      return false unless self.battler.shield
  4556.      return true if face_direction?(attacker)
  4557.      return false
  4558.  end  
  4559.  
  4560.  #--------------------------------------------------------------------------
  4561.  # ● Seal Attack?
  4562.  #--------------------------------------------------------------------------              
  4563.  def seal_attack?(attacker)
  4564.      if attacker.state_seal_attack or attacker.state_mute
  4565.         attacker.damage = XAS_WORD::SEAL
  4566.         attacker.damage_pop = true
  4567.         self.battler.invunerable_duration = 30
  4568.         return true
  4569.      end
  4570.      return false
  4571.  end  
  4572.  
  4573.  #--------------------------------------------------------------------------
  4574.  # ● Execute Attack Damage
  4575.  #--------------------------------------------------------------------------      
  4576.  def execute_attack_damage(attacker)
  4577.      #if self.battler.agi > (rand(attacker.battler.agi) * 2)
  4578.      #   self.battler.result.missed = true
  4579.      #   return
  4580.      #end
  4581.      damage = ((attacker.battler.atk * 4) - (self.battler.def * 2)).truncate
  4582.      damage = 0 if damage < 0
  4583.      self.battler.result.hp_damage = damage
  4584.      #self.battler.result.critical  
  4585.      self.battler.hp -= damage.abs
  4586.  end
  4587.  
  4588.  #--------------------------------------------------------------------------
  4589.  # ● Execute Attack Effect
  4590.  #--------------------------------------------------------------------------      
  4591.  def execute_attack_effect(attacker)
  4592.      execute_attack_effect_before_damage(attacker)
  4593.      execute_attack_damage(attacker)
  4594.      if target_missed?(attacker)
  4595.         self.battler.invunerable_duration = 30
  4596.         return
  4597.      end
  4598.      execute_damage_pop(attacker)
  4599.      execute_attack_effect_after_damage(attacker) if can_check_after_attack_effect?(attacker)  
  4600.      execute_state_effect(nil, attacker, nil)    
  4601.      self.battler.invunerable_duration = 20 + XAS_BA::DEFAULT_KNOCK_BACK_DURATION
  4602.      if attacker.battler.attack_animation_id != 0
  4603.         self.animation_id = attacker.battler.attack_animation_id
  4604.      end  
  4605.      if self.battler.damage.to_i > 0
  4606.         self.blow(attacker.direction, 1) if can_blow_effect?
  4607.      end
  4608.      if self.is_a?(Game_Player)
  4609.         self.need_refresh = true
  4610.      end
  4611.  end  
  4612.      
  4613.  #--------------------------------------------------------------------------
  4614.  # ● Can Check After Attack Effect?  
  4615.  #--------------------------------------------------------------------------        
  4616.  def can_check_after_attack_effect?(attacker)  
  4617.      return false unless self.battler.damage.is_a?(Numeric)
  4618.      return true
  4619.  end
  4620.  
  4621.  #--------------------------------------------------------------------------
  4622.  # ● Execute Attack Effect Before Damage
  4623.  #--------------------------------------------------------------------------      
  4624.  def execute_attack_effect_before_damage(attacker)
  4625.  
  4626.  end
  4627.  
  4628.  #--------------------------------------------------------------------------
  4629.  # ● Execute Attack Effect After Damage
  4630.  #--------------------------------------------------------------------------      
  4631.  def execute_attack_effect_after_damage(attacker)
  4632.  
  4633.  end
  4634.  
  4635. end
  4636.  
  4637. #===============================================================================
  4638. # ■ Game Player
  4639. #===============================================================================
  4640. class Game_Player < Game_Character  
  4641.   #--------------------------------------------------------------------------
  4642.   # ● Check Event Trigger Touch
  4643.   #--------------------------------------------------------------------------            
  4644.   alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  4645.   def check_event_trigger_touch(x, y)
  4646.       xrxs64c_check_event_trigger_touch(x, y)
  4647.       if $game_map.interpreter.running?
  4648.          return
  4649.       end
  4650.       for event in $game_map.events.values
  4651.           next unless event.collision_attack
  4652.           unless [1,2].include?(event.trigger)
  4653.              if event.battler != nil and event.x == x and event.y == y
  4654.                 $game_player.attack_effect(event)
  4655.              end
  4656.           end
  4657.       end
  4658.   end
  4659. end
  4660.  
  4661. #===============================================================================
  4662. # ■ Game Event
  4663. #===============================================================================
  4664. class Game_Event < Game_Character
  4665.  
  4666.   #--------------------------------------------------------------------------
  4667.   # ● Check Event Trigger Touch
  4668.   #--------------------------------------------------------------------------            
  4669.   alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  4670.   def check_event_trigger_touch(x, y)
  4671.     xrxs64c_check_event_trigger_touch(x, y)
  4672.     if $game_map.interpreter.running?
  4673.        return
  4674.     end
  4675.     return unless self.collision_attack
  4676.     if self.battler != nil and x == $game_player.x and y == $game_player.y
  4677.        $game_player.attack_effect(self)
  4678.     end
  4679.   end
  4680. end
  4681.  
  4682.  
  4683.  
  4684. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4685. #■ BATTLER - MOVE SPEED
  4686. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4687.  
  4688.  
  4689. #==============================================================================
  4690. # ■ Game_Character
  4691. #==============================================================================
  4692. class Game_Character < Game_CharacterBase
  4693.  
  4694.   include XAS_BA
  4695.   attr_accessor :base_move_speed
  4696.   attr_accessor :dash_move_speed
  4697.   attr_accessor :move_speed
  4698.  
  4699.  #--------------------------------------------------------------------------
  4700.  # ● Initialize
  4701.  #--------------------------------------------------------------------------  
  4702.   alias x_move_speed_initialize initialize
  4703.   def initialize
  4704.       @base_move_speed = BASE_MOVE_SPEED
  4705.       @dash_move_speed = 0
  4706.       x_move_speed_initialize
  4707.   end  
  4708.  
  4709.  #--------------------------------------------------------------------------
  4710.  # ● update_battler_move_speed
  4711.  #--------------------------------------------------------------------------
  4712.   def update_battler_move_speed
  4713.       @dash_move_speed = @dash_active ? DASH_MOVE_SPEED : 0
  4714.       sp1 = @base_move_speed
  4715.       sp2 = @dash_move_speed
  4716.       sp3 = self.battler.state_move_speed
  4717.       @move_speed = (sp1 + sp2 + sp3)
  4718.   end
  4719.  
  4720.  #--------------------------------------------------------------------------
  4721.  # ● Update Animation
  4722.  #--------------------------------------------------------------------------      
  4723.   def update_animation
  4724.       super
  4725.       update_force_move_routine_move
  4726.   end
  4727.    
  4728.  #--------------------------------------------------------------------------
  4729.  # ● Update Force Move Routine Move
  4730.  #--------------------------------------------------------------------------        
  4731.   def update_force_move_routine_move
  4732.       return if @force_action == ""
  4733.       return if @move_route == nil
  4734.       command = @move_route.list[@move_route_index]
  4735.       return if command == nil
  4736.       if command.code == ROUTE_PLAY_SE    
  4737.          params = command.parameters
  4738.          params[0].play
  4739.          advance_move_route_index
  4740.       end  
  4741.   end
  4742.  
  4743.  #--------------------------------------------------------------------------
  4744.  # ● Update Routine Move
  4745.  #--------------------------------------------------------------------------      
  4746.  alias x_update_routine_move update_routine_move
  4747.  def update_routine_move
  4748.      return if @force_action_times > 0
  4749.      x_update_routine_move
  4750.  end
  4751.  
  4752.  #--------------------------------------------------------------------------
  4753.  # ● Can Cancel Move Type Custom
  4754.  #--------------------------------------------------------------------------    
  4755.   alias x_move_speed_process_move_command process_move_command
  4756.   def process_move_command(command)
  4757.       return if can_cancel_move_type_custom?(command)
  4758.       params = command.parameters
  4759.       x_move_speed_process_move_command(command)
  4760.       if command.code == ROUTE_CHANGE_SPEED and @battler != nil and
  4761.          self.is_a?(Game_Event)
  4762.          @base_move_speed = params[0]
  4763.       end        
  4764.   end
  4765.  
  4766.  #--------------------------------------------------------------------------
  4767.  # ● Can Cancel Move Type Custom
  4768.  #--------------------------------------------------------------------------    
  4769.   def can_cancel_move_type_custom?(command)
  4770.       return true if command == nil
  4771.       return true if @force_action_times > 0
  4772.       return false
  4773.   end  
  4774.  
  4775. end  
  4776.  
  4777.  
  4778. #==============================================================================
  4779. # ■ Game_Event
  4780. #==============================================================================
  4781. class Game_Event < Game_Character  
  4782.  
  4783.  #--------------------------------------------------------------------------
  4784.  # ● Initialize
  4785.  #--------------------------------------------------------------------------              
  4786.  alias x_move_speed_event_initialize initialize
  4787.  def initialize(map_id, event)
  4788.      x_move_speed_event_initialize(map_id, event)
  4789.      refresh_move_speed
  4790.  end  
  4791.  
  4792.   #--------------------------------------------------------------------------
  4793.   # ● Refresh Move Speed
  4794.   #--------------------------------------------------------------------------
  4795.   def refresh_move_speed
  4796.       return if @page == nil
  4797.       @base_move_speed = @page.move_speed
  4798.   end
  4799.  
  4800.  #--------------------------------------------------------------------------
  4801.  # ● Setup Page
  4802.  #--------------------------------------------------------------------------              
  4803.  alias x_move_speed_setup_page setup_page
  4804.  def setup_page(new_page)
  4805.      x_move_speed_setup_page(new_page)
  4806.      refresh_move_speed
  4807.  end
  4808.  
  4809. end
  4810.  
  4811.  
  4812. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4813. #■ BATTLER - STATES
  4814. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4815.  
  4816.  
  4817. #==============================================================================
  4818. # ■ Game_Battler
  4819. #==============================================================================
  4820. class Game_Battler
  4821.  
  4822.   attr_accessor :state_move_speed
  4823.   attr_accessor :state_stop
  4824.   attr_accessor :state_loop_effect_time
  4825.   attr_accessor :state_loop_speed
  4826.   attr_accessor :state_duration
  4827.   attr_accessor :state_string
  4828.   attr_accessor :state_string_time
  4829.   attr_accessor :state_stop
  4830.   attr_accessor :state_slow
  4831.   attr_accessor :state_sleep
  4832.   attr_accessor :state_invunerable
  4833.   attr_accessor :state_fast
  4834.   attr_accessor :state_mute
  4835.   attr_accessor :state_seal_attack
  4836.   attr_accessor :state_seal_skill
  4837.   attr_accessor :state_seal_item
  4838.   attr_accessor :state_reflect
  4839.  
  4840.  #--------------------------------------------------------------------------
  4841.  # ● Initialize
  4842.  #--------------------------------------------------------------------------  
  4843.   alias x_state_initialize initialize
  4844.   def initialize
  4845.       @state_move_speed = 0
  4846.       @state_duration = []
  4847.       @state_loop_effect_time = []
  4848.       @state_loop_speed = []
  4849.       @state_string = ""
  4850.       @state_string_time = 0
  4851.       @state_stop = false
  4852.       @state_sleep = false
  4853.       @state_invunerable = false
  4854.       @state_slow = false
  4855.       @state_fast = false
  4856.       @state_mute = false
  4857.       @state_seal_attack = false
  4858.       @state_seal_skill = false
  4859.       @state_seal_item = false
  4860.       @state_reflect = false
  4861.       x_state_initialize
  4862.   end
  4863.    
  4864.  #--------------------------------------------------------------------------
  4865.  # ● Add State
  4866.  #--------------------------------------------------------------------------    
  4867.   alias x_add_state add_state
  4868.   def add_state(state_id)
  4869.       unless @states.include?(state_id)
  4870.           state = $data_states[state_id]
  4871.           xas_add_state(state)
  4872.       end        
  4873.       x_add_state(state_id)
  4874.   end
  4875.  
  4876.  #--------------------------------------------------------------------------
  4877.  # ● Xas Add State
  4878.  #--------------------------------------------------------------------------      
  4879.   def xas_add_state(state)
  4880.       @state_duration[state.id] = 60 * $data_states[state.id].min_turns
  4881.       @state_loop_effect_time[state.id] = 0
  4882.       @state_loop_speed[state.id] = $data_states[state.id].max_turns
  4883.       execute_damage_state(state,0)
  4884.   end      
  4885.  
  4886.  #--------------------------------------------------------------------------
  4887.  # ● Remove State
  4888.  #--------------------------------------------------------------------------        
  4889.   alias x_remove_state remove_state
  4890.   def remove_state(state_id)
  4891.       if state?(state_id)
  4892.          state = $data_states[state_id]
  4893.          xas_remove_state(state)
  4894.       end  
  4895.       x_remove_state(state_id)      
  4896.   end    
  4897.    
  4898.  #--------------------------------------------------------------------------
  4899.  # ● XAS Remove State
  4900.  #--------------------------------------------------------------------------        
  4901.   def xas_remove_state(state)
  4902.       @state_duration.delete(state.id)  
  4903.       @state_loop_effect_time.delete(state.id)  
  4904.       @state_loop_speed.delete(state.id)
  4905.       execute_damage_state(state,1)
  4906.   end  
  4907.  
  4908.  #--------------------------------------------------------------------------
  4909.  # ● Execute_Damage_State
  4910.  #--------------------------------------------------------------------------          
  4911.   def execute_damage_state(state,type)
  4912.       return unless XAS_DAMAGE_POP::DAMAGE_STATE_POP
  4913.       return unless XAS_WORD::ENABLE_WORD
  4914.       return if state == nil or state.id == 1
  4915.       case type
  4916.          when 0
  4917.              damage = "+ " + state.name.to_s
  4918.          when 1  
  4919.              damage = "- " + state.name.to_s
  4920.       end
  4921.       @state_string = damage
  4922.       @state_string_time = 30            
  4923.   end  
  4924.  
  4925. end
  4926.  
  4927. #==============================================================================
  4928. # ■ Game_Character
  4929. #==============================================================================
  4930. class Game_Character < Game_CharacterBase
  4931.  
  4932.  #--------------------------------------------------------------------------
  4933.  # ● Update Battler States Effect
  4934.  #--------------------------------------------------------------------------    
  4935.  def update_battler_states_effect
  4936.      return unless XAS_SYSTEM::STATE_SYSTEM
  4937.      update_state_string_pop
  4938.      update_pre_state_setup
  4939.      return unless can_update_states_effect?
  4940.      for i in self.battler.states
  4941.          state = $data_states[i.id]  
  4942.          if state == nil or self.battler.state_duration[state.id] == nil or
  4943.             self.battler.state_loop_effect_time[state.id] == nil or
  4944.             self.battler.state_loop_speed[state.id] == nil
  4945.             self.battler.remove_state(state.id)
  4946.             next
  4947.             return
  4948.          end  
  4949.          update_state_abs_effects(state)
  4950.          update_state_loop(state)
  4951.          update_remove_state(state)
  4952.      end  
  4953.        
  4954.  end  
  4955.  
  4956.  #--------------------------------------------------------------------------
  4957.  # ● Update Pre State Setup
  4958.  #--------------------------------------------------------------------------      
  4959.  def update_pre_state_setup
  4960.      self.battler.state_stop = false
  4961.      self.battler.state_slow = false
  4962.      self.battler.state_fast = false
  4963.      self.battler.state_mute = false
  4964.      self.battler.state_sleep = false
  4965.      self.battler.state_invunerable = false
  4966.      self.battler.state_seal_attack = false
  4967.      self.battler.state_seal_skill = false
  4968.      self.battler.state_seal_item = false
  4969.      self.battler.state_reflect = false
  4970.      self.battler.state_move_speed = 0
  4971.  end  
  4972.  
  4973.  #--------------------------------------------------------------------------
  4974.  # ● Update Pre State Setup
  4975.  #--------------------------------------------------------------------------        
  4976.  def update_state_abs_effects(state)
  4977.      if state.note =~ /<Stop>/
  4978.         self.battler.state_stop = true
  4979.      end
  4980.      if state.note =~ /<Slow>/
  4981.         self.battler.state_slow = true
  4982.         self.battler.state_move_speed = -1.5
  4983.      end  
  4984.      if state.note =~ /<Fast>/  
  4985.         self.battler.state_fast = true
  4986.         self.battler.state_move_speed = 1    
  4987.      end
  4988.      if self.battler.state_fast and
  4989.         self.battler.state_slow
  4990.         self.battler.state_move_speed = 0
  4991.      end
  4992.      if state.note =~ /<Mute>/  
  4993.         self.battler.state_mute = true
  4994.      end
  4995.      if state.note =~ /<Sleep>/  
  4996.         self.battler.state_sleep = true
  4997.      end
  4998.      if state.note =~ /<Invincible>/  
  4999.         self.battler.state_invunerable = true
  5000.      end  
  5001.      if state.note =~ /<Seal Attack>/  
  5002.         self.battler.state_seal_attack = true
  5003.      end
  5004.      if state.note =~ /<Seal Skill>/  
  5005.         self.battler.state_seal_skill = true
  5006.      end      
  5007.      if state.note =~ /<Seal Item>/  
  5008.         self.battler.state_seal_item = true
  5009.       end
  5010.      if state.note =~ /<Reflect>/
  5011.         self.battler.state_reflect = true
  5012.      end        
  5013.  end
  5014.  
  5015.  #--------------------------------------------------------------------------
  5016.  # ● Update State Loop
  5017.  #--------------------------------------------------------------------------      
  5018.  def update_state_loop(state)
  5019.      self.battler.state_loop_effect_time[state.id] += 1
  5020.      if self.battler.state_loop_effect_time[state.id] > self.battler.state_loop_speed[state.id]
  5021.         self.battler.state_loop_effect_time[state.id] = 0
  5022.         if state.note =~ /<Animation ID = (\d+)>/
  5023.            state_anime = $1.to_i
  5024.            if state_anime != nil
  5025.               self.animation_id = state_anime
  5026.            end
  5027.         end    
  5028.         execute_states_effects(state)          
  5029.      end          
  5030.  end
  5031.  
  5032. #--------------------------------------------------------------------------
  5033. # ● Execute States Effect
  5034. #--------------------------------------------------------------------------      
  5035.   def execute_states_effects(state)        
  5036.     if state.note =~ /<Slip Damage = (\S+)>/
  5037.       execute_state_slip_damage($1.to_i)
  5038.     end  
  5039.   end
  5040.  
  5041.  #--------------------------------------------------------------------------
  5042.  # ● Execute States Slip Damage
  5043.  #--------------------------------------------------------------------------        
  5044.  def execute_state_slip_damage(damage)
  5045.      damage = 1 if damage == nil
  5046.      damage_slip = self.battler.mhp * damage / 100
  5047.      self.battler.hp -= damage_slip
  5048.      self.battler.damage = damage_slip
  5049.      self.battler.damage_pop = true
  5050.    end
  5051.  
  5052.  #--------------------------------------------------------------------------
  5053.  # ● Update Remove State
  5054.  #--------------------------------------------------------------------------      
  5055.  def update_remove_state(state)
  5056.      self.battler.state_duration[state.id] -= 1
  5057.      if self.battler.state_duration[state.id] <= 0    
  5058.         self.battler.remove_state(state.id)
  5059.      end          
  5060.  end
  5061.  
  5062.  #--------------------------------------------------------------------------
  5063.  # ● Can Update States Effect
  5064.  #--------------------------------------------------------------------------      
  5065.   def can_update_states_effect?
  5066.       return false if self.dead?
  5067.       return false if self.battler.states == nil
  5068.       return false if self.battler.states.size == 0
  5069.       return false if self.battler.state_duration == []
  5070.       return true
  5071.   end
  5072.  
  5073.  #--------------------------------------------------------------------------
  5074.  # ● Update State String Pop
  5075.  #--------------------------------------------------------------------------      
  5076.   def update_state_string_pop
  5077.       return false if self.battler.state_string_time == 0
  5078.       self.battler.state_string_time -= 1
  5079.       if self.battler.state_string_time == 0
  5080.          self.battler.damage = self.battler.state_string
  5081.          self.battler.damage_pop = true
  5082.          self.battler.state_string = ""
  5083.       end  
  5084.   end  
  5085. end  
  5086.  
  5087. #==============================================================================
  5088. # ■ Game_Party
  5089. #==============================================================================
  5090. class Game_Party < Game_Unit
  5091.  
  5092.  #--------------------------------------------------------------------------
  5093.  # ● On Player Walk
  5094.  #--------------------------------------------------------------------------        
  5095.  alias x_state_on_player_walk on_player_walk
  5096.  def on_player_walk
  5097.      return if XAS_SYSTEM::STATE_SYSTEM
  5098.      x_state_on_player_walk
  5099.  end
  5100.  
  5101. end
  5102.  
  5103.  
  5104.  
  5105. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5106. #■ BATTLER - EVENT COMMANDS
  5107. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5108.  
  5109.  
  5110. #===============================================================================
  5111. # ■ Game Event
  5112. #===============================================================================
  5113. class Game_Event < Game_Character
  5114.  
  5115.   #--------------------------------------------------------------------------
  5116.   # ● Shoot Chance
  5117.   #--------------------------------------------------------------------------            
  5118.   def shoot_chance(action_id,perc)
  5119.       return if self.battler == nil
  5120.       if perc >= rand(100)
  5121.          shoot(action_id)
  5122.       end  
  5123.   end  
  5124.  
  5125.   #--------------------------------------------------------------------------
  5126.   # ● Guard
  5127.   #--------------------------------------------------------------------------          
  5128.   def guard(enable)
  5129.       return if self.battler == nil
  5130.       self.battler.guard = enable
  5131.   end  
  5132.  
  5133.   #--------------------------------------------------------------------------
  5134.   # ● Touch Attack
  5135.   #--------------------------------------------------------------------------            
  5136.   def touch_attack(enable)
  5137.       return if self.battler == nil        
  5138.       return if seal_attack?(self.battler)
  5139.       @collision_attack = enable
  5140.       @pattern = 0
  5141.       @pattern_count  = 0      
  5142.   end
  5143.  
  5144.   #--------------------------------------------------------------------------
  5145.   # ● Counter
  5146.   #--------------------------------------------------------------------------            
  5147.   def counter(enable)
  5148.       return if self.battler == nil
  5149.       self.battler.counter_action[2] = enable
  5150.   end    
  5151.  
  5152.   #--------------------------------------------------------------------------
  5153.   # ● Rand Shoot
  5154.   #--------------------------------------------------------------------------            
  5155.   def rand_shoot(random_id = [])
  5156.       return if self.battler == nil
  5157.       return if random_id == []
  5158.       action_id = random_id[rand(random_id.size)]
  5159.       self.shoot(action_id)
  5160.   end      
  5161.  
  5162. end
  5163.  
  5164.  
  5165.  
  5166. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5167. #■ BATTLER - DEFEAT PROCESS
  5168. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5169.  
  5170. #===============================================================================
  5171. # ■ Scene Base
  5172. #===============================================================================
  5173. class Scene_Base  
  5174.  
  5175.   #--------------------------------------------------------------------------
  5176.   # ● Check Gameover
  5177.   #--------------------------------------------------------------------------              
  5178.   def check_gameover
  5179.       return unless $game_party.in_battle  
  5180.       SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
  5181.   end
  5182. end  
  5183.  
  5184. #===============================================================================
  5185. # ■ Game Character
  5186. #===============================================================================
  5187. class Game_Character < Game_CharacterBase
  5188.   attr_accessor :collapse_duration
  5189.   attr_accessor :battler_visible
  5190.   attr_writer   :opacity
  5191.  
  5192.   #--------------------------------------------------------------------------
  5193.   # ● Initialize
  5194.   #--------------------------------------------------------------------------            
  5195.   alias x_collapse_initialize initialize
  5196.   def initialize
  5197.       @collapse_duration = 0
  5198.       x_collapse_initialize
  5199.   end  
  5200.  
  5201. end
  5202.  
  5203. #===============================================================================
  5204. # ■ XAS_BA_BATTLEEVENT_NONPREEMPT
  5205. #==============================================================================
  5206. module XAS_BA_BATTLEEVENT_NONPREEMPT
  5207.  
  5208.   #--------------------------------------------------------------------------
  5209.   # ● Update
  5210.   #--------------------------------------------------------------------------            
  5211.   def update
  5212.       return if self.battler != nil and $game_map.interpreter.running?
  5213.       super
  5214.   end
  5215. end
  5216.  
  5217. #===============================================================================
  5218. # ■ Game Event
  5219. #==============================================================================
  5220. class Game_Event < Game_Character
  5221.       include XAS_BA_BATTLEEVENT_NONPREEMPT
  5222. end
  5223.  
  5224. #===============================================================================
  5225. # ■ Game Character
  5226. #===============================================================================
  5227. class Game_Character < Game_CharacterBase
  5228.  
  5229.   #--------------------------------------------------------------------------
  5230.   # ● Update Battler Defeat Process
  5231.   #--------------------------------------------------------------------------      
  5232.    def update_battler_defeat_process
  5233.        execute_enemy_defeated_process if can_check_enemy_defeated?
  5234.        execute_actor_defeated_process if can_check_actor_defeated?
  5235.    end
  5236.    
  5237.   #--------------------------------------------------------------------------
  5238.   # ● Can Check Enemy Defeated?
  5239.   #--------------------------------------------------------------------------            
  5240.   def can_check_enemy_defeated?  
  5241.       return false if self.battler.is_a?(Game_Actor)
  5242.       return false if self.battler.defeated
  5243.       return true
  5244.   end    
  5245.  
  5246.   #--------------------------------------------------------------------------
  5247.   # ● Can Check Actor Defeated?
  5248.   #--------------------------------------------------------------------------              
  5249.   def can_check_actor_defeated?
  5250.       return false if self.battler.is_a?(Game_Enemy)
  5251.       return false if self.battler.defeated
  5252.       return false if $game_party.members[0].hp > 0
  5253.       return false if @collapse_duration > 0
  5254.       return true  
  5255.   end
  5256.  
  5257.   #--------------------------------------------------------------------------
  5258.   # ● Execute Actor Defeated Process
  5259.   #--------------------------------------------------------------------------                
  5260.   def execute_actor_defeated_process
  5261.       erase_actor_tools_on_map
  5262.       if $game_party.all_dead? and not self.battler.defeated
  5263.          self.battler.defeated = true
  5264.          self.collapse_duration = 120
  5265.          self.knock_back_duration = 161
  5266.          reset_battler_temp
  5267.       else  
  5268.          $game_temp.change_leader_wait_time = 0
  5269.          $game_player.change_leader
  5270.       end  
  5271.   end
  5272.  
  5273.   #--------------------------------------------------------------------------
  5274.   # ● Erase Tools on Map
  5275.   #--------------------------------------------------------------------------                  
  5276.   def erase_actor_tools_on_map
  5277.       for event in $game_map.events.values
  5278.           if event.tool_id > 0 and event.action.user.is_a?(Game_Player)
  5279.              event.erase
  5280.           end  
  5281.       end  
  5282.   end
  5283.  
  5284.   #--------------------------------------------------------------------------
  5285.   # ● Execute Enemy Defeaed Process
  5286.   #--------------------------------------------------------------------------        
  5287.    def execute_enemy_defeated_process
  5288.        self.battler.defeated = true
  5289.        self.through = true
  5290.        @knock_back_duration = 121
  5291.        enemy = $data_enemies[self.battler.enemy_id]
  5292.        @collapse_duration = 120
  5293.        execute_gain_exp_gold(enemy)  
  5294.        execute_active_switch(enemy)
  5295.        execute_defeated_animation(enemy)
  5296.        execute_defeated_sound_effect(enemy)
  5297.        execute_final_shoot(enemy)
  5298.    end    
  5299.  
  5300.   #--------------------------------------------------------------------------
  5301.   # ● Execute Defeated Sound Effect
  5302.   #--------------------------------------------------------------------------              
  5303.   def execute_defeated_sound_effect(enemy)
  5304.       return if self.battler.no_damage_pop
  5305.       Sound.play_enemy_collapse  
  5306.   end
  5307.  
  5308.   #--------------------------------------------------------------------------
  5309.   # ● Execute Final Shoot
  5310.   #--------------------------------------------------------------------------            
  5311.   def execute_final_shoot(enemy)
  5312.       enemy.note  =~ /<Final Action ID = (\d+)>/
  5313.       action_id = $1.to_i
  5314.       return if action_id == nil
  5315.       self.shoot(action_id)      
  5316.   end  
  5317.  
  5318.   #--------------------------------------------------------------------------
  5319.   # ● Execute Gain Exp Gold
  5320.   #--------------------------------------------------------------------------          
  5321.   def execute_gain_exp_gold(enemy)  
  5322.       exp = self.battler.exp
  5323.       case XAS_BA::EXP_TYPE
  5324.          when 0
  5325.             actor = $game_party.members[0]
  5326.             actor.gain_exp(exp)
  5327.          when 1
  5328.             for i in 0...$game_party.members.size
  5329.                actor = $game_party.members[i]
  5330.                actor.gain_exp(exp)
  5331.             end  
  5332.          when 2  
  5333.             exp = exp / $game_party.members.size
  5334.             for i in 0...$game_party.members.size
  5335.                actor = $game_party.members[i]          
  5336.                actor.gain_exp(exp)
  5337.             end              
  5338.       end
  5339.       $game_party.gain_gold(self.battler.gold)
  5340.   end  
  5341.  
  5342.   #--------------------------------------------------------------------------
  5343.   # ● Execute_Active Switch
  5344.   #--------------------------------------------------------------------------          
  5345.   def execute_active_switch(enemy)        
  5346.       enemy.note  =~ /<Active Switch = (\d+)>/      
  5347.       switch_id = $1.to_i  
  5348.       if switch_id != nil
  5349.          $game_switches[switch_id] = true
  5350.          $game_map.need_refresh = true    
  5351.       end
  5352.   end
  5353.  
  5354.   #--------------------------------------------------------------------------
  5355.   # ● Execute Defeated Animation
  5356.   #--------------------------------------------------------------------------            
  5357.   def execute_defeated_animation(enemy)
  5358.       enemy.note  =~ /<Defeated Animation = (\d+)>/      
  5359.       anime_id = $1.to_i      
  5360.       if anime_id != nil
  5361.          self.animation_id = anime_id
  5362.       end  
  5363.   end  
  5364.  
  5365. end  
  5366.  
  5367. #===============================================================================
  5368. # ■ Game Player
  5369. #===============================================================================
  5370. class Game_Player < Game_Character
  5371.  
  5372.   #--------------------------------------------------------------------------
  5373.   # ● Reset Old Level
  5374.   #--------------------------------------------------------------------------            
  5375.   def reset_old_level(trans = false)
  5376.      for actor in $game_party.members
  5377.          actor.old_level = actor.level
  5378.      end    
  5379.   end
  5380.  
  5381.   #--------------------------------------------------------------------------
  5382.   # ● Change Leader
  5383.   #--------------------------------------------------------------------------                  
  5384.   def change_leader
  5385.       return if $game_party.members.size <= 1
  5386.       reset_battler_temp
  5387.       current_leader_id = $game_party.members[0].id
  5388.       for i in 1..$game_party.members.size
  5389.           pre_leader = $game_party.members[0].id
  5390.           $game_party.remove_actor(pre_leader)
  5391.           $game_party.add_actor(pre_leader)  
  5392.           if $game_party.members[0].hp > 0
  5393.              execute_change_leader_effect unless current_leader_id == $game_party.members[0].id
  5394.              break
  5395.           end
  5396.       end
  5397.   end  
  5398.  
  5399.   #--------------------------------------------------------------------------
  5400.   # ● Exeute Change leader Effect
  5401.   #--------------------------------------------------------------------------                    
  5402.   def execute_change_leader_effect
  5403.       actor = $game_party.members[0]
  5404.       actor.invunerable_duration = XAS_BA::CHANGE_LEADER_WAIT_TIME
  5405.       actor.damage = nil
  5406.       actor.damage_pop = false
  5407.       actor.critical = false
  5408.       @knock_back_duration = nil
  5409.       if self.action != nil
  5410.          self.action.duration = 1
  5411.       end
  5412.       @force_action_times = 0
  5413.       @force_action_type = ""        
  5414.       reset_old_level(true)
  5415.       @x_pose_original_name = @character_name
  5416.       update_battler_pose
  5417.       $game_map.need_refresh = true
  5418.       self.animation_id = XAS_ANIMATION::CHANGE_LEADER_ANIMATION_ID
  5419.       $game_temp.change_leader_wait_time = XAS_BA::CHANGE_LEADER_WAIT_TIME  
  5420.   end
  5421.  
  5422.   #--------------------------------------------------------------------------
  5423.   # ● Check Actor Level
  5424.   #--------------------------------------------------------------------------          
  5425.   def check_actor_level
  5426.       return if $game_party.in_battle
  5427.       return if self.battler == nil
  5428.       return if self.battler.old_level == self.battler.level
  5429.       reset_old_level(false)
  5430.       if self.battler.level > 1
  5431.          Audio.se_play("Audio/SE/" + XAS_SOUND::LEVEL_UP , 100, 100)
  5432.          if XAS_WORD::ENABLE_WORD
  5433.             $game_player.battler.damage = XAS_WORD::LEVEL_UP
  5434.             $game_player.battler.damage_pop = true
  5435.          end
  5436.       end
  5437.       $game_player.need_refresh = true
  5438.   end
  5439. end  
  5440.  
  5441. #===============================================================================
  5442. # ■ Game Party
  5443. #===============================================================================
  5444. class Game_Party < Game_Unit
  5445.  
  5446.  #--------------------------------------------------------------------------
  5447.  # ● Setup Starting Members  
  5448.  #--------------------------------------------------------------------------      
  5449.   alias x_old_level_setup_starting_members setup_starting_members  
  5450.   def setup_starting_members  
  5451.       x_old_level_setup_starting_members    
  5452.       for actor in $game_party.members
  5453.           actor.old_level = actor.level
  5454.       end
  5455.   end
  5456.  
  5457. end
  5458.  
  5459. #===============================================================================
  5460. # ■ Sprite Character
  5461. #==============================================================================
  5462. class Sprite_Character < Sprite_Base  
  5463.  
  5464.   #--------------------------------------------------------------------------
  5465.   # ● Update Collapse Effects
  5466.   #--------------------------------------------------------------------------            
  5467.   def update_collaspse_effects
  5468.       update_collapse_duration
  5469.       return unless can_collapse_effects?
  5470.       update_collpase_zoom_effects
  5471.       update_exp_gold_pop
  5472.   end
  5473.    
  5474.   #--------------------------------------------------------------------------
  5475.   # ● Can Collapse Effects
  5476.   #--------------------------------------------------------------------------              
  5477.   def can_collapse_effects?
  5478.       return false if @character.battler.is_a?(Game_Actor)
  5479.       return false unless @character.dead?
  5480.       return false if @character.erased    
  5481.       return true
  5482.   end  
  5483.  
  5484.   #--------------------------------------------------------------------------
  5485.   # ● Update Exp Gold Pop
  5486.   #--------------------------------------------------------------------------              
  5487.   def update_exp_gold_pop
  5488.       return unless XAS_DAMAGE_POP::DAMAGE_EXP_GOLD_POP
  5489.       exp_pop = @character.battler.exp
  5490.       gold_pop =@character.battler.gold
  5491.       case @character.collapse_duration
  5492.            when 110
  5493.                 enemy = $data_enemies[@character.battler.enemy_id]
  5494.                 @character.make_treasure(enemy)      
  5495.            when 80
  5496.              if exp_pop != 0
  5497.                 word = XAS_WORD::EXP
  5498.                 @character.battler.damage = word + " " + exp_pop.to_s
  5499.                 @character.battler.damage_pop = true
  5500.                 @character.battler.damage_type = "Exp"
  5501.              end  
  5502.            when 40
  5503.              if gold_pop != 0
  5504.                 word = $data_system.currency_unit
  5505.                 @character.battler.damage = word + " " + gold_pop.to_s
  5506.                 @character.battler.damage_pop = true
  5507.                 @character.battler.damage_type = "Gold"
  5508.              end              
  5509.       end      
  5510.   end
  5511.  
  5512.   #--------------------------------------------------------------------------
  5513.   # ● Update Collapse Duration
  5514.   #--------------------------------------------------------------------------              
  5515.   def update_collapse_duration
  5516.       @character.collapse_duration -= 1
  5517.       @character.opacity -= 2
  5518.       if @character.collapse_duration <= 0
  5519.          if @character.battler.is_a?(Game_Actor)
  5520.             SceneManager.goto(Scene_Gameover)
  5521.             return
  5522.          end
  5523.          self.visible = false
  5524.          @character.opacity = 0
  5525.          @character.erase
  5526.       end  
  5527.   end  
  5528.  
  5529.   #--------------------------------------------------------------------------
  5530.   # ● Update Collapse Zoom Effects
  5531.   #--------------------------------------------------------------------------                
  5532.   def update_collpase_zoom_effects
  5533.       case @character.battler.death_zoom_effect
  5534.           when 1
  5535.              @character.zoom_y += 0.05
  5536.              @character.zoom_x -= 0.01            
  5537.           when 2  
  5538.              @character.zoom_y -= 0.01
  5539.              @character.zoom_x += 0.03            
  5540.           when 3  
  5541.              @character.zoom_y += 0.03
  5542.              @character.zoom_x += 0.03              
  5543.           when 4  
  5544.              @character.zoom_y -= 0.005
  5545.              @character.zoom_x -= 0.005
  5546.           when 5  
  5547.             case @character.collapse_duration
  5548.                 when 60..120
  5549.                  @character.zoom_y -= 0.01
  5550.                  @character.zoom_x += 0.06                            
  5551.                 when 0..59  
  5552.                  @character.zoom_y += 0.2
  5553.                  @character.zoom_x -= 0.1
  5554.              end
  5555.       end
  5556.   end  
  5557.  
  5558. end
  5559.  
  5560.  
  5561.  
  5562. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5563. #■ BATTLER - TREASURE
  5564. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5565.  
  5566.  
  5567. #===============================================================================
  5568. # ■ XAS_BA_Item_Drop
  5569. #==============================================================================
  5570. module XAS_BA_ItemDrop
  5571.  
  5572.   #--------------------------------------------------------------------------
  5573.   # ● Defeat Process
  5574.   #--------------------------------------------------------------------------              
  5575.   def make_treasure(enemy)  
  5576.       treasure = nil      
  5577.       return unless $game_player.passable?(self.x,self.y,0)
  5578.       for di in enemy.drop_items
  5579.            next if di.kind == 0
  5580.            next if rand(di.denominator) != 0
  5581.            if di.kind == 1
  5582.               treasure = $data_items[di.data_id]
  5583.               tr_id = treasure.id
  5584.            elsif di.kind == 2
  5585.               treasure = $data_weapons[di.data_id]
  5586.               tr_id = treasure.id
  5587.            elsif di.kind == 3
  5588.               treasure = $data_armors[di.data_id]
  5589.               tr_id = treasure.id
  5590.            end
  5591.            break if treasure != nil
  5592.        end  
  5593.        if treasure != nil
  5594.           command = RPG::MoveCommand.new
  5595.           command.code = 14
  5596.           command.parameters = [0,0]
  5597.           route = RPG::MoveRoute.new
  5598.           route.repeat = false
  5599.           route.list = [command, RPG::MoveCommand.new]        
  5600.           page = RPG::Event::Page.new
  5601.           page.move_type = 3
  5602.           page.move_route = route
  5603.           page.move_frequency = 6
  5604.           page.priority_type = 1
  5605.           page.trigger = 1
  5606.           page.through = true
  5607.           event = RPG::Event.new(self.x, self.y)
  5608.           event.pages = [page]      
  5609.           event = RPG::Event.new(self.x, self.y)
  5610.           token = Token_Event.new($game_map.map_id, event)
  5611.           token.icon_name = treasure.icon_index
  5612.           token.treasure = [di.kind,tr_id]
  5613.           token.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  5614.           token.jump_high(0,0,20)
  5615.           token.force_update = true
  5616.           token.move_speed = 6
  5617.           $game_map.add_token(token)
  5618.        end  
  5619.   end  
  5620. end
  5621.  
  5622. #===============================================================================
  5623. # ■ Game Event
  5624. #===============================================================================
  5625. class Game_Event < Game_Character
  5626.   include XAS_BA_ItemDrop
  5627.  
  5628.   #--------------------------------------------------------------------------
  5629.   # ● Update Treasure Duration
  5630.   #--------------------------------------------------------------------------              
  5631.   def update_treasure_duration
  5632.       return if @treasure_time == 0
  5633.       @treasure_time -= 1
  5634.       self.erase if @treasure_time == 0
  5635.   end
  5636.  
  5637. end
  5638.  
  5639. #===============================================================================
  5640. # ■ Game Character
  5641. #==============================================================================
  5642. class Game_Character < Game_CharacterBase
  5643.   attr_accessor :icon_name
  5644.   attr_accessor :treasure
  5645. end
  5646.  
  5647. #===============================================================================
  5648. # ■ Game Character
  5649. #==============================================================================
  5650. class Sprite_Character < Sprite_Base
  5651.  
  5652.   #--------------------------------------------------------------------------
  5653.   # ● Update
  5654.   #--------------------------------------------------------------------------            
  5655.   alias xrxs_charactericon_update update
  5656.   def update
  5657.       xrxs_charactericon_update
  5658.       if @character.icon_name != nil
  5659.          self.bitmap = Cache.system("Iconset")
  5660.          self.src_rect.set(@character.icon_name  % 16 * 24, @character.icon_name / 16 * 24, 24, 24)
  5661.          self.ox = 12
  5662.          self.oy = 24
  5663.       end
  5664.   end
  5665. end
  5666.  
  5667. #===============================================================================
  5668. # ■ Game Player
  5669. #==============================================================================
  5670. class Game_Player < Game_Character
  5671.  
  5672.   #--------------------------------------------------------------------------
  5673.   # ● Check Event Trigger Here
  5674.   #--------------------------------------------------------------------------              
  5675.   alias treasure_check_event_trigger_here check_event_trigger_here
  5676.   def check_event_trigger_here(triggers)
  5677.       return false if $game_map.interpreter.running?
  5678.       check_treasure_here        
  5679.       treasure_check_event_trigger_here(triggers)
  5680.   end  
  5681.  
  5682.   #--------------------------------------------------------------------------
  5683.   # ● check_treasure_here  
  5684.   #--------------------------------------------------------------------------                
  5685.   def check_treasure_here  
  5686.      for event in $game_map.events_xy(@x, @y)
  5687.          if event.treasure != nil
  5688.             name_pop = true
  5689.             case event.treasure[0]            
  5690.             when 1
  5691.                   item = $data_items[event.treasure[1]]
  5692.                   if can_execute_field_item_effect?(item)
  5693.                      name_pop = false
  5694.                   else  
  5695.                      $game_party.gain_item(item, 1)
  5696.                   end
  5697.                   $game_map.need_refresh = true
  5698.             when 2  
  5699.                   item = $data_weapons[event.treasure[1]]
  5700.                   $game_party.gain_item($data_weapons[event.treasure[1]], 1,false)
  5701.             when 3
  5702.                   item = $data_armors[event.treasure[1]]
  5703.                   $game_party.gain_item(item, 1,false)
  5704.             end
  5705.             Audio.se_play("Audio/SE/" + XAS_SOUND::ITEM_DROP , 100, 100)  
  5706.             event.erase
  5707.             if item != nil
  5708.                 if item.note =~ /<Drop Animation = (\d+)>/
  5709.                    self.animation_id = $1.to_i
  5710.                 end
  5711.                 if XAS_DAMAGE_POP::DAMAGE_ITEM_POP and name_pop
  5712.                    self.battler.damage = item.name.to_s
  5713.                    self.battler.damage_pop = true
  5714.                    self.battler.damage_type = "Item"
  5715.                 end                      
  5716.             end
  5717.           end            
  5718.      end  
  5719.  end          
  5720.      
  5721.   #--------------------------------------------------------------------------
  5722.   # ● Can Execute Field Item Effect
  5723.   #--------------------------------------------------------------------------                  
  5724.   def can_execute_field_item_effect?(item)
  5725.       if item.note =~ /<Drop HP Damage = (\S+)>/
  5726.          damage = $1.to_i
  5727.          damage2 = damage * self.battler.mhp / 100
  5728.          self.battler.damage = damage2
  5729.          self.battler.damage_pop = true
  5730.          self.battler.hp -= damage2
  5731.          return true
  5732.       end  
  5733.       if item.note =~ /<Drop MP Damage = (\S+)>/
  5734.          damage = $1.to_i
  5735.          damage2 = damage * self.battler.mmp / 100
  5736.          self.battler.mp -= damage2        
  5737.          self.battler.damage_type = "Mp"  
  5738.          self.battler.damage = damage2
  5739.          self.battler.damage_pop = true
  5740.          return true
  5741.       end      
  5742.       if item.note =~ /<Drop Gold = (\d+)>/
  5743.          gold = $1.to_i
  5744.          damage = $data_system.terms.gold + " " + gold.to_s
  5745.          self.battler.damage = damage
  5746.          self.battler.damage_pop = true
  5747.          $game_party.gain_gold(gold)
  5748.          return true
  5749.       end
  5750.       return false  
  5751.   end  
  5752. end
  5753.  
  5754.  
  5755.  
  5756. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5757. #■ SPRITE - POSE (Character Name)
  5758. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5759.  
  5760.  
  5761. #===============================================================================
  5762. # ■ Game_Character
  5763. #===============================================================================
  5764. class Game_Character < Game_CharacterBase
  5765.  
  5766.   attr_accessor :x_pose_duration
  5767.   attr_accessor :x_pose_name
  5768.   attr_accessor :x_pose_original_name
  5769.   attr_accessor :character_name
  5770.  
  5771.   #-----------------------------------------------------------------------------
  5772.   # ● Initialize
  5773.   #-----------------------------------------------------------------------------  
  5774.   alias x_pose_initialize initialize
  5775.   def initialize
  5776.       x_pose_initialize
  5777.       @x_pose_duration = 0
  5778.       @x_pose_name = ""
  5779.       @x_pose_original_name = @character_name
  5780.   end
  5781.  
  5782.   #-----------------------------------------------------------------------------
  5783.   # ● Update
  5784.   #-----------------------------------------------------------------------------    
  5785.   def make_pose(sufix, pose_duration)
  5786.       return if @x_pose_original_name == ""
  5787.       @x_pose_name = sufix
  5788.       @x_pose_duration = pose_duration        
  5789.   end    
  5790.  
  5791.   #-----------------------------------------------------------------------------
  5792.   # ● Update Pose
  5793.   #-----------------------------------------------------------------------------    
  5794.   def update_battler_pose
  5795.       return false unless XAS_SYSTEM::CHARACTER_POSE_NAME
  5796.       if @x_pose_duration == 0
  5797.          @x_pose_original_name = @character_name
  5798.          return
  5799.       else    
  5800.          @x_pose_duration -= 1
  5801.          @character_name = @x_pose_original_name + @x_pose_name
  5802.          if @x_pose_duration == 0
  5803.             @character_name = @x_pose_original_name
  5804.             @x_pose_name = ""
  5805.          end
  5806.       end
  5807.       unless jumping?
  5808.          @jump_count = 0
  5809.          @jump_peak = 0
  5810.       end      
  5811.   end
  5812.  
  5813.   #-----------------------------------------------------------------------------
  5814.   # ● Set Graphic
  5815.   #-----------------------------------------------------------------------------      
  5816.   alias x_pose_set_graphic set_graphic
  5817.   def set_graphic(character_name, character_index)
  5818.       x_pose_set_graphic(character_name, character_index)
  5819.       @x_pose_original_name = @character_name
  5820.       @x_pose_duration = 0
  5821.       @x_pose_name = ""      
  5822.   end    
  5823.  
  5824. end
  5825.  
  5826.  
  5827. #===============================================================================
  5828. # ■ Game_Interpreter
  5829. #===============================================================================
  5830. class Game_Interpreter
  5831.  
  5832.   #-----------------------------------------------------------------------------
  5833.   # ● Command_322
  5834.   #-----------------------------------------------------------------------------    
  5835.   alias x_pose_command_322 command_322
  5836.   def command_322
  5837.       x_pose_command_322
  5838.       actor = $game_actors[@params[0]]
  5839.       if actor != nil
  5840.          $game_player.x_pose_duration = 0
  5841.          $game_player.x_pose_original_name =  @params[1]
  5842.       end
  5843.   end
  5844.  
  5845. end  
  5846.  
  5847. #===============================================================================
  5848. # ■ RPG_FileTest
  5849. #===============================================================================
  5850. module RPG_FileTest
  5851.  
  5852.   #--------------------------------------------------------------------------
  5853.   # ● RPG_FileTest.character_exist?
  5854.   #--------------------------------------------------------------------------
  5855.   def RPG_FileTest.character_exist?(filename)
  5856.       return Cache.character(filename) rescue return false
  5857.   end
  5858.  
  5859.   #--------------------------------------------------------------------------
  5860.   # ● RPG_FileTest.system_exist?
  5861.   #--------------------------------------------------------------------------
  5862.   def RPG_FileTest.system_exist?(filename)
  5863.       return Cache.system(filename) rescue return false
  5864.   end  
  5865.  
  5866. end
  5867.  
  5868. #===============================================================================
  5869. # ■ Sprite_Character
  5870. #===============================================================================
  5871. class Sprite_Character < Sprite_Base
  5872.  
  5873.   #--------------------------------------------------------------------------
  5874.   # ● X Pose Update
  5875.   #--------------------------------------------------------------------------  
  5876.   alias x_pose_update_bitmap update_bitmap
  5877.   def update_bitmap
  5878.       check_file_exist
  5879.       x_pose_update_bitmap
  5880.   end
  5881.  
  5882.  #--------------------------------------------------------------------------
  5883.  # ● Check File Exist
  5884.  #--------------------------------------------------------------------------  
  5885.  def check_file_exist
  5886.      return if @character_name == @character.character_name
  5887.      unless RPG_FileTest.character_exist?(@character.character_name)
  5888.             @character.character_name = @character.x_pose_original_name    
  5889.             @character.x_pose_duration = 0
  5890.             @character.x_pose_name = ""
  5891.      end        
  5892.  end  
  5893.  
  5894. end
  5895.  
  5896.  
  5897.  
  5898.  
  5899.  
  5900. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5901. #■ SPRITE - DAMAGE SPRITE
  5902. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5903.  
  5904.  
  5905. #===============================================================================
  5906. # ■  XRXS_DAMAGE_OFFSET
  5907. #===============================================================================
  5908. module XRXS_DAMAGE_OFFSET
  5909.  
  5910.   #--------------------------------------------------------------------------
  5911.   # ● Update
  5912.   #--------------------------------------------------------------------------              
  5913.   def update
  5914.       super
  5915.       @damage_sprites   = [] if @damage_sprites.nil?
  5916.       for damage_sprite in @damage_sprites
  5917.           damage_sprite.x = self.x
  5918.           damage_sprite.y = self.y
  5919.       end
  5920.   end
  5921. end
  5922.  
  5923. #===============================================================================
  5924. # ■ Sprite_Character
  5925. #===============================================================================
  5926. class Sprite_Character < Sprite_Base
  5927.       include XRXS_DAMAGE_OFFSET
  5928. end
  5929.  
  5930.  
  5931. #==============================================================================
  5932. # ■ Sprite Base
  5933. #==============================================================================
  5934. class Sprite_Base < Sprite
  5935.   include XAS_DAMAGE_POP
  5936.   #--------------------------------------------------------------------------
  5937.   # ● Initialize
  5938.   #--------------------------------------------------------------------------  
  5939.   alias x_damage_pop_initialize initialize
  5940.   def initialize(viewport = nil)      
  5941.       @_damage_duration = 0
  5942.       x_damage_pop_initialize(viewport)
  5943.   end
  5944.  
  5945.   #--------------------------------------------------------------------------
  5946.   # ● Damage
  5947.   #--------------------------------------------------------------------------    
  5948.   def damage(value, type = "")
  5949.       dispose_damage
  5950.       @damage_ox = 0
  5951.       @damage_type = type
  5952.       # NUMBER PICTURE
  5953.       if value.is_a?(Numeric)
  5954.          bitmap_number_image = Cache.system("XAS_Damage_Number")
  5955.          bitmap_im_cw = bitmap_number_image.width / 10
  5956.          bitmap_im_ch = bitmap_number_image.height / 5          
  5957.          bitmap = Bitmap.new(bitmap_number_image.width,(bitmap_im_ch * 2) + 5)
  5958.          bitmap_number_text = value.to_s.split(//)
  5959.          center_x = (((2 + bitmap_number_text.size) * bitmap_im_cw) / 2)
  5960.          # Damage Color        
  5961.          if value >= 0
  5962.             if @damage_type == "Critical"
  5963.                h = bitmap_im_ch * 2  
  5964.                h2 = bitmap_im_ch * 4
  5965.                $game_map.screen.start_shake(5, 5, 60)
  5966.             elsif @damage_type == "Mp"  
  5967.                h = bitmap_im_ch * 0  
  5968.                h2 = bitmap_im_ch * 3
  5969.             else
  5970.                h = 0
  5971.             end
  5972.             f = 0
  5973.           else # Recover Color  
  5974.             h = bitmap_im_ch  
  5975.             h2 = bitmap_im_ch * 3 if @damage_type == "Mp"    
  5976.             f = 1
  5977.         end  
  5978.         for r in f..bitmap_number_text.size - 1
  5979.             bitmap_number_abs = bitmap_number_text[r].to_i
  5980.             bitmap_src_rect = Rect.new(bitmap_im_cw * bitmap_number_abs, h, bitmap_im_cw, bitmap_im_ch)
  5981.             bitmap.blt(center_x + (bitmap_im_cw  *  r), bitmap_im_ch + 5, bitmap_number_image, bitmap_src_rect)                  
  5982.         end
  5983.         ex = (bitmap_im_cw / 2) * (bitmap_number_text.size + f)
  5984.         @damage_ox = (bitmap_number_image.width - (bitmap_number_image.width / 2) - ex) - center_x
  5985.         # Add Extra String (MP / Critical)
  5986.         if h2 != nil
  5987.            string_x = (center_x - (bitmap_number_image.width / 2) + (bitmap_im_cw / 2) * bitmap_number_text.size)
  5988.            bitmap_src_rect = Rect.new(0, h2,  bitmap_number_image.width, bitmap_im_ch)
  5989.            bitmap.blt(string_x , 0, bitmap_number_image, bitmap_src_rect)  
  5990.         end        
  5991.         bitmap_number_image.dispose  
  5992.       else
  5993.           #TEXT STRING
  5994.           damage_string = value.to_s
  5995.           bitmap = Bitmap.new(160, 48)
  5996.           bitmap.font.name = DAMAGE_FONT_NAME
  5997.           bitmap.font.size = DAMAGE_FONT_SIZE
  5998.           bitmap.font.bold = DAMAGE_FONT_BOLD
  5999.           bitmap.font.italic = DAMAGE_FONT_ITALIC
  6000.           bitmap.font.color = Color.new(0,0,0)
  6001.           bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  6002.           case @damage_type
  6003.                when "Exp";   string_color = DAMAGE_EXP_FONT_COLOR
  6004.                when "Gold";  string_color = DAMAGE_GOLD_FONT_COLOR
  6005.                when "Item";  string_color = DAMAGE_ITEM_FONT_COLOR
  6006.           else
  6007.              string_color = DAMAGE_DEFAULT_FONT_COLOR
  6008.           end
  6009.           bitmap.font.color = string_color
  6010.           bitmap.draw_text(0, 12, 160, 36, damage_string, 1)              
  6011.       end
  6012.        @_damage_sprite = ::Sprite.new(self.viewport)
  6013.        @_damage_sprite.bitmap = bitmap
  6014.        @_damage_sprite.ox = 80
  6015.        @_damage_sprite.oy = 20
  6016.        @_damage_sprite.x = self.x + @damage_ox
  6017.        @_damage_sprite.y = self.y - self.oy / 2
  6018.        @_damage_sprite.z = 3000
  6019.        @_damage_duration = 60
  6020.    end
  6021.  
  6022.   #--------------------------------------------------------------------------
  6023.   # ● Dispose Damage
  6024.   #--------------------------------------------------------------------------      
  6025.   def dispose_damage
  6026.       if @_damage_sprite != nil
  6027.          @_damage_sprite.bitmap.dispose
  6028.          @_damage_sprite.dispose
  6029.          @_damage_sprite = nil
  6030.          @_damage_duration = 0
  6031.       end
  6032.   end
  6033.  
  6034.   #--------------------------------------------------------------------------
  6035.   # ● Dispose
  6036.   #--------------------------------------------------------------------------        
  6037.   alias x_damage_dispose dispose
  6038.   def dispose
  6039.       dispose_damage
  6040.       x_damage_dispose
  6041.   end
  6042.  
  6043.   #--------------------------------------------------------------------------
  6044.   # ● Update
  6045.   #--------------------------------------------------------------------------          
  6046.   alias x_damage_pop_update update
  6047.   def update
  6048.       if @_damage_duration > 0
  6049.          @_damage_duration -= 1
  6050.          if @_damage_duration == 0
  6051.             dispose_damage
  6052.          end
  6053.        end      
  6054.        x_damage_pop_update
  6055.   end    
  6056.    
  6057. end  
  6058.  
  6059. #===============================================================================
  6060. # ■ XRXS DAMAGE
  6061. #===============================================================================
  6062. module XRXS_DAMAGE
  6063.  
  6064.   #--------------------------------------------------------------------------
  6065.   # ● Damage X Init Velocity
  6066.   #--------------------------------------------------------------------------                            
  6067.   def damage_x_init_velocity
  6068.       return 0#0.2 * (rand(5) - 2)
  6069.   end
  6070.    
  6071.   #--------------------------------------------------------------------------
  6072.   # ● Damage Y Init Velocity
  6073.   #--------------------------------------------------------------------------                            
  6074.   def damage_y_init_velocity
  6075.       return 0#9
  6076.   end
  6077.    
  6078.   #--------------------------------------------------------------------------
  6079.   # ● Update
  6080.   #--------------------------------------------------------------------------                              
  6081.   def update
  6082.     super
  6083.     @damage_sprites   = [] if @damage_sprites.nil?
  6084.     @damage_durations = [] if @damage_durations.nil?
  6085.     if @_damage_sprite != nil and @_damage_sprite.visible
  6086.        if @damage_ox != nil
  6087.           dam_ox = @damage_ox
  6088.        else  
  6089.           dam_ox = 0
  6090.        end        
  6091.        if @damage_type != nil
  6092.           dam_type = @damage_type
  6093.        end  
  6094.        x = damage_x_init_velocity
  6095.        y = damage_y_init_velocity
  6096.        d = @_damage_duration
  6097.        @damage_sprites.push(Sprite_Damage.new(@_damage_sprite, x, y, d,dam_ox,dam_type))
  6098.        @_damage_sprite.visible = false
  6099.     end
  6100.     for damage_sprite in @damage_sprites
  6101.         damage_sprite.update
  6102.     end
  6103.     for i in 0...@damage_sprites.size
  6104.         @damage_sprites[i] = nil if @damage_sprites[i].disposed?
  6105.     end
  6106.     @damage_sprites.compact!
  6107.   end
  6108.   def dispose
  6109.     super
  6110.     if @damage_sprites != nil
  6111.        for damage_sprite in @damage_sprites
  6112.            damage_sprite.dispose
  6113.        end
  6114.      end
  6115.   end
  6116. end
  6117.  
  6118. #===============================================================================
  6119. # ■ RPG Sprite
  6120. #===============================================================================
  6121. class Sprite_Base < Sprite
  6122.       include XRXS_DAMAGE
  6123. end
  6124.  
  6125. #===============================================================================
  6126. # ■ Sprite Damage
  6127. #===============================================================================
  6128. class Sprite_Damage < Sprite
  6129.  
  6130.   #--------------------------------------------------------------------------
  6131.   # ● Initialize
  6132.   #--------------------------------------------------------------------------                        
  6133.   def initialize(sprite, init_x_speed, init_y_speed, duration,dam_ox,dam_type = nil)
  6134.       super(nil)
  6135.       self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil?
  6136.       self.opacity = sprite.opacity
  6137.       self.x = sprite.x
  6138.       self.y = sprite.y
  6139.       self.z = sprite.z
  6140.       self.ox = sprite.ox - dam_ox
  6141.       self.oy = sprite.oy
  6142.       @now_x_speed = init_x_speed
  6143.       @now_y_speed = init_y_speed
  6144.       @potential_x_energy = 0.0
  6145.       @potential_y_energy = 0.0
  6146.       @duration = duration
  6147.       @dam_type = dam_type
  6148.       @dam_type = "" if dam_type == nil
  6149.   end
  6150.  
  6151.   #--------------------------------------------------------------------------
  6152.   # ● Update    
  6153.   #--------------------------------------------------------------------------                      
  6154.   def update
  6155.     super
  6156.     if XAS_DAMAGE_POP::DAMAGE_CRITICAL_ZOOM
  6157.        if @dam_type != "Critical"
  6158.           update_normal_popup
  6159.        else  
  6160.           update_critical_effect  
  6161.        end      
  6162.     else      
  6163.        update_normal_popup
  6164.     end
  6165.     @duration -= 1
  6166.     if @duration == 0
  6167.        self.dispose
  6168.     end
  6169.   end
  6170.  
  6171.   #--------------------------------------------------------------------------
  6172.   # ● update_critical_effect
  6173.   #--------------------------------------------------------------------------                          
  6174.   def update_critical_effect  
  6175.       case @duration
  6176.          when 40..60
  6177.            self.zoom_x += 0.1
  6178.            self.zoom_y += 0.1
  6179.          else  
  6180.            if self.zoom_x > 0.1  
  6181.               self.zoom_x -= 0.1
  6182.               self.zoom_y -= 0.1
  6183.            end
  6184.        end
  6185.   end
  6186.  
  6187.   #--------------------------------------------------------------------------
  6188.   # ● update_normal_popup
  6189.   #--------------------------------------------------------------------------                        
  6190.   def update_normal_popup
  6191.       self.opacity -= 25 if @duration <= 10
  6192.       self.x = rand(40) - 20
  6193.       self.y = rand(40) - 20
  6194.       n = self.oy + @now_y_speed
  6195.       if n <= 0
  6196.          @now_y_speed *= -1
  6197.          @now_y_speed /=  2
  6198.          @now_x_speed /=  2
  6199.       end
  6200.       self.oy  = [n, 0].max    
  6201.       @potential_y_energy += 0.58
  6202.       speed = @potential_y_energy.floor
  6203.       @now_y_speed        -= speed
  6204.       @potential_y_energy -= speed
  6205.       @potential_x_energy += @now_x_speed
  6206.       speed = @potential_x_energy.floor
  6207.       self.ox             += speed
  6208.       @potential_x_energy -= speed  
  6209.     end
  6210.  
  6211. end
  6212.  
  6213.  
  6214.  
  6215. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6216. #■ SPRITE - SPRITE EFFECTS
  6217. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6218.  
  6219.  
  6220. #==============================================================================
  6221. # ■ Sprite Base
  6222. #==============================================================================
  6223. class Sprite_Base < Sprite  
  6224.  
  6225.   #--------------------------------------------------------------------------
  6226.   # ● Animation Set Sprite
  6227.   #--------------------------------------------------------------------------
  6228.   def animation_set_sprites(frame)
  6229.       cell_data = frame.cell_data
  6230.       @ani_sprites.each_with_index do |sprite, i|
  6231.         next unless sprite
  6232.         pattern = cell_data[i, 0]
  6233.         if !pattern || pattern < 0
  6234.             sprite.visible = false
  6235.             next
  6236.         end
  6237.         sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  6238.         sprite.visible = true
  6239.         sprite.src_rect.set(pattern % 5 * 192,
  6240.         pattern % 100 / 5 * 192, 192, 192)
  6241.         if @ani_mirror
  6242.            cx = cell_data[i, 1]
  6243.            sprite.angle = (360 - cell_data[i, 4])
  6244.            sprite.mirror = (cell_data[i, 5] == 0)
  6245.         else
  6246.            cx = cell_data[i, 1]
  6247.            sprite.angle = cell_data[i, 4]
  6248.            sprite.mirror = (cell_data[i, 5] == 1)
  6249.         end
  6250.         cy = cell_data[i, 2]
  6251.         sprite.z = self.z + 300 + i
  6252.         sprite.ox = 96
  6253.         sprite.oy = 96
  6254.         sprite.zoom_x = cell_data[i, 3] / 100.0
  6255.         sprite.zoom_y = cell_data[i, 3] / 100.0
  6256.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  6257.         sprite.blend_type = cell_data[i, 7]
  6258.         case @animation.position
  6259.               when 0
  6260.                   sprite.x = self.x + cx
  6261.                   sprite.y = self.y + cy - (height / 2)          
  6262.               when 1
  6263.                   sprite.x = self.x + cx
  6264.                   sprite.y = self.y + cy        
  6265.               when 2
  6266.                   sprite.x = self.x + cx
  6267.                   sprite.y = self.y + cy + (height / 2)
  6268.               when 3  
  6269.                   sprite.x  = (544 / 2) + cx
  6270.                   sprite.y  = (416 / 2) + cy    
  6271.         end        
  6272.        
  6273.        
  6274.     end
  6275.   end  
  6276.  
  6277.   #--------------------------------------------------------------------------
  6278.   # ● Dispose Animation
  6279.   #--------------------------------------------------------------------------
  6280.   def dispose_animation
  6281.       $game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
  6282.       if @ani_bitmap1
  6283.          @@_reference_count[@ani_bitmap1] -= 1
  6284.         if @@_reference_count[@ani_bitmap1] == 0
  6285.             $game_temp.animation_garbage.push(@ani_bitmap1)
  6286.          end
  6287.       end
  6288.       if @ani_bitmap2
  6289.          @@_reference_count[@ani_bitmap2] -= 1
  6290.          if @@_reference_count[@ani_bitmap2] == 0
  6291.             $game_temp.animation_garbage.push(@ani_bitmap2)
  6292.         end
  6293.      end
  6294.      if @ani_sprites
  6295.         @ani_sprites.each {|sprite| sprite.dispose }
  6296.         @ani_sprites = nil
  6297.         @animation = nil
  6298.      end
  6299.      @ani_bitmap1 = nil
  6300.      @ani_bitmap2 = nil
  6301.   end    
  6302.  
  6303. end
  6304.  
  6305. #==============================================================================
  6306. # ■ Game_Map
  6307. #==============================================================================
  6308. class Game_Map
  6309.    
  6310.   #--------------------------------------------------------------------------
  6311.   # ● Setup
  6312.   #--------------------------------------------------------------------------    
  6313.   alias animation_garbage_setup setup
  6314.   def setup(map_id)
  6315.       animation_garbage_setup(map_id)
  6316.       dispose_animation_garbage
  6317.   end
  6318.  
  6319.   #--------------------------------------------------------------------------
  6320.   # ● Dispose Animation Garbage
  6321.   #--------------------------------------------------------------------------  
  6322.   def dispose_animation_garbage
  6323.       return if $game_temp.animation_garbage == nil
  6324.       for animation in $game_temp.animation_garbage
  6325.           animation.dispose
  6326.       end  
  6327.       $game_temp.animation_garbage = nil
  6328.   end  
  6329.  
  6330. end  
  6331.  
  6332. #==============================================================================
  6333. # ■ Scene_Base
  6334. #==============================================================================
  6335. class Scene_Base
  6336.  
  6337.   #--------------------------------------------------------------------------
  6338.   # ● Scene Changing?
  6339.   #--------------------------------------------------------------------------    
  6340.   alias animation_garbage_scene_changing scene_changing?
  6341.   def scene_changing?
  6342.       $game_map.dispose_animation_garbage if SceneManager.scene != self
  6343.       animation_garbage_scene_changing
  6344.   end
  6345.  
  6346. end  
  6347.  
  6348. #===============================================================================
  6349. # ■ Sprite_Character
  6350. #===============================================================================
  6351. class Sprite_Character < Sprite_Base
  6352.   include XAS_SYSTEM
  6353.  
  6354.   #--------------------------------------------------------------------------
  6355.   # ● Setup New Effect
  6356.   #--------------------------------------------------------------------------              
  6357.   def setup_new_effect
  6358.       if @character.animation_id > 0
  6359.          animation = $data_animations[@character.animation_id]
  6360.          start_animation(animation)
  6361.          @character.animation_id = 0
  6362.       end
  6363.       if !@balloon_sprite && @character.balloon_id > 0
  6364.          @balloon_id = @character.balloon_id
  6365.          start_balloon
  6366.       end
  6367.   end  
  6368.  
  6369.   #--------------------------------------------------------------------------
  6370.   # ● Can Update X Effects
  6371.   #--------------------------------------------------------------------------                    
  6372.   def can_update_x_effects?
  6373.       return false unless CHARACTER_SPRITE_EFFECTS
  6374.       return false if @character.erased
  6375.       return false if @character.transparent == true
  6376.       return true
  6377.   end  
  6378.   #--------------------------------------------------------------------------
  6379.   # ● Can Damage Pop Base
  6380.   #--------------------------------------------------------------------------                  
  6381.   def can_damage_pop_base?
  6382.       return false unless $game_system.xas_battle
  6383.       return false if XAS_SYSTEM::DAMAGE_POP == false
  6384.       return false if @character.battler == nil
  6385.       return false if @character.battler.no_damage_pop  
  6386.       return false if @character.battler.damage_pop != true
  6387.       return true  
  6388.   end  
  6389.  
  6390.  
  6391.   #--------------------------------------------------------------------------
  6392.   # ● Execute Damage Pop
  6393.   #--------------------------------------------------------------------------              
  6394.   def execute_damage_pop  
  6395.       damage(@character.battler.damage, @character.battler.damage_type)
  6396.       @character.battler.damage = nil
  6397.       @character.battler.critical = false
  6398.       @character.battler.damage_pop = false
  6399.       @character.battler.damage_type = ""
  6400.   end
  6401.    
  6402.   #--------------------------------------------------------------------------
  6403.   # ● Update X Effects
  6404.   #--------------------------------------------------------------------------              
  6405.   def update_x_effects
  6406.       update_collaspse_effects if @character.collapse_duration > 0
  6407.       update_sprite_position
  6408.       update_angle
  6409.       update_zoom
  6410.   end
  6411.    
  6412.   #--------------------------------------------------------------------------
  6413.   # ● Update Angle
  6414.   #--------------------------------------------------------------------------          
  6415.   def update_angle
  6416.       return if @character.angle == self.angle
  6417.       self.angle = @character.angle
  6418.   end
  6419.  
  6420.   #--------------------------------------------------------------------------
  6421.   # ● Update Zoom
  6422.   #--------------------------------------------------------------------------            
  6423.   def update_zoom
  6424.       update_treasure_effect
  6425.       update_breath_effect if can_breath_effect?
  6426.       self.zoom_x = @character.zoom_x
  6427.       self.zoom_y = @character.zoom_y
  6428.   end
  6429.  
  6430.   #--------------------------------------------------------------------------
  6431.   # ● Update Treasure_effect
  6432.   #--------------------------------------------------------------------------                      
  6433.   def update_treasure_effect
  6434.       return if @character.treasure_time == 0
  6435.       update_treasure_fade_effect
  6436.       update_treasure_float_effect
  6437.   end  
  6438.  
  6439.   #--------------------------------------------------------------------------
  6440.   # ● update_treasure_fade_effect
  6441.   #--------------------------------------------------------------------------                        
  6442.   def update_treasure_fade_effect
  6443.       return unless XAS_BA::FADE_TREASURE_SPRITE
  6444.       return if @character.treasure_time > 100
  6445.       return if @character.zoom_x < 0.01      
  6446.       @character.zoom_x -= 0.01
  6447.       if @character.temp_id > 0
  6448.          @character.zoom_x = 1.00
  6449.          @character.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  6450.       end
  6451.   end  
  6452.  
  6453.   #--------------------------------------------------------------------------
  6454.   # ● Update Treasure Float Effect
  6455.   #--------------------------------------------------------------------------                          
  6456.   def update_treasure_float_effect
  6457.       return unless XAS_BA::FLOAT_TREASURE_SPRITE    
  6458.       return if self.character.jumping?
  6459.       self.character.treasure_float[2] += 1
  6460.       if self.character.treasure_float[2] > 1
  6461.          self.character.treasure_float[2] = 0
  6462.          self.character.treasure_float[1] += 1
  6463.          case self.character.treasure_float[1]
  6464.             when 1..15
  6465.               self.character.treasure_float[0] -= 1
  6466.             when 16..30
  6467.               self.character.treasure_float[0] += 1
  6468.             else
  6469.               self.character.treasure_float[0] = 0
  6470.               self.character.treasure_float[1] = 0
  6471.           end
  6472.       end  
  6473.       self.y +=  self.character.treasure_float[0]
  6474.   end
  6475.  
  6476.   #--------------------------------------------------------------------------
  6477.   # ● Can Breath Effect?
  6478.   #--------------------------------------------------------------------------                    
  6479.   def can_breath_effect?
  6480.       return false if @character.battler == nil
  6481.       return false if @character.battler.breath_effect == false
  6482.       return false if @character.battler.hp == 0
  6483.       return false if @character.stop and not @character.battler.state_sleep
  6484.       return true
  6485.   end  
  6486.  
  6487.   #--------------------------------------------------------------------------
  6488.   # ● Update Breath Effect
  6489.   #--------------------------------------------------------------------------                  
  6490.   def update_breath_effect
  6491.       if @character.battler.fast_breath_effect
  6492.           zoom_speed = 3
  6493.           zoom_power_x = 0.006    
  6494.           zoom_power_y = 0.006        
  6495.       else
  6496.           zoom_speed = 1
  6497.           zoom_power_x = 0    
  6498.           zoom_power_y = 0.002
  6499.       end
  6500.       @character.battler.breath_duration += zoom_speed
  6501.       case @character.battler.breath_duration
  6502.            when 1..30
  6503.                 @character.zoom_x += zoom_power_x
  6504.                 @character.zoom_y += zoom_power_y
  6505.            when 31..60
  6506.                 @character.zoom_x -= zoom_power_x
  6507.                 @character.zoom_y -= zoom_power_y
  6508.            else  
  6509.                 @character.battler.breath_duration = 0
  6510.                 @character.zoom_x = 1.00
  6511.                 @character.zoom_y = 1.00
  6512.       end  
  6513.   end  
  6514.  
  6515.   #--------------------------------------------------------------------------
  6516.   # ● Update Sprite Position
  6517.   #--------------------------------------------------------------------------                  
  6518.   alias x_set_character_bitmap set_character_bitmap
  6519.   def set_character_bitmap
  6520.       @py = nil
  6521.       x_set_character_bitmap
  6522.       if @character_name[/\((\d+)\)/]
  6523.          @py = $1.to_i
  6524.       end            
  6525.   end
  6526.  
  6527.   #--------------------------------------------------------------------------
  6528.   # ● Update Sprite Position
  6529.   #--------------------------------------------------------------------------                
  6530.   def update_sprite_position
  6531.       if @character.tool_id > 0
  6532.          if @character.tool_effect == "Barrier"
  6533.             unless @character.action == nil
  6534.                bullet_user = @character.action.user
  6535.                self.x = bullet_user.screen_x
  6536.                self.y = bullet_user.screen_y
  6537.                @character.x = bullet_user.x
  6538.                @character.y = bullet_user.y
  6539.                @character.direction = bullet_user.direction
  6540.             end
  6541.          end  
  6542.       end  
  6543.       update_hold_target      
  6544.       if @py != nil
  6545.          self.y += @py
  6546.       end
  6547.       if @character.angle == 315 and @cw != nil
  6548.          self.x -= (@cw / 3)
  6549.          self.y -= (@ch / 6)
  6550.       end  
  6551.       if XAS_BA::KNOCKBACKING_SHAKE
  6552.          if self.character.knockbacking?
  6553.             self.x = self.x + rand(5) unless self.character.dead?
  6554.          end  
  6555.       end      
  6556.  end  
  6557.  
  6558.  #--------------------------------------------------------------------------
  6559.  # ● Update X Effects
  6560.  #--------------------------------------------------------------------------                
  6561.  def update_hold_target
  6562.      return if @character.temp_id == 0
  6563.      target = $game_map.events[@character.temp_id]
  6564.      if target == nil or target.erased
  6565.         @character.temp_id = 0
  6566.         @character.move_speed = @character.pre_move_speed
  6567.         check_character_above_player(target)
  6568.      else
  6569.         self.x = target.screen_x
  6570.         self.y = target.screen_y
  6571.         self.character.x = target.x
  6572.         self.character.y = target.y
  6573.         self.character.move_speed = target.move_speed
  6574.         self.character.direction = target.direction unless self.character.direction_fix
  6575.         check_character_above_player(target)
  6576.      end  
  6577.  end
  6578.  
  6579.  #--------------------------------------------------------------------------
  6580.  # ● Check Chacracter Above Player
  6581.  #--------------------------------------------------------------------------                  
  6582.  def check_character_above_player(target)
  6583.      return if @character.is_a?(Game_Player)
  6584.      return if @character.battler == nil
  6585.      if (@character.x == $game_player.x and
  6586.          @character.y == $game_player.y) or
  6587.           not @character.passable_temp_id?(@character.x,@character.y)
  6588.          @character.temp_id = 0
  6589.          @character.move_speed = @character.pre_move_speed
  6590.          case @character.direction
  6591.             when 2;  @character.y -= 1
  6592.             when 4;  @character.x += 1
  6593.             when 6;  @character.x -= 1
  6594.             when 8;  @character.y += 1  
  6595.          end
  6596.      end  
  6597.    end
  6598.  
  6599.  #--------------------------------------------------------------------------
  6600.  # ● Update_balloon
  6601.  #--------------------------------------------------------------------------
  6602.  if XAS_BA::FIX_BALLOON_POSITION
  6603.  def update_balloon
  6604.      if @balloon_duration > 0
  6605.         @balloon_duration -= 1
  6606.         if @balloon_duration > 0
  6607.            @balloon_sprite.x = x
  6608.            @balloon_sprite.y = y - XAS_BA::BALLOON_HEIGHT
  6609.            @balloon_sprite.z = z + 200
  6610.            sx = balloon_frame_index * 32
  6611.            sy = (@balloon_id - 1) * 32
  6612.            @balloon_sprite.src_rect.set(sx, sy, 32, 32)
  6613.       else
  6614.            end_balloon
  6615.       end
  6616.     end
  6617.   end  
  6618.   end
  6619.  
  6620. end
  6621.  
  6622. #==============================================================================
  6623. # ■ Game_Event
  6624. #==============================================================================
  6625. class Game_Event < Game_Character
  6626.  
  6627.   #--------------------------------------------------------------------------
  6628.   # ● Near The Screen
  6629.   #--------------------------------------------------------------------------  
  6630.   alias x_near_the_screen near_the_screen?
  6631.   def near_the_screen?(dx = 12, dy = 8)
  6632.       return true if can_update_out_screen?
  6633.       x_near_the_screen(dx, dy)
  6634.   end
  6635.  
  6636.  #--------------------------------------------------------------------------
  6637.  # ● Can Update Out Screen
  6638.  #--------------------------------------------------------------------------
  6639.  def can_update_out_screen?
  6640.      return true #if self.force_update
  6641.      return false
  6642.  end
  6643.    
  6644. end
  6645.  
  6646. #==============================================================================
  6647. # ■ Spriteset Map
  6648. #==============================================================================
  6649. class Spriteset_Map
  6650.  
  6651.   #--------------------------------------------------------------------------
  6652.   # ● Can Refresh Hud
  6653.   #--------------------------------------------------------------------------    
  6654.   alias x_pre_leader_id_initialize initialize
  6655.   def initialize
  6656.       if $game_party.members[0] != nil
  6657.          $game_system.pre_leader_id = $game_party.members[0].actor_id
  6658.       else  
  6659.          $game_system.pre_leader_id = nil
  6660.       end  
  6661.       x_pre_leader_id_initialize
  6662.   end  
  6663.  
  6664.   #--------------------------------------------------------------------------
  6665.   # ● Can Refresh Hud
  6666.   #--------------------------------------------------------------------------    
  6667.   def can_refresh_hud?
  6668.       if $game_party.members[0] == nil
  6669.          return true if $game_system.pre_leader_id != nil
  6670.       elsif $game_party.members[0] != nil  
  6671.          return true if $game_system.pre_leader_id == nil
  6672.          return true if $game_system.pre_leader_id != $game_party.members[0].actor_id
  6673.       end  
  6674.       return false
  6675.   end  
  6676.  
  6677.   #--------------------------------------------------------------------------
  6678.   # ● update
  6679.   #--------------------------------------------------------------------------    
  6680.   def refresh_hud
  6681.       $game_system.pre_leader_id = $game_party.members[0].actor_id      
  6682.   end
  6683.  
  6684.   #--------------------------------------------------------------------------
  6685.   # ● Update Hud Visible
  6686.   #--------------------------------------------------------------------------      
  6687.   def update_hud_visible
  6688.       if hud_visible?
  6689.          $game_system.enable_hud = true
  6690.       else  
  6691.          $game_system.enable_hud = false
  6692.       end  
  6693.   end  
  6694.    
  6695.   #--------------------------------------------------------------------------
  6696.   # ● Hud Visible?
  6697.   #--------------------------------------------------------------------------        
  6698.   def hud_visible?
  6699.       return false if $game_system.hud_visible == false
  6700.       return false if $game_message.visible
  6701.       return true
  6702.   end    
  6703.  
  6704. end  
  6705.  
  6706.  
  6707.  
  6708. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6709. #■ MISC - SCENE TARGET SELECT
  6710. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6711.  
  6712.  
  6713. #==============================================================================
  6714. # ■ Game_Temp
  6715. #==============================================================================
  6716. class Game_Temp
  6717.       attr_accessor :xas_target_x
  6718.       attr_accessor :xas_target_y
  6719.       attr_accessor :xas_target_time
  6720.       attr_accessor :xas_target_shoot_id
  6721.      
  6722. #--------------------------------------------------------------------------
  6723. # ● Initialize
  6724. #--------------------------------------------------------------------------
  6725.   alias xas_target_initialize initialize
  6726.   def initialize
  6727.       xas_target_initialize
  6728.       @xas_target_x = 0
  6729.       @xas_target_y = 0
  6730.       @xas_target_time = 0
  6731.       @xas_target_shoot_id = 0
  6732.   end    
  6733.        
  6734. end
  6735.  
  6736. #==============================================================================
  6737. # ■ Game_Map
  6738. #==============================================================================
  6739. class Game_Map
  6740.  
  6741.  attr_accessor :pre_display_x
  6742.  attr_accessor :pre_display_y
  6743.  attr_accessor :pre_real_display_x
  6744.  attr_accessor :pre_real_display_y
  6745.  
  6746.  #--------------------------------------------------------------------------
  6747.  # * Object Initialization
  6748.  #--------------------------------------------------------------------------
  6749.  alias x_map_initialize initialize
  6750.  def initialize  
  6751.      x_map_initialize
  6752.      @pre_display_x = @display_x - 1
  6753.      @pre_display_y = @display_y - 1    
  6754.  end
  6755.  
  6756.   #--------------------------------------------------------------------------
  6757.   # ● Screen Scrolled?
  6758.   #--------------------------------------------------------------------------        
  6759.   def screen_scrolled?
  6760.       if @pre_display_x != @display_x or
  6761.          @pre_display_y != @display_y
  6762.          @pre_display_x = @display_x
  6763.          @pre_display_y = @display_y
  6764.          return true
  6765.       end  
  6766.       return false
  6767.   end
  6768.  
  6769.  #--------------------------------------------------------------------------
  6770.  # ● Event On Screen
  6771.  #--------------------------------------------------------------------------
  6772.  def event_on_screen?(event)
  6773.      event.target = false
  6774.      px = ($game_map.display_x).truncate
  6775.      py = ($game_map.display_y).truncate    
  6776.      distance_x = event.x - px
  6777.      distance_y = event.y - py
  6778.      if distance_x.between?(0, 16) and
  6779.         distance_y.between?(0, 12)
  6780.         event.target = true
  6781.      end  
  6782.  end      
  6783.  
  6784.  #--------------------------------------------------------------------------
  6785.  # ● Check Event on Screen
  6786.  #--------------------------------------------------------------------------
  6787.  def check_events_on_screen
  6788.       for i in $game_map.events.values
  6789.             event_on_screen?(i)
  6790.       end  
  6791.   end
  6792.  
  6793. end  
  6794. #==============================================================================
  6795. # ■ Scene Target Select
  6796. #==============================================================================
  6797. class Scene_Target_Select
  6798.  
  6799.   #--------------------------------------------------------------------------
  6800.   # ● Main
  6801.   #--------------------------------------------------------------------------        
  6802.   def main    
  6803.       $game_temp.xas_target_x = 0
  6804.       $game_temp.xas_target_y = 0      
  6805.       $game_temp.xas_target_time = 0
  6806.       @new_x = $game_player.screen_x
  6807.       @new_y = $game_player.screen_y
  6808.       @index_max = -1
  6809.       @target_index = 0  
  6810.       @spriteset = Spriteset_Map.new
  6811.       @text_string = ""
  6812.       @fy = 0
  6813.       @fy_time = 0
  6814.       for event in $game_map.events.values
  6815.         if event.target and event.battler?
  6816.            @index_max += 1
  6817.         end  
  6818.       end  
  6819.       Sound.play_equip
  6820.       if @index_max == -1
  6821.          cancel_select
  6822.       else
  6823.          create_layout
  6824.          create_layout_skill
  6825.          create_cusrsor
  6826.          create_text      
  6827.          create_skill_name
  6828.          select_target(0)
  6829.       end
  6830.       Graphics.transition(0)
  6831.       loop do
  6832.            Graphics.update
  6833.            Input.update
  6834.            update
  6835.            break if SceneManager.scene != self
  6836.       end
  6837.       dispose
  6838.  end  
  6839.   #--------------------------------------------------------------------------
  6840.   # ● Create Layout
  6841.   #--------------------------------------------------------------------------      
  6842.   def create_layout
  6843.       @layout_1 = Plane.new
  6844.       @layout_1.bitmap = Cache.system("XAS_Target_Layout1")
  6845.       @layout_1.z = 10100
  6846.       @layout_1.opacity = 255
  6847.   end  
  6848.  
  6849.  #--------------------------------------------------------------------------
  6850.  # ● Create Layout
  6851.  #--------------------------------------------------------------------------      
  6852.  def create_layout_skill
  6853.      @skill_layout = Sprite.new
  6854.      @skill_layout.bitmap = Cache.system("XAS_Active_Help")
  6855.      @skill_layout.z = 10101
  6856.      @skill_layout.x = -100    
  6857.      @skill_layout.y = 32
  6858.      @skill_layout.opacity = 0
  6859.  end
  6860.    
  6861.  #--------------------------------------------------------------------------
  6862.  # ● Create Cursor
  6863.  #--------------------------------------------------------------------------            
  6864.  def create_cusrsor
  6865.      @cursor = Sprite.new
  6866.      @cursor.bitmap = Cache.system("XAS_Cursor")
  6867.      @cursor.z = 10105
  6868.      @cursor.x = @new_x
  6869.      @cursor.y = @new_y
  6870.      @cursor.opacity = 255
  6871.      @cursor.visible = true
  6872.  end
  6873.  
  6874.  #--------------------------------------------------------------------------
  6875.  # ● Create Text
  6876.  #--------------------------------------------------------------------------    
  6877.  def create_text
  6878.      @text = Sprite.new
  6879.      @text.bitmap = Bitmap.new(200,40)
  6880.      @text.z = 10102
  6881.      @text.bitmap.font.size = 20
  6882.      @text.bitmap.font.bold = true
  6883.      @text.bitmap.font.name = "Georgia"  
  6884.      @text.bitmap.draw_text(0, 0, 200, 40, @text_string.to_s,1)
  6885.      @text.opacity = 255
  6886.      @text.x = @new_x
  6887.      @text.y = @new_y    
  6888.  end
  6889.  
  6890.  #--------------------------------------------------------------------------
  6891.  # ● Create Text
  6892.  #--------------------------------------------------------------------------    
  6893.  def create_skill_name
  6894.      @skill_name = Plane.new
  6895.      @skill_name.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  6896.      @skill_name.z = 10103
  6897.      @skill_name.bitmap.font.size = 20
  6898.      @skill_name.bitmap.font.bold = true
  6899.      @skill_name.bitmap.font.name = "Georgia"  
  6900.      @skill_name.oy = -40
  6901.      skill = $data_skills[$game_temp.xas_target_shoot_id]
  6902.      skill_text = skill.name.to_s + " - " + skill.description.to_s    
  6903.      @skill_name.bitmap.draw_text(0, 0, Graphics.width, 40, skill_text,1)
  6904.      @skill_name.opacity = 0
  6905.  end  
  6906.  
  6907.  #--------------------------------------------------------------------------
  6908.  # ● Dispose
  6909.  #--------------------------------------------------------------------------            
  6910.  def dispose
  6911.      Graphics.freeze
  6912.      @spriteset.dispose
  6913.      if @cursor != nil
  6914.         @cursor.bitmap.dispose
  6915.         @cursor.dispose  
  6916.         @text.bitmap.dispose
  6917.         @text.dispose
  6918.         @skill_layout.bitmap.dispose
  6919.         @skill_layout.dispose
  6920.         @skill_name.bitmap.dispose
  6921.         @skill_name.dispose
  6922.         @layout_1.bitmap.dispose
  6923.         @layout_1.dispose
  6924.      end
  6925.  end
  6926.  
  6927.  #--------------------------------------------------------------------------
  6928.  # ● Update
  6929.  #--------------------------------------------------------------------------          
  6930.  def update
  6931.      return if @index_max == -1
  6932.      @spriteset.update
  6933.      update_cursor_slide
  6934.      update_layout_slide
  6935.      update_targe_select
  6936.  end
  6937.  
  6938.  #--------------------------------------------------------------------------
  6939.  # ● Update Layout Slide
  6940.  #--------------------------------------------------------------------------            
  6941.  def update_layout_slide
  6942.      @layout_1.ox += 3
  6943.      if @skill_layout.x < 0
  6944.         @skill_layout.x += 10
  6945.         @skill_layout.opacity += 25
  6946.         @skill_name.opacity += 25
  6947.      else
  6948.         @skill_layout.x = 0
  6949.         @skill_layout.opacity = 255
  6950.         @skill_name.opacity = 255
  6951.         @skill_name.ox -= 3
  6952.      end  
  6953.  end  
  6954.  
  6955.  #--------------------------------------------------------------------------
  6956.  # ● Refresh Text
  6957.  #--------------------------------------------------------------------------            
  6958.  def refresh_text
  6959.      @text.bitmap.clear
  6960.      @text.bitmap.draw_text(0, 0, 200, 40, @text_string.to_s,1)
  6961.  end
  6962.  
  6963.  #--------------------------------------------------------------------------
  6964.  # ● Update Cursor Slide
  6965.  #--------------------------------------------------------------------------          
  6966.  def update_cursor_slide
  6967.      @speed_x = [[(@cursor.x - @new_x / 60), 1].max, 60].min
  6968.      @speed_y = [[(@cursor.y - @new_y / 60), 1].max, 60].min
  6969.      if @cursor.x > @new_x
  6970.         @cursor.x -= @speed_x.abs
  6971.         @cursor.x = @new_x if @cursor.x < @new_x
  6972.      elsif @cursor.x < @new_x
  6973.         @cursor.x += @speed_x.abs
  6974.         @cursor.x = @new_x if @cursor.x > @new_x
  6975.      end        
  6976.      
  6977.      if @cursor.y > @new_y
  6978.         @cursor.y -= @speed_y.abs
  6979.         @cursor.y = @new_y if @cursor.y < @new_y
  6980.      elsif @cursor.y < @new_y
  6981.         @cursor.y += @speed_y.abs
  6982.         @cursor.y = @new_y if @cursor.y > @new_y
  6983.      end      
  6984.      @text.x = - 85 + @cursor.x
  6985.      @text.y = 20 + @cursor.y
  6986.      if @fy_time > 25
  6987.         @fy += 1
  6988.      elsif @fy_time > 0
  6989.         @fy -= 1
  6990.      else  
  6991.         @fy = 0
  6992.         @fy_time = 50
  6993.      end  
  6994.      @fy_time -= 1
  6995.      @cursor.oy = @fy
  6996.      
  6997.  end
  6998.  
  6999.  #--------------------------------------------------------------------------
  7000.  # ● Select Target(type)
  7001.  #--------------------------------------------------------------------------          
  7002.  def select_target(type)
  7003.      return if  @index_max < 0
  7004.      check_index
  7005.      valor = 0
  7006.      for event in $game_map.events.values
  7007.         if event.target and event.battler?
  7008.            if valor == @target_index
  7009.               @new_x = event.screen_x - 10
  7010.               @new_y = event.screen_y
  7011.               @text_string = event.battler.name
  7012.               $game_temp.xas_target_x = event.x
  7013.               $game_temp.xas_target_y = event.y
  7014.               $game_temp.xas_target_time = 1
  7015.             end
  7016.             valor += 1  
  7017.          end  
  7018.      end  
  7019.      refresh_text  
  7020.   end
  7021.  
  7022.  #--------------------------------------------------------------------------
  7023.  # ● Cancel Select
  7024.  #--------------------------------------------------------------------------              
  7025.  def cancel_select
  7026.      Sound.play_buzzer
  7027.      $game_temp.xas_target_x = 0
  7028.      $game_temp.xas_target_y = 0      
  7029.      $game_temp.xas_target_time = 0
  7030.      $game_temp.xas_target_shoot_id = 0
  7031.      SceneManager.call(Scene_Map)
  7032.  end
  7033.    
  7034.   #--------------------------------------------------------------------------
  7035.   # ● Update Target Select
  7036.   #--------------------------------------------------------------------------            
  7037.   def update_targe_select
  7038.       if Input.trigger?(Input::B)
  7039.          cancel_select
  7040.       elsif Input.trigger?(Input::DOWN) or Input.trigger?(Input::RIGHT)  
  7041.          @target_index += 1
  7042.          select_target(0)
  7043.          Sound.play_cursor
  7044.       elsif Input.trigger?(Input::UP) or Input.trigger?(Input::LEFT)
  7045.          @target_index -= 1
  7046.          select_target(1)
  7047.          Sound.play_cursor
  7048.       elsif Input.trigger?(Input::C)
  7049.          Sound.play_ok
  7050.          SceneManager.call(Scene_Map)
  7051.       end  
  7052.   end
  7053.  
  7054.   #--------------------------------------------------------------------------
  7055.   # ● Check Index
  7056.   #--------------------------------------------------------------------------                
  7057.   def check_index
  7058.       if @target_index > @index_max
  7059.          @target_index = 0
  7060.       end      
  7061.       if @target_index < 0
  7062.          @target_index = @index_max
  7063.       end    
  7064.   end        
  7065.  
  7066. end  
  7067.  
  7068.  
  7069. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  7070. #■ MISC - MAIN UPDATE
  7071. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  7072.  
  7073. #===============================================================================
  7074. # ■  Spriteset_Map
  7075. #===============================================================================
  7076. class Spriteset_Map
  7077.  
  7078.   #--------------------------------------------------------------------------
  7079.   # ● update
  7080.   #--------------------------------------------------------------------------  
  7081.   alias xas_main_update update
  7082.   def update
  7083.       xas_main_update
  7084.       update_xas_spriteset_map
  7085.   end
  7086.  
  7087.   #--------------------------------------------------------------------------
  7088.   # ● Update XAS Spriteset Map
  7089.   #--------------------------------------------------------------------------      
  7090.   def update_xas_spriteset_map
  7091.       refresh_token if $game_map.need_refresh_token
  7092.       refresh_hud if can_refresh_hud?
  7093.       update_hud_visible
  7094.   end    
  7095. end
  7096.  
  7097.  
  7098. #===============================================================================
  7099. # ■ Sprite_Character
  7100. #===============================================================================
  7101. class Sprite_Character < Sprite_Base
  7102.  
  7103.   #--------------------------------------------------------------------------
  7104.   # ● Update
  7105.   #--------------------------------------------------------------------------            
  7106.   alias x_update update
  7107.   def update
  7108.       x_update
  7109.       execute_damage_pop  if can_damage_pop_base?
  7110.       update_x_effects if can_update_x_effects?
  7111.   end
  7112.    
  7113. end    
  7114.  
  7115. #===============================================================================
  7116. # ■ Game Character
  7117. #===============================================================================
  7118. class Game_Character < Game_CharacterBase
  7119.  
  7120.   #--------------------------------------------------------------------------
  7121.   # ● Update
  7122.   #--------------------------------------------------------------------------    
  7123.   alias x_main_update update
  7124.   def update
  7125.       update_character_before_movement
  7126.       x_main_update
  7127.       update_character_after_movement
  7128.   end  
  7129.  
  7130.   #--------------------------------------------------------------------------
  7131.   # ● Update Character Before Movement
  7132.   #--------------------------------------------------------------------------      
  7133.   def update_character_before_movement
  7134.       check_xy
  7135.       update_force_action if can_force_action?
  7136.   end  
  7137.  
  7138.   #--------------------------------------------------------------------------
  7139.   # ● Update Character After Movement
  7140.   #--------------------------------------------------------------------------      
  7141.   def update_character_after_movement
  7142.       update_battler if can_update_battler?      
  7143.   end      
  7144.  
  7145. end  
  7146.  
  7147. #===============================================================================
  7148. # ■ Game Event
  7149. #===============================================================================
  7150. class Game_Event < Game_Character
  7151.  
  7152.   #--------------------------------------------------------------------------
  7153.   # ● Update
  7154.   #--------------------------------------------------------------------------    
  7155.   alias x_main_event_update update
  7156.   def update
  7157.       update_event_before_movement
  7158.       x_main_event_update
  7159.       update_event_after_movement
  7160.   end  
  7161.  
  7162.   #--------------------------------------------------------------------------
  7163.   # ● Update Event Before Movement
  7164.   #--------------------------------------------------------------------------      
  7165.   def update_event_before_movement
  7166.       update_sensor if can_update_sensor?
  7167.       update_treasure_duration      
  7168.   end  
  7169.  
  7170.   #--------------------------------------------------------------------------
  7171.   # ● Update Event After Movement
  7172.   #--------------------------------------------------------------------------      
  7173.   def update_event_after_movement
  7174.      
  7175.   end    
  7176.  
  7177. end  
  7178.  
  7179. #===============================================================================
  7180. # ■ Game Player
  7181. #===============================================================================
  7182. class Game_Player < Game_Character
  7183.  
  7184.   #--------------------------------------------------------------------------
  7185.   # ● Update
  7186.   #--------------------------------------------------------------------------    
  7187.   alias x_main_player_update update
  7188.   def update
  7189.       update_player_before_movement if party_system?
  7190.       x_main_player_update
  7191.       update_player_after_movement if party_system?
  7192.   end  
  7193.  
  7194.   #--------------------------------------------------------------------------
  7195.   # ● Update Player Before Movement
  7196.   #--------------------------------------------------------------------------      
  7197.   def update_player_before_movement
  7198.       check_actor_level
  7199.       update_reset_battler_setting_time
  7200.       if $game_system.old_interpreter_running != $game_map.interpreter.running?
  7201.          refresh_interpreter_effect
  7202.       end  
  7203.   end  
  7204.  
  7205.   #--------------------------------------------------------------------------
  7206.   # ● Update Player after Movement
  7207.   #--------------------------------------------------------------------------      
  7208.   def update_player_after_movement
  7209.       update_action_command if can_use_command?
  7210.       $game_temp.change_leader_wait_time -= 1 if $game_temp.change_leader_wait_time > 0
  7211.   end      
  7212.  
  7213. end
  7214.  
  7215. #==============================================================================
  7216. # ■ Sprite Picture
  7217. #==============================================================================
  7218. class Sprite_Picture < Sprite
  7219.  
  7220.  #--------------------------------------------------------------------------
  7221.  # ● Update
  7222.  #--------------------------------------------------------------------------    
  7223.   alias mog_fix_picture_erased_update update
  7224.   def update
  7225.       return if picture_erased?  
  7226.       mog_fix_picture_erased_update
  7227.   end  
  7228.  
  7229.  #--------------------------------------------------------------------------
  7230.  # ● Picture Erased?
  7231.  #--------------------------------------------------------------------------    
  7232.   def picture_erased?
  7233.       return false if @picture.name != ""
  7234.       if self.bitmap != nil
  7235.          self.bitmap.dispose
  7236.          self.bitmap = nil
  7237.       end  
  7238.       return true
  7239.   end
  7240.  
  7241. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement