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

Project1

 找回密码
 注册会员
搜索
查看: 814|回复: 1

[已经过期] XAS如何将玩家设置为不能被击倒

[复制链接]

Lv2.观梦者

梦石
0
星屑
287
在线时间
35 小时
注册时间
2020-2-17
帖子
61
发表于 2020-4-14 11:40:22 | 显示全部楼层 |阅读模式
67星屑
本帖最后由 daysp2 于 2020-4-14 12:17 编辑

XAS虽然是个很完善的系统,
但在我感觉很多需要的功能没有(比如真CD),其它偏门的、非arpg必须的花里胡哨功能太多...
官方使用教程似乎也没说,请问有没有会xas的大佬,玩家如何设置为不能被击倒?
被打一下就倒,感觉打起群架来手感贼不好.....

solewa Great daze

Lv3.寻梦者

梦石
0
星屑
1388
在线时间
343 小时
注册时间
2016-7-17
帖子
132
发表于 2020-4-14 21:38:26 | 显示全部楼层
我改了XAS脚本哪里不太清楚,但是击倒确实改掉了。
  1. =begin
  2. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4. ■■ X A S  - Xiderwong Action System (面向高级用户)
  5. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  7.                                                                        
  8. X - Xiderowng
  9. A - Action
  10. S - System

  11. 如果你要使用XAS,那么请贴上下面这个连接并尊重Xiderowng.
  12. http://xrxs.at-ninja.jp/

  13. 如果你要转载该汉化版本,那么注明以下来源。

  14. (脚本翻译+文档翻译+脚本修改:白雪羊圣域

  15.   BY白雪羊 6R ID:47731089 百度ID:47731089)

  16. #===============================================================================
  17. # ■ XAS HERO ACE W.S+(VER DEMO 0.5 - 2012 / 01 / 04)(汉化版本:Ver2013.7.28)                                                
  18. #===============================================================================

  19. 这里有XAS Hero Edtion的更新与支持.
  20. http://www.atelier-rgss.com/
  21. #===============================================================================
  22. # ■ Caracteristicas (主要功能)                                                           
  23. #===============================================================================
  24.    活跃争斗系统在地图(或)和互作用以场面。
  25. #===============================================================================
  26. # ■ 描述
  27. =end

  28. #===============================================================================
  29. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  30. # XAS - 设定
  31. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  32. #===============================================================================
  33. # ■ XAS SYSTEN SETTING
  34. #===============================================================================
  35. # 如果你不想要使用下面任何一个系统或脚本,或者这个系统和脚本与其他的脚本
  36. #有冲突,可以关掉它。
  37. #-------------------------------------------------------------------------------
  38. module XAS_SYSTEM
  39.   #开启伤害显示
  40.   BATTLE_SYSTEM = true
  41.   # 是否弹出伤害?
  42.   DAMAGE_POP = true
  43.   # 启用行走图名字系统?
  44.   CHARACTER_POSE_NAME = true
  45.   # 启用对角色的影响 的描绘?
  46.   CHARACTER_SPRITE_EFFECTS = true
  47.   # 启用冲刺系统?
  48.   DASH_SYSTEM = true
  49.   # 启用对角线运动么?
  50.   PLAYER_DIAGONAL_MOVEMENT  = true
  51.   # 事件启用对角线运动么?
  52.   EVENT_DIAGONAL_MOVEMENT  = true
  53.   # 状态系统是否开启呢?
  54.   STATE_SYSTEM = true
  55.   # 定义的地图,这将是事件的工具的仓库地图哦!
  56.   ACTION_TEMPLATE_MAP_ID = 3
  57.   #变量定义ID与仓库事件ID相匹配的工具,
  58.   #这个ID是用于创建互动活动的工具哦。...比如仓库事件中火球的事件ID为3
  59.   #然后建立一个事件,换上草的行走图,再新增加一个页面,设置公共变量【3】条件为3
  60.   #就可以通过火球的射击到这个事件,来触发这个事件页面的开启了。
  61.   HIT_ID = 3
  62. end

  63. #===============================================================================
  64. # ■ XAS 按钮设定
  65. #===============================================================================
  66. module XAS_BUTTON
  67.   #使用武器的按钮
  68.   ACTION_1_BUTTON = Input::C
  69.   #使用盾牌的按钮.
  70.   ACTION_2_BUTTON = Input::X
  71.   #使用技能的按钮
  72.   SKILL_BUTTON = Input::Z  
  73.   #使用道具的按钮
  74.   ITEM_BUTTON = Input::Y
  75.   #冲刺的按钮
  76.   DASH_BUTTON = Input::A
  77.   #切换领队的按钮
  78.   CHANGE_LEADER_BUTTON = Input::R
  79.   #是否使用武器按钮.
  80.   ENABLE_ACTION_1_BUTTON = true
  81.   #是否使用盾牌按钮  
  82.   ENABLE_ACTION_2_BUTTON = true
  83.   #是否使用技能按钮
  84.   ENABLE_SKILL_BUTTON = true
  85.   #是否使用道具按钮
  86.   ENABLE_ITEM_BUTTON = true
  87.   #是否使用冲刺按钮
  88.   ENABLE_DASH_BUTTON = true
  89.   #是否使用队友切换系统  
  90.   ENABLE_CHANGE_LEADER_BUTTON = false
  91. end

  92. #===============================================================================
  93. # ■ 文字设定
  94. #===============================================================================
  95. # 文字系统在 XAS的一般定义。
  96. #-------------------------------------------------------------------------------
  97. module XAS_WORD
  98.   # Ativar as palavras.
  99.   ENABLE_WORD = true
  100.   # 防御成功时显示的文字。
  101.   GUARD = "防御"
  102.   # MP不足时显示的文字。
  103.   NO_MP = "MP不足"
  104.   # 没有道具时显示的文字。
  105.   NO_ITEM = "道具不足"  
  106.   # 升级时显示的文字。
  107.   LEVEL_UP = "升级!"
  108.   # 禁止使用(道具,技能或者武器)时显示的文字。
  109.   SEAL = "禁止使用!"
  110.   # 无敌时显示的文字。
  111.   INVINCIBLE = "无敌"
  112.   # 定义“经验”的名称。
  113.   EXP = "Exp"
  114.   # 定义目标闪避时播放的文字。
  115.   EVADED = "闪避!"
  116.   # 未能命中显示的文字
  117.   MISSED = "未命中!"
  118.   # 当反击使用时,显示的文字。
  119.   COUNTER = "反击!"
  120.   # 反射成功时显示的文字。
  121.   REFLECT = "反射!"
  122. end

  123. #===============================================================================
  124. # ■ XAS 伤害
  125. #===============================================================================
  126. # 伤害系统的XAS一般定义。
  127. #-------------------------------------------------------------------------------
  128. module XAS_DAMAGE_POP
  129.   # 伤害弹出的字体
  130.   DAMAGE_FONT_NAME = "黑体"
  131.   # 字体的大小。
  132.   DAMAGE_FONT_SIZE = 22
  133.   # 启用加粗字体咩?.
  134.   DAMAGE_FONT_BOLD = true
  135.   #  启用斜体咩?
  136.   DAMAGE_FONT_ITALIC = true
  137.   # 暴击时,伤害字体放大咩?
  138.   DAMAGE_CRITICAL_ZOOM = true
  139.   # 伤害弹出,显示金钱和经验咩?
  140.   DAMAGE_EXP_GOLD_POP = true  
  141.   # 状态获得时,是否弹出状态名显示呢?
  142.   DAMAGE_STATE_POP = true
  143.   # 道具获得时,是否弹出道具名显示咩?
  144.   DAMAGE_ITEM_POP = true
  145.   # 设置默认的字体颜色
  146.   DAMAGE_DEFAULT_FONT_COLOR = Color.new(255, 255, 255)
  147.   # 设置弹出 经验 文字的字体颜色
  148.   DAMAGE_EXP_FONT_COLOR = Color.new(0, 255, 100)
  149.   # 设置弹出 金币 文字的字体颜色
  150.   DAMAGE_GOLD_FONT_COLOR = Color.new(255, 255, 50)
  151.   # 设置弹出 道具 文字的字体颜色
  152.   DAMAGE_ITEM_FONT_COLOR = Color.new(155, 55, 250)
  153. end

  154. #===============================================================================
  155. # ■ 声音设定
  156. #===============================================================================
  157. # Definição do sistema de sons do XAS.
  158. #-------------------------------------------------------------------------------
  159. module XAS_SOUND
  160.   #接到掉落的道具时的音效  
  161.   ITEM_DROP = "Key"
  162.   #升级时的音效
  163.   LEVEL_UP = "Chime1"
  164.   #消耗行为的效果,比如消耗道具之类的.
  165.   ACTION_COST = "Cusor2"
  166. end

  167. #===============================================================================
  168. # ■ 动画设定
  169. #===============================================================================
  170. # 动画系统XAS的定义。
  171. # 如果你不想使用动画,将值设置为0(零)。
  172. #-------------------------------------------------------------------------------
  173. module XAS_ANIMATION
  174.   # 防御时动画
  175.   GUARD_ANIMATION_ID = 127
  176.   # 切换队长后播放的动画
  177.   CHANGE_LEADER_ANIMATION_ID = 135
  178.   # 角色无敌时的动画。
  179.   INVINCIBLE_ANIMATION_ID = 36
  180.   # 蓄力中的动画。
  181.   CHARGE_ANIMATION1_ID = 155
  182.   # 蓄力完成时的动画。
  183.   CHARGE_ANIMATION2_ID = 123
  184.   # 吟唱时显示的动画
  185.   CAST_TIME_ANIMATION_ID = 120
  186.   # 循环动画的播放速度。
  187.   LOOP_ANIMATIONS_SPEED = 60
  188.   # 反射时的动画。
  189.   REFLECT_ANIMATION_ID = 128
  190. end

  191. #===============================================================================
  192. # ■ 一般战斗设置
  193. #===============================================================================
  194. # 战斗系统XAS的一般定义
  195. #-------------------------------------------------------------------------------
  196. module XAS_BA
  197.   #交换队长后需要等待多久才能再换。
  198.   CHANGE_LEADER_WAIT_TIME = 10
  199.   #启动游戏时,HUD是否见?
  200.   #您可以启用或禁用的HUD,在事件中使用下面的代码
  201.   # $game_system.hud_visible = true
  202.   HUD_VISIBLE_AT_STARTUP = false
  203.   # 在敌人传感器范围内会被激活的独立开关。
  204.   SENSOR_SELF_SWITCH = "D"
  205.    #设置变量定义的区域激活的默认ID(就是传感器变量的ID)
  206.   DEFAULT_SENSOR_RANGE_VARIABLE_ID = 4
  207.   # 角色被击破倒地后,起身所需要的时间.
  208.   DEFAULT_KNOCK_BACK_DURATION = 60
  209.   # 被击破倒地后,是否震动屏幕。
  210.   KNOCKBACKING_SHAKE = false
  211.   #基础移动速度
  212.   BASE_MOVE_SPEED = 4.2
  213.   # 冲刺时增加的移动速度.
  214.   DASH_MOVE_SPEED = 0.6
  215.   # 是否启用八方向行走。
  216.   DIAGONAL_DURATION_ENABLE = true
  217.   # 返回四方向的时间。
  218.   #(就是说角色是斜着走的,停止操作后,行走图切换到正方向行走的时间。)
  219.   DIAGONAL_DURATION = 15
  220.   # 经验的分配方式。
  221.   # 0 - EXP 谁杀了死敌人谁得这些EXP。
  222.   # 1 - EXP 每个人都可以获得同样多的EXP。
  223.   # 2 - EXP 获得的EXP需要被平均分配到每一个队员。
  224.   EXP_TYPE = 0
  225.   #[下面是用来定义地图掉落道具的。]
  226.   # 定义宝物消失时间。(秒数吧....)
  227.   TREASURE_ERASE_TIME = 5
  228.   # 是否启用忽明忽暗的效果。
  229.   FADE_TREASURE_SPRITE = true
  230.   # 是否启用悬浮的效果。
  231.   FLOAT_TREASURE_SPRITE = true
  232.   # 修正掉落道具的位置高度。
  233.   FIX_BALLOON_POSITION = true
  234.   # 固定在离地图多少高度以上。(像素)
  235.   BALLOON_HEIGHT = 32
  236. end  

  237. #===============================================================================
  238. # ■ 敌人的设置
  239. #===============================================================================

  240. module XAS_BA_ENEMY
  241.   #定义敌人能够抵挡的技能(TOOL事件)。
  242.   #
  243.   #INVUNERABLE_ACTIONS={A#=> B,B,B,B] A => B,B,B,B],...}
  244.   #A  -  敌人的ID。
  245.   #B  -  技能的ID。
  246.   
  247.   INVUNERABLE_ACTIONS = {
  248.   6=>[39,40,41,42,43],
  249.   7=>[24,25,26,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],
  250.   8=>[1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,24,25,26],
  251.   9=>[39,40,41,42,43],
  252.   10=>[39,40,41,42,43],
  253.   11=>[39,40,41,42,43]
  254.   }
  255.   
  256.   # 敌人能够抵挡哪个方向上的攻击。
  257.   # GUARD_DIRECTIONS = { A=>[B],  A=>[B,B,B,B], ...}
  258.   # A - 敌人的ID
  259.   # B - 方向。(2,4,6,8)
  260.   #     -> 2 = 下.   -> 4 = 左.
  261.   #     -> 6 = 右.   -> 8 = 上.
  262.   
  263.   GUARD_DIRECTIONS = {
  264.   }  
  265.   
  266.   # 敌人能够反击的技能
  267.   # 按下面的格式来设置。A为敌人ID,B为技能ID。
  268.   # COUNTER_ATTACK = { A=>[B,B,B,B],  A=>[B,B,B,B], ...}
  269.   COUNTER_ATTACK = {
  270.   }
  271.   
  272. end  








  273. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  274. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  275. #■ 初始化操作
  276. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  277. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  278. #===============================================================================
  279. # ■ 游戏_队伍
  280. #===============================================================================
  281. class Game_Temp
  282.   attr_accessor :change_leader_wait_time
  283.   attr_accessor :reset_battler_time
  284.   attr_accessor :tool_event
  285.   attr_accessor :animation_garbage
  286.   
  287.   #--------------------------------------------------------------------------
  288.   # ● 初始化
  289.   #--------------------------------------------------------------------------   
  290.   alias xas_initialize initialize
  291.   def initialize
  292.       @change_leader_wait_time = 0
  293.       @reset_battler_time = 0
  294.       @tool_event = nil
  295.       @animation_garbage = []
  296.       xas_initialize
  297.   end
  298.   
  299. end

  300. #===============================================================================
  301. # ■ 游戏_系统
  302. #===============================================================================
  303. class Game_System
  304.   attr_accessor :tools_on_map
  305.   attr_accessor :old_interpreter_running
  306.   attr_accessor :hud_visible
  307.   attr_accessor :enable_hud
  308.   attr_accessor :command_enable
  309.   attr_accessor :pre_leader_id
  310.   attr_accessor :xas_battle
  311.   #--------------------------------------------------------------------------
  312.   # ● 初始化
  313.   #--------------------------------------------------------------------------   
  314.   alias x_initialize initialize
  315.   def initialize
  316.       @tools_on_map = []
  317.       @old_interpreter_running = false
  318.       @hud_visible = XAS_BA::HUD_VISIBLE_AT_STARTUP
  319.       @enable_hud = false
  320.       @command_enable  = true
  321.       @pre_leader_id = 0
  322.       @xas_battle = XAS_SYSTEM::BATTLE_SYSTEM
  323.       x_initialize
  324.   end  
  325. end  

  326. #===============================================================================
  327. # ■ 游戏_战斗者
  328. #===============================================================================
  329. class Game_Battler
  330.   attr_accessor :damage_pop
  331.   attr_accessor :damage
  332.   attr_accessor :damage_type
  333.   attr_accessor :critical
  334.   attr_accessor :invunerable_duration
  335.   attr_accessor :shield
  336.   attr_accessor :invunerable_actions
  337.   attr_accessor :guard_directions
  338.   attr_accessor :guard
  339.   attr_accessor :invunerable
  340.   attr_accessor :x_combo
  341.   attr_accessor :cast_action
  342.   attr_accessor :defeated
  343.   attr_accessor :death_zoom_effect
  344.   attr_accessor :counter_action
  345.   attr_accessor :knockback_duration
  346.   attr_accessor :hp_damage
  347.   attr_accessor :mp_damage
  348.   
  349. #--------------------------------------------------------------------------
  350. # ● 初始化
  351. #--------------------------------------------------------------------------  
  352.   alias x_initialize initialize
  353.   def initialize
  354.       @damage = 0
  355.       @damage_pop = false
  356.       @damage_type = 0
  357.       @critical = false
  358.       @invunerable_duration = 0
  359.       @shield = false
  360.       @invunerable_actions = []
  361.       @guard_directions = []
  362.       @guard = true
  363.       @invunerable = false
  364.       @x_combo = [0,-1,0]
  365.       @defeated = false
  366.       @death_zoom_effect = 0
  367.       @cast_action = [0,0,0,0,0]
  368.       @counter_action = [0,0,true]
  369.       @knockback_duration = XAS_BA::DEFAULT_KNOCK_BACK_DURATION
  370.       x_initialize
  371.   end
  372.   
  373. #--------------------------------------------------------------------------
  374. # ● 添加 无敌 行为
  375. #--------------------------------------------------------------------------     
  376. def add_inv(action_id = 0)
  377.      return if action_id == nil or action_id <= 0
  378.      return if @invunerable_actions.include?(action_id)
  379.      @invunerable_actions.push(action_id)     
  380. end

  381. #--------------------------------------------------------------------------
  382. # ● 消除 无敌 行为
  383. #--------------------------------------------------------------------------     
  384. def remove_inv(action_id = 0)
  385.      return if action_id == nil or action_id <= 0
  386.      return unless @invunerable_actions.include?(action_id)
  387.      @invunerable_actions.delete(action_id)     
  388. end
  389.    
  390. #--------------------------------------------------------------------------
  391. # ● 防御 的方向
  392. #--------------------------------------------------------------------------     
  393. def add_guard_dir(direction = 0)
  394.      return if direction == nil or direction <= 0
  395.      return if @guard_directions.include?(direction)
  396.      @guard_directions.push(direction)     
  397. end

  398. #--------------------------------------------------------------------------
  399. # ● 消除 防御 的方向
  400. #--------------------------------------------------------------------------     
  401. def remove_guard_dir(direction = 0)
  402.      return if direction == nil or direction <= 0
  403.      return unless @guard_directions.include?(direction)
  404.      @guard_directions.delete(direction)     
  405. end  

  406. end  

  407. #===============================================================================
  408. # ■ 游戏 Actor
  409. #===============================================================================
  410. class Game_Actor < Game_Battler
  411.   
  412.   attr_accessor :x_action1_id
  413.   attr_accessor :x_action2_id
  414.   attr_accessor :skill_id
  415.   attr_accessor :x_item_id
  416.   attr_accessor :x_charge_action
  417.   attr_accessor :old_equipment_id
  418.   attr_accessor :item_id
  419.   attr_accessor :old_level
  420.   attr_reader :actor_id

  421. #--------------------------------------------------------------------------
  422. # ● 计划
  423. #--------------------------------------------------------------------------   
  424. alias x_setup setup
  425. def setup(actor_id)
  426.       @x_action1_id = 0
  427.       @x_action2_id = 0
  428.       @skill_id = 0
  429.       @x_item_id = 0
  430.       @item_id = 0
  431.       @x_charge_action = [0,0,0,0]
  432.       @old_level = @level
  433.       @old_equipment_id = [0,0,0,0,0]
  434.       x_setup(actor_id)
  435. end

  436. #--------------------------------------------------------------------------
  437. # ● 显示的等级
  438. #--------------------------------------------------------------------------     
  439.   alias x_display_level_up display_level_up
  440.   def display_level_up(new_skills)
  441.       return unless $game_party.in_battle
  442.       x_display_level_up(new_skills)
  443.   end

  444. end

  445. #===============================================================================
  446. # ■ 角色
  447. #===============================================================================
  448. class Game_Character < Game_CharacterBase
  449.   
  450.   attr_accessor :tool_id
  451.   attr_accessor :tool_effect  
  452.   attr_accessor :target
  453.   attr_accessor :target2
  454.   attr_accessor :old_x
  455.   attr_accessor :old_y
  456.   attr_accessor :pre_x
  457.   attr_accessor :pre_y
  458.   attr_accessor :temp_id
  459.   attr_accessor :angle
  460.   attr_accessor :force_action_times
  461.   attr_accessor :force_action
  462.   attr_accessor :move_frequency
  463.   attr_accessor :move_speed
  464.   attr_accessor :direction_fix
  465.   attr_accessor :walk_anime
  466.   attr_accessor :step_anime
  467.   attr_accessor :x
  468.   attr_accessor :y
  469.   attr_accessor :pattern
  470.   attr_accessor :pattern_count  
  471.   attr_accessor :jump_count
  472.   attr_accessor :jump_peak
  473.   attr_accessor :dash_active
  474.   attr_accessor :direction
  475.   attr_accessor :through
  476.   attr_accessor :bush_depth  
  477.   attr_accessor :blend_type
  478.   attr_accessor :priority_type  
  479.   attr_accessor :jump_count
  480.   attr_accessor :zoom_x
  481.   attr_accessor :zoom_y
  482.   attr_accessor :stop
  483.   attr_accessor :force_update
  484.   attr_accessor :treasure_time
  485.   attr_accessor :treasure_float
  486.   attr_accessor :can_update
  487.   attr_accessor :pre_move_speed
  488.   attr_accessor :knock_back_duration
  489.   attr_accessor :orig_pos_x
  490.   attr_accessor :orig_pos_y
  491.   attr_accessor :shoot_time
  492.   #--------------------------------------------------------------------------
  493.   # ● 初始化
  494.   #--------------------------------------------------------------------------   
  495.   alias x_initialize initialize
  496.   def initialize
  497.       x_initialize
  498.       @tool_id = 0
  499.       @tool_effect = ""
  500.       @target = false
  501.       @target2 = nil
  502.       @old_x = @x
  503.       @old_y = @y
  504.       @pre_x = @x
  505.       @pre_y = @y   
  506.       @orig_pos_x = @x
  507.       @orig_pos_y = @y
  508.       @angle = 0
  509.       @force_action_times = 0
  510.       @force_action = ""
  511.       @dash_active = false
  512.       @zoom_x = 1.00
  513.       @zoom_y = 1.00
  514.       @stop = false
  515.       @force_update = false
  516.       @treasure_time = 0
  517.       @treasure_float = [0,0,0,0]
  518.       @can_update = true
  519.       @temp_id = 0
  520.       @pre_move_speed = @move_speed
  521.       @shoot_time = [0,0]
  522.   end
  523.   
  524.   #--------------------------------------------------------------------------
  525.   # ● 无敌
  526.   #--------------------------------------------------------------------------      
  527.   def invunerable(enable = false)
  528.       return if @battler == nil or @battler.dead?
  529.       @battler.invunerable = enable
  530.   end  
  531.   
  532.   #--------------------------------------------------------------------------
  533.   # ● 敌人呼吸
  534.   #--------------------------------------------------------------------------        
  535.   def fast_breath(enable = true)
  536.      return if @battler == nil or @battler.dead?
  537.      @battler.fast_breath_effect = enable
  538.   end
  539. end

  540. #===============================================================================
  541. # ■ 游戏_事件
  542. #===============================================================================
  543. class Game_Event < Game_Character
  544.   attr_accessor :target
  545.   attr_reader   :name
  546.   attr_accessor :collision_attack

  547. #--------------------------------------------------------------------------
  548. # ● 对象
  549. #--------------------------------------------------------------------------      
  550. alias x_event_initialize initialize
  551. def initialize(map_id, event)
  552.      x_event_initialize(map_id, event)
  553.      @collision_attack = false
  554.      if @event.name =~ /<O(\d+)>/i or @event.name =~ /<透(\d+)>/i
  555.         @opacity = $1.to_i  
  556.      end   
  557.      if @event.name =~ /<B(\d+)>/i or @event.name =~ /<合(\d+)>/i  
  558.         @blend_type = $1.to_i
  559.      end  
  560. end  
  561.    
  562. #--------------------------------------------------------------------------
  563. # ● 事件消除
  564. #--------------------------------------------------------------------------        
  565. alias x_event_erase erase
  566. def erase
  567.      if self.tool_id > 0
  568.         $game_system.tools_on_map.delete(self.tool_id)
  569.      end   
  570.      x_event_erase
  571. end     
  572.   
  573. #--------------------------------------------------------------------------
  574. # ● 事件名字
  575. #--------------------------------------------------------------------------
  576.   def name
  577.       return @event.name  
  578.   end   
  579.   
  580. end

  581. #===============================================================================
  582. # ■ 游戏队友
  583. #===============================================================================
  584. class Game_Followers
  585.   
  586. #--------------------------------------------------------------------------
  587. # ● 初始化
  588. #--------------------------------------------------------------------------  
  589.   alias x_party_initialize initialize
  590.   def initialize(leader)
  591.       x_party_initialize(leader)
  592.       if $xas_party_system == nil
  593.          @visible = false
  594.       end  
  595.   end  
  596. end  

  597. #===============================================================================
  598. # ■ 游戏地图
  599. #===============================================================================
  600. class Game_Map  

  601. #--------------------------------------------------------------------------
  602. # ● 设置
  603. #--------------------------------------------------------------------------  
  604.   alias x_initial_setup setup
  605.   def setup(map_id)
  606.       x_initial_setup(map_id)
  607.       xas_initial_setup(map_id)
  608.   end
  609.   
  610. #--------------------------------------------------------------------------
  611. # ● XAS 初始设置
  612. #--------------------------------------------------------------------------  
  613.   def xas_initial_setup(map_id)
  614.       for actor in $game_party.members
  615.           setup_initial_members(actor)
  616.       end  
  617.   end  
  618.    
  619. #--------------------------------------------------------------------------
  620. # ● 设置 初始成员
  621. #--------------------------------------------------------------------------   
  622.   def setup_initial_members(actor)
  623.       
  624.   end  
  625. end  


  626. #==============================================================================
  627. # ■ Scene_Map
  628. #==============================================================================
  629. class Scene_Map < Scene_Base
  630.   
  631.   #--------------------------------------------------------------------------
  632.   # ● 调用菜单
  633.   #--------------------------------------------------------------------------   
  634.   alias x_call_menu call_menu
  635.   def call_menu
  636.       return if $game_player.action != nil
  637.       $game_player.reset_charge_temp
  638.       x_call_menu
  639.   end
  640.    
  641. end   
  642. #===============================================================================
  643. # ■ Scene_Refresh
  644. #===============================================================================
  645. class Scene_Refresh
  646.   
  647. #--------------------------------------------------------------------------
  648. # ● 主处理
  649. #--------------------------------------------------------------------------
  650.   def main
  651.       SceneManager.call(Scene_Map)
  652.   end
  653. end

  654. #==============================================================================
  655. # ■ Game_Player
  656. #==============================================================================
  657. class Game_Player < Game_Character

  658. #--------------------------------------------------------------------------
  659. # ● 队友切换
  660. #--------------------------------------------------------------------------  
  661.   def leader_changed?(actor)
  662.       if $game_party.members[0] == nil
  663.          return true if actor != nil
  664.       elsif $game_party.members[0] != nil
  665.          return true if actor == nil   
  666.          return true if actor.actor_id != $game_party.members[0].actor_id        
  667.       end   
  668.       return false
  669.   end
  670.   
  671. end  
  672. $xas = true


  673. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  674. #■ 运动 - 斜向运动
  675. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  676. #===============================================================================
  677. # ■ 游戏 角色
  678. #===============================================================================
  679. class Game_CharacterBase
  680.   
  681.   #--------------------------------------------------------------------------
  682.   # ● 建立方向
  683.   #--------------------------------------------------------------------------         
  684.    alias diagonal_set_direction set_direction
  685.    def set_direction(d)
  686.        diagonal_set_direction(d)
  687.        @diagonal_direction = 0
  688.        reset_diagonal
  689.    end
  690.    
  691. end   

  692. #===============================================================================
  693. # ■  游戏 角色
  694. #===============================================================================
  695. class Game_Character < Game_CharacterBase
  696.   
  697.   attr_accessor :diagonal
  698.   attr_accessor :diagonal_direction
  699.   attr_accessor :sprite_angle_enable
  700.   attr_accessor :diagonal_time
  701.   
  702.   #--------------------------------------------------------------------------
  703.   # ● 初始化
  704.   #--------------------------------------------------------------------------        
  705.   alias diagonal_initialize initialize
  706.   def initialize
  707.       diagonal_initialize
  708.       if XAS_SYSTEM::EVENT_DIAGONAL_MOVEMENT
  709.          @diagonal = true
  710.       else   
  711.          @diagonal = false
  712.       end  
  713.       @diagonal_direction = 0
  714.       @sprite_angle_enable = false
  715.       @diagonal_time = 0
  716.   end  
  717.    
  718.   #--------------------------------------------------------------------------
  719.   # ● 复位 对角线
  720.   #--------------------------------------------------------------------------            
  721.   def reset_diagonal
  722.       return if @direction_fix
  723.       return if @diagonal == false
  724.       @diagonal_direction = 0   
  725.       @diagonal_time = 0
  726.       @angle = 0 if @sprite_angle_enable
  727.   end  
  728.   
  729.   #--------------------------------------------------------------------------
  730.   # ● 启用对角线
  731.   #--------------------------------------------------------------------------            
  732.   def enable_diagonal(dir = 0)
  733.      return if @direction_fix
  734.      return if @diagonal == false
  735.      return if dir == 0
  736.      @diagonal_direction = dir
  737.      @diagonal_time = XAS_BA::DIAGONAL_DURATION
  738.      @angle = 315 if @sprite_angle_enable
  739.   end  
  740.   
  741.   #--------------------------------------------------------------------------
  742.   # ● ↗
  743.   #--------------------------------------------------------------------------  
  744.   def turn_upper_right
  745.       enable_diagonal(9)
  746.       @direction = 8 unless @direction_fix
  747.   end  
  748.   
  749.   #--------------------------------------------------------------------------
  750.   # ● ↖
  751.   #--------------------------------------------------------------------------  
  752.   def turn_upper_left
  753.       enable_diagonal(7)
  754.       @direction = 4 unless @direction_fix
  755.   end   
  756.   
  757.   #--------------------------------------------------------------------------
  758.   # ● ↘
  759.   #--------------------------------------------------------------------------  
  760.   def turn_lower_right
  761.       enable_diagonal(3)
  762.       @direction = 6 unless @direction_fix
  763.   end      
  764.   
  765.   #--------------------------------------------------------------------------
  766.   # ● ↙
  767.   #--------------------------------------------------------------------------  
  768.   def turn_lower_left
  769.       enable_diagonal(1)
  770.       @direction = 2 unless @direction_fix
  771.   end   
  772.    
  773.   #--------------------------------------------------------------------------
  774.   # ● 移动朝向
  775.   #--------------------------------------------------------------------------               
  776.   alias diagonal_move_forward move_forward
  777.   def move_forward
  778.       return if move_forward_diagonal?
  779.       diagonal_move_forward
  780.   end
  781.   
  782.   #--------------------------------------------------------------------------
  783.   # ● 移动朝向对角线设置?
  784.   #--------------------------------------------------------------------------                  
  785.   def move_forward_diagonal?
  786.       return false if @diagonal == false
  787.       if @diagonal_direction != 0
  788.          case @diagonal_direction
  789.               when 1 #左上
  790.                  move_diagonal(4, 2)
  791.                  @direction = 2
  792.               when 3 #右下
  793.                  move_diagonal(6, 2)
  794.                  @direction = 6
  795.               when 7 #左下
  796.                  move_diagonal(4, 8)
  797.                  @direction = 4
  798.               when 9 #右上
  799.                  move_diagonal(6, 8)
  800.                  @direction = 8
  801.           end
  802.           enable_diagonal(@diagonal_direction)      
  803.          return true
  804.       end  
  805.       return false
  806.   end
  807.   
  808.   #--------------------------------------------------------------------------
  809.   # ● 后移动
  810.   #--------------------------------------------------------------------------               
  811.   alias diagonal_move_backward move_backward
  812.   def move_backward
  813.       return if move_backward_diagonal?
  814.       diagonal_move_backward
  815.   end
  816.   
  817.   #--------------------------------------------------------------------------
  818.   # ● 后移动对角线?
  819.   #--------------------------------------------------------------------------                  
  820.   def move_backward_diagonal?
  821.       return false if @diagonal == false
  822.       if @diagonal_direction != 0
  823.          last_direction_fix = @direction_fix
  824.          @direction_fix = true      
  825.          case @diagonal_direction
  826.               when 1
  827.                  move_diagonal(6, 8)
  828.                  @direction = 6
  829.               when 3
  830.                  move_diagonal(4, 8)
  831.                  @direction = 4
  832.               when 7
  833.                  move_diagonal(6, 2)
  834.                  @direction = 6
  835.               when 9         
  836.                  move_diagonal(4, 2)
  837.                  @direction = 2
  838.          end
  839.          enable_diagonal(@diagonal_direction)      
  840.          @direction_fix = last_direction_fix
  841.          return true
  842.       end  
  843.       return false
  844.   end  
  845.   
  846.   #--------------------------------------------------------------------------
  847.   # ● 转向朝向玩家
  848.   #--------------------------------------------------------------------------
  849.   alias turn_toward_player_diagonal turn_toward_player
  850.   def turn_toward_player
  851.       if @diagonal
  852.          diagonal_turn_toward_player
  853.          return
  854.       end
  855.       turn_toward_player_diagonal
  856.   end  
  857.   
  858.   #--------------------------------------------------------------------------
  859.   # ● 对角线 转向朝向玩家
  860.   #--------------------------------------------------------------------------
  861.   def diagonal_turn_toward_player
  862.       sx = distance_x_from($game_player.x)
  863.       sy = distance_y_from($game_player.y)
  864.       sd = sx.abs - sy.abs
  865.       sdx = sd.abs - sx.abs
  866.       sdy = sd.abs - sy.abs
  867.       return if sx == 0 and sy == 0
  868.       #Turn Upper Right
  869.       if sx < 0 and sy > 0
  870.          if sx.abs > sy.abs and sdx.abs < sd.abs
  871.             set_direction(6)
  872.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  873.             set_direction(8)
  874.          else
  875.             turn_upper_right
  876.          end
  877.          enable_diagonal(9)
  878.       #Turn Upper Left
  879.       elsif sx > 0 and sy > 0
  880.          if sx.abs > sy.abs and sdx.abs < sd.abs
  881.             set_direction(4)
  882.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  883.             set_direction(8)            
  884.          else
  885.             set_direction(4)
  886.             turn_upper_left
  887.          end
  888.          enable_diagonal(7)  
  889.       #Turn Lower Left  
  890.       elsif sx > 0 and sy < 0
  891.          if sx.abs > sy.abs and sdx.abs < sd.abs
  892.             set_direction(4)
  893.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  894.             set_direction(2)         
  895.          else                    
  896.             turn_lower_left
  897.          end
  898.          enable_diagonal(1)   
  899.        #Turn Lower Right   
  900.        elsif sx < 0 and sy < 0         
  901.          if sx.abs > sy.abs and sdx.abs < sd.abs
  902.             set_direction(6)
  903.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  904.             set_direction(2)           
  905.          else        
  906.             turn_lower_right
  907.          end
  908.          enable_diagonal(3)
  909.       elsif sx < 0
  910.          set_direction(6)
  911.       elsif sx > 0
  912.          set_direction(4)
  913.       elsif sy > 0
  914.          set_direction(8)
  915.       elsif sy < 0
  916.          set_direction(2)   
  917.       end     
  918.   
  919.   end  

  920.   #--------------------------------------------------------------------------
  921.   # ● 跟随玩家
  922.   #--------------------------------------------------------------------------
  923.   alias move_toward_player_diagonal move_toward_player
  924.   def move_toward_player
  925.       if @diagonal
  926.          diagonal_move_toward_player
  927.          return  
  928.       end
  929.       move_toward_player_diagonal
  930.   end   
  931.    
  932.   #--------------------------------------------------------------------------
  933.   # ● 对角线移动跟随玩家
  934.   #--------------------------------------------------------------------------  
  935.   def diagonal_move_toward_player
  936.       sx = distance_x_from($game_player.x)
  937.       sy = distance_y_from($game_player.y)
  938.       if sx == 0 and sy == 0
  939.          return
  940.       end
  941.       abs_sx = sx.abs
  942.       abs_sy = sy.abs
  943.       if abs_sx == abs_sy
  944.         rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
  945.       end
  946.       if abs_sx
  947.          if sx < 0 and sy > 0
  948.             move_diagonal(6, 8)
  949.             move_random unless moving?
  950.             enable_diagonal(9)
  951.          elsif sx > 0 and sy > 0
  952.             move_diagonal(4, 8)
  953.             move_random unless moving?
  954.             enable_diagonal(7)
  955.          elsif sx > 0 and sy < 0
  956.             move_diagonal(4, 2)
  957.             move_random unless moving?
  958.             enable_diagonal(1)
  959.          elsif sx < 0 and sy < 0
  960.             move_diagonal(6, 2)
  961.             move_random unless moving?
  962.             enable_diagonal(3)
  963.          elsif sx < 0
  964.             move_straight(6)
  965.          elsif sx > 0
  966.             move_straight(4)
  967.          elsif sy > 0
  968.             move_straight(8)
  969.          elsif sy < 0
  970.             move_straight(2)
  971.          end
  972.          if abs_sx != 1 and abs_sy != 1
  973.             move_random unless moving?
  974.          end  
  975.       end
  976. end
  977.   
  978. #--------------------------------------------------------------------------
  979. # ● 右转_45度
  980. #--------------------------------------------------------------------------      
  981. def turn_right_45
  982.      if @diagonal and @diagonal_direction != 0     
  983.         case @diagonal_direction
  984.           when 1;  set_direction(4)
  985.           when 3;  set_direction(2)
  986.           when 7;  set_direction(8)
  987.           when 9;  set_direction(6)  
  988.         end
  989.      else  
  990.         case @direction
  991.           when 2;  turn_lower_left
  992.           when 4;  turn_upper_left
  993.           when 6;  turn_lower_right
  994.           when 8;  turn_upper_right
  995.         end
  996.      end  
  997. end

  998. #--------------------------------------------------------------------------
  999. # ● 左转_45
  1000. #--------------------------------------------------------------------------  
  1001. def turn_left_45
  1002.      if @diagonal and @diagonal_direction != 0     
  1003.         case @diagonal_direction
  1004.           when 1;  set_direction(2)
  1005.           when 3;  set_direction(6)
  1006.           when 7;  set_direction(4)
  1007.           when 9;  set_direction(8)
  1008.         end
  1009.      else  
  1010.         case @direction
  1011.           when 2;  turn_lower_right
  1012.           when 4;  turn_lower_left
  1013.           when 6;  turn_upper_right
  1014.           when 8;  turn_upper_left
  1015.         end
  1016.      end  
  1017. end

  1018. #--------------------------------------------------------------------------
  1019. # ● 右转_90度
  1020. #--------------------------------------------------------------------------   
  1021. alias diagonal_turn_right_90 turn_right_90
  1022.   def turn_right_90
  1023.       if @diagonal and @diagonal_direction != 0
  1024.          turn_diagonal_right_90
  1025.          return
  1026.       end  
  1027.       diagonal_turn_right_90
  1028.   end
  1029.   
  1030. #--------------------------------------------------------------------------
  1031. # ● 斜角右转_90度
  1032. #--------------------------------------------------------------------------   
  1033.   def turn_diagonal_right_90
  1034.       case @diagonal_direction
  1035.          when 1;  turn_upper_left
  1036.          when 3;  turn_lower_left
  1037.          when 7;  turn_upper_right
  1038.          when 9;  turn_lower_right
  1039.       end
  1040.   end
  1041.    
  1042. #--------------------------------------------------------------------------
  1043. # ● 左转_90度
  1044. #--------------------------------------------------------------------------   
  1045.   alias diagonal_turn_left_90 turn_left_90
  1046.   def turn_left_90
  1047.       if @diagonal and @diagonal_direction != 0
  1048.          turn_diagonal_left_90
  1049.          return
  1050.       end
  1051.       diagonal_turn_left_90
  1052.   end  
  1053.    
  1054. #--------------------------------------------------------------------------
  1055. # ● 斜角左转_90度
  1056. #--------------------------------------------------------------------------   
  1057.   def turn_diagonal_left_90
  1058.       case @diagonal_direction
  1059.          when 1;  turn_lower_right
  1060.          when 3;  turn_upper_right
  1061.          when 7;  turn_lower_left
  1062.          when 9;  turn_upper_left
  1063.       end
  1064.   end     
  1065.    
  1066.   #--------------------------------------------------------------------------
  1067.   # ● 转_180度
  1068.   #--------------------------------------------------------------------------
  1069.   alias diagonal_turn_180 turn_180
  1070.   def turn_180  
  1071.       if @diagonal and @diagonal_direction != 0
  1072.          turn_diagonal_180
  1073.          return
  1074.       end
  1075.       diagonal_turn_180
  1076.   end
  1077.   
  1078. #--------------------------------------------------------------------------
  1079. # ● 斜角转_180度
  1080. #--------------------------------------------------------------------------   
  1081.   def turn_diagonal_180
  1082.       case @diagonal_direction
  1083.          when 1;  turn_upper_right
  1084.          when 3;  turn_upper_left
  1085.          when 7;  turn_lower_right
  1086.          when 9;  turn_lower_left
  1087.       end
  1088.   end  
  1089.    
  1090. #--------------------------------------------------------------------------
  1091. # ● 随机移动
  1092. #--------------------------------------------------------------------------   
  1093.   alias diagonal_turn_random turn_random
  1094.   def turn_random
  1095.       if @diagonal
  1096.          turn_diagonal_random
  1097.          return
  1098.       end  
  1099.       diagonal_turn_random
  1100.   end  
  1101.   
  1102. #--------------------------------------------------------------------------
  1103. # ● 斜角随机移动
  1104. #--------------------------------------------------------------------------   
  1105.   def turn_diagonal_random
  1106.       case rand(8)
  1107.           when 0;  set_direction(8)
  1108.           when 1;  set_direction(6)
  1109.           when 2;  set_direction(4)
  1110.           when 3;  set_direction(2)
  1111.           when 4;  turn_lower_left  
  1112.           when 5;  turn_lower_right
  1113.           when 6;  turn_upper_left  
  1114.           when 7;  turn_upper_right
  1115.       end
  1116.   end

  1117. end   

  1118. #===============================================================================
  1119. # ■ Game_Player
  1120. #===============================================================================
  1121. class Game_Player < Game_Character
  1122.   
  1123.   #--------------------------------------------------------------------------
  1124.   # ● Move By Input
  1125.   #--------------------------------------------------------------------------   
  1126.   alias diagonal_move_by_input move_by_input
  1127.   def move_by_input
  1128.       if XAS_SYSTEM::PLAYER_DIAGONAL_MOVEMENT
  1129.          player_diagonal_move_by_input
  1130.         # update_sprite_diagonal
  1131.          update_return_direction
  1132.          return
  1133.       end
  1134.       diagonal_move_by_input
  1135.   end   
  1136. #~     
  1137.   #--------------------------------------------------------------------------
  1138.   # ● Update Sprite Diagonal
  1139.   #--------------------------------------------------------------------------        
  1140.   def update_sprite_diagonal
  1141.       return if @diagonal_direction == 0
  1142.       return if self.action != nil
  1143.       return if @dash_active
  1144.       make_pose("_Diagonal", 2)
  1145.   end  
  1146.   
  1147.   #--------------------------------------------------------------------------
  1148.   # ● Update Return Direction
  1149.   #--------------------------------------------------------------------------         
  1150.   def update_return_direction
  1151.       return if XAS_BA::DIAGONAL_DURATION_ENABLE == false
  1152.       return if @diagonal_time == 0
  1153.       return if moving? or @stop
  1154.       @diagonal_time -= 1
  1155.       @diagonal_direction = 0 if @diagonal_time == 0
  1156.   end
  1157.    
  1158.   #--------------------------------------------------------------------------
  1159.   # ● Player Diagonal Move By Input
  1160.   #--------------------------------------------------------------------------      
  1161.   def player_diagonal_move_by_input   
  1162.       return unless movable?
  1163.       return if $game_map.interpreter.running?
  1164.       case Input.dir8
  1165.            when 1
  1166.                move_diagonal(4, 2)
  1167.                unless moving?
  1168.                    move_straight(4)
  1169.                    move_straight(2)                 
  1170.                end  
  1171.                @diagonal_direction = 1  
  1172.            when 2; move_straight(2)
  1173.            when 3
  1174.                 move_diagonal(6, 2)
  1175.                 unless moving?
  1176.                    move_straight(6)
  1177.                    move_straight(2)
  1178.                 end
  1179.                 @diagonal_direction = 3
  1180.            when 4;  move_straight(4)
  1181.            when 6;  move_straight(6)
  1182.            when 7
  1183.                  move_diagonal(4, 8)
  1184.                  unless moving?
  1185.                     move_straight(4)
  1186.                     move_straight(8)
  1187.                 end
  1188.                 @diagonal_direction = 7
  1189.            when 8;  move_straight(8)
  1190.            when 9  
  1191.                  move_diagonal(6, 8)
  1192.                  unless moving?
  1193.                     move_straight(6)
  1194.                     move_straight(8)
  1195.                 end
  1196.                 @diagonal_direction = 9  
  1197.       end
  1198.   end  
  1199.   
  1200. end


  1201. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1202. #■ MOVEMENT - FORCE ACTION
  1203. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  1204. #===============================================================================
  1205. # ■ Game Character
  1206. #===============================================================================
  1207. class Game_Character < Game_CharacterBase
  1208.   
  1209.   #--------------------------------------------------------------------------
  1210.   # ● moving 2?
  1211.   #--------------------------------------------------------------------------  
  1212.   def moving2?
  1213.       @real_x != @x || @real_y != @y
  1214.   end   
  1215.   
  1216.   #--------------------------------------------------------------------------
  1217.   # ● Can Force Action?
  1218.   #--------------------------------------------------------------------------         
  1219.   def can_force_action?
  1220.       return false if @force_action_times  == 0
  1221.       return false if self.moving2?
  1222.       return false if self.jumping?
  1223.       return false if self.knockbacking?
  1224.       return false if self.stop
  1225.       return true
  1226.   end
  1227.    
  1228.   #--------------------------------------------------------------------------
  1229.   # ● Update Force Action
  1230.   #--------------------------------------------------------------------------        
  1231.   def update_force_action
  1232.       @force_action_times -= 1
  1233.       execute_force_action
  1234.       execute_force_action_tool_effect if @tool_id > 0 and @tool_effect != ""
  1235.       reset_auto_action if @force_action_times == 0
  1236.   end
  1237.   
  1238.   #--------------------------------------------------------------------------
  1239.   # ● Execute Force Action
  1240.   #--------------------------------------------------------------------------         
  1241.   def execute_force_action  
  1242.       case @force_action
  1243.         when "Forward"
  1244.             move_forward
  1245.         when "Backward"
  1246.             move_backward
  1247.         when "Toward Player"   
  1248.             move_toward_player
  1249.         when "Move Left"   
  1250.             move_straight(4)
  1251.         when "Move Right"
  1252.             move_straight(6)
  1253.         when "Move Up"   
  1254.             move_straight(8)
  1255.         when "Move Down"
  1256.             move_straight(2)
  1257.         when "All Shoot"  
  1258.               if self.action != nil
  1259.                  turn_right_45
  1260.                  self.shoot(self.action.id) unless @force_action_times == 0
  1261.               end
  1262.         when "Four Shoot"  
  1263.               if self.action != nil
  1264.                  turn_right_90
  1265.                  self.shoot(self.action.id) unless @force_action_times == 0
  1266.               end               
  1267.         when "Three Shoot"  
  1268.               if self.action != nil
  1269.                  case @force_action_times
  1270.                      when 2
  1271.                        turn_right_45
  1272.                      when 1
  1273.                        turn_left_90
  1274.                      when 0
  1275.                        turn_right_45
  1276.                  end  
  1277.                  self.shoot(self.action.id) unless @force_action_times == 0
  1278.               end      
  1279.         when "Two Shoot"  
  1280.               if self.action != nil
  1281.                  turn_180
  1282.                  self.shoot(self.action.id) unless @force_action_times == 0
  1283.               end   
  1284.         end  
  1285.   end  
  1286.   
  1287.   #--------------------------------------------------------------------------
  1288.   # ● Execute Force Action Tool Effect
  1289.   #--------------------------------------------------------------------------
  1290.   def execute_force_action_tool_effect
  1291.       action_effect_during_move     
  1292.       action_effect_after_move if @force_action_times == 0
  1293.   end  
  1294.   
  1295.   #--------------------------------------------------------------------------
  1296.   # ● Auto Action Effect During Move
  1297.   #--------------------------------------------------------------------------            
  1298.   def reset_auto_action  
  1299.       @force_action = ""
  1300.       @force_action_times = 0
  1301.       @anime_count = 0
  1302.   end
  1303.   
  1304.   #--------------------------------------------------------------------------
  1305.   # ● Action Effect During Move
  1306.   #--------------------------------------------------------------------------         
  1307.   def action_effect_during_move  
  1308.       if @tool_effect == "Boomerang" and @force_action == "Toward Player"  
  1309.          if @x == $game_player.x and @y == $game_player.y  
  1310.             self.action.duration = 15
  1311.             @force_action_times = 0
  1312.             @force_action_type = ""            
  1313.           end
  1314.       end
  1315.   end  

  1316.   #--------------------------------------------------------------------------
  1317.   # ● Action Effect After Move
  1318.   #--------------------------------------------------------------------------            
  1319.   def action_effect_after_move
  1320.       if @tool_effect == "Boomerang"
  1321.          @force_action_times = 30
  1322.          @force_action = "Toward Player"   
  1323.          @move_frequency = 6
  1324.          @move_speed = 5.5           
  1325.       end     
  1326.   end      
  1327.       
  1328. end  


  1329. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1330. #■ MOVEMENT - EXTRA MOVEMENT
  1331. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  1332. #===============================================================================
  1333. # ■ Game Character
  1334. #===============================================================================
  1335. class Game_Character < Game_CharacterBase
  1336.   
  1337.   #--------------------------------------------------------------------------
  1338.   # ● Check XY
  1339.   #--------------------------------------------------------------------------      
  1340.   def check_xy
  1341.       @pre_x = @x
  1342.       @pre_y = @y
  1343.   end   

  1344.   #--------------------------------------------------------------------------
  1345.   # ● Turn Reverse
  1346.   #--------------------------------------------------------------------------         
  1347.   def turn_reverse(dir)
  1348.       case dir     
  1349.         when 2; set_direction(8)
  1350.         when 4; set_direction(6)
  1351.         when 6; set_direction(4)
  1352.         when 8; set_direction(2)
  1353.       end   
  1354.   end
  1355.   
  1356.   #--------------------------------------------------------------------------
  1357.   # ● Org Here
  1358.   #--------------------------------------------------------------------------        
  1359.   def org_here
  1360.       @orig_pos_x = @x
  1361.       @orig_pos_y = @y
  1362.   end  
  1363.   
  1364.   #--------------------------------------------------------------------------
  1365.   # ● return_org
  1366.   #--------------------------------------------------------------------------         
  1367.   def return_org(type = 0)
  1368.       if type == 1
  1369.          moveto(@orig_pos_x,@orig_pos_x)
  1370.       else  
  1371.          jump(0,0)
  1372.       end
  1373.       @x = @orig_pos_x
  1374.       @y = @orig_pos_y
  1375.   end  
  1376.   
  1377.   #--------------------------------------------------------------------------
  1378.   # ● Dual Switch
  1379.   #--------------------------------------------------------------------------   
  1380.   def dual_switch(switch_on, switch_off,percentage = 100)
  1381.       enable_per = rand(100)
  1382.       if enable_per <= percentage
  1383.          $game_switches[switch_on] = true   
  1384.          $game_switches[switch_off] = false
  1385.          $game_map.need_refresh = true
  1386.       end   
  1387.   end   
  1388.   
  1389.   #--------------------------------------------------------------------------
  1390.   # ● Move Forward 2
  1391.   #--------------------------------------------------------------------------  
  1392.   def move_forward2
  1393.       return if moving2?
  1394.       move_forward
  1395.   end  
  1396.   
  1397.   #--------------------------------------------------------------------------
  1398.   # ● Bounce Direction
  1399.   #--------------------------------------------------------------------------  
  1400.   def bounce_direction
  1401.       @diagonal = true
  1402.       turn_random  
  1403.   end
  1404.   
  1405.   #--------------------------------------------------------------------------
  1406.   # ● Turn_back
  1407.   #--------------------------------------------------------------------------            
  1408.   def turn_back
  1409.       if @diagonal_direction != 0
  1410.          case @diagonal_direction
  1411.               when 1
  1412.                 turn_upper_right
  1413.               when 3
  1414.                 turn_upper_left
  1415.               when 7
  1416.                 turn_lower_right
  1417.               when 9         
  1418.                 turn_lower_left
  1419.          end
  1420.       else
  1421.           case @direction
  1422.                when 2;   set_direction(8)
  1423.                when 4;   @direction = 6#move_straight(6)#set_direction(6)
  1424.                when 6;   set_direction(4)
  1425.                when 8;   set_direction(2)
  1426.           end
  1427.       end     
  1428.   end  
  1429.   
  1430.   #--------------------------------------------------------------------------
  1431.   # ● Jump_high
  1432.   #--------------------------------------------------------------------------
  1433.   def jump_high(x_plus,y_plus,high = 10)   
  1434.       @x += x_plus
  1435.       @y += y_plus
  1436.       distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
  1437.       @jump_peak = high + distance - @move_speed
  1438.       @jump_count = @jump_peak * 2
  1439.       @stop_count = 0
  1440.       straighten
  1441.   end
  1442.   
  1443.   #--------------------------------------------------------------------------
  1444.   # ● Passable Temp
  1445.   #--------------------------------------------------------------------------   
  1446. def passable_temp_id?(x, y)
  1447.      return false unless $game_map.valid?(x, y)   
  1448.      return true if @through or debug_through?     
  1449.      return false unless map_passable?(x, y,@direction)         
  1450.      return false if collide_with_characters_temp_id?(x, y)
  1451.      return true                                   
  1452.   end
  1453.   
  1454.   #--------------------------------------------------------------------------
  1455.   # ● Collide With Characters
  1456.   #--------------------------------------------------------------------------      
  1457.   def collide_with_characters_temp_id?(x, y)
  1458.       for event in $game_map.events_xy(x, y)         
  1459.           unless event.through or event.battler != nil   
  1460.              return true if self.is_a?(Game_Event)      
  1461.              return true if event.priority_type >= 1     
  1462.           end
  1463.       end
  1464.       return false
  1465.   end  

  1466.   #--------------------------------------------------------------------------
  1467.   # ● Force Move Route
  1468.   #--------------------------------------------------------------------------
  1469.   alias x_force_move_route force_move_route
  1470.   def force_move_route(move_route)
  1471.       if self.battler != nil and self.is_a?(Game_Event)
  1472.          return
  1473.       end  
  1474.       x_force_move_route(move_route)
  1475.   end  
  1476. end  


  1477. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1478. #■ MOVEMENT - PLAYER COMMANDS
  1479. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  1480. #==============================================================================
  1481. # ■ Game_Player
  1482. #==============================================================================
  1483. class Game_Player < Game_Character
  1484.   include XAS_BUTTON
  1485.   
  1486.   #--------------------------------------------------------------------------
  1487.   # ● Update Action Command
  1488.   #--------------------------------------------------------------------------  
  1489.   def update_action_command
  1490.       update_check_battler_equipment if can_check_battler_equipment?
  1491.       update_dash_button
  1492.       update_auto_target_shoot
  1493.       update_combo_time
  1494.       update_action_1_button
  1495.       update_action_2_button
  1496.       update_skill_button
  1497.       update_item_button
  1498.       update_change_leader_button
  1499.       update_charge_button
  1500.   end  

  1501.   #--------------------------------------------------------------------------
  1502.   # ● Can Use Command?
  1503.   #--------------------------------------------------------------------------      
  1504.   def can_use_command?
  1505.       return false if $game_map.interpreter.running?
  1506.       return false if $game_message.visible
  1507.       return false if self.battler == nil
  1508.       return false if self.action != nil
  1509.       return false if self.knockbacking?      
  1510.       return false if @stop
  1511.       return true
  1512.   end   
  1513.   
  1514.   #--------------------------------------------------------------------------
  1515.   # ● Update Check Battler Equipment
  1516.   #--------------------------------------------------------------------------      
  1517.   def update_check_battler_equipment
  1518.   
  1519.   end  
  1520.   
  1521.   #--------------------------------------------------------------------------
  1522.   # ● Can Check Battler Equipment
  1523.   #--------------------------------------------------------------------------        
  1524.   def can_check_battler_equipment?
  1525.       if self.battler.old_equipment_id[0] != self.battler.equips[0] or
  1526.          self.battler.old_equipment_id[1] != self.battler.equips[1] or
  1527.          self.battler.old_equipment_id[2] != self.battler.equips[2] or
  1528.          self.battler.old_equipment_id[3] != self.battler.equips[3] or
  1529.          self.battler.old_equipment_id[4] != self.battler.equips[4]
  1530.          self.battler.old_equipment_id[0] = self.battler.equips[0]
  1531.          self.battler.old_equipment_id[1] = self.battler.equips[1]
  1532.          self.battler.old_equipment_id[2] = self.battler.equips[2]
  1533.          self.battler.old_equipment_id[3] = self.battler.equips[3]
  1534.          self.battler.old_equipment_id[4] = self.battler.equips[4]      
  1535.          return true
  1536.       end   
  1537.       return false
  1538.   end
  1539.   
  1540.   #--------------------------------------------------------------------------
  1541.   # ● Update Charge Button
  1542.   #--------------------------------------------------------------------------   
  1543.   def update_charge_button
  1544.       return unless can_charge_command?
  1545.       if Input.press?(ACTION_1_BUTTON) and ENABLE_ACTION_1_BUTTON
  1546.          update_charge_effect(0)
  1547.          reset_charge_temp if Input.press?(ACTION_2_BUTTON) and ENABLE_ACTION_2_BUTTON
  1548.       elsif Input.press?(ACTION_2_BUTTON)
  1549.          update_charge_effect(1)
  1550.          reset_charge_temp if Input.press?(ACTION_1_BUTTON)
  1551.       else
  1552.          if self.battler.x_charge_action[2] >= self.battler.x_charge_action[1]
  1553.             self.shoot(self.battler.x_charge_action[0])
  1554.          end
  1555.         reset_charge_temp
  1556.       end  
  1557.   end

  1558.   #--------------------------------------------------------------------------
  1559.   # ● Update Charge Effect
  1560.   #--------------------------------------------------------------------------        
  1561.   def update_charge_effect(type)
  1562.       if self.battler.x_charge_action[2] == 0
  1563.          return unless equipped_charge_action?(type)
  1564.       end  
  1565.       if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
  1566.          self.battler.x_charge_action[2] += 1
  1567.       end
  1568.       self.battler.x_charge_action[3] += 1
  1569.       if self.battler.x_charge_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
  1570.          self.battler.x_charge_action[3] = 0
  1571.          if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
  1572.             self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION1_ID
  1573.          else
  1574.             self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION2_ID
  1575.          end  
  1576.       end
  1577.   end
  1578.   
  1579.   #--------------------------------------------------------------------------
  1580.   # ● Equipped Charge Action
  1581.   #--------------------------------------------------------------------------         
  1582.   def equipped_charge_action?(type)
  1583.       case type
  1584.          when 0
  1585.            weapon = self.battler.equips[0]
  1586.          when 1
  1587.            weapon = self.battler.equips[1]
  1588.       end
  1589.       if weapon == nil
  1590.          return false
  1591.          reset_charge_temp
  1592.       end
  1593.       if weapon.note =~ /<Charge Action = (\d+) - (\d+)>/   or
  1594.         weapon.note =~ /<蓄力技能 = (\d+) - (\d+)>/
  1595.          self.battler.x_charge_action[0] = $1.to_i rescue 0#Skill ID
  1596.          self.battler.x_charge_action[1] = $2.to_i rescue 0#Max Time
  1597.          self.battler.x_charge_action[2] = 0#Current Time
  1598.          self.battler.x_charge_action[3] = 0#Loop Anime Time
  1599.          return true
  1600.       end            
  1601.       return false   
  1602.       reset_charge_temp
  1603.   end
  1604.   
  1605.   #--------------------------------------------------------------------------
  1606.   # ● Update Combo Time
  1607.   #--------------------------------------------------------------------------        
  1608.   def update_combo_time
  1609.       return if self.battler.x_combo[2] == 0
  1610.       self.battler.x_combo[2] -= 1
  1611.       if self.battler.x_combo[2] == 0
  1612.          self.battler.x_combo[0] = 0
  1613.          self.battler.x_combo[1] = -1
  1614.       end   
  1615.   end  
  1616.   
  1617.   #--------------------------------------------------------------------------
  1618.   # ● Can Use Weapon Command?
  1619.   #--------------------------------------------------------------------------   
  1620.   def can_use_weapon_command?
  1621.       return false if $game_system.command_enable == false
  1622.       return false unless ENABLE_ACTION_1_BUTTON
  1623.       return false if self.battler.shield
  1624.       return false if self.battler.cast_action[4] > 0
  1625.       return false if self.battler.x_charge_action[2] > 0
  1626.       return true
  1627.   end
  1628.   
  1629.   #--------------------------------------------------------------------------
  1630.   # ● Can Use Shield Command?
  1631.   #--------------------------------------------------------------------------      
  1632.   def can_use_shield_command?
  1633.       return false if $game_system.command_enable == false
  1634.       return false unless ENABLE_ACTION_2_BUTTON
  1635.       return false if self.battler.equips[1] == nil
  1636.       return false if self.battler.equips[1].id == 0
  1637.       return false if self.battler.cast_action[4] > 0
  1638.       return false if self.battler.x_charge_action[2] > 0
  1639.       return true
  1640.   end
  1641.   
  1642.   #--------------------------------------------------------------------------
  1643.   # ● Can Use Skill Command?
  1644.   #--------------------------------------------------------------------------   
  1645.   def can_use_skill_command?
  1646.       return false if $game_system.command_enable == false
  1647.       return false unless ENABLE_SKILL_BUTTON
  1648.       return false if self.battler.shield
  1649.       return false if self.battler.cast_action[4] > 0
  1650.       return false if self.battler.x_charge_action[2] > 0
  1651.       return true
  1652.   end   
  1653.   
  1654.   #--------------------------------------------------------------------------
  1655.   # ● Can Use Item Command?
  1656.   #--------------------------------------------------------------------------   
  1657.   def can_use_item_command?
  1658.       return false if $game_system.command_enable == false
  1659.       return false unless ENABLE_ITEM_BUTTON
  1660.       return false if self.battler.shield   
  1661.       return false if self.battler.cast_action[4] > 0
  1662.       return false if self.battler.x_charge_action[2] > 0
  1663.       return true
  1664.   end      
  1665.   
  1666.   #--------------------------------------------------------------------------
  1667.   # ● Can Charge Command
  1668.   #--------------------------------------------------------------------------      
  1669.   def can_charge_command?
  1670.       return false if $game_system.command_enable == false
  1671.       return false if self.battler.cast_action[4] > 0
  1672.       return false if self.battler.shield      
  1673.       return true
  1674.   end   
  1675.   
  1676.   #--------------------------------------------------------------------------
  1677.   # ● Can Use Change Leader Command?
  1678.   #--------------------------------------------------------------------------      
  1679.   def can_use_change_leader_command?
  1680.       return false unless ENABLE_CHANGE_LEADER_BUTTON
  1681.       return false if self.battler.shield   
  1682.       return false if self.battler.cast_action[4] > 0
  1683.       return false if self.battler.x_charge_action[2] > 0
  1684.       return false if $game_temp.change_leader_wait_time > 0
  1685.       return true
  1686.   end
  1687.   
  1688.   #--------------------------------------------------------------------------
  1689.   # ● State_Seal Command
  1690.   #--------------------------------------------------------------------------        
  1691.   def state_seal_command?(type)
  1692.       seal = false
  1693.       case type  
  1694.          when 0
  1695.             seal = true if self.battler.state_mute
  1696.             seal = true if self.battler.state_seal_attack
  1697.          when 1
  1698.             seal = true if self.battler.state_mute
  1699.             seal = true if self.battler.state_seal_attack
  1700.          when 2
  1701.             seal = true if self.battler.state_mute
  1702.             seal = true if self.battler.state_seal_skill
  1703.          when 3  
  1704.             seal = true if self.battler.state_mute   
  1705.             seal = true if self.battler.state_seal_item
  1706.       end
  1707.       if seal
  1708.          seal_effect
  1709.          return true
  1710.       end  
  1711.       return false      
  1712.   end  
  1713.   
  1714.   #--------------------------------------------------------------------------
  1715.   # ● Check Equipped Action(修改BY W.S)
  1716.   #--------------------------------------------------------------------------   
  1717.   def check_equipped_action(command_type)
  1718.       case command_type
  1719.          when 0 # Weapon 1
  1720.             weapon = self.battler.equips[0]
  1721.             if weapon == nil
  1722.                self.battler.x_action1_id = 0
  1723.                return
  1724.              end
  1725.               if weapon.note =~ /<Action ID = (\d+)>/  
  1726.                weapon.note =~ /<Action ID = (\d+)>/
  1727.               elsif weapon.note =~ /<动作ID = (\d+)>/
  1728.                weapon.note =~ /<动作ID = (\d+)>/
  1729.               end
  1730.             action_id =  $1.to_i
  1731.             action_id = 0 if action_id == nil
  1732.             self.battler.x_action1_id = action_id
  1733.          when 1 # Weapon 2
  1734.             weapon = self.battler.equips[1]
  1735.             if weapon == nil
  1736.                self.battler.x_action2_id = 0
  1737.                return
  1738.              end   
  1739.               if weapon.note =~ /<Action ID = (\d+)>/  
  1740.                weapon.note =~ /<Action ID = (\d+)>/
  1741.               elsif weapon.note =~ /<动作ID = (\d+)>/
  1742.                weapon.note =~ /<动作ID = (\d+)>/
  1743.               end
  1744.             action_id =  $1.to_i
  1745.             action_id = 0 if action_id == nil            
  1746.             self.battler.x_action2_id = action_id
  1747.          when 2 # Skill   
  1748.             
  1749.          when 3 # Item
  1750.             item_id = $data_items[self.battler.item_id]
  1751.             if item_id == nil            
  1752.                self.battler.x_item_id =  0
  1753.                return
  1754.              end   
  1755.               if item_id.note =~ /<Action ID = (\d+)>/  
  1756.                item_id.note =~ /<Action ID = (\d+)>/
  1757.               elsif item_id.note =~ /<动作ID = (\d+)>/
  1758.                item_id.note =~ /<动作ID = (\d+)>/
  1759.               end
  1760.             action_id =  $1.to_i
  1761.             action_id = 0 if action_id == nil     
  1762.             self.battler.x_item_id = action_id
  1763.       end     
  1764.   end
  1765.    
  1766.   #--------------------------------------------------------------------------
  1767.   # ● Execute Combo
  1768.   #--------------------------------------------------------------------------        
  1769.   def execute_combo?(type)  
  1770.       if type == self.battler.x_combo[1] and self.battler.x_combo[0] != 0
  1771.          return if state_seal_command?(type)        
  1772.          self.shoot(self.battler.x_combo[0])
  1773.          self.battler.x_combo[1] = type
  1774.          return true
  1775.       end  
  1776.       self.battler.x_combo[0] = 0
  1777.       self.battler.x_combo[1] = type
  1778.       self.battler.x_combo[2] = 0
  1779.       return false
  1780.   end
  1781.   
  1782.   #--------------------------------------------------------------------------
  1783.   # ● Update Change Leader Button
  1784.   #--------------------------------------------------------------------------        
  1785.   def update_change_leader_button
  1786.       if Input.trigger?(CHANGE_LEADER_BUTTON)
  1787.          return unless can_use_change_leader_command?
  1788.          change_leader     
  1789.       end
  1790.   end
  1791.   
  1792.   #--------------------------------------------------------------------------
  1793.   # ● Update Action 1 Button
  1794.   #--------------------------------------------------------------------------      
  1795.   def update_action_1_button
  1796.       if Input.trigger?(ACTION_1_BUTTON)
  1797.          type = 0
  1798.          return unless can_use_weapon_command?
  1799.          return if execute_combo?(type)
  1800.          check_equipped_action(type)
  1801.          action_id = self.battler.x_action1_id
  1802.          return if action_id == 0
  1803.          return if state_seal_command?(type)
  1804.          self.shoot(action_id)
  1805.       end   
  1806.   end
  1807.    
  1808.   #--------------------------------------------------------------------------
  1809.   # ● Update Action 2 Button
  1810.   #--------------------------------------------------------------------------   
  1811.   def update_action_2_button
  1812.       if Input.trigger?(ACTION_2_BUTTON)
  1813.          if self.battler.equips[1].is_a?(RPG::Weapon)
  1814.             type = 1
  1815.             return unless can_use_weapon_command?
  1816.             return if execute_combo?(type)
  1817.             check_equipped_action(type)
  1818.             action_id = self.battler.x_action2_id
  1819.             return if action_id == 0
  1820.             return if state_seal_command?(type)            
  1821.             self.shoot(action_id)
  1822.             return
  1823.          end   
  1824.       end         
  1825.       update_shield_button
  1826.   end
  1827.   
  1828.   #--------------------------------------------------------------------------
  1829.   # ● Update Shield Button(修改BY W.S)
  1830.   #--------------------------------------------------------------------------        
  1831.   def update_shield_button
  1832.       if Input.press?(ACTION_2_BUTTON)
  1833.          if can_use_shield_command?
  1834.             unless self.battler.shield  
  1835.                 shield = self.battler.equips[1]
  1836.                 if shield.note =~ /<Action>/ or shield.note =~ /<动作>/
  1837.                    if shield.note =~ /<Pose = (\w+)>/ or shield.note =~ /<行走图 = (\w+)>/
  1838.                       make_pose($1.to_s, 2)
  1839.                    end
  1840.                 else   
  1841.                    self.battler.shield = false
  1842.                    return
  1843.                 end
  1844.             end
  1845.             self.x_pose_duration = 2
  1846.             self.battler.shield = true
  1847.             update_shield_diretion_button
  1848.          else
  1849.             self.battler.shield = false
  1850.          end  
  1851.       else   
  1852.          self.battler.shield = false
  1853.       end      
  1854.   end
  1855.   
  1856.   #--------------------------------------------------------------------------
  1857.   # ● update_shield_direction_button
  1858.   #--------------------------------------------------------------------------         
  1859.   def update_shield_diretion_button
  1860.       return if @direction_fix
  1861.       case Input.dir4
  1862.          when 2;  set_direction(2)   
  1863.          when 4;  set_direction(4)   
  1864.          when 6;  set_direction(6)   
  1865.          when 8;  set_direction(8)   
  1866.       end
  1867.   end
  1868.   
  1869.   #--------------------------------------------------------------------------
  1870.   # ● Update Skill Button
  1871.   #--------------------------------------------------------------------------      
  1872.   def update_skill_button
  1873.       if Input.trigger?(SKILL_BUTTON)
  1874.          type = 2
  1875.          return unless can_use_skill_command?
  1876.          return if execute_combo?(type)
  1877.          check_equipped_action(type)
  1878.          action_id = self.battler.skill_id
  1879.          return if action_id == 0
  1880.          return if state_seal_command?(type)         
  1881.          self.shoot(action_id)
  1882.       end   
  1883.   end
  1884.   
  1885.   #--------------------------------------------------------------------------
  1886.   # ● Update Item Button
  1887.   #--------------------------------------------------------------------------      
  1888.   def update_item_button
  1889.       if Input.trigger?(ITEM_BUTTON)
  1890.          type = 3         
  1891.          return unless can_use_item_command?
  1892.          return if execute_combo?(type)
  1893.          check_equipped_action(type)
  1894.          action_id = self.battler.x_item_id
  1895.          return if action_id == 0
  1896.          return if state_seal_command?(type)         
  1897.          self.shoot(action_id)
  1898.       end   
  1899.   end
  1900.   
  1901.   #--------------------------------------------------------------------------
  1902.   # ● Update Auto Target Shoot
  1903.   #--------------------------------------------------------------------------
  1904.   def update_auto_target_shoot
  1905.       return if $game_temp.xas_target_time == 0
  1906.       return if $game_temp.xas_target_shoot_id == 0
  1907.       return if $game_temp.xas_target_x == 0 and $game_temp.xas_target_y == 0   
  1908.       $game_temp.xas_target_time -= 1
  1909.       if $game_temp.xas_target_time == 0
  1910.          self.shoot($game_temp.xas_target_shoot_id)
  1911.          $game_temp.xas_target_shoot_id = 0
  1912.       end   
  1913.   end   
  1914.   
  1915. #--------------------------------------------------------------------------
  1916. # ● Dash?
  1917. #--------------------------------------------------------------------------            
  1918. alias x_dash dash?
  1919. def dash?   
  1920.      return false if XAS_SYSTEM::DASH_SYSTEM
  1921.      x_dash
  1922. end

  1923. #--------------------------------------------------------------------------
  1924. # ● Can Dash?
  1925. #--------------------------------------------------------------------------              
  1926. def can_dash?
  1927.      return false unless XAS_BUTTON::ENABLE_DASH_BUTTON
  1928.      return false if self.battler.shield
  1929.      return true if Input.press?(XAS_BUTTON::DASH_BUTTON)
  1930.      @dash_active = false
  1931.      return false
  1932. end

  1933. #--------------------------------------------------------------------------
  1934. # ● Update Dash Command
  1935. #--------------------------------------------------------------------------            
  1936. def update_dash_button
  1937.      return unless can_dash?
  1938.      @dash_active = true
  1939.      @anime_count -= 0.5 if moving?
  1940.      update_dash_sprite_name
  1941. end  

  1942. #--------------------------------------------------------------------------
  1943. # ● Update Dash Sprite Name
  1944. #--------------------------------------------------------------------------              
  1945. def update_dash_sprite_name
  1946.      make_pose("_Dash", 2)
  1947. end

  1948. end


  1949. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1950. #■ TOOL - INITIALIZE
  1951. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  1952. #===============================================================================
  1953. # ■ Game_Map
  1954. #===============================================================================
  1955. class Game_Map
  1956.   
  1957.   attr_accessor :need_refresh_token

  1958.   #--------------------------------------------------------------------------
  1959.   # ● need_add_tokens
  1960.   #--------------------------------------------------------------------------  
  1961.   def need_add_tokens
  1962.       @need_add_tokens = [] if @need_add_tokens == nil
  1963.       return @need_add_tokens
  1964.   end
  1965.   
  1966.   #--------------------------------------------------------------------------
  1967.   # ● need_remove_tokens
  1968.   #--------------------------------------------------------------------------
  1969.   def need_remove_tokens
  1970.       @need_remove_tokens = [] if @need_remove_tokens == nil
  1971.       return @need_remove_tokens
  1972.   end
  1973.   
  1974.   #--------------------------------------------------------------------------
  1975.   # ● add_token
  1976.   #--------------------------------------------------------------------------
  1977.   def add_token(token_event)
  1978.       $game_temp.tool_event = [] if $game_temp.tool_event == nil
  1979.       $game_temp.tool_event.push(token_event)
  1980.       self.need_add_tokens.push(token_event)
  1981.       self.need_refresh_token = true
  1982.   end
  1983.   
  1984.   #--------------------------------------------------------------------------
  1985.   # ● remove_token
  1986.   #--------------------------------------------------------------------------
  1987.   def remove_token(token_event)
  1988.       @events.delete(token_event.id)
  1989.       self.need_remove_tokens.push(token_event)
  1990.       self.need_refresh_token = true
  1991.   end

  1992.   #--------------------------------------------------------------------------
  1993.   # ● clear_tokens
  1994.   #--------------------------------------------------------------------------
  1995.   def clear_tokens
  1996.       $game_system.tools_on_map.clear
  1997.       $game_system.tools_on_map = []
  1998.       for event in @events.values.dup
  1999.           remove_token(event) if event.is_a?(Token_Event)
  2000.       end
  2001.       channels = ["A", "B", "C", "D"]
  2002.       for id in 1001..(token_id_shift - 1)
  2003.           for a in channels
  2004.               key = [self.map_id, id, a]
  2005.               $game_self_switches.delete(key)
  2006.           end
  2007.       end
  2008.       clear_token_id
  2009.   end
  2010.    
  2011.   #--------------------------------------------------------------------------
  2012.   # ● Update
  2013.   #--------------------------------------------------------------------------      
  2014.   alias x_temp_tool_hash_update update
  2015.   def update(main = false)
  2016.       x_temp_tool_hash_update(main)
  2017.       update_add_tool_hash
  2018.   end

  2019.   #--------------------------------------------------------------------------
  2020.   # ● Update Add Toll Hash
  2021.   #--------------------------------------------------------------------------      
  2022.   def update_add_tool_hash  
  2023.       return if $game_temp.tool_event == nil
  2024.       for i in $game_temp.tool_event
  2025.           $game_map.events[i.id] = i
  2026.           execute_tool_effects_hash(i)
  2027.       end  
  2028.       $game_temp.tool_event.clear
  2029.       $game_temp.tool_event = nil
  2030.   end
  2031.    
  2032.   #--------------------------------------------------------------------------
  2033.   # ● Execute Toll Effects Hash
  2034.   #--------------------------------------------------------------------------        
  2035.   def execute_tool_effects_hash(i)
  2036.       
  2037.   end  
  2038. end

  2039. #===============================================================================
  2040. # ■ Game_SelfSwitches  
  2041. #===============================================================================
  2042. class Game_SelfSwitches
  2043.   def delete(key)
  2044.       @data.delete(key)
  2045.   end
  2046. end

  2047. #===============================================================================
  2048. # ■ Game_Map  
  2049. #===============================================================================
  2050. class Game_Map
  2051.    
  2052.   attr_accessor :token_id
  2053.   
  2054.   #--------------------------------------------------------------------------
  2055.   # ● token_id_shift
  2056.   #--------------------------------------------------------------------------  
  2057.   def token_id_shift
  2058.       @token_id  = 1000 if @token_id == nil
  2059.       @token_id += 1
  2060.       return @token_id
  2061.   end

  2062.   #--------------------------------------------------------------------------
  2063.   # ● clear_token_id
  2064.   #--------------------------------------------------------------------------  
  2065.   def clear_token_id
  2066.       @token_id = nil
  2067.   end
  2068. end

  2069. #===============================================================================
  2070. # ■ XRXS_CTS_RefreshToken
  2071. #===============================================================================
  2072. module XRXS_CTS_RefreshToken
  2073.   
  2074.   #--------------------------------------------------------------------------
  2075.   # ● refresh_token
  2076.   #--------------------------------------------------------------------------  
  2077.   def refresh_token
  2078.       for event in $game_map.need_add_tokens
  2079.           @character_sprites.push(Sprite_Character.new(@viewport1, event))
  2080.       end
  2081.       $game_map.need_add_tokens.clear
  2082.       for sprite in @character_sprites.dup
  2083.           if $game_map.need_remove_tokens.empty?
  2084.              break
  2085.           end
  2086.           if $game_map.need_remove_tokens.delete(sprite.character)
  2087.              @character_sprites.delete(sprite)
  2088.              sprite.dispose
  2089.           end
  2090.       end
  2091.       $game_map.need_refresh_token = false
  2092.   end
  2093. end

  2094. #===============================================================================
  2095. # ■  Spriteset_Map
  2096. #===============================================================================
  2097. class Spriteset_Map
  2098.   include XRXS_CTS_RefreshToken
  2099.   
  2100.   #--------------------------------------------------------------------------
  2101.   # ● Initialize
  2102.   #--------------------------------------------------------------------------   
  2103.   alias x_smap_initialize initialize
  2104.   def initialize
  2105.       setup_start
  2106.       x_smap_initialize
  2107.   end
  2108.   
  2109.   #--------------------------------------------------------------------------
  2110.   # ● Setup Start
  2111.   #--------------------------------------------------------------------------      
  2112.   def setup_start
  2113.       $game_player.reset_old_level(true)
  2114.   end
  2115.   
  2116. end

  2117. #===============================================================================
  2118. # ■ Game_Player
  2119. #===============================================================================
  2120. class Game_Player < Game_Character

  2121.   #--------------------------------------------------------------------------
  2122.   # ● x_reserve_transfer
  2123.   #--------------------------------------------------------------------------     
  2124.   alias x_reserve_transfer reserve_transfer
  2125.   def reserve_transfer(map_id, x, y, direction)
  2126.       $game_map.clear_tokens
  2127.       if $game_temp.tool_event != nil
  2128.          $game_temp.tool_event.clear
  2129.          $game_temp.tool_event = nil
  2130.       end   
  2131.       x_reserve_transfer(map_id, x, y, direction)
  2132.   end
  2133.   
  2134. end

  2135. #===============================================================================
  2136. # ■ Token_Event
  2137. #===============================================================================
  2138. class Token_Event < Game_Event
  2139.   
  2140.   #--------------------------------------------------------------------------
  2141.   # ● Token_Event
  2142.   #--------------------------------------------------------------------------
  2143.   def initialize(map_id, event)
  2144.       event.id = $game_map.token_id_shift
  2145.       super
  2146.   end
  2147.   
  2148.   #--------------------------------------------------------------------------
  2149.   # ● erase
  2150.   #--------------------------------------------------------------------------
  2151.   def erase
  2152.       super
  2153.       $game_map.remove_token(self)
  2154.   end
  2155. end


  2156. #===============================================================================
  2157. # ■  XRXS_ActionTemplate
  2158. #===============================================================================
  2159. module XRXS_ActionTemplate
  2160.   map_id = XAS_SYSTEM::ACTION_TEMPLATE_MAP_ID
  2161.   map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  2162.   @@events = map.events
  2163. end

  2164. #===============================================================================
  2165. # ■  Token_Event
  2166. #===============================================================================
  2167. class Token_Event < Game_Event
  2168.   include XRXS_ActionTemplate
  2169. end

  2170. #===============================================================================
  2171. # ■  Game_Temp
  2172. #===============================================================================
  2173. class Game_Temp
  2174.   attr_accessor :active_token
  2175. end



  2176. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2177. #■ TOOL - SHOOT COMMAND
  2178. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  2179. #===============================================================================
  2180. # ■ XAS ACTION
  2181. #===============================================================================
  2182. module XAS_ACTION
  2183.   attr_reader   :action
  2184.   attr_reader   :erased
  2185.   
  2186.   #--------------------------------------------------------------------------
  2187.   # ● shoot
  2188.   #--------------------------------------------------------------------------
  2189.   def shoot(action_id = 0)
  2190.       return if action_id == 0
  2191.       skill = $data_skills[action_id]
  2192.       return unless can_shoot?(skill)
  2193.       execute_user_effects(skill)
  2194.       execute_call_event(action_id)      
  2195.       self.action_attachment(action_id)
  2196.       execute_set_pose(action_id)
  2197.   end

  2198.   #--------------------------------------------------------------------------
  2199.   # ● Can Shoot
  2200.   #--------------------------------------------------------------------------   
  2201.   def can_shoot?(skill)
  2202.       if self.battler == nil and self.tool_id > 0
  2203.          @battler = self.action.user.battler
  2204.       end  
  2205.       return false if self.battler == nil
  2206.       return false if skill == nil
  2207.       return true if ignore_can_shoot?(skill)
  2208.       enough_cost = true
  2209.       return false if tools_on_map?(skill.id)      
  2210.       if self.battler.state_mute  
  2211.          seal_effect
  2212.          return false
  2213.       end   
  2214.       if self.battler.cast_action[4].between?(1,self.battler.cast_action[1] -1)
  2215.          return false
  2216.       end
  2217.       return false if check_cast_action?(skill)
  2218.       return false if check_auto_target_select?(skill)
  2219.       unless enough_skill_cost?(skill)
  2220.          Audio.se_play("Audio/SE/" + XAS_SOUND::ACTION_COST , 100, 100)
  2221.          return false
  2222.       end
  2223.       return true
  2224.   end
  2225.   
  2226.   #--------------------------------------------------------------------------
  2227.   # ● Ignore Can Shoot?     
  2228.   #--------------------------------------------------------------------------               
  2229.   def ignore_can_shoot?(skill)
  2230.       return false
  2231.   end
  2232.   
  2233.   #--------------------------------------------------------------------------
  2234.   # ● Tools on Map
  2235.   #--------------------------------------------------------------------------              
  2236.   def tools_on_map?(skill_id)
  2237.       return true if $game_system.tools_on_map.include?(skill_id)
  2238.       return false
  2239.   end  
  2240.   
  2241.   #--------------------------------------------------------------------------
  2242.   # ● Check Cast Action (修改BY W.S)
  2243.   #--------------------------------------------------------------------------            
  2244.   def check_cast_action?(skill)
  2245.       if self.battler.cast_action[0] != 0
  2246.          self.battler.cast_action[0] = 0
  2247.          self.battler.cast_action[1] = 0
  2248.          self.battler.cast_action[2] = 0
  2249.          self.battler.cast_action[3] = 0
  2250.          self.battler.cast_action[4] = 0
  2251.          return false
  2252.       end  
  2253.       if (skill.note =~ /<Cast Time = (\d+)>/ or skill.note =~ /<吟唱时间 = (\d+)>/) and
  2254.          $game_temp.xas_target_shoot_id == 0 and
  2255.          self.force_action_times == 0
  2256.          self.battler.cast_action[0] = skill.id
  2257.          self.battler.cast_action[1] = $1.to_i rescue 0
  2258.          self.battler.cast_action[2] = XAS_ANIMATION::CAST_TIME_ANIMATION_ID
  2259.          self.battler.cast_action[3] = 0
  2260.          self.battler.cast_action[4] = 0
  2261.          self.animation_id = self.battler.cast_action[2]
  2262.          return true
  2263.       end      
  2264.       return false
  2265.   end
  2266.   
  2267.   #--------------------------------------------------------------------------
  2268.   # ● Check Auto Target Select(修改BY W.S)
  2269.   #--------------------------------------------------------------------------         
  2270.   def check_auto_target_select?(skill)
  2271.       return false if self.is_a?(Game_Event)
  2272.       if skill.note =~ /<Auto Target>/ or skill.note =~ /<瞄准>/
  2273.          if $game_temp.xas_target_shoot_id == 0
  2274.             $game_temp.xas_target_shoot_id = skill.id
  2275.             $game_map.check_events_on_screen
  2276.             SceneManager.call(Scene_Target_Select)
  2277.             return true
  2278.          end         
  2279.       end  
  2280.       return false
  2281.   end
  2282.   
  2283.   #--------------------------------------------------------------------------
  2284.   # ● enough_skill_cost?
  2285.   #--------------------------------------------------------------------------         
  2286.   def enough_skill_cost?(skill)
  2287.       return false unless enough_mp_cost?(skill)         
  2288.       return false unless enough_item_cost?(skill)      
  2289.       return true
  2290.   end
  2291.    
  2292.   #--------------------------------------------------------------------------
  2293.   # ● Enough MP Cost
  2294.   #--------------------------------------------------------------------------        
  2295.   def enough_mp_cost?(skill)  
  2296.       if @force_action_times > 0
  2297.          return true if @force_action == "All Shoot"
  2298.          return true if @force_action == "Four Shoot"  
  2299.          return true if @force_action == "Three Shoot"
  2300.          return true if @force_action == "Two Shoot"
  2301.       end
  2302.       if self.battler.mp < skill.mp_cost
  2303.          self.battler.damage = XAS_WORD::NO_MP
  2304.          self.battler.damage_pop = true
  2305.          return false
  2306.       else   
  2307.          self.battler.mp -= skill.mp_cost
  2308.          return true
  2309.       end
  2310.       return true
  2311.   end  
  2312.   
  2313.   #--------------------------------------------------------------------------
  2314.   # ● Enough MP Cost
  2315.   #--------------------------------------------------------------------------      
  2316.   def enough_item_cost?(skill)
  2317.       return true if self.battler.is_a?(Game_Enemy)
  2318.       if @force_action_times > 0
  2319.          return true if @force_action == "All Shoot"
  2320.          return true if @force_action == "Four Shoot"
  2321.          return true if @force_action == "Three Shoot"
  2322.          return true if @force_action == "Two Shoot"
  2323.        end      
  2324.         if skill.note =~ /<Item Cost = (\d+)>/
  2325.           skill.note =~ /<Item Cost = (\d+)>/
  2326.           elsif skill.note =~ /<道具消耗 = (\d+)>/
  2327.           skill.note =~ /<道具消耗 = (\d+)>/
  2328.           end
  2329.       item_id = $1.to_i
  2330.       if item_id != nil and item_id != 0
  2331.          item_cost = $data_items[item_id]
  2332.          number = $game_party.item_number(item_cost)
  2333.          if number == 0 or number == nil
  2334.             self.battler.damage = XAS_WORD::NO_ITEM
  2335.             self.battler.damage_pop = true
  2336.             return false
  2337.          else
  2338.             $game_party.lose_item(item_cost, 1, false)
  2339.             return true
  2340.          end            
  2341.       end   
  2342.       return true
  2343.   end   
  2344.   
  2345.   #--------------------------------------------------------------------------
  2346.   # ● Execute User Effects
  2347.   #--------------------------------------------------------------------------  
  2348.   def execute_user_effects(skill)
  2349.       self.battler.shield = false
  2350.       #Animation
  2351.       if skill.note =~ /<Cast Ani = (\d+)>/ or skill.note =~ /<吟唱动画 = (\d+)>/
  2352.          ani_id = $1.to_i     
  2353.          if ani_id != nil
  2354.             self.animation_id = ani_id
  2355.          end   
  2356.       end
  2357.       unless @force_action_times > 0
  2358.           #All Directions
  2359.           if skill.note =~ /<All Directions>/ or skill.note =~ /<八方射击>/
  2360.              @force_action = "All Shoot"
  2361.              @force_action_times = 8        
  2362.           elsif skill.note =~ /<Four Directions>/ or skill.note =~ /<四方射击>/
  2363.              @force_action = "Four Shoot"
  2364.              @force_action_times = 4      
  2365.           elsif skill.note =~ /<Three Directions>/ or skill.note =~ /<三向射击>/
  2366.              @force_action = "Three Shoot"
  2367.              @force_action_times = 3        
  2368.           elsif skill.note =~ /<Two Directions>/ or skill.note =~ /<前后射击>/
  2369.              @force_action = "Two Shoot"
  2370.              @force_action_times = 2         
  2371.           end  
  2372.       end  
  2373.   end
  2374.    
  2375.   #--------------------------------------------------------------------------
  2376.   # ● Execute Set Pose
  2377.   #--------------------------------------------------------------------------      
  2378.   def execute_set_pose(action_id)
  2379.       @action.duration = @action.sunflag
  2380.       make_pose(@action.self_motion, @action.sunflag )
  2381.       @pattern = 0
  2382.       @pattern_count  = 0
  2383.       @step_anime = true
  2384.       @self_motion = nil      
  2385.       self.need_refresh = true if self.is_a?(Game_Player)
  2386.   end  
  2387.    
  2388.   #--------------------------------------------------------------------------
  2389.   # ● execute_call_event
  2390.   #--------------------------------------------------------------------------  
  2391.   def execute_call_event(action_id)
  2392.       bullet_token = Token_Bullet.new(self, action_id)
  2393.       $game_map.add_token(bullet_token)
  2394.       return bullet_token
  2395.   end
  2396.       
  2397.   #--------------------------------------------------------------------------
  2398.   # ● action_attachment
  2399.   #--------------------------------------------------------------------------
  2400.   def action_attachment(action_id)
  2401.       @action = Game_Action_XAS.new(self, action_id)
  2402.       @action.attachment(action_id)
  2403.   end
  2404.   
  2405. end  


  2406. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2407. #■ TOOL - SHOOT SETTING
  2408. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  2409. #===============================================================================
  2410. # ■ Game_Action_XAS
  2411. #===============================================================================
  2412. class Game_Action_XAS
  2413.   
  2414.   attr_accessor   :user
  2415.   attr_accessor   :id                    
  2416.   attr_accessor   :attack_id            
  2417.   attr_accessor   :attack_range
  2418.   attr_accessor   :attack_range_type
  2419.   attr_accessor   :hit_events
  2420.   attr_accessor   :now_count
  2421.   attr_accessor   :pre_now_count
  2422.   attr_accessor   :duration
  2423.   attr_accessor   :blow_power
  2424.   attr_accessor   :piercing
  2425.   attr_accessor   :ignore_knockback_invincible
  2426.   attr_accessor   :target_invunerable_duration
  2427.   attr_accessor   :multi_hit
  2428.   attr_accessor   :ally_damage
  2429.   attr_accessor   :all_damage
  2430.   attr_accessor   :sunflag
  2431.   attr_accessor   :self_motion
  2432.   attr_accessor   :second_animation_id
  2433.   attr_accessor   :third_animation_id
  2434.   attr_accessor   :attack_range_type
  2435.   attr_accessor   :attack_range_plan
  2436.   attr_accessor   :blow_power
  2437.   attr_accessor   :ignore_guard
  2438.   attr_accessor   :user_invincible  
  2439.   attr_accessor   :short_range
  2440.   attr_accessor   :first_impact_time
  2441.   attr_accessor   :animation_time
  2442.   attr_accessor   :duration
  2443.   attr_accessor   :item_cost
  2444.   attr_accessor   :hit_shake
  2445.   attr_accessor   :hit_hold_target
  2446.   attr_accessor   :hit_bounce
  2447.   attr_accessor   :sticky
  2448.   attr_accessor   :reflectable
  2449.   attr_accessor   :can_reflect
  2450.   attr_accessor   :attack_id_plan
  2451.   attr_accessor   :hit_action
  2452.   attr_accessor   :fake_id
  2453.   attr_accessor   :impact
  2454.   
  2455.   #--------------------------------------------------------------------------
  2456.   # ● initialize
  2457.   #--------------------------------------------------------------------------
  2458.   def initialize(user, action_id)
  2459.       @user        = user
  2460.       @id          = action_id
  2461.       @now_count   = 0
  2462.       @duration    = nil
  2463.       @attack_id   = 0
  2464.       @attack_range = 0
  2465.       @hit_events  = []
  2466.       @blow_power  = 0
  2467.       @skill = $data_skills[action_id]
  2468.       @ignore_knockback_invincible = false
  2469.       @multi_hit = false
  2470.       @piercing = false
  2471.       @all_damage = false
  2472.       @ally_damage = false
  2473.       @ignore_guard = false
  2474.       @sunflag = 10
  2475.       @duration = 10
  2476.       @self_motion = ""
  2477.       @attack_range_type = 1
  2478.       @attack_range_plan = 1
  2479.       @blow_power = 1
  2480.       @first_impact_time  = 0
  2481.       @animation_time = []
  2482.       @target_invunerable_duration = 10
  2483.       @second_animation_id = 0
  2484.       @third_animation_id = 0
  2485.       @user_invincible = false
  2486.       @short_range = false
  2487.       @item_cost = 0
  2488.       @hit_shake = false
  2489.       @hit_hold_target = false
  2490.       @hit_bounce = false
  2491.       @sticky = false
  2492.       @reflectable = false
  2493.       @can_reflect = false
  2494.       @hit_action = 0
  2495.       @fake_id = false
  2496.       @impact = true
  2497.   end
  2498.   
  2499.   #--------------------------------------------------------------------------
  2500.   # ● attachment (修改 BY W.S)
  2501.   #--------------------------------------------------------------------------
  2502.   def attachment(action_id)
  2503.       @attack_id_plan = [action_id]
  2504.       if @skill.note =~ /<Sunflag = (\d+)>/ or /<动作时间 = (\d+)>/
  2505.          @sunflag = $1.to_i
  2506.       end
  2507.       if @skill.note =~ /<Duration = (\d+)>/ or  @skill.note =~ /<存在时间 = (\d+)>/
  2508.          @duration = $1.to_i
  2509.       end
  2510.       if @skill.note =~ /<Pose = (\S+)>/ or @skill.note =~ /<行走图 = (\S+)>/
  2511.          @self_motion = $1.to_s
  2512.       end
  2513.       if @skill.note =~ /<Area = (\w+)>/
  2514.          case $1
  2515.             when "CROSS"   
  2516.                area = 7
  2517.             when "WALL"
  2518.                area = 6        
  2519.             when "FRONTRHOMBUS"  
  2520.                area = 5
  2521.             when "FRONTSQUARE"
  2522.                area = 4
  2523.             when "LINE"
  2524.                area = 3
  2525.             when "SQUARE"
  2526.                area = 2               
  2527.             else   
  2528.                area = 1
  2529.              end   
  2530.       elsif @skill.note =~ /<区域 = (\w+)>/
  2531.          case $1
  2532.             when "十字"   
  2533.                area = 7
  2534.             when "墙"
  2535.                area = 6        
  2536.             when "半菱形"  
  2537.                area = 5
  2538.             when "半矩形"
  2539.                area = 4
  2540.             when "直线"
  2541.                area = 3
  2542.             when "矩形"
  2543.                area = 2               
  2544.             else   
  2545.                area = 1
  2546.          end     
  2547.          @attack_range_type = area
  2548.        end
  2549.       if @skill.note =~ /<Range = (\d+)>/ or  @skill.note =~ /<范围 = (\d+)>/
  2550.          @attack_range_plan = [$1.to_i]
  2551.       end
  2552.       if @skill.note =~ /<Blow Power = (\d+)>/  or @skill.note =~ /<击退格数 = (\d+)>/
  2553.          @blow_power = $1.to_i
  2554.       end   
  2555.       if @skill.note =~ /<Impact Time = (\d+)>/ or   @skill.note =~ /<影响时间 = (\d+)>/ or @skill.note =~  /<Impact Time  = (\d+)>/  
  2556.          @first_impact_time = $1.to_i

  2557.        end   
  2558.       if @skill.note =~ /<Animation Time = (\d+) - (\d+)>/ or @skill.note =~ /<动画时间 = (\d+) - (\d+)>/
  2559.          @animation_time[0] = $1.to_i
  2560.          @animation_time[1] = $2.to_i
  2561.       end
  2562.       if @skill.note =~ /<Target Invunerable = (\d+)>/ or @skill.note =~ /<伤害间隔 = (\d+)>/
  2563.          @target_invunerable_duration = $1.to_i
  2564.       end  
  2565.       if @skill.note =~ /<Tool Hit Ani = (\d+)>/ or @skill.note =~ /<击中动画 = (\d+)>/      
  2566.          @second_animation_id = $1.to_i
  2567.       end         
  2568.       if @skill.note =~ /<User Hit Ani = (\d+)>/ or @skill.note =~ /<使用动画 = (\d+)>/      
  2569.          @third_animation_id = $1.to_i
  2570.       end   
  2571.       if @skill.note =~ /<Item Cost = (\d+)>/  or   @skill.note =~ /<消耗道具 = (\d+)>/
  2572.          @item_cost = $1.to_i
  2573.       end         
  2574.       if @skill.note =~ /<Link Action ID = (\d+)>/  or @skill.note =~ /<连接技能ID = (\d+)>/ or @skill.note =~ /<连接技能 = (\d+)>/
  2575.          if user.battler != nil
  2576.             user.battler.x_combo[0] = $1.to_i
  2577.             user.battler.x_combo[2] = @sunflag + 20
  2578.          end
  2579.       else     
  2580.          if user.battler != nil
  2581.             user.battler.x_combo[0] = 0
  2582.             user.battler.x_combo[1] = 0
  2583.             user.battler.x_combo[2] = 0
  2584.          end            
  2585.       end   
  2586.       if @skill.note =~ /<Hit Action ID = (\d+)>/ or @skill.note =~ /<攻击动作ID = (\d+)>/
  2587.          @hit_action = $1.to_i
  2588.       end
  2589.       if @skill.note =~ /<Ignore Knockback>/ or @skill.note =~ /<忽略击倒>/ or @skill.note =~ /<忽略击破>/
  2590.          @ignore_knockback_invincible = true
  2591.       end      
  2592.       if @skill.note =~ /<Multi Hit>/ or @skill.note =~ /<多次连击>/ or @skill.note =~ /<多重连击>/
  2593.          @multi_hit = true  
  2594.       end         
  2595.       if @skill.note =~ /<Piercing>/ or @skill.note =~ /<贯穿>/
  2596.          @piercing = true
  2597.       end
  2598.       if @skill.note =~ /<All Damage>/ or @skill.note =~ /<全域化>/
  2599.          @all_damage = true
  2600.       end
  2601.       if @skill.note =~ /<Ally Damage>/ or @skill.note =~ /<己方伤害>/
  2602.          @ally_damage = true
  2603.       end      
  2604.       if @skill.note =~ /<User Invincible>/ or @skill.note =~ /<使用者无敌>/
  2605.          @user_invincible = true
  2606.       end      
  2607.       if @skill.note =~ /<Ignore Guard>/ or @skill.note =~ /<忽略防御>/
  2608.          @ignore_guard = true
  2609.       end      
  2610.       if @skill.note =~ /<One Action>/ or @skill.note =~ /<等待结束>/ or @skill.note =~ /<等待完成>/
  2611.          unless $game_system.tools_on_map.include?(action_id)   
  2612.                 $game_system.tools_on_map.push(action_id)
  2613.          end
  2614.       end      
  2615.       if @skill.note =~ /<Shake>/ or @skill.note =~ /<震动>/ or @skill.note =~ /<地震>/
  2616.          @hit_shake = true
  2617.       end
  2618.       if @skill.note =~ /<User Range>/ or @skill.note =~ /<使用者属性>/
  2619.          @short_range = true
  2620.       end      
  2621.       if @skill.note =~ /<Hit Hold Target>/ or @skill.note =~ /<按键持续>/
  2622.          @hit_hold_target = true
  2623.       end        
  2624.       if @skill.note =~ /<Hit Sticky Target>/ or @skill.note =~ /<追踪>/
  2625.          @sticky = true
  2626.       end        
  2627.       if @skill.note =~ /<Hit Bounce Direction>/ or @skill.note =~ /<击中转向>/
  2628.          @hit_bounce = true
  2629.       end   
  2630.       if @skill.note =~ /<Reflectable>/ or @skill.note =~ /<允许反射>/
  2631.          @reflectable = true
  2632.       end        
  2633.       if @skill.note =~ /<Can Reflect>/ or @skill.note =~ /<允许反击>/
  2634.          @can_reflect = true
  2635.       end  
  2636.       if @skill.note =~ /<Disable Hit>/ or @skill.note =~ /<不计入连击>/
  2637.          @impact = false
  2638.       end
  2639.       @sunflag = 1 if @sunflag <= 0
  2640.   end
  2641.   
  2642.   #--------------------------------------------------------------------------
  2643.   # ● update
  2644.   #--------------------------------------------------------------------------
  2645.   def update
  2646.       @first_impact_time -= 1 if @first_impact_time > 0
  2647.       if @attack_id_plan != nil
  2648.          id = @attack_id_plan[@now_count]
  2649.          unless id.nil?
  2650.            @attack_id = id
  2651.            @hit_events.clear
  2652.            @hit_events.push(self.user) unless @all_damage or @ally_damage
  2653.          end
  2654.       end
  2655.       if @attack_range_plan != nil
  2656.          range = @attack_range_plan[@now_count]
  2657.          @attack_range = range unless range.nil?
  2658.       end
  2659.       @now_count += 1
  2660.   end  
  2661.   
  2662.   #--------------------------------------------------------------------------
  2663.   # ● done?
  2664.   #--------------------------------------------------------------------------
  2665.   def done?
  2666.       return (self.duration.to_i > 0 and self.now_count >= self.duration)
  2667.   end
  2668. end

  2669. #===============================================================================
  2670. # ■ Token_Bullet  
  2671. #===============================================================================
  2672. class Token_Bullet < Token_Event
  2673. include XRXS_ActionTemplate
  2674.   #--------------------------------------------------------------------------
  2675.   # ● initialize
  2676.   #--------------------------------------------------------------------------
  2677.   def initialize(user, action_id)
  2678.       event_id = action_id
  2679.       skill = $data_skills[action_id]
  2680.       if skill.note =~ /<Event ID = (\d+)>/ or skill.note =~ /<事件ID = (\d+)>/
  2681.          event_id = $1.to_i
  2682.       end  
  2683.       original_event = @@events[event_id]
  2684.       if original_event == nil
  2685.          msgbox("这里没有 对应的事件 ID " + event_id.to_s + " 在 Tool Map中!")
  2686.          SceneManager.exit
  2687.          return
  2688.       end  
  2689.       event = original_event.dup
  2690.       event.x = user.x
  2691.       event.y = user.y
  2692.       pre_direction = event.pages[0].graphic.direction
  2693.       event.pages[0].graphic.direction = user.direction
  2694.       @character_name = event.pages[0].graphic
  2695.       super($game_map.map_id, event)
  2696.       self.action_attachment(action_id)
  2697.       self.tool_id = action_id
  2698.       self.diagonal = false
  2699.       self.diagonal_direction = 0
  2700.       self.sprite_angle_enable = false
  2701.       @action.user = user
  2702.       @remain_for_an_act = @action.duration.is_a?(Numeric)
  2703.       check_tool_effects(user,skill,pre_direction)
  2704.   end
  2705.   
  2706.   #--------------------------------------------------------------------------
  2707.   # ● update
  2708.   #--------------------------------------------------------------------------
  2709.   def update
  2710.       super
  2711.       if @action == nil and @remain_for_an_act
  2712.          erase
  2713.          $game_system.tools_on_map.delete(self.tool_id)
  2714.       end
  2715.       check_event_trigger_attack
  2716.   end
  2717. end

  2718. #===============================================================================
  2719. # ■ Game Player
  2720. #===============================================================================
  2721. class Game_Player < Game_Character
  2722.   attr_accessor :need_refresh
  2723. end

  2724. #===============================================================================
  2725. # ■ Token_Bullet  
  2726. #===============================================================================
  2727. class Token_Bullet < Token_Event
  2728.   
  2729.   #--------------------------------------------------------------------------
  2730.   # ● Check Tool Effects
  2731.   #--------------------------------------------------------------------------
  2732.   def check_tool_effects(user,skill,pre_direction)
  2733.       if @action.ally_damage or @action.all_damage   
  2734.          user.battler.invunerable_duration = 0
  2735.       end
  2736.      # Force Update Out Screen
  2737.      if user.battler.sensor_range >= 15 or
  2738.         skill.note =~ /<Update Out Screen>/ or skill.note =~ /<屏幕外刷新>/
  2739.         self.force_update = true
  2740.      end  
  2741.      #Diagonal Effect
  2742.      if skill.note =~ /<Diagonal>/ or skill.note =~ /<斜角>/ or
  2743.         skill.note =~ /<All Direction>/ or skill.note =~ /<八方射击>/ or
  2744.         skill.note =~ /<Three Direction>/ or skill.note =~ /<三向射击>/
  2745.         self.diagonal = true
  2746.         self.diagonal_direction = user.diagonal_direction
  2747.         self.sprite_angle_enable = true
  2748.         user.diagonal_time = XAS_BA::DIAGONAL_DURATION if user.diagonal_direction != 0
  2749.         user.diagonal = true if user.tool_id > 0        
  2750.      end
  2751.      #Auto Target
  2752.      if skill.note =~ /<Auto Target>/ or skill.note =~ /<瞄准>/
  2753.         if user.is_a?(Game_Event)
  2754.            self.moveto($game_player.x, $game_player.y)
  2755.         else  
  2756.            moveto($game_temp.xas_target_x, $game_temp.xas_target_y)
  2757.            $game_temp.xas_target_x = 0
  2758.            $game_temp.xas_target_y = 0      
  2759.            $game_temp.xas_target_time = 0
  2760.            $game_temp.xas_target_shoot_id = 0
  2761.         end   
  2762.      end
  2763.      #Barrier
  2764.      if skill.note =~ /<Barrier>/ or skill.note =~ /<跟随>/ or skill.note =~ /<跟随角色>/
  2765.         self.tool_effect = "Barrier"
  2766.      end
  2767.      #Boomerang
  2768.      if skill.note =~ /<Boomerang = (\d+)>/ or skill.note =~ /<回旋镖 = (\d+)>/
  2769.         self.tool_effect = "Boomerang"
  2770.         self.action.duration = 1000
  2771.         self.diagonal = true
  2772.         self.diagonal_direction = user.diagonal_direction
  2773.         self.force_update = true
  2774.         @move_frequency = 6
  2775.         @move_speed = 5
  2776.         @direction_fix = false
  2777.         @walk_anime = true
  2778.         @step_anime = true
  2779.         @force_action = "Forward"
  2780.         @force_action_times = $1.to_i
  2781.      end     
  2782.       
  2783.    end
  2784. end



  2785. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2786. #■ TOOL - AREA
  2787. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  2788. #===============================================================================
  2789. # ■ XAS ACTION
  2790. #===============================================================================
  2791. module XAS_ACTION

  2792.   #--------------------------------------------------------------------------
  2793.   # ● action_update
  2794.   #--------------------------------------------------------------------------
  2795.   def action_update
  2796.       return unless @action.is_a?(Game_Action_XAS)
  2797.       if @action.animation_time != [] and
  2798.          @action.animation_time[0] == @action.now_count
  2799.          animation_id = @action.animation_time[1]
  2800.          unless self.is_a?(Game_Player) or self.tool_id == 0
  2801.              self.animation_id = animation_id
  2802.          end
  2803.       end
  2804.       @action.update
  2805.   end
  2806.    
  2807.   #--------------------------------------------------------------------------
  2808.   # ● Can Impact Target
  2809.   #--------------------------------------------------------------------------  
  2810.   def can_impact_target?
  2811.       return false if @action.nil?
  2812.       return false if @action.attack_id == 0
  2813.       return false if @action.first_impact_time > 0
  2814.       return false if @action.impact == false
  2815.       return false if self.jumping?
  2816.       return true
  2817.   end  
  2818.   
  2819.   #--------------------------------------------------------------------------
  2820.   # ● check_event_trigger_attack
  2821.   #--------------------------------------------------------------------------
  2822.   def check_event_trigger_attack()
  2823.       return unless can_impact_target?
  2824.       hit_check = false
  2825.       range = @action.attack_range
  2826.       hit = []
  2827.       targets = [$game_player] + $game_map.events.values
  2828.       for event in targets
  2829.         next if event == self or
  2830.                 @action.hit_events.include?(event) or event.erased
  2831.         body_size      = event.body_size
  2832.         event_center_x = event.x
  2833.         event_center_y = event.y - body_size
  2834.         if @action.short_range
  2835.            dx = event_center_x - $game_player.x
  2836.            dy = event_center_y - $game_player.y
  2837.         else
  2838.            dx = event_center_x - self.x
  2839.            dy = event_center_y - self.y
  2840.          end
  2841.         dx = (dx >= 0 ? [dx - body_size, 0].max : [dx + body_size, 0].min)
  2842.         dy = (dy >= 0 ? [dy - body_size, 0].max : [dy + body_size, 0].min)
  2843.         hit_check = true if in_range?(dx,dy,event,range)
  2844.         hit.push(event) if hit_check
  2845.         hit_check = false
  2846.       end
  2847.       for event in hit
  2848.           if event.action_effect(self, self.action.attack_id)
  2849.              hit_check = true
  2850.           end
  2851.           if event.action_effect_page(self, self.action.attack_id)
  2852.              hit_check = true
  2853.          end         
  2854.          @action.hit_events.push(event) unless @action.multi_hit
  2855.          end
  2856.       if hit_check
  2857.          $game_temp.active_token = self
  2858.       end
  2859.   end

  2860.   #--------------------------------------------------------------------------
  2861.   # ● In Range?
  2862.   #--------------------------------------------------------------------------  
  2863.   def in_range?(dx,dy,event,range)
  2864.       case @action.attack_range_type
  2865.             when 1 #RHOMBUS
  2866.               return true if (dx.abs + dy.abs <= range)
  2867.             when 2 #SQUARE
  2868.               return true if (dx.abs <= range and dy.abs <= range)
  2869.             when 3 #LINE
  2870.               case self.direction
  2871.                   when 2
  2872.                     return true if (dx == 0 and dy >= 0 and dy <= range)
  2873.                   when 8
  2874.                     return true if (dx == 0 and dy <= 0 and dy >= -range)
  2875.                   when 6
  2876.                     return true if (dy == 0 and dx >= 0 and dx <= range)
  2877.                   when 4
  2878.                     return true if (dy == 0 and dx <= 0 and dx >= -range)
  2879.               end
  2880.             when 4  #FRONT SQUARE   
  2881.               case self.direction
  2882.                  when 2
  2883.                     return true if (dx.abs <= range and dy >= 0 and dy.abs <= range)
  2884.                  when 4
  2885.                     return true if (dx.abs <= range and dx <= 0 and dy.abs <= range)  
  2886.                  when 6
  2887.                     return true if (dx.abs <= range and dx >= 0 and dy.abs <= range)
  2888.                  when 8
  2889.                     return true if (dx.abs <= range and dy <= 0 and dy.abs <= range)
  2890.               end              
  2891.             when 5  #FRONT RHOMBUS     
  2892.               case self.direction
  2893.                   when 2
  2894.                     return true if (dx.abs + dy.abs <= range and dy >= 0)
  2895.                   when 8
  2896.                     return true if (dx.abs + dy.abs <= range and dy <= 0)
  2897.                   when 6
  2898.                     return true if (dx.abs + dy.abs <= range and dx >= 0)
  2899.                   when 4
  2900.                     return true if (dx.abs + dy.abs <= range and dx <= 0)
  2901.               end         
  2902.             when 6  #WALL
  2903.               case self.direction
  2904.                  when 2
  2905.                     return true if (dx.abs <= range and dy == 0 )
  2906.                  when 4
  2907.                     return true if (dy.abs <= range and dx == 0)  
  2908.                  when 6
  2909.                     return true if (dy.abs <= range and dx == 0)
  2910.                  when 8
  2911.                     return true if (dx.abs <= range and dy == 0)
  2912.                end  
  2913.             when 7 #CROSS
  2914.                  return true if (dx.abs <= range and dy == 0)
  2915.                  return true if (dy.abs <= range and dx == 0)  
  2916.             end
  2917.      return false      
  2918.   end      
  2919.   
  2920.   #--------------------------------------------------------------------------
  2921.   # ●  action_effect Page
  2922.   #--------------------------------------------------------------------------
  2923.   def action_effect_page(attacker, attack_id)
  2924.       return false unless self.is_a?(Game_Event)
  2925.       return false if attacker.action.fake_id
  2926.       if attacker.action != nil
  2927.          check_auto_effect_page(attacker, attack_id)
  2928.          check_reflectable_skills(attacker, attack_id)
  2929.       end
  2930.       for page in @event.pages
  2931.           if page.condition.variable_valid and
  2932.              page.condition.variable_id == XAS_SYSTEM::HIT_ID and
  2933.              page.condition.variable_value == attack_id
  2934.              self.reaction_valid_attack_id = attack_id
  2935.              self.refresh
  2936.              @trigger = 0
  2937.              self.start
  2938.              return true
  2939.           end
  2940.       end
  2941.       return false
  2942.   end
  2943.   
  2944.   #--------------------------------------------------------------------------
  2945.   # ● Check Reflectable Skills
  2946.   #--------------------------------------------------------------------------   
  2947.   def check_reflectable_skills(attacker, attack_id)
  2948.       return if self.tool_id == 0
  2949.       return unless self.action.reflectable
  2950.       return unless attacker.action.can_reflect
  2951.       self.action.user = attacker.action.user
  2952.       self.action.hit_events = []  
  2953.       self.turn_back
  2954.   end  
  2955.   
  2956.   #--------------------------------------------------------------------------
  2957.   # ● Check Auto Effect Page
  2958.   #--------------------------------------------------------------------------  
  2959.   def check_auto_effect_page(attacker, attack_id)
  2960.       if self.treasure_time > 0
  2961.          if can_hit_take_treasure?(attacker, attack_id)
  2962.             execute_take_treasure(attacker, attack_id)
  2963.          elsif self.temp_id == 0 and can_hold_treasure?(attacker, attack_id)   
  2964.             execute_hold_treasure(attacker, attack_id)
  2965.          end  
  2966.       end
  2967.   end
  2968.   
  2969.   #--------------------------------------------------------------------------
  2970.   # ● Can Hit Take Treasure
  2971.   #--------------------------------------------------------------------------      
  2972.   def can_hit_take_treasure?(attacker, attack_id)
  2973.       return true if attacker.action.short_range
  2974.       return false
  2975.   end
  2976.   
  2977.   #--------------------------------------------------------------------------
  2978.   # ● Can Hold Treasure?
  2979.   #--------------------------------------------------------------------------        
  2980.   def can_hold_treasure?(attacker, attack_id)
  2981.       return true if attacker.tool_effect == "Boomerang"   
  2982.       return false
  2983.   end  
  2984.   
  2985.   #--------------------------------------------------------------------------
  2986.   # ● Execute Hold Treasure
  2987.   #--------------------------------------------------------------------------      
  2988.   def execute_hold_treasure(attacker, attack_id)
  2989.       tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
  2990.       return if self.treasure_time > tr_time
  2991.       self.temp_id = attacker.id   
  2992.   end  
  2993.   
  2994.   #--------------------------------------------------------------------------
  2995.   # ● Execute Take Treasure
  2996.   #--------------------------------------------------------------------------      
  2997.   def execute_take_treasure(attacker, attack_id)
  2998.       tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
  2999.       return if self.treasure_time > tr_time
  3000.       self.x = $game_player.x
  3001.       self.y = $game_player.y
  3002.   end

  3003.   #--------------------------------------------------------------------------
  3004.   # ● body_size
  3005.   #--------------------------------------------------------------------------
  3006.   def body_size
  3007.       return 0
  3008.   end
  3009.   
  3010.   #--------------------------------------------------------------------------
  3011.   # ● action_clear
  3012.   #--------------------------------------------------------------------------
  3013.   def action_clear
  3014.       @action = nil
  3015.       @step_anime = false
  3016.   end
  3017. end

  3018. #===============================================================================
  3019. # ■ Game_Character
  3020. #===============================================================================
  3021. class Game_Character < Game_CharacterBase
  3022.     include XAS_ACTION
  3023. end

  3024. #===============================================================================
  3025. # ■  Game_Event
  3026. #===============================================================================
  3027. class Game_Event < Game_Character

  3028.   #--------------------------------------------------------------------------
  3029.   # * Refresh
  3030.   #--------------------------------------------------------------------------
  3031.   alias x_conditions_met conditions_met?
  3032.   def conditions_met?(page)
  3033.       c = page.condition
  3034.       if c.variable_valid
  3035.          if c.variable_id == XAS_SYSTEM::HIT_ID and
  3036.             c.variable_value == self.reaction_valid_attack_id
  3037.             return true
  3038.          end
  3039.        end
  3040.       x_conditions_met(page)
  3041.   end
  3042.   
  3043. end  

  3044. #===============================================================================
  3045. # ■  XAS_Dispose
  3046. #===============================================================================
  3047. module XAS_Dispose
  3048.   
  3049.   #--------------------------------------------------------------------------
  3050.   # ● update
  3051.   #--------------------------------------------------------------------------  
  3052.   def update
  3053.       action_update
  3054.       super
  3055.       if @action.is_a?(Game_Action_XAS) and @action.done?
  3056.          self.action_clear
  3057.       end
  3058.   end
  3059. end

  3060. #===============================================================================
  3061. # ■  Game_Player
  3062. #===============================================================================
  3063. class Game_Player < Game_Character
  3064.   include XAS_Dispose
  3065. end

  3066. #===============================================================================
  3067. # ■  Game_Event
  3068. #===============================================================================
  3069. class Game_Event < Game_Character
  3070.   include XAS_Dispose
  3071. end

  3072. #===============================================================================
  3073. # ■ XAS_StopToAction
  3074. #===============================================================================
  3075. module XAS_StopToAction
  3076.   
  3077.   #--------------------------------------------------------------------------
  3078.   # ● acting?
  3079.   #--------------------------------------------------------------------------  
  3080.   def acting?
  3081.       return false if self.battler == nil
  3082.       return true if self.battler.shield
  3083.       return true if self.action != nil
  3084.       return false
  3085.   end
  3086.   
  3087.   #--------------------------------------------------------------------------
  3088.   # ● moving?
  3089.   #--------------------------------------------------------------------------  
  3090.   def moving?
  3091.       return (super or self.acting? or self.stop)
  3092.   end
  3093.    
  3094. end

  3095. #===============================================================================
  3096. # ■ Game_Player  
  3097. #===============================================================================
  3098. class Game_Player < Game_Character
  3099.   include XAS_StopToAction
  3100. end

  3101. #===============================================================================
  3102. # ■ Game_Event  
  3103. #===============================================================================
  3104. class Game_Event < Game_Character
  3105.   attr_accessor :reaction_valid_attack_id
  3106. end


  3107. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3108. #■ TOOL - HIT EFFECT
  3109. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  3110. #===============================================================================
  3111. # ■ XRXS_BattlerAttachment
  3112. #==============================================================================
  3113. module XRXS_BattlerAttachment

  3114.   #--------------------------------------------------------------------------
  3115.   # ● Can Hit Base?
  3116.   #--------------------------------------------------------------------------   
  3117.   def can_hit_base?(bullet, action_id)
  3118.       return false unless $game_system.xas_battle
  3119.       return false if self.battler == nil
  3120.       return false if bullet == nil
  3121.       return false if action_id == nil or action_id <= 0
  3122.       return false if self.can_update == false
  3123.       return true
  3124.   end  
  3125.   
  3126.   #--------------------------------------------------------------------------
  3127.   # ● Action Effect
  3128.   #--------------------------------------------------------------------------  
  3129.   def action_effect(bullet, action_id)
  3130.       return unless can_hit_base?(bullet, action_id)
  3131.       skill = $data_skills[action_id]
  3132.       user = bullet.action.user
  3133.       attacker = (user == nil ? nil : user.battler)     
  3134.       tar_invu = bullet.action.target_invunerable_duration
  3135.       #CAN HIT?
  3136.       return unless action_can_hit_target?(bullet, user, skill,tar_invu)
  3137.       #REFLECT STATE
  3138.       return if reflect_state?(bullet, skill)
  3139.       #SHIELD
  3140.       if target_shield_enabled?(attacker, skill, bullet)
  3141.          execute_guard_effect(user, skill, bullet, tar_invu)
  3142.          return
  3143.       end
  3144.       #INVUNERABLE ACTIONS
  3145.       if target_invunerable_actions?(user, skill, bullet)
  3146.          execute_guard_effect(user, skill, bullet, tar_invu, false)
  3147.          return
  3148.       end   
  3149.       #GUARD DIRECTIONS
  3150.       if target_guard_directions?(user, skill, bullet)
  3151.          execute_guard_effect(user, skill, bullet, tar_invu)
  3152.          return        
  3153.       end  
  3154.       execute_hit_effect(attacker,skill, bullet , user, tar_invu )
  3155.       if self.is_a?(Game_Player)
  3156.          self.need_refresh = true
  3157.       end
  3158.   end

  3159.   #--------------------------------------------------------------------------
  3160.   # ● Reflect State?
  3161.   #--------------------------------------------------------------------------                 
  3162.   def reflect_state?(bullet, skill)
  3163.       if  bullet.action.reflectable and self.battler.state_reflect
  3164.           if skill.note =~ /<Auto Target>/ or skill.note =~ /<瞄准>/
  3165.              bullet.moveto(bullet.action.user.x,bullet.action.user.y)
  3166.           else   
  3167.              bullet.turn_back
  3168.           end  
  3169.           bullet.action.user = self
  3170.           bullet.action.hit_events = []           
  3171.           bullet.turn_back
  3172. #          bullet.jump(0,0)
  3173.           bullet.turn_back
  3174.           self.battler.damage = XAS_WORD::REFLECT
  3175.           self.battler.damage_pop = true
  3176.           self.animation_id = XAS_ANIMATION::REFLECT_ANIMATION_ID
  3177.           self.battler.invunerable_duration = 20
  3178.          return true
  3179.      end
  3180.      return false     
  3181.   end
  3182.   
  3183. #--------------------------------------------------------------------------
  3184. # ● Target Guard Directions?
  3185. #--------------------------------------------------------------------------   
  3186. def target_guard_directions?(user, skill, bullet)
  3187.      return false if self.battler.guard == false
  3188.      return false if bullet.action.ignore_guard
  3189.      if self.battler.guard_directions.include?(2) and
  3190.         ((self.direction == 2 and bullet.direction == 8) or
  3191.          (self.direction == 8 and bullet.direction == 2) or
  3192.          (self.direction == 6 and bullet.direction == 4) or
  3193.          (self.direction == 4 and bullet.direction == 6))
  3194.          return true
  3195.      elsif self.battler.guard_directions.include?(8) and
  3196.         ((self.direction == 8 and bullet.direction == 8) or
  3197.          (self.direction == 2 and bullet.direction == 2) or
  3198.          (self.direction == 6 and bullet.direction == 6) or
  3199.          (self.direction == 4 and bullet.direction == 4))
  3200.          return true
  3201.      elsif self.battler.guard_directions.include?(4) and
  3202.         ((self.direction == 2 and bullet.direction == 4) or
  3203.          (self.direction == 8 and bullet.direction == 6) or
  3204.          (self.direction == 6 and bullet.direction == 2) or
  3205.          (self.direction == 4 and bullet.direction == 8))
  3206.          return true         
  3207.      elsif self.battler.guard_directions.include?(6) and
  3208.         ((self.direction == 2 and bullet.direction == 6) or
  3209.          (self.direction == 8 and bullet.direction == 4) or
  3210.          (self.direction == 6 and bullet.direction == 8) or
  3211.          (self.direction == 4 and bullet.direction == 2))
  3212.          return true
  3213.      end      
  3214.      return false
  3215.   end
  3216.       
  3217.   #--------------------------------------------------------------------------
  3218.   # ● Target Invunerable Actions?
  3219.   #--------------------------------------------------------------------------            
  3220.   def target_invunerable_actions?(user, skill, bullet)
  3221.       return true if self.battler.invunerable_actions.include?(skill.id)
  3222.       return false
  3223.   end
  3224.   
  3225.   #--------------------------------------------------------------------------
  3226.   # ● Shoot Target Shield
  3227.   #--------------------------------------------------------------------------         
  3228.   def shoot_target_shield?(bullet,user, skill)
  3229.       return false unless self.battler.shield
  3230.       return false if bullet.action.ignore_guard
  3231.       return true if face_direction?(bullet)
  3232.       return false
  3233.   end
  3234.   
  3235.   #--------------------------------------------------------------------------
  3236.   # ● Action can hit target?
  3237.   #--------------------------------------------------------------------------        
  3238.   def action_can_hit_target?(bullet, user, skill,tar_invu)
  3239.       if user == nil
  3240.          return false
  3241.       end   
  3242.       if self.battler.invunerable
  3243.          return false
  3244.       end  
  3245.       if self.battler.dead?
  3246.          return false
  3247.       end   
  3248.       if self.battler.invunerable_duration > 0
  3249.          return false
  3250.       end   
  3251.       if @knock_back_duration != nil
  3252.          return false unless bullet.action.ignore_knockback_invincible
  3253.       end
  3254.       if bullet.action.first_impact_time > 0
  3255.          return false
  3256.       end
  3257.       if self.action != nil and self.action.user_invincible
  3258.          unless self.action.ally_damage and bullet.action.user == self.action.user
  3259.              return false
  3260.          end
  3261.       end  
  3262.       unless bullet.action.all_damage
  3263.              if bullet.action.ally_damage
  3264.                 if user.battler.is_a?(Game_Actor)
  3265.                    return false if self.battler.is_a?(Game_Enemy)
  3266.                 elsif user.battler.is_a?(Game_Enemy)
  3267.                    return false if self.battler.is_a?(Game_Actor)
  3268.                 end
  3269.              else   
  3270.                 if user.battler.is_a?(Game_Actor)
  3271.                    return false if self.battler.is_a?(Game_Actor)
  3272.                 elsif user.battler.is_a?(Game_Enemy)
  3273.                    return false if self.battler.is_a?(Game_Enemy)
  3274.                 end                 
  3275.              end              
  3276.       end
  3277.       return false if target_state_invunerable?(tar_invu)
  3278.       #return false if target_reflect_action?(bullet, user)
  3279.       return true
  3280.   end
  3281.   
  3282.   #--------------------------------------------------------------------------
  3283.   # ● Target Relfect Action
  3284.   #--------------------------------------------------------------------------         
  3285.   def target_reflect_action?(bullet, user)
  3286.       return false unless bullet.action.reflectable
  3287.       for i in $game_map.events.values
  3288.           if i.tool_id > 0 and i.action.can_reflect and
  3289.              i.tool_effect == "Barrier"# and i.action.user.battler.is_a?(self.battler)
  3290.              bullet.action.user = self
  3291.              bullet.action.hit_events = []  
  3292.              bullet.turn_back
  3293.              return true
  3294.              break
  3295.           end   
  3296.       end
  3297.       return false  
  3298.   end
  3299.   
  3300.   #--------------------------------------------------------------------------
  3301.   # ● Target State Invunerable
  3302.   #--------------------------------------------------------------------------        
  3303.   def target_state_invunerable?(tar_invu)
  3304.       if self.battler.state_invunerable
  3305.          self.battler.damage = XAS_WORD::INVINCIBLE
  3306.          self.battler.damage_pop = true
  3307.          self.animation_id = XAS_ANIMATION::INVINCIBLE_ANIMATION_ID
  3308.          self.battler.invunerable_duration = tar_invu
  3309.          return true
  3310.       end
  3311.       return false
  3312.   end
  3313.   
  3314.   #--------------------------------------------------------------------------
  3315.   # ● Execute Hit Effect
  3316.   #--------------------------------------------------------------------------      
  3317.   def execute_hit_effect(attacker,skill, bullet , user, tar_invu)
  3318.       shoot_effect_before_damage(skill, bullet, user)
  3319.       execute_battler_skill_effect(attacker ,skill, user)
  3320.       if target_missed?(attacker)
  3321.          self.battler.invunerable_duration = 30
  3322.          return
  3323.       end            
  3324.       execute_damage_pop(attacker,skill)
  3325.       shoot_effect_after_damage(skill, bullet, user) if can_damage_after_effect?
  3326.       execute_state_effect(skill, user,  bullet)   
  3327.       bullet.action.duration = 1 if remove_tool_after_hit?(skill, bullet, user)
  3328.       self.battler.invunerable_duration = tar_invu
  3329.       execute_blow_effect(skill,bullet) if can_blow_effect?
  3330.       execute_animation(skill, bullet, user)
  3331.       execute_tool_effects(skill, bullet , user)
  3332.   end

  3333.   #--------------------------------------------------------------------------
  3334.   # ● Execute Tool Effects
  3335.   #--------------------------------------------------------------------------              
  3336.   def execute_tool_effects(skill, bullet , user)
  3337.       execute_sticky_effect(skill, bullet, user)
  3338.       execute_bounce_effect(skill, bullet, user)
  3339.       execute_hit_action_effect(skill, bullet, user)
  3340.   end
  3341.    
  3342.   #--------------------------------------------------------------------------
  3343.   # ● Remove Tool After Hit?
  3344.   #--------------------------------------------------------------------------            
  3345.   def remove_tool_after_hit?(skill, bullet, user)
  3346.       return true if bullet.action.piercing == false
  3347.       return false
  3348.   end  

  3349.   #--------------------------------------------------------------------------
  3350.   # ● Execute Battler Skill Effect
  3351.   #--------------------------------------------------------------------------         
  3352.   def execute_battler_skill_effect(attacker ,skill, user)
  3353.       self.battler.item_apply(attacker, skill)
  3354.   end
  3355.   
  3356.   #--------------------------------------------------------------------------
  3357.   # ● Target Missed?
  3358.   #--------------------------------------------------------------------------        
  3359.   def target_missed?(attacker)
  3360.       if self.battler.result.missed
  3361.          self.battler.damage = XAS_WORD::MISSED
  3362.          self.battler.damage_pop = true         
  3363.          return true
  3364.       end   
  3365.       if self.battler.result.evaded
  3366.          self.battler.damage = XAS_WORD::EVADED
  3367.          self.battler.damage_pop = true            
  3368.          return true
  3369.       end  
  3370.       return false
  3371.   end  
  3372.   #--------------------------------------------------------------------------
  3373.   # ● Shoot Effect Before Damage
  3374.   #--------------------------------------------------------------------------        
  3375.   def shoot_effect_before_damage(skill, bullet, user)
  3376.   end
  3377.   
  3378.   #--------------------------------------------------------------------------
  3379.   # ● Shoot Effect After Damage
  3380.   #--------------------------------------------------------------------------         
  3381.   def shoot_effect_after_damage(skill, bullet, user)
  3382.       check_counter_attack(skill)
  3383.       self.battler.passive = false
  3384.   end
  3385.   
  3386.   #--------------------------------------------------------------------------
  3387.   # ● Shoot Effect After Damage
  3388.   #--------------------------------------------------------------------------            
  3389.   def check_counter_attack(skill)
  3390.       return if self.battler.is_a?(Game_Actor)
  3391.       return if self.battler.counter_action[2] == false
  3392.       return if self.battler.counter_action[1] > 0
  3393.       counter = XAS_BA_ENEMY::COUNTER_ATTACK[self.battler.enemy_id]
  3394.       if counter != nil
  3395.          counter_action_id = counter[rand(counter.size)]
  3396.          self.battler.counter_action[0] = counter_action_id
  3397.          self.battler.counter_action[1] = 15
  3398.       end  
  3399.   end  
  3400.   
  3401.   #--------------------------------------------------------------------------
  3402.   # ● Execute Bounce Effect
  3403.   #--------------------------------------------------------------------------            
  3404.   def execute_bounce_effect(skill, bullet, user)
  3405.       return false if bullet.action.hit_bounce == false
  3406.       bullet.bounce_direction
  3407.   end
  3408.   
  3409.   #--------------------------------------------------------------------------
  3410.   # ● Execute Stick Effect
  3411.   #--------------------------------------------------------------------------           
  3412.   def execute_sticky_effect(skill, bullet, user)
  3413.       return unless bullet.action.sticky
  3414.       return if bullet.temp_id !=  0
  3415.       bullet.pre_move_speed = bullet.move_speed
  3416.       bullet.temp_id = self.id
  3417.   end
  3418.   
  3419.   #--------------------------------------------------------------------------
  3420.   # ● Execute Hit Action Effect
  3421.   #--------------------------------------------------------------------------            
  3422.   def execute_hit_action_effect(skill, bullet, user)
  3423.       return if bullet.action.hit_action == 0
  3424.       self.battler.invunerable_duration = 1
  3425.       bullet.shoot(bullet.action.hit_action)
  3426.       bullet.action.duration = 9
  3427.       bullet.action.multi_hit = false
  3428.       bullet.character_name = ""
  3429.       bullet.x_pose_duration = 0
  3430.       bullet.x_pose_name = ""
  3431.       bullet.x_pose_original_name = ""      
  3432.   end
  3433.   
  3434.   #--------------------------------------------------------------------------
  3435.   # ● Can Damage Effect
  3436.   #--------------------------------------------------------------------------         
  3437.   def can_damage_after_effect?
  3438.       return false if self.battler.damage == nil
  3439.       return false unless self.battler.damage.is_a?(Numeric)
  3440.       return true
  3441.   end  
  3442.   
  3443.   #--------------------------------------------------------------------------
  3444.   # ● Execute State Effect
  3445.   #--------------------------------------------------------------------------        
  3446.   def execute_state_effect(skill, user,  bullet)   
  3447.       if user.battler.states.size != 0
  3448.          for i in user.battler.states
  3449.              execute_state_effect_user(skill, user, bullet,i)
  3450.          end   
  3451.       end
  3452.       if self.battler.states.size != 0
  3453.          for i in self.battler.states
  3454.              execute_state_effect_target(skill, user, bullet,i)
  3455.          end   
  3456.       end
  3457.   end
  3458.   
  3459.   #--------------------------------------------------------------------------
  3460.   # ● Execute State Effect User
  3461.   #--------------------------------------------------------------------------         
  3462.   def execute_state_effect_user(skill, user, bullet,i)
  3463.   
  3464.   end
  3465.   
  3466.   #--------------------------------------------------------------------------
  3467.   # ● Execute State Target
  3468.   #--------------------------------------------------------------------------         
  3469.   def execute_state_effect_target(skill, user, bullet,i)
  3470.       #Sleep
  3471.       if self.battler.damage.is_a?(Numeric) and self.battler.damage > 0
  3472.          if i.note =~ /<Sleep>/ or  i.note =~ /<睡眠>/
  3473.             self.battler.remove_state(i.id)
  3474.          end
  3475.       end   
  3476.   end  
  3477.   
  3478.   #--------------------------------------------------------------------------
  3479.   # ● Execute Blow Effect
  3480.   #--------------------------------------------------------------------------      
  3481.   def execute_blow_effect(skill,bullet)
  3482.       if bullet.action.hit_hold_target and self.temp_id == 0     
  3483.          self.temp_id = bullet.id
  3484.          self.pre_move_speed = self.move_speed         
  3485.          self.moveto(bullet.x, bullet.y)
  3486.       end   
  3487.       $game_map.screen.start_shake(5, 5, 60) if bullet.action.hit_shake
  3488.       p = bullet.action.blow_power.to_i  
  3489.       d = bullet.direction   
  3490.       return if self.battler.damage.to_i <= 0
  3491.       return if p < 0
  3492.       self.blow(d, p)  
  3493.   end
  3494.    
  3495.   #--------------------------------------------------------------------------
  3496.   # ● Execute Animation
  3497.   #--------------------------------------------------------------------------        
  3498.   def execute_animation(skill, bullet, user)   
  3499.       self.animation_id = skill.animation_id
  3500.       tool_animation = bullet.action.second_animation_id
  3501.       user_animation = bullet.action.third_animation_id
  3502.       bullet.animation_id = tool_animation if tool_animation != 0
  3503.       user.animation_id = user_animation if user_animation != 0
  3504.   end  
  3505.    
  3506.   #--------------------------------------------------------------------------
  3507.   # ● Knock Back Disable
  3508.   #--------------------------------------------------------------------------      
  3509.   def knock_back_disable
  3510.     return false
  3511.   end
  3512.   
  3513.   #--------------------------------------------------------------------------
  3514.   # ● Dead?
  3515.   #--------------------------------------------------------------------------         
  3516.   def dead?
  3517.     return self.battler == nil ? false : self.battler.dead?
  3518.   end
  3519.   
  3520. end


  3521. #===============================================================================
  3522. # ■ XRXS_BattlerAttachment
  3523. #==============================================================================
  3524. module XRXS_BattlerAttachment

  3525.   #--------------------------------------------------------------------------
  3526.   # ● Shoot Target Shield
  3527.   #--------------------------------------------------------------------------         
  3528.   def target_shield_enabled?(attacker, skill, bullet)
  3529.       return false unless self.battler.shield
  3530.       if bullet != nil
  3531.          return false if bullet.action.ignore_guard
  3532.          return true if face_direction?(bullet)         
  3533.       else   
  3534.          return false if attacker.battler.ignore_guard
  3535.          return true if face_direction?(attacker)         
  3536.       end  
  3537.       return false
  3538.   end  

  3539.   #--------------------------------------------------------------------------
  3540.   # ● Can Blow Effect
  3541.   #--------------------------------------------------------------------------        
  3542.   def can_blow_effect?
  3543.       return false if self.battler.no_knockback
  3544.       return false if $game_map.interpreter.running?
  3545.       return true
  3546.   end  

  3547. #--------------------------------------------------------------------------
  3548. # ● Execute Guard Effect
  3549. #--------------------------------------------------------------------------      
  3550. def execute_guard_effect(attacker, skill, bullet, inv, erase_bullet = true)
  3551.      self.battler.invunerable_duration = inv
  3552.      damage_pop(XAS_WORD::GUARD)
  3553.      guard_animation_id = XAS_ANIMATION::GUARD_ANIMATION_ID
  3554.      self.animation_id = guard_animation_id if guard_animation_id != 0   
  3555.      if bullet != nil
  3556.         bullet.erase if erase_bullet
  3557.      else   
  3558.         blow_reverse(attacker) unless attacker.battler.no_knockback
  3559.      end   
  3560. end
  3561.    
  3562. #--------------------------------------------------------------------------
  3563. # ● Blow Reverse
  3564. #--------------------------------------------------------------------------      
  3565. def blow_reverse(attacker)
  3566.      return if attacker.battler.no_knockback
  3567.      case attacker.direction
  3568.         when 2
  3569.            d = 8
  3570.         when 4
  3571.            d = 6
  3572.         when 6
  3573.            d = 4
  3574.         when 8  
  3575.            d = 2
  3576.      end
  3577.      attacker.jump(0,0)   
  3578.      attacker.blow(d,1)
  3579. end

  3580. #--------------------------------------------------------------------------
  3581. # ● Can Attack Effect
  3582. #--------------------------------------------------------------------------      
  3583. def damage_pop(text)
  3584.      return unless XAS_WORD::ENABLE_WORD
  3585.      self.battler.damage = text
  3586.      self.battler.damage_pop = true
  3587. end

  3588. #--------------------------------------------------------------------------
  3589. # ● Shd Direction?
  3590. #--------------------------------------------------------------------------      
  3591. def face_direction?(attacker)
  3592.      target = self.direction  
  3593.      case target
  3594.           when 2
  3595.              return true if attacker.direction == 8
  3596.           when 4
  3597.              return true if attacker.direction == 6
  3598.           when 6
  3599.              return true if attacker.direction == 4
  3600.           when 8  
  3601.              return true if attacker.direction == 2     
  3602.      end
  3603.      return false
  3604. end   

  3605. #--------------------------------------------------------------------------
  3606. # ● Execute Damage Pop
  3607. #--------------------------------------------------------------------------      
  3608. def execute_damage_pop(attacker,skill = nil)
  3609.      if skill != nil
  3610.         return  if  skill.note =~ /<伤害隐藏>/
  3611.         if skill.damage.to_mp?
  3612.            dam = self.battler.result.mp_damage
  3613.            self.battler.damage_type = "Mp"      
  3614.         elsif skill.damage.to_hp?
  3615.            dam = self.battler.result.hp_damage
  3616.            self.battler.damage_type = "Critical"  if self.battler.result.critical
  3617.         end   
  3618.         if dam != nil
  3619.            if skill.damage.drain? or skill.damage.drain?
  3620.               attacker.damage = -dam
  3621.               attacker.damage_type = self.battler.damage_type
  3622.               attacker.damage_pop = true
  3623.            end  
  3624.            self.battler.damage = dam
  3625.            self.battler.damage_pop = true
  3626.         end
  3627.      else
  3628.         if self.battler.result.hp_damage != nil
  3629.            self.battler.damage = self.battler.result.hp_damage
  3630.            self.battler.damage_type = "Critical" if self.battler.result.critical   
  3631.            self.battler.damage_pop = true      
  3632.         end   
  3633.      end  
  3634. end  

  3635. end   



  3636. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3637. #■ TOOL - EQUIP
  3638. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  3639. #==============================================================================
  3640. # ■ Window Skill List
  3641. #==============================================================================
  3642. class Window_SkillList < Window_Selectable
  3643.   
  3644.   #--------------------------------------------------------------------------
  3645.   # ● Process OK
  3646.   #--------------------------------------------------------------------------                  
  3647.   alias x_skill_process_ok process_ok
  3648.   def process_ok
  3649.       return if can_equip_skill_action?
  3650.       x_skill_process_ok
  3651.   end

  3652.   #--------------------------------------------------------------------------
  3653.   # ● Can Equip Skill Action
  3654.   #--------------------------------------------------------------------------                     
  3655.   def can_equip_skill_action?
  3656.       return false if $game_party.in_battle
  3657.       skill = @data[index]
  3658.       if skill != nil and ( skill.note =~ /<Duration = (\d+)>/ or skill.note =~ /<存在时间 = (\d+)>/)
  3659.          @actor.skill_id = skill.id
  3660.          Sound.play_equip
  3661.          return true         
  3662.       end
  3663.       return false
  3664.   end
  3665.   
  3666. end

  3667. #==============================================================================
  3668. # ■ Window Item List
  3669. #==============================================================================
  3670. class Window_ItemList < Window_Selectable
  3671.   
  3672.   #--------------------------------------------------------------------------
  3673.   # ● Process OK
  3674.   #--------------------------------------------------------------------------                  
  3675.   alias x_item_process_ok process_ok
  3676.   def process_ok
  3677.       return if can_equip_item_action?
  3678.       x_item_process_ok
  3679.   end

  3680.   #--------------------------------------------------------------------------
  3681.   # ● Can Equip Item Action
  3682.   #--------------------------------------------------------------------------                     
  3683.   def can_equip_item_action?
  3684.       return false if $game_party.in_battle
  3685.       item = @data[index]
  3686.       if item != nil and item.is_a?(RPG::Item) and
  3687.         (item.note =~ /<Action ID = (\d+)>/ or item.note =~ /<动作ID = (\d+)>/)
  3688.          actor = $game_party.members[0]
  3689.          actor.item_id = item.id
  3690.          Sound.play_equip
  3691.          return true         
  3692.       end
  3693.       return false
  3694.   end
  3695.   
  3696. end



  3697. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3698. #■ BATTLER - INITIALIZE
  3699. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  3700. #===============================================================================
  3701. # ■ Game Character
  3702. #==============================================================================
  3703. class Game_Character < Game_CharacterBase
  3704.   
  3705.   #--------------------------------------------------------------------------
  3706.   # ● Update Battler
  3707.   #--------------------------------------------------------------------------      
  3708.   def update_battler
  3709.       update_battler_pose
  3710.       update_battler_parameters
  3711.       update_battler_stop_movement
  3712.       update_battler_knockbacking
  3713.       update_battler_counter_action
  3714.       unless self.battler.hp == 0
  3715.           update_battler_cast_action   
  3716.           update_battler_move_speed if can_update_battler_move_speed?
  3717.           update_battler_states_effect
  3718.           update_battler_attacking
  3719.       else
  3720.           update_battler_defeat_process
  3721.       end
  3722.   end  

  3723. end

  3724. #===============================================================================
  3725. # ■ Game Player
  3726. #===============================================================================
  3727. class Game_Player < Game_Character
  3728.   include XRXS_BattlerAttachment
  3729.   
  3730.   #--------------------------------------------------------------------------
  3731.   # ● Battler
  3732.   #--------------------------------------------------------------------------  
  3733.   def battler
  3734.       return $game_party.members[0]
  3735.   end
  3736.   
  3737.   #--------------------------------------------------------------------------
  3738.   # ● Refresh Interpreter Effect
  3739.   #--------------------------------------------------------------------------        
  3740.   def refresh_interpreter_effect
  3741.       $game_system.old_interpreter_running = $game_map.interpreter.running?
  3742.       if $game_system.old_interpreter_running
  3743.          $game_temp.reset_battler_time = 60 * 4
  3744.       end  
  3745.       reset_battler_setting  
  3746.   end  
  3747.   
  3748.   #--------------------------------------------------------------------------
  3749.   # ● Update Battler Setting Time
  3750.   #--------------------------------------------------------------------------           
  3751.   def update_reset_battler_setting_time
  3752.       return if $game_temp.reset_battler_time == 0
  3753.       $game_temp.reset_battler_time -= 1
  3754.       reset_battler_setting_running if $game_temp.reset_battler_time == 0
  3755.   end
  3756.   
  3757.   #--------------------------------------------------------------------------
  3758.   # ● Update Battler Setting
  3759.   #--------------------------------------------------------------------------         
  3760.   def reset_battler_setting
  3761.       reset_player_parameters
  3762.       for ally in $game_party.members
  3763.          reset_members_parameters(ally)
  3764.       end
  3765.       for enemy in $game_map.events.values
  3766.           reset_enemies_parameters(enemy) if enemy.battler != nil
  3767.       end   
  3768.       $game_map.need_refresh = true  
  3769.   end  
  3770.   
  3771.   #--------------------------------------------------------------------------
  3772.   # ● Update Battler Setting Running
  3773.   #--------------------------------------------------------------------------         
  3774.   def reset_battler_setting_running
  3775.       reset_player_parameters_running
  3776.       for ally in $game_party.members
  3777.          reset_members_parameters_running(ally)
  3778.       end
  3779.       for enemy in $game_map.events.values
  3780.           reset_enemies_parameters(enemy) if enemy.battler != nil
  3781.       end   
  3782.       $game_map.need_refresh = true  
  3783.   end   
  3784.   
  3785.   #--------------------------------------------------------------------------
  3786.   # ● Reset Enemies Parameters
  3787.   #--------------------------------------------------------------------------         
  3788.   def reset_enemies_parameters(enemy)
  3789.       enemy.battler.cast_action[0] = 0
  3790.       enemy.battler.cast_action[1] = 0
  3791.       enemy.battler.cast_action[2] = 0
  3792.       enemy.battler.cast_action[3] = 0  
  3793.       enemy.battler.cast_action[4] = 0
  3794.       enemy.battler.counter_action[0] = 0
  3795.       enemy.battler.counter_action[1] = 0
  3796.       enemy.battler.counter_action[2] = true
  3797.       enemy.battler.invunerable_duration = 0
  3798.       enemy.knock_back_duration = nil
  3799.   end  
  3800.   
  3801.   #--------------------------------------------------------------------------
  3802.   # ● Reset Members Parameters
  3803.   #--------------------------------------------------------------------------         
  3804.   def reset_members_parameters(ally)
  3805.       ally.old_level = ally.level
  3806.       ally.shield = false
  3807.       ally.x_charge_action[0] = 0
  3808.       ally.x_charge_action[1] = 0
  3809.       ally.x_charge_action[2] = 0
  3810.       ally.x_charge_action[3] = 0
  3811.       ally.cast_action[0] = 0
  3812.       ally.cast_action[1] = 0
  3813.       ally.cast_action[2] = 0
  3814.       ally.cast_action[3] = 0  
  3815.       ally.cast_action[4] = 0
  3816.       ally.counter_action[0] = 0
  3817.       ally.counter_action[1] = 0
  3818.       ally.counter_action[2] = true
  3819.       ally.invunerable_duration = 0
  3820.   end
  3821.   
  3822.   #--------------------------------------------------------------------------
  3823.   # ● Reset Player Parameters
  3824.   #--------------------------------------------------------------------------         
  3825.   def reset_player_parameters
  3826.       make_pose("", 1) unless $game_player.action != nil
  3827.       $game_temp.xas_target_time = 0
  3828.       $game_temp.xas_target_shoot_id = 0
  3829.       $game_temp.xas_target_x = 0      
  3830.       @knock_back_duration = nil
  3831.       @dash_active = false
  3832.   end
  3833.    
  3834.   
  3835.   #--------------------------------------------------------------------------
  3836.   # ● Reset Members Parameters Running
  3837.   #--------------------------------------------------------------------------         
  3838.   def reset_members_parameters_running(ally)
  3839.       ally.old_level = ally.level
  3840.       ally.shield = false
  3841.       unless ally.x_charge_action[1] > 0
  3842.       ally.x_charge_action[0] = 0
  3843.       ally.x_charge_action[1] = 0
  3844.       ally.x_charge_action[2] = 0
  3845.       ally.x_charge_action[3] = 0
  3846.       end
  3847.       unless ally.cast_action[1] > 0
  3848.          ally.cast_action[0] = 0
  3849.          ally.cast_action[1] = 0
  3850.          ally.cast_action[2] = 0
  3851.          ally.cast_action[3] = 0  
  3852.          ally.cast_action[4] = 0
  3853.       end
  3854.       ally.counter_action[0] = 0
  3855.       ally.counter_action[1] = 0
  3856.       ally.counter_action[2] = true
  3857.       ally.invunerable_duration = 0
  3858.   end
  3859.   
  3860.   #--------------------------------------------------------------------------
  3861.   # ● Reset Player Parameters Running
  3862.   #--------------------------------------------------------------------------         
  3863.   def reset_player_parameters_running
  3864.       $game_temp.xas_target_time = 0
  3865.       $game_temp.xas_target_shoot_id = 0
  3866.       $game_temp.xas_target_x = 0      
  3867.       @knock_back_duration = nil
  3868.       @dash_active = false
  3869.   end
  3870.   
  3871. end

  3872. #===============================================================================
  3873. # ■ Game Follower
  3874. #===============================================================================
  3875. class Game_Follower < Game_Character
  3876.   include XRXS_BattlerAttachment
  3877.   
  3878.   #--------------------------------------------------------------------------
  3879.   # ● Battler
  3880.   #--------------------------------------------------------------------------   
  3881.   def battler
  3882.       return $game_party.members[@member_index]
  3883.   end
  3884. end

  3885. #===============================================================================
  3886. # ■ Game Follower
  3887. #===============================================================================
  3888. class Game_Followers
  3889.   include XRXS_BattlerAttachment
  3890.   
  3891.   #--------------------------------------------------------------------------
  3892.   # ● Battler
  3893.   #--------------------------------------------------------------------------   
  3894.   def battler
  3895.       return $game_party.members[@member_index]
  3896.   end
  3897. end
  3898. #===============================================================================
  3899. # ■ Game_Vehicle
  3900. #===============================================================================
  3901. class Game_Vehicle < Game_Character
  3902.   include XRXS_BattlerAttachment
  3903.   attr_reader   :collision_attack
  3904.   
  3905.   #--------------------------------------------------------------------------
  3906.   # ● Battler
  3907.   #--------------------------------------------------------------------------      
  3908.   def battler
  3909.      return @battler
  3910.   end  
  3911. end  

  3912. #===============================================================================
  3913. # ■ Game Event
  3914. #===============================================================================
  3915. class Game_Event < Game_Character
  3916.   
  3917.   include XRXS_BattlerAttachment
  3918.   
  3919.   #--------------------------------------------------------------------------
  3920.   # ● Battler
  3921.   #--------------------------------------------------------------------------   
  3922.   def battler
  3923.     return @battler
  3924.   end
  3925.   
  3926. #--------------------------------------------------------------------------
  3927. # ● Battler?
  3928. #--------------------------------------------------------------------------           
  3929. def battler?
  3930.      return false if self.erased
  3931.      return false if self.battler == nil
  3932.      return false if self.dead?
  3933.      return false if self.battler.no_damage_pop
  3934.      return false if self.battler.invunerable
  3935.      return true
  3936. end  

  3937.   #--------------------------------------------------------------------------
  3938.   # ● Refresh
  3939.   #--------------------------------------------------------------------------   
  3940.   alias xrxs64c_refresh refresh
  3941.   def refresh
  3942.       xrxs64c_refresh
  3943.       self.battler_recheck
  3944.   end
  3945.    
  3946.   #--------------------------------------------------------------------------
  3947.   # ● Battler Recheck
  3948.   #--------------------------------------------------------------------------   
  3949.   def battler_recheck
  3950.       return if @battler != nil
  3951.       return if @page == nil
  3952.       if self.name =~ /<Actor>/ or self.name =~ /<友方>/
  3953.          actor = $game_party.members[0]
  3954.          @battler = Game_Actor.new(actor.id)
  3955.          return
  3956.       else
  3957.          @enemy_id = 0
  3958.          if self.name =~ /<Enemy(\d+)>/i or self.name =~ /<敌人(\d+)>/i
  3959.             @enemy_id = $1.to_i   
  3960.          end           
  3961.          return if @enemy_id <= 0
  3962.          @battler = Game_Enemy.new(1, @enemy_id)
  3963.          self.force_update = true if self.battler.sensor_range >= 15         
  3964.       end  
  3965.   end
  3966.    
  3967.   #--------------------------------------------------------------------------
  3968.   # ● Battler Recheck
  3969.   #--------------------------------------------------------------------------      
  3970.   def enemy_id
  3971.       return @enemy_id
  3972.   end
  3973.   
  3974.   #--------------------------------------------------------------------------
  3975.   # ● body_size
  3976.   #--------------------------------------------------------------------------        
  3977.   def body_size
  3978.       if self.battler != nil
  3979.          return self.battler.body_size
  3980.       else
  3981.          return 0
  3982.       end  
  3983.   end

  3984. end


  3985. #===============================================================================
  3986. # ■ Game_Battler
  3987. #===============================================================================
  3988. class Game_Battler
  3989.   attr_accessor :sensor_range
  3990.   attr_accessor :body_size
  3991.   attr_accessor :breath_effect
  3992.   attr_accessor :breath_duration
  3993.   attr_accessor :fast_breath_effect
  3994.   attr_accessor :no_knockback
  3995.   attr_accessor :passive  
  3996.   attr_accessor :attack_animation_id
  3997.   attr_accessor :ignore_guard
  3998.   attr_accessor :no_damage_pop
  3999.   
  4000.   #--------------------------------------------------------------------------
  4001.   # ● Initialize
  4002.   #--------------------------------------------------------------------------      
  4003.   alias x_e_initialize initialize
  4004.   def initialize  
  4005.       x_e_initialize
  4006.       @sensor_range = 4
  4007.       @body_size = 0
  4008.       @breath_effect = false
  4009.       @breath_duration = 0
  4010.       @fast_breath_effect = false
  4011.       @no_knockback = false
  4012.       @passive = false     
  4013.       @attack_animation_id = 0
  4014.       @ignore_guard = false
  4015.       @no_damage_pop = false
  4016.   end  
  4017. end

  4018. #===============================================================================
  4019. # ■ Game_Enemy
  4020. #===============================================================================
  4021. class Game_Enemy < Game_Battler
  4022.    
  4023.   #--------------------------------------------------------------------------
  4024.   # ● Initialize
  4025.   #--------------------------------------------------------------------------      
  4026.   alias x_e2_initialize initialize
  4027.   def initialize(index, enemy_id)
  4028.       x_e2_initialize(index, enemy_id)
  4029.       enemy = $data_enemies[@enemy_id]
  4030.       setup_enemy_note(enemy)
  4031.   end  
  4032.   
  4033.   #--------------------------------------------------------------------------
  4034.   # ● Setup X Note Elements
  4035.   #--------------------------------------------------------------------------         
  4036.   def setup_enemy_note(enemy)
  4037.       if enemy.note =~ /<Sensor Range = (\d+)>/ or enemy.note =~ /<视野范围 = (\d+)>/ or
  4038.          enemy.note =~ /<感应器范围 = (\d+)>/ or enemy.note =~ /<效应范围 = (\d+)>/
  4039.          @sensor_range = $1.to_i
  4040.       end   
  4041.       if enemy.note =~ /<Body Size = (\d+)>/ or enemy.note =~ /<身体大小 = (\d+)>/
  4042.          @body_size = $1.to_i
  4043.       end
  4044.       if enemy.note =~ /<Attack Animation = (\d+)>/ or enemy.note =~ /<攻击动画 = (\d+)>/
  4045.          @attack_animation_id = $1.to_i
  4046.       end  
  4047.       if enemy.note =~ /<Death Zoom = (\d+)>/ or enemy.note =~ /<死亡方式 = (\d+)>/
  4048.          @death_zoom_effect = $1.to_i
  4049.       end
  4050.       if enemy.note =~ /<Knockback Duration = (\d+)>/ or enemy.note =~ /<倒地起身 = (\d+)>/
  4051.          @knockback_duration = $1.to_i
  4052.       end      
  4053.       if enemy.note =~ /<Ignore Guard>/ or enemy.note =~ /<忽略防御>/
  4054.          @ignore_shield = true
  4055.       end
  4056.       if enemy.note =~ /<Invunerable>/  or enemy.note =~ /<无敌>/
  4057.          @invunerable = true
  4058.       end
  4059.       if enemy.note =~ /<Breath Effect>/  or enemy.note =~ /<呼吸>/
  4060.          @breath_effect = true
  4061.       end
  4062.       if enemy.note =~ /<Knockback Disable>/  or   enemy.note =~ /<禁止击倒>/   
  4063.          @no_knockback = true
  4064.       end
  4065.       if enemy.note =~ /<Passive>/  or enemy.note =~ /<被动>/
  4066.          @passive = true
  4067.       end
  4068.       if enemy.note =~ /<伤害隐藏>/
  4069.          @no_damage_pop = true
  4070.       end   
  4071.       invunerable_actions_ids = XAS_BA_ENEMY::INVUNERABLE_ACTIONS[@enemy_id]
  4072.       if invunerable_actions_ids != nil
  4073.          @invunerable_actions = invunerable_actions_ids
  4074.       end   
  4075.       guard_directions_ids = XAS_BA_ENEMY::GUARD_DIRECTIONS[@enemy_id]
  4076.       if guard_directions_ids != nil
  4077.          @guard_directions = guard_directions_ids
  4078.       end         
  4079.   end
  4080.   
  4081.   
  4082. end  


  4083. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4084. #■ BATTLER - EVENT SENSOR
  4085. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  4086. #===============================================================================
  4087. # ■ XRXS_Enemy_Sensor
  4088. #===============================================================================
  4089. module XRXS_EnemySensor
  4090.   
  4091.   #--------------------------------------------------------------------------
  4092.   # ● Update Sensor
  4093.   #--------------------------------------------------------------------------        
  4094.   def update_sensor
  4095.       if self.battler != nil and self.battler.sensor_range > 0  
  4096.          sensor_area = self.battler.sensor_range
  4097.       else  
  4098.          sensor_area = $game_variables[XAS_BA::DEFAULT_SENSOR_RANGE_VARIABLE_ID]
  4099.       end
  4100.       sensor_area = -1 if cancel_sensor?
  4101.       distance = ($game_player.x - self.x).abs + ($game_player.y - self.y).abs
  4102.       enable   = (distance <= sensor_area)
  4103.       key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
  4104.       last_enable = $game_self_switches[key]
  4105.       last_enable = false if last_enable == nil
  4106.       if enable != last_enable
  4107.          touch_attack(false)
  4108.          @collision_attack = false
  4109.          @pattern = 0
  4110.          @pattern_count = 0               
  4111.          $game_self_switches[key] = enable
  4112.          self.refresh
  4113.       end
  4114.   end
  4115.   
  4116.   #--------------------------------------------------------------------------
  4117.   # ● Can Update Sensor
  4118.   #--------------------------------------------------------------------------            
  4119.   def can_update_sensor?
  4120.       return false if @sensor_enable == false
  4121.       return false if self.dead?
  4122.       return false if self.erased
  4123.       return false if self.stop
  4124.       return false if self.knockbacking?
  4125.       return true
  4126.   end
  4127.   
  4128.   #--------------------------------------------------------------------------
  4129.   # ● refresh_sensor
  4130.   #--------------------------------------------------------------------------         
  4131.   def refresh_sensor
  4132.       touch_attack(false)
  4133.       key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
  4134.       $game_self_switches[key] = false
  4135.       @pattern = 0
  4136.       @pattern_count  = 0         
  4137.       self.refresh        
  4138.   end  
  4139.   
  4140.   #--------------------------------------------------------------------------
  4141.   # ● Cancel Sensor
  4142.   #--------------------------------------------------------------------------         
  4143.   def cancel_sensor?  
  4144.       return false if self.battler == nil
  4145.       return true if self.battler.passive
  4146.       return false
  4147.   end
  4148.   
  4149. end

  4150. #===============================================================================
  4151. # ■  Game Event
  4152. #===============================================================================
  4153. class Game_Event < Game_Character
  4154.   
  4155.   attr_accessor :sensor_enable
  4156.   
  4157.   #--------------------------------------------------------------------------
  4158.   # ● Initialize
  4159.   #--------------------------------------------------------------------------            
  4160.   alias x_sensor_initialize initialize
  4161.   def initialize(map_id, event)
  4162.       @sensor_enable = false
  4163.       x_sensor_initialize(map_id, event)
  4164.   end  
  4165.   
  4166.   #--------------------------------------------------------------------------
  4167.   # ● Conditions Met
  4168.   #--------------------------------------------------------------------------
  4169.   alias x_sensor_conditions_met conditions_met?
  4170.   def conditions_met?(page)
  4171.       c = page.condition
  4172.       if c.self_switch_ch == XAS_BA::SENSOR_SELF_SWITCH
  4173.          @sensor_enable = true
  4174.       end
  4175.       x_sensor_conditions_met(page)   
  4176.   end
  4177. end

  4178. #===============================================================================
  4179. # ■  Game Event
  4180. #===============================================================================
  4181. class Game_Character < Game_CharacterBase
  4182.       include XRXS_EnemySensor
  4183. end

  4184. #===============================================================================
  4185. # ■  Game Character
  4186. #===============================================================================
  4187. class Game_Character < Game_CharacterBase
  4188.       attr_writer   :opacity
  4189. end



  4190. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4191. #■ BATTLER - ACTION
  4192. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  4193. #===============================================================================
  4194. # ■ Game Character
  4195. #==============================================================================
  4196. class Game_Character < Game_CharacterBase
  4197.   
  4198.   #--------------------------------------------------------------------------
  4199.   # ● Can Update Battler Move Speed
  4200.   #--------------------------------------------------------------------------                  
  4201.   def can_update_battler_move_speed?
  4202.       return false if @temp_id > 0
  4203.       return false if moving?   
  4204.       return true
  4205.   end  
  4206.   
  4207.   #--------------------------------------------------------------------------
  4208.   # ● Can Update Battler?
  4209.   #--------------------------------------------------------------------------               
  4210.   def can_update_battler?
  4211.       return false unless $game_system.xas_battle
  4212.       return false if self.battler == nil
  4213.       return false unless party_system?
  4214.       return true
  4215.   end  

  4216.   #--------------------------------------------------------------------------
  4217.   # ● Party System
  4218.   #--------------------------------------------------------------------------                  
  4219.   def party_system?
  4220.       return false if self.battler == nil
  4221.       if $xas_party_system == nil and self.battler.is_a?(Game_Actor)
  4222.          return false if self.battler.actor_id != $game_party.members[0].actor_id
  4223.       end
  4224.       return true
  4225.   end
  4226.   
  4227.   #--------------------------------------------------------------------------
  4228.   # ● Reset Battler Temp
  4229.   #--------------------------------------------------------------------------                  
  4230.   def reset_battler_temp
  4231.       reset_cast_temp   
  4232.       reset_charge_temp
  4233.   end  
  4234.   
  4235.   #--------------------------------------------------------------------------
  4236.   # ● Reset Charge Temp
  4237.   #--------------------------------------------------------------------------                    
  4238.   def reset_charge_temp  
  4239.       return if self.battler == nil
  4240.       return if self.battler.is_a?(Game_Enemy)
  4241.       self.battler.x_charge_action[0] = 0
  4242.       self.battler.x_charge_action[1] = 0
  4243.       self.battler.x_charge_action[2] = 0
  4244.       self.battler.x_charge_action[3] = 0
  4245.   end
  4246.   
  4247.   #--------------------------------------------------------------------------
  4248.   # ● Reset Battler Temp
  4249.   #--------------------------------------------------------------------------                    
  4250.   def reset_cast_temp   
  4251.       return if self.battler == nil
  4252.       self.battler.cast_action[0] = 0
  4253.       self.battler.cast_action[1] = 0
  4254.       self.battler.cast_action[2] = 0
  4255.       self.battler.cast_action[3] = 0  
  4256.       self.battler.cast_action[4] = 0
  4257.   end
  4258.    
  4259.   #--------------------------------------------------------------------------
  4260.   # ● update_battler_parameters
  4261.   #--------------------------------------------------------------------------   
  4262.   def update_battler_parameters
  4263.       @stop_count = -1 if can_stop_battler?
  4264.       self.battler.invunerable_duration -= 1 if self.battler.invunerable_duration > 0
  4265.       unless @stop
  4266.          @knock_back_duration = 30 if @temp_id > 0
  4267.       end   
  4268.   end   
  4269.   
  4270.   #--------------------------------------------------------------------------
  4271.   # ● Can Stop Battler
  4272.   #--------------------------------------------------------------------------      
  4273.   def can_stop_battler?
  4274.       return false if self.is_a?(Game_Player)
  4275.       return true if self.knockbacking?
  4276.       return true if self.dead?
  4277.       return true if self.stop
  4278.       return false
  4279.   end
  4280.   
  4281.   #--------------------------------------------------------------------------
  4282.   # ● Update Battler Counter Action
  4283.   #--------------------------------------------------------------------------                    
  4284.   def update_battler_counter_action
  4285.       return if self.battler.counter_action[1] == 0
  4286.       self.battler.counter_action[1] -= 1
  4287.       if self.battler.counter_action[1] == 0
  4288.          turn_toward_player
  4289.          self.battler.damage = XAS_WORD::COUNTER
  4290.          self.battler.damage_pop = true
  4291.          self.shoot(self.battler.counter_action[0])
  4292.          self.battler.counter_action[0] = 0
  4293.       end   
  4294.   end  
  4295.   
  4296.   #--------------------------------------------------------------------------
  4297.   # ● Update Cast Action
  4298.   #--------------------------------------------------------------------------         
  4299.   def update_battler_cast_action   
  4300.       return unless can_update_cast_action?
  4301.       self.battler.cast_action[3] += 1
  4302.       if self.battler.cast_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
  4303.          self.battler.cast_action[3] = 0
  4304.          self.animation_id =  self.battler.cast_action[2]
  4305.       end  
  4306.       self.battler.cast_action[4] += 1
  4307.       if self.battler.cast_action[4] >= self.battler.cast_action[1]
  4308.           self.shoot(self.battler.cast_action[0])
  4309.       end
  4310.   end  
  4311.   
  4312.   #--------------------------------------------------------------------------
  4313.   # ● Can Update Cast Action
  4314.   #--------------------------------------------------------------------------            
  4315.   def can_update_cast_action?
  4316.       return false if self.battler.cast_action[1] == 0   
  4317.       return false if @stop
  4318.       return true
  4319.   end
  4320.   
  4321.   #--------------------------------------------------------------------------
  4322.   # ● Can Blow Effect
  4323.   #--------------------------------------------------------------------------              
  4324.   def can_blow?
  4325.       return false if self.stop and not self.battler.state_sleep
  4326.       return false if self.battler.no_knockback   
  4327.       return false if self.is_a?(Game_Player) and self.action != nil
  4328.       return true
  4329.   end   
  4330.    
  4331.   #--------------------------------------------------------------------------
  4332.   # ● Blow Effect
  4333.   #--------------------------------------------------------------------------        
  4334.   def blow(d, power = 1)
  4335.       return unless can_blow?
  4336.       jump_pre(0,0)
  4337.       self.battler.invunerable_duration = 30 if self.battler.invunerable_duration <= 0
  4338.       if self.is_a?(Game_Event)
  4339.          @collision_attack = false  
  4340.       end
  4341.       @knock_back_duration = self.battler.knockback_duration
  4342.       refresh_sensor if self.is_a?(Game_Event)
  4343.       pre_direction = self.direction
  4344.       pre_direction_fix = self.direction_fix
  4345.       self.turn_reverse(d)      
  4346.       self.direction_fix = true
  4347.       power.times do
  4348.         case d
  4349.            when 2; @y += 1 if passable?(@x, @y, d)
  4350.            when 4; @x -= 1 if passable?(@x, @y, d)
  4351.            when 6; @x += 1 if passable?(@x, @y, d)
  4352.            when 8; @y -= 1 if passable?(@x, @y, d)
  4353.         end
  4354.       end
  4355.       self.direction_fix = pre_direction_fix
  4356.       self.direction = pre_direction
  4357.   end
  4358.   
  4359.   #--------------------------------------------------------------------------
  4360.   # ● Can Stop Battler Movement
  4361.   #--------------------------------------------------------------------------            
  4362.   def can_stop_battler_movement?
  4363.       return false if self.dead?   
  4364.       return true if self.battler.state_sleep
  4365.       return true if self.battler.state_stop
  4366.       return false
  4367.   end  
  4368.   
  4369.   #--------------------------------------------------------------------------
  4370.   # ● Impact
  4371.   #--------------------------------------------------------------------------              
  4372.   def impact(enable = true)
  4373.       return if self.tool_id == 0
  4374.       return if self.action == nil
  4375.       self.action.impact = enable
  4376.   end
  4377.   
  4378.   #--------------------------------------------------------------------------
  4379.   # ● Update Battler Stop Movement
  4380.   #--------------------------------------------------------------------------              
  4381.   def update_battler_stop_movement
  4382.       unless can_stop_battler_movement?
  4383.           @stop = false   
  4384.           return
  4385.       end
  4386.       @knock_back_duration = nil
  4387.       @stop = true      
  4388.       @step_anime = false   
  4389.       reset_battler_temp
  4390.       if self.battler.state_sleep
  4391.          make_pose("_Hit", 2)   
  4392.       else
  4393.          make_pose("", 2)
  4394.       end  
  4395.       if self.is_a?(Game_Event)
  4396.          @collision_attack = false
  4397.       end  
  4398.   end
  4399.    
  4400.   #--------------------------------------------------------------------------
  4401.   # ● Update Attacking
  4402.   #--------------------------------------------------------------------------              
  4403.   def update_battler_attacking
  4404.       return unless can_update_attacking?
  4405.       make_pose("_Atk", 2)
  4406.   end

  4407.   #--------------------------------------------------------------------------
  4408.   # ● Can Update Attacking
  4409.   #--------------------------------------------------------------------------              
  4410.   def can_update_attacking?
  4411.       return false if self.battler.is_a?(Game_Actor)
  4412.       return false if @collision_attack == false  
  4413.       return true
  4414.   end  
  4415.   
  4416.   #--------------------------------------------------------------------------
  4417.   # ● Update Battler Knobacking
  4418.   #--------------------------------------------------------------------------            
  4419.   def update_battler_knockbacking
  4420.        return unless self.knockbacking?
  4421.        @pattern = 0
  4422.        @knock_back_duration -= 1 if can_remove_knockback?
  4423.        make_pose("_Hit", 2)        
  4424.        if self.is_a?(Game_Event)
  4425.           @collision_attack = false
  4426.        end         
  4427.        if @knock_back_duration <= 0
  4428.           @knock_back_duration = nil
  4429.           make_pose("", 0)
  4430.           touch_attack(false) if self.is_a?(Game_Event)
  4431.           @character_name = @x_pose_original_name
  4432.        end
  4433.   end  
  4434.    
  4435.   #--------------------------------------------------------------------------
  4436.   # ● Can Remove Knockback
  4437.   #--------------------------------------------------------------------------              
  4438.   def can_remove_knockback?
  4439.       return true
  4440.   end

  4441.   #--------------------------------------------------------------------------
  4442.   # ● knockbacking?
  4443.   #--------------------------------------------------------------------------            
  4444.   def knockbacking?
  4445.       return false if self.battler == nil
  4446.       return false if @stop
  4447.       return true if @knock_back_duration != nil
  4448.       return false
  4449.   end

  4450.   #--------------------------------------------------------------------------
  4451.   # ● collapsing?
  4452.   #--------------------------------------------------------------------------         
  4453.   def collapsing?
  4454.       return self.collapse_duration.to_i > 0
  4455.   end
  4456.    
  4457.   #--------------------------------------------------------------------------
  4458.   # ● Seal Effect
  4459.   #--------------------------------------------------------------------------         
  4460.   def seal_effect
  4461.       Sound.play_buzzer
  4462.       if XAS_WORD::ENABLE_WORD
  4463.          self.battler.damage = XAS_WORD::SEAL
  4464.          self.battler.damage_pop = true
  4465.       end   
  4466.   end   
  4467.   
  4468. end

  4469. #===============================================================================
  4470. # ■ XAS_DamageStop
  4471. #===============================================================================
  4472. module XAS_DamageStop
  4473.   
  4474.   #--------------------------------------------------------------------------
  4475.   # ● Acting
  4476.   #--------------------------------------------------------------------------            
  4477.   def acting?
  4478.       return (super or self.knockbacking? or self.collapsing? or self.stop)
  4479.   end
  4480. end

  4481. #===============================================================================
  4482. # ■ Game_Player
  4483. #===============================================================================
  4484. class Game_Player < Game_Character
  4485.       include XAS_DamageStop
  4486. end

  4487. #===============================================================================
  4488. # ■ Game_Event
  4489. #===============================================================================
  4490. class Game_Event < Game_Character
  4491.       include XAS_DamageStop
  4492. end



  4493. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4494. #■ BATTLER - TOUCH EFFECT
  4495. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  4496. #===============================================================================
  4497. # ■ XRXS_BattlerAttachment
  4498. #==============================================================================
  4499. module XRXS_BattlerAttachment
  4500.   
  4501.   #--------------------------------------------------------------------------
  4502.   # ● Attack Effect
  4503.   #--------------------------------------------------------------------------   
  4504.   def attack_effect(attacker)
  4505.       return false unless $game_system.xas_battle   
  4506.       return if self.battler == nil or attacker == nil
  4507.       return unless can_attack_effect?(attacker)
  4508.       if target_shield_enabled?(attacker, nil, nil)
  4509.          execute_guard_effect(attacker, nil, nil, 30)
  4510.          return
  4511.       end   
  4512.       execute_attack_effect(attacker)
  4513. end
  4514.    
  4515. #--------------------------------------------------------------------------
  4516. # ● Can Attack Effect
  4517. #--------------------------------------------------------------------------     
  4518. def can_attack_effect?(attacker)
  4519.      return false if self.can_update == false
  4520.      return false if @knock_back_duration != nil
  4521.      return false if attacker.stop
  4522.      return false if self.battler.invunerable
  4523.      return false if self.battler.invunerable_duration > 0
  4524.      return false if self.action != nil and self.action.user_invincible
  4525.      return false if seal_attack?(attacker.battler)     
  4526.      return false if target_state_invunerable?(30)
  4527.      return true
  4528. end  
  4529.   
  4530. #--------------------------------------------------------------------------
  4531. # ● Attack Target Shield
  4532. #--------------------------------------------------------------------------     
  4533. def attack_target_shield?(attacker)
  4534.      return false if attacker.battler.ignore_shield   
  4535.      return false unless self.battler.shield
  4536.      return true if face_direction?(attacker)
  4537.      return false
  4538. end  

  4539. #--------------------------------------------------------------------------
  4540. # ● Seal Attack?
  4541. #--------------------------------------------------------------------------               
  4542. def seal_attack?(attacker)
  4543.      if attacker.state_seal_attack or attacker.state_mute
  4544.         attacker.damage = XAS_WORD::SEAL
  4545.         attacker.damage_pop = true
  4546.         self.battler.invunerable_duration = 30
  4547.         return true
  4548.      end
  4549.      return false
  4550. end   

  4551. #--------------------------------------------------------------------------
  4552. # ● Execute Attack Damage
  4553. #--------------------------------------------------------------------------      
  4554. def execute_attack_damage(attacker)
  4555.      #if self.battler.agi > (rand(attacker.battler.agi) * 2)
  4556.      #   self.battler.result.missed = true
  4557.      #   return
  4558.      #end
  4559.      damage = ((attacker.battler.atk * 4) - (self.battler.def * 2)).truncate
  4560.      damage = 0 if damage < 0
  4561.      self.battler.result.hp_damage = damage
  4562.      #self.battler.result.critical   
  4563.      self.battler.hp -= damage.abs
  4564. end

  4565. #--------------------------------------------------------------------------
  4566. # ● Execute Attack Effect
  4567. #--------------------------------------------------------------------------      
  4568. def execute_attack_effect(attacker)
  4569.      execute_attack_effect_before_damage(attacker)
  4570.      execute_attack_damage(attacker)
  4571.      if target_missed?(attacker)
  4572.         self.battler.invunerable_duration = 30
  4573.         return
  4574.      end
  4575.      execute_damage_pop(attacker)
  4576.      execute_attack_effect_after_damage(attacker) if can_check_after_attack_effect?(attacker)   
  4577.      execute_state_effect(nil, attacker, nil)   
  4578.      self.battler.invunerable_duration = 20 + XAS_BA::DEFAULT_KNOCK_BACK_DURATION
  4579.      if attacker.battler.attack_animation_id != 0
  4580.         self.animation_id = attacker.battler.attack_animation_id
  4581.      end   
  4582.      if self.battler.damage.to_i > 0
  4583.         self.blow(attacker.direction, 1) if can_blow_effect?
  4584.      end
  4585.      if self.is_a?(Game_Player)
  4586.         self.need_refresh = true
  4587.      end
  4588. end  
  4589.      
  4590. #--------------------------------------------------------------------------
  4591. # ● Can Check After Attack Effect?  
  4592. #--------------------------------------------------------------------------        
  4593. def can_check_after_attack_effect?(attacker)   
  4594.      return false unless self.battler.damage.is_a?(Numeric)
  4595.      return true
  4596. end

  4597. #--------------------------------------------------------------------------
  4598. # ● Execute Attack Effect Before Damage
  4599. #--------------------------------------------------------------------------      
  4600. def execute_attack_effect_before_damage(attacker)

  4601. end

  4602. #--------------------------------------------------------------------------
  4603. # ● Execute Attack Effect After Damage
  4604. #--------------------------------------------------------------------------      
  4605. def execute_attack_effect_after_damage(attacker)

  4606. end

  4607. end

  4608. #===============================================================================
  4609. # ■ Game Player
  4610. #===============================================================================
  4611. class Game_Player < Game_Character  
  4612.   #--------------------------------------------------------------------------
  4613.   # ● Check Event Trigger Touch
  4614.   #--------------------------------------------------------------------------            
  4615.   alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  4616.   def check_event_trigger_touch(x, y)
  4617.       xrxs64c_check_event_trigger_touch(x, y)
  4618.       if $game_map.interpreter.running?
  4619.          return
  4620.       end
  4621.       for event in $game_map.events.values
  4622.           next unless event.collision_attack
  4623.           unless [1,2].include?(event.trigger)
  4624.              if event.battler != nil and event.x == x and event.y == y
  4625.                 $game_player.attack_effect(event)
  4626.              end
  4627.           end
  4628.       end
  4629.   end
  4630. end

  4631. #===============================================================================
  4632. # ■ Game Event
  4633. #===============================================================================
  4634. class Game_Event < Game_Character
  4635.   
  4636.   #--------------------------------------------------------------------------
  4637.   # ● Check Event Trigger Touch
  4638.   #--------------------------------------------------------------------------            
  4639.   alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  4640.   def check_event_trigger_touch(x, y)
  4641.     xrxs64c_check_event_trigger_touch(x, y)
  4642.     if $game_map.interpreter.running?
  4643.        return
  4644.     end
  4645.     return unless self.collision_attack
  4646.     if self.battler != nil and x == $game_player.x and y == $game_player.y
  4647.        $game_player.attack_effect(self)
  4648.     end
  4649.   end
  4650. end



  4651. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4652. #■ BATTLER - MOVE SPEED
  4653. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  4654. #==============================================================================
  4655. # ■ Game_Character
  4656. #==============================================================================
  4657. class Game_Character < Game_CharacterBase
  4658.   
  4659.   include XAS_BA
  4660.   attr_accessor :base_move_speed
  4661.   attr_accessor :dash_move_speed
  4662.   attr_accessor :move_speed
  4663.   
  4664. #--------------------------------------------------------------------------
  4665. # ● Initialize
  4666. #--------------------------------------------------------------------------  
  4667.   alias x_move_speed_initialize initialize
  4668.   def initialize
  4669.       @base_move_speed = BASE_MOVE_SPEED
  4670.       @dash_move_speed = 0
  4671.       x_move_speed_initialize
  4672.   end  

  4673. #--------------------------------------------------------------------------
  4674. # ● update_battler_move_speed
  4675. #--------------------------------------------------------------------------
  4676.   def update_battler_move_speed
  4677.       @dash_move_speed = @dash_active ? DASH_MOVE_SPEED : 0
  4678.       sp1 = @base_move_speed
  4679.       sp2 = @dash_move_speed
  4680.       sp3 = self.battler.state_move_speed
  4681.       @move_speed = (sp1 + sp2 + sp3)
  4682.   end
  4683.   
  4684. #--------------------------------------------------------------------------
  4685. # ● Update Animation
  4686. #--------------------------------------------------------------------------      
  4687.   def update_animation
  4688.       super
  4689.       update_force_move_routine_move
  4690.   end
  4691.    
  4692. #--------------------------------------------------------------------------
  4693. # ● Update Force Move Routine Move
  4694. #--------------------------------------------------------------------------        
  4695.   def update_force_move_routine_move
  4696.       return if @force_action == ""
  4697.       return if @move_route == nil
  4698.       command = @move_route.list[@move_route_index]
  4699.       return if command == nil
  4700.       if command.code == ROUTE_PLAY_SE   
  4701.          params = command.parameters
  4702.          params[0].play
  4703.          advance_move_route_index
  4704.       end   
  4705.   end

  4706. #--------------------------------------------------------------------------
  4707. # ● Update Routine Move
  4708. #--------------------------------------------------------------------------      
  4709. alias x_update_routine_move update_routine_move
  4710. def update_routine_move
  4711.      return if @force_action_times > 0
  4712.      x_update_routine_move
  4713. end

  4714. #--------------------------------------------------------------------------
  4715. # ● Can Cancel Move Type Custom
  4716. #--------------------------------------------------------------------------   
  4717.   alias x_move_speed_process_move_command process_move_command
  4718.   def process_move_command(command)
  4719.       return if can_cancel_move_type_custom?(command)
  4720.       params = command.parameters
  4721.       x_move_speed_process_move_command(command)
  4722.       if command.code == ROUTE_CHANGE_SPEED and @battler != nil and
  4723.          self.is_a?(Game_Event)
  4724.          @base_move_speed = params[0]
  4725.       end        
  4726.   end
  4727.   
  4728. #--------------------------------------------------------------------------
  4729. # ● Can Cancel Move Type Custom
  4730. #--------------------------------------------------------------------------   
  4731.   def can_cancel_move_type_custom?(command)
  4732.       return true if command == nil
  4733.       return true if @force_action_times > 0
  4734.       return false
  4735.   end  
  4736.   
  4737. end  


  4738. #==============================================================================
  4739. # ■ Game_Event
  4740. #==============================================================================
  4741. class Game_Event < Game_Character  
  4742.   
  4743. #--------------------------------------------------------------------------
  4744. # ● Initialize
  4745. #--------------------------------------------------------------------------              
  4746. alias x_move_speed_event_initialize initialize
  4747. def initialize(map_id, event)
  4748.      x_move_speed_event_initialize(map_id, event)
  4749.      refresh_move_speed
  4750. end  

  4751.   #--------------------------------------------------------------------------
  4752.   # ● Refresh Move Speed
  4753.   #--------------------------------------------------------------------------
  4754.   def refresh_move_speed
  4755.       return if @page == nil
  4756.       @base_move_speed = @page.move_speed
  4757.   end

  4758. #--------------------------------------------------------------------------
  4759. # ● Setup Page
  4760. #--------------------------------------------------------------------------               
  4761. alias x_move_speed_setup_page setup_page
  4762. def setup_page(new_page)
  4763.      x_move_speed_setup_page(new_page)
  4764.      refresh_move_speed
  4765. end

  4766. end


  4767. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4768. #■ BATTLER - STATES
  4769. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  4770. #==============================================================================
  4771. # ■ Game_Battler
  4772. #==============================================================================
  4773. class Game_Battler

  4774.   attr_accessor :state_move_speed
  4775.   attr_accessor :state_stop
  4776.   attr_accessor :state_loop_effect_time
  4777.   attr_accessor :state_loop_speed
  4778.   attr_accessor :state_duration
  4779.   attr_accessor :state_string
  4780.   attr_accessor :state_string_time
  4781.   attr_accessor :state_stop
  4782.   attr_accessor :state_slow
  4783.   attr_accessor :state_sleep
  4784.   attr_accessor :state_invunerable
  4785.   attr_accessor :state_fast
  4786.   attr_accessor :state_mute
  4787.   attr_accessor :state_seal_attack
  4788.   attr_accessor :state_seal_skill
  4789.   attr_accessor :state_seal_item
  4790.   attr_accessor :state_reflect
  4791.   
  4792. #--------------------------------------------------------------------------
  4793. # ● Initialize
  4794. #--------------------------------------------------------------------------  
  4795.   alias x_state_initialize initialize
  4796.   def initialize
  4797.       @state_move_speed = 0
  4798.       @state_duration = []
  4799.       @state_loop_effect_time = []
  4800.       @state_loop_speed = []
  4801.       @state_string = ""
  4802.       @state_string_time = 0
  4803.       @state_stop = false
  4804.       @state_sleep = false
  4805.       @state_invunerable = false
  4806.       @state_slow = false
  4807.       @state_fast = false
  4808.       @state_mute = false
  4809.       @state_seal_attack = false
  4810.       @state_seal_skill = false
  4811.       @state_seal_item = false
  4812.       @state_reflect = false
  4813.       x_state_initialize
  4814.   end
  4815.    
  4816. #--------------------------------------------------------------------------
  4817. # ● Add State
  4818. #--------------------------------------------------------------------------   
  4819.   alias x_add_state add_state
  4820.   def add_state(state_id)
  4821.       unless @states.include?(state_id)
  4822.           state = $data_states[state_id]
  4823.           xas_add_state(state)
  4824.       end        
  4825.       x_add_state(state_id)
  4826.   end
  4827.   
  4828. #--------------------------------------------------------------------------
  4829. # ● Xas Add State
  4830. #--------------------------------------------------------------------------      
  4831.   def xas_add_state(state)
  4832.       @state_duration[state.id] = 60 * $data_states[state.id].min_turns
  4833.       @state_loop_effect_time[state.id] = 0
  4834.       @state_loop_speed[state.id] = $data_states[state.id].max_turns
  4835.       execute_damage_state(state,0)
  4836.   end      

  4837. #--------------------------------------------------------------------------
  4838. # ● Remove State
  4839. #--------------------------------------------------------------------------        
  4840.   alias x_remove_state remove_state
  4841.   def remove_state(state_id)
  4842.       if state?(state_id)
  4843.          state = $data_states[state_id]
  4844.          xas_remove_state(state)
  4845.       end  
  4846.       x_remove_state(state_id)      
  4847.   end   
  4848.    
  4849. #--------------------------------------------------------------------------
  4850. # ● XAS Remove State
  4851. #--------------------------------------------------------------------------         
  4852.   def xas_remove_state(state)
  4853.       @state_duration.delete(state.id)  
  4854.       @state_loop_effect_time.delete(state.id)  
  4855.       @state_loop_speed.delete(state.id)
  4856.       execute_damage_state(state,1)
  4857.   end  

  4858. #--------------------------------------------------------------------------
  4859. # ● Execute_Damage_State
  4860. #--------------------------------------------------------------------------           
  4861.   def execute_damage_state(state,type)
  4862.       return unless XAS_DAMAGE_POP::DAMAGE_STATE_POP
  4863.       return unless XAS_WORD::ENABLE_WORD
  4864.       return if state == nil or state.id == 1
  4865.       case type
  4866.          when 0
  4867.              damage = "+ " + state.name.to_s
  4868.          when 1  
  4869.              damage = "- " + state.name.to_s
  4870.       end
  4871.       @state_string = damage
  4872.       @state_string_time = 30            
  4873.   end  
  4874.   
  4875. end

  4876. #==============================================================================
  4877. # ■ Game_Character
  4878. #==============================================================================
  4879. class Game_Character < Game_CharacterBase
  4880.   
  4881. #--------------------------------------------------------------------------
  4882. # ● Update Battler States Effect
  4883. #--------------------------------------------------------------------------   
  4884. def update_battler_states_effect
  4885.      return unless XAS_SYSTEM::STATE_SYSTEM
  4886.      update_state_string_pop
  4887.      update_pre_state_setup
  4888.      return unless can_update_states_effect?
  4889.      for i in self.battler.states
  4890.          state = $data_states[i.id]  
  4891.          if state == nil or self.battler.state_duration[state.id] == nil or
  4892.             self.battler.state_loop_effect_time[state.id] == nil or
  4893.             self.battler.state_loop_speed[state.id] == nil
  4894.             self.battler.remove_state(state.id)
  4895.             next
  4896.             return
  4897.          end  
  4898.          update_state_abs_effects(state)
  4899.          update_state_loop(state)
  4900.          update_remove_state(state)
  4901.      end  
  4902.       
  4903. end  
  4904.   
  4905. #--------------------------------------------------------------------------
  4906. # ● Update Pre State Setup
  4907. #--------------------------------------------------------------------------      
  4908. def update_pre_state_setup
  4909.      self.battler.state_stop = false
  4910.      self.battler.state_slow = false
  4911.      self.battler.state_fast = false
  4912.      self.battler.state_mute = false
  4913.      self.battler.state_sleep = false
  4914.      self.battler.state_invunerable = false
  4915.      self.battler.state_seal_attack = false
  4916.      self.battler.state_seal_skill = false
  4917.      self.battler.state_seal_item = false
  4918.      self.battler.state_reflect = false
  4919.      self.battler.state_move_speed = 0
  4920. end  

  4921. #--------------------------------------------------------------------------
  4922. # ● Update Pre State Setup
  4923. #--------------------------------------------------------------------------        
  4924. def update_state_abs_effects(state)
  4925.      if state.note =~ /<Stop>/ or state.note =~ /<停止>/
  4926.         self.battler.state_stop = true
  4927.      end
  4928.      if state.note =~ /<Slow>/ or state.note =~ /<减速>/
  4929.         self.battler.state_slow = true
  4930.         self.battler.state_move_speed = -1.5
  4931.      end   
  4932.      if state.note =~ /<Fast>/ or state.note =~ /<加速>/
  4933.         self.battler.state_fast = true
  4934.         self.battler.state_move_speed = 1     
  4935.      end
  4936.      if self.battler.state_fast and
  4937.         self.battler.state_slow
  4938.         self.battler.state_move_speed = 0
  4939.      end
  4940.      if state.note =~ /<Mute>/  or state.note =~ /<M沉默>/   
  4941.         self.battler.state_mute = true
  4942.      end
  4943.      if state.note =~ /<Sleep>/  or state.note =~ /<睡眠>/
  4944.         self.battler.state_sleep = true
  4945.      end
  4946.      if state.note =~ /<Invincible>/ or state.note =~ /<无敌>/   
  4947.         self.battler.state_invunerable = true
  4948.      end  
  4949.      if state.note =~ /<Seal Attack>/ or state.note =~ /<禁止攻击>/  
  4950.         self.battler.state_seal_attack = true
  4951.      end
  4952.      if state.note =~ /<Seal Skill>/   or state.note =~ /<禁止技能>/
  4953.         self.battler.state_seal_skill = true
  4954.      end      
  4955.      if state.note =~ /<Seal Item>/   or  state.note =~ /<禁止道具>/
  4956.         self.battler.state_seal_item = true
  4957.       end
  4958.      if state.note =~ /<Reflect>/ or  state.note =~ /<反射>/
  4959.         self.battler.state_reflect = true
  4960.      end         
  4961. end

  4962. #--------------------------------------------------------------------------
  4963. # ● Update State Loop
  4964. #--------------------------------------------------------------------------      
  4965. def update_state_loop(state)
  4966.      self.battler.state_loop_effect_time[state.id] += 1
  4967.      if self.battler.state_loop_effect_time[state.id] > self.battler.state_loop_speed[state.id]
  4968.         self.battler.state_loop_effect_time[state.id] = 0
  4969.         if state.note =~ /<Animation ID = (\d+)>/ or state.note =~ /<动画ID = (\d+)>/
  4970.            state_anime = $1.to_i
  4971.            if state_anime != nil
  4972.               self.animation_id = state_anime
  4973.            end
  4974.         end   
  4975.         execute_states_effects(state)         
  4976.      end         
  4977. end

  4978. #--------------------------------------------------------------------------
  4979. # ● Execute States Effect
  4980. #--------------------------------------------------------------------------      
  4981. def execute_states_effects(state)         
  4982.      if state.note =~ /<Slip Damage = (\S+)>/ or state.note =~ /<持续伤害 = (\S+)>/
  4983.         execute_state_slip_damage($1.to_i)
  4984.      end  
  4985. end

  4986. #--------------------------------------------------------------------------
  4987. # ● Execute States Slip Damage
  4988. #--------------------------------------------------------------------------        
  4989. def execute_state_slip_damage(damage)
  4990.      damage = 1 if damage == nil
  4991.      damage_slip = self.battler.mhp * damage / 100
  4992.      self.battler.hp -= damage_slip
  4993.      self.battler.damage = damage_slip
  4994.      self.battler.damage_pop = true
  4995. end

  4996. #--------------------------------------------------------------------------
  4997. # ● Update Remove State
  4998. #--------------------------------------------------------------------------      
  4999. def update_remove_state(state)
  5000.      self.battler.state_duration[state.id] -= 1
  5001.      if self.battler.state_duration[state.id] <= 0     
  5002.         self.battler.remove_state(state.id)
  5003.      end         
  5004. end

  5005. #--------------------------------------------------------------------------
  5006. # ● Can Update States Effect
  5007. #--------------------------------------------------------------------------      
  5008.   def can_update_states_effect?
  5009.       return false if self.dead?
  5010.       return false if self.battler.states == nil
  5011.       return false if self.battler.states.size == 0
  5012.       return false if self.battler.state_duration == []
  5013.       return true
  5014.   end

  5015. #--------------------------------------------------------------------------
  5016. # ● Update State String Pop
  5017. #--------------------------------------------------------------------------      
  5018.   def update_state_string_pop
  5019.       return false if self.battler.state_string_time == 0
  5020.       self.battler.state_string_time -= 1
  5021.       if self.battler.state_string_time == 0
  5022.          self.battler.damage = self.battler.state_string
  5023.          self.battler.damage_pop = true
  5024.          self.battler.state_string = ""
  5025.       end  
  5026.   end  
  5027. end  

  5028. #==============================================================================
  5029. # ■ Game_Party
  5030. #==============================================================================
  5031. class Game_Party < Game_Unit

  5032. #--------------------------------------------------------------------------
  5033. # ● On Player Walk
  5034. #--------------------------------------------------------------------------        
  5035. alias x_state_on_player_walk on_player_walk
  5036. def on_player_walk
  5037.      return if XAS_SYSTEM::STATE_SYSTEM
  5038.      x_state_on_player_walk
  5039. end

  5040. end



  5041. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5042. #■ BATTLER - EVENT COMMANDS
  5043. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  5044. #===============================================================================
  5045. # ■ Game Event
  5046. #===============================================================================
  5047. class Game_Event < Game_Character
  5048.   
  5049.   #--------------------------------------------------------------------------
  5050.   # ● Shoot Chance
  5051.   #--------------------------------------------------------------------------            
  5052.   def shoot_chance(action_id,perc)
  5053.       return if self.battler == nil
  5054.       if perc >= rand(100)
  5055.          shoot(action_id)
  5056.       end  
  5057.   end  
  5058.   
  5059.   #--------------------------------------------------------------------------
  5060.   # ● Guard
  5061.   #--------------------------------------------------------------------------         
  5062.   def guard(enable)
  5063.       return if self.battler == nil
  5064.       self.battler.guard = enable
  5065.   end  
  5066.   
  5067.   #--------------------------------------------------------------------------
  5068.   # ● Touch Attack
  5069.   #--------------------------------------------------------------------------            
  5070.   def touch_attack(enable)
  5071.       return if self.battler == nil        
  5072.       return if seal_attack?(self.battler)
  5073.       @collision_attack = enable
  5074.       @pattern = 0
  5075.       @pattern_count  = 0      
  5076.   end
  5077.   
  5078.   #--------------------------------------------------------------------------
  5079.   # ● Counter
  5080.   #--------------------------------------------------------------------------            
  5081.   def counter(enable)
  5082.       return if self.battler == nil
  5083.       self.battler.counter_action[2] = enable
  5084.   end   

  5085.   #--------------------------------------------------------------------------
  5086.   # ● Rand Shoot
  5087.   #--------------------------------------------------------------------------            
  5088.   def rand_shoot(random_id = [])
  5089.       return if self.battler == nil
  5090.       return if random_id == []
  5091.       action_id = random_id[rand(random_id.size)]
  5092.       self.shoot(action_id)
  5093.   end      
  5094.   
  5095. end



  5096. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5097. #■ BATTLER - DEFEAT PROCESS
  5098. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

  5099. #===============================================================================
  5100. # ■ Scene Base
  5101. #===============================================================================
  5102. class Scene_Base  
  5103.   
  5104.   #--------------------------------------------------------------------------
  5105.   # ● Check Gameover
  5106.   #--------------------------------------------------------------------------              
  5107.   def check_gameover
  5108.       return unless $game_party.in_battle  
  5109.       SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
  5110.   end
  5111. end  

  5112. #===============================================================================
  5113. # ■ Game Character
  5114. #===============================================================================
  5115. class Game_Character < Game_CharacterBase
  5116.   attr_accessor :collapse_duration
  5117.   attr_accessor :battler_visible
  5118.   attr_writer   :opacity
  5119.   
  5120.   #--------------------------------------------------------------------------
  5121.   # ● Initialize
  5122.   #--------------------------------------------------------------------------            
  5123.   alias x_collapse_initialize initialize
  5124.   def initialize
  5125.       @collapse_duration = 0
  5126.       x_collapse_initialize
  5127.   end  
  5128.   
  5129. end

  5130. #===============================================================================
  5131. # ■ XAS_BA_BATTLEEVENT_NONPREEMPT
  5132. #==============================================================================
  5133. module XAS_BA_BATTLEEVENT_NONPREEMPT
  5134.   
  5135.   #--------------------------------------------------------------------------
  5136.   # ● Update
  5137.   #--------------------------------------------------------------------------            
  5138.   def update
  5139.       return if self.battler != nil and $game_map.interpreter.running?
  5140.       super
  5141.   end
  5142. end

  5143. #===============================================================================
  5144. # ■ Game Event
  5145. #==============================================================================
  5146. class Game_Event < Game_Character
  5147.       include XAS_BA_BATTLEEVENT_NONPREEMPT
  5148. end

  5149. #===============================================================================
  5150. # ■ Game Character
  5151. #===============================================================================
  5152. class Game_Character < Game_CharacterBase

  5153.   #--------------------------------------------------------------------------
  5154.   # ● Update Battler Defeat Process
  5155.   #--------------------------------------------------------------------------      
  5156.    def update_battler_defeat_process
  5157.        execute_enemy_defeated_process if can_check_enemy_defeated?
  5158.        execute_actor_defeated_process if can_check_actor_defeated?
  5159.    end
  5160.    
  5161.   #--------------------------------------------------------------------------
  5162.   # ● Can Check Enemy Defeated?
  5163.   #--------------------------------------------------------------------------            
  5164.   def can_check_enemy_defeated?  
  5165.       return false if self.battler.is_a?(Game_Actor)
  5166.       return false if self.battler.defeated
  5167.       return true
  5168.   end     
  5169.   
  5170.   #--------------------------------------------------------------------------
  5171.   # ● Can Check Actor Defeated?
  5172.   #--------------------------------------------------------------------------              
  5173.   def can_check_actor_defeated?
  5174.       return false if self.battler.is_a?(Game_Enemy)
  5175.       return false if self.battler.defeated
  5176.       return false if $game_party.members[0].hp > 0
  5177.       return false if @collapse_duration > 0
  5178.       return true  
  5179.   end
  5180.   
  5181.   #--------------------------------------------------------------------------
  5182.   # ● Execute Actor Defeated Process
  5183.   #--------------------------------------------------------------------------               
  5184.   def execute_actor_defeated_process
  5185.       erase_actor_tools_on_map
  5186.       if $game_party.all_dead? and not self.battler.defeated
  5187.          self.battler.defeated = true
  5188.          self.collapse_duration = 120
  5189.          self.knock_back_duration = 161
  5190.          reset_battler_temp
  5191.       else   
  5192.          $game_temp.change_leader_wait_time = 0
  5193.          $game_player.change_leader
  5194.       end  
  5195.   end
  5196.   
  5197.   #--------------------------------------------------------------------------
  5198.   # ● Erase Tools on Map
  5199.   #--------------------------------------------------------------------------                  
  5200.   def erase_actor_tools_on_map
  5201.       for event in $game_map.events.values
  5202.           if event.tool_id > 0 and event.action.user.is_a?(Game_Player)
  5203.              event.erase
  5204.           end   
  5205.       end  
  5206.   end
  5207.   
  5208.   #--------------------------------------------------------------------------
  5209.   # ● Execute Enemy Defeaed Process
  5210.   #--------------------------------------------------------------------------         
  5211.    def execute_enemy_defeated_process
  5212.        self.battler.defeated = true
  5213.        self.through = true
  5214.        @knock_back_duration = 121
  5215.        enemy = $data_enemies[self.battler.enemy_id]
  5216.        @collapse_duration = 120
  5217.        execute_gain_exp_gold(enemy)  
  5218.        execute_active_switch(enemy)
  5219.               execute_active_variable(enemy)
  5220.        execute_defeated_animation(enemy)
  5221.        execute_defeated_sound_effect(enemy)
  5222.        execute_final_shoot(enemy)
  5223.    end   

  5224.   #--------------------------------------------------------------------------
  5225.   # ● Execute Defeated Sound Effect
  5226.   #--------------------------------------------------------------------------              
  5227.   def execute_defeated_sound_effect(enemy)
  5228.       return if self.battler.no_damage_pop
  5229.       Sound.play_enemy_collapse   
  5230.   end
  5231.   
  5232.   #--------------------------------------------------------------------------
  5233.   # ● Execute Final Shoot
  5234.   #--------------------------------------------------------------------------            
  5235.   def execute_final_shoot(enemy)
  5236.      if enemy.note  =~ /<Final Action ID = (\d+)>/  
  5237.        enemy.note  =~ /<Final Action ID = (\d+)>/   
  5238.       elsif enemy.note  =~ /<最终攻击ID = (\d+)>/
  5239.        enemy.note  =~ /<最终攻击ID = (\d+)>/
  5240.       end
  5241.       action_id = $1.to_i
  5242.       return if action_id == nil
  5243.       self.shoot(action_id)      
  5244.   end  
  5245.   
  5246.   #--------------------------------------------------------------------------
  5247.   # ● Execute Gain Exp Gold
  5248.   #--------------------------------------------------------------------------           
  5249.   def execute_gain_exp_gold(enemy)  
  5250.       exp = self.battler.exp
  5251.       case XAS_BA::EXP_TYPE
  5252.          when 0
  5253.             actor = $game_party.members[0]
  5254.             actor.gain_exp(exp)
  5255.          when 1
  5256.             for i in 0...$game_party.members.size
  5257.                actor = $game_party.members[i]           
  5258.                actor.gain_exp(exp)
  5259.             end   
  5260.          when 2  
  5261.             exp = exp / $game_party.members.size
  5262.             for i in 0...$game_party.members.size
  5263.                actor = $game_party.members[i]           
  5264.                actor.gain_exp(exp)
  5265.             end              
  5266.       end
  5267.       $game_party.gain_gold(self.battler.gold)
  5268.   end  
  5269.   
  5270.   #--------------------------------------------------------------------------
  5271.   # ● Execute_Active Switch
  5272.   #--------------------------------------------------------------------------           
  5273.   def execute_active_switch(enemy)
  5274.     if enemy.note  =~ /<Active Switch = (\d+)>/
  5275.         enemy.note  =~ /<Active Switch = (\d+)>/
  5276.       elsif  enemy.note  =~ /<激活开关 = (\d+)>/
  5277.         enemy.note  =~ /<激活开关 = (\d+)>/      
  5278.       end
  5279.     switch_id = $1.to_i  
  5280.       if switch_id != nil
  5281.          $game_switches[switch_id] = true
  5282.          $game_map.need_refresh = true     
  5283.       end
  5284.   end
  5285.     #--------------------------------------------------------------------------
  5286.   # ● Execute_Active Switch
  5287.   #--------------------------------------------------------------------------           
  5288.   def execute_active_variable(enemy)
  5289.     if enemy.note  =~ /<Active Variable = (\d+)>/
  5290.         enemy.note  =~ /<Active Variable = (\d+)>/
  5291.       elsif  enemy.note  =~ /<增加變量 = (\d+)>/
  5292.         enemy.note  =~ /<增加變量 = (\d+)>/      
  5293.       end
  5294.     variable_id = $1.to_i  
  5295.       if variable_id != nil
  5296.          $game_variables[variable_id] += 1
  5297.          $game_map.need_refresh = true     
  5298.       end
  5299.   end
  5300.   #--------------------------------------------------------------------------
  5301.   # ● Execute Defeated Animation
  5302.   #--------------------------------------------------------------------------            
  5303.   def execute_defeated_animation(enemy)
  5304.      if enemy.note  =~ /<Defeated Animation = (\d+)>/
  5305.          enemy.note  =~ /<Defeated Animation = (\d+)>/      
  5306.         elsif enemy.note  =~ /<死亡动画 = (\d+)>/
  5307.          enemy.note  =~ /<死亡动画 = (\d+)>/
  5308.         end
  5309.         anime_id = $1.to_i
  5310.      if anime_id != nil
  5311.          self.animation_id = anime_id
  5312.       end  
  5313.   end  
  5314.   
  5315. end   

  5316. #===============================================================================
  5317. # ■ Game Player
  5318. #===============================================================================
  5319. class Game_Player < Game_Character
  5320.   
  5321.   #--------------------------------------------------------------------------
  5322.   # ● Reset Old Level
  5323.   #--------------------------------------------------------------------------            
  5324.   def reset_old_level(trans = false)
  5325.      for actor in $game_party.members
  5326.          actor.old_level = actor.level
  5327.      end   
  5328.   end
  5329.   
  5330.   #--------------------------------------------------------------------------
  5331.   # ● Change Leader
  5332.   #--------------------------------------------------------------------------                  
  5333.   def change_leader
  5334.       return if $game_party.members.size <= 1
  5335.       reset_battler_temp
  5336.       current_leader_id = $game_party.members[0].id
  5337.       for i in 1..$game_party.members.size
  5338.           pre_leader = $game_party.members[0].id
  5339.           $game_party.remove_actor(pre_leader)
  5340.           $game_party.add_actor(pre_leader)  
  5341.           if $game_party.members[0].hp > 0
  5342.              execute_change_leader_effect unless current_leader_id == $game_party.members[0].id
  5343.              break
  5344.           end
  5345.       end
  5346.   end   
  5347.   
  5348.   #--------------------------------------------------------------------------
  5349.   # ● Exeute Change leader Effect
  5350.   #--------------------------------------------------------------------------                    
  5351.   def execute_change_leader_effect
  5352.       actor = $game_party.members[0]
  5353.       actor.invunerable_duration = XAS_BA::CHANGE_LEADER_WAIT_TIME
  5354.       actor.damage = nil
  5355.       actor.damage_pop = false
  5356.       actor.critical = false
  5357.       @knock_back_duration = nil
  5358.       if self.action != nil
  5359.          self.action.duration = 1
  5360.       end
  5361.       @force_action_times = 0
  5362.       @force_action_type = ""         
  5363.       reset_old_level(true)
  5364.       @x_pose_original_name = @character_name
  5365.       update_battler_pose
  5366.       $game_map.need_refresh = true
  5367.       self.animation_id = XAS_ANIMATION::CHANGE_LEADER_ANIMATION_ID
  5368.       $game_temp.change_leader_wait_time = XAS_BA::CHANGE_LEADER_WAIT_TIME  
  5369.   end
  5370.   
  5371.   #--------------------------------------------------------------------------
  5372.   # ● Check Actor Level
  5373.   #--------------------------------------------------------------------------           
  5374.   def check_actor_level
  5375.       return if $game_party.in_battle
  5376.       return if self.battler == nil
  5377.       return if self.battler.old_level == self.battler.level
  5378.       reset_old_level(false)
  5379.       if self.battler.level > 1
  5380.          Audio.se_play("Audio/SE/" + XAS_SOUND::LEVEL_UP , 100, 100)
  5381.          if XAS_WORD::ENABLE_WORD
  5382.             $game_player.battler.damage = XAS_WORD::LEVEL_UP
  5383.             $game_player.battler.damage_pop = true
  5384.          end
  5385.       end
  5386.       $game_player.need_refresh = true
  5387.   end
  5388. end   

  5389. #===============================================================================
  5390. # ■ Game Party
  5391. #===============================================================================
  5392. class Game_Party < Game_Unit
  5393.   
  5394. #--------------------------------------------------------------------------
  5395. # ● Setup Starting Members  
  5396. #--------------------------------------------------------------------------      
  5397.   alias x_old_level_setup_starting_members setup_starting_members  
  5398.   def setup_starting_members  
  5399.       x_old_level_setup_starting_members   
  5400.       for actor in $game_party.members
  5401.           actor.old_level = actor.level
  5402.       end
  5403.   end
  5404.   
  5405. end

  5406. #===============================================================================
  5407. # ■ Sprite Character
  5408. #==============================================================================
  5409. class Sprite_Character < Sprite_Base  
  5410.   
  5411.   #--------------------------------------------------------------------------
  5412.   # ● Update Collapse Effects
  5413.   #--------------------------------------------------------------------------            
  5414.   def update_collaspse_effects
  5415.       update_collapse_duration
  5416.       return unless can_collapse_effects?
  5417.       update_collpase_zoom_effects
  5418.       update_exp_gold_pop
  5419.   end
  5420.    
  5421.   #--------------------------------------------------------------------------
  5422.   # ● Can Collapse Effects
  5423.   #--------------------------------------------------------------------------              
  5424.   def can_collapse_effects?
  5425.       return false if @character.battler.is_a?(Game_Actor)
  5426.       return false unless @character.dead?
  5427.       return false if @character.erased   
  5428.       return true
  5429.   end  
  5430.   
  5431.   #--------------------------------------------------------------------------
  5432.   # ● Update Exp Gold Pop
  5433.   #--------------------------------------------------------------------------              
  5434.   def update_exp_gold_pop
  5435.       return unless XAS_DAMAGE_POP::DAMAGE_EXP_GOLD_POP
  5436.       exp_pop = @character.battler.exp
  5437.       gold_pop [email protected]
  5438.       case @character.collapse_duration
  5439.            when 110
  5440.                 enemy = $data_enemies[@character.battler.enemy_id]
  5441.                 @character.make_treasure(enemy)      
  5442.            when 80
  5443.              if exp_pop != 0
  5444.                 word = XAS_WORD::EXP
  5445.                 @character.battler.damage = word + " " + exp_pop.to_s
  5446.                 @character.battler.damage_pop = true
  5447.                 @character.battler.damage_type = "Exp"
  5448.              end  
  5449.            when 40
  5450.              if gold_pop != 0
  5451.                 word = $data_system.currency_unit
  5452.                 @character.battler.damage = word + " " + gold_pop.to_s
  5453.                 @character.battler.damage_pop = true
  5454.                 @character.battler.damage_type = "Gold"
  5455.              end               
  5456.       end      
  5457.   end
  5458.   
  5459.   #--------------------------------------------------------------------------
  5460.   # ● Update Collapse Duration
  5461.   #--------------------------------------------------------------------------              
  5462.   def update_collapse_duration
  5463.       @character.collapse_duration -= 1
  5464.       @character.opacity -= 2
  5465.       if @character.collapse_duration <= 0
  5466.          if @character.battler.is_a?(Game_Actor)
  5467.             SceneManager.goto(Scene_Gameover)
  5468.             return
  5469.          end
  5470.          self.visible = false
  5471.          @character.opacity = 0
  5472.          @character.erase
  5473.       end  
  5474.   end  

  5475.   #--------------------------------------------------------------------------
  5476.   # ● Update Collapse Zoom Effects
  5477.   #--------------------------------------------------------------------------               
  5478.   def update_collpase_zoom_effects
  5479.       case @character.battler.death_zoom_effect
  5480.           when 1
  5481.              @character.zoom_y += 0.05
  5482.              @character.zoom_x -= 0.01            
  5483.           when 2  
  5484.              @character.zoom_y -= 0.01
  5485.              @character.zoom_x += 0.03            
  5486.           when 3  
  5487.              @character.zoom_y += 0.03
  5488.              @character.zoom_x += 0.03              
  5489.           when 4   
  5490.              @character.zoom_y -= 0.005
  5491.              @character.zoom_x -= 0.005
  5492.           when 5   
  5493.             case @character.collapse_duration
  5494.                 when 60..120
  5495.                  @character.zoom_y -= 0.01
  5496.                  @character.zoom_x += 0.06                             
  5497.                 when 0..59  
  5498.                  @character.zoom_y += 0.2
  5499.                  @character.zoom_x -= 0.1
  5500.              end
  5501.       end
  5502.   end  
  5503.   
  5504. end



  5505. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5506. #■ BATTLER - TREASURE
  5507. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  5508. #===============================================================================
  5509. # ■ XAS_BA_Item_Drop
  5510. #==============================================================================
  5511. module XAS_BA_ItemDrop
  5512.   
  5513.   #--------------------------------------------------------------------------
  5514.   # ● Defeat Process
  5515.   #--------------------------------------------------------------------------               
  5516.   def make_treasure(enemy)  
  5517.       treasure = nil      
  5518.       return unless $game_player.passable?(self.x,self.y,0)
  5519.       for di in enemy.drop_items
  5520.            next if di.kind == 0
  5521.            next if rand(di.denominator) != 0
  5522.            if di.kind == 1
  5523.               treasure = $data_items[di.data_id]
  5524.               tr_id = treasure.id
  5525.            elsif di.kind == 2
  5526.               treasure = $data_weapons[di.data_id]
  5527.               tr_id = treasure.id
  5528.            elsif di.kind == 3
  5529.               treasure = $data_armors[di.data_id]
  5530.               tr_id = treasure.id
  5531.            end
  5532.            break if treasure != nil
  5533.        end   
  5534.        if treasure != nil
  5535.           command = RPG::MoveCommand.new
  5536.           command.code = 14
  5537.           command.parameters = [0,0]
  5538.           route = RPG::MoveRoute.new
  5539.           route.repeat = false
  5540.           route.list = [command, RPG::MoveCommand.new]         
  5541.           page = RPG::Event::Page.new
  5542.           page.move_type = 3
  5543.           page.move_route = route
  5544.           page.move_frequency = 6
  5545.           page.priority_type = 1
  5546.           page.trigger = 1
  5547.           page.through = true
  5548.           event = RPG::Event.new(self.x, self.y)
  5549.           event.pages =      
  5550.           event = RPG::Event.new(self.x, self.y)
  5551.           token = Token_Event.new($game_map.map_id, event)
  5552.           token.icon_name = treasure.icon_index
  5553.           token.treasure = [di.kind,tr_id]
  5554.           token.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  5555.           token.jump_high(0,0,20)
  5556.           token.force_update = true
  5557.           token.move_speed = 6
  5558.           $game_map.add_token(token)
  5559.        end  
  5560.   end  
  5561. end

  5562. #===============================================================================
  5563. # ■ Game Event
  5564. #===============================================================================
  5565. class Game_Event < Game_Character
  5566.   include XAS_BA_ItemDrop
  5567.   
  5568.   #--------------------------------------------------------------------------
  5569.   # ● Update Treasure Duration
  5570.   #--------------------------------------------------------------------------               
  5571.   def update_treasure_duration
  5572.       return if @treasure_time == 0
  5573.       @treasure_time -= 1
  5574.       self.erase if @treasure_time == 0
  5575.   end
  5576.   
  5577. end

  5578. #===============================================================================
  5579. # ■ Game Character
  5580. #==============================================================================
  5581. class Game_Character < Game_CharacterBase
  5582.   attr_accessor :icon_name
  5583.   attr_accessor :treasure
  5584. end

  5585. #===============================================================================
  5586. # ■ Game Character
  5587. #==============================================================================
  5588. class Sprite_Character < Sprite_Base
  5589.   
  5590.   #--------------------------------------------------------------------------
  5591.   # ● Update
  5592.   #--------------------------------------------------------------------------            
  5593.   alias xrxs_charactericon_update update
  5594.   def update
  5595.       xrxs_charactericon_update
  5596.       if @character.icon_name != nil
  5597.          self.bitmap = Cache.system("Iconset")
  5598.          self.src_rect.set(@character.icon_name  % 16 * 24, @character.icon_name / 16 * 24, 24, 24)
  5599.          self.ox = 12
  5600.          self.oy = 24
  5601.       end
  5602.   end
  5603. end

  5604. #===============================================================================
  5605. # ■ Game Player
  5606. #==============================================================================
  5607. class Game_Player < Game_Character
  5608.   
  5609.   #--------------------------------------------------------------------------
  5610.   # ● Check Event Trigger Here
  5611.   #--------------------------------------------------------------------------               
  5612.   alias treasure_check_event_trigger_here check_event_trigger_here
  5613.   def check_event_trigger_here(triggers)
  5614.       return false if $game_map.interpreter.running?
  5615.       check_treasure_here         
  5616.       treasure_check_event_trigger_here(triggers)
  5617.   end  

  5618.   #--------------------------------------------------------------------------
  5619.   # ● check_treasure_here   
  5620.   #--------------------------------------------------------------------------                 
  5621.   def check_treasure_here   
  5622.      for event in $game_map.events_xy(@x, @y)
  5623.          if event.treasure != nil
  5624.             name_pop = true
  5625.             case event.treasure[0]            
  5626.             when 1
  5627.                   item = $data_items[event.treasure[1]]
  5628.                   if can_execute_field_item_effect?(item)
  5629.                      name_pop = false
  5630.                   else  
  5631.                      $game_party.gain_item(item, 1)
  5632.                   end
  5633.                   $game_map.need_refresh = true
  5634.             when 2  
  5635.                   item = $data_weapons[event.treasure[1]]
  5636.                   $game_party.gain_item($data_weapons[event.treasure[1]], 1,false)
  5637.             when 3
  5638.                   item = $data_armors[event.treasure[1]]
  5639.                   $game_party.gain_item(item, 1,false)
  5640.             end
  5641.             Audio.se_play("Audio/SE/" + XAS_SOUND::ITEM_DROP , 100, 100)   
  5642.             event.erase
  5643.             if item != nil
  5644.                 if item.note =~ /<Drop Animation = (\d+)>/ or item.note =~ /<掉落动画 = (\d+)>/
  5645.                    self.animation_id = $1.to_i
  5646.                 end
  5647.                 if XAS_DAMAGE_POP::DAMAGE_ITEM_POP and name_pop
  5648.                    self.battler.damage = item.name.to_s
  5649.                    self.battler.damage_pop = true
  5650.                    self.battler.damage_type = "Item"
  5651.                 end                       
  5652.             end
  5653.           end            
  5654.      end   
  5655. end           
  5656.      
  5657.   #--------------------------------------------------------------------------
  5658.   # ● Can Execute Field Item Effect
  5659.   #--------------------------------------------------------------------------                  
  5660.   def can_execute_field_item_effect?(item)
  5661.       if item.note =~ /<Drop HP Damage = (\S+)>/ or item.note =~ /<HP伤害 = (\S+)>/
  5662.          damage = $1.to_i
  5663.          damage2 = damage * self.battler.mhp / 100
  5664.          self.battler.damage = damage2
  5665.          self.battler.damage_pop = true
  5666.          self.battler.hp -= damage2
  5667.          return true
  5668.       end  
  5669.       if item.note =~ /<Drop MP Damage = (\S+)>/ or item.note =~ /<MP伤害 = (\S+)>/
  5670.          damage = $1.to_i
  5671.          damage2 = damage * self.battler.mmp / 100
  5672.          self.battler.mp -= damage2         
  5673.          self.battler.damage_type = "Mp"   
  5674.          self.battler.damage = damage2
  5675.          self.battler.damage_pop = true
  5676.          return true
  5677.       end      
  5678.       if item.note =~ /<Drop Gold = (\d+)>/ or item.note =~ /<掉落金币 = (\d+)>/
  5679.          gold = $1.to_i
  5680.          damage = $data_system.terms.gold + " " + gold.to_s
  5681.          self.battler.damage = damage
  5682.          self.battler.damage_pop = true
  5683.          $game_party.gain_gold(gold)
  5684.          return true
  5685.       end
  5686.       return false  
  5687.   end  
  5688. end



  5689. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5690. #■ SPRITE - POSE (Character Name)
  5691. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  5692. #===============================================================================
  5693. # ■ Game_Character
  5694. #===============================================================================
  5695. class Game_Character < Game_CharacterBase
  5696.   
  5697.   attr_accessor :x_pose_duration
  5698.   attr_accessor :x_pose_name
  5699.   attr_accessor :x_pose_original_name
  5700.   attr_accessor :character_name
  5701.   
  5702.   #-----------------------------------------------------------------------------
  5703.   # ● Initialize
  5704.   #-----------------------------------------------------------------------------  
  5705.   alias x_pose_initialize initialize
  5706.   def initialize
  5707.       x_pose_initialize
  5708.       @x_pose_duration = 0
  5709.       @x_pose_name = ""
  5710.       @x_pose_original_name = @character_name
  5711.   end

  5712.   #-----------------------------------------------------------------------------
  5713.   # ● Update
  5714.   #-----------------------------------------------------------------------------   
  5715.   def make_pose(sufix, pose_duration)
  5716.       return if @x_pose_original_name == ""
  5717.       @x_pose_name = sufix
  5718.       @x_pose_duration = pose_duration         
  5719.   end     
  5720.   
  5721.   #-----------------------------------------------------------------------------
  5722.   # ● Update Pose
  5723.   #-----------------------------------------------------------------------------   
  5724.   def update_battler_pose
  5725.       return false unless XAS_SYSTEM::CHARACTER_POSE_NAME
  5726.       if @x_pose_duration == 0
  5727.          @x_pose_original_name = @character_name
  5728.          return
  5729.       else     
  5730.          @x_pose_duration -= 1
  5731.          @character_name = @x_pose_original_name + @x_pose_name
  5732.          if @x_pose_duration == 0
  5733.             @character_name = @x_pose_original_name
  5734.             @x_pose_name = ""
  5735.          end
  5736.       end
  5737.       unless jumping?
  5738.          @jump_count = 0
  5739.          @jump_peak = 0
  5740.       end      
  5741.   end
  5742.   
  5743.   #-----------------------------------------------------------------------------
  5744.   # ● Set Graphic
  5745.   #-----------------------------------------------------------------------------      
  5746.   alias x_pose_set_graphic set_graphic
  5747.   def set_graphic(character_name, character_index)
  5748.       x_pose_set_graphic(character_name, character_index)
  5749.       @x_pose_original_name = @character_name
  5750.       @x_pose_duration = 0
  5751.       @x_pose_name = ""      
  5752.   end   
  5753.   
  5754. end


  5755. #===============================================================================
  5756. # ■ Game_Interpreter
  5757. #===============================================================================
  5758. class Game_Interpreter
  5759.   
  5760.   #-----------------------------------------------------------------------------
  5761.   # ● Command_322
  5762.   #-----------------------------------------------------------------------------   
  5763.   alias x_pose_command_322 command_322
  5764.   def command_322
  5765.       x_pose_command_322
  5766.       actor = $game_actors[@params[0]]
  5767.       if actor != nil
  5768.          $game_player.x_pose_duration = 0
  5769.          $game_player.x_pose_original_name =  @params[1]
  5770.       end
  5771.   end
  5772.   
  5773. end  

  5774. #===============================================================================
  5775. # ■ RPG_FileTest
  5776. #===============================================================================
  5777. module RPG_FileTest
  5778.   
  5779.   #--------------------------------------------------------------------------
  5780.   # ● RPG_FileTest.character_exist?
  5781.   #--------------------------------------------------------------------------
  5782.   def RPG_FileTest.character_exist?(filename)
  5783.       return Cache.character(filename) rescue return false
  5784.   end

  5785.   #--------------------------------------------------------------------------
  5786.   # ● RPG_FileTest.system_exist?
  5787.   #--------------------------------------------------------------------------
  5788.   def RPG_FileTest.system_exist?(filename)
  5789.       return Cache.system(filename) rescue return false
  5790.   end  
  5791.   
  5792. end

  5793. #===============================================================================
  5794. # ■ Sprite_Character
  5795. #===============================================================================
  5796. class Sprite_Character < Sprite_Base
  5797.   
  5798.   #--------------------------------------------------------------------------
  5799.   # ● X Pose Update
  5800.   #--------------------------------------------------------------------------  
  5801.   alias x_pose_update_bitmap update_bitmap
  5802.   def update_bitmap
  5803.       check_file_exist
  5804.       x_pose_update_bitmap
  5805.   end

  5806. #--------------------------------------------------------------------------
  5807. # ● Check File Exist
  5808. #--------------------------------------------------------------------------  
  5809. def check_file_exist
  5810.      return if @character_name == @character.character_name
  5811.      unless RPG_FileTest.character_exist?(@character.character_name)
  5812.             @character.character_name = @character.x_pose_original_name   
  5813.             @character.x_pose_duration = 0
  5814.             @character.x_pose_name = ""
  5815.      end         
  5816. end  
  5817.   
  5818. end





  5819. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5820. #■ SPRITE - DAMAGE SPRITE
  5821. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  5822. #===============================================================================
  5823. # ■  XRXS_DAMAGE_OFFSET
  5824. #===============================================================================
  5825. module XRXS_DAMAGE_OFFSET
  5826.   
  5827.   #--------------------------------------------------------------------------
  5828.   # ● Update
  5829.   #--------------------------------------------------------------------------              
  5830.   def update
  5831.       super
  5832.       @damage_sprites   = [] if @damage_sprites.nil?
  5833.       for damage_sprite in @damage_sprites
  5834.           damage_sprite.x = self.x
  5835.           damage_sprite.y = self.y
  5836.       end
  5837.   end
  5838. end

  5839. #===============================================================================
  5840. # ■ Sprite_Character
  5841. #===============================================================================
  5842. class Sprite_Character < Sprite_Base
  5843.       include XRXS_DAMAGE_OFFSET
  5844. end


  5845. #==============================================================================
  5846. # ■ Sprite Base
  5847. #==============================================================================
  5848. class Sprite_Base < Sprite
  5849.   include XAS_DAMAGE_POP
  5850.   #--------------------------------------------------------------------------
  5851.   # ● Initialize
  5852.   #--------------------------------------------------------------------------   
  5853.   alias x_damage_pop_initialize initialize
  5854.   def initialize(viewport = nil)      
  5855.       @_damage_duration = 0
  5856.       x_damage_pop_initialize(viewport)
  5857.   end
  5858.   
  5859.   #--------------------------------------------------------------------------
  5860.   # ● Damage
  5861.   #--------------------------------------------------------------------------     
  5862.   def damage(value, type = "")
  5863.       dispose_damage
  5864.       @damage_ox = 0
  5865.       @damage_type = type
  5866.       # NUMBER PICTURE
  5867.       if value.is_a?(Numeric)
  5868.          bitmap_number_image = Cache.system("XAS_Damage_Number")
  5869.          bitmap_im_cw = bitmap_number_image.width / 10
  5870.          bitmap_im_ch = bitmap_number_image.height / 5           
  5871.          bitmap = Bitmap.new(bitmap_number_image.width,(bitmap_im_ch * 2) + 5)
  5872.          bitmap_number_text = value.to_s.split(//)
  5873.          center_x = (((2 + bitmap_number_text.size) * bitmap_im_cw) / 2)
  5874.          # Damage Color         
  5875.          if value >= 0
  5876.             if @damage_type == "Critical"
  5877.                h = bitmap_im_ch * 2  
  5878.                h2 = bitmap_im_ch * 4
  5879.                $game_map.screen.start_shake(5, 5, 60)
  5880.             elsif @damage_type == "Mp"   
  5881.                h = bitmap_im_ch * 0  
  5882.                h2 = bitmap_im_ch * 3
  5883.             else
  5884.                h = 0
  5885.             end
  5886.             f = 0
  5887.           else # Recover Color   
  5888.             h = bitmap_im_ch  
  5889.             h2 = bitmap_im_ch * 3 if @damage_type == "Mp"     
  5890.             f = 1
  5891.         end   
  5892.         for r in f..bitmap_number_text.size - 1
  5893.             bitmap_number_abs = bitmap_number_text[r].to_i
  5894.             bitmap_src_rect = Rect.new(bitmap_im_cw * bitmap_number_abs, h, bitmap_im_cw, bitmap_im_ch)
  5895.             bitmap.blt(center_x + (bitmap_im_cw  *  r), bitmap_im_ch + 5, bitmap_number_image, bitmap_src_rect)                  
  5896.         end
  5897.         ex = (bitmap_im_cw / 2) * (bitmap_number_text.size + f)
  5898.         @damage_ox = (bitmap_number_image.width - (bitmap_number_image.width / 2) - ex) - center_x
  5899.         # Add Extra String (MP / Critical)
  5900.         if h2 != nil
  5901.            string_x = (center_x - (bitmap_number_image.width / 2) + (bitmap_im_cw / 2) * bitmap_number_text.size)
  5902.            bitmap_src_rect = Rect.new(0, h2,  bitmap_number_image.width, bitmap_im_ch)
  5903.            bitmap.blt(string_x , 0, bitmap_number_image, bitmap_src_rect)   
  5904.         end        
  5905.         bitmap_number_image.dispose  
  5906.       else
  5907.           #TEXT STRING
  5908.           damage_string = value.to_s
  5909.           bitmap = Bitmap.new(160, 48)
  5910.           bitmap.font.name = DAMAGE_FONT_NAME
  5911.           bitmap.font.size = DAMAGE_FONT_SIZE
  5912.           bitmap.font.bold = DAMAGE_FONT_BOLD
  5913.           bitmap.font.italic = DAMAGE_FONT_ITALIC
  5914.           bitmap.font.color = Color.new(0,0,0)
  5915.           bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  5916.           case @damage_type
  5917.                when "Exp";   string_color = DAMAGE_EXP_FONT_COLOR
  5918.                when "Gold";  string_color = DAMAGE_GOLD_FONT_COLOR
  5919.                when "Item";  string_color = DAMAGE_ITEM_FONT_COLOR
  5920.           else
  5921.              string_color = DAMAGE_DEFAULT_FONT_COLOR
  5922.           end
  5923.           bitmap.font.color = string_color
  5924.           bitmap.draw_text(0, 12, 160, 36, damage_string, 1)              
  5925.       end
  5926.        @_damage_sprite = ::Sprite.new(self.viewport)
  5927.        @_damage_sprite.bitmap = bitmap
  5928.        @_damage_sprite.ox = 80
  5929.        @_damage_sprite.oy = 20
  5930.        @_damage_sprite.x = self.x + @damage_ox
  5931.        @_damage_sprite.y = self.y - self.oy / 2
  5932.        @_damage_sprite.z = 3000
  5933.        @_damage_duration = 60
  5934.    end

  5935.   #--------------------------------------------------------------------------
  5936.   # ● Dispose Damage
  5937.   #--------------------------------------------------------------------------      
  5938.   def dispose_damage
  5939.       if @_damage_sprite != nil
  5940.          @_damage_sprite.bitmap.dispose
  5941.          @_damage_sprite.dispose
  5942.          @_damage_sprite = nil
  5943.          @_damage_duration = 0
  5944.       end
  5945.   end
  5946.   
  5947.   #--------------------------------------------------------------------------
  5948.   # ● Dispose
  5949.   #--------------------------------------------------------------------------         
  5950.   alias x_damage_dispose dispose
  5951.   def dispose
  5952.       dispose_damage
  5953.       x_damage_dispose
  5954.   end
  5955.   
  5956.   #--------------------------------------------------------------------------
  5957.   # ● Update
  5958.   #--------------------------------------------------------------------------           
  5959.   alias x_damage_pop_update update
  5960.   def update
  5961.       if @_damage_duration > 0
  5962.          @_damage_duration -= 1
  5963.          if @_damage_duration == 0
  5964.             dispose_damage
  5965.          end
  5966.        end      
  5967.        x_damage_pop_update
  5968.   end   
  5969.    
  5970. end  

  5971. #===============================================================================
  5972. # ■ XRXS DAMAGE
  5973. #===============================================================================
  5974. module XRXS_DAMAGE
  5975.   
  5976.   #--------------------------------------------------------------------------
  5977.   # ● Damage X Init Velocity
  5978.   #--------------------------------------------------------------------------                             
  5979.   def damage_x_init_velocity
  5980.       return 0.2 * (rand(5) - 2)
  5981.   end
  5982.    
  5983.   #--------------------------------------------------------------------------
  5984.   # ● Damage Y Init Velocity
  5985.   #--------------------------------------------------------------------------                             
  5986.   def damage_y_init_velocity
  5987.       return 9
  5988.   end
  5989.    
  5990.   #--------------------------------------------------------------------------
  5991.   # ● Update
  5992.   #--------------------------------------------------------------------------                              
  5993.   def update
  5994.     super
  5995.     @damage_sprites   = [] if @damage_sprites.nil?
  5996.     @damage_durations = [] if @damage_durations.nil?
  5997.     if @_damage_sprite != nil and @_damage_sprite.visible
  5998.        if @damage_ox != nil
  5999.           dam_ox = @damage_ox
  6000.        else   
  6001.           dam_ox = 0
  6002.        end        
  6003.        if @damage_type != nil
  6004.           dam_type = @damage_type
  6005.        end  
  6006.        x = damage_x_init_velocity
  6007.        y = damage_y_init_velocity
  6008.        d = @_damage_duration
  6009.        @damage_sprites.push(Sprite_Damage.new(@_damage_sprite, x, y, d,dam_ox,dam_type))
  6010.        @_damage_sprite.visible = false
  6011.     end
  6012.     for damage_sprite in @damage_sprites
  6013.         damage_sprite.update
  6014.     end
  6015.     for i in 0...@damage_sprites.size
  6016.         @damage_sprites[i] = nil if @damage_sprites[i].disposed?
  6017.     end
  6018.     @damage_sprites.compact!
  6019.   end
  6020.   def dispose
  6021.     super
  6022.     if @damage_sprites != nil
  6023.        for damage_sprite in @damage_sprites
  6024.            damage_sprite.dispose
  6025.        end
  6026.      end
  6027.   end
  6028. end

  6029. #===============================================================================
  6030. # ■ RPG Sprite
  6031. #===============================================================================
  6032. class Sprite_Base < Sprite
  6033.       include XRXS_DAMAGE
  6034. end

  6035. #===============================================================================
  6036. # ■ Sprite Damage
  6037. #===============================================================================
  6038. class Sprite_Damage < Sprite
  6039.   
  6040.   #--------------------------------------------------------------------------
  6041.   # ● Initialize
  6042.   #--------------------------------------------------------------------------                        
  6043.   def initialize(sprite, init_x_speed, init_y_speed, duration,dam_ox,dam_type = nil)
  6044.       super(nil)
  6045.       self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil?
  6046.       self.opacity = sprite.opacity
  6047.       self.x = sprite.x
  6048.       self.y = sprite.y
  6049.       self.z = sprite.z
  6050.       self.ox = sprite.ox - dam_ox
  6051.       self.oy = sprite.oy
  6052.       @now_x_speed = init_x_speed
  6053.       @now_y_speed = init_y_speed
  6054.       @potential_x_energy = 0.0
  6055.       @potential_y_energy = 0.0
  6056.       @duration = duration
  6057.       @dam_type = dam_type
  6058.       @dam_type = "" if dam_type == nil
  6059.   end

  6060.   #--------------------------------------------------------------------------
  6061.   # ● Update   
  6062.   #--------------------------------------------------------------------------                       
  6063.   def update
  6064.     super
  6065.     if XAS_DAMAGE_POP::DAMAGE_CRITICAL_ZOOM
  6066.        if @dam_type != "Critical"
  6067.           update_normal_popup
  6068.        else  
  6069.           update_critical_effect   
  6070.        end      
  6071.     else      
  6072.        update_normal_popup
  6073.     end
  6074.     @duration -= 1
  6075.     if @duration == 0
  6076.        self.dispose
  6077.     end
  6078.   end
  6079.   
  6080.   #--------------------------------------------------------------------------
  6081.   # ● update_critical_effect
  6082.   #--------------------------------------------------------------------------                           
  6083.   def update_critical_effect  
  6084.       case @duration
  6085.          when 40..60
  6086.            self.zoom_x += 0.1
  6087.            self.zoom_y += 0.1
  6088.          else   
  6089.            if self.zoom_x > 0.1   
  6090.               self.zoom_x -= 0.1
  6091.               self.zoom_y -= 0.1
  6092.            end
  6093.        end
  6094.   end
  6095.   
  6096.   #--------------------------------------------------------------------------
  6097.   # ● update_normal_popup
  6098.   #--------------------------------------------------------------------------                        
  6099.   def update_normal_popup
  6100.       self.opacity -= 25 if @duration <= 10
  6101.       n = self.oy + @now_y_speed
  6102.       if n <= 0
  6103.          @now_y_speed *= -1
  6104.          @now_y_speed /=  2
  6105.          @now_x_speed /=  2
  6106.       end
  6107.       self.oy  = [n, 0].max   
  6108.       @potential_y_energy += 0.58
  6109.       speed = @potential_y_energy.floor
  6110.       @now_y_speed        -= speed
  6111.       @potential_y_energy -= speed
  6112.       @potential_x_energy += @now_x_speed
  6113.       speed = @potential_x_energy.floor
  6114.       self.ox             += speed
  6115.       @potential_x_energy -= speed  
  6116.     end

  6117. end



  6118. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6119. #■ SPRITE - SPRITE EFFECTS
  6120. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  6121. #==============================================================================
  6122. # ■ Sprite Base
  6123. #==============================================================================
  6124. class Sprite_Base < Sprite  

  6125.   #--------------------------------------------------------------------------
  6126.   # ● Animation Set Sprite
  6127.   #--------------------------------------------------------------------------
  6128.   def animation_set_sprites(frame)
  6129.       cell_data = frame.cell_data
  6130.       @ani_sprites.each_with_index do |sprite, i|
  6131.         next unless sprite
  6132.         pattern = cell_data[i, 0]
  6133.         if !pattern || pattern < 0
  6134.             sprite.visible = false
  6135.             next
  6136.         end
  6137.         sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  6138.         sprite.visible = true
  6139.         sprite.src_rect.set(pattern % 5 * 192,
  6140.         pattern % 100 / 5 * 192, 192, 192)
  6141.         if @ani_mirror
  6142.            cx = cell_data[i, 1]
  6143.            sprite.angle = (360 - cell_data[i, 4])
  6144.            sprite.mirror = (cell_data[i, 5] == 0)
  6145.         else
  6146.            cx = cell_data[i, 1]
  6147.            sprite.angle = cell_data[i, 4]
  6148.            sprite.mirror = (cell_data[i, 5] == 1)
  6149.         end
  6150.         cy = cell_data[i, 2]
  6151.         sprite.z = self.z + 300 + i
  6152.         sprite.ox = 96
  6153.         sprite.oy = 96
  6154.         sprite.zoom_x = cell_data[i, 3] / 100.0
  6155.         sprite.zoom_y = cell_data[i, 3] / 100.0
  6156.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  6157.         sprite.blend_type = cell_data[i, 7]
  6158.         case @animation.position
  6159.               when 0
  6160.                   sprite.x = self.x + cx
  6161.                   sprite.y = self.y + cy - (height / 2)         
  6162.               when 1
  6163.                   sprite.x = self.x + cx
  6164.                   sprite.y = self.y + cy         
  6165.               when 2
  6166.                   sprite.x = self.x + cx
  6167.                   sprite.y = self.y + cy + (height / 2)
  6168.               when 3  
  6169.                   sprite.x  = (544 / 2) + cx
  6170.                   sprite.y  = (416 / 2) + cy     
  6171.         end        
  6172.         
  6173.         
  6174.     end
  6175.   end  
  6176.   
  6177.   #--------------------------------------------------------------------------
  6178.   # ● Dispose Animation
  6179.   #--------------------------------------------------------------------------
  6180.   def dispose_animation
  6181.       $game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
  6182.       if @ani_bitmap1
  6183.          @@_reference_count[@ani_bitmap1] -= 1
  6184.         if @@_reference_count[@ani_bitmap1] == 0
  6185.             $game_temp.animation_garbage.push(@ani_bitmap1)
  6186.          end
  6187.       end
  6188.       if @ani_bitmap2
  6189.          @@_reference_count[@ani_bitmap2] -= 1
  6190.          if @@_reference_count[@ani_bitmap2] == 0
  6191.             $game_temp.animation_garbage.push(@ani_bitmap2)
  6192.         end
  6193.      end
  6194.      if @ani_sprites
  6195.         @ani_sprites.each {|sprite| sprite.dispose }
  6196.         @ani_sprites = nil
  6197.         @animation = nil
  6198.      end
  6199.      @ani_bitmap1 = nil
  6200.      @ani_bitmap2 = nil
  6201.   end   
  6202.   
  6203. end

  6204. #==============================================================================
  6205. # ■ Scene_Base
  6206. #==============================================================================
  6207. class Game_Map
  6208.    
  6209.   #--------------------------------------------------------------------------
  6210.   # ● Setup
  6211.   #--------------------------------------------------------------------------   
  6212.   alias animation_garbage_setup setup
  6213.   def setup(map_id)
  6214.       animation_garbage_setup(map_id)
  6215.       dispose_animation_garbage
  6216.   end
  6217.   
  6218.   #--------------------------------------------------------------------------
  6219.   # ● Dispose Animation Garbage
  6220.   #--------------------------------------------------------------------------  
  6221.   def dispose_animation_garbage
  6222.       return if $game_temp.animation_garbage == nil
  6223.       for animation in $game_temp.animation_garbage
  6224.           animation.dispose
  6225.       end  
  6226.       $game_temp.animation_garbage = nil
  6227.   end  
  6228.   
  6229. end  

  6230. #==============================================================================
  6231. # ■ Scene_Base
  6232. #==============================================================================
  6233. class Scene_Base
  6234.   
  6235.   #--------------------------------------------------------------------------
  6236.   # ● Scene Changing?
  6237.   #--------------------------------------------------------------------------   
  6238.   alias animation_garbage_scene_changing scene_changing?
  6239.   def scene_changing?
  6240.       $game_map.dispose_animation_garbage if SceneManager.scene != self
  6241.       animation_garbage_scene_changing
  6242.   end

  6243. end  

  6244. #===============================================================================
  6245. # ■ Sprite_Character
  6246. #===============================================================================
  6247. class Sprite_Character < Sprite_Base
  6248.   include XAS_SYSTEM
  6249.   
  6250.   #--------------------------------------------------------------------------
  6251.   # ● Setup New Effect
  6252.   #--------------------------------------------------------------------------              
  6253.   def setup_new_effect
  6254.       if @character.animation_id > 0
  6255.          animation = $data_animations[@character.animation_id]
  6256.          start_animation(animation)
  6257.          @character.animation_id = 0
  6258.       end
  6259.       if !@balloon_sprite && @character.balloon_id > 0
  6260.          @balloon_id = @character.balloon_id
  6261.          start_balloon
  6262.       end
  6263.   end  
  6264.   
  6265.   #--------------------------------------------------------------------------
  6266.   # ● Can Update X Effects
  6267.   #--------------------------------------------------------------------------                    
  6268.   def can_update_x_effects?
  6269.       return false unless CHARACTER_SPRITE_EFFECTS
  6270.       return false if @character.erased
  6271.       return false if @character.transparent == true
  6272.       return true
  6273.   end  
  6274.   #--------------------------------------------------------------------------
  6275.   # ● Can Damage Pop Base
  6276.   #--------------------------------------------------------------------------                  
  6277.   def can_damage_pop_base?
  6278.       return false unless $game_system.xas_battle
  6279.       return false if XAS_SYSTEM::DAMAGE_POP == false
  6280.       return false if @character.battler == nil
  6281.       return false if @character.battler.no_damage_pop  
  6282.       return false if @character.battler.damage_pop != true
  6283.       return true  
  6284.   end  
  6285.   
  6286.   
  6287.   #--------------------------------------------------------------------------
  6288.   # ● Execute Damage Pop
  6289.   #--------------------------------------------------------------------------              
  6290.   def execute_damage_pop  
  6291.       damage(@character.battler.damage, @character.battler.damage_type)
  6292.       @character.battler.damage = nil
  6293.       @character.battler.critical = false
  6294.       @character.battler.damage_pop = false
  6295.       @character.battler.damage_type = ""
  6296.   end
  6297.    
  6298.   #--------------------------------------------------------------------------
  6299.   # ● Update X Effects
  6300.   #--------------------------------------------------------------------------              
  6301.   def update_x_effects
  6302.       update_collaspse_effects if @character.collapse_duration > 0
  6303.       update_sprite_position
  6304.       update_angle
  6305.       update_zoom
  6306.   end
  6307.    
  6308.   #--------------------------------------------------------------------------
  6309.   # ● Update Angle
  6310.   #--------------------------------------------------------------------------         
  6311.   def update_angle
  6312.       return if @character.angle == self.angle
  6313.       self.angle = @character.angle
  6314.   end
  6315.   
  6316.   #--------------------------------------------------------------------------
  6317.   # ● Update Zoom
  6318.   #--------------------------------------------------------------------------            
  6319.   def update_zoom
  6320.       update_treasure_effect
  6321.       update_breath_effect if can_breath_effect?
  6322.       self.zoom_x = @character.zoom_x
  6323.       self.zoom_y = @character.zoom_y
  6324.   end
  6325.   
  6326.   #--------------------------------------------------------------------------
  6327.   # ● Update Treasure_effect
  6328.   #--------------------------------------------------------------------------                     
  6329.   def update_treasure_effect
  6330.       return if @character.treasure_time == 0
  6331.       update_treasure_fade_effect
  6332.       update_treasure_float_effect
  6333.   end  
  6334.   
  6335.   #--------------------------------------------------------------------------
  6336.   # ● update_treasure_fade_effect
  6337.   #--------------------------------------------------------------------------                        
  6338.   def update_treasure_fade_effect
  6339.       return unless XAS_BA::FADE_TREASURE_SPRITE
  6340.       return if @character.treasure_time > 100
  6341.       return if @character.zoom_x < 0.01      
  6342.       @character.zoom_x -= 0.01
  6343.       if @character.temp_id > 0
  6344.          @character.zoom_x = 1.00
  6345.          @character.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  6346.       end
  6347.   end  
  6348.   
  6349.   #--------------------------------------------------------------------------
  6350.   # ● Update Treasure Float Effect
  6351.   #--------------------------------------------------------------------------                          
  6352.   def update_treasure_float_effect
  6353.       return unless XAS_BA::FLOAT_TREASURE_SPRITE   
  6354.       return if self.character.jumping?
  6355.       self.character.treasure_float[2] += 1
  6356.       if self.character.treasure_float[2] > 1
  6357.          self.character.treasure_float[2] = 0
  6358.          self.character.treasure_float[1] += 1
  6359.          case self.character.treasure_float[1]
  6360.             when 1..15
  6361.               self.character.treasure_float[0] -= 1
  6362.             when 16..30
  6363.               self.character.treasure_float[0] += 1
  6364.             else
  6365.               self.character.treasure_float[0] = 0
  6366.               self.character.treasure_float[1] = 0
  6367.           end
  6368.       end   
  6369.       self.y +=  self.character.treasure_float[0]
  6370.   end
  6371.   
  6372.   #--------------------------------------------------------------------------
  6373.   # ● Can Breath Effect?
  6374.   #--------------------------------------------------------------------------                    
  6375.   def can_breath_effect?
  6376.       return false if @character.battler == nil
  6377.       return false if @character.battler.breath_effect == false
  6378.       return false if @character.battler.hp == 0
  6379.       return false if @character.stop and not @character.battler.state_sleep
  6380.       return true
  6381.   end  
  6382.   
  6383.   #--------------------------------------------------------------------------
  6384.   # ● Update Breath Effect
  6385.   #--------------------------------------------------------------------------                  
  6386.   def update_breath_effect
  6387.       if @character.battler.fast_breath_effect
  6388.           zoom_speed = 3
  6389.           zoom_power_x = 0.006   
  6390.           zoom_power_y = 0.006        
  6391.       else
  6392.           zoom_speed = 1
  6393.           zoom_power_x = 0   
  6394.           zoom_power_y = 0.002
  6395.       end
  6396.       @character.battler.breath_duration += zoom_speed
  6397.       case @character.battler.breath_duration
  6398.            when 1..30
  6399.                 @character.zoom_x += zoom_power_x
  6400.                 @character.zoom_y += zoom_power_y
  6401.            when 31..60
  6402.                 @character.zoom_x -= zoom_power_x
  6403.                 @character.zoom_y -= zoom_power_y
  6404.            else  
  6405.                 @character.battler.breath_duration = 0
  6406.                 @character.zoom_x = 1.00
  6407.                 @character.zoom_y = 1.00
  6408.       end   
  6409.   end  
  6410.   
  6411.   #--------------------------------------------------------------------------
  6412.   # ● Update Sprite Position
  6413.   #--------------------------------------------------------------------------                  
  6414.   alias x_set_character_bitmap set_character_bitmap
  6415.   def set_character_bitmap
  6416.       @py = nil
  6417.       x_set_character_bitmap
  6418.       if @character_name[/\((\d+)\)/]
  6419.          @py = $1.to_i
  6420.       end            
  6421.   end
  6422.   
  6423.   #--------------------------------------------------------------------------
  6424.   # ● Update Sprite Position
  6425.   #--------------------------------------------------------------------------               
  6426.   def update_sprite_position
  6427.       if @character.tool_id > 0
  6428.          if @character.tool_effect == "Barrier"
  6429.             unless @character.action == nil
  6430.                bullet_user = @character.action.user
  6431.                self.x = bullet_user.screen_x
  6432.                self.y = bullet_user.screen_y
  6433.                @character.x = bullet_user.x
  6434.                @character.y = bullet_user.y
  6435.                @character.direction = bullet_user.direction
  6436.             end
  6437.          end  
  6438.       end  
  6439.       update_hold_target      
  6440.       if @py != nil
  6441.          self.y += @py
  6442.       end
  6443.       if @character.angle == 315 and @cw != nil
  6444.          self.x -= (@cw / 3)
  6445.          self.y -= (@ch / 6)
  6446.       end  
  6447.       if XAS_BA::KNOCKBACKING_SHAKE
  6448.          if self.character.knockbacking?
  6449.             self.x = self.x + rand(5) unless self.character.dead?
  6450.          end  
  6451.       end      
  6452. end  

  6453. #--------------------------------------------------------------------------
  6454. # ● Update X Effects
  6455. #--------------------------------------------------------------------------                 
  6456. def update_hold_target
  6457.      return if @character.temp_id == 0
  6458.      target = $game_map.events[@character.temp_id]
  6459.      if target == nil or target.erased
  6460.         @character.temp_id = 0
  6461.         @character.move_speed = @character.pre_move_speed
  6462.         check_character_above_player(target)
  6463.      else
  6464.         self.x = target.screen_x
  6465.         self.y = target.screen_y
  6466.         self.character.x = target.x
  6467.         self.character.y = target.y
  6468.         self.character.move_speed = target.move_speed
  6469.         self.character.direction = target.direction unless self.character.direction_fix
  6470.         check_character_above_player(target)
  6471.      end   
  6472. end

  6473. #--------------------------------------------------------------------------
  6474. # ● Check Chacracter Above Player
  6475. #--------------------------------------------------------------------------                  
  6476. def check_character_above_player(target)
  6477.      return if @character.is_a?(Game_Player)
  6478.      return if @character.battler == nil
  6479.      if (@character.x == $game_player.x and
  6480.          @character.y == $game_player.y) or
  6481.           not @character.passable_temp_id?(@character.x,@character.y)
  6482.          @character.temp_id = 0
  6483.          @character.move_speed = @character.pre_move_speed
  6484.          case @character.direction
  6485.             when 2;  @character.y -= 1
  6486.             when 4;  @character.x += 1
  6487.             when 6;  @character.x -= 1
  6488.             when 8;  @character.y += 1  
  6489.          end
  6490.      end   
  6491.    end
  6492.   
  6493. #--------------------------------------------------------------------------
  6494. # ● Update_balloon
  6495. #--------------------------------------------------------------------------
  6496. if XAS_BA::FIX_BALLOON_POSITION
  6497. def update_balloon
  6498.      if @balloon_duration > 0
  6499.         @balloon_duration -= 1
  6500.         if @balloon_duration > 0
  6501.            @balloon_sprite.x = x
  6502.            @balloon_sprite.y = y - XAS_BA::BALLOON_HEIGHT
  6503.            @balloon_sprite.z = z + 200
  6504.            sx = balloon_frame_index * 32
  6505.            sy = (@balloon_id - 1) * 32
  6506.            @balloon_sprite.src_rect.set(sx, sy, 32, 32)
  6507.       else
  6508.            end_balloon
  6509.       end
  6510.     end
  6511.   end   
  6512.   end

  6513. end

  6514. #==============================================================================
  6515. # ■ Game_Event
  6516. #==============================================================================
  6517. class Game_Event < Game_Character

  6518.   #--------------------------------------------------------------------------
  6519.   # ● Near The Screen
  6520.   #--------------------------------------------------------------------------  
  6521.   alias x_near_the_screen near_the_screen?
  6522.   def near_the_screen?(dx = 12, dy = 8)
  6523.       return true if can_update_out_screen?
  6524.       x_near_the_screen(dx, dy)
  6525.   end
  6526.   
  6527. #--------------------------------------------------------------------------
  6528. # ● Can Update Out Screen
  6529. #--------------------------------------------------------------------------
  6530. def can_update_out_screen?
  6531.      return true if self.force_update
  6532.      return false
  6533. end
  6534.    
  6535. end

  6536. #==============================================================================
  6537. # ■ Spriteset Map
  6538. #==============================================================================
  6539. class Spriteset_Map
  6540.   
  6541.   #--------------------------------------------------------------------------
  6542.   # ● Can Refresh Hud
  6543.   #--------------------------------------------------------------------------   
  6544.   alias x_pre_leader_id_initialize initialize
  6545.   def initialize
  6546.       if $game_party.members[0] != nil
  6547.          $game_system.pre_leader_id = $game_party.members[0].actor_id
  6548.       else   
  6549.          $game_system.pre_leader_id = nil
  6550.       end  
  6551.       x_pre_leader_id_initialize
  6552.   end  
  6553.   
  6554.   #--------------------------------------------------------------------------
  6555.   # ● Can Refresh Hud
  6556.   #--------------------------------------------------------------------------   
  6557.   def can_refresh_hud?
  6558.       if $game_party.members[0] == nil
  6559.          return true if $game_system.pre_leader_id != nil
  6560.       elsif $game_party.members[0] != nil   
  6561.          return true if $game_system.pre_leader_id == nil
  6562.          return true if $game_system.pre_leader_id != $game_party.members[0].actor_id
  6563.       end  
  6564.       return false
  6565.   end  
  6566.   
  6567.   #--------------------------------------------------------------------------
  6568.   # ● update
  6569.   #--------------------------------------------------------------------------   
  6570.   def refresh_hud
  6571.       $game_system.pre_leader_id = $game_party.members[0].actor_id      
  6572.   end
  6573.   
  6574.   #--------------------------------------------------------------------------
  6575.   # ● Update Hud Visible
  6576.   #--------------------------------------------------------------------------      
  6577.   def update_hud_visible
  6578.       if hud_visible?
  6579.          $game_system.enable_hud = true
  6580.       else   
  6581.          $game_system.enable_hud = false
  6582.       end  
  6583.   end  
  6584.    
  6585.   #--------------------------------------------------------------------------
  6586.   # ● Hud Visible?
  6587.   #--------------------------------------------------------------------------        
  6588.   def hud_visible?
  6589.       return false if $game_system.hud_visible == false
  6590.       return false if $game_message.visible
  6591.       return true
  6592.   end     
  6593.   
  6594. end  



  6595. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6596. #■ MISC - SCENE TARGET SELECT
  6597. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■


  6598. #==============================================================================
  6599. # ■ Game_Temp
  6600. #==============================================================================
  6601. class Game_Temp
  6602.       attr_accessor :xas_target_x
  6603.       attr_accessor :xas_target_y
  6604.       attr_accessor :xas_target_time
  6605.       attr_accessor :xas_target_shoot_id
  6606.       
  6607. #--------------------------------------------------------------------------
  6608. # ● Initialize
  6609. #--------------------------------------------------------------------------
  6610.   alias xas_target_initialize initialize
  6611.   def initialize
  6612.       xas_target_initialize
  6613.       @xas_target_x = 0
  6614.       @xas_target_y = 0
  6615.       @xas_target_time = 0
  6616.       @xas_target_shoot_id = 0
  6617.   end   
  6618.         
  6619. end

  6620. #==============================================================================
  6621. # ■ Game_Map
  6622. #==============================================================================
  6623. class Game_Map

  6624. attr_accessor :pre_display_x
  6625. attr_accessor :pre_display_y
  6626. attr_accessor :pre_real_display_x
  6627. attr_accessor :pre_real_display_y

  6628. #--------------------------------------------------------------------------
  6629. # * Object Initialization
  6630. #--------------------------------------------------------------------------
  6631. alias x_map_initialize initialize
  6632. def initialize  
  6633.      x_map_initialize
  6634.      @pre_display_x = @display_x - 1
  6635.      @pre_display_y = @display_y - 1   
  6636. end

  6637.   #--------------------------------------------------------------------------
  6638.   # ● Screen Scrolled?
  6639.   #--------------------------------------------------------------------------        
  6640.   def screen_scrolled?
  6641.       if @pre_display_x != @display_x or
  6642.          @pre_display_y != @display_y
  6643.          @pre_display_x = @display_x
  6644.          @pre_display_y = @display_y
  6645.          return true
  6646.       end   
  6647.       return false
  6648.   end

  6649. #--------------------------------------------------------------------------
  6650. # ● Event On Screen
  6651. #--------------------------------------------------------------------------
  6652. def event_on_screen?(event)
  6653.      event.target = false
  6654.      px = ($game_map.display_x).truncate
  6655.      py = ($game_map.display_y).truncate   
  6656.      distance_x = event.x - px
  6657.      distance_y = event.y - py
  6658.      if distance_x.between?(0, 16) and
  6659.         distance_y.between?(0, 12)
  6660.         event.target = true
  6661.      end  
  6662. end      
  6663.   
  6664. #--------------------------------------------------------------------------
  6665. # ● Check Event on Screen
  6666. #--------------------------------------------------------------------------
  6667. def check_events_on_screen
  6668.       for i in $game_map.events.values
  6669.             event_on_screen?(i)
  6670.       end   
  6671.   end
  6672.   
  6673. end  
  6674. #==============================================================================
  6675. # ■ Scene Target Select
  6676. #==============================================================================
  6677. class Scene_Target_Select
  6678.   
  6679.   #--------------------------------------------------------------------------
  6680.   # ● Main
  6681.   #--------------------------------------------------------------------------        
  6682.   def main     
  6683.       $game_temp.xas_target_x = 0
  6684.       $game_temp.xas_target_y = 0      
  6685.       $game_temp.xas_target_time = 0
  6686.       @new_x = $game_player.screen_x
  6687.       @new_y = $game_player.screen_y
  6688.       @index_max = -1
  6689.       @target_index = 0  
  6690.       @spriteset = Spriteset_Map.new
  6691.       @text_string = ""
  6692.       @fy = 0
  6693.       @fy_time = 0
  6694.       for event in $game_map.events.values
  6695.         if event.target and event.battler?
  6696.            @index_max += 1
  6697.         end  
  6698.       end  
  6699.       Sound.play_equip
  6700.       if @index_max == -1
  6701.          cancel_select
  6702.       else
  6703.          create_layout
  6704.          create_layout_skill
  6705.          create_cusrsor
  6706.          create_text      
  6707.          create_skill_name
  6708.          select_target(0)
  6709.       end
  6710.       Graphics.transition(0)
  6711.       loop do
  6712.            Graphics.update
  6713.            Input.update
  6714.            update
  6715.            break if SceneManager.scene != self
  6716.       end
  6717.       dispose
  6718. end  
  6719.   #--------------------------------------------------------------------------
  6720.   # ● Create Layout
  6721.   #--------------------------------------------------------------------------      
  6722.   def create_layout
  6723.       @layout_1 = Plane.new
  6724.       @layout_1.bitmap = Cache.system("XAS_Target_Layout1")
  6725.       @layout_1.z = 10100
  6726.       @layout_1.opacity = 255
  6727.   end  

  6728. #--------------------------------------------------------------------------
  6729. # ● Create Layout
  6730. #--------------------------------------------------------------------------      
  6731. def create_layout_skill
  6732.      @skill_layout = Sprite.new
  6733.      @skill_layout.bitmap = Cache.system("XAS_Active_Help")
  6734.      @skill_layout.z = 10101
  6735.      @skill_layout.x = -100   
  6736.      @skill_layout.y = 32
  6737.      @skill_layout.opacity = 0
  6738. end
  6739.    
  6740. #--------------------------------------------------------------------------
  6741. # ● Create Cursor
  6742. #--------------------------------------------------------------------------            
  6743. def create_cusrsor
  6744.      @cursor = Sprite.new
  6745.      @cursor.bitmap = Cache.system("XAS_Cursor")
  6746.      @cursor.z = 10105
  6747.      @cursor.x = @new_x
  6748.      @cursor.y = @new_y
  6749.      @cursor.opacity = 255
  6750.      @cursor.visible = true
  6751. end

  6752. #--------------------------------------------------------------------------
  6753. # ● Create Text
  6754. #--------------------------------------------------------------------------   
  6755. def create_text
  6756.      @text = Sprite.new
  6757.      @text.bitmap = Bitmap.new(200,40)
  6758.      @text.z = 10102
  6759.      @text.bitmap.font.size = 20
  6760.      @text.bitmap.font.bold = true
  6761.      @text.bitmap.font.name = "黑体"  
  6762.      @text.bitmap.draw_text(0, 0, 200, 40, @text_string.to_s,1)
  6763.      @text.opacity = 255
  6764.      @text.x = @new_x
  6765.      @text.y = @new_y   
  6766. end

  6767. #--------------------------------------------------------------------------
  6768. # ● Create Text
  6769. #--------------------------------------------------------------------------   
  6770. def create_skill_name
  6771.      @skill_name = Plane.new
  6772.      @skill_name.bitmap = Bitmap.new(640,480)
  6773.      @skill_name.z = 10103
  6774.      @skill_name.bitmap.font.size = 20
  6775.      @skill_name.bitmap.font.bold = true
  6776.      @skill_name.bitmap.font.name = "黑体"  
  6777.      @skill_name.oy = -40
  6778.      skill = $data_skills[$game_temp.xas_target_shoot_id]
  6779.      skill_text = skill.name.to_s + " - " + skill.description.to_s     
  6780.      @skill_name.bitmap.draw_text(0, 0, 640, 40, skill_text,1)
  6781.      @skill_name.opacity = 0
  6782. end  

  6783. #--------------------------------------------------------------------------
  6784. # ● Dispose
  6785. #--------------------------------------------------------------------------            
  6786. def dispose
  6787.      Graphics.freeze
  6788.      @spriteset.dispose
  6789.      if @cursor != nil
  6790.         @cursor.bitmap.dispose
  6791.         @cursor.dispose  
  6792.         @text.bitmap.dispose
  6793.         @text.dispose
  6794.         @skill_layout.bitmap.dispose
  6795.         @skill_layout.dispose
  6796.         @skill_name.bitmap.dispose
  6797.         @skill_name.dispose
  6798.         @layout_1.bitmap.dispose
  6799.         @layout_1.dispose
  6800.      end
  6801. end

  6802. #--------------------------------------------------------------------------
  6803. # ● Update
  6804. #--------------------------------------------------------------------------         
  6805. def update
  6806.      return if @index_max == -1
  6807.      @spriteset.update
  6808.      update_cursor_slide
  6809.      update_layout_slide
  6810.      update_targe_select
  6811. end

  6812. #--------------------------------------------------------------------------
  6813. # ● Update Layout Slide
  6814. #--------------------------------------------------------------------------            
  6815. def update_layout_slide
  6816.      @layout_1.ox += 3
  6817.      if @skill_layout.x < 0
  6818.         @skill_layout.x += 10
  6819.         @skill_layout.opacity += 25
  6820.         @skill_name.opacity += 25
  6821.      else
  6822.         @skill_layout.x = 0
  6823.         @skill_layout.opacity = 255
  6824.         @skill_name.opacity = 255
  6825.         @skill_name.ox -= 3
  6826.      end  
  6827. end  

  6828. #--------------------------------------------------------------------------
  6829. # ● Refresh Text
  6830. #--------------------------------------------------------------------------            
  6831. def refresh_text
  6832.      @text.bitmap.clear
  6833.      @text.bitmap.draw_text(0, 0, 200, 40, @text_string.to_s,1)
  6834. end
  6835.   
  6836. #--------------------------------------------------------------------------
  6837. # ● Update Cursor Slide
  6838. #--------------------------------------------------------------------------           
  6839. def update_cursor_slide
  6840.      @speed_x = [[(@cursor.x - @new_x / 60), 1].max, 60].min
  6841.      @speed_y = [[(@cursor.y - @new_y / 60), 1].max, 60].min
  6842.      if @cursor.x > @new_x
  6843.         @cursor.x -= @speed_x.abs
  6844.         @cursor.x = @new_x if @cursor.x < @new_x
  6845.      elsif @cursor.x < @new_x
  6846.         @cursor.x += @speed_x.abs
  6847.         @cursor.x = @new_x if @cursor.x > @new_x
  6848.      end         
  6849.       
  6850.      if @cursor.y > @new_y
  6851.         @cursor.y -= @speed_y.abs
  6852.         @cursor.y = @new_y if @cursor.y < @new_y
  6853.      elsif @cursor.y < @new_y
  6854.         @cursor.y += @speed_y.abs
  6855.         @cursor.y = @new_y if @cursor.y > @new_y
  6856.      end      
  6857.      @text.x = - 85 + @cursor.x
  6858.      @text.y = 20 + @cursor.y
  6859.      if @fy_time > 25
  6860.         @fy += 1
  6861.      elsif @fy_time > 0
  6862.         @fy -= 1
  6863.      else   
  6864.         @fy = 0
  6865.         @fy_time = 50
  6866.      end  
  6867.      @fy_time -= 1
  6868.      @cursor.oy = @fy
  6869.      
  6870. end

  6871. #--------------------------------------------------------------------------
  6872. # ● Select Target(type)
  6873. #--------------------------------------------------------------------------           
  6874. def select_target(type)
  6875.      return if  @index_max < 0
  6876.      check_index
  6877.      valor = 0
  6878.      for event in $game_map.events.values
  6879.         if event.target and event.battler?
  6880.            if valor == @target_index
  6881.               @new_x = event.screen_x - 10
  6882.               @new_y = event.screen_y
  6883.               @text_string = event.battler.name
  6884.               $game_temp.xas_target_x = event.x
  6885.               $game_temp.xas_target_y = event.y
  6886.               $game_temp.xas_target_time = 1
  6887.             end
  6888.             valor += 1  
  6889.          end  
  6890.      end   
  6891.      refresh_text  
  6892.   end

  6893. #--------------------------------------------------------------------------
  6894. # ● Cancel Select
  6895. #--------------------------------------------------------------------------              
  6896. def cancel_select
  6897.      Sound.play_buzzer
  6898.      $game_temp.xas_target_x = 0
  6899.      $game_temp.xas_target_y = 0      
  6900.      $game_temp.xas_target_time = 0
  6901.      $game_temp.xas_target_shoot_id = 0
  6902.      SceneManager.call(Scene_Map)
  6903. end
  6904.    
  6905.   #--------------------------------------------------------------------------
  6906.   # ● Update Target Select
  6907.   #--------------------------------------------------------------------------            
  6908.   def update_targe_select
  6909.       if Input.trigger?(Input::B)
  6910.          cancel_select
  6911.       elsif Input.trigger?(Input::DOWN) or Input.trigger?(Input::RIGHT)  
  6912.          @target_index += 1
  6913.          select_target(0)
  6914.          Sound.play_cursor
  6915.       elsif Input.trigger?(Input::UP) or Input.trigger?(Input::LEFT)
  6916.          @target_index -= 1
  6917.          select_target(1)
  6918.          Sound.play_cursor
  6919.       elsif Input.trigger?(Input::C)
  6920.          Sound.play_ok
  6921.          SceneManager.call(Scene_Map)
  6922.       end  
  6923.   end
  6924.   
  6925.   #--------------------------------------------------------------------------
  6926.   # ● Check Index
  6927.   #--------------------------------------------------------------------------               
  6928.   def check_index
  6929.       if @target_index > @index_max
  6930.          @target_index = 0
  6931.       end      
  6932.       if @target_index < 0
  6933.          @target_index = @index_max
  6934.       end   
  6935.   end        
  6936.   
  6937. end  


  6938. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6939. #■ MISC - MAIN UPDATE
  6940. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

  6941. #===============================================================================
  6942. # ■  Spriteset_Map
  6943. #===============================================================================
  6944. class Spriteset_Map
  6945.   
  6946.   #--------------------------------------------------------------------------
  6947.   # ● update
  6948.   #--------------------------------------------------------------------------  
  6949.   alias xas_main_update update
  6950.   def update
  6951.       xas_main_update
  6952.       update_xas_spriteset_map
  6953.   end

  6954.   #--------------------------------------------------------------------------
  6955.   # ● Update XAS Spriteset Map
  6956.   #--------------------------------------------------------------------------      
  6957.   def update_xas_spriteset_map
  6958.       refresh_token if $game_map.need_refresh_token
  6959.       refresh_hud if can_refresh_hud?
  6960.       update_hud_visible
  6961.   end   
  6962. end


  6963. #===============================================================================
  6964. # ■ Sprite_Character
  6965. #===============================================================================
  6966. class Sprite_Character < Sprite_Base
  6967.   
  6968.   #--------------------------------------------------------------------------
  6969.   # ● Update
  6970.   #--------------------------------------------------------------------------            
  6971.   alias x_update update
  6972.   def update
  6973.       x_update
  6974.       execute_damage_pop  if can_damage_pop_base?
  6975.       update_x_effects if can_update_x_effects?
  6976.   end
  6977.    
  6978. end   

  6979. #===============================================================================
  6980. # ■ Game Character
  6981. #===============================================================================
  6982. class Game_Character < Game_CharacterBase
  6983.   
  6984.   #--------------------------------------------------------------------------
  6985.   # ● Update
  6986.   #--------------------------------------------------------------------------   
  6987.   alias x_main_update update
  6988.   def update
  6989.       update_character_before_movement
  6990.       x_main_update
  6991.       update_character_after_movement
  6992.   end  

  6993.   #--------------------------------------------------------------------------
  6994.   # ● Update Character Before Movement
  6995.   #--------------------------------------------------------------------------      
  6996.   def update_character_before_movement
  6997.       check_xy
  6998.       update_force_action if can_force_action?
  6999.   end  
  7000.   
  7001.   #--------------------------------------------------------------------------
  7002.   # ● Update Character After Movement
  7003.   #--------------------------------------------------------------------------      
  7004.   def update_character_after_movement
  7005.       update_battler if can_update_battler?      
  7006.   end      
  7007.   
  7008. end  

  7009. #===============================================================================
  7010. # ■ Game Event
  7011. #===============================================================================
  7012. class Game_Event < Game_Character
  7013.   
  7014.   #--------------------------------------------------------------------------
  7015.   # ● Update
  7016.   #--------------------------------------------------------------------------   
  7017.   alias x_main_event_update update
  7018.   def update
  7019.       update_event_before_movement
  7020.       x_main_event_update
  7021.       update_event_after_movement
  7022.   end   
  7023.   
  7024.   #--------------------------------------------------------------------------
  7025.   # ● Update Event Before Movement
  7026.   #--------------------------------------------------------------------------      
  7027.   def update_event_before_movement
  7028.       update_sensor if can_update_sensor?
  7029.       update_treasure_duration      
  7030.   end  
  7031.   
  7032.   #--------------------------------------------------------------------------
  7033.   # ● Update Event After Movement
  7034.   #--------------------------------------------------------------------------      
  7035.   def update_event_after_movement
  7036.       
  7037.   end   
  7038.   
  7039. end  

  7040. #===============================================================================
  7041. # ■ Game Player
  7042. #===============================================================================
  7043. class Game_Player < Game_Character

  7044.   #--------------------------------------------------------------------------
  7045.   # ● Update
  7046.   #--------------------------------------------------------------------------   
  7047.   alias x_main_player_update update
  7048.   def update
  7049.       update_player_before_movement if party_system?
  7050.       x_main_player_update
  7051.       update_player_after_movement if party_system?
  7052.   end   
  7053.   
  7054.   #--------------------------------------------------------------------------
  7055.   # ● Update Player Before Movement
  7056.   #--------------------------------------------------------------------------      
  7057.   def update_player_before_movement
  7058.       check_actor_level
  7059.       update_reset_battler_setting_time
  7060.       if $game_system.old_interpreter_running != $game_map.interpreter.running?
  7061.          refresh_interpreter_effect
  7062.       end   
  7063.   end  
  7064.   
  7065.   #--------------------------------------------------------------------------
  7066.   # ● Update Player after Movement
  7067.   #--------------------------------------------------------------------------      
  7068.   def update_player_after_movement
  7069.       update_action_command if can_use_command?
  7070.       $game_temp.change_leader_wait_time -= 1 if $game_temp.change_leader_wait_time > 0
  7071.   end      
  7072.   
  7073. end
复制代码
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 14:30

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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