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

Project1

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

[已经解决] 如何给xas添加多个技能

[复制链接]

Lv1.梦旅人

梦石
0
星屑
128
在线时间
12 小时
注册时间
2019-2-10
帖子
4
跳转到指定楼层
1
发表于 2019-2-19 00:35:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 VIPArcher 于 2021-8-29 01:49 编辑

新人,问一下怎么给xas系统添加多个技能快捷

RUBY 代码复制
  1. module XAS_SYSTEM
  2.   #开启伤害显示
  3.   BATTLE_SYSTEM = true
  4.   # 是否弹出伤害?
  5.   DAMAGE_POP = true
  6.   # 启用行走图名字系统?
  7.   CHARACTER_POSE_NAME = true
  8.   # 启用对角色的影响 的描绘?
  9.   CHARACTER_SPRITE_EFFECTS = true
  10.   # 启用冲刺系统?
  11.   DASH_SYSTEM = true
  12.   # 启用对角线运动么?
  13.   PLAYER_DIAGONAL_MOVEMENT  = true
  14.   # 事件启用对角线运动么?
  15.   EVENT_DIAGONAL_MOVEMENT  = true
  16.   # 状态系统是否开启呢?
  17.   STATE_SYSTEM = true
  18.   # 定义的地图,这将是事件的工具的仓库地图哦!
  19.   ACTION_TEMPLATE_MAP_ID = 2
  20.   #变量定义ID与仓库事件ID相匹配的工具,
  21.   #这个ID是用于创建互动活动的工具哦。...比如仓库事件中火球的事件ID为3
  22.   #然后建立一个事件,换上草的行走图,再新增加一个页面,设置公共变量【3】条件为3
  23.   #就可以通过火球的射击到这个事件,来触发这个事件页面的开启了。
  24.   HIT_ID = 3
  25. end
  26. #===============================================================================
  27. # ■ XAS 按钮设定
  28. #===============================================================================
  29. module XAS_BUTTON
  30.   #使用武器的按钮
  31.   ACTION_1_BUTTON = Input::C
  32.   #使用盾牌的按钮.
  33.   ACTION_2_BUTTON = Input::X
  34.   #使用技能的按钮
  35.   SKILL_BUTTON = Input::Z  
  36.   #使用道具的按钮
  37.   ITEM_BUTTON = Input::Y
  38.   #冲刺的按钮
  39.   DASH_BUTTON = Input::A
  40.   #切换领队的按钮
  41.   CHANGE_LEADER_BUTTON = Input::R
  42.   #是否使用武器按钮.
  43.   ENABLE_ACTION_1_BUTTON = true
  44.   #是否使用盾牌按钮  
  45.   ENABLE_ACTION_2_BUTTON = true
  46.   #是否使用技能按钮
  47.   ENABLE_SKILL_BUTTON = true
  48.   #是否使用道具按钮
  49.   ENABLE_ITEM_BUTTON = true
  50.   #是否使用冲刺按钮
  51.   ENABLE_DASH_BUTTON = true
  52.   #是否使用队友切换系统  
  53.   ENABLE_CHANGE_LEADER_BUTTON = true
  54. end
  55.  
  56. #===============================================================================
  57. # ■ 文字设定
  58. #===============================================================================
  59. # 文字系统在 XAS的一般定义。
  60. #-------------------------------------------------------------------------------
  61. module XAS_WORD
  62.   # Ativar as palavras.
  63.   ENABLE_WORD = true
  64.   # 防御成功时显示的文字。
  65.   GUARD = "防御"
  66.   # MP不足时显示的文字。
  67.   NO_MP = "MP不足"
  68.   # 没有道具时显示的文字。
  69.   NO_ITEM = "道具不足"  
  70.   # 升级时显示的文字。
  71.   LEVEL_UP = "升级!"
  72.   # 禁止使用(道具,技能或者武器)时显示的文字。
  73.   SEAL = "禁止使用!"
  74.   # 无敌时显示的文字。
  75.   INVINCIBLE = "无敌"
  76.   # 定义“经验”的名称。
  77.   EXP = "Exp"
  78.   # 定义目标闪避时播放的文字。
  79.   EVADED = "闪避!"
  80.   # 未能命中显示的文字
  81.   MISSED = "未命中!"
  82.   # 当反击使用时,显示的文字。
  83.   COUNTER = "反击!"
  84.   # 反射成功时显示的文字。
  85.   REFLECT = "反射!"
  86. end
  87.  
  88. #===============================================================================
  89. # ■ XAS 伤害
  90. #===============================================================================
  91. # 伤害系统的XAS一般定义。
  92. #-------------------------------------------------------------------------------
  93. module XAS_DAMAGE_POP
  94.   # 伤害弹出的字体
  95.   DAMAGE_FONT_NAME = "黑体"
  96.   # 字体的大小。
  97.   DAMAGE_FONT_SIZE = 22
  98.   # 启用加粗字体咩?.
  99.   DAMAGE_FONT_BOLD = true
  100.   #  启用斜体咩?
  101.   DAMAGE_FONT_ITALIC = true
  102.   # 暴击时,伤害字体放大咩?
  103.   DAMAGE_CRITICAL_ZOOM = true
  104.   # 伤害弹出,显示金钱和经验咩?
  105.   DAMAGE_EXP_GOLD_POP = true  
  106.   # 状态获得时,是否弹出状态名显示呢?
  107.   DAMAGE_STATE_POP = true
  108.   # 道具获得时,是否弹出道具名显示咩?
  109.   DAMAGE_ITEM_POP = true
  110.   # 设置默认的字体颜色
  111.   DAMAGE_DEFAULT_FONT_COLOR = Color.new(255, 255, 255)
  112.   # 设置弹出 经验 文字的字体颜色
  113.   DAMAGE_EXP_FONT_COLOR = Color.new(0, 255, 100)
  114.   # 设置弹出 金币 文字的字体颜色
  115.   DAMAGE_GOLD_FONT_COLOR = Color.new(255, 255, 50)
  116.   # 设置弹出 道具 文字的字体颜色
  117.   DAMAGE_ITEM_FONT_COLOR = Color.new(155, 55, 250)
  118. end
  119.  
  120. #===============================================================================
  121. # ■ 声音设定
  122. #===============================================================================
  123. # Definição do sistema de sons do XAS.
  124. #-------------------------------------------------------------------------------
  125. module XAS_SOUND
  126.   #接到掉落的道具时的音效  
  127.   ITEM_DROP = "Key"
  128.   #升级时的音效
  129.   LEVEL_UP = "Chime1"
  130.   #消耗行为的效果,比如消耗道具之类的.
  131.   ACTION_COST = "Cursor2"
  132. end
  133.  
  134. #===============================================================================
  135. # ■ 动画设定
  136. #===============================================================================
  137. # 动画系统XAS的定义。
  138. # 如果你不想使用动画,将值设置为0(零)。
  139. #-------------------------------------------------------------------------------
  140. module XAS_ANIMATION
  141.   # 防御时动画
  142.   GUARD_ANIMATION_ID = 127
  143.   # 切换队长后播放的动画
  144.   CHANGE_LEADER_ANIMATION_ID = 135
  145.   # 角色无敌时的动画。
  146.   INVINCIBLE_ANIMATION_ID = 36
  147.   # 蓄力中的动画。
  148.   CHARGE_ANIMATION1_ID = 155
  149.   # 蓄力完成时的动画。
  150.   CHARGE_ANIMATION2_ID = 123
  151.   # 吟唱时显示的动画
  152.   CAST_TIME_ANIMATION_ID = 120
  153.   # 循环动画的播放速度。
  154.   LOOP_ANIMATIONS_SPEED = 60
  155.   # 反射时的动画。
  156.   REFLECT_ANIMATION_ID = 128
  157. end
  158.  
  159. #===============================================================================
  160. # ■ 一般战斗设置
  161. #===============================================================================
  162. # 战斗系统XAS的一般定义
  163. #-------------------------------------------------------------------------------
  164. module XAS_BA
  165.   #交换队长后需要等待多久才能再换。
  166.   CHANGE_LEADER_WAIT_TIME = 10
  167.   #启动游戏时,HUD是否见?
  168.   #您可以启用或禁用的HUD,在事件中使用下面的代码
  169.   # $game_system.hud_visible = true
  170.   HUD_VISIBLE_AT_STARTUP = false
  171.   # 在敌人传感器范围内会被激活的独立开关。
  172.   SENSOR_SELF_SWITCH = "D"
  173.    #设置变量定义的区域激活的默认ID(就是传感器变量的ID)
  174.   DEFAULT_SENSOR_RANGE_VARIABLE_ID = 4
  175.   # 角色被击破倒地后,起身所需要的时间.
  176.   DEFAULT_KNOCK_BACK_DURATION = 60
  177.   # 被击破倒地后,是否震动屏幕。
  178.   KNOCKBACKING_SHAKE = false
  179.   #基础移动速度
  180.   BASE_MOVE_SPEED = 4.0
  181.   # 冲刺时增加的移动速度.
  182.   DASH_MOVE_SPEED = 0.8
  183.   # 是否启用八方向行走。
  184.   DIAGONAL_DURATION_ENABLE = true
  185.   # 返回四方向的时间。
  186.   #(就是说角色是斜着走的,停止操作后,行走图切换到正方向行走的时间。)
  187.   DIAGONAL_DURATION = 15
  188.   # 经验的分配方式。
  189.   # 0 - EXP 谁杀了死敌人谁得这些EXP。
  190.   # 1 - EXP 每个人都可以获得同样多的EXP。
  191.   # 2 - EXP 获得的EXP需要被平均分配到每一个队员。
  192.   EXP_TYPE = 0
  193.   #[下面是用来定义地图掉落道具的。]
  194.   # 定义宝物消失时间。(秒数吧....)
  195.   TREASURE_ERASE_TIME = 3
  196.   # 是否启用忽明忽暗的效果。
  197.   FADE_TREASURE_SPRITE = true
  198.   # 是否启用悬浮的效果。
  199.   FLOAT_TREASURE_SPRITE = true
  200.   # 修正掉落道具的位置高度。
  201.   FIX_BALLOON_POSITION = true
  202.   # 固定在离地图多少高度以上。(像素)
  203.   BALLOON_HEIGHT = 32
  204. end  
  205.  
  206. #===============================================================================
  207. # ■ 敌人的设置
  208. #===============================================================================
  209.  
  210. module XAS_BA_ENEMY
  211.   #定义敌人能够抵挡的技能(TOOL事件)。
  212.   #
  213.   #INVUNERABLE_ACTIONS={A#=> B,B,B,B] A => B,B,B,B],...}
  214.   #A  -  敌人的ID。
  215.   #B  -  技能的ID。
  216.  
  217.   INVUNERABLE_ACTIONS = {
  218.   6=>[39,40,41,42,43],
  219.   7=>[24,25,26,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],
  220.   8=>[1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,24,25,26],
  221.   9=>[39,40,41,42,43],
  222.   10=>[39,40,41,42,43],
  223.   11=>[39,40,41,42,43]
  224.   }
  225.  
  226.   # 敌人能够抵挡哪个方向上的攻击。
  227.   # GUARD_DIRECTIONS = { A=>[B],  A=>[B,B,B,B], ...}
  228.   # A - 敌人的ID
  229.   # B - 方向。(2,4,6,8)
  230.   #     -> 2 = 下.   -> 4 = 左.
  231.   #     -> 6 = 右.   -> 8 = 上.
  232.  
  233.   GUARD_DIRECTIONS = {
  234.   }  
  235.  
  236.   # 敌人能够反击的技能
  237.   # 按下面的格式来设置。A为敌人ID,B为技能ID。
  238.   # COUNTER_ATTACK = { A=>[B,B,B,B],  A=>[B,B,B,B], ...}
  239.   COUNTER_ATTACK = {
  240.   }
  241.  
  242. end
  243. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  244. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  245. #■ 初始化操作
  246. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  247. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  248.  
  249. #===============================================================================
  250. # ■ 游戏_队伍
  251. #===============================================================================
  252. class Game_Temp
  253.   attr_accessor :change_leader_wait_time
  254.   attr_accessor :reset_battler_time
  255.   attr_accessor :tool_event
  256.   attr_accessor :animation_garbage
  257.  
  258.   #--------------------------------------------------------------------------
  259.   # ● 初始化
  260.   #--------------------------------------------------------------------------   
  261.   alias xas_initialize initialize
  262.   def initialize
  263.       @change_leader_wait_time = 0
  264.       @reset_battler_time = 0
  265.       @tool_event = nil
  266.       @animation_garbage = []
  267.       xas_initialize
  268.   end
  269.  
  270. end
  271.  
  272. #===============================================================================
  273. # ■ 游戏_系统
  274. #===============================================================================
  275. class Game_System
  276.   attr_accessor :tools_on_map
  277.   attr_accessor :old_interpreter_running
  278.   attr_accessor :hud_visible
  279.   attr_accessor :enable_hud
  280.   attr_accessor :command_enable
  281.   attr_accessor :pre_leader_id
  282.   attr_accessor :xas_battle
  283.   #--------------------------------------------------------------------------
  284.   # ● 初始化
  285.   #--------------------------------------------------------------------------   
  286.   alias x_initialize initialize
  287.   def initialize
  288.       @tools_on_map = []
  289.       @old_interpreter_running = false
  290.       @hud_visible = XAS_BA::HUD_VISIBLE_AT_STARTUP
  291.       @enable_hud = false
  292.       @command_enable  = true
  293.       @pre_leader_id = 0
  294.       @xas_battle = XAS_SYSTEM::BATTLE_SYSTEM
  295.       x_initialize
  296.   end  
  297. end  
  298.  
  299. #===============================================================================
  300. # ■ 游戏_战斗者
  301. #===============================================================================
  302. class Game_Battler
  303.   attr_accessor :damage_pop
  304.   attr_accessor :damage
  305.   attr_accessor :damage_type
  306.   attr_accessor :critical
  307.   attr_accessor :invunerable_duration
  308.   attr_accessor :shield
  309.   attr_accessor :invunerable_actions
  310.   attr_accessor :guard_directions
  311.   attr_accessor :guard
  312.   attr_accessor :invunerable
  313.   attr_accessor :x_combo
  314.   attr_accessor :cast_action
  315.   attr_accessor :defeated
  316.   attr_accessor :death_zoom_effect
  317.   attr_accessor :counter_action
  318.   attr_accessor :knockback_duration
  319.   attr_accessor :hp_damage
  320.   attr_accessor :mp_damage
  321.  
  322. #--------------------------------------------------------------------------
  323. # ● 初始化
  324. #--------------------------------------------------------------------------  
  325.   alias x_initialize initialize
  326.   def initialize
  327.       @damage = 0
  328.       @damage_pop = false
  329.       @damage_type = 0
  330.       @critical = false
  331.       @invunerable_duration = 0
  332.       @shield = false
  333.       @invunerable_actions = []
  334.       @guard_directions = []
  335.       @guard = true
  336.       @invunerable = false
  337.       @x_combo = [0,-1,0]
  338.       @defeated = false
  339.       @death_zoom_effect = 0
  340.       @cast_action = [0,0,0,0,0]
  341.       @counter_action = [0,0,true]
  342.       @knockback_duration = XAS_BA::DEFAULT_KNOCK_BACK_DURATION
  343.       x_initialize
  344.   end
  345.  
  346. #--------------------------------------------------------------------------
  347. # ● 添加 无敌 行为
  348. #--------------------------------------------------------------------------     
  349. def add_inv(action_id = 0)
  350.      return if action_id == nil or action_id <= 0
  351.      return if @invunerable_actions.include?(action_id)
  352.      @invunerable_actions.push(action_id)     
  353. end
  354.  
  355. #--------------------------------------------------------------------------
  356. # ● 消除 无敌 行为
  357. #--------------------------------------------------------------------------     
  358. def remove_inv(action_id = 0)
  359.      return if action_id == nil or action_id <= 0
  360.      return unless @invunerable_actions.include?(action_id)
  361.      @invunerable_actions.delete(action_id)     
  362. end
  363.  
  364. #--------------------------------------------------------------------------
  365. # ● 防御 的方向
  366. #--------------------------------------------------------------------------     
  367. def add_guard_dir(direction = 0)
  368.      return if direction == nil or direction <= 0
  369.      return if @guard_directions.include?(direction)
  370.      @guard_directions.push(direction)     
  371. end
  372.  
  373. #--------------------------------------------------------------------------
  374. # ● 消除 防御 的方向
  375. #--------------------------------------------------------------------------     
  376. def remove_guard_dir(direction = 0)
  377.      return if direction == nil or direction <= 0
  378.      return unless @guard_directions.include?(direction)
  379.      @guard_directions.delete(direction)     
  380. end  
  381.  
  382. end  
  383.  
  384. #===============================================================================
  385. # ■ 游戏 Actor
  386. #===============================================================================
  387. class Game_Actor < Game_Battler
  388.  
  389.   attr_accessor :x_action1_id
  390.   attr_accessor :x_action2_id
  391.   attr_accessor :skill_id
  392.   attr_accessor :x_item_id
  393.   attr_accessor :x_charge_action
  394.   attr_accessor :old_equipment_id
  395.   attr_accessor :item_id
  396.   attr_accessor :old_level
  397.   attr_reader :actor_id
  398.  
  399. #--------------------------------------------------------------------------
  400. # ● 计划
  401. #--------------------------------------------------------------------------   
  402. alias x_setup setup
  403. def setup(actor_id)
  404.       @x_action1_id = 0
  405.       @x_action2_id = 0
  406.       @skill_id = 0
  407.       @x_item_id = 0
  408.       @item_id = 0
  409.       @x_charge_action = [0,0,0,0]
  410.       @old_level = @level
  411.       @old_equipment_id = [0,0,0,0,0]
  412.       x_setup(actor_id)
  413. end
  414.  
  415. #--------------------------------------------------------------------------
  416. # ● 显示的等级
  417. #--------------------------------------------------------------------------     
  418.   alias x_display_level_up display_level_up
  419.   def display_level_up(new_skills)
  420.       return unless $game_party.in_battle
  421.       x_display_level_up(new_skills)
  422.   end
  423.  
  424. end
  425.  
  426. #===============================================================================
  427. # ■ 角色
  428. #===============================================================================
  429. class Game_Character < Game_CharacterBase
  430.  
  431.   attr_accessor :tool_id
  432.   attr_accessor :tool_effect  
  433.   attr_accessor :target
  434.   attr_accessor :target2
  435.   attr_accessor :old_x
  436.   attr_accessor :old_y
  437.   attr_accessor :pre_x
  438.   attr_accessor :pre_y
  439.   attr_accessor :temp_id
  440.   attr_accessor :angle
  441.   attr_accessor :force_action_times
  442.   attr_accessor :force_action
  443.   attr_accessor :move_frequency
  444.   attr_accessor :move_speed
  445.   attr_accessor :direction_fix
  446.   attr_accessor :walk_anime
  447.   attr_accessor :step_anime
  448.   attr_accessor :x
  449.   attr_accessor :y
  450.   attr_accessor :pattern
  451.   attr_accessor :pattern_count  
  452.   attr_accessor :jump_count
  453.   attr_accessor :jump_peak
  454.   attr_accessor :dash_active
  455.   attr_accessor :direction
  456.   attr_accessor :through
  457.   attr_accessor :bush_depth  
  458.   attr_accessor :blend_type
  459.   attr_accessor :priority_type  
  460.   attr_accessor :jump_count
  461.   attr_accessor :zoom_x
  462.   attr_accessor :zoom_y
  463.   attr_accessor :stop
  464.   attr_accessor :force_update
  465.   attr_accessor :treasure_time
  466.   attr_accessor :treasure_float
  467.   attr_accessor :can_update
  468.   attr_accessor :pre_move_speed
  469.   attr_accessor :knock_back_duration
  470.   attr_accessor :orig_pos_x
  471.   attr_accessor :orig_pos_y
  472.   attr_accessor :shoot_time
  473.   #--------------------------------------------------------------------------
  474.   # ● 初始化
  475.   #--------------------------------------------------------------------------   
  476.   alias x_initialize initialize
  477.   def initialize
  478.       x_initialize
  479.       @tool_id = 0
  480.       @tool_effect = ""
  481.       @target = false
  482.       @target2 = nil
  483.       @old_x = @x
  484.       @old_y = @y
  485.       @pre_x = @x
  486.       @pre_y = @y   
  487.       @orig_pos_x = @x
  488.       @orig_pos_y = @y
  489.       @angle = 0
  490.       @force_action_times = 0
  491.       @force_action = ""
  492.       @dash_active = false
  493.       @zoom_x = 1.00
  494.       @zoom_y = 1.00
  495.       @stop = false
  496.       @force_update = false
  497.       @treasure_time = 0
  498.       @treasure_float = [0,0,0,0]
  499.       @can_update = true
  500.       @temp_id = 0
  501.       @pre_move_speed = @move_speed
  502.       @shoot_time = [0,0]
  503.   end
  504.  
  505.   #--------------------------------------------------------------------------
  506.   # ● 无敌
  507.   #--------------------------------------------------------------------------      
  508.   def invunerable(enable = false)
  509.       return if @battler == nil or @battler.dead?
  510.       @battler.invunerable = enable
  511.   end  
  512.  
  513.   #--------------------------------------------------------------------------
  514.   # ● 敌人呼吸
  515.   #--------------------------------------------------------------------------        
  516.   def fast_breath(enable = true)
  517.      return if @battler == nil or @battler.dead?
  518.      @battler.fast_breath_effect = enable
  519.   end
  520. end
  521.  
  522. #===============================================================================
  523. # ■ 游戏_事件
  524. #===============================================================================
  525. class Game_Event < Game_Character
  526.   attr_accessor :target
  527.   attr_reader   :name
  528.   attr_accessor :collision_attack
  529.  
  530. #--------------------------------------------------------------------------
  531. # ● 对象
  532. #--------------------------------------------------------------------------      
  533. alias x_event_initialize initialize
  534. def initialize(map_id, event)
  535.      x_event_initialize(map_id, event)
  536.      @collision_attack = false
  537.      if @event.name =~ /<O(\d+)>/i or @event.name =~ /<透(\d+)>/i
  538.         @opacity = $1.to_i  
  539.      end   
  540.      if @event.name =~ /<B(\d+)>/i or @event.name =~ /<合(\d+)>/i  
  541.         @blend_type = $1.to_i
  542.      end  
  543. end  
  544.  
  545. #--------------------------------------------------------------------------
  546. # ● 事件消除
  547. #--------------------------------------------------------------------------        
  548. alias x_event_erase erase
  549. def erase
  550.      if self.tool_id > 0
  551.         $game_system.tools_on_map.delete(self.tool_id)
  552.      end   
  553.      x_event_erase
  554. end     
  555.  
  556. #--------------------------------------------------------------------------
  557. # ● 事件名字
  558. #--------------------------------------------------------------------------
  559.   def name
  560.       return @event.name  
  561.   end   
  562.  
  563. end
  564.  
  565. #===============================================================================
  566. # ■ 游戏队友
  567. #===============================================================================
  568. class Game_Followers
  569.  
  570. #--------------------------------------------------------------------------
  571. # ● 初始化
  572. #--------------------------------------------------------------------------  
  573.   alias x_party_initialize initialize
  574.   def initialize(leader)
  575.       x_party_initialize(leader)
  576.       if $xas_party_system == nil
  577.          @visible = false
  578.       end  
  579.   end  
  580. end  
  581.  
  582. #===============================================================================
  583. # ■ 游戏地图
  584. #===============================================================================
  585. class Game_Map  
  586.  
  587. #--------------------------------------------------------------------------
  588. # ● 设置
  589. #--------------------------------------------------------------------------  
  590.   alias x_initial_setup setup
  591.   def setup(map_id)
  592.       x_initial_setup(map_id)
  593.       xas_initial_setup(map_id)
  594.   end
  595.  
  596. #--------------------------------------------------------------------------
  597. # ● XAS 初始设置
  598. #--------------------------------------------------------------------------  
  599.   def xas_initial_setup(map_id)
  600.       for actor in $game_party.members
  601.           setup_initial_members(actor)
  602.       end  
  603.   end  
  604.  
  605. #--------------------------------------------------------------------------
  606. # ● 设置 初始成员
  607. #--------------------------------------------------------------------------   
  608.   def setup_initial_members(actor)
  609.  
  610.   end  
  611. end  
  612.  
  613.  
  614. #==============================================================================
  615. # ■ Scene_Map
  616. #==============================================================================
  617. class Scene_Map < Scene_Base
  618.  
  619.   #--------------------------------------------------------------------------
  620.   # ● 调用菜单
  621.   #--------------------------------------------------------------------------   
  622.   alias x_call_menu call_menu
  623.   def call_menu
  624.       return if $game_player.action != nil
  625.       $game_player.reset_charge_temp
  626.       x_call_menu
  627.   end
  628.  
  629. end   
  630. #===============================================================================
  631. # ■ Scene_Refresh
  632. #===============================================================================
  633. class Scene_Refresh
  634.  
  635. #--------------------------------------------------------------------------
  636. # ● 主处理
  637. #--------------------------------------------------------------------------
  638.   def main
  639.       SceneManager.call(Scene_Map)
  640.   end
  641. end
  642.  
  643. #==============================================================================
  644. # ■ Game_Player
  645. #==============================================================================
  646. class Game_Player < Game_Character
  647.  
  648. #--------------------------------------------------------------------------
  649. # ● 队友切换
  650. #--------------------------------------------------------------------------  
  651.   def leader_changed?(actor)
  652.       if $game_party.members[0] == nil
  653.          return true if actor != nil
  654.       elsif $game_party.members[0] != nil
  655.          return true if actor == nil   
  656.          return true if actor.actor_id != $game_party.members[0].actor_id        
  657.       end   
  658.       return false
  659.   end
  660.  
  661. end  
  662. $xas = true
  663.  
  664. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  665. #■ 运动 - 斜向运动
  666. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  667.  
  668.  
  669. #===============================================================================
  670. # ■ 游戏 角色
  671. #===============================================================================
  672. class Game_CharacterBase
  673.  
  674.   #--------------------------------------------------------------------------
  675.   # ● 建立方向
  676.   #--------------------------------------------------------------------------         
  677.    alias diagonal_set_direction set_direction
  678.    def set_direction(d)
  679.        diagonal_set_direction(d)
  680.        @diagonal_direction = 0
  681.        reset_diagonal
  682.    end
  683.  
  684. end   
  685.  
  686. #===============================================================================
  687. # ■  游戏 角色
  688. #===============================================================================
  689. class Game_Character < Game_CharacterBase
  690.  
  691.   attr_accessor :diagonal
  692.   attr_accessor :diagonal_direction
  693.   attr_accessor :sprite_angle_enable
  694.   attr_accessor :diagonal_time
  695.  
  696.   #--------------------------------------------------------------------------
  697.   # ● 初始化
  698.   #--------------------------------------------------------------------------        
  699.   alias diagonal_initialize initialize
  700.   def initialize
  701.       diagonal_initialize
  702.       if XAS_SYSTEM::EVENT_DIAGONAL_MOVEMENT
  703.          @diagonal = true
  704.       else   
  705.          @diagonal = false
  706.       end  
  707.       @diagonal_direction = 0
  708.       @sprite_angle_enable = false
  709.       @diagonal_time = 0
  710.   end  
  711.  
  712.   #--------------------------------------------------------------------------
  713.   # ● 复位 对角线
  714.   #--------------------------------------------------------------------------            
  715.   def reset_diagonal
  716.       return if @direction_fix
  717.       return if @diagonal == false
  718.       @diagonal_direction = 0   
  719.       @diagonal_time = 0
  720.       @angle = 0 if @sprite_angle_enable
  721.   end  
  722.  
  723.   #--------------------------------------------------------------------------
  724.   # ● 启用对角线
  725.   #--------------------------------------------------------------------------            
  726.   def enable_diagonal(dir = 0)
  727.      return if @direction_fix
  728.      return if @diagonal == false
  729.      return if dir == 0
  730.      @diagonal_direction = dir
  731.      @diagonal_time = XAS_BA::DIAGONAL_DURATION
  732.      @angle = 315 if @sprite_angle_enable
  733.   end  
  734.  
  735.   #--------------------------------------------------------------------------
  736.   # ● ↗
  737.   #--------------------------------------------------------------------------  
  738.   def turn_upper_right
  739.       enable_diagonal(9)
  740.       @direction = 8 unless @direction_fix
  741.   end  
  742.  
  743.   #--------------------------------------------------------------------------
  744.   # ● ↖
  745.   #--------------------------------------------------------------------------  
  746.   def turn_upper_left
  747.       enable_diagonal(7)
  748.       @direction = 4 unless @direction_fix
  749.   end   
  750.  
  751.   #--------------------------------------------------------------------------
  752.   # ● ↘
  753.   #--------------------------------------------------------------------------  
  754.   def turn_lower_right
  755.       enable_diagonal(3)
  756.       @direction = 6 unless @direction_fix
  757.   end      
  758.  
  759.   #--------------------------------------------------------------------------
  760.   # ● ↙
  761.   #--------------------------------------------------------------------------  
  762.   def turn_lower_left
  763.       enable_diagonal(1)
  764.       @direction = 2 unless @direction_fix
  765.   end   
  766.  
  767.   #--------------------------------------------------------------------------
  768.   # ● 移动朝向
  769.   #--------------------------------------------------------------------------               
  770.   alias diagonal_move_forward move_forward
  771.   def move_forward
  772.       return if move_forward_diagonal?
  773.       diagonal_move_forward
  774.   end
  775.  
  776.   #--------------------------------------------------------------------------
  777.   # ● 移动朝向对角线设置?
  778.   #--------------------------------------------------------------------------                  
  779.   def move_forward_diagonal?
  780.       return false if @diagonal == false
  781.       if @diagonal_direction != 0
  782.          case @diagonal_direction
  783.               when 1 #左上
  784.                  move_diagonal(4, 2)
  785.                  @direction = 2
  786.               when 3 #右下
  787.                  move_diagonal(6, 2)
  788.                  @direction = 6
  789.               when 7 #左下
  790.                  move_diagonal(4, 8)
  791.                  @direction = 4
  792.               when 9 #右上
  793.                  move_diagonal(6, 8)
  794.                  @direction = 8
  795.           end
  796.           enable_diagonal(@diagonal_direction)      
  797.          return true
  798.       end  
  799.       return false
  800.   end
  801.  
  802.   #--------------------------------------------------------------------------
  803.   # ● 后移动
  804.   #--------------------------------------------------------------------------               
  805.   alias diagonal_move_backward move_backward
  806.   def move_backward
  807.       return if move_backward_diagonal?
  808.       diagonal_move_backward
  809.   end
  810.  
  811.   #--------------------------------------------------------------------------
  812.   # ● 后移动对角线?
  813.   #--------------------------------------------------------------------------                  
  814.   def move_backward_diagonal?
  815.       return false if @diagonal == false
  816.       if @diagonal_direction != 0
  817.          last_direction_fix = @direction_fix
  818.          @direction_fix = true      
  819.          case @diagonal_direction
  820.               when 1
  821.                  move_diagonal(6, 8)
  822.                  @direction = 6
  823.               when 3
  824.                  move_diagonal(4, 8)
  825.                  @direction = 4
  826.               when 7
  827.                  move_diagonal(6, 2)
  828.                  @direction = 6
  829.               when 9         
  830.                  move_diagonal(4, 2)
  831.                  @direction = 2
  832.          end
  833.          enable_diagonal(@diagonal_direction)      
  834.          @direction_fix = last_direction_fix
  835.          return true
  836.       end  
  837.       return false
  838.   end  
  839.  
  840.   #--------------------------------------------------------------------------
  841.   # ● 转向朝向玩家
  842.   #--------------------------------------------------------------------------
  843.   alias turn_toward_player_diagonal turn_toward_player
  844.   def turn_toward_player
  845.       if @diagonal
  846.          diagonal_turn_toward_player
  847.          return
  848.       end
  849.       turn_toward_player_diagonal
  850.   end  
  851.  
  852.   #--------------------------------------------------------------------------
  853.   # ● 对角线 转向朝向玩家
  854.   #--------------------------------------------------------------------------
  855.   def diagonal_turn_toward_player
  856.       sx = distance_x_from($game_player.x)
  857.       sy = distance_y_from($game_player.y)
  858.       sd = sx.abs - sy.abs
  859.       sdx = sd.abs - sx.abs
  860.       sdy = sd.abs - sy.abs
  861.       return if sx == 0 and sy == 0
  862.       #Turn Upper Right
  863.       if sx < 0 and sy > 0
  864.          if sx.abs > sy.abs and sdx.abs < sd.abs
  865.             set_direction(6)
  866.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  867.             set_direction(8)
  868.          else
  869.             turn_upper_right
  870.          end
  871.          enable_diagonal(9)
  872.       #Turn Upper Left
  873.       elsif sx > 0 and sy > 0
  874.          if sx.abs > sy.abs and sdx.abs < sd.abs
  875.             set_direction(4)
  876.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  877.             set_direction(8)            
  878.          else
  879.             set_direction(4)
  880.             turn_upper_left
  881.          end
  882.          enable_diagonal(7)  
  883.       #Turn Lower Left  
  884.       elsif sx > 0 and sy < 0
  885.          if sx.abs > sy.abs and sdx.abs < sd.abs
  886.             set_direction(4)
  887.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  888.             set_direction(2)         
  889.          else                    
  890.             turn_lower_left
  891.          end
  892.          enable_diagonal(1)   
  893.        #Turn Lower Right   
  894.        elsif sx < 0 and sy < 0         
  895.          if sx.abs > sy.abs and sdx.abs < sd.abs
  896.             set_direction(6)
  897.          elsif sx.abs < sy.abs and sdy.abs < sd.abs
  898.             set_direction(2)           
  899.          else        
  900.             turn_lower_right
  901.          end
  902.          enable_diagonal(3)
  903.       elsif sx < 0
  904.          set_direction(6)
  905.       elsif sx > 0
  906.          set_direction(4)
  907.       elsif sy > 0
  908.          set_direction(8)
  909.       elsif sy < 0
  910.          set_direction(2)   
  911.       end     
  912.  
  913.   end  
  914.  
  915.   #--------------------------------------------------------------------------
  916.   # ● 跟随玩家
  917.   #--------------------------------------------------------------------------
  918.   alias move_toward_player_diagonal move_toward_player
  919.   def move_toward_player
  920.       if @diagonal
  921.          diagonal_move_toward_player
  922.          return  
  923.       end
  924.       move_toward_player_diagonal
  925.   end   
  926.  
  927.   #--------------------------------------------------------------------------
  928.   # ● 对角线移动跟随玩家
  929.   #--------------------------------------------------------------------------  
  930.   def diagonal_move_toward_player
  931.       sx = distance_x_from($game_player.x)
  932.       sy = distance_y_from($game_player.y)
  933.       if sx == 0 and sy == 0
  934.          return
  935.       end
  936.       abs_sx = sx.abs
  937.       abs_sy = sy.abs
  938.       if abs_sx == abs_sy
  939.         rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
  940.       end
  941.       if abs_sx
  942.          if sx < 0 and sy > 0
  943.             move_diagonal(6, 8)
  944.             move_random unless moving?
  945.             enable_diagonal(9)
  946.          elsif sx > 0 and sy > 0
  947.             move_diagonal(4, 8)
  948.             move_random unless moving?
  949.             enable_diagonal(7)
  950.          elsif sx > 0 and sy < 0
  951.             move_diagonal(4, 2)
  952.             move_random unless moving?
  953.             enable_diagonal(1)
  954.          elsif sx < 0 and sy < 0
  955.             move_diagonal(6, 2)
  956.             move_random unless moving?
  957.             enable_diagonal(3)
  958.          elsif sx < 0
  959.             move_straight(6)
  960.          elsif sx > 0
  961.             move_straight(4)
  962.          elsif sy > 0
  963.             move_straight(8)
  964.          elsif sy < 0
  965.             move_straight(2)
  966.          end
  967.          if abs_sx != 1 and abs_sy != 1
  968.             move_random unless moving?
  969.          end  
  970.       end
  971. end
  972.  
  973. #--------------------------------------------------------------------------
  974. # ● 右转_45度
  975. #--------------------------------------------------------------------------      
  976. def turn_right_45
  977.      if @diagonal and @diagonal_direction != 0     
  978.         case @diagonal_direction
  979.           when 1;  set_direction(4)
  980.           when 3;  set_direction(2)
  981.           when 7;  set_direction(8)
  982.           when 9;  set_direction(6)  
  983.         end
  984.      else  
  985.         case @direction
  986.           when 2;  turn_lower_left
  987.           when 4;  turn_upper_left
  988.           when 6;  turn_lower_right
  989.           when 8;  turn_upper_right
  990.         end
  991.      end  
  992. end
  993.  
  994. #--------------------------------------------------------------------------
  995. # ● 左转_45
  996. #--------------------------------------------------------------------------  
  997. def turn_left_45
  998.      if @diagonal and @diagonal_direction != 0     
  999.         case @diagonal_direction
  1000.           when 1;  set_direction(2)
  1001.           when 3;  set_direction(6)
  1002.           when 7;  set_direction(4)
  1003.           when 9;  set_direction(8)
  1004.         end
  1005.      else  
  1006.         case @direction
  1007.           when 2;  turn_lower_right
  1008.           when 4;  turn_lower_left
  1009.           when 6;  turn_upper_right
  1010.           when 8;  turn_upper_left
  1011.         end
  1012.      end  
  1013. end
  1014.  
  1015. #--------------------------------------------------------------------------
  1016. # ● 右转_90度
  1017. #--------------------------------------------------------------------------   
  1018. alias diagonal_turn_right_90 turn_right_90
  1019.   def turn_right_90
  1020.       if @diagonal and @diagonal_direction != 0
  1021.          turn_diagonal_right_90
  1022.          return
  1023.       end  
  1024.       diagonal_turn_right_90
  1025.   end
  1026.  
  1027. #--------------------------------------------------------------------------
  1028. # ● 斜角右转_90度
  1029. #--------------------------------------------------------------------------   
  1030.   def turn_diagonal_right_90
  1031.       case @diagonal_direction
  1032.          when 1;  turn_upper_left
  1033.          when 3;  turn_lower_left
  1034.          when 7;  turn_upper_right
  1035.          when 9;  turn_lower_right
  1036.       end
  1037.   end
  1038.  
  1039. #--------------------------------------------------------------------------
  1040. # ● 左转_90度
  1041. #--------------------------------------------------------------------------   
  1042.   alias diagonal_turn_left_90 turn_left_90
  1043.   def turn_left_90
  1044.       if @diagonal and @diagonal_direction != 0
  1045.          turn_diagonal_left_90
  1046.          return
  1047.       end
  1048.       diagonal_turn_left_90
  1049.   end  
  1050.  
  1051. #--------------------------------------------------------------------------
  1052. # ● 斜角左转_90度
  1053. #--------------------------------------------------------------------------   
  1054.   def turn_diagonal_left_90
  1055.       case @diagonal_direction
  1056.          when 1;  turn_lower_right
  1057.          when 3;  turn_upper_right
  1058.          when 7;  turn_lower_left
  1059.          when 9;  turn_upper_left
  1060.       end
  1061.   end     
  1062.  
  1063.   #--------------------------------------------------------------------------
  1064.   # ● 转_180度
  1065.   #--------------------------------------------------------------------------
  1066.   alias diagonal_turn_180 turn_180
  1067.   def turn_180  
  1068.       if @diagonal and @diagonal_direction != 0
  1069.          turn_diagonal_180
  1070.          return
  1071.       end
  1072.       diagonal_turn_180
  1073.   end
  1074.  
  1075. #--------------------------------------------------------------------------
  1076. # ● 斜角转_180度
  1077. #--------------------------------------------------------------------------   
  1078.   def turn_diagonal_180
  1079.       case @diagonal_direction
  1080.          when 1;  turn_upper_right
  1081.          when 3;  turn_upper_left
  1082.          when 7;  turn_lower_right
  1083.          when 9;  turn_lower_left
  1084.       end
  1085.   end  
  1086.  
  1087. #--------------------------------------------------------------------------
  1088. # ● 随机移动
  1089. #--------------------------------------------------------------------------   
  1090.   alias diagonal_turn_random turn_random
  1091.   def turn_random
  1092.       if @diagonal
  1093.          turn_diagonal_random
  1094.          return
  1095.       end  
  1096.       diagonal_turn_random
  1097.   end  
  1098.  
  1099. #--------------------------------------------------------------------------
  1100. # ● 斜角随机移动
  1101. #--------------------------------------------------------------------------   
  1102.   def turn_diagonal_random
  1103.       case rand(8)
  1104.           when 0;  set_direction(8)
  1105.           when 1;  set_direction(6)
  1106.           when 2;  set_direction(4)
  1107.           when 3;  set_direction(2)
  1108.           when 4;  turn_lower_left  
  1109.           when 5;  turn_lower_right
  1110.           when 6;  turn_upper_left  
  1111.           when 7;  turn_upper_right
  1112.       end
  1113.   end
  1114.  
  1115. end   
  1116.  
  1117. #===============================================================================
  1118. # ■ Game_Player
  1119. #===============================================================================
  1120. class Game_Player < Game_Character
  1121.  
  1122.   #--------------------------------------------------------------------------
  1123.   # ● Move By Input
  1124.   #--------------------------------------------------------------------------   
  1125.   alias diagonal_move_by_input move_by_input
  1126.   def move_by_input
  1127.       if XAS_SYSTEM::PLAYER_DIAGONAL_MOVEMENT
  1128.          player_diagonal_move_by_input
  1129.         # update_sprite_diagonal
  1130.          update_return_direction
  1131.          return
  1132.       end
  1133.       diagonal_move_by_input
  1134.   end   
  1135.  
  1136.   #--------------------------------------------------------------------------
  1137.   # ● Update Sprite Diagonal
  1138.   #--------------------------------------------------------------------------        
  1139.   def update_sprite_diagonal
  1140.       return if @diagonal_direction == 0
  1141.       return if self.action != nil
  1142.       return if @dash_active
  1143.       make_pose("_Diagonal", 2)
  1144.   end  
  1145.  
  1146.   #--------------------------------------------------------------------------
  1147.   # ● Update Return Direction
  1148.   #--------------------------------------------------------------------------         
  1149.   def update_return_direction
  1150.       return if XAS_BA::DIAGONAL_DURATION_ENABLE == false
  1151.       return if @diagonal_time == 0
  1152.       return if moving? or @stop
  1153.       @diagonal_time -= 1
  1154.       @diagonal_direction = 0 if @diagonal_time == 0
  1155.   end
  1156.  
  1157.   #--------------------------------------------------------------------------
  1158.   # ● Player Diagonal Move By Input
  1159.   #--------------------------------------------------------------------------      
  1160.   def player_diagonal_move_by_input   
  1161.       return unless movable?
  1162.       return if $game_map.interpreter.running?
  1163.       case Input.dir8
  1164.            when 1
  1165.                move_diagonal(4, 2)
  1166.                unless moving?
  1167.                    move_straight(4)
  1168.                    move_straight(2)                 
  1169.                end  
  1170.                @diagonal_direction = 1  
  1171.            when 2; move_straight(2)
  1172.            when 3
  1173.                 move_diagonal(6, 2)
  1174.                 unless moving?
  1175.                    move_straight(6)
  1176.                    move_straight(2)
  1177.                 end
  1178.                 @diagonal_direction = 3
  1179.            when 4;  move_straight(4)
  1180.            when 6;  move_straight(6)
  1181.            when 7
  1182.                  move_diagonal(4, 8)
  1183.                  unless moving?
  1184.                     move_straight(4)
  1185.                     move_straight(8)
  1186.                 end
  1187.                 @diagonal_direction = 7
  1188.            when 8;  move_straight(8)
  1189.            when 9  
  1190.                  move_diagonal(6, 8)
  1191.                  unless moving?
  1192.                     move_straight(6)
  1193.                     move_straight(8)
  1194.                 end
  1195.                 @diagonal_direction = 9  
  1196.       end
  1197.   end  
  1198.  
  1199. end
  1200.  
  1201.  
  1202. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1203. #■ MOVEMENT - FORCE ACTION
  1204. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1205.  
  1206.  
  1207. #===============================================================================
  1208. # ■ Game Character
  1209. #===============================================================================
  1210. class Game_Character < Game_CharacterBase
  1211.  
  1212.   #--------------------------------------------------------------------------
  1213.   # ● moving 2?
  1214.   #--------------------------------------------------------------------------  
  1215.   def moving2?
  1216.       @real_x != @x || @real_y != @y
  1217.   end   
  1218.  
  1219.   #--------------------------------------------------------------------------
  1220.   # ● Can Force Action?
  1221.   #--------------------------------------------------------------------------         
  1222.   def can_force_action?
  1223.       return false if @force_action_times  == 0
  1224.       return false if self.moving2?
  1225.       return false if self.jumping?
  1226.       return false if self.knockbacking?
  1227.       return false if self.stop
  1228.       return true
  1229.   end
  1230.  
  1231.   #--------------------------------------------------------------------------
  1232.   # ● Update Force Action
  1233.   #--------------------------------------------------------------------------        
  1234.   def update_force_action
  1235.       @force_action_times -= 1
  1236.       execute_force_action
  1237.       execute_force_action_tool_effect if @tool_id > 0 and @tool_effect != ""
  1238.       reset_auto_action if @force_action_times == 0
  1239.   end
  1240.  
  1241.   #--------------------------------------------------------------------------
  1242.   # ● Execute Force Action
  1243.   #--------------------------------------------------------------------------         
  1244.   def execute_force_action  
  1245.       case @force_action
  1246.         when "Forward"
  1247.             move_forward
  1248.         when "Backward"
  1249.             move_backward
  1250.         when "Toward Player"   
  1251.             move_toward_player
  1252.         when "Move Left"   
  1253.             move_straight(4)
  1254.         when "Move Right"
  1255.             move_straight(6)
  1256.         when "Move Up"   
  1257.             move_straight(8)
  1258.         when "Move Down"
  1259.             move_straight(2)
  1260.         when "All Shoot"  
  1261.               if self.action != nil
  1262.                  turn_right_45
  1263.                  self.shoot(self.action.id) unless @force_action_times == 0
  1264.               end
  1265.         when "Four Shoot"  
  1266.               if self.action != nil
  1267.                  turn_right_90
  1268.                  self.shoot(self.action.id) unless @force_action_times == 0
  1269.               end               
  1270.         when "Three Shoot"  
  1271.               if self.action != nil
  1272.                  case @force_action_times
  1273.                      when 2
  1274.                        turn_right_45
  1275.                      when 1
  1276.                        turn_left_90
  1277.                      when 0
  1278.                        turn_right_45
  1279.                  end  
  1280.                  self.shoot(self.action.id) unless @force_action_times == 0
  1281.               end      
  1282.         when "Two Shoot"  
  1283.               if self.action != nil
  1284.                  turn_180
  1285.                  self.shoot(self.action.id) unless @force_action_times == 0
  1286.               end   
  1287.         end  
  1288.   end  
  1289.  
  1290.   #--------------------------------------------------------------------------
  1291.   # ● Execute Force Action Tool Effect
  1292.   #--------------------------------------------------------------------------
  1293.   def execute_force_action_tool_effect
  1294.       action_effect_during_move     
  1295.       action_effect_after_move if @force_action_times == 0
  1296.   end  
  1297.  
  1298.   #--------------------------------------------------------------------------
  1299.   # ● Auto Action Effect During Move
  1300.   #--------------------------------------------------------------------------            
  1301.   def reset_auto_action  
  1302.       @force_action = ""
  1303.       @force_action_times = 0
  1304.       @anime_count = 0
  1305.   end
  1306.  
  1307.   #--------------------------------------------------------------------------
  1308.   # ● Action Effect During Move
  1309.   #--------------------------------------------------------------------------         
  1310.   def action_effect_during_move  
  1311.       if @tool_effect == "Boomerang" and @force_action == "Toward Player"  
  1312.          if @x == $game_player.x and @y == $game_player.y  
  1313.             self.action.duration = 15
  1314.             @force_action_times = 0
  1315.             @force_action_type = ""            
  1316.           end
  1317.       end
  1318.   end  
  1319.  
  1320.   #--------------------------------------------------------------------------
  1321.   # ● Action Effect After Move
  1322.   #--------------------------------------------------------------------------            
  1323.   def action_effect_after_move
  1324.       if @tool_effect == "Boomerang"
  1325.          @force_action_times = 30
  1326.          @force_action = "Toward Player"   
  1327.          @move_frequency = 6
  1328.          @move_speed = 5.5           
  1329.       end     
  1330.   end      
  1331.  
  1332. end
  1333. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1334. #■ MOVEMENT - EXTRA MOVEMENT
  1335. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1336.  
  1337.  
  1338. #===============================================================================
  1339. # ■ Game Character
  1340. #===============================================================================
  1341. class Game_Character < Game_CharacterBase
  1342.  
  1343.   #--------------------------------------------------------------------------
  1344.   # ● Check XY
  1345.   #--------------------------------------------------------------------------      
  1346.   def check_xy
  1347.       @pre_x = @x
  1348.       @pre_y = @y
  1349.   end   
  1350.  
  1351.   #--------------------------------------------------------------------------
  1352.   # ● Turn Reverse
  1353.   #--------------------------------------------------------------------------         
  1354.   def turn_reverse(dir)
  1355.       case dir     
  1356.         when 2; set_direction(8)
  1357.         when 4; set_direction(6)
  1358.         when 6; set_direction(4)
  1359.         when 8; set_direction(2)
  1360.       end   
  1361.   end
  1362.  
  1363.   #--------------------------------------------------------------------------
  1364.   # ● Org Here
  1365.   #--------------------------------------------------------------------------        
  1366.   def org_here
  1367.       @orig_pos_x = @x
  1368.       @orig_pos_y = @y
  1369.   end  
  1370.  
  1371.   #--------------------------------------------------------------------------
  1372.   # ● return_org
  1373.   #--------------------------------------------------------------------------         
  1374.   def return_org(type = 0)
  1375.       if type == 1
  1376.          moveto(@orig_pos_x,@orig_pos_x)
  1377.       else  
  1378.          jump(0,0)
  1379.       end
  1380.       @x = @orig_pos_x
  1381.       @y = @orig_pos_y
  1382.   end  
  1383.  
  1384.   #--------------------------------------------------------------------------
  1385.   # ● Dual Switch
  1386.   #--------------------------------------------------------------------------   
  1387.   def dual_switch(switch_on, switch_off,percentage = 100)
  1388.       enable_per = rand(100)
  1389.       if enable_per <= percentage
  1390.          $game_switches[switch_on] = true   
  1391.          $game_switches[switch_off] = false
  1392.          $game_map.need_refresh = true
  1393.       end   
  1394.   end   
  1395.  
  1396.   #--------------------------------------------------------------------------
  1397.   # ● Move Forward 2
  1398.   #--------------------------------------------------------------------------  
  1399.   def move_forward2
  1400.       return if moving2?
  1401.       move_forward
  1402.   end  
  1403.  
  1404.   #--------------------------------------------------------------------------
  1405.   # ● Bounce Direction
  1406.   #--------------------------------------------------------------------------  
  1407.   def bounce_direction
  1408.       @diagonal = true
  1409.       turn_random  
  1410.   end
  1411.  
  1412.   #--------------------------------------------------------------------------
  1413.   # ● Turn_back
  1414.   #--------------------------------------------------------------------------            
  1415.   def turn_back
  1416.       if @diagonal_direction != 0
  1417.          case @diagonal_direction
  1418.               when 1
  1419.                 turn_upper_right
  1420.               when 3
  1421.                 turn_upper_left
  1422.               when 7
  1423.                 turn_lower_right
  1424.               when 9         
  1425.                 turn_lower_left
  1426.          end
  1427.       else
  1428.           case @direction
  1429.                when 2;   set_direction(8)
  1430.                when 4;   @direction = 6#move_straight(6)#set_direction(6)
  1431.                when 6;   set_direction(4)
  1432.                when 8;   set_direction(2)
  1433.           end
  1434.       end     
  1435.   end  
  1436.  
  1437.   #--------------------------------------------------------------------------
  1438.   # ● Jump_high
  1439.   #--------------------------------------------------------------------------
  1440.   def jump_high(x_plus,y_plus,high = 10)   
  1441.       @x += x_plus
  1442.       @y += y_plus
  1443.       distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
  1444.       @jump_peak = high + distance - @move_speed
  1445.       @jump_count = @jump_peak * 2
  1446.       @stop_count = 0
  1447.       straighten
  1448.   end
  1449.  
  1450.   #--------------------------------------------------------------------------
  1451.   # ● Passable Temp
  1452.   #--------------------------------------------------------------------------   
  1453. def passable_temp_id?(x, y)
  1454.      return false unless $game_map.valid?(x, y)   
  1455.      return true if @through or debug_through?     
  1456.      return false unless map_passable?(x, y,@direction)         
  1457.      return false if collide_with_characters_temp_id?(x, y)
  1458.      return true                                   
  1459.   end
  1460.  
  1461.   #--------------------------------------------------------------------------
  1462.   # ● Collide With Characters
  1463.   #--------------------------------------------------------------------------      
  1464.   def collide_with_characters_temp_id?(x, y)
  1465.       for event in $game_map.events_xy(x, y)         
  1466.           unless event.through or event.battler != nil   
  1467.              return true if self.is_a?(Game_Event)      
  1468.              return true if event.priority_type >= 1     
  1469.           end
  1470.       end
  1471.       return false
  1472.   end  
  1473.  
  1474.   #--------------------------------------------------------------------------
  1475.   # ● Force Move Route
  1476.   #--------------------------------------------------------------------------
  1477.   alias x_force_move_route force_move_route
  1478.   def force_move_route(move_route)
  1479.       if self.battler != nil and self.is_a?(Game_Event)
  1480.          return
  1481.       end  
  1482.       x_force_move_route(move_route)
  1483.   end  
  1484. end
  1485. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1486. #■ MOVEMENT - PLAYER COMMANDS
  1487. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1488.  
  1489.  
  1490. #==============================================================================
  1491. # ■ Game_Player
  1492. #==============================================================================
  1493. class Game_Player < Game_Character
  1494.   include XAS_BUTTON
  1495.  
  1496.   #--------------------------------------------------------------------------
  1497.   # ● Update Action Command
  1498.   #--------------------------------------------------------------------------  
  1499.   def update_action_command
  1500.       update_check_battler_equipment if can_check_battler_equipment?
  1501.       update_dash_button
  1502.       update_auto_target_shoot
  1503.       update_combo_time
  1504.       update_action_1_button
  1505.       update_action_2_button
  1506.       update_skill_button
  1507.       update_item_button
  1508.       update_change_leader_button
  1509.       update_charge_button
  1510.   end  
  1511.  
  1512.   #--------------------------------------------------------------------------
  1513.   # ● Can Use Command?
  1514.   #--------------------------------------------------------------------------      
  1515.   def can_use_command?
  1516.       return false if $game_map.interpreter.running?
  1517.       return false if $game_message.visible
  1518.       return false if self.battler == nil
  1519.       return false if self.action != nil
  1520.       return false if self.knockbacking?      
  1521.       return false if @stop
  1522.       return true
  1523.   end   
  1524.  
  1525.   #--------------------------------------------------------------------------
  1526.   # ● Update Check Battler Equipment
  1527.   #--------------------------------------------------------------------------      
  1528.   def update_check_battler_equipment
  1529.  
  1530.   end  
  1531.  
  1532.   #--------------------------------------------------------------------------
  1533.   # ● Can Check Battler Equipment
  1534.   #--------------------------------------------------------------------------        
  1535.   def can_check_battler_equipment?
  1536.       if self.battler.old_equipment_id[0] != self.battler.equips[0] or
  1537.          self.battler.old_equipment_id[1] != self.battler.equips[1] or
  1538.          self.battler.old_equipment_id[2] != self.battler.equips[2] or
  1539.          self.battler.old_equipment_id[3] != self.battler.equips[3] or
  1540.          self.battler.old_equipment_id[4] != self.battler.equips[4]
  1541.          self.battler.old_equipment_id[0] = self.battler.equips[0]
  1542.          self.battler.old_equipment_id[1] = self.battler.equips[1]
  1543.          self.battler.old_equipment_id[2] = self.battler.equips[2]
  1544.          self.battler.old_equipment_id[3] = self.battler.equips[3]
  1545.          self.battler.old_equipment_id[4] = self.battler.equips[4]      
  1546.          return true
  1547.       end   
  1548.       return false
  1549.   end
  1550.  
  1551.   #--------------------------------------------------------------------------
  1552.   # ● Update Charge Button
  1553.   #--------------------------------------------------------------------------   
  1554.   def update_charge_button
  1555.       return unless can_charge_command?
  1556.       if Input.press?(ACTION_1_BUTTON) and ENABLE_ACTION_1_BUTTON
  1557.          update_charge_effect(0)
  1558.          reset_charge_temp if Input.press?(ACTION_2_BUTTON) and ENABLE_ACTION_2_BUTTON
  1559.       elsif Input.press?(ACTION_2_BUTTON)
  1560.          update_charge_effect(1)
  1561.          reset_charge_temp if Input.press?(ACTION_1_BUTTON)
  1562.       else
  1563.          if self.battler.x_charge_action[2] >= self.battler.x_charge_action[1]
  1564.             self.shoot(self.battler.x_charge_action[0])
  1565.          end
  1566.         reset_charge_temp
  1567.       end  
  1568.   end
  1569.  
  1570.   #--------------------------------------------------------------------------
  1571.   # ● Update Charge Effect
  1572.   #--------------------------------------------------------------------------        
  1573.   def update_charge_effect(type)
  1574.       if self.battler.x_charge_action[2] == 0
  1575.          return unless equipped_charge_action?(type)
  1576.       end  
  1577.       if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
  1578.          self.battler.x_charge_action[2] += 1
  1579.       end
  1580.       self.battler.x_charge_action[3] += 1
  1581.       if self.battler.x_charge_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
  1582.          self.battler.x_charge_action[3] = 0
  1583.          if self.battler.x_charge_action[2] < self.battler.x_charge_action[1]
  1584.             self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION1_ID
  1585.          else
  1586.             self.animation_id = XAS_ANIMATION::CHARGE_ANIMATION2_ID
  1587.          end  
  1588.       end
  1589.   end
  1590.  
  1591.   #--------------------------------------------------------------------------
  1592.   # ● Equipped Charge Action
  1593.   #--------------------------------------------------------------------------         
  1594.   def equipped_charge_action?(type)
  1595.       case type
  1596.          when 0
  1597.            weapon = self.battler.equips[0]
  1598.          when 1
  1599.            weapon = self.battler.equips[1]
  1600.       end
  1601.       if weapon == nil
  1602.          return false
  1603.          reset_charge_temp
  1604.       end
  1605.       if weapon.note =~ /<Charge Action = (\d+) - (\d+)>/   or
  1606.         weapon.note =~ /<蓄力技能 = (\d+) - (\d+)>/
  1607.          self.battler.x_charge_action[0] = $1.to_i rescue 0#Skill ID
  1608.          self.battler.x_charge_action[1] = $2.to_i rescue 0#Max Time
  1609.          self.battler.x_charge_action[2] = 0#Current Time
  1610.          self.battler.x_charge_action[3] = 0#Loop Anime Time
  1611.          return true
  1612.       end            
  1613.       return false   
  1614.       reset_charge_temp
  1615.   end
  1616.  
  1617.   #--------------------------------------------------------------------------
  1618.   # ● Update Combo Time
  1619.   #--------------------------------------------------------------------------        
  1620.   def update_combo_time
  1621.       return if self.battler.x_combo[2] == 0
  1622.       self.battler.x_combo[2] -= 1
  1623.       if self.battler.x_combo[2] == 0
  1624.          self.battler.x_combo[0] = 0
  1625.          self.battler.x_combo[1] = -1
  1626.       end   
  1627.   end  
  1628.  
  1629.   #--------------------------------------------------------------------------
  1630.   # ● Can Use Weapon Command?
  1631.   #--------------------------------------------------------------------------   
  1632.   def can_use_weapon_command?
  1633.       return false if $game_system.command_enable == false
  1634.       return false unless ENABLE_ACTION_1_BUTTON
  1635.       return false if self.battler.shield
  1636.       return false if self.battler.cast_action[4] > 0
  1637.       return false if self.battler.x_charge_action[2] > 0
  1638.       return true
  1639.   end
  1640.  
  1641.   #--------------------------------------------------------------------------
  1642.   # ● Can Use Shield Command?
  1643.   #--------------------------------------------------------------------------      
  1644.   def can_use_shield_command?
  1645.       return false if $game_system.command_enable == false
  1646.       return false unless ENABLE_ACTION_2_BUTTON
  1647.       return false if self.battler.equips[1] == nil
  1648.       return false if self.battler.equips[1].id == 0
  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 Skill Command?
  1656.   #--------------------------------------------------------------------------   
  1657.   def can_use_skill_command?
  1658.       return false if $game_system.command_enable == false
  1659.       return false unless ENABLE_SKILL_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 Use Item Command?
  1668.   #--------------------------------------------------------------------------   
  1669.   def can_use_item_command?
  1670.       return false if $game_system.command_enable == false
  1671.       return false unless ENABLE_ITEM_BUTTON
  1672.       return false if self.battler.shield   
  1673.       return false if self.battler.cast_action[4] > 0
  1674.       return false if self.battler.x_charge_action[2] > 0
  1675.       return true
  1676.   end      
  1677.  
  1678.   #--------------------------------------------------------------------------
  1679.   # ● Can Charge Command
  1680.   #--------------------------------------------------------------------------      
  1681.   def can_charge_command?
  1682.       return false if $game_system.command_enable == false
  1683.       return false if self.battler.cast_action[4] > 0
  1684.       return false if self.battler.shield      
  1685.       return true
  1686.   end   
  1687.  
  1688.   #--------------------------------------------------------------------------
  1689.   # ● Can Use Change Leader Command?
  1690.   #--------------------------------------------------------------------------      
  1691.   def can_use_change_leader_command?
  1692.       return false unless ENABLE_CHANGE_LEADER_BUTTON
  1693.       return false if self.battler.shield   
  1694.       return false if self.battler.cast_action[4] > 0
  1695.       return false if self.battler.x_charge_action[2] > 0
  1696.       return false if $game_temp.change_leader_wait_time > 0
  1697.       return true
  1698.   end
  1699.  
  1700.   #--------------------------------------------------------------------------
  1701.   # ● State_Seal Command
  1702.   #--------------------------------------------------------------------------        
  1703.   def state_seal_command?(type)
  1704.       seal = false
  1705.       case type  
  1706.          when 0
  1707.             seal = true if self.battler.state_mute
  1708.             seal = true if self.battler.state_seal_attack
  1709.          when 1
  1710.             seal = true if self.battler.state_mute
  1711.             seal = true if self.battler.state_seal_attack
  1712.          when 2
  1713.             seal = true if self.battler.state_mute
  1714.             seal = true if self.battler.state_seal_skill
  1715.          when 3  
  1716.             seal = true if self.battler.state_mute   
  1717.             seal = true if self.battler.state_seal_item
  1718.       end
  1719.       if seal
  1720.          seal_effect
  1721.          return true
  1722.       end  
  1723.       return false      
  1724.   end  
  1725.  
  1726.   #--------------------------------------------------------------------------
  1727.   # ● Check Equipped Action(修改BY W.S)
  1728.   #--------------------------------------------------------------------------   
  1729.   def check_equipped_action(command_type)
  1730.       case command_type
  1731.          when 0 # Weapon 1
  1732.             weapon = self.battler.equips[0]
  1733.             if weapon == nil
  1734.                self.battler.x_action1_id = 0
  1735.                return
  1736.              end
  1737.               if weapon.note =~ /<Action ID = (\d+)>/  
  1738.                weapon.note =~ /<Action ID = (\d+)>/
  1739.               elsif weapon.note =~ /<动作ID = (\d+)>/
  1740.                weapon.note =~ /<动作ID = (\d+)>/
  1741.               end
  1742.             action_id =  $1.to_i
  1743.             action_id = 0 if action_id == nil
  1744.             self.battler.x_action1_id = action_id
  1745.          when 1 # Weapon 2
  1746.             weapon = self.battler.equips[1]
  1747.             if weapon == nil
  1748.                self.battler.x_action2_id = 0
  1749.                return
  1750.              end   
  1751.               if weapon.note =~ /<Action ID = (\d+)>/  
  1752.                weapon.note =~ /<Action ID = (\d+)>/
  1753.               elsif weapon.note =~ /<动作ID = (\d+)>/
  1754.                weapon.note =~ /<动作ID = (\d+)>/
  1755.               end
  1756.             action_id =  $1.to_i
  1757.             action_id = 0 if action_id == nil            
  1758.             self.battler.x_action2_id = action_id
  1759.          when 2 # Skill   
  1760.  
  1761.          when 3 # Item
  1762.             item_id = $data_items[self.battler.item_id]
  1763.             if item_id == nil            
  1764.                self.battler.x_item_id =  0
  1765.                return
  1766.              end   
  1767.               if item_id.note =~ /<Action ID = (\d+)>/  
  1768.                item_id.note =~ /<Action ID = (\d+)>/
  1769.               elsif item_id.note =~ /<动作ID = (\d+)>/
  1770.                item_id.note =~ /<动作ID = (\d+)>/
  1771.               end
  1772.             action_id =  $1.to_i
  1773.             action_id = 0 if action_id == nil     
  1774.             self.battler.x_item_id = action_id
  1775.       end     
  1776.   end
  1777.  
  1778.   #--------------------------------------------------------------------------
  1779.   # ● Execute Combo
  1780.   #--------------------------------------------------------------------------        
  1781.   def execute_combo?(type)  
  1782.       if type == self.battler.x_combo[1] and self.battler.x_combo[0] != 0
  1783.          return if state_seal_command?(type)        
  1784.          self.shoot(self.battler.x_combo[0])
  1785.          self.battler.x_combo[1] = type
  1786.          return true
  1787.       end  
  1788.       self.battler.x_combo[0] = 0
  1789.       self.battler.x_combo[1] = type
  1790.       self.battler.x_combo[2] = 0
  1791.       return false
  1792.   end
  1793.  
  1794.   #--------------------------------------------------------------------------
  1795.   # ● Update Change Leader Button
  1796.   #--------------------------------------------------------------------------        
  1797.   def update_change_leader_button
  1798.       if Input.trigger?(CHANGE_LEADER_BUTTON)
  1799.          return unless can_use_change_leader_command?
  1800.          change_leader     
  1801.       end
  1802.   end
  1803.  
  1804.   #--------------------------------------------------------------------------
  1805.   # ● Update Action 1 Button
  1806.   #--------------------------------------------------------------------------      
  1807.   def update_action_1_button
  1808.       if Input.trigger?(ACTION_1_BUTTON)
  1809.          type = 0
  1810.          return unless can_use_weapon_command?
  1811.          return if execute_combo?(type)
  1812.          check_equipped_action(type)
  1813.          action_id = self.battler.x_action1_id
  1814.          return if action_id == 0
  1815.          return if state_seal_command?(type)
  1816.          self.shoot(action_id)
  1817.       end   
  1818.   end
  1819.  
  1820.   #--------------------------------------------------------------------------
  1821.   # ● Update Action 2 Button
  1822.   #--------------------------------------------------------------------------   
  1823.   def update_action_2_button
  1824.       if Input.trigger?(ACTION_2_BUTTON)
  1825.          if self.battler.equips[1].is_a?(RPG::Weapon)
  1826.             type = 1
  1827.             return unless can_use_weapon_command?
  1828.             return if execute_combo?(type)
  1829.             check_equipped_action(type)
  1830.             action_id = self.battler.x_action2_id
  1831.             return if action_id == 0
  1832.             return if state_seal_command?(type)            
  1833.             self.shoot(action_id)
  1834.             return
  1835.          end   
  1836.       end         
  1837.       update_shield_button
  1838.   end
  1839.  
  1840.   #--------------------------------------------------------------------------
  1841.   # ● Update Shield Button(修改BY W.S)
  1842.   #--------------------------------------------------------------------------        
  1843.   def update_shield_button
  1844.       if Input.press?(ACTION_2_BUTTON)
  1845.          if can_use_shield_command?
  1846.             unless self.battler.shield  
  1847.                 shield = self.battler.equips[1]
  1848.                 if shield.note =~ /<Action>/ or shield.note =~ /<动作>/
  1849.                    if shield.note =~ /<Pose = (\w+)>/ or shield.note =~ /<行走图 = (\w+)>/
  1850.                       make_pose($1.to_s, 2)
  1851.                    end
  1852.                 else   
  1853.                    self.battler.shield = false
  1854.                    return
  1855.                 end
  1856.             end
  1857.             self.x_pose_duration = 2
  1858.             self.battler.shield = true
  1859.             update_shield_diretion_button
  1860.          else
  1861.             self.battler.shield = false
  1862.          end  
  1863.       else   
  1864.          self.battler.shield = false
  1865.       end      
  1866.   end
  1867.  
  1868.   #--------------------------------------------------------------------------
  1869.   # ● update_shield_direction_button
  1870.   #--------------------------------------------------------------------------         
  1871.   def update_shield_diretion_button
  1872.       return if @direction_fix
  1873.       case Input.dir4
  1874.          when 2;  set_direction(2)   
  1875.          when 4;  set_direction(4)   
  1876.          when 6;  set_direction(6)   
  1877.          when 8;  set_direction(8)   
  1878.       end
  1879.   end
  1880.  
  1881.   #--------------------------------------------------------------------------
  1882.   # ● Update Skill Button
  1883.   #--------------------------------------------------------------------------      
  1884.   def update_skill_button
  1885.       if Input.trigger?(SKILL_BUTTON)
  1886.          type = 2
  1887.          return unless can_use_skill_command?
  1888.          return if execute_combo?(type)
  1889.          check_equipped_action(type)
  1890.          action_id = self.battler.skill_id
  1891.          return if action_id == 0
  1892.          return if state_seal_command?(type)         
  1893.          self.shoot(action_id)
  1894.       end   
  1895.   end
  1896.  
  1897.   #--------------------------------------------------------------------------
  1898.   # ● Update Item Button
  1899.   #--------------------------------------------------------------------------      
  1900.   def update_item_button
  1901.       if Input.trigger?(ITEM_BUTTON)
  1902.          type = 3         
  1903.          return unless can_use_item_command?
  1904.          return if execute_combo?(type)
  1905.          check_equipped_action(type)
  1906.          action_id = self.battler.x_item_id
  1907.          return if action_id == 0
  1908.          return if state_seal_command?(type)         
  1909.          self.shoot(action_id)
  1910.       end   
  1911.   end
  1912.  
  1913.   #--------------------------------------------------------------------------
  1914.   # ● Update Auto Target Shoot
  1915.   #--------------------------------------------------------------------------
  1916.   def update_auto_target_shoot
  1917.       return if $game_temp.xas_target_time == 0
  1918.       return if $game_temp.xas_target_shoot_id == 0
  1919.       return if $game_temp.xas_target_x == 0 and $game_temp.xas_target_y == 0   
  1920.       $game_temp.xas_target_time -= 1
  1921.       if $game_temp.xas_target_time == 0
  1922.          self.shoot($game_temp.xas_target_shoot_id)
  1923.          $game_temp.xas_target_shoot_id = 0
  1924.       end   
  1925.   end   
  1926.  
  1927. #--------------------------------------------------------------------------
  1928. # ● Dash?
  1929. #--------------------------------------------------------------------------            
  1930. alias x_dash dash?
  1931. def dash?   
  1932.      return false if XAS_SYSTEM::DASH_SYSTEM
  1933.      x_dash
  1934. end
  1935.  
  1936. #--------------------------------------------------------------------------
  1937. # ● Can Dash?
  1938. #--------------------------------------------------------------------------              
  1939. def can_dash?
  1940.      return false unless XAS_BUTTON::ENABLE_DASH_BUTTON
  1941.      return false if self.battler.shield
  1942.      return true if Input.press?(XAS_BUTTON::DASH_BUTTON)
  1943.      @dash_active = false
  1944.      return false
  1945. end
  1946.  
  1947. #--------------------------------------------------------------------------
  1948. # ● Update Dash Command
  1949. #--------------------------------------------------------------------------            
  1950. def update_dash_button
  1951.      return unless can_dash?
  1952.      @dash_active = true
  1953.      @anime_count -= 0.5 if moving?
  1954.      update_dash_sprite_name
  1955. end  
  1956.  
  1957. #--------------------------------------------------------------------------
  1958. # ● Update Dash Sprite Name
  1959. #--------------------------------------------------------------------------              
  1960. def update_dash_sprite_name
  1961.      make_pose("_Dash", 2)
  1962. end
  1963.  
  1964. end
  1965. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1966. #■ TOOL - INITIALIZE
  1967. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1968.  
  1969.  
  1970. #===============================================================================
  1971. # ■ Game_Map
  1972. #===============================================================================
  1973. class Game_Map
  1974.  
  1975.   attr_accessor :need_refresh_token
  1976.  
  1977.   #--------------------------------------------------------------------------
  1978.   # ● need_add_tokens
  1979.   #--------------------------------------------------------------------------  
  1980.   def need_add_tokens
  1981.       @need_add_tokens = [] if @need_add_tokens == nil
  1982.       return @need_add_tokens
  1983.   end
  1984.  
  1985.   #--------------------------------------------------------------------------
  1986.   # ● need_remove_tokens
  1987.   #--------------------------------------------------------------------------
  1988.   def need_remove_tokens
  1989.       @need_remove_tokens = [] if @need_remove_tokens == nil
  1990.       return @need_remove_tokens
  1991.   end
  1992.  
  1993.   #--------------------------------------------------------------------------
  1994.   # ● add_token
  1995.   #--------------------------------------------------------------------------
  1996.   def add_token(token_event)
  1997.       $game_temp.tool_event = [] if $game_temp.tool_event == nil
  1998.       $game_temp.tool_event.push(token_event)
  1999.       self.need_add_tokens.push(token_event)
  2000.       self.need_refresh_token = true
  2001.   end
  2002.  
  2003.   #--------------------------------------------------------------------------
  2004.   # ● remove_token
  2005.   #--------------------------------------------------------------------------
  2006.   def remove_token(token_event)
  2007.       @events.delete(token_event.id)
  2008.       self.need_remove_tokens.push(token_event)
  2009.       self.need_refresh_token = true
  2010.   end
  2011.  
  2012.   #--------------------------------------------------------------------------
  2013.   # ● clear_tokens
  2014.   #--------------------------------------------------------------------------
  2015.   def clear_tokens
  2016.       $game_system.tools_on_map.clear
  2017.       $game_system.tools_on_map = []
  2018.       for event in @events.values.dup
  2019.           remove_token(event) if event.is_a?(Token_Event)
  2020.       end
  2021.       channels = ["A", "B", "C", "D"]
  2022.       for id in 1001..(token_id_shift - 1)
  2023.           for a in channels
  2024.               key = [self.map_id, id, a]
  2025.               $game_self_switches.delete(key)
  2026.           end
  2027.       end
  2028.       clear_token_id
  2029.   end
  2030.  
  2031.   #--------------------------------------------------------------------------
  2032.   # ● Update
  2033.   #--------------------------------------------------------------------------      
  2034.   alias x_temp_tool_hash_update update
  2035.   def update(main = false)
  2036.       x_temp_tool_hash_update(main)
  2037.       update_add_tool_hash
  2038.   end
  2039.  
  2040.   #--------------------------------------------------------------------------
  2041.   # ● Update Add Toll Hash
  2042.   #--------------------------------------------------------------------------      
  2043.   def update_add_tool_hash  
  2044.       return if $game_temp.tool_event == nil
  2045.       for i in $game_temp.tool_event
  2046.           $game_map.events[i.id] = i
  2047.           execute_tool_effects_hash(i)
  2048.       end  
  2049.       $game_temp.tool_event.clear
  2050.       $game_temp.tool_event = nil
  2051.   end
  2052.  
  2053.   #--------------------------------------------------------------------------
  2054.   # ● Execute Toll Effects Hash
  2055.   #--------------------------------------------------------------------------        
  2056.   def execute_tool_effects_hash(i)
  2057.  
  2058.   end  
  2059. end
  2060.  
  2061. #===============================================================================
  2062. # ■ Game_SelfSwitches  
  2063. #===============================================================================
  2064. class Game_SelfSwitches
  2065.   def delete(key)
  2066.       @data.delete(key)
  2067.   end
  2068. end
  2069.  
  2070. #===============================================================================
  2071. # ■ Game_Map  
  2072. #===============================================================================
  2073. class Game_Map
  2074.  
  2075.   attr_accessor :token_id
  2076.  
  2077.   #--------------------------------------------------------------------------
  2078.   # ● token_id_shift
  2079.   #--------------------------------------------------------------------------  
  2080.   def token_id_shift
  2081.       @token_id  = 1000 if @token_id == nil
  2082.       @token_id += 1
  2083.       return @token_id
  2084.   end
  2085.  
  2086.   #--------------------------------------------------------------------------
  2087.   # ● clear_token_id
  2088.   #--------------------------------------------------------------------------  
  2089.   def clear_token_id
  2090.       @token_id = nil
  2091.   end
  2092. end
  2093.  
  2094. #===============================================================================
  2095. # ■ XRXS_CTS_RefreshToken
  2096. #===============================================================================
  2097. module XRXS_CTS_RefreshToken
  2098.  
  2099.   #--------------------------------------------------------------------------
  2100.   # ● refresh_token
  2101.   #--------------------------------------------------------------------------  
  2102.   def refresh_token
  2103.       for event in $game_map.need_add_tokens
  2104.           @character_sprites.push(Sprite_Character.new(@viewport1, event))
  2105.       end
  2106.       $game_map.need_add_tokens.clear
  2107.       for sprite in @character_sprites.dup
  2108.           if $game_map.need_remove_tokens.empty?
  2109.              break
  2110.           end
  2111.           if $game_map.need_remove_tokens.delete(sprite.character)
  2112.              @character_sprites.delete(sprite)
  2113.              sprite.dispose
  2114.           end
  2115.       end
  2116.       $game_map.need_refresh_token = false
  2117.   end
  2118. end
  2119.  
  2120. #===============================================================================
  2121. # ■  Spriteset_Map
  2122. #===============================================================================
  2123. class Spriteset_Map
  2124.   include XRXS_CTS_RefreshToken
  2125.  
  2126.   #--------------------------------------------------------------------------
  2127.   # ● Initialize
  2128.   #--------------------------------------------------------------------------   
  2129.   alias x_smap_initialize initialize
  2130.   def initialize
  2131.       setup_start
  2132.       x_smap_initialize
  2133.   end
  2134.  
  2135.   #--------------------------------------------------------------------------
  2136.   # ● Setup Start
  2137.   #--------------------------------------------------------------------------      
  2138.   def setup_start
  2139.       $game_player.reset_old_level(true)
  2140.   end
  2141.  
  2142. end
  2143.  
  2144. #===============================================================================
  2145. # ■ Game_Player
  2146. #===============================================================================
  2147. class Game_Player < Game_Character
  2148.  
  2149.   #--------------------------------------------------------------------------
  2150.   # ● x_reserve_transfer
  2151.   #--------------------------------------------------------------------------     
  2152.   alias x_reserve_transfer reserve_transfer
  2153.   def reserve_transfer(map_id, x, y, direction)
  2154.       $game_map.clear_tokens
  2155.       if $game_temp.tool_event != nil
  2156.          $game_temp.tool_event.clear
  2157.          $game_temp.tool_event = nil
  2158.       end   
  2159.       x_reserve_transfer(map_id, x, y, direction)
  2160.   end
  2161.  
  2162. end
  2163.  
  2164. #===============================================================================
  2165. # ■ Token_Event
  2166. #===============================================================================
  2167. class Token_Event < Game_Event
  2168.  
  2169.   #--------------------------------------------------------------------------
  2170.   # ● Token_Event
  2171.   #--------------------------------------------------------------------------
  2172.   def initialize(map_id, event)
  2173.       event.id = $game_map.token_id_shift
  2174.       super
  2175.   end
  2176.  
  2177.   #--------------------------------------------------------------------------
  2178.   # ● erase
  2179.   #--------------------------------------------------------------------------
  2180.   def erase
  2181.       super
  2182.       $game_map.remove_token(self)
  2183.   end
  2184. end
  2185.  
  2186.  
  2187. #===============================================================================
  2188. # ■  XRXS_ActionTemplate
  2189. #===============================================================================
  2190. module XRXS_ActionTemplate
  2191.   map_id = XAS_SYSTEM::ACTION_TEMPLATE_MAP_ID
  2192.   map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  2193.   @@events = map.events
  2194. end
  2195.  
  2196. #===============================================================================
  2197. # ■  Token_Event
  2198. #===============================================================================
  2199. class Token_Event < Game_Event
  2200.   include XRXS_ActionTemplate
  2201. end
  2202.  
  2203. #===============================================================================
  2204. # ■  Game_Temp
  2205. #===============================================================================
  2206. class Game_Temp
  2207.   attr_accessor :active_token
  2208. end
  2209. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2210. #■ TOOL - SHOOT COMMAND
  2211. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2212.  
  2213.  
  2214. #===============================================================================
  2215. # ■ XAS ACTION
  2216. #===============================================================================
  2217. module XAS_ACTION
  2218.   attr_reader   :action
  2219.   attr_reader   :erased
  2220.  
  2221.   #--------------------------------------------------------------------------
  2222.   # ● shoot
  2223.   #--------------------------------------------------------------------------
  2224.   def shoot(action_id = 0)
  2225.       return if action_id == 0
  2226.       skill = $data_skills[action_id]
  2227.       return unless can_shoot?(skill)
  2228.       execute_user_effects(skill)
  2229.       execute_call_event(action_id)      
  2230.       self.action_attachment(action_id)
  2231.       execute_set_pose(action_id)
  2232.   end
  2233.  
  2234.   #--------------------------------------------------------------------------
  2235.   # ● Can Shoot
  2236.   #--------------------------------------------------------------------------   
  2237.   def can_shoot?(skill)
  2238.       if self.battler == nil and self.tool_id > 0
  2239.          @battler = self.action.user.battler
  2240.       end  
  2241.       return false if self.battler == nil
  2242.       return false if skill == nil
  2243.       return true if ignore_can_shoot?(skill)
  2244.       enough_cost = true
  2245.       return false if tools_on_map?(skill.id)      
  2246.       if self.battler.state_mute  
  2247.          seal_effect
  2248.          return false
  2249.       end   
  2250.       if self.battler.cast_action[4].between?(1,self.battler.cast_action[1] -1)
  2251.          return false
  2252.       end
  2253.       return false if check_cast_action?(skill)
  2254.       return false if check_auto_target_select?(skill)
  2255.       unless enough_skill_cost?(skill)
  2256.          Audio.se_play("Audio/SE/" + XAS_SOUND::ACTION_COST , 100, 100)
  2257.          return false
  2258.       end
  2259.       return true
  2260.   end
  2261.  
  2262.   #--------------------------------------------------------------------------
  2263.   # ● Ignore Can Shoot?     
  2264.   #--------------------------------------------------------------------------               
  2265.   def ignore_can_shoot?(skill)
  2266.       return false
  2267.   end
  2268.  
  2269.   #--------------------------------------------------------------------------
  2270.   # ● Tools on Map
  2271.   #--------------------------------------------------------------------------              
  2272.   def tools_on_map?(skill_id)
  2273.       return true if $game_system.tools_on_map.include?(skill_id)
  2274.       return false
  2275.   end  
  2276.  
  2277.   #--------------------------------------------------------------------------
  2278.   # ● Check Cast Action (修改BY W.S)
  2279.   #--------------------------------------------------------------------------            
  2280.   def check_cast_action?(skill)
  2281.       if self.battler.cast_action[0] != 0
  2282.          self.battler.cast_action[0] = 0
  2283.          self.battler.cast_action[1] = 0
  2284.          self.battler.cast_action[2] = 0
  2285.          self.battler.cast_action[3] = 0
  2286.          self.battler.cast_action[4] = 0
  2287.          return false
  2288.       end  
  2289.       if (skill.note =~ /<Cast Time = (\d+)>/ or skill.note =~ /<吟唱时间 = (\d+)>/) and
  2290.          $game_temp.xas_target_shoot_id == 0 and
  2291.          self.force_action_times == 0
  2292.          self.battler.cast_action[0] = skill.id
  2293.          self.battler.cast_action[1] = $1.to_i rescue 0
  2294.          self.battler.cast_action[2] = XAS_ANIMATION::CAST_TIME_ANIMATION_ID
  2295.          self.battler.cast_action[3] = 0
  2296.          self.battler.cast_action[4] = 0
  2297.          self.animation_id = self.battler.cast_action[2]
  2298.          return true
  2299.       end      
  2300.       return false
  2301.   end
  2302.  
  2303.   #--------------------------------------------------------------------------
  2304.   # ● Check Auto Target Select(修改BY W.S)
  2305.   #--------------------------------------------------------------------------         
  2306.   def check_auto_target_select?(skill)
  2307.       return false if self.is_a?(Game_Event)
  2308.       if skill.note =~ /<Auto Target>/ or skill.note =~ /<瞄准>/
  2309.          if $game_temp.xas_target_shoot_id == 0
  2310.             $game_temp.xas_target_shoot_id = skill.id
  2311.             $game_map.check_events_on_screen
  2312.             SceneManager.call(Scene_Target_Select)
  2313.             return true
  2314.          end         
  2315.       end  
  2316.       return false
  2317.   end
  2318.  
  2319.   #--------------------------------------------------------------------------
  2320.   # ● enough_skill_cost?
  2321.   #--------------------------------------------------------------------------         
  2322.   def enough_skill_cost?(skill)
  2323.       return false unless enough_mp_cost?(skill)         
  2324.       return false unless enough_item_cost?(skill)      
  2325.       return true
  2326.   end
  2327.  
  2328.   #--------------------------------------------------------------------------
  2329.   # ● Enough MP Cost
  2330.   #--------------------------------------------------------------------------        
  2331.   def enough_mp_cost?(skill)  
  2332.       if @force_action_times > 0
  2333.          return true if @force_action == "All Shoot"
  2334.          return true if @force_action == "Four Shoot"  
  2335.          return true if @force_action == "Three Shoot"
  2336.          return true if @force_action == "Two Shoot"
  2337.       end
  2338.       if self.battler.mp < skill.mp_cost
  2339.          self.battler.damage = XAS_WORD::NO_MP
  2340.          self.battler.damage_pop = true
  2341.          return false
  2342.       else   
  2343.          self.battler.mp -= skill.mp_cost
  2344.          return true
  2345.       end
  2346.       return true
  2347.   end  
  2348.  
  2349.   #--------------------------------------------------------------------------
  2350.   # ● Enough MP Cost
  2351.   #--------------------------------------------------------------------------      
  2352.   def enough_item_cost?(skill)
  2353.       return true if self.battler.is_a?(Game_Enemy)
  2354.       if @force_action_times > 0
  2355.          return true if @force_action == "All Shoot"
  2356.          return true if @force_action == "Four Shoot"
  2357.          return true if @force_action == "Three Shoot"
  2358.          return true if @force_action == "Two Shoot"
  2359.        end      
  2360.         if skill.note =~ /<Item Cost = (\d+)>/
  2361.           skill.note =~ /<Item Cost = (\d+)>/
  2362.           elsif skill.note =~ /<道具消耗 = (\d+)>/
  2363.           skill.note =~ /<道具消耗 = (\d+)>/
  2364.           end
  2365.       item_id = $1.to_i
  2366.       if item_id != nil and item_id != 0
  2367.          item_cost = $data_items[item_id]
  2368.          number = $game_party.item_number(item_cost)
  2369.          if number == 0 or number == nil
  2370.             self.battler.damage = XAS_WORD::NO_ITEM
  2371.             self.battler.damage_pop = true
  2372.             return false
  2373.          else
  2374.             $game_party.lose_item(item_cost, 1, false)
  2375.             return true
  2376.          end            
  2377.       end   
  2378.       return true
  2379.   end   
  2380.  
  2381.   #--------------------------------------------------------------------------
  2382.   # ● Execute User Effects
  2383.   #--------------------------------------------------------------------------  
  2384.   def execute_user_effects(skill)
  2385.       self.battler.shield = false
  2386.       #Animation
  2387.       if skill.note =~ /<Cast Ani = (\d+)>/ or skill.note =~ /<吟唱动画 = (\d+)>/
  2388.          ani_id = $1.to_i     
  2389.          if ani_id != nil
  2390.             self.animation_id = ani_id
  2391.          end   
  2392.       end
  2393.       unless @force_action_times > 0
  2394.           #All Directions
  2395.           if skill.note =~ /<All Directions>/ or skill.note =~ /<八方射击>/
  2396.              @force_action = "All Shoot"
  2397.              @force_action_times = 8        
  2398.           elsif skill.note =~ /<Four Directions>/ or skill.note =~ /<四方射击>/
  2399.              @force_action = "Four Shoot"
  2400.              @force_action_times = 4      
  2401.           elsif skill.note =~ /<Three Directions>/ or skill.note =~ /<三向射击>/
  2402.              @force_action = "Three Shoot"
  2403.              @force_action_times = 3        
  2404.           elsif skill.note =~ /<Two Directions>/ or skill.note =~ /<前后射击>/
  2405.              @force_action = "Two Shoot"
  2406.              @force_action_times = 2         
  2407.           end  
  2408.       end  
  2409.   end
  2410.  
  2411.   #--------------------------------------------------------------------------
  2412.   # ● Execute Set Pose
  2413.   #--------------------------------------------------------------------------      
  2414.   def execute_set_pose(action_id)
  2415.       @action.duration = @action.sunflag
  2416.       make_pose(@action.self_motion, @action.sunflag )
  2417.       @pattern = 0
  2418.       @pattern_count  = 0
  2419.       @step_anime = true
  2420.       @self_motion = nil      
  2421.       self.need_refresh = true if self.is_a?(Game_Player)
  2422.   end  
  2423.  
  2424.   #--------------------------------------------------------------------------
  2425.   # ● execute_call_event
  2426.   #--------------------------------------------------------------------------  
  2427.   def execute_call_event(action_id)
  2428.       bullet_token = Token_Bullet.new(self, action_id)
  2429.       $game_map.add_token(bullet_token)
  2430.       return bullet_token
  2431.   end
  2432.  
  2433.   #--------------------------------------------------------------------------
  2434.   # ● action_attachment
  2435.   #--------------------------------------------------------------------------
  2436.   def action_attachment(action_id)
  2437.       @action = Game_Action_XAS.new(self, action_id)
  2438.       @action.attachment(action_id)
  2439.   end
  2440.  
  2441. end
  2442. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2443. #■ TOOL - SHOOT SETTING
  2444. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2445.  
  2446.  
  2447. #===============================================================================
  2448. # ■ Game_Action_XAS
  2449. #===============================================================================
  2450. class Game_Action_XAS
  2451.  
  2452.   attr_accessor   :user
  2453.   attr_accessor   :id                    
  2454.   attr_accessor   :attack_id            
  2455.   attr_accessor   :attack_range
  2456.   attr_accessor   :attack_range_type
  2457.   attr_accessor   :hit_events
  2458.   attr_accessor   :now_count
  2459.   attr_accessor   :pre_now_count
  2460.   attr_accessor   :duration
  2461.   attr_accessor   :blow_power
  2462.   attr_accessor   :piercing
  2463.   attr_accessor   :ignore_knockback_invincible
  2464.   attr_accessor   :target_invunerable_duration
  2465.   attr_accessor   :multi_hit
  2466.   attr_accessor   :ally_damage
  2467.   attr_accessor   :all_damage
  2468.   attr_accessor   :sunflag
  2469.   attr_accessor   :self_motion
  2470.   attr_accessor   :second_animation_id
  2471.   attr_accessor   :third_animation_id
  2472.   attr_accessor   :attack_range_type
  2473.   attr_accessor   :attack_range_plan
  2474.   attr_accessor   :blow_power
  2475.   attr_accessor   :ignore_guard
  2476.   attr_accessor   :user_invincible  
  2477.   attr_accessor   :short_range
  2478.   attr_accessor   :first_impact_time
  2479.   attr_accessor   :animation_time
  2480.   attr_accessor   :duration
  2481.   attr_accessor   :item_cost
  2482.   attr_accessor   :hit_shake
  2483.   attr_accessor   :hit_hold_target
  2484.   attr_accessor   :hit_bounce
  2485.   attr_accessor   :sticky
  2486.   attr_accessor   :reflectable
  2487.   attr_accessor   :can_reflect
  2488.   attr_accessor   :attack_id_plan
  2489.   attr_accessor   :hit_action
  2490.   attr_accessor   :fake_id
  2491.   attr_accessor   :impact
  2492.  
  2493.   #--------------------------------------------------------------------------
  2494.   # ● initialize
  2495.   #--------------------------------------------------------------------------
  2496.   def initialize(user, action_id)
  2497.       @user        = user
  2498.       @id          = action_id
  2499.       @now_count   = 0
  2500.       @duration    = nil
  2501.       @attack_id   = 0
  2502.       @attack_range = 0
  2503.       @hit_events  = []
  2504.       @blow_power  = 0
  2505.       @skill = $data_skills[action_id]
  2506.       @ignore_knockback_invincible = false
  2507.       @multi_hit = false
  2508.       @piercing = false
  2509.       @all_damage = false
  2510.       @ally_damage = false
  2511.       @ignore_guard = false
  2512.       @sunflag = 10
  2513.       @duration = 10
  2514.       @self_motion = ""
  2515.       @attack_range_type = 1
  2516.       @attack_range_plan = 1
  2517.       @blow_power = 1
  2518.       @first_impact_time  = 0
  2519.       @animation_time = []
  2520.       @target_invunerable_duration = 10
  2521.       @second_animation_id = 0
  2522.       @third_animation_id = 0
  2523.       @user_invincible = false
  2524.       @short_range = false
  2525.       @item_cost = 0
  2526.       @hit_shake = false
  2527.       @hit_hold_target = false
  2528.       @hit_bounce = false
  2529.       @sticky = false
  2530.       @reflectable = false
  2531.       @can_reflect = false
  2532.       @hit_action = 0
  2533.       @fake_id = false
  2534.       @impact = true
  2535.   end
  2536.  
  2537.   #--------------------------------------------------------------------------
  2538.   # ● attachment (修改 BY W.S)
  2539.   #--------------------------------------------------------------------------
  2540.   def attachment(action_id)
  2541.       @attack_id_plan = [action_id]
  2542.       if @skill.note =~ /<Sunflag = (\d+)>/ or /<动作时间 = (\d+)>/
  2543.          @sunflag = $1.to_i
  2544.       end
  2545.       if @skill.note =~ /<Duration = (\d+)>/ or  @skill.note =~ /<存在时间 = (\d+)>/
  2546.          @duration = $1.to_i
  2547.       end
  2548.       if @skill.note =~ /<Pose = (\S+)>/ or @skill.note =~ /<行走图 = (\S+)>/
  2549.          @self_motion = $1.to_s
  2550.       end
  2551.       if @skill.note =~ /<Area = (\w+)>/
  2552.          case $1
  2553.             when "CROSS"   
  2554.                area = 7
  2555.             when "WALL"
  2556.                area = 6        
  2557.             when "FRONTRHOMBUS"  
  2558.                area = 5
  2559.             when "FRONTSQUARE"
  2560.                area = 4
  2561.             when "LINE"
  2562.                area = 3
  2563.             when "SQUARE"
  2564.                area = 2               
  2565.             else   
  2566.                area = 1
  2567.              end   
  2568.       elsif @skill.note =~ /<区域 = (\w+)>/
  2569.          case $1
  2570.             when "十字"   
  2571.                area = 7
  2572.             when "墙"
  2573.                area = 6        
  2574.             when "半菱形"  
  2575.                area = 5
  2576.             when "半矩形"
  2577.                area = 4
  2578.             when "直线"
  2579.                area = 3
  2580.             when "矩形"
  2581.                area = 2               
  2582.             else   
  2583.                area = 1
  2584.          end     
  2585.          @attack_range_type = area
  2586.        end
  2587.       if @skill.note =~ /<Range = (\d+)>/ or  @skill.note =~ /<范围 = (\d+)>/
  2588.          @attack_range_plan = [$1.to_i]
  2589.       end
  2590.       if @skill.note =~ /<Blow Power = (\d+)>/  or @skill.note =~ /<击退格数 = (\d+)>/
  2591.          @blow_power = $1.to_i
  2592.       end   
  2593.       if @skill.note =~ /<Impact Time =  (\d+)>/ or   @skill.note =~ /影响时间  = (\d+)>/  
  2594.          @first_impact_time = $1.to_i
  2595.  
  2596.        end   
  2597.       if @skill.note =~ /<Animation Time  = (\d+) - (\d+)>/ or @skill.note =~ /<动画时间  = (\d+) - (\d+)>/
  2598.          @animation_time[0] = $1.to_i
  2599.          @animation_time[1] = $2.to_i
  2600.       end
  2601.       if @skill.note =~ /<Target Invunerable = (\d+)>/ or @skill.note =~ /<伤害间隔 = (\d+)>/
  2602.          @target_invunerable_duration = $1.to_i
  2603.       end  
  2604.       if @skill.note =~ /<Tool Hit Ani = (\d+)>/ or @skill.note =~ /<击中动画 = (\d+)>/      
  2605.          @second_animation_id = $1.to_i
  2606.       end         
  2607.       if @skill.note =~ /<User Hit Ani = (\d+)>/ or @skill.note =~ /<使用动画 = (\d+)>/      
  2608.          @third_animation_id = $1.to_i
  2609.       end   
  2610.       if @skill.note =~ /<Item Cost = (\d+)>/  or   @skill.note =~ /<消耗道具 = (\d+)>/
  2611.          @item_cost = $1.to_i
  2612.       end         
  2613.       if @skill.note =~ /<Link Action ID = (\d+)>/  or @skill.note =~ /<连接技能ID = (\d+)>/
  2614.          if user.battler != nil
  2615.             user.battler.x_combo[0] = $1.to_i
  2616.             user.battler.x_combo[2] = @sunflag + 20
  2617.          end
  2618.       else     
  2619.          if user.battler != nil
  2620.             user.battler.x_combo[0] = 0
  2621.             user.battler.x_combo[1] = 0
  2622.             user.battler.x_combo[2] = 0
  2623.          end            
  2624.       end   
  2625.       if @skill.note =~ /<Hit Action ID = (\d+)>/ or @skill.note =~ /<攻击动作ID = (\d+)>/
  2626.          @hit_action = $1.to_i
  2627.       end
  2628.       if @skill.note =~ /<Ignore Knockback>/ or @skill.note =~ /<忽略击倒>/ or @skill.note =~ /<忽略击破>/
  2629.          @ignore_knockback_invincible = true
  2630.       end      
  2631.       if @skill.note =~ /<Multi Hit>/ or @skill.note =~ /<多次连击>/
  2632.          @multi_hit = true  
  2633.       end         
  2634.       if @skill.note =~ /<Piercing>/
  2635.          @piercing = true
  2636.       end
  2637.       if @skill.note =~ /<All Damage>/ or @skill.note =~ /<全域化>/
  2638.          @all_damage = true
  2639.       end
  2640.       if @skill.note =~ /<Ally Damage>/ or @skill.note =~ /<己方伤害>/
  2641.          @ally_damage = true
  2642.       end      
  2643.       if @skill.note =~ /<User Invincible>/ or @skill.note =~ /<使用者无敌>/
  2644.          @user_invincible = true
  2645.       end      
  2646.       if @skill.note =~ /<Ignore Guard>/ or @skill.note =~ /<忽略防御>/
  2647.          @ignore_guard = true
  2648.       end      
  2649.       if @skill.note =~ /<One Action>/ or @skill.note =~ /<等待结束>/ or @skill.note =~ /<等待完成>/
  2650.          unless $game_system.tools_on_map.include?(action_id)   
  2651.                 $game_system.tools_on_map.push(action_id)
  2652.          end
  2653.       end      
  2654.       if @skill.note =~ /<Shake>/ or @skill.note =~ /<震动>/ or @skill.note =~ /<地震>/
  2655.          @hit_shake = true
  2656.       end
  2657.       if @skill.note =~ /<User Range>/ or @skill.note =~ /<使用者属性>/
  2658.          @short_range = true
  2659.       end      
  2660.       if @skill.note =~ /<Hit Hold Target>/ or @skill.note =~ /<按键持续>/
  2661.          @hit_hold_target = true
  2662.       end        
  2663.       if @skill.note =~ /<Hit Sticky Target>/ or @skill.note =~ /<追踪>/
  2664.          @sticky = true
  2665.       end        
  2666.       if @skill.note =~ /<Hit Bounce Direction>/ or @skill.note =~ /<击中转向>/
  2667.          @hit_bounce = true
  2668.       end   
  2669.       if @skill.note =~ /<Reflectable>/ or @skill.note =~ /<允许反射>/
  2670.          @reflectable = true
  2671.       end        
  2672.       if @skill.note =~ /<Can Reflect>/ or @skill.note =~ /<允许反击>/
  2673.          @can_reflect = true
  2674.       end  
  2675.       if @skill.note =~ /<Disable Hit>/ or @skill.note =~ /<不计入连击>/
  2676.          @impact = false
  2677.       end
  2678.       @sunflag = 1 if @sunflag <= 0
  2679.   end
  2680.  
  2681.   #--------------------------------------------------------------------------
  2682.   # ● update
  2683.   #--------------------------------------------------------------------------
  2684.   def update
  2685.       @first_impact_time -= 1 if @first_impact_time > 0
  2686.       if @attack_id_plan != nil
  2687.          id = @attack_id_plan[@now_count]
  2688.          unless id.nil?
  2689.            @attack_id = id
  2690.            @hit_events.clear
  2691.            @hit_events.push(self.user) unless @all_damage or @ally_damage
  2692.          end
  2693.       end
  2694.       if @attack_range_plan != nil
  2695.          range = @attack_range_plan[@now_count]
  2696.          @attack_range = range unless range.nil?
  2697.       end
  2698.       @now_count += 1
  2699.   end  
  2700.  
  2701.   #--------------------------------------------------------------------------
  2702.   # ● done?
  2703.   #--------------------------------------------------------------------------
  2704.   def done?
  2705.       return (self.duration.to_i > 0 and self.now_count >= self.duration)
  2706.   end
  2707. end
  2708.  
  2709. #===============================================================================
  2710. # ■ Token_Bullet  
  2711. #===============================================================================
  2712. class Token_Bullet < Token_Event
  2713. include XRXS_ActionTemplate
  2714.   #--------------------------------------------------------------------------
  2715.   # ● initialize
  2716.   #--------------------------------------------------------------------------
  2717.   def initialize(user, action_id)
  2718.       event_id = action_id
  2719.       skill = $data_skills[action_id]
  2720.       if skill.note =~ /<Event ID = (\d+)>/ or skill.note =~ /<事件ID = (\d+)>/
  2721.          event_id = $1.to_i
  2722.       end  
  2723.       original_event = @@events[event_id]
  2724.       if original_event == nil
  2725.          msgbox("这里没有 对应的事件 ID " + event_id.to_s + " 在 Tool Map中!")
  2726.          SceneManager.exit
  2727.          return
  2728.       end  
  2729.       event = original_event.dup
  2730.       event.x = user.x
  2731.       event.y = user.y
  2732.       pre_direction = event.pages[0].graphic.direction
  2733.       event.pages[0].graphic.direction = user.direction
  2734.       @character_name = event.pages[0].graphic
  2735.       super($game_map.map_id, event)
  2736.       self.action_attachment(action_id)
  2737.       self.tool_id = action_id
  2738.       self.diagonal = false
  2739.       self.diagonal_direction = 0
  2740.       self.sprite_angle_enable = false
  2741.       @action.user = user
  2742.       @remain_for_an_act = @action.duration.is_a?(Numeric)
  2743.       check_tool_effects(user,skill,pre_direction)
  2744.   end
  2745.  
  2746.   #--------------------------------------------------------------------------
  2747.   # ● update
  2748.   #--------------------------------------------------------------------------
  2749.   def update
  2750.       super
  2751.       if @action == nil and @remain_for_an_act
  2752.          erase
  2753.          $game_system.tools_on_map.delete(self.tool_id)
  2754.       end
  2755.       check_event_trigger_attack
  2756.   end
  2757. end
  2758.  
  2759. #===============================================================================
  2760. # ■ Game Player
  2761. #===============================================================================
  2762. class Game_Player < Game_Character
  2763.   attr_accessor :need_refresh
  2764. end
  2765.  
  2766. #===============================================================================
  2767. # ■ Token_Bullet  
  2768. #===============================================================================
  2769. class Token_Bullet < Token_Event
  2770.  
  2771.   #--------------------------------------------------------------------------
  2772.   # ● Check Tool Effects
  2773.   #--------------------------------------------------------------------------
  2774.   def check_tool_effects(user,skill,pre_direction)
  2775.       if @action.ally_damage or @action.all_damage   
  2776.          user.battler.invunerable_duration = 0
  2777.       end
  2778.      # Force Update Out Screen
  2779.      if user.battler.sensor_range >= 15 or
  2780.         skill.note =~ /<Update Out Screen>/ or skill.note =~ /<屏幕外刷新>/
  2781.         self.force_update = true
  2782.      end  
  2783.      #Diagonal Effect
  2784.      if skill.note =~ /<Diagonal>/ or skill.note =~ /<斜角>/ or
  2785.         skill.note =~ /<All Direction>/ or skill.note =~ /<八方射击>/ or
  2786.         skill.note =~ /<Three Direction>/ or skill.note =~ /<三向射击>/
  2787.         self.diagonal = true
  2788.         self.diagonal_direction = user.diagonal_direction
  2789.         self.sprite_angle_enable = true
  2790.         user.diagonal_time = XAS_BA::DIAGONAL_DURATION if user.diagonal_direction != 0
  2791.         user.diagonal = true if user.tool_id > 0        
  2792.      end
  2793.      #Auto Target
  2794.      if skill.note =~ /<Auto Target>/ or skill.note =~ /<瞄准>/
  2795.         if user.is_a?(Game_Event)
  2796.            self.moveto($game_player.x, $game_player.y)
  2797.         else  
  2798.            moveto($game_temp.xas_target_x, $game_temp.xas_target_y)
  2799.            $game_temp.xas_target_x = 0
  2800.            $game_temp.xas_target_y = 0      
  2801.            $game_temp.xas_target_time = 0
  2802.            $game_temp.xas_target_shoot_id = 0
  2803.         end   
  2804.      end
  2805.      #Barrier
  2806.      if skill.note =~ /<Barrier>/ or skill.note =~ /<跟随>/
  2807.         self.tool_effect = "Barrier"
  2808.      end
  2809.      #Boomerang
  2810.      if skill.note =~ /<Boomerang = (\d+)>/ or skill.note =~ /<回旋镖 = (\d+)>/
  2811.         self.tool_effect = "Boomerang"
  2812.         self.action.duration = 1000
  2813.         self.diagonal = true
  2814.         self.diagonal_direction = user.diagonal_direction
  2815.         self.force_update = true
  2816.         @move_frequency = 6
  2817.         @move_speed = 5
  2818.         @direction_fix = false
  2819.         @walk_anime = true
  2820.         @step_anime = true
  2821.         @force_action = "Forward"
  2822.         @force_action_times = $1.to_i
  2823.      end     
  2824.  
  2825.    end
  2826. end
  2827. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2828. #■ TOOL - AREA
  2829. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2830.  
  2831.  
  2832. #===============================================================================
  2833. # ■ XAS ACTION
  2834. #===============================================================================
  2835. module XAS_ACTION
  2836.  
  2837.   #--------------------------------------------------------------------------
  2838.   # ● action_update
  2839.   #--------------------------------------------------------------------------
  2840.   def action_update
  2841.       return unless @action.is_a?(Game_Action_XAS)
  2842.       if @action.animation_time != [] and
  2843.          @action.animation_time[0] == @action.now_count
  2844.          animation_id = @action.animation_time[1]
  2845.          unless self.is_a?(Game_Player) or self.tool_id == 0
  2846.              self.animation_id = animation_id
  2847.          end
  2848.       end
  2849.       @action.update
  2850.   end
  2851.  
  2852.   #--------------------------------------------------------------------------
  2853.   # ● Can Impact Target
  2854.   #--------------------------------------------------------------------------  
  2855.   def can_impact_target?
  2856.       return false if @action.nil?
  2857.       return false if @action.attack_id == 0
  2858.       return false if @action.first_impact_time > 0
  2859.       return false if @action.impact == false
  2860.       return false if self.jumping?
  2861.       return true
  2862.   end  
  2863.  
  2864.   #--------------------------------------------------------------------------
  2865.   # ● check_event_trigger_attack
  2866.   #--------------------------------------------------------------------------
  2867.   def check_event_trigger_attack()
  2868.       return unless can_impact_target?
  2869.       hit_check = false
  2870.       range = @action.attack_range
  2871.       hit = []
  2872.       targets = [$game_player] + $game_map.events.values
  2873.       for event in targets
  2874.         next if event == self or
  2875.                 @action.hit_events.include?(event) or event.erased
  2876.         body_size      = event.body_size
  2877.         event_center_x = event.x
  2878.         event_center_y = event.y - body_size
  2879.         if @action.short_range
  2880.            dx = event_center_x - $game_player.x
  2881.            dy = event_center_y - $game_player.y
  2882.         else
  2883.            dx = event_center_x - self.x
  2884.            dy = event_center_y - self.y
  2885.          end
  2886.         dx = (dx >= 0 ? [dx - body_size, 0].max : [dx + body_size, 0].min)
  2887.         dy = (dy >= 0 ? [dy - body_size, 0].max : [dy + body_size, 0].min)
  2888.         hit_check = true if in_range?(dx,dy,event,range)
  2889.         hit.push(event) if hit_check
  2890.         hit_check = false
  2891.       end
  2892.       for event in hit
  2893.           if event.action_effect(self, self.action.attack_id)
  2894.              hit_check = true
  2895.           end
  2896.           if event.action_effect_page(self, self.action.attack_id)
  2897.              hit_check = true
  2898.          end         
  2899.          @action.hit_events.push(event) unless @action.multi_hit
  2900.          end
  2901.       if hit_check
  2902.          $game_temp.active_token = self
  2903.       end
  2904.   end
  2905.  
  2906.   #--------------------------------------------------------------------------
  2907.   # ● In Range?
  2908.   #--------------------------------------------------------------------------  
  2909.   def in_range?(dx,dy,event,range)
  2910.       case @action.attack_range_type
  2911.             when 1 #RHOMBUS
  2912.               return true if (dx.abs + dy.abs <= range)
  2913.             when 2 #SQUARE
  2914.               return true if (dx.abs <= range and dy.abs <= range)
  2915.             when 3 #LINE
  2916.               case self.direction
  2917.                   when 2
  2918.                     return true if (dx == 0 and dy >= 0 and dy <= range)
  2919.                   when 8
  2920.                     return true if (dx == 0 and dy <= 0 and dy >= -range)
  2921.                   when 6
  2922.                     return true if (dy == 0 and dx >= 0 and dx <= range)
  2923.                   when 4
  2924.                     return true if (dy == 0 and dx <= 0 and dx >= -range)
  2925.               end
  2926.             when 4  #FRONT SQUARE   
  2927.               case self.direction
  2928.                  when 2
  2929.                     return true if (dx.abs <= range and dy >= 0 and dy.abs <= range)
  2930.                  when 4
  2931.                     return true if (dx.abs <= range and dx <= 0 and dy.abs <= range)  
  2932.                  when 6
  2933.                     return true if (dx.abs <= range and dx >= 0 and dy.abs <= range)
  2934.                  when 8
  2935.                     return true if (dx.abs <= range and dy <= 0 and dy.abs <= range)
  2936.               end              
  2937.             when 5  #FRONT RHOMBUS     
  2938.               case self.direction
  2939.                   when 2
  2940.                     return true if (dx.abs + dy.abs <= range and dy >= 0)
  2941.                   when 8
  2942.                     return true if (dx.abs + dy.abs <= range and dy <= 0)
  2943.                   when 6
  2944.                     return true if (dx.abs + dy.abs <= range and dx >= 0)
  2945.                   when 4
  2946.                     return true if (dx.abs + dy.abs <= range and dx <= 0)
  2947.               end         
  2948.             when 6  #WALL
  2949.               case self.direction
  2950.                  when 2
  2951.                     return true if (dx.abs <= range and dy == 0 )
  2952.                  when 4
  2953.                     return true if (dy.abs <= range and dx == 0)  
  2954.                  when 6
  2955.                     return true if (dy.abs <= range and dx == 0)
  2956.                  when 8
  2957.                     return true if (dx.abs <= range and dy == 0)
  2958.                end  
  2959.             when 7 #CROSS
  2960.                  return true if (dx.abs <= range and dy == 0)
  2961.                  return true if (dy.abs <= range and dx == 0)  
  2962.             end
  2963.      return false      
  2964.   end      
  2965.  
  2966.   #--------------------------------------------------------------------------
  2967.   # ●  action_effect Page
  2968.   #--------------------------------------------------------------------------
  2969.   def action_effect_page(attacker, attack_id)
  2970.       return false unless self.is_a?(Game_Event)
  2971.       return false if attacker.action.fake_id
  2972.       if attacker.action != nil
  2973.          check_auto_effect_page(attacker, attack_id)
  2974.          check_reflectable_skills(attacker, attack_id)
  2975.       end
  2976.       for page in @event.pages
  2977.           if page.condition.variable_valid and
  2978.              page.condition.variable_id == XAS_SYSTEM::HIT_ID and
  2979.              page.condition.variable_value == attack_id
  2980.              self.reaction_valid_attack_id = attack_id
  2981.              self.refresh
  2982.              @trigger = 0
  2983.              self.start
  2984.              return true
  2985.           end
  2986.       end
  2987.       return false
  2988.   end
  2989.  
  2990.   #--------------------------------------------------------------------------
  2991.   # ● Check Reflectable Skills
  2992.   #--------------------------------------------------------------------------   
  2993.   def check_reflectable_skills(attacker, attack_id)
  2994.       return if self.tool_id == 0
  2995.       return unless self.action.reflectable
  2996.       return unless attacker.action.can_reflect
  2997.       self.action.user = attacker.action.user
  2998.       self.action.hit_events = []  
  2999.       self.turn_back
  3000.   end  
  3001.  
  3002.   #--------------------------------------------------------------------------
  3003.   # ● Check Auto Effect Page
  3004.   #--------------------------------------------------------------------------  
  3005.   def check_auto_effect_page(attacker, attack_id)
  3006.       if self.treasure_time > 0
  3007.          if can_hit_take_treasure?(attacker, attack_id)
  3008.             execute_take_treasure(attacker, attack_id)
  3009.          elsif self.temp_id == 0 and can_hold_treasure?(attacker, attack_id)   
  3010.             execute_hold_treasure(attacker, attack_id)
  3011.          end  
  3012.       end
  3013.   end
  3014.  
  3015.   #--------------------------------------------------------------------------
  3016.   # ● Can Hit Take Treasure
  3017.   #--------------------------------------------------------------------------      
  3018.   def can_hit_take_treasure?(attacker, attack_id)
  3019.       return true if attacker.action.short_range
  3020.       return false
  3021.   end
  3022.  
  3023.   #--------------------------------------------------------------------------
  3024.   # ● Can Hold Treasure?
  3025.   #--------------------------------------------------------------------------        
  3026.   def can_hold_treasure?(attacker, attack_id)
  3027.       return true if attacker.tool_effect == "Boomerang"   
  3028.       return false
  3029.   end  
  3030.  
  3031.   #--------------------------------------------------------------------------
  3032.   # ● Execute Hold Treasure
  3033.   #--------------------------------------------------------------------------      
  3034.   def execute_hold_treasure(attacker, attack_id)
  3035.       tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
  3036.       return if self.treasure_time > tr_time
  3037.       self.temp_id = attacker.id   
  3038.   end  
  3039.  
  3040.   #--------------------------------------------------------------------------
  3041.   # ● Execute Take Treasure
  3042.   #--------------------------------------------------------------------------      
  3043.   def execute_take_treasure(attacker, attack_id)
  3044.       tr_time = (100 + XAS_BA::TREASURE_ERASE_TIME * 60) - 20
  3045.       return if self.treasure_time > tr_time
  3046.       self.x = $game_player.x
  3047.       self.y = $game_player.y
  3048.   end
  3049.  
  3050.   #--------------------------------------------------------------------------
  3051.   # ● body_size
  3052.   #--------------------------------------------------------------------------
  3053.   def body_size
  3054.       return 0
  3055.   end
  3056.  
  3057.   #--------------------------------------------------------------------------
  3058.   # ● action_clear
  3059.   #--------------------------------------------------------------------------
  3060.   def action_clear
  3061.       @action = nil
  3062.       @step_anime = false
  3063.   end
  3064. end
  3065.  
  3066. #===============================================================================
  3067. # ■ Game_Character
  3068. #===============================================================================
  3069. class Game_Character < Game_CharacterBase
  3070.     include XAS_ACTION
  3071. end
  3072.  
  3073. #===============================================================================
  3074. # ■  Game_Event
  3075. #===============================================================================
  3076. class Game_Event < Game_Character
  3077.  
  3078.   #--------------------------------------------------------------------------
  3079.   # * Refresh
  3080.   #--------------------------------------------------------------------------
  3081.   alias x_conditions_met conditions_met?
  3082.   def conditions_met?(page)
  3083.       c = page.condition
  3084.       if c.variable_valid
  3085.          if c.variable_id == XAS_SYSTEM::HIT_ID and
  3086.             c.variable_value == self.reaction_valid_attack_id
  3087.             return true
  3088.          end
  3089.        end
  3090.       x_conditions_met(page)
  3091.   end
  3092.  
  3093. end  
  3094.  
  3095. #===============================================================================
  3096. # ■  XAS_Dispose
  3097. #===============================================================================
  3098. module XAS_Dispose
  3099.  
  3100.   #--------------------------------------------------------------------------
  3101.   # ● update
  3102.   #--------------------------------------------------------------------------  
  3103.   def update
  3104.       action_update
  3105.       super
  3106.       if @action.is_a?(Game_Action_XAS) and @action.done?
  3107.          self.action_clear
  3108.       end
  3109.   end
  3110. end
  3111.  
  3112. #===============================================================================
  3113. # ■  Game_Player
  3114. #===============================================================================
  3115. class Game_Player < Game_Character
  3116.   include XAS_Dispose
  3117. end
  3118.  
  3119. #===============================================================================
  3120. # ■  Game_Event
  3121. #===============================================================================
  3122. class Game_Event < Game_Character
  3123.   include XAS_Dispose
  3124. end
  3125.  
  3126. #===============================================================================
  3127. # ■ XAS_StopToAction
  3128. #===============================================================================
  3129. module XAS_StopToAction
  3130.  
  3131.   #--------------------------------------------------------------------------
  3132.   # ● acting?
  3133.   #--------------------------------------------------------------------------  
  3134.   def acting?
  3135.       return false if self.battler == nil
  3136.       return true if self.battler.shield
  3137.       return true if self.action != nil
  3138.       return false
  3139.   end
  3140.  
  3141.   #--------------------------------------------------------------------------
  3142.   # ● moving?
  3143.   #--------------------------------------------------------------------------  
  3144.   def moving?
  3145.       return (super or self.acting? or self.stop)
  3146.   end
  3147.  
  3148. end
  3149.  
  3150. #===============================================================================
  3151. # ■ Game_Player  
  3152. #===============================================================================
  3153. class Game_Player < Game_Character
  3154.   include XAS_StopToAction
  3155. end
  3156.  
  3157. #===============================================================================
  3158. # ■ Game_Event  
  3159. #===============================================================================
  3160. class Game_Event < Game_Character
  3161.   attr_accessor :reaction_valid_attack_id
  3162. end
  3163. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3164. #■ TOOL - HIT EFFECT
  3165. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3166.  
  3167.  
  3168. #===============================================================================
  3169. # ■ XRXS_BattlerAttachment
  3170. #==============================================================================
  3171. module XRXS_BattlerAttachment
  3172.  
  3173.   #--------------------------------------------------------------------------
  3174.   # ● Can Hit Base?
  3175.   #--------------------------------------------------------------------------   
  3176.   def can_hit_base?(bullet, action_id)
  3177.       return false unless $game_system.xas_battle
  3178.       return false if self.battler == nil
  3179.       return false if bullet == nil
  3180.       return false if action_id == nil or action_id <= 0
  3181.       return false if self.can_update == false
  3182.       return true
  3183.   end  
  3184.  
  3185.   #--------------------------------------------------------------------------
  3186.   # ● Action Effect
  3187.   #--------------------------------------------------------------------------  
  3188.   def action_effect(bullet, action_id)
  3189.       return unless can_hit_base?(bullet, action_id)
  3190.       skill = $data_skills[action_id]
  3191.       user = bullet.action.user
  3192.       attacker = (user == nil ? nil : user.battler)     
  3193.       tar_invu = bullet.action.target_invunerable_duration
  3194.       #CAN HIT?
  3195.       return unless action_can_hit_target?(bullet, user, skill,tar_invu)
  3196.       #REFLECT STATE
  3197.       return if reflect_state?(bullet, skill)
  3198.       #SHIELD
  3199.       if target_shield_enabled?(attacker, skill, bullet)
  3200.          execute_guard_effect(user, skill, bullet, tar_invu)
  3201.          return
  3202.       end
  3203.       #INVUNERABLE ACTIONS
  3204.       if target_invunerable_actions?(user, skill, bullet)
  3205.          execute_guard_effect(user, skill, bullet, tar_invu, false)
  3206.          return
  3207.       end   
  3208.       #GUARD DIRECTIONS
  3209.       if target_guard_directions?(user, skill, bullet)
  3210.          execute_guard_effect(user, skill, bullet, tar_invu)
  3211.          return        
  3212.       end  
  3213.       execute_hit_effect(attacker,skill, bullet , user, tar_invu )
  3214.       if self.is_a?(Game_Player)
  3215.          self.need_refresh = true
  3216.       end
  3217.   end
  3218.  
  3219.   #--------------------------------------------------------------------------
  3220.   # ● Reflect State?
  3221.   #--------------------------------------------------------------------------                 
  3222.   def reflect_state?(bullet, skill)
  3223.       if  bullet.action.reflectable and self.battler.state_reflect
  3224.           if skill.note =~ /<Auto Target>/ or skill.note =~ /<瞄准>/
  3225.              bullet.moveto(bullet.action.user.x,bullet.action.user.y)
  3226.           else   
  3227.              bullet.turn_back
  3228.           end  
  3229.           bullet.action.user = self
  3230.           bullet.action.hit_events = []           
  3231.           bullet.turn_back
  3232. #          bullet.jump(0,0)
  3233.           bullet.turn_back
  3234.           self.battler.damage = XAS_WORD::REFLECT
  3235.           self.battler.damage_pop = true
  3236.           self.animation_id = XAS_ANIMATION::REFLECT_ANIMATION_ID
  3237.           self.battler.invunerable_duration = 20
  3238.          return true
  3239.      end
  3240.      return false     
  3241.   end
  3242.  
  3243. #--------------------------------------------------------------------------
  3244. # ● Target Guard Directions?
  3245. #--------------------------------------------------------------------------   
  3246. def target_guard_directions?(user, skill, bullet)
  3247.      return false if self.battler.guard == false
  3248.      return false if bullet.action.ignore_guard
  3249.      if self.battler.guard_directions.include?(2) and
  3250.         ((self.direction == 2 and bullet.direction == 8) or
  3251.          (self.direction == 8 and bullet.direction == 2) or
  3252.          (self.direction == 6 and bullet.direction == 4) or
  3253.          (self.direction == 4 and bullet.direction == 6))
  3254.          return true
  3255.      elsif self.battler.guard_directions.include?(8) and
  3256.         ((self.direction == 8 and bullet.direction == 8) or
  3257.          (self.direction == 2 and bullet.direction == 2) or
  3258.          (self.direction == 6 and bullet.direction == 6) or
  3259.          (self.direction == 4 and bullet.direction == 4))
  3260.          return true
  3261.      elsif self.battler.guard_directions.include?(4) and
  3262.         ((self.direction == 2 and bullet.direction == 4) or
  3263.          (self.direction == 8 and bullet.direction == 6) or
  3264.          (self.direction == 6 and bullet.direction == 2) or
  3265.          (self.direction == 4 and bullet.direction == 8))
  3266.          return true         
  3267.      elsif self.battler.guard_directions.include?(6) and
  3268.         ((self.direction == 2 and bullet.direction == 6) or
  3269.          (self.direction == 8 and bullet.direction == 4) or
  3270.          (self.direction == 6 and bullet.direction == 8) or
  3271.          (self.direction == 4 and bullet.direction == 2))
  3272.          return true
  3273.      end      
  3274.      return false
  3275.   end
  3276.  
  3277.   #--------------------------------------------------------------------------
  3278.   # ● Target Invunerable Actions?
  3279.   #--------------------------------------------------------------------------            
  3280.   def target_invunerable_actions?(user, skill, bullet)
  3281.       return true if self.battler.invunerable_actions.include?(skill.id)
  3282.       return false
  3283.   end
  3284.  
  3285.   #--------------------------------------------------------------------------
  3286.   # ● Shoot Target Shield
  3287.   #--------------------------------------------------------------------------         
  3288.   def shoot_target_shield?(bullet,user, skill)
  3289.       return false unless self.battler.shield
  3290.       return false if bullet.action.ignore_guard
  3291.       return true if face_direction?(bullet)
  3292.       return false
  3293.   end
  3294.  
  3295.   #--------------------------------------------------------------------------
  3296.   # ● Action can hit target?
  3297.   #--------------------------------------------------------------------------        
  3298.   def action_can_hit_target?(bullet, user, skill,tar_invu)
  3299.       if user == nil
  3300.          return false
  3301.       end   
  3302.       if self.battler.invunerable
  3303.          return false
  3304.       end  
  3305.       if self.battler.dead?
  3306.          return false
  3307.       end   
  3308.       if self.battler.invunerable_duration > 0
  3309.          return false
  3310.       end   
  3311.       if @knock_back_duration != nil
  3312.          return false unless bullet.action.ignore_knockback_invincible
  3313.       end
  3314.       if bullet.action.first_impact_time > 0
  3315.          return false
  3316.       end
  3317.       if self.action != nil and self.action.user_invincible
  3318.          unless self.action.ally_damage and bullet.action.user == self.action.user
  3319.              return false
  3320.          end
  3321.       end  
  3322.       unless bullet.action.all_damage
  3323.              if bullet.action.ally_damage
  3324.                 if user.battler.is_a?(Game_Actor)
  3325.                    return false if self.battler.is_a?(Game_Enemy)
  3326.                 elsif user.battler.is_a?(Game_Enemy)
  3327.                    return false if self.battler.is_a?(Game_Actor)
  3328.                 end
  3329.              else   
  3330.                 if user.battler.is_a?(Game_Actor)
  3331.                    return false if self.battler.is_a?(Game_Actor)
  3332.                 elsif user.battler.is_a?(Game_Enemy)
  3333.                    return false if self.battler.is_a?(Game_Enemy)
  3334.                 end                 
  3335.              end              
  3336.       end
  3337.       return false if target_state_invunerable?(tar_invu)
  3338.       #return false if target_reflect_action?(bullet, user)
  3339.       return true
  3340.   end
  3341.  
  3342.   #--------------------------------------------------------------------------
  3343.   # ● Target Relfect Action
  3344.   #--------------------------------------------------------------------------         
  3345.   def target_reflect_action?(bullet, user)
  3346.       return false unless bullet.action.reflectable
  3347.       for i in $game_map.events.values
  3348.           if i.tool_id > 0 and i.action.can_reflect and
  3349.              i.tool_effect == "Barrier"# and i.action.user.battler.is_a?(self.battler)
  3350.              bullet.action.user = self
  3351.              bullet.action.hit_events = []  
  3352.              bullet.turn_back
  3353.              return true
  3354.              break
  3355.           end   
  3356.       end
  3357.       return false  
  3358.   end
  3359.  
  3360.   #--------------------------------------------------------------------------
  3361.   # ● Target State Invunerable
  3362.   #--------------------------------------------------------------------------        
  3363.   def target_state_invunerable?(tar_invu)
  3364.       if self.battler.state_invunerable
  3365.          self.battler.damage = XAS_WORD::INVINCIBLE
  3366.          self.battler.damage_pop = true
  3367.          self.animation_id = XAS_ANIMATION::INVINCIBLE_ANIMATION_ID
  3368.          self.battler.invunerable_duration = tar_invu
  3369.          return true
  3370.       end
  3371.       return false
  3372.   end
  3373.  
  3374.   #--------------------------------------------------------------------------
  3375.   # ● Execute Hit Effect
  3376.   #--------------------------------------------------------------------------      
  3377.   def execute_hit_effect(attacker,skill, bullet , user, tar_invu)
  3378.       shoot_effect_before_damage(skill, bullet, user)
  3379.       execute_battler_skill_effect(attacker ,skill, user)
  3380.       if target_missed?(attacker)
  3381.          self.battler.invunerable_duration = 30
  3382.          return
  3383.       end            
  3384.       execute_damage_pop(attacker,skill)
  3385.       shoot_effect_after_damage(skill, bullet, user) if can_damage_after_effect?
  3386.       execute_state_effect(skill, user,  bullet)   
  3387.       bullet.action.duration = 1 if remove_tool_after_hit?(skill, bullet, user)
  3388.       self.battler.invunerable_duration = tar_invu
  3389.       execute_blow_effect(skill,bullet) if can_blow_effect?
  3390.       execute_animation(skill, bullet, user)
  3391.       execute_tool_effects(skill, bullet , user)
  3392.   end
  3393.  
  3394.   #--------------------------------------------------------------------------
  3395.   # ● Execute Tool Effects
  3396.   #--------------------------------------------------------------------------              
  3397.   def execute_tool_effects(skill, bullet , user)
  3398.       execute_sticky_effect(skill, bullet, user)
  3399.       execute_bounce_effect(skill, bullet, user)
  3400.       execute_hit_action_effect(skill, bullet, user)
  3401.   end
  3402.  
  3403.   #--------------------------------------------------------------------------
  3404.   # ● Remove Tool After Hit?
  3405.   #--------------------------------------------------------------------------            
  3406.   def remove_tool_after_hit?(skill, bullet, user)
  3407.       return true if bullet.action.piercing == false
  3408.       return false
  3409.   end  
  3410.  
  3411.   #--------------------------------------------------------------------------
  3412.   # ● Execute Battler Skill Effect
  3413.   #--------------------------------------------------------------------------         
  3414.   def execute_battler_skill_effect(attacker ,skill, user)
  3415.       self.battler.item_apply(attacker, skill)
  3416.   end
  3417.  
  3418.   #--------------------------------------------------------------------------
  3419.   # ● Target Missed?
  3420.   #--------------------------------------------------------------------------        
  3421.   def target_missed?(attacker)
  3422.       if self.battler.result.missed
  3423.          self.battler.damage = XAS_WORD::MISSED
  3424.          self.battler.damage_pop = true         
  3425.          return true
  3426.       end   
  3427.       if self.battler.result.evaded
  3428.          self.battler.damage = XAS_WORD::EVADED
  3429.          self.battler.damage_pop = true            
  3430.          return true
  3431.       end  
  3432.       return false
  3433.   end  
  3434.   #--------------------------------------------------------------------------
  3435.   # ● Shoot Effect Before Damage
  3436.   #--------------------------------------------------------------------------        
  3437.   def shoot_effect_before_damage(skill, bullet, user)
  3438.   end
  3439.  
  3440.   #--------------------------------------------------------------------------
  3441.   # ● Shoot Effect After Damage
  3442.   #--------------------------------------------------------------------------         
  3443.   def shoot_effect_after_damage(skill, bullet, user)
  3444.       check_counter_attack(skill)
  3445.       self.battler.passive = false
  3446.   end
  3447.  
  3448.   #--------------------------------------------------------------------------
  3449.   # ● Shoot Effect After Damage
  3450.   #--------------------------------------------------------------------------            
  3451.   def check_counter_attack(skill)
  3452.       return if self.battler.is_a?(Game_Actor)
  3453.       return if self.battler.counter_action[2] == false
  3454.       return if self.battler.counter_action[1] > 0
  3455.       counter = XAS_BA_ENEMY::COUNTER_ATTACK[self.battler.enemy_id]
  3456.       if counter != nil
  3457.          counter_action_id = counter[rand(counter.size)]
  3458.          self.battler.counter_action[0] = counter_action_id
  3459.          self.battler.counter_action[1] = 15
  3460.       end  
  3461.   end  
  3462.  
  3463.   #--------------------------------------------------------------------------
  3464.   # ● Execute Bounce Effect
  3465.   #--------------------------------------------------------------------------            
  3466.   def execute_bounce_effect(skill, bullet, user)
  3467.       return false if bullet.action.hit_bounce == false
  3468.       bullet.bounce_direction
  3469.   end
  3470.  
  3471.   #--------------------------------------------------------------------------
  3472.   # ● Execute Stick Effect
  3473.   #--------------------------------------------------------------------------           
  3474.   def execute_sticky_effect(skill, bullet, user)
  3475.       return unless bullet.action.sticky
  3476.       return if bullet.temp_id !=  0
  3477.       bullet.pre_move_speed = bullet.move_speed
  3478.       bullet.temp_id = self.id
  3479.   end
  3480.  
  3481.   #--------------------------------------------------------------------------
  3482.   # ● Execute Hit Action Effect
  3483.   #--------------------------------------------------------------------------            
  3484.   def execute_hit_action_effect(skill, bullet, user)
  3485.       return if bullet.action.hit_action == 0
  3486.       self.battler.invunerable_duration = 1
  3487.       bullet.shoot(bullet.action.hit_action)
  3488.       bullet.action.duration = 9
  3489.       bullet.action.multi_hit = false
  3490.       bullet.character_name = ""
  3491.       bullet.x_pose_duration = 0
  3492.       bullet.x_pose_name = ""
  3493.       bullet.x_pose_original_name = ""      
  3494.   end
  3495.  
  3496.   #--------------------------------------------------------------------------
  3497.   # ● Can Damage Effect
  3498.   #--------------------------------------------------------------------------         
  3499.   def can_damage_after_effect?
  3500.       return false if self.battler.damage == nil
  3501.       return false unless self.battler.damage.is_a?(Numeric)
  3502.       return true
  3503.   end  
  3504.  
  3505.   #--------------------------------------------------------------------------
  3506.   # ● Execute State Effect
  3507.   #--------------------------------------------------------------------------        
  3508.   def execute_state_effect(skill, user,  bullet)   
  3509.       if user.battler.states.size != 0
  3510.          for i in user.battler.states
  3511.              execute_state_effect_user(skill, user, bullet,i)
  3512.          end   
  3513.       end
  3514.       if self.battler.states.size != 0
  3515.          for i in self.battler.states
  3516.              execute_state_effect_target(skill, user, bullet,i)
  3517.          end   
  3518.       end
  3519.   end
  3520.  
  3521.   #--------------------------------------------------------------------------
  3522.   # ● Execute State Effect User
  3523.   #--------------------------------------------------------------------------         
  3524.   def execute_state_effect_user(skill, user, bullet,i)
  3525.  
  3526.   end
  3527.  
  3528.   #--------------------------------------------------------------------------
  3529.   # ● Execute State Target
  3530.   #--------------------------------------------------------------------------         
  3531.   def execute_state_effect_target(skill, user, bullet,i)
  3532.       #Sleep
  3533.       if self.battler.damage.is_a?(Numeric) and self.battler.damage > 0
  3534.          if i.note =~ /<Sleep>/ or  i.note =~ /<睡眠>/
  3535.             self.battler.remove_state(i.id)
  3536.          end
  3537.       end   
  3538.   end  
  3539.  
  3540.   #--------------------------------------------------------------------------
  3541.   # ● Execute Blow Effect
  3542.   #--------------------------------------------------------------------------      
  3543.   def execute_blow_effect(skill,bullet)
  3544.       if bullet.action.hit_hold_target and self.temp_id == 0     
  3545.          self.temp_id = bullet.id
  3546.          self.pre_move_speed = self.move_speed         
  3547.          self.moveto(bullet.x, bullet.y)
  3548.       end   
  3549.       $game_map.screen.start_shake(5, 5, 60) if bullet.action.hit_shake
  3550.       p = bullet.action.blow_power.to_i  
  3551.       d = bullet.direction   
  3552.       return if self.battler.damage.to_i <= 0
  3553.       return if p < 0
  3554.       self.blow(d, p)  
  3555.   end
  3556.  
  3557.   #--------------------------------------------------------------------------
  3558.   # ● Execute Animation
  3559.   #--------------------------------------------------------------------------        
  3560.   def execute_animation(skill, bullet, user)   
  3561.       self.animation_id = skill.animation_id
  3562.       tool_animation = bullet.action.second_animation_id
  3563.       user_animation = bullet.action.third_animation_id
  3564.       bullet.animation_id = tool_animation if tool_animation != 0
  3565.       user.animation_id = user_animation if user_animation != 0
  3566.   end  
  3567.  
  3568.   #--------------------------------------------------------------------------
  3569.   # ● Knock Back Disable
  3570.   #--------------------------------------------------------------------------      
  3571.   def knock_back_disable
  3572.     return false
  3573.   end
  3574.  
  3575.   #--------------------------------------------------------------------------
  3576.   # ● Dead?
  3577.   #--------------------------------------------------------------------------         
  3578.   def dead?
  3579.     return self.battler == nil ? false : self.battler.dead?
  3580.   end
  3581.  
  3582. end
  3583.  
  3584.  
  3585. #===============================================================================
  3586. # ■ XRXS_BattlerAttachment
  3587. #==============================================================================
  3588. module XRXS_BattlerAttachment
  3589.  
  3590.   #--------------------------------------------------------------------------
  3591.   # ● Shoot Target Shield
  3592.   #--------------------------------------------------------------------------         
  3593.   def target_shield_enabled?(attacker, skill, bullet)
  3594.       return false unless self.battler.shield
  3595.       if bullet != nil
  3596.          return false if bullet.action.ignore_guard
  3597.          return true if face_direction?(bullet)         
  3598.       else   
  3599.          return false if attacker.battler.ignore_guard
  3600.          return true if face_direction?(attacker)         
  3601.       end  
  3602.       return false
  3603.   end  
  3604.  
  3605.   #--------------------------------------------------------------------------
  3606.   # ● Can Blow Effect
  3607.   #--------------------------------------------------------------------------        
  3608.   def can_blow_effect?
  3609.       return false if self.battler.no_knockback
  3610.       return false if $game_map.interpreter.running?
  3611.       return true
  3612.   end  
  3613.  
  3614. #--------------------------------------------------------------------------
  3615. # ● Execute Guard Effect
  3616. #--------------------------------------------------------------------------      
  3617. def execute_guard_effect(attacker, skill, bullet, inv, erase_bullet = true)
  3618.      self.battler.invunerable_duration = inv
  3619.      damage_pop(XAS_WORD::GUARD)
  3620.      guard_animation_id = XAS_ANIMATION::GUARD_ANIMATION_ID
  3621.      self.animation_id = guard_animation_id if guard_animation_id != 0   
  3622.      if bullet != nil
  3623.         bullet.erase if erase_bullet
  3624.      else   
  3625.         blow_reverse(attacker) unless attacker.battler.no_knockback
  3626.      end   
  3627. end
  3628.  
  3629. #--------------------------------------------------------------------------
  3630. # ● Blow Reverse
  3631. #--------------------------------------------------------------------------      
  3632. def blow_reverse(attacker)
  3633.      return if attacker.battler.no_knockback
  3634.      case attacker.direction
  3635.         when 2
  3636.            d = 8
  3637.         when 4
  3638.            d = 6
  3639.         when 6
  3640.            d = 4
  3641.         when 8  
  3642.            d = 2
  3643.      end
  3644.      attacker.jump(0,0)   
  3645.      attacker.blow(d,1)
  3646. end
  3647.  
  3648. #--------------------------------------------------------------------------
  3649. # ● Can Attack Effect
  3650. #--------------------------------------------------------------------------      
  3651. def damage_pop(text)
  3652.      return unless XAS_WORD::ENABLE_WORD
  3653.      self.battler.damage = text
  3654.      self.battler.damage_pop = true
  3655. end
  3656.  
  3657. #--------------------------------------------------------------------------
  3658. # ● Shd Direction?
  3659. #--------------------------------------------------------------------------      
  3660. def face_direction?(attacker)
  3661.      target = self.direction  
  3662.      case target
  3663.           when 2
  3664.              return true if attacker.direction == 8
  3665.           when 4
  3666.              return true if attacker.direction == 6
  3667.           when 6
  3668.              return true if attacker.direction == 4
  3669.           when 8  
  3670.              return true if attacker.direction == 2     
  3671.      end
  3672.      return false
  3673. end   
  3674.  
  3675. #--------------------------------------------------------------------------
  3676. # ● Execute Damage Pop
  3677. #--------------------------------------------------------------------------      
  3678. def execute_damage_pop(attacker,skill = nil)
  3679.      if skill != nil
  3680.         return  if  skill.note =~ /<伤害隐藏>/
  3681.         if skill.damage.to_mp?
  3682.            dam = self.battler.result.mp_damage
  3683.            self.battler.damage_type = "Mp"      
  3684.         elsif skill.damage.to_hp?
  3685.            dam = self.battler.result.hp_damage
  3686.            self.battler.damage_type = "Critical"  if self.battler.result.critical
  3687.         end   
  3688.         if dam != nil
  3689.            if skill.damage.drain? or skill.damage.drain?
  3690.               attacker.damage = -dam
  3691.               attacker.damage_type = self.battler.damage_type
  3692.               attacker.damage_pop = true
  3693.            end  
  3694.            self.battler.damage = dam
  3695.            self.battler.damage_pop = true
  3696.         end
  3697.      else
  3698.         if self.battler.result.hp_damage != nil
  3699.            self.battler.damage = self.battler.result.hp_damage
  3700.            self.battler.damage_type = "Critical" if self.battler.result.critical   
  3701.            self.battler.damage_pop = true      
  3702.         end   
  3703.      end  
  3704. end  
  3705.  
  3706. end
  3707. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3708. #■ TOOL - EQUIP
  3709. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3710.  
  3711.  
  3712. #==============================================================================
  3713. # ■ Window Skill List
  3714. #==============================================================================
  3715. class Window_SkillList < Window_Selectable
  3716.  
  3717.   #--------------------------------------------------------------------------
  3718.   # ● Process OK
  3719.   #--------------------------------------------------------------------------                  
  3720.   alias x_skill_process_ok process_ok
  3721.   def process_ok
  3722.       return if can_equip_skill_action?
  3723.       x_skill_process_ok
  3724.   end
  3725.  
  3726.   #--------------------------------------------------------------------------
  3727.   # ● Can Equip Skill Action
  3728.   #--------------------------------------------------------------------------                     
  3729.   def can_equip_skill_action?
  3730.       return false if $game_party.in_battle
  3731.       skill = @data[index]
  3732.       if skill != nil and ( skill.note =~ /<Duration = (\d+)>/ or skill.note =~ /<存在时间 = (\d+)>/)
  3733.          @actor.skill_id = skill.id
  3734.          Sound.play_equip
  3735.          return true         
  3736.       end
  3737.       return false
  3738.   end
  3739.  
  3740. end
  3741.  
  3742. #==============================================================================
  3743. # ■ Window Item List
  3744. #==============================================================================
  3745. class Window_ItemList < Window_Selectable
  3746.  
  3747.   #--------------------------------------------------------------------------
  3748.   # ● Process OK
  3749.   #--------------------------------------------------------------------------                  
  3750.   alias x_item_process_ok process_ok
  3751.   def process_ok
  3752.       return if can_equip_item_action?
  3753.       x_item_process_ok
  3754.   end
  3755.  
  3756.   #--------------------------------------------------------------------------
  3757.   # ● Can Equip Item Action
  3758.   #--------------------------------------------------------------------------                     
  3759.   def can_equip_item_action?
  3760.       return false if $game_party.in_battle
  3761.       item = @data[index]
  3762.       if item != nil and item.is_a?(RPG::Item) and
  3763.         (item.note =~ /<Action ID = (\d+)>/ or item.note =~ /<动作ID = (\d+)>/)
  3764.          actor = $game_party.members[0]
  3765.          actor.item_id = item.id
  3766.          Sound.play_equip
  3767.          return true         
  3768.       end
  3769.       return false
  3770.   end
  3771.  
  3772. end
  3773.  
  3774.  
  3775.  
  3776. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3777. #■ BATTLER - INITIALIZE
  3778. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3779.  
  3780.  
  3781. #===============================================================================
  3782. # ■ Game Character
  3783. #==============================================================================
  3784. class Game_Character < Game_CharacterBase
  3785.  
  3786.   #--------------------------------------------------------------------------
  3787.   # ● Update Battler
  3788.   #--------------------------------------------------------------------------      
  3789.   def update_battler
  3790.       update_battler_pose
  3791.       update_battler_parameters
  3792.       update_battler_stop_movement
  3793.       update_battler_knockbacking
  3794.       update_battler_counter_action
  3795.       unless self.battler.hp == 0
  3796.           update_battler_cast_action   
  3797.           update_battler_move_speed if can_update_battler_move_speed?
  3798.           update_battler_states_effect
  3799.           update_battler_attacking
  3800.       else
  3801.           update_battler_defeat_process
  3802.       end
  3803.   end  
  3804.  
  3805. end
  3806.  
  3807. #===============================================================================
  3808. # ■ Game Player
  3809. #===============================================================================
  3810. class Game_Player < Game_Character
  3811.   include XRXS_BattlerAttachment
  3812.  
  3813.   #--------------------------------------------------------------------------
  3814.   # ● Battler
  3815.   #--------------------------------------------------------------------------  
  3816.   def battler
  3817.       return $game_party.members[0]
  3818.   end
  3819.  
  3820.   #--------------------------------------------------------------------------
  3821.   # ● Refresh Interpreter Effect
  3822.   #--------------------------------------------------------------------------        
  3823.   def refresh_interpreter_effect
  3824.       $game_system.old_interpreter_running = $game_map.interpreter.running?
  3825.       if $game_system.old_interpreter_running
  3826.          $game_temp.reset_battler_time = 60 * 4
  3827.       end  
  3828.       reset_battler_setting  
  3829.   end  
  3830.  
  3831.   #--------------------------------------------------------------------------
  3832.   # ● Update Battler Setting Time
  3833.   #--------------------------------------------------------------------------           
  3834.   def update_reset_battler_setting_time
  3835.       return if $game_temp.reset_battler_time == 0
  3836.       $game_temp.reset_battler_time -= 1
  3837.       reset_battler_setting_running if $game_temp.reset_battler_time == 0
  3838.   end
  3839.  
  3840.   #--------------------------------------------------------------------------
  3841.   # ● Update Battler Setting
  3842.   #--------------------------------------------------------------------------         
  3843.   def reset_battler_setting
  3844.       reset_player_parameters
  3845.       for ally in $game_party.members
  3846.          reset_members_parameters(ally)
  3847.       end
  3848.       for enemy in $game_map.events.values
  3849.           reset_enemies_parameters(enemy) if enemy.battler != nil
  3850.       end   
  3851.       $game_map.need_refresh = true  
  3852.   end  
  3853.  
  3854.   #--------------------------------------------------------------------------
  3855.   # ● Update Battler Setting Running
  3856.   #--------------------------------------------------------------------------         
  3857.   def reset_battler_setting_running
  3858.       reset_player_parameters_running
  3859.       for ally in $game_party.members
  3860.          reset_members_parameters_running(ally)
  3861.       end
  3862.       for enemy in $game_map.events.values
  3863.           reset_enemies_parameters(enemy) if enemy.battler != nil
  3864.       end   
  3865.       $game_map.need_refresh = true  
  3866.   end   
  3867.  
  3868.   #--------------------------------------------------------------------------
  3869.   # ● Reset Enemies Parameters
  3870.   #--------------------------------------------------------------------------         
  3871.   def reset_enemies_parameters(enemy)
  3872.       enemy.battler.cast_action[0] = 0
  3873.       enemy.battler.cast_action[1] = 0
  3874.       enemy.battler.cast_action[2] = 0
  3875.       enemy.battler.cast_action[3] = 0  
  3876.       enemy.battler.cast_action[4] = 0
  3877.       enemy.battler.counter_action[0] = 0
  3878.       enemy.battler.counter_action[1] = 0
  3879.       enemy.battler.counter_action[2] = true
  3880.       enemy.battler.invunerable_duration = 0
  3881.       enemy.knock_back_duration = nil
  3882.   end  
  3883.  
  3884.   #--------------------------------------------------------------------------
  3885.   # ● Reset Members Parameters
  3886.   #--------------------------------------------------------------------------         
  3887.   def reset_members_parameters(ally)
  3888.       ally.old_level = ally.level
  3889.       ally.shield = false
  3890.       ally.x_charge_action[0] = 0
  3891.       ally.x_charge_action[1] = 0
  3892.       ally.x_charge_action[2] = 0
  3893.       ally.x_charge_action[3] = 0
  3894.       ally.cast_action[0] = 0
  3895.       ally.cast_action[1] = 0
  3896.       ally.cast_action[2] = 0
  3897.       ally.cast_action[3] = 0  
  3898.       ally.cast_action[4] = 0
  3899.       ally.counter_action[0] = 0
  3900.       ally.counter_action[1] = 0
  3901.       ally.counter_action[2] = true
  3902.       ally.invunerable_duration = 0
  3903.   end
  3904.  
  3905.   #--------------------------------------------------------------------------
  3906.   # ● Reset Player Parameters
  3907.   #--------------------------------------------------------------------------         
  3908.   def reset_player_parameters
  3909.       make_pose("", 1) unless $game_player.action != nil
  3910.       $game_temp.xas_target_time = 0
  3911.       $game_temp.xas_target_shoot_id = 0
  3912.       $game_temp.xas_target_x = 0      
  3913.       @knock_back_duration = nil
  3914.       @dash_active = false
  3915.   end
  3916.  
  3917.  
  3918.   #--------------------------------------------------------------------------
  3919.   # ● Reset Members Parameters Running
  3920.   #--------------------------------------------------------------------------         
  3921.   def reset_members_parameters_running(ally)
  3922.       ally.old_level = ally.level
  3923.       ally.shield = false
  3924.       unless ally.x_charge_action[1] > 0
  3925.       ally.x_charge_action[0] = 0
  3926.       ally.x_charge_action[1] = 0
  3927.       ally.x_charge_action[2] = 0
  3928.       ally.x_charge_action[3] = 0
  3929.       end
  3930.       unless ally.cast_action[1] > 0
  3931.          ally.cast_action[0] = 0
  3932.          ally.cast_action[1] = 0
  3933.          ally.cast_action[2] = 0
  3934.          ally.cast_action[3] = 0  
  3935.          ally.cast_action[4] = 0
  3936.       end
  3937.       ally.counter_action[0] = 0
  3938.       ally.counter_action[1] = 0
  3939.       ally.counter_action[2] = true
  3940.       ally.invunerable_duration = 0
  3941.   end
  3942.  
  3943.   #--------------------------------------------------------------------------
  3944.   # ● Reset Player Parameters Running
  3945.   #--------------------------------------------------------------------------         
  3946.   def reset_player_parameters_running
  3947.       $game_temp.xas_target_time = 0
  3948.       $game_temp.xas_target_shoot_id = 0
  3949.       $game_temp.xas_target_x = 0      
  3950.       @knock_back_duration = nil
  3951.       @dash_active = false
  3952.   end
  3953.  
  3954. end
  3955.  
  3956. #===============================================================================
  3957. # ■ Game Follower
  3958. #===============================================================================
  3959. class Game_Follower < Game_Character
  3960.   include XRXS_BattlerAttachment
  3961.  
  3962.   #--------------------------------------------------------------------------
  3963.   # ● Battler
  3964.   #--------------------------------------------------------------------------   
  3965.   def battler
  3966.       return $game_party.members[@member_index]
  3967.   end
  3968. end
  3969.  
  3970. #===============================================================================
  3971. # ■ Game Follower
  3972. #===============================================================================
  3973. class Game_Followers
  3974.   include XRXS_BattlerAttachment
  3975.  
  3976.   #--------------------------------------------------------------------------
  3977.   # ● Battler
  3978.   #--------------------------------------------------------------------------   
  3979.   def battler
  3980.       return $game_party.members[@member_index]
  3981.   end
  3982. end
  3983. #===============================================================================
  3984. # ■ Game_Vehicle
  3985. #===============================================================================
  3986. class Game_Vehicle < Game_Character
  3987.   include XRXS_BattlerAttachment
  3988.   attr_reader   :collision_attack
  3989.  
  3990.   #--------------------------------------------------------------------------
  3991.   # ● Battler
  3992.   #--------------------------------------------------------------------------      
  3993.   def battler
  3994.      return @battler
  3995.   end  
  3996. end  
  3997.  
  3998. #===============================================================================
  3999. # ■ Game Event
  4000. #===============================================================================
  4001. class Game_Event < Game_Character
  4002.  
  4003.   include XRXS_BattlerAttachment
  4004.  
  4005.   #--------------------------------------------------------------------------
  4006.   # ● Battler
  4007.   #--------------------------------------------------------------------------   
  4008.   def battler
  4009.     return @battler
  4010.   end
  4011.  
  4012. #--------------------------------------------------------------------------
  4013. # ● Battler?
  4014. #--------------------------------------------------------------------------           
  4015. def battler?
  4016.      return false if self.erased
  4017.      return false if self.battler == nil
  4018.      return false if self.dead?
  4019.      return false if self.battler.no_damage_pop
  4020.      return false if self.battler.invunerable
  4021.      return true
  4022. end  
  4023.  
  4024.   #--------------------------------------------------------------------------
  4025.   # ● Refresh
  4026.   #--------------------------------------------------------------------------   
  4027.   alias xrxs64c_refresh refresh
  4028.   def refresh
  4029.       xrxs64c_refresh
  4030.       self.battler_recheck
  4031.   end
  4032.  
  4033.   #--------------------------------------------------------------------------
  4034.   # ● Battler Recheck
  4035.   #--------------------------------------------------------------------------   
  4036.   def battler_recheck
  4037.       return if @battler != nil
  4038.       return if @page == nil
  4039.       if self.name =~ /<Actor>/ or self.name =~ /<友方>/
  4040.          actor = $game_party.members[0]
  4041.          @battler = Game_Actor.new(actor.id)
  4042.          return
  4043.       else
  4044.          @enemy_id = 0
  4045.          if self.name =~ /<Enemy(\d+)>/i or self.name =~ /<敌人(\d+)>/i
  4046.             @enemy_id = $1.to_i   
  4047.          end           
  4048.          return if @enemy_id <= 0
  4049.          @battler = Game_Enemy.new(1, @enemy_id)
  4050.          self.force_update = true if self.battler.sensor_range >= 15         
  4051.       end  
  4052.   end
  4053.  
  4054.   #--------------------------------------------------------------------------
  4055.   # ● Battler Recheck
  4056.   #--------------------------------------------------------------------------      
  4057.   def enemy_id
  4058.       return @enemy_id
  4059.   end
  4060.  
  4061.   #--------------------------------------------------------------------------
  4062.   # ● body_size
  4063.   #--------------------------------------------------------------------------        
  4064.   def body_size
  4065.       if self.battler != nil
  4066.          return self.battler.body_size
  4067.       else
  4068.          return 0
  4069.       end  
  4070.   end
  4071.  
  4072. end
  4073.  
  4074.  
  4075. #===============================================================================
  4076. # ■ Game_Battler
  4077. #===============================================================================
  4078. class Game_Battler
  4079.   attr_accessor :sensor_range
  4080.   attr_accessor :body_size
  4081.   attr_accessor :breath_effect
  4082.   attr_accessor :breath_duration
  4083.   attr_accessor :fast_breath_effect
  4084.   attr_accessor :no_knockback
  4085.   attr_accessor :passive  
  4086.   attr_accessor :attack_animation_id
  4087.   attr_accessor :ignore_guard
  4088.   attr_accessor :no_damage_pop
  4089.  
  4090.   #--------------------------------------------------------------------------
  4091.   # ● Initialize
  4092.   #--------------------------------------------------------------------------      
  4093.   alias x_e_initialize initialize
  4094.   def initialize  
  4095.       x_e_initialize
  4096.       @sensor_range = 4
  4097.       @body_size = 0
  4098.       @breath_effect = false
  4099.       @breath_duration = 0
  4100.       @fast_breath_effect = false
  4101.       @no_knockback = false
  4102.       @passive = false     
  4103.       @attack_animation_id = 0
  4104.       @ignore_guard = false
  4105.       @no_damage_pop = false
  4106.   end  
  4107. end
  4108.  
  4109. #===============================================================================
  4110. # ■ Game_Enemy
  4111. #===============================================================================
  4112. class Game_Enemy < Game_Battler
  4113.  
  4114.   #--------------------------------------------------------------------------
  4115.   # ● Initialize
  4116.   #--------------------------------------------------------------------------      
  4117.   alias x_e2_initialize initialize
  4118.   def initialize(index, enemy_id)
  4119.       x_e2_initialize(index, enemy_id)
  4120.       enemy = $data_enemies[@enemy_id]
  4121.       setup_enemy_note(enemy)
  4122.   end  
  4123.  
  4124.   #--------------------------------------------------------------------------
  4125.   # ● Setup X Note Elements
  4126.   #--------------------------------------------------------------------------         
  4127.   def setup_enemy_note(enemy)
  4128.       if enemy.note =~ /<Sensor Range = (\d+)>/ or enemy.note =~ /<视野范围 = (\d+)>/ or
  4129.          enemy.note =~ /<感应器范围 = (\d+)>/ or enemy.note =~ /<效应范围 = (\d+)>/
  4130.          @sensor_range = $1.to_i
  4131.       end   
  4132.       if enemy.note =~ /<Body Size = (\d+)>/ or enemy.note =~ /<身体大小 = (\d+)>/
  4133.          @body_size = $1.to_i
  4134.       end
  4135.       if enemy.note =~ /<Attack Animation = (\d+)>/ or enemy.note =~ /<攻击动画 = (\d+)>/
  4136.          @attack_animation_id = $1.to_i
  4137.       end  
  4138.       if enemy.note =~ /<Death Zoom = (\d+)>/ or enemy.note =~ /<死亡方式 = (\d+)>/
  4139.          @death_zoom_effect = $1.to_i
  4140.       end
  4141.       if enemy.note =~ /<Knockback Duration = (\d+)>/ or enemy.note =~ /<倒地起身 = (\d+)>/
  4142.          @knockback_duration = $1.to_i
  4143.       end      
  4144.       if enemy.note =~ /<Ignore Guard>/ or enemy.note =~ /<忽略防御>/
  4145.          @ignore_shield = true
  4146.       end
  4147.       if enemy.note =~ /<Invunerable>/  or enemy.note =~ /<无敌>/
  4148.          @invunerable = true
  4149.       end
  4150.       if enemy.note =~ /<Breath Effect>/  or enemy.note =~ /<呼吸>/
  4151.          @breath_effect = true
  4152.       end
  4153.       if enemy.note =~ /<Knockback Disable>/  or   enemy.note =~ /<禁止击倒>/   
  4154.          @no_knockback = true
  4155.       end
  4156.       if enemy.note =~ /<Passive>/  or enemy.note =~ /<被动>/
  4157.          @passive = true
  4158.       end
  4159.       if enemy.note =~ /<伤害隐藏>/
  4160.          @no_damage_pop = true
  4161.       end   
  4162.       invunerable_actions_ids = XAS_BA_ENEMY::INVUNERABLE_ACTIONS[@enemy_id]
  4163.       if invunerable_actions_ids != nil
  4164.          @invunerable_actions = invunerable_actions_ids
  4165.       end   
  4166.       guard_directions_ids = XAS_BA_ENEMY::GUARD_DIRECTIONS[@enemy_id]
  4167.       if guard_directions_ids != nil
  4168.          @guard_directions = guard_directions_ids
  4169.       end         
  4170.   end
  4171.  
  4172.  
  4173. end  
  4174.  
  4175.  
  4176. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4177. #■ BATTLER - EVENT SENSOR
  4178. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4179.  
  4180.  
  4181. #===============================================================================
  4182. # ■ XRXS_Enemy_Sensor
  4183. #===============================================================================
  4184. module XRXS_EnemySensor
  4185.  
  4186.   #--------------------------------------------------------------------------
  4187.   # ● Update Sensor
  4188.   #--------------------------------------------------------------------------        
  4189.   def update_sensor
  4190.       if self.battler != nil and self.battler.sensor_range > 0  
  4191.          sensor_area = self.battler.sensor_range
  4192.       else  
  4193.          sensor_area = $game_variables[XAS_BA::DEFAULT_SENSOR_RANGE_VARIABLE_ID]
  4194.       end
  4195.       sensor_area = -1 if cancel_sensor?
  4196.       distance = ($game_player.x - self.x).abs + ($game_player.y - self.y).abs
  4197.       enable   = (distance <= sensor_area)
  4198.       key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
  4199.       last_enable = $game_self_switches[key]
  4200.       last_enable = false if last_enable == nil
  4201.       if enable != last_enable
  4202.          touch_attack(false)
  4203.          @collision_attack = false
  4204.          @pattern = 0
  4205.          @pattern_count = 0               
  4206.          $game_self_switches[key] = enable
  4207.          self.refresh
  4208.       end
  4209.   end
  4210.  
  4211.   #--------------------------------------------------------------------------
  4212.   # ● Can Update Sensor
  4213.   #--------------------------------------------------------------------------            
  4214.   def can_update_sensor?
  4215.       return false if @sensor_enable == false
  4216.       return false if self.dead?
  4217.       return false if self.erased
  4218.       return false if self.stop
  4219.       return false if self.knockbacking?
  4220.       return true
  4221.   end
  4222.  
  4223.   #--------------------------------------------------------------------------
  4224.   # ● refresh_sensor
  4225.   #--------------------------------------------------------------------------         
  4226.   def refresh_sensor
  4227.       touch_attack(false)
  4228.       key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
  4229.       $game_self_switches[key] = false
  4230.       @pattern = 0
  4231.       @pattern_count  = 0         
  4232.       self.refresh        
  4233.   end  
  4234.  
  4235.   #--------------------------------------------------------------------------
  4236.   # ● Cancel Sensor
  4237.   #--------------------------------------------------------------------------         
  4238.   def cancel_sensor?  
  4239.       return false if self.battler == nil
  4240.       return true if self.battler.passive
  4241.       return false
  4242.   end
  4243.  
  4244. end
  4245.  
  4246. #===============================================================================
  4247. # ■  Game Event
  4248. #===============================================================================
  4249. class Game_Event < Game_Character
  4250.  
  4251.   attr_accessor :sensor_enable
  4252.  
  4253.   #--------------------------------------------------------------------------
  4254.   # ● Initialize
  4255.   #--------------------------------------------------------------------------            
  4256.   alias x_sensor_initialize initialize
  4257.   def initialize(map_id, event)
  4258.       @sensor_enable = false
  4259.       x_sensor_initialize(map_id, event)
  4260.   end  
  4261.  
  4262.   #--------------------------------------------------------------------------
  4263.   # ● Conditions Met
  4264.   #--------------------------------------------------------------------------
  4265.   alias x_sensor_conditions_met conditions_met?
  4266.   def conditions_met?(page)
  4267.       c = page.condition
  4268.       if c.self_switch_ch == XAS_BA::SENSOR_SELF_SWITCH
  4269.          @sensor_enable = true
  4270.       end
  4271.       x_sensor_conditions_met(page)   
  4272.   end
  4273. end
  4274.  
  4275. #===============================================================================
  4276. # ■  Game Event
  4277. #===============================================================================
  4278. class Game_Character < Game_CharacterBase
  4279.       include XRXS_EnemySensor
  4280. end
  4281.  
  4282. #===============================================================================
  4283. # ■  Game Character
  4284. #===============================================================================
  4285. class Game_Character < Game_CharacterBase
  4286.       attr_writer   :opacity
  4287. end
  4288. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4289. #■ BATTLER - ACTION
  4290. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4291.  
  4292.  
  4293. #===============================================================================
  4294. # ■ Game Character
  4295. #==============================================================================
  4296. class Game_Character < Game_CharacterBase
  4297.  
  4298.   #--------------------------------------------------------------------------
  4299.   # ● Can Update Battler Move Speed
  4300.   #--------------------------------------------------------------------------                  
  4301.   def can_update_battler_move_speed?
  4302.       return false if @temp_id > 0
  4303.       return false if moving?   
  4304.       return true
  4305.   end  
  4306.  
  4307.   #--------------------------------------------------------------------------
  4308.   # ● Can Update Battler?
  4309.   #--------------------------------------------------------------------------               
  4310.   def can_update_battler?
  4311.       return false unless $game_system.xas_battle
  4312.       return false if self.battler == nil
  4313.       return false unless party_system?
  4314.       return true
  4315.   end  
  4316.  
  4317.   #--------------------------------------------------------------------------
  4318.   # ● Party System
  4319.   #--------------------------------------------------------------------------                  
  4320.   def party_system?
  4321.       return false if self.battler == nil
  4322.       if $xas_party_system == nil and self.battler.is_a?(Game_Actor)
  4323.          return false if self.battler.actor_id != $game_party.members[0].actor_id
  4324.       end
  4325.       return true
  4326.   end
  4327.  
  4328.   #--------------------------------------------------------------------------
  4329.   # ● Reset Battler Temp
  4330.   #--------------------------------------------------------------------------                  
  4331.   def reset_battler_temp
  4332.       reset_cast_temp   
  4333.       reset_charge_temp
  4334.   end  
  4335.  
  4336.   #--------------------------------------------------------------------------
  4337.   # ● Reset Charge Temp
  4338.   #--------------------------------------------------------------------------                    
  4339.   def reset_charge_temp  
  4340.       return if self.battler == nil
  4341.       return if self.battler.is_a?(Game_Enemy)
  4342.       self.battler.x_charge_action[0] = 0
  4343.       self.battler.x_charge_action[1] = 0
  4344.       self.battler.x_charge_action[2] = 0
  4345.       self.battler.x_charge_action[3] = 0
  4346.   end
  4347.  
  4348.   #--------------------------------------------------------------------------
  4349.   # ● Reset Battler Temp
  4350.   #--------------------------------------------------------------------------                    
  4351.   def reset_cast_temp   
  4352.       return if self.battler == nil
  4353.       self.battler.cast_action[0] = 0
  4354.       self.battler.cast_action[1] = 0
  4355.       self.battler.cast_action[2] = 0
  4356.       self.battler.cast_action[3] = 0  
  4357.       self.battler.cast_action[4] = 0
  4358.   end
  4359.  
  4360.   #--------------------------------------------------------------------------
  4361.   # ● update_battler_parameters
  4362.   #--------------------------------------------------------------------------   
  4363.   def update_battler_parameters
  4364.       @stop_count = -1 if can_stop_battler?
  4365.       self.battler.invunerable_duration -= 1 if self.battler.invunerable_duration > 0
  4366.       unless @stop
  4367.          @knock_back_duration = 30 if @temp_id > 0
  4368.       end   
  4369.   end   
  4370.  
  4371.   #--------------------------------------------------------------------------
  4372.   # ● Can Stop Battler
  4373.   #--------------------------------------------------------------------------      
  4374.   def can_stop_battler?
  4375.       return false if self.is_a?(Game_Player)
  4376.       return true if self.knockbacking?
  4377.       return true if self.dead?
  4378.       return true if self.stop
  4379.       return false
  4380.   end
  4381.  
  4382.   #--------------------------------------------------------------------------
  4383.   # ● Update Battler Counter Action
  4384.   #--------------------------------------------------------------------------                    
  4385.   def update_battler_counter_action
  4386.       return if self.battler.counter_action[1] == 0
  4387.       self.battler.counter_action[1] -= 1
  4388.       if self.battler.counter_action[1] == 0
  4389.          turn_toward_player
  4390.          self.battler.damage = XAS_WORD::COUNTER
  4391.          self.battler.damage_pop = true
  4392.          self.shoot(self.battler.counter_action[0])
  4393.          self.battler.counter_action[0] = 0
  4394.       end   
  4395.   end  
  4396.  
  4397.   #--------------------------------------------------------------------------
  4398.   # ● Update Cast Action
  4399.   #--------------------------------------------------------------------------         
  4400.   def update_battler_cast_action   
  4401.       return unless can_update_cast_action?
  4402.       self.battler.cast_action[3] += 1
  4403.       if self.battler.cast_action[3] > XAS_ANIMATION::LOOP_ANIMATIONS_SPEED
  4404.          self.battler.cast_action[3] = 0
  4405.          self.animation_id =  self.battler.cast_action[2]
  4406.       end  
  4407.       self.battler.cast_action[4] += 1
  4408.       if self.battler.cast_action[4] >= self.battler.cast_action[1]
  4409.           self.shoot(self.battler.cast_action[0])
  4410.       end
  4411.   end  
  4412.  
  4413.   #--------------------------------------------------------------------------
  4414.   # ● Can Update Cast Action
  4415.   #--------------------------------------------------------------------------            
  4416.   def can_update_cast_action?
  4417.       return false if self.battler.cast_action[1] == 0   
  4418.       return false if @stop
  4419.       return true
  4420.   end
  4421.  
  4422.   #--------------------------------------------------------------------------
  4423.   # ● Can Blow Effect
  4424.   #--------------------------------------------------------------------------              
  4425.   def can_blow?
  4426.       return false if self.stop and not self.battler.state_sleep
  4427.       return false if self.battler.no_knockback   
  4428.       return false if self.is_a?(Game_Player) and self.action != nil
  4429.       return true
  4430.   end   
  4431.  
  4432.   #--------------------------------------------------------------------------
  4433.   # ● Blow Effect
  4434.   #--------------------------------------------------------------------------        
  4435.   def blow(d, power = 1)
  4436.       return unless can_blow?
  4437.       jump(0,0)
  4438.       self.battler.invunerable_duration = 30 if self.battler.invunerable_duration <= 0
  4439.       if self.is_a?(Game_Event)
  4440.          @collision_attack = false  
  4441.       end
  4442.       @knock_back_duration = self.battler.knockback_duration
  4443.       refresh_sensor if self.is_a?(Game_Event)
  4444.       pre_direction = self.direction
  4445.       pre_direction_fix = self.direction_fix
  4446.       self.turn_reverse(d)      
  4447.       self.direction_fix = true
  4448.       power.times do
  4449.         case d
  4450.            when 2; @y += 1 if passable?(@x, @y, d)
  4451.            when 4; @x -= 1 if passable?(@x, @y, d)
  4452.            when 6; @x += 1 if passable?(@x, @y, d)
  4453.            when 8; @y -= 1 if passable?(@x, @y, d)
  4454.         end
  4455.       end
  4456.       self.direction_fix = pre_direction_fix
  4457.       self.direction = pre_direction
  4458.   end
  4459.  
  4460.   #--------------------------------------------------------------------------
  4461.   # ● Can Stop Battler Movement
  4462.   #--------------------------------------------------------------------------            
  4463.   def can_stop_battler_movement?
  4464.       return false if self.dead?   
  4465.       return true if self.battler.state_sleep
  4466.       return true if self.battler.state_stop
  4467.       return false
  4468.   end  
  4469.  
  4470.   #--------------------------------------------------------------------------
  4471.   # ● Impact
  4472.   #--------------------------------------------------------------------------              
  4473.   def impact(enable = true)
  4474.       return if self.tool_id == 0
  4475.       return if self.action == nil
  4476.       self.action.impact = enable
  4477.   end
  4478.  
  4479.   #--------------------------------------------------------------------------
  4480.   # ● Update Battler Stop Movement
  4481.   #--------------------------------------------------------------------------              
  4482.   def update_battler_stop_movement
  4483.       unless can_stop_battler_movement?
  4484.           @stop = false   
  4485.           return
  4486.       end
  4487.       @knock_back_duration = nil
  4488.       @stop = true      
  4489.       @step_anime = false   
  4490.       reset_battler_temp
  4491.       if self.battler.state_sleep
  4492.          make_pose("_Hit", 2)   
  4493.       else
  4494.          make_pose("", 2)
  4495.       end  
  4496.       if self.is_a?(Game_Event)
  4497.          @collision_attack = false
  4498.       end  
  4499.   end
  4500.  
  4501.   #--------------------------------------------------------------------------
  4502.   # ● Update Attacking
  4503.   #--------------------------------------------------------------------------              
  4504.   def update_battler_attacking
  4505.       return unless can_update_attacking?
  4506.       make_pose("_Atk", 2)
  4507.   end
  4508.  
  4509.   #--------------------------------------------------------------------------
  4510.   # ● Can Update Attacking
  4511.   #--------------------------------------------------------------------------              
  4512.   def can_update_attacking?
  4513.       return false if self.battler.is_a?(Game_Actor)
  4514.       return false if @collision_attack == false  
  4515.       return true
  4516.   end  
  4517.  
  4518.   #--------------------------------------------------------------------------
  4519.   # ● Update Battler Knobacking
  4520.   #--------------------------------------------------------------------------            
  4521.   def update_battler_knockbacking
  4522.        return unless self.knockbacking?
  4523.        @pattern = 0
  4524.        @knock_back_duration -= 1 if can_remove_knockback?
  4525.        make_pose("_Hit", 2)        
  4526.        if self.is_a?(Game_Event)
  4527.           @collision_attack = false
  4528.        end         
  4529.        if @knock_back_duration <= 0
  4530.           @knock_back_duration = nil
  4531.           make_pose("", 0)
  4532.           touch_attack(false) if self.is_a?(Game_Event)
  4533.           @character_name = @x_pose_original_name
  4534.        end
  4535.   end  
  4536.  
  4537.   #--------------------------------------------------------------------------
  4538.   # ● Can Remove Knockback
  4539.   #--------------------------------------------------------------------------              
  4540.   def can_remove_knockback?
  4541.       return true
  4542.   end
  4543.  
  4544.   #--------------------------------------------------------------------------
  4545.   # ● knockbacking?
  4546.   #--------------------------------------------------------------------------            
  4547.   def knockbacking?
  4548.       return false if self.battler == nil
  4549.       return false if @stop
  4550.       return true if @knock_back_duration != nil
  4551.       return false
  4552.   end
  4553.  
  4554.   #--------------------------------------------------------------------------
  4555.   # ● collapsing?
  4556.   #--------------------------------------------------------------------------         
  4557.   def collapsing?
  4558.       return self.collapse_duration.to_i > 0
  4559.   end
  4560.  
  4561.   #--------------------------------------------------------------------------
  4562.   # ● Seal Effect
  4563.   #--------------------------------------------------------------------------         
  4564.   def seal_effect
  4565.       Sound.play_buzzer
  4566.       if XAS_WORD::ENABLE_WORD
  4567.          self.battler.damage = XAS_WORD::SEAL
  4568.          self.battler.damage_pop = true
  4569.       end   
  4570.   end   
  4571.  
  4572. end
  4573.  
  4574. #===============================================================================
  4575. # ■ XAS_DamageStop
  4576. #===============================================================================
  4577. module XAS_DamageStop
  4578.  
  4579.   #--------------------------------------------------------------------------
  4580.   # ● Acting
  4581.   #--------------------------------------------------------------------------            
  4582.   def acting?
  4583.       return (super or self.knockbacking? or self.collapsing? or self.stop)
  4584.   end
  4585. end
  4586.  
  4587. #===============================================================================
  4588. # ■ Game_Player
  4589. #===============================================================================
  4590. class Game_Player < Game_Character
  4591.       include XAS_DamageStop
  4592. end
  4593.  
  4594. #===============================================================================
  4595. # ■ Game_Event
  4596. #===============================================================================
  4597. class Game_Event < Game_Character
  4598.       include XAS_DamageStop
  4599. end
  4600.  
  4601.  
  4602.  
  4603. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4604. #■ BATTLER - TOUCH EFFECT
  4605. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4606.  
  4607.  
  4608. #===============================================================================
  4609. # ■ XRXS_BattlerAttachment
  4610. #==============================================================================
  4611. module XRXS_BattlerAttachment
  4612.  
  4613.   #--------------------------------------------------------------------------
  4614.   # ● Attack Effect
  4615.   #--------------------------------------------------------------------------   
  4616.   def attack_effect(attacker)
  4617.       return false unless $game_system.xas_battle   
  4618.       return if self.battler == nil or attacker == nil
  4619.       return unless can_attack_effect?(attacker)
  4620.       if target_shield_enabled?(attacker, nil, nil)
  4621.          execute_guard_effect(attacker, nil, nil, 30)
  4622.          return
  4623.       end   
  4624.       execute_attack_effect(attacker)
  4625. end
  4626.  
  4627. #--------------------------------------------------------------------------
  4628. # ● Can Attack Effect
  4629. #--------------------------------------------------------------------------     
  4630. def can_attack_effect?(attacker)
  4631.      return false if self.can_update == false
  4632.      return false if @knock_back_duration != nil
  4633.      return false if attacker.stop
  4634.      return false if self.battler.invunerable
  4635.      return false if self.battler.invunerable_duration > 0
  4636.      return false if self.action != nil and self.action.user_invincible
  4637.      return false if seal_attack?(attacker.battler)     
  4638.      return false if target_state_invunerable?(30)
  4639.      return true
  4640. end  
  4641.  
  4642. #--------------------------------------------------------------------------
  4643. # ● Attack Target Shield
  4644. #--------------------------------------------------------------------------     
  4645. def attack_target_shield?(attacker)
  4646.      return false if attacker.battler.ignore_shield   
  4647.      return false unless self.battler.shield
  4648.      return true if face_direction?(attacker)
  4649.      return false
  4650. end  
  4651.  
  4652. #--------------------------------------------------------------------------
  4653. # ● Seal Attack?
  4654. #--------------------------------------------------------------------------               
  4655. def seal_attack?(attacker)
  4656.      if attacker.state_seal_attack or attacker.state_mute
  4657.         attacker.damage = XAS_WORD::SEAL
  4658.         attacker.damage_pop = true
  4659.         self.battler.invunerable_duration = 30
  4660.         return true
  4661.      end
  4662.      return false
  4663. end   
  4664.  
  4665. #--------------------------------------------------------------------------
  4666. # ● Execute Attack Damage
  4667. #--------------------------------------------------------------------------      
  4668. def execute_attack_damage(attacker)
  4669.      #if self.battler.agi > (rand(attacker.battler.agi) * 2)
  4670.      #   self.battler.result.missed = true
  4671.      #   return
  4672.      #end
  4673.      damage = ((attacker.battler.atk * 4) - (self.battler.def * 2)).truncate
  4674.      damage = 0 if damage < 0
  4675.      self.battler.result.hp_damage = damage
  4676.      #self.battler.result.critical   
  4677.      self.battler.hp -= damage.abs
  4678. end
  4679.  
  4680. #--------------------------------------------------------------------------
  4681. # ● Execute Attack Effect
  4682. #--------------------------------------------------------------------------      
  4683. def execute_attack_effect(attacker)
  4684.      execute_attack_effect_before_damage(attacker)
  4685.      execute_attack_damage(attacker)
  4686.      if target_missed?(attacker)
  4687.         self.battler.invunerable_duration = 30
  4688.         return
  4689.      end
  4690.      execute_damage_pop(attacker)
  4691.      execute_attack_effect_after_damage(attacker) if can_check_after_attack_effect?(attacker)   
  4692.      execute_state_effect(nil, attacker, nil)   
  4693.      self.battler.invunerable_duration = 20 + XAS_BA::DEFAULT_KNOCK_BACK_DURATION
  4694.      if attacker.battler.attack_animation_id != 0
  4695.         self.animation_id = attacker.battler.attack_animation_id
  4696.      end   
  4697.      if self.battler.damage.to_i > 0
  4698.         self.blow(attacker.direction, 1) if can_blow_effect?
  4699.      end
  4700.      if self.is_a?(Game_Player)
  4701.         self.need_refresh = true
  4702.      end
  4703. end  
  4704.  
  4705. #--------------------------------------------------------------------------
  4706. # ● Can Check After Attack Effect?  
  4707. #--------------------------------------------------------------------------        
  4708. def can_check_after_attack_effect?(attacker)   
  4709.      return false unless self.battler.damage.is_a?(Numeric)
  4710.      return true
  4711. end
  4712.  
  4713. #--------------------------------------------------------------------------
  4714. # ● Execute Attack Effect Before Damage
  4715. #--------------------------------------------------------------------------      
  4716. def execute_attack_effect_before_damage(attacker)
  4717.  
  4718. end
  4719.  
  4720. #--------------------------------------------------------------------------
  4721. # ● Execute Attack Effect After Damage
  4722. #--------------------------------------------------------------------------      
  4723. def execute_attack_effect_after_damage(attacker)
  4724.  
  4725. end
  4726.  
  4727. end
  4728.  
  4729. #===============================================================================
  4730. # ■ Game Player
  4731. #===============================================================================
  4732. class Game_Player < Game_Character  
  4733.   #--------------------------------------------------------------------------
  4734.   # ● Check Event Trigger Touch
  4735.   #--------------------------------------------------------------------------            
  4736.   alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  4737.   def check_event_trigger_touch(x, y)
  4738.       xrxs64c_check_event_trigger_touch(x, y)
  4739.       if $game_map.interpreter.running?
  4740.          return
  4741.       end
  4742.       for event in $game_map.events.values
  4743.           next unless event.collision_attack
  4744.           unless [1,2].include?(event.trigger)
  4745.              if event.battler != nil and event.x == x and event.y == y
  4746.                 $game_player.attack_effect(event)
  4747.              end
  4748.           end
  4749.       end
  4750.   end
  4751. end
  4752.  
  4753. #===============================================================================
  4754. # ■ Game Event
  4755. #===============================================================================
  4756. class Game_Event < Game_Character
  4757.  
  4758.   #--------------------------------------------------------------------------
  4759.   # ● Check Event Trigger Touch
  4760.   #--------------------------------------------------------------------------            
  4761.   alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  4762.   def check_event_trigger_touch(x, y)
  4763.     xrxs64c_check_event_trigger_touch(x, y)
  4764.     if $game_map.interpreter.running?
  4765.        return
  4766.     end
  4767.     return unless self.collision_attack
  4768.     if self.battler != nil and x == $game_player.x and y == $game_player.y
  4769.        $game_player.attack_effect(self)
  4770.     end
  4771.   end
  4772. end
  4773.  
  4774.  
  4775.  
  4776. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4777. #■ BATTLER - MOVE SPEED
  4778. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4779.  
  4780.  
  4781. #==============================================================================
  4782. # ■ Game_Character
  4783. #==============================================================================
  4784. class Game_Character < Game_CharacterBase
  4785.  
  4786.   include XAS_BA
  4787.   attr_accessor :base_move_speed
  4788.   attr_accessor :dash_move_speed
  4789.   attr_accessor :move_speed
  4790.  
  4791. #--------------------------------------------------------------------------
  4792. # ● Initialize
  4793. #--------------------------------------------------------------------------  
  4794.   alias x_move_speed_initialize initialize
  4795.   def initialize
  4796.       @base_move_speed = BASE_MOVE_SPEED
  4797.       @dash_move_speed = 0
  4798.       x_move_speed_initialize
  4799.   end  
  4800.  
  4801. #--------------------------------------------------------------------------
  4802. # ● update_battler_move_speed
  4803. #--------------------------------------------------------------------------
  4804.   def update_battler_move_speed
  4805.       @dash_move_speed = @dash_active ? DASH_MOVE_SPEED : 0
  4806.       sp1 = @base_move_speed
  4807.       sp2 = @dash_move_speed
  4808.       sp3 = self.battler.state_move_speed
  4809.       @move_speed = (sp1 + sp2 + sp3)
  4810.   end
  4811.  
  4812. #--------------------------------------------------------------------------
  4813. # ● Update Animation
  4814. #--------------------------------------------------------------------------      
  4815.   def update_animation
  4816.       super
  4817.       update_force_move_routine_move
  4818.   end
  4819.  
  4820. #--------------------------------------------------------------------------
  4821. # ● Update Force Move Routine Move
  4822. #--------------------------------------------------------------------------        
  4823.   def update_force_move_routine_move
  4824.       return if @force_action == ""
  4825.       return if @move_route == nil
  4826.       command = @move_route.list[@move_route_index]
  4827.       return if command == nil
  4828.       if command.code == ROUTE_PLAY_SE   
  4829.          params = command.parameters
  4830.          params[0].play
  4831.          advance_move_route_index
  4832.       end   
  4833.   end
  4834.  
  4835. #--------------------------------------------------------------------------
  4836. # ● Update Routine Move
  4837. #--------------------------------------------------------------------------      
  4838. alias x_update_routine_move update_routine_move
  4839. def update_routine_move
  4840.      return if @force_action_times > 0
  4841.      x_update_routine_move
  4842. end
  4843.  
  4844. #--------------------------------------------------------------------------
  4845. # ● Can Cancel Move Type Custom
  4846. #--------------------------------------------------------------------------   
  4847.   alias x_move_speed_process_move_command process_move_command
  4848.   def process_move_command(command)
  4849.       return if can_cancel_move_type_custom?(command)
  4850.       params = command.parameters
  4851.       x_move_speed_process_move_command(command)
  4852.       if command.code == ROUTE_CHANGE_SPEED and @battler != nil and
  4853.          self.is_a?(Game_Event)
  4854.          @base_move_speed = params[0]
  4855.       end        
  4856.   end
  4857.  
  4858. #--------------------------------------------------------------------------
  4859. # ● Can Cancel Move Type Custom
  4860. #--------------------------------------------------------------------------   
  4861.   def can_cancel_move_type_custom?(command)
  4862.       return true if command == nil
  4863.       return true if @force_action_times > 0
  4864.       return false
  4865.   end  
  4866.  
  4867. end  
  4868.  
  4869.  
  4870. #==============================================================================
  4871. # ■ Game_Event
  4872. #==============================================================================
  4873. class Game_Event < Game_Character  
  4874.  
  4875. #--------------------------------------------------------------------------
  4876. # ● Initialize
  4877. #--------------------------------------------------------------------------              
  4878. alias x_move_speed_event_initialize initialize
  4879. def initialize(map_id, event)
  4880.      x_move_speed_event_initialize(map_id, event)
  4881.      refresh_move_speed
  4882. end  
  4883.  
  4884.   #--------------------------------------------------------------------------
  4885.   # ● Refresh Move Speed
  4886.   #--------------------------------------------------------------------------
  4887.   def refresh_move_speed
  4888.       return if @page == nil
  4889.       @base_move_speed = @page.move_speed
  4890.   end
  4891.  
  4892. #--------------------------------------------------------------------------
  4893. # ● Setup Page
  4894. #--------------------------------------------------------------------------               
  4895. alias x_move_speed_setup_page setup_page
  4896. def setup_page(new_page)
  4897.      x_move_speed_setup_page(new_page)
  4898.      refresh_move_speed
  4899. end
  4900.  
  4901. end
  4902.  
  4903.  
  4904. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4905. #■ BATTLER - STATES
  4906. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  4907.  
  4908.  
  4909. #==============================================================================
  4910. # ■ Game_Battler
  4911. #==============================================================================
  4912. class Game_Battler
  4913.  
  4914.   attr_accessor :state_move_speed
  4915.   attr_accessor :state_stop
  4916.   attr_accessor :state_loop_effect_time
  4917.   attr_accessor :state_loop_speed
  4918.   attr_accessor :state_duration
  4919.   attr_accessor :state_string
  4920.   attr_accessor :state_string_time
  4921.   attr_accessor :state_stop
  4922.   attr_accessor :state_slow
  4923.   attr_accessor :state_sleep
  4924.   attr_accessor :state_invunerable
  4925.   attr_accessor :state_fast
  4926.   attr_accessor :state_mute
  4927.   attr_accessor :state_seal_attack
  4928.   attr_accessor :state_seal_skill
  4929.   attr_accessor :state_seal_item
  4930.   attr_accessor :state_reflect
  4931.  
  4932. #--------------------------------------------------------------------------
  4933. # ● Initialize
  4934. #--------------------------------------------------------------------------  
  4935.   alias x_state_initialize initialize
  4936.   def initialize
  4937.       @state_move_speed = 0
  4938.       @state_duration = []
  4939.       @state_loop_effect_time = []
  4940.       @state_loop_speed = []
  4941.       @state_string = ""
  4942.       @state_string_time = 0
  4943.       @state_stop = false
  4944.       @state_sleep = false
  4945.       @state_invunerable = false
  4946.       @state_slow = false
  4947.       @state_fast = false
  4948.       @state_mute = false
  4949.       @state_seal_attack = false
  4950.       @state_seal_skill = false
  4951.       @state_seal_item = false
  4952.       @state_reflect = false
  4953.       x_state_initialize
  4954.   end
  4955.  
  4956. #--------------------------------------------------------------------------
  4957. # ● Add State
  4958. #--------------------------------------------------------------------------   
  4959.   alias x_add_state add_state
  4960.   def add_state(state_id)
  4961.       unless @states.include?(state_id)
  4962.           state = $data_states[state_id]
  4963.           xas_add_state(state)
  4964.       end        
  4965.       x_add_state(state_id)
  4966.   end
  4967.  
  4968. #--------------------------------------------------------------------------
  4969. # ● Xas Add State
  4970. #--------------------------------------------------------------------------      
  4971.   def xas_add_state(state)
  4972.       @state_duration[state.id] = 60 * $data_states[state.id].min_turns
  4973.       @state_loop_effect_time[state.id] = 0
  4974.       @state_loop_speed[state.id] = $data_states[state.id].max_turns
  4975.       execute_damage_state(state,0)
  4976.   end      
  4977.  
  4978. #--------------------------------------------------------------------------
  4979. # ● Remove State
  4980. #--------------------------------------------------------------------------        
  4981.   alias x_remove_state remove_state
  4982.   def remove_state(state_id)
  4983.       if state?(state_id)
  4984.          state = $data_states[state_id]
  4985.          xas_remove_state(state)
  4986.       end  
  4987.       x_remove_state(state_id)      
  4988.   end   
  4989.  
  4990. #--------------------------------------------------------------------------
  4991. # ● XAS Remove State
  4992. #--------------------------------------------------------------------------         
  4993.   def xas_remove_state(state)
  4994.       @state_duration.delete(state.id)  
  4995.       @state_loop_effect_time.delete(state.id)  
  4996.       @state_loop_speed.delete(state.id)
  4997.       execute_damage_state(state,1)
  4998.   end  
  4999.  
  5000. #--------------------------------------------------------------------------
  5001. # ● Execute_Damage_State
  5002. #--------------------------------------------------------------------------           
  5003.   def execute_damage_state(state,type)
  5004.       return unless XAS_DAMAGE_POP::DAMAGE_STATE_POP
  5005.       return unless XAS_WORD::ENABLE_WORD
  5006.       return if state == nil or state.id == 1
  5007.       case type
  5008.          when 0
  5009.              damage = "+ " + state.name.to_s
  5010.          when 1  
  5011.              damage = "- " + state.name.to_s
  5012.       end
  5013.       @state_string = damage
  5014.       @state_string_time = 30            
  5015.   end  
  5016.  
  5017. end
  5018.  
  5019. #==============================================================================
  5020. # ■ Game_Character
  5021. #==============================================================================
  5022. class Game_Character < Game_CharacterBase
  5023.  
  5024. #--------------------------------------------------------------------------
  5025. # ● Update Battler States Effect
  5026. #--------------------------------------------------------------------------   
  5027. def update_battler_states_effect
  5028.      return unless XAS_SYSTEM::STATE_SYSTEM
  5029.      update_state_string_pop
  5030.      update_pre_state_setup
  5031.      return unless can_update_states_effect?
  5032.      for i in self.battler.states
  5033.          state = $data_states[i.id]  
  5034.          if state == nil or self.battler.state_duration[state.id] == nil or
  5035.             self.battler.state_loop_effect_time[state.id] == nil or
  5036.             self.battler.state_loop_speed[state.id] == nil
  5037.             self.battler.remove_state(state.id)
  5038.             next
  5039.             return
  5040.          end  
  5041.          update_state_abs_effects(state)
  5042.          update_state_loop(state)
  5043.          update_remove_state(state)
  5044.      end  
  5045.  
  5046. end  
  5047.  
  5048. #--------------------------------------------------------------------------
  5049. # ● Update Pre State Setup
  5050. #--------------------------------------------------------------------------      
  5051. def update_pre_state_setup
  5052.      self.battler.state_stop = false
  5053.      self.battler.state_slow = false
  5054.      self.battler.state_fast = false
  5055.      self.battler.state_mute = false
  5056.      self.battler.state_sleep = false
  5057.      self.battler.state_invunerable = false
  5058.      self.battler.state_seal_attack = false
  5059.      self.battler.state_seal_skill = false
  5060.      self.battler.state_seal_item = false
  5061.      self.battler.state_reflect = false
  5062.      self.battler.state_move_speed = 0
  5063. end  
  5064.  
  5065. #--------------------------------------------------------------------------
  5066. # ● Update Pre State Setup
  5067. #--------------------------------------------------------------------------        
  5068. def update_state_abs_effects(state)
  5069.      if state.note =~ /<Stop>/ or state.note =~ /<停止>/
  5070.         self.battler.state_stop = true
  5071.      end
  5072.      if state.note =~ /<Slow>/ or state.note =~ /<减速>/
  5073.         self.battler.state_slow = true
  5074.         self.battler.state_move_speed = -1.5
  5075.      end   
  5076.      if state.note =~ /<Fast>/ or state.note =~ /<加速>/
  5077.         self.battler.state_fast = true
  5078.         self.battler.state_move_speed = 1     
  5079.      end
  5080.      if self.battler.state_fast and
  5081.         self.battler.state_slow
  5082.         self.battler.state_move_speed = 0
  5083.      end
  5084.      if state.note =~ /<Mute>/  or state.note =~ /<M沉默>/   
  5085.         self.battler.state_mute = true
  5086.      end
  5087.      if state.note =~ /<Sleep>/  or state.note =~ /<睡眠>/
  5088.         self.battler.state_sleep = true
  5089.      end
  5090.      if state.note =~ /<Invincible>/ or state.note =~ /<无敌>/   
  5091.         self.battler.state_invunerable = true
  5092.      end  
  5093.      if state.note =~ /<Seal Attack>/ or state.note =~ /<禁止攻击>/  
  5094.         self.battler.state_seal_attack = true
  5095.      end
  5096.      if state.note =~ /<Seal Skill>/   or state.note =~ /<禁止技能>/
  5097.         self.battler.state_seal_skill = true
  5098.      end      
  5099.      if state.note =~ /<Seal Item>/   or  state.note =~ /<禁止道具>/
  5100.         self.battler.state_seal_item = true
  5101.       end
  5102.      if state.note =~ /<Reflect>/ or  state.note =~ /<反射>/
  5103.         self.battler.state_reflect = true
  5104.      end         
  5105. end
  5106.  
  5107. #--------------------------------------------------------------------------
  5108. # ● Update State Loop
  5109. #--------------------------------------------------------------------------      
  5110. def update_state_loop(state)
  5111.      self.battler.state_loop_effect_time[state.id] += 1
  5112.      if self.battler.state_loop_effect_time[state.id] > self.battler.state_loop_speed[state.id]
  5113.         self.battler.state_loop_effect_time[state.id] = 0
  5114.         if state.note =~ /<Animation ID = (\d+)>/ or state.note =~ /<动画ID = (\d+)>/
  5115.            state_anime = $1.to_i
  5116.            if state_anime != nil
  5117.               self.animation_id = state_anime
  5118.            end
  5119.         end   
  5120.         execute_states_effects(state)         
  5121.      end         
  5122. end
  5123.  
  5124. #--------------------------------------------------------------------------
  5125. # ● Execute States Effect
  5126. #--------------------------------------------------------------------------      
  5127. def execute_states_effects(state)         
  5128.      if state.note =~ /<Slip Damage = (\S+)>/ or state.note =~ /<持续伤害 = (\S+)>/
  5129.         execute_state_slip_damage($1.to_i)
  5130.      end  
  5131. end
  5132.  
  5133. #--------------------------------------------------------------------------
  5134. # ● Execute States Slip Damage
  5135. #--------------------------------------------------------------------------        
  5136. def execute_state_slip_damage(damage)
  5137.      damage = 1 if damage == nil
  5138.      damage_slip = self.battler.mhp * damage / 100
  5139.      self.battler.hp -= damage_slip
  5140.      self.battler.damage = damage_slip
  5141.      self.battler.damage_pop = true
  5142. end
  5143.  
  5144. #--------------------------------------------------------------------------
  5145. # ● Update Remove State
  5146. #--------------------------------------------------------------------------      
  5147. def update_remove_state(state)
  5148.      self.battler.state_duration[state.id] -= 1
  5149.      if self.battler.state_duration[state.id] <= 0     
  5150.         self.battler.remove_state(state.id)
  5151.      end         
  5152. end
  5153.  
  5154. #--------------------------------------------------------------------------
  5155. # ● Can Update States Effect
  5156. #--------------------------------------------------------------------------      
  5157.   def can_update_states_effect?
  5158.       return false if self.dead?
  5159.       return false if self.battler.states == nil
  5160.       return false if self.battler.states.size == 0
  5161.       return false if self.battler.state_duration == []
  5162.       return true
  5163.   end
  5164.  
  5165. #--------------------------------------------------------------------------
  5166. # ● Update State String Pop
  5167. #--------------------------------------------------------------------------      
  5168.   def update_state_string_pop
  5169.       return false if self.battler.state_string_time == 0
  5170.       self.battler.state_string_time -= 1
  5171.       if self.battler.state_string_time == 0
  5172.          self.battler.damage = self.battler.state_string
  5173.          self.battler.damage_pop = true
  5174.          self.battler.state_string = ""
  5175.       end  
  5176.   end  
  5177. end  
  5178.  
  5179. #==============================================================================
  5180. # ■ Game_Party
  5181. #==============================================================================
  5182. class Game_Party < Game_Unit
  5183.  
  5184. #--------------------------------------------------------------------------
  5185. # ● On Player Walk
  5186. #--------------------------------------------------------------------------        
  5187. alias x_state_on_player_walk on_player_walk
  5188. def on_player_walk
  5189.      return if XAS_SYSTEM::STATE_SYSTEM
  5190.      x_state_on_player_walk
  5191. end
  5192.  
  5193. end
  5194. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5195. #■ BATTLER - EVENT COMMANDS
  5196. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5197.  
  5198.  
  5199. #===============================================================================
  5200. # ■ Game Event
  5201. #===============================================================================
  5202. class Game_Event < Game_Character
  5203.  
  5204.   #--------------------------------------------------------------------------
  5205.   # ● Shoot Chance
  5206.   #--------------------------------------------------------------------------            
  5207.   def shoot_chance(action_id,perc)
  5208.       return if self.battler == nil
  5209.       if perc >= rand(100)
  5210.          shoot(action_id)
  5211.       end  
  5212.   end  
  5213.  
  5214.   #--------------------------------------------------------------------------
  5215.   # ● Guard
  5216.   #--------------------------------------------------------------------------         
  5217.   def guard(enable)
  5218.       return if self.battler == nil
  5219.       self.battler.guard = enable
  5220.   end  
  5221.  
  5222.   #--------------------------------------------------------------------------
  5223.   # ● Touch Attack
  5224.   #--------------------------------------------------------------------------            
  5225.   def touch_attack(enable)
  5226.       return if self.battler == nil        
  5227.       return if seal_attack?(self.battler)
  5228.       @collision_attack = enable
  5229.       @pattern = 0
  5230.       @pattern_count  = 0      
  5231.   end
  5232.  
  5233.   #--------------------------------------------------------------------------
  5234.   # ● Counter
  5235.   #--------------------------------------------------------------------------            
  5236.   def counter(enable)
  5237.       return if self.battler == nil
  5238.       self.battler.counter_action[2] = enable
  5239.   end   
  5240.  
  5241.   #--------------------------------------------------------------------------
  5242.   # ● Rand Shoot
  5243.   #--------------------------------------------------------------------------            
  5244.   def rand_shoot(random_id = [])
  5245.       return if self.battler == nil
  5246.       return if random_id == []
  5247.       action_id = random_id[rand(random_id.size)]
  5248.       self.shoot(action_id)
  5249.   end      
  5250.  
  5251. end
  5252. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5253. #■ BATTLER - DEFEAT PROCESS
  5254. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5255.  
  5256. #===============================================================================
  5257. # ■ Scene Base
  5258. #===============================================================================
  5259. class Scene_Base  
  5260.  
  5261.   #--------------------------------------------------------------------------
  5262.   # ● Check Gameover
  5263.   #--------------------------------------------------------------------------              
  5264.   def check_gameover
  5265.       return unless $game_party.in_battle  
  5266.       SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
  5267.   end
  5268. end  
  5269.  
  5270. #===============================================================================
  5271. # ■ Game Character
  5272. #===============================================================================
  5273. class Game_Character < Game_CharacterBase
  5274.   attr_accessor :collapse_duration
  5275.   attr_accessor :battler_visible
  5276.   attr_writer   :opacity
  5277.  
  5278.   #--------------------------------------------------------------------------
  5279.   # ● Initialize
  5280.   #--------------------------------------------------------------------------            
  5281.   alias x_collapse_initialize initialize
  5282.   def initialize
  5283.       @collapse_duration = 0
  5284.       x_collapse_initialize
  5285.   end  
  5286.  
  5287. end
  5288.  
  5289. #===============================================================================
  5290. # ■ XAS_BA_BATTLEEVENT_NONPREEMPT
  5291. #==============================================================================
  5292. module XAS_BA_BATTLEEVENT_NONPREEMPT
  5293.  
  5294.   #--------------------------------------------------------------------------
  5295.   # ● Update
  5296.   #--------------------------------------------------------------------------            
  5297.   def update
  5298.       return if self.battler != nil and $game_map.interpreter.running?
  5299.       super
  5300.   end
  5301. end
  5302.  
  5303. #===============================================================================
  5304. # ■ Game Event
  5305. #==============================================================================
  5306. class Game_Event < Game_Character
  5307.       include XAS_BA_BATTLEEVENT_NONPREEMPT
  5308. end
  5309.  
  5310. #===============================================================================
  5311. # ■ Game Character
  5312. #===============================================================================
  5313. class Game_Character < Game_CharacterBase
  5314.  
  5315.   #--------------------------------------------------------------------------
  5316.   # ● Update Battler Defeat Process
  5317.   #--------------------------------------------------------------------------      
  5318.    def update_battler_defeat_process
  5319.        execute_enemy_defeated_process if can_check_enemy_defeated?
  5320.        execute_actor_defeated_process if can_check_actor_defeated?
  5321.    end
  5322.  
  5323.   #--------------------------------------------------------------------------
  5324.   # ● Can Check Enemy Defeated?
  5325.   #--------------------------------------------------------------------------            
  5326.   def can_check_enemy_defeated?  
  5327.       return false if self.battler.is_a?(Game_Actor)
  5328.       return false if self.battler.defeated
  5329.       return true
  5330.   end     
  5331.  
  5332.   #--------------------------------------------------------------------------
  5333.   # ● Can Check Actor Defeated?
  5334.   #--------------------------------------------------------------------------              
  5335.   def can_check_actor_defeated?
  5336.       return false if self.battler.is_a?(Game_Enemy)
  5337.       return false if self.battler.defeated
  5338.       return false if $game_party.members[0].hp > 0
  5339.       return false if @collapse_duration > 0
  5340.       return true  
  5341.   end
  5342.  
  5343.   #--------------------------------------------------------------------------
  5344.   # ● Execute Actor Defeated Process
  5345.   #--------------------------------------------------------------------------               
  5346.   def execute_actor_defeated_process
  5347.       erase_actor_tools_on_map
  5348.       if $game_party.all_dead? and not self.battler.defeated
  5349.          self.battler.defeated = true
  5350.          self.collapse_duration = 120
  5351.          self.knock_back_duration = 161
  5352.          reset_battler_temp
  5353.       else   
  5354.          $game_temp.change_leader_wait_time = 0
  5355.          $game_player.change_leader
  5356.       end  
  5357.   end
  5358.  
  5359.   #--------------------------------------------------------------------------
  5360.   # ● Erase Tools on Map
  5361.   #--------------------------------------------------------------------------                  
  5362.   def erase_actor_tools_on_map
  5363.       for event in $game_map.events.values
  5364.           if event.tool_id > 0 and event.action.user.is_a?(Game_Player)
  5365.              event.erase
  5366.           end   
  5367.       end  
  5368.   end
  5369.  
  5370.   #--------------------------------------------------------------------------
  5371.   # ● Execute Enemy Defeaed Process
  5372.   #--------------------------------------------------------------------------         
  5373.    def execute_enemy_defeated_process
  5374.        self.battler.defeated = true
  5375.        self.through = true
  5376.        @knock_back_duration = 121
  5377.        enemy = $data_enemies[self.battler.enemy_id]
  5378.        @collapse_duration = 120
  5379.        execute_gain_exp_gold(enemy)  
  5380.        execute_active_switch(enemy)
  5381.        execute_defeated_animation(enemy)
  5382.        execute_defeated_sound_effect(enemy)
  5383.        execute_final_shoot(enemy)
  5384.    end   
  5385.  
  5386.   #--------------------------------------------------------------------------
  5387.   # ● Execute Defeated Sound Effect
  5388.   #--------------------------------------------------------------------------              
  5389.   def execute_defeated_sound_effect(enemy)
  5390.       return if self.battler.no_damage_pop
  5391.       Sound.play_enemy_collapse   
  5392.   end
  5393.  
  5394.   #--------------------------------------------------------------------------
  5395.   # ● Execute Final Shoot
  5396.   #--------------------------------------------------------------------------            
  5397.   def execute_final_shoot(enemy)
  5398.      if enemy.note  =~ /<Final Action ID = (\d+)>/  
  5399.        enemy.note  =~ /<Final Action ID = (\d+)>/   
  5400.       elsif enemy.note  =~ /<最终攻击ID = (\d+)>/
  5401.        enemy.note  =~ /<最终攻击ID = (\d+)>/
  5402.       end
  5403.       action_id = $1.to_i
  5404.       return if action_id == nil
  5405.       self.shoot(action_id)      
  5406.   end  
  5407.  
  5408.   #--------------------------------------------------------------------------
  5409.   # ● Execute Gain Exp Gold
  5410.   #--------------------------------------------------------------------------           
  5411.   def execute_gain_exp_gold(enemy)  
  5412.       exp = self.battler.exp
  5413.       case XAS_BA::EXP_TYPE
  5414.          when 0
  5415.             actor = $game_party.members[0]
  5416.             actor.gain_exp(exp)
  5417.          when 1
  5418.             for i in 0...$game_party.members.size
  5419.                actor = $game_party.members[i]           
  5420.                actor.gain_exp(exp)
  5421.             end   
  5422.          when 2  
  5423.             exp = exp / $game_party.members.size
  5424.             for i in 0...$game_party.members.size
  5425.                actor = $game_party.members[i]           
  5426.                actor.gain_exp(exp)
  5427.             end              
  5428.       end
  5429.       $game_party.gain_gold(self.battler.gold)
  5430.   end  
  5431.  
  5432.   #--------------------------------------------------------------------------
  5433.   # ● Execute_Active Switch
  5434.   #--------------------------------------------------------------------------           
  5435.   def execute_active_switch(enemy)
  5436.     if enemy.note  =~ /<Active Switch = (\d+)>/
  5437.         enemy.note  =~ /<Active Switch = (\d+)>/
  5438.       elsif  enemy.note  =~ /<激活开关 = (\d+)>/
  5439.         enemy.note  =~ /<激活开关 = (\d+)>/      
  5440.       end
  5441.     switch_id = $1.to_i  
  5442.       if switch_id != nil
  5443.          $game_switches[switch_id] = true
  5444.          $game_map.need_refresh = true     
  5445.       end
  5446.   end
  5447.  
  5448.   #--------------------------------------------------------------------------
  5449.   # ● Execute Defeated Animation
  5450.   #--------------------------------------------------------------------------            
  5451.   def execute_defeated_animation(enemy)
  5452.      if enemy.note  =~ /<Defeated Animation = (\d+)>/
  5453.          enemy.note  =~ /<Defeated Animation = (\d+)>/      
  5454.         elsif enemy.note  =~ /<死亡动画 = (\d+)>/
  5455.          enemy.note  =~ /<死亡动画 = (\d+)>/
  5456.         end
  5457.         anime_id = $1.to_i
  5458.      if anime_id != nil
  5459.          self.animation_id = anime_id
  5460.       end  
  5461.   end  
  5462.  
  5463. end   
  5464.  
  5465. #===============================================================================
  5466. # ■ Game Player
  5467. #===============================================================================
  5468. class Game_Player < Game_Character
  5469.  
  5470.   #--------------------------------------------------------------------------
  5471.   # ● Reset Old Level
  5472.   #--------------------------------------------------------------------------            
  5473.   def reset_old_level(trans = false)
  5474.      for actor in $game_party.members
  5475.          actor.old_level = actor.level
  5476.      end   
  5477.   end
  5478.  
  5479.   #--------------------------------------------------------------------------
  5480.   # ● Change Leader
  5481.   #--------------------------------------------------------------------------                  
  5482.   def change_leader
  5483.       return if $game_party.members.size <= 1
  5484.       reset_battler_temp
  5485.       current_leader_id = $game_party.members[0].id
  5486.       for i in 1..$game_party.members.size
  5487.           pre_leader = $game_party.members[0].id
  5488.           $game_party.remove_actor(pre_leader)
  5489.           $game_party.add_actor(pre_leader)  
  5490.           if $game_party.members[0].hp > 0
  5491.              execute_change_leader_effect unless current_leader_id == $game_party.members[0].id
  5492.              break
  5493.           end
  5494.       end
  5495.   end   
  5496.  
  5497.   #--------------------------------------------------------------------------
  5498.   # ● Exeute Change leader Effect
  5499.   #--------------------------------------------------------------------------                    
  5500.   def execute_change_leader_effect
  5501.       actor = $game_party.members[0]
  5502.       actor.invunerable_duration = XAS_BA::CHANGE_LEADER_WAIT_TIME
  5503.       actor.damage = nil
  5504.       actor.damage_pop = false
  5505.       actor.critical = false
  5506.       @knock_back_duration = nil
  5507.       if self.action != nil
  5508.          self.action.duration = 1
  5509.       end
  5510.       @force_action_times = 0
  5511.       @force_action_type = ""         
  5512.       reset_old_level(true)
  5513.       @x_pose_original_name = @character_name
  5514.       update_battler_pose
  5515.       $game_map.need_refresh = true
  5516.       self.animation_id = XAS_ANIMATION::CHANGE_LEADER_ANIMATION_ID
  5517.       $game_temp.change_leader_wait_time = XAS_BA::CHANGE_LEADER_WAIT_TIME  
  5518.   end
  5519.  
  5520.   #--------------------------------------------------------------------------
  5521.   # ● Check Actor Level
  5522.   #--------------------------------------------------------------------------           
  5523.   def check_actor_level
  5524.       return if $game_party.in_battle
  5525.       return if self.battler == nil
  5526.       return if self.battler.old_level == self.battler.level
  5527.       reset_old_level(false)
  5528.       if self.battler.level > 1
  5529.          Audio.se_play("Audio/SE/" + XAS_SOUND::LEVEL_UP , 100, 100)
  5530.          if XAS_WORD::ENABLE_WORD
  5531.             $game_player.battler.damage = XAS_WORD::LEVEL_UP
  5532.             $game_player.battler.damage_pop = true
  5533.          end
  5534.       end
  5535.       $game_player.need_refresh = true
  5536.   end
  5537. end   
  5538.  
  5539. #===============================================================================
  5540. # ■ Game Party
  5541. #===============================================================================
  5542. class Game_Party < Game_Unit
  5543.  
  5544. #--------------------------------------------------------------------------
  5545. # ● Setup Starting Members  
  5546. #--------------------------------------------------------------------------      
  5547.   alias x_old_level_setup_starting_members setup_starting_members  
  5548.   def setup_starting_members  
  5549.       x_old_level_setup_starting_members   
  5550.       for actor in $game_party.members
  5551.           actor.old_level = actor.level
  5552.       end
  5553.   end
  5554.  
  5555. end
  5556.  
  5557. #===============================================================================
  5558. # ■ Sprite Character
  5559. #==============================================================================
  5560. class Sprite_Character < Sprite_Base  
  5561.  
  5562.   #--------------------------------------------------------------------------
  5563.   # ● Update Collapse Effects
  5564.   #--------------------------------------------------------------------------            
  5565.   def update_collaspse_effects
  5566.       update_collapse_duration
  5567.       return unless can_collapse_effects?
  5568.       update_collpase_zoom_effects
  5569.       update_exp_gold_pop
  5570.   end
  5571.  
  5572.   #--------------------------------------------------------------------------
  5573.   # ● Can Collapse Effects
  5574.   #--------------------------------------------------------------------------              
  5575.   def can_collapse_effects?
  5576.       return false if @character.battler.is_a?(Game_Actor)
  5577.       return false unless @character.dead?
  5578.       return false if @character.erased   
  5579.       return true
  5580.   end  
  5581.  
  5582.   #--------------------------------------------------------------------------
  5583.   # ● Update Exp Gold Pop
  5584.   #--------------------------------------------------------------------------              
  5585.   def update_exp_gold_pop
  5586.       return unless XAS_DAMAGE_POP::DAMAGE_EXP_GOLD_POP
  5587.       exp_pop = @character.battler.exp
  5588.       gold_pop =@character.battler.gold
  5589.       case @character.collapse_duration
  5590.            when 110
  5591.                 enemy = $data_enemies[@character.battler.enemy_id]
  5592.                 @character.make_treasure(enemy)      
  5593.            when 80
  5594.              if exp_pop != 0
  5595.                 word = XAS_WORD::EXP
  5596.                 @character.battler.damage = word + " " + exp_pop.to_s
  5597.                 @character.battler.damage_pop = true
  5598.                 @character.battler.damage_type = "Exp"
  5599.              end  
  5600.            when 40
  5601.              if gold_pop != 0
  5602.                 word = $data_system.currency_unit
  5603.                 @character.battler.damage = word + " " + gold_pop.to_s
  5604.                 @character.battler.damage_pop = true
  5605.                 @character.battler.damage_type = "Gold"
  5606.              end               
  5607.       end      
  5608.   end
  5609.  
  5610.   #--------------------------------------------------------------------------
  5611.   # ● Update Collapse Duration
  5612.   #--------------------------------------------------------------------------              
  5613.   def update_collapse_duration
  5614.       @character.collapse_duration -= 1
  5615.       @character.opacity -= 2
  5616.       if @character.collapse_duration <= 0
  5617.          if @character.battler.is_a?(Game_Actor)
  5618.             SceneManager.goto(Scene_Gameover)
  5619.             return
  5620.          end
  5621.          self.visible = false
  5622.          @character.opacity = 0
  5623.          @character.erase
  5624.       end  
  5625.   end  
  5626.  
  5627.   #--------------------------------------------------------------------------
  5628.   # ● Update Collapse Zoom Effects
  5629.   #--------------------------------------------------------------------------               
  5630.   def update_collpase_zoom_effects
  5631.       case @character.battler.death_zoom_effect
  5632.           when 1
  5633.              @character.zoom_y += 0.05
  5634.              @character.zoom_x -= 0.01            
  5635.           when 2  
  5636.              @character.zoom_y -= 0.01
  5637.              @character.zoom_x += 0.03            
  5638.           when 3  
  5639.              @character.zoom_y += 0.03
  5640.              @character.zoom_x += 0.03              
  5641.           when 4   
  5642.              @character.zoom_y -= 0.005
  5643.              @character.zoom_x -= 0.005
  5644.           when 5   
  5645.             case @character.collapse_duration
  5646.                 when 60..120
  5647.                  @character.zoom_y -= 0.01
  5648.                  @character.zoom_x += 0.06                             
  5649.                 when 0..59  
  5650.                  @character.zoom_y += 0.2
  5651.                  @character.zoom_x -= 0.1
  5652.              end
  5653.       end
  5654.   end  
  5655.  
  5656. end
  5657. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5658. #■ BATTLER - TREASURE
  5659. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5660.  
  5661.  
  5662. #===============================================================================
  5663. # ■ XAS_BA_Item_Drop
  5664. #==============================================================================
  5665. module XAS_BA_ItemDrop
  5666.  
  5667.   #--------------------------------------------------------------------------
  5668.   # ● Defeat Process
  5669.   #--------------------------------------------------------------------------               
  5670.   def make_treasure(enemy)  
  5671.       treasure = nil      
  5672.       return unless $game_player.passable?(self.x,self.y,0)
  5673.       for di in enemy.drop_items
  5674.            next if di.kind == 0
  5675.            next if rand(di.denominator) != 0
  5676.            if di.kind == 1
  5677.               treasure = $data_items[di.data_id]
  5678.               tr_id = treasure.id
  5679.            elsif di.kind == 2
  5680.               treasure = $data_weapons[di.data_id]
  5681.               tr_id = treasure.id
  5682.            elsif di.kind == 3
  5683.               treasure = $data_armors[di.data_id]
  5684.               tr_id = treasure.id
  5685.            end
  5686.            break if treasure != nil
  5687.        end   
  5688.        if treasure != nil
  5689.           command = RPG::MoveCommand.new
  5690.           command.code = 14
  5691.           command.parameters = [0,0]
  5692.           route = RPG::MoveRoute.new
  5693.           route.repeat = false
  5694.           route.list = [command, RPG::MoveCommand.new]         
  5695.           page = RPG::Event::Page.new
  5696.           page.move_type = 3
  5697.           page.move_route = route
  5698.           page.move_frequency = 6
  5699.           page.priority_type = 1
  5700.           page.trigger = 1
  5701.           page.through = true
  5702.           event = RPG::Event.new(self.x, self.y)
  5703.           event.pages = [ page ]
  5704.           event = RPG::Event.new(self.x, self.y)
  5705.           token = Token_Event.new($game_map.map_id, event)
  5706.           token.icon_name = treasure.icon_index
  5707.           token.treasure = [di.kind,tr_id]
  5708.           token.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  5709.           token.jump_high(0,0,20)
  5710.           token.force_update = true
  5711.           token.move_speed = 6
  5712.           $game_map.add_token(token)
  5713.        end  
  5714.   end  
  5715. end
  5716.  
  5717. #===============================================================================
  5718. # ■ Game Event
  5719. #===============================================================================
  5720. class Game_Event < Game_Character
  5721.   include XAS_BA_ItemDrop
  5722.  
  5723.   #--------------------------------------------------------------------------
  5724.   # ● Update Treasure Duration
  5725.   #--------------------------------------------------------------------------               
  5726.   def update_treasure_duration
  5727.       return if @treasure_time == 0
  5728.       @treasure_time -= 1
  5729.       self.erase if @treasure_time == 0
  5730.   end
  5731.  
  5732. end
  5733.  
  5734. #===============================================================================
  5735. # ■ Game Character
  5736. #==============================================================================
  5737. class Game_Character < Game_CharacterBase
  5738.   attr_accessor :icon_name
  5739.   attr_accessor :treasure
  5740. end
  5741.  
  5742. #===============================================================================
  5743. # ■ Game Character
  5744. #==============================================================================
  5745. class Sprite_Character < Sprite_Base
  5746.  
  5747.   #--------------------------------------------------------------------------
  5748.   # ● Update
  5749.   #--------------------------------------------------------------------------            
  5750.   alias xrxs_charactericon_update update
  5751.   def update
  5752.       xrxs_charactericon_update
  5753.       if @character.icon_name != nil
  5754.          self.bitmap = Cache.system("Iconset")
  5755.          self.src_rect.set(@character.icon_name  % 16 * 24, @character.icon_name / 16 * 24, 24, 24)
  5756.          self.ox = 12
  5757.          self.oy = 24
  5758.       end
  5759.   end
  5760. end
  5761.  
  5762. #===============================================================================
  5763. # ■ Game Player
  5764. #==============================================================================
  5765. class Game_Player < Game_Character
  5766.  
  5767.   #--------------------------------------------------------------------------
  5768.   # ● Check Event Trigger Here
  5769.   #--------------------------------------------------------------------------               
  5770.   alias treasure_check_event_trigger_here check_event_trigger_here
  5771.   def check_event_trigger_here(triggers)
  5772.       return false if $game_map.interpreter.running?
  5773.       check_treasure_here         
  5774.       treasure_check_event_trigger_here(triggers)
  5775.   end  
  5776.  
  5777.   #--------------------------------------------------------------------------
  5778.   # ● check_treasure_here   
  5779.   #--------------------------------------------------------------------------                 
  5780.   def check_treasure_here   
  5781.      for event in $game_map.events_xy(@x, @y)
  5782.          if event.treasure != nil
  5783.             name_pop = true
  5784.             case event.treasure[0]            
  5785.             when 1
  5786.                   item = $data_items[event.treasure[1]]
  5787.                   if can_execute_field_item_effect?(item)
  5788.                      name_pop = false
  5789.                   else  
  5790.                      $game_party.gain_item(item, 1)
  5791.                   end
  5792.                   $game_map.need_refresh = true
  5793.             when 2  
  5794.                   item = $data_weapons[event.treasure[1]]
  5795.                   $game_party.gain_item($data_weapons[event.treasure[1]], 1,false)
  5796.             when 3
  5797.                   item = $data_armors[event.treasure[1]]
  5798.                   $game_party.gain_item(item, 1,false)
  5799.             end
  5800.             Audio.se_play("Audio/SE/" + XAS_SOUND::ITEM_DROP , 100, 100)   
  5801.             event.erase
  5802.             if item != nil
  5803.                 if item.note =~ /<Drop Animation = (\d+)>/ or item.note =~ /<掉落动画 = (\d+)>/
  5804.                    self.animation_id = $1.to_i
  5805.                 end
  5806.                 if XAS_DAMAGE_POP::DAMAGE_ITEM_POP and name_pop
  5807.                    self.battler.damage = item.name.to_s
  5808.                    self.battler.damage_pop = true
  5809.                    self.battler.damage_type = "Item"
  5810.                 end                       
  5811.             end
  5812.           end            
  5813.      end   
  5814. end           
  5815.  
  5816.   #--------------------------------------------------------------------------
  5817.   # ● Can Execute Field Item Effect
  5818.   #--------------------------------------------------------------------------                  
  5819.   def can_execute_field_item_effect?(item)
  5820.       if item.note =~ /<Drop HP Damage = (\S+)>/ or item.note =~ /<HP伤害 = (\S+)>/
  5821.          damage = $1.to_i
  5822.          damage2 = damage * self.battler.mhp / 100
  5823.          self.battler.damage = damage2
  5824.          self.battler.damage_pop = true
  5825.          self.battler.hp -= damage2
  5826.          return true
  5827.       end  
  5828.       if item.note =~ /<Drop MP Damage = (\S+)>/ or item.note =~ /<MP伤害 = (\S+)>/
  5829.          damage = $1.to_i
  5830.          damage2 = damage * self.battler.mmp / 100
  5831.          self.battler.mp -= damage2         
  5832.          self.battler.damage_type = "Mp"   
  5833.          self.battler.damage = damage2
  5834.          self.battler.damage_pop = true
  5835.          return true
  5836.       end      
  5837.       if item.note =~ /<Drop Gold = (\d+)>/ or item.note =~ /<掉落金币 = (\d+)>/
  5838.          gold = $1.to_i
  5839.          damage = $data_system.terms.gold + " " + gold.to_s
  5840.          self.battler.damage = damage
  5841.          self.battler.damage_pop = true
  5842.          $game_party.gain_gold(gold)
  5843.          return true
  5844.       end
  5845.       return false  
  5846.   end  
  5847. end
  5848.  
  5849.  
  5850. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5851. #■ SPRITE - POSE (Character Name)
  5852. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5853.  
  5854.  
  5855. #===============================================================================
  5856. # ■ Game_Character
  5857. #===============================================================================
  5858. class Game_Character < Game_CharacterBase
  5859.  
  5860.   attr_accessor :x_pose_duration
  5861.   attr_accessor :x_pose_name
  5862.   attr_accessor :x_pose_original_name
  5863.   attr_accessor :character_name
  5864.  
  5865.   #-----------------------------------------------------------------------------
  5866.   # ● Initialize
  5867.   #-----------------------------------------------------------------------------  
  5868.   alias x_pose_initialize initialize
  5869.   def initialize
  5870.       x_pose_initialize
  5871.       @x_pose_duration = 0
  5872.       @x_pose_name = ""
  5873.       @x_pose_original_name = @character_name
  5874.   end
  5875.  
  5876.   #-----------------------------------------------------------------------------
  5877.   # ● Update
  5878.   #-----------------------------------------------------------------------------   
  5879.   def make_pose(sufix, pose_duration)
  5880.       return if @x_pose_original_name == ""
  5881.       @x_pose_name = sufix
  5882.       @x_pose_duration = pose_duration         
  5883.   end     
  5884.  
  5885.   #-----------------------------------------------------------------------------
  5886.   # ● Update Pose
  5887.   #-----------------------------------------------------------------------------   
  5888.   def update_battler_pose
  5889.       return false unless XAS_SYSTEM::CHARACTER_POSE_NAME
  5890.       if @x_pose_duration == 0
  5891.          @x_pose_original_name = @character_name
  5892.          return
  5893.       else     
  5894.          @x_pose_duration -= 1
  5895.          @character_name = @x_pose_original_name + @x_pose_name
  5896.          if @x_pose_duration == 0
  5897.             @character_name = @x_pose_original_name
  5898.             @x_pose_name = ""
  5899.          end
  5900.       end
  5901.       unless jumping?
  5902.          @jump_count = 0
  5903.          @jump_peak = 0
  5904.       end      
  5905.   end
  5906.  
  5907.   #-----------------------------------------------------------------------------
  5908.   # ● Set Graphic
  5909.   #-----------------------------------------------------------------------------      
  5910.   alias x_pose_set_graphic set_graphic
  5911.   def set_graphic(character_name, character_index)
  5912.       x_pose_set_graphic(character_name, character_index)
  5913.       @x_pose_original_name = @character_name
  5914.       @x_pose_duration = 0
  5915.       @x_pose_name = ""      
  5916.   end   
  5917.  
  5918. end
  5919.  
  5920.  
  5921. #===============================================================================
  5922. # ■ Game_Interpreter
  5923. #===============================================================================
  5924. class Game_Interpreter
  5925.  
  5926.   #-----------------------------------------------------------------------------
  5927.   # ● Command_322
  5928.   #-----------------------------------------------------------------------------   
  5929.   alias x_pose_command_322 command_322
  5930.   def command_322
  5931.       x_pose_command_322
  5932.       actor = $game_actors[@params[0]]
  5933.       if actor != nil
  5934.          $game_player.x_pose_duration = 0
  5935.          $game_player.x_pose_original_name =  @params[1]
  5936.       end
  5937.   end
  5938.  
  5939. end  
  5940.  
  5941. #===============================================================================
  5942. # ■ RPG_FileTest
  5943. #===============================================================================
  5944. module RPG_FileTest
  5945.  
  5946.   #--------------------------------------------------------------------------
  5947.   # ● RPG_FileTest.character_exist?
  5948.   #--------------------------------------------------------------------------
  5949.   def RPG_FileTest.character_exist?(filename)
  5950.       return Cache.character(filename) rescue return false
  5951.   end
  5952.  
  5953.   #--------------------------------------------------------------------------
  5954.   # ● RPG_FileTest.system_exist?
  5955.   #--------------------------------------------------------------------------
  5956.   def RPG_FileTest.system_exist?(filename)
  5957.       return Cache.system(filename) rescue return false
  5958.   end  
  5959.  
  5960. end
  5961.  
  5962. #===============================================================================
  5963. # ■ Sprite_Character
  5964. #===============================================================================
  5965. class Sprite_Character < Sprite_Base
  5966.  
  5967.   #--------------------------------------------------------------------------
  5968.   # ● X Pose Update
  5969.   #--------------------------------------------------------------------------  
  5970.   alias x_pose_update_bitmap update_bitmap
  5971.   def update_bitmap
  5972.       check_file_exist
  5973.       x_pose_update_bitmap
  5974.   end
  5975.  
  5976. #--------------------------------------------------------------------------
  5977. # ● Check File Exist
  5978. #--------------------------------------------------------------------------  
  5979. def check_file_exist
  5980.      return if @character_name == @character.character_name
  5981.      unless RPG_FileTest.character_exist?(@character.character_name)
  5982.             @character.character_name = @character.x_pose_original_name   
  5983.             @character.x_pose_duration = 0
  5984.             @character.x_pose_name = ""
  5985.      end         
  5986. end  
  5987.  
  5988. end
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5995. #■ SPRITE - DAMAGE SPRITE
  5996. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5997.  
  5998.  
  5999. #===============================================================================
  6000. # ■  XRXS_DAMAGE_OFFSET
  6001. #===============================================================================
  6002. module XRXS_DAMAGE_OFFSET
  6003.  
  6004.   #--------------------------------------------------------------------------
  6005.   # ● Update
  6006.   #--------------------------------------------------------------------------              
  6007.   def update
  6008.       super
  6009.       @damage_sprites   = [] if @damage_sprites.nil?
  6010.       for damage_sprite in @damage_sprites
  6011.           damage_sprite.x = self.x
  6012.           damage_sprite.y = self.y
  6013.       end
  6014.   end
  6015. end
  6016.  
  6017. #===============================================================================
  6018. # ■ Sprite_Character
  6019. #===============================================================================
  6020. class Sprite_Character < Sprite_Base
  6021.       include XRXS_DAMAGE_OFFSET
  6022. end
  6023.  
  6024.  
  6025. #==============================================================================
  6026. # ■ Sprite Base
  6027. #==============================================================================
  6028. class Sprite_Base < Sprite
  6029.   include XAS_DAMAGE_POP
  6030.   #--------------------------------------------------------------------------
  6031.   # ● Initialize
  6032.   #--------------------------------------------------------------------------   
  6033.   alias x_damage_pop_initialize initialize
  6034.   def initialize(viewport = nil)      
  6035.       @_damage_duration = 0
  6036.       x_damage_pop_initialize(viewport)
  6037.   end
  6038.  
  6039.   #--------------------------------------------------------------------------
  6040.   # ● Damage
  6041.   #--------------------------------------------------------------------------     
  6042.   def damage(value, type = "")
  6043.       dispose_damage
  6044.       @damage_ox = 0
  6045.       @damage_type = type
  6046.       # NUMBER PICTURE
  6047.       if value.is_a?(Numeric)
  6048.          bitmap_number_image = Cache.system("XAS_Damage_Number")
  6049.          bitmap_im_cw = bitmap_number_image.width / 10
  6050.          bitmap_im_ch = bitmap_number_image.height / 5           
  6051.          bitmap = Bitmap.new(bitmap_number_image.width,(bitmap_im_ch * 2) + 5)
  6052.          bitmap_number_text = value.to_s.split(//)
  6053.          center_x = (((2 + bitmap_number_text.size) * bitmap_im_cw) / 2)
  6054.          # Damage Color         
  6055.          if value >= 0
  6056.             if @damage_type == "Critical"
  6057.                h = bitmap_im_ch * 2  
  6058.                h2 = bitmap_im_ch * 4
  6059.                $game_map.screen.start_shake(5, 5, 60)
  6060.             elsif @damage_type == "Mp"   
  6061.                h = bitmap_im_ch * 0  
  6062.                h2 = bitmap_im_ch * 3
  6063.             else
  6064.                h = 0
  6065.             end
  6066.             f = 0
  6067.           else # Recover Color   
  6068.             h = bitmap_im_ch  
  6069.             h2 = bitmap_im_ch * 3 if @damage_type == "Mp"     
  6070.             f = 1
  6071.         end   
  6072.         for r in f..bitmap_number_text.size - 1
  6073.             bitmap_number_abs = bitmap_number_text[r].to_i
  6074.             bitmap_src_rect = Rect.new(bitmap_im_cw * bitmap_number_abs, h, bitmap_im_cw, bitmap_im_ch)
  6075.             bitmap.blt(center_x + (bitmap_im_cw  *  r), bitmap_im_ch + 5, bitmap_number_image, bitmap_src_rect)                  
  6076.         end
  6077.         ex = (bitmap_im_cw / 2) * (bitmap_number_text.size + f)
  6078.         @damage_ox = (bitmap_number_image.width - (bitmap_number_image.width / 2) - ex) - center_x
  6079.         # Add Extra String (MP / Critical)
  6080.         if h2 != nil
  6081.            string_x = (center_x - (bitmap_number_image.width / 2) + (bitmap_im_cw / 2) * bitmap_number_text.size)
  6082.            bitmap_src_rect = Rect.new(0, h2,  bitmap_number_image.width, bitmap_im_ch)
  6083.            bitmap.blt(string_x , 0, bitmap_number_image, bitmap_src_rect)   
  6084.         end        
  6085.         bitmap_number_image.dispose  
  6086.       else
  6087.           #TEXT STRING
  6088.           damage_string = value.to_s
  6089.           bitmap = Bitmap.new(160, 48)
  6090.           bitmap.font.name = DAMAGE_FONT_NAME
  6091.           bitmap.font.size = DAMAGE_FONT_SIZE
  6092.           bitmap.font.bold = DAMAGE_FONT_BOLD
  6093.           bitmap.font.italic = DAMAGE_FONT_ITALIC
  6094.           bitmap.font.color = Color.new(0,0,0)
  6095.           bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  6096.           case @damage_type
  6097.                when "Exp";   string_color = DAMAGE_EXP_FONT_COLOR
  6098.                when "Gold";  string_color = DAMAGE_GOLD_FONT_COLOR
  6099.                when "Item";  string_color = DAMAGE_ITEM_FONT_COLOR
  6100.           else
  6101.              string_color = DAMAGE_DEFAULT_FONT_COLOR
  6102.           end
  6103.           bitmap.font.color = string_color
  6104.           bitmap.draw_text(0, 12, 160, 36, damage_string, 1)              
  6105.       end
  6106.        @_damage_sprite = ::Sprite.new(self.viewport)
  6107.        @_damage_sprite.bitmap = bitmap
  6108.        @_damage_sprite.ox = 80
  6109.        @_damage_sprite.oy = 20
  6110.        @_damage_sprite.x = self.x + @damage_ox
  6111.        @_damage_sprite.y = self.y - self.oy / 2
  6112.        @_damage_sprite.z = 3000
  6113.        @_damage_duration = 60
  6114.    end
  6115.  
  6116.   #--------------------------------------------------------------------------
  6117.   # ● Dispose Damage
  6118.   #--------------------------------------------------------------------------      
  6119.   def dispose_damage
  6120.       if @_damage_sprite != nil
  6121.          @_damage_sprite.bitmap.dispose
  6122.          @_damage_sprite.dispose
  6123.          @_damage_sprite = nil
  6124.          @_damage_duration = 0
  6125.       end
  6126.   end
  6127.  
  6128.   #--------------------------------------------------------------------------
  6129.   # ● Dispose
  6130.   #--------------------------------------------------------------------------         
  6131.   alias x_damage_dispose dispose
  6132.   def dispose
  6133.       dispose_damage
  6134.       x_damage_dispose
  6135.   end
  6136.  
  6137.   #--------------------------------------------------------------------------
  6138.   # ● Update
  6139.   #--------------------------------------------------------------------------           
  6140.   alias x_damage_pop_update update
  6141.   def update
  6142.       if @_damage_duration > 0
  6143.          @_damage_duration -= 1
  6144.          if @_damage_duration == 0
  6145.             dispose_damage
  6146.          end
  6147.        end      
  6148.        x_damage_pop_update
  6149.   end   
  6150.  
  6151. end  
  6152.  
  6153. #===============================================================================
  6154. # ■ XRXS DAMAGE
  6155. #===============================================================================
  6156. module XRXS_DAMAGE
  6157.  
  6158.   #--------------------------------------------------------------------------
  6159.   # ● Damage X Init Velocity
  6160.   #--------------------------------------------------------------------------                             
  6161.   def damage_x_init_velocity
  6162.       return 0.2 * (rand(5) - 2)
  6163.   end
  6164.  
  6165.   #--------------------------------------------------------------------------
  6166.   # ● Damage Y Init Velocity
  6167.   #--------------------------------------------------------------------------                             
  6168.   def damage_y_init_velocity
  6169.       return 9
  6170.   end
  6171.  
  6172.   #--------------------------------------------------------------------------
  6173.   # ● Update
  6174.   #--------------------------------------------------------------------------                              
  6175.   def update
  6176.     super
  6177.     @damage_sprites   = [] if @damage_sprites.nil?
  6178.     @damage_durations = [] if @damage_durations.nil?
  6179.     if @_damage_sprite != nil and @_damage_sprite.visible
  6180.        if @damage_ox != nil
  6181.           dam_ox = @damage_ox
  6182.        else   
  6183.           dam_ox = 0
  6184.        end        
  6185.        if @damage_type != nil
  6186.           dam_type = @damage_type
  6187.        end  
  6188.        x = damage_x_init_velocity
  6189.        y = damage_y_init_velocity
  6190.        d = @_damage_duration
  6191.        @damage_sprites.push(Sprite_Damage.new(@_damage_sprite, x, y, d,dam_ox,dam_type))
  6192.        @_damage_sprite.visible = false
  6193.     end
  6194.     for damage_sprite in @damage_sprites
  6195.         damage_sprite.update
  6196.     end
  6197.     for i in 0...@damage_sprites.size
  6198.         @damage_sprites[i] = nil if @damage_sprites[i].disposed?
  6199.     end
  6200.     @damage_sprites.compact!
  6201.   end
  6202.   def dispose
  6203.     super
  6204.     if @damage_sprites != nil
  6205.        for damage_sprite in @damage_sprites
  6206.            damage_sprite.dispose
  6207.        end
  6208.      end
  6209.   end
  6210. end
  6211.  
  6212. #===============================================================================
  6213. # ■ RPG Sprite
  6214. #===============================================================================
  6215. class Sprite_Base < Sprite
  6216.       include XRXS_DAMAGE
  6217. end
  6218.  
  6219. #===============================================================================
  6220. # ■ Sprite Damage
  6221. #===============================================================================
  6222. class Sprite_Damage < Sprite
  6223.  
  6224.   #--------------------------------------------------------------------------
  6225.   # ● Initialize
  6226.   #--------------------------------------------------------------------------                        
  6227.   def initialize(sprite, init_x_speed, init_y_speed, duration,dam_ox,dam_type = nil)
  6228.       super(nil)
  6229.       self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil?
  6230.       self.opacity = sprite.opacity
  6231.       self.x = sprite.x
  6232.       self.y = sprite.y
  6233.       self.z = sprite.z
  6234.       self.ox = sprite.ox - dam_ox
  6235.       self.oy = sprite.oy
  6236.       @now_x_speed = init_x_speed
  6237.       @now_y_speed = init_y_speed
  6238.       @potential_x_energy = 0.0
  6239.       @potential_y_energy = 0.0
  6240.       @duration = duration
  6241.       @dam_type = dam_type
  6242.       @dam_type = "" if dam_type == nil
  6243.   end
  6244.  
  6245.   #--------------------------------------------------------------------------
  6246.   # ● Update   
  6247.   #--------------------------------------------------------------------------                       
  6248.   def update
  6249.     super
  6250.     if XAS_DAMAGE_POP::DAMAGE_CRITICAL_ZOOM
  6251.        if @dam_type != "Critical"
  6252.           update_normal_popup
  6253.        else  
  6254.           update_critical_effect   
  6255.        end      
  6256.     else      
  6257.        update_normal_popup
  6258.     end
  6259.     @duration -= 1
  6260.     if @duration == 0
  6261.        self.dispose
  6262.     end
  6263.   end
  6264.  
  6265.   #--------------------------------------------------------------------------
  6266.   # ● update_critical_effect
  6267.   #--------------------------------------------------------------------------                           
  6268.   def update_critical_effect  
  6269.       case @duration
  6270.          when 40..60
  6271.            self.zoom_x += 0.1
  6272.            self.zoom_y += 0.1
  6273.          else   
  6274.            if self.zoom_x > 0.1   
  6275.               self.zoom_x -= 0.1
  6276.               self.zoom_y -= 0.1
  6277.            end
  6278.        end
  6279.   end
  6280.  
  6281.   #--------------------------------------------------------------------------
  6282.   # ● update_normal_popup
  6283.   #--------------------------------------------------------------------------                        
  6284.   def update_normal_popup
  6285.       self.opacity -= 25 if @duration <= 10
  6286.       n = self.oy + @now_y_speed
  6287.       if n <= 0
  6288.          @now_y_speed *= -1
  6289.          @now_y_speed /=  2
  6290.          @now_x_speed /=  2
  6291.       end
  6292.       self.oy  = [n, 0].max   
  6293.       @potential_y_energy += 0.58
  6294.       speed = @potential_y_energy.floor
  6295.       @now_y_speed        -= speed
  6296.       @potential_y_energy -= speed
  6297.       @potential_x_energy += @now_x_speed
  6298.       speed = @potential_x_energy.floor
  6299.       self.ox             += speed
  6300.       @potential_x_energy -= speed  
  6301.     end
  6302.  
  6303. end
  6304.  
  6305.  
  6306.  
  6307. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6308. #■ SPRITE - SPRITE EFFECTS
  6309. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6310.  
  6311.  
  6312. #==============================================================================
  6313. # ■ Sprite Base
  6314. #==============================================================================
  6315. class Sprite_Base < Sprite  
  6316.  
  6317.   #--------------------------------------------------------------------------
  6318.   # ● Animation Set Sprite
  6319.   #--------------------------------------------------------------------------
  6320.   def animation_set_sprites(frame)
  6321.       cell_data = frame.cell_data
  6322.       @ani_sprites.each_with_index do |sprite, i|
  6323.         next unless sprite
  6324.         pattern = cell_data[i, 0]
  6325.         if !pattern || pattern < 0
  6326.             sprite.visible = false
  6327.             next
  6328.         end
  6329.         sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  6330.         sprite.visible = true
  6331.         sprite.src_rect.set(pattern % 5 * 192,
  6332.         pattern % 100 / 5 * 192, 192, 192)
  6333.         if @ani_mirror
  6334.            cx = cell_data[i, 1]
  6335.            sprite.angle = (360 - cell_data[i, 4])
  6336.            sprite.mirror = (cell_data[i, 5] == 0)
  6337.         else
  6338.            cx = cell_data[i, 1]
  6339.            sprite.angle = cell_data[i, 4]
  6340.            sprite.mirror = (cell_data[i, 5] == 1)
  6341.         end
  6342.         cy = cell_data[i, 2]
  6343.         sprite.z = self.z + 300 + i
  6344.         sprite.ox = 96
  6345.         sprite.oy = 96
  6346.         sprite.zoom_x = cell_data[i, 3] / 100.0
  6347.         sprite.zoom_y = cell_data[i, 3] / 100.0
  6348.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  6349.         sprite.blend_type = cell_data[i, 7]
  6350.         case @animation.position
  6351.               when 0
  6352.                   sprite.x = self.x + cx
  6353.                   sprite.y = self.y + cy - (height / 2)         
  6354.               when 1
  6355.                   sprite.x = self.x + cx
  6356.                   sprite.y = self.y + cy         
  6357.               when 2
  6358.                   sprite.x = self.x + cx
  6359.                   sprite.y = self.y + cy + (height / 2)
  6360.               when 3  
  6361.                   sprite.x  = (544 / 2) + cx
  6362.                   sprite.y  = (416 / 2) + cy     
  6363.         end        
  6364.  
  6365.  
  6366.     end
  6367.   end  
  6368.  
  6369.   #--------------------------------------------------------------------------
  6370.   # ● Dispose Animation
  6371.   #--------------------------------------------------------------------------
  6372.   def dispose_animation
  6373.       $game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
  6374.       if @ani_bitmap1
  6375.          @@_reference_count[@ani_bitmap1] -= 1
  6376.         if @@_reference_count[@ani_bitmap1] == 0
  6377.             $game_temp.animation_garbage.push(@ani_bitmap1)
  6378.          end
  6379.       end
  6380.       if @ani_bitmap2
  6381.          @@_reference_count[@ani_bitmap2] -= 1
  6382.          if @@_reference_count[@ani_bitmap2] == 0
  6383.             $game_temp.animation_garbage.push(@ani_bitmap2)
  6384.         end
  6385.      end
  6386.      if @ani_sprites
  6387.         @ani_sprites.each {|sprite| sprite.dispose }
  6388.         @ani_sprites = nil
  6389.         @animation = nil
  6390.      end
  6391.      @ani_bitmap1 = nil
  6392.      @ani_bitmap2 = nil
  6393.   end   
  6394.  
  6395. end
  6396.  
  6397. #==============================================================================
  6398. # ■ Scene_Base
  6399. #==============================================================================
  6400. class Game_Map
  6401.  
  6402.   #--------------------------------------------------------------------------
  6403.   # ● Setup
  6404.   #--------------------------------------------------------------------------   
  6405.   alias animation_garbage_setup setup
  6406.   def setup(map_id)
  6407.       animation_garbage_setup(map_id)
  6408.       dispose_animation_garbage
  6409.   end
  6410.  
  6411.   #--------------------------------------------------------------------------
  6412.   # ● Dispose Animation Garbage
  6413.   #--------------------------------------------------------------------------  
  6414.   def dispose_animation_garbage
  6415.       return if $game_temp.animation_garbage == nil
  6416.       for animation in $game_temp.animation_garbage
  6417.           animation.dispose
  6418.       end  
  6419.       $game_temp.animation_garbage = nil
  6420.   end  
  6421.  
  6422. end  
  6423.  
  6424. #==============================================================================
  6425. # ■ Scene_Base
  6426. #==============================================================================
  6427. class Scene_Base
  6428.  
  6429.   #--------------------------------------------------------------------------
  6430.   # ● Scene Changing?
  6431.   #--------------------------------------------------------------------------   
  6432.   alias animation_garbage_scene_changing scene_changing?
  6433.   def scene_changing?
  6434.       $game_map.dispose_animation_garbage if SceneManager.scene != self
  6435.       animation_garbage_scene_changing
  6436.   end
  6437.  
  6438. end  
  6439.  
  6440. #===============================================================================
  6441. # ■ Sprite_Character
  6442. #===============================================================================
  6443. class Sprite_Character < Sprite_Base
  6444.   include XAS_SYSTEM
  6445.  
  6446.   #--------------------------------------------------------------------------
  6447.   # ● Setup New Effect
  6448.   #--------------------------------------------------------------------------              
  6449.   def setup_new_effect
  6450.       if @character.animation_id > 0
  6451.          animation = $data_animations[@character.animation_id]
  6452.          start_animation(animation)
  6453.          @character.animation_id = 0
  6454.       end
  6455.       if !@balloon_sprite && @character.balloon_id > 0
  6456.          @balloon_id = @character.balloon_id
  6457.          start_balloon
  6458.       end
  6459.   end  
  6460.  
  6461.   #--------------------------------------------------------------------------
  6462.   # ● Can Update X Effects
  6463.   #--------------------------------------------------------------------------                    
  6464.   def can_update_x_effects?
  6465.       return false unless CHARACTER_SPRITE_EFFECTS
  6466.       return false if @character.erased
  6467.       return false if @character.transparent == true
  6468.       return true
  6469.   end  
  6470.   #--------------------------------------------------------------------------
  6471.   # ● Can Damage Pop Base
  6472.   #--------------------------------------------------------------------------                  
  6473.   def can_damage_pop_base?
  6474.       return false unless $game_system.xas_battle
  6475.       return false if XAS_SYSTEM::DAMAGE_POP == false
  6476.       return false if @character.battler == nil
  6477.       return false if @character.battler.no_damage_pop  
  6478.       return false if @character.battler.damage_pop != true
  6479.       return true  
  6480.   end  
  6481.  
  6482.  
  6483.   #--------------------------------------------------------------------------
  6484.   # ● Execute Damage Pop
  6485.   #--------------------------------------------------------------------------              
  6486.   def execute_damage_pop  
  6487.       damage(@character.battler.damage, @character.battler.damage_type)
  6488.       @character.battler.damage = nil
  6489.       @character.battler.critical = false
  6490.       @character.battler.damage_pop = false
  6491.       @character.battler.damage_type = ""
  6492.   end
  6493.  
  6494.   #--------------------------------------------------------------------------
  6495.   # ● Update X Effects
  6496.   #--------------------------------------------------------------------------              
  6497.   def update_x_effects
  6498.       update_collaspse_effects if @character.collapse_duration > 0
  6499.       update_sprite_position
  6500.       update_angle
  6501.       update_zoom
  6502.   end
  6503.  
  6504.   #--------------------------------------------------------------------------
  6505.   # ● Update Angle
  6506.   #--------------------------------------------------------------------------         
  6507.   def update_angle
  6508.       return if @character.angle == self.angle
  6509.       self.angle = @character.angle
  6510.   end
  6511.  
  6512.   #--------------------------------------------------------------------------
  6513.   # ● Update Zoom
  6514.   #--------------------------------------------------------------------------            
  6515.   def update_zoom
  6516.       update_treasure_effect
  6517.       update_breath_effect if can_breath_effect?
  6518.       self.zoom_x = @character.zoom_x
  6519.       self.zoom_y = @character.zoom_y
  6520.   end
  6521.  
  6522.   #--------------------------------------------------------------------------
  6523.   # ● Update Treasure_effect
  6524.   #--------------------------------------------------------------------------                     
  6525.   def update_treasure_effect
  6526.       return if @character.treasure_time == 0
  6527.       update_treasure_fade_effect
  6528.       update_treasure_float_effect
  6529.   end  
  6530.  
  6531.   #--------------------------------------------------------------------------
  6532.   # ● update_treasure_fade_effect
  6533.   #--------------------------------------------------------------------------                        
  6534.   def update_treasure_fade_effect
  6535.       return unless XAS_BA::FADE_TREASURE_SPRITE
  6536.       return if @character.treasure_time > 100
  6537.       return if @character.zoom_x < 0.01      
  6538.       @character.zoom_x -= 0.01
  6539.       if @character.temp_id > 0
  6540.          @character.zoom_x = 1.00
  6541.          @character.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  6542.       end
  6543.   end  
  6544.  
  6545.   #--------------------------------------------------------------------------
  6546.   # ● Update Treasure Float Effect
  6547.   #--------------------------------------------------------------------------                          
  6548.   def update_treasure_float_effect
  6549.       return unless XAS_BA::FLOAT_TREASURE_SPRITE   
  6550.       return if self.character.jumping?
  6551.       self.character.treasure_float[2] += 1
  6552.       if self.character.treasure_float[2] > 1
  6553.          self.character.treasure_float[2] = 0
  6554.          self.character.treasure_float[1] += 1
  6555.          case self.character.treasure_float[1]
  6556.             when 1..15
  6557.               self.character.treasure_float[0] -= 1
  6558.             when 16..30
  6559.               self.character.treasure_float[0] += 1
  6560.             else
  6561.               self.character.treasure_float[0] = 0
  6562.               self.character.treasure_float[1] = 0
  6563.           end
  6564.       end   
  6565.       self.y +=  self.character.treasure_float[0]
  6566.   end
  6567.  
  6568.   #--------------------------------------------------------------------------
  6569.   # ● Can Breath Effect?
  6570.   #--------------------------------------------------------------------------                    
  6571.   def can_breath_effect?
  6572.       return false if @character.battler == nil
  6573.       return false if @character.battler.breath_effect == false
  6574.       return false if @character.battler.hp == 0
  6575.       return false if @character.stop and not @character.battler.state_sleep
  6576.       return true
  6577.   end  
  6578.  
  6579.   #--------------------------------------------------------------------------
  6580.   # ● Update Breath Effect
  6581.   #--------------------------------------------------------------------------                  
  6582.   def update_breath_effect
  6583.       if @character.battler.fast_breath_effect
  6584.           zoom_speed = 3
  6585.           zoom_power_x = 0.006   
  6586.           zoom_power_y = 0.006        
  6587.       else
  6588.           zoom_speed = 1
  6589.           zoom_power_x = 0   
  6590.           zoom_power_y = 0.002
  6591.       end
  6592.       @character.battler.breath_duration += zoom_speed
  6593.       case @character.battler.breath_duration
  6594.            when 1..30
  6595.                 @character.zoom_x += zoom_power_x
  6596.                 @character.zoom_y += zoom_power_y
  6597.            when 31..60
  6598.                 @character.zoom_x -= zoom_power_x
  6599.                 @character.zoom_y -= zoom_power_y
  6600.            else  
  6601.                 @character.battler.breath_duration = 0
  6602.                 @character.zoom_x = 1.00
  6603.                 @character.zoom_y = 1.00
  6604.       end   
  6605.   end  
  6606.  
  6607.   #--------------------------------------------------------------------------
  6608.   # ● Update Sprite Position
  6609.   #--------------------------------------------------------------------------                  
  6610.   alias x_set_character_bitmap set_character_bitmap
  6611.   def set_character_bitmap
  6612.       @py = nil
  6613.       x_set_character_bitmap
  6614.       if @character_name[/\((\d+)\)/]
  6615.          @py = $1.to_i
  6616.       end            
  6617.   end
  6618.  
  6619.   #--------------------------------------------------------------------------
  6620.   # ● Update Sprite Position
  6621.   #--------------------------------------------------------------------------               
  6622.   def update_sprite_position
  6623.       if @character.tool_id > 0
  6624.          if @character.tool_effect == "Barrier"
  6625.             unless @character.action == nil
  6626.                bullet_user = @character.action.user
  6627.                self.x = bullet_user.screen_x
  6628.                self.y = bullet_user.screen_y
  6629.                @character.x = bullet_user.x
  6630.                @character.y = bullet_user.y
  6631.                @character.direction = bullet_user.direction
  6632.             end
  6633.          end  
  6634.       end  
  6635.       update_hold_target      
  6636.       if @py != nil
  6637.          self.y += @py
  6638.       end
  6639.       if @character.angle == 315 and @cw != nil
  6640.          self.x -= (@cw / 3)
  6641.          self.y -= (@ch / 6)
  6642.       end  
  6643.       if XAS_BA::KNOCKBACKING_SHAKE
  6644.          if self.character.knockbacking?
  6645.             self.x = self.x + rand(5) unless self.character.dead?
  6646.          end  
  6647.       end      
  6648. end  
  6649.  
  6650. #--------------------------------------------------------------------------
  6651. # ● Update X Effects
  6652. #--------------------------------------------------------------------------                 
  6653. def update_hold_target
  6654.      return if @character.temp_id == 0
  6655.      target = $game_map.events[@character.temp_id]
  6656.      if target == nil or target.erased
  6657.         @character.temp_id = 0
  6658.         @character.move_speed = @character.pre_move_speed
  6659.         check_character_above_player(target)
  6660.      else
  6661.         self.x = target.screen_x
  6662.         self.y = target.screen_y
  6663.         self.character.x = target.x
  6664.         self.character.y = target.y
  6665.         self.character.move_speed = target.move_speed
  6666.         self.character.direction = target.direction unless self.character.direction_fix
  6667.         check_character_above_player(target)
  6668.      end   
  6669. end
  6670.  
  6671. #--------------------------------------------------------------------------
  6672. # ● Check Chacracter Above Player
  6673. #--------------------------------------------------------------------------                  
  6674. def check_character_above_player(target)
  6675.      return if @character.is_a?(Game_Player)
  6676.      return if @character.battler == nil
  6677.      if (@character.x == $game_player.x and
  6678.          @character.y == $game_player.y) or
  6679.           not @character.passable_temp_id?(@character.x,@character.y)
  6680.          @character.temp_id = 0
  6681.          @character.move_speed = @character.pre_move_speed
  6682.          case @character.direction
  6683.             when 2;  @character.y -= 1
  6684.             when 4;  @character.x += 1
  6685.             when 6;  @character.x -= 1
  6686.             when 8;  @character.y += 1  
  6687.          end
  6688.      end   
  6689.    end
  6690.  
  6691. #--------------------------------------------------------------------------
  6692. # ● Update_balloon
  6693. #--------------------------------------------------------------------------
  6694. if XAS_BA::FIX_BALLOON_POSITION
  6695. def update_balloon
  6696.      if @balloon_duration > 0
  6697.         @balloon_duration -= 1
  6698.         if @balloon_duration > 0
  6699.            @balloon_sprite.x = x
  6700.            @balloon_sprite.y = y - XAS_BA::BALLOON_HEIGHT
  6701.            @balloon_sprite.z = z + 200
  6702.            sx = balloon_frame_index * 32
  6703.            sy = (@balloon_id - 1) * 32
  6704.            @balloon_sprite.src_rect.set(sx, sy, 32, 32)
  6705.       else
  6706.            end_balloon
  6707.       end
  6708.     end
  6709.   end   
  6710.   end
  6711.  
  6712. end
  6713.  
  6714. #==============================================================================
  6715. # ■ Game_Event
  6716. #==============================================================================
  6717. class Game_Event < Game_Character
  6718.  
  6719.   #--------------------------------------------------------------------------
  6720.   # ● Near The Screen
  6721.   #--------------------------------------------------------------------------  
  6722.   alias x_near_the_screen near_the_screen?
  6723.   def near_the_screen?(dx = 12, dy = 8)
  6724.       return true if can_update_out_screen?
  6725.       x_near_the_screen(dx, dy)
  6726.   end
  6727.  
  6728. #--------------------------------------------------------------------------
  6729. # ● Can Update Out Screen
  6730. #--------------------------------------------------------------------------
  6731. def can_update_out_screen?
  6732.      return true if self.force_update
  6733.      return false
  6734. end
  6735.  
  6736. end
  6737.  
  6738. #==============================================================================
  6739. # ■ Spriteset Map
  6740. #==============================================================================
  6741. class Spriteset_Map
  6742.  
  6743.   #--------------------------------------------------------------------------
  6744.   # ● Can Refresh Hud
  6745.   #--------------------------------------------------------------------------   
  6746.   alias x_pre_leader_id_initialize initialize
  6747.   def initialize
  6748.       if $game_party.members[0] != nil
  6749.          $game_system.pre_leader_id = $game_party.members[0].actor_id
  6750.       else   
  6751.          $game_system.pre_leader_id = nil
  6752.       end  
  6753.       x_pre_leader_id_initialize
  6754.   end  
  6755.  
  6756.   #--------------------------------------------------------------------------
  6757.   # ● Can Refresh Hud
  6758.   #--------------------------------------------------------------------------   
  6759.   def can_refresh_hud?
  6760.       if $game_party.members[0] == nil
  6761.          return true if $game_system.pre_leader_id != nil
  6762.       elsif $game_party.members[0] != nil   
  6763.          return true if $game_system.pre_leader_id == nil
  6764.          return true if $game_system.pre_leader_id != $game_party.members[0].actor_id
  6765.       end  
  6766.       return false
  6767.   end  
  6768.  
  6769.   #--------------------------------------------------------------------------
  6770.   # ● update
  6771.   #--------------------------------------------------------------------------   
  6772.   def refresh_hud
  6773.       $game_system.pre_leader_id = $game_party.members[0].actor_id      
  6774.   end
  6775.  
  6776.   #--------------------------------------------------------------------------
  6777.   # ● Update Hud Visible
  6778.   #--------------------------------------------------------------------------      
  6779.   def update_hud_visible
  6780.       if hud_visible?
  6781.          $game_system.enable_hud = true
  6782.       else   
  6783.          $game_system.enable_hud = false
  6784.       end  
  6785.   end  
  6786.  
  6787.   #--------------------------------------------------------------------------
  6788.   # ● Hud Visible?
  6789.   #--------------------------------------------------------------------------        
  6790.   def hud_visible?
  6791.       return false if $game_system.hud_visible == false
  6792.       return false if $game_message.visible
  6793.       return true
  6794.   end     
  6795.  
  6796. end  
  6797.  
  6798.  
  6799.  
  6800. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6801. #■ MISC - SCENE TARGET SELECT
  6802. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  6803.  
  6804.  
  6805. #==============================================================================
  6806. # ■ Game_Temp
  6807. #==============================================================================
  6808. class Game_Temp
  6809.       attr_accessor :xas_target_x
  6810.       attr_accessor :xas_target_y
  6811.       attr_accessor :xas_target_time
  6812.       attr_accessor :xas_target_shoot_id
  6813.  
  6814. #--------------------------------------------------------------------------
  6815. # ● Initialize
  6816. #--------------------------------------------------------------------------
  6817.   alias xas_target_initialize initialize
  6818.   def initialize
  6819.       xas_target_initialize
  6820.       @xas_target_x = 0
  6821.       @xas_target_y = 0
  6822.       @xas_target_time = 0
  6823.       @xas_target_shoot_id = 0
  6824.   end   
  6825.  
  6826. end
  6827.  
  6828. #==============================================================================
  6829. # ■ Game_Map
  6830. #==============================================================================
  6831. class Game_Map
  6832.  
  6833. attr_accessor :pre_display_x
  6834. attr_accessor :pre_display_y
  6835. attr_accessor :pre_real_display_x
  6836. attr_accessor :pre_real_display_y
  6837.  
  6838. #--------------------------------------------------------------------------
  6839. # * Object Initialization
  6840. #--------------------------------------------------------------------------
  6841. alias x_map_initialize initialize
  6842. def initialize  
  6843.      x_map_initialize
  6844.      @pre_display_x = @display_x - 1
  6845.      @pre_display_y = @display_y - 1   
  6846. end
  6847.  
  6848.   #--------------------------------------------------------------------------
  6849.   # ● Screen Scrolled?
  6850.   #--------------------------------------------------------------------------        
  6851.   def screen_scrolled?
  6852.       if @pre_display_x != @display_x or
  6853.          @pre_display_y != @display_y
  6854.          @pre_display_x = @display_x
  6855.          @pre_display_y = @display_y
  6856.          return true
  6857.       end   
  6858.       return false
  6859.   end
  6860.  
  6861. #--------------------------------------------------------------------------
  6862. # ● Event On Screen
  6863. #--------------------------------------------------------------------------
  6864. def event_on_screen?(event)
  6865.      event.target = false
  6866.      px = ($game_map.display_x).truncate
  6867.      py = ($game_map.display_y).truncate   
  6868.      distance_x = event.x - px
  6869.      distance_y = event.y - py
  6870.      if distance_x.between?(0, 16) and
  6871.         distance_y.between?(0, 12)
  6872.         event.target = true
  6873.      end  
  6874. end      
  6875.  
  6876. #--------------------------------------------------------------------------
  6877. # ● Check Event on Screen
  6878. #--------------------------------------------------------------------------
  6879. def check_events_on_screen
  6880.       for i in $game_map.events.values
  6881.             event_on_screen?(i)
  6882.       end   
  6883.   end
  6884.  
  6885. end  
  6886. #==============================================================================
  6887. # ■ Scene Target Select
  6888. #==============================================================================
  6889. class Scene_Target_Select
  6890.  
  6891.   #--------------------------------------------------------------------------
  6892.   # ● Main
  6893.   #--------------------------------------------------------------------------        
  6894.   def main     
  6895.       $game_temp.xas_target_x = 0
  6896.       $game_temp.xas_target_y = 0      
  6897.       $game_temp.xas_target_time = 0
  6898.       @new_x = $game_player.screen_x
  6899.       @new_y = $game_player.screen_y
  6900.       @index_max = -1
  6901.       @target_index = 0  
  6902.       @spriteset = Spriteset_Map.new
  6903.       @text_string = ""
  6904.       @fy = 0
  6905.       @fy_time = 0
  6906.       for event in $game_map.events.values
  6907.         if event.target and event.battler?
  6908.            @index_max += 1
  6909.         end  
  6910.       end  
  6911.       Sound.play_equip
  6912.       if @index_max == -1
  6913.          cancel_select
  6914.       else
  6915.          create_layout
  6916.          create_layout_skill
  6917.          create_cusrsor
  6918.          create_text      
  6919.          create_skill_name
  6920.          select_target(0)
  6921.       end
  6922.       Graphics.transition(0)
  6923.       loop do
  6924.            Graphics.update
  6925.            Input.update
  6926.            update
  6927.            break if SceneManager.scene != self
  6928.       end
  6929.       dispose
  6930. end  
  6931.   #--------------------------------------------------------------------------
  6932.   # ● Create Layout
  6933.   #--------------------------------------------------------------------------      
  6934.   def create_layout
  6935.       @layout_1 = Plane.new
  6936.       @layout_1.bitmap = Cache.system("XAS_Target_Layout1")
  6937.       @layout_1.z = 10100
  6938.       @layout_1.opacity = 255
  6939.   end  
  6940.  
  6941. #--------------------------------------------------------------------------
  6942. # ● Create Layout
  6943. #--------------------------------------------------------------------------      
  6944. def create_layout_skill
  6945.      @skill_layout = Sprite.new
  6946.      @skill_layout.bitmap = Cache.system("XAS_Active_Help")
  6947.      @skill_layout.z = 10101
  6948.      @skill_layout.x = -100   
  6949.      @skill_layout.y = 32
  6950.      @skill_layout.opacity = 0
  6951. end
  6952.  
  6953. #--------------------------------------------------------------------------
  6954. # ● Create Cursor
  6955. #--------------------------------------------------------------------------            
  6956. def create_cusrsor
  6957.      @cursor = Sprite.new
  6958.      @cursor.bitmap = Cache.system("XAS_Cursor")
  6959.      @cursor.z = 10105
  6960.      @cursor.x = @new_x
  6961.      @cursor.y = @new_y
  6962.      @cursor.opacity = 255
  6963.      @cursor.visible = true
  6964. end
  6965.  
  6966. #--------------------------------------------------------------------------
  6967. # ● Create Text
  6968. #--------------------------------------------------------------------------   
  6969. def create_text
  6970.      @text = Sprite.new
  6971.      @text.bitmap = Bitmap.new(200,40)
  6972.      @text.z = 10102
  6973.      @text.bitmap.font.size = 20
  6974.      @text.bitmap.font.bold = true
  6975.      @text.bitmap.font.name = "黑体"  
  6976.      @text.bitmap.draw_text(0, 0, 200, 40, @text_string.to_s,1)
  6977.      @text.opacity = 255
  6978.      @text.x = @new_x
  6979.      @text.y = @new_y   
  6980. end
  6981.  
  6982. #--------------------------------------------------------------------------
  6983. # ● Create Text
  6984. #--------------------------------------------------------------------------   
  6985. def create_skill_name
  6986.      @skill_name = Plane.new
  6987.      @skill_name.bitmap = Bitmap.new(640,480)
  6988.      @skill_name.z = 10103
  6989.      @skill_name.bitmap.font.size = 20
  6990.      @skill_name.bitmap.font.bold = true
  6991.      @skill_name.bitmap.font.name = "黑体"  
  6992.      @skill_name.oy = -40
  6993.      skill = $data_skills[$game_temp.xas_target_shoot_id]
  6994.      skill_text = skill.name.to_s + " - " + skill.description.to_s     
  6995.      @skill_name.bitmap.draw_text(0, 0, 640, 40, skill_text,1)
  6996.      @skill_name.opacity = 0
  6997. end  
  6998.  
  6999. #--------------------------------------------------------------------------
  7000. # ● Dispose
  7001. #--------------------------------------------------------------------------            
  7002. def dispose
  7003.      Graphics.freeze
  7004.      @spriteset.dispose
  7005.      if @cursor != nil
  7006.         @cursor.bitmap.dispose
  7007.         @cursor.dispose  
  7008.         @text.bitmap.dispose
  7009.         @text.dispose
  7010.         @skill_layout.bitmap.dispose
  7011.         @skill_layout.dispose
  7012.         @skill_name.bitmap.dispose
  7013.         @skill_name.dispose
  7014.         @layout_1.bitmap.dispose
  7015.         @layout_1.dispose
  7016.      end
  7017. end
  7018.  
  7019. #--------------------------------------------------------------------------
  7020. # ● Update
  7021. #--------------------------------------------------------------------------         
  7022. def update
  7023.      return if @index_max == -1
  7024.      @spriteset.update
  7025.      update_cursor_slide
  7026.      update_layout_slide
  7027.      update_targe_select
  7028. end
  7029.  
  7030. #--------------------------------------------------------------------------
  7031. # ● Update Layout Slide
  7032. #--------------------------------------------------------------------------            
  7033. def update_layout_slide
  7034.      @layout_1.ox += 3
  7035.      if @skill_layout.x < 0
  7036.         @skill_layout.x += 10
  7037.         @skill_layout.opacity += 25
  7038.         @skill_name.opacity += 25
  7039.      else
  7040.         @skill_layout.x = 0
  7041.         @skill_layout.opacity = 255
  7042.         @skill_name.opacity = 255
  7043.         @skill_name.ox -= 3
  7044.      end  
  7045. end  
  7046.  
  7047. #--------------------------------------------------------------------------
  7048. # ● Refresh Text
  7049. #--------------------------------------------------------------------------            
  7050. def refresh_text
  7051.      @text.bitmap.clear
  7052.      @text.bitmap.draw_text(0, 0, 200, 40, @text_string.to_s,1)
  7053. end
  7054.  
  7055. #--------------------------------------------------------------------------
  7056. # ● Update Cursor Slide
  7057. #--------------------------------------------------------------------------           
  7058. def update_cursor_slide
  7059.      @speed_x = [[(@cursor.x - @new_x / 60), 1].max, 60].min
  7060.      @speed_y = [[(@cursor.y - @new_y / 60), 1].max, 60].min
  7061.      if @cursor.x > @new_x
  7062.         @cursor.x -= @speed_x.abs
  7063.         @cursor.x = @new_x if @cursor.x < @new_x
  7064.      elsif @cursor.x < @new_x
  7065.         @cursor.x += @speed_x.abs
  7066.         @cursor.x = @new_x if @cursor.x > @new_x
  7067.      end         
  7068.  
  7069.      if @cursor.y > @new_y
  7070.         @cursor.y -= @speed_y.abs
  7071.         @cursor.y = @new_y if @cursor.y < @new_y
  7072.      elsif @cursor.y < @new_y
  7073.         @cursor.y += @speed_y.abs
  7074.         @cursor.y = @new_y if @cursor.y > @new_y
  7075.      end      
  7076.      @text.x = - 85 + @cursor.x
  7077.      @text.y = 20 + @cursor.y
  7078.      if @fy_time > 25
  7079.         @fy += 1
  7080.      elsif @fy_time > 0
  7081.         @fy -= 1
  7082.      else   
  7083.         @fy = 0
  7084.         @fy_time = 50
  7085.      end  
  7086.      @fy_time -= 1
  7087.      @cursor.oy = @fy
  7088.  
  7089. end
  7090.  
  7091. #--------------------------------------------------------------------------
  7092. # ● Select Target(type)
  7093. #--------------------------------------------------------------------------           
  7094. def select_target(type)
  7095.      return if  @index_max < 0
  7096.      check_index
  7097.      valor = 0
  7098.      for event in $game_map.events.values
  7099.         if event.target and event.battler?
  7100.            if valor == @target_index
  7101.               @new_x = event.screen_x - 10
  7102.               @new_y = event.screen_y
  7103.               @text_string = event.battler.name
  7104.               $game_temp.xas_target_x = event.x
  7105.               $game_temp.xas_target_y = event.y
  7106.               $game_temp.xas_target_time = 1
  7107.             end
  7108.             valor += 1  
  7109.          end  
  7110.      end   
  7111.      refresh_text  
  7112.   end
  7113.  
  7114. #--------------------------------------------------------------------------
  7115. # ● Cancel Select
  7116. #--------------------------------------------------------------------------              
  7117. def cancel_select
  7118.      Sound.play_buzzer
  7119.      $game_temp.xas_target_x = 0
  7120.      $game_temp.xas_target_y = 0      
  7121.      $game_temp.xas_target_time = 0
  7122.      $game_temp.xas_target_shoot_id = 0
  7123.      SceneManager.call(Scene_Map)
  7124. end
  7125.  
  7126.   #--------------------------------------------------------------------------
  7127.   # ● Update Target Select
  7128.   #--------------------------------------------------------------------------            
  7129.   def update_targe_select
  7130.       if Input.trigger?(Input::B)
  7131.          cancel_select
  7132.       elsif Input.trigger?(Input::DOWN) or Input.trigger?(Input::RIGHT)  
  7133.          @target_index += 1
  7134.          select_target(0)
  7135.          Sound.play_cursor
  7136.       elsif Input.trigger?(Input::UP) or Input.trigger?(Input::LEFT)
  7137.          @target_index -= 1
  7138.          select_target(1)
  7139.          Sound.play_cursor
  7140.       elsif Input.trigger?(Input::C)
  7141.          Sound.play_ok
  7142.          SceneManager.call(Scene_Map)
  7143.       end  
  7144.   end
  7145.  
  7146.   #--------------------------------------------------------------------------
  7147.   # ● Check Index
  7148.   #--------------------------------------------------------------------------               
  7149.   def check_index
  7150.       if @target_index > @index_max
  7151.          @target_index = 0
  7152.       end      
  7153.       if @target_index < 0
  7154.          @target_index = @index_max
  7155.       end   
  7156.   end        
  7157.  
  7158. end
  7159. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  7160. #■ MISC - MAIN UPDATE
  7161. #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  7162.  
  7163. #===============================================================================
  7164. # ■  Spriteset_Map
  7165. #===============================================================================
  7166. class Spriteset_Map
  7167.  
  7168.   #--------------------------------------------------------------------------
  7169.   # ● update
  7170.   #--------------------------------------------------------------------------  
  7171.   alias xas_main_update update
  7172.   def update
  7173.       xas_main_update
  7174.       update_xas_spriteset_map
  7175.   end
  7176.  
  7177.   #--------------------------------------------------------------------------
  7178.   # ● Update XAS Spriteset Map
  7179.   #--------------------------------------------------------------------------      
  7180.   def update_xas_spriteset_map
  7181.       refresh_token if $game_map.need_refresh_token
  7182.       refresh_hud if can_refresh_hud?
  7183.       update_hud_visible
  7184.   end   
  7185. end
  7186.  
  7187.  
  7188. #===============================================================================
  7189. # ■ Sprite_Character
  7190. #===============================================================================
  7191. class Sprite_Character < Sprite_Base
  7192.  
  7193.   #--------------------------------------------------------------------------
  7194.   # ● Update
  7195.   #--------------------------------------------------------------------------            
  7196.   alias x_update update
  7197.   def update
  7198.       x_update
  7199.       execute_damage_pop  if can_damage_pop_base?
  7200.       update_x_effects if can_update_x_effects?
  7201.   end
  7202.  
  7203. end   
  7204.  
  7205. #===============================================================================
  7206. # ■ Game Character
  7207. #===============================================================================
  7208. class Game_Character < Game_CharacterBase
  7209.  
  7210.   #--------------------------------------------------------------------------
  7211.   # ● Update
  7212.   #--------------------------------------------------------------------------   
  7213.   alias x_main_update update
  7214.   def update
  7215.       update_character_before_movement
  7216.       x_main_update
  7217.       update_character_after_movement
  7218.   end  
  7219.  
  7220.   #--------------------------------------------------------------------------
  7221.   # ● Update Character Before Movement
  7222.   #--------------------------------------------------------------------------      
  7223.   def update_character_before_movement
  7224.       check_xy
  7225.       update_force_action if can_force_action?
  7226.   end  
  7227.  
  7228.   #--------------------------------------------------------------------------
  7229.   # ● Update Character After Movement
  7230.   #--------------------------------------------------------------------------      
  7231.   def update_character_after_movement
  7232.       update_battler if can_update_battler?      
  7233.   end      
  7234.  
  7235. end  
  7236.  
  7237. #===============================================================================
  7238. # ■ Game Event
  7239. #===============================================================================
  7240. class Game_Event < Game_Character
  7241.  
  7242.   #--------------------------------------------------------------------------
  7243.   # ● Update
  7244.   #--------------------------------------------------------------------------   
  7245.   alias x_main_event_update update
  7246.   def update
  7247.       update_event_before_movement
  7248.       x_main_event_update
  7249.       update_event_after_movement
  7250.   end   
  7251.  
  7252.   #--------------------------------------------------------------------------
  7253.   # ● Update Event Before Movement
  7254.   #--------------------------------------------------------------------------      
  7255.   def update_event_before_movement
  7256.       update_sensor if can_update_sensor?
  7257.       update_treasure_duration      
  7258.   end  
  7259.  
  7260.   #--------------------------------------------------------------------------
  7261.   # ● Update Event After Movement
  7262.   #--------------------------------------------------------------------------      
  7263.   def update_event_after_movement
  7264.  
  7265.   end   
  7266.  
  7267. end  
  7268.  
  7269. #===============================================================================
  7270. # ■ Game Player
  7271. #===============================================================================
  7272. class Game_Player < Game_Character
  7273.  
  7274.   #--------------------------------------------------------------------------
  7275.   # ● Update
  7276.   #--------------------------------------------------------------------------   
  7277.   alias x_main_player_update update
  7278.   def update
  7279.       update_player_before_movement if party_system?
  7280.       x_main_player_update
  7281.       update_player_after_movement if party_system?
  7282.   end   
  7283.  
  7284.   #--------------------------------------------------------------------------
  7285.   # ● Update Player Before Movement
  7286.   #--------------------------------------------------------------------------      
  7287.   def update_player_before_movement
  7288.       check_actor_level
  7289.       update_reset_battler_setting_time
  7290.       if $game_system.old_interpreter_running != $game_map.interpreter.running?
  7291.          refresh_interpreter_effect
  7292.       end   
  7293.   end  
  7294.  
  7295.   #--------------------------------------------------------------------------
  7296.   # ● Update Player after Movement
  7297.   #--------------------------------------------------------------------------      
  7298.   def update_player_after_movement
  7299.       update_action_command if can_use_command?
  7300.       $game_temp.change_leader_wait_time -= 1 if $game_temp.change_leader_wait_time > 0
  7301.   end      
  7302. end

Lv3.寻梦者

梦石
0
星屑
2631
在线时间
1045 小时
注册时间
2015-11-1
帖子
271
2
发表于 2019-2-19 09:11:14 | 只看该作者
公共事件 - 并行处理:
条件分支:如果按下什么什么键

设置移动路线,对象玩家
执行脚本:shoot(技能编号)

评分

参与人数 1星屑 +100 收起 理由
VIPArcher + 100 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
128
在线时间
12 小时
注册时间
2019-2-10
帖子
4
3
 楼主| 发表于 2019-2-20 17:46:16 | 只看该作者
 眠  发表于 2019-2-19 09:11
公共事件 - 并行处理:
条件分支:如果按下什么什么键

非常感谢
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 06:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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