Advertisement
Masouf

XAS

Jul 1st, 2017
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 268.40 KB | None | 0 0
  1. =begin
  2. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4. ■■ X A S  - Xiderwong Action System (For Advanced Users)
  5. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  7.                                                                        
  8.  X - Xiderowng
  9.  A - Action
  10.  S - System
  11.  
  12.  Created by XIDEROWNG  (XMS / XRXS / ちいさな本屋 / 森穂(もりほ)  
  13.  http://xrxs.at-ninja.jp/
  14.  
  15. #===============================================================================
  16. # ■ TERMS OF USE
  17. #===============================================================================
  18.  
  19.   English
  20.  
  21.  - You need to give credits to Xiderowng.
  22.  - You need to link the official Xiderowng website.
  23.    http://xrxs.at-ninja.jp/
  24.  
  25.   Português
  26.  
  27.  > Termos de uso <
  28.  - Você precisa dar os creditos para o Xiderowg.
  29.  - Você precisa divulgar a página oficial do Xiderowg.
  30.    http://xrxs.at-ninja.jp/
  31.    
  32.  
  33. #===============================================================================
  34. # ■ XAS Hero Edition ACE (Ver Experimental 0.5  - 2012 / 01 / 04)                                                
  35. #===============================================================================
  36.  
  37.  Updates for XAS Hero Edtion.
  38.  http://www.atelier-rgss.com/
  39.  
  40.  XAS Tutorials.
  41.  http://xasabs.wordpress.com/
  42.  
  43. #===============================================================================
  44. # ■ Caracteristicas (MAIN FEATURES)                                                          
  45. #===============================================================================
  46.    Sistema de batalha ativa no mapa (ou) e de interação com o cenário.
  47.    
  48. #===============================================================================
  49. # ■ Histórico  
  50. #===============================================================================
  51.   (V 0.5)
  52.    - introdução inicial do XAS Hero Edition para o Rpg Maker VX ACE.
  53.    - Versão de teste para correção de bugs, glitches e teste de performance.
  54. =end
  55.  
  56.  
  57.  
  58. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  59. # XAS - SETUP
  60. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  61. #===============================================================================
  62. # ■ XAS SYSTEN SETTING
  63. #===============================================================================
  64. # Desative um dos sistemas abaixo caso você tiver algum problema de
  65. # compatibilidade com outros sistemas de script, problema de performance ou
  66. # caso não quiser usar algum dos sistemas abaixo
  67. #-------------------------------------------------------------------------------
  68. module XAS_SYSTEM
  69.   # Activer le système de combat, laissez false si vous voulez utiliser  
  70.   # uniquement l'outils système (scénario d'interaction)
  71.   # Si vous souhaitez désactiver le système de combat dans le jeu, utilisez la
  72.   # commande ci-dessous.
  73.   #
  74.   # $game_system.xas_battle = X
  75.   #
  76.   BATTLE_SYSTEM = true
  77.   # Affichage Activer les dommages (Sprite).
  78.   DAMAGE_POP = true
  79.   # Ativar o sistema de pose de ações.
  80.   CHARACTER_POSE_NAME = true
  81.   # Ativar o sistema de sprites
  82.   CHARACTER_SPRITE_EFFECTS = true
  83.   # Ativar o sistema de dash avançado para o XAS.
  84.   DASH_SYSTEM = true
  85.   # Ativar o sistema de diagonal para o player.
  86.   PLAYER_DIAGONAL_MOVEMENT  = true
  87.   # Ativar o sistema de diagonal para o evento
  88.   EVENT_DIAGONAL_MOVEMENT  = true
  89.   # Ativar o sistema de condições para o battler.
  90.   STATE_SYSTEM = true
  91.   # Definição do mapa que ficarão os eventos das ferramentas.
  92.   ACTION_TEMPLATE_MAP_ID = 1
  93.   # Definição da ID da variável que corresponde a ID da ferramenta,
  94.   # Essa ID serve para criar eventos interativos com as ferramentas.
  95.   HIT_ID = 1
  96. end
  97.  
  98. #===============================================================================
  99. # ■ XAS BUTTON SETTING
  100. #===============================================================================
  101. module XAS_BUTTON
  102.   #Definição do botão de ataque.
  103.   ACTION_1_BUTTON = Input::X
  104.   #Definição do botão do escudo.
  105.   ACTION_2_BUTTON = Input::C
  106.   #Definição do botão de habildiade
  107.   SKILL_BUTTON = Input::Z  
  108.   #Definição do botão do item.
  109.   ITEM_BUTTON = Input::Y
  110.   #Definição do botão de correr.
  111.   DASH_BUTTON = Input::A
  112.   #Definição do botão de mudar de lider.
  113.   CHANGE_LEADER_BUTTON = Input::R
  114.   #Ativar o botão de ataque.
  115.   ENABLE_ACTION_1_BUTTON = true
  116.   #Ativar o botão de escudo.  
  117.   ENABLE_ACTION_2_BUTTON = true
  118.   #Ativar o botão de habilidade.
  119.   ENABLE_SKILL_BUTTON = true
  120.   #Ativar o botão de item.
  121.   ENABLE_ITEM_BUTTON = true
  122.   #Ativar o botão de corrida.
  123.   ENABLE_DASH_BUTTON = true
  124.   #Ativar o botão de mudar de lider.  
  125.   ENABLE_CHANGE_LEADER_BUTTON = false
  126. end
  127.  
  128. #===============================================================================
  129. # ■ WORD SETTING
  130. #===============================================================================
  131. # Definição das palavras usadas no XAS
  132. #-------------------------------------------------------------------------------
  133. module XAS_WORD
  134.   # Ativar as palavras.
  135.   ENABLE_WORD = true
  136.   # Palavra usada quando o battler usa o sistema de defesa.
  137.   GUARD = "Guard"
  138.   # Palavra usada quando não tem MP o suficiênte para usar a habilidade.
  139.   NO_MP = "No MP"
  140.   # Palavra usada quando não tem item para ativar a habilidade.
  141.   NO_ITEM = "No Item"  
  142.   # Palavra usada quando o personagem aumenta de nível.
  143.   LEVEL_UP = "Level Up"
  144.   # Palavra usada quando o personagem está com as ações seladas.
  145.   SEAL = "Sealed!"
  146.   # Palavra usada quando o personagem está invencível.
  147.   INVINCIBLE = "Invincible!"
  148.   # Palavra usada para definir experiência.
  149.   EXP = "Exp"
  150.   # Palavra usada quando o alvo se esquiva do ataque.
  151.   EVADED = "Evaded!"
  152.   # Palavra usada quando o battler erra o ataque.
  153.   MISSED = "Missed!"
  154.   # Palavra usada quando o counter é ativado.
  155.   COUNTER = "Counter"
  156.   # Palavra usada quando a habilidade é refletida.
  157.   REFLECT = "Reflected"
  158. end
  159.  
  160. #===============================================================================
  161. # ■ XAS DAMAGE POP
  162. #===============================================================================
  163. # Definição do sistema de sprites de dano.
  164. #-------------------------------------------------------------------------------
  165. module XAS_DAMAGE_POP
  166.   # Defnição da fonte.
  167.   DAMAGE_FONT_NAME = "Georgia"
  168.   # Definição do tamanho da fonte.
  169.   DAMAGE_FONT_SIZE = 22
  170.   # Ativar a fonte em bold.
  171.   DAMAGE_FONT_BOLD = true
  172.   # Ativar a fonte em itálico.
  173.   DAMAGE_FONT_ITALIC = true
  174.   # Ativar o Zoom no dano quando é dano crítico.
  175.   DAMAGE_CRITICAL_ZOOM = true
  176.   # Apresentar a quantidade de experiência e dinheiro.
  177.   DAMAGE_EXP_GOLD_POP = true  
  178.   # Apresentar o nome da condição(States).
  179.   DAMAGE_STATE_POP = true
  180.   # Apresentar o nome do item ao pegar no campo de batalha.
  181.   DAMAGE_ITEM_POP = true
  182.   # Definição da cor padrão da fonte.
  183.   DAMAGE_DEFAULT_FONT_COLOR = Color.new(255, 255, 255)
  184.   # Definição da cor da experiência.
  185.   DAMAGE_EXP_FONT_COLOR = Color.new(0, 255, 100)
  186.   # Definição da cor do dinheiro (Gold).
  187.   DAMAGE_GOLD_FONT_COLOR = Color.new(255, 255, 50)
  188.   # Definição da cor do item.
  189.   DAMAGE_ITEM_FONT_COLOR = Color.new(55, 55, 250)
  190. end
  191.  
  192. #===============================================================================
  193. # ■ SOUND SETTING
  194. #===============================================================================
  195. # Definição do sistema de sons do XAS.
  196. #-------------------------------------------------------------------------------
  197. module XAS_SOUND
  198.   #Som executado ao pegar o item.  
  199.   ITEM_DROP = "Key"
  200.   #Som executado ao fazer level up
  201.   LEVEL_UP = "Chime1"
  202.   #Som executado quando não tem item ou mp o suficiente.
  203.   ACTION_COST = "None"
  204. end
  205.  
  206. #===============================================================================
  207. # ■ ANIMATION SETTING
  208. #===============================================================================
  209. # Definição do sistema de animações do XAS.
  210. # Caso não quiser usar as animações, defina o valor como 0 (Zero).
  211. #-------------------------------------------------------------------------------
  212. module XAS_ANIMATION
  213.   # Animação quando o sistema de defesa é ativado.
  214.   GUARD_ANIMATION_ID = 115
  215.   # Animação quando o lider é trocado.
  216.   CHANGE_LEADER_ANIMATION_ID = 135
  217.   # Animação quando o battler acerta o alvo em condição invencível.
  218.   INVINCIBLE_ANIMATION_ID = 36
  219.   # Animação quando o battler estiver usando o sistema de charge weapon.
  220.   CHARGE_ANIMATION1_ID = 112
  221.   # Animação do battler após a arma estiver carregada.
  222.   CHARGE_ANIMATION2_ID = 113
  223.   # Animação apresentada durante o carregamento das habilidades.
  224.   CAST_TIME_ANIMATION_ID = 120
  225.   # Velocidade do loop das animações.
  226.   LOOP_ANIMATIONS_SPEED = 60
  227.   # Animação de refletir
  228.   REFLECT_ANIMATION_ID = 128
  229. end
  230.  
  231. #===============================================================================
  232. # ■ GENERAL BATTLER SETTING
  233. #===============================================================================
  234. # Definição geral do sistema de batalha do XAS.
  235. #-------------------------------------------------------------------------------
  236. module XAS_BA
  237.   #Tempo para poder ativar o botão de mudar de lider.
  238.   CHANGE_LEADER_WAIT_TIME = 10
  239.   #Deixar a hud visivel ao começar o jogo.
  240.   #Você pode ativar ou desativar a hud usando o código abaixo
  241.   # $game_system.hud_visible = true
  242.   HUD_VISIBLE_AT_STARTUP = false
  243.   # Definição da Switch da página de ações de curta distância.
  244.   SENSOR_SELF_SWITCH = "D"
  245.   # Definição da variável que define a area padrão para ativar a página de
  246.   # ações de curta distância.
  247.   DEFAULT_SENSOR_RANGE_VARIABLE_ID = 2
  248.   # Tempo padrão do recuo (lockout) do battler.
  249.   DEFAULT_KNOCK_BACK_DURATION = 60
  250.   # Ativar sprite tremendo quando o battler está em recuo.
  251.   KNOCKBACKING_SHAKE = false
  252.   # Velocidade básica de movimento
  253.   BASE_MOVE_SPEED = 4.2
  254.   # Velocidade extra quando o battler estiver correndo.
  255.   DASH_MOVE_SPEED = 0.6
  256.   # Retornar na posição de 4 direções após algum tempo na posição na diagonal.
  257.   DIAGONAL_DURATION_ENABLE = true
  258.   # Tempo para retornar na posição de 4 direções.
  259.   DIAGONAL_DURATION = 15
  260.   # Definição do modo como a experiência é dividida entre os aliados.
  261.   # 0 - EXP somente para quem matou o inimigo.
  262.   # 1 - EXP é repartido para o grupo, exp no valor integral.
  263.   # 2 - EXP é divido pelo numero do grupo e repartido para todos.
  264.   EXP_TYPE = 0
  265.   # Definição do tempo para remover o tesouro do mapa.
  266.   TREASURE_ERASE_TIME = 5
  267.   # Ativar a animação de fade no tesouro.
  268.   FADE_TREASURE_SPRITE = true
  269.   # Ativar a animação de levitação no tesouro.
  270.   FLOAT_TREASURE_SPRITE = true
  271.   # Fixar a posição do balão independente da altura real do sprite.
  272.   FIX_BALLOON_POSITION = true
  273.   # Altura que o balão será fixado.
  274.   BALLOON_HEIGHT = 32
  275. end  
  276.  
  277. #===============================================================================
  278. # ■ ENEMY SETTING
  279. #===============================================================================
  280.  
  281. module XAS_BA_ENEMY
  282.   # Definição de quais habilidades o inimigo será invunerável.
  283.   #
  284.   # INVUNERABLE_ACTIONS = { A=>[B,B,B,B],  A=>[B,B,B,B], ...}
  285.   # A - ID do inimigo.
  286.   # B - ID da habilidade.
  287.   INVUNERABLE_ACTIONS = {
  288.   6=>[39,40,41,42,43],
  289.   7=>[24,25,26,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],
  290.   8=>[1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,24,25,26],
  291.   9=>[39,40,41,42,43],
  292.   10=>[39,40,41,42,43],
  293.   11=>[39,40,41,42,43]
  294.   }
  295.   # Definição das direções que o inimigo será invunerável.
  296.   # GUARD_DIRECTIONS = { A=>[B],  A=>[B,B,B,B], ...}
  297.   # A - ID do inimigo
  298.   # B - Direções de Invulnerabilidade.
  299.   #     -> 2 = Abaixo.   -> 4 = Esquerda.
  300.   #     -> 6 = Direita.  -> 8 = Acima.
  301.   GUARD_DIRECTIONS = {
  302.   }  
  303.   # Definição das habilidades de Counter Attack
  304.   #
  305.   # COUNTER_ATTACK = { A=>[B,B,B,B],  A=>[B,B,B,B], ...}
  306.   COUNTER_ATTACK = {
  307.   }
  308.  
  309. end  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  319. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  320. #■ INITIALIZE
  321. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  322. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  323.  
  324.  
  325. #===============================================================================
  326. # ■ Game_Temp
  327. #===============================================================================
  328. class Game_Temp
  329.   attr_accessor :change_leader_wait_time
  330.   attr_accessor :reset_battler_time
  331.   attr_accessor :tool_event
  332.   attr_accessor :animation_garbage
  333.  
  334.   #--------------------------------------------------------------------------
  335.   # ● Initialize
  336.   #--------------------------------------------------------------------------  
  337.   alias xas_initialize initialize
  338.   def initialize
  339.       @change_leader_wait_time = 0
  340.       @reset_battler_time = 0
  341.       @tool_event = nil
  342.       @animation_garbage = []
  343.       xas_initialize
  344.   end
  345.  
  346. end
  347.  
  348. #===============================================================================
  349. # ■ Game_System
  350. #===============================================================================
  351. class Game_System
  352.   attr_accessor :tools_on_map
  353.   attr_accessor :old_interpreter_running
  354.   attr_accessor :hud_visible
  355.   attr_accessor :enable_hud
  356.   attr_accessor :command_enable
  357.   attr_accessor :pre_leader_id
  358.   attr_accessor :xas_battle
  359.   #--------------------------------------------------------------------------
  360.   # ● Initialize
  361.   #--------------------------------------------------------------------------  
  362.   alias x_initialize initialize
  363.   def initialize
  364.       @tools_on_map = []
  365.       @old_interpreter_running = false
  366.       @hud_visible = XAS_BA::HUD_VISIBLE_AT_STARTUP
  367.       @enable_hud = false
  368.       @command_enable  = true
  369.       @pre_leader_id = 0
  370.       @xas_battle = XAS_SYSTEM::BATTLE_SYSTEM
  371.       x_initialize
  372.   end  
  373. end  
  374.  
  375. #===============================================================================
  376. # ■ Game_Battler
  377. #===============================================================================
  378. class Game_Battler
  379.   attr_accessor :damage_pop
  380.   attr_accessor :damage
  381.   attr_accessor :damage_type
  382.   attr_accessor :critical
  383.   attr_accessor :invunerable_duration
  384.   attr_accessor :shield
  385.   attr_accessor :invunerable_actions
  386.   attr_accessor :guard_directions
  387.   attr_accessor :guard
  388.   attr_accessor :invunerable
  389.   attr_accessor :x_combo
  390.   attr_accessor :cast_action
  391.   attr_accessor :defeated
  392.   attr_accessor :death_zoom_effect
  393.   attr_accessor :counter_action
  394.   attr_accessor :knockback_duration
  395.   attr_accessor :hp_damage
  396.   attr_accessor :mp_damage
  397.  
  398.  #--------------------------------------------------------------------------
  399.  # ● Initialize
  400.  #--------------------------------------------------------------------------  
  401.   alias x_initialize initialize
  402.   def initialize
  403.       @damage = 0
  404.       @damage_pop = false
  405.       @damage_type = 0
  406.       @critical = false
  407.       @invunerable_duration = 0
  408.       @shield = false
  409.       @invunerable_actions = []
  410.       @guard_directions = []
  411.       @guard = true
  412.       @invunerable = false
  413.       @x_combo = [0,-1,0]
  414.       @defeated = false
  415.       @death_zoom_effect = 0
  416.       @cast_action = [0,0,0,0,0]
  417.       @counter_action = [0,0,true]
  418.       @knockback_duration = XAS_BA::DEFAULT_KNOCK_BACK_DURATION
  419.       x_initialize
  420.   end
  421.  
  422.  #--------------------------------------------------------------------------
  423.  # ● Add Invunerable Actions
  424.  #--------------------------------------------------------------------------    
  425.  def add_inv(action_id = 0)
  426.      return if action_id == nil or action_id <= 0
  427.      return if @invunerable_actions.include?(action_id)
  428.      @invunerable_actions.push(action_id)    
  429.  end
  430.  
  431.  #--------------------------------------------------------------------------
  432.  # ● Remove Invunerable Actions
  433.  #--------------------------------------------------------------------------    
  434.  def remove_inv(action_id = 0)
  435.      return if action_id == nil or action_id <= 0
  436.      return unless @invunerable_actions.include?(action_id)
  437.      @invunerable_actions.delete(action_id)    
  438.  end
  439.    
  440.  #--------------------------------------------------------------------------
  441.  # ● Add Guard Directions
  442.  #--------------------------------------------------------------------------    
  443.  def add_guard_dir(direction = 0)
  444.      return if direction == nil or direction <= 0
  445.      return if @guard_directions.include?(direction)
  446.      @guard_directions.push(direction)    
  447.  end
  448.  
  449.  #--------------------------------------------------------------------------
  450.  # ● Remove Guard Directions
  451.  #--------------------------------------------------------------------------    
  452.  def remove_guard_dir(direction = 0)
  453.      return if direction == nil or direction <= 0
  454.      return unless @guard_directions.include?(direction)
  455.      @guard_directions.delete(direction)    
  456.  end  
  457.  
  458. end  
  459.  
  460. #===============================================================================
  461. # ■ Game Actor
  462. #===============================================================================
  463. class Game_Actor < Game_Battler
  464.  
  465.   attr_accessor :x_action1_id
  466.   attr_accessor :x_action2_id
  467.   attr_accessor :skill_id
  468.   attr_accessor :x_item_id
  469.   attr_accessor :x_charge_action
  470.   attr_accessor :old_equipment_id
  471.   attr_accessor :item_id
  472.   attr_accessor :old_level
  473.   attr_reader :actor_id
  474.  
  475.  #--------------------------------------------------------------------------
  476.  # ● Setup
  477.  #--------------------------------------------------------------------------    
  478.  alias x_setup setup
  479.  def setup(actor_id)
  480.       @x_action1_id = 0
  481.       @x_action2_id = 0
  482.       @skill_id = 0
  483.       @x_item_id = 0
  484.       @item_id = 0
  485.       @x_charge_action = [0,0,0,0]
  486.       @old_level = @level
  487.       @old_equipment_id = [0,0,0,0,0]
  488.       x_setup(actor_id)
  489.  end
  490.  
  491.  #--------------------------------------------------------------------------
  492.  # ● Display Level Up
  493.  #--------------------------------------------------------------------------    
  494.   alias x_display_level_up display_level_up
  495.   def display_level_up(new_skills)
  496.       return unless $game_party.in_battle
  497.       x_display_level_up(new_skills)
  498.   end
  499.  
  500. end
  501.  
  502. #===============================================================================
  503. # ■ Character
  504. #===============================================================================
  505. class Game_Character < Game_CharacterBase
  506.  
  507.   attr_accessor :tool_id
  508.   attr_accessor :tool_effect  
  509.   attr_accessor :target
  510.   attr_accessor :target2
  511.   attr_accessor :old_x
  512.   attr_accessor :old_y
  513.   attr_accessor :pre_x
  514.   attr_accessor :pre_y
  515.   attr_accessor :temp_id
  516.   attr_accessor :angle
  517.   attr_accessor :force_action_times
  518.   attr_accessor :force_action
  519.   attr_accessor :move_frequency
  520.   attr_accessor :move_speed
  521.   attr_accessor :direction_fix
  522.   attr_accessor :walk_anime
  523.   attr_accessor :step_anime
  524.   attr_accessor :x
  525.   attr_accessor :y
  526.   attr_accessor :pattern
  527.   attr_accessor :pattern_count  
  528.   attr_accessor :jump_count
  529.   attr_accessor :jump_peak
  530.   attr_accessor :dash_active
  531.   attr_accessor :direction
  532.   attr_accessor :through
  533.   attr_accessor :bush_depth  
  534.   attr_accessor :blend_type
  535.   attr_accessor :priority_type  
  536.   attr_accessor :jump_count
  537.   attr_accessor :zoom_x
  538.   attr_accessor :zoom_y
  539.   attr_accessor :stop
  540.   attr_accessor :force_update
  541.   attr_accessor :treasure_time
  542.   attr_accessor :treasure_float
  543.   attr_accessor :can_update
  544.   attr_accessor :pre_move_speed
  545.   attr_accessor :knock_back_duration
  546.   attr_accessor :orig_pos_x
  547.   attr_accessor :orig_pos_y
  548.   attr_accessor :shoot_time
  549.   #--------------------------------------------------------------------------
  550.   # ● Initialize
  551.   #--------------------------------------------------------------------------    
  552.   alias x_initialize initialize
  553.   def initialize
  554.       x_initialize
  555.       @tool_id = 0
  556.       @tool_effect = ""
  557.       @target = false
  558.       @target2 = nil
  559.       @old_x = @x
  560.       @old_y = @y
  561.       @pre_x = @x
  562.       @pre_y = @y  
  563.       @orig_pos_x = @x
  564.       @orig_pos_y = @y
  565.       @angle = 0
  566.       @force_action_times = 0
  567.       @force_action = ""
  568.       @dash_active = false
  569.       @zoom_x = 1.00
  570.       @zoom_y = 1.00
  571.       @stop = false
  572.       @force_update = false
  573.       @treasure_time = 0
  574.       @treasure_float = [0,0,0,0]
  575.       @can_update = true
  576.       @temp_id = 0
  577.       @pre_move_speed = @move_speed
  578.       @shoot_time = [0,0]
  579.   end
  580.  
  581.   #--------------------------------------------------------------------------
  582.   # ● Invunerable
  583.   #--------------------------------------------------------------------------      
  584.   def invunerable(enable = false)
  585.       return if @battler == nil or @battler.dead?
  586.       @battler.invunerable = enable
  587.   end  
  588.  
  589.   #--------------------------------------------------------------------------
  590.   # ● Fast Breath
  591.   #--------------------------------------------------------------------------        
  592.   def fast_breath(enable = true)
  593.      return if @battler == nil or @battler.dead?
  594.      @battler.fast_breath_effect = enable
  595.   end
  596. end
  597.  
  598. #===============================================================================
  599. # ■ Game_Event
  600. #===============================================================================
  601. class Game_Event < Game_Character
  602.   attr_accessor :target
  603.   attr_reader   :name
  604.   attr_accessor :collision_attack
  605.  
  606.  #--------------------------------------------------------------------------
  607.  # ● Object
  608.  #--------------------------------------------------------------------------      
  609.  alias x_event_initialize initialize
  610.  def initialize(map_id, event)
  611.      x_event_initialize(map_id, event)
  612.      @collision_attack = false
  613.      if @event.name =~ /<O(\d+)>/i
  614.         @opacity = $1.to_i  
  615.      end  
  616.      if @event.name =~ /<B(\d+)>/i  
  617.         @blend_type = $1.to_i
  618.      end  
  619.  end  
  620.    
  621.  #--------------------------------------------------------------------------
  622.  # ● Erase
  623.  #--------------------------------------------------------------------------        
  624.  alias x_event_erase erase
  625.  def erase
  626.      if self.tool_id > 0
  627.         $game_system.tools_on_map.delete(self.tool_id)
  628.      end  
  629.      x_event_erase
  630.  end    
  631.  
  632.  #--------------------------------------------------------------------------
  633.  # ● Event Name
  634.  #--------------------------------------------------------------------------
  635.   def name
  636.       return @event.name  
  637.   end  
  638.  
  639. end
  640.  
  641. #===============================================================================
  642. # ■ Game Followers
  643. #===============================================================================
  644. class Game_Followers
  645.  
  646.  #--------------------------------------------------------------------------
  647.  # ● Initialize
  648.  #--------------------------------------------------------------------------  
  649.   alias x_party_initialize initialize
  650.   def initialize(leader)
  651.       x_party_initialize(leader)
  652.       if $xas_party_system == nil
  653.          @visible = false
  654.       end  
  655.   end  
  656. end  
  657.  
  658. #===============================================================================
  659. # ■ Game Map
  660. #===============================================================================
  661. class Game_Map  
  662.  
  663.  #--------------------------------------------------------------------------
  664.  # ● Setup
  665.  #--------------------------------------------------------------------------  
  666.   alias x_initial_setup setup
  667.   def setup(map_id)
  668.       x_initial_setup(map_id)
  669.       xas_initial_setup(map_id)
  670.   end
  671.  
  672.  #--------------------------------------------------------------------------
  673.  # ● XAS Initial Setup
  674.  #--------------------------------------------------------------------------  
  675.   def xas_initial_setup(map_id)
  676.       for actor in $game_party.members
  677.           setup_initial_members(actor)
  678.       end  
  679.   end  
  680.    
  681.  #--------------------------------------------------------------------------
  682.  # ● Setup Initial Membes
  683.  #--------------------------------------------------------------------------    
  684.   def setup_initial_members(actor)
  685.      
  686.   end  
  687. end  
  688.  
  689.  
  690. #==============================================================================
  691. # ■ Scene_Map
  692. #==============================================================================
  693. class Scene_Map < Scene_Base
  694.  
  695.   #--------------------------------------------------------------------------
  696.   # ● Call Menu
  697.   #--------------------------------------------------------------------------    
  698.   alias x_call_menu call_menu
  699.   def call_menu
  700.       return if $game_player.action != nil
  701.       $game_player.reset_charge_temp
  702.       x_call_menu
  703.   end
  704.    
  705. end    
  706. #===============================================================================
  707. # ■ Scene_Refresh
  708. #===============================================================================
  709. class Scene_Refresh
  710.  
  711.  #--------------------------------------------------------------------------
  712.  # ● Main
  713.  #--------------------------------------------------------------------------
  714.   def main
  715.       SceneManager.call(Scene_Map)
  716.   end
  717. end
  718.  
  719. #==============================================================================
  720. # ■ Game_Player
  721. #==============================================================================
  722. class Game_Player < Game_Character
  723.  
  724.  #--------------------------------------------------------------------------
  725.  # ● Leader Changed
  726.  #--------------------------------------------------------------------------  
  727.   def leader_changed?(actor)
  728.       if $game_party.members[0] == nil
  729.          return true if actor != nil
  730.       elsif $game_party.members[0] != nil
  731.          return true if actor == nil    
  732.          return true if actor.actor_id != $game_party.members[0].actor_id        
  733.       end  
  734.       return false
  735.   end
  736.  
  737. end  
  738. $xas = true
  739.  
  740.  
  741. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  742. #■ MOVEMENT - DIAGONAL MOVEMENT
  743. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  744.  
  745.  
  746. #===============================================================================
  747. # ■ Game Character
  748. #===============================================================================
  749. class Game_CharacterBase
  750.  
  751.   #--------------------------------------------------------------------------
  752.   # ● Set Direction
  753.   #--------------------------------------------------------------------------          
  754.    alias diagonal_set_direction set_direction
  755.    def set_direction(d)
  756.        diagonal_set_direction(d)
  757.        @diagonal_direction = 0
  758.        reset_diagonal
  759.    end
  760.    
  761. end  
  762.  
  763. #===============================================================================
  764. # ■  Game Character
  765. #===============================================================================
  766. class Game_Character < Game_CharacterBase
  767.  
  768.   attr_accessor :diagonal
  769.   attr_accessor :diagonal_direction
  770.   attr_accessor :sprite_angle_enable
  771.   attr_accessor :diagonal_time
  772.  
  773.   #--------------------------------------------------------------------------
  774.   # ● Initialize
  775.   #--------------------------------------------------------------------------        
  776.   alias diagonal_initialize initialize
  777.   def initialize
  778.       diagonal_initialize
  779.       if XAS_SYSTEM::EVENT_DIAGONAL_MOVEMENT
  780.          @diagonal = true
  781.       else  
  782.          @diagonal = false
  783.       end  
  784.       @diagonal_direction = 0
  785.       @sprite_angle_enable = false
  786.       @diagonal_time = 0
  787.   end  
  788.    
  789.   #--------------------------------------------------------------------------
  790.   # ● Reset Diagonal
  791.   #--------------------------------------------------------------------------            
  792.   def reset_diagonal
  793.       return if @direction_fix
  794.       return if @diagonal == false
  795.       @diagonal_direction = 0    
  796.       @diagonal_time = 0
  797.       @angle = 0 if @sprite_angle_enable
  798.   end  
  799.  
  800.   #--------------------------------------------------------------------------
  801.   # ● Enable Diagonal
  802.   #--------------------------------------------------------------------------            
  803.   def enable_diagonal(dir = 0)
  804.      return if @direction_fix
  805.      return if @diagonal == false
  806.      return if dir == 0
  807.      @diagonal_direction = dir
  808.      @diagonal_time = XAS_BA::DIAGONAL_DURATION
  809.      @angle = 315 if @sprite_angle_enable
  810.   end  
  811.  
  812.   #--------------------------------------------------------------------------
  813.   # ● Turn Upper Right
  814.   #--------------------------------------------------------------------------  
  815.   def turn_upper_right
  816.       enable_diagonal(9)
  817.       @direction = 8 unless @direction_fix
  818.   end  
  819.  
  820.   #--------------------------------------------------------------------------
  821.   # ● Turn Upper Left
  822.   #--------------------------------------------------------------------------  
  823.   def turn_upper_left
  824.       enable_diagonal(7)
  825.       @direction = 4 unless @direction_fix
  826.   end  
  827.  
  828.   #--------------------------------------------------------------------------
  829.   # ● Turn Lower Right
  830.   #--------------------------------------------------------------------------  
  831.   def turn_lower_right
  832.       enable_diagonal(3)
  833.       @direction = 6 unless @direction_fix
  834.   end      
  835.  
  836.   #--------------------------------------------------------------------------
  837.   # ● Turn Lower Left
  838.   #--------------------------------------------------------------------------  
  839.   def turn_lower_left
  840.       enable_diagonal(1)
  841.       @direction = 2 unless @direction_fix
  842.   end  
  843.    
  844.   #--------------------------------------------------------------------------
  845.   # ● Move forward
  846.   #--------------------------------------------------------------------------                
  847.   alias diagonal_move_forward move_forward
  848.   def move_forward
  849.       return if move_forward_diagonal?
  850.       diagonal_move_forward
  851.   end
  852.  
  853.   #--------------------------------------------------------------------------
  854.   # ● Move forward Diagonal?
  855.   #--------------------------------------------------------------------------                  
  856.   def move_forward_diagonal?
  857.       return false if @diagonal == false
  858.       if @diagonal_direction != 0
  859.          case @diagonal_direction
  860.               when 1 #Lower Left
  861.                  move_diagonal(4, 2)
  862.                  @direction = 2
  863.               when 3 #Lower Right
  864.                  move_diagonal(6, 2)
  865.                  @direction = 6
  866.               when 7 #Upper Left
  867.                  move_diagonal(4, 8)
  868.                  @direction = 4
  869.               when 9 #Upper Right
  870.                  move_diagonal(6, 8)
  871.                  @direction = 8
  872.           end
  873.           enable_diagonal(@diagonal_direction)      
  874.          return true
  875.       end  
  876.       return false
  877.   end
  878.  
  879.   #--------------------------------------------------------------------------
  880.   # ● Move Backward
  881.   #--------------------------------------------------------------------------                
  882.   alias diagonal_move_backward move_backward
  883.   def move_backward
  884.       return if move_backward_diagonal?
  885.       diagonal_move_backward
  886.   end
  887.  
  888.   #--------------------------------------------------------------------------
  889.   # ● Move Backward Diagonal?
  890.   #--------------------------------------------------------------------------                  
  891.   def move_backward_diagonal?
  892.       return false if @diagonal == false
  893.       if @diagonal_direction != 0
  894.          last_direction_fix = @direction_fix
  895.          @direction_fix = true      
  896.          case @diagonal_direction
  897.               when 1
  898.                  move_diagonal(6, 8)
  899.                  @direction = 6
  900.               when 3
  901.                  move_diagonal(4, 8)
  902.                  @direction = 4
  903.               when 7
  904.                  move_diagonal(6, 2)
  905.                  @direction = 6
  906.               when 9        
  907.                  move_diagonal(4, 2)
  908.                  @direction = 2
  909.          end
  910.          enable_diagonal(@diagonal_direction)      
  911.          @direction_fix = last_direction_fix
  912.          return true
  913.       end  
  914.       return false
  915.   end  
  916.  
  917.   #--------------------------------------------------------------------------
  918.   # ● Turn Toward Player
  919.   #--------------------------------------------------------------------------
  920.   alias turn_toward_player_diagonal turn_toward_player
  921.   def turn_toward_player
  922.       if @diagonal
  923.          diagonal_turn_toward_player
  924.          return
  925.       end
  926.       turn_toward_player_diagonal
  927.   end  
  928.  
  929.   #--------------------------------------------------------------------------
  930.   # ● Diagonal Turn Toward Player
  931.   #--------------------------------------------------------------------------
  932.   def diagonal_turn_toward_player
  933.       sx = distance_x_from($game_player.x)
  934.       sy = distance_y_from($game_player.y)
  935.       sd = sx.abs - sy.abs
  936.       sdx = sd.abs - sx.abs
  937.       sdy = sd.abs - sy.abs
  938.       return if sx == 0 and sy == 0
  939.       #Turn Upper Right
  940.       if sx < 0 and sy > 0
  941.          if sx.abs > sy.abs and sdx.abs < sd.abs
  942.             set_direction(6)
  943.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  944.             set_direction(8)
  945.          else
  946.             turn_upper_right
  947.          end
  948.          enable_diagonal(9)
  949.       #Turn Upper Left
  950.       elsif sx > 0 and sy > 0
  951.          if sx.abs > sy.abs and sdx.abs < sd.abs
  952.             set_direction(4)
  953.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  954.             set_direction(8)            
  955.          else
  956.             set_direction(4)
  957.             turn_upper_left
  958.          end
  959.          enable_diagonal(7)  
  960.       #Turn Lower Left  
  961.       elsif sx > 0 and sy < 0
  962.          if sx.abs > sy.abs and sdx.abs < sd.abs
  963.             set_direction(4)
  964.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  965.             set_direction(2)        
  966.          else                    
  967.             turn_lower_left
  968.          end
  969.          enable_diagonal(1)  
  970.        #Turn Lower Right    
  971.        elsif sx < 0 and sy < 0        
  972.          if sx.abs > sy.abs and sdx.abs < sd.abs
  973.             set_direction(6)
  974.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  975.             set_direction(2)          
  976.          else        
  977.             turn_lower_right
  978.          end
  979.          enable_diagonal(3)
  980.       elsif sx < 0
  981.          set_direction(6)
  982.       elsif sx > 0
  983.          set_direction(4)
  984.       elsif sy > 0
  985.          set_direction(8)
  986.       elsif sy < 0
  987.          set_direction(2)  
  988.       end    
  989.  
  990.   end  
  991.  
  992.   #--------------------------------------------------------------------------
  993.   # ● Move toward Player
  994.   #--------------------------------------------------------------------------
  995.   alias move_toward_player_diagonal move_toward_player
  996.   def move_toward_player
  997.       if @diagonal
  998.          diagonal_move_toward_player
  999.          return  
  1000.       end
  1001.       move_toward_player_diagonal
  1002.   end  
  1003.    
  1004.   #--------------------------------------------------------------------------
  1005.   # ● Diagonal Move Toward Player
  1006.   #--------------------------------------------------------------------------  
  1007.   def diagonal_move_toward_player
  1008.       sx = distance_x_from($game_player.x)
  1009.       sy = distance_y_from($game_player.y)
  1010.       if sx == 0 and sy == 0
  1011.          return
  1012.       end
  1013.       abs_sx = sx.abs
  1014.       abs_sy = sy.abs
  1015.       if abs_sx == abs_sy
  1016.         rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
  1017.       end
  1018.       if abs_sx
  1019.          if sx < 0 and sy > 0
  1020.             move_diagonal(6, 8)
  1021.             move_random unless moving?
  1022.             enable_diagonal(9)
  1023.          elsif sx > 0 and sy > 0
  1024.             move_diagonal(4, 8)
  1025.             move_random unless moving?
  1026.             enable_diagonal(7)
  1027.          elsif sx > 0 and sy < 0
  1028.             move_diagonal(4, 2)
  1029.             move_random unless moving?
  1030.             enable_diagonal(1)
  1031.          elsif sx < 0 and sy < 0
  1032.             move_diagonal(6, 2)
  1033.             move_random unless moving?
  1034.             enable_diagonal(3)
  1035.          elsif sx < 0
  1036.             move_straight(6)
  1037.          elsif sx > 0
  1038.             move_straight(4)
  1039.          elsif sy > 0
  1040.             move_straight(8)
  1041.          elsif sy < 0
  1042.             move_straight(2)
  1043.          end
  1044.          if abs_sx != 1 and abs_sy != 1
  1045.             move_random unless moving?
  1046.          end  
  1047.       end
  1048.  end
  1049.  
  1050.  #--------------------------------------------------------------------------
  1051.  # ● turn_right_45
  1052.  #--------------------------------------------------------------------------      
  1053.  def turn_right_45
  1054.      if @diagonal and @diagonal_direction != 0    
  1055.         case @diagonal_direction
  1056.           when 1;  set_direction(4)
  1057.           when 3;  set_direction(2)
  1058.           when 7;  set_direction(8)
  1059.           when 9;  set_direction(6)  
  1060.         end
  1061.      else  
  1062.         case @direction
  1063.           when 2;  turn_lower_left
  1064.           when 4;  turn_upper_left
  1065.           when 6;  turn_lower_right
  1066.           when 8;  turn_upper_right
  1067.         end
  1068.      end  
  1069.  end
  1070.  
  1071.  #--------------------------------------------------------------------------
  1072.  # ● turn_left_45
  1073.  #--------------------------------------------------------------------------  
  1074.  def turn_left_45
  1075.      if @diagonal and @diagonal_direction != 0    
  1076.         case @diagonal_direction
  1077.           when 1;  set_direction(2)
  1078.           when 3;  set_direction(6)
  1079.           when 7;  set_direction(4)
  1080.           when 9;  set_direction(8)
  1081.         end
  1082.      else  
  1083.         case @direction
  1084.           when 2;  turn_lower_right
  1085.           when 4;  turn_lower_left
  1086.           when 6;  turn_upper_right
  1087.           when 8;  turn_upper_left
  1088.         end
  1089.      end  
  1090.  end
  1091.  
  1092.  #--------------------------------------------------------------------------
  1093.  # ● turn_right_90
  1094.  #--------------------------------------------------------------------------  
  1095.  alias diagonal_turn_right_90 turn_right_90
  1096.   def turn_right_90
  1097.       if @diagonal and @diagonal_direction != 0
  1098.          turn_diagonal_right_90
  1099.          return
  1100.       end  
  1101.       diagonal_turn_right_90
  1102.   end
  1103.  
  1104.  #--------------------------------------------------------------------------
  1105.  # ● turn_diagonal_right_90
  1106.  #--------------------------------------------------------------------------    
  1107.   def turn_diagonal_right_90
  1108.       case @diagonal_direction
  1109.          when 1;  turn_upper_left
  1110.          when 3;  turn_lower_left
  1111.          when 7;  turn_upper_right
  1112.          when 9;  turn_lower_right
  1113.       end
  1114.   end
  1115.    
  1116.  #--------------------------------------------------------------------------
  1117.  # ● turn_left_90
  1118.  #--------------------------------------------------------------------------    
  1119.   alias diagonal_turn_left_90 turn_left_90
  1120.   def turn_left_90
  1121.       if @diagonal and @diagonal_direction != 0
  1122.          turn_diagonal_left_90
  1123.          return
  1124.       end
  1125.       diagonal_turn_left_90
  1126.   end  
  1127.    
  1128.  #--------------------------------------------------------------------------
  1129.  # ● turn_diagonal_left_90
  1130.  #--------------------------------------------------------------------------    
  1131.   def turn_diagonal_left_90
  1132.       case @diagonal_direction
  1133.          when 1;  turn_lower_right
  1134.          when 3;  turn_upper_right
  1135.          when 7;  turn_lower_left
  1136.          when 9;  turn_upper_left
  1137.       end
  1138.   end    
  1139.    
  1140.   #--------------------------------------------------------------------------
  1141.   # ● diagonal_turn_180
  1142.   #--------------------------------------------------------------------------
  1143.   alias diagonal_turn_180 turn_180
  1144.   def turn_180  
  1145.       if @diagonal and @diagonal_direction != 0
  1146.          turn_diagonal_180
  1147.          return
  1148.       end
  1149.       diagonal_turn_180
  1150.   end
  1151.  
  1152.  #--------------------------------------------------------------------------
  1153.  # ● turn_diagonal_180
  1154.  #--------------------------------------------------------------------------    
  1155.   def turn_diagonal_180
  1156.       case @diagonal_direction
  1157.          when 1;  turn_upper_right
  1158.          when 3;  turn_upper_left
  1159.          when 7;  turn_lower_right
  1160.          when 9;  turn_lower_left
  1161.       end
  1162.   end  
  1163.    
  1164.  #--------------------------------------------------------------------------
  1165.  # ● turn_random
  1166.  #--------------------------------------------------------------------------    
  1167.   alias diagonal_turn_random turn_random
  1168.   def turn_random
  1169.       if @diagonal
  1170.          turn_diagonal_random
  1171.          return
  1172.       end  
  1173.       diagonal_turn_random
  1174.   end  
  1175.  
  1176.  #--------------------------------------------------------------------------
  1177.  # ● turn_diagonal_random
  1178.  #--------------------------------------------------------------------------    
  1179.   def turn_diagonal_random
  1180.       case rand(8)
  1181.           when 0;  set_direction(8)
  1182.           when 1;  set_direction(6)
  1183.           when 2;  set_direction(4)
  1184.           when 3;  set_direction(2)
  1185.           when 4;  turn_lower_left  
  1186.           when 5;  turn_lower_right
  1187.           when 6;  turn_upper_left  
  1188.           when 7;  turn_upper_right
  1189.       end
  1190.   end
  1191.  
  1192. end    
  1193.  
  1194. #===============================================================================
  1195. # ■ Game_Player
  1196. #===============================================================================
  1197. class Game_Player < Game_Character
  1198.  
  1199.   #--------------------------------------------------------------------------
  1200.   # ● Move By Input
  1201.   #--------------------------------------------------------------------------    
  1202.   alias diagonal_move_by_input move_by_input
  1203.   def move_by_input
  1204.       if XAS_SYSTEM::PLAYER_DIAGONAL_MOVEMENT
  1205.          player_diagonal_move_by_input
  1206.         # update_sprite_diagonal
  1207.          update_return_direction
  1208.          return
  1209.       end
  1210.       diagonal_move_by_input
  1211.   end  
  1212.    
  1213.   #--------------------------------------------------------------------------
  1214.   # ● Update Sprite Diagonal
  1215.   #--------------------------------------------------------------------------        
  1216.   def update_sprite_diagonal
  1217.       return if @diagonal_direction == 0
  1218.       return if self.action != nil
  1219.       return if @dash_active
  1220.       make_pose("_Diagonal", 2)
  1221.   end  
  1222.  
  1223.   #--------------------------------------------------------------------------
  1224.   # ● Update Return Direction
  1225.   #--------------------------------------------------------------------------          
  1226.   def update_return_direction
  1227.       return if XAS_BA::DIAGONAL_DURATION_ENABLE == false
  1228.       return if @diagonal_time == 0
  1229.       return if moving? or @stop
  1230.       @diagonal_time -= 1
  1231.       @diagonal_direction = 0 if @diagonal_time == 0
  1232.   end
  1233.    
  1234.   #--------------------------------------------------------------------------
  1235.   # ● Player Diagonal Move By Input
  1236.   #--------------------------------------------------------------------------      
  1237.   def player_diagonal_move_by_input    
  1238.       return unless movable?
  1239.       return if $game_map.interpreter.running?
  1240.       case Input.dir8
  1241.            when 1
  1242.                move_diagonal(4, 2)
  1243.                unless moving?
  1244.                    move_straight(4)
  1245.                    move_straight(2)                
  1246.                end  
  1247.                @diagonal_direction = 1  
  1248.            when 2; move_straight(2)
  1249.            when 3
  1250.                 move_diagonal(6, 2)
  1251.                 unless moving?
  1252.                    move_straight(6)
  1253.                    move_straight(2)
  1254.                 end
  1255.                 @diagonal_direction = 3
  1256.            when 4;  move_straight(4)
  1257.            when 6;  move_straight(6)
  1258.            when 7
  1259.                  move_diagonal(4, 8)
  1260.                  unless moving?
  1261.                     move_straight(4)
  1262.                     move_straight(8)
  1263.                 end
  1264.                 @diagonal_direction = 7
  1265.            when 8;  move_straight(8)
  1266.            when 9  
  1267.                  move_diagonal(6, 8)
  1268.                  unless moving?
  1269.                     move_straight(6)
  1270.                     move_straight(8)
  1271.                 end
  1272.                 @diagonal_direction = 9  
  1273.       end
  1274.   end  
  1275.  
  1276. end
  1277.  
  1278.  
  1279. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1280. #■ MOVEMENT - FORCE ACTION
  1281. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1282.  
  1283.  
  1284. #===============================================================================
  1285. # ■ Game Character
  1286. #===============================================================================
  1287. class Game_Character < Game_CharacterBase
  1288.  
  1289.   #--------------------------------------------------------------------------
  1290.   # ● moving 2?
  1291.   #--------------------------------------------------------------------------  
  1292.   def moving2?
  1293.       @real_x != @x || @real_y != @y
  1294.   end  
  1295.  
  1296.   #--------------------------------------------------------------------------
  1297.   # ● Can Force Action?
  1298.   #--------------------------------------------------------------------------          
  1299.   def can_force_action?
  1300.       return false if @force_action_times  == 0
  1301.       return false if self.moving2?
  1302.       return false if self.jumping?
  1303.       return false if self.knockbacking?
  1304.       return false if self.stop
  1305.       return true
  1306.   end
  1307.    
  1308.   #--------------------------------------------------------------------------
  1309.   # ● Update Force Action
  1310.   #--------------------------------------------------------------------------        
  1311.   def update_force_action
  1312.       @force_action_times -= 1
  1313.       execute_force_action
  1314.       execute_force_action_tool_effect if @tool_id > 0 and @tool_effect != ""
  1315.       reset_auto_action if @force_action_times == 0
  1316.   end
  1317.  
  1318.   #--------------------------------------------------------------------------
  1319.   # ● Execute Force Action
  1320.   #--------------------------------------------------------------------------          
  1321.   def execute_force_action  
  1322.       case @force_action
  1323.         when "Forward"
  1324.             move_forward
  1325.         when "Backward"
  1326.             move_backward
  1327.         when "Toward Player"  
  1328.             move_toward_player
  1329.         when "Move Left"    
  1330.             move_straight(4)
  1331.         when "Move Right"
  1332.             move_straight(6)
  1333.         when "Move Up"    
  1334.             move_straight(8)
  1335.         when "Move Down"
  1336.             move_straight(2)
  1337.         when "All Shoot"  
  1338.               if self.action != nil
  1339.                  turn_right_45
  1340.                  self.shoot(self.action.id) unless @force_action_times == 0
  1341.               end
  1342.         when "Four Shoot"  
  1343.               if self.action != nil
  1344.                  turn_right_90
  1345.                  self.shoot(self.action.id) unless @force_action_times == 0
  1346.               end              
  1347.         when "Three Shoot"  
  1348.               if self.action != nil
  1349.                  case @force_action_times
  1350.                      when 2
  1351.                        turn_right_45
  1352.                      when 1
  1353.                        turn_left_90
  1354.                      when 0
  1355.                        turn_right_45
  1356.                  end  
  1357.                  self.shoot(self.action.id) unless @force_action_times == 0
  1358.               end      
  1359.         when "Two Shoot"  
  1360.               if self.action != nil
  1361.                  turn_180
  1362.                  self.shoot(self.action.id) unless @force_action_times == 0
  1363.               end  
  1364.         end  
  1365.   end  
  1366.  
  1367.   #--------------------------------------------------------------------------
  1368.   # ● Execute Force Action Tool Effect
  1369.   #--------------------------------------------------------------------------
  1370.   def execute_force_action_tool_effect
  1371.       action_effect_during_move    
  1372.       action_effect_after_move if @force_action_times == 0
  1373.   end  
  1374.  
  1375.   #--------------------------------------------------------------------------
  1376.   # ● Auto Action Effect During Move
  1377.   #--------------------------------------------------------------------------            
  1378.   def reset_auto_action  
  1379.       @force_action = ""
  1380.       @force_action_times = 0
  1381.       @anime_count = 0
  1382.   end
  1383.  
  1384.   #--------------------------------------------------------------------------
  1385.   # ● Action Effect During Move
  1386.   #--------------------------------------------------------------------------          
  1387.   def action_effect_during_move  
  1388.       if @tool_effect == "Boomerang" and @force_action == "Toward Player"  
  1389.          if @x == $game_player.x and @y == $game_player.y  
  1390.             self.action.duration = 15
  1391.             @force_action_times = 0
  1392.             @force_action_type = ""            
  1393.           end
  1394.       end
  1395.   end  
  1396.  
  1397.   #--------------------------------------------------------------------------
  1398.   # ● Action Effect After Move
  1399.   #--------------------------------------------------------------------------            
  1400.   def action_effect_after_move
  1401.       if @tool_effect == "Boomerang"
  1402.          @force_action_times = 30
  1403.          @force_action = "Toward Player"  
  1404.          @move_frequency = 6
  1405.          @move_speed = 5.5          
  1406.       end    
  1407.   end      
  1408.      
  1409. end  
  1410.  
  1411.  
  1412. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1413. #■ MOVEMENT - EXTRA MOVEMENT
  1414. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1415.  
  1416.  
  1417. #===============================================================================
  1418. # ■ Game Character
  1419. #===============================================================================
  1420. class Game_Character < Game_CharacterBase
  1421.  
  1422.   #--------------------------------------------------------------------------
  1423.   # ● Check XY
  1424.   #--------------------------------------------------------------------------      
  1425.   def check_xy
  1426.       @pre_x = @x
  1427.       @pre_y = @y
  1428.   end    
  1429.  
  1430.   #--------------------------------------------------------------------------
  1431.   # ● Turn Reverse
  1432.   #--------------------------------------------------------------------------          
  1433.   def turn_reverse(dir)
  1434.       case dir    
  1435.         when 2; set_direction(8)
  1436.         when 4; set_direction(6)
  1437.         when 6; set_direction(4)
  1438.         when 8; set_direction(2)
  1439.       end    
  1440.   end
  1441.  
  1442.   #--------------------------------------------------------------------------
  1443.   # ● Org Here
  1444.   #--------------------------------------------------------------------------        
  1445.   def org_here
  1446.       @orig_pos_x = @x
  1447.       @orig_pos_y = @y
  1448.   end  
  1449.  
  1450.   #--------------------------------------------------------------------------
  1451.   # ● return_org
  1452.   #--------------------------------------------------------------------------          
  1453.   def return_org(type = 0)
  1454.       if type == 1
  1455.          moveto(@orig_pos_x,@orig_pos_x)
  1456.       else  
  1457.          jump(0,0)
  1458.       end
  1459.       @x = @orig_pos_x
  1460.       @y = @orig_pos_y
  1461.   end  
  1462.  
  1463.   #--------------------------------------------------------------------------
  1464.   # ● Dual Switch
  1465.   #--------------------------------------------------------------------------    
  1466.   def dual_switch(switch_on, switch_off,percentage = 100)
  1467.       enable_per = rand(100)
  1468.       if enable_per <= percentage
  1469.          $game_switches[switch_on] = true    
  1470.          $game_switches[switch_off] = false
  1471.          $game_map.need_refresh = true
  1472.       end  
  1473.   end  
  1474.  
  1475.   #--------------------------------------------------------------------------
  1476.   # ● Move Forward 2
  1477.   #--------------------------------------------------------------------------  
  1478.   def move_forward2
  1479.       return if moving2?
  1480.       move_forward
  1481.   end  
  1482.  
  1483.   #--------------------------------------------------------------------------
  1484.   # ● Bounce Direction
  1485.   #--------------------------------------------------------------------------  
  1486.   def bounce_direction
  1487.       @diagonal = true
  1488.       turn_random  
  1489.   end
  1490.  
  1491.   #--------------------------------------------------------------------------
  1492.   # ● Turn_back
  1493.   #--------------------------------------------------------------------------            
  1494.   def turn_back
  1495.       if @diagonal_direction != 0
  1496.          case @diagonal_direction
  1497.               when 1
  1498.                 turn_upper_right
  1499.               when 3
  1500.                 turn_upper_left
  1501.               when 7
  1502.                 turn_lower_right
  1503.               when 9        
  1504.                 turn_lower_left
  1505.          end
  1506.       else
  1507.           case @direction
  1508.                when 2;   set_direction(8)
  1509.                when 4;   @direction = 6#move_straight(6)#set_direction(6)
  1510.                when 6;   set_direction(4)
  1511.                when 8;   set_direction(2)
  1512.           end
  1513.       end    
  1514.   end  
  1515.  
  1516.   #--------------------------------------------------------------------------
  1517.   # ● Jump_high
  1518.   #--------------------------------------------------------------------------
  1519.   def jump_high(x_plus,y_plus,high = 10)    
  1520.       @x += x_plus
  1521.       @y += y_plus
  1522.       distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
  1523.       @jump_peak = high + distance - @move_speed
  1524.       @jump_count = @jump_peak * 2
  1525.       @stop_count = 0
  1526.       straighten
  1527.   end
  1528.  
  1529.   #--------------------------------------------------------------------------
  1530.   # ● Passable Temp
  1531.   #--------------------------------------------------------------------------    
  1532.  def passable_temp_id?(x, y)
  1533.      return false unless $game_map.valid?(x, y)    
  1534.      return true if @through or debug_through?    
  1535.      return false unless map_passable?(x, y,@direction)        
  1536.      return false if collide_with_characters_temp_id?(x, y)
  1537.      return true                                  
  1538.   end
  1539.  
  1540.   #--------------------------------------------------------------------------
  1541.   # ● Collide With Characters
  1542.   #--------------------------------------------------------------------------      
  1543.   def collide_with_characters_temp_id?(x, y)
  1544.       for event in $game_map.events_xy(x, y)        
  1545.           unless event.through or event.battler != nil    
  1546.              return true if self.is_a?(Game_Event)      
  1547.              return true if event.priority_type >= 1    
  1548.           end
  1549.       end
  1550.       return false
  1551.   end  
  1552.  
  1553.   #--------------------------------------------------------------------------
  1554.   # ● Force Move Route
  1555.   #--------------------------------------------------------------------------
  1556.   alias x_force_move_route force_move_route
  1557.   def force_move_route(move_route)
  1558.       if self.battler != nil and self.is_a?(Game_Event)
  1559.          return
  1560.       end  
  1561.       x_force_move_route(move_route)
  1562.   end  
  1563. end  
  1564.  
  1565.  
  1566. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1567. #■ MOVEMENT - PLAYER COMMANDS
  1568. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1569.  
  1570.  
  1571. #==============================================================================
  1572. # ■ Game_Player
  1573. #==============================================================================
  1574. class Game_Player < Game_Character
  1575.   include XAS_BUTTON
  1576.  
  1577.   #--------------------------------------------------------------------------
  1578.   # ● Update Action Command
  1579.   #--------------------------------------------------------------------------  
  1580.   def update_action_command
  1581.       update_check_battler_equipment if can_check_battler_equipment?
  1582.       update_dash_button
  1583.       update_auto_target_shoot
  1584.       update_combo_time
  1585.       update_action_1_button
  1586.       update_action_2_button
  1587.       update_skill_button
  1588.       update_item_button
  1589.       update_change_leader_button
  1590.       update_charge_button
  1591.   end  
  1592.  
  1593.   #--------------------------------------------------------------------------
  1594.   # ● Can Use Command?
  1595.   #--------------------------------------------------------------------------      
  1596.   def can_use_command?
  1597.       return false if $game_map.interpreter.running?
  1598.       return false if $game_message.visible
  1599.       return false if self.battler == nil
  1600.       return false if self.action != nil
  1601.       return false if self.knockbacking?      
  1602.       return false if @stop
  1603.       return true
  1604.   end    
  1605.  
  1606.   #--------------------------------------------------------------------------
  1607.   # ● Update Check Battler Equipment
  1608.   #--------------------------------------------------------------------------      
  1609.   def update_check_battler_equipment
  1610.  
  1611.   end  
  1612.  
  1613.   #--------------------------------------------------------------------------
  1614.   # ● Can Check Battler Equipment
  1615.   #--------------------------------------------------------------------------        
  1616.   def can_check_battler_equipment?
  1617.       if self.battler.old_equipment_id[0] != self.battler.equips[0] or
  1618.          self.battler.old_equipment_id[1] != self.battler.equips[1] or
  1619.          self.battler.old_equipment_id[2] != self.battler.equips[2] or
  1620.          self.battler.old_equipment_id[3] != self.battler.equips[3] or
  1621.          self.battler.old_equipment_id[4] != self.battler.equips[4]
  1622.          self.battler.old_equipment_id[0] = self.battler.equips[0]
  1623.          self.battler.old_equipment_id[1] = self.battler.equips[1]
  1624.          self.battler.old_equipment_id[2] = self.battler.equips[2]
  1625.          self.battler.old_equipment_id[3] = self.battler.equips[3]
  1626.          self.battler.old_equipment_id[4] = self.battler.equips[4]      
  1627.          return true
  1628.       end  
  1629.       return false
  1630.   end
  1631.  
  1632.   #--------------------------------------------------------------------------
  1633.   # ● Update Charge Button
  1634.   #--------------------------------------------------------------------------    
  1635.   def update_charge_button
  1636.       return unless can_charge_command?
  1637.       if Input.press?(ACTION_1_BUTTON) and ENABLE_ACTION_1_BUTTON
  1638.          update_charge_effect(0)
  1639.          reset_charge_temp if Input.press?(ACTION_2_BUTTON) and ENABLE_ACTION_2_BUTTON
  1640.       elsif Input.press?(ACTION_2_BUTTON)
  1641.          update_charge_effect(1)
  1642.          reset_charge_temp if Input.press?(ACTION_1_BUTTON)
  1643.       else
  1644.          if self.battler.x_charge_action[2] >= self.battler.x_charge_action[1]
  1645.             self.shoot(self.battler.x_charge_action[0])
  1646.          end
  1647.         reset_charge_temp
  1648.       end  
  1649.   end
  1650.  
  1651.   #--------------------------------------------------------------------------
  1652.   # ● Update Charge Effect
  1653.   #--------------------------------------------------------------------------        
  1654.   def update_charge_effect(type)
  1655.       if self.battler.x_charge_action[2] == 0
  1656.          return unless equipped_charge_action?(type)
  1657.       end  
  1658.       if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
  1659.          self.battler.x_charge_action[2] += 1
  1660.       end
  1661.       self.battler.x_charge_action[3] += 1
  1662.       if self.battler.x_charge_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
  1663.          self.battler.x_charge_action[3] = 0
  1664.          if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
  1665.             self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION1_ID
  1666.          else
  1667.             self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION2_ID
  1668.          end  
  1669.       end
  1670.   end
  1671.  
  1672.   #--------------------------------------------------------------------------
  1673.   # ● Equipped Charge Action
  1674.   #--------------------------------------------------------------------------          
  1675.   def equipped_charge_action?(type)
  1676.       case type
  1677.          when 0
  1678.            weapon = self.battler.equips[0]
  1679.          when 1
  1680.            weapon = self.battler.equips[1]
  1681.       end
  1682.       if weapon == nil
  1683.          return false
  1684.          reset_charge_temp
  1685.       end
  1686.       if weapon.note =~ /<Charge Action = (\d+) - (\d+)>/  
  1687.          self.battler.x_charge_action[0] = $1.to_i rescue 0#Skill ID
  1688.          self.battler.x_charge_action[1] = $2.to_i rescue 0#Max Time
  1689.          self.battler.x_charge_action[2] = 0#Current Time
  1690.          self.battler.x_charge_action[3] = 0#Loop Anime Time
  1691.          return true
  1692.       end            
  1693.       return false    
  1694.       reset_charge_temp
  1695.   end
  1696.  
  1697.   #--------------------------------------------------------------------------
  1698.   # ● Update Combo Time
  1699.   #--------------------------------------------------------------------------        
  1700.   def update_combo_time
  1701.       return if self.battler.x_combo[2] == 0
  1702.       self.battler.x_combo[2] -= 1
  1703.       if self.battler.x_combo[2] == 0
  1704.          self.battler.x_combo[0] = 0
  1705.          self.battler.x_combo[1] = -1
  1706.       end  
  1707.   end  
  1708.  
  1709.   #--------------------------------------------------------------------------
  1710.   # ● Can Use Weapon Command?
  1711.   #--------------------------------------------------------------------------    
  1712.   def can_use_weapon_command?
  1713.       return false if $game_system.command_enable == false
  1714.       return false unless ENABLE_ACTION_1_BUTTON
  1715.       return false if self.battler.shield
  1716.       return false if self.battler.cast_action[4] > 0
  1717.       return false if self.battler.x_charge_action[2] > 0
  1718.       return true
  1719.   end
  1720.  
  1721.   #--------------------------------------------------------------------------
  1722.   # ● Can Use Shield Command?
  1723.   #--------------------------------------------------------------------------      
  1724.   def can_use_shield_command?
  1725.       return false if $game_system.command_enable == false
  1726.       return false unless ENABLE_ACTION_2_BUTTON
  1727.       return false if self.battler.equips[1] == nil
  1728.       return false if self.battler.equips[1].id == 0
  1729.       return false if self.battler.cast_action[4] > 0
  1730.       return false if self.battler.x_charge_action[2] > 0
  1731.       return true
  1732.   end
  1733.  
  1734.   #--------------------------------------------------------------------------
  1735.   # ● Can Use Skill Command?
  1736.   #--------------------------------------------------------------------------    
  1737.   def can_use_skill_command?
  1738.       return false if $game_system.command_enable == false
  1739.       return false unless ENABLE_SKILL_BUTTON
  1740.       return false if self.battler.shield
  1741.       return false if self.battler.cast_action[4] > 0
  1742.       return false if self.battler.x_charge_action[2] > 0
  1743.       return true
  1744.   end    
  1745.  
  1746.   #--------------------------------------------------------------------------
  1747.   # ● Can Use Item Command?
  1748.   #--------------------------------------------------------------------------    
  1749.   def can_use_item_command?
  1750.       return false if $game_system.command_enable == false
  1751.       return false unless ENABLE_ITEM_BUTTON
  1752.       return false if self.battler.shield    
  1753.       return false if self.battler.cast_action[4] > 0
  1754.       return false if self.battler.x_charge_action[2] > 0
  1755.       return true
  1756.   end      
  1757.  
  1758.   #--------------------------------------------------------------------------
  1759.   # ● Can Charge Command
  1760.   #--------------------------------------------------------------------------      
  1761.   def can_charge_command?
  1762.       return false if $game_system.command_enable == false
  1763.       return false if self.battler.cast_action[4] > 0
  1764.       return false if self.battler.shield      
  1765.       return true
  1766.   end  
  1767.  
  1768.   #--------------------------------------------------------------------------
  1769.   # ● Can Use Change Leader Command?
  1770.   #--------------------------------------------------------------------------      
  1771.   def can_use_change_leader_command?
  1772.       return false unless ENABLE_CHANGE_LEADER_BUTTON
  1773.       return false if self.battler.shield    
  1774.       return false if self.battler.cast_action[4] > 0
  1775.       return false if self.battler.x_charge_action[2] > 0
  1776.       return false if $game_temp.change_leader_wait_time > 0
  1777.       return true
  1778.   end
  1779.  
  1780.   #--------------------------------------------------------------------------
  1781.   # ● State_Seal Command
  1782.   #--------------------------------------------------------------------------        
  1783.   def state_seal_command?(type)
  1784.       seal = false
  1785.       case type  
  1786.          when 0
  1787.             seal = true if self.battler.state_mute
  1788.             seal = true if self.battler.state_seal_attack
  1789.          when 1
  1790.             seal = true if self.battler.state_mute
  1791.             seal = true if self.battler.state_seal_attack
  1792.          when 2
  1793.             seal = true if self.battler.state_mute
  1794.             seal = true if self.battler.state_seal_skill
  1795.          when 3  
  1796.             seal = true if self.battler.state_mute  
  1797.             seal = true if self.battler.state_seal_item
  1798.       end
  1799.       if seal
  1800.          seal_effect
  1801.          return true
  1802.       end  
  1803.       return false      
  1804.   end  
  1805.  
  1806.   #--------------------------------------------------------------------------
  1807.   # ● Check Equipped Action
  1808.   #--------------------------------------------------------------------------    
  1809.   def check_equipped_action(command_type)
  1810.       case command_type
  1811.          when 0 # Weapon 1
  1812.             weapon = self.battler.equips[0]
  1813.             if weapon == nil
  1814.                self.battler.x_action1_id = 0
  1815.                return
  1816.             end
  1817.             weapon.note =~ /<Action ID = (\d+)>/  
  1818.             action_id =  $1.to_i
  1819.             action_id = 0 if action_id == nil
  1820.             self.battler.x_action1_id = action_id
  1821.          when 1 # Weapon 2
  1822.             weapon = self.battler.equips[1]
  1823.             if weapon == nil
  1824.                self.battler.x_action2_id = 0
  1825.                return
  1826.             end  
  1827.             weapon.note =~ /<Action ID = (\d+)>/
  1828.             action_id =  $1.to_i
  1829.             action_id = 0 if action_id == nil            
  1830.             self.battler.x_action2_id = action_id
  1831.          when 2 # Skill  
  1832.            
  1833.          when 3 # Item
  1834.             item_id = $data_items[self.battler.item_id]
  1835.             if item_id == nil            
  1836.                self.battler.x_item_id =  0
  1837.                return
  1838.             end  
  1839.             item_id.note =~ /<Action ID = (\d+)>/
  1840.             action_id =  $1.to_i
  1841.             action_id = 0 if action_id == nil    
  1842.             self.battler.x_item_id = action_id
  1843.       end    
  1844.   end
  1845.    
  1846.   #--------------------------------------------------------------------------
  1847.   # ● Execute Combo
  1848.   #--------------------------------------------------------------------------        
  1849.   def execute_combo?(type)  
  1850.       if type == self.battler.x_combo[1] and self.battler.x_combo[0] != 0
  1851.          return if state_seal_command?(type)        
  1852.          self.shoot(self.battler.x_combo[0])
  1853.          self.battler.x_combo[1] = type
  1854.          return true
  1855.       end  
  1856.       self.battler.x_combo[0] = 0
  1857.       self.battler.x_combo[1] = type
  1858.       self.battler.x_combo[2] = 0
  1859.       return false
  1860.   end
  1861.  
  1862.   #--------------------------------------------------------------------------
  1863.   # ● Update Change Leader Button
  1864.   #--------------------------------------------------------------------------        
  1865.   def update_change_leader_button
  1866.       if Input.trigger?(CHANGE_LEADER_BUTTON)
  1867.          return unless can_use_change_leader_command?
  1868.          change_leader    
  1869.       end
  1870.   end
  1871.  
  1872.   #--------------------------------------------------------------------------
  1873.   # ● Update Action 1 Button
  1874.   #--------------------------------------------------------------------------      
  1875.   def update_action_1_button
  1876.       if Input.trigger?(ACTION_1_BUTTON)
  1877.          type = 0
  1878.          return unless can_use_weapon_command?
  1879.          return if execute_combo?(type)
  1880.          check_equipped_action(type)
  1881.          action_id = self.battler.x_action1_id
  1882.          return if action_id == 0
  1883.          return if state_seal_command?(type)
  1884.          self.shoot(action_id)
  1885.       end    
  1886.   end
  1887.    
  1888.   #--------------------------------------------------------------------------
  1889.   # ● Update Action 2 Button
  1890.   #--------------------------------------------------------------------------    
  1891.   def update_action_2_button
  1892.       if Input.trigger?(ACTION_2_BUTTON)
  1893.          if self.battler.equips[1].is_a?(RPG::Weapon)
  1894.             type = 1
  1895.             return unless can_use_weapon_command?
  1896.             return if execute_combo?(type)
  1897.             check_equipped_action(type)
  1898.             action_id = self.battler.x_action2_id
  1899.             return if action_id == 0
  1900.             return if state_seal_command?(type)            
  1901.             self.shoot(action_id)
  1902.             return
  1903.          end  
  1904.       end        
  1905.       update_shield_button
  1906.   end
  1907.  
  1908.   #--------------------------------------------------------------------------
  1909.   # ● Update Shield Button
  1910.   #--------------------------------------------------------------------------        
  1911.   def update_shield_button
  1912.       if Input.press?(ACTION_2_BUTTON)
  1913.          if can_use_shield_command?
  1914.             unless self.battler.shield  
  1915.                 shield = self.battler.equips[1]
  1916.                 if shield.note =~ /<Action>/
  1917.                    if shield.note =~ /<Pose = (\w+)>/
  1918.                       make_pose($1.to_s, 2)
  1919.                    end
  1920.                 else  
  1921.                    self.battler.shield = false
  1922.                    return
  1923.                 end
  1924.             end
  1925.             self.x_pose_duration = 2
  1926.             self.battler.shield = true
  1927.             update_shield_diretion_button
  1928.          else
  1929.             self.battler.shield = false
  1930.          end  
  1931.       else  
  1932.          self.battler.shield = false
  1933.       end      
  1934.   end
  1935.  
  1936.   #--------------------------------------------------------------------------
  1937.   # ● update_shield_direction_button
  1938.   #--------------------------------------------------------------------------          
  1939.   def update_shield_diretion_button
  1940.       return if @direction_fix
  1941.       case Input.dir4
  1942.          when 2;  set_direction(2)  
  1943.          when 4;  set_direction(4)  
  1944.          when 6;  set_direction(6)  
  1945.          when 8;  set_direction(8)  
  1946.       end
  1947.   end
  1948.  
  1949.   #--------------------------------------------------------------------------
  1950.   # ● Update Skill Button
  1951.   #--------------------------------------------------------------------------      
  1952.   def update_skill_button
  1953.       if Input.trigger?(SKILL_BUTTON)
  1954.          type = 2
  1955.          return unless can_use_skill_command?
  1956.          return if execute_combo?(type)
  1957.          check_equipped_action(type)
  1958.          action_id = self.battler.skill_id
  1959.          return if action_id == 0
  1960.          return if state_seal_command?(type)        
  1961.          self.shoot(action_id)
  1962.       end    
  1963.   end
  1964.  
  1965.   #--------------------------------------------------------------------------
  1966.   # ● Update Item Button
  1967.   #--------------------------------------------------------------------------      
  1968.   def update_item_button
  1969.       if Input.trigger?(ITEM_BUTTON)
  1970.          type = 3        
  1971.          return unless can_use_item_command?
  1972.          return if execute_combo?(type)
  1973.          check_equipped_action(type)
  1974.          action_id = self.battler.x_item_id
  1975.          return if action_id == 0
  1976.          return if state_seal_command?(type)        
  1977.          self.shoot(action_id)
  1978.       end  
  1979.   end
  1980.  
  1981.   #--------------------------------------------------------------------------
  1982.   # ● Update Auto Target Shoot
  1983.   #--------------------------------------------------------------------------
  1984.   def update_auto_target_shoot
  1985.       return if $game_temp.xas_target_time == 0
  1986.       return if $game_temp.xas_target_shoot_id == 0
  1987.       return if $game_temp.xas_target_x == 0 and $game_temp.xas_target_y == 0  
  1988.       $game_temp.xas_target_time -= 1
  1989.       if $game_temp.xas_target_time == 0
  1990.          self.shoot($game_temp.xas_target_shoot_id)
  1991.          $game_temp.xas_target_shoot_id = 0
  1992.       end  
  1993.   end  
  1994.  
  1995.  #--------------------------------------------------------------------------
  1996.  # ● Dash?
  1997.  #--------------------------------------------------------------------------            
  1998.  alias x_dash dash?
  1999.  def dash?  
  2000.      return false if XAS_SYSTEM::DASH_SYSTEM
  2001.      x_dash
  2002.  end
  2003.  
  2004.  #--------------------------------------------------------------------------
  2005.  # ● Can Dash?
  2006.  #--------------------------------------------------------------------------              
  2007.  def can_dash?
  2008.      return false unless XAS_BUTTON::ENABLE_DASH_BUTTON
  2009.      return false if self.battler.shield
  2010.      return true if Input.press?(XAS_BUTTON::DASH_BUTTON)
  2011.      @dash_active = false
  2012.      return false
  2013.  end
  2014.  
  2015.  #--------------------------------------------------------------------------
  2016.  # ● Update Dash Command
  2017.  #--------------------------------------------------------------------------            
  2018.  def update_dash_button
  2019.      return unless can_dash?
  2020.      @dash_active = true
  2021.      @anime_count -= 0.5 if moving?
  2022.      update_dash_sprite_name
  2023.  end  
  2024.  
  2025.  #--------------------------------------------------------------------------
  2026.  # ● Update Dash Sprite Name
  2027.  #--------------------------------------------------------------------------              
  2028.  def update_dash_sprite_name
  2029.      make_pose("_Dash", 2)
  2030.  end
  2031.  
  2032. end
  2033.  
  2034.  
  2035. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2036. #■ TOOL - INITIALIZE
  2037. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2038.  
  2039.  
  2040. #===============================================================================
  2041. # ■ Game_Map
  2042. #===============================================================================
  2043. class Game_Map
  2044.  
  2045.   attr_accessor :need_refresh_token
  2046.  
  2047.   #--------------------------------------------------------------------------
  2048.   # ● need_add_tokens
  2049.   #--------------------------------------------------------------------------  
  2050.   def need_add_tokens
  2051.       @need_add_tokens = [] if @need_add_tokens == nil
  2052.       return @need_add_tokens
  2053.   end
  2054.  
  2055.   #--------------------------------------------------------------------------
  2056.   # ● need_remove_tokens
  2057.   #--------------------------------------------------------------------------
  2058.   def need_remove_tokens
  2059.       @need_remove_tokens = [] if @need_remove_tokens == nil
  2060.       return @need_remove_tokens
  2061.   end
  2062.  
  2063.   #--------------------------------------------------------------------------
  2064.   # ● add_token
  2065.   #--------------------------------------------------------------------------
  2066.   def add_token(token_event)
  2067.       $game_temp.tool_event = [] if $game_temp.tool_event == nil
  2068.       $game_temp.tool_event.push(token_event)
  2069.       self.need_add_tokens.push(token_event)
  2070.       self.need_refresh_token = true
  2071.   end
  2072.  
  2073.   #--------------------------------------------------------------------------
  2074.   # ● remove_token
  2075.   #--------------------------------------------------------------------------
  2076.   def remove_token(token_event)
  2077.       @events.delete(token_event.id)
  2078.       self.need_remove_tokens.push(token_event)
  2079.       self.need_refresh_token = true
  2080.   end
  2081.  
  2082.   #--------------------------------------------------------------------------
  2083.   # ● clear_tokens
  2084.   #--------------------------------------------------------------------------
  2085.   def clear_tokens
  2086.       $game_system.tools_on_map.clear
  2087.       $game_system.tools_on_map = []
  2088.       for event in @events.values.dup
  2089.           remove_token(event) if event.is_a?(Token_Event)
  2090.       end
  2091.       channels = ["A", "B", "C", "D"]
  2092.       for id in 1001..(token_id_shift - 1)
  2093.           for a in channels
  2094.               key = [self.map_id, id, a]
  2095.               $game_self_switches.delete(key)
  2096.           end
  2097.       end
  2098.       clear_token_id
  2099.   end
  2100.    
  2101.   #--------------------------------------------------------------------------
  2102.   # ● Update
  2103.   #--------------------------------------------------------------------------      
  2104.   alias x_temp_tool_hash_update update
  2105.   def update(main = false)
  2106.       x_temp_tool_hash_update(main)
  2107.       update_add_tool_hash
  2108.   end
  2109.  
  2110.   #--------------------------------------------------------------------------
  2111.   # ● Update Add Toll Hash
  2112.   #--------------------------------------------------------------------------      
  2113.   def update_add_tool_hash  
  2114.       return if $game_temp.tool_event == nil
  2115.       for i in $game_temp.tool_event
  2116.           $game_map.events[i.id] = i
  2117.           execute_tool_effects_hash(i)
  2118.       end  
  2119.       $game_temp.tool_event.clear
  2120.       $game_temp.tool_event = nil
  2121.   end
  2122.    
  2123.   #--------------------------------------------------------------------------
  2124.   # ● Execute Toll Effects Hash
  2125.   #--------------------------------------------------------------------------        
  2126.   def execute_tool_effects_hash(i)
  2127.      
  2128.   end  
  2129. end
  2130.  
  2131. #===============================================================================
  2132. # ■ Game_SelfSwitches  
  2133. #===============================================================================
  2134. class Game_SelfSwitches
  2135.   def delete(key)
  2136.       @data.delete(key)
  2137.   end
  2138. end
  2139.  
  2140. #===============================================================================
  2141. # ■ Game_Map  
  2142. #===============================================================================
  2143. class Game_Map
  2144.    
  2145.   attr_accessor :token_id
  2146.  
  2147.   #--------------------------------------------------------------------------
  2148.   # ● token_id_shift
  2149.   #--------------------------------------------------------------------------  
  2150.   def token_id_shift
  2151.       @token_id  = 1000 if @token_id == nil
  2152.       @token_id += 1
  2153.       return @token_id
  2154.   end
  2155.  
  2156.   #--------------------------------------------------------------------------
  2157.   # ● clear_token_id
  2158.   #--------------------------------------------------------------------------  
  2159.   def clear_token_id
  2160.       @token_id = nil
  2161.   end
  2162. end
  2163.  
  2164. #===============================================================================
  2165. # ■ XRXS_CTS_RefreshToken
  2166. #===============================================================================
  2167. module XRXS_CTS_RefreshToken
  2168.  
  2169.   #--------------------------------------------------------------------------
  2170.   # ● refresh_token
  2171.   #--------------------------------------------------------------------------  
  2172.   def refresh_token
  2173.       for event in $game_map.need_add_tokens
  2174.           @character_sprites.push(Sprite_Character.new(@viewport1, event))
  2175.       end
  2176.       $game_map.need_add_tokens.clear
  2177.       for sprite in @character_sprites.dup
  2178.           if $game_map.need_remove_tokens.empty?
  2179.              break
  2180.           end
  2181.           if $game_map.need_remove_tokens.delete(sprite.character)
  2182.              @character_sprites.delete(sprite)
  2183.              sprite.dispose
  2184.           end
  2185.       end
  2186.       $game_map.need_refresh_token = false
  2187.   end
  2188. end
  2189.  
  2190. #===============================================================================
  2191. # ■  Spriteset_Map
  2192. #===============================================================================
  2193. class Spriteset_Map
  2194.   include XRXS_CTS_RefreshToken
  2195.  
  2196.   #--------------------------------------------------------------------------
  2197.   # ● Initialize
  2198.   #--------------------------------------------------------------------------    
  2199.   alias x_smap_initialize initialize
  2200.   def initialize
  2201.       setup_start
  2202.       x_smap_initialize
  2203.   end
  2204.  
  2205.   #--------------------------------------------------------------------------
  2206.   # ● Setup Start
  2207.   #--------------------------------------------------------------------------      
  2208.   def setup_start
  2209.       $game_player.reset_old_level(true)
  2210.   end
  2211.  
  2212. end
  2213.  
  2214. #===============================================================================
  2215. # ■ Game_Player
  2216. #===============================================================================
  2217. class Game_Player < Game_Character
  2218.  
  2219.   #--------------------------------------------------------------------------
  2220.   # ● x_reserve_transfer
  2221.   #--------------------------------------------------------------------------    
  2222.   alias x_reserve_transfer reserve_transfer
  2223.   def reserve_transfer(map_id, x, y, direction)
  2224.       $game_map.clear_tokens
  2225.       if $game_temp.tool_event != nil
  2226.          $game_temp.tool_event.clear
  2227.          $game_temp.tool_event = nil
  2228.       end  
  2229.       x_reserve_transfer(map_id, x, y, direction)
  2230.   end
  2231.  
  2232. end
  2233.  
  2234. #===============================================================================
  2235. # ■ Token_Event
  2236. #===============================================================================
  2237. class Token_Event < Game_Event
  2238.  
  2239.   #--------------------------------------------------------------------------
  2240.   # ● Token_Event
  2241.   #--------------------------------------------------------------------------
  2242.   def initialize(map_id, event)
  2243.       event.id = $game_map.token_id_shift
  2244.       super
  2245.   end
  2246.  
  2247.   #--------------------------------------------------------------------------
  2248.   # ● erase
  2249.   #--------------------------------------------------------------------------
  2250.   def erase
  2251.       super
  2252.       $game_map.remove_token(self)
  2253.   end
  2254. end
  2255.  
  2256.  
  2257. #===============================================================================
  2258. # ■  XRXS_ActionTemplate
  2259. #===============================================================================
  2260. module XRXS_ActionTemplate
  2261.   map_id = XAS_SYSTEM::ACTION_TEMPLATE_MAP_ID
  2262.   map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  2263.   @@events = map.events
  2264. end
  2265.  
  2266. #===============================================================================
  2267. # ■  Token_Event
  2268. #===============================================================================
  2269. class Token_Event < Game_Event
  2270.   include XRXS_ActionTemplate
  2271. end
  2272.  
  2273. #===============================================================================
  2274. # ■  Game_Temp
  2275. #===============================================================================
  2276. class Game_Temp
  2277.   attr_accessor :active_token
  2278. end
  2279.  
  2280.  
  2281.  
  2282. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2283. #■ TOOL - SHOOT COMMAND
  2284. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2285.  
  2286.  
  2287. #===============================================================================
  2288. # ■ XAS ACTION
  2289. #===============================================================================
  2290. module XAS_ACTION
  2291.   attr_reader   :action
  2292.   attr_reader   :erased
  2293.  
  2294.   #--------------------------------------------------------------------------
  2295.   # ● shoot
  2296.   #--------------------------------------------------------------------------
  2297.   def shoot(action_id = 0)
  2298.       return if action_id == 0
  2299.       skill = $data_skills[action_id]
  2300.       return unless can_shoot?(skill)
  2301.       execute_user_effects(skill)
  2302.       execute_call_event(action_id)      
  2303.       self.action_attachment(action_id)
  2304.       execute_set_pose(action_id)
  2305.   end
  2306.  
  2307.   #--------------------------------------------------------------------------
  2308.   # ● Can Shoot
  2309.   #--------------------------------------------------------------------------    
  2310.   def can_shoot?(skill)
  2311.       if self.battler == nil and self.tool_id > 0
  2312.          @battler = self.action.user.battler
  2313.       end  
  2314.       return false if self.battler == nil
  2315.       return false if skill == nil
  2316.       return true if ignore_can_shoot?(skill)
  2317.       enough_cost = true
  2318.       return false if tools_on_map?(skill.id)      
  2319.       if self.battler.state_mute  
  2320.          seal_effect
  2321.          return false
  2322.       end  
  2323.       if self.battler.cast_action[4].between?(1,self.battler.cast_action[1] -1)
  2324.          return false
  2325.       end
  2326.       return false if check_cast_action?(skill)
  2327.       return false if check_auto_target_select?(skill)
  2328.       unless enough_skill_cost?(skill)
  2329.          Audio.se_play("Audio/SE/" + XAS_SOUND::ACTION_COST , 100, 100)
  2330.          return false
  2331.       end
  2332.       return true
  2333.   end
  2334.  
  2335.   #--------------------------------------------------------------------------
  2336.   # ● Ignore Can Shoot?    
  2337.   #--------------------------------------------------------------------------                
  2338.   def ignore_can_shoot?(skill)
  2339.       return false
  2340.   end
  2341.  
  2342.   #--------------------------------------------------------------------------
  2343.   # ● Tools on Map
  2344.   #--------------------------------------------------------------------------              
  2345.   def tools_on_map?(skill_id)
  2346.       return true if $game_system.tools_on_map.include?(skill_id)
  2347.       return false
  2348.   end  
  2349.  
  2350.   #--------------------------------------------------------------------------
  2351.   # ● Check Cast Action
  2352.   #--------------------------------------------------------------------------            
  2353.   def check_cast_action?(skill)
  2354.       if self.battler.cast_action[0] != 0
  2355.          self.battler.cast_action[0] = 0
  2356.          self.battler.cast_action[1] = 0
  2357.          self.battler.cast_action[2] = 0
  2358.          self.battler.cast_action[3] = 0
  2359.          self.battler.cast_action[4] = 0
  2360.          return false
  2361.       end  
  2362.       if skill.note =~ /<Cast Time = (\d+)>/ and
  2363.          $game_temp.xas_target_shoot_id == 0 and
  2364.          self.force_action_times == 0
  2365.          self.battler.cast_action[0] = skill.id
  2366.          self.battler.cast_action[1] = $1.to_i rescue 0
  2367.          self.battler.cast_action[2] = XAS_ANIMATION::CAST_TIME_ANIMATION_ID
  2368.          self.battler.cast_action[3] = 0
  2369.          self.battler.cast_action[4] = 0
  2370.          self.animation_id = self.battler.cast_action[2]
  2371.          return true
  2372.       end      
  2373.       return false
  2374.   end
  2375.  
  2376.   #--------------------------------------------------------------------------
  2377.   # ● Check Auto Target Select
  2378.   #--------------------------------------------------------------------------          
  2379.   def check_auto_target_select?(skill)
  2380.       return false if self.is_a?(Game_Event)
  2381.       if skill.note =~ /<Auto Target>/
  2382.          if $game_temp.xas_target_shoot_id == 0
  2383.             $game_temp.xas_target_shoot_id = skill.id
  2384.             $game_map.check_events_on_screen
  2385.             SceneManager.call(Scene_Target_Select)
  2386.             return true
  2387.          end          
  2388.       end  
  2389.       return false
  2390.   end
  2391.  
  2392.   #--------------------------------------------------------------------------
  2393.   # ● enough_skill_cost?
  2394.   #--------------------------------------------------------------------------          
  2395.   def enough_skill_cost?(skill)
  2396.       return false unless enough_mp_cost?(skill)        
  2397.       return false unless enough_item_cost?(skill)      
  2398.       return true
  2399.   end
  2400.    
  2401.   #--------------------------------------------------------------------------
  2402.   # ● Enough MP Cost
  2403.   #--------------------------------------------------------------------------        
  2404.   def enough_mp_cost?(skill)  
  2405.       if @force_action_times > 0
  2406.          return true if @force_action == "All Shoot"
  2407.          return true if @force_action == "Four Shoot"  
  2408.          return true if @force_action == "Three Shoot"
  2409.          return true if @force_action == "Two Shoot"
  2410.       end
  2411.       if self.battler.mp < skill.mp_cost
  2412.          self.battler.damage = XAS_WORD::NO_MP
  2413.          self.battler.damage_pop = true
  2414.          return false
  2415.       else  
  2416.          self.battler.mp -= skill.mp_cost
  2417.          return true
  2418.       end
  2419.       return true
  2420.   end  
  2421.  
  2422.   #--------------------------------------------------------------------------
  2423.   # ● Enough MP Cost
  2424.   #--------------------------------------------------------------------------      
  2425.   def enough_item_cost?(skill)
  2426.       return true if self.battler.is_a?(Game_Enemy)
  2427.       if @force_action_times > 0
  2428.          return true if @force_action == "All Shoot"
  2429.          return true if @force_action == "Four Shoot"
  2430.          return true if @force_action == "Three Shoot"
  2431.          return true if @force_action == "Two Shoot"
  2432.       end      
  2433.       skill.note =~ /<Item Cost = (\d+)>/
  2434.       item_id = $1.to_i
  2435.       if item_id != nil and item_id != 0
  2436.          item_cost = $data_items[item_id]
  2437.          number = $game_party.item_number(item_cost)
  2438.          if number == 0 or number == nil
  2439.             self.battler.damage = XAS_WORD::NO_ITEM
  2440.             self.battler.damage_pop = true
  2441.             return false
  2442.          else
  2443.             $game_party.lose_item(item_cost, 1, false)
  2444.             return true
  2445.          end            
  2446.       end    
  2447.       return true
  2448.   end    
  2449.  
  2450.   #--------------------------------------------------------------------------
  2451.   # ● Execute User Effects
  2452.   #--------------------------------------------------------------------------  
  2453.   def execute_user_effects(skill)
  2454.       self.battler.shield = false
  2455.       #Animation
  2456.       if skill.note =~ /<Cast Ani = (\d+)>/
  2457.          ani_id = $1.to_i    
  2458.          if ani_id != nil
  2459.             self.animation_id = ani_id
  2460.          end  
  2461.       end
  2462.       unless @force_action_times > 0
  2463.           #All Directions
  2464.           if skill.note =~ /<All Directions>/
  2465.              @force_action = "All Shoot"
  2466.              @force_action_times = 8        
  2467.           elsif skill.note =~ /<Four Directions>/
  2468.              @force_action = "Four Shoot"
  2469.              @force_action_times = 4      
  2470.           elsif skill.note =~ /<Three Directions>/
  2471.              @force_action = "Three Shoot"
  2472.              @force_action_times = 3        
  2473.           elsif skill.note =~ /<Two Directions>/
  2474.              @force_action = "Two Shoot"
  2475.              @force_action_times = 2        
  2476.           end  
  2477.       end  
  2478.   end
  2479.    
  2480.   #--------------------------------------------------------------------------
  2481.   # ● Execute Set Pose
  2482.   #--------------------------------------------------------------------------      
  2483.   def execute_set_pose(action_id)
  2484.       @action.duration = @action.sunflag
  2485.       make_pose(@action.self_motion, @action.sunflag )
  2486.       @pattern = 0
  2487.       @pattern_count  = 0
  2488.       @step_anime = true
  2489.       @self_motion = nil      
  2490.       self.need_refresh = true if self.is_a?(Game_Player)
  2491.   end  
  2492.    
  2493.   #--------------------------------------------------------------------------
  2494.   # ● execute_call_event
  2495.   #--------------------------------------------------------------------------  
  2496.   def execute_call_event(action_id)
  2497.       bullet_token = Token_Bullet.new(self, action_id)
  2498.       $game_map.add_token(bullet_token)
  2499.       return bullet_token
  2500.   end
  2501.      
  2502.   #--------------------------------------------------------------------------
  2503.   # ● action_attachment
  2504.   #--------------------------------------------------------------------------
  2505.   def action_attachment(action_id)
  2506.       @action = Game_Action_XAS.new(self, action_id)
  2507.       @action.attachment(action_id)
  2508.   end
  2509.  
  2510. end  
  2511.  
  2512.  
  2513. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2514. #■ TOOL - SHOOT SETTING
  2515. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2516.  
  2517.  
  2518. #===============================================================================
  2519. # ■ Game_Action_XAS
  2520. #===============================================================================
  2521. class Game_Action_XAS
  2522.  
  2523.   attr_accessor   :user
  2524.   attr_accessor   :id                    
  2525.   attr_accessor   :attack_id            
  2526.   attr_accessor   :attack_range
  2527.   attr_accessor   :attack_range_type
  2528.   attr_accessor   :hit_events
  2529.   attr_accessor   :now_count
  2530.   attr_accessor   :pre_now_count
  2531.   attr_accessor   :duration
  2532.   attr_accessor   :blow_power
  2533.   attr_accessor   :piercing
  2534.   attr_accessor   :ignore_knockback_invincible
  2535.   attr_accessor   :target_invunerable_duration
  2536.   attr_accessor   :multi_hit
  2537.   attr_accessor   :ally_damage
  2538.   attr_accessor   :all_damage
  2539.   attr_accessor   :sunflag
  2540.   attr_accessor   :self_motion
  2541.   attr_accessor   :second_animation_id
  2542.   attr_accessor   :third_animation_id
  2543.   attr_accessor   :attack_range_type
  2544.   attr_accessor   :attack_range_plan
  2545.   attr_accessor   :blow_power
  2546.   attr_accessor   :ignore_guard
  2547.   attr_accessor   :user_invincible  
  2548.   attr_accessor   :short_range
  2549.   attr_accessor   :first_impact_time
  2550.   attr_accessor   :animation_time
  2551.   attr_accessor   :duration
  2552.   attr_accessor   :item_cost
  2553.   attr_accessor   :hit_shake
  2554.   attr_accessor   :hit_hold_target
  2555.   attr_accessor   :hit_bounce
  2556.   attr_accessor   :sticky
  2557.   attr_accessor   :reflectable
  2558.   attr_accessor   :can_reflect
  2559.   attr_accessor   :attack_id_plan
  2560.   attr_accessor   :hit_action
  2561.   attr_accessor   :fake_id
  2562.   attr_accessor   :impact
  2563.  
  2564.   #--------------------------------------------------------------------------
  2565.   # ● initialize
  2566.   #--------------------------------------------------------------------------
  2567.   def initialize(user, action_id)
  2568.       @user        = user
  2569.       @id          = action_id
  2570.       @now_count   = 0
  2571.       @duration    = nil
  2572.       @attack_id   = 0
  2573.       @attack_range = 0
  2574.       @hit_events  = []
  2575.       @blow_power  = 0
  2576.       @skill = $data_skills[action_id]
  2577.       @ignore_knockback_invincible = false
  2578.       @multi_hit = false
  2579.       @piercing = false
  2580.       @all_damage = false
  2581.       @ally_damage = false
  2582.       @ignore_guard = false
  2583.       @sunflag = 10
  2584.       @duration = 10
  2585.       @self_motion = ""
  2586.       @attack_range_type = 1
  2587.       @attack_range_plan = 1
  2588.       @blow_power = 1
  2589.       @first_impact_time  = 0
  2590.       @animation_time = []
  2591.       @target_invunerable_duration = 10
  2592.       @second_animation_id = 0
  2593.       @third_animation_id = 0
  2594.       @user_invincible = false
  2595.       @short_range = false
  2596.       @item_cost = 0
  2597.       @hit_shake = false
  2598.       @hit_hold_target = false
  2599.       @hit_bounce = false
  2600.       @sticky = false
  2601.       @reflectable = false
  2602.       @can_reflect = false
  2603.       @hit_action = 0
  2604.       @fake_id = false
  2605.       @impact = true
  2606.   end
  2607.  
  2608.   #--------------------------------------------------------------------------
  2609.   # ● attachment
  2610.   #--------------------------------------------------------------------------
  2611.   def attachment(action_id)
  2612.       @attack_id_plan = [action_id]
  2613.       if @skill.note =~ /<Sunflag = (\d+)>/
  2614.          @sunflag = $1.to_i
  2615.       end
  2616.       if @skill.note =~ /<Duration = (\d+)>/  
  2617.          @duration = $1.to_i
  2618.       end
  2619.       if @skill.note =~ /<Pose = (\S+)>/  
  2620.          @self_motion = $1.to_s
  2621.       end
  2622.       if @skill.note =~ /<Area = (\w+)>/
  2623.          case $1
  2624.             when "CROSS"  
  2625.                area = 7
  2626.             when "WALL"
  2627.                area = 6        
  2628.             when "FRONTRHOMBUS"  
  2629.                area = 5
  2630.             when "FRONTSQUARE"
  2631.                area = 4
  2632.             when "LINE"
  2633.                area = 3
  2634.             when "SQUARE"
  2635.                area = 2              
  2636.             else  
  2637.                area = 1
  2638.          end    
  2639.          @attack_range_type = area
  2640.        end
  2641.       if @skill.note =~ /<Range = (\d+)>/  
  2642.          @attack_range_plan = [$1.to_i]
  2643.       end
  2644.       if @skill.note =~ /<Blow Power = (\d+)>/  
  2645.          @blow_power = $1.to_i
  2646.       end  
  2647.       if @skill.note =~ /<Impact Time  = (\d+)>/  
  2648.          @first_impact_time = $1.to_i
  2649.  
  2650.        end  
  2651.       if @skill.note =~ /<Animation Time  = (\d+) - (\d+)>/  
  2652.          @animation_time[0] = $1.to_i
  2653.          @animation_time[1] = $2.to_i
  2654.       end
  2655.       if @skill.note =~ /<Target Invunerable = (\d+)>/
  2656.          @target_invunerable_duration = $1.to_i
  2657.       end  
  2658.       if @skill.note =~ /<Tool Hit Ani = (\d+)>/      
  2659.          @second_animation_id = $1.to_i
  2660.       end        
  2661.       if @skill.note =~ /<User Hit Ani = (\d+)>/      
  2662.          @third_animation_id = $1.to_i
  2663.       end  
  2664.       if @skill.note =~ /<Item Cost = (\d+)>/    
  2665.          @item_cost = $1.to_i
  2666.       end        
  2667.       if @skill.note =~ /<Link Action ID = (\d+)>/    
  2668.          if user.battler != nil
  2669.             user.battler.x_combo[0] = $1.to_i
  2670.             user.battler.x_combo[2] = @sunflag + 20
  2671.          end
  2672.       else    
  2673.          if user.battler != nil
  2674.             user.battler.x_combo[0] = 0
  2675.             user.battler.x_combo[1] = 0
  2676.             user.battler.x_combo[2] = 0
  2677.          end            
  2678.       end  
  2679.       if @skill.note =~ /<Hit Action ID = (\d+)>/
  2680.          @hit_action = $1.to_i
  2681.       end
  2682.       if @skill.note =~ /<Ignore Knockback>/
  2683.          @ignore_knockback_invincible = true
  2684.       end      
  2685.       if @skill.note =~ /<Multi Hit>/
  2686.          @multi_hit = true  
  2687.       end        
  2688.       if @skill.note =~ /<Piercing>/
  2689.          @piercing = true
  2690.       end
  2691.       if @skill.note =~ /<All Damage>/
  2692.          @all_damage = true
  2693.       end
  2694.       if @skill.note =~ /<Ally Damage>/
  2695.          @ally_damage = true
  2696.       end      
  2697.       if @skill.note =~ /<User Invincible>/
  2698.          @user_invincible = true
  2699.       end      
  2700.       if @skill.note =~ /<Ignore Guard>/
  2701.          @ignore_guard = true
  2702.       end      
  2703.       if @skill.note =~ /<One Action>/
  2704.          unless $game_system.tools_on_map.include?(action_id)  
  2705.                 $game_system.tools_on_map.push(action_id)
  2706.          end
  2707.       end      
  2708.       if @skill.note =~ /<Shake>/
  2709.          @hit_shake = true
  2710.       end
  2711.       if @skill.note =~ /<User Range>/
  2712.          @short_range = true
  2713.       end      
  2714.       if @skill.note =~ /<Hit Hold Target>/
  2715.          @hit_hold_target = true
  2716.       end        
  2717.       if @skill.note =~ /<Hit Sticky Target>/
  2718.          @sticky = true
  2719.       end        
  2720.       if @skill.note =~ /<Hit Bounce Direction>/
  2721.          @hit_bounce = true
  2722.       end  
  2723.       if @skill.note =~ /<Reflectable>/
  2724.          @reflectable = true
  2725.       end        
  2726.       if @skill.note =~ /<Can Reflect>/
  2727.          @can_reflect = true
  2728.       end  
  2729.       if @skill.note =~ /<Disable Hit>/
  2730.          @impact = false
  2731.       end
  2732.       @sunflag = 1 if @sunflag <= 0
  2733.   end
  2734.  
  2735.   #--------------------------------------------------------------------------
  2736.   # ● update
  2737.   #--------------------------------------------------------------------------
  2738.   def update
  2739.       @first_impact_time -= 1 if @first_impact_time > 0
  2740.       if @attack_id_plan != nil
  2741.          id = @attack_id_plan[@now_count]
  2742.          unless id.nil?
  2743.            @attack_id = id
  2744.            @hit_events.clear
  2745.            @hit_events.push(self.user) unless @all_damage or @ally_damage
  2746.          end
  2747.       end
  2748.       if @attack_range_plan != nil
  2749.          range = @attack_range_plan[@now_count]
  2750.          @attack_range = range unless range.nil?
  2751.       end
  2752.       @now_count += 1
  2753.   end  
  2754.  
  2755.   #--------------------------------------------------------------------------
  2756.   # ● done?
  2757.   #--------------------------------------------------------------------------
  2758.   def done?
  2759.       return (self.duration.to_i > 0 and self.now_count >= self.duration)
  2760.   end
  2761. end
  2762.  
  2763. #===============================================================================
  2764. # ■ Token_Bullet  
  2765. #===============================================================================
  2766. class Token_Bullet < Token_Event
  2767. include XRXS_ActionTemplate
  2768.   #--------------------------------------------------------------------------
  2769.   # ● initialize
  2770.   #--------------------------------------------------------------------------
  2771.   def initialize(user, action_id)
  2772.       event_id = action_id
  2773.       skill = $data_skills[action_id]
  2774.       if skill.note =~ /<Event ID = (\d+)>/
  2775.          event_id = $1.to_i
  2776.       end  
  2777.       original_event = @@events[event_id]
  2778.       if original_event == nil
  2779.          msgbox("There's no Event ID " + event_id.to_s + " on Tool Map!")
  2780.          SceneManager.exit
  2781.          return
  2782.       end  
  2783.       event = original_event.dup
  2784.       event.x = user.x
  2785.       event.y = user.y
  2786.       pre_direction = event.pages[0].graphic.direction
  2787.       event.pages[0].graphic.direction = user.direction
  2788.       @character_name = event.pages[0].graphic
  2789.       super($game_map.map_id, event)
  2790.       self.action_attachment(action_id)
  2791.       self.tool_id = action_id
  2792.       self.diagonal = false
  2793.       self.diagonal_direction = 0
  2794.       self.sprite_angle_enable = false
  2795.       @action.user = user
  2796.       @remain_for_an_act = @action.duration.is_a?(Numeric)
  2797.       check_tool_effects(user,skill,pre_direction)
  2798.   end
  2799.  
  2800.   #--------------------------------------------------------------------------
  2801.   # ● update
  2802.   #--------------------------------------------------------------------------
  2803.   def update
  2804.       super
  2805.       if @action == nil and @remain_for_an_act
  2806.          erase
  2807.          $game_system.tools_on_map.delete(self.tool_id)
  2808.       end
  2809.       check_event_trigger_attack
  2810.   end
  2811. end
  2812.  
  2813. #===============================================================================
  2814. # ■ Game Player
  2815. #===============================================================================
  2816. class Game_Player < Game_Character
  2817.   attr_accessor :need_refresh
  2818. end
  2819.  
  2820. #===============================================================================
  2821. # ■ Token_Bullet  
  2822. #===============================================================================
  2823. class Token_Bullet < Token_Event
  2824.  
  2825.   #--------------------------------------------------------------------------
  2826.   # ● Check Tool Effects
  2827.   #--------------------------------------------------------------------------
  2828.   def check_tool_effects(user,skill,pre_direction)
  2829.       if @action.ally_damage or @action.all_damage    
  2830.          user.battler.invunerable_duration = 0
  2831.       end
  2832.      # Force Update Out Screen
  2833.      if user.battler.sensor_range >= 15 or
  2834.         skill.note =~ /<Update Out Screen>/
  2835.         self.force_update = true
  2836.      end  
  2837.      #Diagonal Effect
  2838.      if skill.note =~ /<Diagonal>/ or
  2839.         skill.note =~ /<All Direction>/ or
  2840.         skill.note =~ /<Three Direction>/
  2841.         self.diagonal = true
  2842.         self.diagonal_direction = user.diagonal_direction
  2843.         self.sprite_angle_enable = true
  2844.         user.diagonal_time = XAS_BA::DIAGONAL_DURATION if user.diagonal_direction != 0
  2845.         user.diagonal = true if user.tool_id > 0        
  2846.      end
  2847.      #Auto Target
  2848.      if skill.note =~ /<Auto Target>/
  2849.         if user.is_a?(Game_Event)
  2850.            self.moveto($game_player.x, $game_player.y)
  2851.         else  
  2852.            moveto($game_temp.xas_target_x, $game_temp.xas_target_y)
  2853.            $game_temp.xas_target_x = 0
  2854.            $game_temp.xas_target_y = 0      
  2855.            $game_temp.xas_target_time = 0
  2856.            $game_temp.xas_target_shoot_id = 0
  2857.         end  
  2858.      end
  2859.      #Barrier
  2860.      if skill.note =~ /<Barrier>/
  2861.         self.tool_effect = "Barrier"
  2862.      end
  2863.      #Boomerang
  2864.      if skill.note =~ /<Boomerang = (\d+)>/
  2865.         self.tool_effect = "Boomerang"
  2866.         self.action.duration = 1000
  2867.         self.diagonal = true
  2868.         self.diagonal_direction = user.diagonal_direction
  2869.         self.force_update = true
  2870.         @move_frequency = 6
  2871.         @move_speed = 7
  2872.         @direction_fix = false
  2873.         @walk_anime = true
  2874.         @step_anime = true
  2875.         @force_action = "Forward"
  2876.         @force_action_times = $1.to_i
  2877.      end    
  2878.      
  2879.    end
  2880. end
  2881.  
  2882.  
  2883.  
  2884. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2885. #■ TOOL - AREA
  2886. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2887.  
  2888.  
  2889. #===============================================================================
  2890. # ■ XAS ACTION
  2891. #===============================================================================
  2892. module XAS_ACTION
  2893.  
  2894.   #--------------------------------------------------------------------------
  2895.   # ● action_update
  2896.   #--------------------------------------------------------------------------
  2897.   def action_update
  2898.       return unless @action.is_a?(Game_Action_XAS)
  2899.       if @action.animation_time != [] and
  2900.          @action.animation_time[0] == @action.now_count
  2901.          animation_id = @action.animation_time[1]
  2902.          unless self.is_a?(Game_Player) or self.tool_id == 0
  2903.              self.animation_id = animation_id
  2904.          end
  2905.       end
  2906.       @action.update
  2907.   end
  2908.    
  2909.   #--------------------------------------------------------------------------
  2910.   # ● Can Impact Target
  2911.   #--------------------------------------------------------------------------  
  2912.   def can_impact_target?
  2913.       return false if @action.nil?
  2914.       return false if @action.attack_id == 0
  2915.       return false if @action.first_impact_time > 0
  2916.       return false if @action.impact == false
  2917.       return false if self.jumping?
  2918.       return true
  2919.   end  
  2920.  
  2921.   #--------------------------------------------------------------------------
  2922.   # ● check_event_trigger_attack
  2923.   #--------------------------------------------------------------------------
  2924.   def check_event_trigger_attack()
  2925.       return unless can_impact_target?
  2926.       hit_check = false
  2927.       range = @action.attack_range
  2928.       hit = []
  2929.       targets = [$game_player] + $game_map.events.values
  2930.       for event in targets
  2931.         next if event == self or
  2932.                 @action.hit_events.include?(event) or event.erased
  2933.         body_size      = event.body_size
  2934.         event_center_x = event.x
  2935.         event_center_y = event.y - body_size
  2936.         if @action.short_range
  2937.            dx = event_center_x - $game_player.x
  2938.            dy = event_center_y - $game_player.y
  2939.         else
  2940.            dx = event_center_x - self.x
  2941.            dy = event_center_y - self.y
  2942.          end
  2943.         dx = (dx >= 0 ? [dx - body_size, 0].max : [dx + body_size, 0].min)
  2944.         dy = (dy >= 0 ? [dy - body_size, 0].max : [dy + body_size, 0].min)
  2945.         hit_check = true if in_range?(dx,dy,event,range)
  2946.         hit.push(event) if hit_check
  2947.         hit_check = false
  2948.       end
  2949.       for event in hit
  2950.           if event.action_effect(self, self.action.attack_id)
  2951.              hit_check = true
  2952.           end
  2953.           if event.action_effect_page(self, self.action.attack_id)
  2954.              hit_check = true
  2955.          end        
  2956.          @action.hit_events.push(event) unless @action.multi_hit
  2957.          end
  2958.       if hit_check
  2959.          $game_temp.active_token = self
  2960.       end
  2961.   end
  2962.  
  2963.   #--------------------------------------------------------------------------
  2964.   # ● In Range?
  2965.   #--------------------------------------------------------------------------  
  2966.   def in_range?(dx,dy,event,range)
  2967.       case @action.attack_range_type
  2968.             when 1 #RHOMBUS
  2969.               return true if (dx.abs + dy.abs <= range)
  2970.             when 2 #SQUARE
  2971.               return true if (dx.abs <= range and dy.abs <= range)
  2972.             when 3 #LINE
  2973.               case self.direction
  2974.                   when 2
  2975.                     return true if (dx == 0 and dy >= 0 and dy <= range)
  2976.                   when 8
  2977.                     return true if (dx == 0 and dy <= 0 and dy >= -range)
  2978.                   when 6
  2979.                     return true if (dy == 0 and dx >= 0 and dx <= range)
  2980.                   when 4
  2981.                     return true if (dy == 0 and dx <= 0 and dx >= -range)
  2982.               end
  2983.             when 4  #FRONT SQUARE  
  2984.               case self.direction
  2985.                  when 2
  2986.                     return true if (dx.abs <= range and dy >= 0 and dy.abs <= range)
  2987.                  when 4
  2988.                     return true if (dx.abs <= range and dx <= 0 and dy.abs <= range)  
  2989.                  when 6
  2990.                     return true if (dx.abs <= range and dx >= 0 and dy.abs <= range)
  2991.                  when 8
  2992.                     return true if (dx.abs <= range and dy <= 0 and dy.abs <= range)
  2993.               end              
  2994.             when 5  #FRONT RHOMBUS    
  2995.               case self.direction
  2996.                   when 2
  2997.                     return true if (dx.abs + dy.abs <= range and dy >= 0)
  2998.                   when 8
  2999.                     return true if (dx.abs + dy.abs <= range and dy <= 0)
  3000.                   when 6
  3001.                     return true if (dx.abs + dy.abs <= range and dx >= 0)
  3002.                   when 4
  3003.                     return true if (dx.abs + dy.abs <= range and dx <= 0)
  3004.               end          
  3005.             when 6  #WALL
  3006.               case self.direction
  3007.                  when 2
  3008.                     return true if (dx.abs <= range and dy == 0 )
  3009.                  when 4
  3010.                     return true if (dy.abs <= range and dx == 0)  
  3011.                  when 6
  3012.                     return true if (dy.abs <= range and dx == 0)
  3013.                  when 8
  3014.                     return true if (dx.abs <= range and dy == 0)
  3015.                end  
  3016.             when 7 #CROSS
  3017.                  return true if (dx.abs <= range and dy == 0)
  3018.                  return true if (dy.abs <= range and dx == 0)  
  3019.             end
  3020.      return false      
  3021.   end      
  3022.  
  3023.   #--------------------------------------------------------------------------
  3024.   # ●  action_effect Page
  3025.   #--------------------------------------------------------------------------
  3026.   def action_effect_page(attacker, attack_id)
  3027.       return false unless self.is_a?(Game_Event)
  3028.       return false if attacker.action.fake_id
  3029.       if attacker.action != nil
  3030.          check_auto_effect_page(attacker, attack_id)
  3031.          check_reflectable_skills(attacker, attack_id)
  3032.       end
  3033.       for page in @event.pages
  3034.           if page.condition.variable_valid and
  3035.              page.condition.variable_id == XAS_SYSTEM::HIT_ID and
  3036.              page.condition.variable_value == attack_id
  3037.              self.reaction_valid_attack_id = attack_id
  3038.              self.refresh
  3039.              @trigger = 0
  3040.              self.start
  3041.              return true
  3042.           end
  3043.       end
  3044.       return false
  3045.   end
  3046.  
  3047.   #--------------------------------------------------------------------------
  3048.   # ● Check Reflectable Skills
  3049.   #--------------------------------------------------------------------------    
  3050.   def check_reflectable_skills(attacker, attack_id)
  3051.       return if self.tool_id == 0
  3052.       return unless self.action.reflectable
  3053.       return unless attacker.action.can_reflect
  3054.       self.action.user = attacker.action.user
  3055.       self.action.hit_events = []  
  3056.       self.turn_back
  3057.   end  
  3058.  
  3059.   #--------------------------------------------------------------------------
  3060.   # ● Check Auto Effect Page
  3061.   #--------------------------------------------------------------------------  
  3062.   def check_auto_effect_page(attacker, attack_id)
  3063.       if self.treasure_time > 0
  3064.          if can_hit_take_treasure?(attacker, attack_id)
  3065.             execute_take_treasure(attacker, attack_id)
  3066.          elsif self.temp_id == 0 and can_hold_treasure?(attacker, attack_id)  
  3067.             execute_hold_treasure(attacker, attack_id)
  3068.          end  
  3069.       end
  3070.   end
  3071.  
  3072.   #--------------------------------------------------------------------------
  3073.   # ● Can Hit Take Treasure
  3074.   #--------------------------------------------------------------------------      
  3075.   def can_hit_take_treasure?(attacker, attack_id)
  3076.       return true if attacker.action.short_range
  3077.       return false
  3078.   end
  3079.  
  3080.   #--------------------------------------------------------------------------
  3081.   # ● Can Hold Treasure?
  3082.   #--------------------------------------------------------------------------        
  3083.   def can_hold_treasure?(attacker, attack_id)
  3084.       return true if attacker.tool_effect == "Boomerang"  
  3085.       return false
  3086.   end  
  3087.  
  3088.   #--------------------------------------------------------------------------
  3089.   # ● Execute Hold Treasure
  3090.   #--------------------------------------------------------------------------      
  3091.   def execute_hold_treasure(attacker, attack_id)
  3092.       tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
  3093.       return if self.treasure_time > tr_time
  3094.       self.temp_id = attacker.id    
  3095.   end  
  3096.  
  3097.   #--------------------------------------------------------------------------
  3098.   # ● Execute Take Treasure
  3099.   #--------------------------------------------------------------------------      
  3100.   def execute_take_treasure(attacker, attack_id)
  3101.       tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
  3102.       return if self.treasure_time > tr_time
  3103.       self.x = $game_player.x
  3104.       self.y = $game_player.y
  3105.   end
  3106.  
  3107.   #--------------------------------------------------------------------------
  3108.   # ● body_size
  3109.   #--------------------------------------------------------------------------
  3110.   def body_size
  3111.       return 0
  3112.   end
  3113.  
  3114.   #--------------------------------------------------------------------------
  3115.   # ● action_clear
  3116.   #--------------------------------------------------------------------------
  3117.   def action_clear
  3118.       @action = nil
  3119.       @step_anime = false
  3120.   end
  3121. end
  3122.  
  3123. #===============================================================================
  3124. # ■ Game_Character
  3125. #===============================================================================
  3126. class Game_Character < Game_CharacterBase
  3127.     include XAS_ACTION
  3128. end
  3129.  
  3130. #===============================================================================
  3131. # ■  Game_Event
  3132. #===============================================================================
  3133. class Game_Event < Game_Character
  3134.  
  3135.   #--------------------------------------------------------------------------
  3136.   # * Refresh
  3137.   #--------------------------------------------------------------------------
  3138.   alias x_conditions_met conditions_met?
  3139.   def conditions_met?(page)
  3140.       c = page.condition
  3141.       if c.variable_valid
  3142.          if c.variable_id == XAS_SYSTEM::HIT_ID and
  3143.             c.variable_value == self.reaction_valid_attack_id
  3144.             return true
  3145.          end
  3146.        end
  3147.       x_conditions_met(page)
  3148.   end
  3149.  
  3150. end  
  3151.  
  3152. #===============================================================================
  3153. # ■  XAS_Dispose
  3154. #===============================================================================
  3155. module XAS_Dispose
  3156.  
  3157.   #--------------------------------------------------------------------------
  3158.   # ● update
  3159.   #--------------------------------------------------------------------------  
  3160.   def update
  3161.       action_update
  3162.       super
  3163.       if @action.is_a?(Game_Action_XAS) and @action.done?
  3164.          self.action_clear
  3165.       end
  3166.   end
  3167. end
  3168.  
  3169. #===============================================================================
  3170. # ■  Game_Player
  3171. #===============================================================================
  3172. class Game_Player < Game_Character
  3173.   include XAS_Dispose
  3174. end
  3175.  
  3176. #===============================================================================
  3177. # ■  Game_Event
  3178. #===============================================================================
  3179. class Game_Event < Game_Character
  3180.   include XAS_Dispose
  3181. end
  3182.  
  3183. #===============================================================================
  3184. # ■ XAS_StopToAction
  3185. #===============================================================================
  3186. module XAS_StopToAction
  3187.  
  3188.   #--------------------------------------------------------------------------
  3189.   # ● acting?
  3190.   #--------------------------------------------------------------------------  
  3191.   def acting?
  3192.       return false if self.battler == nil
  3193.       return true if self.battler.shield
  3194.       return true if self.action != nil
  3195.       return false
  3196.   end
  3197.  
  3198.   #--------------------------------------------------------------------------
  3199.   # ● moving?
  3200.   #--------------------------------------------------------------------------  
  3201.   def moving?
  3202.       return (super or self.acting? or self.stop)
  3203.   end
  3204.    
  3205. end
  3206.  
  3207. #===============================================================================
  3208. # ■ Game_Player  
  3209. #===============================================================================
  3210. class Game_Player < Game_Character
  3211.   include XAS_StopToAction
  3212. end
  3213.  
  3214. #===============================================================================
  3215. # ■ Game_Event  
  3216. #===============================================================================
  3217. class Game_Event < Game_Character
  3218.   attr_accessor :reaction_valid_attack_id
  3219. end
  3220.  
  3221.  
  3222. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3223. #■ TOOL - HIT EFFECT
  3224. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3225.  
  3226.  
  3227. #===============================================================================
  3228. # ■ XRXS_BattlerAttachment
  3229. #==============================================================================
  3230. module XRXS_BattlerAttachment
  3231.  
  3232.   #--------------------------------------------------------------------------
  3233.   # ● Can Hit Base?
  3234.   #--------------------------------------------------------------------------    
  3235.   def can_hit_base?(bullet, action_id)
  3236.       return false unless $game_system.xas_battle
  3237.       return false if self.battler == nil
  3238.       return false if bullet == nil
  3239.       return false if action_id == nil or action_id <= 0
  3240.       return false if self.can_update == false
  3241.       return true
  3242.   end  
  3243.  
  3244.   #--------------------------------------------------------------------------
  3245.   # ● Action Effect
  3246.   #--------------------------------------------------------------------------  
  3247.   def action_effect(bullet, action_id)
  3248.       return unless can_hit_base?(bullet, action_id)
  3249.       skill = $data_skills[action_id]
  3250.       user = bullet.action.user
  3251.       attacker = (user == nil ? nil : user.battler)    
  3252.       tar_invu = bullet.action.target_invunerable_duration
  3253.       #CAN HIT?
  3254.       return unless action_can_hit_target?(bullet, user, skill,tar_invu)
  3255.       #REFLECT STATE
  3256.       return if reflect_state?(bullet, skill)
  3257.       #SHIELD
  3258.       if target_shield_enabled?(attacker, skill, bullet)
  3259.          execute_guard_effect(user, skill, bullet, tar_invu)
  3260.          return
  3261.       end
  3262.       #INVUNERABLE ACTIONS
  3263.       if target_invunerable_actions?(user, skill, bullet)
  3264.          execute_guard_effect(user, skill, bullet, tar_invu, false)
  3265.          return
  3266.       end  
  3267.       #GUARD DIRECTIONS
  3268.       if target_guard_directions?(user, skill, bullet)
  3269.          execute_guard_effect(user, skill, bullet, tar_invu)
  3270.          return        
  3271.       end  
  3272.       execute_hit_effect(attacker,skill, bullet , user, tar_invu )
  3273.       if self.is_a?(Game_Player)
  3274.          self.need_refresh = true
  3275.       end
  3276.   end
  3277.  
  3278.   #--------------------------------------------------------------------------
  3279.   # ● Reflect State?
  3280.   #--------------------------------------------------------------------------                
  3281.   def reflect_state?(bullet, skill)
  3282.       if  bullet.action.reflectable and self.battler.state_reflect
  3283.           if skill.note =~ /<Auto Target>/
  3284.              bullet.moveto(bullet.action.user.x,bullet.action.user.y)
  3285.           else  
  3286.              bullet.turn_back
  3287.           end  
  3288.           bullet.action.user = self
  3289.           bullet.action.hit_events = []          
  3290.           bullet.turn_back
  3291. #          bullet.jump(0,0)
  3292.           bullet.turn_back
  3293.           self.battler.damage = XAS_WORD::REFLECT
  3294.           self.battler.damage_pop = true
  3295.           self.animation_id = XAS_ANIMATION::REFLECT_ANIMATION_ID
  3296.           self.battler.invunerable_duration = 20
  3297.          return true
  3298.      end
  3299.      return false    
  3300.   end
  3301.  
  3302.  #--------------------------------------------------------------------------
  3303.  # ● Target Guard Directions?
  3304.  #--------------------------------------------------------------------------    
  3305.  def target_guard_directions?(user, skill, bullet)
  3306.      return false if self.battler.guard == false
  3307.      return false if bullet.action.ignore_guard
  3308.      if self.battler.guard_directions.include?(2) and
  3309.         ((self.direction == 2 and bullet.direction == 8) or
  3310.          (self.direction == 8 and bullet.direction == 2) or
  3311.          (self.direction == 6 and bullet.direction == 4) or
  3312.          (self.direction == 4 and bullet.direction == 6))
  3313.          return true
  3314.      elsif self.battler.guard_directions.include?(8) and
  3315.         ((self.direction == 8 and bullet.direction == 8) or
  3316.          (self.direction == 2 and bullet.direction == 2) or
  3317.          (self.direction == 6 and bullet.direction == 6) or
  3318.          (self.direction == 4 and bullet.direction == 4))
  3319.          return true
  3320.      elsif self.battler.guard_directions.include?(4) and
  3321.         ((self.direction == 2 and bullet.direction == 4) or
  3322.          (self.direction == 8 and bullet.direction == 6) or
  3323.          (self.direction == 6 and bullet.direction == 2) or
  3324.          (self.direction == 4 and bullet.direction == 8))
  3325.          return true        
  3326.      elsif self.battler.guard_directions.include?(6) and
  3327.         ((self.direction == 2 and bullet.direction == 6) or
  3328.          (self.direction == 8 and bullet.direction == 4) or
  3329.          (self.direction == 6 and bullet.direction == 8) or
  3330.          (self.direction == 4 and bullet.direction == 2))
  3331.          return true
  3332.      end      
  3333.      return false
  3334.   end
  3335.      
  3336.   #--------------------------------------------------------------------------
  3337.   # ● Target Invunerable Actions?
  3338.   #--------------------------------------------------------------------------            
  3339.   def target_invunerable_actions?(user, skill, bullet)
  3340.       return true if self.battler.invunerable_actions.include?(skill.id)
  3341.       return false
  3342.   end
  3343.  
  3344.   #--------------------------------------------------------------------------
  3345.   # ● Shoot Target Shield
  3346.   #--------------------------------------------------------------------------          
  3347.   def shoot_target_shield?(bullet,user, skill)
  3348.       return false unless self.battler.shield
  3349.       return false if bullet.action.ignore_guard
  3350.       return true if face_direction?(bullet)
  3351.       return false
  3352.   end
  3353.  
  3354.   #--------------------------------------------------------------------------
  3355.   # ● Action can hit target?
  3356.   #--------------------------------------------------------------------------        
  3357.   def action_can_hit_target?(bullet, user, skill,tar_invu)
  3358.       if user == nil
  3359.          return false
  3360.       end  
  3361.       if self.battler.invunerable
  3362.          return false
  3363.       end  
  3364.       if self.battler.dead?
  3365.          return false
  3366.       end  
  3367.       if self.battler.invunerable_duration > 0
  3368.          return false
  3369.       end  
  3370.       if @knock_back_duration != nil
  3371.          return false unless bullet.action.ignore_knockback_invincible
  3372.       end
  3373.       if bullet.action.first_impact_time > 0
  3374.          return false
  3375.       end
  3376.       if self.action != nil and self.action.user_invincible
  3377.          unless self.action.ally_damage and bullet.action.user == self.action.user
  3378.              return false
  3379.          end
  3380.       end  
  3381.       unless bullet.action.all_damage
  3382.              if bullet.action.ally_damage
  3383.                 if user.battler.is_a?(Game_Actor)
  3384.                    return false if self.battler.is_a?(Game_Enemy)
  3385.                 elsif user.battler.is_a?(Game_Enemy)
  3386.                    return false if self.battler.is_a?(Game_Actor)
  3387.                 end
  3388.              else    
  3389.                 if user.battler.is_a?(Game_Actor)
  3390.                    return false if self.battler.is_a?(Game_Actor)
  3391.                 elsif user.battler.is_a?(Game_Enemy)
  3392.                    return false if self.battler.is_a?(Game_Enemy)
  3393.                 end                
  3394.              end              
  3395.       end
  3396.       return false if target_state_invunerable?(tar_invu)
  3397.       #return false if target_reflect_action?(bullet, user)
  3398.       return true
  3399.   end
  3400.  
  3401.   #--------------------------------------------------------------------------
  3402.   # ● Target Relfect Action
  3403.   #--------------------------------------------------------------------------          
  3404.   def target_reflect_action?(bullet, user)
  3405.       return false unless bullet.action.reflectable
  3406.       for i in $game_map.events.values
  3407.           if i.tool_id > 0 and i.action.can_reflect and
  3408.              i.tool_effect == "Barrier"# and i.action.user.battler.is_a?(self.battler)
  3409.              bullet.action.user = self
  3410.              bullet.action.hit_events = []  
  3411.              bullet.turn_back
  3412.              return true
  3413.              break
  3414.           end  
  3415.       end
  3416.       return false  
  3417.   end
  3418.  
  3419.   #--------------------------------------------------------------------------
  3420.   # ● Target State Invunerable
  3421.   #--------------------------------------------------------------------------        
  3422.   def target_state_invunerable?(tar_invu)
  3423.       if self.battler.state_invunerable
  3424.          self.battler.damage = XAS_WORD::INVINCIBLE
  3425.          self.battler.damage_pop = true
  3426.          self.animation_id = XAS_ANIMATION::INVINCIBLE_ANIMATION_ID
  3427.          self.battler.invunerable_duration = tar_invu
  3428.          return true
  3429.       end
  3430.       return false
  3431.   end
  3432.  
  3433.   #--------------------------------------------------------------------------
  3434.   # ● Execute Hit Effect
  3435.   #--------------------------------------------------------------------------      
  3436.   def execute_hit_effect(attacker,skill, bullet , user, tar_invu)
  3437.       shoot_effect_before_damage(skill, bullet, user)
  3438.       execute_battler_skill_effect(attacker ,skill, user)
  3439.       if target_missed?(attacker)
  3440.          self.battler.invunerable_duration = 30
  3441.          return
  3442.       end            
  3443.       execute_damage_pop(attacker,skill)
  3444.       shoot_effect_after_damage(skill, bullet, user) if can_damage_after_effect?
  3445.       execute_state_effect(skill, user,  bullet)    
  3446.       bullet.action.duration = 1 if remove_tool_after_hit?(skill, bullet, user)
  3447.       self.battler.invunerable_duration = tar_invu
  3448.       execute_blow_effect(skill,bullet) if can_blow_effect?
  3449.       execute_animation(skill, bullet, user)
  3450.       execute_tool_effects(skill, bullet , user)
  3451.   end
  3452.  
  3453.   #--------------------------------------------------------------------------
  3454.   # ● Execute Tool Effects
  3455.   #--------------------------------------------------------------------------              
  3456.   def execute_tool_effects(skill, bullet , user)
  3457.       execute_sticky_effect(skill, bullet, user)
  3458.       execute_bounce_effect(skill, bullet, user)
  3459.       execute_hit_action_effect(skill, bullet, user)
  3460.   end
  3461.    
  3462.   #--------------------------------------------------------------------------
  3463.   # ● Remove Tool After Hit?
  3464.   #--------------------------------------------------------------------------            
  3465.   def remove_tool_after_hit?(skill, bullet, user)
  3466.       return true if bullet.action.piercing == false
  3467.       return false
  3468.   end  
  3469.  
  3470.   #--------------------------------------------------------------------------
  3471.   # ● Execute Battler Skill Effect
  3472.   #--------------------------------------------------------------------------          
  3473.   def execute_battler_skill_effect(attacker ,skill, user)
  3474.       self.battler.item_apply(attacker, skill)
  3475.   end
  3476.  
  3477.   #--------------------------------------------------------------------------
  3478.   # ● Target Missed?
  3479.   #--------------------------------------------------------------------------        
  3480.   def target_missed?(attacker)
  3481.       if self.battler.result.missed
  3482.          self.battler.damage = XAS_WORD::MISSED
  3483.          self.battler.damage_pop = true        
  3484.          return true
  3485.       end    
  3486.       if self.battler.result.evaded
  3487.          self.battler.damage = XAS_WORD::EVADED
  3488.          self.battler.damage_pop = true            
  3489.          return true
  3490.       end  
  3491.       return false
  3492.   end  
  3493.   #--------------------------------------------------------------------------
  3494.   # ● Shoot Effect Before Damage
  3495.   #--------------------------------------------------------------------------        
  3496.   def shoot_effect_before_damage(skill, bullet, user)
  3497.   end
  3498.  
  3499.   #--------------------------------------------------------------------------
  3500.   # ● Shoot Effect After Damage
  3501.   #--------------------------------------------------------------------------          
  3502.   def shoot_effect_after_damage(skill, bullet, user)
  3503.       check_counter_attack(skill)
  3504.       self.battler.passive = false
  3505.   end
  3506.  
  3507.   #--------------------------------------------------------------------------
  3508.   # ● Shoot Effect After Damage
  3509.   #--------------------------------------------------------------------------            
  3510.   def check_counter_attack(skill)
  3511.       return if self.battler.is_a?(Game_Actor)
  3512.       return if self.battler.counter_action[2] == false
  3513.       return if self.battler.counter_action[1] > 0
  3514.       counter = XAS_BA_ENEMY::COUNTER_ATTACK[self.battler.enemy_id]
  3515.       if counter != nil
  3516.          counter_action_id = counter[rand(counter.size)]
  3517.          self.battler.counter_action[0] = counter_action_id
  3518.          self.battler.counter_action[1] = 15
  3519.       end  
  3520.   end  
  3521.  
  3522.   #--------------------------------------------------------------------------
  3523.   # ● Execute Bounce Effect
  3524.   #--------------------------------------------------------------------------            
  3525.   def execute_bounce_effect(skill, bullet, user)
  3526.       return false if bullet.action.hit_bounce == false
  3527.       bullet.bounce_direction
  3528.   end
  3529.  
  3530.   #--------------------------------------------------------------------------
  3531.   # ● Execute Stick Effect
  3532.   #--------------------------------------------------------------------------          
  3533.   def execute_sticky_effect(skill, bullet, user)
  3534.       return unless bullet.action.sticky
  3535.       return if bullet.temp_id !=  0
  3536.       bullet.pre_move_speed = bullet.move_speed
  3537.       bullet.temp_id = self.id
  3538.   end
  3539.  
  3540.   #--------------------------------------------------------------------------
  3541.   # ● Execute Hit Action Effect
  3542.   #--------------------------------------------------------------------------            
  3543.   def execute_hit_action_effect(skill, bullet, user)
  3544.       return if bullet.action.hit_action == 0
  3545.       self.battler.invunerable_duration = 1
  3546.       bullet.shoot(bullet.action.hit_action)
  3547.       bullet.action.duration = 9
  3548.       bullet.action.multi_hit = false
  3549.       bullet.character_name = ""
  3550.       bullet.x_pose_duration = 0
  3551.       bullet.x_pose_name = ""
  3552.       bullet.x_pose_original_name = ""      
  3553.   end
  3554.  
  3555.   #--------------------------------------------------------------------------
  3556.   # ● Can Damage Effect
  3557.   #--------------------------------------------------------------------------          
  3558.   def can_damage_after_effect?
  3559.       return false if self.battler.damage == nil
  3560.       return false unless self.battler.damage.is_a?(Numeric)
  3561.       return true
  3562.   end  
  3563.  
  3564.   #--------------------------------------------------------------------------
  3565.   # ● Execute State Effect
  3566.   #--------------------------------------------------------------------------        
  3567.   def execute_state_effect(skill, user,  bullet)  
  3568.       if user.battler.states.size != 0
  3569.          for i in user.battler.states
  3570.              execute_state_effect_user(skill, user, bullet,i)
  3571.          end    
  3572.       end
  3573.       if self.battler.states.size != 0
  3574.          for i in self.battler.states
  3575.              execute_state_effect_target(skill, user, bullet,i)
  3576.          end    
  3577.       end
  3578.   end
  3579.  
  3580.   #--------------------------------------------------------------------------
  3581.   # ● Execute State Effect User
  3582.   #--------------------------------------------------------------------------          
  3583.   def execute_state_effect_user(skill, user, bullet,i)
  3584.  
  3585.   end
  3586.  
  3587.   #--------------------------------------------------------------------------
  3588.   # ● Execute State Target
  3589.   #--------------------------------------------------------------------------          
  3590.   def execute_state_effect_target(skill, user, bullet,i)
  3591.       #Sleep
  3592.       if self.battler.damage.is_a?(Numeric) and self.battler.damage > 0
  3593.          if i.note =~ /<Sleep>/  
  3594.             self.battler.remove_state(i.id)
  3595.          end
  3596.       end  
  3597.   end  
  3598.  
  3599.   #--------------------------------------------------------------------------
  3600.   # ● Execute Blow Effect
  3601.   #--------------------------------------------------------------------------      
  3602.   def execute_blow_effect(skill,bullet)
  3603.       if bullet.action.hit_hold_target and self.temp_id == 0    
  3604.          self.temp_id = bullet.id
  3605.          self.pre_move_speed = self.move_speed        
  3606.          self.moveto(bullet.x, bullet.y)
  3607.       end  
  3608.       $game_map.screen.start_shake(5, 5, 60) if bullet.action.hit_shake
  3609.       p = bullet.action.blow_power.to_i  
  3610.       d = bullet.direction    
  3611.       return if self.battler.damage.to_i <= 0
  3612.       return if p < 0
  3613.       self.blow(d, p)  
  3614.   end
  3615.    
  3616.   #--------------------------------------------------------------------------
  3617.   # ● Execute Animation
  3618.   #--------------------------------------------------------------------------        
  3619.   def execute_animation(skill, bullet, user)    
  3620.       self.animation_id = skill.animation_id
  3621.       tool_animation = bullet.action.second_animation_id
  3622.       user_animation = bullet.action.third_animation_id
  3623.       bullet.animation_id = tool_animation if tool_animation != 0
  3624.       user.animation_id = user_animation if user_animation != 0
  3625.   end  
  3626.    
  3627.   #--------------------------------------------------------------------------
  3628.   # ● Knock Back Disable
  3629.   #--------------------------------------------------------------------------      
  3630.   def knock_back_disable
  3631.     return false
  3632.   end
  3633.  
  3634.   #--------------------------------------------------------------------------
  3635.   # ● Dead?
  3636.   #--------------------------------------------------------------------------          
  3637.   def dead?
  3638.     return self.battler == nil ? false : self.battler.dead?
  3639.   end
  3640.  
  3641. end
  3642.  
  3643.  
  3644. #===============================================================================
  3645. # ■ XRXS_BattlerAttachment
  3646. #==============================================================================
  3647. module XRXS_BattlerAttachment
  3648.  
  3649.   #--------------------------------------------------------------------------
  3650.   # ● Shoot Target Shield
  3651.   #--------------------------------------------------------------------------          
  3652.   def target_shield_enabled?(attacker, skill, bullet)
  3653.       return false unless self.battler.shield
  3654.       if bullet != nil
  3655.          return false if bullet.action.ignore_guard
  3656.          return true if face_direction?(bullet)        
  3657.       else  
  3658.          return false if attacker.battler.ignore_guard
  3659.          return true if face_direction?(attacker)        
  3660.       end  
  3661.       return false
  3662.   end  
  3663.  
  3664.   #--------------------------------------------------------------------------
  3665.   # ● Can Blow Effect
  3666.   #--------------------------------------------------------------------------        
  3667.   def can_blow_effect?
  3668.       return false if self.battler.no_knockback
  3669.       return false if $game_map.interpreter.running?
  3670.       return true
  3671.   end  
  3672.  
  3673.  #--------------------------------------------------------------------------
  3674.  # ● Execute Guard Effect
  3675.  #--------------------------------------------------------------------------      
  3676.  def execute_guard_effect(attacker, skill, bullet, inv, erase_bullet = true)
  3677.      self.battler.invunerable_duration = inv
  3678.      damage_pop(XAS_WORD::GUARD)
  3679.      guard_animation_id = XAS_ANIMATION::GUARD_ANIMATION_ID
  3680.      self.animation_id = guard_animation_id if guard_animation_id != 0  
  3681.      if bullet != nil
  3682.         bullet.erase if erase_bullet
  3683.      else  
  3684.         blow_reverse(attacker) unless attacker.battler.no_knockback
  3685.      end  
  3686.  end
  3687.    
  3688.  #--------------------------------------------------------------------------
  3689.  # ● Blow Reverse
  3690.  #--------------------------------------------------------------------------      
  3691.  def blow_reverse(attacker)
  3692.      return if attacker.battler.no_knockback
  3693.      case attacker.direction
  3694.         when 2
  3695.            d = 8
  3696.         when 4
  3697.            d = 6
  3698.         when 6
  3699.            d = 4
  3700.         when 8  
  3701.            d = 2
  3702.      end
  3703.      attacker.jump(0,0)  
  3704.      attacker.blow(d,1)
  3705.  end
  3706.  
  3707.  #--------------------------------------------------------------------------
  3708.  # ● Can Attack Effect
  3709.  #--------------------------------------------------------------------------      
  3710.  def damage_pop(text)
  3711.      return unless XAS_WORD::ENABLE_WORD
  3712.      self.battler.damage = text
  3713.      self.battler.damage_pop = true
  3714.  end
  3715.  
  3716.  #--------------------------------------------------------------------------
  3717.  # ● Shd Direction?
  3718.  #--------------------------------------------------------------------------      
  3719.  def face_direction?(attacker)
  3720.      target = self.direction  
  3721.      case target
  3722.           when 2
  3723.              return true if attacker.direction == 8
  3724.           when 4
  3725.              return true if attacker.direction == 6
  3726.           when 6
  3727.              return true if attacker.direction == 4
  3728.           when 8  
  3729.              return true if attacker.direction == 2    
  3730.      end
  3731.      return false
  3732.  end  
  3733.  
  3734.  #--------------------------------------------------------------------------
  3735.  # ● Execute Damage Pop
  3736.  #--------------------------------------------------------------------------      
  3737.  def execute_damage_pop(attacker,skill = nil)
  3738.      if skill != nil
  3739.         return if skill.note =~ /<No Damage Pop>/
  3740.         if skill.damage.to_mp?
  3741.            dam = self.battler.result.mp_damage
  3742.            self.battler.damage_type = "Mp"      
  3743.         elsif skill.damage.to_hp?
  3744.            dam = self.battler.result.hp_damage
  3745.            self.battler.damage_type = "Critical"  if self.battler.result.critical
  3746.         end  
  3747.         if dam != nil
  3748.            if skill.damage.drain? or skill.damage.drain?
  3749.               attacker.damage = -dam
  3750.               attacker.damage_type = self.battler.damage_type
  3751.               attacker.damage_pop = true
  3752.            end  
  3753.            self.battler.damage = dam
  3754.            self.battler.damage_pop = true
  3755.         end
  3756.      else
  3757.         if self.battler.result.hp_damage != nil
  3758.            self.battler.damage = self.battler.result.hp_damage
  3759.            self.battler.damage_type = "Critical" if self.battler.result.critical  
  3760.            self.battler.damage_pop = true      
  3761.         end  
  3762.      end  
  3763.  end  
  3764.  
  3765. end  
  3766.  
  3767.  
  3768.  
  3769. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3770. #■ TOOL - EQUIP
  3771. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3772.  
  3773.  
  3774. #==============================================================================
  3775. # ■ Window Skill List
  3776. #==============================================================================
  3777. class Window_SkillList < Window_Selectable
  3778.  
  3779.   #--------------------------------------------------------------------------
  3780.   # ● Process OK
  3781.   #--------------------------------------------------------------------------                  
  3782.   alias x_skill_process_ok process_ok
  3783.   def process_ok
  3784.       return if can_equip_skill_action?
  3785.       x_skill_process_ok
  3786.   end
  3787.  
  3788.   #--------------------------------------------------------------------------
  3789.   # ● Can Equip Skill Action
  3790.   #--------------------------------------------------------------------------                    
  3791.   def can_equip_skill_action?
  3792.       return false if $game_party.in_battle
  3793.       skill = @data[index]
  3794.       if skill != nil and skill.note =~ /<Duration = (\d+)>/
  3795.          @actor.skill_id = skill.id
  3796.          Sound.play_equip
  3797.          return true        
  3798.       end
  3799.       return false
  3800.   end
  3801.  
  3802. end
  3803.  
  3804. #==============================================================================
  3805. # ■ Window Item List
  3806. #==============================================================================
  3807. class Window_ItemList < Window_Selectable
  3808.  
  3809.   #--------------------------------------------------------------------------
  3810.   # ● Process OK
  3811.   #--------------------------------------------------------------------------                  
  3812.   alias x_item_process_ok process_ok
  3813.   def process_ok
  3814.       return if can_equip_item_action?
  3815.       x_item_process_ok
  3816.   end
  3817.  
  3818.   #--------------------------------------------------------------------------
  3819.   # ● Can Equip Item Action
  3820.   #--------------------------------------------------------------------------                    
  3821.   def can_equip_item_action?
  3822.       return false if $game_party.in_battle
  3823.       item = @data[index]
  3824.       if item != nil and item.is_a?(RPG::Item) and
  3825.          item.note =~ /<Action ID = (\d+)>/
  3826.          actor = $game_party.members[0]
  3827.          actor.item_id = item.id
  3828.          Sound.play_equip
  3829.          return true        
  3830.       end
  3831.       return false
  3832.   end
  3833.  
  3834. end
  3835.  
  3836.  
  3837.  
  3838. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3839. #■ BATTLER - INITIALIZE
  3840. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3841.  
  3842.  
  3843. #===============================================================================
  3844. # ■ Game Character
  3845. #==============================================================================
  3846. class Game_Character < Game_CharacterBase
  3847.  
  3848.   #--------------------------------------------------------------------------
  3849.   # ● Update Battler
  3850.   #--------------------------------------------------------------------------      
  3851.   def update_battler
  3852.       update_battler_pose
  3853.       update_battler_parameters
  3854.       update_battler_stop_movement
  3855.       update_battler_knockbacking
  3856.       update_battler_counter_action
  3857.       unless self.battler.hp == 0
  3858.           update_battler_cast_action    
  3859.           update_battler_move_speed if can_update_battler_move_speed?
  3860.           update_battler_states_effect
  3861.           update_battler_attacking
  3862.       else
  3863.           update_battler_defeat_process
  3864.       end
  3865.   end  
  3866.  
  3867. end
  3868.  
  3869. #===============================================================================
  3870. # ■ Game Player
  3871. #===============================================================================
  3872. class Game_Player < Game_Character
  3873.   include XRXS_BattlerAttachment
  3874.  
  3875.   #--------------------------------------------------------------------------
  3876.   # ● Battler
  3877.   #--------------------------------------------------------------------------  
  3878.   def battler
  3879.       return $game_party.members[0]
  3880.   end
  3881.  
  3882.   #--------------------------------------------------------------------------
  3883.   # ● Refresh Interpreter Effect
  3884.   #--------------------------------------------------------------------------        
  3885.   def refresh_interpreter_effect
  3886.       $game_system.old_interpreter_running = $game_map.interpreter.running?
  3887.       if $game_system.old_interpreter_running
  3888.          $game_temp.reset_battler_time = 60 * 4
  3889.       end  
  3890.       reset_battler_setting  
  3891.   end  
  3892.  
  3893.   #--------------------------------------------------------------------------
  3894.   # ● Update Battler Setting Time
  3895.   #--------------------------------------------------------------------------          
  3896.   def update_reset_battler_setting_time
  3897.       return if $game_temp.reset_battler_time == 0
  3898.       $game_temp.reset_battler_time -= 1
  3899.       reset_battler_setting_running if $game_temp.reset_battler_time == 0
  3900.   end
  3901.  
  3902.   #--------------------------------------------------------------------------
  3903.   # ● Update Battler Setting
  3904.   #--------------------------------------------------------------------------        
  3905.   def reset_battler_setting
  3906.       reset_player_parameters
  3907.       for ally in $game_party.members
  3908.          reset_members_parameters(ally)
  3909.       end
  3910.       for enemy in $game_map.events.values
  3911.           reset_enemies_parameters(enemy) if enemy.battler != nil
  3912.       end    
  3913.       $game_map.need_refresh = true  
  3914.   end  
  3915.  
  3916.   #--------------------------------------------------------------------------
  3917.   # ● Update Battler Setting Running
  3918.   #--------------------------------------------------------------------------        
  3919.   def reset_battler_setting_running
  3920.       reset_player_parameters_running
  3921.       for ally in $game_party.members
  3922.          reset_members_parameters_running(ally)
  3923.       end
  3924.       for enemy in $game_map.events.values
  3925.           reset_enemies_parameters(enemy) if enemy.battler != nil
  3926.       end    
  3927.       $game_map.need_refresh = true  
  3928.   end    
  3929.  
  3930.   #--------------------------------------------------------------------------
  3931.   # ● Reset Enemies Parameters
  3932.   #--------------------------------------------------------------------------          
  3933.   def reset_enemies_parameters(enemy)
  3934.       enemy.battler.cast_action[0] = 0
  3935.       enemy.battler.cast_action[1] = 0
  3936.       enemy.battler.cast_action[2] = 0
  3937.       enemy.battler.cast_action[3] = 0  
  3938.       enemy.battler.cast_action[4] = 0
  3939.       enemy.battler.counter_action[0] = 0
  3940.       enemy.battler.counter_action[1] = 0
  3941.       enemy.battler.counter_action[2] = true
  3942.       enemy.battler.invunerable_duration = 0
  3943.       enemy.knock_back_duration = nil
  3944.   end  
  3945.  
  3946.   #--------------------------------------------------------------------------
  3947.   # ● Reset Members Parameters
  3948.   #--------------------------------------------------------------------------          
  3949.   def reset_members_parameters(ally)
  3950.       ally.old_level = ally.level
  3951.       ally.shield = false
  3952.       ally.x_charge_action[0] = 0
  3953.       ally.x_charge_action[1] = 0
  3954.       ally.x_charge_action[2] = 0
  3955.       ally.x_charge_action[3] = 0
  3956.       ally.cast_action[0] = 0
  3957.       ally.cast_action[1] = 0
  3958.       ally.cast_action[2] = 0
  3959.       ally.cast_action[3] = 0  
  3960.       ally.cast_action[4] = 0
  3961.       ally.counter_action[0] = 0
  3962.       ally.counter_action[1] = 0
  3963.       ally.counter_action[2] = true
  3964.       ally.invunerable_duration = 0
  3965.   end
  3966.  
  3967.   #--------------------------------------------------------------------------
  3968.   # ● Reset Player Parameters
  3969.   #--------------------------------------------------------------------------          
  3970.   def reset_player_parameters
  3971.       make_pose("", 1) unless $game_player.action != nil
  3972.       $game_temp.xas_target_time = 0
  3973.       $game_temp.xas_target_shoot_id = 0
  3974.       $game_temp.xas_target_x = 0      
  3975.       @knock_back_duration = nil
  3976.       @dash_active = false
  3977.   end
  3978.    
  3979.  
  3980.   #--------------------------------------------------------------------------
  3981.   # ● Reset Members Parameters Running
  3982.   #--------------------------------------------------------------------------          
  3983.   def reset_members_parameters_running(ally)
  3984.       ally.old_level = ally.level
  3985.       ally.shield = false
  3986.       unless ally.x_charge_action[1] > 0
  3987.       ally.x_charge_action[0] = 0
  3988.       ally.x_charge_action[1] = 0
  3989.       ally.x_charge_action[2] = 0
  3990.       ally.x_charge_action[3] = 0
  3991.       end
  3992.       unless ally.cast_action[1] > 0
  3993.          ally.cast_action[0] = 0
  3994.          ally.cast_action[1] = 0
  3995.          ally.cast_action[2] = 0
  3996.          ally.cast_action[3] = 0  
  3997.          ally.cast_action[4] = 0
  3998.       end
  3999.       ally.counter_action[0] = 0
  4000.       ally.counter_action[1] = 0
  4001.       ally.counter_action[2] = true
  4002.       ally.invunerable_duration = 0
  4003.   end
  4004.  
  4005.   #--------------------------------------------------------------------------
  4006.   # ● Reset Player Parameters Running
  4007.   #--------------------------------------------------------------------------          
  4008.   def reset_player_parameters_running
  4009.       $game_temp.xas_target_time = 0
  4010.       $game_temp.xas_target_shoot_id = 0
  4011.       $game_temp.xas_target_x = 0      
  4012.       @knock_back_duration = nil
  4013.       @dash_active = false
  4014.   end
  4015.  
  4016. end
  4017.  
  4018. #===============================================================================
  4019. # ■ Game Follower
  4020. #===============================================================================
  4021. class Game_Follower < Game_Character
  4022.   include XRXS_BattlerAttachment
  4023.  
  4024.   #--------------------------------------------------------------------------
  4025.   # ● Battler
  4026.   #--------------------------------------------------------------------------    
  4027.   def battler
  4028.       return $game_party.members[@member_index]
  4029.   end
  4030. end
  4031.  
  4032. #===============================================================================
  4033. # ■ Game Follower
  4034. #===============================================================================
  4035. class Game_Followers
  4036.   include XRXS_BattlerAttachment
  4037.  
  4038.   #--------------------------------------------------------------------------
  4039.   # ● Battler
  4040.   #--------------------------------------------------------------------------    
  4041.   def battler
  4042.       return $game_party.members[@member_index]
  4043.   end
  4044. end
  4045. #===============================================================================
  4046. # ■ Game_Vehicle
  4047. #===============================================================================
  4048. class Game_Vehicle < Game_Character
  4049.   include XRXS_BattlerAttachment
  4050.   attr_reader   :collision_attack
  4051.  
  4052.   #--------------------------------------------------------------------------
  4053.   # ● Battler
  4054.   #--------------------------------------------------------------------------      
  4055.   def battler
  4056.      return @battler
  4057.   end  
  4058. end  
  4059.  
  4060. #===============================================================================
  4061. # ■ Game Event
  4062. #===============================================================================
  4063. class Game_Event < Game_Character
  4064.  
  4065.   include XRXS_BattlerAttachment
  4066.  
  4067.   #--------------------------------------------------------------------------
  4068.   # ● Battler
  4069.   #--------------------------------------------------------------------------    
  4070.   def battler
  4071.     return @battler
  4072.   end
  4073.  
  4074.  #--------------------------------------------------------------------------
  4075.  # ● Battler?
  4076.  #--------------------------------------------------------------------------          
  4077.  def battler?
  4078.      return false if self.erased
  4079.      return false if self.battler == nil
  4080.      return false if self.dead?
  4081.      return false if self.battler.no_damage_pop
  4082.      return false if self.battler.invunerable
  4083.      return true
  4084.  end  
  4085.  
  4086.   #--------------------------------------------------------------------------
  4087.   # ● Refresh
  4088.   #--------------------------------------------------------------------------    
  4089.   alias xrxs64c_refresh refresh
  4090.   def refresh
  4091.       xrxs64c_refresh
  4092.       self.battler_recheck
  4093.   end
  4094.    
  4095.   #--------------------------------------------------------------------------
  4096.   # ● Battler Recheck
  4097.   #--------------------------------------------------------------------------    
  4098.   def battler_recheck
  4099.       return if @battler != nil
  4100.       return if @page == nil
  4101.       if self.name =~ /<Actor>/      
  4102.          actor = $game_party.members[0]
  4103.          @battler = Game_Actor.new(actor.id)
  4104.          return
  4105.       else
  4106.          @enemy_id = 0
  4107.          if self.name =~ /<Enemy(\d+)>/i
  4108.             @enemy_id = $1.to_i    
  4109.          end          
  4110.          return if @enemy_id <= 0
  4111.          @battler = Game_Enemy.new(1, @enemy_id)
  4112.          self.force_update = true if self.battler.sensor_range >= 15        
  4113.       end  
  4114.   end
  4115.    
  4116.   #--------------------------------------------------------------------------
  4117.   # ● Battler Recheck
  4118.   #--------------------------------------------------------------------------      
  4119.   def enemy_id
  4120.       return @enemy_id
  4121.   end
  4122.  
  4123.   #--------------------------------------------------------------------------
  4124.   # ● body_size
  4125.   #--------------------------------------------------------------------------        
  4126.   def body_size
  4127.       if self.battler != nil
  4128.          return self.battler.body_size
  4129.       else
  4130.          return 0
  4131.       end  
  4132.   end
  4133.  
  4134. end
  4135.  
  4136.  
  4137. #===============================================================================
  4138. # ■ Game_Battler
  4139. #===============================================================================
  4140. class Game_Battler
  4141.   attr_accessor :sensor_range
  4142.   attr_accessor :body_size
  4143.   attr_accessor :breath_effect
  4144.   attr_accessor :breath_duration
  4145.   attr_accessor :fast_breath_effect
  4146.   attr_accessor :no_knockback
  4147.   attr_accessor :passive  
  4148.   attr_accessor :attack_animation_id
  4149.   attr_accessor :ignore_guard
  4150.   attr_accessor :no_damage_pop
  4151.  
  4152.   #--------------------------------------------------------------------------
  4153.   # ● Initialize
  4154.   #--------------------------------------------------------------------------      
  4155.   alias x_e_initialize initialize
  4156.   def initialize  
  4157.       x_e_initialize
  4158.       @sensor_range = 4
  4159.       @body_size = 0
  4160.       @breath_effect = false
  4161.       @breath_duration = 0
  4162.       @fast_breath_effect = false
  4163.       @no_knockback = false
  4164.       @passive = false    
  4165.       @attack_animation_id = 0
  4166.       @ignore_guard = false
  4167.       @no_damage_pop = false
  4168.   end  
  4169. end
  4170.  
  4171. #===============================================================================
  4172. # ■ Game_Enemy
  4173. #===============================================================================
  4174. class Game_Enemy < Game_Battler
  4175.    
  4176.   #--------------------------------------------------------------------------
  4177.   # ● Initialize
  4178.   #--------------------------------------------------------------------------      
  4179.   alias x_e2_initialize initialize
  4180.   def initialize(index, enemy_id)
  4181.       x_e2_initialize(index, enemy_id)
  4182.       enemy = $data_enemies[@enemy_id]
  4183.       setup_enemy_note(enemy)
  4184.   end  
  4185.  
  4186.   #--------------------------------------------------------------------------
  4187.   # ● Setup X Note Elements
  4188.   #--------------------------------------------------------------------------          
  4189.   def setup_enemy_note(enemy)
  4190.       if enemy.note =~ /<Sensor Range = (\d+)>/
  4191.          @sensor_range = $1.to_i
  4192.       end  
  4193.       if enemy.note =~ /<Body Size = (\d+)>/
  4194.          @body_size = $1.to_i
  4195.       end
  4196.       if enemy.note =~ /<Attack Animation = (\d+)>/
  4197.          @attack_animation_id = $1.to_i
  4198.       end  
  4199.       if enemy.note =~ /<Death Zoom = (\d+)>/
  4200.          @death_zoom_effect = $1.to_i
  4201.       end
  4202.       if enemy.note =~ /<Knockback Duration = (\d+)>/
  4203.          @knockback_duration = $1.to_i
  4204.       end      
  4205.       if enemy.note =~ /<Ignore Guard>/
  4206.          @ignore_shield = true
  4207.       end
  4208.       if enemy.note =~ /<Invunerable>/
  4209.          @invunerable = true
  4210.       end
  4211.       if enemy.note =~ /<Breath Effect>/  
  4212.          @breath_effect = true
  4213.       end
  4214.       if enemy.note =~ /<Knockback Disable>/        
  4215.          @no_knockback = true
  4216.       end
  4217.       if enemy.note =~ /<Passive>/  
  4218.          @passive = true
  4219.       end
  4220.       if enemy.note =~ /<No Damage Pop>/  
  4221.          @no_damage_pop = true
  4222.       end  
  4223.       invunerable_actions_ids = XAS_BA_ENEMY::INVUNERABLE_ACTIONS[@enemy_id]
  4224.       if invunerable_actions_ids != nil
  4225.          @invunerable_actions = invunerable_actions_ids
  4226.       end  
  4227.       guard_directions_ids = XAS_BA_ENEMY::GUARD_DIRECTIONS[@enemy_id]
  4228.       if guard_directions_ids != nil
  4229.          @guard_directions = guard_directions_ids
  4230.       end          
  4231.   end
  4232.  
  4233.  
  4234. end  
  4235.  
  4236.  
  4237. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4238. #■ BATTLER - EVENT SENSOR
  4239. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4240.  
  4241.  
  4242. #===============================================================================
  4243. # ■ XRXS_Enemy_Sensor
  4244. #===============================================================================
  4245. module XRXS_EnemySensor
  4246.  
  4247.   #--------------------------------------------------------------------------
  4248.   # ● Update Sensor
  4249.   #--------------------------------------------------------------------------        
  4250.   def update_sensor
  4251.       if self.battler != nil and self.battler.sensor_range > 0  
  4252.          sensor_area = self.battler.sensor_range
  4253.       else  
  4254.          sensor_area = $game_variables[XAS_BA::DEFAULT_SENSOR_RANGE_VARIABLE_ID]
  4255.       end
  4256.       sensor_area = -1 if cancel_sensor?
  4257.       distance = ($game_player.x - self.x).abs + ($game_player.y - self.y).abs
  4258.       enable   = (distance <= sensor_area)
  4259.       key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
  4260.       last_enable = $game_self_switches[key]
  4261.       last_enable = false if last_enable == nil
  4262.       if enable != last_enable
  4263.          touch_attack(false)
  4264.          @collision_attack = false
  4265.          @pattern = 0
  4266.          @pattern_count = 0              
  4267.          $game_self_switches[key] = enable
  4268.          self.refresh
  4269.       end
  4270.   end
  4271.  
  4272.   #--------------------------------------------------------------------------
  4273.   # ● Can Update Sensor
  4274.   #--------------------------------------------------------------------------            
  4275.   def can_update_sensor?
  4276.       return false if @sensor_enable == false
  4277.       return false if self.dead?
  4278.       return false if self.erased
  4279.       return false if self.stop
  4280.       return false if self.knockbacking?
  4281.       return true
  4282.   end
  4283.  
  4284.   #--------------------------------------------------------------------------
  4285.   # ● refresh_sensor
  4286.   #--------------------------------------------------------------------------          
  4287.   def refresh_sensor
  4288.       touch_attack(false)
  4289.       key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
  4290.       $game_self_switches[key] = false
  4291.       @pattern = 0
  4292.       @pattern_count  = 0        
  4293.       self.refresh        
  4294.   end  
  4295.  
  4296.   #--------------------------------------------------------------------------
  4297.   # ● Cancel Sensor
  4298.   #--------------------------------------------------------------------------          
  4299.   def cancel_sensor?  
  4300.       return false if self.battler == nil
  4301.       return true if self.battler.passive
  4302.       return false
  4303.   end
  4304.  
  4305. end
  4306.  
  4307. #===============================================================================
  4308. # ■  Game Event
  4309. #===============================================================================
  4310. class Game_Event < Game_Character
  4311.  
  4312.   attr_accessor :sensor_enable
  4313.  
  4314.   #--------------------------------------------------------------------------
  4315.   # ● Initialize
  4316.   #--------------------------------------------------------------------------            
  4317.   alias x_sensor_initialize initialize
  4318.   def initialize(map_id, event)
  4319.       @sensor_enable = false
  4320.       x_sensor_initialize(map_id, event)
  4321.   end  
  4322.  
  4323.   #--------------------------------------------------------------------------
  4324.   # ● Conditions Met
  4325.   #--------------------------------------------------------------------------
  4326.   alias x_sensor_conditions_met conditions_met?
  4327.   def conditions_met?(page)
  4328.       c = page.condition
  4329.       if c.self_switch_ch == XAS_BA::SENSOR_SELF_SWITCH
  4330.          @sensor_enable = true
  4331.       end
  4332.       x_sensor_conditions_met(page)    
  4333.   end
  4334. end
  4335.  
  4336. #===============================================================================
  4337. # ■  Game Event
  4338. #===============================================================================
  4339. class Game_Character < Game_CharacterBase
  4340.       include XRXS_EnemySensor
  4341. end
  4342.  
  4343. #===============================================================================
  4344. # ■  Game Character
  4345. #===============================================================================
  4346. class Game_Character < Game_CharacterBase
  4347.       attr_writer   :opacity
  4348. end
  4349.  
  4350.  
  4351.  
  4352. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4353. #■ BATTLER - ACTION
  4354. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4355.  
  4356.  
  4357. #===============================================================================
  4358. # ■ Game Character
  4359. #==============================================================================
  4360. class Game_Character < Game_CharacterBase
  4361.  
  4362.   #--------------------------------------------------------------------------
  4363.   # ● Can Update Battler Move Speed
  4364.   #--------------------------------------------------------------------------                  
  4365.   def can_update_battler_move_speed?
  4366.       return false if @temp_id > 0
  4367.       return false if moving?    
  4368.       return true
  4369.   end  
  4370.  
  4371.   #--------------------------------------------------------------------------
  4372.   # ● Can Update Battler?
  4373.   #--------------------------------------------------------------------------                
  4374.   def can_update_battler?
  4375.       return false unless $game_system.xas_battle
  4376.       return false if self.battler == nil
  4377.       return false unless party_system?
  4378.       return true
  4379.   end  
  4380.  
  4381.   #--------------------------------------------------------------------------
  4382.   # ● Party System
  4383.   #--------------------------------------------------------------------------                  
  4384.   def party_system?
  4385.       return false if self.battler == nil
  4386.       if $xas_party_system == nil and self.battler.is_a?(Game_Actor)
  4387.          return false if self.battler.actor_id != $game_party.members[0].actor_id
  4388.       end
  4389.       return true
  4390.   end
  4391.  
  4392.   #--------------------------------------------------------------------------
  4393.   # ● Reset Battler Temp
  4394.   #--------------------------------------------------------------------------                  
  4395.   def reset_battler_temp
  4396.       reset_cast_temp  
  4397.       reset_charge_temp
  4398.   end  
  4399.  
  4400.   #--------------------------------------------------------------------------
  4401.   # ● Reset Charge Temp
  4402.   #--------------------------------------------------------------------------                    
  4403.   def reset_charge_temp  
  4404.       return if self.battler == nil
  4405.       return if self.battler.is_a?(Game_Enemy)
  4406.       self.battler.x_charge_action[0] = 0
  4407.       self.battler.x_charge_action[1] = 0
  4408.       self.battler.x_charge_action[2] = 0
  4409.       self.battler.x_charge_action[3] = 0
  4410.   end
  4411.  
  4412.   #--------------------------------------------------------------------------
  4413.   # ● Reset Battler Temp
  4414.   #--------------------------------------------------------------------------                    
  4415.   def reset_cast_temp  
  4416.       return if self.battler == nil
  4417.       self.battler.cast_action[0] = 0
  4418.       self.battler.cast_action[1] = 0
  4419.       self.battler.cast_action[2] = 0
  4420.       self.battler.cast_action[3] = 0  
  4421.       self.battler.cast_action[4] = 0
  4422.   end
  4423.    
  4424.   #--------------------------------------------------------------------------
  4425.   # ● update_battler_parameters
  4426.   #--------------------------------------------------------------------------    
  4427.   def update_battler_parameters
  4428.       @stop_count = -1 if can_stop_battler?
  4429.       self.battler.invunerable_duration -= 1 if self.battler.invunerable_duration > 0
  4430.       unless @stop
  4431.          @knock_back_duration = 30 if @temp_id > 0
  4432.       end  
  4433.   end    
  4434.  
  4435.   #--------------------------------------------------------------------------
  4436.   # ● Can Stop Battler
  4437.   #--------------------------------------------------------------------------      
  4438.   def can_stop_battler?
  4439.       return false if self.is_a?(Game_Player)
  4440.       return true if self.knockbacking?
  4441.       return true if self.dead?
  4442.       return true if self.stop
  4443.       return false
  4444.   end
  4445.  
  4446.   #--------------------------------------------------------------------------
  4447.   # ● Update Battler Counter Action
  4448.   #--------------------------------------------------------------------------                    
  4449.   def update_battler_counter_action
  4450.       return if self.battler.counter_action[1] == 0
  4451.       self.battler.counter_action[1] -= 1
  4452.       if self.battler.counter_action[1] == 0
  4453.          turn_toward_player
  4454.          self.battler.damage = XAS_WORD::COUNTER
  4455.          self.battler.damage_pop = true
  4456.          self.shoot(self.battler.counter_action[0])
  4457.          self.battler.counter_action[0] = 0
  4458.       end  
  4459.   end  
  4460.  
  4461.   #--------------------------------------------------------------------------
  4462.   # ● Update Cast Action
  4463.   #--------------------------------------------------------------------------          
  4464.   def update_battler_cast_action    
  4465.       return unless can_update_cast_action?
  4466.       self.battler.cast_action[3] += 1
  4467.       if self.battler.cast_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
  4468.          self.battler.cast_action[3] = 0
  4469.          self.animation_id =  self.battler.cast_action[2]
  4470.       end  
  4471.       self.battler.cast_action[4] += 1
  4472.       if self.battler.cast_action[4] >= self.battler.cast_action[1]
  4473.           self.shoot(self.battler.cast_action[0])
  4474.       end
  4475.   end  
  4476.  
  4477.   #--------------------------------------------------------------------------
  4478.   # ● Can Update Cast Action
  4479.   #--------------------------------------------------------------------------            
  4480.   def can_update_cast_action?
  4481.       return false if self.battler.cast_action[1] == 0    
  4482.       return false if @stop
  4483.       return true
  4484.   end
  4485.  
  4486.   #--------------------------------------------------------------------------
  4487.   # ● Can Blow Effect
  4488.   #--------------------------------------------------------------------------              
  4489.   def can_blow?
  4490.       return false if self.stop and not self.battler.state_sleep
  4491.       return false if self.battler.no_knockback    
  4492.       return false if self.is_a?(Game_Player) and self.action != nil
  4493.       return true
  4494.   end  
  4495.    
  4496.   #--------------------------------------------------------------------------
  4497.   # ● Blow Effect
  4498.   #--------------------------------------------------------------------------        
  4499.   def blow(d, power = 1)
  4500.       return unless can_blow?
  4501.       jump(0,0)
  4502.       self.battler.invunerable_duration = 30 if self.battler.invunerable_duration <= 0
  4503.       if self.is_a?(Game_Event)
  4504.          @collision_attack = false  
  4505.       end
  4506.       @knock_back_duration = self.battler.knockback_duration
  4507.       refresh_sensor if self.is_a?(Game_Event)
  4508.       pre_direction = self.direction
  4509.       pre_direction_fix = self.direction_fix
  4510.       self.turn_reverse(d)      
  4511.       self.direction_fix = true
  4512.       power.times do
  4513.         case d
  4514.            when 2; @y += 1 if passable?(@x, @y, d)
  4515.            when 4; @x -= 1 if passable?(@x, @y, d)
  4516.            when 6; @x += 1 if passable?(@x, @y, d)
  4517.            when 8; @y -= 1 if passable?(@x, @y, d)
  4518.         end
  4519.       end
  4520.       self.direction_fix = pre_direction_fix
  4521.       self.direction = pre_direction
  4522.   end
  4523.  
  4524.   #--------------------------------------------------------------------------
  4525.   # ● Can Stop Battler Movement
  4526.   #--------------------------------------------------------------------------            
  4527.   def can_stop_battler_movement?
  4528.       return false if self.dead?  
  4529.       return true if self.battler.state_sleep
  4530.       return true if self.battler.state_stop
  4531.       return false
  4532.   end  
  4533.  
  4534.   #--------------------------------------------------------------------------
  4535.   # ● Impact
  4536.   #--------------------------------------------------------------------------              
  4537.   def impact(enable = true)
  4538.       return if self.tool_id == 0
  4539.       return if self.action == nil
  4540.       self.action.impact = enable
  4541.   end
  4542.  
  4543.   #--------------------------------------------------------------------------
  4544.   # ● Update Battler Stop Movement
  4545.   #--------------------------------------------------------------------------              
  4546.   def update_battler_stop_movement
  4547.       unless can_stop_battler_movement?
  4548.           @stop = false  
  4549.           return
  4550.       end
  4551.       @knock_back_duration = nil
  4552.       @stop = true      
  4553.       @step_anime = false    
  4554.       reset_battler_temp
  4555.       if self.battler.state_sleep
  4556.          make_pose("_Hit", 2)  
  4557.       else
  4558.          make_pose("", 2)
  4559.       end  
  4560.       if self.is_a?(Game_Event)
  4561.          @collision_attack = false
  4562.       end  
  4563.   end
  4564.    
  4565.   #--------------------------------------------------------------------------
  4566.   # ● Update Attacking
  4567.   #--------------------------------------------------------------------------              
  4568.   def update_battler_attacking
  4569.       return unless can_update_attacking?
  4570.       make_pose("_Atk", 2)
  4571.   end
  4572.  
  4573.   #--------------------------------------------------------------------------
  4574.   # ● Can Update Attacking
  4575.   #--------------------------------------------------------------------------              
  4576.   def can_update_attacking?
  4577.       return false if self.battler.is_a?(Game_Actor)
  4578.       return false if @collision_attack == false  
  4579.       return true
  4580.   end  
  4581.  
  4582.   #--------------------------------------------------------------------------
  4583.   # ● Update Battler Knobacking
  4584.   #--------------------------------------------------------------------------            
  4585.   def update_battler_knockbacking
  4586.        return unless self.knockbacking?
  4587.        @pattern = 0
  4588.        @knock_back_duration -= 1 if can_remove_knockback?
  4589.        make_pose("_Hit", 2)        
  4590.        if self.is_a?(Game_Event)
  4591.           @collision_attack = false
  4592.        end        
  4593.        if @knock_back_duration <= 0
  4594.           @knock_back_duration = nil
  4595.           make_pose("", 0)
  4596.           touch_attack(false) if self.is_a?(Game_Event)
  4597.           @character_name = @x_pose_original_name
  4598.        end
  4599.   end  
  4600.    
  4601.   #--------------------------------------------------------------------------
  4602.   # ● Can Remove Knockback
  4603.   #--------------------------------------------------------------------------              
  4604.   def can_remove_knockback?
  4605.       return true
  4606.   end
  4607.  
  4608.   #--------------------------------------------------------------------------
  4609.   # ● knockbacking?
  4610.   #--------------------------------------------------------------------------            
  4611.   def knockbacking?
  4612.       return false if self.battler == nil
  4613.       return false if @stop
  4614.       return true if @knock_back_duration != nil
  4615.       return false
  4616.   end
  4617.  
  4618.   #--------------------------------------------------------------------------
  4619.   # ● collapsing?
  4620.   #--------------------------------------------------------------------------          
  4621.   def collapsing?
  4622.       return self.collapse_duration.to_i > 0
  4623.   end
  4624.    
  4625.   #--------------------------------------------------------------------------
  4626.   # ● Seal Effect
  4627.   #--------------------------------------------------------------------------          
  4628.   def seal_effect
  4629.       Sound.play_buzzer
  4630.       if XAS_WORD::ENABLE_WORD
  4631.          self.battler.damage = XAS_WORD::SEAL
  4632.          self.battler.damage_pop = true
  4633.       end  
  4634.   end    
  4635.  
  4636. end
  4637.  
  4638. #===============================================================================
  4639. # ■ XAS_DamageStop
  4640. #===============================================================================
  4641. module XAS_DamageStop
  4642.  
  4643.   #--------------------------------------------------------------------------
  4644.   # ● Acting
  4645.   #--------------------------------------------------------------------------            
  4646.   def acting?
  4647.       return (super or self.knockbacking? or self.collapsing? or self.stop)
  4648.   end
  4649. end
  4650.  
  4651. #===============================================================================
  4652. # ■ Game_Player
  4653. #===============================================================================
  4654. class Game_Player < Game_Character
  4655.       include XAS_DamageStop
  4656. end
  4657.  
  4658. #===============================================================================
  4659. # ■ Game_Event
  4660. #===============================================================================
  4661. class Game_Event < Game_Character
  4662.       include XAS_DamageStop
  4663. end
  4664.  
  4665.  
  4666.  
  4667. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4668. #■ BATTLER - TOUCH EFFECT
  4669. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4670.  
  4671.  
  4672. #===============================================================================
  4673. # ■ XRXS_BattlerAttachment
  4674. #==============================================================================
  4675. module XRXS_BattlerAttachment
  4676.  
  4677.   #--------------------------------------------------------------------------
  4678.   # ● Attack Effect
  4679.   #--------------------------------------------------------------------------    
  4680.   def attack_effect(attacker)
  4681.       return false unless $game_system.xas_battle    
  4682.       return if self.battler == nil or attacker == nil
  4683.       return unless can_attack_effect?(attacker)
  4684.       if target_shield_enabled?(attacker, nil, nil)
  4685.          execute_guard_effect(attacker, nil, nil, 30)
  4686.          return
  4687.       end  
  4688.       execute_attack_effect(attacker)
  4689.  end
  4690.    
  4691.  #--------------------------------------------------------------------------
  4692.  # ● Can Attack Effect
  4693.  #--------------------------------------------------------------------------    
  4694.  def can_attack_effect?(attacker)
  4695.      return false if self.can_update == false
  4696.      return false if @knock_back_duration != nil
  4697.      return false if attacker.stop
  4698.      return false if self.battler.invunerable
  4699.      return false if self.battler.invunerable_duration > 0
  4700.      return false if self.action != nil and self.action.user_invincible
  4701.      return false if seal_attack?(attacker.battler)    
  4702.      return false if target_state_invunerable?(30)
  4703.      return true
  4704.  end  
  4705.  
  4706.  #--------------------------------------------------------------------------
  4707.  # ● Attack Target Shield
  4708.  #--------------------------------------------------------------------------    
  4709.  def attack_target_shield?(attacker)
  4710.      return false if attacker.battler.ignore_shield  
  4711.      return false unless self.battler.shield
  4712.      return true if face_direction?(attacker)
  4713.      return false
  4714.  end  
  4715.  
  4716.  #--------------------------------------------------------------------------
  4717.  # ● Seal Attack?
  4718.  #--------------------------------------------------------------------------              
  4719.  def seal_attack?(attacker)
  4720.      if attacker.state_seal_attack or attacker.state_mute
  4721.         attacker.damage = XAS_WORD::SEAL
  4722.         attacker.damage_pop = true
  4723.         self.battler.invunerable_duration = 30
  4724.         return true
  4725.      end
  4726.      return false
  4727.  end  
  4728.  
  4729.  #--------------------------------------------------------------------------
  4730.  # ● Execute Attack Damage
  4731.  #--------------------------------------------------------------------------      
  4732.  def execute_attack_damage(attacker)
  4733.      #if self.battler.agi > (rand(attacker.battler.agi) * 2)
  4734.      #   self.battler.result.missed = true
  4735.      #   return
  4736.      #end
  4737.      damage = ((attacker.battler.atk * 4) - (self.battler.def * 2)).truncate
  4738.      damage = 0 if damage < 0
  4739.      self.battler.result.hp_damage = damage
  4740.      #self.battler.result.critical  
  4741.      self.battler.hp -= damage.abs
  4742.  end
  4743.  
  4744.  #--------------------------------------------------------------------------
  4745.  # ● Execute Attack Effect
  4746.  #--------------------------------------------------------------------------      
  4747.  def execute_attack_effect(attacker)
  4748.      execute_attack_effect_before_damage(attacker)
  4749.      execute_attack_damage(attacker)
  4750.      if target_missed?(attacker)
  4751.         self.battler.invunerable_duration = 30
  4752.         return
  4753.      end
  4754.      execute_damage_pop(attacker)
  4755.      execute_attack_effect_after_damage(attacker) if can_check_after_attack_effect?(attacker)  
  4756.      execute_state_effect(nil, attacker, nil)    
  4757.      self.battler.invunerable_duration = 20 + XAS_BA::DEFAULT_KNOCK_BACK_DURATION
  4758.      if attacker.battler.attack_animation_id != 0
  4759.         self.animation_id = attacker.battler.attack_animation_id
  4760.      end  
  4761.      if self.battler.damage.to_i > 0
  4762.         self.blow(attacker.direction, 1) if can_blow_effect?
  4763.      end
  4764.      if self.is_a?(Game_Player)
  4765.         self.need_refresh = true
  4766.      end
  4767.  end  
  4768.      
  4769.  #--------------------------------------------------------------------------
  4770.  # ● Can Check After Attack Effect?  
  4771.  #--------------------------------------------------------------------------        
  4772.  def can_check_after_attack_effect?(attacker)  
  4773.      return false unless self.battler.damage.is_a?(Numeric)
  4774.      return true
  4775.  end
  4776.  
  4777.  #--------------------------------------------------------------------------
  4778.  # ● Execute Attack Effect Before Damage
  4779.  #--------------------------------------------------------------------------      
  4780.  def execute_attack_effect_before_damage(attacker)
  4781.  
  4782.  end
  4783.  
  4784.  #--------------------------------------------------------------------------
  4785.  # ● Execute Attack Effect After Damage
  4786.  #--------------------------------------------------------------------------      
  4787.  def execute_attack_effect_after_damage(attacker)
  4788.  
  4789.  end
  4790.  
  4791. end
  4792.  
  4793. #===============================================================================
  4794. # ■ Game Player
  4795. #===============================================================================
  4796. class Game_Player < Game_Character  
  4797.   #--------------------------------------------------------------------------
  4798.   # ● Check Event Trigger Touch
  4799.   #--------------------------------------------------------------------------            
  4800.   alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  4801.   def check_event_trigger_touch(x, y)
  4802.       xrxs64c_check_event_trigger_touch(x, y)
  4803.       if $game_map.interpreter.running?
  4804.          return
  4805.       end
  4806.       for event in $game_map.events.values
  4807.           next unless event.collision_attack
  4808.           unless [1,2].include?(event.trigger)
  4809.              if event.battler != nil and event.x == x and event.y == y
  4810.                 $game_player.attack_effect(event)
  4811.              end
  4812.           end
  4813.       end
  4814.   end
  4815. end
  4816.  
  4817. #===============================================================================
  4818. # ■ Game Event
  4819. #===============================================================================
  4820. class Game_Event < Game_Character
  4821.  
  4822.   #--------------------------------------------------------------------------
  4823.   # ● Check Event Trigger Touch
  4824.   #--------------------------------------------------------------------------            
  4825.   alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  4826.   def check_event_trigger_touch(x, y)
  4827.     xrxs64c_check_event_trigger_touch(x, y)
  4828.     if $game_map.interpreter.running?
  4829.        return
  4830.     end
  4831.     return unless self.collision_attack
  4832.     if self.battler != nil and x == $game_player.x and y == $game_player.y
  4833.        $game_player.attack_effect(self)
  4834.     end
  4835.   end
  4836. end
  4837.  
  4838.  
  4839.  
  4840. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4841. #■ BATTLER - MOVE SPEED
  4842. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4843.  
  4844.  
  4845. #==============================================================================
  4846. # ■ Game_Character
  4847. #==============================================================================
  4848. class Game_Character < Game_CharacterBase
  4849.  
  4850.   include XAS_BA
  4851.   attr_accessor :base_move_speed
  4852.   attr_accessor :dash_move_speed
  4853.   attr_accessor :move_speed
  4854.  
  4855.  #--------------------------------------------------------------------------
  4856.  # ● Initialize
  4857.  #--------------------------------------------------------------------------  
  4858.   alias x_move_speed_initialize initialize
  4859.   def initialize
  4860.       @base_move_speed = BASE_MOVE_SPEED
  4861.       @dash_move_speed = 0
  4862.       x_move_speed_initialize
  4863.   end  
  4864.  
  4865.  #--------------------------------------------------------------------------
  4866.  # ● update_battler_move_speed
  4867.  #--------------------------------------------------------------------------
  4868.   def update_battler_move_speed
  4869.       @dash_move_speed = @dash_active ? DASH_MOVE_SPEED : 0
  4870.       sp1 = @base_move_speed
  4871.       sp2 = @dash_move_speed
  4872.       sp3 = self.battler.state_move_speed
  4873.       @move_speed = (sp1 + sp2 + sp3)
  4874.   end
  4875.  
  4876.  #--------------------------------------------------------------------------
  4877.  # ● Update Animation
  4878.  #--------------------------------------------------------------------------      
  4879.   def update_animation
  4880.       super
  4881.       update_force_move_routine_move
  4882.   end
  4883.    
  4884.  #--------------------------------------------------------------------------
  4885.  # ● Update Force Move Routine Move
  4886.  #--------------------------------------------------------------------------        
  4887.   def update_force_move_routine_move
  4888.       return if @force_action == ""
  4889.       return if @move_route == nil
  4890.       command = @move_route.list[@move_route_index]
  4891.       return if command == nil
  4892.       if command.code == ROUTE_PLAY_SE    
  4893.          params = command.parameters
  4894.          params[0].play
  4895.          advance_move_route_index
  4896.       end  
  4897.   end
  4898.  
  4899.  #--------------------------------------------------------------------------
  4900.  # ● Update Routine Move
  4901.  #--------------------------------------------------------------------------      
  4902.  alias x_update_routine_move update_routine_move
  4903.  def update_routine_move
  4904.      return if @force_action_times > 0
  4905.      x_update_routine_move
  4906.  end
  4907.  
  4908.  #--------------------------------------------------------------------------
  4909.  # ● Can Cancel Move Type Custom
  4910.  #--------------------------------------------------------------------------    
  4911.   alias x_move_speed_process_move_command process_move_command
  4912.   def process_move_command(command)
  4913.       return if can_cancel_move_type_custom?(command)
  4914.       params = command.parameters
  4915.       x_move_speed_process_move_command(command)
  4916.       if command.code == ROUTE_CHANGE_SPEED and @battler != nil and
  4917.          self.is_a?(Game_Event)
  4918.          @base_move_speed = params[0]
  4919.       end        
  4920.   end
  4921.  
  4922.  #--------------------------------------------------------------------------
  4923.  # ● Can Cancel Move Type Custom
  4924.  #--------------------------------------------------------------------------    
  4925.   def can_cancel_move_type_custom?(command)
  4926.       return true if command == nil
  4927.       return true if @force_action_times > 0
  4928.       return false
  4929.   end  
  4930.  
  4931. end  
  4932.  
  4933.  
  4934. #==============================================================================
  4935. # ■ Game_Event
  4936. #==============================================================================
  4937. class Game_Event < Game_Character  
  4938.  
  4939.  #--------------------------------------------------------------------------
  4940.  # ● Initialize
  4941.  #--------------------------------------------------------------------------              
  4942.  alias x_move_speed_event_initialize initialize
  4943.  def initialize(map_id, event)
  4944.      x_move_speed_event_initialize(map_id, event)
  4945.      refresh_move_speed
  4946.  end  
  4947.  
  4948.   #--------------------------------------------------------------------------
  4949.   # ● Refresh Move Speed
  4950.   #--------------------------------------------------------------------------
  4951.   def refresh_move_speed
  4952.       return if @page == nil
  4953.       @base_move_speed = @page.move_speed
  4954.   end
  4955.  
  4956.  #--------------------------------------------------------------------------
  4957.  # ● Setup Page
  4958.  #--------------------------------------------------------------------------              
  4959.  alias x_move_speed_setup_page setup_page
  4960.  def setup_page(new_page)
  4961.      x_move_speed_setup_page(new_page)
  4962.      refresh_move_speed
  4963.  end
  4964.  
  4965. end
  4966.  
  4967.  
  4968. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4969. #■ BATTLER - STATES
  4970. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4971.  
  4972.  
  4973. #==============================================================================
  4974. # ■ Game_Battler
  4975. #==============================================================================
  4976. class Game_Battler
  4977.  
  4978.   attr_accessor :state_move_speed
  4979.   attr_accessor :state_stop
  4980.   attr_accessor :state_loop_effect_time
  4981.   attr_accessor :state_loop_speed
  4982.   attr_accessor :state_duration
  4983.   attr_accessor :state_string
  4984.   attr_accessor :state_string_time
  4985.   attr_accessor :state_stop
  4986.   attr_accessor :state_slow
  4987.   attr_accessor :state_sleep
  4988.   attr_accessor :state_invunerable
  4989.   attr_accessor :state_fast
  4990.   attr_accessor :state_mute
  4991.   attr_accessor :state_seal_attack
  4992.   attr_accessor :state_seal_skill
  4993.   attr_accessor :state_seal_item
  4994.   attr_accessor :state_reflect
  4995.  
  4996.  #--------------------------------------------------------------------------
  4997.  # ● Initialize
  4998.  #--------------------------------------------------------------------------  
  4999.   alias x_state_initialize initialize
  5000.   def initialize
  5001.       @state_move_speed = 0
  5002.       @state_duration = []
  5003.       @state_loop_effect_time = []
  5004.       @state_loop_speed = []
  5005.       @state_string = ""
  5006.       @state_string_time = 0
  5007.       @state_stop = false
  5008.       @state_sleep = false
  5009.       @state_invunerable = false
  5010.       @state_slow = false
  5011.       @state_fast = false
  5012.       @state_mute = false
  5013.       @state_seal_attack = false
  5014.       @state_seal_skill = false
  5015.       @state_seal_item = false
  5016.       @state_reflect = false
  5017.       x_state_initialize
  5018.   end
  5019.    
  5020.  #--------------------------------------------------------------------------
  5021.  # ● Add State
  5022.  #--------------------------------------------------------------------------    
  5023.   alias x_add_state add_state
  5024.   def add_state(state_id)
  5025.       unless @states.include?(state_id)
  5026.           state = $data_states[state_id]
  5027.           xas_add_state(state)
  5028.       end        
  5029.       x_add_state(state_id)
  5030.   end
  5031.  
  5032.  #--------------------------------------------------------------------------
  5033.  # ● Xas Add State
  5034.  #--------------------------------------------------------------------------      
  5035.   def xas_add_state(state)
  5036.       @state_duration[state.id] = 60 * $data_states[state.id].min_turns
  5037.       @state_loop_effect_time[state.id] = 0
  5038.       @state_loop_speed[state.id] = $data_states[state.id].max_turns
  5039.       execute_damage_state(state,0)
  5040.   end      
  5041.  
  5042.  #--------------------------------------------------------------------------
  5043.  # ● Remove State
  5044.  #--------------------------------------------------------------------------        
  5045.   alias x_remove_state remove_state
  5046.   def remove_state(state_id)
  5047.       if state?(state_id)
  5048.          state = $data_states[state_id]
  5049.          xas_remove_state(state)
  5050.       end  
  5051.       x_remove_state(state_id)      
  5052.   end    
  5053.    
  5054.  #--------------------------------------------------------------------------
  5055.  # ● XAS Remove State
  5056.  #--------------------------------------------------------------------------        
  5057.   def xas_remove_state(state)
  5058.       @state_duration.delete(state.id)  
  5059.       @state_loop_effect_time.delete(state.id)  
  5060.       @state_loop_speed.delete(state.id)
  5061.       execute_damage_state(state,1)
  5062.   end  
  5063.  
  5064.  #--------------------------------------------------------------------------
  5065.  # ● Execute_Damage_State
  5066.  #--------------------------------------------------------------------------          
  5067.   def execute_damage_state(state,type)
  5068.       return unless XAS_DAMAGE_POP::DAMAGE_STATE_POP
  5069.       return unless XAS_WORD::ENABLE_WORD
  5070.       return if state == nil or state.id == 1
  5071.       case type
  5072.          when 0
  5073.              damage = "+ " + state.name.to_s
  5074.          when 1  
  5075.              damage = "- " + state.name.to_s
  5076.       end
  5077.       @state_string = damage
  5078.       @state_string_time = 30            
  5079.   end  
  5080.  
  5081. end
  5082.  
  5083. #==============================================================================
  5084. # ■ Game_Character
  5085. #==============================================================================
  5086. class Game_Character < Game_CharacterBase
  5087.  
  5088.  #--------------------------------------------------------------------------
  5089.  # ● Update Battler States Effect
  5090.  #--------------------------------------------------------------------------    
  5091.  def update_battler_states_effect
  5092.      return unless XAS_SYSTEM::STATE_SYSTEM
  5093.      update_state_string_pop
  5094.      update_pre_state_setup
  5095.      return unless can_update_states_effect?
  5096.      for i in self.battler.states
  5097.          state = $data_states[i.id]  
  5098.          if state == nil or self.battler.state_duration[state.id] == nil or
  5099.             self.battler.state_loop_effect_time[state.id] == nil or
  5100.             self.battler.state_loop_speed[state.id] == nil
  5101.             self.battler.remove_state(state.id)
  5102.             next
  5103.             return
  5104.          end  
  5105.          update_state_abs_effects(state)
  5106.          update_state_loop(state)
  5107.          update_remove_state(state)
  5108.      end  
  5109.        
  5110.  end  
  5111.  
  5112.  #--------------------------------------------------------------------------
  5113.  # ● Update Pre State Setup
  5114.  #--------------------------------------------------------------------------      
  5115.  def update_pre_state_setup
  5116.      self.battler.state_stop = false
  5117.      self.battler.state_slow = false
  5118.      self.battler.state_fast = false
  5119.      self.battler.state_mute = false
  5120.      self.battler.state_sleep = false
  5121.      self.battler.state_invunerable = false
  5122.      self.battler.state_seal_attack = false
  5123.      self.battler.state_seal_skill = false
  5124.      self.battler.state_seal_item = false
  5125.      self.battler.state_reflect = false
  5126.      self.battler.state_move_speed = 0
  5127.  end  
  5128.  
  5129.  #--------------------------------------------------------------------------
  5130.  # ● Update Pre State Setup
  5131.  #--------------------------------------------------------------------------        
  5132.  def update_state_abs_effects(state)
  5133.      if state.note =~ /<Stop>/
  5134.         self.battler.state_stop = true
  5135.      end
  5136.      if state.note =~ /<Slow>/
  5137.         self.battler.state_slow = true
  5138.         self.battler.state_move_speed = -1.5
  5139.      end  
  5140.      if state.note =~ /<Fast>/  
  5141.         self.battler.state_fast = true
  5142.         self.battler.state_move_speed = 1    
  5143.      end
  5144.      if self.battler.state_fast and
  5145.         self.battler.state_slow
  5146.         self.battler.state_move_speed = 0
  5147.      end
  5148.      if state.note =~ /<Mute>/  
  5149.         self.battler.state_mute = true
  5150.      end
  5151.      if state.note =~ /<Sleep>/  
  5152.         self.battler.state_sleep = true
  5153.      end
  5154.      if state.note =~ /<Invincible>/  
  5155.         self.battler.state_invunerable = true
  5156.      end  
  5157.      if state.note =~ /<Seal Attack>/  
  5158.         self.battler.state_seal_attack = true
  5159.      end
  5160.      if state.note =~ /<Seal Skill>/  
  5161.         self.battler.state_seal_skill = true
  5162.      end      
  5163.      if state.note =~ /<Seal Item>/  
  5164.         self.battler.state_seal_item = true
  5165.       end
  5166.      if state.note =~ /<Reflect>/
  5167.         self.battler.state_reflect = true
  5168.      end        
  5169.  end
  5170.  
  5171.  #--------------------------------------------------------------------------
  5172.  # ● Update State Loop
  5173.  #--------------------------------------------------------------------------      
  5174.  def update_state_loop(state)
  5175.      self.battler.state_loop_effect_time[state.id] += 1
  5176.      if self.battler.state_loop_effect_time[state.id] > self.battler.state_loop_speed[state.id]
  5177.         self.battler.state_loop_effect_time[state.id] = 0
  5178.         if state.note =~ /<Animation ID = (\d+)>/
  5179.            state_anime = $1.to_i
  5180.            if state_anime != nil
  5181.               self.animation_id = state_anime
  5182.            end
  5183.         end    
  5184.         execute_states_effects(state)          
  5185.      end          
  5186.  end
  5187.  
  5188.  #--------------------------------------------------------------------------
  5189.  # ● Execute States Effect
  5190.  #--------------------------------------------------------------------------      
  5191.  def execute_states_effects(state)        
  5192.      if state.note =~ /<Slip Damage = (\S+)>/
  5193.         execute_state_slip_damage($1.to_i)
  5194.      end  
  5195.  end
  5196.  
  5197.  #--------------------------------------------------------------------------
  5198.  # ● Execute States Slip Damage
  5199.  #--------------------------------------------------------------------------        
  5200.  def execute_state_slip_damage(damage)
  5201.      damage = 1 if damage == nil
  5202.      damage_slip = self.battler.mhp * damage / 100
  5203.      self.battler.hp -= damage_slip
  5204.      self.battler.damage = damage_slip
  5205.      self.battler.damage_pop = true
  5206.  end
  5207.  
  5208.  #--------------------------------------------------------------------------
  5209.  # ● Update Remove State
  5210.  #--------------------------------------------------------------------------      
  5211.  def update_remove_state(state)
  5212.      self.battler.state_duration[state.id] -= 1
  5213.      if self.battler.state_duration[state.id] <= 0    
  5214.         self.battler.remove_state(state.id)
  5215.      end          
  5216.  end
  5217.  
  5218.  #--------------------------------------------------------------------------
  5219.  # ● Can Update States Effect
  5220.  #--------------------------------------------------------------------------      
  5221.   def can_update_states_effect?
  5222.       return false if self.dead?
  5223.       return false if self.battler.states == nil
  5224.       return false if self.battler.states.size == 0
  5225.       return false if self.battler.state_duration == []
  5226.       return true
  5227.   end
  5228.  
  5229.  #--------------------------------------------------------------------------
  5230.  # ● Update State String Pop
  5231.  #--------------------------------------------------------------------------      
  5232.   def update_state_string_pop
  5233.       return false if self.battler.state_string_time == 0
  5234.       self.battler.state_string_time -= 1
  5235.       if self.battler.state_string_time == 0
  5236.          self.battler.damage = self.battler.state_string
  5237.          self.battler.damage_pop = true
  5238.          self.battler.state_string = ""
  5239.       end  
  5240.   end  
  5241. end  
  5242.  
  5243. #==============================================================================
  5244. # ■ Game_Party
  5245. #==============================================================================
  5246. class Game_Party < Game_Unit
  5247.  
  5248.  #--------------------------------------------------------------------------
  5249.  # ● On Player Walk
  5250.  #--------------------------------------------------------------------------        
  5251.  alias x_state_on_player_walk on_player_walk
  5252.  def on_player_walk
  5253.      return if XAS_SYSTEM::STATE_SYSTEM
  5254.      x_state_on_player_walk
  5255.  end
  5256.  
  5257. end
  5258.  
  5259.  
  5260.  
  5261. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5262. #■ BATTLER - EVENT COMMANDS
  5263. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5264.  
  5265.  
  5266. #===============================================================================
  5267. # ■ Game Event
  5268. #===============================================================================
  5269. class Game_Event < Game_Character
  5270.  
  5271.   #--------------------------------------------------------------------------
  5272.   # ● Shoot Chance
  5273.   #--------------------------------------------------------------------------            
  5274.   def shoot_chance(action_id,perc)
  5275.       return if self.battler == nil
  5276.       if perc >= rand(100)
  5277.          shoot(action_id)
  5278.       end  
  5279.   end  
  5280.  
  5281.   #--------------------------------------------------------------------------
  5282.   # ● Guard
  5283.   #--------------------------------------------------------------------------          
  5284.   def guard(enable)
  5285.       return if self.battler == nil
  5286.       self.battler.guard = enable
  5287.   end  
  5288.  
  5289.   #--------------------------------------------------------------------------
  5290.   # ● Touch Attack
  5291.   #--------------------------------------------------------------------------            
  5292.   def touch_attack(enable)
  5293.       return if self.battler == nil        
  5294.       return if seal_attack?(self.battler)
  5295.       @collision_attack = enable
  5296.       @pattern = 0
  5297.       @pattern_count  = 0      
  5298.   end
  5299.  
  5300.   #--------------------------------------------------------------------------
  5301.   # ● Counter
  5302.   #--------------------------------------------------------------------------            
  5303.   def counter(enable)
  5304.       return if self.battler == nil
  5305.       self.battler.counter_action[2] = enable
  5306.   end    
  5307.  
  5308.   #--------------------------------------------------------------------------
  5309.   # ● Rand Shoot
  5310.   #--------------------------------------------------------------------------            
  5311.   def rand_shoot(random_id = [])
  5312.       return if self.battler == nil
  5313.       return if random_id == []
  5314.       action_id = random_id[rand(random_id.size)]
  5315.       self.shoot(action_id)
  5316.   end      
  5317.  
  5318. end
  5319.  
  5320.  
  5321.  
  5322. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5323. #■ BATTLER - DEFEAT PROCESS
  5324. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5325.  
  5326. #===============================================================================
  5327. # ■ Scene Base
  5328. #===============================================================================
  5329. class Scene_Base  
  5330.  
  5331.   #--------------------------------------------------------------------------
  5332.   # ● Check Gameover
  5333.   #--------------------------------------------------------------------------              
  5334.   def check_gameover
  5335.       return unless $game_party.in_battle  
  5336.       SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
  5337.   end
  5338. end  
  5339.  
  5340. #===============================================================================
  5341. # ■ Game Character
  5342. #===============================================================================
  5343. class Game_Character < Game_CharacterBase
  5344.   attr_accessor :collapse_duration
  5345.   attr_accessor :battler_visible
  5346.   attr_writer   :opacity
  5347.  
  5348.   #--------------------------------------------------------------------------
  5349.   # ● Initialize
  5350.   #--------------------------------------------------------------------------            
  5351.   alias x_collapse_initialize initialize
  5352.   def initialize
  5353.       @collapse_duration = 0
  5354.       x_collapse_initialize
  5355.   end  
  5356.  
  5357. end
  5358.  
  5359. #===============================================================================
  5360. # ■ XAS_BA_BATTLEEVENT_NONPREEMPT
  5361. #==============================================================================
  5362. module XAS_BA_BATTLEEVENT_NONPREEMPT
  5363.  
  5364.   #--------------------------------------------------------------------------
  5365.   # ● Update
  5366.   #--------------------------------------------------------------------------            
  5367.   def update
  5368.       return if self.battler != nil and $game_map.interpreter.running?
  5369.       super
  5370.   end
  5371. end
  5372.  
  5373. #===============================================================================
  5374. # ■ Game Event
  5375. #==============================================================================
  5376. class Game_Event < Game_Character
  5377.       include XAS_BA_BATTLEEVENT_NONPREEMPT
  5378. end
  5379.  
  5380. #===============================================================================
  5381. # ■ Game Character
  5382. #===============================================================================
  5383. class Game_Character < Game_CharacterBase
  5384.  
  5385.   #--------------------------------------------------------------------------
  5386.   # ● Update Battler Defeat Process
  5387.   #--------------------------------------------------------------------------      
  5388.    def update_battler_defeat_process
  5389.        execute_enemy_defeated_process if can_check_enemy_defeated?
  5390.        execute_actor_defeated_process if can_check_actor_defeated?
  5391.    end
  5392.    
  5393.   #--------------------------------------------------------------------------
  5394.   # ● Can Check Enemy Defeated?
  5395.   #--------------------------------------------------------------------------            
  5396.   def can_check_enemy_defeated?  
  5397.       return false if self.battler.is_a?(Game_Actor)
  5398.       return false if self.battler.defeated
  5399.       return true
  5400.   end    
  5401.  
  5402.   #--------------------------------------------------------------------------
  5403.   # ● Can Check Actor Defeated?
  5404.   #--------------------------------------------------------------------------              
  5405.   def can_check_actor_defeated?
  5406.       return false if self.battler.is_a?(Game_Enemy)
  5407.       return false if self.battler.defeated
  5408.       return false if $game_party.members[0].hp > 0
  5409.       return false if @collapse_duration > 0
  5410.       return true  
  5411.   end
  5412.  
  5413.   #--------------------------------------------------------------------------
  5414.   # ● Execute Actor Defeated Process
  5415.   #--------------------------------------------------------------------------                
  5416.   def execute_actor_defeated_process
  5417.       erase_actor_tools_on_map
  5418.       if $game_party.all_dead? and not self.battler.defeated
  5419.          self.battler.defeated = true
  5420.          self.collapse_duration = 120
  5421.          self.knock_back_duration = 161
  5422.          reset_battler_temp
  5423.       else  
  5424.          $game_temp.change_leader_wait_time = 0
  5425.          $game_player.change_leader
  5426.       end  
  5427.   end
  5428.  
  5429.   #--------------------------------------------------------------------------
  5430.   # ● Erase Tools on Map
  5431.   #--------------------------------------------------------------------------                  
  5432.   def erase_actor_tools_on_map
  5433.       for event in $game_map.events.values
  5434.           if event.tool_id > 0 and event.action.user.is_a?(Game_Player)
  5435.              event.erase
  5436.           end  
  5437.       end  
  5438.   end
  5439.  
  5440.   #--------------------------------------------------------------------------
  5441.   # ● Execute Enemy Defeaed Process
  5442.   #--------------------------------------------------------------------------        
  5443.    def execute_enemy_defeated_process
  5444.        self.battler.defeated = true
  5445.        self.through = true
  5446.        @knock_back_duration = 121
  5447.        enemy = $data_enemies[self.battler.enemy_id]
  5448.        @collapse_duration = 120
  5449.        execute_gain_exp_gold(enemy)  
  5450.        execute_active_switch(enemy)
  5451.        execute_defeated_animation(enemy)
  5452.        execute_defeated_sound_effect(enemy)
  5453.        execute_final_shoot(enemy)
  5454.    end    
  5455.  
  5456.   #--------------------------------------------------------------------------
  5457.   # ● Execute Defeated Sound Effect
  5458.   #--------------------------------------------------------------------------              
  5459.   def execute_defeated_sound_effect(enemy)
  5460.       return if self.battler.no_damage_pop
  5461.       Sound.play_enemy_collapse  
  5462.   end
  5463.  
  5464.   #--------------------------------------------------------------------------
  5465.   # ● Execute Final Shoot
  5466.   #--------------------------------------------------------------------------            
  5467.   def execute_final_shoot(enemy)
  5468.       enemy.note  =~ /<Final Action ID = (\d+)>/
  5469.       action_id = $1.to_i
  5470.       return if action_id == nil
  5471.       self.shoot(action_id)      
  5472.   end  
  5473.  
  5474.   #--------------------------------------------------------------------------
  5475.   # ● Execute Gain Exp Gold
  5476.   #--------------------------------------------------------------------------          
  5477.   def execute_gain_exp_gold(enemy)  
  5478.       exp = self.battler.exp
  5479.       case XAS_BA::EXP_TYPE
  5480.          when 0
  5481.             actor = $game_party.members[0]
  5482.             actor.gain_exp(exp)
  5483.          when 1
  5484.             for i in 0...$game_party.members.size
  5485.                actor = $game_party.members[i]          
  5486.                actor.gain_exp(exp)
  5487.             end  
  5488.          when 2  
  5489.             exp = exp / $game_party.members.size
  5490.             for i in 0...$game_party.members.size
  5491.                actor = $game_party.members[i]          
  5492.                actor.gain_exp(exp)
  5493.             end              
  5494.       end
  5495.       $game_party.gain_gold(self.battler.gold)
  5496.   end  
  5497.  
  5498.   #--------------------------------------------------------------------------
  5499.   # ● Execute_Active Switch
  5500.   #--------------------------------------------------------------------------          
  5501.   def execute_active_switch(enemy)        
  5502.       enemy.note  =~ /<Active Switch = (\d+)>/      
  5503.       switch_id = $1.to_i  
  5504.       if switch_id != nil
  5505.          $game_switches[switch_id] = true
  5506.          $game_map.need_refresh = true    
  5507.       end
  5508.   end
  5509.  
  5510.   #--------------------------------------------------------------------------
  5511.   # ● Execute Defeated Animation
  5512.   #--------------------------------------------------------------------------            
  5513.   def execute_defeated_animation(enemy)
  5514.       enemy.note  =~ /<Defeated Animation = (\d+)>/      
  5515.       anime_id = $1.to_i      
  5516.       if anime_id != nil
  5517.          self.animation_id = anime_id
  5518.       end  
  5519.   end  
  5520.  
  5521. end  
  5522.  
  5523. #===============================================================================
  5524. # ■ Game Player
  5525. #===============================================================================
  5526. class Game_Player < Game_Character
  5527.  
  5528.   #--------------------------------------------------------------------------
  5529.   # ● Reset Old Level
  5530.   #--------------------------------------------------------------------------            
  5531.   def reset_old_level(trans = false)
  5532.      for actor in $game_party.members
  5533.          actor.old_level = actor.level
  5534.      end    
  5535.   end
  5536.  
  5537.   #--------------------------------------------------------------------------
  5538.   # ● Change Leader
  5539.   #--------------------------------------------------------------------------                  
  5540.   def change_leader
  5541.       return if $game_party.members.size <= 1
  5542.       reset_battler_temp
  5543.       current_leader_id = $game_party.members[0].id
  5544.       for i in 1..$game_party.members.size
  5545.           pre_leader = $game_party.members[0].id
  5546.           $game_party.remove_actor(pre_leader)
  5547.           $game_party.add_actor(pre_leader)  
  5548.           if $game_party.members[0].hp > 0
  5549.              execute_change_leader_effect unless current_leader_id == $game_party.members[0].id
  5550.              break
  5551.           end
  5552.       end
  5553.   end  
  5554.  
  5555.   #--------------------------------------------------------------------------
  5556.   # ● Exeute Change leader Effect
  5557.   #--------------------------------------------------------------------------                    
  5558.   def execute_change_leader_effect
  5559.       actor = $game_party.members[0]
  5560.       actor.invunerable_duration = XAS_BA::CHANGE_LEADER_WAIT_TIME
  5561.       actor.damage = nil
  5562.       actor.damage_pop = false
  5563.       actor.critical = false
  5564.       @knock_back_duration = nil
  5565.       if self.action != nil
  5566.          self.action.duration = 1
  5567.       end
  5568.       @force_action_times = 0
  5569.       @force_action_type = ""        
  5570.       reset_old_level(true)
  5571.       @x_pose_original_name = @character_name
  5572.       update_battler_pose
  5573.       $game_map.need_refresh = true
  5574.       self.animation_id = XAS_ANIMATION::CHANGE_LEADER_ANIMATION_ID
  5575.       $game_temp.change_leader_wait_time = XAS_BA::CHANGE_LEADER_WAIT_TIME  
  5576.   end
  5577.  
  5578.   #--------------------------------------------------------------------------
  5579.   # ● Check Actor Level
  5580.   #--------------------------------------------------------------------------          
  5581.   def check_actor_level
  5582.       return if $game_party.in_battle
  5583.       return if self.battler == nil
  5584.       return if self.battler.old_level == self.battler.level
  5585.       reset_old_level(false)
  5586.       if self.battler.level > 1
  5587.          Audio.se_play("Audio/SE/" + XAS_SOUND::LEVEL_UP , 100, 100)
  5588.          if XAS_WORD::ENABLE_WORD
  5589.             $game_player.battler.damage = XAS_WORD::LEVEL_UP
  5590.             $game_player.battler.damage_pop = true
  5591.          end
  5592.       end
  5593.       $game_player.need_refresh = true
  5594.   end
  5595. end  
  5596.  
  5597. #===============================================================================
  5598. # ■ Game Party
  5599. #===============================================================================
  5600. class Game_Party < Game_Unit
  5601.  
  5602.  #--------------------------------------------------------------------------
  5603.  # ● Setup Starting Members  
  5604.  #--------------------------------------------------------------------------      
  5605.   alias x_old_level_setup_starting_members setup_starting_members  
  5606.   def setup_starting_members  
  5607.       x_old_level_setup_starting_members    
  5608.       for actor in $game_party.members
  5609.           actor.old_level = actor.level
  5610.       end
  5611.   end
  5612.  
  5613. end
  5614.  
  5615. #===============================================================================
  5616. # ■ Sprite Character
  5617. #==============================================================================
  5618. class Sprite_Character < Sprite_Base  
  5619.  
  5620.   #--------------------------------------------------------------------------
  5621.   # ● Update Collapse Effects
  5622.   #--------------------------------------------------------------------------            
  5623.   def update_collaspse_effects
  5624.       update_collapse_duration
  5625.       return unless can_collapse_effects?
  5626.       update_collpase_zoom_effects
  5627.       update_exp_gold_pop
  5628.   end
  5629.    
  5630.   #--------------------------------------------------------------------------
  5631.   # ● Can Collapse Effects
  5632.   #--------------------------------------------------------------------------              
  5633.   def can_collapse_effects?
  5634.       return false if @character.battler.is_a?(Game_Actor)
  5635.       return false unless @character.dead?
  5636.       return false if @character.erased    
  5637.       return true
  5638.   end  
  5639.  
  5640.   #--------------------------------------------------------------------------
  5641.   # ● Update Exp Gold Pop
  5642.   #--------------------------------------------------------------------------              
  5643.   def update_exp_gold_pop
  5644.       return unless XAS_DAMAGE_POP::DAMAGE_EXP_GOLD_POP
  5645.       exp_pop = @character.battler.exp
  5646.       gold_pop =@character.battler.gold
  5647.       case @character.collapse_duration
  5648.            when 110
  5649.                 enemy = $data_enemies[@character.battler.enemy_id]
  5650.                 @character.make_treasure(enemy)      
  5651.            when 80
  5652.              if exp_pop != 0
  5653.                 word = XAS_WORD::EXP
  5654.                 @character.battler.damage = word + " " + exp_pop.to_s
  5655.                 @character.battler.damage_pop = true
  5656.                 @character.battler.damage_type = "Exp"
  5657.              end  
  5658.            when 40
  5659.              if gold_pop != 0
  5660.                 word = $data_system.currency_unit
  5661.                 @character.battler.damage = word + " " + gold_pop.to_s
  5662.                 @character.battler.damage_pop = true
  5663.                 @character.battler.damage_type = "Gold"
  5664.              end              
  5665.       end      
  5666.   end
  5667.  
  5668.   #--------------------------------------------------------------------------
  5669.   # ● Update Collapse Duration
  5670.   #--------------------------------------------------------------------------              
  5671.   def update_collapse_duration
  5672.       @character.collapse_duration -= 1
  5673.       @character.opacity -= 2
  5674.       if @character.collapse_duration <= 0
  5675.          if @character.battler.is_a?(Game_Actor)
  5676.             SceneManager.goto(Scene_Gameover)
  5677.             return
  5678.          end
  5679.          self.visible = false
  5680.          @character.opacity = 0
  5681.          @character.erase
  5682.       end  
  5683.   end  
  5684.  
  5685.   #--------------------------------------------------------------------------
  5686.   # ● Update Collapse Zoom Effects
  5687.   #--------------------------------------------------------------------------                
  5688.   def update_collpase_zoom_effects
  5689.       case @character.battler.death_zoom_effect
  5690.           when 1
  5691.              @character.zoom_y += 0.05
  5692.              @character.zoom_x -= 0.01            
  5693.           when 2  
  5694.              @character.zoom_y -= 0.01
  5695.              @character.zoom_x += 0.03            
  5696.           when 3  
  5697.              @character.zoom_y += 0.03
  5698.              @character.zoom_x += 0.03              
  5699.           when 4  
  5700.              @character.zoom_y -= 0.005
  5701.              @character.zoom_x -= 0.005
  5702.           when 5  
  5703.             case @character.collapse_duration
  5704.                 when 60..120
  5705.                  @character.zoom_y -= 0.01
  5706.                  @character.zoom_x += 0.06                            
  5707.                 when 0..59  
  5708.                  @character.zoom_y += 0.2
  5709.                  @character.zoom_x -= 0.1
  5710.              end
  5711.       end
  5712.   end  
  5713.  
  5714. end
  5715.  
  5716.  
  5717.  
  5718. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5719. #■ BATTLER - TREASURE
  5720. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5721.  
  5722.  
  5723. #===============================================================================
  5724. # ■ XAS_BA_Item_Drop
  5725. #==============================================================================
  5726. module XAS_BA_ItemDrop
  5727.  
  5728.   #--------------------------------------------------------------------------
  5729.   # ● Defeat Process
  5730.   #--------------------------------------------------------------------------              
  5731.   def make_treasure(enemy)  
  5732.       treasure = nil      
  5733.       return unless $game_player.passable?(self.x,self.y,0)
  5734.       for di in enemy.drop_items
  5735.            next if di.kind == 0
  5736.            next if rand(di.denominator) != 0
  5737.            if di.kind == 1
  5738.               treasure = $data_items[di.data_id]
  5739.               tr_id = treasure.id
  5740.            elsif di.kind == 2
  5741.               treasure = $data_weapons[di.data_id]
  5742.               tr_id = treasure.id
  5743.            elsif di.kind == 3
  5744.               treasure = $data_armors[di.data_id]
  5745.               tr_id = treasure.id
  5746.            end
  5747.            break if treasure != nil
  5748.        end  
  5749.        if treasure != nil
  5750.           command = RPG::MoveCommand.new
  5751.           command.code = 14
  5752.           command.parameters = [0,0]
  5753.           route = RPG::MoveRoute.new
  5754.           route.repeat = false
  5755.           route.list = [command, RPG::MoveCommand.new]        
  5756.           page = RPG::Event::Page.new
  5757.           page.move_type = 3
  5758.           page.move_route = route
  5759.           page.move_frequency = 6
  5760.           page.priority_type = 1
  5761.           page.trigger = 1
  5762.           page.through = true
  5763.           event = RPG::Event.new(self.x, self.y)
  5764.           event.pages = [page]      
  5765.           event = RPG::Event.new(self.x, self.y)
  5766.           token = Token_Event.new($game_map.map_id, event)
  5767.           token.icon_name = treasure.icon_index
  5768.           token.treasure = [di.kind,tr_id]
  5769.           token.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  5770.           token.jump_high(0,0,20)
  5771.           token.force_update = true
  5772.           token.move_speed = 6
  5773.           $game_map.add_token(token)
  5774.        end  
  5775.   end  
  5776. end
  5777.  
  5778. #===============================================================================
  5779. # ■ Game Event
  5780. #===============================================================================
  5781. class Game_Event < Game_Character
  5782.   include XAS_BA_ItemDrop
  5783.  
  5784.   #--------------------------------------------------------------------------
  5785.   # ● Update Treasure Duration
  5786.   #--------------------------------------------------------------------------              
  5787.   def update_treasure_duration
  5788.       return if @treasure_time == 0
  5789.       @treasure_time -= 1
  5790.       self.erase if @treasure_time == 0
  5791.   end
  5792.  
  5793. end
  5794.  
  5795. #===============================================================================
  5796. # ■ Game Character
  5797. #==============================================================================
  5798. class Game_Character < Game_CharacterBase
  5799.   attr_accessor :icon_name
  5800.   attr_accessor :treasure
  5801. end
  5802.  
  5803. #===============================================================================
  5804. # ■ Game Character
  5805. #==============================================================================
  5806. class Sprite_Character < Sprite_Base
  5807.  
  5808.   #--------------------------------------------------------------------------
  5809.   # ● Update
  5810.   #--------------------------------------------------------------------------            
  5811.   alias xrxs_charactericon_update update
  5812.   def update
  5813.       xrxs_charactericon_update
  5814.       if @character.icon_name != nil
  5815.          self.bitmap = Cache.system("Iconset")
  5816.          self.src_rect.set(@character.icon_name  % 16 * 24, @character.icon_name / 16 * 24, 24, 24)
  5817.          self.ox = 12
  5818.          self.oy = 24
  5819.       end
  5820.   end
  5821. end
  5822.  
  5823. #===============================================================================
  5824. # ■ Game Player
  5825. #==============================================================================
  5826. class Game_Player < Game_Character
  5827.  
  5828.   #--------------------------------------------------------------------------
  5829.   # ● Check Event Trigger Here
  5830.   #--------------------------------------------------------------------------              
  5831.   alias treasure_check_event_trigger_here check_event_trigger_here
  5832.   def check_event_trigger_here(triggers)
  5833.       return false if $game_map.interpreter.running?
  5834.       check_treasure_here        
  5835.       treasure_check_event_trigger_here(triggers)
  5836.   end  
  5837.  
  5838.   #--------------------------------------------------------------------------
  5839.   # ● check_treasure_here  
  5840.   #--------------------------------------------------------------------------                
  5841.   def check_treasure_here  
  5842.      for event in $game_map.events_xy(@x, @y)
  5843.          if event.treasure != nil
  5844.             name_pop = true
  5845.             case event.treasure[0]            
  5846.             when 1
  5847.                   item = $data_items[event.treasure[1]]
  5848.                   if can_execute_field_item_effect?(item)
  5849.                      name_pop = false
  5850.                   else  
  5851.                      $game_party.gain_item(item, 1)
  5852.                   end
  5853.                   $game_map.need_refresh = true
  5854.             when 2  
  5855.                   item = $data_weapons[event.treasure[1]]
  5856.                   $game_party.gain_item($data_weapons[event.treasure[1]], 1,false)
  5857.             when 3
  5858.                   item = $data_armors[event.treasure[1]]
  5859.                   $game_party.gain_item(item, 1,false)
  5860.             end
  5861.             Audio.se_play("Audio/SE/" + XAS_SOUND::ITEM_DROP , 100, 100)  
  5862.             event.erase
  5863.             if item != nil
  5864.                 if item.note =~ /<Drop Animation = (\d+)>/
  5865.                    self.animation_id = $1.to_i
  5866.                 end
  5867.                 if XAS_DAMAGE_POP::DAMAGE_ITEM_POP and name_pop
  5868.                    self.battler.damage = item.name.to_s
  5869.                    self.battler.damage_pop = true
  5870.                    self.battler.damage_type = "Item"
  5871.                 end                      
  5872.             end
  5873.           end            
  5874.      end  
  5875.  end          
  5876.      
  5877.   #--------------------------------------------------------------------------
  5878.   # ● Can Execute Field Item Effect
  5879.   #--------------------------------------------------------------------------                  
  5880.   def can_execute_field_item_effect?(item)
  5881.       if item.note =~ /<Drop HP Damage = (\S+)>/
  5882.          damage = $1.to_i
  5883.          damage2 = damage * self.battler.mhp / 100
  5884.          self.battler.damage = damage2
  5885.          self.battler.damage_pop = true
  5886.          self.battler.hp -= damage2
  5887.          return true
  5888.       end  
  5889.       if item.note =~ /<Drop MP Damage = (\S+)>/
  5890.          damage = $1.to_i
  5891.          damage2 = damage * self.battler.mmp / 100
  5892.          self.battler.mp -= damage2        
  5893.          self.battler.damage_type = "Mp"  
  5894.          self.battler.damage = damage2
  5895.          self.battler.damage_pop = true
  5896.          return true
  5897.       end      
  5898.       if item.note =~ /<Drop Gold = (\d+)>/
  5899.          gold = $1.to_i
  5900.          damage = $data_system.terms.gold + " " + gold.to_s
  5901.          self.battler.damage = damage
  5902.          self.battler.damage_pop = true
  5903.          $game_party.gain_gold(gold)
  5904.          return true
  5905.       end
  5906.       return false  
  5907.   end  
  5908. end
  5909.  
  5910.  
  5911.  
  5912. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5913. #■ SPRITE - POSE (Character Name)
  5914. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5915.  
  5916.  
  5917. #===============================================================================
  5918. # ■ Game_Character
  5919. #===============================================================================
  5920. class Game_Character < Game_CharacterBase
  5921.  
  5922.   attr_accessor :x_pose_duration
  5923.   attr_accessor :x_pose_name
  5924.   attr_accessor :x_pose_original_name
  5925.   attr_accessor :character_name
  5926.  
  5927.   #-----------------------------------------------------------------------------
  5928.   # ● Initialize
  5929.   #-----------------------------------------------------------------------------  
  5930.   alias x_pose_initialize initialize
  5931.   def initialize
  5932.       x_pose_initialize
  5933.       @x_pose_duration = 0
  5934.       @x_pose_name = ""
  5935.       @x_pose_original_name = @character_name
  5936.   end
  5937.  
  5938.   #-----------------------------------------------------------------------------
  5939.   # ● Update
  5940.   #-----------------------------------------------------------------------------    
  5941.   def make_pose(sufix, pose_duration)
  5942.       return if @x_pose_original_name == ""
  5943.       @x_pose_name = sufix
  5944.       @x_pose_duration = pose_duration        
  5945.   end    
  5946.  
  5947.   #-----------------------------------------------------------------------------
  5948.   # ● Update Pose
  5949.   #-----------------------------------------------------------------------------    
  5950.   def update_battler_pose
  5951.       return false unless XAS_SYSTEM::CHARACTER_POSE_NAME
  5952.       if @x_pose_duration == 0
  5953.          @x_pose_original_name = @character_name
  5954.          return
  5955.       else    
  5956.          @x_pose_duration -= 1
  5957.          @character_name = @x_pose_original_name + @x_pose_name
  5958.          if @x_pose_duration == 0
  5959.             @character_name = @x_pose_original_name
  5960.             @x_pose_name = ""
  5961.          end
  5962.       end
  5963.       unless jumping?
  5964.          @jump_count = 0
  5965.          @jump_peak = 0
  5966.       end      
  5967.   end
  5968.  
  5969.   #-----------------------------------------------------------------------------
  5970.   # ● Set Graphic
  5971.   #-----------------------------------------------------------------------------      
  5972.   alias x_pose_set_graphic set_graphic
  5973.   def set_graphic(character_name, character_index)
  5974.       x_pose_set_graphic(character_name, character_index)
  5975.       @x_pose_original_name = @character_name
  5976.       @x_pose_duration = 0
  5977.       @x_pose_name = ""      
  5978.   end    
  5979.  
  5980. end
  5981.  
  5982.  
  5983. #===============================================================================
  5984. # ■ Game_Interpreter
  5985. #===============================================================================
  5986. class Game_Interpreter
  5987.  
  5988.   #-----------------------------------------------------------------------------
  5989.   # ● Command_322
  5990.   #-----------------------------------------------------------------------------    
  5991.   alias x_pose_command_322 command_322
  5992.   def command_322
  5993.       x_pose_command_322
  5994.       actor = $game_actors[@params[0]]
  5995.       if actor != nil
  5996.          $game_player.x_pose_duration = 0
  5997.          $game_player.x_pose_original_name =  @params[1]
  5998.       end
  5999.   end
  6000.  
  6001. end  
  6002.  
  6003. #===============================================================================
  6004. # ■ RPG_FileTest
  6005. #===============================================================================
  6006. module RPG_FileTest
  6007.  
  6008.   #--------------------------------------------------------------------------
  6009.   # ● RPG_FileTest.character_exist?
  6010.   #--------------------------------------------------------------------------
  6011.   def RPG_FileTest.character_exist?(filename)
  6012.       return Cache.character(filename) rescue return false
  6013.   end
  6014.  
  6015.   #--------------------------------------------------------------------------
  6016.   # ● RPG_FileTest.system_exist?
  6017.   #--------------------------------------------------------------------------
  6018.   def RPG_FileTest.system_exist?(filename)
  6019.       return Cache.system(filename) rescue return false
  6020.   end  
  6021.  
  6022. end
  6023.  
  6024. #===============================================================================
  6025. # ■ Sprite_Character
  6026. #===============================================================================
  6027. class Sprite_Character < Sprite_Base
  6028.  
  6029.   #--------------------------------------------------------------------------
  6030.   # ● X Pose Update
  6031.   #--------------------------------------------------------------------------  
  6032.   alias x_pose_update_bitmap update_bitmap
  6033.   def update_bitmap
  6034.       check_file_exist
  6035.       x_pose_update_bitmap
  6036.   end
  6037.  
  6038.  #--------------------------------------------------------------------------
  6039.  # ● Check File Exist
  6040.  #--------------------------------------------------------------------------  
  6041.  def check_file_exist
  6042.      return if @character_name == @character.character_name
  6043.      unless RPG_FileTest.character_exist?(@character.character_name)
  6044.             @character.character_name = @character.x_pose_original_name    
  6045.             @character.x_pose_duration = 0
  6046.             @character.x_pose_name = ""
  6047.      end        
  6048.  end  
  6049.  
  6050. end
  6051.  
  6052.  
  6053.  
  6054.  
  6055.  
  6056. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6057. #■ SPRITE - DAMAGE SPRITE
  6058. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6059.  
  6060.  
  6061. #===============================================================================
  6062. # ■  XRXS_DAMAGE_OFFSET
  6063. #===============================================================================
  6064. module XRXS_DAMAGE_OFFSET
  6065.  
  6066.   #--------------------------------------------------------------------------
  6067.   # ● Update
  6068.   #--------------------------------------------------------------------------              
  6069.   def update
  6070.       super
  6071.       @damage_sprites   = [] if @damage_sprites.nil?
  6072.       for damage_sprite in @damage_sprites
  6073.           damage_sprite.x = self.x
  6074.           damage_sprite.y = self.y
  6075.       end
  6076.   end
  6077. end
  6078.  
  6079. #===============================================================================
  6080. # ■ Sprite_Character
  6081. #===============================================================================
  6082. class Sprite_Character < Sprite_Base
  6083.       include XRXS_DAMAGE_OFFSET
  6084. end
  6085.  
  6086.  
  6087. #==============================================================================
  6088. # ■ Sprite Base
  6089. #==============================================================================
  6090. class Sprite_Base < Sprite
  6091.   include XAS_DAMAGE_POP
  6092.   #--------------------------------------------------------------------------
  6093.   # ● Initialize
  6094.   #--------------------------------------------------------------------------  
  6095.   alias x_damage_pop_initialize initialize
  6096.   def initialize(viewport = nil)      
  6097.       @_damage_duration = 0
  6098.       x_damage_pop_initialize(viewport)
  6099.   end
  6100.  
  6101.   #--------------------------------------------------------------------------
  6102.   # ● Damage
  6103.   #--------------------------------------------------------------------------    
  6104.   def damage(value, type = "")
  6105.       dispose_damage
  6106.       @damage_ox = 0
  6107.       @damage_type = type
  6108.       # NUMBER PICTURE
  6109.       if value.is_a?(Numeric)
  6110.          bitmap_number_image = Cache.system("XAS_Damage_Number")
  6111.          bitmap_im_cw = bitmap_number_image.width / 10
  6112.          bitmap_im_ch = bitmap_number_image.height / 5          
  6113.          bitmap = Bitmap.new(bitmap_number_image.width,(bitmap_im_ch * 2) + 5)
  6114.          bitmap_number_text = value.to_s.split(//)
  6115.          center_x = (((2 + bitmap_number_text.size) * bitmap_im_cw) / 2)
  6116.          # Damage Color        
  6117.          if value >= 0
  6118.             if @damage_type == "Critical"
  6119.                h = bitmap_im_ch * 2  
  6120.                h2 = bitmap_im_ch * 4
  6121.                $game_map.screen.start_shake(5, 5, 60)
  6122.             elsif @damage_type == "Mp"  
  6123.                h = bitmap_im_ch * 0  
  6124.                h2 = bitmap_im_ch * 3
  6125.             else
  6126.                h = 0
  6127.             end
  6128.             f = 0
  6129.           else # Recover Color  
  6130.             h = bitmap_im_ch  
  6131.             h2 = bitmap_im_ch * 3 if @damage_type == "Mp"    
  6132.             f = 1
  6133.         end  
  6134.         for r in f..bitmap_number_text.size - 1
  6135.             bitmap_number_abs = bitmap_number_text[r].to_i
  6136.             bitmap_src_rect = Rect.new(bitmap_im_cw * bitmap_number_abs, h, bitmap_im_cw, bitmap_im_ch)
  6137.             bitmap.blt(center_x + (bitmap_im_cw  *  r), bitmap_im_ch + 5, bitmap_number_image, bitmap_src_rect)                  
  6138.         end
  6139.         ex = (bitmap_im_cw / 2) * (bitmap_number_text.size + f)
  6140.         @damage_ox = (bitmap_number_image.width - (bitmap_number_image.width / 2) - ex) - center_x
  6141.         # Add Extra String (MP / Critical)
  6142.         if h2 != nil
  6143.            string_x = (center_x - (bitmap_number_image.width / 2) + (bitmap_im_cw / 2) * bitmap_number_text.size)
  6144.            bitmap_src_rect = Rect.new(0, h2,  bitmap_number_image.width, bitmap_im_ch)
  6145.            bitmap.blt(string_x , 0, bitmap_number_image, bitmap_src_rect)  
  6146.         end        
  6147.         bitmap_number_image.dispose  
  6148.       else
  6149.           #TEXT STRING
  6150.           damage_string = value.to_s
  6151.           bitmap = Bitmap.new(160, 48)
  6152.           bitmap.font.name = DAMAGE_FONT_NAME
  6153.           bitmap.font.size = DAMAGE_FONT_SIZE
  6154.           bitmap.font.bold = DAMAGE_FONT_BOLD
  6155.           bitmap.font.italic = DAMAGE_FONT_ITALIC
  6156.           bitmap.font.color = Color.new(0,0,0)
  6157.           bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  6158.           case @damage_type
  6159.                when "Exp";   string_color = DAMAGE_EXP_FONT_COLOR
  6160.                when "Gold";  string_color = DAMAGE_GOLD_FONT_COLOR
  6161.                when "Item";  string_color = DAMAGE_ITEM_FONT_COLOR
  6162.           else
  6163.              string_color = DAMAGE_DEFAULT_FONT_COLOR
  6164.           end
  6165.           bitmap.font.color = string_color
  6166.           bitmap.draw_text(0, 12, 160, 36, damage_string, 1)              
  6167.       end
  6168.        @_damage_sprite = ::Sprite.new(self.viewport)
  6169.        @_damage_sprite.bitmap = bitmap
  6170.        @_damage_sprite.ox = 80
  6171.        @_damage_sprite.oy = 20
  6172.        @_damage_sprite.x = self.x + @damage_ox
  6173.        @_damage_sprite.y = self.y - self.oy / 2
  6174.        @_damage_sprite.z = 3000
  6175.        @_damage_duration = 60
  6176.    end
  6177.  
  6178.   #--------------------------------------------------------------------------
  6179.   # ● Dispose Damage
  6180.   #--------------------------------------------------------------------------      
  6181.   def dispose_damage
  6182.       if @_damage_sprite != nil
  6183.          @_damage_sprite.bitmap.dispose
  6184.          @_damage_sprite.dispose
  6185.          @_damage_sprite = nil
  6186.          @_damage_duration = 0
  6187.       end
  6188.   end
  6189.  
  6190.   #--------------------------------------------------------------------------
  6191.   # ● Dispose
  6192.   #--------------------------------------------------------------------------        
  6193.   alias x_damage_dispose dispose
  6194.   def dispose
  6195.       dispose_damage
  6196.       x_damage_dispose
  6197.   end
  6198.  
  6199.   #--------------------------------------------------------------------------
  6200.   # ● Update
  6201.   #--------------------------------------------------------------------------          
  6202.   alias x_damage_pop_update update
  6203.   def update
  6204.       if @_damage_duration > 0
  6205.          @_damage_duration -= 1
  6206.          if @_damage_duration == 0
  6207.             dispose_damage
  6208.          end
  6209.        end      
  6210.        x_damage_pop_update
  6211.   end    
  6212.    
  6213. end  
  6214.  
  6215. #===============================================================================
  6216. # ■ XRXS DAMAGE
  6217. #===============================================================================
  6218. module XRXS_DAMAGE
  6219.  
  6220.   #--------------------------------------------------------------------------
  6221.   # ● Damage X Init Velocity
  6222.   #--------------------------------------------------------------------------                            
  6223.   def damage_x_init_velocity
  6224.       return 0.2 * (rand(5) - 2)
  6225.   end
  6226.    
  6227.   #--------------------------------------------------------------------------
  6228.   # ● Damage Y Init Velocity
  6229.   #--------------------------------------------------------------------------                            
  6230.   def damage_y_init_velocity
  6231.       return 9
  6232.   end
  6233.    
  6234.   #--------------------------------------------------------------------------
  6235.   # ● Update
  6236.   #--------------------------------------------------------------------------                              
  6237.   def update
  6238.     super
  6239.     @damage_sprites   = [] if @damage_sprites.nil?
  6240.     @damage_durations = [] if @damage_durations.nil?
  6241.     if @_damage_sprite != nil and @_damage_sprite.visible
  6242.        if @damage_ox != nil
  6243.           dam_ox = @damage_ox
  6244.        else  
  6245.           dam_ox = 0
  6246.        end        
  6247.        if @damage_type != nil
  6248.           dam_type = @damage_type
  6249.        end  
  6250.        x = damage_x_init_velocity
  6251.        y = damage_y_init_velocity
  6252.        d = @_damage_duration
  6253.        @damage_sprites.push(Sprite_Damage.new(@_damage_sprite, x, y, d,dam_ox,dam_type))
  6254.        @_damage_sprite.visible = false
  6255.     end
  6256.     for damage_sprite in @damage_sprites
  6257.         damage_sprite.update
  6258.     end
  6259.     for i in 0...@damage_sprites.size
  6260.         @damage_sprites[i] = nil if @damage_sprites[i].disposed?
  6261.     end
  6262.     @damage_sprites.compact!
  6263.   end
  6264.   def dispose
  6265.     super
  6266.     if @damage_sprites != nil
  6267.        for damage_sprite in @damage_sprites
  6268.            damage_sprite.dispose
  6269.        end
  6270.      end
  6271.   end
  6272. end
  6273.  
  6274. #===============================================================================
  6275. # ■ RPG Sprite
  6276. #===============================================================================
  6277. class Sprite_Base < Sprite
  6278.       include XRXS_DAMAGE
  6279. end
  6280.  
  6281. #===============================================================================
  6282. # ■ Sprite Damage
  6283. #===============================================================================
  6284. class Sprite_Damage < Sprite
  6285.  
  6286.   #--------------------------------------------------------------------------
  6287.   # ● Initialize
  6288.   #--------------------------------------------------------------------------                        
  6289.   def initialize(sprite, init_x_speed, init_y_speed, duration,dam_ox,dam_type = nil)
  6290.       super(nil)
  6291.       self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil?
  6292.       self.opacity = sprite.opacity
  6293.       self.x = sprite.x
  6294.       self.y = sprite.y
  6295.       self.z = sprite.z
  6296.       self.ox = sprite.ox - dam_ox
  6297.       self.oy = sprite.oy
  6298.       @now_x_speed = init_x_speed
  6299.       @now_y_speed = init_y_speed
  6300.       @potential_x_energy = 0.0
  6301.       @potential_y_energy = 0.0
  6302.       @duration = duration
  6303.       @dam_type = dam_type
  6304.       @dam_type = "" if dam_type == nil
  6305.   end
  6306.  
  6307.   #--------------------------------------------------------------------------
  6308.   # ● Update    
  6309.   #--------------------------------------------------------------------------                      
  6310.   def update
  6311.     super
  6312.     if XAS_DAMAGE_POP::DAMAGE_CRITICAL_ZOOM
  6313.        if @dam_type != "Critical"
  6314.           update_normal_popup
  6315.        else  
  6316.           update_critical_effect  
  6317.        end      
  6318.     else      
  6319.        update_normal_popup
  6320.     end
  6321.     @duration -= 1
  6322.     if @duration == 0
  6323.        self.dispose
  6324.     end
  6325.   end
  6326.  
  6327.   #--------------------------------------------------------------------------
  6328.   # ● update_critical_effect
  6329.   #--------------------------------------------------------------------------                          
  6330.   def update_critical_effect  
  6331.       case @duration
  6332.          when 40..60
  6333.            self.zoom_x += 0.1
  6334.            self.zoom_y += 0.1
  6335.          else  
  6336.            if self.zoom_x > 0.1  
  6337.               self.zoom_x -= 0.1
  6338.               self.zoom_y -= 0.1
  6339.            end
  6340.        end
  6341.   end
  6342.  
  6343.   #--------------------------------------------------------------------------
  6344.   # ● update_normal_popup
  6345.   #--------------------------------------------------------------------------                        
  6346.   def update_normal_popup
  6347.       self.opacity -= 25 if @duration <= 10
  6348.       n = self.oy + @now_y_speed
  6349.       if n <= 0
  6350.          @now_y_speed *= -1
  6351.          @now_y_speed /=  2
  6352.          @now_x_speed /=  2
  6353.       end
  6354.       self.oy  = [n, 0].max    
  6355.       @potential_y_energy += 0.58
  6356.       speed = @potential_y_energy.floor
  6357.       @now_y_speed        -= speed
  6358.       @potential_y_energy -= speed
  6359.       @potential_x_energy += @now_x_speed
  6360.       speed = @potential_x_energy.floor
  6361.       self.ox             += speed
  6362.       @potential_x_energy -= speed  
  6363.     end
  6364.  
  6365. end
  6366.  
  6367.  
  6368.  
  6369. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6370. #■ SPRITE - SPRITE EFFECTS
  6371. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6372.  
  6373.  
  6374. #==============================================================================
  6375. # ■ Sprite Base
  6376. #==============================================================================
  6377. class Sprite_Base < Sprite  
  6378.  
  6379.   #--------------------------------------------------------------------------
  6380.   # ● Animation Set Sprite
  6381.   #--------------------------------------------------------------------------
  6382.   def animation_set_sprites(frame)
  6383.       cell_data = frame.cell_data
  6384.       @ani_sprites.each_with_index do |sprite, i|
  6385.         next unless sprite
  6386.         pattern = cell_data[i, 0]
  6387.         if !pattern || pattern < 0
  6388.             sprite.visible = false
  6389.             next
  6390.         end
  6391.         sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  6392.         sprite.visible = true
  6393.         sprite.src_rect.set(pattern % 5 * 192,
  6394.         pattern % 100 / 5 * 192, 192, 192)
  6395.         if @ani_mirror
  6396.            cx = cell_data[i, 1]
  6397.            sprite.angle = (360 - cell_data[i, 4])
  6398.            sprite.mirror = (cell_data[i, 5] == 0)
  6399.         else
  6400.            cx = cell_data[i, 1]
  6401.            sprite.angle = cell_data[i, 4]
  6402.            sprite.mirror = (cell_data[i, 5] == 1)
  6403.         end
  6404.         cy = cell_data[i, 2]
  6405.         sprite.z = self.z + 300 + i
  6406.         sprite.ox = 96
  6407.         sprite.oy = 96
  6408.         sprite.zoom_x = cell_data[i, 3] / 100.0
  6409.         sprite.zoom_y = cell_data[i, 3] / 100.0
  6410.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  6411.         sprite.blend_type = cell_data[i, 7]
  6412.         case @animation.position
  6413.               when 0
  6414.                   sprite.x = self.x + cx
  6415.                   sprite.y = self.y + cy - (height / 2)          
  6416.               when 1
  6417.                   sprite.x = self.x + cx
  6418.                   sprite.y = self.y + cy        
  6419.               when 2
  6420.                   sprite.x = self.x + cx
  6421.                   sprite.y = self.y + cy + (height / 2)
  6422.               when 3  
  6423.                   sprite.x  = (544 / 2) + cx
  6424.                   sprite.y  = (416 / 2) + cy    
  6425.         end        
  6426.        
  6427.        
  6428.     end
  6429.   end  
  6430.  
  6431.   #--------------------------------------------------------------------------
  6432.   # ● Dispose Animation
  6433.   #--------------------------------------------------------------------------
  6434.   def dispose_animation
  6435.       $game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
  6436.       if @ani_bitmap1
  6437.          @@_reference_count[@ani_bitmap1] -= 1
  6438.         if @@_reference_count[@ani_bitmap1] == 0
  6439.             $game_temp.animation_garbage.push(@ani_bitmap1)
  6440.          end
  6441.       end
  6442.       if @ani_bitmap2
  6443.          @@_reference_count[@ani_bitmap2] -= 1
  6444.          if @@_reference_count[@ani_bitmap2] == 0
  6445.             $game_temp.animation_garbage.push(@ani_bitmap2)
  6446.         end
  6447.      end
  6448.      if @ani_sprites
  6449.         @ani_sprites.each {|sprite| sprite.dispose }
  6450.         @ani_sprites = nil
  6451.         @animation = nil
  6452.      end
  6453.      @ani_bitmap1 = nil
  6454.      @ani_bitmap2 = nil
  6455.   end    
  6456.  
  6457. end
  6458.  
  6459. #==============================================================================
  6460. # ■ Scene_Base
  6461. #==============================================================================
  6462. class Game_Map
  6463.    
  6464.   #--------------------------------------------------------------------------
  6465.   # ● Setup
  6466.   #--------------------------------------------------------------------------    
  6467.   alias animation_garbage_setup setup
  6468.   def setup(map_id)
  6469.       animation_garbage_setup(map_id)
  6470.       dispose_animation_garbage
  6471.   end
  6472.  
  6473.   #--------------------------------------------------------------------------
  6474.   # ● Dispose Animation Garbage
  6475.   #--------------------------------------------------------------------------  
  6476.   def dispose_animation_garbage
  6477.       return if $game_temp.animation_garbage == nil
  6478.       for animation in $game_temp.animation_garbage
  6479.           animation.dispose
  6480.       end  
  6481.       $game_temp.animation_garbage = nil
  6482.   end  
  6483.  
  6484. end  
  6485.  
  6486. #==============================================================================
  6487. # ■ Scene_Base
  6488. #==============================================================================
  6489. class Scene_Base
  6490.  
  6491.   #--------------------------------------------------------------------------
  6492.   # ● Scene Changing?
  6493.   #--------------------------------------------------------------------------    
  6494.   alias animation_garbage_scene_changing scene_changing?
  6495.   def scene_changing?
  6496.       $game_map.dispose_animation_garbage if SceneManager.scene != self
  6497.       animation_garbage_scene_changing
  6498.   end
  6499.  
  6500. end  
  6501.  
  6502. #===============================================================================
  6503. # ■ Sprite_Character
  6504. #===============================================================================
  6505. class Sprite_Character < Sprite_Base
  6506.   include XAS_SYSTEM
  6507.  
  6508.   #--------------------------------------------------------------------------
  6509.   # ● Setup New Effect
  6510.   #--------------------------------------------------------------------------              
  6511.   def setup_new_effect
  6512.       if @character.animation_id > 0
  6513.          animation = $data_animations[@character.animation_id]
  6514.          start_animation(animation)
  6515.          @character.animation_id = 0
  6516.       end
  6517.       if !@balloon_sprite && @character.balloon_id > 0
  6518.          @balloon_id = @character.balloon_id
  6519.          start_balloon
  6520.       end
  6521.   end  
  6522.  
  6523.   #--------------------------------------------------------------------------
  6524.   # ● Can Update X Effects
  6525.   #--------------------------------------------------------------------------                    
  6526.   def can_update_x_effects?
  6527.       return false unless CHARACTER_SPRITE_EFFECTS
  6528.       return false if @character.erased
  6529.       return false if @character.transparent == true
  6530.       return true
  6531.   end  
  6532.   #--------------------------------------------------------------------------
  6533.   # ● Can Damage Pop Base
  6534.   #--------------------------------------------------------------------------                  
  6535.   def can_damage_pop_base?
  6536.       return false unless $game_system.xas_battle
  6537.       return false if XAS_SYSTEM::DAMAGE_POP == false
  6538.       return false if @character.battler == nil
  6539.       return false if @character.battler.no_damage_pop  
  6540.       return false if @character.battler.damage_pop != true
  6541.       return true  
  6542.   end  
  6543.  
  6544.  
  6545.   #--------------------------------------------------------------------------
  6546.   # ● Execute Damage Pop
  6547.   #--------------------------------------------------------------------------              
  6548.   def execute_damage_pop  
  6549.       damage(@character.battler.damage, @character.battler.damage_type)
  6550.       @character.battler.damage = nil
  6551.       @character.battler.critical = false
  6552.       @character.battler.damage_pop = false
  6553.       @character.battler.damage_type = ""
  6554.   end
  6555.    
  6556.   #--------------------------------------------------------------------------
  6557.   # ● Update X Effects
  6558.   #--------------------------------------------------------------------------              
  6559.   def update_x_effects
  6560.       update_collaspse_effects if @character.collapse_duration > 0
  6561.       update_sprite_position
  6562.       update_angle
  6563.       update_zoom
  6564.   end
  6565.    
  6566.   #--------------------------------------------------------------------------
  6567.   # ● Update Angle
  6568.   #--------------------------------------------------------------------------          
  6569.   def update_angle
  6570.       return if @character.angle == self.angle
  6571.       self.angle = @character.angle
  6572.   end
  6573.  
  6574.   #--------------------------------------------------------------------------
  6575.   # ● Update Zoom
  6576.   #--------------------------------------------------------------------------            
  6577.   def update_zoom
  6578.       update_treasure_effect
  6579.       update_breath_effect if can_breath_effect?
  6580.       self.zoom_x = @character.zoom_x
  6581.       self.zoom_y = @character.zoom_y
  6582.   end
  6583.  
  6584.   #--------------------------------------------------------------------------
  6585.   # ● Update Treasure_effect
  6586.   #--------------------------------------------------------------------------                      
  6587.   def update_treasure_effect
  6588.       return if @character.treasure_time == 0
  6589.       update_treasure_fade_effect
  6590.       update_treasure_float_effect
  6591.   end  
  6592.  
  6593.   #--------------------------------------------------------------------------
  6594.   # ● update_treasure_fade_effect
  6595.   #--------------------------------------------------------------------------                        
  6596.   def update_treasure_fade_effect
  6597.       return unless XAS_BA::FADE_TREASURE_SPRITE
  6598.       return if @character.treasure_time > 100
  6599.       return if @character.zoom_x < 0.01      
  6600.       @character.zoom_x -= 0.01
  6601.       if @character.temp_id > 0
  6602.          @character.zoom_x = 1.00
  6603.          @character.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  6604.       end
  6605.   end  
  6606.  
  6607.   #--------------------------------------------------------------------------
  6608.   # ● Update Treasure Float Effect
  6609.   #--------------------------------------------------------------------------                          
  6610.   def update_treasure_float_effect
  6611.       return unless XAS_BA::FLOAT_TREASURE_SPRITE    
  6612.       return if self.character.jumping?
  6613.       self.character.treasure_float[2] += 1
  6614.       if self.character.treasure_float[2] > 1
  6615.          self.character.treasure_float[2] = 0
  6616.          self.character.treasure_float[1] += 1
  6617.          case self.character.treasure_float[1]
  6618.             when 1..15
  6619.               self.character.treasure_float[0] -= 1
  6620.             when 16..30
  6621.               self.character.treasure_float[0] += 1
  6622.             else
  6623.               self.character.treasure_float[0] = 0
  6624.               self.character.treasure_float[1] = 0
  6625.           end
  6626.       end  
  6627.       self.y +=  self.character.treasure_float[0]
  6628.   end
  6629.  
  6630.   #--------------------------------------------------------------------------
  6631.   # ● Can Breath Effect?
  6632.   #--------------------------------------------------------------------------                    
  6633.   def can_breath_effect?
  6634.       return false if @character.battler == nil
  6635.       return false if @character.battler.breath_effect == false
  6636.       return false if @character.battler.hp == 0
  6637.       return false if @character.stop and not @character.battler.state_sleep
  6638.       return true
  6639.   end  
  6640.  
  6641.   #--------------------------------------------------------------------------
  6642.   # ● Update Breath Effect
  6643.   #--------------------------------------------------------------------------                  
  6644.   def update_breath_effect
  6645.       if @character.battler.fast_breath_effect
  6646.           zoom_speed = 3
  6647.           zoom_power_x = 0.006    
  6648.           zoom_power_y = 0.006        
  6649.       else
  6650.           zoom_speed = 1
  6651.           zoom_power_x = 0    
  6652.           zoom_power_y = 0.002
  6653.       end
  6654.       @character.battler.breath_duration += zoom_speed
  6655.       case @character.battler.breath_duration
  6656.            when 1..30
  6657.                 @character.zoom_x += zoom_power_x
  6658.                 @character.zoom_y += zoom_power_y
  6659.            when 31..60
  6660.                 @character.zoom_x -= zoom_power_x
  6661.                 @character.zoom_y -= zoom_power_y
  6662.            else  
  6663.                 @character.battler.breath_duration = 0
  6664.                 @character.zoom_x = 1.00
  6665.                 @character.zoom_y = 1.00
  6666.       end  
  6667.   end  
  6668.  
  6669.   #--------------------------------------------------------------------------
  6670.   # ● Update Sprite Position
  6671.   #--------------------------------------------------------------------------                  
  6672.   alias x_set_character_bitmap set_character_bitmap
  6673.   def set_character_bitmap
  6674.       @py = nil
  6675.       x_set_character_bitmap
  6676.       if @character_name[/\((\d+)\)/]
  6677.          @py = $1.to_i
  6678.       end            
  6679.   end
  6680.  
  6681.   #--------------------------------------------------------------------------
  6682.   # ● Update Sprite Position
  6683.   #--------------------------------------------------------------------------                
  6684.   def update_sprite_position
  6685.       if @character.tool_id > 0
  6686.          if @character.tool_effect == "Barrier"
  6687.             unless @character.action == nil
  6688.                bullet_user = @character.action.user
  6689.                self.x = bullet_user.screen_x
  6690.                self.y = bullet_user.screen_y
  6691.                @character.x = bullet_user.x
  6692.                @character.y = bullet_user.y
  6693.                @character.direction = bullet_user.direction
  6694.             end
  6695.          end  
  6696.       end  
  6697.       update_hold_target      
  6698.       if @py != nil
  6699.          self.y += @py
  6700.       end
  6701.       if @character.angle == 315 and @cw != nil
  6702.          self.x -= (@cw / 3)
  6703.          self.y -= (@ch / 6)
  6704.       end  
  6705.       if XAS_BA::KNOCKBACKING_SHAKE
  6706.          if self.character.knockbacking?
  6707.             self.x = self.x + rand(5) unless self.character.dead?
  6708.          end  
  6709.       end      
  6710.  end  
  6711.  
  6712.  #--------------------------------------------------------------------------
  6713.  # ● Update X Effects
  6714.  #--------------------------------------------------------------------------                
  6715.  def update_hold_target
  6716.      return if @character.temp_id == 0
  6717.      target = $game_map.events[@character.temp_id]
  6718.      if target == nil or target.erased
  6719.         @character.temp_id = 0
  6720.         @character.move_speed = @character.pre_move_speed
  6721.         check_character_above_player(target)
  6722.      else
  6723.         self.x = target.screen_x
  6724.         self.y = target.screen_y
  6725.         self.character.x = target.x
  6726.         self.character.y = target.y
  6727.         self.character.move_speed = target.move_speed
  6728.         self.character.direction = target.direction unless self.character.direction_fix
  6729.         check_character_above_player(target)
  6730.      end  
  6731.  end
  6732.  
  6733.  #--------------------------------------------------------------------------
  6734.  # ● Check Chacracter Above Player
  6735.  #--------------------------------------------------------------------------                  
  6736.  def check_character_above_player(target)
  6737.      return if @character.is_a?(Game_Player)
  6738.      return if @character.battler == nil
  6739.      if (@character.x == $game_player.x and
  6740.          @character.y == $game_player.y) or
  6741.           not @character.passable_temp_id?(@character.x,@character.y)
  6742.          @character.temp_id = 0
  6743.          @character.move_speed = @character.pre_move_speed
  6744.          case @character.direction
  6745.             when 2;  @character.y -= 1
  6746.             when 4;  @character.x += 1
  6747.             when 6;  @character.x -= 1
  6748.             when 8;  @character.y += 1  
  6749.          end
  6750.      end  
  6751.    end
  6752.  
  6753.  #--------------------------------------------------------------------------
  6754.  # ● Update_balloon
  6755.  #--------------------------------------------------------------------------
  6756.  if XAS_BA::FIX_BALLOON_POSITION
  6757.  def update_balloon
  6758.      if @balloon_duration > 0
  6759.         @balloon_duration -= 1
  6760.         if @balloon_duration > 0
  6761.            @balloon_sprite.x = x
  6762.            @balloon_sprite.y = y - XAS_BA::BALLOON_HEIGHT
  6763.            @balloon_sprite.z = z + 200
  6764.            sx = balloon_frame_index * 32
  6765.            sy = (@balloon_id - 1) * 32
  6766.            @balloon_sprite.src_rect.set(sx, sy, 32, 32)
  6767.       else
  6768.            end_balloon
  6769.       end
  6770.     end
  6771.   end  
  6772.   end
  6773.  
  6774. end
  6775.  
  6776. #==============================================================================
  6777. # ■ Game_Event
  6778. #==============================================================================
  6779. class Game_Event < Game_Character
  6780.  
  6781.   #--------------------------------------------------------------------------
  6782.   # ● Near The Screen
  6783.   #--------------------------------------------------------------------------  
  6784.   alias x_near_the_screen near_the_screen?
  6785.   def near_the_screen?(dx = 12, dy = 8)
  6786.       return true if can_update_out_screen?
  6787.       x_near_the_screen(dx, dy)
  6788.   end
  6789.  
  6790.  #--------------------------------------------------------------------------
  6791.  # ● Can Update Out Screen
  6792.  #--------------------------------------------------------------------------
  6793.  def can_update_out_screen?
  6794.      return true if self.force_update
  6795.      return false
  6796.  end
  6797.    
  6798. end
  6799.  
  6800. #==============================================================================
  6801. # ■ Spriteset Map
  6802. #==============================================================================
  6803. class Spriteset_Map
  6804.  
  6805.   #--------------------------------------------------------------------------
  6806.   # ● Can Refresh Hud
  6807.   #--------------------------------------------------------------------------    
  6808.   alias x_pre_leader_id_initialize initialize
  6809.   def initialize
  6810.       if $game_party.members[0] != nil
  6811.          $game_system.pre_leader_id = $game_party.members[0].actor_id
  6812.       else  
  6813.          $game_system.pre_leader_id = nil
  6814.       end  
  6815.       x_pre_leader_id_initialize
  6816.   end  
  6817.  
  6818.   #--------------------------------------------------------------------------
  6819.   # ● Can Refresh Hud
  6820.   #--------------------------------------------------------------------------    
  6821.   def can_refresh_hud?
  6822.       if $game_party.members[0] == nil
  6823.          return true if $game_system.pre_leader_id != nil
  6824.       elsif $game_party.members[0] != nil  
  6825.          return true if $game_system.pre_leader_id == nil
  6826.          return true if $game_system.pre_leader_id != $game_party.members[0].actor_id
  6827.       end  
  6828.       return false
  6829.   end  
  6830.  
  6831.   #--------------------------------------------------------------------------
  6832.   # ● update
  6833.   #--------------------------------------------------------------------------    
  6834.   def refresh_hud
  6835.       $game_system.pre_leader_id = $game_party.members[0].actor_id      
  6836.   end
  6837.  
  6838.   #--------------------------------------------------------------------------
  6839.   # ● Update Hud Visible
  6840.   #--------------------------------------------------------------------------      
  6841.   def update_hud_visible
  6842.       if hud_visible?
  6843.          $game_system.enable_hud = true
  6844.       else  
  6845.          $game_system.enable_hud = false
  6846.       end  
  6847.   end  
  6848.    
  6849.   #--------------------------------------------------------------------------
  6850.   # ● Hud Visible?
  6851.   #--------------------------------------------------------------------------        
  6852.   def hud_visible?
  6853.       return false if $game_system.hud_visible == false
  6854.       return false if $game_message.visible
  6855.       return true
  6856.   end    
  6857.  
  6858. end  
  6859.  
  6860.  
  6861.  
  6862. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6863. #■ MISC - SCENE TARGET SELECT
  6864. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6865.  
  6866.  
  6867. #==============================================================================
  6868. # ■ Game_Temp
  6869. #==============================================================================
  6870. class Game_Temp
  6871.       attr_accessor :xas_target_x
  6872.       attr_accessor :xas_target_y
  6873.       attr_accessor :xas_target_time
  6874.       attr_accessor :xas_target_shoot_id
  6875.      
  6876. #--------------------------------------------------------------------------
  6877. # ● Initialize
  6878. #--------------------------------------------------------------------------
  6879.   alias xas_target_initialize initialize
  6880.   def initialize
  6881.       xas_target_initialize
  6882.       @xas_target_x = 0
  6883.       @xas_target_y = 0
  6884.       @xas_target_time = 0
  6885.       @xas_target_shoot_id = 0
  6886.   end    
  6887.        
  6888. end
  6889.  
  6890. #==============================================================================
  6891. # ■ Game_Map
  6892. #==============================================================================
  6893. class Game_Map
  6894.  
  6895.  attr_accessor :pre_display_x
  6896.  attr_accessor :pre_display_y
  6897.  attr_accessor :pre_real_display_x
  6898.  attr_accessor :pre_real_display_y
  6899.  
  6900.  #--------------------------------------------------------------------------
  6901.  # * Object Initialization
  6902.  #--------------------------------------------------------------------------
  6903.  alias x_map_initialize initialize
  6904.  def initialize  
  6905.      x_map_initialize
  6906.      @pre_display_x = @display_x - 1
  6907.      @pre_display_y = @display_y - 1    
  6908.  end
  6909.  
  6910.   #--------------------------------------------------------------------------
  6911.   # ● Screen Scrolled?
  6912.   #--------------------------------------------------------------------------        
  6913.   def screen_scrolled?
  6914.       if @pre_display_x != @display_x or
  6915.          @pre_display_y != @display_y
  6916.          @pre_display_x = @display_x
  6917.          @pre_display_y = @display_y
  6918.          return true
  6919.       end  
  6920.       return false
  6921.   end
  6922.  
  6923.  #--------------------------------------------------------------------------
  6924.  # ● Event On Screen
  6925.  #--------------------------------------------------------------------------
  6926.  def event_on_screen?(event)
  6927.      event.target = false
  6928.      px = ($game_map.display_x).truncate
  6929.      py = ($game_map.display_y).truncate    
  6930.      distance_x = event.x - px
  6931.      distance_y = event.y - py
  6932.      if distance_x.between?(0, 16) and
  6933.         distance_y.between?(0, 12)
  6934.         event.target = true
  6935.      end  
  6936.  end      
  6937.  
  6938.  #--------------------------------------------------------------------------
  6939.  # ● Check Event on Screen
  6940.  #--------------------------------------------------------------------------
  6941.  def check_events_on_screen
  6942.       for i in $game_map.events.values
  6943.             event_on_screen?(i)
  6944.       end  
  6945.   end
  6946.  
  6947. end  
  6948. #==============================================================================
  6949. # ■ Scene Target Select
  6950. #==============================================================================
  6951. class Scene_Target_Select
  6952.  
  6953.   #--------------------------------------------------------------------------
  6954.   # ● Main
  6955.   #--------------------------------------------------------------------------        
  6956.   def main    
  6957.       $game_temp.xas_target_x = 0
  6958.       $game_temp.xas_target_y = 0      
  6959.       $game_temp.xas_target_time = 0
  6960.       @new_x = $game_player.screen_x
  6961.       @new_y = $game_player.screen_y
  6962.       @index_max = -1
  6963.       @target_index = 0  
  6964.       @spriteset = Spriteset_Map.new
  6965.       @text_string = ""
  6966.       @fy = 0
  6967.       @fy_time = 0
  6968.       for event in $game_map.events.values
  6969.         if event.target and event.battler?
  6970.            @index_max += 1
  6971.         end  
  6972.       end  
  6973.       Sound.play_equip
  6974.       if @index_max == -1
  6975.          cancel_select
  6976.       else
  6977.          create_layout
  6978.          create_layout_skill
  6979.          create_cusrsor
  6980.          create_text      
  6981.          create_skill_name
  6982.          select_target(0)
  6983.       end
  6984.       Graphics.transition(0)
  6985.       loop do
  6986.            Graphics.update
  6987.            Input.update
  6988.            update
  6989.            break if SceneManager.scene != self
  6990.       end
  6991.       dispose
  6992.  end  
  6993.   #--------------------------------------------------------------------------
  6994.   # ● Create Layout
  6995.   #--------------------------------------------------------------------------      
  6996.   def create_layout
  6997.       @layout_1 = Plane.new
  6998.       @layout_1.bitmap = Cache.system("XAS_Target_Layout1")
  6999.       @layout_1.z = 10100
  7000.       @layout_1.opacity = 255
  7001.   end  
  7002.  
  7003.  #--------------------------------------------------------------------------
  7004.  # ● Create Layout
  7005.  #--------------------------------------------------------------------------      
  7006.  def create_layout_skill
  7007.      @skill_layout = Sprite.new
  7008.      @skill_layout.bitmap = Cache.system("XAS_Active_Help")
  7009.      @skill_layout.z = 10101
  7010.      @skill_layout.x = -100    
  7011.      @skill_layout.y = 32
  7012.      @skill_layout.opacity = 0
  7013.  end
  7014.    
  7015.  #--------------------------------------------------------------------------
  7016.  # ● Create Cursor
  7017.  #--------------------------------------------------------------------------            
  7018.  def create_cusrsor
  7019.      @cursor = Sprite.new
  7020.      @cursor.bitmap = Cache.system("XAS_Cursor")
  7021.      @cursor.z = 10105
  7022.      @cursor.x = @new_x
  7023.      @cursor.y = @new_y
  7024.      @cursor.opacity = 255
  7025.      @cursor.visible = true
  7026.  end
  7027.  
  7028.  #--------------------------------------------------------------------------
  7029.  # ● Create Text
  7030.  #--------------------------------------------------------------------------    
  7031.  def create_text
  7032.      @text = Sprite.new
  7033.      @text.bitmap = Bitmap.new(200,40)
  7034.      @text.z = 10102
  7035.      @text.bitmap.font.size = 20
  7036.      @text.bitmap.font.bold = true
  7037.      @text.bitmap.font.name = "Georgia"  
  7038.      @text.bitmap.draw_text(0, 0, 200, 40, @text_string.to_s,1)
  7039.      @text.opacity = 255
  7040.      @text.x = @new_x
  7041.      @text.y = @new_y    
  7042.  end
  7043.  
  7044.  #--------------------------------------------------------------------------
  7045.  # ● Create Text
  7046.  #--------------------------------------------------------------------------    
  7047.  def create_skill_name
  7048.      @skill_name = Plane.new
  7049.      @skill_name.bitmap = Bitmap.new(640,480)
  7050.      @skill_name.z = 10103
  7051.      @skill_name.bitmap.font.size = 20
  7052.      @skill_name.bitmap.font.bold = true
  7053.      @skill_name.bitmap.font.name = "Georgia"  
  7054.      @skill_name.oy = -40
  7055.      skill = $data_skills[$game_temp.xas_target_shoot_id]
  7056.      skill_text = skill.name.to_s + " - " + skill.description.to_s    
  7057.      @skill_name.bitmap.draw_text(0, 0, 640, 40, skill_text,1)
  7058.      @skill_name.opacity = 0
  7059.  end  
  7060.  
  7061.  #--------------------------------------------------------------------------
  7062.  # ● Dispose
  7063.  #--------------------------------------------------------------------------            
  7064.  def dispose
  7065.      Graphics.freeze
  7066.      @spriteset.dispose
  7067.      if @cursor != nil
  7068.         @cursor.bitmap.dispose
  7069.         @cursor.dispose  
  7070.         @text.bitmap.dispose
  7071.         @text.dispose
  7072.         @skill_layout.bitmap.dispose
  7073.         @skill_layout.dispose
  7074.         @skill_name.bitmap.dispose
  7075.         @skill_name.dispose
  7076.         @layout_1.bitmap.dispose
  7077.         @layout_1.dispose
  7078.      end
  7079.  end
  7080.  
  7081.  #--------------------------------------------------------------------------
  7082.  # ● Update
  7083.  #--------------------------------------------------------------------------          
  7084.  def update
  7085.      return if @index_max == -1
  7086.      @spriteset.update
  7087.      update_cursor_slide
  7088.      update_layout_slide
  7089.      update_targe_select
  7090.  end
  7091.  
  7092.  #--------------------------------------------------------------------------
  7093.  # ● Update Layout Slide
  7094.  #--------------------------------------------------------------------------            
  7095.  def update_layout_slide
  7096.      @layout_1.ox += 3
  7097.      if @skill_layout.x < 0
  7098.         @skill_layout.x += 10
  7099.         @skill_layout.opacity += 25
  7100.         @skill_name.opacity += 25
  7101.      else
  7102.         @skill_layout.x = 0
  7103.         @skill_layout.opacity = 255
  7104.         @skill_name.opacity = 255
  7105.         @skill_name.ox -= 3
  7106.      end  
  7107.  end  
  7108.  
  7109.  #--------------------------------------------------------------------------
  7110.  # ● Refresh Text
  7111.  #--------------------------------------------------------------------------            
  7112.  def refresh_text
  7113.      @text.bitmap.clear
  7114.      @text.bitmap.draw_text(0, 0, 200, 40, @text_string.to_s,1)
  7115.  end
  7116.  
  7117.  #--------------------------------------------------------------------------
  7118.  # ● Update Cursor Slide
  7119.  #--------------------------------------------------------------------------          
  7120.  def update_cursor_slide
  7121.      @speed_x = [[(@cursor.x - @new_x / 60), 1].max, 60].min
  7122.      @speed_y = [[(@cursor.y - @new_y / 60), 1].max, 60].min
  7123.      if @cursor.x > @new_x
  7124.         @cursor.x -= @speed_x.abs
  7125.         @cursor.x = @new_x if @cursor.x < @new_x
  7126.      elsif @cursor.x < @new_x
  7127.         @cursor.x += @speed_x.abs
  7128.         @cursor.x = @new_x if @cursor.x > @new_x
  7129.      end        
  7130.      
  7131.      if @cursor.y > @new_y
  7132.         @cursor.y -= @speed_y.abs
  7133.         @cursor.y = @new_y if @cursor.y < @new_y
  7134.      elsif @cursor.y < @new_y
  7135.         @cursor.y += @speed_y.abs
  7136.         @cursor.y = @new_y if @cursor.y > @new_y
  7137.      end      
  7138.      @text.x = - 85 + @cursor.x
  7139.      @text.y = 20 + @cursor.y
  7140.      if @fy_time > 25
  7141.         @fy += 1
  7142.      elsif @fy_time > 0
  7143.         @fy -= 1
  7144.      else  
  7145.         @fy = 0
  7146.         @fy_time = 50
  7147.      end  
  7148.      @fy_time -= 1
  7149.      @cursor.oy = @fy
  7150.      
  7151.  end
  7152.  
  7153.  #--------------------------------------------------------------------------
  7154.  # ● Select Target(type)
  7155.  #--------------------------------------------------------------------------          
  7156.  def select_target(type)
  7157.      return if  @index_max < 0
  7158.      check_index
  7159.      valor = 0
  7160.      for event in $game_map.events.values
  7161.         if event.target and event.battler?
  7162.            if valor == @target_index
  7163.               @new_x = event.screen_x - 10
  7164.               @new_y = event.screen_y
  7165.               @text_string = event.battler.name
  7166.               $game_temp.xas_target_x = event.x
  7167.               $game_temp.xas_target_y = event.y
  7168.               $game_temp.xas_target_time = 1
  7169.             end
  7170.             valor += 1  
  7171.          end  
  7172.      end  
  7173.      refresh_text  
  7174.   end
  7175.  
  7176.  #--------------------------------------------------------------------------
  7177.  # ● Cancel Select
  7178.  #--------------------------------------------------------------------------              
  7179.  def cancel_select
  7180.      Sound.play_buzzer
  7181.      $game_temp.xas_target_x = 0
  7182.      $game_temp.xas_target_y = 0      
  7183.      $game_temp.xas_target_time = 0
  7184.      $game_temp.xas_target_shoot_id = 0
  7185.      SceneManager.call(Scene_Map)
  7186.  end
  7187.    
  7188.   #--------------------------------------------------------------------------
  7189.   # ● Update Target Select
  7190.   #--------------------------------------------------------------------------            
  7191.   def update_targe_select
  7192.       if Input.trigger?(Input::B)
  7193.          cancel_select
  7194.       elsif Input.trigger?(Input::DOWN) or Input.trigger?(Input::RIGHT)  
  7195.          @target_index += 1
  7196.          select_target(0)
  7197.          Sound.play_cursor
  7198.       elsif Input.trigger?(Input::UP) or Input.trigger?(Input::LEFT)
  7199.          @target_index -= 1
  7200.          select_target(1)
  7201.          Sound.play_cursor
  7202.       elsif Input.trigger?(Input::C)
  7203.          Sound.play_ok
  7204.          SceneManager.call(Scene_Map)
  7205.       end  
  7206.   end
  7207.  
  7208.   #--------------------------------------------------------------------------
  7209.   # ● Check Index
  7210.   #--------------------------------------------------------------------------                
  7211.   def check_index
  7212.       if @target_index > @index_max
  7213.          @target_index = 0
  7214.       end      
  7215.       if @target_index < 0
  7216.          @target_index = @index_max
  7217.       end    
  7218.   end        
  7219.  
  7220. end  
  7221.  
  7222.  
  7223. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  7224. #■ MISC - MAIN UPDATE
  7225. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  7226.  
  7227. #===============================================================================
  7228. # ■  Spriteset_Map
  7229. #===============================================================================
  7230. class Spriteset_Map
  7231.  
  7232.   #--------------------------------------------------------------------------
  7233.   # ● update
  7234.   #--------------------------------------------------------------------------  
  7235.   alias xas_main_update update
  7236.   def update
  7237.       xas_main_update
  7238.       update_xas_spriteset_map
  7239.   end
  7240.  
  7241.   #--------------------------------------------------------------------------
  7242.   # ● Update XAS Spriteset Map
  7243.   #--------------------------------------------------------------------------      
  7244.   def update_xas_spriteset_map
  7245.       refresh_token if $game_map.need_refresh_token
  7246.       refresh_hud if can_refresh_hud?
  7247.       update_hud_visible
  7248.   end    
  7249. end
  7250.  
  7251.  
  7252. #===============================================================================
  7253. # ■ Sprite_Character
  7254. #===============================================================================
  7255. class Sprite_Character < Sprite_Base
  7256.  
  7257.   #--------------------------------------------------------------------------
  7258.   # ● Update
  7259.   #--------------------------------------------------------------------------            
  7260.   alias x_update update
  7261.   def update
  7262.       x_update
  7263.       execute_damage_pop  if can_damage_pop_base?
  7264.       update_x_effects if can_update_x_effects?
  7265.   end
  7266.    
  7267. end    
  7268.  
  7269. #===============================================================================
  7270. # ■ Game Character
  7271. #===============================================================================
  7272. class Game_Character < Game_CharacterBase
  7273.  
  7274.   #--------------------------------------------------------------------------
  7275.   # ● Update
  7276.   #--------------------------------------------------------------------------    
  7277.   alias x_main_update update
  7278.   def update
  7279.       update_character_before_movement
  7280.       x_main_update
  7281.       update_character_after_movement
  7282.   end  
  7283.  
  7284.   #--------------------------------------------------------------------------
  7285.   # ● Update Character Before Movement
  7286.   #--------------------------------------------------------------------------      
  7287.   def update_character_before_movement
  7288.       check_xy
  7289.       update_force_action if can_force_action?
  7290.   end  
  7291.  
  7292.   #--------------------------------------------------------------------------
  7293.   # ● Update Character After Movement
  7294.   #--------------------------------------------------------------------------      
  7295.   def update_character_after_movement
  7296.       update_battler if can_update_battler?      
  7297.   end      
  7298.  
  7299. end  
  7300.  
  7301. #===============================================================================
  7302. # ■ Game Event
  7303. #===============================================================================
  7304. class Game_Event < Game_Character
  7305.  
  7306.   #--------------------------------------------------------------------------
  7307.   # ● Update
  7308.   #--------------------------------------------------------------------------    
  7309.   alias x_main_event_update update
  7310.   def update
  7311.       update_event_before_movement
  7312.       x_main_event_update
  7313.       update_event_after_movement
  7314.   end  
  7315.  
  7316.   #--------------------------------------------------------------------------
  7317.   # ● Update Event Before Movement
  7318.   #--------------------------------------------------------------------------      
  7319.   def update_event_before_movement
  7320.       update_sensor if can_update_sensor?
  7321.       update_treasure_duration      
  7322.   end  
  7323.  
  7324.   #--------------------------------------------------------------------------
  7325.   # ● Update Event After Movement
  7326.   #--------------------------------------------------------------------------      
  7327.   def update_event_after_movement
  7328.      
  7329.   end    
  7330.  
  7331. end  
  7332.  
  7333. #===============================================================================
  7334. # ■ Game Player
  7335. #===============================================================================
  7336. class Game_Player < Game_Character
  7337.  
  7338.   #--------------------------------------------------------------------------
  7339.   # ● Update
  7340.   #--------------------------------------------------------------------------    
  7341.   alias x_main_player_update update
  7342.   def update
  7343.       update_player_before_movement if party_system?
  7344.       x_main_player_update
  7345.       update_player_after_movement if party_system?
  7346.   end  
  7347.  
  7348.   #--------------------------------------------------------------------------
  7349.   # ● Update Player Before Movement
  7350.   #--------------------------------------------------------------------------      
  7351.   def update_player_before_movement
  7352.       check_actor_level
  7353.       update_reset_battler_setting_time
  7354.       if $game_system.old_interpreter_running != $game_map.interpreter.running?
  7355.          refresh_interpreter_effect
  7356.       end  
  7357.   end  
  7358.  
  7359.   #--------------------------------------------------------------------------
  7360.   # ● Update Player after Movement
  7361.   #--------------------------------------------------------------------------      
  7362.   def update_player_after_movement
  7363.       update_action_command if can_use_command?
  7364.       $game_temp.change_leader_wait_time -= 1 if $game_temp.change_leader_wait_time > 0
  7365.   end      
  7366.  
  7367. end
  7368.  
  7369. #==============================================================================
  7370. # ■ Sprite Picture
  7371. #==============================================================================
  7372. class Sprite_Picture < Sprite
  7373.  
  7374.  #--------------------------------------------------------------------------
  7375.  # ● Update
  7376.  #--------------------------------------------------------------------------    
  7377.   alias mog_fix_picture_erased_update update
  7378.   def update
  7379.       return if picture_erased?  
  7380.       mog_fix_picture_erased_update
  7381.   end  
  7382.  
  7383.  #--------------------------------------------------------------------------
  7384.  # ● Picture Erased?
  7385.  #--------------------------------------------------------------------------    
  7386.   def picture_erased?
  7387.       return false if @picture.name != ""
  7388.       if self.bitmap != nil
  7389.          self.bitmap.dispose
  7390.          self.bitmap = nil
  7391.       end  
  7392.       return true
  7393.   end
  7394.  
  7395. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement