下一将说明技能设置与TOOL MAP的关联!
---------------------------------------我就是分割线---------------------------------------------------------------------
由于VA 的XAS系统官方一直都是1.0,所以有很多BUG!
比如物品关联技能时不能扔也不能卖,EXP经验条不正常递增!
本人小小的优化了下!
喜欢的就拿走吧!
[pre lang="ruby" line="1"]=begin
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■■ X A S - Xiderwong Action System (For Advanced Users)
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
----改动3860 4850 5673 5626----------
X - Xiderowng
A - Action
S - System
#===============================================================================
# ■ TERMS OF USE
#===============================================================================
English
- You need to give credits to Xiderowng.
- You need to link the official Xiderowng website. http://xrxs.at-ninja.jp/
Português
> Termos de uso <
- Você precisa dar os creditos para o Xiderowg.
- Você precisa divulgar a página oficial do Xiderowg. http://xrxs.at-ninja.jp/
#===============================================================================
# ■ Caracteristicas (MAIN FEATURES)
#===============================================================================
Sistema de batalha ativa no mapa (ou) e de intera??o com o cenário.
#===============================================================================
# ■ Histórico
#===============================================================================
(V 0.5)
- introdu??o inicial do XAS Hero Edition para o Rpg Maker VX ACE.
- Vers?o de teste para corre??o de bugs, glitches e teste de performance.
=end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
# XAS - SETUP
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#===============================================================================
# ■ XAS SYSTEN SETTING
#===============================================================================
# Desative um dos sistemas abaixo caso você tiver algum problema de
# compatibilidade com outros sistemas de script, problema de performance ou
# caso n?o quiser usar algum dos sistemas abaixo
#-------------------------------------------------------------------------------
module XAS_SYSTEM
# Ativar o sistema de batalha, deixe como false se desejar usar apenas o
# sistema de ferramentas (Intera??o com o cenário)
# Caso queira desativar o sistema de batalha durante o jogo use o comando
# abaixo.
#
# $game_system.xas_battle = X
#
BATTLE_SYSTEM = true
# Ativar a exibi??o de dano (Sprite).
DAMAGE_POP = true
# Ativar o sistema de pose de a??es.
CHARACTER_POSE_NAME = true
# Ativar o sistema de sprites
CHARACTER_SPRITE_EFFECTS = true
# Ativar o sistema de dash avan?ado para o XAS.
DASH_SYSTEM = true
# Ativar o sistema de diagonal para o player.
PLAYER_DIAGONAL_MOVEMENT = true
# Ativar o sistema de diagonal para o evento
EVENT_DIAGONAL_MOVEMENT = true
# Ativar o sistema de condi??es para o battler.
STATE_SYSTEM = true
# Defini??o do mapa que ficar?o os eventos das ferramentas.
ACTION_TEMPLATE_MAP_ID = 1
# Defini??o da ID da variável que corresponde a ID da ferramenta,
# Essa ID serve para criar eventos interativos com as ferramentas.
HIT_ID = 3
end
#===============================================================================
# ■ XAS BUTTON SETTING
#===============================================================================
module XAS_BUTTON
#Defini??o do bot?o de ataque.
ACTION_1_BUTTON = Input::C
#Defini??o do bot?o do escudo.
ACTION_2_BUTTON = Input::X
#Defini??o do bot?o de habildiade
SKILL_BUTTON = Input::Z
#Defini??o do bot?o do item.
ITEM_BUTTON = Input::Y
#Defini??o do bot?o de correr.
DASH_BUTTON = Input::A
#Defini??o do bot?o de mudar de lider.
CHANGE_LEADER_BUTTON = Input::R
#Ativar o bot?o de ataque.
ENABLE_ACTION_1_BUTTON = true
#Ativar o bot?o de escudo.
ENABLE_ACTION_2_BUTTON = true #
#Ativar o bot?o de habilidade.
ENABLE_SKILL_BUTTON = true
#Ativar o bot?o de item.
ENABLE_ITEM_BUTTON = true
#Ativar o bot?o de corrida.
ENABLE_DASH_BUTTON = false #
#Ativar o bot?o de mudar de lider.
ENABLE_CHANGE_LEADER_BUTTON = true
end
#===============================================================================
# ■ WORD SETTING
#===============================================================================
# Defini??o das palavras usadas no XAS
#-------------------------------------------------------------------------------
module XAS_WORD
# Ativar as palavras.
ENABLE_WORD = true
# Palavra usada quando o battler usa o sistema de defesa.
GUARD = "Guard"
# Palavra usada quando n?o tem MP o suficiênte para usar a habilidade.
NO_MP = "SP不足"
# Palavra usada quando n?o tem item para ativar a habilidade.
NO_ITEM = "缺少物品"
# Palavra usada quando o personagem aumenta de nível.
LEVEL_UP = "等级上升了"
# Palavra usada quando o personagem está com as a??es seladas.
SEAL = "Sealed!"
# Palavra usada quando o personagem está invencível.
INVINCIBLE = "Invincible!"
# Palavra usada para definir experiência.
EXP = "经验值"
# Palavra usada quando o alvo se esquiva do ataque.
EVADED = "Evaded!"
# Palavra usada quando o battler erra o ataque.
MISSED = "MISS"
# Palavra usada quando o counter é ativado.
COUNTER = "Counter"
# Palavra usada quando a habilidade é refletida.
REFLECT = "Reflected"
end
#===============================================================================
# ■ XAS DAMAGE POP
#===============================================================================
# Defini??o do sistema de sprites de dano.
#-------------------------------------------------------------------------------
module XAS_DAMAGE_POP
# Defni??o da fonte.
DAMAGE_FONT_NAME = "黑体"
# Defini??o do tamanho da fonte.
DAMAGE_FONT_SIZE = 14
# Ativar a fonte em bold.
DAMAGE_FONT_BOLD = true
# Ativar a fonte em itálico.
DAMAGE_FONT_ITALIC = true
# Ativar o Zoom no dano quando é dano crítico.
DAMAGE_CRITICAL_ZOOM = true
# Apresentar a quantidade de experiência e dinheiro.
DAMAGE_EXP_GOLD_POP = true
# Apresentar o nome da condi??o(States).
DAMAGE_STATE_POP = true
# Apresentar o nome do item ao pegar no campo de batalha.
DAMAGE_ITEM_POP = true
# Defini??o da cor padr?o da fonte.
DAMAGE_DEFAULT_FONT_COLOR = Color.new(255, 90, 120)
# Defini??o da cor da experiência.
DAMAGE_EXP_FONT_COLOR = Color.new(0, 255, 100)
# Defini??o da cor do dinheiro (Gold).
DAMAGE_GOLD_FONT_COLOR = Color.new(255, 255, 50)
# Defini??o da cor do item.
DAMAGE_ITEM_FONT_COLOR = Color.new(255, 100, 20)
end
#===============================================================================
# ■ SOUND SETTING
#===============================================================================
# Defini??o do sistema de sons do XAS.
#-------------------------------------------------------------------------------
module XAS_SOUND
#Som executado ao pegar o item.
ITEM_DROP = "Equip2"
#Som executado ao fazer level up
LEVEL_UP = "powerup"
#Som executado quando n?o tem item ou mp o suficiente.
ACTION_COST = "Cursor1"
end
#===============================================================================
# ■ ANIMATION SETTING
#===============================================================================
# Defini??o do sistema de anima??es do XAS.
# Caso n?o quiser usar as anima??es, defina o valor como 0 (Zero).
#-------------------------------------------------------------------------------
module XAS_ANIMATION
# Anima??o quando o sistema de defesa é ativado.
GUARD_ANIMATION_ID = 127
# Anima??o quando o lider é trocado.
CHANGE_LEADER_ANIMATION_ID = 135
# Anima??o quando o battler acerta o alvo em condi??o invencível.
INVINCIBLE_ANIMATION_ID = 36
# Anima??o quando o battler estiver usando o sistema de charge weapon.
CHARGE_ANIMATION1_ID = 155
# Anima??o do battler após a arma estiver carregada.
CHARGE_ANIMATION2_ID = 123
# Anima??o apresentada durante o carregamento das habilidades.
CAST_TIME_ANIMATION_ID = 120
# Velocidade do loop das anima??es.
LOOP_ANIMATIONS_SPEED = 60
# Anima??o de refletir
REFLECT_ANIMATION_ID = 128
end
#===============================================================================
# ■ GENERAL BATTLER SETTING
#===============================================================================
# Defini??o geral do sistema de batalha do XAS.
#-------------------------------------------------------------------------------
module XAS_BA
#Tempo para poder ativar o bot?o de mudar de lider.
CHANGE_LEADER_WAIT_TIME = 10
#Deixar a hud visivel ao come?ar o jogo.
#Você pode ativar ou desativar a hud usando o código abaixo
# $game_system.hud_visible = true
HUD_VISIBLE_AT_STARTUP = false
# Defini??o da Switch da página de a??es de curta distancia.
SENSOR_SELF_SWITCH = "D"
# Defini??o da variável que define a area padr?o para ativar a página de
# a??es de curta distancia.
DEFAULT_SENSOR_RANGE_VARIABLE_ID = 4
# Tempo padr?o do recuo (lockout) do battler.
DEFAULT_KNOCK_BACK_DURATION = 10
# Ativar sprite tremendo quando o battler está em recuo.
KNOCKBACKING_SHAKE = false
# Velocidade básica de movimento
#BASE_MOVE_SPEED = 4.2
# Velocidade extra quando o battler estiver correndo.
# DASH_MOVE_SPEED = 0.6
# Retornar na posi??o de 4 dire??es após algum tempo na posi??o na diagonal.
DIAGONAL_DURATION_ENABLE = true
# Tempo para retornar na posi??o de 4 dire??es.
DIAGONAL_DURATION = 15
# Defini??o do modo como a experiência é dividida entre os aliados.
# 0 - EXP somente para quem matou o inimigo.
# 1 - EXP é repartido para o grupo, exp no valor integral.
# 2 - EXP é divido pelo numero do grupo e repartido para todos.
EXP_TYPE = 2
# Defini??o do tempo para remover o tesouro do mapa.
TREASURE_ERASE_TIME = 5
# Ativar a anima??o de fade no tesouro.
FADE_TREASURE_SPRITE = true
# Ativar a anima??o de levita??o no tesouro.
FLOAT_TREASURE_SPRITE = true
# Fixar a posi??o do bal?o independente da altura real do sprite.
FIX_BALLOON_POSITION = true
# Altura que o bal?o será fixado.
BALLOON_HEIGHT = 32
end
#--------------------------------------------------------------------------
# ● Add Invunerable Actions
#--------------------------------------------------------------------------
def add_inv(action_id = 0)
return if action_id == nil or action_id <= 0
return if @invunerable_actions.include?(action_id)
@invunerable_actions.push(action_id)
end
#--------------------------------------------------------------------------
# ● Remove Invunerable Actions
#--------------------------------------------------------------------------
def remove_inv(action_id = 0)
return if action_id == nil or action_id <= 0
return unless @invunerable_actions.include?(action_id)
@invunerable_actions.delete(action_id)
end
#--------------------------------------------------------------------------
# ● Add Guard Directions
#--------------------------------------------------------------------------
def add_guard_dir(direction = 0)
return if direction == nil or direction <= 0
return if @guard_directions.include?(direction)
@guard_directions.push(direction)
end
#--------------------------------------------------------------------------
# ● Remove Guard Directions
#--------------------------------------------------------------------------
def remove_guard_dir(direction = 0)
return if direction == nil or direction <= 0
return unless @guard_directions.include?(direction)
@guard_directions.delete(direction)
end
end
#===============================================================================
# ■ Game Actor
#===============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● Display Level Up
#--------------------------------------------------------------------------
alias x_display_level_up display_level_up
def display_level_up(new_skills)
return unless $game_party.in_battle
x_display_level_up(new_skills)
end
end
#===============================================================================
# ■ Character
#===============================================================================
class Game_Character < Game_CharacterBase
#--------------------------------------------------------------------------
# ● Invunerable
#--------------------------------------------------------------------------
def invunerable(enable = false)
return if @battler == nil or @battler.dead?
@battler.invunerable = enable
end
#--------------------------------------------------------------------------
# ● Fast Breath
#--------------------------------------------------------------------------
def fast_breath(enable = true)
return if @battler == nil or @battler.dead?
@battler.fast_breath_effect = enable
end
end
#--------------------------------------------------------------------------
# ● Object
#--------------------------------------------------------------------------
alias x_event_initialize initialize
def initialize(map_id, event)
x_event_initialize(map_id, event)
@collision_attack = false
if @event.name =~ /<O(\d+)>/i @opacity = $1.to_i
end
if @event.name =~ /<B(\d+)>/i
@blend_type = $1.to_i
end
end
#--------------------------------------------------------------------------
# ● Erase
#--------------------------------------------------------------------------
alias x_event_erase erase
def erase
if self.tool_id > 0
$game_system.tools_on_map.delete(self.tool_id)
end
x_event_erase
end
#--------------------------------------------------------------------------
# ● Event Name
#--------------------------------------------------------------------------
def name
return @event.name
end
end
#===============================================================================
# ■ Game Followers
#===============================================================================
class Game_Followers
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_party_initialize initialize
def initialize(leader)
x_party_initialize(leader)
if $xas_party_system == nil
@visible = false
end
end
end
#===============================================================================
# ■ Game Map
#===============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
alias x_initial_setup setup
def setup(map_id)
x_initial_setup(map_id)
xas_initial_setup(map_id)
end
#--------------------------------------------------------------------------
# ● XAS Initial Setup
#--------------------------------------------------------------------------
def xas_initial_setup(map_id)
for actor in $game_party.members
setup_initial_members(actor)
end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● Call Menu
#--------------------------------------------------------------------------
alias x_call_menu call_menu
def call_menu
return if $game_player.action != nil
$game_player.reset_charge_temp
x_call_menu
end
end
#===============================================================================
# ■ Scene_Refresh
#===============================================================================
class Scene_Refresh
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
SceneManager.call(Scene_Map)
end
end
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● Leader Changed
#--------------------------------------------------------------------------
def leader_changed?(actor)
if $game_party.members[0] == nil
return true if actor != nil
elsif $game_party.members[0] != nil
return true if actor == nil
return true if actor.actor_id != $game_party.members[0].actor_id
end
return false
end
end
$xas = true
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ MOVEMENT - DIAGONAL MOVEMENT
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#===============================================================================
# ■ Game Character
#===============================================================================
class Game_CharacterBase
#--------------------------------------------------------------------------
# ● Set Direction
#--------------------------------------------------------------------------
alias diagonal_set_direction set_direction
def set_direction(d)
diagonal_set_direction(d)
@diagonal_direction = 0
reset_diagonal
end
end
#===============================================================================
# ■ Game Character
#===============================================================================
class Game_Character < Game_CharacterBase
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias diagonal_initialize initialize
def initialize
diagonal_initialize
if XAS_SYSTEM::EVENT_DIAGONAL_MOVEMENT
@diagonal = true
else
@diagonal = false
end
@diagonal_direction = 0
@sprite_angle_enable = false
@diagonal_time = 0
end
#--------------------------------------------------------------------------
# ● Reset Diagonal
#--------------------------------------------------------------------------
def reset_diagonal
return if @direction_fix
return if @diagonal == false
@diagonal_direction = 0
@diagonal_time = 0 @Angle = 0 if @sprite_angle_enable
end
#--------------------------------------------------------------------------
# ● Enable Diagonal
#--------------------------------------------------------------------------
def enable_diagonal(dir = 0)
return if @direction_fix
return if @diagonal == false
return if dir == 0
@diagonal_direction = dir
@diagonal_time = XAS_BA::DIAGONAL_DURATION @Angle = 315 if @sprite_angle_enable
end
#--------------------------------------------------------------------------
# ● Turn Upper Right
#--------------------------------------------------------------------------
def turn_upper_right
enable_diagonal(9)
@direction = 8 unless @direction_fix
end
#--------------------------------------------------------------------------
# ● Turn Upper Left
#--------------------------------------------------------------------------
def turn_upper_left
enable_diagonal(7)
@direction = 4 unless @direction_fix
end
#--------------------------------------------------------------------------
# ● Turn Lower Right
#--------------------------------------------------------------------------
def turn_lower_right
enable_diagonal(3)
@direction = 6 unless @direction_fix
end
#--------------------------------------------------------------------------
# ● Turn Lower Left
#--------------------------------------------------------------------------
def turn_lower_left
enable_diagonal(1)
@direction = 2 unless @direction_fix
end
#--------------------------------------------------------------------------
# ● Move forward
#--------------------------------------------------------------------------
alias diagonal_move_forward move_forward
def move_forward
return if move_forward_diagonal?
diagonal_move_forward
end
#--------------------------------------------------------------------------
# ● Move forward Diagonal?
#--------------------------------------------------------------------------
def move_forward_diagonal?
return false if @diagonal == false
if @diagonal_direction != 0
case @diagonal_direction
when 1 #Lower Left
move_diagonal(4, 2)
@direction = 2
when 3 #Lower Right
move_diagonal(6, 2)
@direction = 6
when 7 #Upper Left
move_diagonal(4, 8)
@direction = 4
when 9 #Upper Right
move_diagonal(6, 8)
@direction = 8
end
enable_diagonal(@diagonal_direction)
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Move Backward
#--------------------------------------------------------------------------
alias diagonal_move_backward move_backward
def move_backward
return if move_backward_diagonal?
diagonal_move_backward
end
#--------------------------------------------------------------------------
# ● Move Backward Diagonal?
#--------------------------------------------------------------------------
def move_backward_diagonal?
return false if @diagonal == false
if @diagonal_direction != 0
last_direction_fix = @direction_fix
@direction_fix = true
case @diagonal_direction
when 1
move_diagonal(6, 8)
@direction = 6
when 3
move_diagonal(4, 8)
@direction = 4
when 7
move_diagonal(6, 2)
@direction = 6
when 9
move_diagonal(4, 2)
@direction = 2
end
enable_diagonal(@diagonal_direction)
@direction_fix = last_direction_fix
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Turn Toward Player
#--------------------------------------------------------------------------
alias turn_toward_player_diagonal turn_toward_player
def turn_toward_player
if @diagonal
diagonal_turn_toward_player
return
end
turn_toward_player_diagonal
end
#--------------------------------------------------------------------------
# ● Diagonal Turn Toward Player
#--------------------------------------------------------------------------
def diagonal_turn_toward_player
sx = distance_x_from($game_player.x)
sy = distance_y_from($game_player.y)
sd = sx.abs - sy.abs
sdx = sd.abs - sx.abs
sdy = sd.abs - sy.abs
return if sx == 0 and sy == 0
#Turn Upper Right
if sx < 0 and sy > 0
if sx.abs > sy.abs and sdx.abs < sd.abs
set_direction(6)
elsif sx.abs < sy.abs and sdy.abs < sd.abs
set_direction(8)
else
turn_upper_right
end
enable_diagonal(9)
#Turn Upper Left
elsif sx > 0 and sy > 0
if sx.abs > sy.abs and sdx.abs < sd.abs
set_direction(4)
elsif sx.abs < sy.abs and sdy.abs < sd.abs
set_direction(8)
else
set_direction(4)
turn_upper_left
end
enable_diagonal(7)
#Turn Lower Left
elsif sx > 0 and sy < 0
if sx.abs > sy.abs and sdx.abs < sd.abs
set_direction(4)
elsif sx.abs < sy.abs and sdy.abs < sd.abs
set_direction(2)
else
turn_lower_left
end
enable_diagonal(1)
#Turn Lower Right
elsif sx < 0 and sy < 0
if sx.abs > sy.abs and sdx.abs < sd.abs
set_direction(6)
elsif sx.abs < sy.abs and sdy.abs < sd.abs
set_direction(2)
else
turn_lower_right
end
enable_diagonal(3)
elsif sx < 0
set_direction(6)
elsif sx > 0
set_direction(4)
elsif sy > 0
set_direction(8)
elsif sy < 0
set_direction(2)
end
end
#--------------------------------------------------------------------------
# ● Move toward Player
#--------------------------------------------------------------------------
alias move_toward_player_diagonal move_toward_player
def move_toward_player
if @diagonal
diagonal_move_toward_player
return
end
move_toward_player_diagonal
end
#--------------------------------------------------------------------------
# ● Diagonal Move Toward Player
#--------------------------------------------------------------------------
def diagonal_move_toward_player
sx = distance_x_from($game_player.x)
sy = distance_y_from($game_player.y)
if sx == 0 and sy == 0
return
end
abs_sx = sx.abs
abs_sy = sy.abs
if abs_sx == abs_sy
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
if abs_sx
if sx < 0 and sy > 0
move_diagonal(6, 8)
move_random unless moving?
enable_diagonal(9)
elsif sx > 0 and sy > 0
move_diagonal(4, 8)
move_random unless moving?
enable_diagonal(7)
elsif sx > 0 and sy < 0
move_diagonal(4, 2)
move_random unless moving?
enable_diagonal(1)
elsif sx < 0 and sy < 0
move_diagonal(6, 2)
move_random unless moving?
enable_diagonal(3)
elsif sx < 0
move_straight(6)
elsif sx > 0
move_straight(4)
elsif sy > 0
move_straight(8)
elsif sy < 0
move_straight(2)
end
if abs_sx != 1 and abs_sy != 1
move_random unless moving?
end
end
end
#--------------------------------------------------------------------------
# ● turn_right_45
#--------------------------------------------------------------------------
def turn_right_45
if @diagonal and @diagonal_direction != 0
case @diagonal_direction
when 1; set_direction(4)
when 3; set_direction(2)
when 7; set_direction(8)
when 9; set_direction(6)
end
else
case @direction
when 2; turn_lower_left
when 4; turn_upper_left
when 6; turn_lower_right
when 8; turn_upper_right
end
end
end
#--------------------------------------------------------------------------
# ● turn_left_45
#--------------------------------------------------------------------------
def turn_left_45
if @diagonal and @diagonal_direction != 0
case @diagonal_direction
when 1; set_direction(2)
when 3; set_direction(6)
when 7; set_direction(4)
when 9; set_direction(8)
end
else
case @direction
when 2; turn_lower_right
when 4; turn_lower_left
when 6; turn_upper_right
when 8; turn_upper_left
end
end
end
#--------------------------------------------------------------------------
# ● turn_right_90
#--------------------------------------------------------------------------
alias diagonal_turn_right_90 turn_right_90
def turn_right_90
if @diagonal and @diagonal_direction != 0
turn_diagonal_right_90
return
end
diagonal_turn_right_90
end
#--------------------------------------------------------------------------
# ● turn_diagonal_right_90
#--------------------------------------------------------------------------
def turn_diagonal_right_90
case @diagonal_direction
when 1; turn_upper_left
when 3; turn_lower_left
when 7; turn_upper_right
when 9; turn_lower_right
end
end
#--------------------------------------------------------------------------
# ● turn_left_90
#--------------------------------------------------------------------------
alias diagonal_turn_left_90 turn_left_90
def turn_left_90
if @diagonal and @diagonal_direction != 0
turn_diagonal_left_90
return
end
diagonal_turn_left_90
end
#--------------------------------------------------------------------------
# ● turn_diagonal_left_90
#--------------------------------------------------------------------------
def turn_diagonal_left_90
case @diagonal_direction
when 1; turn_lower_right
when 3; turn_upper_right
when 7; turn_lower_left
when 9; turn_upper_left
end
end
#--------------------------------------------------------------------------
# ● diagonal_turn_180
#--------------------------------------------------------------------------
alias diagonal_turn_180 turn_180
def turn_180
if @diagonal and @diagonal_direction != 0
turn_diagonal_180
return
end
diagonal_turn_180
end
#--------------------------------------------------------------------------
# ● turn_diagonal_180
#--------------------------------------------------------------------------
def turn_diagonal_180
case @diagonal_direction
when 1; turn_upper_right
when 3; turn_upper_left
when 7; turn_lower_right
when 9; turn_lower_left
end
end
#--------------------------------------------------------------------------
# ● turn_random
#--------------------------------------------------------------------------
alias diagonal_turn_random turn_random
def turn_random
if @diagonal
turn_diagonal_random
return
end
diagonal_turn_random
end
#--------------------------------------------------------------------------
# ● turn_diagonal_random
#--------------------------------------------------------------------------
def turn_diagonal_random
case rand(8)
when 0; set_direction(8)
when 1; set_direction(6)
when 2; set_direction(4)
when 3; set_direction(2)
when 4; turn_lower_left
when 5; turn_lower_right
when 6; turn_upper_left
when 7; turn_upper_right
end
end
end
#===============================================================================
# ■ Game_Player
#===============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● Move By Input
#--------------------------------------------------------------------------
alias diagonal_move_by_input move_by_input
def move_by_input
if XAS_SYSTEM::PLAYER_DIAGONAL_MOVEMENT
player_diagonal_move_by_input
# update_sprite_diagonal
update_return_direction
return
end
diagonal_move_by_input
end
#--------------------------------------------------------------------------
# ● Update Sprite Diagonal
#--------------------------------------------------------------------------
def update_sprite_diagonal
return if @diagonal_direction == 0
return if self.action != nil
return if @dash_active
make_pose("_Diagonal", 2)
end
#--------------------------------------------------------------------------
# ● Update Return Direction
#--------------------------------------------------------------------------
def update_return_direction
return if XAS_BA::DIAGONAL_DURATION_ENABLE == false
return if @diagonal_time == 0
return if moving? or @stop
@diagonal_time -= 1
@diagonal_direction = 0 if @diagonal_time == 0
end
#--------------------------------------------------------------------------
# ● Player Diagonal Move By Input
#--------------------------------------------------------------------------
def player_diagonal_move_by_input
return unless movable?
return if $game_map.interpreter.running?
case Input.dir8
when 1
move_diagonal(4, 2)
unless moving?
move_straight(4)
move_straight(2)
end
@diagonal_direction = 1
when 2; move_straight(2)
when 3
move_diagonal(6, 2)
unless moving?
move_straight(6)
move_straight(2)
end
@diagonal_direction = 3
when 4; move_straight(4)
when 6; move_straight(6)
when 7
move_diagonal(4, 8)
unless moving?
move_straight(4)
move_straight(8)
end
@diagonal_direction = 7
when 8; move_straight(8)
when 9
move_diagonal(6, 8)
unless moving?
move_straight(6)
move_straight(8)
end
@diagonal_direction = 9
end
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ MOVEMENT - FORCE ACTION
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#===============================================================================
# ■ Game Character
#===============================================================================
class Game_Character < Game_CharacterBase
#--------------------------------------------------------------------------
# ● Can Force Action?
#--------------------------------------------------------------------------
def can_force_action?
return false if @force_action_times == 0
return false if self.moving2?
return false if self.jumping?
return false if self.knockbacking?
return false if self.stop
return true
end
#--------------------------------------------------------------------------
# ● Update Force Action
#--------------------------------------------------------------------------
def update_force_action
@force_action_times -= 1
execute_force_action
execute_force_action_tool_effect if @tool_id > 0 and @tool_effect != ""
reset_auto_action if @force_action_times == 0
end
#--------------------------------------------------------------------------
# ● Execute Force Action
#--------------------------------------------------------------------------
def execute_force_action
case @force_action
when "Forward"
move_forward
when "Backward"
move_backward
when "Toward Player"
move_toward_player
when "Move Left"
move_straight(4)
when "Move Right"
move_straight(6)
when "Move Up"
move_straight(8)
when "Move Down"
move_straight(2)
when "All Shoot"
if self.action != nil
turn_right_45
self.shoot(self.action.id) unless @force_action_times == 0
end
when "Four Shoot"
if self.action != nil
turn_right_90
self.shoot(self.action.id) unless @force_action_times == 0
end
when "Three Shoot"
if self.action != nil
case @force_action_times
when 2
turn_right_45
when 1
turn_left_90
when 0
turn_right_45
end
self.shoot(self.action.id) unless @force_action_times == 0
end
when "Two Shoot"
if self.action != nil
turn_180
self.shoot(self.action.id) unless @force_action_times == 0
end
end
end
#--------------------------------------------------------------------------
# ● Execute Force Action Tool Effect
#--------------------------------------------------------------------------
def execute_force_action_tool_effect
action_effect_during_move
action_effect_after_move if @force_action_times == 0
end
#--------------------------------------------------------------------------
# ● Auto Action Effect During Move
#--------------------------------------------------------------------------
def reset_auto_action
@force_action = ""
@force_action_times = 0
@anime_count = 0
end
#--------------------------------------------------------------------------
# ● Action Effect During Move
#--------------------------------------------------------------------------
def action_effect_during_move
if @tool_effect == "Boomerang" and @force_action == "Toward Player"
if @x == $game_player.x and @y == $game_player.y
self.action.duration = 15
@force_action_times = 0
@force_action_type = ""
end
end
end
#--------------------------------------------------------------------------
# ● Action Effect After Move
#--------------------------------------------------------------------------
def action_effect_after_move
if @tool_effect == "Boomerang"
@force_action_times = 30
@force_action = "Toward Player"
@move_frequency = 6
@move_speed = 5.5
end
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ MOVEMENT - EXTRA MOVEMENT
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#===============================================================================
# ■ Game Character
#===============================================================================
class Game_Character < Game_CharacterBase
#--------------------------------------------------------------------------
# ● Turn Reverse
#--------------------------------------------------------------------------
def turn_reverse(dir)
case dir
when 2; set_direction(8)
when 4; set_direction(6)
when 6; set_direction(4)
when 8; set_direction(2)
end
end
#--------------------------------------------------------------------------
# ● Org Here
#--------------------------------------------------------------------------
def org_here
@orig_pos_x = @x
@orig_pos_y = @y
end
#--------------------------------------------------------------------------
# ● return_org
#--------------------------------------------------------------------------
def return_org(type = 0)
if type == 1
moveto(@orig_pos_x,@orig_pos_x)
else
jump(0,0)
end
@x = @orig_pos_x
@y = @orig_pos_y
end
#--------------------------------------------------------------------------
# ● Dual Switch
#--------------------------------------------------------------------------
def dual_switch(switch_on, switch_off,percentage = 100)
enable_per = rand(100)
if enable_per <= percentage
$game_switches[switch_on] = true
$game_switches[switch_off] = false
$game_map.need_refresh = true
end
end
#--------------------------------------------------------------------------
# ● Move Forward 2
#--------------------------------------------------------------------------
def move_forward2
return if moving2?
move_forward
end
#--------------------------------------------------------------------------
# ● Bounce Direction
#--------------------------------------------------------------------------
def bounce_direction
@diagonal = true
turn_random
end
#--------------------------------------------------------------------------
# ● Turn_back
#--------------------------------------------------------------------------
def turn_back
if @diagonal_direction != 0
case @diagonal_direction
when 1
turn_upper_right
when 3
turn_upper_left
when 7
turn_lower_right
when 9
turn_lower_left
end
else
case @direction
when 2; set_direction(8)
when 4; @direction = 6#move_straight(6)#set_direction(6)
when 6; set_direction(4)
when 8; set_direction(2)
end
end
end
#--------------------------------------------------------------------------
# ● Passable Temp
#--------------------------------------------------------------------------
def passable_temp_id?(x, y)
return false unless $game_map.valid?(x, y)
return true if @through or debug_through?
return false unless map_passable?(x, y,@direction)
return false if collide_with_characters_temp_id?(x, y)
return true
end
#--------------------------------------------------------------------------
# ● Collide With Characters
#--------------------------------------------------------------------------
def collide_with_characters_temp_id?(x, y)
for event in $game_map.events_xy(x, y)
unless event.through or event.battler != nil
return true if self.is_a?(Game_Event)
return true if event.priority_type >= 1
end
end
return false
end
#--------------------------------------------------------------------------
# ● Force Move Route
#--------------------------------------------------------------------------
alias x_force_move_route force_move_route
def force_move_route(move_route)
if self.battler != nil and self.is_a?(Game_Event)
return
end
x_force_move_route(move_route)
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ MOVEMENT - PLAYER COMMANDS
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
include XAS_BUTTON
#--------------------------------------------------------------------------
# ● Can Use Command?
#--------------------------------------------------------------------------
def can_use_command?
return false if $game_map.interpreter.running?
return false if $game_message.visible
return false if self.battler == nil
return false if self.action != nil
return false if self.knockbacking?
return false if @stop
return true
end
#--------------------------------------------------------------------------
# ● Can Check Battler Equipment
#--------------------------------------------------------------------------
def can_check_battler_equipment?
if self.battler.old_equipment_id[0] != self.battler.equips[0] or
self.battler.old_equipment_id[1] != self.battler.equips[1] or
self.battler.old_equipment_id[2] != self.battler.equips[2] or
self.battler.old_equipment_id[3] != self.battler.equips[3] or
self.battler.old_equipment_id[4] != self.battler.equips[4]
self.battler.old_equipment_id[0] = self.battler.equips[0]
self.battler.old_equipment_id[1] = self.battler.equips[1]
self.battler.old_equipment_id[2] = self.battler.equips[2]
self.battler.old_equipment_id[3] = self.battler.equips[3]
self.battler.old_equipment_id[4] = self.battler.equips[4]
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Update Charge Button
#--------------------------------------------------------------------------
def update_charge_button
return unless can_charge_command?
if Input.press?(ACTION_1_BUTTON) and ENABLE_ACTION_1_BUTTON
update_charge_effect(0)
reset_charge_temp if Input.press?(ACTION_2_BUTTON) and ENABLE_ACTION_2_BUTTON
elsif Input.press?(ACTION_2_BUTTON)
update_charge_effect(1)
reset_charge_temp if Input.press?(ACTION_1_BUTTON)
else
if self.battler.x_charge_action[2] >= self.battler.x_charge_action[1]
self.shoot(self.battler.x_charge_action[0])
end
reset_charge_temp
end
end
#--------------------------------------------------------------------------
# ● Update Charge Effect
#--------------------------------------------------------------------------
def update_charge_effect(type)
if self.battler.x_charge_action[2] == 0
return unless equipped_charge_action?(type)
end
if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
self.battler.x_charge_action[2] += 1
end
self.battler.x_charge_action[3] += 1
if self.battler.x_charge_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
self.battler.x_charge_action[3] = 0
if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION1_ID
else
self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION2_ID
end
end
end
#--------------------------------------------------------------------------
# ● Equipped Charge Action
#--------------------------------------------------------------------------
def equipped_charge_action?(type)
case type
when 0
weapon = self.battler.equips[0]
when 1
weapon = self.battler.equips[1]
end
if weapon == nil
return false
reset_charge_temp
end
if weapon.note =~ /<Charge Action = (\d+) - (\d+)>/
self.battler.x_charge_action[0] = $1.to_i rescue 0#Skill ID
self.battler.x_charge_action[1] = $2.to_i rescue 0#Max Time
self.battler.x_charge_action[2] = 0#Current Time
self.battler.x_charge_action[3] = 0#Loop Anime Time
return true
end
return false
reset_charge_temp
end
#--------------------------------------------------------------------------
# ● Update Combo Time
#--------------------------------------------------------------------------
def update_combo_time
return if self.battler.x_combo[2] == 0
self.battler.x_combo[2] -= 1
if self.battler.x_combo[2] == 0
self.battler.x_combo[0] = 0
self.battler.x_combo[1] = -1
end
end
#--------------------------------------------------------------------------
# ● Can Use Weapon Command?
#--------------------------------------------------------------------------
def can_use_weapon_command?
return false if $game_system.command_enable == false
return false unless ENABLE_ACTION_1_BUTTON
return false if self.battler.shield
return false if self.battler.cast_action[4] > 0
return false if self.battler.x_charge_action[2] > 0
return true
end
#--------------------------------------------------------------------------
# ● Can Use Shield Command?
#--------------------------------------------------------------------------
def can_use_shield_command?
return false if $game_system.command_enable == false
return false unless ENABLE_ACTION_2_BUTTON
return false if self.battler.equips[1] == nil
return false if self.battler.equips[1].id == 0
return false if self.battler.cast_action[4] > 0
return false if self.battler.x_charge_action[2] > 0
return true
end
#--------------------------------------------------------------------------
# ● Can Use Skill Command?
#--------------------------------------------------------------------------
def can_use_skill_command?
return false if $game_system.command_enable == false
return false unless ENABLE_SKILL_BUTTON
return false if self.battler.shield
return false if self.battler.cast_action[4] > 0
return false if self.battler.x_charge_action[2] > 0
return true
end
#--------------------------------------------------------------------------
# ● Can Use Item Command?
#--------------------------------------------------------------------------
def can_use_item_command?
return false if $game_system.command_enable == false
return false unless ENABLE_ITEM_BUTTON
return false if self.battler.shield
return false if self.battler.cast_action[4] > 0
return false if self.battler.x_charge_action[2] > 0
return true
end
#--------------------------------------------------------------------------
# ● Can Charge Command
#--------------------------------------------------------------------------
def can_charge_command?
return false if $game_system.command_enable == false
return false if self.battler.cast_action[4] > 0
return false if self.battler.shield
return true
end
#--------------------------------------------------------------------------
# ● Can Use Change Leader Command?
#--------------------------------------------------------------------------
def can_use_change_leader_command?
return false unless ENABLE_CHANGE_LEADER_BUTTON
return false if self.battler.shield
return false if self.battler.cast_action[4] > 0
return false if self.battler.x_charge_action[2] > 0
return false if $game_temp.change_leader_wait_time > 0
return true
end
#--------------------------------------------------------------------------
# ● State_Seal Command
#--------------------------------------------------------------------------
def state_seal_command?(type)
seal = false
case type
when 0
seal = true if self.battler.state_mute
seal = true if self.battler.state_seal_attack
when 1
seal = true if self.battler.state_mute
seal = true if self.battler.state_seal_attack
when 2
seal = true if self.battler.state_mute
seal = true if self.battler.state_seal_skill
when 3
seal = true if self.battler.state_mute
seal = true if self.battler.state_seal_item
end
if seal
seal_effect
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Check Equipped Action
#--------------------------------------------------------------------------
def check_equipped_action(command_type)
case command_type
when 0 # Weapon 1
weapon = self.battler.equips[0]
if weapon == nil
self.battler.x_action1_id = 0
return
end
weapon.note =~ /<Action ID = (\d+)>/
action_id = $1.to_i
action_id = 0 if action_id == nil
self.battler.x_action1_id = action_id
when 1 # Weapon 2
weapon = self.battler.equips[1]
if weapon == nil
self.battler.x_action2_id = 0
return
end
weapon.note =~ /<Action ID = (\d+)>/
action_id = $1.to_i
action_id = 0 if action_id == nil
self.battler.x_action2_id = action_id
when 2 # Skill
when 3 # Item
item_id = $data_items[self.battler.item_id]
if item_id == nil
self.battler.x_item_id = 0
return
end
item_id.note =~ /<Action ID = (\d+)>/
action_id = $1.to_i
action_id = 0 if action_id == nil
self.battler.x_item_id = action_id
end
end
#--------------------------------------------------------------------------
# ● Execute Combo
#--------------------------------------------------------------------------
def execute_combo?(type)
if type == self.battler.x_combo[1] and self.battler.x_combo[0] != 0
return if state_seal_command?(type)
self.shoot(self.battler.x_combo[0])
self.battler.x_combo[1] = type
return true
end
self.battler.x_combo[0] = 0
self.battler.x_combo[1] = type
self.battler.x_combo[2] = 0
return false
end
#--------------------------------------------------------------------------
# ● Update Change Leader Button
#--------------------------------------------------------------------------
def update_change_leader_button
if Input.trigger?(CHANGE_LEADER_BUTTON)
return unless can_use_change_leader_command?
change_leader
end
end
#--------------------------------------------------------------------------
# ● Update Action 1 Button
#--------------------------------------------------------------------------
def update_action_1_button
if Input.trigger?(ACTION_1_BUTTON)
type = 0
return unless can_use_weapon_command?
return if execute_combo?(type)
check_equipped_action(type)
action_id = self.battler.x_action1_id
return if action_id == 0
return if state_seal_command?(type)
self.shoot(action_id)
end
end
#--------------------------------------------------------------------------
# ● Update Action 2 Button
#--------------------------------------------------------------------------
def update_action_2_button
if Input.trigger?(ACTION_2_BUTTON)
if self.battler.equips[1].is_a?(RPG::Weapon)
type = 1
return unless can_use_weapon_command?
return if execute_combo?(type)
check_equipped_action(type)
action_id = self.battler.x_action2_id
return if action_id == 0
return if state_seal_command?(type)
self.shoot(action_id)
return
end
end
update_shield_button
end
#--------------------------------------------------------------------------
# ● Update Shield Button
#--------------------------------------------------------------------------
def update_shield_button
if Input.press?(ACTION_2_BUTTON)
if can_use_shield_command?
unless self.battler.shield
shield = self.battler.equips[1]
if shield.note =~ /<Action>/
if shield.note =~ /<Pose = (\w+)>/
make_pose($1.to_s, 2)
end
else
self.battler.shield = false
return
end
end
self.x_pose_duration = 2
self.battler.shield = true
update_shield_diretion_button
else
self.battler.shield = false
end
else
self.battler.shield = false
end
end
#--------------------------------------------------------------------------
# ● update_shield_direction_button
#--------------------------------------------------------------------------
def update_shield_diretion_button
return if @direction_fix
case Input.dir4
when 2; set_direction(2)
when 4; set_direction(4)
when 6; set_direction(6)
when 8; set_direction(8)
end
end
#--------------------------------------------------------------------------
# ● Update Skill Button
#--------------------------------------------------------------------------
def update_skill_button
if Input.trigger?(SKILL_BUTTON)
type = 2
return unless can_use_skill_command?
return if execute_combo?(type)
check_equipped_action(type)
action_id = self.battler.skill_id
return if action_id == 0
return if state_seal_command?(type)
self.shoot(action_id)
end
end
#--------------------------------------------------------------------------
# ● Update Item Button
#--------------------------------------------------------------------------
def update_item_button
if Input.trigger?(ITEM_BUTTON)
type = 3
return unless can_use_item_command?
return if execute_combo?(type)
check_equipped_action(type)
action_id = self.battler.x_item_id
return if action_id == 0
return if state_seal_command?(type)
self.shoot(action_id)
end
end
#--------------------------------------------------------------------------
# ● Update Auto Target Shoot
#--------------------------------------------------------------------------
def update_auto_target_shoot
return if $game_temp.xas_target_time == 0
return if $game_temp.xas_target_shoot_id == 0
return if $game_temp.xas_target_x == 0 and $game_temp.xas_target_y == 0
$game_temp.xas_target_time -= 1
if $game_temp.xas_target_time == 0
self.shoot($game_temp.xas_target_shoot_id)
$game_temp.xas_target_shoot_id = 0
end
end
#--------------------------------------------------------------------------
# ● Dash?
#--------------------------------------------------------------------------
alias x_dash dash?
def dash?
return false if XAS_SYSTEM::DASH_SYSTEM
x_dash
end
#--------------------------------------------------------------------------
# ● Can Dash?
#--------------------------------------------------------------------------
def can_dash?
return false unless XAS_BUTTON::ENABLE_DASH_BUTTON
return false if self.battler.shield
return true if Input.press?(XAS_BUTTON::DASH_BUTTON)
@dash_active = false
return false
end
#--------------------------------------------------------------------------
# ● clear_tokens
#--------------------------------------------------------------------------
def clear_tokens
$game_system.tools_on_map.clear
$game_system.tools_on_map = []
for event in @events.values.dup
remove_token(event) if event.is_a?(Token_Event)
end
channels = ["A", "B", "C", "D"]
for id in 1001..(token_id_shift - 1)
for a in channels
key = [self.map_id, id, a]
$game_self_switches.delete(key)
end
end
clear_token_id
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias x_temp_tool_hash_update update
def update(main = false)
x_temp_tool_hash_update(main)
update_add_tool_hash
end
#--------------------------------------------------------------------------
# ● Update Add Toll Hash
#--------------------------------------------------------------------------
def update_add_tool_hash
return if $game_temp.tool_event == nil
for i in $game_temp.tool_event
$game_map.events[i.id] = i
execute_tool_effects_hash(i)
end
$game_temp.tool_event.clear
$game_temp.tool_event = nil
end
#===============================================================================
# ■ Game_SelfSwitches
#===============================================================================
class Game_SelfSwitches
def delete(key)
@data.delete(key)
end
end
#===============================================================================
# ■ Game_Map
#===============================================================================
class Game_Map
attr_accessor :token_id
#--------------------------------------------------------------------------
# ● token_id_shift
#--------------------------------------------------------------------------
def token_id_shift
@token_id = 1000 if @token_id == nil
@token_id += 1
return @token_id
end
#--------------------------------------------------------------------------
# ● clear_token_id
#--------------------------------------------------------------------------
def clear_token_id
@token_id = nil
end
end
#--------------------------------------------------------------------------
# ● refresh_token
#--------------------------------------------------------------------------
def refresh_token
for event in $game_map.need_add_tokens
@character_sprites.push(Sprite_Character.new(@viewport1, event))
end
$game_map.need_add_tokens.clear
for sprite in @character_sprites.dup
if $game_map.need_remove_tokens.empty?
break
end
if $game_map.need_remove_tokens.delete(sprite.character)
@character_sprites.delete(sprite)
sprite.dispose
end
end
$game_map.need_refresh_token = false
end
end
#===============================================================================
# ■ Spriteset_Map
#===============================================================================
class Spriteset_Map
include XRXS_CTS_RefreshToken
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_smap_initialize initialize
def initialize
setup_start
x_smap_initialize
end
#--------------------------------------------------------------------------
# ● Setup Start
#--------------------------------------------------------------------------
def setup_start
$game_player.reset_old_level(true)
end
end
#===============================================================================
# ■ Game_Player
#===============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● x_reserve_transfer
#--------------------------------------------------------------------------
alias x_reserve_transfer reserve_transfer
def reserve_transfer(map_id, x, y, direction)
$game_map.clear_tokens
if $game_temp.tool_event != nil
$game_temp.tool_event.clear
$game_temp.tool_event = nil
end
x_reserve_transfer(map_id, x, y, direction)
end
end
#===============================================================================
# ■ Token_Event
#===============================================================================
class Token_Event < Game_Event
#--------------------------------------------------------------------------
# ● Token_Event
#--------------------------------------------------------------------------
def initialize(map_id, event)
event.id = $game_map.token_id_shift
super
end
#--------------------------------------------------------------------------
# ● erase
#--------------------------------------------------------------------------
def erase
super
$game_map.remove_token(self)
end
end
#===============================================================================
# ■ Token_Event
#===============================================================================
class Token_Event < Game_Event
include XRXS_ActionTemplate
end
#===============================================================================
# ■ Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :active_token
end
#--------------------------------------------------------------------------
# ● Can Shoot
#--------------------------------------------------------------------------
def can_shoot?(skill)
if self.battler == nil and self.tool_id > 0
@battler = self.action.user.battler
end
return false if self.battler == nil
return false if skill == nil
return true if ignore_can_shoot?(skill)
enough_cost = true
return false if tools_on_map?(skill.id)
if self.battler.state_mute
seal_effect
return false
end
if self.battler.cast_action[4].between?(1,self.battler.cast_action[1] -1)
return false
end
return false if check_cast_action?(skill)
return false if check_auto_target_select?(skill)
unless enough_skill_cost?(skill)
Audio.se_play("Audio/SE/" + XAS_SOUND::ACTION_COST , 100, 100)
return false
end
return true
end
#--------------------------------------------------------------------------
# ● Ignore Can Shoot?
#--------------------------------------------------------------------------
def ignore_can_shoot?(skill)
return false
end
#--------------------------------------------------------------------------
# ● Tools on Map
#--------------------------------------------------------------------------
def tools_on_map?(skill_id)
return true if $game_system.tools_on_map.include?(skill_id)
return false
end
#--------------------------------------------------------------------------
# ● Check Cast Action
#--------------------------------------------------------------------------
def check_cast_action?(skill)
if self.battler.cast_action[0] != 0
self.battler.cast_action[0] = 0
self.battler.cast_action[1] = 0
self.battler.cast_action[2] = 0
self.battler.cast_action[3] = 0
self.battler.cast_action[4] = 0
return false
end
if skill.note =~ /<Cast Time = (\d+)>/ and
$game_temp.xas_target_shoot_id == 0 and
self.force_action_times == 0
self.battler.cast_action[0] = skill.id
self.battler.cast_action[1] = $1.to_i rescue 0
self.battler.cast_action[2] = XAS_ANIMATION::CAST_TIME_ANIMATION_ID
self.battler.cast_action[3] = 0
self.battler.cast_action[4] = 0
self.animation_id = self.battler.cast_action[2]
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Check Auto Target Select
#--------------------------------------------------------------------------
def check_auto_target_select?(skill)
return false if self.is_a?(Game_Event)
if skill.note =~ /<Auto Target>/
if $game_temp.xas_target_shoot_id == 0
$game_temp.xas_target_shoot_id = skill.id
$game_map.check_events_on_screen
SceneManager.call(Scene_Target_Select)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● attachment
#--------------------------------------------------------------------------
def attachment(action_id)
@attack_id_plan = [action_id]
if @skill.note =~ /<Sunflag = (\d+)>/
@sunflag = $1.to_i
end
if @skill.note =~ /<Duration = (\d+)>/
@duration = $1.to_i
end
if @skill.note =~ /<Pose = (\S+)>/
@self_motion = $1.to_s
end
if @skill.note =~ /<Area = (\w+)>/
case $1
when "CROSS"
area = 7
when "WALL"
area = 6
when "FRONTRHOMBUS"
area = 5
when "FRONTSQUARE"
area = 4
when "LINE"
area = 3
when "SQUARE"
area = 2
else
area = 1
end
@attack_range_type = area
end
if @skill.note =~ /<Range = (\d+)>/
@attack_range_plan = [$1.to_i]
end
if @skill.note =~ /<Blow Power = (\d+)>/
@blow_power = $1.to_i
end
if @skill.note =~ /<Impact Time = (\d+)>/
@first_impact_time = $1.to_i
end
if @skill.note =~ /<Animation Time = (\d+) - (\d+)>/
@animation_time[0] = $1.to_i
@animation_time[1] = $2.to_i
end
if @skill.note =~ /<Target Invunerable = (\d+)>/
@target_invunerable_duration = $1.to_i
end
if @skill.note =~ /<Tool Hit Ani = (\d+)>/
@second_animation_id = $1.to_i
end
if @skill.note =~ /<User Hit Ani = (\d+)>/
@third_animation_id = $1.to_i
end
if @skill.note =~ /<Item Cost = (\d+)>/
@item_cost = $1.to_i
end
if @skill.note =~ /<Link Action ID = (\d+)>/
if user.battler != nil
user.battler.x_combo[0] = $1.to_i
user.battler.x_combo[2] = @sunflag + 20
end
else
if user.battler != nil
user.battler.x_combo[0] = 0
user.battler.x_combo[1] = 0
user.battler.x_combo[2] = 0
end
end
if @skill.note =~ /<Hit Action ID = (\d+)>/
@hit_action = $1.to_i
end
if @skill.note =~ /<Ignore Knockback>/
@ignore_knockback_invincible = true
end
if @skill.note =~ /<Multi Hit>/
@multi_hit = true
end
if @skill.note =~ /<Piercing>/
@piercing = true
end
if @skill.note =~ /<All Damage>/
@all_damage = true
end
if @skill.note =~ /<Ally Damage>/
@ally_damage = true
end
if @skill.note =~ /<User Invincible>/
@user_invincible = true
end
if @skill.note =~ /<Ignore Guard>/
@ignore_guard = true
end
if @skill.note =~ /<One Action>/
unless $game_system.tools_on_map.include?(action_id)
$game_system.tools_on_map.push(action_id)
end
end
if @skill.note =~ /<Shake>/
@hit_shake = true
end
if @skill.note =~ /<User Range>/
@short_range = true
end
if @skill.note =~ /<Hit Hold Target>/
@hit_hold_target = true
end
if @skill.note =~ /<Hit Sticky Target>/
@sticky = true
end
if @skill.note =~ /<Hit Bounce Direction>/
@hit_bounce = true
end
if @skill.note =~ /<Reflectable>/
@reflectable = true
end
if @skill.note =~ /<Can Reflect>/
@can_reflect = true
end
if @skill.note =~ /<Disable Hit>/
@impact = false
end
@sunflag = 1 if @sunflag <= 0
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update
@first_impact_time -= 1 if @first_impact_time > 0
if @attack_id_plan != nil
id = @attack_id_plan[@now_count]
unless id.nil?
@attack_id = id
@hit_events.clear
@hit_events.push(self.user) unless @all_damage or @ally_damage
end
end
if @attack_range_plan != nil
range = @attack_range_plan[@now_count]
@attack_range = range unless range.nil?
end
@now_count += 1
end
#--------------------------------------------------------------------------
# ● done?
#--------------------------------------------------------------------------
def done?
return (self.duration.to_i > 0 and self.now_count >= self.duration)
end
end
#===============================================================================
# ■ Token_Bullet
#===============================================================================
class Token_Bullet < Token_Event
include XRXS_ActionTemplate
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize(user, action_id)
event_id = action_id
skill = $data_skills[action_id]
if skill.note =~ /<Event ID = (\d+)>/
event_id = $1.to_i
end
original_event = @@events[event_id]
if original_event == nil
msgbox("There's no Event ID " + event_id.to_s + " on Tool Map!")
SceneManager.exit
return
end
event = original_event.dup
event.x = user.x
event.y = user.y
pre_direction = event.pages[0].graphic.direction
event.pages[0].graphic.direction = user.direction
@character_name = event.pages[0].graphic
super($game_map.map_id, event)
self.action_attachment(action_id)
self.tool_id = action_id
self.diagonal = false
self.diagonal_direction = 0
self.sprite_angle_enable = false
@action.user = user
@remain_for_an_act = @action.duration.is_a?(Numeric)
check_tool_effects(user,skill,pre_direction)
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update
super
if @action == nil and @remain_for_an_act
erase
$game_system.tools_on_map.delete(self.tool_id)
end
check_event_trigger_attack
end
end
#===============================================================================
# ■ Game Player
#===============================================================================
class Game_Player < Game_Character
attr_accessor :need_refresh
end
#===============================================================================
# ■ Token_Bullet
#===============================================================================
class Token_Bullet < Token_Event
#--------------------------------------------------------------------------
# ● Check Tool Effects
#--------------------------------------------------------------------------
def check_tool_effects(user,skill,pre_direction)
if @action.ally_damage or @action.all_damage
user.battler.invunerable_duration = 0
end
# Force Update Out Screen
if user.battler.sensor_range >= 15 or
skill.note =~ /<Update Out Screen>/
self.force_update = true
end
#Diagonal Effect
if skill.note =~ /<Diagonal>/ or
skill.note =~ /<All Direction>/ or
skill.note =~ /<Three Direction>/
self.diagonal = true
self.diagonal_direction = user.diagonal_direction
self.sprite_angle_enable = true
user.diagonal_time = XAS_BA::DIAGONAL_DURATION if user.diagonal_direction != 0
user.diagonal = true if user.tool_id > 0
end
#Auto Target
if skill.note =~ /<Auto Target>/
if user.is_a?(Game_Event)
self.moveto($game_player.x, $game_player.y)
else
moveto($game_temp.xas_target_x, $game_temp.xas_target_y)
$game_temp.xas_target_x = 0
$game_temp.xas_target_y = 0
$game_temp.xas_target_time = 0
$game_temp.xas_target_shoot_id = 0
end
end
#Barrier
if skill.note =~ /<Barrier>/
self.tool_effect = "Barrier"
end
#Boomerang
if skill.note =~ /<Boomerang = (\d+)>/
self.tool_effect = "Boomerang"
self.action.duration = 1000
self.diagonal = true
self.diagonal_direction = user.diagonal_direction
self.force_update = true
@move_frequency = 6
@move_speed = 5
@direction_fix = false
@walk_anime = true
@step_anime = true
@force_action = "Forward"
@force_action_times = $1.to_i
end
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ TOOL - AREA
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#===============================================================================
# ■ XAS ACTION
#===============================================================================
module XAS_ACTION
#--------------------------------------------------------------------------
# ● action_update
#--------------------------------------------------------------------------
def action_update
return unless @action.is_a?(Game_Action_XAS)
if @action.animation_time != [] and
@action.animation_time[0] == @action.now_count
animation_id = @action.animation_time[1]
unless self.is_a?(Game_Player) or self.tool_id == 0
self.animation_id = animation_id
end
end
@action.update
end
#--------------------------------------------------------------------------
# ● Can Impact Target
#--------------------------------------------------------------------------
def can_impact_target?
return false if @action.nil?
return false if @action.attack_id == 0
return false if @action.first_impact_time > 0
return false if @action.impact == false
return false if self.jumping?
return true
end
#--------------------------------------------------------------------------
# ● check_event_trigger_attack
#--------------------------------------------------------------------------
def check_event_trigger_attack()
return unless can_impact_target?
hit_check = false
range = @action.attack_range
hit = []
targets = [$game_player] + $game_map.events.values
for event in targets
next if event == self or
@action.hit_events.include?(event) or event.erased
body_size = event.body_size
event_center_x = event.x
event_center_y = event.y - body_size
if @action.short_range
dx = event_center_x - $game_player.x
dy = event_center_y - $game_player.y
else
dx = event_center_x - self.x
dy = event_center_y - self.y
end
dx = (dx >= 0 ? [dx - body_size, 0].max : [dx + body_size, 0].min)
dy = (dy >= 0 ? [dy - body_size, 0].max : [dy + body_size, 0].min)
hit_check = true if in_range?(dx,dy,event,range)
hit.push(event) if hit_check
hit_check = false
end
for event in hit
if event.action_effect(self, self.action.attack_id)
hit_check = true
end
if event.action_effect_page(self, self.action.attack_id)
hit_check = true
end
@action.hit_events.push(event) unless @action.multi_hit
end
if hit_check
$game_temp.active_token = self
end
end
#--------------------------------------------------------------------------
# ● In Range?
#--------------------------------------------------------------------------
def in_range?(dx,dy,event,range)
case @action.attack_range_type
when 1 #RHOMBUS
return true if (dx.abs + dy.abs <= range)
when 2 #SQUARE
return true if (dx.abs <= range and dy.abs <= range)
when 3 #LINE
case self.direction
when 2
return true if (dx == 0 and dy >= 0 and dy <= range)
when 8
return true if (dx == 0 and dy <= 0 and dy >= -range)
when 6
return true if (dy == 0 and dx >= 0 and dx <= range)
when 4
return true if (dy == 0 and dx <= 0 and dx >= -range)
end
when 4 #FRONT SQUARE
case self.direction
when 2
return true if (dx.abs <= range and dy >= 0 and dy.abs <= range)
when 4
return true if (dx.abs <= range and dx <= 0 and dy.abs <= range)
when 6
return true if (dx.abs <= range and dx >= 0 and dy.abs <= range)
when 8
return true if (dx.abs <= range and dy <= 0 and dy.abs <= range)
end
when 5 #FRONT RHOMBUS
case self.direction
when 2
return true if (dx.abs + dy.abs <= range and dy >= 0)
when 8
return true if (dx.abs + dy.abs <= range and dy <= 0)
when 6
return true if (dx.abs + dy.abs <= range and dx >= 0)
when 4
return true if (dx.abs + dy.abs <= range and dx <= 0)
end
when 6 #WALL
case self.direction
when 2
return true if (dx.abs <= range and dy == 0 )
when 4
return true if (dy.abs <= range and dx == 0)
when 6
return true if (dy.abs <= range and dx == 0)
when 8
return true if (dx.abs <= range and dy == 0)
end
when 7 #CROSS
return true if (dx.abs <= range and dy == 0)
return true if (dy.abs <= range and dx == 0)
end
return false
end
#--------------------------------------------------------------------------
# ● action_effect Page
#--------------------------------------------------------------------------
def action_effect_page(attacker, attack_id)
return false unless self.is_a?(Game_Event)
return false if attacker.action.fake_id
if attacker.action != nil
check_auto_effect_page(attacker, attack_id)
check_reflectable_skills(attacker, attack_id)
end
for page in @event.pages
if page.condition.variable_valid and
page.condition.variable_id == XAS_SYSTEM::HIT_ID and
page.condition.variable_value == attack_id
self.reaction_valid_attack_id = attack_id
self.refresh
@trigger = 0
self.start
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● Check Auto Effect Page
#--------------------------------------------------------------------------
def check_auto_effect_page(attacker, attack_id)
if self.treasure_time > 0
if can_hit_take_treasure?(attacker, attack_id)
execute_take_treasure(attacker, attack_id)
elsif self.temp_id == 0 and can_hold_treasure?(attacker, attack_id)
execute_hold_treasure(attacker, attack_id)
end
end
end
#--------------------------------------------------------------------------
# ● Can Hit Take Treasure
#--------------------------------------------------------------------------
def can_hit_take_treasure?(attacker, attack_id)
return true if attacker.action.short_range
return false
end
#--------------------------------------------------------------------------
# ● Can Hold Treasure?
#--------------------------------------------------------------------------
def can_hold_treasure?(attacker, attack_id)
return true if attacker.tool_effect == "Boomerang"
return false
end
#--------------------------------------------------------------------------
# ● Execute Hold Treasure
#--------------------------------------------------------------------------
def execute_hold_treasure(attacker, attack_id)
tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
return if self.treasure_time > tr_time
self.temp_id = attacker.id
end
#--------------------------------------------------------------------------
# ● body_size
#--------------------------------------------------------------------------
def body_size
return 0
end
#--------------------------------------------------------------------------
# ● action_clear
#--------------------------------------------------------------------------
def action_clear
@action = nil
@step_anime = false
end
end
#===============================================================================
# ■ Game_Character
#===============================================================================
class Game_Character < Game_CharacterBase
include XAS_ACTION
end
#===============================================================================
# ■ Game_Event
#===============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
alias x_conditions_met conditions_met?
def conditions_met?(page)
c = page.condition
if c.variable_valid
if c.variable_id == XAS_SYSTEM::HIT_ID and
c.variable_value == self.reaction_valid_attack_id
return true
end
end
x_conditions_met(page)
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update
action_update
super
if @action.is_a?(Game_Action_XAS) and @action.done?
self.action_clear
end
end
end
#===============================================================================
# ■ Game_Player
#===============================================================================
class Game_Player < Game_Character
include XAS_Dispose
end
#===============================================================================
# ■ Game_Event
#===============================================================================
class Game_Event < Game_Character
include XAS_Dispose
end
#--------------------------------------------------------------------------
# ● acting?
#--------------------------------------------------------------------------
def acting?
return false if self.battler == nil
return true if self.battler.shield
return true if self.action != nil
return false
end
#--------------------------------------------------------------------------
# ● moving?
#--------------------------------------------------------------------------
def moving?
return (super or self.acting? or self.stop)
end
end
#===============================================================================
# ■ Game_Player
#===============================================================================
class Game_Player < Game_Character
include XAS_StopToAction
end
#===============================================================================
# ■ Game_Event
#===============================================================================
class Game_Event < Game_Character
attr_accessor :reaction_valid_attack_id
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ TOOL - HIT EFFECT
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#--------------------------------------------------------------------------
# ● Can Hit Base?
#--------------------------------------------------------------------------
def can_hit_base?(bullet, action_id)
return false unless $game_system.xas_battle
return false if self.battler == nil
return false if bullet == nil
return false if action_id == nil or action_id <= 0
return false if self.can_update == false
return true
end
#--------------------------------------------------------------------------
# ● Action Effect
#--------------------------------------------------------------------------
def action_effect(bullet, action_id)
return unless can_hit_base?(bullet, action_id)
skill = $data_skills[action_id]
user = bullet.action.user
attacker = (user == nil ? nil : user.battler)
tar_invu = bullet.action.target_invunerable_duration
#CAN HIT?
return unless action_can_hit_target?(bullet, user, skill,tar_invu)
#REFLECT STATE
return if reflect_state?(bullet, skill)
#SHIELD
if target_shield_enabled?(attacker, skill, bullet)
execute_guard_effect(user, skill, bullet, tar_invu)
return
end
#INVUNERABLE ACTIONS
if target_invunerable_actions?(user, skill, bullet)
execute_guard_effect(user, skill, bullet, tar_invu, false)
return
end
#GUARD DIRECTIONS
if target_guard_directions?(user, skill, bullet)
execute_guard_effect(user, skill, bullet, tar_invu)
return
end
execute_hit_effect(attacker,skill, bullet , user, tar_invu )
if self.is_a?(Game_Player)
self.need_refresh = true
end
end
#--------------------------------------------------------------------------
# ● Reflect State?
#--------------------------------------------------------------------------
def reflect_state?(bullet, skill)
if bullet.action.reflectable and self.battler.state_reflect
if skill.note =~ /<Auto Target>/
bullet.moveto(bullet.action.user.x,bullet.action.user.y)
else
bullet.turn_back
end
bullet.action.user = self
bullet.action.hit_events = []
bullet.turn_back
# bullet.jump(0,0)
bullet.turn_back
self.battler.damage = XAS_WORD::REFLECT
self.battler.damage_pop = true
self.animation_id = XAS_ANIMATION::REFLECT_ANIMATION_ID
self.battler.invunerable_duration = 20
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Target Guard Directions?
#--------------------------------------------------------------------------
def target_guard_directions?(user, skill, bullet)
return false if self.battler.guard == false
return false if bullet.action.ignore_guard
if self.battler.guard_directions.include?(2) and
((self.direction == 2 and bullet.direction == 8) or
(self.direction == 8 and bullet.direction == 2) or
(self.direction == 6 and bullet.direction == 4) or
(self.direction == 4 and bullet.direction == 6))
return true
elsif self.battler.guard_directions.include?(8) and
((self.direction == 8 and bullet.direction == 8) or
(self.direction == 2 and bullet.direction == 2) or
(self.direction == 6 and bullet.direction == 6) or
(self.direction == 4 and bullet.direction == 4))
return true
elsif self.battler.guard_directions.include?(4) and
((self.direction == 2 and bullet.direction == 4) or
(self.direction == 8 and bullet.direction == 6) or
(self.direction == 6 and bullet.direction == 2) or
(self.direction == 4 and bullet.direction == 8))
return true
elsif self.battler.guard_directions.include?(6) and
((self.direction == 2 and bullet.direction == 6) or
(self.direction == 8 and bullet.direction == 4) or
(self.direction == 6 and bullet.direction == 8) or
(self.direction == 4 and bullet.direction == 2))
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Target Invunerable Actions?
#--------------------------------------------------------------------------
def target_invunerable_actions?(user, skill, bullet)
return true if self.battler.invunerable_actions.include?(skill.id)
return false
end
#--------------------------------------------------------------------------
# ● Shoot Target Shield
#--------------------------------------------------------------------------
def shoot_target_shield?(bullet,user, skill)
return false unless self.battler.shield
return false if bullet.action.ignore_guard
return true if face_direction?(bullet)
return false
end
#--------------------------------------------------------------------------
# ● Action can hit target?
#--------------------------------------------------------------------------
def action_can_hit_target?(bullet, user, skill,tar_invu)
if user == nil
return false
end
if self.battler.invunerable
return false
end
if self.battler.dead?
return false
end
if self.battler.invunerable_duration > 0
return false
end
if @knock_back_duration != nil
return false unless bullet.action.ignore_knockback_invincible
end
if bullet.action.first_impact_time > 0
return false
end
if self.action != nil and self.action.user_invincible
unless self.action.ally_damage and bullet.action.user == self.action.user
return false
end
end
unless bullet.action.all_damage
if bullet.action.ally_damage
if user.battler.is_a?(Game_Actor)
return false if self.battler.is_a?(Game_Enemy)
elsif user.battler.is_a?(Game_Enemy)
return false if self.battler.is_a?(Game_Actor)
end
else
if user.battler.is_a?(Game_Actor)
return false if self.battler.is_a?(Game_Actor)
elsif user.battler.is_a?(Game_Enemy)
return false if self.battler.is_a?(Game_Enemy)
end
end
end
return false if target_state_invunerable?(tar_invu)
#return false if target_reflect_action?(bullet, user)
return true
end
#--------------------------------------------------------------------------
# ● Target Relfect Action
#--------------------------------------------------------------------------
def target_reflect_action?(bullet, user)
return false unless bullet.action.reflectable
for i in $game_map.events.values
if i.tool_id > 0 and i.action.can_reflect and
i.tool_effect == "Barrier"# and i.action.user.battler.is_a?(self.battler)
bullet.action.user = self
bullet.action.hit_events = []
bullet.turn_back
return true
break
end
end
return false
end
#--------------------------------------------------------------------------
# ● Target State Invunerable
#--------------------------------------------------------------------------
def target_state_invunerable?(tar_invu)
if self.battler.state_invunerable
self.battler.damage = XAS_WORD::INVINCIBLE
self.battler.damage_pop = true
self.animation_id = XAS_ANIMATION::INVINCIBLE_ANIMATION_ID
self.battler.invunerable_duration = tar_invu
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Execute Hit Effect
#--------------------------------------------------------------------------
def execute_hit_effect(attacker,skill, bullet , user, tar_invu)
shoot_effect_before_damage(skill, bullet, user)
execute_battler_skill_effect(attacker ,skill, user)
if target_missed?(attacker)
self.battler.invunerable_duration = 30
return
end
execute_damage_pop(attacker,skill)
shoot_effect_after_damage(skill, bullet, user) if can_damage_after_effect?
execute_state_effect(skill, user, bullet)
bullet.action.duration = 1 if remove_tool_after_hit?(skill, bullet, user)
self.battler.invunerable_duration = tar_invu
execute_blow_effect(skill,bullet) if can_blow_effect?
execute_animation(skill, bullet, user)
execute_tool_effects(skill, bullet , user)
end
#--------------------------------------------------------------------------
# ● Can Damage Effect
#--------------------------------------------------------------------------
def can_damage_after_effect?
return false if self.battler.damage == nil
return false unless self.battler.damage.is_a?(Numeric)
return true
end
#--------------------------------------------------------------------------
# ● Execute State Effect
#--------------------------------------------------------------------------
def execute_state_effect(skill, user, bullet)
if user.battler.states.size != 0
for i in user.battler.states
execute_state_effect_user(skill, user, bullet,i)
end
end
if self.battler.states.size != 0
for i in self.battler.states
execute_state_effect_target(skill, user, bullet,i)
end
end
end
#--------------------------------------------------------------------------
# ● Execute State Effect User
#--------------------------------------------------------------------------
def execute_state_effect_user(skill, user, bullet,i)
end
#--------------------------------------------------------------------------
# ● Execute State Target
#--------------------------------------------------------------------------
def execute_state_effect_target(skill, user, bullet,i)
#Sleep
if self.battler.damage.is_a?(Numeric) and self.battler.damage > 0
if i.note =~ /<Sleep>/
self.battler.remove_state(i.id)
end
end
end
#--------------------------------------------------------------------------
# ● Execute Blow Effect
#--------------------------------------------------------------------------
def execute_blow_effect(skill,bullet)
if bullet.action.hit_hold_target and self.temp_id == 0
self.temp_id = bullet.id
self.pre_move_speed = self.move_speed
self.moveto(bullet.x, bullet.y)
end
$game_map.screen.start_shake(5, 5, 60) if bullet.action.hit_shake
p = bullet.action.blow_power.to_i
d = bullet.direction
return if self.battler.damage.to_i <= 0
return if p < 0
self.blow(d, p)
end
#--------------------------------------------------------------------------
# ● Shoot Target Shield
#--------------------------------------------------------------------------
def target_shield_enabled?(attacker, skill, bullet)
return false unless self.battler.shield
if bullet != nil
return false if bullet.action.ignore_guard
return true if face_direction?(bullet)
else
return false if attacker.battler.ignore_guard
return true if face_direction?(attacker)
end
return false
end
#--------------------------------------------------------------------------
# ● Can Blow Effect
#--------------------------------------------------------------------------
def can_blow_effect?
return false if self.battler.no_knockback
return false if $game_map.interpreter.running?
return true
end
#--------------------------------------------------------------------------
# ● Execute Guard Effect
#--------------------------------------------------------------------------
def execute_guard_effect(attacker, skill, bullet, inv, erase_bullet = true)
self.battler.invunerable_duration = inv
damage_pop(XAS_WORD::GUARD)
guard_animation_id = XAS_ANIMATION::GUARD_ANIMATION_ID
self.animation_id = guard_animation_id if guard_animation_id != 0
if bullet != nil
bullet.erase if erase_bullet
else
blow_reverse(attacker) unless attacker.battler.no_knockback
end
end
#--------------------------------------------------------------------------
# ● Blow Reverse
#--------------------------------------------------------------------------
def blow_reverse(attacker)
return if attacker.battler.no_knockback
case attacker.direction
when 2
d = 8
when 4
d = 6
when 6
d = 4
when 8
d = 2
end
attacker.jump(0,0)
attacker.blow(d,1)
end
#--------------------------------------------------------------------------
# ● Can Attack Effect
#--------------------------------------------------------------------------
def damage_pop(text)
return unless XAS_WORD::ENABLE_WORD
self.battler.damage = text
self.battler.damage_pop = true
end
#--------------------------------------------------------------------------
# ● Shd Direction?
#--------------------------------------------------------------------------
def face_direction?(attacker)
target = self.direction
case target
when 2
return true if attacker.direction == 8
when 4
return true if attacker.direction == 6
when 6
return true if attacker.direction == 4
when 8
return true if attacker.direction == 2
end
return false
end
#--------------------------------------------------------------------------
# ● Execute Damage Pop
#--------------------------------------------------------------------------
def execute_damage_pop(attacker,skill = nil)
if skill != nil
return if skill.note =~ /<No Damage Pop>/
if skill.damage.to_mp?
dam = self.battler.result.mp_damage
self.battler.damage_type = "Mp"
elsif skill.damage.to_hp?
dam = self.battler.result.hp_damage
self.battler.damage_type = "Critical" if self.battler.result.critical
end
if dam != nil
if skill.damage.drain? or skill.damage.drain?
attacker.damage = -dam
attacker.damage_type = self.battler.damage_type
attacker.damage_pop = true
end
self.battler.damage = dam
self.battler.damage_pop = true
end
else
if self.battler.result.hp_damage != nil
self.battler.damage = self.battler.result.hp_damage
self.battler.damage_type = "Critical" if self.battler.result.critical
self.battler.damage_pop = true
end
end
end
#==============================================================================
# ■ Window Skill List
#==============================================================================
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# ● Process OK
#--------------------------------------------------------------------------
alias x_skill_process_ok process_ok
def process_ok
return if can_equip_skill_action?
x_skill_process_ok
end
#--------------------------------------------------------------------------
# ● Can Equip Skill Action
#--------------------------------------------------------------------------
def can_equip_skill_action?
return false if $game_party.in_battle
skill = @data[index]
if skill != nil and skill.note =~ /<Duration = (\d+)>/
@actor.skill_id = skill.id
Sound.play_equip
return true
end
return false
end
end
#-----以下为冗余代码
#==============================================================================
# ■ Window Item List
#~ #==============================================================================
#~ class Window_ItemList < Window_Selectable
#~
#~ #--------------------------------------------------------------------------
#~ # ● Process OK
#~ #--------------------------------------------------------------------------
#~ alias x_item_process_ok process_ok
#~ def process_ok
#~ return if can_equip_item_action?
#~ x_item_process_ok
#~ end
#~ #--------------------------------------------------------------------------
#~ # ● Can Equip Item Action
#~ #--------------------------------------------------------------------------
#~ def can_equip_item_action?
#~ return false if $game_party.in_battle
#~ item = @data[index]
#~ if item != nil and item.is_a?(RPG::Item) and
#~ item.note =~ /<Action ID = (\d+)>/
#~ actor = $game_party.members[0]
#~ actor.item_id = item.id
#~ Sound.play_equip
#~ return true
#~ end
#~ return false
#~ end
#~
#~ end
#------------------------------------------
#===============================================================================
# ■ Game Character
#==============================================================================
class Game_Character < Game_CharacterBase
#--------------------------------------------------------------------------
# ● Update Battler
#--------------------------------------------------------------------------
def update_battler
update_battler_pose
update_battler_parameters
update_battler_stop_movement
update_battler_knockbacking
update_battler_counter_action
unless self.battler.hp == 0
update_battler_cast_action
# update_battler_move_speed if can_update_battler_move_speed?
update_battler_states_effect
update_battler_attacking
else
update_battler_defeat_process
end
end
end
#===============================================================================
# ■ Game Player
#===============================================================================
class Game_Player < Game_Character
include XRXS_BattlerAttachment
#--------------------------------------------------------------------------
# ● Battler
#--------------------------------------------------------------------------
def battler
return $game_party.members[0]
end
#--------------------------------------------------------------------------
# ● Refresh Interpreter Effect
#--------------------------------------------------------------------------
def refresh_interpreter_effect
$game_system.old_interpreter_running = $game_map.interpreter.running?
if $game_system.old_interpreter_running
$game_temp.reset_battler_time = 60 * 4
end
reset_battler_setting
end
#--------------------------------------------------------------------------
# ● Update Battler Setting Time
#--------------------------------------------------------------------------
def update_reset_battler_setting_time
return if $game_temp.reset_battler_time == 0
$game_temp.reset_battler_time -= 1
reset_battler_setting_running if $game_temp.reset_battler_time == 0
end
#--------------------------------------------------------------------------
# ● Update Battler Setting
#--------------------------------------------------------------------------
def reset_battler_setting
reset_player_parameters
for ally in $game_party.members
reset_members_parameters(ally)
end
for enemy in $game_map.events.values
reset_enemies_parameters(enemy) if enemy.battler != nil
end
$game_map.need_refresh = true
end
#--------------------------------------------------------------------------
# ● Update Battler Setting Running
#--------------------------------------------------------------------------
def reset_battler_setting_running
reset_player_parameters_running
for ally in $game_party.members
reset_members_parameters_running(ally)
end
for enemy in $game_map.events.values
reset_enemies_parameters(enemy) if enemy.battler != nil
end
$game_map.need_refresh = true
end
#===============================================================================
# ■ Game Follower
#===============================================================================
class Game_Follower < Game_Character
include XRXS_BattlerAttachment
#--------------------------------------------------------------------------
# ● Battler
#--------------------------------------------------------------------------
def battler
return $game_party.members[@member_index]
end
end
#===============================================================================
# ■ Game Follower
#===============================================================================
class Game_Followers
include XRXS_BattlerAttachment
#--------------------------------------------------------------------------
# ● Battler
#--------------------------------------------------------------------------
def battler
return $game_party.members[@member_index]
end
end
#===============================================================================
# ■ Game_Vehicle
#===============================================================================
class Game_Vehicle < Game_Character
include XRXS_BattlerAttachment
attr_reader :collision_attack
#--------------------------------------------------------------------------
# ● Battler
#--------------------------------------------------------------------------
def battler
return @battler
end
end
#===============================================================================
# ■ Game Event
#===============================================================================
class Game_Event < Game_Character
include XRXS_BattlerAttachment
#--------------------------------------------------------------------------
# ● Battler
#--------------------------------------------------------------------------
def battler
return @battler
end
#--------------------------------------------------------------------------
# ● Battler?
#--------------------------------------------------------------------------
def battler?
return false if self.erased
return false if self.battler == nil
return false if self.dead?
return false if self.battler.no_damage_pop
return false if self.battler.invunerable
return true
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
alias xrxs64c_refresh refresh
def refresh
xrxs64c_refresh
self.battler_recheck
end
#--------------------------------------------------------------------------
# ● Battler Recheck
#--------------------------------------------------------------------------
def battler_recheck
return if @battler != nil
return if @page == nil
if self.name =~ /<Actor>/
actor = $game_party.members[0]
@battler = Game_Actor.new(actor.id)
return
else
@enemy_id = 0
if self.name =~ /<Enemy(\d+)>/i
@enemy_id = $1.to_i
end
return if @enemy_id <= 0
@battler = Game_Enemy.new(1, @enemy_id)
self.force_update = true if self.battler.sensor_range >= 15
end
end
#===============================================================================
# ■ Game_Enemy
#===============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_e2_initialize initialize
def initialize(index, enemy_id)
x_e2_initialize(index, enemy_id)
enemy = $data_enemies[@enemy_id]
setup_enemy_note(enemy)
end
#--------------------------------------------------------------------------
# ● Setup X Note Elements
#--------------------------------------------------------------------------
def setup_enemy_note(enemy)
if enemy.note =~ /<Sensor Range = (\d+)>/
@sensor_range = $1.to_i
end
if enemy.note =~ /<Body Size = (\d+)>/
@body_size = $1.to_i
end
if enemy.note =~ /<Attack Animation = (\d+)>/
@attack_animation_id = $1.to_i
end
if enemy.note =~ /<Death Zoom = (\d+)>/
@death_zoom_effect = $1.to_i
end
if enemy.note =~ /<Knockback Duration = (\d+)>/
@knockback_duration = $1.to_i
end
if enemy.note =~ /<Ignore Guard>/
@ignore_shield = true
end
if enemy.note =~ /<Invunerable>/
@invunerable = true
end
if enemy.note =~ /
/
@breath_effect = true
end
if enemy.note =~ /<Knockback Disable>/
@no_knockback = true
end
if enemy.note =~ /<Passive>/
@passive = true
end
if enemy.note =~ /<No Damage Pop>/
@no_damage_pop = true
end
invunerable_actions_ids = XAS_BA_ENEMY::INVUNERABLE_ACTIONS[@enemy_id]
if invunerable_actions_ids != nil
@invunerable_actions = invunerable_actions_ids
end
guard_directions_ids = XAS_BA_ENEMY::GUARD_DIRECTIONS[@enemy_id]
if guard_directions_ids != nil
@guard_directions = guard_directions_ids
end
end
#--------------------------------------------------------------------------
# ● Update Sensor
#--------------------------------------------------------------------------
def update_sensor
if self.battler != nil and self.battler.sensor_range > 0
sensor_area = self.battler.sensor_range
else
sensor_area = $game_variables[XAS_BA::DEFAULT_SENSOR_RANGE_VARIABLE_ID]
end
sensor_area = -1 if cancel_sensor?
distance = ($game_player.x - self.x).abs + ($game_player.y - self.y).abs
enable = (distance <= sensor_area)
key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
last_enable = $game_self_switches[key]
last_enable = false if last_enable == nil
if enable != last_enable
touch_attack(false)
@collision_attack = false
@pattern = 0
@pattern_count = 0
$game_self_switches[key] = enable
self.refresh
end
end
#--------------------------------------------------------------------------
# ● Can Update Sensor
#--------------------------------------------------------------------------
def can_update_sensor?
return false if @sensor_enable == false
return false if self.dead?
return false if self.erased
return false if self.stop
return false if self.knockbacking?
return true
end
#--------------------------------------------------------------------------
# ● Cancel Sensor
#--------------------------------------------------------------------------
def cancel_sensor?
return false if self.battler == nil
return true if self.battler.passive
return false
end
end
#===============================================================================
# ■ Game Event
#===============================================================================
class Game_Event < Game_Character
attr_accessor :sensor_enable
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_sensor_initialize initialize
def initialize(map_id, event)
@sensor_enable = false
x_sensor_initialize(map_id, event)
end
#--------------------------------------------------------------------------
# ● Conditions Met
#--------------------------------------------------------------------------
alias x_sensor_conditions_met conditions_met?
def conditions_met?(page)
c = page.condition
if c.self_switch_ch == XAS_BA::SENSOR_SELF_SWITCH
@sensor_enable = true
end
x_sensor_conditions_met(page)
end
end
#===============================================================================
# ■ Game Event
#===============================================================================
class Game_Character < Game_CharacterBase
include XRXS_EnemySensor
end
#===============================================================================
# ■ Game Character
#===============================================================================
class Game_Character < Game_CharacterBase
attr_writer :opacity
end
#===============================================================================
# ■ Game Character
#==============================================================================
class Game_Character < Game_CharacterBase
#--------------------------------------------------------------------------
# ● Can Update Battler Move Speed
#--------------------------------------------------------------------------
def can_update_battler_move_speed?
return false if @temp_id > 0
return false if moving?
return true
end
#--------------------------------------------------------------------------
# ● Can Update Battler?
#--------------------------------------------------------------------------
def can_update_battler?
return false unless $game_system.xas_battle
return false if self.battler == nil
return false unless party_system?
return true
end
#--------------------------------------------------------------------------
# ● Party System
#--------------------------------------------------------------------------
def party_system?
return false if self.battler == nil
if $xas_party_system == nil and self.battler.is_a?(Game_Actor)
return false if self.battler.actor_id != $game_party.members[0].actor_id
end
return true
end
#--------------------------------------------------------------------------
# ● update_battler_parameters
#--------------------------------------------------------------------------
def update_battler_parameters
@stop_count = -1 if can_stop_battler?
self.battler.invunerable_duration -= 1 if self.battler.invunerable_duration > 0
unless @stop
@knock_back_duration = 30 if @temp_id > 0
end
end
#--------------------------------------------------------------------------
# ● Can Stop Battler
#--------------------------------------------------------------------------
def can_stop_battler?
return false if self.is_a?(Game_Player)
return true if self.knockbacking?
return true if self.dead?
return true if self.stop
return false
end
#--------------------------------------------------------------------------
# ● Update Battler Counter Action
#--------------------------------------------------------------------------
def update_battler_counter_action
return if self.battler.counter_action[1] == 0
self.battler.counter_action[1] -= 1
if self.battler.counter_action[1] == 0
turn_toward_player
self.battler.damage = XAS_WORD::COUNTER
self.battler.damage_pop = true
self.shoot(self.battler.counter_action[0])
self.battler.counter_action[0] = 0
end
end
#--------------------------------------------------------------------------
# ● Update Cast Action
#--------------------------------------------------------------------------
def update_battler_cast_action
return unless can_update_cast_action?
self.battler.cast_action[3] += 1
if self.battler.cast_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
self.battler.cast_action[3] = 0
self.animation_id = self.battler.cast_action[2]
end
self.battler.cast_action[4] += 1
if self.battler.cast_action[4] >= self.battler.cast_action[1]
self.shoot(self.battler.cast_action[0])
end
end
#--------------------------------------------------------------------------
# ● Can Update Cast Action
#--------------------------------------------------------------------------
def can_update_cast_action?
return false if self.battler.cast_action[1] == 0
return false if @stop
return true
end
#--------------------------------------------------------------------------
# ● Can Blow Effect
#--------------------------------------------------------------------------
def can_blow?
return false if self.stop and not self.battler.state_sleep
return false if self.battler.no_knockback
return false if self.is_a?(Game_Player) and self.action != nil
return true
end
#--------------------------------------------------------------------------
# ● Blow Effect
#--------------------------------------------------------------------------
def blow(d, power = 1)
return unless can_blow?
jump(0,0)
self.battler.invunerable_duration = 30 if self.battler.invunerable_duration <= 0
if self.is_a?(Game_Event)
@collision_attack = false
end
@knock_back_duration = self.battler.knockback_duration
refresh_sensor if self.is_a?(Game_Event)
pre_direction = self.direction
pre_direction_fix = self.direction_fix
self.turn_reverse(d)
self.direction_fix = true
power.times do
case d
when 2; @y += 1 if passable?(@x, @y, d)
when 4; @x -= 1 if passable?(@x, @y, d)
when 6; @x += 1 if passable?(@x, @y, d)
when 8; @y -= 1 if passable?(@x, @y, d)
end
end
self.direction_fix = pre_direction_fix
self.direction = pre_direction
end
#--------------------------------------------------------------------------
# ● Can Stop Battler Movement
#--------------------------------------------------------------------------
def can_stop_battler_movement?
return false if self.dead?
return true if self.battler.state_sleep
return true if self.battler.state_stop
return false
end
#--------------------------------------------------------------------------
# ● Impact
#--------------------------------------------------------------------------
def impact(enable = true)
return if self.tool_id == 0
return if self.action == nil
self.action.impact = enable
end
#--------------------------------------------------------------------------
# ● Update Battler Stop Movement
#--------------------------------------------------------------------------
def update_battler_stop_movement
unless can_stop_battler_movement? @stop = false
return
end
@knock_back_duration = nil
@stop = true
@step_anime = false
reset_battler_temp
if self.battler.state_sleep
make_pose("_Hit", 2)
else
make_pose("", 2)
end
if self.is_a?(Game_Event)
@collision_attack = false
end
end
#--------------------------------------------------------------------------
# ● Seal Effect
#--------------------------------------------------------------------------
def seal_effect
Sound.play_buzzer
if XAS_WORD::ENABLE_WORD
self.battler.damage = XAS_WORD::SEAL
self.battler.damage_pop = true
end
end
#--------------------------------------------------------------------------
# ● Acting
#--------------------------------------------------------------------------
def acting?
return (super or self.knockbacking? or self.collapsing? or self.stop)
end
end
#===============================================================================
# ■ Game_Player
#===============================================================================
class Game_Player < Game_Character
include XAS_DamageStop
end
#===============================================================================
# ■ Game_Event
#===============================================================================
class Game_Event < Game_Character
include XAS_DamageStop
end
#--------------------------------------------------------------------------
# ● Attack Effect
#--------------------------------------------------------------------------
def attack_effect(attacker)
return false unless $game_system.xas_battle
return if self.battler == nil or attacker == nil
return unless can_attack_effect?(attacker)
if target_shield_enabled?(attacker, nil, nil)
execute_guard_effect(attacker, nil, nil, 30)
return
end
execute_attack_effect(attacker)
end
#--------------------------------------------------------------------------
# ● Can Attack Effect
#--------------------------------------------------------------------------
def can_attack_effect?(attacker)
return false if self.can_update == false
return false if @knock_back_duration != nil
return false if attacker.stop
return false if self.battler.invunerable
return false if self.battler.invunerable_duration > 0
return false if self.action != nil and self.action.user_invincible
return false if seal_attack?(attacker.battler)
return false if target_state_invunerable?(30)
return true
end
#--------------------------------------------------------------------------
# ● Attack Target Shield
#--------------------------------------------------------------------------
def attack_target_shield?(attacker)
return false if attacker.battler.ignore_shield
return false unless self.battler.shield
return true if face_direction?(attacker)
return false
end
#--------------------------------------------------------------------------
# ● Seal Attack?
#--------------------------------------------------------------------------
def seal_attack?(attacker)
if attacker.state_seal_attack or attacker.state_mute
attacker.damage = XAS_WORD::SEAL
attacker.damage_pop = true
self.battler.invunerable_duration = 30
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Execute Attack Effect
#--------------------------------------------------------------------------
def execute_attack_effect(attacker)
execute_attack_effect_before_damage(attacker)
execute_attack_damage(attacker)
if target_missed?(attacker)
self.battler.invunerable_duration = 30
return
end
execute_damage_pop(attacker)
execute_attack_effect_after_damage(attacker) if can_check_after_attack_effect?(attacker)
execute_state_effect(nil, attacker, nil)
self.battler.invunerable_duration = 20 + XAS_BA::DEFAULT_KNOCK_BACK_DURATION
if attacker.battler.attack_animation_id != 0
self.animation_id = attacker.battler.attack_animation_id
end
if self.battler.damage.to_i > 0
self.blow(attacker.direction, 1) if can_blow_effect?
end
if self.is_a?(Game_Player)
self.need_refresh = true
end
end
#--------------------------------------------------------------------------
# ● Can Check After Attack Effect?
#--------------------------------------------------------------------------
def can_check_after_attack_effect?(attacker)
return false unless self.battler.damage.is_a?(Numeric)
return true
end
#===============================================================================
# ■ Game Player
#===============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● Check Event Trigger Touch
#--------------------------------------------------------------------------
alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
def check_event_trigger_touch(x, y)
xrxs64c_check_event_trigger_touch(x, y)
if $game_map.interpreter.running?
return
end
for event in $game_map.events.values
next unless event.collision_attack
unless [1,2].include?(event.trigger)
if event.battler != nil and event.x == x and event.y == y
$game_player.attack_effect(event)
end
end
end
end
end
#===============================================================================
# ■ Game Event
#===============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ● Check Event Trigger Touch
#--------------------------------------------------------------------------
alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
def check_event_trigger_touch(x, y)
xrxs64c_check_event_trigger_touch(x, y)
if $game_map.interpreter.running?
return
end
return unless self.collision_attack
if self.battler != nil and x == $game_player.x and y == $game_player.y
$game_player.attack_effect(self)
end
end
end
#--------------------------------------------------------------------------
# ● Add State
#--------------------------------------------------------------------------
alias x_add_state add_state
def add_state(state_id)
unless @states.include?(state_id)
state = $data_states[state_id]
xas_add_state(state)
end
x_add_state(state_id)
end
#--------------------------------------------------------------------------
# ● Xas Add State
#--------------------------------------------------------------------------
def xas_add_state(state)
@state_duration[state.id] = 60 * $data_states[state.id].min_turns
@state_loop_effect_time[state.id] = 0
@state_loop_speed[state.id] = $data_states[state.id].max_turns
execute_damage_state(state,0)
end
#--------------------------------------------------------------------------
# ● Remove State
#--------------------------------------------------------------------------
alias x_remove_state remove_state
def remove_state(state_id)
if state?(state_id)
state = $data_states[state_id]
xas_remove_state(state)
end
x_remove_state(state_id)
end
#--------------------------------------------------------------------------
# ● XAS Remove State
#--------------------------------------------------------------------------
def xas_remove_state(state)
@state_duration.delete(state.id)
@state_loop_effect_time.delete(state.id)
@state_loop_speed.delete(state.id)
execute_damage_state(state,1)
end
#--------------------------------------------------------------------------
# ● Execute_Damage_State
#--------------------------------------------------------------------------
def execute_damage_state(state,type)
return unless XAS_DAMAGE_POP::DAMAGE_STATE_POP
return unless XAS_WORD::ENABLE_WORD
return if state == nil or state.id == 1
case type
when 0
damage = "+ " + state.name.to_s
when 1
damage = "- " + state.name.to_s
end
@state_string = damage
@state_string_time = 30
end
end
#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Character < Game_CharacterBase
#--------------------------------------------------------------------------
# ● Update Battler States Effect
#--------------------------------------------------------------------------
def update_battler_states_effect
return unless XAS_SYSTEM::STATE_SYSTEM
update_state_string_pop
update_pre_state_setup
return unless can_update_states_effect?
for i in self.battler.states
state = $data_states[i.id]
if state == nil or self.battler.state_duration[state.id] == nil or
self.battler.state_loop_effect_time[state.id] == nil or
self.battler.state_loop_speed[state.id] == nil
self.battler.remove_state(state.id)
next
return
end
update_state_abs_effects(state)
update_state_loop(state)
update_remove_state(state)
end
#--------------------------------------------------------------------------
# ● Update Pre State Setup
#--------------------------------------------------------------------------
def update_state_abs_effects(state)
if state.note =~ /<Stop>/
self.battler.state_stop = true
end
if state.note =~ /<Slow>/
self.battler.state_slow = true
self.battler.state_move_speed = -1.5
end
if state.note =~ /<Fast>/
self.battler.state_fast = true
self.battler.state_move_speed = 1
end
if self.battler.state_fast and
self.battler.state_slow
self.battler.state_move_speed = 0
end
if state.note =~ /<Mute>/
self.battler.state_mute = true
end
if state.note =~ /<Sleep>/
self.battler.state_sleep = true
end
if state.note =~ /<Invincible>/
self.battler.state_invunerable = true
end
if state.note =~ /<Seal Attack>/
self.battler.state_seal_attack = true
end
if state.note =~ /<Seal Skill>/
self.battler.state_seal_skill = true
end
if state.note =~ /<Seal Item>/
self.battler.state_seal_item = true
end
if state.note =~ /<Reflect>/
self.battler.state_reflect = true
end
end
#--------------------------------------------------------------------------
# ● Update State Loop
#--------------------------------------------------------------------------
def update_state_loop(state)
self.battler.state_loop_effect_time[state.id] += 1
if self.battler.state_loop_effect_time[state.id] > self.battler.state_loop_speed[state.id]
self.battler.state_loop_effect_time[state.id] = 0
if state.note =~ /<Animation ID = (\d+)>/
state_anime = $1.to_i
if state_anime != nil
self.animation_id = state_anime
end
end
execute_states_effects(state)
end
end
#--------------------------------------------------------------------------
# ● Execute States Effect
#--------------------------------------------------------------------------
def execute_states_effects(state)
if state.note =~ /<Slip Damage = (\S+)>/
execute_state_slip_damage($1.to_i)
end
end
#--------------------------------------------------------------------------
# ● Update Remove State
#--------------------------------------------------------------------------
def update_remove_state(state)
self.battler.state_duration[state.id] -= 1
if self.battler.state_duration[state.id] <= 0
self.battler.remove_state(state.id)
end
end
#--------------------------------------------------------------------------
# ● Can Update States Effect
#--------------------------------------------------------------------------
def can_update_states_effect?
return false if self.dead?
return false if self.battler.states == nil
return false if self.battler.states.size == 0
return false if self.battler.state_duration == []
return true
end
#--------------------------------------------------------------------------
# ● Update State String Pop
#--------------------------------------------------------------------------
def update_state_string_pop
return false if self.battler.state_string_time == 0
self.battler.state_string_time -= 1
if self.battler.state_string_time == 0
self.battler.damage = self.battler.state_string
self.battler.damage_pop = true
self.battler.state_string = ""
end
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● On Player Walk
#--------------------------------------------------------------------------
alias x_state_on_player_walk on_player_walk
def on_player_walk
return if XAS_SYSTEM::STATE_SYSTEM
x_state_on_player_walk
end
#===============================================================================
# ■ Game Event
#===============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ● Shoot Chance
#--------------------------------------------------------------------------
def shoot_chance(action_id,perc)
return if self.battler == nil
if perc >= rand(100)
shoot(action_id)
end
end
#--------------------------------------------------------------------------
# ● Guard
#--------------------------------------------------------------------------
def guard(enable)
return if self.battler == nil
self.battler.guard = enable
end
#--------------------------------------------------------------------------
# ● Touch Attack
#--------------------------------------------------------------------------
def touch_attack(enable)
return if self.battler == nil
return if seal_attack?(self.battler)
@collision_attack = enable
@pattern = 0
@pattern_count = 0
end
#--------------------------------------------------------------------------
# ● Counter
#--------------------------------------------------------------------------
def counter(enable)
return if self.battler == nil
self.battler.counter_action[2] = enable
end
#--------------------------------------------------------------------------
# ● Rand Shoot
#--------------------------------------------------------------------------
def rand_shoot(random_id = [])
return if self.battler == nil
return if random_id == []
action_id = random_id[rand(random_id.size)]
self.shoot(action_id)
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ BATTLER - DEFEAT PROCESS
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#===============================================================================
# ■ Scene Base
#===============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ● Check Gameover
#--------------------------------------------------------------------------
def check_gameover
return unless $game_party.in_battle
SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
end
end
#===============================================================================
# ■ Game Character
#===============================================================================
class Game_Character < Game_CharacterBase
attr_accessor :collapse_duration
attr_accessor :battler_visible
attr_writer :opacity
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_collapse_initialize initialize
def initialize
@collapse_duration = 0
x_collapse_initialize
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
return if self.battler != nil and $game_map.interpreter.running?
super
end
end
#===============================================================================
# ■ Game Event
#==============================================================================
class Game_Event < Game_Character
include XAS_BA_BATTLEEVENT_NONPREEMPT
end
#===============================================================================
# ■ Game Character
#===============================================================================
class Game_Character < Game_CharacterBase
#--------------------------------------------------------------------------
# ● Update Battler Defeat Process
#--------------------------------------------------------------------------
def update_battler_defeat_process
execute_enemy_defeated_process if can_check_enemy_defeated?
execute_actor_defeated_process if can_check_actor_defeated?
end
#--------------------------------------------------------------------------
# ● Can Check Enemy Defeated?
#--------------------------------------------------------------------------
def can_check_enemy_defeated?
return false if self.battler.is_a?(Game_Actor)
return false if self.battler.defeated
return true
end
#--------------------------------------------------------------------------
# ● Can Check Actor Defeated?
#--------------------------------------------------------------------------
def can_check_actor_defeated?
return false if self.battler.is_a?(Game_Enemy)
return false if self.battler.defeated
return false if $game_party.members[0].hp > 0
return false if @collapse_duration > 0
return true
end
#--------------------------------------------------------------------------
# ● Execute Actor Defeated Process
#--------------------------------------------------------------------------
def execute_actor_defeated_process
erase_actor_tools_on_map
if $game_party.all_dead? and not self.battler.defeated
self.battler.defeated = true
self.collapse_duration = 120
self.knock_back_duration = 161
reset_battler_temp
else
$game_temp.change_leader_wait_time = 0
$game_player.change_leader
end
end
#--------------------------------------------------------------------------
# ● Erase Tools on Map
#--------------------------------------------------------------------------
def erase_actor_tools_on_map
for event in $game_map.events.values
if event.tool_id > 0 and event.action.user.is_a?(Game_Player)
event.erase
end
end
end
#--------------------------------------------------------------------------
# ● Execute Defeated Sound Effect
#--------------------------------------------------------------------------
def execute_defeated_sound_effect(enemy)
return if self.battler.no_damage_pop
Sound.play_enemy_collapse
end
#--------------------------------------------------------------------------
# ● Execute Final Shoot
#--------------------------------------------------------------------------
def execute_final_shoot(enemy)
enemy.note =~ /<Final Action ID = (\d+)>/
action_id = $1.to_i
return if action_id == nil
self.shoot(action_id)
end
#--------------------------------------------------------------------------
# ● Execute Gain Exp Gold
#--------------------------------------------------------------------------
def execute_gain_exp_gold(enemy)
exp = self.battler.exp
case XAS_BA::EXP_TYPE
when 0
actor = $game_party.members[0]
actor.gain_exp(exp)
when 1
for i in 0...$game_party.members.size
actor = $game_party.members
actor.gain_exp(exp)
end
when 2
exp = exp / $game_party.members.size
for i in 0...$game_party.members.size
actor = $game_party.members
actor.gain_exp(exp)
end
end
$game_party.gain_gold(self.battler.gold)
end
#--------------------------------------------------------------------------
# ● Execute_Active Switch
#--------------------------------------------------------------------------
def execute_active_switch(enemy)
enemy.note =~ /<Active Switch = (\d+)>/
switch_id = $1.to_i
if switch_id != nil
$game_switches[switch_id] = true
$game_map.need_refresh = true
end
end
#--------------------------------------------------------------------------
# ● Execute Defeated Animation
#--------------------------------------------------------------------------
def execute_defeated_animation(enemy)
enemy.note =~ /<Defeated Animation = (\d+)>/
anime_id = $1.to_i
if anime_id != nil
self.animation_id = anime_id
end
end
end
#===============================================================================
# ■ Game Player
#===============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● Reset Old Level
#--------------------------------------------------------------------------
def reset_old_level(trans = false)
for actor in $game_party.members
actor.old_level = actor.level
end
end
#--------------------------------------------------------------------------
# ● Change Leader
#--------------------------------------------------------------------------
def change_leader
return if $game_party.members.size <= 1
reset_battler_temp
current_leader_id = $game_party.members[0].id
for i in 1..$game_party.members.size
pre_leader = $game_party.members[0].id
$game_party.remove_actor(pre_leader)
$game_party.add_actor(pre_leader)
if $game_party.members[0].hp > 0
execute_change_leader_effect unless current_leader_id == $game_party.members[0].id
break
end
end
end
#--------------------------------------------------------------------------
# ● Check Actor Level
#--------------------------------------------------------------------------
def check_actor_level
return if $game_party.in_battle
return if self.battler == nil
return if self.battler.old_level == self.battler.level
reset_old_level(false)
if self.battler.level > 1
Audio.se_play("Audio/SE/" + XAS_SOUND::LEVEL_UP , 100, 100)
if XAS_WORD::ENABLE_WORD
$game_player.battler.damage = XAS_WORD::LEVEL_UP
$game_player.battler.damage_pop = true
end
end
$game_player.need_refresh = true
end
end
#===============================================================================
# ■ Game Party
#===============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● Setup Starting Members
#--------------------------------------------------------------------------
alias x_old_level_setup_starting_members setup_starting_members
def setup_starting_members
x_old_level_setup_starting_members
for actor in $game_party.members
actor.old_level = actor.level
end
end
end
#===============================================================================
# ■ Sprite Character
#==============================================================================
class Sprite_Character < Sprite_Base