设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4075|回复: 10
打印 上一主题 下一主题

[已经解决] XAS中文说明 技能篇(一)

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
150 小时
注册时间
2010-10-22
帖子
58
跳转到指定楼层
1
发表于 2013-7-23 15:47:37 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 Sion 于 2013-10-27 12:02 编辑

最近发现蛮多人喜欢XAS的,就把自己的一些使用心得分享一下吧!

还有本人不推荐新人去搞这个系统,要不然你会很蛋疼的!
系统范例就不发了,记得好像有一个集合贴,可以搜一下!

---------------------我是分割线吗?---------------------------------------------------
<Piercing>
技能攻击判断,技能都要填上。
<Ally Damage>无差别攻击,设置回复技能必须项,
<User Invincible>使用技能时将无敌.
<Auto Target>选择性技能设置,设置之后施放技能可以选择画面内的任何一个目标!
注意: Auto Target> Ally Damage> Piercing
<Disable Hit>关闭技能的直击中效果,可以设置技能飞行一定距离时爆炸的效果,要配合TOOL事件设置!
<Reflectable>这个嘛,<Disable Hit>搞在一起时就OK!
<Sunflag = X>技能攻击间隔,X基本为1;数值越大间隔越久。
<Duration = X>技能生命周期,X基本为30,设置多断攻击与射程的重要项.要配合TOOL事件的设置.
<Multi Hit>多断攻击判断,必须配合<Duration = X>,生命周期太小就不会有多断攻击效果.
配合<Sunflag = X>,可实现一段时间内的多次攻击:比如<Duration = 50>,<Sunflag = 1>,那么技能就会在5秒内发生5次攻击.
<Cast Time = X>技能充能时间
<Item Cost = X>技能消耗物品,X为物品ID.
<Impact Time = X>技能重新装填时间(技能CD).
<Shake>施放技能时将产生画面震动效果.
<Pose = _at>施放技能时的动画,_at为行走图后缀。
<Area = X>技能效果范围(注意:必须为大写)
SQUARE RHOMBUS

LINE FRONTSQUARE

FRONTRHOMBUS WALL

CROSS

<Range = X>技能范围(1OK了)
<Range = 1> <Range = 2>

<Blow Power = X>技能力度,数值越大敌人被吹飞的驱离就越远,建议1-10之间.
(敌人设置<Knockback Disable>之后将无效)

<Target Invunerable = X>敌人受攻击之后的无敌时间.

<Diagonal>技能八方向设定.
<X Directions>技能方向设定,要设定<Diagonal>本项才生效!
<All Directions>全方向
<Four Directions>四方向
<Three Directions>三方向
<Two Directions>二方向

OK主要的都是这些,还有个别的没啥用处的就不不说了!!

下一将说明技能设置与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

Created by XIDEROWNG (XMS / XRXS / ちいさな本屋 / 森穂(もりほ)
http://xrxs.at-ninja.jp/

#===============================================================================
# ■ 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/


#===============================================================================
# ■ XAS Hero Edition ACE (Ver Experimental 0.5 - 2012 / 01 / 04)
#===============================================================================

Updates for XAS Hero Edtion.
http://www.atelier-rgss.com/

XAS Tutorials.
http://xasabs.wordpress.com/

#===============================================================================
# ■ 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

#===============================================================================
# ■ ENEMY SETTING
#===============================================================================

module XAS_BA_ENEMY
# Defini??o de quais habilidades o inimigo será invunerável.
#
# INVUNERABLE_ACTIONS = { A=>[B,B,B,B], A=>[B,B,B,B], ...}
# A - ID do inimigo.
# B - ID da habilidade.
INVUNERABLE_ACTIONS = {
6=>[39,40,41,42,43],
7=>[24,25,26,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],
#8=>[1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,24,25,26],
8=>[69],
9=>[39,40,41,42,43],
10=>[39,40,41,42,43],
11=>[39,40,41,42,43],
20=>[39,40,41,42,43,80,81,82,83,84,85,86,87,88,89]
}
# Defini??o das dire??es que o inimigo será invunerável.
# GUARD_DIRECTIONS = { A=>[B], A=>[B,B,B,B], ...}
# A - ID do inimigo
# B - Dire??es de Invulnerabilidade.
# -> 2 = Abaixo. -> 4 = Esquerda.
# -> 6 = Direita. -> 8 = Acima.
GUARD_DIRECTIONS = {
}
# Defini??o das habilidades de Counter Attack
#
# COUNTER_ATTACK = { A=>[B,B,B,B], A=>[B,B,B,B], ...}
COUNTER_ATTACK = {
}

end








#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ INITIALIZE
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :change_leader_wait_time
attr_accessor :reset_battler_time
attr_accessor :tool_event
attr_accessor :animation_garbage

#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias xas_initialize initialize
def initialize
@change_leader_wait_time = 0
@reset_battler_time = 0
@tool_event = nil
@animation_garbage = []
xas_initialize
end

end

#===============================================================================
# ■ Game_System
#===============================================================================
class Game_System
attr_accessor :tools_on_map
attr_accessor :old_interpreter_running
attr_accessor :hud_visible
attr_accessor :enable_hud
attr_accessor :command_enable
attr_accessor :pre_leader_id
attr_accessor :xas_battle
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_initialize initialize
def initialize
@tools_on_map = []
@old_interpreter_running = false
@hud_visible = XAS_BA::HUD_VISIBLE_AT_STARTUP
@enable_hud = false
@command_enable = true
@pre_leader_id = 0
@xas_battle = XAS_SYSTEM::BATTLE_SYSTEM
x_initialize
end
end

#===============================================================================
# ■ Game_Battler
#===============================================================================
class Game_Battler
attr_accessor :damage_pop
attr_accessor :damage
attr_accessor :damage_type
attr_accessor :critical
attr_accessor :invunerable_duration
attr_accessor :shield
attr_accessor :invunerable_actions
attr_accessor :guard_directions
attr_accessor :guard
attr_accessor :invunerable
attr_accessor :x_combo
attr_accessor :cast_action
attr_accessor :defeated
attr_accessor :death_zoom_effect
attr_accessor :counter_action
attr_accessor :knockback_duration
attr_accessor :hp_damage
attr_accessor :mp_damage

#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_initialize initialize
def initialize
@damage = 0
@damage_pop = false
@damage_type = 0
@critical = false
@invunerable_duration = 0
@shield = false
@invunerable_actions = []
@guard_directions = []
@guard = true
@invunerable = false
@x_combo = [0,-1,0]
@defeated = false
@death_zoom_effect = 0
@cast_action = [0,0,0,0,0]
@counter_action = [0,0,true]
@knockback_duration = XAS_BA::DEFAULT_KNOCK_BACK_DURATION
x_initialize
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

attr_accessor :x_action1_id
attr_accessor :x_action2_id
attr_accessor :skill_id
attr_accessor :x_item_id
attr_accessor :x_charge_action
attr_accessor :old_equipment_id
attr_accessor :item_id
attr_accessor :old_level
attr_reader :actor_id

#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
alias x_setup setup
def setup(actor_id)
@x_action1_id = 0
@x_action2_id = 0
@skill_id = 0
@x_item_id = 0
@item_id = 0
@x_charge_action = [0,0,0,0]
@old_level = @level
@old_equipment_id = [0,0,0,0,0]
x_setup(actor_id)
end

#--------------------------------------------------------------------------
# ● 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

attr_accessor :tool_id
attr_accessor :tool_effect
attr_accessor :target
attr_accessor :target2
attr_accessor :old_x
attr_accessor :old_y
attr_accessor :pre_x
attr_accessor :pre_y
attr_accessor :temp_id
attr_accessor :angle
attr_accessor :force_action_times
attr_accessor :force_action
attr_accessor :move_frequency
attr_accessor :move_speed
attr_accessor :direction_fix
attr_accessor :walk_anime
attr_accessor :step_anime
attr_accessor :x
attr_accessor :y
attr_accessor :pattern
attr_accessor :pattern_count
attr_accessor :jump_count
attr_accessor :jump_peak
attr_accessor :dash_active
attr_accessor :direction
attr_accessor :through
attr_accessor :bush_depth
attr_accessor :blend_type
attr_accessor :priority_type
attr_accessor :jump_count
attr_accessor :zoom_x
attr_accessor :zoom_y
attr_accessor :stop
attr_accessor :force_update
attr_accessor :treasure_time
attr_accessor :treasure_float
attr_accessor :can_update
attr_accessor :pre_move_speed
attr_accessor :knock_back_duration
attr_accessor :orig_pos_x
attr_accessor :orig_pos_y
attr_accessor :shoot_time
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_initialize initialize
def initialize
x_initialize
@tool_id = 0
@tool_effect = ""
@target = false
@target2 = nil
@old_x = @x
@old_y = @y
@pre_x = @x
@pre_y = @y
@orig_pos_x = @x
@orig_pos_y = @y
@Angle = 0
@force_action_times = 0
@force_action = ""
@dash_active = false
@zoom_x = 1.00
@zoom_y = 1.00
@stop = false
@force_update = false
@treasure_time = 0
@treasure_float = [0,0,0,0]
@can_update = true
@temp_id = 0
@pre_move_speed = @move_speed
@shoot_time = [0,0]
end

#--------------------------------------------------------------------------
# ● 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

#===============================================================================
# ■ Game_Event
#===============================================================================
class Game_Event < Game_Character
attr_accessor :target
attr_reader :name
attr_accessor :collision_attack

#--------------------------------------------------------------------------
# ● 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

#--------------------------------------------------------------------------
# ● Setup Initial Membes
#--------------------------------------------------------------------------
def 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

attr_accessor :diagonal
attr_accessor :diagonal_direction
attr_accessor :sprite_angle_enable
attr_accessor :diagonal_time

#--------------------------------------------------------------------------
# ● 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

#--------------------------------------------------------------------------
# ● moving 2?
#--------------------------------------------------------------------------
def moving2?
@real_x != @x || @real_y != @y
end

#--------------------------------------------------------------------------
# ● 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

#--------------------------------------------------------------------------
# ● Check XY
#--------------------------------------------------------------------------
def check_xy
@pre_x = @x
@pre_y = @y
end

#--------------------------------------------------------------------------
# ● 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

#--------------------------------------------------------------------------
# ● Jump_high
#--------------------------------------------------------------------------
def jump_high(x_plus,y_plus,high = 10)
@x += x_plus
@y += y_plus
distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
@jump_peak = high + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
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

#--------------------------------------------------------------------------
# ● Update Action Command
#--------------------------------------------------------------------------
def update_action_command
update_check_battler_equipment if can_check_battler_equipment?
update_dash_button
update_auto_target_shoot
update_combo_time
update_action_1_button
update_action_2_button
update_skill_button
update_item_button
update_change_leader_button
update_charge_button
end

#--------------------------------------------------------------------------
# ● 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

#--------------------------------------------------------------------------
# ● Update Check Battler Equipment
#--------------------------------------------------------------------------
def update_check_battler_equipment

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

#--------------------------------------------------------------------------
# ● Update Dash Command
#--------------------------------------------------------------------------
def update_dash_button
return unless can_dash?
@dash_active = true
@anime_count -= 0.5 if moving?
update_dash_sprite_name
end

#--------------------------------------------------------------------------
# ● Update Dash Sprite Name
#--------------------------------------------------------------------------
def update_dash_sprite_name
make_pose("_Dash", 2)
end

end


#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ TOOL - INITIALIZE
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ Game_Map
#===============================================================================
class Game_Map

attr_accessor :need_refresh_token

#--------------------------------------------------------------------------
# ● need_add_tokens
#--------------------------------------------------------------------------
def need_add_tokens
@need_add_tokens = [] if @need_add_tokens == nil
return @need_add_tokens
end

#--------------------------------------------------------------------------
# ● need_remove_tokens
#--------------------------------------------------------------------------
def need_remove_tokens
@need_remove_tokens = [] if @need_remove_tokens == nil
return @need_remove_tokens
end

#--------------------------------------------------------------------------
# ● add_token
#--------------------------------------------------------------------------
def add_token(token_event)
$game_temp.tool_event = [] if $game_temp.tool_event == nil
$game_temp.tool_event.push(token_event)
self.need_add_tokens.push(token_event)
self.need_refresh_token = true
end

#--------------------------------------------------------------------------
# ● remove_token
#--------------------------------------------------------------------------
def remove_token(token_event)
@events.delete(token_event.id)
self.need_remove_tokens.push(token_event)
self.need_refresh_token = true
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

#--------------------------------------------------------------------------
# ● Execute Toll Effects Hash
#--------------------------------------------------------------------------
def execute_tool_effects_hash(i)

end
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

#===============================================================================
# ■ XRXS_CTS_RefreshToken
#===============================================================================
module XRXS_CTS_RefreshToken

#--------------------------------------------------------------------------
# ● 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


#===============================================================================
# ■ XRXS_ActionTemplate
#===============================================================================
module XRXS_ActionTemplate
map_id = XAS_SYSTEM::ACTION_TEMPLATE_MAP_ID
map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
@@events = map.events
end

#===============================================================================
# ■ Token_Event
#===============================================================================
class Token_Event < Game_Event
include XRXS_ActionTemplate
end

#===============================================================================
# ■ Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :active_token
end



#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ TOOL - SHOOT COMMAND
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ XAS ACTION
#===============================================================================
module XAS_ACTION
attr_reader :action
attr_reader :erased

#--------------------------------------------------------------------------
# ● shoot
#--------------------------------------------------------------------------
def shoot(action_id = 0)
return if action_id == 0
skill = $data_skills[action_id]
return unless can_shoot?(skill)
execute_user_effects(skill)
execute_call_event(action_id)
self.action_attachment(action_id)
execute_set_pose(action_id)
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

#--------------------------------------------------------------------------
# ● enough_skill_cost?
#--------------------------------------------------------------------------
def enough_skill_cost?(skill)
return false unless enough_mp_cost?(skill)
return false unless enough_item_cost?(skill)
return true
end

#--------------------------------------------------------------------------
# ● Enough MP Cost
#--------------------------------------------------------------------------
def enough_mp_cost?(skill)
if @force_action_times > 0
return true if @force_action == "All Shoot"
return true if @force_action == "Four Shoot"
return true if @force_action == "Three Shoot"
return true if @force_action == "Two Shoot"
end
if self.battler.mp < skill.mp_cost
self.battler.damage = XAS_WORD::NO_MP
self.battler.damage_pop = true
return false
else
self.battler.mp -= skill.mp_cost
return true
end
return true
end

#--------------------------------------------------------------------------
# ● Enough MP Cost
#--------------------------------------------------------------------------
def enough_item_cost?(skill)
return true if self.battler.is_a?(Game_Enemy)
if @force_action_times > 0
return true if @force_action == "All Shoot"
return true if @force_action == "Four Shoot"
return true if @force_action == "Three Shoot"
return true if @force_action == "Two Shoot"
end
skill.note =~ /<Item Cost = (\d+)>/
item_id = $1.to_i
if item_id != nil and item_id != 0
item_cost = $data_items[item_id]
number = $game_party.item_number(item_cost)
if number == 0 or number == nil
self.battler.damage = XAS_WORD::NO_ITEM
self.battler.damage_pop = true
return false
else
$game_party.lose_item(item_cost, 1, false)
return true
end
end
return true
end

#--------------------------------------------------------------------------
# ● Execute User Effects
#--------------------------------------------------------------------------
def execute_user_effects(skill)
self.battler.shield = false
#Animation
if skill.note =~ /<Cast Ani = (\d+)>/
ani_id = $1.to_i
if ani_id != nil
self.animation_id = ani_id
end
end
unless @force_action_times > 0
#All Directions
if skill.note =~ /<All Directions>/
@force_action = "All Shoot"
@force_action_times = 8
elsif skill.note =~ /<Four Directions>/
@force_action = "Four Shoot"
@force_action_times = 4
elsif skill.note =~ /<Three Directions>/
@force_action = "Three Shoot"
@force_action_times = 3
elsif skill.note =~ /<Two Directions>/
@force_action = "Two Shoot"
@force_action_times = 2
end
end
end

#--------------------------------------------------------------------------
# ● Execute Set Pose
#--------------------------------------------------------------------------
def execute_set_pose(action_id)
@action.duration = @action.sunflag
make_pose(@action.self_motion, @action.sunflag )
@pattern = 0
@pattern_count = 0
@step_anime = true
@self_motion = nil
self.need_refresh = true if self.is_a?(Game_Player)
end

#--------------------------------------------------------------------------
# ● execute_call_event
#--------------------------------------------------------------------------
def execute_call_event(action_id)
bullet_token = Token_Bullet.new(self, action_id)
$game_map.add_token(bullet_token)
return bullet_token
end

#--------------------------------------------------------------------------
# ● action_attachment
#--------------------------------------------------------------------------
def action_attachment(action_id)
@action = Game_Action_XAS.new(self, action_id)
@action.attachment(action_id)
end

end


#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ TOOL - SHOOT SETTING
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ Game_Action_XAS
#===============================================================================
class Game_Action_XAS

attr_accessor :user
attr_accessor :id
attr_accessor :attack_id
attr_accessor :attack_range
attr_accessor :attack_range_type
attr_accessor :hit_events
attr_accessor :now_count
attr_accessor :pre_now_count
attr_accessor :duration
attr_accessor :blow_power
attr_accessor :piercing
attr_accessor :ignore_knockback_invincible
attr_accessor :target_invunerable_duration
attr_accessor :multi_hit
attr_accessor :ally_damage
attr_accessor :all_damage
attr_accessor :sunflag
attr_accessor :self_motion
attr_accessor :second_animation_id
attr_accessor :third_animation_id
attr_accessor :attack_range_type
attr_accessor :attack_range_plan
attr_accessor :blow_power
attr_accessor :ignore_guard
attr_accessor :user_invincible
attr_accessor :short_range
attr_accessor :first_impact_time
attr_accessor :animation_time
attr_accessor :duration
attr_accessor :item_cost
attr_accessor :hit_shake
attr_accessor :hit_hold_target
attr_accessor :hit_bounce
attr_accessor :sticky
attr_accessor :reflectable
attr_accessor :can_reflect
attr_accessor :attack_id_plan
attr_accessor :hit_action
attr_accessor :fake_id
attr_accessor :impact

#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize(user, action_id)
@user = user
@id = action_id
@now_count = 0
@duration = nil
@attack_id = 0
@attack_range = 0
@hit_events = []
@blow_power = 0
@skill = $data_skills[action_id]
@ignore_knockback_invincible = false
@multi_hit = false
@piercing = false
@all_damage = false
@ally_damage = false
@ignore_guard = false
@sunflag = 10
@duration = 10
@self_motion = ""
@attack_range_type = 1
@attack_range_plan = 1
@blow_power = 1
@first_impact_time = 0
@animation_time = []
@target_invunerable_duration = 10
@second_animation_id = 0
@third_animation_id = 0
@user_invincible = false
@short_range = false
@item_cost = 0
@hit_shake = false
@hit_hold_target = false
@hit_bounce = false
@sticky = false
@reflectable = false
@can_reflect = false
@hit_action = 0
@fake_id = false
@impact = true
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 Reflectable Skills
#--------------------------------------------------------------------------
def check_reflectable_skills(attacker, attack_id)
return if self.tool_id == 0
return unless self.action.reflectable
return unless attacker.action.can_reflect
self.action.user = attacker.action.user
self.action.hit_events = []
self.turn_back
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

#--------------------------------------------------------------------------
# ● Execute Take Treasure
#--------------------------------------------------------------------------
def execute_take_treasure(attacker, attack_id)
tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
return if self.treasure_time > tr_time
self.x = $game_player.x
self.y = $game_player.y
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

end

#===============================================================================
# ■ XAS_Dispose
#===============================================================================
module XAS_Dispose

#--------------------------------------------------------------------------
# ● 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

#===============================================================================
# ■ XAS_StopToAction
#===============================================================================
module XAS_StopToAction

#--------------------------------------------------------------------------
# ● 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
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ XRXS_BattlerAttachment
#==============================================================================
module XRXS_BattlerAttachment

#--------------------------------------------------------------------------
# ● 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

#--------------------------------------------------------------------------
# ● Execute Tool Effects
#--------------------------------------------------------------------------
def execute_tool_effects(skill, bullet , user)
execute_sticky_effect(skill, bullet, user)
execute_bounce_effect(skill, bullet, user)
execute_hit_action_effect(skill, bullet, user)
end

#--------------------------------------------------------------------------
# ● Remove Tool After Hit?
#--------------------------------------------------------------------------
def remove_tool_after_hit?(skill, bullet, user)
return true if bullet.action.piercing == false
return false
end

#--------------------------------------------------------------------------
# ● Execute Battler Skill Effect
#--------------------------------------------------------------------------
def execute_battler_skill_effect(attacker ,skill, user)
self.battler.item_apply(attacker, skill)
end

#--------------------------------------------------------------------------
# ● Target Missed?
#--------------------------------------------------------------------------
def target_missed?(attacker)
if self.battler.result.missed
self.battler.damage = XAS_WORD::MISSED
self.battler.damage_pop = true
return true
end
if self.battler.result.evaded
self.battler.damage = XAS_WORD::EVADED
self.battler.damage_pop = true
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Shoot Effect Before Damage
#--------------------------------------------------------------------------
def shoot_effect_before_damage(skill, bullet, user)
end

#--------------------------------------------------------------------------
# ● Shoot Effect After Damage
#--------------------------------------------------------------------------
def shoot_effect_after_damage(skill, bullet, user)
check_counter_attack(skill)
self.battler.passive = false
end

#--------------------------------------------------------------------------
# ● Shoot Effect After Damage
#--------------------------------------------------------------------------
def check_counter_attack(skill)
return if self.battler.is_a?(Game_Actor)
return if self.battler.counter_action[2] == false
return if self.battler.counter_action[1] > 0
counter = XAS_BA_ENEMY::COUNTER_ATTACK[self.battler.enemy_id]
if counter != nil
counter_action_id = counter[rand(counter.size)]
self.battler.counter_action[0] = counter_action_id
self.battler.counter_action[1] = 15
end
end

#--------------------------------------------------------------------------
# ● Execute Bounce Effect
#--------------------------------------------------------------------------
def execute_bounce_effect(skill, bullet, user)
return false if bullet.action.hit_bounce == false
bullet.bounce_direction
end

#--------------------------------------------------------------------------
# ● Execute Stick Effect
#--------------------------------------------------------------------------
def execute_sticky_effect(skill, bullet, user)
return unless bullet.action.sticky
return if bullet.temp_id != 0
bullet.pre_move_speed = bullet.move_speed
bullet.temp_id = self.id
end

#--------------------------------------------------------------------------
# ● Execute Hit Action Effect
#--------------------------------------------------------------------------
def execute_hit_action_effect(skill, bullet, user)
return if bullet.action.hit_action == 0
self.battler.invunerable_duration = 1
bullet.shoot(bullet.action.hit_action)
bullet.action.duration = 9
bullet.action.multi_hit = false
bullet.character_name = ""
bullet.x_pose_duration = 0
bullet.x_pose_name = ""
bullet.x_pose_original_name = ""
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

#--------------------------------------------------------------------------
# ● Execute Animation
#--------------------------------------------------------------------------
def execute_animation(skill, bullet, user)
self.animation_id = skill.animation_id
tool_animation = bullet.action.second_animation_id
user_animation = bullet.action.third_animation_id
bullet.animation_id = tool_animation if tool_animation != 0
user.animation_id = user_animation if user_animation != 0
end

#--------------------------------------------------------------------------
# ● Knock Back Disable
#--------------------------------------------------------------------------
def knock_back_disable
return false
end

#--------------------------------------------------------------------------
# ● Dead?
#--------------------------------------------------------------------------
def dead?
return self.battler == nil ? false : self.battler.dead?
end

end


#===============================================================================
# ■ XRXS_BattlerAttachment
#==============================================================================
module XRXS_BattlerAttachment

#--------------------------------------------------------------------------
# ● 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

end



#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ TOOL - EQUIP
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#==============================================================================
# ■ 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
#------------------------------------------


#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ BATTLER - INITIALIZE
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ 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

#--------------------------------------------------------------------------
# ● Reset Enemies Parameters
#--------------------------------------------------------------------------
def reset_enemies_parameters(enemy)
enemy.battler.cast_action[0] = 0
enemy.battler.cast_action[1] = 0
enemy.battler.cast_action[2] = 0
enemy.battler.cast_action[3] = 0
enemy.battler.cast_action[4] = 0
enemy.battler.counter_action[0] = 0
enemy.battler.counter_action[1] = 0
enemy.battler.counter_action[2] = true
enemy.battler.invunerable_duration = 0
enemy.knock_back_duration = nil
end

#--------------------------------------------------------------------------
# ● Reset Members Parameters
#--------------------------------------------------------------------------
def reset_members_parameters(ally)
ally.old_level = ally.level
ally.shield = false
ally.x_charge_action[0] = 0
ally.x_charge_action[1] = 0
ally.x_charge_action[2] = 0
ally.x_charge_action[3] = 0
ally.cast_action[0] = 0
ally.cast_action[1] = 0
ally.cast_action[2] = 0
ally.cast_action[3] = 0
ally.cast_action[4] = 0
ally.counter_action[0] = 0
ally.counter_action[1] = 0
ally.counter_action[2] = true
ally.invunerable_duration = 0
end

#--------------------------------------------------------------------------
# ● Reset Player Parameters
#--------------------------------------------------------------------------
def reset_player_parameters
make_pose("", 1) unless $game_player.action != nil
$game_temp.xas_target_time = 0
$game_temp.xas_target_shoot_id = 0
$game_temp.xas_target_x = 0
@knock_back_duration = nil
@dash_active = false
end


#--------------------------------------------------------------------------
# ● Reset Members Parameters Running
#--------------------------------------------------------------------------
def reset_members_parameters_running(ally)
ally.old_level = ally.level
ally.shield = false
unless ally.x_charge_action[1] > 0
ally.x_charge_action[0] = 0
ally.x_charge_action[1] = 0
ally.x_charge_action[2] = 0
ally.x_charge_action[3] = 0
end
unless ally.cast_action[1] > 0
ally.cast_action[0] = 0
ally.cast_action[1] = 0
ally.cast_action[2] = 0
ally.cast_action[3] = 0
ally.cast_action[4] = 0
end
ally.counter_action[0] = 0
ally.counter_action[1] = 0
ally.counter_action[2] = true
ally.invunerable_duration = 0
end

#--------------------------------------------------------------------------
# ● Reset Player Parameters Running
#--------------------------------------------------------------------------
def reset_player_parameters_running
$game_temp.xas_target_time = 0
$game_temp.xas_target_shoot_id = 0
$game_temp.xas_target_x = 0
@knock_back_duration = nil
@dash_active = false
end

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

#--------------------------------------------------------------------------
# ● Battler Recheck
#--------------------------------------------------------------------------
def enemy_id
return @enemy_id
end

#--------------------------------------------------------------------------
# ● body_size
#--------------------------------------------------------------------------
def body_size
if self.battler != nil
return self.battler.body_size
else
return 0
end
end

end


#===============================================================================
# ■ Game_Battler
#===============================================================================
class Game_Battler
attr_accessor :sensor_range
attr_accessor :body_size
attr_accessor :breath_effect
attr_accessor :breath_duration
attr_accessor :fast_breath_effect
attr_accessor :no_knockback
attr_accessor :passive
attr_accessor :attack_animation_id
attr_accessor :ignore_guard
attr_accessor :no_damage_pop

#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_e_initialize initialize
def initialize
x_e_initialize
@sensor_range = 4
@body_size = 0
@breath_effect = false
@breath_duration = 0
@fast_breath_effect = false
@no_knockback = false
@passive = false
@attack_animation_id = 0
@ignore_guard = false
@no_damage_pop = false
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


end


#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ BATTLER - EVENT SENSOR
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ XRXS_Enemy_Sensor
#===============================================================================
module XRXS_EnemySensor

#--------------------------------------------------------------------------
# ● 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

#--------------------------------------------------------------------------
# ● refresh_sensor
#--------------------------------------------------------------------------
def refresh_sensor
touch_attack(false)
key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
$game_self_switches[key] = false
@pattern = 0
@pattern_count = 0
self.refresh
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



#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ BATTLER - ACTION
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ 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

#--------------------------------------------------------------------------
# ● Reset Battler Temp
#--------------------------------------------------------------------------
def reset_battler_temp
reset_cast_temp
reset_charge_temp
end

#--------------------------------------------------------------------------
# ● Reset Charge Temp
#--------------------------------------------------------------------------
def reset_charge_temp
return if self.battler == nil
return if self.battler.is_a?(Game_Enemy)
self.battler.x_charge_action[0] = 0
self.battler.x_charge_action[1] = 0
self.battler.x_charge_action[2] = 0
self.battler.x_charge_action[3] = 0
end

#--------------------------------------------------------------------------
# ● Reset Battler Temp
#--------------------------------------------------------------------------
def reset_cast_temp
return if self.battler == nil
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
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

#--------------------------------------------------------------------------
# ● Update Attacking
#--------------------------------------------------------------------------
def update_battler_attacking
return unless can_update_attacking?
make_pose("_Atk", 2)
end

#--------------------------------------------------------------------------
# ● Can Update Attacking
#--------------------------------------------------------------------------
def can_update_attacking?
return false if self.battler.is_a?(Game_Actor)
return false if @collision_attack == false
return true
end

#--------------------------------------------------------------------------
# ● Update Battler Knobacking
#--------------------------------------------------------------------------
def update_battler_knockbacking
return unless self.knockbacking?
@pattern = 0
@knock_back_duration -= 1 if can_remove_knockback?
make_pose("_Hit", 2)
if self.is_a?(Game_Event)
@collision_attack = false
end
if @knock_back_duration <= 0
@knock_back_duration = nil
make_pose("", 0)
touch_attack(false) if self.is_a?(Game_Event)
@character_name = @x_pose_original_name
end
end

#--------------------------------------------------------------------------
# ● Can Remove Knockback
#--------------------------------------------------------------------------
def can_remove_knockback?
return true
end

#--------------------------------------------------------------------------
# ● knockbacking?
#--------------------------------------------------------------------------
def knockbacking?
return false if self.battler == nil
return false if @stop
return true if @knock_back_duration != nil
return false
end

#--------------------------------------------------------------------------
# ● collapsing?
#--------------------------------------------------------------------------
def collapsing?
return self.collapse_duration.to_i > 0
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

end

#===============================================================================
# ■ XAS_DamageStop
#===============================================================================
module XAS_DamageStop

#--------------------------------------------------------------------------
# ● 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



#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ BATTLER - TOUCH EFFECT
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ XRXS_BattlerAttachment
#==============================================================================
module XRXS_BattlerAttachment

#--------------------------------------------------------------------------
# ● 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 Damage
#--------------------------------------------------------------------------
def execute_attack_damage(attacker)
#if self.battler.agi > (rand(attacker.battler.agi) * 2)
# self.battler.result.missed = true
# return
#end
damage = ((attacker.battler.atk * 4) - (self.battler.def * 2)).truncate
damage = 0 if damage < 0
self.battler.result.hp_damage = damage
#self.battler.result.critical
self.battler.hp -= damage.abs
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

#--------------------------------------------------------------------------
# ● Execute Attack Effect Before Damage
#--------------------------------------------------------------------------
def execute_attack_effect_before_damage(attacker)

end

#--------------------------------------------------------------------------
# ● Execute Attack Effect After Damage
#--------------------------------------------------------------------------
def execute_attack_effect_after_damage(attacker)

end

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



#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ BATTLER - MOVE SPEED
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Character < Game_CharacterBase

include XAS_BA
attr_accessor :base_move_speed
attr_accessor :dash_move_speed
attr_accessor :move_speed

#~ #--------------------------------------------------------------------------
#~ # ● Initialize
#~ #--------------------------------------------------------------------------
#~ alias x_move_speed_initialize initialize
#~ def initialize
#~ @base_move_speed = BASE_MOVE_SPEED
#~ @dash_move_speed = 0
#~ x_move_speed_initialize
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● update_battler_move_speed
#~ #--------------------------------------------------------------------------
#~ def update_battler_move_speed
#~ @dash_move_speed = @dash_active ? DASH_MOVE_SPEED : 0
#~ sp1 = @base_move_speed
#~ sp2 = @dash_move_speed
#~ sp3 = self.battler.state_move_speed
#~ @move_speed = (sp1 + sp2 + sp3)
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update Animation
#~ #--------------------------------------------------------------------------
#~ def update_animation
#~ super
#~ update_force_move_routine_move
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update Force Move Routine Move
#~ #--------------------------------------------------------------------------
#~ def update_force_move_routine_move
#~ return if @force_action == ""
#~ return if @move_route == nil
#~ command = @move_route.list[@move_route_index]
#~ return if command == nil
#~ if command.code == ROUTE_PLAY_SE
#~ params = command.parameters
#~ params[0].play
#~ advance_move_route_index
#~ end
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update Routine Move
#~ #--------------------------------------------------------------------------
#~ alias x_update_routine_move update_routine_move
#~ def update_routine_move
#~ return if @force_action_times > 0
#~ x_update_routine_move
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Can Cancel Move Type Custom
#~ #--------------------------------------------------------------------------
#~ alias x_move_speed_process_move_command process_move_command
#~ def process_move_command(command)
#~ return if can_cancel_move_type_custom?(command)
#~ params = command.parameters
#~ x_move_speed_process_move_command(command)
#~ if command.code == ROUTE_CHANGE_SPEED and @battler != nil and
#~ self.is_a?(Game_Event)
#~ @base_move_speed = params[0]
#~ end
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Can Cancel Move Type Custom
#~ #--------------------------------------------------------------------------
#~ def can_cancel_move_type_custom?(command)
#~ return true if command == nil
#~ return true if @force_action_times > 0
#~ return false
end
#~



#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character

#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_move_speed_event_initialize initialize
def initialize(map_id, event)
x_move_speed_event_initialize(map_id, event)
refresh_move_speed
end

#--------------------------------------------------------------------------
# ● Refresh Move Speed
#--------------------------------------------------------------------------
def refresh_move_speed
return if @page == nil
@base_move_speed = @page.move_speed
end

#--------------------------------------------------------------------------
# ● Setup Page
#--------------------------------------------------------------------------
alias x_move_speed_setup_page setup_page
def setup_page(new_page)
x_move_speed_setup_page(new_page)
refresh_move_speed
end

end


#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ BATTLER - STATES
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler

attr_accessor :state_move_speed
attr_accessor :state_stop
attr_accessor :state_loop_effect_time
attr_accessor :state_loop_speed
attr_accessor :state_duration
attr_accessor :state_string
attr_accessor :state_string_time
attr_accessor :state_stop
attr_accessor :state_slow
attr_accessor :state_sleep
attr_accessor :state_invunerable
attr_accessor :state_fast
attr_accessor :state_mute
attr_accessor :state_seal_attack
attr_accessor :state_seal_skill
attr_accessor :state_seal_item
attr_accessor :state_reflect

#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias x_state_initialize initialize
def initialize
@state_move_speed = 0
@state_duration = []
@state_loop_effect_time = []
@state_loop_speed = []
@state_string = ""
@state_string_time = 0
@state_stop = false
@state_sleep = false
@state_invunerable = false
@state_slow = false
@state_fast = false
@state_mute = false
@state_seal_attack = false
@state_seal_skill = false
@state_seal_item = false
@state_reflect = false
x_state_initialize
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

end

#--------------------------------------------------------------------------
# ● Update Pre State Setup
#--------------------------------------------------------------------------
def update_pre_state_setup
self.battler.state_stop = false
self.battler.state_slow = false
self.battler.state_fast = false
self.battler.state_mute = false
self.battler.state_sleep = false
self.battler.state_invunerable = false
self.battler.state_seal_attack = false
self.battler.state_seal_skill = false
self.battler.state_seal_item = false
self.battler.state_reflect = false
self.battler.state_move_speed = 0
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

#--------------------------------------------------------------------------
# ● Execute States Slip Damage
#--------------------------------------------------------------------------
def execute_state_slip_damage(damage)
damage = 1 if damage == nil
#damage_slip = self.battler.mhp * damage / 100
damage_slip = damage
self.battler.hp -= damage_slip
self.battler.damage = damage_slip
self.battler.damage_pop = true
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

end



#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ BATTLER - EVENT COMMANDS
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ 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

end

#===============================================================================
# ■ XAS_BA_BATTLEEVENT_NONPREEMPT
#==============================================================================
module XAS_BA_BATTLEEVENT_NONPREEMPT

#--------------------------------------------------------------------------
# ● 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 Enemy Defeaed Process
#--------------------------------------------------------------------------
def execute_enemy_defeated_process
self.battler.defeated = true
self.through = true
@knock_back_duration = 121
enemy = $data_enemies[self.battler.enemy_id]
@collapse_duration = 120
execute_gain_exp_gold(enemy)
execute_active_switch(enemy)
execute_defeated_animation(enemy)
execute_defeated_sound_effect(enemy)
execute_final_shoot(enemy)
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

#--------------------------------------------------------------------------
# ● Exeute Change leader Effect
#--------------------------------------------------------------------------
def execute_change_leader_effect
actor = $game_party.members[0]
actor.invunerable_duration = XAS_BA::CHANGE_LEADER_WAIT_TIME
actor.damage = nil
actor.damage_pop = false
actor.critical = false
@knock_back_duration = nil
if self.action != nil
self.action.duration = 1
end
@force_action_times = 0
@force_action_type = ""
reset_old_level(true)
@x_pose_original_name = @character_name
update_battler_pose
$game_map.need_refresh = true
self.animation_id = XAS_ANIMATION::CHANGE_LEADER_ANIMATION_ID
$game_temp.change_leader_wait_time = XAS_BA::CHANGE_LEADER_WAIT_TIME
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

#--------------------------------------------------------------------------
# ● Update Collapse Effects
#--------------------------------------------------------------------------
def update_collaspse_effects
update_collapse_duration
return unless can_collapse_effects?
update_collpase_zoom_effects
update_exp_gold_pop
end

#--------------------------------------------------------------------------
# ● Can Collapse Effects
#--------------------------------------------------------------------------
def can_collapse_effects?
return false if @character.battler.is_a?(Game_Actor)
return false unless @character.dead?
return false if @character.erased
return true
end

#--------------------------------------------------------------------------
# ● Update Exp Gold Pop
#--------------------------------------------------------------------------
def update_exp_gold_pop
return unless XAS_DAMAGE_POP::DAMAGE_EXP_GOLD_POP
exp_pop = @character.battler.exp
gold_pop [email protected]
case @character.collapse_duration
when 110
enemy = $data_enemies[@character.battler.enemy_id]
@character.make_treasure(enemy)
when 80
if exp_pop != 0
word = XAS_WORD::EXP
@character.battler.damage = word + " " + exp_pop.to_s
@character.battler.damage_pop = true
@character.battler.damage_type = "Exp"
end
when 40
if gold_pop != 0
word = $data_system.currency_unit
@character.battler.damage = word + " " + gold_pop.to_s
@character.battler.damage_pop = true
@character.battler.damage_type = "Gold"
end
end
end

#~ #--------------------------------------------------------------------------
#~ # ● Update Collapse Duration
#~ #--------------------------------------------------------------------------
def update_collapse_duration
@character.collapse_duration -= 1
@character.opacity -= 2
if @character.collapse_duration <= 0
if @character.battler.is_a?(Game_Actor)
SceneManager.goto(Scene_Gameover)
return
end
self.visible = false
@character.opacity = 0
@character.erase
end
end

#--------------------------------------------------------------------------
# ● Update Collapse Zoom Effects
#--------------------------------------------------------------------------
def update_collpase_zoom_effects
case @character.battler.death_zoom_effect
when 1
@character.zoom_y += 0.05
@character.zoom_x -= 0.01
when 2
@character.zoom_y -= 0.01
@character.zoom_x += 0.03
when 3
@character.zoom_y += 0.03
@character.zoom_x += 0.03
when 4
@character.zoom_y -= 0.005
@character.zoom_x -= 0.005
when 5
case @character.collapse_duration
when 60..120
@character.zoom_y -= 0.01
@character.zoom_x += 0.06
when 0..59
@character.zoom_y += 0.2
@character.zoom_x -= 0.1
end
end
end

end



#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#■ BATTLER - TREASURE
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


#===============================================================================
# ■ XAS_BA_Item_Drop
#==============================================================================
module XAS_BA_ItemDrop

#--------------------------------------------------------------------------
# ● Defeat Process
#--------------------------------------------------------------------------
def make_treasure(enemy)
treasure = nil
return unless $game_player.passable?(self.x,self.y,0)
for di in enemy.drop_items
next if di.kind == 0
next if rand(di.denominator) != 0
if di.kind == 1
treasure = $data_items[di.data_id]
tr_id = treasure.id
elsif di.kind == 2
treasure = $data_weapons[di.data_id]
tr_id = treasure.id
elsif di.kind == 3
treasure = $data_armors[di.data_id]
tr_id = treasure.id
end
break if treasure != nil
end
if treasure != nil
command = RPG::MoveCommand.new
command.code = 14
command.parameters = [0,0]
route = RPG::MoveRoute.new
route.repeat = false
route.list = [command, RPG::MoveCommand.new]
page = RPG::Event::Page.new
page.move_type = 3
page.move_route = route
page.move_frequency = 6
page.priority_type = 1
page.trigger = 1
page.through = true
event = RPG::Event.new(self.x, self.y)
event.pages =

评分

参与人数 2星屑 +210 收起 理由
Vortur + 10 今天最后的糖
熊喵酱 + 200 精品文章 不過錯區了....

查看全部评分

XAS GYRO努力制造中
代码什么的最讨厌了!去改别人的才最好玩

Lv2.观梦者

梦石
0
星屑
687
在线时间
791 小时
注册时间
2011-10-20
帖子
2394

开拓者

2
发表于 2013-7-23 17:03:51 | 只看该作者
这是神马东西7000多行?

点评

没错ARPG的!!!  发表于 2013-7-23 17:15
ARPG的脚本吧  发表于 2013-7-23 17:06
欢迎点此进入我的egames.wink.ws,有RMQQ堂等

[url=http://rpg.blue/thread-317273-1-1.html]短篇八-赶选

http://yun.baidu.com/share/link?shareid=2158225779&uk=169642147&third=0


历险ARPG赢回你的疆域新的战斗模式?…………点击这里:[宋乱贼狂 for QQ堂]
http://rpg.blue/group-368-1.html
programing ....?
[url=http://rpg.blue/thrd-234658-1-1.html]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
444 小时
注册时间
2011-1-3
帖子
151

开拓者

3
发表于 2013-7-23 18:19:14 | 只看该作者
{:2_262:}话说,会继续讲解XAS的使用说明吗?

点评

那是必需的!  发表于 2013-7-23 18:22
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
120 小时
注册时间
2011-5-30
帖子
44
4
发表于 2013-7-23 19:01:17 | 只看该作者
那个。带URL的部分是啥米?全都出错。
...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
66 小时
注册时间
2013-9-4
帖子
94
5
发表于 2013-10-27 10:40:07 | 只看该作者
有连载吗?
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3298
在线时间
1120 小时
注册时间
2009-4-15
帖子
815
6
发表于 2013-10-27 10:49:38 | 只看该作者
好东西,求继续汉化共享。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
80 小时
注册时间
2015-1-17
帖子
16
7
发表于 2016-4-19 14:26:37 | 只看该作者
如何把八方向行走变成四方向行走

点评

有开关,在脚本说明部分有  发表于 2016-4-19 16:48

评分

参与人数 1星屑 -1 收起 理由
taroxd -1 请不要挖坟,有问题可以开新帖.

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1293
在线时间
995 小时
注册时间
2014-12-14
帖子
3016

开拓者

8
发表于 2016-4-19 16:46:50 | 只看该作者
就是要着个!!!!!!
【RMVA教程】
---------------------
欲买桂花同载酒,终不似,少年游.
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
80 小时
注册时间
2015-1-17
帖子
16
9
发表于 2016-4-19 19:47:09 | 只看该作者
cdwqing 发表于 2016-4-19 14:26
如何把八方向行走变成四方向行走

谢谢,大侠能说具体点吗,在哪一行,我找不到。{:2_257:}

点评

不告诉你 (^Q^)  发表于 2016-4-21 13:15
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
80 小时
注册时间
2015-1-17
帖子
16
10
发表于 2016-4-19 19:50:06 | 只看该作者
cdwqing 发表于 2016-4-19 14:26
如何把八方向行走变成四方向行走

谢谢,大侠能说具体点吗,在哪一行,我找不到。{:2_257:}
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-16 03:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表