Advertisement
Tid

Xas com Party

Tid
Jan 13th, 2018
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 270.45 KB | None | 0 0
  1. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2. # XAS - SETUP
  3. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4. #===============================================================================
  5. # ■ XAS SYSTEN SETTING
  6. #===============================================================================
  7. # Desative um dos sistemas abaixo caso você tiver algum problema de
  8. # compatibilidade com outros sistemas de script, problema de performance ou
  9. # caso não quiser usar algum dos sistemas abaixo
  10. #-------------------------------------------------------------------------------
  11. module XAS_SYSTEM
  12. # Ativar o sistema de batalha, deixe como false se desejar usar apenas o
  13. # sistema de ferramentas (Interação com o cenário)
  14. # Caso queira desativar o sistema de batalha durante o jogo use o comando
  15. # abaixo.
  16. #
  17. # $game_system.xas_battle = X
  18. #
  19. BATTLE_SYSTEM = false
  20. # Ativar a exibição de dano (Sprite).
  21. DAMAGE_POP = false#true
  22. # Ativar o sistema de pose de ações.
  23. CHARACTER_POSE_NAME = true
  24. # Ativar o sistema de sprites
  25. CHARACTER_SPRITE_EFFECTS = true
  26. # Ativar o sistema de dash avançado para o XAS.
  27. DASH_SYSTEM = true
  28. # Ativar o sistema de diagonal para o player.
  29. PLAYER_DIAGONAL_MOVEMENT = true
  30. # Ativar o sistema de diagonal para o evento
  31. EVENT_DIAGONAL_MOVEMENT = true
  32. # Ativar o sistema de condições para o battler.
  33. STATE_SYSTEM = true
  34. # Definição do mapa que ficarão os eventos das ferramentas.
  35. ACTION_TEMPLATE_MAP_ID = 1
  36. # Definição da ID da variável que corresponde a ID da ferramenta,
  37. # Essa ID serve para criar eventos interativos com as ferramentas.
  38. HIT_ID = 3
  39. end
  40.  
  41. #===============================================================================
  42. # ■ XAS BUTTON SETTING
  43. #===============================================================================
  44. module XAS_BUTTON
  45. #Definição do botão de ataque.
  46. ACTION_1_BUTTON = Key::C#Input::C
  47. #Definição do botão do escudo.
  48. ACTION_2_BUTTON = Key::X#Input::B #Y
  49. #Definição do botão de habildiade
  50. SKILL_BUTTON = Key::D#Input::Z
  51. #SKILL2_BUTTON = Key::R#Input::Z
  52. #Definição do botão do item.
  53. ITEM_BUTTON = Key::S#Input::Y
  54. #Definição do botão de correr.
  55. DASH_BUTTON = Key::Z#Input::A
  56. #Definição do botão de mudar de lider.
  57. CHANGE_LEADER_BUTTON = nil#Input::R
  58. #Ativar o botão de ataque.
  59. ENABLE_ACTION_1_BUTTON = true
  60. #Ativar o botão de escudo.
  61. ENABLE_ACTION_2_BUTTON = true
  62. #Ativar o botão de habilidade.
  63. ENABLE_SKILL_BUTTON = true
  64. #ENABLE_SKILL2_BUTTON = true
  65. #Ativar o botão de item.
  66. ENABLE_ITEM_BUTTON = true
  67. #Ativar o botão de corrida.
  68. ENABLE_DASH_BUTTON = true
  69. #Ativar o botão de mudar de lider.
  70. ENABLE_CHANGE_LEADER_BUTTON = false#true
  71. end
  72.  
  73. #===============================================================================
  74. # ■ WORD SETTING
  75. #===============================================================================
  76. # Definição das palavras usadas no XAS
  77. #-------------------------------------------------------------------------------
  78. module XAS_WORD
  79. # Ativar as palavras.
  80. ENABLE_WORD = true#false
  81. # Palavra usada quando o battler usa o sistema de defesa.
  82. GUARD = ""
  83. # Palavra usada quando não tem MP o suficiênte para usar a habilidade.
  84. NO_MP = "Sem Mana!"
  85. # Palavra usada quando não tem item para ativar a habilidade.
  86. NO_ITEM = "Sem item"
  87. # Palavra usada quando o personagem aumenta de nível.
  88. LEVEL_UP = ""
  89. # Palavra usada quando o personagem está com as ações seladas.
  90. SEAL = "Selado!"
  91. # Palavra usada quando o personagem está invencível.
  92. INVINCIBLE = ""
  93. # Palavra usada para definir experiência.
  94. EXP = "Exp"
  95. # Palavra usada quando o alvo se esquiva do ataque.
  96. EVADED = "Desviou!"
  97. # Palavra usada quando o battler erra o ataque.
  98. MISSED = "Errou!"
  99. # Palavra usada quando o counter é ativado.
  100. COUNTER = "Counter"
  101. # Palavra usada quando a habilidade é refletida.
  102. REFLECT = "Reflected"
  103. end
  104.  
  105. #===============================================================================
  106. # ■ XAS DAMAGE POP
  107. #===============================================================================
  108. # Definição do sistema de sprites de dano.
  109. #-------------------------------------------------------------------------------
  110. module XAS_DAMAGE_POP
  111. # Defnição da fonte.
  112. DAMAGE_FONT_NAME = "Georgia"
  113. # Definição do tamanho da fonte.
  114. DAMAGE_FONT_SIZE = 22
  115. # Ativar a fonte em bold.
  116. DAMAGE_FONT_BOLD = true
  117. # Ativar a fonte em itálico.
  118. DAMAGE_FONT_ITALIC = true
  119. # Ativar o Zoom no dano quando é dano crítico.
  120. DAMAGE_CRITICAL_ZOOM = true
  121. # Apresentar a quantidade de experiência e dinheiro.
  122. DAMAGE_EXP_GOLD_POP = true
  123. # Apresentar o nome da condição(States).
  124. DAMAGE_STATE_POP = true
  125. # Apresentar o nome do item ao pegar no campo de batalha.
  126. DAMAGE_ITEM_POP = true
  127. # Definição da cor padrão da fonte.
  128. DAMAGE_DEFAULT_FONT_COLOR = Color.new(255, 255, 255)
  129. # Definição da cor da experiência.
  130. DAMAGE_EXP_FONT_COLOR = Color.new(0, 255, 100)
  131. # Definição da cor do dinheiro (Gold).
  132. DAMAGE_GOLD_FONT_COLOR = Color.new(255, 255, 50)
  133. # Definição da cor do item.
  134. DAMAGE_ITEM_FONT_COLOR = Color.new(55, 55, 250)
  135. end
  136.  
  137. #===============================================================================
  138. # ■ SOUND SETTING
  139. #===============================================================================
  140. # Definição do sistema de sons do XAS.
  141. #-------------------------------------------------------------------------------
  142. module XAS_SOUND
  143. #Som executado ao pegar o item.
  144. ITEM_DROP = "Key"
  145. #Som executado ao fazer level up
  146. LEVEL_UP = "Up3"
  147. #Som executado quando não tem item ou mp o suficiente.
  148. ACTION_COST = "Cancel1"
  149. end
  150.  
  151. #===============================================================================
  152. # ■ ANIMATION SETTING
  153. #===============================================================================
  154. # Definição do sistema de animações do XAS.
  155. # Caso não quiser usar as animações, defina o valor como 0 (Zero).
  156. #-------------------------------------------------------------------------------
  157. module XAS_ANIMATION
  158. # Id da variável que guarda o valor da animação quando a defesa é ativada.
  159. GUARD_ANIMATION_ID = 10
  160. # Animação quando o lider é trocado.
  161. CHANGE_LEADER_ANIMATION_ID = 135
  162. # Animação quando o battler acerta o alvo em condição invencível.
  163. INVINCIBLE_ANIMATION_ID = 36
  164. # Animação quando o battler estiver usando o sistema de charge weapon.
  165. CHARGE_ANIMATION1_ID = 0#242
  166. # Animação do battler após a arma estiver carregada.
  167. CHARGE_ANIMATION2_ID = 0#242
  168. # Animação apresentada durante o carregamento das habilidades.
  169. CAST_TIME_ANIMATION_ID = 20#id da variável de cast animation
  170. # Velocidade do loop das animações.
  171. LOOP_ANIMATIONS_SPEED = 30#60
  172. # Animação de refletir
  173. REFLECT_ANIMATION_ID = 128
  174. end
  175.  
  176. #===============================================================================
  177. # ■ GENERAL BATTLER SETTING
  178. #===============================================================================
  179. # Definição geral do sistema de batalha do XAS.
  180. #-------------------------------------------------------------------------------
  181. module XAS_BA
  182. #Tempo para poder ativar o botão de mudar de lider.
  183. CHANGE_LEADER_WAIT_TIME = 5
  184. #Deixar a hud visivel ao começar o jogo.
  185. #Você pode ativar ou desativar a hud usando o código abaixo
  186. # $game_system.hud_visible = true
  187. HUD_VISIBLE_AT_STARTUP = false#true
  188. # Definição da Switch da página de ações de curta distância.
  189. SENSOR_SELF_SWITCH = "D"
  190. # Definição da variável que define a area padrão para ativar a página de
  191. # ações de curta distância.
  192. DEFAULT_SENSOR_RANGE_VARIABLE_ID = 4
  193. # Tempo padrão do recuo (lockout) do battler.
  194. DEFAULT_KNOCK_BACK_DURATION = 10#15#30#60
  195. # Ativar sprite tremendo quando o battler está em recuo.
  196. KNOCKBACKING_SHAKE = true#false
  197. # Velocidade básica de movimento
  198. BASE_MOVE_SPEED = 4.00#25
  199. # Velocidade extra quando o battler estiver correndo.
  200. DASH_MOVE_SPEED = 2.00
  201. # Retornar na posição de 4 direções após algum tempo na posição na diagonal.
  202. DIAGONAL_DURATION_ENABLE = false#true
  203. # Tempo para retornar na posição de 4 direções.
  204. DIAGONAL_DURATION = 15
  205. # Definição do modo como a experiência é dividida entre os aliados.
  206. # 0 - EXP somente para quem matou o inimigo.
  207. # 1 - EXP é repartido para o grupo, exp no valor integral.
  208. # 2 - EXP é divido pelo numero do grupo e repartido para todos.
  209. EXP_TYPE = 0
  210. # Definição do tempo para remover o tesouro do mapa.
  211. TREASURE_ERASE_TIME = 999#50
  212. # Ativar a animação de fade no tesouro.
  213. FADE_TREASURE_SPRITE = false#true
  214. # Ativar a animação de levitação no tesouro.
  215. FLOAT_TREASURE_SPRITE = false
  216. # Fixar a posição do balão independente da altura real do sprite.
  217. FIX_BALLOON_POSITION = false#true
  218. # Altura que o balão será fixado.
  219. BALLOON_HEIGHT = 32
  220. end
  221.  
  222. #===============================================================================
  223. # ■ ENEMY SETTING
  224. #===============================================================================
  225.  
  226. module XAS_BA_ENEMY
  227. # Definição de quais habilidades o inimigo será invunerável.
  228. #
  229. # INVUNERABLE_ACTIONS = { A=>[B,B,B,B], A=>[B,B,B,B], ...}
  230. # A - ID do inimigo.
  231. # B - ID da habilidade.
  232. # if $game_switches(23) == true
  233. # INVUNERABLE_ACTIONS = {
  234. # 6=>[39,40,41,42,43],
  235. # 7=>[24,25,26,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],
  236. # 8=>[1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,24,25,26],
  237. # 9=>[39,40,41,42,43],
  238. # 10=>[39,40,41,42,43],
  239. # 11=>[39,40,41,42,43],
  240. # 22=>[1,2,3,4,5,6,7,8,16,18,25,28,19,21,30,22,23,24,26,33,37,38,41,49,50,80],
  241. # 23=>[1,2,3,4,5,6,7,8,22,23,24,49,50,80],
  242. # 25=>[1,2,3,4,5,6,7,8,16,18,25,28,19,21,30,22,23,24,25,26,33,36,37,49,50,80]
  243. # }
  244. # else
  245. INVUNERABLE_ACTIONS = {
  246. 6=>[39,40,41,42,43],
  247. 7=>[24,25,26,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],
  248. 8=>[1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,24,25,26],
  249. 9=>[39,40,41,42,43],
  250. 10=>[39,40,41,42,43],
  251. 11=>[39,40,41,42,43],
  252. 22=>[1,2,3,4,5,6,7,8,16,18,25,28,19,21,30,22,23,24,26,33,37,38,41,42,43,49,50,80],
  253. #23=>[22,23,24,49,50],
  254. 25=>[1,2,3,4,5,6,7,8,16,18,25,27,28,19,21,30,31,22,23,24,25,26,33,36,37,38,41,49,50,80],
  255. 30=>[1,2,3,4,5,6,7,8,22,23,24,49,50,67,68,80]
  256. }
  257. # end
  258. #end
  259.  
  260.  
  261.  
  262. # Definição das direções que o inimigo será invunerável.
  263. # GUARD_DIRECTIONS = { A=>[B], A=>[B,B,B,B], ...}
  264. # A - ID do inimigo
  265. # B - Direções de Invulnerabilidade.
  266. # -> 2 = Abaixo. -> 4 = Esquerda.
  267. # -> 6 = Direita. -> 8 = Acima.
  268. GUARD_DIRECTIONS = {
  269. }
  270. # Definição das habilidades de Counter Attack
  271. #
  272. # COUNTER_ATTACK = { A=>[B,B,B,B], A=>[B,B,B,B], ...}
  273. COUNTER_ATTACK = {
  274. }
  275.  
  276. end
  277. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  278. #■ INITIALIZE
  279. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  280.  
  281.  
  282. #===============================================================================
  283. # ■ Game_Temp
  284. #===============================================================================
  285. class Game_Temp
  286. attr_accessor :change_leader_wait_time
  287. attr_accessor :reset_battler_time
  288. attr_accessor :tool_event
  289. attr_accessor :animation_garbage
  290.  
  291. #--------------------------------------------------------------------------
  292. # ● Initialize
  293. #--------------------------------------------------------------------------
  294. alias xas_initialize initialize
  295. def initialize
  296. @change_leader_wait_time = 0
  297. @reset_battler_time = 0
  298. @tool_event = nil
  299. @animation_garbage = []
  300. xas_initialize
  301. end
  302.  
  303. end
  304.  
  305. #===============================================================================
  306. # ■ Game_System
  307. #===============================================================================
  308. class Game_System
  309. attr_accessor :tools_on_map
  310. attr_accessor :old_interpreter_running
  311. attr_accessor :hud_visible
  312. attr_accessor :enable_hud
  313. attr_accessor :command_enable
  314. attr_accessor :pre_leader_id
  315. attr_accessor :xas_battle
  316. #--------------------------------------------------------------------------
  317. # ● Initialize
  318. #--------------------------------------------------------------------------
  319. alias x_initialize initialize
  320. def initialize
  321. @tools_on_map = []
  322. @old_interpreter_running = false
  323. @hud_visible = XAS_BA::HUD_VISIBLE_AT_STARTUP
  324. @enable_hud = false
  325. @command_enable = true
  326. @pre_leader_id = 0
  327. @xas_battle = XAS_SYSTEM::BATTLE_SYSTEM
  328. x_initialize
  329. end
  330. end
  331.  
  332. #===============================================================================
  333. # ■ Game_Battler
  334. #===============================================================================
  335. class Game_Battler
  336. attr_accessor :damage_pop
  337. attr_accessor :damage
  338. attr_accessor :damage_type
  339. attr_accessor :critical
  340. attr_accessor :invunerable_duration
  341. attr_accessor :shield
  342. attr_accessor :invunerable_actions
  343. attr_accessor :guard_directions
  344. attr_accessor :guard
  345. attr_accessor :invunerable
  346. attr_accessor :x_combo
  347. attr_accessor :cast_action
  348. attr_accessor :defeated
  349. attr_accessor :death_zoom_effect
  350. attr_accessor :counter_action
  351. attr_accessor :knockback_duration
  352. attr_accessor :hp_damage
  353. attr_accessor :mp_damage
  354.  
  355. #--------------------------------------------------------------------------
  356. # ● Initialize
  357. #--------------------------------------------------------------------------
  358. alias x_initialize initialize
  359. def initialize
  360. @damage = 0
  361. @damage_pop = false
  362. @damage_type = 0
  363. @critical = false
  364. @invunerable_duration = 0
  365. @shield = false
  366. @invunerable_actions = []
  367. @guard_directions = []
  368. @guard = true
  369. @invunerable = false
  370. @x_combo = [0,-1,0]
  371. @defeated = false
  372. @death_zoom_effect = 0
  373. @cast_action = [0,0,0,0,0]
  374. @counter_action = [0,0,true]
  375. @knockback_duration = XAS_BA::DEFAULT_KNOCK_BACK_DURATION
  376. x_initialize
  377. end
  378.  
  379. #--------------------------------------------------------------------------
  380. # ● Add Invunerable Actions
  381. #--------------------------------------------------------------------------
  382. def add_inv(action_id = 0)
  383. return if action_id == nil or action_id <= 0
  384. return if @invunerable_actions.include?(action_id)
  385. @invunerable_actions.push(action_id) #TESTE
  386. end
  387.  
  388. #--------------------------------------------------------------------------
  389. # ● Remove Invunerable Actions
  390. #--------------------------------------------------------------------------
  391. def remove_inv(action_id = 0)
  392. return if action_id == nil or action_id <= 0
  393. return unless @invunerable_actions.include?(action_id)
  394. @invunerable_actions.delete(action_id)
  395. end
  396.  
  397. #--------------------------------------------------------------------------
  398. # ● Add Guard Directions
  399. #--------------------------------------------------------------------------
  400. def add_guard_dir(direction = 0)
  401. return if direction == nil or direction <= 0
  402. return if @guard_directions.include?(direction)
  403. @guard_directions.push(direction)
  404. end
  405.  
  406. #--------------------------------------------------------------------------
  407. # ● Remove Guard Directions
  408. #--------------------------------------------------------------------------
  409. def remove_guard_dir(direction = 0)
  410. return if direction == nil or direction <= 0
  411. return unless @guard_directions.include?(direction)
  412. @guard_directions.delete(direction)
  413. end
  414.  
  415. end
  416.  
  417. #===============================================================================
  418. # ■ Game Actor
  419. #===============================================================================
  420. class Game_Actor < Game_Battler
  421.  
  422. attr_accessor :x_action1_id
  423. attr_accessor :x_action2_id
  424. attr_accessor :skill_id
  425. attr_accessor :x_item_id
  426. attr_accessor :x_charge_action
  427. attr_accessor :old_equipment_id
  428. attr_accessor :item_id
  429. attr_accessor :old_level
  430. attr_reader :actor_id
  431.  
  432. #--------------------------------------------------------------------------
  433. # ● Setup
  434. #--------------------------------------------------------------------------
  435. alias x_setup setup
  436. def setup(actor_id)
  437. @x_action1_id = 0
  438. @x_action2_id = 0
  439. @skill_id = 0
  440. @x_item_id = 0
  441. @item_id = 0
  442. @x_charge_action = [0,0,0,0]
  443. @old_level = @level
  444. @old_equipment_id = [0,0,0,0,0]
  445. x_setup(actor_id)
  446. end
  447.  
  448. #--------------------------------------------------------------------------
  449. # ● Display Level Up
  450. #--------------------------------------------------------------------------
  451. alias x_display_level_up display_level_up
  452. def display_level_up(new_skills)
  453. return unless $game_party.in_battle
  454. x_display_level_up(new_skills)
  455. end
  456.  
  457. end
  458.  
  459. #===============================================================================
  460. # ■ Character
  461. #===============================================================================
  462. class Game_Character < Game_CharacterBase
  463.  
  464. attr_accessor :tool_id
  465. attr_accessor :tool_effect
  466. attr_accessor :target
  467. attr_accessor :target2
  468. attr_accessor :old_x
  469. attr_accessor :old_y
  470. attr_accessor :pre_x
  471. attr_accessor :pre_y
  472. attr_accessor :temp_id
  473. attr_accessor :angle
  474. attr_accessor :force_action_times
  475. attr_accessor :force_action
  476. attr_accessor :move_frequency
  477. attr_accessor :move_speed
  478. attr_accessor :direction_fix
  479. attr_accessor :walk_anime
  480. attr_accessor :step_anime
  481. attr_accessor :x
  482. attr_accessor :y
  483. attr_accessor :pattern
  484. attr_accessor :pattern_count
  485. attr_accessor :jump_count
  486. attr_accessor :jump_peak
  487. attr_accessor :dash_active
  488. attr_accessor :direction
  489. attr_accessor :through
  490. attr_accessor :bush_depth
  491. attr_accessor :blend_type
  492. attr_accessor :priority_type
  493. attr_accessor :jump_count
  494. attr_accessor :zoom_x
  495. attr_accessor :zoom_y
  496. attr_accessor :stop
  497. attr_accessor :force_update
  498. attr_accessor :treasure_time
  499. attr_accessor :treasure_float
  500. attr_accessor :can_update
  501. attr_accessor :pre_move_speed
  502. attr_accessor :knock_back_duration
  503. attr_accessor :orig_pos_x
  504. attr_accessor :orig_pos_y
  505. attr_accessor :shoot_time
  506. #--------------------------------------------------------------------------
  507. # ● Initialize
  508. #--------------------------------------------------------------------------
  509. alias x_initialize initialize
  510. def initialize
  511. x_initialize
  512. @tool_id = 0
  513. @tool_effect = ""
  514. @target = false
  515. @target2 = nil
  516. @old_x = @x
  517. @old_y = @y
  518. @pre_x = @x
  519. @pre_y = @y
  520. @orig_pos_x = @x
  521. @orig_pos_y = @y
  522. @angle = 0
  523. @force_action_times = 0
  524. @force_action = ""
  525. @dash_active = false
  526. @zoom_x = 1.00
  527. @zoom_y = 1.00
  528. @stop = false
  529. @force_update = false
  530. @treasure_time = 0
  531. @treasure_float = [0,0,0,0]
  532. @can_update = true
  533. @temp_id = 0
  534. @pre_move_speed = @move_speed
  535. @shoot_time = [0,0]
  536. end
  537.  
  538. #--------------------------------------------------------------------------
  539. # ● Invunerable
  540. #--------------------------------------------------------------------------
  541. def invunerable(enable = false)
  542. return if @battler == nil or @battler.dead?
  543. @battler.invunerable = enable
  544. end
  545.  
  546. #--------------------------------------------------------------------------
  547. # ● Fast Breath
  548. #--------------------------------------------------------------------------
  549. def fast_breath(enable = true)
  550. return if @battler == nil or @battler.dead?
  551. @battler.fast_breath_effect = enable
  552. end
  553. end
  554.  
  555. #===============================================================================
  556. # ■ Game_Event
  557. #===============================================================================
  558. class Game_Event < Game_Character
  559. attr_accessor :target
  560. attr_reader :name
  561. attr_accessor :collision_attack
  562.  
  563. #--------------------------------------------------------------------------
  564. # ● Object
  565. #--------------------------------------------------------------------------
  566. alias x_event_initialize initialize
  567. def initialize(map_id, event)
  568. x_event_initialize(map_id, event)
  569. @collision_attack = false
  570. if @event.name =~ /<O(\d+)>/i
  571. @opacity = $1.to_i
  572. end
  573. if @event.name =~ /<B(\d+)>/i
  574. @blend_type = $1.to_i
  575. end
  576. end
  577.  
  578. #--------------------------------------------------------------------------
  579. # ● Erase
  580. #--------------------------------------------------------------------------
  581. alias x_event_erase erase
  582. def erase
  583. if self.tool_id > 0
  584. $game_system.tools_on_map.delete(self.tool_id)
  585. end
  586. x_event_erase
  587. end
  588.  
  589. #--------------------------------------------------------------------------
  590. # ● Event Name
  591. #--------------------------------------------------------------------------
  592. def name
  593. return @event.name
  594. end
  595.  
  596. end
  597.  
  598. #===============================================================================
  599. # ■ Game Followers
  600. #===============================================================================
  601. class Game_Followers
  602.  
  603. #--------------------------------------------------------------------------
  604. # ● Initialize
  605. #--------------------------------------------------------------------------
  606. alias x_party_initialize initialize
  607. def initialize(leader)
  608. x_party_initialize(leader)
  609. if $xas_party_system == nil
  610. @visible = $data_system.opt_followers
  611. end
  612. end
  613. end
  614.  
  615. #===============================================================================
  616. # ■ Game Map
  617. #===============================================================================
  618. class Game_Map
  619.  
  620. #--------------------------------------------------------------------------
  621. # ● Setup
  622. #--------------------------------------------------------------------------
  623. alias x_initial_setup setup
  624. def setup(map_id)
  625. x_initial_setup(map_id)
  626. xas_initial_setup(map_id)
  627. end
  628.  
  629. #--------------------------------------------------------------------------
  630. # ● XAS Initial Setup
  631. #--------------------------------------------------------------------------
  632. def xas_initial_setup(map_id)
  633. for actor in $game_party.members
  634. setup_initial_members(actor)
  635. end
  636. end
  637.  
  638. #--------------------------------------------------------------------------
  639. # ● Setup Initial Membes
  640. #--------------------------------------------------------------------------
  641. def setup_initial_members(actor)
  642.  
  643. end
  644. end
  645.  
  646.  
  647. #==============================================================================
  648. # ■ Scene_Map
  649. #==============================================================================
  650. class Scene_Map < Scene_Base
  651.  
  652. #--------------------------------------------------------------------------
  653. # ● Call Menu
  654. #--------------------------------------------------------------------------
  655. alias x_call_menu call_menu
  656. def call_menu
  657. return if $game_player.action != nil
  658. $game_player.reset_charge_temp
  659. x_call_menu
  660. end
  661.  
  662. end
  663. #===============================================================================
  664. # ■ Scene_Refresh
  665. #===============================================================================
  666. class Scene_Refresh
  667.  
  668. #--------------------------------------------------------------------------
  669. # ● Main
  670. #--------------------------------------------------------------------------
  671. def main
  672. SceneManager.call(Scene_Map)
  673. end
  674. end
  675.  
  676. #==============================================================================
  677. # ■ Game_Player
  678. #==============================================================================
  679. class Game_Player < Game_Character
  680.  
  681. #--------------------------------------------------------------------------
  682. # ● Leader Changed
  683. #--------------------------------------------------------------------------
  684. def leader_changed?(actor)
  685. if $game_party.members[0] == nil
  686. return true if actor != nil
  687. elsif $game_party.members[0] != nil
  688. return true if actor == nil
  689. return true if actor.actor_id != $game_party.members[0].actor_id
  690. end
  691. return false
  692. end
  693.  
  694. end
  695. $xas = true
  696. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  697. #■ MOVEMENT - DIAGONAL MOVEMENT
  698. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  699.  
  700.  
  701. #===============================================================================
  702. # ■ Game Character
  703. #===============================================================================
  704. class Game_CharacterBase
  705.  
  706. #--------------------------------------------------------------------------
  707. # ● Set Direction
  708. #--------------------------------------------------------------------------
  709. alias diagonal_set_direction set_direction
  710. def set_direction(d)
  711. diagonal_set_direction(d)
  712. @diagonal_direction = 0
  713. reset_diagonal
  714. end
  715.  
  716. end
  717.  
  718. #===============================================================================
  719. # ■ Game Character
  720. #===============================================================================
  721. class Game_Character < Game_CharacterBase
  722.  
  723. attr_accessor :diagonal
  724. attr_accessor :diagonal_direction
  725. attr_accessor :sprite_angle_enable
  726. attr_accessor :diagonal_time
  727.  
  728. #--------------------------------------------------------------------------
  729. # ● Initialize
  730. #--------------------------------------------------------------------------
  731. alias diagonal_initialize initialize
  732. def initialize
  733. diagonal_initialize
  734. if XAS_SYSTEM::EVENT_DIAGONAL_MOVEMENT
  735. @diagonal = true
  736. else
  737. @diagonal = false
  738. end
  739. @diagonal_direction = 0
  740. @sprite_angle_enable = false
  741. @diagonal_time = 0
  742. end
  743.  
  744. #--------------------------------------------------------------------------
  745. # ● Reset Diagonal
  746. #--------------------------------------------------------------------------
  747. def reset_diagonal
  748. return if @direction_fix
  749. return if @diagonal == false
  750. @diagonal_direction = 0
  751. @diagonal_time = 0
  752. @angle = 0 if @sprite_angle_enable
  753. end
  754.  
  755. #--------------------------------------------------------------------------
  756. # ● Enable Diagonal
  757. #--------------------------------------------------------------------------
  758. def enable_diagonal(dir = 0)
  759. return if @direction_fix
  760. return if @diagonal == false
  761. return if dir == 0
  762. @diagonal_direction = dir
  763. @diagonal_time = XAS_BA::DIAGONAL_DURATION
  764. @angle = 315 if @sprite_angle_enable
  765. end
  766.  
  767. #--------------------------------------------------------------------------
  768. # ● Turn Upper Right
  769. #--------------------------------------------------------------------------
  770. def turn_upper_right
  771. enable_diagonal(9)
  772. @direction = 8 unless @direction_fix
  773. end
  774.  
  775. #--------------------------------------------------------------------------
  776. # ● Turn Upper Left
  777. #--------------------------------------------------------------------------
  778. def turn_upper_left
  779. enable_diagonal(7)
  780. @direction = 4 unless @direction_fix
  781. end
  782.  
  783. #--------------------------------------------------------------------------
  784. # ● Turn Lower Right
  785. #--------------------------------------------------------------------------
  786. def turn_lower_right
  787. enable_diagonal(3)
  788. @direction = 6 unless @direction_fix
  789. end
  790.  
  791. #--------------------------------------------------------------------------
  792. # ● Turn Lower Left
  793. #--------------------------------------------------------------------------
  794. def turn_lower_left
  795. enable_diagonal(1)
  796. @direction = 2 unless @direction_fix
  797. end
  798.  
  799. #--------------------------------------------------------------------------
  800. # ● Move forward
  801. #--------------------------------------------------------------------------
  802. alias diagonal_move_forward move_forward
  803. def move_forward
  804. return if move_forward_diagonal?
  805. diagonal_move_forward
  806. end
  807.  
  808. #--------------------------------------------------------------------------
  809. # ● Move forward Diagonal?
  810. #--------------------------------------------------------------------------
  811. def move_forward_diagonal?
  812. return false if @diagonal == false
  813. if @diagonal_direction != 0
  814. case @diagonal_direction
  815. when 1 #Lower Left
  816. move_diagonal(4, 2)
  817. @direction = 2
  818. when 3 #Lower Right
  819. move_diagonal(6, 2)
  820. @direction = 6
  821. when 7 #Upper Left
  822. move_diagonal(4, 8)
  823. @direction = 4
  824. when 9 #Upper Right
  825. move_diagonal(6, 8)
  826. @direction = 8
  827. end
  828. enable_diagonal(@diagonal_direction)
  829. return true
  830. end
  831. return false
  832. end
  833.  
  834. #--------------------------------------------------------------------------
  835. # ● Move Backward
  836. #--------------------------------------------------------------------------
  837. alias diagonal_move_backward move_backward
  838. def move_backward
  839. return if move_backward_diagonal?
  840. diagonal_move_backward
  841. end
  842.  
  843. #--------------------------------------------------------------------------
  844. # ● Move Backward Diagonal?
  845. #--------------------------------------------------------------------------
  846. def move_backward_diagonal?
  847. return false if @diagonal == false
  848. if @diagonal_direction != 0
  849. last_direction_fix = @direction_fix
  850. @direction_fix = true
  851. case @diagonal_direction
  852. when 1
  853. move_diagonal(6, 8)
  854. @direction = 6
  855. when 3
  856. move_diagonal(4, 8)
  857. @direction = 4
  858. when 7
  859. move_diagonal(6, 2)
  860. @direction = 6
  861. when 9
  862. move_diagonal(4, 2)
  863. @direction = 2
  864. end
  865. enable_diagonal(@diagonal_direction)
  866. @direction_fix = last_direction_fix
  867. return true
  868. end
  869. return false
  870. end
  871.  
  872. #--------------------------------------------------------------------------
  873. # ● Turn Toward Player
  874. #--------------------------------------------------------------------------
  875. alias turn_toward_player_diagonal turn_toward_player
  876. def turn_toward_player
  877. if @diagonal
  878. diagonal_turn_toward_player
  879. return
  880. end
  881. turn_toward_player_diagonal
  882. end
  883.  
  884. #--------------------------------------------------------------------------
  885. # ● Diagonal Turn Toward Player
  886. #--------------------------------------------------------------------------
  887. def diagonal_turn_toward_player
  888. sx = distance_x_from($game_player.x)
  889. sy = distance_y_from($game_player.y)
  890. sd = sx.abs - sy.abs
  891. sdx = sd.abs - sx.abs
  892. sdy = sd.abs - sy.abs
  893. return if sx == 0 and sy == 0
  894. #Turn Upper Right
  895. if sx < 0 and sy > 0
  896. if sx.abs > sy.abs and sdx.abs < sd.abs
  897. set_direction(6)
  898. elsif sx.abs < sy.abs and sdy.abs < sd.abs
  899. set_direction(8)
  900. else
  901. turn_upper_right
  902. end
  903. enable_diagonal(9)
  904. #Turn Upper Left
  905. elsif sx > 0 and sy > 0
  906. if sx.abs > sy.abs and sdx.abs < sd.abs
  907. set_direction(4)
  908. elsif sx.abs < sy.abs and sdy.abs < sd.abs
  909. set_direction(8)
  910. else
  911. set_direction(4)
  912. turn_upper_left
  913. end
  914. enable_diagonal(7)
  915. #Turn Lower Left
  916. elsif sx > 0 and sy < 0
  917. if sx.abs > sy.abs and sdx.abs < sd.abs
  918. set_direction(4)
  919. elsif sx.abs < sy.abs and sdy.abs < sd.abs
  920. set_direction(2)
  921. else
  922. turn_lower_left
  923. end
  924. enable_diagonal(1)
  925. #Turn Lower Right
  926. elsif sx < 0 and sy < 0
  927. if sx.abs > sy.abs and sdx.abs < sd.abs
  928. set_direction(6)
  929. elsif sx.abs < sy.abs and sdy.abs < sd.abs
  930. set_direction(2)
  931. else
  932. turn_lower_right
  933. end
  934. enable_diagonal(3)
  935. elsif sx < 0
  936. set_direction(6)
  937. elsif sx > 0
  938. set_direction(4)
  939. elsif sy > 0
  940. set_direction(8)
  941. elsif sy < 0
  942. set_direction(2)
  943. end
  944.  
  945. end
  946.  
  947. #--------------------------------------------------------------------------
  948. # ● Move toward Player
  949. #--------------------------------------------------------------------------
  950. alias move_toward_player_diagonal move_toward_player
  951. def move_toward_player
  952. if @diagonal
  953. diagonal_move_toward_player
  954. return
  955. end
  956. move_toward_player_diagonal
  957. end
  958.  
  959. #--------------------------------------------------------------------------
  960. # ● Diagonal Move Toward Player
  961. #--------------------------------------------------------------------------
  962. def diagonal_move_toward_player
  963. sx = distance_x_from($game_player.x)
  964. sy = distance_y_from($game_player.y)
  965. if sx == 0 and sy == 0
  966. return
  967. end
  968. abs_sx = sx.abs
  969. abs_sy = sy.abs
  970. if abs_sx == abs_sy
  971. rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
  972. end
  973. if abs_sx
  974. if sx < 0 and sy > 0
  975. move_diagonal(6, 8)
  976. move_random unless moving?
  977. enable_diagonal(9)
  978. elsif sx > 0 and sy > 0
  979. move_diagonal(4, 8)
  980. move_random unless moving?
  981. enable_diagonal(7)
  982. elsif sx > 0 and sy < 0
  983. move_diagonal(4, 2)
  984. move_random unless moving?
  985. enable_diagonal(1)
  986. elsif sx < 0 and sy < 0
  987. move_diagonal(6, 2)
  988. move_random unless moving?
  989. enable_diagonal(3)
  990. elsif sx < 0
  991. move_straight(6)
  992. elsif sx > 0
  993. move_straight(4)
  994. elsif sy > 0
  995. move_straight(8)
  996. elsif sy < 0
  997. move_straight(2)
  998. end
  999. if abs_sx != 1 and abs_sy != 1
  1000. move_random unless moving?
  1001. end
  1002. end
  1003. end
  1004.  
  1005. #--------------------------------------------------------------------------
  1006. # ● turn_right_45
  1007. #--------------------------------------------------------------------------
  1008. def turn_right_45
  1009. if @diagonal and @diagonal_direction != 0
  1010. case @diagonal_direction
  1011. when 1; set_direction(4)
  1012. when 3; set_direction(2)
  1013. when 7; set_direction(8)
  1014. when 9; set_direction(6)
  1015. end
  1016. else
  1017. case @direction
  1018. when 2; turn_lower_left
  1019. when 4; turn_upper_left
  1020. when 6; turn_lower_right
  1021. when 8; turn_upper_right
  1022. end
  1023. end
  1024. end
  1025.  
  1026. #--------------------------------------------------------------------------
  1027. # ● turn_left_45
  1028. #--------------------------------------------------------------------------
  1029. def turn_left_45
  1030. if @diagonal and @diagonal_direction != 0
  1031. case @diagonal_direction
  1032. when 1; set_direction(2)
  1033. when 3; set_direction(6)
  1034. when 7; set_direction(4)
  1035. when 9; set_direction(8)
  1036. end
  1037. else
  1038. case @direction
  1039. when 2; turn_lower_right
  1040. when 4; turn_lower_left
  1041. when 6; turn_upper_right
  1042. when 8; turn_upper_left
  1043. end
  1044. end
  1045. end
  1046.  
  1047. #--------------------------------------------------------------------------
  1048. # ● turn_right_90
  1049. #--------------------------------------------------------------------------
  1050. alias diagonal_turn_right_90 turn_right_90
  1051. def turn_right_90
  1052. if @diagonal and @diagonal_direction != 0
  1053. turn_diagonal_right_90
  1054. return
  1055. end
  1056. diagonal_turn_right_90
  1057. end
  1058.  
  1059. #--------------------------------------------------------------------------
  1060. # ● turn_diagonal_right_90
  1061. #--------------------------------------------------------------------------
  1062. def turn_diagonal_right_90
  1063. case @diagonal_direction
  1064. when 1; turn_upper_left
  1065. when 3; turn_lower_left
  1066. when 7; turn_upper_right
  1067. when 9; turn_lower_right
  1068. end
  1069. end
  1070.  
  1071. #--------------------------------------------------------------------------
  1072. # ● turn_left_90
  1073. #--------------------------------------------------------------------------
  1074. alias diagonal_turn_left_90 turn_left_90
  1075. def turn_left_90
  1076. if @diagonal and @diagonal_direction != 0
  1077. turn_diagonal_left_90
  1078. return
  1079. end
  1080. diagonal_turn_left_90
  1081. end
  1082.  
  1083. #--------------------------------------------------------------------------
  1084. # ● turn_diagonal_left_90
  1085. #--------------------------------------------------------------------------
  1086. def turn_diagonal_left_90
  1087. case @diagonal_direction
  1088. when 1; turn_lower_right
  1089. when 3; turn_upper_right
  1090. when 7; turn_lower_left
  1091. when 9; turn_upper_left
  1092. end
  1093. end
  1094.  
  1095. #--------------------------------------------------------------------------
  1096. # ● diagonal_turn_180
  1097. #--------------------------------------------------------------------------
  1098. alias diagonal_turn_180 turn_180
  1099. def turn_180
  1100. if @diagonal and @diagonal_direction != 0
  1101. turn_diagonal_180
  1102. return
  1103. end
  1104. diagonal_turn_180
  1105. end
  1106.  
  1107. #--------------------------------------------------------------------------
  1108. # ● turn_diagonal_180
  1109. #--------------------------------------------------------------------------
  1110. def turn_diagonal_180
  1111. case @diagonal_direction
  1112. when 1; turn_upper_right
  1113. when 3; turn_upper_left
  1114. when 7; turn_lower_right
  1115. when 9; turn_lower_left
  1116. end
  1117. end
  1118.  
  1119. #--------------------------------------------------------------------------
  1120. # ● turn_random
  1121. #--------------------------------------------------------------------------
  1122. alias diagonal_turn_random turn_random
  1123. def turn_random
  1124. if @diagonal
  1125. turn_diagonal_random
  1126. return
  1127. end
  1128. diagonal_turn_random
  1129. end
  1130.  
  1131. #--------------------------------------------------------------------------
  1132. # ● turn_diagonal_random
  1133. #--------------------------------------------------------------------------
  1134. def turn_diagonal_random
  1135. case rand(2)
  1136. when 0; turn_right_45
  1137. when 1; turn_left_45
  1138. #when 2; set_direction(4)
  1139. #when 3; set_direction(2)
  1140. #when 4; turn_lower_left
  1141. #when 5; turn_lower_right
  1142. #when 6; turn_upper_left
  1143. #when 7; turn_upper_right
  1144. end
  1145. end
  1146.  
  1147. end
  1148.  
  1149. #===============================================================================
  1150. # ■ Game_Player
  1151. #===============================================================================
  1152. class Game_Player < Game_Character
  1153.  
  1154. #--------------------------------------------------------------------------
  1155. # ● Move By Input
  1156. #--------------------------------------------------------------------------
  1157. alias diagonal_move_by_input move_by_input
  1158. def move_by_input
  1159. if XAS_SYSTEM::PLAYER_DIAGONAL_MOVEMENT
  1160. player_diagonal_move_by_input
  1161. update_sprite_diagonal
  1162. update_return_direction
  1163. return
  1164. end
  1165. diagonal_move_by_input
  1166. end
  1167.  
  1168. #--------------------------------------------------------------------------
  1169. # ● Update Sprite Diagonal
  1170. #--------------------------------------------------------------------------
  1171. def update_sprite_diagonal
  1172. return if @diagonal_direction == 0
  1173. return if self.action != nil
  1174. return if @dash_active
  1175. make_pose("_Diagonal", 2)
  1176. end
  1177.  
  1178. #--------------------------------------------------------------------------
  1179. # ● Update Return Direction
  1180. #--------------------------------------------------------------------------
  1181. def update_return_direction
  1182. return if XAS_BA::DIAGONAL_DURATION_ENABLE == false
  1183. return if @diagonal_time == 0
  1184. return if moving? or @stop
  1185. @diagonal_time -= 1
  1186. @diagonal_direction = 0 if @diagonal_time == 0
  1187. end
  1188.  
  1189. #--------------------------------------------------------------------------
  1190. # ● Player Diagonal Move By Input
  1191. #--------------------------------------------------------------------------
  1192. def player_diagonal_move_by_input
  1193. return unless movable?
  1194. return if $game_map.interpreter.running?
  1195. case Input.dir8
  1196. when 1
  1197. move_diagonal(4, 2)
  1198. unless moving?
  1199. move_straight(4)
  1200. move_straight(2)
  1201. end
  1202. @diagonal_direction = 1
  1203. when 2; move_straight(2)
  1204. when 3
  1205. move_diagonal(6, 2)
  1206. unless moving?
  1207. move_straight(6)
  1208. move_straight(2)
  1209. end
  1210. @diagonal_direction = 3
  1211. when 4; move_straight(4)
  1212. when 6; move_straight(6)
  1213. when 7
  1214. move_diagonal(4, 8)
  1215. unless moving?
  1216. move_straight(4)
  1217. move_straight(8)
  1218. end
  1219. @diagonal_direction = 7
  1220. when 8; move_straight(8)
  1221. when 9
  1222. move_diagonal(6, 8)
  1223. unless moving?
  1224. move_straight(6)
  1225. move_straight(8)
  1226. end
  1227. @diagonal_direction = 9
  1228. end
  1229. end
  1230.  
  1231. end
  1232. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1233. #■ MOVEMENT - FORCE ACTION
  1234. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1235.  
  1236.  
  1237. #===============================================================================
  1238. # ■ Game Character
  1239. #===============================================================================
  1240. class Game_Character < Game_CharacterBase
  1241.  
  1242. #--------------------------------------------------------------------------
  1243. # ● moving 2?
  1244. #--------------------------------------------------------------------------
  1245. def moving2?
  1246. @real_x != @x || @real_y != @y
  1247. end
  1248.  
  1249. #--------------------------------------------------------------------------
  1250. # ● Can Force Action?
  1251. #--------------------------------------------------------------------------
  1252. def can_force_action?
  1253. return false if @force_action_times == 0
  1254. return false if self.moving2?
  1255. return false if self.jumping?
  1256. return false if self.knockbacking?
  1257. return false if self.stop
  1258. return true
  1259. end
  1260.  
  1261. #--------------------------------------------------------------------------
  1262. # ● Update Force Action
  1263. #--------------------------------------------------------------------------
  1264. def update_force_action
  1265. @force_action_times -= 1
  1266. execute_force_action
  1267. execute_force_action_tool_effect if @tool_id > 0 and @tool_effect != ""
  1268. reset_auto_action if @force_action_times == 0
  1269. end
  1270.  
  1271. #--------------------------------------------------------------------------
  1272. # ● Execute Force Action
  1273. #--------------------------------------------------------------------------
  1274. def execute_force_action
  1275. case @force_action
  1276. when "Forward"
  1277. move_forward
  1278. when "Backward"
  1279. move_backward
  1280. when "Toward Player"
  1281. move_toward_player
  1282. when "Move Left"
  1283. move_straight(4)
  1284. when "Move Right"
  1285. move_straight(6)
  1286. when "Move Up"
  1287. move_straight(8)
  1288. when "Move Down"
  1289. move_straight(2)
  1290. when "All Shoot"
  1291. if self.action != nil
  1292. if self.action == 20
  1293. turn_right_45
  1294. self.shoot(self.action.id) unless @force_action_times == 0
  1295. turn_right_45
  1296. else
  1297. turn_right_45
  1298. self.shoot(self.action.id) unless @force_action_times == 0
  1299. end
  1300. end
  1301. when "Four Shoot"
  1302. if self.action != nil
  1303. turn_right_90
  1304. self.shoot(self.action.id) unless @force_action_times == 0
  1305. end
  1306. when "Three Shoot"
  1307. if self.action != nil
  1308. case @force_action_times
  1309. when 2
  1310. turn_right_45
  1311. when 1
  1312. turn_left_90
  1313. when 0
  1314. turn_right_45
  1315. end
  1316. self.shoot(self.action.id) unless @force_action_times == 0
  1317. end
  1318. when "Two Shoot"
  1319. if self.action != nil
  1320. turn_180
  1321. self.shoot(self.action.id) unless @force_action_times == 0
  1322. end
  1323. end
  1324. end
  1325.  
  1326. #--------------------------------------------------------------------------
  1327. # ● Execute Force Action Tool Effect
  1328. #--------------------------------------------------------------------------
  1329. def execute_force_action_tool_effect
  1330. action_effect_during_move
  1331. action_effect_after_move if @force_action_times == 0
  1332. end
  1333.  
  1334. #--------------------------------------------------------------------------
  1335. # ● Auto Action Effect During Move
  1336. #--------------------------------------------------------------------------
  1337. def reset_auto_action
  1338. if @tool_effect == "Boomerang"
  1339. @move_speed = 7
  1340. @move_frequency = 6
  1341. @force_action = ""
  1342. @force_action_times = 0
  1343. @anime_count = 0
  1344. else
  1345. @force_action = ""
  1346. @force_action_times = 0
  1347. @anime_count = 0
  1348. end
  1349.  
  1350. end
  1351.  
  1352. #--------------------------------------------------------------------------
  1353. # ● Action Effect During Move
  1354. #--------------------------------------------------------------------------
  1355. def action_effect_during_move
  1356. if @tool_effect == "Boomerang" and @force_action == "Toward Player"
  1357. if @x == $game_player.x and @y == $game_player.y
  1358. self.action.duration = 15
  1359. @move_frequency = 6
  1360. @move_speed = 7#5.5
  1361. @force_action_times = 0
  1362. @force_action_type = ""
  1363. end
  1364. end
  1365. end
  1366.  
  1367. #--------------------------------------------------------------------------
  1368. # ● Action Effect After Move
  1369. #--------------------------------------------------------------------------
  1370. def action_effect_after_move
  1371. if @tool_effect == "Boomerang"
  1372. @force_action_times = 30
  1373. @force_action = "Toward Player"
  1374. @move_frequency = 6
  1375. @move_speed = 5.5
  1376. end
  1377. end
  1378.  
  1379. end
  1380. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1381. #■ MOVEMENT - EXTRA MOVEMENT
  1382. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1383.  
  1384.  
  1385. #===============================================================================
  1386. # ■ Game Character
  1387. #===============================================================================
  1388. class Game_Character < Game_CharacterBase
  1389.  
  1390. #--------------------------------------------------------------------------
  1391. # ● Check XY
  1392. #--------------------------------------------------------------------------
  1393. def check_xy
  1394. @pre_x = @x
  1395. @pre_y = @y
  1396. end
  1397.  
  1398. #--------------------------------------------------------------------------
  1399. # ● Turn Reverse
  1400. #--------------------------------------------------------------------------
  1401. def turn_reverse(dir)
  1402. case dir
  1403. when 2; set_direction(8)
  1404. when 4; set_direction(6)
  1405. when 6; set_direction(4)
  1406. when 8; set_direction(2)
  1407. end
  1408. end
  1409.  
  1410. #--------------------------------------------------------------------------
  1411. # ● Org Here
  1412. #--------------------------------------------------------------------------
  1413. def org_here
  1414. @orig_pos_x = @x
  1415. @orig_pos_y = @y
  1416. end
  1417.  
  1418. #--------------------------------------------------------------------------
  1419. # ● return_org
  1420. #--------------------------------------------------------------------------
  1421. def return_org(type = 0)
  1422. if type == 1
  1423. moveto(@orig_pos_x,@orig_pos_x)
  1424. else
  1425. jump(0,0)
  1426. end
  1427. @x = @orig_pos_x
  1428. @y = @orig_pos_y
  1429. end
  1430.  
  1431. #--------------------------------------------------------------------------
  1432. # ● Dual Switch
  1433. #--------------------------------------------------------------------------
  1434. def dual_switch(switch_on, switch_off,percentage = 100)
  1435. enable_per = rand(100)
  1436. if enable_per <= percentage
  1437. $game_switches[switch_on] = true
  1438. $game_switches[switch_off] = false
  1439. $game_map.need_refresh = true
  1440. end
  1441. end
  1442.  
  1443. #--------------------------------------------------------------------------
  1444. # ● Move Forward 2
  1445. #--------------------------------------------------------------------------
  1446. def move_forward2
  1447. return if moving2?
  1448. move_forward
  1449. end
  1450.  
  1451. #--------------------------------------------------------------------------
  1452. # ● Bounce Direction
  1453. #--------------------------------------------------------------------------
  1454. def bounce_direction #TESTE
  1455. @diagonal = true
  1456. turn_random
  1457. end
  1458.  
  1459. #--------------------------------------------------------------------------
  1460. # ● Turn_back
  1461. #--------------------------------------------------------------------------
  1462. def turn_back
  1463. if @diagonal_direction != 0
  1464. case @diagonal_direction
  1465. when 1
  1466. turn_upper_right
  1467. when 3
  1468. turn_upper_left
  1469. when 7
  1470. turn_lower_right
  1471. when 9
  1472. turn_lower_left
  1473. end
  1474. else
  1475. case @direction
  1476. when 2; set_direction(8)
  1477. when 4; set_direction(6)
  1478. when 6; set_direction(4)
  1479. when 8; set_direction(2)
  1480. end
  1481. end
  1482. end
  1483.  
  1484. #--------------------------------------------------------------------------
  1485. # ● Jump_high
  1486. #--------------------------------------------------------------------------
  1487. def jump_high(x_plus,y_plus,high = 10)
  1488. @x += x_plus
  1489. @y += y_plus
  1490. distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
  1491. @jump_peak = high + distance - @move_speed
  1492. @jump_count = @jump_peak * 2
  1493. @stop_count = 0
  1494. straighten
  1495. end
  1496.  
  1497. #--------------------------------------------------------------------------
  1498. # ● Passable Temp
  1499. #--------------------------------------------------------------------------
  1500. def passable_temp_id?(x, y)
  1501. return false unless $game_map.valid?(x, y)
  1502. return true if @through or debug_through? #TESTE
  1503. return false unless map_passable?(x, y,@direction)
  1504. return false if collide_with_characters_temp_id?(x, y)
  1505. return true
  1506. end
  1507.  
  1508. #--------------------------------------------------------------------------
  1509. # ● Collide With Characters
  1510. #--------------------------------------------------------------------------
  1511. def collide_with_characters_temp_id?(x, y)
  1512. for event in $game_map.events_xy(x, y)
  1513. unless event.through or event.battler != nil
  1514. return true if self.is_a?(Game_Event)
  1515. return true if event.priority_type >= 1
  1516. end
  1517. end
  1518. return false
  1519. end
  1520.  
  1521. #--------------------------------------------------------------------------
  1522. # ● Force Move Route
  1523. #--------------------------------------------------------------------------
  1524. alias x_force_move_route force_move_route
  1525. def force_move_route(move_route)
  1526. if self.battler != nil and self.is_a?(Game_Event)
  1527. return
  1528. end
  1529. x_force_move_route(move_route)
  1530. end
  1531. end
  1532. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1533. #■ MOVEMENT - PLAYER COMMANDS
  1534. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1535.  
  1536.  
  1537. #==============================================================================
  1538. # ■ Game_Player
  1539. #==============================================================================
  1540. class Game_Player < Game_Character
  1541. include XAS_BUTTON
  1542.  
  1543. #--------------------------------------------------------------------------
  1544. # ● Update Action Command
  1545. #--------------------------------------------------------------------------
  1546. def update_action_command
  1547. update_check_battler_equipment if can_check_battler_equipment?
  1548. update_dash_button
  1549. update_auto_target_shoot
  1550. update_combo_time
  1551. update_action_1_button
  1552. update_action_2_button
  1553. update_skill_button
  1554. update_item_button
  1555. update_change_leader_button
  1556. update_charge_button
  1557. end
  1558.  
  1559. #--------------------------------------------------------------------------
  1560. # ● Can Use Command?
  1561. #--------------------------------------------------------------------------
  1562. def can_use_command?
  1563. return false if $game_map.interpreter.running?
  1564. return false if $game_message.visible
  1565. return false if self.battler == nil
  1566. return false if self.action != nil
  1567. return false if self.knockbacking?
  1568. return false if @stop
  1569. return true
  1570. end
  1571.  
  1572. #--------------------------------------------------------------------------
  1573. # ● Update Check Battler Equipment
  1574. #--------------------------------------------------------------------------
  1575. def update_check_battler_equipment
  1576.  
  1577. end
  1578.  
  1579. #--------------------------------------------------------------------------
  1580. # ● Can Check Battler Equipment
  1581. #--------------------------------------------------------------------------
  1582. def can_check_battler_equipment?
  1583. if self.battler.old_equipment_id[0] != self.battler.equips[0] or
  1584. self.battler.old_equipment_id[1] != self.battler.equips[1] or
  1585. self.battler.old_equipment_id[2] != self.battler.equips[2] or
  1586. self.battler.old_equipment_id[3] != self.battler.equips[3] or
  1587. self.battler.old_equipment_id[4] != self.battler.equips[4]
  1588. self.battler.old_equipment_id[0] = self.battler.equips[0]
  1589. self.battler.old_equipment_id[1] = self.battler.equips[1]
  1590. self.battler.old_equipment_id[2] = self.battler.equips[2]
  1591. self.battler.old_equipment_id[3] = self.battler.equips[3]
  1592. self.battler.old_equipment_id[4] = self.battler.equips[4]
  1593. return true
  1594. end
  1595. return false
  1596. end
  1597.  
  1598. #--------------------------------------------------------------------------
  1599. # ● Update Charge Button
  1600. #--------------------------------------------------------------------------
  1601. def update_charge_button
  1602. return unless can_charge_command?
  1603. if Input.press?(ACTION_1_BUTTON) and ENABLE_ACTION_1_BUTTON
  1604. update_charge_effect(0)
  1605. if self.battler.x_charge_action[0] == 4
  1606. if $game_switches[55] == true
  1607. @direction_fix = true #TESTE
  1608. @dash_active = false
  1609. end
  1610. else
  1611. if self.battler.x_charge_action[0] == 49
  1612. if $game_switches[55] == true
  1613. @direction_fix = true #TESTE
  1614. @dash_active = false
  1615. end
  1616. else
  1617. @direction_fix = false #TESTE
  1618. end
  1619. end
  1620. if self.battler.x_charge_action[0] != 58#20
  1621. if self.battler.x_charge_action[0] != 31#20
  1622. if $game_switches[55] == true #SWITCH DE SPRITE DE CAST
  1623. make_pose("_Cast", 2) #TESTE
  1624. end
  1625. end
  1626. end
  1627. reset_charge_temp if Input.press?(ACTION_2_BUTTON) and ENABLE_ACTION_2_BUTTON
  1628. elsif Input.press?(ACTION_2_BUTTON)
  1629. update_charge_effect(1)
  1630. reset_charge_temp if Input.press?(ACTION_1_BUTTON)
  1631. else
  1632. if self.battler.x_charge_action[2] >= self.battler.x_charge_action[1]
  1633. self.shoot(self.battler.x_charge_action[0])
  1634. @direction_fix = false #TESTE
  1635. end
  1636. reset_charge_temp
  1637. end
  1638. end
  1639.  
  1640. #--------------------------------------------------------------------------
  1641. # ● Update Charge Effect
  1642. #--------------------------------------------------------------------------
  1643. def update_charge_effect(type)
  1644. if self.battler.x_charge_action[2] == 0
  1645. return unless equipped_charge_action?(type)
  1646. end
  1647. if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
  1648. self.battler.x_charge_action[2] += 1
  1649. end
  1650. self.battler.x_charge_action[3] += 1
  1651. if self.battler.x_charge_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
  1652. self.battler.x_charge_action[3] = 0
  1653. if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
  1654. self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION1_ID
  1655. else
  1656. self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION2_ID
  1657. end
  1658. end
  1659. end
  1660.  
  1661. #--------------------------------------------------------------------------
  1662. # ● Equipped Charge Action
  1663. #--------------------------------------------------------------------------
  1664. def equipped_charge_action?(type)
  1665. case type
  1666. when 0
  1667. weapon = self.battler.equips[0]
  1668. when 1
  1669. weapon = self.battler.equips[1]
  1670. end
  1671. if weapon == nil
  1672. return false
  1673. reset_charge_temp
  1674. end
  1675. if weapon.note =~ /<Charge Action = (\d+) - (\d+)>/
  1676. #make_pose("_Cast(12)", 2)
  1677. self.battler.x_charge_action[0] = $1.to_i rescue 0#Skill ID
  1678. self.battler.x_charge_action[1] = $2.to_i rescue 0#Max Time
  1679. self.battler.x_charge_action[2] = 0#Current Time
  1680. self.battler.x_charge_action[3] = 0#Loop Anime Time
  1681. return true
  1682. end
  1683. return false
  1684. reset_charge_temp
  1685. end
  1686.  
  1687. #--------------------------------------------------------------------------
  1688. # ● Update Combo Time
  1689. #--------------------------------------------------------------------------
  1690. def update_combo_time
  1691. return if self.battler.x_combo[2] == 0
  1692. self.battler.x_combo[2] -= 1
  1693. if self.battler.x_combo[2] == 0
  1694. self.battler.x_combo[0] = 0
  1695. self.battler.x_combo[1] = -1
  1696. end
  1697. end
  1698.  
  1699. #--------------------------------------------------------------------------
  1700. # ● Can Use Weapon Command?
  1701. #--------------------------------------------------------------------------
  1702. def can_use_weapon_command?
  1703. return false if $game_system.command_enable == false
  1704. return false unless ENABLE_ACTION_1_BUTTON
  1705. return false if self.battler.shield
  1706. return false if self.battler.cast_action[4] > 0
  1707. return false if self.battler.x_charge_action[2] > 0
  1708. return true
  1709. end
  1710.  
  1711. #--------------------------------------------------------------------------
  1712. # ● Can Use Shield Command?
  1713. #--------------------------------------------------------------------------
  1714. def can_use_shield_command?
  1715. return false if $game_system.command_enable == false
  1716. return false unless ENABLE_ACTION_2_BUTTON
  1717. return false if self.battler.equips[1] == nil
  1718. return false if self.battler.equips[1].id == 0
  1719. return false if self.battler.cast_action[4] > 0
  1720. return false if self.battler.x_charge_action[2] > 0
  1721. return true
  1722. end
  1723.  
  1724. #--------------------------------------------------------------------------
  1725. # ● Can Use Skill Command?
  1726. #--------------------------------------------------------------------------
  1727. def can_use_skill_command?
  1728. return false if $game_system.command_enable == false
  1729. return false unless ENABLE_SKILL_BUTTON
  1730. return false unless ENABLE_SKILL_BUTTON
  1731. #return false unless ENABLE_SKILL2_BUTTON
  1732. #return false unless ENABLE_SKILL2_BUTTON
  1733. return false if self.battler.shield
  1734. return false if self.battler.cast_action[4] > 0
  1735. return false if self.battler.x_charge_action[2] > 0
  1736. #return false if self.battler.skill_id == 60 and self.battler.equips[0] != 3
  1737. return true
  1738. end
  1739.  
  1740. #--------------------------------------------------------------------------
  1741. # ● Can Use Item Command?
  1742. #--------------------------------------------------------------------------
  1743. def can_use_item_command?
  1744. return false if $game_system.command_enable == false
  1745. return false unless ENABLE_ITEM_BUTTON
  1746. return false if self.battler.shield
  1747. return false if self.battler.cast_action[4] > 0
  1748. return false if self.battler.x_charge_action[2] > 0
  1749. return true
  1750. end
  1751.  
  1752. #--------------------------------------------------------------------------
  1753. # ● Can Charge Command
  1754. #--------------------------------------------------------------------------
  1755. def can_charge_command?
  1756. return false if $game_system.command_enable == false
  1757. return false if self.battler.cast_action[4] > 0
  1758. return false if self.battler.shield
  1759. return true
  1760. end
  1761.  
  1762. #--------------------------------------------------------------------------
  1763. # ● Can Use Change Leader Command?
  1764. #--------------------------------------------------------------------------
  1765. def can_use_change_leader_command?
  1766. return false unless ENABLE_CHANGE_LEADER_BUTTON
  1767. return false if self.battler.shield
  1768. return false if self.battler.cast_action[4] > 0
  1769. return false if self.battler.x_charge_action[2] > 0
  1770. return false if $game_temp.change_leader_wait_time > 0
  1771. return true
  1772. end
  1773.  
  1774. #--------------------------------------------------------------------------
  1775. # ● State_Seal Command
  1776. #--------------------------------------------------------------------------
  1777. def state_seal_command?(type)
  1778. seal = false
  1779. case type
  1780. when 0
  1781. seal = true if self.battler.state_mute
  1782. seal = true if self.battler.state_seal_attack
  1783. when 1
  1784. seal = true if self.battler.state_mute
  1785. seal = true if self.battler.state_seal_attack
  1786. when 2
  1787. seal = true if self.battler.state_mute
  1788. seal = true if self.battler.state_seal_skill
  1789. when 3
  1790. seal = true if self.battler.state_mute
  1791. seal = true if self.battler.state_seal_item
  1792. end
  1793. if seal
  1794. seal_effect
  1795. return true
  1796. end
  1797. return false
  1798. end
  1799.  
  1800. #--------------------------------------------------------------------------
  1801. # ● Check Equipped Action
  1802. #--------------------------------------------------------------------------
  1803. def check_equipped_action(command_type)
  1804. case command_type
  1805. when 0 # Weapon 1
  1806. weapon = self.battler.equips[0]
  1807. if weapon == nil
  1808. self.battler.x_action1_id = 0
  1809. return
  1810. end
  1811. weapon.note =~ /<Action ID = (\d+)>/
  1812. action_id = $1.to_i
  1813. action_id = 0 if action_id == nil
  1814. self.battler.x_action1_id = action_id
  1815. when 1 # Weapon 2
  1816. weapon = self.battler.equips[1]
  1817. if weapon == nil
  1818. self.battler.x_action2_id = 0
  1819. return
  1820. end
  1821. weapon.note =~ /<Action ID = (\d+)>/
  1822. action_id = $1.to_i
  1823. action_id = 0 if action_id == nil
  1824. self.battler.x_action2_id = action_id
  1825. when 2 # Skill
  1826.  
  1827. when 3 # Item
  1828. item_id = $data_items[self.battler.item_id]
  1829. if item_id == nil
  1830. self.battler.x_item_id = 0
  1831. return
  1832. end
  1833. item_id.note =~ /<Action ID = (\d+)>/
  1834. action_id = $1.to_i
  1835. action_id = 0 if action_id == nil
  1836. self.battler.x_item_id = action_id
  1837. end
  1838. end
  1839.  
  1840. #--------------------------------------------------------------------------
  1841. # ● Execute Combo
  1842. #--------------------------------------------------------------------------
  1843. def execute_combo?(type)
  1844. if type == self.battler.x_combo[1] and self.battler.x_combo[0] != 0
  1845. return if state_seal_command?(type)
  1846. self.shoot(self.battler.x_combo[0])
  1847. self.battler.x_combo[1] = type
  1848. return true
  1849. end
  1850. self.battler.x_combo[0] = 0
  1851. self.battler.x_combo[1] = type
  1852. self.battler.x_combo[2] = 0
  1853. return false
  1854. end
  1855.  
  1856. #--------------------------------------------------------------------------
  1857. # ● Update Change Leader Button
  1858. #--------------------------------------------------------------------------
  1859. def update_change_leader_button
  1860. if Input.trigger?(CHANGE_LEADER_BUTTON)
  1861. return unless can_use_change_leader_command?
  1862. change_leader
  1863. end
  1864. end
  1865.  
  1866. #--------------------------------------------------------------------------
  1867. # ● Update Action 1 Button
  1868. #--------------------------------------------------------------------------
  1869. def update_action_1_button
  1870. if Input.trigger?(ACTION_1_BUTTON)
  1871. type = 0
  1872. return unless can_use_weapon_command?
  1873. return if execute_combo?(type)
  1874. check_equipped_action(type)
  1875. action_id = self.battler.x_action1_id
  1876. return if action_id == 0
  1877. return if state_seal_command?(type)
  1878. self.shoot(action_id)
  1879. end
  1880. end
  1881.  
  1882. #--------------------------------------------------------------------------
  1883. # ● Update Action 2 Button
  1884. #--------------------------------------------------------------------------
  1885. def update_action_2_button
  1886. if Input.trigger?(ACTION_2_BUTTON)
  1887. if self.battler.equips[1].is_a?(RPG::Weapon)
  1888. type = 1
  1889. return unless can_use_weapon_command?
  1890. return if execute_combo?(type)
  1891. check_equipped_action(type)
  1892. action_id = self.battler.x_action2_id
  1893. return if action_id == 0
  1894. return if state_seal_command?(type)
  1895. self.shoot(action_id)
  1896. return
  1897. end
  1898. end
  1899. update_shield_button
  1900. end
  1901.  
  1902. #--------------------------------------------------------------------------
  1903. # ● Update Shield Button
  1904. #--------------------------------------------------------------------------
  1905. def update_shield_button
  1906. if Input.press?(ACTION_2_BUTTON)
  1907. if can_use_shield_command?
  1908. unless self.battler.shield
  1909. shield = self.battler.equips[1]
  1910. if shield.note =~ /<Action>/
  1911. if shield.note =~ /<Pose = (\w+)>/
  1912. make_pose($1.to_s, 2)
  1913. end
  1914. else
  1915. self.battler.shield = false #TESTE
  1916. return
  1917. end
  1918. end
  1919. self.battler.add_state(30)
  1920. self.battler.result.clear#actor.add_state(30)
  1921. self.x_pose_duration = 2
  1922. self.battler.shield = true
  1923. update_shield_diretion_button
  1924. else
  1925. self.battler.shield = false
  1926. end
  1927. else
  1928. self.battler.remove_state(30)
  1929. self.battler.result.clear#actor.remove_state(30)
  1930. self.battler.shield = false
  1931. end
  1932. end
  1933.  
  1934. #--------------------------------------------------------------------------
  1935. # ● update_shield_direction_button
  1936. #--------------------------------------------------------------------------
  1937. def update_shield_diretion_button
  1938. return if @direction_fix
  1939. self.battler.add_state(30)
  1940. case Input.dir4
  1941. when 2; set_direction(2)
  1942. when 4; set_direction(4)
  1943. when 6; set_direction(6)
  1944. when 8; set_direction(8)
  1945. end
  1946. end
  1947.  
  1948. #--------------------------------------------------------------------------
  1949. # ● Update Skill Button
  1950. #--------------------------------------------------------------------------
  1951. def update_skill_button
  1952. if Input.trigger?(SKILL_BUTTON)
  1953. type = 2
  1954. return unless can_use_skill_command?
  1955. return if execute_combo?(type)
  1956. check_equipped_action(type)
  1957. action_id = self.battler.skill_id
  1958. return if action_id == 0
  1959. return if state_seal_command?(type)
  1960. if $game_switches[60] == true#false
  1961. @skill = nil
  1962. else
  1963. self.shoot(action_id)
  1964. end
  1965. end
  1966. end
  1967.  
  1968. #--------------------------------------------------------------------------
  1969. # ● Update Item Button
  1970. #--------------------------------------------------------------------------
  1971. def update_item_button
  1972. if Input.trigger?(ITEM_BUTTON)
  1973. type = 3
  1974. return unless can_use_item_command?
  1975. return if execute_combo?(type)
  1976. check_equipped_action(type)
  1977. action_id = self.battler.x_item_id
  1978. return if action_id == 0
  1979. return if state_seal_command?(type)
  1980. self.shoot(action_id)
  1981. end
  1982. end
  1983.  
  1984. #--------------------------------------------------------------------------
  1985. # ● Update Auto Target Shoot
  1986. #--------------------------------------------------------------------------
  1987. def update_auto_target_shoot
  1988. return if $game_temp.xas_target_time == 0
  1989. return if $game_temp.xas_target_shoot_id == 0
  1990. return if $game_temp.xas_target_x == 0 and $game_temp.xas_target_y == 0
  1991. $game_temp.xas_target_time -= 1
  1992. if $game_temp.xas_target_time == 0
  1993. self.shoot($game_temp.xas_target_shoot_id)
  1994. $game_temp.xas_target_shoot_id = 0
  1995. end
  1996. end
  1997.  
  1998. #--------------------------------------------------------------------------
  1999. # ● Dash?
  2000. #--------------------------------------------------------------------------
  2001. alias x_dash dash?
  2002. def dash?
  2003. return false if XAS_SYSTEM::DASH_SYSTEM
  2004. x_dash
  2005. end
  2006.  
  2007. #--------------------------------------------------------------------------
  2008. # ● Can Dash?
  2009. #--------------------------------------------------------------------------
  2010. def can_dash?
  2011. return false unless XAS_BUTTON::ENABLE_DASH_BUTTON
  2012. return false if self.battler.shield
  2013. return true if Input.press?(XAS_BUTTON::DASH_BUTTON)
  2014. @dash_active = false
  2015. return false
  2016. end
  2017.  
  2018. #--------------------------------------------------------------------------
  2019. # ● Update Dash Command
  2020. #--------------------------------------------------------------------------
  2021. def update_dash_button
  2022. return unless can_dash?
  2023. @dash_active = true
  2024. @anime_count -= 0.9 if moving? #-= 0.5 if moving?
  2025. update_dash_sprite_name
  2026. end
  2027.  
  2028. #--------------------------------------------------------------------------
  2029. # ● Update Dash Sprite Name
  2030. #--------------------------------------------------------------------------
  2031. def update_dash_sprite_name
  2032. make_pose("_Dash", 2) #make_pose("_Dash", 2) , make_pose("_Dash[FR6]", 4)
  2033. end
  2034.  
  2035. end
  2036. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2037. #■ TOOL - INITIALIZE
  2038. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2039.  
  2040.  
  2041. #===============================================================================
  2042. # ■ Game_Map
  2043. #===============================================================================
  2044. class Game_Map
  2045.  
  2046. attr_accessor :need_refresh_token
  2047.  
  2048. #--------------------------------------------------------------------------
  2049. # ● need_add_tokens
  2050. #--------------------------------------------------------------------------
  2051. def need_add_tokens
  2052. @need_add_tokens = [] if @need_add_tokens == nil
  2053. return @need_add_tokens
  2054. end
  2055.  
  2056. #--------------------------------------------------------------------------
  2057. # ● need_remove_tokens
  2058. #--------------------------------------------------------------------------
  2059. def need_remove_tokens
  2060. @need_remove_tokens = [] if @need_remove_tokens == nil
  2061. return @need_remove_tokens
  2062. end
  2063.  
  2064. #--------------------------------------------------------------------------
  2065. # ● add_token
  2066. #--------------------------------------------------------------------------
  2067. def add_token(token_event)
  2068. $game_temp.tool_event = [] if $game_temp.tool_event == nil
  2069. $game_temp.tool_event.push(token_event)
  2070. self.need_add_tokens.push(token_event)
  2071. self.need_refresh_token = true
  2072. end
  2073.  
  2074. #--------------------------------------------------------------------------
  2075. # ● remove_token
  2076. #--------------------------------------------------------------------------
  2077. def remove_token(token_event)
  2078. @events.delete(token_event.id)
  2079. self.need_remove_tokens.push(token_event)
  2080. self.need_refresh_token = true
  2081. end
  2082.  
  2083. #--------------------------------------------------------------------------
  2084. # ● clear_tokens
  2085. #--------------------------------------------------------------------------
  2086. def clear_tokens
  2087. $game_system.tools_on_map.clear
  2088. $game_system.tools_on_map = []
  2089. for event in @events.values.dup
  2090. remove_token(event) if event.is_a?(Token_Event)
  2091. end
  2092. channels = ["A", "B", "C", "D"]
  2093. for id in 1001..(token_id_shift - 1)
  2094. for a in channels
  2095. key = [self.map_id, id, a]
  2096. $game_self_switches.delete(key)
  2097. end
  2098. end
  2099. clear_token_id
  2100. end
  2101.  
  2102. #--------------------------------------------------------------------------
  2103. # ● Update
  2104. #--------------------------------------------------------------------------
  2105. alias x_temp_tool_hash_update update
  2106. def update(main = false)
  2107. x_temp_tool_hash_update(main)
  2108. update_add_tool_hash
  2109. end
  2110.  
  2111. #--------------------------------------------------------------------------
  2112. # ● Update Add Toll Hash
  2113. #--------------------------------------------------------------------------
  2114. def update_add_tool_hash
  2115. return if $game_temp.tool_event == nil
  2116. for i in $game_temp.tool_event
  2117. $game_map.events[i.id] = i
  2118. execute_tool_effects_hash(i)
  2119. end
  2120. $game_temp.tool_event.clear
  2121. $game_temp.tool_event = nil
  2122. end
  2123.  
  2124. #--------------------------------------------------------------------------
  2125. # ● Execute Toll Effects Hash
  2126. #--------------------------------------------------------------------------
  2127. def execute_tool_effects_hash(i)
  2128.  
  2129. end
  2130. end
  2131.  
  2132. #===============================================================================
  2133. # ■ Game_SelfSwitches
  2134. #===============================================================================
  2135. class Game_SelfSwitches
  2136. def delete(key)
  2137. @data.delete(key)
  2138. end
  2139. end
  2140.  
  2141. #===============================================================================
  2142. # ■ Game_Map
  2143. #===============================================================================
  2144. class Game_Map
  2145.  
  2146. attr_accessor :token_id
  2147.  
  2148. #--------------------------------------------------------------------------
  2149. # ● token_id_shift
  2150. #--------------------------------------------------------------------------
  2151. def token_id_shift
  2152. @token_id = 1000 if @token_id == nil
  2153. @token_id += 1
  2154. return @token_id
  2155. end
  2156.  
  2157. #--------------------------------------------------------------------------
  2158. # ● clear_token_id
  2159. #--------------------------------------------------------------------------
  2160. def clear_token_id
  2161. @token_id = nil
  2162. end
  2163. end
  2164.  
  2165. #===============================================================================
  2166. # ■ XRXS_CTS_RefreshToken
  2167. #===============================================================================
  2168. module XRXS_CTS_RefreshToken
  2169.  
  2170. #--------------------------------------------------------------------------
  2171. # ● refresh_token
  2172. #--------------------------------------------------------------------------
  2173. def refresh_token
  2174. for event in $game_map.need_add_tokens
  2175. @character_sprites.push(Sprite_Character.new(@viewport1, event))
  2176. end
  2177. $game_map.need_add_tokens.clear
  2178. for sprite in @character_sprites.dup
  2179. if $game_map.need_remove_tokens.empty?
  2180. break
  2181. end
  2182. if $game_map.need_remove_tokens.delete(sprite.character)
  2183. @character_sprites.delete(sprite)
  2184. sprite.dispose
  2185. end
  2186. end
  2187. $game_map.need_refresh_token = false
  2188. end
  2189. end
  2190.  
  2191. #===============================================================================
  2192. # ■ Spriteset_Map
  2193. #===============================================================================
  2194. class Spriteset_Map
  2195. include XRXS_CTS_RefreshToken
  2196.  
  2197. #--------------------------------------------------------------------------
  2198. # ● Initialize
  2199. #--------------------------------------------------------------------------
  2200. alias x_smap_initialize initialize
  2201. def initialize
  2202. setup_start
  2203. x_smap_initialize
  2204. end
  2205.  
  2206. #--------------------------------------------------------------------------
  2207. # ● Setup Start
  2208. #--------------------------------------------------------------------------
  2209. def setup_start
  2210. $game_player.reset_old_level(true)
  2211. end
  2212.  
  2213. end
  2214.  
  2215. #===============================================================================
  2216. # ■ Game_Player
  2217. #===============================================================================
  2218. class Game_Player < Game_Character
  2219.  
  2220. #--------------------------------------------------------------------------
  2221. # ● x_reserve_transfer
  2222. #--------------------------------------------------------------------------
  2223. alias x_reserve_transfer reserve_transfer
  2224. def reserve_transfer(map_id, x, y, direction)
  2225. $game_map.clear_tokens
  2226. if $game_temp.tool_event != nil
  2227. $game_temp.tool_event.clear
  2228. $game_temp.tool_event = nil
  2229. end
  2230. x_reserve_transfer(map_id, x, y, direction)
  2231. end
  2232.  
  2233. end
  2234.  
  2235. #===============================================================================
  2236. # ■ Token_Event
  2237. #===============================================================================
  2238. class Token_Event < Game_Event
  2239.  
  2240. #--------------------------------------------------------------------------
  2241. # ● Token_Event
  2242. #--------------------------------------------------------------------------
  2243. def initialize(map_id, event)
  2244. event.id = $game_map.token_id_shift
  2245. super
  2246. end
  2247.  
  2248. #--------------------------------------------------------------------------
  2249. # ● erase
  2250. #--------------------------------------------------------------------------
  2251. def erase
  2252. super
  2253. $game_map.remove_token(self)
  2254. end
  2255. end
  2256.  
  2257.  
  2258. #===============================================================================
  2259. # ■ XRXS_ActionTemplate
  2260. #===============================================================================
  2261. module XRXS_ActionTemplate
  2262. map_id = XAS_SYSTEM::ACTION_TEMPLATE_MAP_ID
  2263. map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  2264. @@events = map.events
  2265. end
  2266.  
  2267. #===============================================================================
  2268. # ■ Token_Event
  2269. #===============================================================================
  2270. class Token_Event < Game_Event
  2271. include XRXS_ActionTemplate
  2272. end
  2273.  
  2274. #===============================================================================
  2275. # ■ Game_Temp
  2276. #===============================================================================
  2277. class Game_Temp
  2278. attr_accessor :active_token
  2279. end
  2280.  
  2281. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2282. #■ TOOL - SHOOT COMMAND
  2283. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2284.  
  2285.  
  2286. #===============================================================================
  2287. # ■ XAS ACTION
  2288. #===============================================================================
  2289. module XAS_ACTION
  2290. attr_reader :action
  2291. attr_reader :erased
  2292.  
  2293. #--------------------------------------------------------------------------
  2294. # ● shoot
  2295. #--------------------------------------------------------------------------
  2296. def shoot(action_id = 0)
  2297. return if action_id == 0
  2298. skill = $data_skills[action_id]
  2299. return unless can_shoot?(skill)
  2300. execute_user_effects(skill)
  2301. execute_call_event(action_id)
  2302. self.action_attachment(action_id)
  2303. execute_set_pose(action_id)
  2304. end
  2305.  
  2306. #--------------------------------------------------------------------------
  2307. # ● Can Shoot
  2308. #--------------------------------------------------------------------------
  2309. def can_shoot?(skill)
  2310. if self.battler == nil and self.tool_id > 0
  2311. @battler = self.action.user.battler
  2312. end
  2313. return false if self.battler == nil
  2314. return false if skill == nil
  2315. return true if ignore_can_shoot?(skill)
  2316. enough_cost = true
  2317. return false if tools_on_map?(skill.id)
  2318. if self.battler.state_mute
  2319. seal_effect
  2320. return false
  2321. end
  2322. if self.battler.cast_action[4].between?(1,self.battler.cast_action[1] -1)
  2323. return false
  2324. end
  2325. return false if check_cast_action?(skill)
  2326. return false if check_auto_target_select?(skill)
  2327. unless enough_skill_cost?(skill)
  2328. #Audio.se_play("Audio/SE/" + XAS_SOUND::ACTION_COST , 100, 100) #TESTE
  2329. return false
  2330. end
  2331. return true
  2332. end
  2333.  
  2334. #--------------------------------------------------------------------------
  2335. # ● Ignore Can Shoot?
  2336. #--------------------------------------------------------------------------
  2337. def ignore_can_shoot?(skill)
  2338. return false
  2339. end
  2340.  
  2341. #--------------------------------------------------------------------------
  2342. # ● Tools on Map
  2343. #--------------------------------------------------------------------------
  2344. def tools_on_map?(skill_id)
  2345. return true if $game_system.tools_on_map.include?(skill_id)
  2346. return false
  2347. end
  2348.  
  2349. #--------------------------------------------------------------------------
  2350. # ● Check Cast Action
  2351. #--------------------------------------------------------------------------
  2352. def check_cast_action?(skill)
  2353. if self.battler.cast_action[0] != 0
  2354. self.battler.cast_action[0] = 0
  2355. self.battler.cast_action[1] = 0
  2356. self.battler.cast_action[2] = 0
  2357. self.battler.cast_action[3] = 0
  2358. self.battler.cast_action[4] = 0
  2359. return false
  2360. end
  2361. if skill.note =~ /<Cast Time = (\d+)>/ and
  2362. $game_temp.xas_target_shoot_id == 0 and
  2363. self.force_action_times == 0
  2364. self.battler.cast_action[0] = skill.id
  2365. self.battler.cast_action[1] = $1.to_i rescue 0
  2366. self.battler.cast_action[2] = $game_variables[XAS_ANIMATION::CAST_TIME_ANIMATION_ID]
  2367. self.battler.cast_action[3] = 0
  2368. self.battler.cast_action[4] = 0
  2369. self.animation_id = self.battler.cast_action[2]
  2370. return true
  2371. end
  2372. return false
  2373. end
  2374.  
  2375. #--------------------------------------------------------------------------
  2376. # ● Check Auto Target Select
  2377. #--------------------------------------------------------------------------
  2378. def check_auto_target_select?(skill)
  2379. return false if self.is_a?(Game_Event)
  2380. if skill.note =~ /<Auto Target>/
  2381. if $game_temp.xas_target_shoot_id == 0
  2382. $game_temp.xas_target_shoot_id = skill.id
  2383. $game_map.check_events_on_screen
  2384. SceneManager.call(Scene_Target_Select)
  2385. return true
  2386. end
  2387. end
  2388. return false
  2389. end
  2390.  
  2391. #--------------------------------------------------------------------------
  2392. # ● enough_skill_cost?
  2393. #--------------------------------------------------------------------------
  2394. def enough_skill_cost?(skill)
  2395. return false unless enough_mp_cost?(skill)
  2396. return false unless enough_item_cost?(skill)
  2397. return true
  2398. end
  2399.  
  2400. #--------------------------------------------------------------------------
  2401. # ● Enough MP Cost
  2402. #--------------------------------------------------------------------------
  2403. def enough_mp_cost?(skill)
  2404. if @force_action_times > 0
  2405. return true if @force_action == "All Shoot"
  2406. return true if @force_action == "Four Shoot"
  2407. return true if @force_action == "Three Shoot"
  2408. return true if @force_action == "Two Shoot"
  2409. end
  2410. if self.battler.mp < skill.mp_cost
  2411. self.battler.damage = XAS_WORD::NO_MP
  2412. self.battler.damage_pop = true
  2413. return false
  2414. else
  2415. self.battler.mp -= skill.mp_cost
  2416. return true
  2417. end
  2418. return true
  2419. end
  2420.  
  2421. #--------------------------------------------------------------------------
  2422. # ● Enough MP Cost
  2423. #--------------------------------------------------------------------------
  2424. def enough_item_cost?(skill)
  2425. return true if self.battler.is_a?(Game_Enemy)
  2426. if @force_action_times > 0
  2427. return true if @force_action == "All Shoot"
  2428. return true if @force_action == "Four Shoot"
  2429. return true if @force_action == "Three Shoot"
  2430. return true if @force_action == "Two Shoot"
  2431. end
  2432. skill.note =~ /<Item Cost = (\d+)>/
  2433. item_id = $1.to_i
  2434. if item_id != nil and item_id != 0
  2435. item_cost = $data_items[item_id]
  2436. number = $game_party.item_number(item_cost)
  2437. if number == 0 or number == nil
  2438. self.battler.damage = XAS_WORD::NO_ITEM
  2439. self.battler.damage_pop = true
  2440. return false
  2441. else
  2442. $game_party.lose_item(item_cost, 1, false)
  2443. return true
  2444. end
  2445. end
  2446. return true
  2447. end
  2448.  
  2449. #--------------------------------------------------------------------------
  2450. # ● Execute User Effects
  2451. #--------------------------------------------------------------------------
  2452. def execute_user_effects(skill)
  2453. self.battler.shield = false
  2454. #Animation
  2455. if skill.note =~ /<Cast Ani = (\d+)>/
  2456. ani_id = $1.to_i
  2457. if ani_id != nil
  2458. self.animation_id = ani_id
  2459. end
  2460. end
  2461. unless @force_action_times > 0
  2462. #All Directions
  2463. if skill.note =~ /<All Directions>/
  2464. @force_action = "All Shoot"
  2465. @force_action_times = 8
  2466. elsif skill.note =~ /<Four Directions>/
  2467. @force_action = "Four Shoot"
  2468. @force_action_times = 4
  2469. elsif skill.note =~ /<Three Directions>/
  2470. @force_action = "Three Shoot"
  2471. @force_action_times = 3
  2472. elsif skill.note =~ /<Two Directions>/
  2473. @force_action = "Two Shoot"
  2474. @force_action_times = 2
  2475. #elsif skill.note =~ /<Two Diagonals>/
  2476. #@force_action = "Two DShoot"
  2477. #@force_action_times = 2
  2478. end
  2479. end
  2480. end
  2481.  
  2482. #--------------------------------------------------------------------------
  2483. # ● Execute Set Pose
  2484. #--------------------------------------------------------------------------
  2485. def execute_set_pose(action_id)
  2486. @action.duration = @action.sunflag
  2487. make_pose(@action.self_motion, @action.sunflag )
  2488. @pattern = 0
  2489. @pattern_count = 0
  2490. @step_anime = false if self.is_a?(Game_Player) #false TESTE
  2491. @self_motion = nil
  2492. self.need_refresh = true if self.is_a?(Game_Player)
  2493. end
  2494.  
  2495. #--------------------------------------------------------------------------
  2496. # ● execute_call_event
  2497. #--------------------------------------------------------------------------
  2498. def execute_call_event(action_id)
  2499. bullet_token = Token_Bullet.new(self, action_id)
  2500. $game_map.add_token(bullet_token)
  2501. return bullet_token
  2502. end
  2503.  
  2504. #--------------------------------------------------------------------------
  2505. # ● action_attachment
  2506. #--------------------------------------------------------------------------
  2507. def action_attachment(action_id)
  2508. @action = Game_Action_XAS.new(self, action_id)
  2509. @action.attachment(action_id)
  2510. end
  2511.  
  2512. end
  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. #if $game_actor[1].equips[1].id == 9#.id == 9#self.battler.equips[1] == 9
  2702. @ignore_guard = true #TESTE
  2703. # guard_animation_id = 35
  2704. #else
  2705. # @ignore_guard = true #TESTE
  2706. #end
  2707.  
  2708. end
  2709. if @skill.note =~ /<One Action>/
  2710. unless $game_system.tools_on_map.include?(action_id)
  2711. $game_system.tools_on_map.push(action_id)
  2712. end
  2713. end
  2714. if @skill.note =~ /<Shake>/
  2715. @hit_shake = true
  2716. end
  2717. if @skill.note =~ /<User Range>/
  2718. @short_range = true
  2719. end
  2720. if @skill.note =~ /<Hit Hold Target>/
  2721. @hit_hold_target = true
  2722. end
  2723. if @skill.note =~ /<Hit Sticky Target>/
  2724. @sticky = true
  2725. end
  2726. if @skill.note =~ /<Hit Bounce Direction>/
  2727. @hit_bounce = true
  2728. end
  2729. if @skill.note =~ /<Reflectable>/
  2730. @reflectable = true
  2731. end
  2732. if @skill.note =~ /<Can Reflect>/
  2733. @can_reflect = true
  2734. end
  2735. if @skill.note =~ /<Disable Hit>/
  2736. @impact = false
  2737. end
  2738. @sunflag = 1 if @sunflag <= 0
  2739. end
  2740.  
  2741. #--------------------------------------------------------------------------
  2742. # ● update
  2743. #--------------------------------------------------------------------------
  2744. def update
  2745. @first_impact_time -= 1 if @first_impact_time > 0
  2746. if @attack_id_plan != nil
  2747. id = @attack_id_plan[@now_count]
  2748. unless id.nil?
  2749. @attack_id = id
  2750. @hit_events.clear
  2751. @hit_events.push(self.user) unless @all_damage or @ally_damage
  2752. end
  2753. end
  2754. if @attack_range_plan != nil
  2755. range = @attack_range_plan[@now_count]
  2756. @attack_range = range unless range.nil?
  2757. end
  2758. @now_count += 1
  2759. end
  2760.  
  2761. #--------------------------------------------------------------------------
  2762. # ● done?
  2763. #--------------------------------------------------------------------------
  2764. def done?
  2765. return (self.duration.to_i > 0 and self.now_count >= self.duration)
  2766. end
  2767. end
  2768.  
  2769. #===============================================================================
  2770. # ■ Token_Bullet
  2771. #===============================================================================
  2772. class Token_Bullet < Token_Event
  2773. include XRXS_ActionTemplate
  2774. #--------------------------------------------------------------------------
  2775. # ● initialize
  2776. #--------------------------------------------------------------------------
  2777. def initialize(user, action_id)
  2778. event_id = action_id
  2779. skill = $data_skills[action_id]
  2780. if skill.note =~ /<Event ID = (\d+)>/
  2781. event_id = $1.to_i
  2782. end
  2783. original_event = @@events[event_id]
  2784. if original_event == nil
  2785. msgbox("There's no Event ID " + event_id.to_s + " on Tool Map!")
  2786. SceneManager.exit
  2787. return
  2788. end
  2789. event = original_event.dup
  2790. event.x = user.x
  2791. event.y = user.y
  2792. pre_direction = event.pages[0].graphic.direction
  2793. event.pages[0].graphic.direction = user.direction
  2794. @character_name = event.pages[0].graphic
  2795. super($game_map.map_id, event)
  2796. self.action_attachment(action_id)
  2797. self.tool_id = action_id
  2798. self.diagonal = false
  2799. self.diagonal_direction = 0
  2800. self.sprite_angle_enable = false
  2801. @action.user = user
  2802. @remain_for_an_act = @action.duration.is_a?(Numeric)
  2803. check_tool_effects(user,skill,pre_direction)
  2804. end
  2805.  
  2806. #--------------------------------------------------------------------------
  2807. # ● update
  2808. #--------------------------------------------------------------------------
  2809. def update
  2810. super
  2811. if @action == nil and @remain_for_an_act
  2812. erase
  2813. $game_system.tools_on_map.delete(self.tool_id)
  2814. end
  2815. check_event_trigger_attack
  2816. end
  2817. end
  2818.  
  2819. #===============================================================================
  2820. # ■ Game Player
  2821. #===============================================================================
  2822. class Game_Player < Game_Character
  2823. attr_accessor :need_refresh
  2824. end
  2825.  
  2826. #===============================================================================
  2827. # ■ Token_Bullet
  2828. #===============================================================================
  2829. class Token_Bullet < Token_Event
  2830.  
  2831. #--------------------------------------------------------------------------
  2832. # ● Check Tool Effects
  2833. #--------------------------------------------------------------------------
  2834. def check_tool_effects(user,skill,pre_direction)
  2835. if @action.ally_damage or @action.all_damage
  2836. user.battler.invunerable_duration = 0
  2837. end
  2838. # Force Update Out Screen
  2839. if user.battler.sensor_range >= 15 or
  2840. skill.note =~ /<Update Out Screen>/
  2841. self.force_update = true
  2842. end
  2843. #Diagonal Effect
  2844. if skill.note =~ /<Diagonal>/ or
  2845. skill.note =~ /<All Direction>/ or
  2846. skill.note =~ /<Three Direction>/
  2847. self.diagonal = true
  2848. self.diagonal_direction = user.diagonal_direction
  2849. self.sprite_angle_enable = true
  2850. user.diagonal_time = XAS_BA::DIAGONAL_DURATION if user.diagonal_direction != 0
  2851. user.diagonal = true if user.tool_id > 0
  2852. end
  2853. #Auto Target
  2854. if skill.note =~ /<Auto Target>/
  2855. if user.is_a?(Game_Event)
  2856. self.moveto($game_player.x, $game_player.y)
  2857. else
  2858. moveto($game_temp.xas_target_x, $game_temp.xas_target_y)
  2859. $game_temp.xas_target_x = 0
  2860. $game_temp.xas_target_y = 0
  2861. $game_temp.xas_target_time = 0
  2862. $game_temp.xas_target_shoot_id = 0
  2863. end
  2864. end
  2865. #Barrier
  2866. if skill.note =~ /<Barrier>/
  2867. self.tool_effect = "Barrier"
  2868. end
  2869. #Boomerang
  2870. if skill.note =~ /<Boomerang = (\d+)>/
  2871. self.tool_effect = "Boomerang"
  2872. self.action.duration = 1000
  2873. self.diagonal = true
  2874. self.diagonal_direction = user.diagonal_direction
  2875. self.force_update = true
  2876. @move_frequency = 6
  2877. @move_speed = 5
  2878. @direction_fix = false
  2879. @walk_anime = true
  2880. @step_anime = true
  2881. @force_action = "Forward"
  2882. @force_action_times = $1.to_i
  2883. end
  2884.  
  2885. end
  2886. end
  2887. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2888. #■ TOOL - AREA
  2889. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2890.  
  2891.  
  2892. #===============================================================================
  2893. # ■ XAS ACTION
  2894. #===============================================================================
  2895. module XAS_ACTION
  2896.  
  2897. #--------------------------------------------------------------------------
  2898. # ● action_update
  2899. #--------------------------------------------------------------------------
  2900. def action_update
  2901. return unless @action.is_a?(Game_Action_XAS)
  2902. if @action.animation_time != [] and
  2903. @action.animation_time[0] == @action.now_count
  2904. animation_id = @action.animation_time[1]
  2905. unless self.is_a?(Game_Player) or self.tool_id == 0
  2906. self.animation_id = animation_id
  2907. end
  2908. end
  2909. @action.update
  2910. end
  2911.  
  2912. #--------------------------------------------------------------------------
  2913. # ● Can Impact Target
  2914. #--------------------------------------------------------------------------
  2915. def can_impact_target?
  2916. return false if @action.nil?
  2917. return false if @action.attack_id == 0
  2918. return false if @action.first_impact_time > 0
  2919. return false if @action.impact == false
  2920. return false if self.jumping?
  2921. return true
  2922. end
  2923.  
  2924. #--------------------------------------------------------------------------
  2925. # ● check_event_trigger_attack
  2926. #--------------------------------------------------------------------------
  2927. def check_event_trigger_attack()
  2928. return unless can_impact_target?
  2929. hit_check = false
  2930. range = @action.attack_range
  2931. hit = []
  2932. targets = [$game_player] + $game_map.events.values
  2933. for event in targets
  2934. next if event == self or
  2935. @action.hit_events.include?(event) or event.erased
  2936. body_size = event.body_size
  2937. event_center_x = event.x
  2938. event_center_y = event.y - body_size
  2939. if @action.short_range
  2940. dx = event_center_x - $game_player.x
  2941. dy = event_center_y - $game_player.y
  2942. else
  2943. dx = event_center_x - self.x
  2944. dy = event_center_y - self.y
  2945. end
  2946. dx = (dx >= 0 ? [dx - body_size, 0].max : [dx + body_size, 0].min)
  2947. dy = (dy >= 0 ? [dy - body_size, 0].max : [dy + body_size, 0].min)
  2948. hit_check = true if in_range?(dx,dy,event,range)
  2949. hit.push(event) if hit_check
  2950. hit_check = false
  2951. end
  2952. for event in hit
  2953. if event.action_effect(self, self.action.attack_id)
  2954. hit_check = true
  2955. end
  2956. if event.action_effect_page(self, self.action.attack_id)
  2957. hit_check = true
  2958. end
  2959. @action.hit_events.push(event) unless @action.multi_hit
  2960. end
  2961. if hit_check
  2962. $game_temp.active_token = self
  2963. end
  2964. end
  2965.  
  2966. #--------------------------------------------------------------------------
  2967. # ● In Range?
  2968. #--------------------------------------------------------------------------
  2969. def in_range?(dx,dy,event,range)
  2970. case @action.attack_range_type
  2971. when 1 #RHOMBUS
  2972. return true if (dx.abs + dy.abs <= range)
  2973. when 2 #SQUARE
  2974. return true if (dx.abs <= range and dy.abs <= range)
  2975. when 3 #LINE
  2976. case self.direction
  2977. when 2
  2978. return true if (dx == 0 and dy >= 0 and dy <= range)
  2979. when 8
  2980. return true if (dx == 0 and dy <= 0 and dy >= -range)
  2981. when 6
  2982. return true if (dy == 0 and dx >= 0 and dx <= range)
  2983. when 4
  2984. return true if (dy == 0 and dx <= 0 and dx >= -range)
  2985. end
  2986. when 4 #FRONT SQUARE
  2987. case self.direction
  2988. when 2
  2989. return true if (dx.abs <= range and dy >= 0 and dy.abs <= range)
  2990. when 4
  2991. return true if (dx.abs <= range and dx <= 0 and dy.abs <= range)
  2992. when 6
  2993. return true if (dx.abs <= range and dx >= 0 and dy.abs <= range)
  2994. when 8
  2995. return true if (dx.abs <= range and dy <= 0 and dy.abs <= range)
  2996. end
  2997. when 5 #FRONT RHOMBUS
  2998. case self.direction
  2999. when 2
  3000. return true if (dx.abs + dy.abs <= range and dy >= 0)
  3001. when 8
  3002. return true if (dx.abs + dy.abs <= range and dy <= 0)
  3003. when 6
  3004. return true if (dx.abs + dy.abs <= range and dx >= 0)
  3005. when 4
  3006. return true if (dx.abs + dy.abs <= range and dx <= 0)
  3007. end
  3008. when 6 #WALL
  3009. case self.direction
  3010. when 2
  3011. return true if (dx.abs <= range and dy == 0 )
  3012. when 4
  3013. return true if (dy.abs <= range and dx == 0)
  3014. when 6
  3015. return true if (dy.abs <= range and dx == 0)
  3016. when 8
  3017. return true if (dx.abs <= range and dy == 0)
  3018. end
  3019. when 7 #CROSS
  3020. return true if (dx.abs <= range and dy == 0)
  3021. return true if (dy.abs <= range and dx == 0)
  3022. end
  3023. return false
  3024. end
  3025.  
  3026. #--------------------------------------------------------------------------
  3027. # ● action_effect Page
  3028. #--------------------------------------------------------------------------
  3029. def action_effect_page(attacker, attack_id)
  3030. return false unless self.is_a?(Game_Event)
  3031. return false if attacker.action.fake_id
  3032. if attacker.action != nil
  3033. check_auto_effect_page(attacker, attack_id)
  3034. check_reflectable_skills(attacker, attack_id)
  3035. end
  3036. for page in @event.pages
  3037. if page.condition.variable_valid and
  3038. page.condition.variable_id == XAS_SYSTEM::HIT_ID and
  3039. page.condition.variable_value == attack_id
  3040. self.reaction_valid_attack_id = attack_id
  3041. self.refresh
  3042. @trigger = 0
  3043. self.start
  3044. return true
  3045. end
  3046. end
  3047. return false
  3048. end
  3049.  
  3050. #--------------------------------------------------------------------------
  3051. # ● Check Reflectable Skills
  3052. #--------------------------------------------------------------------------
  3053. def check_reflectable_skills(attacker, attack_id)
  3054. return if self.tool_id == 0
  3055. return unless self.action.reflectable
  3056. return unless attacker.action.can_reflect
  3057. self.action.user = attacker.action.user
  3058. self.action.hit_events = []
  3059. self.turn_back
  3060. end
  3061.  
  3062. #--------------------------------------------------------------------------
  3063. # ● Check Auto Effect Page
  3064. #--------------------------------------------------------------------------
  3065. def check_auto_effect_page(attacker, attack_id)
  3066. if self.treasure_time > 0
  3067. if can_hit_take_treasure?(attacker, attack_id)
  3068. execute_take_treasure(attacker, attack_id)
  3069. elsif self.temp_id == 0 and can_hold_treasure?(attacker, attack_id)
  3070. execute_hold_treasure(attacker, attack_id)
  3071. end
  3072. end
  3073. end
  3074.  
  3075. #--------------------------------------------------------------------------
  3076. # ● Can Hit Take Treasure
  3077. #--------------------------------------------------------------------------
  3078. def can_hit_take_treasure?(attacker, attack_id)
  3079. return true if attacker.action.short_range
  3080. return false
  3081. end
  3082.  
  3083. #--------------------------------------------------------------------------
  3084. # ● Can Hold Treasure?
  3085. #--------------------------------------------------------------------------
  3086. def can_hold_treasure?(attacker, attack_id)
  3087. return true if attacker.tool_effect == "Boomerang"
  3088. return false
  3089. end
  3090.  
  3091. #--------------------------------------------------------------------------
  3092. # ● Execute Hold Treasure
  3093. #--------------------------------------------------------------------------
  3094. def execute_hold_treasure(attacker, attack_id)
  3095. tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
  3096. return if self.treasure_time > tr_time
  3097. self.temp_id = attacker.id
  3098. end
  3099.  
  3100. #--------------------------------------------------------------------------
  3101. # ● Execute Take Treasure
  3102. #--------------------------------------------------------------------------
  3103. def execute_take_treasure(attacker, attack_id)
  3104. tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
  3105. return if self.treasure_time > tr_time
  3106. self.x = $game_player.x
  3107. self.y = $game_player.y
  3108. end
  3109.  
  3110. #--------------------------------------------------------------------------
  3111. # ● body_size
  3112. #--------------------------------------------------------------------------
  3113. def body_size
  3114. return 0
  3115. end
  3116.  
  3117. #--------------------------------------------------------------------------
  3118. # ● action_clear
  3119. #--------------------------------------------------------------------------
  3120. def action_clear
  3121. @action = nil
  3122. @step_anime = false
  3123. end
  3124. end
  3125.  
  3126. #===============================================================================
  3127. # ■ Game_Character
  3128. #===============================================================================
  3129. class Game_Character < Game_CharacterBase
  3130. include XAS_ACTION
  3131. end
  3132.  
  3133. #===============================================================================
  3134. # ■ Game_Event
  3135. #===============================================================================
  3136. class Game_Event < Game_Character
  3137.  
  3138. #--------------------------------------------------------------------------
  3139. # * Refresh
  3140. #--------------------------------------------------------------------------
  3141. alias x_conditions_met conditions_met?
  3142. def conditions_met?(page)
  3143. c = page.condition
  3144. if c.variable_valid
  3145. if c.variable_id == XAS_SYSTEM::HIT_ID and
  3146. c.variable_value == self.reaction_valid_attack_id
  3147. return true
  3148. end
  3149. end
  3150. x_conditions_met(page)
  3151. end
  3152.  
  3153. end
  3154.  
  3155. #===============================================================================
  3156. # ■ XAS_Dispose
  3157. #===============================================================================
  3158. module XAS_Dispose
  3159.  
  3160. #--------------------------------------------------------------------------
  3161. # ● update
  3162. #--------------------------------------------------------------------------
  3163. def update
  3164. action_update
  3165. super
  3166. if @action.is_a?(Game_Action_XAS) and @action.done?
  3167. self.action_clear
  3168. end
  3169. end
  3170. end
  3171.  
  3172. #===============================================================================
  3173. # ■ Game_Player
  3174. #===============================================================================
  3175. class Game_Player < Game_Character
  3176. include XAS_Dispose
  3177. end
  3178.  
  3179. #===============================================================================
  3180. # ■ Game_Event
  3181. #===============================================================================
  3182. class Game_Event < Game_Character
  3183. include XAS_Dispose
  3184. end
  3185.  
  3186. #===============================================================================
  3187. # ■ XAS_StopToAction
  3188. #===============================================================================
  3189. module XAS_StopToAction
  3190.  
  3191. #--------------------------------------------------------------------------
  3192. # ● acting?
  3193. #--------------------------------------------------------------------------
  3194. def acting?
  3195. return false if self.battler == nil
  3196. return true if self.battler.shield
  3197. return true if self.action != nil
  3198. return false
  3199. end
  3200.  
  3201. #--------------------------------------------------------------------------
  3202. # ● moving?
  3203. #--------------------------------------------------------------------------
  3204. def moving?
  3205. return (super or self.acting? or self.stop)
  3206. end
  3207.  
  3208. end
  3209.  
  3210. #===============================================================================
  3211. # ■ Game_Player
  3212. #===============================================================================
  3213. class Game_Player < Game_Character
  3214. include XAS_StopToAction
  3215. end
  3216.  
  3217. #===============================================================================
  3218. # ■ Game_Event
  3219. #===============================================================================
  3220. class Game_Event < Game_Character
  3221. attr_accessor :reaction_valid_attack_id
  3222. end
  3223. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3224. #■ TOOL - HIT EFFECT
  3225. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3226.  
  3227.  
  3228. #===============================================================================
  3229. # ■ XRXS_BattlerAttachment
  3230. #==============================================================================
  3231. module XRXS_BattlerAttachment
  3232.  
  3233. #--------------------------------------------------------------------------
  3234. # ● Can Hit Base?
  3235. #--------------------------------------------------------------------------
  3236. def can_hit_base?(bullet, action_id)
  3237. return false unless $game_system.xas_battle
  3238. return false if self.battler == nil
  3239. return false if bullet == nil
  3240. return false if action_id == nil or action_id <= 0
  3241. return false if self.can_update == false
  3242. return true
  3243. end
  3244.  
  3245. #--------------------------------------------------------------------------
  3246. # ● Action Effect
  3247. #--------------------------------------------------------------------------
  3248. def action_effect(bullet, action_id)
  3249. return unless can_hit_base?(bullet, action_id)
  3250. skill = $data_skills[action_id]
  3251. user = bullet.action.user
  3252. attacker = (user == nil ? nil : user.battler)
  3253. tar_invu = bullet.action.target_invunerable_duration
  3254. #CAN HIT?
  3255. return unless action_can_hit_target?(bullet, user, skill,tar_invu)
  3256. #REFLECT STATE
  3257. return if reflect_state?(bullet, skill)
  3258. #SHIELD
  3259. if target_shield_enabled?(attacker, skill, bullet)
  3260. execute_guard_effect(user, skill, bullet, tar_invu)
  3261. return
  3262. end
  3263. #INVUNERABLE ACTIONS
  3264. if target_invunerable_actions?(user, skill, bullet)
  3265. if action_id == 25
  3266. execute_guard_effect(user, skill, bullet, tar_invu, true)
  3267. else
  3268. if action_id == 36
  3269. execute_guard_effect(user, skill, bullet, tar_invu, true)
  3270. else
  3271. execute_guard_effect(user, skill, bullet, tar_invu, false)
  3272. end
  3273. end
  3274. #execute_guard_effect(user, skill, bullet, tar_invu, false)#false
  3275. bullet.bounce_direction if action_id == 4 #FUNCIONOU
  3276. bullet.bounce_direction if action_id == 5 #FUNCIONOU
  3277. bullet.bounce_direction if action_id == 23 # FUNCIONOU
  3278. bullet.bounce_direction if action_id == 24 # FUNCIONOU
  3279. bullet.bounce_direction if action_id == 49 # FUNCIONOU
  3280. bullet.bounce_direction if action_id == 36 # FUNCIONOU
  3281. bullet.bounce_direction if action_id == 38 # FUNCIONOU
  3282. bullet.bounce_direction if action_id == 41 # FUNCIONOU
  3283. #bullet.action.multi_hit = false if action_id == 49 #TESTE
  3284. bullet.bounce_direction if action_id == 50 # FUNCIONOU
  3285. return
  3286. end
  3287. #GUARD DIRECTIONS
  3288. if target_guard_directions?(user, skill, bullet)
  3289. execute_guard_effect(user, skill, bullet, tar_invu)
  3290. return
  3291. end
  3292. execute_hit_effect(attacker,skill, bullet , user, tar_invu )
  3293. if self.is_a?(Game_Player)
  3294. self.need_refresh = true
  3295. end
  3296. end
  3297.  
  3298. #--------------------------------------------------------------------------
  3299. # ● Reflect State?
  3300. #--------------------------------------------------------------------------
  3301. def reflect_state?(bullet, skill)
  3302. if bullet.action.reflectable and self.battler.state_reflect
  3303. if skill.note =~ /<Auto Target>/
  3304. bullet.moveto(bullet.action.user.x,bullet.action.user.y)
  3305. else
  3306. bullet.turn_back
  3307. end
  3308. bullet.action.user = self
  3309. bullet.action.hit_events = []
  3310. bullet.turn_back
  3311. #bullet.jump(0,0) #TESTE , esse tava desativado não sei pq
  3312. bullet.turn_back
  3313. self.battler.damage = XAS_WORD::REFLECT
  3314. self.battler.damage_pop = true
  3315. self.animation_id = XAS_ANIMATION::REFLECT_ANIMATION_ID
  3316. self.battler.invunerable_duration = 20
  3317. return true
  3318. end
  3319. return false
  3320. end
  3321.  
  3322. #--------------------------------------------------------------------------
  3323. # ● Target Guard Directions?
  3324. #--------------------------------------------------------------------------
  3325. def target_guard_directions?(user, skill, bullet)
  3326. return false if self.battler.guard == false
  3327. return false if bullet.action.ignore_guard
  3328. if self.battler.guard_directions.include?(2) and
  3329. ((self.direction == 2 and bullet.direction == 8) or
  3330. (self.direction == 8 and bullet.direction == 2) or
  3331. (self.direction == 6 and bullet.direction == 4) or
  3332. (self.direction == 4 and bullet.direction == 6))
  3333. return true
  3334. elsif self.battler.guard_directions.include?(8) and
  3335. ((self.direction == 8 and bullet.direction == 8) or
  3336. (self.direction == 2 and bullet.direction == 2) or
  3337. (self.direction == 6 and bullet.direction == 6) or
  3338. (self.direction == 4 and bullet.direction == 4))
  3339. return true
  3340. elsif self.battler.guard_directions.include?(4) and
  3341. ((self.direction == 2 and bullet.direction == 4) or
  3342. (self.direction == 8 and bullet.direction == 6) or
  3343. (self.direction == 6 and bullet.direction == 2) or
  3344. (self.direction == 4 and bullet.direction == 8))
  3345. return true
  3346. elsif self.battler.guard_directions.include?(6) and
  3347. ((self.direction == 2 and bullet.direction == 6) or
  3348. (self.direction == 8 and bullet.direction == 4) or
  3349. (self.direction == 6 and bullet.direction == 8) or
  3350. (self.direction == 4 and bullet.direction == 2))
  3351. return true
  3352. end
  3353. return false
  3354. end
  3355.  
  3356. #--------------------------------------------------------------------------
  3357. # ● Target Invunerable Actions?
  3358. #--------------------------------------------------------------------------
  3359. def target_invunerable_actions?(user, skill, bullet)
  3360. return true if self.battler.invunerable_actions.include?(skill.id)
  3361. return false
  3362. end
  3363.  
  3364. #--------------------------------------------------------------------------
  3365. # ● Shoot Target Shield
  3366. #--------------------------------------------------------------------------
  3367. def shoot_target_shield?(bullet,user, skill)
  3368. return false unless self.battler.shield
  3369. return false if bullet.action.ignore_guard
  3370. return true if face_direction?(bullet)
  3371. return false
  3372. end
  3373.  
  3374. #--------------------------------------------------------------------------
  3375. # ● Action can hit target?
  3376. #--------------------------------------------------------------------------
  3377. def action_can_hit_target?(bullet, user, skill,tar_invu)
  3378. if user == nil
  3379. return false
  3380. end
  3381. if self.battler.invunerable
  3382. return false
  3383. end
  3384. if self.battler.dead?
  3385. return false
  3386. end
  3387. if self.battler.invunerable_duration > 0
  3388. return false
  3389. end
  3390. if @knock_back_duration != nil
  3391. return false unless bullet.action.ignore_knockback_invincible
  3392. end
  3393. if bullet.action.first_impact_time > 0
  3394. return false
  3395. end
  3396. if self.action != nil and self.action.user_invincible
  3397. unless self.action.ally_damage and bullet.action.user == self.action.user
  3398. return false
  3399. end
  3400. end
  3401. unless bullet.action.all_damage
  3402. if bullet.action.ally_damage
  3403. if user.battler.is_a?(Game_Actor)
  3404. return false if self.battler.is_a?(Game_Enemy)
  3405. elsif user.battler.is_a?(Game_Enemy)
  3406. return false if self.battler.is_a?(Game_Actor)
  3407. end
  3408. else
  3409. if user.battler.is_a?(Game_Actor)
  3410. return false if self.battler.is_a?(Game_Actor)
  3411. elsif user.battler.is_a?(Game_Enemy)
  3412. return false if self.battler.is_a?(Game_Enemy)
  3413. end
  3414. end
  3415. end
  3416. return false if target_state_invunerable?(tar_invu)
  3417. return false if target_reflect_action?(bullet, user) #outro desativado sem motivo
  3418. return true
  3419. end
  3420.  
  3421. #--------------------------------------------------------------------------
  3422. # ● Target Relfect Action
  3423. #--------------------------------------------------------------------------
  3424. def target_reflect_action?(bullet, user)
  3425. return false unless bullet.action.reflectable
  3426. for i in $game_map.events.values
  3427. if i.tool_id > 0 and i.action.can_reflect and
  3428. i.tool_effect == "Barrier" #and i.action.user.battler.is_a?(self.battler) #desativado a partir do "and"
  3429. bullet.action.user = self
  3430. bullet.action.hit_events = []
  3431. bullet.turn_back
  3432. return true
  3433. break
  3434. end
  3435. end
  3436. return false
  3437. end
  3438.  
  3439. #--------------------------------------------------------------------------
  3440. # ● Target State Invunerable
  3441. #--------------------------------------------------------------------------
  3442. def target_state_invunerable?(tar_invu)
  3443. if self.battler.state_invunerable
  3444. self.battler.damage = XAS_WORD::INVINCIBLE
  3445. self.battler.damage_pop = true
  3446. self.animation_id = XAS_ANIMATION::INVINCIBLE_ANIMATION_ID
  3447. self.battler.invunerable_duration = tar_invu
  3448. return true
  3449. end
  3450. return false
  3451. end
  3452.  
  3453. #--------------------------------------------------------------------------
  3454. # ● Execute Hit Effect
  3455. #--------------------------------------------------------------------------
  3456. def execute_hit_effect(attacker,skill, bullet , user, tar_invu)
  3457. shoot_effect_before_damage(skill, bullet, user)
  3458. execute_battler_skill_effect(attacker ,skill, user)
  3459. if self.battler.shield == true #TESTE ESCUDO
  3460. update_shield_diretion_button
  3461. self.need_refresh = true #TESTE
  3462. end
  3463. if target_missed?(attacker)
  3464. self.battler.invunerable_duration = 10 #DURAÇÃO DE RECUO TESTE
  3465. return
  3466. end
  3467. execute_damage_pop(attacker,skill)
  3468. shoot_effect_after_damage(skill, bullet, user) if can_damage_after_effect?
  3469. execute_state_effect(skill, user, bullet)
  3470. bullet.action.duration = 1 if remove_tool_after_hit?(skill, bullet, user)
  3471. self.battler.invunerable_duration = tar_invu
  3472. execute_blow_effect(skill,bullet) if can_blow_effect?
  3473. execute_animation(skill, bullet, user)
  3474. execute_tool_effects(skill, bullet , user)
  3475. end
  3476.  
  3477. #--------------------------------------------------------------------------
  3478. # ● Execute Tool Effects
  3479. #--------------------------------------------------------------------------
  3480. def execute_tool_effects(skill, bullet , user)
  3481. execute_sticky_effect(skill, bullet, user)
  3482. execute_bounce_effect(skill, bullet, user)
  3483. execute_hit_action_effect(skill, bullet, user)
  3484. end
  3485.  
  3486. #--------------------------------------------------------------------------
  3487. # ● Remove Tool After Hit?
  3488. #--------------------------------------------------------------------------
  3489. def remove_tool_after_hit?(skill, bullet, user)
  3490. return true if bullet.action.piercing == false
  3491. return false
  3492. end
  3493.  
  3494. #--------------------------------------------------------------------------
  3495. # ● Execute Battler Skill Effect
  3496. #--------------------------------------------------------------------------
  3497. def execute_battler_skill_effect(attacker ,skill, user)
  3498. self.battler.item_apply(attacker, skill)
  3499. end
  3500.  
  3501. #--------------------------------------------------------------------------
  3502. # ● Target Missed?
  3503. #--------------------------------------------------------------------------
  3504. def target_missed?(attacker)
  3505. if self.battler.result.missed
  3506. self.battler.damage = XAS_WORD::MISSED
  3507. self.battler.damage_pop = true
  3508. return true
  3509. end
  3510. if self.battler.result.evaded
  3511. self.battler.damage = XAS_WORD::EVADED
  3512. self.battler.damage_pop = true
  3513. return true
  3514. end
  3515. return false
  3516. end
  3517. #--------------------------------------------------------------------------
  3518. # ● Shoot Effect Before Damage
  3519. #--------------------------------------------------------------------------
  3520. def shoot_effect_before_damage(skill, bullet, user)
  3521. end
  3522.  
  3523. #--------------------------------------------------------------------------
  3524. # ● Shoot Effect After Damage
  3525. #--------------------------------------------------------------------------
  3526. def shoot_effect_after_damage(skill, bullet, user)
  3527. check_counter_attack(skill)
  3528. self.battler.passive = false
  3529. end
  3530.  
  3531. #--------------------------------------------------------------------------
  3532. # ● Shoot Effect After Damage
  3533. #--------------------------------------------------------------------------
  3534. def check_counter_attack(skill)
  3535. return if self.battler.is_a?(Game_Actor)
  3536. return if self.battler.counter_action[2] == false
  3537. return if self.battler.counter_action[1] > 0
  3538. counter = XAS_BA_ENEMY::COUNTER_ATTACK[self.battler.enemy_id]
  3539. if counter != nil
  3540. counter_action_id = counter[rand(counter.size)]
  3541. self.battler.counter_action[0] = counter_action_id
  3542. self.battler.counter_action[1] = 15
  3543. end
  3544. end
  3545.  
  3546. #--------------------------------------------------------------------------
  3547. # ● Execute Bounce Effect
  3548. #--------------------------------------------------------------------------
  3549. def execute_bounce_effect(skill, bullet, user)
  3550. return false if bullet.action.hit_bounce == false
  3551. bullet.bounce_direction
  3552. end
  3553.  
  3554. #--------------------------------------------------------------------------
  3555. # ● Execute Stick Effect
  3556. #--------------------------------------------------------------------------
  3557. def execute_sticky_effect(skill, bullet, user)
  3558. return unless bullet.action.sticky
  3559. return if bullet.temp_id != 0
  3560. bullet.pre_move_speed = bullet.move_speed
  3561. bullet.temp_id = self.id
  3562. end
  3563.  
  3564. #--------------------------------------------------------------------------
  3565. # ● Execute Hit Action Effect
  3566. #--------------------------------------------------------------------------
  3567. def execute_hit_action_effect(skill, bullet, user)
  3568. return if bullet.action.hit_action == 0
  3569. self.battler.invunerable_duration = 1
  3570. bullet.shoot(bullet.action.hit_action)
  3571. bullet.action.duration = 9
  3572. bullet.action.multi_hit = false
  3573. bullet.character_name = ""
  3574. bullet.x_pose_duration = 0
  3575. bullet.x_pose_name = ""
  3576. bullet.x_pose_original_name = ""
  3577. end
  3578.  
  3579. #--------------------------------------------------------------------------
  3580. # ● Can Damage Effect
  3581. #--------------------------------------------------------------------------
  3582. def can_damage_after_effect?
  3583. return false if self.battler.damage == nil
  3584. return false unless self.battler.damage.is_a?(Numeric)
  3585. return true
  3586. end
  3587.  
  3588. #--------------------------------------------------------------------------
  3589. # ● Execute State Effect
  3590. #--------------------------------------------------------------------------
  3591. def execute_state_effect(skill, user, bullet)
  3592. if user.battler.states.size != 0
  3593. for i in user.battler.states
  3594. execute_state_effect_user(skill, user, bullet,i)
  3595. end
  3596. end
  3597. if self.battler.states.size != 0
  3598. for i in self.battler.states
  3599. execute_state_effect_target(skill, user, bullet,i)
  3600. end
  3601. end
  3602. end
  3603.  
  3604. #--------------------------------------------------------------------------
  3605. # ● Execute State Effect User
  3606. #--------------------------------------------------------------------------
  3607. def execute_state_effect_user(skill, user, bullet,i)
  3608.  
  3609. end
  3610.  
  3611. #--------------------------------------------------------------------------
  3612. # ● Execute State Target
  3613. #--------------------------------------------------------------------------
  3614. def execute_state_effect_target(skill, user, bullet,i)
  3615. #Sleep
  3616. if self.battler.damage.is_a?(Numeric) and self.battler.damage > 0
  3617. if i.note =~ /<Sleep>/
  3618. self.battler.remove_state(i.id)
  3619. end
  3620. end
  3621. end
  3622.  
  3623. #--------------------------------------------------------------------------
  3624. # ● Execute Blow Effect
  3625. #--------------------------------------------------------------------------
  3626. def execute_blow_effect(skill,bullet)
  3627. if bullet.action.hit_hold_target and self.temp_id == 0
  3628. self.temp_id = bullet.id
  3629. self.pre_move_speed = self.move_speed
  3630. self.moveto(bullet.x, bullet.y)
  3631. end
  3632. $game_map.screen.start_shake(5, 5, 60) if bullet.action.hit_shake
  3633. p = bullet.action.blow_power.to_i
  3634. d = bullet.direction
  3635. return if self.battler.damage.to_i <= 0
  3636. return if p < 0
  3637. self.blow(d, p)
  3638. end
  3639.  
  3640. #--------------------------------------------------------------------------
  3641. # ● Execute Animation
  3642. #--------------------------------------------------------------------------
  3643. def execute_animation(skill, bullet, user)
  3644. self.animation_id = skill.animation_id
  3645. tool_animation = bullet.action.second_animation_id
  3646. user_animation = bullet.action.third_animation_id
  3647. bullet.animation_id = tool_animation if tool_animation != 0
  3648. user.animation_id = user_animation if user_animation != 0
  3649. end
  3650.  
  3651. #--------------------------------------------------------------------------
  3652. # ● Knock Back Disable
  3653. #--------------------------------------------------------------------------
  3654. def knock_back_disable
  3655. return false
  3656. end
  3657.  
  3658. #--------------------------------------------------------------------------
  3659. # ● Dead?
  3660. #--------------------------------------------------------------------------
  3661. def dead?
  3662. return self.battler == nil ? false : self.battler.dead?
  3663. end
  3664.  
  3665. end
  3666.  
  3667.  
  3668. #===============================================================================
  3669. # ■ XRXS_BattlerAttachment
  3670. #==============================================================================
  3671. module XRXS_BattlerAttachment
  3672.  
  3673. #--------------------------------------------------------------------------
  3674. # ● Shoot Target Shield
  3675. #--------------------------------------------------------------------------
  3676. def target_shield_enabled?(attacker, skill, bullet)
  3677. return false unless self.battler.shield
  3678. if bullet != nil
  3679. return false if bullet.action.ignore_guard
  3680. return true if face_direction?(bullet)
  3681. else
  3682. return false if attacker.battler.ignore_guard
  3683. return true if face_direction?(attacker)
  3684. end
  3685. return false
  3686. end
  3687.  
  3688. #--------------------------------------------------------------------------
  3689. # ● Can Blow Effect
  3690. #--------------------------------------------------------------------------
  3691. def can_blow_effect?
  3692. return false if self.battler.no_knockback
  3693. return false if $game_map.interpreter.running?
  3694. return true
  3695. end
  3696.  
  3697. #--------------------------------------------------------------------------
  3698. # ● Execute Guard Effect
  3699. #--------------------------------------------------------------------------
  3700. def execute_guard_effect(attacker, skill, bullet, inv, erase_bullet = true)
  3701. self.battler.invunerable_duration = inv
  3702. damage_pop(XAS_WORD::GUARD)
  3703. guard_animation_id = $game_variables[XAS_ANIMATION::GUARD_ANIMATION_ID]
  3704. self.animation_id = guard_animation_id if guard_animation_id != 0
  3705. if bullet != nil
  3706. bullet.erase if erase_bullet
  3707. else
  3708. blow_reverse(attacker) unless attacker.battler.no_knockback
  3709. end
  3710. end
  3711.  
  3712. #--------------------------------------------------------------------------
  3713. # ● Blow Reverse
  3714. #--------------------------------------------------------------------------
  3715. def blow_reverse(attacker)
  3716. return if attacker.battler.no_knockback
  3717. case attacker.direction
  3718. when 2
  3719. d = 8
  3720. when 4
  3721. d = 6
  3722. when 6
  3723. d = 4
  3724. when 8
  3725. d = 2
  3726. end
  3727. attacker.jump(0,0)
  3728. attacker.blow(d,1)
  3729. end
  3730.  
  3731. #--------------------------------------------------------------------------
  3732. # ● Can Attack Effect
  3733. #--------------------------------------------------------------------------
  3734. def damage_pop(text)
  3735. return unless XAS_WORD::ENABLE_WORD
  3736. self.battler.damage = text
  3737. self.battler.damage_pop = true
  3738. end
  3739.  
  3740. #--------------------------------------------------------------------------
  3741. # ● Shd Direction?
  3742. #--------------------------------------------------------------------------
  3743. def face_direction?(attacker)
  3744. target = self.direction
  3745. case target
  3746. when 2
  3747. return true if attacker.direction == 8
  3748. when 4
  3749. return true if attacker.direction == 6
  3750. when 6
  3751. return true if attacker.direction == 4
  3752. when 8
  3753. return true if attacker.direction == 2
  3754. end
  3755. return false
  3756. end
  3757.  
  3758. #--------------------------------------------------------------------------
  3759. # ● Execute Damage Pop
  3760. #--------------------------------------------------------------------------
  3761. def execute_damage_pop(attacker,skill = nil)
  3762. if skill != nil
  3763. return if skill.note =~ /<No Damage Pop>/
  3764. if skill.damage.to_mp?
  3765. dam = self.battler.result.mp_damage
  3766. self.battler.damage_type = "Mp"
  3767. elsif skill.damage.to_hp?
  3768. dam = self.battler.result.hp_damage
  3769. self.battler.damage_type = "Critical" if self.battler.result.critical
  3770. end
  3771. if dam != nil
  3772. if skill.damage.drain? or skill.damage.drain?
  3773. attacker.damage = -dam
  3774. attacker.damage_type = self.battler.damage_type
  3775. attacker.damage_pop = true
  3776. end
  3777. self.battler.damage = dam
  3778. self.battler.damage_pop = true
  3779. end
  3780. else
  3781. if self.battler.result.hp_damage != nil
  3782. self.battler.damage = self.battler.result.hp_damage
  3783. self.battler.damage_type = "Critical" if self.battler.result.critical
  3784. self.battler.damage_pop = true
  3785. end
  3786. end
  3787. end
  3788.  
  3789. end
  3790. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3791. #■ TOOL - EQUIP
  3792. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3793.  
  3794.  
  3795. #==============================================================================
  3796. # ■ Window Skill List
  3797. #==============================================================================
  3798. class Window_SkillList < Window_Selectable
  3799.  
  3800. #--------------------------------------------------------------------------
  3801. # ● Process OK
  3802. #--------------------------------------------------------------------------
  3803. alias x_skill_process_ok process_ok
  3804. def process_ok
  3805. return if can_equip_skill_action?
  3806. x_skill_process_ok
  3807. end
  3808.  
  3809. #--------------------------------------------------------------------------
  3810. # ● Can Equip Skill Action
  3811. #--------------------------------------------------------------------------
  3812. def can_equip_skill_action?
  3813. return false if $game_party.in_battle
  3814. skill = @data[index]
  3815. if skill != nil and skill.note =~ /<Duration = (\d+)>/
  3816. @actor.skill_id = skill.id
  3817. Sound.play_equip
  3818. return true
  3819. end
  3820. return false
  3821. end
  3822.  
  3823. end
  3824.  
  3825. #==============================================================================
  3826. # ■ Window Item List
  3827. #==============================================================================
  3828. class Window_ItemList < Window_Selectable
  3829.  
  3830. #--------------------------------------------------------------------------
  3831. # ● Process OK
  3832. #--------------------------------------------------------------------------
  3833. alias x_item_process_ok process_ok
  3834. def process_ok
  3835. return if can_equip_item_action?
  3836. x_item_process_ok
  3837. end
  3838.  
  3839. #--------------------------------------------------------------------------
  3840. # ● Can Equip Item Action
  3841. #--------------------------------------------------------------------------
  3842. def can_equip_item_action?
  3843. return false if $game_party.in_battle
  3844. item = @data[index]
  3845. if item != nil and item.is_a?(RPG::Item) and
  3846. item.note =~ /<Action ID = (\d+)>/
  3847. actor = $game_party.members[0]
  3848. actor.item_id = item.id
  3849. Sound.play_equip
  3850. return true
  3851. end
  3852. return false
  3853. end
  3854.  
  3855. end
  3856. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3857. #■ BATTLER - INITIALIZE
  3858. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3859.  
  3860.  
  3861. #===============================================================================
  3862. # ■ Game Character
  3863. #==============================================================================
  3864. class Game_Character < Game_CharacterBase
  3865.  
  3866. #--------------------------------------------------------------------------
  3867. # ● Update Battler
  3868. #--------------------------------------------------------------------------
  3869. def update_battler
  3870. update_battler_pose
  3871. update_battler_parameters
  3872. update_battler_stop_movement
  3873. update_battler_knockbacking
  3874. update_battler_counter_action
  3875. unless self.battler.hp == 0
  3876. update_battler_cast_action
  3877. update_battler_move_speed if can_update_battler_move_speed?
  3878. update_battler_states_effect
  3879. update_battler_attacking
  3880. else
  3881. update_battler_defeat_process
  3882. end
  3883. end
  3884.  
  3885. end
  3886.  
  3887. #===============================================================================
  3888. # ■ Game Player
  3889. #===============================================================================
  3890. class Game_Player < Game_Character
  3891. include XRXS_BattlerAttachment
  3892.  
  3893. #--------------------------------------------------------------------------
  3894. # ● Battler
  3895. #--------------------------------------------------------------------------
  3896. def battler
  3897. return $game_party.members[0]
  3898. return $game_party.members[1] #TESTE
  3899. end
  3900.  
  3901. #--------------------------------------------------------------------------
  3902. # ● Refresh Interpreter Effect
  3903. #--------------------------------------------------------------------------
  3904. def refresh_interpreter_effect
  3905. $game_system.old_interpreter_running = $game_map.interpreter.running?
  3906. if $game_system.old_interpreter_running
  3907. $game_temp.reset_battler_time = 60 * 4
  3908. end
  3909. reset_battler_setting
  3910. end
  3911.  
  3912. #--------------------------------------------------------------------------
  3913. # ● Update Battler Setting Time
  3914. #--------------------------------------------------------------------------
  3915. def update_reset_battler_setting_time
  3916. return if $game_temp.reset_battler_time == 0
  3917. $game_temp.reset_battler_time -= 1
  3918. reset_battler_setting_running if $game_temp.reset_battler_time == 0
  3919. end
  3920.  
  3921. #--------------------------------------------------------------------------
  3922. # ● Update Battler Setting
  3923. #--------------------------------------------------------------------------
  3924. def reset_battler_setting
  3925. reset_player_parameters
  3926. for ally in $game_party.members
  3927. reset_members_parameters(ally)
  3928. end
  3929. for enemy in $game_map.events.values
  3930. reset_enemies_parameters(enemy) if enemy.battler != nil
  3931. end
  3932. $game_map.need_refresh = true
  3933. end
  3934.  
  3935. #--------------------------------------------------------------------------
  3936. # ● Update Battler Setting Running
  3937. #--------------------------------------------------------------------------
  3938. def reset_battler_setting_running
  3939. reset_player_parameters_running
  3940. for ally in $game_party.members
  3941. reset_members_parameters_running(ally)
  3942. end
  3943. for enemy in $game_map.events.values
  3944. reset_enemies_parameters(enemy) if enemy.battler != nil
  3945. end
  3946. $game_map.need_refresh = true
  3947. end
  3948.  
  3949. #--------------------------------------------------------------------------
  3950. # ● Reset Enemies Parameters
  3951. #--------------------------------------------------------------------------
  3952. def reset_enemies_parameters(enemy)
  3953. enemy.battler.cast_action[0] = 0
  3954. enemy.battler.cast_action[1] = 0
  3955. enemy.battler.cast_action[2] = 0
  3956. enemy.battler.cast_action[3] = 0
  3957. enemy.battler.cast_action[4] = 0
  3958. enemy.battler.counter_action[0] = 0
  3959. enemy.battler.counter_action[1] = 0
  3960. enemy.battler.counter_action[2] = true
  3961. enemy.battler.invunerable_duration = 0
  3962. enemy.knock_back_duration = nil
  3963. end
  3964.  
  3965. #--------------------------------------------------------------------------
  3966. # ● Reset Members Parameters
  3967. #--------------------------------------------------------------------------
  3968. def reset_members_parameters(ally)
  3969. ally.old_level = ally.level
  3970. ally.shield = false
  3971. ally.x_charge_action[0] = 0
  3972. ally.x_charge_action[1] = 0
  3973. ally.x_charge_action[2] = 0
  3974. ally.x_charge_action[3] = 0
  3975. ally.cast_action[0] = 0
  3976. ally.cast_action[1] = 0
  3977. ally.cast_action[2] = 0
  3978. ally.cast_action[3] = 0
  3979. ally.cast_action[4] = 0
  3980. ally.counter_action[0] = 0
  3981. ally.counter_action[1] = 0
  3982. ally.counter_action[2] = true
  3983. ally.invunerable_duration = 0
  3984. end
  3985.  
  3986. #--------------------------------------------------------------------------
  3987. # ● Reset Player Parameters
  3988. #--------------------------------------------------------------------------
  3989. def reset_player_parameters
  3990. make_pose("", 1) unless $game_player.action != nil
  3991. $game_temp.xas_target_time = 0
  3992. $game_temp.xas_target_shoot_id = 0
  3993. $game_temp.xas_target_x = 0
  3994. @knock_back_duration = nil
  3995. @dash_active = false
  3996. end
  3997.  
  3998.  
  3999. #--------------------------------------------------------------------------
  4000. # ● Reset Members Parameters Running
  4001. #--------------------------------------------------------------------------
  4002. def reset_members_parameters_running(ally)
  4003. ally.old_level = ally.level
  4004. ally.shield = false
  4005. unless ally.x_charge_action[1] > 0
  4006. ally.x_charge_action[0] = 0
  4007. ally.x_charge_action[1] = 0
  4008. ally.x_charge_action[2] = 0
  4009. ally.x_charge_action[3] = 0
  4010. end
  4011. unless ally.cast_action[1] > 0
  4012. ally.cast_action[0] = 0
  4013. ally.cast_action[1] = 0
  4014. ally.cast_action[2] = 0
  4015. ally.cast_action[3] = 0
  4016. ally.cast_action[4] = 0
  4017. end
  4018. ally.counter_action[0] = 0
  4019. ally.counter_action[1] = 0
  4020. ally.counter_action[2] = true
  4021. ally.invunerable_duration = 0
  4022. end
  4023.  
  4024. #--------------------------------------------------------------------------
  4025. # ● Reset Player Parameters Running
  4026. #--------------------------------------------------------------------------
  4027. def reset_player_parameters_running
  4028. $game_temp.xas_target_time = 0
  4029. $game_temp.xas_target_shoot_id = 0
  4030. $game_temp.xas_target_x = 0
  4031. @knock_back_duration = nil
  4032. @dash_active = false
  4033. end
  4034.  
  4035. end
  4036.  
  4037. #===============================================================================
  4038. # ■ Game Follower
  4039. #===============================================================================
  4040. class Game_Follower < Game_Character
  4041. include XRXS_BattlerAttachment
  4042.  
  4043. #--------------------------------------------------------------------------
  4044. # ● Battler
  4045. #--------------------------------------------------------------------------
  4046. def battler
  4047. return $game_party.members[@member_index]
  4048. end
  4049.  
  4050. #--------------------------------------------------------------------------
  4051. # ● Update
  4052. #--------------------------------------------------------------------------
  4053. def update
  4054. @move_speed = $game_player.real_move_speed
  4055. @transparent = $game_player.transparent
  4056. @walk_anime = $game_player.walk_anime
  4057. @step_anime = false#$game_player.step_anime#false
  4058. @direction_fix = false#$game_player.direction_fix
  4059. @opacity = $game_player.opacity
  4060. @blend_type = $game_player.blend_type
  4061. #@dash_active = $game_player.x_dash #TESTE
  4062. super
  4063. end
  4064. end
  4065.  
  4066. #===============================================================================
  4067. # ■ Game Follower
  4068. #===============================================================================
  4069. class Game_Followers
  4070. include XRXS_BattlerAttachment
  4071.  
  4072. #--------------------------------------------------------------------------
  4073. # ● Battler
  4074. #--------------------------------------------------------------------------
  4075. def battler
  4076. return $game_party.members[@member_index]
  4077. end
  4078. end
  4079. #===============================================================================
  4080. # ■ Game_Vehicle
  4081. #===============================================================================
  4082. class Game_Vehicle < Game_Character
  4083. include XRXS_BattlerAttachment
  4084. attr_reader :collision_attack
  4085.  
  4086. #--------------------------------------------------------------------------
  4087. # ● Battler
  4088. #--------------------------------------------------------------------------
  4089. def battler
  4090. return @battler
  4091. end
  4092. end
  4093.  
  4094. #===============================================================================
  4095. # ■ Game Event
  4096. #===============================================================================
  4097. class Game_Event < Game_Character
  4098.  
  4099. include XRXS_BattlerAttachment
  4100.  
  4101. #--------------------------------------------------------------------------
  4102. # ● Battler
  4103. #--------------------------------------------------------------------------
  4104. def battler
  4105. return @battler
  4106. end
  4107.  
  4108. #--------------------------------------------------------------------------
  4109. # ● Battler?
  4110. #--------------------------------------------------------------------------
  4111. def battler?
  4112. return false if self.erased
  4113. return false if self.battler == nil
  4114. return false if self.dead?
  4115. return false if self.battler.no_damage_pop
  4116. return false if self.battler.invunerable
  4117. return true
  4118. end
  4119.  
  4120. #--------------------------------------------------------------------------
  4121. # ● Refresh
  4122. #--------------------------------------------------------------------------
  4123. alias xrxs64c_refresh refresh
  4124. def refresh
  4125. xrxs64c_refresh
  4126. self.battler_recheck
  4127. end
  4128.  
  4129. #--------------------------------------------------------------------------
  4130. # ● Battler Recheck
  4131. #--------------------------------------------------------------------------
  4132. def battler_recheck
  4133. return if @battler != nil
  4134. return if @page == nil
  4135. if self.name =~ /<Actor>/
  4136. actor = $game_party.members[0]
  4137. @battler = Game_Actor.new(actor.id)
  4138. return
  4139. else
  4140. @enemy_id = 0
  4141. if self.name =~ /<Enemy(\d+)>/i
  4142. @enemy_id = $1.to_i
  4143. end
  4144. return if @enemy_id <= 0
  4145. @battler = Game_Enemy.new(1, @enemy_id)
  4146. self.force_update = true if self.battler.sensor_range >= 15
  4147. end
  4148. end
  4149.  
  4150. #--------------------------------------------------------------------------
  4151. # ● Battler Recheck
  4152. #--------------------------------------------------------------------------
  4153. def enemy_id
  4154. return @enemy_id
  4155. end
  4156.  
  4157. #--------------------------------------------------------------------------
  4158. # ● body_size
  4159. #--------------------------------------------------------------------------
  4160. def body_size
  4161. if self.battler != nil
  4162. return self.battler.body_size
  4163. else
  4164. return 0
  4165. end
  4166. end
  4167.  
  4168. end
  4169.  
  4170.  
  4171. #===============================================================================
  4172. # ■ Game_Battler
  4173. #===============================================================================
  4174. class Game_Battler
  4175. attr_accessor :sensor_range
  4176. attr_accessor :body_size
  4177. attr_accessor :breath_effect
  4178. attr_accessor :breath_duration
  4179. attr_accessor :fast_breath_effect
  4180. attr_accessor :no_knockback
  4181. attr_accessor :passive
  4182. attr_accessor :attack_animation_id
  4183. attr_accessor :ignore_guard
  4184. attr_accessor :no_damage_pop
  4185.  
  4186. #--------------------------------------------------------------------------
  4187. # ● Initialize
  4188. #--------------------------------------------------------------------------
  4189. alias x_e_initialize initialize
  4190. def initialize
  4191. x_e_initialize
  4192. @sensor_range = 4
  4193. @body_size = 0
  4194. @breath_effect = false
  4195. @breath_duration = 0
  4196. @fast_breath_effect = false
  4197. @no_knockback = false
  4198. @passive = false
  4199. @attack_animation_id = 0
  4200. @ignore_guard = false
  4201. @no_damage_pop = false
  4202. end
  4203. end
  4204.  
  4205. #===============================================================================
  4206. # ■ Game_Enemy
  4207. #===============================================================================
  4208. class Game_Enemy < Game_Battler
  4209.  
  4210. #--------------------------------------------------------------------------
  4211. # ● Initialize
  4212. #--------------------------------------------------------------------------
  4213. alias x_e2_initialize initialize
  4214. def initialize(index, enemy_id)
  4215. x_e2_initialize(index, enemy_id)
  4216. enemy = $data_enemies[@enemy_id]
  4217. setup_enemy_note(enemy)
  4218. end
  4219.  
  4220. #--------------------------------------------------------------------------
  4221. # ● Setup X Note Elements
  4222. #--------------------------------------------------------------------------
  4223. def setup_enemy_note(enemy)
  4224. if enemy.note =~ /<Sensor Range = (\d+)>/
  4225. @sensor_range = $1.to_i
  4226. end
  4227. if enemy.note =~ /<Body Size = (\d+)>/
  4228. @body_size = $1.to_i
  4229. end
  4230. if enemy.note =~ /<Attack Animation = (\d+)>/
  4231. @attack_animation_id = $1.to_i
  4232. end
  4233. if enemy.note =~ /<Death Zoom = (\d+)>/
  4234. @death_zoom_effect = $1.to_i
  4235. end
  4236. if enemy.note =~ /<Knockback Duration = (\d+)>/
  4237. @knockback_duration = $1.to_i
  4238. end
  4239. if enemy.note =~ /<Ignore Guard>/
  4240. @ignore_shield = true
  4241. end
  4242. if enemy.note =~ /<Invunerable>/
  4243. @invunerable = true
  4244. end
  4245. if enemy.note =~ /<Breath Effect>/
  4246. @breath_effect = true
  4247. end
  4248. if enemy.note =~ /<Knockback Disable>/
  4249. @no_knockback = true
  4250. end
  4251. if enemy.note =~ /<Passive>/
  4252. @passive = true
  4253. end
  4254. if enemy.note =~ /<No Damage Pop>/
  4255. @no_damage_pop = true
  4256. end
  4257. invunerable_actions_ids = XAS_BA_ENEMY::INVUNERABLE_ACTIONS[@enemy_id]
  4258. if invunerable_actions_ids != nil
  4259. @invunerable_actions = invunerable_actions_ids
  4260. end
  4261. guard_directions_ids = XAS_BA_ENEMY::GUARD_DIRECTIONS[@enemy_id]
  4262. if guard_directions_ids != nil
  4263. @guard_directions = guard_directions_ids
  4264. end
  4265. end
  4266.  
  4267.  
  4268. end
  4269. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4270. #■ BATTLER - EVENT SENSOR
  4271. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4272.  
  4273.  
  4274. #===============================================================================
  4275. # ■ XRXS_Enemy_Sensor
  4276. #===============================================================================
  4277. module XRXS_EnemySensor
  4278.  
  4279. #--------------------------------------------------------------------------
  4280. # ● Update Sensor
  4281. #--------------------------------------------------------------------------
  4282. def update_sensor
  4283. if self.battler != nil and self.battler.sensor_range > 0
  4284. sensor_area = self.battler.sensor_range
  4285. else
  4286. sensor_area = $game_variables[XAS_BA::DEFAULT_SENSOR_RANGE_VARIABLE_ID]
  4287. end
  4288. sensor_area = -1 if cancel_sensor?
  4289. distance = ($game_player.x - self.x).abs + ($game_player.y - self.y).abs
  4290. enable = (distance <= sensor_area)
  4291. key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
  4292. last_enable = $game_self_switches[key]
  4293. last_enable = false if last_enable == nil
  4294. if enable != last_enable
  4295. touch_attack(false)
  4296. @collision_attack = false
  4297. @pattern = 0
  4298. @pattern_count = 0
  4299. $game_self_switches[key] = enable
  4300. self.refresh
  4301. end
  4302. end
  4303.  
  4304. #--------------------------------------------------------------------------
  4305. # ● Can Update Sensor
  4306. #--------------------------------------------------------------------------
  4307. def can_update_sensor?
  4308. return false if @sensor_enable == false
  4309. return false if self.dead?
  4310. return false if self.erased
  4311. return false if self.stop
  4312. return false if self.knockbacking?
  4313. return true
  4314. end
  4315.  
  4316. #--------------------------------------------------------------------------
  4317. # ● refresh_sensor
  4318. #--------------------------------------------------------------------------
  4319. def refresh_sensor
  4320. touch_attack(false)
  4321. key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
  4322. $game_self_switches[key] = false
  4323. @pattern = 0
  4324. @pattern_count = 0
  4325. self.refresh
  4326. end
  4327.  
  4328. #--------------------------------------------------------------------------
  4329. # ● Cancel Sensor
  4330. #--------------------------------------------------------------------------
  4331. def cancel_sensor?
  4332. return false if self.battler == nil
  4333. return true if self.battler.passive
  4334. return false
  4335. end
  4336.  
  4337. end
  4338.  
  4339. #===============================================================================
  4340. # ■ Game Event
  4341. #===============================================================================
  4342. class Game_Event < Game_Character
  4343.  
  4344. attr_accessor :sensor_enable
  4345.  
  4346. #--------------------------------------------------------------------------
  4347. # ● Initialize
  4348. #--------------------------------------------------------------------------
  4349. alias x_sensor_initialize initialize
  4350. def initialize(map_id, event)
  4351. @sensor_enable = false
  4352. x_sensor_initialize(map_id, event)
  4353. end
  4354.  
  4355. #--------------------------------------------------------------------------
  4356. # ● Conditions Met
  4357. #--------------------------------------------------------------------------
  4358. alias x_sensor_conditions_met conditions_met?
  4359. def conditions_met?(page)
  4360. c = page.condition
  4361. if c.self_switch_ch == XAS_BA::SENSOR_SELF_SWITCH
  4362. @sensor_enable = true
  4363. end
  4364. x_sensor_conditions_met(page)
  4365. end
  4366. end
  4367.  
  4368. #===============================================================================
  4369. # ■ Game Event
  4370. #===============================================================================
  4371. class Game_Character < Game_CharacterBase
  4372. include XRXS_EnemySensor
  4373. end
  4374.  
  4375. #===============================================================================
  4376. # ■ Game Character
  4377. #===============================================================================
  4378. class Game_Character < Game_CharacterBase
  4379. attr_writer :opacity
  4380. end
  4381. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4382. #■ BATTLER - ACTION
  4383. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4384.  
  4385.  
  4386. #===============================================================================
  4387. # ■ Game Character
  4388. #==============================================================================
  4389. class Game_Character < Game_CharacterBase
  4390.  
  4391. #--------------------------------------------------------------------------
  4392. # ● Can Update Battler Move Speed
  4393. #--------------------------------------------------------------------------
  4394. def can_update_battler_move_speed?
  4395. return false if @temp_id > 0
  4396. return false if moving?
  4397. return true
  4398. end
  4399.  
  4400. #--------------------------------------------------------------------------
  4401. # ● Can Update Battler?
  4402. #--------------------------------------------------------------------------
  4403. def can_update_battler?
  4404. return false unless $game_system.xas_battle
  4405. return false if self.battler == nil
  4406. return false unless party_system?
  4407. return true
  4408. end
  4409.  
  4410. #--------------------------------------------------------------------------
  4411. # ● Party System
  4412. #--------------------------------------------------------------------------
  4413. def party_system? #AQUI FICA A PARTY SYSTEM
  4414. return false if self.battler == nil
  4415. if $xas_party_system == nil and self.battler.is_a?(Game_Actor)
  4416. return false if self.battler.actor_id != $game_party.members[0].actor_id
  4417. end
  4418. return true
  4419. end
  4420.  
  4421. #--------------------------------------------------------------------------
  4422. # ● Reset Battler Temp
  4423. #--------------------------------------------------------------------------
  4424. def reset_battler_temp
  4425. reset_cast_temp
  4426. reset_charge_temp
  4427. end
  4428.  
  4429. #--------------------------------------------------------------------------
  4430. # ● Reset Charge Temp
  4431. #--------------------------------------------------------------------------
  4432. def reset_charge_temp
  4433. return if self.battler == nil
  4434. return if self.battler.is_a?(Game_Enemy)
  4435. self.battler.x_charge_action[0] = 0
  4436. self.battler.x_charge_action[1] = 0
  4437. self.battler.x_charge_action[2] = 0
  4438. self.battler.x_charge_action[3] = 0
  4439. end
  4440.  
  4441. #--------------------------------------------------------------------------
  4442. # ● Reset Battler Temp
  4443. #--------------------------------------------------------------------------
  4444. def reset_cast_temp
  4445. return if self.battler == nil
  4446. self.battler.cast_action[0] = 0
  4447. self.battler.cast_action[1] = 0
  4448. self.battler.cast_action[2] = 0
  4449. self.battler.cast_action[3] = 0
  4450. self.battler.cast_action[4] = 0
  4451. end
  4452.  
  4453. #--------------------------------------------------------------------------
  4454. # ● update_battler_parameters
  4455. #--------------------------------------------------------------------------
  4456. def update_battler_parameters
  4457. @stop_count = -1 if can_stop_battler?
  4458. self.battler.invunerable_duration -= 1 if self.battler.invunerable_duration > 0
  4459. unless @stop
  4460. @knock_back_duration = 30 if @temp_id > 0
  4461. end
  4462. end
  4463.  
  4464. #--------------------------------------------------------------------------
  4465. # ● Can Stop Battler
  4466. #--------------------------------------------------------------------------
  4467. def can_stop_battler?
  4468. return false if self.is_a?(Game_Player)
  4469. return true if self.knockbacking?
  4470. return true if self.dead?
  4471. return true if self.stop
  4472. return false
  4473. end
  4474.  
  4475. #--------------------------------------------------------------------------
  4476. # ● Update Battler Counter Action
  4477. #--------------------------------------------------------------------------
  4478. def update_battler_counter_action
  4479. return if self.battler.counter_action[1] == 0
  4480. self.battler.counter_action[1] -= 1
  4481. if self.battler.counter_action[1] == 0
  4482. turn_toward_player
  4483. self.battler.damage = XAS_WORD::COUNTER
  4484. self.battler.damage_pop = true
  4485. self.shoot(self.battler.counter_action[0])
  4486. self.battler.counter_action[0] = 0
  4487. end
  4488. end
  4489.  
  4490. #--------------------------------------------------------------------------
  4491. # ● Update Cast Action
  4492. #--------------------------------------------------------------------------
  4493. def update_battler_cast_action
  4494. return unless can_update_cast_action?
  4495. self.battler.cast_action[3] += 1
  4496. if self.battler.cast_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
  4497. self.battler.cast_action[3] = 0
  4498. self.animation_id = self.battler.cast_action[2]
  4499. end
  4500. self.battler.cast_action[4] += 1
  4501. if self.battler.cast_action[4] >= self.battler.cast_action[1]
  4502. self.shoot(self.battler.cast_action[0])
  4503. end
  4504. end
  4505.  
  4506. #--------------------------------------------------------------------------
  4507. # ● Can Update Cast Action
  4508. #--------------------------------------------------------------------------
  4509. def can_update_cast_action?
  4510. return false if self.battler.cast_action[1] == 0
  4511. #return false if #@stop TESTE
  4512. return true
  4513. end
  4514.  
  4515. #--------------------------------------------------------------------------
  4516. # ● Can Blow Effect
  4517. #--------------------------------------------------------------------------
  4518. def can_blow?
  4519. return false if self.stop and not self.battler.state_sleep
  4520. return false if self.battler.no_knockback
  4521. return false if self.is_a?(Game_Player) and self.action != nil
  4522. return true
  4523. end
  4524.  
  4525. #--------------------------------------------------------------------------
  4526. # ● Blow Effect
  4527. #--------------------------------------------------------------------------
  4528. def blow(d, power = 1)
  4529. return unless can_blow?
  4530. jump(0,0)
  4531. self.battler.invunerable_duration = 30 if self.battler.invunerable_duration <= 0
  4532. if self.is_a?(Game_Event)
  4533. @collision_attack = false #TESTE
  4534. end
  4535. @knock_back_duration = self.battler.knockback_duration
  4536. refresh_sensor if self.is_a?(Game_Event)
  4537. pre_direction = self.direction
  4538. pre_direction_fix = self.direction_fix
  4539. self.turn_reverse(d)
  4540. self.direction_fix = true
  4541. power.times do
  4542. case d
  4543. when 2; @y += 1 if passable?(@x, @y, d)
  4544. when 4; @x -= 1 if passable?(@x, @y, d)
  4545. when 6; @x += 1 if passable?(@x, @y, d)
  4546. when 8; @y -= 1 if passable?(@x, @y, d)
  4547. end
  4548. end
  4549. self.direction_fix = pre_direction_fix
  4550. self.direction = pre_direction
  4551. end
  4552.  
  4553. #--------------------------------------------------------------------------
  4554. # ● Can Stop Battler Movement
  4555. #--------------------------------------------------------------------------
  4556. def can_stop_battler_movement?
  4557. return false if self.dead?
  4558. return true if self.battler.state_sleep
  4559. return true if self.battler.state_stop
  4560. return false
  4561. end
  4562.  
  4563. #--------------------------------------------------------------------------
  4564. # ● Impact
  4565. #--------------------------------------------------------------------------
  4566. def impact(enable = true)
  4567. return if self.tool_id == 0
  4568. return if self.action == nil
  4569. self.action.impact = enable
  4570. end
  4571.  
  4572. #--------------------------------------------------------------------------
  4573. # ● Update Battler Stop Movement
  4574. #--------------------------------------------------------------------------
  4575. def update_battler_stop_movement
  4576. unless can_stop_battler_movement?
  4577. @stop = false
  4578. return
  4579. end
  4580. @knock_back_duration = nil
  4581. @stop = true
  4582. @step_anime = false
  4583. reset_battler_temp
  4584. if self.battler.state_sleep
  4585. make_pose("_Hit", 2)
  4586. else
  4587. make_pose("", 2)
  4588. end
  4589. if self.is_a?(Game_Event)
  4590. @collision_attack = false
  4591. end
  4592. end
  4593.  
  4594. #--------------------------------------------------------------------------
  4595. # ● Update Attacking
  4596. #--------------------------------------------------------------------------
  4597. def update_battler_attacking
  4598. return unless can_update_attacking?
  4599. make_pose("_Atk", 2)
  4600. end
  4601.  
  4602. #--------------------------------------------------------------------------
  4603. # ● Can Update Attacking
  4604. #--------------------------------------------------------------------------
  4605. def can_update_attacking?
  4606. return false if self.battler.is_a?(Game_Actor)
  4607. return false if @collision_attack == false
  4608. return true
  4609. end
  4610.  
  4611. #--------------------------------------------------------------------------
  4612. # ● Update Battler Knobacking
  4613. #--------------------------------------------------------------------------
  4614. def update_battler_knockbacking
  4615. return unless self.knockbacking?
  4616. @pattern = 0
  4617. @knock_back_duration -= 1 if can_remove_knockback?
  4618. make_pose("_Hit", 2)
  4619. if self.is_a?(Game_Event)
  4620. @collision_attack = false
  4621. end
  4622. if @knock_back_duration <= 0
  4623. @knock_back_duration = nil
  4624. make_pose("", 0)
  4625. touch_attack(false) if self.is_a?(Game_Event)
  4626. @character_name = @x_pose_original_name
  4627. end
  4628. end
  4629.  
  4630. #--------------------------------------------------------------------------
  4631. # ● Can Remove Knockback
  4632. #--------------------------------------------------------------------------
  4633. def can_remove_knockback?
  4634. return true
  4635. end
  4636.  
  4637. #--------------------------------------------------------------------------
  4638. # ● knockbacking?
  4639. #--------------------------------------------------------------------------
  4640. def knockbacking?
  4641. return false if self.battler == nil
  4642. return false if @stop
  4643. return true if @knock_back_duration != nil
  4644. return false
  4645. end
  4646.  
  4647. #--------------------------------------------------------------------------
  4648. # ● collapsing?
  4649. #--------------------------------------------------------------------------
  4650. def collapsing?
  4651. return self.collapse_duration.to_i > 0
  4652. end
  4653.  
  4654. #--------------------------------------------------------------------------
  4655. # ● Seal Effect
  4656. #--------------------------------------------------------------------------
  4657. def seal_effect
  4658. Sound.play_buzzer
  4659. if XAS_WORD::ENABLE_WORD
  4660. self.battler.damage = XAS_WORD::SEAL
  4661. self.battler.damage_pop = true
  4662. end
  4663. end
  4664.  
  4665. end
  4666.  
  4667. #===============================================================================
  4668. # ■ XAS_DamageStop
  4669. #===============================================================================
  4670. module XAS_DamageStop
  4671.  
  4672. #--------------------------------------------------------------------------
  4673. # ● Acting
  4674. #--------------------------------------------------------------------------
  4675. def acting?
  4676. return (super or self.knockbacking? or self.collapsing? or self.stop)
  4677. end
  4678. end
  4679.  
  4680. #===============================================================================
  4681. # ■ Game_Player
  4682. #===============================================================================
  4683. class Game_Player < Game_Character
  4684. include XAS_DamageStop
  4685. end
  4686.  
  4687. #===============================================================================
  4688. # ■ Game_Event
  4689. #===============================================================================
  4690. class Game_Event < Game_Character
  4691. include XAS_DamageStop
  4692. end
  4693. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4694. #■ BATTLER - TOUCH EFFECT
  4695. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4696.  
  4697.  
  4698. #===============================================================================
  4699. # ■ XRXS_BattlerAttachment
  4700. #==============================================================================
  4701. module XRXS_BattlerAttachment
  4702.  
  4703. #--------------------------------------------------------------------------
  4704. # ● Attack Effect
  4705. #--------------------------------------------------------------------------
  4706. def attack_effect(attacker)
  4707. return false unless $game_system.xas_battle
  4708. return if self.battler == nil or attacker == nil
  4709. return unless can_attack_effect?(attacker)
  4710. if target_shield_enabled?(attacker, nil, nil)
  4711. execute_guard_effect(attacker, nil, nil, 30)
  4712. return
  4713. end
  4714. execute_attack_effect(attacker)
  4715. end
  4716.  
  4717. #--------------------------------------------------------------------------
  4718. # ● Can Attack Effect
  4719. #--------------------------------------------------------------------------
  4720. def can_attack_effect?(attacker)
  4721. return false if self.can_update == false
  4722. return false if @knock_back_duration != nil
  4723. return false if attacker.stop
  4724. return false if self.battler.invunerable
  4725. return false if self.battler.invunerable_duration > 0
  4726. return false if self.action != nil and self.action.user_invincible
  4727. return false if seal_attack?(attacker.battler)
  4728. return false if target_state_invunerable?(30)
  4729. return true
  4730. end
  4731.  
  4732. #--------------------------------------------------------------------------
  4733. # ● Attack Target Shield
  4734. #--------------------------------------------------------------------------
  4735. def attack_target_shield?(attacker)
  4736. return false if attacker.battler.ignore_shield
  4737. return false unless self.battler.shield
  4738. return true if face_direction?(attacker)
  4739. return false
  4740. end
  4741.  
  4742. #--------------------------------------------------------------------------
  4743. # ● Seal Attack?
  4744. #--------------------------------------------------------------------------
  4745. def seal_attack?(attacker)
  4746. if attacker.state_seal_attack or attacker.state_mute
  4747. attacker.damage = XAS_WORD::SEAL
  4748. attacker.damage_pop = true
  4749. self.battler.invunerable_duration = 30
  4750. return true
  4751. end
  4752. return false
  4753. end
  4754.  
  4755. #--------------------------------------------------------------------------
  4756. # ● Execute Attack Damage
  4757. #--------------------------------------------------------------------------
  4758. def execute_attack_damage(attacker)
  4759. if self.battler.agi > (rand(attacker.battler.agi) * 2) #TESTE LOUCO
  4760. self.battler.result.missed = true
  4761. return
  4762. end
  4763. damage = ((attacker.battler.atk * 4) - (self.battler.def * 2)).truncate
  4764. damage = 0 if damage < 0
  4765. self.battler.result.hp_damage = damage
  4766. self.battler.result.critical #DESATIVADO ANTES DO TESTE
  4767. self.battler.hp -= damage.abs
  4768. end
  4769.  
  4770. #--------------------------------------------------------------------------
  4771. # ● Execute Attack Effect
  4772. #--------------------------------------------------------------------------
  4773. def execute_attack_effect(attacker)
  4774. execute_attack_effect_before_damage(attacker)
  4775. execute_attack_damage(attacker)
  4776. if target_missed?(attacker)
  4777. self.battler.invunerable_duration = 30
  4778. return
  4779. end
  4780. execute_damage_pop(attacker)
  4781. execute_attack_effect_after_damage(attacker) if can_check_after_attack_effect?(attacker)
  4782. execute_state_effect(nil, attacker, nil)
  4783. self.battler.invunerable_duration = 20 + XAS_BA::DEFAULT_KNOCK_BACK_DURATION
  4784. if attacker.battler.attack_animation_id != 0
  4785. self.animation_id = attacker.battler.attack_animation_id
  4786. end
  4787. if self.battler.damage.to_i > 0
  4788. self.blow(attacker.direction, 1) if can_blow_effect?
  4789. end
  4790. if self.is_a?(Game_Player)
  4791. self.need_refresh = true
  4792. end
  4793. end
  4794.  
  4795. #--------------------------------------------------------------------------
  4796. # ● Can Check After Attack Effect?
  4797. #--------------------------------------------------------------------------
  4798. def can_check_after_attack_effect?(attacker)
  4799. return false unless self.battler.damage.is_a?(Numeric)
  4800. return true
  4801. end
  4802.  
  4803. #--------------------------------------------------------------------------
  4804. # ● Execute Attack Effect Before Damage
  4805. #--------------------------------------------------------------------------
  4806. def execute_attack_effect_before_damage(attacker)
  4807.  
  4808. end
  4809.  
  4810. #--------------------------------------------------------------------------
  4811. # ● Execute Attack Effect After Damage
  4812. #--------------------------------------------------------------------------
  4813. def execute_attack_effect_after_damage(attacker)
  4814.  
  4815. end
  4816.  
  4817. end
  4818.  
  4819. #===============================================================================
  4820. # ■ Game Player
  4821. #===============================================================================
  4822. class Game_Player < Game_Character
  4823. #--------------------------------------------------------------------------
  4824. # ● Check Event Trigger Touch
  4825. #--------------------------------------------------------------------------
  4826. alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  4827. def check_event_trigger_touch(x, y)
  4828. xrxs64c_check_event_trigger_touch(x, y)
  4829. if $game_map.interpreter.running?
  4830. return
  4831. end
  4832. for event in $game_map.events.values
  4833. next unless event.collision_attack
  4834. unless [1,2].include?(event.trigger)
  4835. if event.battler != nil and event.x == x and event.y == y
  4836. $game_player.attack_effect(event)
  4837. end
  4838. end
  4839. end
  4840. end
  4841. end
  4842.  
  4843. #===============================================================================
  4844. # ■ Game Event
  4845. #===============================================================================
  4846. class Game_Event < Game_Character
  4847.  
  4848. #--------------------------------------------------------------------------
  4849. # ● Check Event Trigger Touch
  4850. #--------------------------------------------------------------------------
  4851. alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  4852. def check_event_trigger_touch(x, y)
  4853. xrxs64c_check_event_trigger_touch(x, y)
  4854. if $game_map.interpreter.running?
  4855. return
  4856. end
  4857. return unless self.collision_attack
  4858. if self.battler != nil and x == $game_player.x and y == $game_player.y
  4859. $game_player.attack_effect(self)
  4860. end
  4861. end
  4862. end
  4863. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4864. #■ BATTLER - MOVE SPEED
  4865. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4866.  
  4867.  
  4868. #==============================================================================
  4869. # ■ Game_Character
  4870. #==============================================================================
  4871. class Game_Character < Game_CharacterBase
  4872.  
  4873. include XAS_BA
  4874. attr_accessor :base_move_speed
  4875. attr_accessor :dash_move_speed
  4876. attr_accessor :move_speed
  4877.  
  4878. #--------------------------------------------------------------------------
  4879. # ● Initialize
  4880. #--------------------------------------------------------------------------
  4881. alias x_move_speed_initialize initialize
  4882. def initialize
  4883. @base_move_speed = BASE_MOVE_SPEED
  4884. @dash_move_speed = 0
  4885. x_move_speed_initialize
  4886. end
  4887.  
  4888. #--------------------------------------------------------------------------
  4889. # ● update_battler_move_speed
  4890. #--------------------------------------------------------------------------
  4891. def update_battler_move_speed
  4892. @dash_move_speed = @dash_active ? DASH_MOVE_SPEED : 0
  4893. sp1 = @base_move_speed
  4894. sp2 = @dash_move_speed
  4895. sp3 = self.battler.state_move_speed
  4896. @move_speed = (sp1 + sp2 + sp3)
  4897. end
  4898.  
  4899. #--------------------------------------------------------------------------
  4900. # ● Update Animation
  4901. #--------------------------------------------------------------------------
  4902. def update_animation
  4903. super
  4904. update_force_move_routine_move #TESTE
  4905. end
  4906.  
  4907. #--------------------------------------------------------------------------
  4908. # ● Update Force Move Routine Move
  4909. #--------------------------------------------------------------------------
  4910. def update_force_move_routine_move
  4911. return if @force_action == ""
  4912. return if @move_route == nil
  4913. command = @move_route.list[@move_route_index]
  4914. return if command == nil
  4915. if command.code == ROUTE_PLAY_SE
  4916. params = command.parameters
  4917. params[0].play
  4918. advance_move_route_index
  4919. end
  4920. end
  4921.  
  4922. #--------------------------------------------------------------------------
  4923. # ● Update Routine Move
  4924. #--------------------------------------------------------------------------
  4925. alias x_update_routine_move update_routine_move
  4926. def update_routine_move
  4927. return if @force_action_times > 0
  4928. x_update_routine_move
  4929. end
  4930.  
  4931. #--------------------------------------------------------------------------
  4932. # ● Can Cancel Move Type Custom
  4933. #--------------------------------------------------------------------------
  4934. alias x_move_speed_process_move_command process_move_command
  4935. def process_move_command(command)
  4936. return if can_cancel_move_type_custom?(command)
  4937. params = command.parameters
  4938. x_move_speed_process_move_command(command)
  4939. if command.code == ROUTE_CHANGE_SPEED and @battler != nil and
  4940. self.is_a?(Game_Event)
  4941. @base_move_speed = params[0]
  4942. end
  4943. end
  4944.  
  4945. #--------------------------------------------------------------------------
  4946. # ● Can Cancel Move Type Custom
  4947. #--------------------------------------------------------------------------
  4948. def can_cancel_move_type_custom?(command)
  4949. return true if command == nil
  4950. return true if @force_action_times > 0
  4951. return false
  4952. end
  4953.  
  4954. end
  4955.  
  4956.  
  4957. #==============================================================================
  4958. # ■ Game_Event
  4959. #==============================================================================
  4960. class Game_Event < Game_Character
  4961.  
  4962. #--------------------------------------------------------------------------
  4963. # ● Initialize
  4964. #--------------------------------------------------------------------------
  4965. alias x_move_speed_event_initialize initialize
  4966. def initialize(map_id, event)
  4967. x_move_speed_event_initialize(map_id, event)
  4968. refresh_move_speed
  4969. end
  4970.  
  4971. #--------------------------------------------------------------------------
  4972. # ● Refresh Move Speed
  4973. #--------------------------------------------------------------------------
  4974. def refresh_move_speed
  4975. return if @page == nil
  4976. @base_move_speed = @page.move_speed
  4977. end
  4978.  
  4979. #--------------------------------------------------------------------------
  4980. # ● Setup Page
  4981. #--------------------------------------------------------------------------
  4982. alias x_move_speed_setup_page setup_page
  4983. def setup_page(new_page)
  4984. x_move_speed_setup_page(new_page)
  4985. refresh_move_speed
  4986. end
  4987.  
  4988. end
  4989. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4990. #■ BATTLER - STATES
  4991. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4992.  
  4993.  
  4994. #==============================================================================
  4995. # ■ Game_Battler
  4996. #==============================================================================
  4997. class Game_Battler
  4998.  
  4999. attr_accessor :state_move_speed
  5000. attr_accessor :state_stop
  5001. attr_accessor :state_loop_effect_time
  5002. attr_accessor :state_loop_speed
  5003. attr_accessor :state_duration
  5004. attr_accessor :state_string
  5005. attr_accessor :state_string_time
  5006. attr_accessor :state_stop
  5007. attr_accessor :state_slow
  5008. attr_accessor :state_sleep
  5009. attr_accessor :state_invunerable
  5010. attr_accessor :state_fast
  5011. attr_accessor :state_mute
  5012. attr_accessor :state_seal_attack
  5013. attr_accessor :state_seal_skill
  5014. attr_accessor :state_seal_item
  5015. attr_accessor :state_reflect
  5016.  
  5017. #--------------------------------------------------------------------------
  5018. # ● Initialize
  5019. #--------------------------------------------------------------------------
  5020. alias x_state_initialize initialize
  5021. def initialize
  5022. @state_move_speed = 0
  5023. @state_duration = []
  5024. @state_loop_effect_time = []
  5025. @state_loop_speed = []
  5026. @state_string = ""
  5027. @state_string_time = 0
  5028. @state_stop = false
  5029. @state_sleep = false
  5030. @state_invunerable = false
  5031. @state_slow = false
  5032. @state_fast = false
  5033. @state_mute = false
  5034. @state_seal_attack = false
  5035. @state_seal_skill = false
  5036. @state_seal_item = false
  5037. @state_reflect = false
  5038. x_state_initialize
  5039. end
  5040.  
  5041. #--------------------------------------------------------------------------
  5042. # ● Add State
  5043. #--------------------------------------------------------------------------
  5044. alias x_add_state add_state
  5045. def add_state(state_id)
  5046. unless @states.include?(state_id)
  5047. state = $data_states[state_id]
  5048. xas_add_state(state)
  5049. end
  5050. x_add_state(state_id)
  5051. end
  5052.  
  5053. #--------------------------------------------------------------------------
  5054. # ● Xas Add State
  5055. #--------------------------------------------------------------------------
  5056. def xas_add_state(state)
  5057. @state_duration[state.id] = 60 * $data_states[state.id].min_turns
  5058. @state_loop_effect_time[state.id] = 0
  5059. @state_loop_speed[state.id] = $data_states[state.id].max_turns
  5060. execute_damage_state(state,0)
  5061. end
  5062.  
  5063. #--------------------------------------------------------------------------
  5064. # ● Remove State
  5065. #--------------------------------------------------------------------------
  5066. alias x_remove_state remove_state
  5067. def remove_state(state_id)
  5068. if state?(state_id)
  5069. state = $data_states[state_id]
  5070. xas_remove_state(state)
  5071. end
  5072. x_remove_state(state_id)
  5073. end
  5074.  
  5075. #--------------------------------------------------------------------------
  5076. # ● XAS Remove State
  5077. #--------------------------------------------------------------------------
  5078. def xas_remove_state(state)
  5079. @state_duration.delete(state.id)
  5080. @state_loop_effect_time.delete(state.id)
  5081. @state_loop_speed.delete(state.id)
  5082. execute_damage_state(state,1)
  5083. end
  5084.  
  5085. #--------------------------------------------------------------------------
  5086. # ● Execute_Damage_State
  5087. #--------------------------------------------------------------------------
  5088. def execute_damage_state(state,type)
  5089. return unless XAS_DAMAGE_POP::DAMAGE_STATE_POP
  5090. return unless XAS_WORD::ENABLE_WORD
  5091. return if state == nil or state.id == 1
  5092. case type
  5093. when 0
  5094. damage = "+ " + state.name.to_s
  5095. when 1
  5096. damage = "- " + state.name.to_s
  5097. end
  5098. @state_string = damage
  5099. @state_string_time = 30
  5100. end
  5101.  
  5102. end
  5103.  
  5104. #==============================================================================
  5105. # ■ Game_Character
  5106. #==============================================================================
  5107. class Game_Character < Game_CharacterBase
  5108.  
  5109. #--------------------------------------------------------------------------
  5110. # ● Update Battler States Effect
  5111. #--------------------------------------------------------------------------
  5112. def update_battler_states_effect
  5113. return unless XAS_SYSTEM::STATE_SYSTEM
  5114. update_state_string_pop
  5115. update_pre_state_setup
  5116. return unless can_update_states_effect?
  5117. for i in self.battler.states
  5118. state = $data_states[i.id]
  5119. if state == nil or self.battler.state_duration[state.id] == nil or
  5120. self.battler.state_loop_effect_time[state.id] == nil or
  5121. self.battler.state_loop_speed[state.id] == nil
  5122. self.battler.remove_state(state.id)
  5123. next
  5124. return
  5125. end
  5126. update_state_abs_effects(state)
  5127. update_state_loop(state)
  5128. update_remove_state(state)
  5129. end
  5130.  
  5131. end
  5132.  
  5133. #--------------------------------------------------------------------------
  5134. # ● Update Pre State Setup
  5135. #--------------------------------------------------------------------------
  5136. def update_pre_state_setup
  5137. self.battler.state_stop = false
  5138. self.battler.state_slow = false
  5139. self.battler.state_fast = false
  5140. self.battler.state_mute = false
  5141. self.battler.state_sleep = false
  5142. self.battler.state_invunerable = false
  5143. self.battler.state_seal_attack = false
  5144. self.battler.state_seal_skill = false
  5145. self.battler.state_seal_item = false
  5146. self.battler.state_reflect = false
  5147. self.battler.state_move_speed = 0
  5148. end
  5149.  
  5150. #--------------------------------------------------------------------------
  5151. # ● Update Pre State Setup
  5152. #--------------------------------------------------------------------------
  5153. def update_state_abs_effects(state)
  5154. if state.note =~ /<Stop>/
  5155. self.battler.state_stop = true
  5156. end
  5157. if state.note =~ /<Slow>/
  5158. self.battler.state_slow = true
  5159. self.battler.state_move_speed = -1.5
  5160. end
  5161. if state.note =~ /<Fast>/
  5162. self.battler.state_fast = true
  5163. self.battler.state_move_speed = 1
  5164. end
  5165. if self.battler.state_fast and
  5166. self.battler.state_slow
  5167. self.battler.state_move_speed = 0
  5168. end
  5169. if state.note =~ /<Mute>/
  5170. self.battler.state_mute = true
  5171. end
  5172. if state.note =~ /<Sleep>/
  5173. self.battler.state_sleep = true
  5174. end
  5175. if state.note =~ /<Invincible>/
  5176. self.battler.state_invunerable = true
  5177. end
  5178. if state.note =~ /<Seal Attack>/
  5179. self.battler.state_seal_attack = true
  5180. end
  5181. if state.note =~ /<Seal Skill>/
  5182. self.battler.state_seal_skill = true
  5183. end
  5184. if state.note =~ /<Seal Item>/
  5185. self.battler.state_seal_item = true
  5186. end
  5187. if state.note =~ /<Reflect>/
  5188. self.battler.state_reflect = true
  5189. end
  5190. end
  5191.  
  5192. #--------------------------------------------------------------------------
  5193. # ● Update State Loop
  5194. #--------------------------------------------------------------------------
  5195. def update_state_loop(state)
  5196. self.battler.state_loop_effect_time[state.id] += 1
  5197. if self.battler.state_loop_effect_time[state.id] > self.battler.state_loop_speed[state.id]
  5198. self.battler.state_loop_effect_time[state.id] = 0
  5199. if state.note =~ /<Animation ID = (\d+)>/
  5200. state_anime = $1.to_i
  5201. if state_anime != nil
  5202. self.animation_id = state_anime
  5203. end
  5204. end
  5205. execute_states_effects(state)
  5206. end
  5207. end
  5208.  
  5209. #--------------------------------------------------------------------------
  5210. # ● Execute States Effect
  5211. #--------------------------------------------------------------------------
  5212. def execute_states_effects(state)
  5213. if state.note =~ /<Slip Damage = (\S+)>/
  5214. execute_state_slip_damage($1.to_i)
  5215. end
  5216. end
  5217.  
  5218. #--------------------------------------------------------------------------
  5219. # ● Execute States Slip Damage
  5220. #--------------------------------------------------------------------------
  5221. def execute_state_slip_damage(damage)
  5222. damage = 1 if damage == nil
  5223. damage_slip = self.battler.mhp * damage / 100
  5224. self.battler.hp -= damage_slip
  5225. self.battler.damage = damage_slip
  5226. self.battler.damage_pop = true
  5227. end
  5228.  
  5229. #--------------------------------------------------------------------------
  5230. # ● Update Remove State
  5231. #--------------------------------------------------------------------------
  5232. def update_remove_state(state)
  5233. self.battler.state_duration[state.id] -= 1
  5234. if self.battler.state_duration[state.id] <= 0
  5235. self.battler.remove_state(state.id)
  5236. end
  5237. end
  5238.  
  5239. #--------------------------------------------------------------------------
  5240. # ● Can Update States Effect
  5241. #--------------------------------------------------------------------------
  5242. def can_update_states_effect?
  5243. return false if self.dead?
  5244. return false if self.battler.states == nil
  5245. return false if self.battler.states.size == 0
  5246. return false if self.battler.state_duration == []
  5247. return true
  5248. end
  5249.  
  5250. #--------------------------------------------------------------------------
  5251. # ● Update State String Pop
  5252. #--------------------------------------------------------------------------
  5253. def update_state_string_pop
  5254. return false if self.battler.state_string_time == 0
  5255. self.battler.state_string_time -= 1
  5256. if self.battler.state_string_time == 0
  5257. self.battler.damage = self.battler.state_string
  5258. self.battler.damage_pop = true
  5259. self.battler.state_string = ""
  5260. end
  5261. end
  5262. end
  5263.  
  5264. #==============================================================================
  5265. # ■ Game_Party TESTE RÁPIDO
  5266. #==============================================================================
  5267. class Game_Party < Game_Unit
  5268.  
  5269. #--------------------------------------------------------------------------
  5270. # ● On Player Walk
  5271. #--------------------------------------------------------------------------
  5272. alias x_state_on_player_walk on_player_walk
  5273. def on_player_walk
  5274. return if XAS_SYSTEM::STATE_SYSTEM
  5275. x_state_on_player_walk
  5276. end
  5277.  
  5278. end
  5279. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5280. #■ BATTLER - EVENT COMMANDS
  5281. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5282.  
  5283.  
  5284. #===============================================================================
  5285. # ■ Game Event
  5286. #===============================================================================
  5287. class Game_Event < Game_Character
  5288.  
  5289. #--------------------------------------------------------------------------
  5290. # ● Shoot Chance
  5291. #--------------------------------------------------------------------------
  5292. def shoot_chance(action_id,perc)
  5293. return if self.battler == nil
  5294. if perc >= rand(100)
  5295. shoot(action_id)
  5296. end
  5297. end
  5298.  
  5299. #--------------------------------------------------------------------------
  5300. # ● Guard
  5301. #--------------------------------------------------------------------------
  5302. def guard(enable)
  5303. return if self.battler == nil
  5304. self.battler.guard = enable
  5305. end
  5306.  
  5307. #--------------------------------------------------------------------------
  5308. # ● Touch Attack
  5309. #--------------------------------------------------------------------------
  5310. def touch_attack(enable)
  5311. return if self.battler == nil
  5312. return if seal_attack?(self.battler)
  5313. @collision_attack = enable
  5314. @pattern = 0
  5315. @pattern_count = 0
  5316. end
  5317.  
  5318. #--------------------------------------------------------------------------
  5319. # ● Counter
  5320. #--------------------------------------------------------------------------
  5321. def counter(enable)
  5322. return if self.battler == nil
  5323. self.battler.counter_action[2] = enable
  5324. end
  5325.  
  5326. #--------------------------------------------------------------------------
  5327. # ● Rand Shoot
  5328. #--------------------------------------------------------------------------
  5329. def rand_shoot(random_id = [])
  5330. return if self.battler == nil
  5331. return if random_id == []
  5332. action_id = random_id[rand(random_id.size)]
  5333. self.shoot(action_id)
  5334. end
  5335.  
  5336. end
  5337. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5338. #■ BATTLER - DEFEAT PROCESS
  5339. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5340.  
  5341. #===============================================================================
  5342. # ■ Scene Base
  5343. #===============================================================================
  5344. class Scene_Base
  5345.  
  5346. #--------------------------------------------------------------------------
  5347. # ● Check Gameover
  5348. #--------------------------------------------------------------------------
  5349. def check_gameover
  5350. return unless $game_party.in_battle
  5351. SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
  5352. end
  5353. end
  5354.  
  5355. #===============================================================================
  5356. # ■ Game Character
  5357. #===============================================================================
  5358. class Game_Character < Game_CharacterBase
  5359. attr_accessor :collapse_duration
  5360. attr_accessor :battler_visible
  5361. attr_writer :opacity
  5362.  
  5363. #--------------------------------------------------------------------------
  5364. # ● Initialize
  5365. #--------------------------------------------------------------------------
  5366. alias x_collapse_initialize initialize
  5367. def initialize
  5368. @collapse_duration = 0
  5369. x_collapse_initialize
  5370. end
  5371.  
  5372. end
  5373.  
  5374. #===============================================================================
  5375. # ■ XAS_BA_BATTLEEVENT_NONPREEMPT
  5376. #==============================================================================
  5377. module XAS_BA_BATTLEEVENT_NONPREEMPT
  5378.  
  5379. #--------------------------------------------------------------------------
  5380. # ● Update
  5381. #--------------------------------------------------------------------------
  5382. def update
  5383. return if self.battler != nil and $game_map.interpreter.running?
  5384. super
  5385. end
  5386. end
  5387.  
  5388. #===============================================================================
  5389. # ■ Game Event
  5390. #==============================================================================
  5391. class Game_Event < Game_Character
  5392. include XAS_BA_BATTLEEVENT_NONPREEMPT
  5393. end
  5394.  
  5395. #===============================================================================
  5396. # ■ Game Character
  5397. #===============================================================================
  5398. class Game_Character < Game_CharacterBase
  5399.  
  5400. #--------------------------------------------------------------------------
  5401. # ● Update Battler Defeat Process
  5402. #--------------------------------------------------------------------------
  5403. def update_battler_defeat_process
  5404. execute_enemy_defeated_process if can_check_enemy_defeated?
  5405. execute_actor_defeated_process if can_check_actor_defeated?
  5406. end
  5407.  
  5408. #--------------------------------------------------------------------------
  5409. # ● Can Check Enemy Defeated?
  5410. #--------------------------------------------------------------------------
  5411. def can_check_enemy_defeated?
  5412. return false if self.battler.is_a?(Game_Actor)
  5413. return false if self.battler.defeated
  5414. return true
  5415. end
  5416.  
  5417. #--------------------------------------------------------------------------
  5418. # ● Can Check Actor Defeated?
  5419. #--------------------------------------------------------------------------
  5420. def can_check_actor_defeated?
  5421. return false if self.battler.is_a?(Game_Enemy)
  5422. return false if self.battler.defeated
  5423. return false if $game_party.members[0].hp > 0
  5424. return false if @collapse_duration > 0
  5425. return true
  5426. end
  5427.  
  5428. #--------------------------------------------------------------------------
  5429. # ● Execute Actor Defeated Process
  5430. #--------------------------------------------------------------------------
  5431. def execute_actor_defeated_process
  5432. erase_actor_tools_on_map
  5433. if $game_party.all_dead? and not self.battler.defeated
  5434. self.battler.defeated = true
  5435. self.collapse_duration = 20#120
  5436. self.knock_back_duration = 161
  5437. reset_battler_temp
  5438. else
  5439. $game_temp.change_leader_wait_time = 0
  5440. $game_player.change_leader
  5441. end
  5442. end
  5443.  
  5444. #--------------------------------------------------------------------------
  5445. # ● Erase Tools on Map
  5446. #--------------------------------------------------------------------------
  5447. def erase_actor_tools_on_map
  5448. for event in $game_map.events.values
  5449. if event.tool_id > 0 and event.action.user.is_a?(Game_Player)
  5450. event.erase
  5451. end
  5452. end
  5453. end
  5454.  
  5455. #--------------------------------------------------------------------------
  5456. # ● Execute Enemy Defeaed Process
  5457. #--------------------------------------------------------------------------
  5458. def execute_enemy_defeated_process
  5459. self.battler.defeated = true
  5460. self.through = true #TESTE
  5461. @knock_back_duration = 121
  5462. enemy = $data_enemies[self.battler.enemy_id]
  5463. @collapse_duration = 120
  5464. execute_gain_exp_gold(enemy)
  5465. execute_active_switch(enemy)
  5466. execute_defeated_animation(enemy)
  5467. execute_defeated_sound_effect(enemy)
  5468. execute_final_shoot(enemy)
  5469. end
  5470.  
  5471. #--------------------------------------------------------------------------
  5472. # ● Execute Defeated Sound Effect
  5473. #--------------------------------------------------------------------------
  5474. def execute_defeated_sound_effect(enemy)
  5475. return if self.battler.no_damage_pop
  5476. Sound.play_enemy_collapse
  5477. end
  5478.  
  5479. #--------------------------------------------------------------------------
  5480. # ● Execute Final Shoot
  5481. #--------------------------------------------------------------------------
  5482. def execute_final_shoot(enemy)
  5483. enemy.note =~ /<Final Action ID = (\d+)>/
  5484. action_id = $1.to_i
  5485. return if action_id == nil
  5486. self.shoot(action_id)
  5487. end
  5488.  
  5489. #--------------------------------------------------------------------------
  5490. # ● Execute Gain Exp Gold
  5491. #--------------------------------------------------------------------------
  5492. def execute_gain_exp_gold(enemy)
  5493. exp = self.battler.exp
  5494. case XAS_BA::EXP_TYPE
  5495. when 0
  5496. actor = $game_party.members[0]
  5497. actor.gain_exp(exp)
  5498. when 1
  5499. for i in 0...$game_party.members.size
  5500. actor = $game_party.members[i]
  5501. actor.gain_exp(exp)
  5502. end
  5503. when 2
  5504. exp = exp / $game_party.members.size
  5505. for i in 0...$game_party.members.size
  5506. actor = $game_party.members[i]
  5507. actor.gain_exp(exp)
  5508. end
  5509. end
  5510. $game_party.gain_gold(self.battler.gold)
  5511. end
  5512.  
  5513. #--------------------------------------------------------------------------
  5514. # ● Execute_Active Switch
  5515. #--------------------------------------------------------------------------
  5516. def execute_active_switch(enemy)
  5517. enemy.note =~ /<Active Switch = (\d+)>/
  5518. switch_id = $1.to_i
  5519. if switch_id != nil
  5520. $game_switches[switch_id] = true
  5521. $game_map.need_refresh = true
  5522. end
  5523. end
  5524.  
  5525. #--------------------------------------------------------------------------
  5526. # ● Execute Defeated Animation
  5527. #--------------------------------------------------------------------------
  5528. def execute_defeated_animation(enemy)
  5529. enemy.note =~ /<Defeated Animation = (\d+)>/
  5530. anime_id = $1.to_i
  5531. if anime_id != nil
  5532. self.animation_id = anime_id
  5533. end
  5534. end
  5535.  
  5536. end
  5537.  
  5538. #===============================================================================
  5539. # ■ Game Player
  5540. #===============================================================================
  5541. class Game_Player < Game_Character
  5542.  
  5543. #--------------------------------------------------------------------------
  5544. # ● Reset Old Level
  5545. #--------------------------------------------------------------------------
  5546. def reset_old_level(trans = false)
  5547. for actor in $game_party.members
  5548. actor.old_level = actor.level
  5549. end
  5550. end
  5551.  
  5552. #--------------------------------------------------------------------------
  5553. # ● Change Leader
  5554. #--------------------------------------------------------------------------
  5555. def change_leader
  5556. return if $game_party.members.size <= 1
  5557. reset_battler_temp
  5558. current_leader_id = $game_party.members[0].id
  5559. for i in 1..$game_party.members.size
  5560. pre_leader = $game_party.members[0].id
  5561. $game_party.remove_actor(pre_leader)
  5562. $game_party.add_actor(pre_leader)
  5563. if $game_party.members[0].hp > 0
  5564. execute_change_leader_effect unless current_leader_id == $game_party.members[0].id
  5565. break
  5566. end
  5567. end
  5568. end
  5569.  
  5570. #--------------------------------------------------------------------------
  5571. # ● Exeute Change leader Effect
  5572. #--------------------------------------------------------------------------
  5573. def execute_change_leader_effect
  5574. actor = $game_party.members[0]
  5575. actor.invunerable_duration = XAS_BA::CHANGE_LEADER_WAIT_TIME
  5576. actor.damage = nil
  5577. actor.damage_pop = false
  5578. actor.critical = false
  5579. @knock_back_duration = nil
  5580. if self.action != nil
  5581. self.action.duration = 1
  5582. end
  5583. @force_action_times = 0
  5584. @force_action_type = ""
  5585. reset_old_level(true)
  5586. @x_pose_original_name = @character_name
  5587. update_battler_pose
  5588. $game_map.need_refresh = true
  5589. self.animation_id = XAS_ANIMATION::CHANGE_LEADER_ANIMATION_ID
  5590. $game_temp.change_leader_wait_time = XAS_BA::CHANGE_LEADER_WAIT_TIME
  5591. end
  5592.  
  5593. #--------------------------------------------------------------------------
  5594. # ● Check Actor Level
  5595. #--------------------------------------------------------------------------
  5596. def check_actor_level
  5597. return if $game_party.in_battle
  5598. return if self.battler == nil
  5599. return if self.battler.old_level == self.battler.level
  5600. reset_old_level(false)
  5601. if self.battler.level > 1
  5602. Audio.se_play("Audio/SE/" + XAS_SOUND::LEVEL_UP , 0, 100) #TESTE
  5603. if XAS_WORD::ENABLE_WORD
  5604. $game_player.battler.damage = XAS_WORD::LEVEL_UP
  5605. $game_player.battler.damage_pop = true
  5606. end
  5607. end
  5608. $game_player.need_refresh = true
  5609. end
  5610. end
  5611.  
  5612. #===============================================================================
  5613. # ■ Game Party OUTRO TESTE RÁPIDO
  5614. #===============================================================================
  5615. class Game_Party < Game_Unit
  5616.  
  5617. #--------------------------------------------------------------------------
  5618. # ● Setup Starting Members
  5619. #--------------------------------------------------------------------------
  5620. alias x_old_level_setup_starting_members setup_starting_members
  5621. def setup_starting_members
  5622. x_old_level_setup_starting_members
  5623. for actor in $game_party.members
  5624. actor.old_level = actor.level
  5625. end
  5626. end
  5627. end
  5628.  
  5629. #===============================================================================
  5630. # ■ Sprite Character
  5631. #==============================================================================
  5632. class Sprite_Character < Sprite_Base
  5633.  
  5634. #--------------------------------------------------------------------------
  5635. # ● Update Collapse Effects
  5636. #--------------------------------------------------------------------------
  5637. def update_collaspse_effects
  5638. update_collapse_duration
  5639. return unless can_collapse_effects?
  5640. update_collpase_zoom_effects
  5641. update_exp_gold_pop
  5642. end
  5643.  
  5644. #--------------------------------------------------------------------------
  5645. # ● Can Collapse Effects
  5646. #--------------------------------------------------------------------------
  5647. def can_collapse_effects?
  5648. return false if @character.battler.is_a?(Game_Actor)
  5649. return false unless @character.dead?
  5650. return false if @character.erased
  5651. return true
  5652. end
  5653.  
  5654. #--------------------------------------------------------------------------
  5655. # ● Update Exp Gold Pop
  5656. #--------------------------------------------------------------------------
  5657. def update_exp_gold_pop
  5658. return unless XAS_DAMAGE_POP::DAMAGE_EXP_GOLD_POP
  5659. exp_pop = @character.battler.exp
  5660. gold_pop =@character.battler.gold
  5661. case @character.collapse_duration
  5662. when 110
  5663. enemy = $data_enemies[@character.battler.enemy_id]
  5664. @character.make_treasure(enemy)
  5665. when 80
  5666. if exp_pop != 0
  5667. word = XAS_WORD::EXP
  5668. @character.battler.damage = word + " " + exp_pop.to_s
  5669. @character.battler.damage_pop = true
  5670. @character.battler.damage_type = "Exp"
  5671. end
  5672. when 40
  5673. if gold_pop != 0
  5674. word = $data_system.currency_unit
  5675. @character.battler.damage = word + " " + gold_pop.to_s
  5676. @character.battler.damage_pop = true
  5677. @character.battler.damage_type = "Gold"
  5678. end
  5679. end
  5680. end
  5681.  
  5682. #--------------------------------------------------------------------------
  5683. # ● Update Collapse Duration
  5684. #--------------------------------------------------------------------------
  5685. def update_collapse_duration
  5686. @character.collapse_duration -= 1
  5687. @character.opacity -= 2
  5688. if @character.collapse_duration <= 0
  5689. if @character.battler.is_a?(Game_Actor)
  5690. SceneManager.goto(Scene_Gameover)
  5691. return
  5692. end
  5693. self.visible = false
  5694. @character.opacity = 0
  5695. @character.erase
  5696. end
  5697. end
  5698.  
  5699. #--------------------------------------------------------------------------
  5700. # ● Update Collapse Zoom Effects
  5701. #--------------------------------------------------------------------------
  5702. def update_collpase_zoom_effects
  5703. case @character.battler.death_zoom_effect
  5704. when 1
  5705. @character.zoom_y += 0.05
  5706. @character.zoom_x -= 0.01
  5707. when 2
  5708. @character.zoom_y -= 0.01
  5709. @character.zoom_x += 0.03
  5710. when 3
  5711. @character.zoom_y += 0.03
  5712. @character.zoom_x += 0.03
  5713. when 4
  5714. @character.zoom_y -= 0.005
  5715. @character.zoom_x -= 0.005
  5716. when 5
  5717. case @character.collapse_duration
  5718. when 60..120
  5719. @character.zoom_y -= 0.01
  5720. @character.zoom_x += 0.06
  5721. when 0..59
  5722. @character.zoom_y += 0.2
  5723. @character.zoom_x -= 0.1
  5724. end
  5725. end
  5726. end
  5727.  
  5728. end
  5729. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5730. #■ BATTLER - TREASURE
  5731. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5732.  
  5733.  
  5734. #===============================================================================
  5735. # ■ XAS_BA_Item_Drop
  5736. #==============================================================================
  5737. module XAS_BA_ItemDrop
  5738.  
  5739. #--------------------------------------------------------------------------
  5740. # ● Defeat Process
  5741. #--------------------------------------------------------------------------
  5742. def make_treasure(enemy)
  5743. treasure = nil
  5744. return unless $game_player.passable?(self.x,self.y,0)
  5745. for di in enemy.drop_items
  5746. next if di.kind == 0
  5747. next if rand(di.denominator) != 0
  5748. if di.kind == 1
  5749. treasure = $data_items[di.data_id]
  5750. tr_id = treasure.id
  5751. elsif di.kind == 2
  5752. treasure = $data_weapons[di.data_id]
  5753. tr_id = treasure.id
  5754. elsif di.kind == 3
  5755. treasure = $data_armors[di.data_id]
  5756. tr_id = treasure.id
  5757. end
  5758. break if treasure != nil
  5759. end
  5760. if treasure != nil
  5761. command = RPG::MoveCommand.new
  5762. command.code = 14
  5763. command.parameters = [0,0]
  5764. route = RPG::MoveRoute.new
  5765. route.repeat = false
  5766. route.list = [command, RPG::MoveCommand.new]
  5767. page = RPG::Event::Page.new
  5768. page.move_type = 3
  5769. page.move_route = route
  5770. page.move_frequency = 6
  5771. page.priority_type = 1
  5772. page.trigger = 1
  5773. page.through = true
  5774. event = RPG::Event.new(self.x, self.y)
  5775. event.pages = [page]
  5776. event = RPG::Event.new(self.x, self.y)
  5777. token = Token_Event.new($game_map.map_id, event)
  5778. token.icon_name = treasure.icon_index
  5779. token.treasure = [di.kind,tr_id]
  5780. token.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  5781. token.jump_high(0,0,20)
  5782. token.force_update = true
  5783. token.move_speed = 6
  5784. $game_map.add_token(token)
  5785. end
  5786. end
  5787. end
  5788.  
  5789. #===============================================================================
  5790. # ■ Game Event
  5791. #===============================================================================
  5792. class Game_Event < Game_Character
  5793. include XAS_BA_ItemDrop
  5794.  
  5795. #--------------------------------------------------------------------------
  5796. # ● Update Treasure Duration
  5797. #--------------------------------------------------------------------------
  5798. def update_treasure_duration
  5799. return if @treasure_time == 0
  5800. @treasure_time -= 1
  5801. self.erase if @treasure_time == 0
  5802. end
  5803.  
  5804. end
  5805.  
  5806. #===============================================================================
  5807. # ■ Game Character
  5808. #==============================================================================
  5809. class Game_Character < Game_CharacterBase
  5810. attr_accessor :icon_name
  5811. attr_accessor :treasure
  5812. end
  5813.  
  5814. #===============================================================================
  5815. # ■ Game Character
  5816. #==============================================================================
  5817. class Sprite_Character < Sprite_Base
  5818.  
  5819. #--------------------------------------------------------------------------
  5820. # ● Update
  5821. #--------------------------------------------------------------------------
  5822. alias xrxs_charactericon_update update
  5823. def update
  5824. xrxs_charactericon_update
  5825. if @character.icon_name != nil
  5826. self.bitmap = Cache.system("Iconset")
  5827. self.src_rect.set(@character.icon_name % 16 * 24, @character.icon_name / 16 * 24, 24, 24)
  5828. self.ox = 12
  5829. self.oy = 24
  5830. end
  5831. end
  5832. end
  5833.  
  5834. #===============================================================================
  5835. # ■ Game Player
  5836. #==============================================================================
  5837. class Game_Player < Game_Character
  5838.  
  5839. #--------------------------------------------------------------------------
  5840. # ● Check Event Trigger Here
  5841. #--------------------------------------------------------------------------
  5842. alias treasure_check_event_trigger_here check_event_trigger_here
  5843. def check_event_trigger_here(triggers)
  5844. return false if $game_map.interpreter.running?
  5845. check_treasure_here
  5846. treasure_check_event_trigger_here(triggers)
  5847. end
  5848.  
  5849. #--------------------------------------------------------------------------
  5850. # ● check_treasure_here
  5851. #--------------------------------------------------------------------------
  5852. def check_treasure_here
  5853. for event in $game_map.events_xy(@x, @y)
  5854. if event.treasure != nil
  5855. name_pop = true
  5856. case event.treasure[0]
  5857. when 1
  5858. item = $data_items[event.treasure[1]]
  5859. if can_execute_field_item_effect?(item)
  5860. name_pop = false
  5861. else
  5862. $game_party.gain_item(item, 1)
  5863. end
  5864. $game_map.need_refresh = true
  5865. when 2
  5866. item = $data_weapons[event.treasure[1]]
  5867. $game_party.gain_item($data_weapons[event.treasure[1]], 1,false)
  5868. when 3
  5869. item = $data_armors[event.treasure[1]]
  5870. $game_party.gain_item(item, 1,false)
  5871. end
  5872. Audio.se_play("Audio/SE/" + XAS_SOUND::ITEM_DROP , 100, 100)
  5873. event.erase
  5874. if item != nil
  5875. if item.note =~ /<Drop Animation = (\d+)>/
  5876. self.animation_id = $1.to_i
  5877. end
  5878. if XAS_DAMAGE_POP::DAMAGE_ITEM_POP and name_pop
  5879. self.battler.damage = item.name.to_s
  5880. self.battler.damage_pop = true
  5881. self.battler.damage_type = "Item"
  5882. end
  5883. end
  5884. end
  5885. end
  5886. end
  5887.  
  5888. #--------------------------------------------------------------------------
  5889. # ● Can Execute Field Item Effect
  5890. #--------------------------------------------------------------------------
  5891. def can_execute_field_item_effect?(item)
  5892. if item.note =~ /<Drop HP Damage = (\S+)>/
  5893. damage = $1.to_i
  5894. damage2 = damage * self.battler.mhp / 100
  5895. self.battler.damage = damage2
  5896. self.battler.damage_pop = true
  5897. self.battler.hp -= damage2
  5898. return true
  5899. end
  5900. if item.note =~ /<Drop MP Damage = (\S+)>/
  5901. damage = $1.to_i
  5902. damage2 = damage * self.battler.mmp / 100
  5903. self.battler.mp -= damage2
  5904. self.battler.damage_type = "Mp"
  5905. self.battler.damage = damage2
  5906. self.battler.damage_pop = true
  5907. return true
  5908. end
  5909. if item.note =~ /<Drop Gold = (\d+)>/
  5910. gold = $1.to_i
  5911. damage = $data_system.terms.gold + " " + gold.to_s
  5912. self.battler.damage = damage
  5913. self.battler.damage_pop = true
  5914. $game_party.gain_gold(gold)
  5915. return true
  5916. end
  5917. return false
  5918. end
  5919. end
  5920. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5921. #■ SPRITE - POSE (Character Name)
  5922. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5923.  
  5924.  
  5925. #===============================================================================
  5926. # ■ Game_Character
  5927. #===============================================================================
  5928. class Game_Character < Game_CharacterBase
  5929.  
  5930. attr_accessor :x_pose_duration
  5931. attr_accessor :x_pose_name
  5932. attr_accessor :x_pose_original_name
  5933. attr_accessor :character_name
  5934.  
  5935. #-----------------------------------------------------------------------------
  5936. # ● Initialize
  5937. #-----------------------------------------------------------------------------
  5938. alias x_pose_initialize initialize
  5939. def initialize
  5940. x_pose_initialize
  5941. @x_pose_duration = 0
  5942. @x_pose_name = ""
  5943. @x_pose_original_name = @character_name
  5944. end
  5945.  
  5946. #-----------------------------------------------------------------------------
  5947. # ● Update
  5948. #-----------------------------------------------------------------------------
  5949. def make_pose(sufix, pose_duration)
  5950. return if @x_pose_original_name == ""
  5951. @x_pose_name = sufix
  5952. @x_pose_duration = pose_duration
  5953. end
  5954.  
  5955. #-----------------------------------------------------------------------------
  5956. # ● Update Pose
  5957. #-----------------------------------------------------------------------------
  5958. def update_battler_pose
  5959. return false unless XAS_SYSTEM::CHARACTER_POSE_NAME
  5960. if @x_pose_duration == 0
  5961. @x_pose_original_name = @character_name
  5962. return
  5963. else
  5964. @x_pose_duration -= 1
  5965. @character_name = @x_pose_original_name + @x_pose_name
  5966. if @x_pose_duration == 0
  5967. @character_name = @x_pose_original_name
  5968. @x_pose_name = ""
  5969. end
  5970. end
  5971. unless jumping?
  5972. @jump_count = 0
  5973. @jump_peak = 0
  5974. end
  5975. end
  5976.  
  5977. #-----------------------------------------------------------------------------
  5978. # ● Set Graphic
  5979. #-----------------------------------------------------------------------------
  5980. alias x_pose_set_graphic set_graphic
  5981. def set_graphic(character_name, character_index)
  5982. x_pose_set_graphic(character_name, character_index)
  5983. @x_pose_original_name = @character_name
  5984. @x_pose_duration = 0
  5985. @x_pose_name = ""
  5986. end
  5987.  
  5988. end
  5989.  
  5990.  
  5991. #===============================================================================
  5992. # ■ Game_Interpreter
  5993. #===============================================================================
  5994. class Game_Interpreter
  5995.  
  5996. #-----------------------------------------------------------------------------
  5997. # ● Command_322
  5998. #-----------------------------------------------------------------------------
  5999. alias x_pose_command_322 command_322
  6000. def command_322
  6001. x_pose_command_322
  6002. actor = $game_actors[@params[0]] #TESTE CORRENDO
  6003. if actor != nil
  6004. $game_player.x_pose_duration = 0
  6005. $game_player.x_pose_original_name = @params[1]
  6006. end
  6007. end
  6008.  
  6009. end
  6010.  
  6011. #===============================================================================
  6012. # ■ RPG_FileTest
  6013. #===============================================================================
  6014. module RPG_FileTest
  6015.  
  6016. #--------------------------------------------------------------------------
  6017. # ● RPG_FileTest.character_exist?
  6018. #--------------------------------------------------------------------------
  6019. def RPG_FileTest.character_exist?(filename)
  6020. return Cache.character(filename) rescue return false
  6021. end
  6022.  
  6023. #--------------------------------------------------------------------------
  6024. # ● RPG_FileTest.system_exist?
  6025. #--------------------------------------------------------------------------
  6026. def RPG_FileTest.system_exist?(filename)
  6027. return Cache.system(filename) rescue return false
  6028. end
  6029.  
  6030. end
  6031.  
  6032. #===============================================================================
  6033. # ■ Sprite_Character
  6034. #===============================================================================
  6035. class Sprite_Character < Sprite_Base
  6036.  
  6037. #--------------------------------------------------------------------------
  6038. # ● X Pose Update
  6039. #--------------------------------------------------------------------------
  6040. alias x_pose_update_bitmap update_bitmap
  6041. def update_bitmap
  6042. check_file_exist
  6043. x_pose_update_bitmap
  6044. end
  6045.  
  6046. #--------------------------------------------------------------------------
  6047. # ● Check File Exist
  6048. #--------------------------------------------------------------------------
  6049. def check_file_exist
  6050. return if @character_name == @character.character_name
  6051. unless RPG_FileTest.character_exist?(@character.character_name)
  6052. @character.character_name = @character.x_pose_original_name
  6053. @character.x_pose_duration = 0
  6054. @character.x_pose_name = ""
  6055. end
  6056. end
  6057.  
  6058. end
  6059.  
  6060.  
  6061. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6062. #■ SPRITE - DAMAGE SPRITE
  6063. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6064.  
  6065.  
  6066. #===============================================================================
  6067. # ■ XRXS_DAMAGE_OFFSET
  6068. #===============================================================================
  6069. module XRXS_DAMAGE_OFFSET
  6070.  
  6071. #--------------------------------------------------------------------------
  6072. # ● Update
  6073. #--------------------------------------------------------------------------
  6074. def update
  6075. super
  6076. @damage_sprites = [] if @damage_sprites.nil?
  6077. for damage_sprite in @damage_sprites
  6078. damage_sprite.x = self.x
  6079. damage_sprite.y = self.y
  6080. end
  6081. end
  6082. end
  6083.  
  6084. #===============================================================================
  6085. # ■ Sprite_Character
  6086. #===============================================================================
  6087. class Sprite_Character < Sprite_Base
  6088. include XRXS_DAMAGE_OFFSET
  6089. end
  6090.  
  6091.  
  6092. #==============================================================================
  6093. # ■ Sprite Base
  6094. #==============================================================================
  6095. class Sprite_Base < Sprite
  6096. include XAS_DAMAGE_POP
  6097. #--------------------------------------------------------------------------
  6098. # ● Initialize
  6099. #--------------------------------------------------------------------------
  6100. alias x_damage_pop_initialize initialize
  6101. def initialize(viewport = nil)
  6102. @_damage_duration = 0
  6103. x_damage_pop_initialize(viewport)
  6104. end
  6105.  
  6106. #--------------------------------------------------------------------------
  6107. # ● Damage
  6108. #--------------------------------------------------------------------------
  6109. def damage(value, type = "")
  6110. dispose_damage
  6111. @damage_ox = 0
  6112. @damage_type = type
  6113. # NUMBER PICTURE
  6114. if value.is_a?(Numeric)
  6115. bitmap_number_image = Cache.system("XAS_Damage_Number")
  6116. bitmap_im_cw = bitmap_number_image.width / 10
  6117. bitmap_im_ch = bitmap_number_image.height / 5
  6118. bitmap = Bitmap.new(bitmap_number_image.width,(bitmap_im_ch * 2) + 5)
  6119. bitmap_number_text = value.to_s.split(//)
  6120. center_x = (((2 + bitmap_number_text.size) * bitmap_im_cw) / 2)
  6121. # Damage Color
  6122. if value >= 0
  6123. if @damage_type == "Critical"
  6124. h = bitmap_im_ch * 2
  6125. h2 = bitmap_im_ch * 4
  6126. $game_map.screen.start_shake(5, 5, 60)
  6127. elsif @damage_type == "Mp"
  6128. h = bitmap_im_ch * 0
  6129. h2 = bitmap_im_ch * 3
  6130. else
  6131. h = 0
  6132. end
  6133. f = 0
  6134. else # Recover Color
  6135. h = bitmap_im_ch
  6136. h2 = bitmap_im_ch * 3 if @damage_type == "Mp"
  6137. f = 1
  6138. end
  6139. for r in f..bitmap_number_text.size - 1
  6140. bitmap_number_abs = bitmap_number_text[r].to_i
  6141. bitmap_src_rect = Rect.new(bitmap_im_cw * bitmap_number_abs, h, bitmap_im_cw, bitmap_im_ch)
  6142. bitmap.blt(center_x + (bitmap_im_cw * r), bitmap_im_ch + 5, bitmap_number_image, bitmap_src_rect)
  6143. end
  6144. ex = (bitmap_im_cw / 2) * (bitmap_number_text.size + f)
  6145. @damage_ox = (bitmap_number_image.width - (bitmap_number_image.width / 2) - ex) - center_x
  6146. # Add Extra String (MP / Critical)
  6147. if h2 != nil
  6148. string_x = (center_x - (bitmap_number_image.width / 2) + (bitmap_im_cw / 2) * bitmap_number_text.size)
  6149. bitmap_src_rect = Rect.new(0, h2, bitmap_number_image.width, bitmap_im_ch)
  6150. bitmap.blt(string_x , 0, bitmap_number_image, bitmap_src_rect)
  6151. end
  6152. bitmap_number_image.dispose
  6153. else
  6154. #TEXT STRING
  6155. damage_string = value.to_s
  6156. bitmap = Bitmap.new(160, 48)
  6157. bitmap.font.name = DAMAGE_FONT_NAME
  6158. bitmap.font.size = DAMAGE_FONT_SIZE
  6159. bitmap.font.bold = DAMAGE_FONT_BOLD
  6160. bitmap.font.italic = DAMAGE_FONT_ITALIC
  6161. bitmap.font.color = Color.new(0,0,0)
  6162. bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  6163. case @damage_type
  6164. when "Exp"; string_color = DAMAGE_EXP_FONT_COLOR
  6165. when "Gold"; string_color = DAMAGE_GOLD_FONT_COLOR
  6166. when "Item"; string_color = DAMAGE_ITEM_FONT_COLOR
  6167. else
  6168. string_color = DAMAGE_DEFAULT_FONT_COLOR
  6169. end
  6170. bitmap.font.color = string_color
  6171. bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  6172. end
  6173. @_damage_sprite = ::Sprite.new(self.viewport)
  6174. @_damage_sprite.bitmap = bitmap
  6175. @_damage_sprite.ox = 80
  6176. @_damage_sprite.oy = 20
  6177. @_damage_sprite.x = self.x + @damage_ox
  6178. @_damage_sprite.y = self.y - self.oy / 2
  6179. @_damage_sprite.z = 0#5000#3000 # TESTE
  6180. @_damage_duration = 60
  6181. end
  6182.  
  6183. #--------------------------------------------------------------------------
  6184. # ● Dispose Damage
  6185. #--------------------------------------------------------------------------
  6186. def dispose_damage
  6187. if @_damage_sprite != nil
  6188. @_damage_sprite.bitmap.dispose
  6189. @_damage_sprite.dispose
  6190. @_damage_sprite = nil
  6191. @_damage_duration = 0
  6192. end
  6193. end
  6194.  
  6195. #--------------------------------------------------------------------------
  6196. # ● Dispose
  6197. #--------------------------------------------------------------------------
  6198. alias x_damage_dispose dispose
  6199. def dispose
  6200. dispose_damage
  6201. x_damage_dispose
  6202. end
  6203.  
  6204. #--------------------------------------------------------------------------
  6205. # ● Update
  6206. #--------------------------------------------------------------------------
  6207. alias x_damage_pop_update update
  6208. def update
  6209. if @_damage_duration > 0
  6210. @_damage_duration -= 1
  6211. if @_damage_duration == 0
  6212. dispose_damage
  6213. end
  6214. end
  6215. x_damage_pop_update
  6216. end
  6217.  
  6218. end
  6219.  
  6220. #===============================================================================
  6221. # ■ XRXS DAMAGE
  6222. #===============================================================================
  6223. module XRXS_DAMAGE
  6224.  
  6225. #--------------------------------------------------------------------------
  6226. # ● Damage X Init Velocity
  6227. #--------------------------------------------------------------------------
  6228. def damage_x_init_velocity
  6229. return 0.2 * (rand(5) - 2)
  6230. end
  6231.  
  6232. #--------------------------------------------------------------------------
  6233. # ● Damage Y Init Velocity
  6234. #--------------------------------------------------------------------------
  6235. def damage_y_init_velocity
  6236. return 9
  6237. end
  6238.  
  6239. #--------------------------------------------------------------------------
  6240. # ● Update
  6241. #--------------------------------------------------------------------------
  6242. def update
  6243. super
  6244. @damage_sprites = [] if @damage_sprites.nil?
  6245. @damage_durations = [] if @damage_durations.nil?
  6246. if @_damage_sprite != nil and @_damage_sprite.visible
  6247. if @damage_ox != nil
  6248. dam_ox = @damage_ox
  6249. else
  6250. dam_ox = 0
  6251. end
  6252. if @damage_type != nil
  6253. dam_type = @damage_type
  6254. end
  6255. x = damage_x_init_velocity
  6256. y = damage_y_init_velocity
  6257. d = @_damage_duration
  6258. @damage_sprites.push(Sprite_Damage.new(@_damage_sprite, x, y, d,dam_ox,dam_type))
  6259. @_damage_sprite.visible = false
  6260. end
  6261. for damage_sprite in @damage_sprites
  6262. damage_sprite.update
  6263. end
  6264. for i in 0...@damage_sprites.size
  6265. @damage_sprites[i] = nil if @damage_sprites[i].disposed?
  6266. end
  6267. @damage_sprites.compact!
  6268. end
  6269. def dispose
  6270. super
  6271. if @damage_sprites != nil
  6272. for damage_sprite in @damage_sprites
  6273. damage_sprite.dispose
  6274. end
  6275. end
  6276. end
  6277. end
  6278.  
  6279. #===============================================================================
  6280. # ■ RPG Sprite
  6281. #===============================================================================
  6282. class Sprite_Base < Sprite
  6283. include XRXS_DAMAGE
  6284. end
  6285.  
  6286. #===============================================================================
  6287. # ■ Sprite Damage
  6288. #===============================================================================
  6289. class Sprite_Damage < Sprite
  6290.  
  6291. #--------------------------------------------------------------------------
  6292. # ● Initialize
  6293. #--------------------------------------------------------------------------
  6294. def initialize(sprite, init_x_speed, init_y_speed, duration,dam_ox,dam_type = nil)
  6295. super(nil)
  6296. self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil?
  6297. self.opacity = sprite.opacity
  6298. self.x = sprite.x
  6299. self.y = sprite.y
  6300. self.z = sprite.z
  6301. self.ox = sprite.ox - dam_ox
  6302. self.oy = sprite.oy
  6303. @now_x_speed = init_x_speed
  6304. @now_y_speed = init_y_speed
  6305. @potential_x_energy = 0.0
  6306. @potential_y_energy = 0.0
  6307. @duration = duration
  6308. @dam_type = dam_type
  6309. @dam_type = "" if dam_type == nil
  6310. end
  6311.  
  6312. #--------------------------------------------------------------------------
  6313. # ● Update
  6314. #--------------------------------------------------------------------------
  6315. def update
  6316. super
  6317. if XAS_DAMAGE_POP::DAMAGE_CRITICAL_ZOOM
  6318. if @dam_type != "Critical"
  6319. update_normal_popup
  6320. else
  6321. update_critical_effect
  6322. end
  6323. else
  6324. update_normal_popup
  6325. end
  6326. @duration -= 1
  6327. if @duration == 0
  6328. self.dispose
  6329. end
  6330. end
  6331.  
  6332. #--------------------------------------------------------------------------
  6333. # ● update_critical_effect
  6334. #--------------------------------------------------------------------------
  6335. def update_critical_effect
  6336. case @duration
  6337. when 40..60
  6338. self.zoom_x += 0.1
  6339. self.zoom_y += 0.1
  6340. else
  6341. if self.zoom_x > 0.1
  6342. self.zoom_x -= 0.1
  6343. self.zoom_y -= 0.1
  6344. end
  6345. end
  6346. end
  6347.  
  6348. #--------------------------------------------------------------------------
  6349. # ● update_normal_popup
  6350. #--------------------------------------------------------------------------
  6351. def update_normal_popup
  6352. self.opacity -= 25 if @duration <= 10
  6353. n = self.oy + @now_y_speed
  6354. if n <= 0
  6355. @now_y_speed *= -1
  6356. @now_y_speed /= 2
  6357. @now_x_speed /= 2
  6358. end
  6359. self.oy = [n, 0].max
  6360. @potential_y_energy += 0.58
  6361. speed = @potential_y_energy.floor
  6362. @now_y_speed -= speed
  6363. @potential_y_energy -= speed
  6364. @potential_x_energy += @now_x_speed
  6365. speed = @potential_x_energy.floor
  6366. self.ox += speed
  6367. @potential_x_energy -= speed
  6368. end
  6369.  
  6370. end
  6371. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6372. #■ SPRITE - SPRITE EFFECTS
  6373. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6374.  
  6375.  
  6376. #==============================================================================
  6377. # ■ Sprite Base
  6378. #==============================================================================
  6379. class Sprite_Base < Sprite
  6380.  
  6381. #--------------------------------------------------------------------------
  6382. # ● Animation Set Sprite
  6383. #--------------------------------------------------------------------------
  6384. def animation_set_sprites(frame)
  6385. cell_data = frame.cell_data
  6386. @ani_sprites.each_with_index do |sprite, i|
  6387. next unless sprite
  6388. pattern = cell_data[i, 0]
  6389. if !pattern || pattern < 0
  6390. sprite.visible = false
  6391. next
  6392. end
  6393. sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  6394. sprite.visible = true
  6395. sprite.src_rect.set(pattern % 5 * 192,
  6396. pattern % 100 / 5 * 192, 192, 192)
  6397. if @ani_mirror
  6398. cx = cell_data[i, 1]
  6399. sprite.angle = (360 - cell_data[i, 4])
  6400. sprite.mirror = (cell_data[i, 5] == 0)
  6401. else
  6402. cx = cell_data[i, 1]
  6403. sprite.angle = cell_data[i, 4]
  6404. sprite.mirror = (cell_data[i, 5] == 1)
  6405. end
  6406. cy = cell_data[i, 2]
  6407. sprite.z = self.z + 300 + i #TESTE
  6408. sprite.ox = 96
  6409. sprite.oy = 96
  6410. sprite.zoom_x = cell_data[i, 3] / 100.0
  6411. sprite.zoom_y = cell_data[i, 3] / 100.0
  6412. sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  6413. sprite.blend_type = cell_data[i, 7]
  6414. case @animation.position
  6415. when 0
  6416. sprite.x = self.x + cx
  6417. sprite.y = self.y + cy - (height / 2)
  6418. when 1
  6419. sprite.x = self.x + cx
  6420. sprite.y = self.y + cy
  6421. when 2
  6422. sprite.x = self.x + cx
  6423. sprite.y = self.y + cy + (height / 2)
  6424. when 3
  6425. sprite.x = (640 / 2) + cx
  6426. sprite.y = (480 / 2) + cy
  6427. end
  6428.  
  6429.  
  6430. end
  6431. end
  6432.  
  6433. #--------------------------------------------------------------------------
  6434. # ● Dispose Animation
  6435. #--------------------------------------------------------------------------
  6436. def dispose_animation
  6437. $game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
  6438. if @ani_bitmap1
  6439. @@_reference_count[@ani_bitmap1] -= 1
  6440. if @@_reference_count[@ani_bitmap1] == 0
  6441. $game_temp.animation_garbage.push(@ani_bitmap1)
  6442. end
  6443. end
  6444. if @ani_bitmap2
  6445. @@_reference_count[@ani_bitmap2] -= 1
  6446. if @@_reference_count[@ani_bitmap2] == 0
  6447. $game_temp.animation_garbage.push(@ani_bitmap2)
  6448. end
  6449. end
  6450. if @ani_sprites
  6451. @ani_sprites.each {|sprite| sprite.dispose }
  6452. @ani_sprites = nil
  6453. @animation = nil
  6454. end
  6455. @ani_bitmap1 = nil
  6456. @ani_bitmap2 = nil
  6457. end
  6458.  
  6459. end
  6460.  
  6461. #==============================================================================
  6462. # ■ Scene_Base
  6463. #==============================================================================
  6464. class Game_Map
  6465.  
  6466. #--------------------------------------------------------------------------
  6467. # ● Setup
  6468. #--------------------------------------------------------------------------
  6469. alias animation_garbage_setup setup
  6470. def setup(map_id)
  6471. animation_garbage_setup(map_id)
  6472. dispose_animation_garbage
  6473. end
  6474.  
  6475. #--------------------------------------------------------------------------
  6476. # ● Dispose Animation Garbage
  6477. #--------------------------------------------------------------------------
  6478. def dispose_animation_garbage
  6479. return if $game_temp.animation_garbage == nil
  6480. for animation in $game_temp.animation_garbage
  6481. animation.dispose
  6482. end
  6483. $game_temp.animation_garbage = nil
  6484. end
  6485.  
  6486. end
  6487.  
  6488. #==============================================================================
  6489. # ■ Scene_Base
  6490. #==============================================================================
  6491. class Scene_Base
  6492.  
  6493. #--------------------------------------------------------------------------
  6494. # ● Scene Changing?
  6495. #--------------------------------------------------------------------------
  6496. alias animation_garbage_scene_changing scene_changing?
  6497. def scene_changing?
  6498. $game_map.dispose_animation_garbage if SceneManager.scene != self
  6499. animation_garbage_scene_changing
  6500. end
  6501.  
  6502. end
  6503.  
  6504. #===============================================================================
  6505. # ■ Sprite_Character
  6506. #===============================================================================
  6507. class Sprite_Character < Sprite_Base
  6508. include XAS_SYSTEM
  6509.  
  6510. #--------------------------------------------------------------------------
  6511. # ● Setup New Effect
  6512. #--------------------------------------------------------------------------
  6513. def setup_new_effect
  6514. if @character.animation_id > 0
  6515. animation = $data_animations[@character.animation_id]
  6516. start_animation(animation)
  6517. @character.animation_id = 0
  6518. end
  6519. if !@balloon_sprite && @character.balloon_id > 0
  6520. @balloon_id = @character.balloon_id
  6521. start_balloon
  6522. end
  6523. end
  6524.  
  6525. #--------------------------------------------------------------------------
  6526. # ● Can Update X Effects
  6527. #--------------------------------------------------------------------------
  6528. def can_update_x_effects?
  6529. return false unless CHARACTER_SPRITE_EFFECTS
  6530. return false if @character.erased
  6531. return false if @character.transparent == true
  6532. return true
  6533. end
  6534. #--------------------------------------------------------------------------
  6535. # ● Can Damage Pop Base
  6536. #--------------------------------------------------------------------------
  6537. def can_damage_pop_base?
  6538. return false unless $game_system.xas_battle
  6539. return false if XAS_SYSTEM::DAMAGE_POP == false
  6540. return false if @character.battler == nil
  6541. return false if @character.battler.no_damage_pop
  6542. return false if @character.battler.damage_pop != true
  6543. return true
  6544. end
  6545.  
  6546.  
  6547. #--------------------------------------------------------------------------
  6548. # ● Execute Damage Pop
  6549. #--------------------------------------------------------------------------
  6550. def execute_damage_pop
  6551. damage(@character.battler.damage, @character.battler.damage_type)
  6552. @character.battler.damage = nil
  6553. @character.battler.critical = false
  6554. @character.battler.damage_pop = false
  6555. @character.battler.damage_type = ""
  6556. end
  6557.  
  6558. #--------------------------------------------------------------------------
  6559. # ● Update X Effects
  6560. #--------------------------------------------------------------------------
  6561. def update_x_effects
  6562. update_collaspse_effects if @character.collapse_duration > 0
  6563. update_sprite_position
  6564. update_angle
  6565. update_zoom
  6566. end
  6567.  
  6568. #--------------------------------------------------------------------------
  6569. # ● Update Angle
  6570. #--------------------------------------------------------------------------
  6571. def update_angle
  6572. return if @character.angle == self.angle
  6573. self.angle = @character.angle
  6574. end
  6575.  
  6576. #--------------------------------------------------------------------------
  6577. # ● Update Zoom
  6578. #--------------------------------------------------------------------------
  6579. def update_zoom
  6580. update_treasure_effect
  6581. update_breath_effect if can_breath_effect?
  6582. self.zoom_x = @character.zoom_x
  6583. self.zoom_y = @character.zoom_y
  6584. end
  6585.  
  6586. #--------------------------------------------------------------------------
  6587. # ● Update Treasure_effect
  6588. #--------------------------------------------------------------------------
  6589. def update_treasure_effect
  6590. return if @character.treasure_time == 0
  6591. update_treasure_fade_effect
  6592. update_treasure_float_effect
  6593. end
  6594.  
  6595. #--------------------------------------------------------------------------
  6596. # ● update_treasure_fade_effect
  6597. #--------------------------------------------------------------------------
  6598. def update_treasure_fade_effect
  6599. return unless XAS_BA::FADE_TREASURE_SPRITE
  6600. return if @character.treasure_time > 100
  6601. return if @character.zoom_x < 0.01
  6602. @character.zoom_x -= 0.01
  6603. if @character.temp_id > 0
  6604. @character.zoom_x = 1.00
  6605. @character.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  6606. end
  6607. end
  6608.  
  6609. #--------------------------------------------------------------------------
  6610. # ● Update Treasure Float Effect
  6611. #--------------------------------------------------------------------------
  6612. def update_treasure_float_effect
  6613. return unless XAS_BA::FLOAT_TREASURE_SPRITE
  6614. return if self.character.jumping?
  6615. self.character.treasure_float[2] += 1
  6616. if self.character.treasure_float[2] > 1
  6617. self.character.treasure_float[2] = 0
  6618. self.character.treasure_float[1] += 1
  6619. case self.character.treasure_float[1]
  6620. when 1..15
  6621. self.character.treasure_float[0] -= 1
  6622. when 16..30
  6623. self.character.treasure_float[0] += 1
  6624. else
  6625. self.character.treasure_float[0] = 0
  6626. self.character.treasure_float[1] = 0
  6627. end
  6628. end
  6629. self.y += self.character.treasure_float[0]
  6630. end
  6631.  
  6632. #--------------------------------------------------------------------------
  6633. # ● Can Breath Effect?
  6634. #--------------------------------------------------------------------------
  6635. def can_breath_effect?
  6636. return false if @character.battler == nil
  6637. return false if @character.battler.breath_effect == false
  6638. return false if @character.battler.hp == 0
  6639. return false if @character.stop and not @character.battler.state_sleep
  6640. return true
  6641. end
  6642.  
  6643. #--------------------------------------------------------------------------
  6644. # ● Update Breath Effect
  6645. #--------------------------------------------------------------------------
  6646. def update_breath_effect
  6647. if @character.battler.fast_breath_effect
  6648. zoom_speed = 3
  6649. zoom_power_x = 0.006
  6650. zoom_power_y = 0.006
  6651. else
  6652. zoom_speed = 1
  6653. zoom_power_x = 0
  6654. zoom_power_y = 0.002
  6655. end
  6656. @character.battler.breath_duration += zoom_speed
  6657. case @character.battler.breath_duration
  6658. when 1..30
  6659. @character.zoom_x += zoom_power_x
  6660. @character.zoom_y += zoom_power_y
  6661. when 31..60
  6662. @character.zoom_x -= zoom_power_x
  6663. @character.zoom_y -= zoom_power_y
  6664. else
  6665. @character.battler.breath_duration = 0
  6666. @character.zoom_x = 1.00
  6667. @character.zoom_y = 1.00
  6668. end
  6669. end
  6670.  
  6671. #--------------------------------------------------------------------------
  6672. # ● Update Sprite Position
  6673. #--------------------------------------------------------------------------
  6674. alias x_set_character_bitmap set_character_bitmap
  6675. def set_character_bitmap
  6676. @py = nil
  6677. x_set_character_bitmap
  6678. if @character_name[/\((\d+)\)/]
  6679. @py = $1.to_i
  6680. end
  6681. end
  6682.  
  6683. #--------------------------------------------------------------------------
  6684. # ● Update Sprite Position
  6685. #--------------------------------------------------------------------------
  6686. def update_sprite_position
  6687. if @character.tool_id > 0
  6688. if @character.tool_effect == "Barrier"
  6689. unless @character.action == nil
  6690. bullet_user = @character.action.user
  6691. self.x = bullet_user.screen_x
  6692. self.y = bullet_user.screen_y
  6693. @character.x = bullet_user.x
  6694. @character.y = bullet_user.y
  6695. @character.direction = bullet_user.direction
  6696. end
  6697. end
  6698. end
  6699. update_hold_target
  6700. if @py != nil
  6701. self.y += @py
  6702. end
  6703. if @character.angle == 315 and @cw != nil
  6704. self.x -= (@cw / 3)
  6705. self.y -= (@ch / 6)
  6706. end
  6707. if XAS_BA::KNOCKBACKING_SHAKE
  6708. if self.character.knockbacking?
  6709. self.x = self.x + rand(5) unless self.character.dead?
  6710. end
  6711. end
  6712. end
  6713.  
  6714. #--------------------------------------------------------------------------
  6715. # ● Update X Effects
  6716. #--------------------------------------------------------------------------
  6717. def update_hold_target
  6718. return if @character.temp_id == 0
  6719. target = $game_map.events[@character.temp_id]
  6720. if target == nil or target.erased
  6721. @character.temp_id = 0
  6722. @character.move_speed = @character.pre_move_speed
  6723. check_character_above_player(target)
  6724. else
  6725. self.x = target.screen_x
  6726. self.y = target.screen_y
  6727. self.character.x = target.x
  6728. self.character.y = target.y
  6729. self.character.move_speed = target.move_speed
  6730. self.character.direction = target.direction unless self.character.direction_fix
  6731. check_character_above_player(target)
  6732. end
  6733. end
  6734.  
  6735. #--------------------------------------------------------------------------
  6736. # ● Check Chacracter Above Player
  6737. #--------------------------------------------------------------------------
  6738. def check_character_above_player(target)
  6739. return if @character.is_a?(Game_Player)
  6740. return if @character.battler == nil
  6741. if (@character.x == $game_player.x and
  6742. @character.y == $game_player.y) or
  6743. not @character.passable_temp_id?(@character.x,@character.y)
  6744. @character.temp_id = 0
  6745. @character.move_speed = @character.pre_move_speed
  6746. case @character.direction
  6747. when 2; @character.y -= 1
  6748. when 4; @character.x += 1
  6749. when 6; @character.x -= 1
  6750. when 8; @character.y += 1
  6751. end
  6752. end
  6753. end
  6754.  
  6755. #--------------------------------------------------------------------------
  6756. # ● Update_balloon
  6757. #--------------------------------------------------------------------------
  6758. if XAS_BA::FIX_BALLOON_POSITION
  6759. def update_balloon
  6760. if @balloon_duration > 0
  6761. @balloon_duration -= 1
  6762. if @balloon_duration > 0
  6763. @balloon_sprite.x = x
  6764. @balloon_sprite.y = y - XAS_BA::BALLOON_HEIGHT
  6765. @balloon_sprite.z = z + 200
  6766. sx = balloon_frame_index * 32
  6767. sy = (@balloon_id - 1) * 32
  6768. @balloon_sprite.src_rect.set(sx, sy, 32, 32)
  6769. else
  6770. end_balloon
  6771. end
  6772. end
  6773. end
  6774. end
  6775.  
  6776. end
  6777.  
  6778. #==============================================================================
  6779. # ■ Game_Event
  6780. #==============================================================================
  6781. class Game_Event < Game_Character
  6782.  
  6783. #--------------------------------------------------------------------------
  6784. # ● Near The Screen
  6785. #--------------------------------------------------------------------------
  6786. alias x_near_the_screen near_the_screen?
  6787. def near_the_screen?(dx = 12, dy = 8)
  6788. return true if can_update_out_screen?
  6789. x_near_the_screen(dx, dy)
  6790. end
  6791.  
  6792. #--------------------------------------------------------------------------
  6793. # ● Can Update Out Screen
  6794. #--------------------------------------------------------------------------
  6795. def can_update_out_screen?
  6796. return true if self.force_update
  6797. return false
  6798. end
  6799.  
  6800. end
  6801.  
  6802. #==============================================================================
  6803. # ■ Spriteset Map
  6804. #==============================================================================
  6805. class Spriteset_Map
  6806.  
  6807. #--------------------------------------------------------------------------
  6808. # ● Can Refresh Hud
  6809. #--------------------------------------------------------------------------
  6810. alias x_pre_leader_id_initialize initialize
  6811. def initialize
  6812. if $game_party.members[0] != nil
  6813. $game_system.pre_leader_id = $game_party.members[0].actor_id
  6814. else
  6815. $game_system.pre_leader_id = nil
  6816. end
  6817. x_pre_leader_id_initialize
  6818. end
  6819.  
  6820. #--------------------------------------------------------------------------
  6821. # ● Can Refresh Hud
  6822. #--------------------------------------------------------------------------
  6823. def can_refresh_hud?
  6824. if $game_party.members[0] == nil
  6825. return true if $game_system.pre_leader_id != nil
  6826. elsif $game_party.members[0] != nil
  6827. return true if $game_system.pre_leader_id == nil
  6828. return true if $game_system.pre_leader_id != $game_party.members[0].actor_id
  6829. end
  6830. return false
  6831. end
  6832.  
  6833. #--------------------------------------------------------------------------
  6834. # ● update
  6835. #--------------------------------------------------------------------------
  6836. def refresh_hud
  6837. $game_system.pre_leader_id = $game_party.members[0].actor_id
  6838. end
  6839.  
  6840. #--------------------------------------------------------------------------
  6841. # ● Update Hud Visible
  6842. #--------------------------------------------------------------------------
  6843. def update_hud_visible
  6844. if hud_visible?
  6845. $game_system.enable_hud = true
  6846. else
  6847. $game_system.enable_hud = false
  6848. end
  6849. end
  6850.  
  6851. #--------------------------------------------------------------------------
  6852. # ● Hud Visible?
  6853. #--------------------------------------------------------------------------
  6854. def hud_visible?
  6855. return false if $game_system.hud_visible == false
  6856. return false if $game_message.visible
  6857. return true
  6858. end
  6859.  
  6860. end
  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") #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 = 0#-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 #TESTE
  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 += 0
  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 -= 0#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. #■ MISC - MAIN UPDATE
  7223. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  7224.  
  7225. #===============================================================================
  7226. # ■ Spriteset_Map
  7227. #===============================================================================
  7228. class Spriteset_Map
  7229.  
  7230. #--------------------------------------------------------------------------
  7231. # ● update
  7232. #--------------------------------------------------------------------------
  7233. alias xas_main_update update
  7234. def update
  7235. xas_main_update
  7236. update_xas_spriteset_map
  7237. end
  7238.  
  7239. #--------------------------------------------------------------------------
  7240. # ● Update XAS Spriteset Map
  7241. #--------------------------------------------------------------------------
  7242. def update_xas_spriteset_map
  7243. refresh_token if $game_map.need_refresh_token
  7244. refresh_hud if can_refresh_hud?
  7245. update_hud_visible
  7246. end
  7247. end
  7248.  
  7249.  
  7250. #===============================================================================
  7251. # ■ Sprite_Character
  7252. #===============================================================================
  7253. class Sprite_Character < Sprite_Base
  7254.  
  7255. #--------------------------------------------------------------------------
  7256. # ● Update
  7257. #--------------------------------------------------------------------------
  7258. alias x_update update
  7259. def update
  7260. x_update
  7261. execute_damage_pop if can_damage_pop_base?
  7262. update_x_effects if can_update_x_effects?
  7263. end
  7264.  
  7265. end
  7266.  
  7267. #===============================================================================
  7268. # ■ Game Character
  7269. #===============================================================================
  7270. class Game_Character < Game_CharacterBase
  7271.  
  7272. #--------------------------------------------------------------------------
  7273. # ● Update
  7274. #--------------------------------------------------------------------------
  7275. alias x_main_update update
  7276. def update
  7277. update_character_before_movement
  7278. x_main_update
  7279. update_character_after_movement
  7280. end
  7281.  
  7282. #--------------------------------------------------------------------------
  7283. # ● Update Character Before Movement
  7284. #--------------------------------------------------------------------------
  7285. def update_character_before_movement
  7286. check_xy
  7287. update_force_action if can_force_action?
  7288. end
  7289.  
  7290. #--------------------------------------------------------------------------
  7291. # ● Update Character After Movement
  7292. #--------------------------------------------------------------------------
  7293. def update_character_after_movement
  7294. update_battler if can_update_battler?
  7295. end
  7296.  
  7297. end
  7298.  
  7299. #===============================================================================
  7300. # ■ Game Event
  7301. #===============================================================================
  7302. class Game_Event < Game_Character
  7303.  
  7304. #--------------------------------------------------------------------------
  7305. # ● Update
  7306. #--------------------------------------------------------------------------
  7307. alias x_main_event_update update
  7308. def update
  7309. update_event_before_movement
  7310. x_main_event_update
  7311. update_event_after_movement
  7312. end
  7313.  
  7314. #--------------------------------------------------------------------------
  7315. # ● Update Event Before Movement
  7316. #--------------------------------------------------------------------------
  7317. def update_event_before_movement
  7318. update_sensor if can_update_sensor?
  7319. update_treasure_duration
  7320. end
  7321.  
  7322. #--------------------------------------------------------------------------
  7323. # ● Update Event After Movement
  7324. #--------------------------------------------------------------------------
  7325. def update_event_after_movement
  7326. #update_sensor if can_update_sensor? #TESTE (DESATIVAR CASO dÊ MERDA)
  7327. #update_treasure_duration #TESTE (DESATIVAR CASO dÊ MERDA)
  7328. end
  7329.  
  7330. end
  7331.  
  7332. #===============================================================================
  7333. # ■ Game Player
  7334. #===============================================================================
  7335. class Game_Player < Game_Character
  7336.  
  7337. #--------------------------------------------------------------------------
  7338. # ● Update
  7339. #--------------------------------------------------------------------------
  7340. alias x_main_player_update update
  7341. def update
  7342. update_player_before_movement if party_system?
  7343. x_main_player_update #TESTE
  7344. update_player_after_movement if party_system?
  7345. end
  7346.  
  7347. #--------------------------------------------------------------------------
  7348. # ● Update Player Before Movement
  7349. #--------------------------------------------------------------------------
  7350. def update_player_before_movement
  7351. check_actor_level
  7352. update_reset_battler_setting_time
  7353. if $game_system.old_interpreter_running != $game_map.interpreter.running?
  7354. refresh_interpreter_effect
  7355. end
  7356. end
  7357.  
  7358. #--------------------------------------------------------------------------
  7359. # ● Update Player after Movement
  7360. #--------------------------------------------------------------------------
  7361. def update_player_after_movement
  7362. update_action_command if can_use_command?
  7363. $game_temp.change_leader_wait_time -= 1 if $game_temp.change_leader_wait_time > 0
  7364. end
  7365.  
  7366. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement