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

Project1

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

[已经解决] 如何把这个ABS系统的血条背景改没?

[复制链接]

Lv2.观梦者

梦石
0
星屑
384
在线时间
328 小时
注册时间
2013-8-24
帖子
104
跳转到指定楼层
1
发表于 2016-8-19 21:10:15 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x

脚本盲一个
自己改成这样了,最后只要把HP的背景改没就好了,然而怎么删减都无果

求教各位大触T T

有关的脚本↓

RUBY 代码复制
  1. #===============================================================================
  2. # * Falcao Pearl ABS script shelf # 1
  3. #
  4. # This script is the Heart of Pearl ABS Liquid, it handles all the character
  5. # management, the tools variables and the input module, enemy registration etc.
  6. # 这个脚本是ABS的核心部分,他控制了所有的字符、模块等
  7. #===============================================================================
  8.  
  9. module PearlKernel
  10.  
  11.   # 默认敌人自身开关为“B”【Default enemy sensor self switch】
  12.   Enemy_Sensor = "B"
  13.  
  14.   # 默认敌人感知距离【Default enemy sensor (distance in tiles the enemy is able to see the Player】
  15.   Sensor = 7
  16.  
  17.   # 默认敌人自身事件页上的击倒开关“C”,用来显示击倒图像【Default enemy knockdown self switch (used to display knockdowned graphic)】
  18.   KnockdownSelfW = "C"
  19.  
  20.   # 默认敌人消失方式【Deafault Enemy collapse】
  21.   DefaultCollapse = 'zoom_vertical'
  22.  
  23.   # 在团战中,玩家是整个队伍的指挥者【While in party battle on map, the game player is the manager of the group】
  24.   # 在距离为多少时,玩家可以看到敌人?这决定了随从是否可以开始战斗【Which distance the player can see the enemies?, this is used, to determine wheter the follower can start fighting. 】
  25.   # 在玩家达到指定距离之前,敌人会被无视【enemy away from this tiles whil be ignored untill the player is near them】
  26.   # 距离靠(地砖)空格计算【distamce measured in tiles】
  27.   PlayerRange = 7
  28.  
  29.   # 当随从的动作失败时,这个balloon就会启动,能量会归0【When a follower fail an action this balloon is played, runs out of mana etc.】
  30.   FailBalloon = 1
  31.  
  32.   # 开始游戏是,是否展开ABS的HUD条?【Start the game with the ABS huds turned on?】
  33.   StartWithHud = false
  34.  
  35.   # 你是否想要激活随从死的花样?【Do you want to activate the followers dead poses?】
  36.   FollowerDeadPose = true
  37.  
  38.   # 你是否想要激活单人游戏模式?【Do you want to activate the single player mode?】
  39.   # 这让你无法进入人员选择菜单,K键也被设置为打开快速工具选择栏【this only avoid you accesing the player slection menu and the K key is used to open the quick tool selection menu】
  40.   SinglePlayer = true
  41.  
  42.   #-----------------------------------------------------------------------------
  43.   @gaugeback = Color.new(0, 0, 0, 100)
  44.   def self.draw_hp(obj, battler, x, y, w, h, color, name=nil)
  45.     tag = 'Hp' ; c = color
  46.     name = battler.name if !name.nil?
  47.     draw_gauge(obj, battler.hp, battler.mhp, x, y, w, h, c, tag, name)
  48.   end
  49.  
  50.   def self.draw_mp(obj, battler, x, y, w, h, color, name=nil)
  51.     tag = 'Mp' ; c = color
  52.     name = battler.name if !name.nil?
  53.     draw_gauge(obj, battler.mp, battler.mmp, x, y, w, h, c, tag, name)
  54.   end
  55.  
  56. # def self.draw_exp(obj, battler, x, y, w, h, color, name=nil)
  57. #   tag = 'Exp' ; c = color
  58. #   name = battler.name if !name.nil?
  59. #   draw_gauge(obj,battler.exp, battler.next_level_exp, x, y, w, h, c, tag,name)
  60. # end
  61.  
  62. # def self.draw_tp(obj, x, y, actor)
  63. #   string = 'Tp ' + (actor.tp).to_i.to_s
  64. #   obj.fill_rect(x, y + 10 , string.length * 9, 12, @gaugeback)
  65. #   obj.draw_text(x, y, obj.width, 32, string)
  66. # end
  67.  
  68.   def self.draw_gauge(obj, nm, max, x, y, w, h, col, tag, name)
  69.     obj.font.shadow = true
  70.     w2 = w - 2 ; max = 1 if max == 0
  71.     obj.fill_rect(x, y - 1, w, h + 2, @gaugeback)
  72.     obj.fill_rect(x+1, y+1, w2*nm/max, h/2 - 1, col[0])
  73.     obj.fill_rect(x+1, y + h/2, w2*nm/max, h/2 - 1, col[1])
  74.     obj.draw_text(x, y + h - 22, w, 32, nm.to_s, 2)
  75.     obj.draw_text(x + 4, y + h - 22, w, 32, tag)
  76.     obj.draw_text(x, y - 25, w, 32, name, 1) if !name.nil?
  77.   end
  78.  
  79.   # image based bars definition
  80.   def self.image_hp(bitmap, x, y, back, image, battler, name=nil)
  81.     tag = 'Hp'
  82.     name = battler.name if !name.nil?
  83.     draw_i_gauge(bitmap, x, y, back, image, battler.hp, battler.mhp, tag, name)
  84.   end
  85.  
  86.   def self.image_mp(bitmap, x, y, back, image, battler, name=nil)
  87.     tag = 'Mp'
  88.     name = battler.name if !name.nil?
  89.     draw_i_gauge(bitmap, x, y, back, image, battler.mp, battler.mmp, tag, name)
  90.   end
  91.  
  92. # def self.image_exp(bitmap, x, y, back, image, battler, name=nil)
  93. #   tag = 'Exp'
  94. #   name = battler.name if !name.nil?
  95. #   exp, nexte = battler.exp, battler.next_level_exp
  96. #   draw_i_gauge(bitmap, x, y, back, image, exp, nexte, tag, name)
  97. # end
  98.  
  99.   def self.draw_i_gauge(bitmap, x, y, back, image, nm, max, tag, name)
  100.     cw = back.width  
  101.     ch = back.height
  102.     max = 1 if max == 0
  103.     src_rect = Rect.new(0, 0, cw, ch)   
  104.     bitmap.blt(x - 12, y - ch + 30, back, src_rect)#这里与背景有关
  105.     cw = image.width  * nm / max
  106.     ch = image.height
  107.     src_rect = Rect.new(0, 0, cw, ch)
  108.     bitmap.blt(x - -35, y - ch + 23, image, src_rect)
  109.    # bitmap.draw_text(x - 4, y + back.height - 14, back.width, 32, tag)
  110.    # bitmap.draw_text(x - 12, y + back.height - 14, back.width, 32, nm.to_s, 2)
  111.    # bitmap.draw_text(x - 6, y - 10, back.width, 32, name, 1) if !name.nil?
  112.   end
  113.  
  114.   def self.has_data?
  115.     !user_graphic.nil?
  116.   end
  117.  
  118.   def self.load_item(item)
  119.     @item = item
  120.   end
  121.  
  122.   def self.user_graphic()      @item.tool_data("User Graphic = ", false)    end
  123.   def self.user_animespeed()   @item.tool_data("User Anime Speed = ")       end
  124.   def self.tool_cooldown()     @item.tool_data("Tool Cooldown = ")          end
  125.   def self.tool_graphic()      @item.tool_data("Tool Graphic = ", false)    end
  126.   def self.tool_index()        @item.tool_data("Tool Index = ")             end
  127.   def self.tool_size()         @item.tool_data("Tool Size = ")              end
  128.   def self.tool_distance()     @item.tool_data("Tool Distance = ")          end
  129.   def self.tool_effectdelay()  @item.tool_data("Tool Effect Delay = ")      end
  130.   def self.tool_destroydelay() @item.tool_data("Tool Destroy Delay = ")     end
  131.   def self.tool_speed()         @item.tool_float("Tool Speed = ")            end
  132.   def self.tool_castime()       @item.tool_data("Tool Cast Time = ")         end
  133.   def self.tool_castanimation() @item.tool_data("Tool Cast Animation = ")    end
  134.   def self.tool_blowpower()     @item.tool_data("Tool Blow Power = ")        end
  135.   def self.tool_piercing()      @item.tool_data("Tool Piercing = ", false)   end
  136.   def self.tool_animation() @item.tool_data("Tool Animation When = ", false) end
  137.   def self.tool_anirepeat() @item.tool_data("Tool Animation Repeat = ",false)end
  138.   def self.tool_special() @item.tool_data("Tool Special = ", false)          end
  139.   def self.tool_target() @item.tool_data("Tool Target = ", false)            end
  140.   def self.tool_invoke() @item.tool_data("Tool Invoke Skill = ")             end
  141.   def self.tool_guardrate() @item.tool_data("Tool Guard Rate = ")            end
  142.   def self.tool_knockdown() @item.tool_data("Tool Knockdown Rate = ")        end
  143.   def self.tool_soundse() @item.tool_data("Tool Sound Se = ", false)         end
  144.   def self.tool_itemcost() @item.tool_data("Tool Item Cost = ")              end
  145.   def self.tool_shortjump() @item.tool_data("Tool Short Jump = ", false)     end
  146.   def self.tool_through() @item.tool_data("Tool Through = ", false)          end
  147.   def self.tool_priority() @item.tool_data("Tool Priority = ")               end
  148.   def self.tool_selfdamage() @item.tool_data("Tool Self Damage = ", false)   end
  149.   def self.tool_hitshake() @item.tool_data("Tool Hit Shake = ", false)       end
  150.   def self.tool_combo() @item.tool_data("Tool Combo Tool = ", false)         end
  151.  
  152.   def self.knock_actor(actor)
  153.     a = actor.actor.tool_data("Knockdown Graphic = ", false)
  154.     b = actor.actor.tool_data("Knockdown Index = ")
  155.     c = actor.actor.tool_data("Knockdown pattern = ")
  156.     d = actor.actor.tool_data("Knockdown Direction = ")
  157.     return nil if a.nil?
  158.     return [a, b, c, d]
  159.   end
  160.  
  161.   def self.jump_hit?(target)
  162.     t = target.enemy.tool_data("Hit Jump = ", false) if target.is_a?(Game_Enemy)
  163.     t = target.actor.tool_data("Hit Jump = ", false) if target.is_a?(Game_Actor)
  164.     return true if !t.nil? and t == "true"
  165.     return true if t.nil?
  166.     return false
  167.   end
  168.  
  169.   def self.voices(b)
  170.     voices = b.actor.tool_data("Battler Voices = ",false) if b.is_a?(Game_Actor)
  171.     voices = b.enemy.tool_data("Battler Voices = ",false) if b.is_a?(Game_Enemy)
  172.     voices = voices.split(", ") unless voices.nil?
  173.     voices
  174.   end
  175.  
  176.   def self.hitvoices(b)
  177.     voices = b.actor.tool_data("Hit Voices = ",false) if b.is_a?(Game_Actor)
  178.     voices = b.enemy.tool_data("Hit Voices = ",false) if b.is_a?(Game_Enemy)
  179.     voices = voices.split(", ") unless voices.nil?
  180.     voices
  181.   end
  182.  
  183.   # check for iconset
  184.   def self.check_iconset(item, tag, object)
  185.     data = item.tool_data(tag, false)
  186.     return if data.nil?
  187.     v = [item.icon_index, data.to_sym] if data == "animated" ||
  188.     data == "static" || data == "shielding"
  189.     object.is_a?(Projectile) ? object.pro_iconset = v : object.user_iconset = v
  190.   end
  191.  
  192.   def self.clean_back?
  193.     @clean_back == true
  194.   end
  195. end
  196.  
  197. ($imported ||= {})["Falcao Pearl ABS Liquid"] = true
  198.  
  199. class RPG::BaseItem
  200.   attr_reader :has_data
  201.   def tool_data(comment, sw=true)
  202.     if @note =~ /#{comment}(.*)/i
  203.       @has_data = true
  204.       return sw ? $1.to_i : $1.to_s.sub("\r","")
  205.     end
  206.   end
  207.  
  208.   def tool_float(comment)
  209.     return  $1.to_f if @note =~ /#{comment}(.*)/i
  210.   end
  211.  
  212.   def cool_enabled?
  213.     @cd_dis = @note.include?("Tool Cooldown Display = true") if @cd_dis.nil?
  214.     @cd_dis
  215.   end
  216.  
  217.   def itemcost
  218.     if @i_cost.nil?
  219.       @note =~ /Tool Item Cost = (.*)/i ? @i_cost = $1.to_i : @i_cost = 0
  220.     end
  221.     @i_cost
  222.   end
  223. end
  224.  
  225. # Pearl ABS Input module
  226. module PearlKey
  227.  
  228.   # numbers
  229.   N0 = 0x30; N1 = 0x31; N2 = 0x32; N3 = 0x33; N4 = 0x34
  230.   N5 = 0x35; N6 = 0x36; N7 = 0x37; N8 = 0x38; N9 = 0x39
  231.  
  232.   # keys
  233.   A = 0x41; B = 0x42; C = 0x43; D = 0x44; E = 0x45
  234.   F = 0x46; G = 0x47; H = 0x48; I = 0x49; J = 0x4A
  235.   K = 0x4B; L = 0x4C; M = 0x4D; N = 0x4E; O = 0x4F
  236.   P = 0x50; Q = 0x51; R = 0x52; S = 0x53; T = 0x54
  237.   U = 0x55; V = 0x56; W = 0x57; X = 0x58; Y = 0x59; Z = 0x5A
  238.  
  239.   @unpack_string = 'b'*256
  240.   @last_array = '0'*256
  241.   @press = Array.new(256, false)
  242.   @trigger = Array.new(256, false)
  243.   @release = Array.new(256, false)
  244.   @getKeyboardState = Win32API.new('user32', 'GetKeyboardState', ['P'], 'V')
  245.   @getAsyncKeyState = Win32API.new('user32', 'GetAsyncKeyState', 'i', 'i')
  246.   @getKeyboardState.call(@last_array)
  247.  
  248.   @last_array = @last_array.unpack(@unpack_string)
  249.   for i in [email]0...@last_array.size[/email]
  250.     @press[i] = @getAsyncKeyState.call(i) == 0 ? false : true
  251.   end
  252.  
  253.   def self.update
  254.     @trigger = Array.new(256, false)
  255.     @release = Array.new(256, false)
  256.     array = '0'*256
  257.     @getKeyboardState.call(array)
  258.     array = array.unpack(@unpack_string)
  259.     for i in 0...array.size
  260.       if array[i] != @last_array[i]
  261.         @press[i] = @getAsyncKeyState.call(i) == 0 ? false : true
  262.         if !@press[i]
  263.           @release[i] = true
  264.         else
  265.           @trigger[i] = true
  266.         end
  267.       else
  268.         if @press[i] == true
  269.           @press[i] = @getAsyncKeyState.call(i) == 0 ? false : true
  270.           @release[i] = true if !@press[i]
  271.         end
  272.       end
  273.     end
  274.     @last_array = array
  275.   end
  276.  
  277.   def self.press?(key)
  278.     return @press[key]
  279.   end
  280.  
  281.   def self.trigger?(key)
  282.     return @trigger[key]
  283.   end
  284. end
  285.  
  286. # Input module update engine
  287. class << Input
  288.   alias falcaopearl_abs_cooldown_update update
  289.   def Input.update
  290.     update_pearl_abs_cooldown
  291.     update_popwindow if !$game_temp.nil? and !$game_temp.pop_windowdata.nil?
  292.     update_pearl_abs_respawn
  293.     falcaopearl_abs_cooldown_update
  294.   end
  295.  
  296.  
  297.   def update_pearl_abs_respawn
  298.     $game_map.event_enemies.each do |event|
  299.       if event.respawn_count > 0
  300.         event.respawn_count -= 1
  301.         if event.respawn_count == 0
  302.           event.battler.remove_state(event.battler.death_state_id)
  303.           event.battler.hp = event.battler.mhp
  304.           event.battler.mp = event.battler.mmp
  305.           event.apply_respawn
  306.           event.animation_id = event.respawn_anim
  307.         end
  308.       end
  309.     end
  310.   end
  311.  
  312.   alias falcaopearl_trigger trigger?
  313.   def trigger?(constant)
  314.     return true if constant == :B and PearlKey.trigger?(PearlKey::B)
  315.     falcaopearl_trigger(constant)
  316.   end
  317.  
  318.   # pop window global
  319.   def update_popwindow
  320.     $game_temp.pop_windowdata[0] -= 1 if $game_temp.pop_windowdata[0] > 0
  321.     if @temp_window.nil?
  322.       tag = $game_temp.pop_windowdata[2]
  323.       string = $game_temp.pop_windowdata[1] + tag
  324.       width = (string.length * 9) - 10
  325.       x, y = Graphics.width / 2 - width / 2,  Graphics.height / 2 - 64 / 2
  326.       @temp_window = Window_Base.new(x, y, width, 64)
  327.       @temp_window.contents.font.size = 20
  328.       @temp_window.draw_text(-10, -6, width, 32, tag, 1)
  329.       @temp_window.draw_text(-10, 14, width, 32, $game_temp.pop_windowdata[1],1)
  330.       @current_scene = SceneManager.scene.class
  331.     end
  332.  
  333.     if $game_temp.pop_windowdata[0] == 0 ||
  334.       @current_scene != SceneManager.scene.class
  335.       @temp_window.dispose
  336.       @temp_window = nil
  337.       $game_temp.pop_windowdata = nil
  338.     end
  339.   end
  340.  
  341.   def update_pearl_abs_cooldown
  342.     PearlKey.update
  343.     eval_cooldown($game_party.all_members) if !$game_party.nil?
  344.     eval_cooldown($game_map.enemies) if !$game_map.nil?
  345.   end
  346.  
  347.   # cooldown update
  348.   def eval_cooldown(operand)
  349.     for sub in operand
  350.       sub.skill_cooldown.each {|sid, sv| # skill
  351.       if sub.skill_cooldown[sid] > 0
  352.         sub.skill_cooldown[sid] -= 1
  353.         sub.skill_cooldown.delete(sid) if sub.skill_cooldown[sid] == 0
  354.       end}
  355.       sub.item_cooldown.each {|iid, iv| # item
  356.       if sub.item_cooldown[iid] > 0
  357.         sub.item_cooldown[iid] -= 1
  358.         sub.item_cooldown.delete(iid) if sub.item_cooldown[iid] == 0
  359.       end}
  360.       sub.weapon_cooldown.each {|wid, wv| # weapon
  361.       if sub.weapon_cooldown[wid] > 0
  362.         sub.weapon_cooldown[wid] -= 1
  363.         sub.weapon_cooldown.delete(wid) if sub.weapon_cooldown[wid] == 0
  364.       end}
  365.       sub.armor_cooldown.each {|aid, av| #armor
  366.       if sub.armor_cooldown[aid] > 0
  367.         sub.armor_cooldown[aid] -= 1
  368.         sub.armor_cooldown.delete(aid) if sub.armor_cooldown[aid] == 0
  369.       end}
  370.     end
  371.   end
  372. end
  373.  
  374. #===============================================================================
  375. #===============================================================================
  376. # Game character
  377.  
  378. class Game_CharacterBase
  379.   attr_accessor :just_hitted, :anime_speed, :blowpower, :targeting, :x, :y
  380.   attr_accessor :battler_guarding, :knockdown_data, :colapse_time, :opacity
  381.   attr_accessor :zoomfx_x, :zoomfx_y, :targeted_character, :stuck_timer
  382.   attr_accessor :send_dispose_signal, :follower_attacktimer, :stopped_movement
  383.   attr_accessor :hookshoting, :battler_chain, :pattern, :user_move_distance
  384.   attr_accessor :move_speed, :through, :being_grabbed, :making_spiral
  385.   attr_accessor :direction, :direction_fix, :zfx_bol, :buff_pop_stack
  386.   attr_accessor :die_through, :target_index, :using_custom_g, :combodata
  387.   attr_accessor :originalasp, :doingcombo, :angle_fx
  388.   attr_accessor :user_iconset, :pro_iconset, :respawn_count
  389.   alias falcaopearl_abmain_ini initialize
  390.   def initialize
  391.     @zfx_bol = false
  392.     @just_hitted = 0
  393.     @anime_speed = 0
  394.     @respawn_count = 0
  395.     @blowpower = [0, dir=2, dirfix=false, s=4, wait_reset=0]
  396.     @user_casting = [0, nil]
  397.     @send_dispose_signal = false
  398.     @targeting = [false, item=nil, char=nil]
  399.     @colapse_time = 0
  400.     @stopped_movement = 0
  401.     @follower_attacktimer = 0
  402.     set_hook_variables
  403.     @target_index = 0
  404.     @using_custom_g = false
  405.     @combodata = []
  406.     @angle_fx = 0.0
  407.     #--------------
  408.     @zoomfx_x = 1.0
  409.     @zoomfx_y = 1.0
  410.     @stuck_timer = 0
  411.     @battler_guarding = [false, nil]
  412.     @knockdown_data = [0, nil, nil, nil, nil]
  413.     @state_poptimer = [0, 0]
  414.     @making_spiral = false
  415.     @buff_pop_stack = []
  416.     @doingcombo = 0
  417.     @range_view = 2
  418.     @originalasp = 0
  419.     falcaopearl_abmain_ini
  420.   end
  421.  
  422.   def set_hook_variables
  423.     @hookshoting = [on=false, hooking=false, grabing=false, delay=0]
  424.     @battler_chain = []
  425.     @user_move_distance = [steps=0, speed=nil, trought=nil, cor=nil, evmove=nil]
  426.     @being_grabbed = false
  427.   end
  428.  
  429.   # projectiles at nt
  430.   def projectiles_xy_nt(x, y)
  431.     $game_player.projectiles.select {|pro| pro.pos_nt?(x, y) }
  432.   end
  433.  
  434.   # collide with projectiles
  435.   def collide_with_projectiles?(x, y)
  436.     projectiles_xy_nt(x, y).any? do |pro|
  437.       pro.normal_priority? || self.is_a?(Projectile)
  438.     end
  439.   end
  440.  
  441.   def zoom(x, y)
  442.     @zoomfx_x = x
  443.     @zoomfx_y = y
  444.   end
  445.  
  446.   alias falcaopearl_collide_with collide_with_characters?
  447.   def collide_with_characters?(x, y)
  448.     return true if collide_with_projectiles?(x, y)
  449.     falcaopearl_collide_with(x, y)
  450.   end
  451.  
  452.   # follow character straigh and diagonal
  453.   def follow_char(character)
  454.     sx = distance_x_from(character.x)
  455.     sy = distance_y_from(character.y)
  456.     if sx != 0 && sy != 0
  457.       move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
  458.     elsif sx != 0
  459.       move_straight(sx > 0 ? 4 : 6)
  460.     elsif sy != 0
  461.       move_straight(sy > 0 ? 8 : 2)
  462.     end
  463.   end
  464.  
  465.   def on_battle_screen?(out = 0)
  466.     max_w = (Graphics.width / 32).to_i - 1
  467.     max_h = (Graphics.height / 32).to_i - 1
  468.     sx = (screen_x / 32).to_i
  469.     sy = (screen_y / 32).to_i
  470.     if sx.between?(0 - out, max_w + out) and sy.between?(0 - out, max_h + out)
  471.       return true
  472.     end
  473.     return false
  474.   end
  475.  
  476.    # jump to specific tiles
  477.   def jumpto_tile(x, y)
  478.     jumpto(0, [x, y])
  479.   end
  480.  
  481.   # jumpto character ( 0 = Game Player, 1 and up event id)
  482.   def jumpto(char_id, tilexy=nil)
  483.     char_id > 0 ? char = $game_map.events[char_id] : char = $game_player
  484.     tilexy.nil? ? condxy = [char.x, char.y] : condxy = [tilexy[0], tilexy[1]]
  485.     jx = + eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] >= @x
  486.     jy = - eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] <= @y
  487.     jx = - eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] <= @x
  488.     jy = - eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] <= @y
  489.     jx = - eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] <= @x
  490.     jy = + eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] >= @y
  491.     jx = + eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] >= @x
  492.     jy = + eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] >= @y
  493.     jump(jx, jy)
  494.   end
  495.  
  496.   # distance
  497.   def eval_distance(target)
  498.     if target.is_a?(Array)
  499.       distance_x = (@x - target[0]).abs
  500.       distance_y = (@y - target[1]).abs
  501.     else
  502.       distance_x = (@x - target.x).abs
  503.       distance_y = (@y - target.y).abs
  504.     end
  505.     return [distance_x, distance_y]
  506.   end
  507.  
  508.   # check if the game player and follower are executing an action
  509.   def battler_acting?
  510.     return true if @user_casting[0] > 0 || @targeting[0]
  511.     return true if @knockdown_data[0] > 0 and battler.deadposing.nil?
  512.     return true if @anime_speed > 0
  513.     return true if @hookshoting[0] || @making_spiral
  514.     if self.is_a?(Game_Player)
  515.       $game_player.followers.each {|f| return true if f.battler_acting?}
  516.     end
  517.     return false
  518.   end
  519.  
  520.   def battler
  521.   end
  522.  
  523.   #use single tools
  524.   def use_weapon(id)
  525.     return unless tool_can_use?
  526.     process_tool_action($data_weapons[id])
  527.   end
  528.  
  529.   def use_item(id)
  530.     return unless tool_can_use?
  531.     process_tool_action($data_items[id])
  532.   end
  533.  
  534.   def use_skill(id)
  535.     return unless tool_can_use?
  536.     process_tool_action($data_skills[id])
  537.   end
  538.  
  539.   def use_armor(id)
  540.     return unless tool_can_use?
  541.     process_tool_action($data_armors[id])
  542.   end
  543.  
  544.   # use multiple tools
  545.   def rand_weapon(*args)
  546.     return unless tool_can_use?
  547.     process_tool_action($data_weapons[args[rand(args.size)]])
  548.   end
  549.  
  550.   def rand_item(*args)
  551.     return unless tool_can_use?
  552.     process_tool_action($data_items[args[rand(args.size)]])
  553.   end
  554.  
  555.   def rand_skill(*args)
  556.     return unless tool_can_use?
  557.     process_tool_action($data_skills[args[rand(args.size)]])
  558.   end
  559.  
  560.   def rand_armor(*args)
  561.     return unless tool_can_use?
  562.     process_tool_action($data_armors[args[rand(args.size)]])
  563.   end
  564.  
  565.   def tool_can_use?
  566.     return false if @hookshoting[0] || @making_spiral
  567.     return false if @user_casting[0] > 0 || @targeting[0]
  568.     return false if battler.nil?
  569.     return false if battler.dead?
  570.     return false if @doingcombo > 0 || @battler_guarding[0]
  571.     return false if $game_message.busy?
  572.     return true
  573.   end
  574.  
  575.   def load_target_selection(item)
  576.     @targeting[0] = true; @targeting[1] = item
  577.     if self.is_a?(Game_Player)
  578.       $game_player.pearl_menu_call = [:battler, 2]
  579.     elsif self.is_a?(Game_Follower)
  580.       @targeting[2] = @targeted_character
  581.       @targeting = [false, item=nil, char=nil] if @targeting[2].nil?
  582.     elsif self.is_a?(Projectile)
  583.       if user.is_a?(Game_Player)
  584.         user.targeting[0] = true; user.targeting[1] = item
  585.         $game_player.pearl_menu_call = [:battler, 2]
  586.       end
  587.       if user.is_a?(Game_Follower)
  588.         @targeting[2] = user.targeted_character
  589.         @targeting = [false, item=nil, char=nil] if @targeting[2].nil?
  590.       end
  591.     end
  592.   end
  593.  
  594.   def playdead
  595.     @angle_fx = 90
  596.   end
  597.  
  598.   def resetplaydead
  599.     @angle_fx = 0.0
  600.   end
  601.  
  602.   #action canceling
  603.   def force_cancel_actions
  604.     @user_casting[0] = 0
  605.     @anime_speed = 0
  606.   end
  607.  
  608.   def speed(x)
  609.     @move_speed = x
  610.   end
  611.  
  612.   def anima(x)
  613.     @animation_id = x
  614.   end
  615.  
  616.   # aply melee params
  617.   def apply_weapon_param(weapon, add)
  618.     id = 0
  619.     for param in weapon.params
  620.       add ? battler.add_param(id, param) : battler.add_param(id, -param)
  621.       id += 1
  622.     end
  623.   end
  624.  
  625.   # Short script call for poping damage text
  626.   def pop_damage(custom=nil)
  627.     $game_player.damage_pop.push(DamagePop_Obj.new(self, custom))
  628.   end
  629.  
  630.   #check if target is unable to move
  631.   def force_stopped?
  632.     return true if @anime_speed > 0 || @knockdown_data[0] > 0 ||
  633.     @stopped_movement > 0 || @hookshoting[0] || @angle_fx != 0.0
  634.     return true if @making_spiral
  635.     return false
  636.   end
  637.  
  638.   # sensor
  639.   def obj_size?(target, size)
  640.     return false if size.nil?
  641.     distance = (@x - target.x).abs + (@y - target.y).abs
  642.     enable   = (distance <= size-1)
  643.     return true if enable
  644.     return false
  645.   end
  646.  
  647.   # sensor body
  648.   def body_size?(target, size)
  649.     distance = (@x - target[0]).abs + (@y - target[1]).abs
  650.     enable   = (distance <= size-1)
  651.     return true if enable
  652.     return false
  653.   end
  654.  
  655.   def faceto_face?(target)
  656.     return true if @direction == 2 and target.direction == 8
  657.     return true if @direction == 4 and target.direction == 6
  658.     return true if @direction == 6 and target.direction == 4
  659.     return true if @direction == 8 and target.direction == 2
  660.     return false
  661.   end
  662.  
  663.   def adjustcxy
  664.     push_x, push_y =   0,   1 if @direction == 2
  665.     push_x, push_y = - 1,   0 if @direction == 4
  666.     push_x, push_y =   1,   0 if @direction == 6
  667.     push_x, push_y =   0, - 1 if @direction == 8
  668.     return [push_x, push_y]
  669.   end
  670.  
  671.   def in_frontof?(target)
  672.     return true if @direction == 2 and @x == target.x and (@y+1) == target.y
  673.     return true if @direction == 4 and (@x-1) == target.x and @y == target.y
  674.     return true if @direction == 6 and (@x+1) == target.x and @y == target.y
  675.     return true if @direction == 8 and @x == target.x and (@y-1) == target.y
  676.     return false
  677.   end
  678.  
  679.   # detect map edges ignoring loop maps
  680.   def facing_corners?
  681.     case $game_map.map.scroll_type
  682.     when 1 then return false if @direction == 2 || @direction == 8
  683.     when 2 then return false if @direction == 4 || @direction == 6
  684.     when 3 then return false
  685.     end
  686.     m = $game_map
  687.     unless @x.between?(1, m.width - 2) && @y.between?(1, m.height - 2)
  688.       return true if @x == 0 and @direction == 4
  689.       return true if @y == 0 and @direction == 8
  690.       return true if @x == m.width  - 1  and @direction == 6
  691.       return true if @y == m.height - 1  and @direction == 2
  692.     end
  693.     return false
  694.   end
  695.  
  696.   # item usable test
  697.   def usable_test_passed?(item)
  698.     return true if battler.is_a?(Game_Enemy) && item.is_a?(RPG::Item)
  699.     itemcost = item.tool_data("Tool Item Cost = ")
  700.     invoke = item.tool_data("Tool Invoke Skill = ")
  701.     if battler.is_a?(Game_Actor) and itemcost != nil and itemcost != 0
  702.       return false if !battler.usable?($data_items[itemcost])
  703.     end
  704.     if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
  705.       return false if !battler.usable?(item)
  706.     else
  707.       if invoke != nil and invoke != 0
  708.         return false if !battler.usable?($data_skills[invoke])
  709.       else
  710.         return false if !battler.attack_usable?
  711.       end
  712.     end
  713.     return true
  714.   end
  715.  
  716.   # process the tool and verify wheter can be used
  717.   def process_tool_action(item)
  718.     PearlKernel.load_item(item)
  719.     return if !battler.tool_ready?(item)
  720.  
  721.     unless PearlKernel.has_data?
  722.       if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
  723.         msgbox('Tool data missing') if $DEBUG
  724.         return
  725.       end
  726.       if item.scope.between?(1, 6)
  727.         msgbox('Tool data missing') if $DEBUG
  728.         return
  729.       elsif item.scope == 0
  730.         return
  731.  
  732.       elsif !battler.usable?(item)
  733.         RPG::SE.new("Cursor1", 80).play if self.is_a?(Game_Player)
  734.         return
  735.       end
  736.     end
  737.  
  738.     if PearlKernel.has_data? and not usable_test_passed?(item)
  739.       RPG::SE.new("Cursor1", 80).play if self.is_a?(Game_Player)
  740.       return
  741.     end
  742.  
  743.     @user_casting = [PearlKernel.tool_castime,item] if PearlKernel.has_data?
  744.     if @user_casting[0] > 0
  745.       @animation_id = 0
  746.       @animation_id = PearlKernel.tool_castanimation
  747.     else
  748.       load_abs_tool(item)
  749.     end
  750.   end
  751.  
  752.   # load the abs tool
  753.   def load_abs_tool(item)
  754.     return if @knockdown_data[0] > 0
  755.     PearlKernel.load_item(item)
  756.  
  757.     return if self.is_a?(Game_Follower) and @targeted_character.nil?
  758.  
  759.     if !@targeting[0] and  self.battler.is_a?(Game_Actor)
  760.       if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
  761.         # apply target to skills items
  762.         if PearlKernel.tool_target == "true" || item.scope == 7 ||
  763.           item.scope == 9
  764.           load_target_selection(item)
  765.           return
  766.         end
  767.       else
  768.         # apply target parsing the invoked skill to weapons and armors
  769.         invoke = PearlKernel.tool_invoke
  770.         if invoke != nil && invoke > 0 && invoke != 1 && invoke != 2
  771.           invokeskill = $data_skills[invoke]
  772.           if PearlKernel.tool_target == "true" || invokeskill.scope == 7 ||
  773.             invokeskill.scope == 9
  774.             load_target_selection(item)
  775.             return
  776.           end
  777.           # apply target to normal weapon and armor without invoking
  778.         else
  779.           if PearlKernel.tool_target == "true"
  780.             load_target_selection(item)
  781.             return
  782.           end
  783.         end
  784.       end
  785.     end
  786.     if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
  787.       battler.use_item(item)
  788.     else
  789.       if PearlKernel.tool_invoke != 0
  790.         battler.use_item($data_skills[PearlKernel.tool_invoke])
  791.       end
  792.     end
  793.  
  794.     # if the tool has data continue
  795.     if PearlKernel.has_data?
  796.       consume_ammo_item(item) if battler.is_a?(Game_Actor) and
  797.       PearlKernel.tool_itemcost != 0
  798.       @anime_speed = PearlKernel.user_animespeed
  799.       battler.apply_cooldown(item, PearlKernel.tool_cooldown)
  800.     end
  801.     create_projectile_object(item)
  802.     create_anime_sprite_object(item)
  803.   end
  804.  
  805.   # projectile creator
  806.   def create_projectile_object(item)
  807.     if PearlKernel.tool_special == "hook"
  808.       PearlKernel.tool_distance.times {|i|
  809.       $game_player.projectiles.push(Projectile.new(self, item, i))}
  810.       @hookshoting[0] = true
  811.     elsif PearlKernel.tool_special == "triple"       # loads 3 projectiles
  812.       for i in [:uno, :dos, :tres]
  813.         $game_player.projectiles.push(Projectile.new(self, item, i))
  814.       end
  815.     elsif PearlKernel.tool_special == "quintuple"     #loads 5 projectiles
  816.       for i in [:uno, :dos, :tres, :cuatro, :cinco]
  817.         $game_player.projectiles.push(Projectile.new(self, item, i))
  818.       end
  819.     elsif PearlKernel.tool_special == "octuple"       # loads 8 projectiles
  820.       for i in [:uno, :dos, :tres, :cuatro, :cinco, :seis, :siete, :ocho]
  821.         $game_player.projectiles.push(Projectile.new(self, item, i))
  822.       end
  823.     else # load default projectile
  824.       $game_player.projectiles.push(Projectile.new(self, item))
  825.     end
  826.   end
  827.  
  828.   # User anime sprite creation
  829.   def create_anime_sprite_object(item)
  830.     $game_player.anime_action.each {|i|
  831.     if i.user == self
  832.       if i.custom_graphic
  833.         @transparent = false
  834.         i.user.using_custom_g = false
  835.       end
  836.       $game_player.anime_action.delete(i)
  837.     end}
  838.  
  839.     if PearlKernel.user_graphic != "nil"
  840.       return if PearlKernel.user_graphic.nil?
  841.       $game_player.anime_action.push(Anime_Obj.new(self, item))
  842.     end
  843.  
  844.     # using iconset graphic
  845.     if PearlKernel.user_graphic == "nil" and
  846.       !item.tool_data("User Iconset = ", false).nil?
  847.       return if PearlKernel.user_graphic.nil?
  848.       $game_player.anime_action.push(Anime_Obj.new(self, item))
  849.     end
  850.   end
  851.  
  852.   # consume ammo item
  853.   def consume_ammo_item(item)
  854.     itemcost = $data_items[PearlKernel.tool_itemcost]
  855.     return if item.is_a?(RPG::Item) and item.consumable and item == itemcost
  856.     battler.use_item(itemcost)
  857.   end
  858.  
  859.   alias falcaopearl_chaupdate update
  860.   def update
  861.     update_falcao_pearl_abs
  862.     falcaopearl_chaupdate
  863.   end
  864.  
  865.   # Falcao pearl abs main update
  866.   def update_falcao_pearl_abs
  867.     if @user_move_distance[0] > 0 and not moving?
  868.       move_forward ; @user_move_distance[0] -= 1
  869.     end
  870.     return if battler.nil?
  871.     update_pearlabs_timing
  872.     update_followers_attack if self.is_a?(Game_Follower) && self.visible?
  873.     if @targeting[2] != nil
  874.       load_abs_tool(@targeting[1]) if battler.is_a?(Game_Actor)
  875.       @targeting = [false, item=nil, char=nil]
  876.     end
  877.     update_battler_collapse
  878.     update_state_effects
  879.  
  880.     @combodata.each {|combo|
  881.     if combo[3] > 0
  882.       combo[3] -= 1
  883.       if combo[3] == 0
  884.         perform_combo(combo[0], combo[1], combo[2])
  885.         @combodata.delete(combo)
  886.       end
  887.       break
  888.     end}
  889.   end
  890.  
  891.   def perform_combo(kind, id, jumpp)
  892.     if jumpp == 'jump'
  893.       jump(0, 0)
  894.       move_forward
  895.     end
  896.     case kind
  897.     when :weapon then use_weapon(id)
  898.     when :armor  then use_armor(id)
  899.     when :item   then use_item(id)
  900.     when :skill  then use_skill(id)
  901.     end
  902.     @doingcombo = 12
  903.   end
  904.  
  905.   #========================================================================
  906.   #     * followers attacks engine
  907.  
  908.   def fo_tool
  909.     return actor.equips[0]       if actor.primary_use == 1
  910.     return actor.equips[1]       if actor.primary_use == 2
  911.     return actor.assigned_item   if actor.primary_use == 3
  912.     return actor.assigned_item2  if actor.primary_use == 4
  913.     return actor.assigned_skill  if actor.primary_use == 5
  914.     return actor.assigned_skill2 if actor.primary_use == 6
  915.     return actor.assigned_skill3 if actor.primary_use == 7
  916.     return actor.assigned_skill4 if actor.primary_use == 8
  917.   end
  918.  
  919.   # followers attack engine
  920.   def update_followers_attack
  921.     if fo_tool.nil? || battler.dead?
  922.       @targeted_character = nil if @targeted_character != nil
  923.       return
  924.     end
  925.     return if @stopped_movement > 0
  926.     if @follower_attacktimer > 0
  927.       @follower_attacktimer -= 1
  928.       if @follower_attacktimer == 40 and !moving?
  929.         r = rand(3)
  930.         move_random if r == 0 || r == 1
  931.         move_away_from_character(@targeted_character) if
  932.         !@targeted_character.nil? and r == 2
  933.       end
  934.     end
  935.  
  936.      # si la skill es para el player
  937.     if @targeted_character != nil and @targeted_character.is_a?(Game_Player)
  938.       if all_enemies_dead?
  939.         delete_targetf
  940.         return
  941.       end
  942.       use_predefined_tool
  943.       return
  944.     end
  945.  
  946.     # si la skill es para un enemigo continuar
  947.     if @targeted_character != nil
  948.       use_predefined_tool
  949.       return if @targeted_character.nil?
  950.       # reset if the target is dead
  951.       if @targeted_character.collapsing?
  952.         force_cancel_actions
  953.         delete_targetf
  954.       end
  955.     else
  956.       # select a follower slected target
  957.       $game_player.followers.each do |follower|
  958.         if !follower.targeted_character.nil?
  959.           next if follower.targeted_character.is_a?(Game_Player)
  960.           if follower.stuck_timer >= 10
  961.             follower.targeted_character = nil
  962.             return
  963.           end
  964.           @targeted_character = follower.targeted_character
  965.           break
  966.         end
  967.       end
  968.     end
  969.   end
  970.  
  971.   # prepare the tool usage
  972.   def setup_followertool_usage
  973.     @range_view = 2
  974.     @range_view = 6 if fo_tool.tool_data("Tool Target = ", false) == "true" ||
  975.     fo_tool.tool_data("Tool Special = ", false) == "autotarget"
  976.  
  977.     if fo_tool.is_a?(RPG::Skill) || fo_tool.is_a?(RPG::Item)
  978.       if fo_tool.scope.between?(1, 6)
  979.         setup_target
  980.       else ; @targeted_character = $game_player
  981.         @range_view = 6
  982.       end
  983.       # prepare tool for invoke follower
  984.     elsif fo_tool.is_a?(RPG::Weapon) || fo_tool.is_a?(RPG::Armor)
  985.       invoke = fo_tool.tool_data("Tool Invoke Skill = ")
  986.       if invoke > 0
  987.         if $data_skills[invoke].scope.between?(1, 6)
  988.           setup_target
  989.         else ; @targeted_character = $game_player
  990.           @range_view = 6
  991.         end
  992.       else
  993.         # no invoke skill just set up an enemy target
  994.         setup_target
  995.       end
  996.     end
  997.   end
  998.  
  999.   # use the predifined tool
  1000.   def use_predefined_tool
  1001.     update_follower_movement
  1002.     return if @targeted_character.nil?
  1003.     if obj_size?(@targeted_character, @range_view) && @follower_attacktimer == 0
  1004.       turn_toward_character(@targeted_character)
  1005.       use_weapon(fo_tool.id) if actor.primary_use == 1
  1006.       use_armor(fo_tool.id)  if actor.primary_use == 2
  1007.       use_item(fo_tool.id)   if actor.primary_use == 3 || actor.primary_use == 4
  1008.       use_skill(fo_tool.id)  if actor.primary_use==5 || actor.primary_use==6 ||
  1009.       actor.primary_use == 7 || actor.primary_use == 8
  1010.       if fo_tool.tool_data("User Graphic = ", false).nil?
  1011.         @targeted_character = nil
  1012.         turn_toward_player
  1013.       end
  1014.       @follower_attacktimer = 60
  1015.     end
  1016.     delete_targetf if self.actor.dead?
  1017.   end
  1018.  
  1019.   def all_enemies_dead?
  1020.     for event in $game_map.event_enemies
  1021.       if event.on_battle_screen? && event.enemy_ready?
  1022.         return false if $game_player.obj_size?(event,PearlKernel::PlayerRange+1)
  1023.       end
  1024.     end
  1025.     return true
  1026.   end
  1027.  
  1028.   def delete_targetf
  1029.     @targeted_character = nil
  1030.   end
  1031.  
  1032.   #------------------------
  1033.   # follower movement attack
  1034.   def reset_targeting_settings(target)
  1035.     target.being_targeted = false if target.is_a?(Game_Event)
  1036.     delete_targetf
  1037.     turn_toward_player
  1038.     @stuck_timer = 0
  1039.   end
  1040.  
  1041.   def update_follower_movement
  1042.     target = @targeted_character
  1043.     if @stuck_timer >= 30
  1044.       reset_targeting_settings(target)
  1045.       return
  1046.     end
  1047.  
  1048.     # if the follower is unabble to use the tool
  1049.     unless usable_test_passed?(fo_tool)
  1050.       if SceneManager.scene_is?(Scene_Map)
  1051.         reset_targeting_settings(target)
  1052.         @balloon_id = PearlKernel::FailBalloon
  1053.         return
  1054.       end
  1055.     end
  1056.  
  1057.     return if target.nil?
  1058.     @stuck_timer += 1 if !obj_size?(target, @range_view) and !moving?
  1059.  
  1060.     if moving? || @anime_speed > 0 || @making_spiral || @hookshoting[0] ||
  1061.       @knockdown_data[0] > 0
  1062.       @stuck_timer = 0
  1063.     end
  1064.     return if moving?
  1065.     if fo_tool.tool_data("Tool Target = ", false) == "true" ||
  1066.       fo_tool.tool_data("Tool Special = ", false) == "autotarget" ||
  1067.       target.is_a?(Game_Player)
  1068.       # using skill con target true magical
  1069.       cpu_reactiontype(1, target)
  1070.       return
  1071.       # target not exist
  1072.     else
  1073.  
  1074.       if fo_tool.is_a?(RPG::Skill) || fo_tool.is_a?(RPG::Item)
  1075.         fo_tool.scope.between?(1, 6) ? cpu_reactiontype(2, target) : # to enemy
  1076.         cpu_reactiontype(1, target) # benefical
  1077.       else
  1078.         # for weapon armor without target
  1079.         cpu_reactiontype(2, target)
  1080.       end
  1081.     end
  1082.     return if !obj_size?(target, @range_view)
  1083.     return if target.is_a?(Game_Player)
  1084.     case rand(40)
  1085.     when 4  then move_backward
  1086.     when 10 then move_random
  1087.     end
  1088.   end
  1089.  
  1090.   # cpu reaction
  1091.   def cpu_reactiontype(type, target)
  1092.     unless on_battle_screen?
  1093.       3.times.each {|i|  move_toward_player}
  1094.       return
  1095.     end
  1096.     move_toward_character(target) if !obj_size?(target, @range_view) if type==1
  1097.     if @follower_attacktimer == 0 || !obj_size?(target, @range_view)
  1098.       move_toward_character(target) if type == 2
  1099.     end
  1100.   end
  1101.   #-------------------------------------------------
  1102.  
  1103.   # buff timer
  1104.   def update_buff_timing
  1105.     battler.buff_turns.each do |id, value|
  1106.       if battler.buff_turns[id] > 0
  1107.         battler.buff_turns[id] -= 1
  1108.         if battler.buff_turns[id] <= 0
  1109.           battler.remove_buff(id)
  1110.           pop_damage
  1111.         end
  1112.       end
  1113.     end
  1114.   end
  1115.  
  1116.   #blow power effect
  1117.   def update_blow_power_effect
  1118.     if @blowpower[4] > 0
  1119.       @blowpower[4] -= 1
  1120.       if @blowpower[4] == 0
  1121.         @direction_fix = @blowpower[2]
  1122.         @move_speed = @blowpower[3]
  1123.       end
  1124.     end
  1125.     if @blowpower[0] > 0 and !moving?
  1126.       @move_speed = 5.5
  1127.       @direction_fix = true
  1128.       move_straight(@blowpower[1]); @blowpower[0] -= 1
  1129.       if @blowpower[0] == 0
  1130.         @blowpower[4] = 10
  1131.       end
  1132.     end
  1133.   end
  1134.  
  1135.   # Pearl timing
  1136.   def update_pearlabs_timing
  1137.     @just_hitted -= 1 if @just_hitted > 0
  1138.     @stopped_movement -= 1 if @stopped_movement > 0
  1139.     @doingcombo -= 1 if @doingcombo > 0
  1140.  
  1141.     # hookshooting
  1142.     if @hookshoting[3] > 0
  1143.       @hookshoting[3] -= 1
  1144.       if @hookshoting[3] == 0
  1145.         @hookshoting = [false, false, false, 0]
  1146.         @user_move_distance[3].being_grabbed = false if
  1147.         @user_move_distance[3].is_a?(Game_Event)
  1148.         @user_move_distance[3] = nil
  1149.       end
  1150.     end
  1151.     update_buff_timing
  1152.     update_blow_power_effect
  1153.     # anime
  1154.     if @anime_speed > 0
  1155.       @pattern = 0
  1156.       @anime_speed -= 1
  1157.     end
  1158.     # casting
  1159.     if @user_casting[0] > 0
  1160.       @user_casting[0] -= 1
  1161.       load_abs_tool(@user_casting[1]) if @user_casting[0] == 0
  1162.     end
  1163.     update_knockdown
  1164.   end
  1165.  
  1166.   # Update battler collapse
  1167.  
  1168.   def check_for_dead_four
  1169.     return if $game_party.members.size <= 4
  1170.     SceneManager.goto(Scene_Gameover) if all_fourdead?
  1171.   end
  1172.  
  1173.   def all_fourdead?
  1174.     m = $game_party.battle_members
  1175.     return true if m[0].dead? && m[1].dead? && m[2].dead? && m[3].dead?
  1176.     return false
  1177.   end
  1178.  
  1179.   def update_battler_collapse
  1180.     if @colapse_time > 0
  1181.       @colapse_time -= 1
  1182.       force_cancel_actions
  1183.       if battler.is_a?(Game_Actor)
  1184.         Sound.play_actor_collapse if @secollapse.nil?
  1185.         @secollapse = true
  1186.  
  1187.         if @colapse_time == 0
  1188.           @secollapse = nil
  1189.           for event in $game_map.event_enemies
  1190.             if event.agroto_f == self
  1191.               event.agroto_f = nil
  1192.             end
  1193.           end
  1194.  
  1195.           check_for_dead_four
  1196.           member = $game_party.battle_members
  1197.           # swap and reset player
  1198.           if self.is_a?(Game_Player)
  1199.             reset_knockdown_actors
  1200.             battler.deadposing=$game_map.map_id if PearlKernel::FollowerDeadPose
  1201.             $game_party.swap_order(0,3) if !member[3].nil? and !member[3].dead?
  1202.             $game_party.swap_order(0,2) if !member[2].nil? and !member[2].dead?
  1203.             $game_party.swap_order(0,1) if !member[1].nil? and !member[1].dead?
  1204.           else
  1205.             if PearlKernel::FollowerDeadPose
  1206.               battler.deadposing = $game_map.map_id
  1207.               if !$game_player.follower_fighting? and member.size > 2
  1208.                 swap_dead_follower
  1209.               else
  1210.                 $game_player.reserved_swap << battler.id if member.size > 2
  1211.               end
  1212.             end
  1213.           end
  1214.         end
  1215.  
  1216.       elsif battler.is_a?(Game_Enemy)
  1217.         @die_through = @through if @die_through.nil?
  1218.         @through = true
  1219.         apply_collapse_anime(battler.collapse_type)
  1220.         @secollapse = true
  1221.         battler.object ? @transparent = true : @opacity -= 2 if !@deadposee
  1222.         if @colapse_time == 0
  1223.           self.kill_enemy
  1224.         end
  1225.       end
  1226.     end
  1227.   end
  1228.  
  1229.   def swap_dead_follower
  1230.     reset_knockdown_actors
  1231.     member = $game_party.battle_members
  1232.     member.each_with_index.each do |actorr, i|
  1233.       next unless actorr.id == self.actor.id
  1234.       case member.size
  1235.       when 3
  1236.         break if i == 2
  1237.         $game_party.swap_order(i, 2)
  1238.       when 4
  1239.         break if i == 3
  1240.         if !member[3].dead?
  1241.           $game_party.swap_order(i, 3)
  1242.           break
  1243.         end
  1244.         if !member[2].dead?  
  1245.           $game_party.swap_order(i, 2)
  1246.           break
  1247.         end
  1248.       end
  1249.     end
  1250.   end
  1251.  
  1252.   def apply_collapse_anime(type)
  1253.     # sound and animation
  1254.     if battler.die_animation != nil
  1255.       @animation_id = battler.die_animation if @secollapse.nil?
  1256.     else
  1257.       Sound.play_enemy_collapse if @secollapse.nil? and !battler.object
  1258.     end
  1259.     return if battler.object
  1260.     if @deadposee
  1261.       @knockdown_data[0] = 8
  1262.       return
  1263.     end
  1264.     type = PearlKernel::DefaultCollapse if type.nil?
  1265.     case type.to_sym
  1266.     when :zoom_vertical
  1267.       @zoomfx_x -= 0.03
  1268.       @zoomfx_y += 0.02
  1269.     when :zoom_horizontal
  1270.       @zoomfx_x += 0.03
  1271.       @zoomfx_y -= 0.02
  1272.     when :zoom_maximize
  1273.       @zoomfx_x += 0.02
  1274.       @zoomfx_y += 0.02
  1275.     when :zoom_minimize
  1276.       @zoomfx_x -= 0.02
  1277.       @zoomfx_y -= 0.02
  1278.     end
  1279.   end
  1280.  
  1281.   # konck down engine update
  1282.   def update_knockdown
  1283.     if @knockdown_data[0] > 0
  1284.       @knockdown_data[0] -= 1
  1285.       @knockdown_data[0] == 0 ? knowdown_effect(2) : knowdown_effect(1)
  1286.       if @knockdown_data[1] != nil
  1287.         @pattern = @knockdown_data[2]
  1288.         @direction = @knockdown_data[3]
  1289.       end
  1290.     end
  1291.   end
  1292.  
  1293.   def knowdown_effect(type)
  1294.     return if self.is_a?(Projectile)
  1295.     if type[0] == 1
  1296.       if @knockdown_data[1] == nil
  1297.         if battler.is_a?(Game_Enemy)
  1298.           if self.knockdown_enable
  1299.             force_cancel_actions
  1300.             self_sw = PearlKernel::KnockdownSelfW
  1301.             $game_self_switches[[$game_map.map_id, self.id, self_sw]] = true
  1302.             @knockdown_data[1] = self_sw
  1303.             self.refresh
  1304.             @knockdown_data[2] = self.page.graphic.pattern
  1305.             @knockdown_data[3] = self.page.graphic.direction
  1306.             $game_map.screen.start_shake(7, 4, 20)
  1307.           end
  1308.  
  1309.           @knockdown_data[0] = 0 if @knockdown_data[1] == nil
  1310.        elsif battler.is_a?(Game_Actor)
  1311.          if PearlKernel.knock_actor(self.actor) != nil and
  1312.            if @knockdown_data[1] == nil
  1313.              force_cancel_actions
  1314.              @knockdown_data[1] = @character_name
  1315.              @knockdown_data[4] = @character_index
  1316.              @character_name = PearlKernel.knock_actor(self.actor)[0]
  1317.              @character_index = PearlKernel.knock_actor(self.actor)[1]
  1318.              @knockdown_data[2] = PearlKernel.knock_actor(self.actor)[2]
  1319.              @knockdown_data[3] = PearlKernel.knock_actor(self.actor)[3]
  1320.              $game_map.screen.start_shake(7, 4, 20) if battler.deadposing.nil?
  1321.            end
  1322.          end
  1323.          @knockdown_data[0] = 0 if @knockdown_data[1] == nil
  1324.         end
  1325.       end
  1326.     elsif type == 2
  1327.       if battler.is_a?(Game_Enemy)
  1328.         if @deadposee and battler.dead?
  1329.           @knockdown_data[1] = nil
  1330.           return
  1331.         end
  1332.         $game_self_switches[[$game_map.map_id, self.id,
  1333.         @knockdown_data[1]]] = false if @knockdown_data[1] != nil
  1334.         @knockdown_data[1] = nil
  1335.       else
  1336.         @character_name = @knockdown_data[1]
  1337.         @character_index = @knockdown_data[4]
  1338.         @knockdown_data[1] = nil
  1339.       end
  1340.     end
  1341.   end
  1342.  
  1343.   #================================
  1344.   # states
  1345.   def primary_state_ani
  1346.     return nil if battler.states[0].nil?
  1347.     return battler.states[0].tool_data("State Animation = ")
  1348.   end
  1349.  
  1350.   # higer priority state animation displayed
  1351.   def update_state_effects
  1352.     return if battler.nil?
  1353.     @state_poptimer[0] += 1 unless primary_state_ani.nil?
  1354.     if @state_poptimer[0] == 30
  1355.       @animation_id = primary_state_ani
  1356.       @animation_id = 0 if @animation_id.nil?
  1357.     elsif @state_poptimer[0] == 180
  1358.       @state_poptimer[0] = 0
  1359.     end
  1360.     update_state_action_steps
  1361.   end
  1362.  
  1363.   # update state actions
  1364.   def update_state_action_steps
  1365.     for state in battler.states
  1366.       if state.remove_by_walking
  1367.         if !battler.state_steps[state.id].nil? &&
  1368.           battler.state_steps[state.id] > 0
  1369.           battler.state_steps[state.id] -= 1
  1370.         end
  1371.         if battler.state_steps[state.id] == 0
  1372.           battler.remove_state(state.id)
  1373.           pop_damage
  1374.         end
  1375.       end
  1376.       if state.restriction == 4
  1377.         @stopped_movement = 10
  1378.         @pattern = 2 if @knockdown_data[0] == 0
  1379.       end
  1380.       state.features.each do |feature|
  1381.         if feature.code == 22
  1382.           @knockdown_data[0] =10 if state.restriction == 4 && feature.data_id==1
  1383.           next unless feature.data_id.between?(7, 9)
  1384.           apply_regen_state(state, feature.data_id)
  1385.         end
  1386.       end
  1387.     end
  1388.   end
  1389.  
  1390.   # apply regen for hp, mp and tp
  1391.   def apply_regen_state(state, type)
  1392.     random = state.tool_data("State Effect Rand Rate = ")
  1393.     random = 120 if random.nil?
  1394.     if rand(random) == 1
  1395.       battler.regenerate_hp if type == 7
  1396.       battler.regenerate_mp if type == 8
  1397.       battler.regenerate_tp if type == 9
  1398.       if type == 7 and battler.result.hp_damage == 0
  1399.         @colapse_time = 80
  1400.         battler.add_state(1)
  1401.         return
  1402.       end
  1403.       type == 9 ? pop_damage("Tp Up!") : pop_damage
  1404.     end
  1405.   end
  1406.  
  1407.   alias falcaopearl_update_anime_pattern update_anime_pattern
  1408.   def update_anime_pattern
  1409.     return if @anime_speed > 0 || @knockdown_data[0] > 0
  1410.     falcaopearl_update_anime_pattern
  1411.   end
  1412.  
  1413.   #=============================================================================
  1414.   # Reset Pearl ABS System
  1415.  
  1416.   # reset from game player call
  1417.   def reset_knockdown_actors
  1418.     # reset knock down
  1419.     if @knockdown_data[1] != nil
  1420.       @knockdown_data[0] = 0
  1421.       knowdown_effect(2)
  1422.     end
  1423.     # force clear knock down
  1424.     $game_player.followers.each do |follower|
  1425.       if follower.knockdown_data[1] != nil
  1426.         follower.knockdown_data[0] = 0
  1427.         follower.knowdown_effect(2)
  1428.       end
  1429.     end
  1430.   end
  1431.  
  1432.   # reset knockdown enemies game player call
  1433.   def reset_knockdown_enemies
  1434.     $game_map.events.values.each do |event|
  1435.       if event.knockdown_data[1] != nil
  1436.         event.knockdown_data[0] = 0
  1437.         event.knowdown_effect(2)
  1438.       end
  1439.       if event.deadposee and event.killed
  1440.         $game_self_switches[[$game_map.map_id, event.id,
  1441.         PearlKernel::KnockdownSelfW]] = false
  1442.       end
  1443.     end
  1444.   end
  1445.  
  1446.   # glabal reseting
  1447.   def pearl_abs_global_reset
  1448.     force_cancel_actions
  1449.     battler.remove_state(9) if @battler_guarding[0]
  1450.     @battler_guarding = [false, nil]
  1451.     @making_spiral = false
  1452.     set_hook_variables
  1453.     @using_custom_g = false
  1454.     $game_player.followers.each do |f|
  1455.       f.targeted_character = nil if !f.targeted_character.nil?
  1456.       f.stuck_timer = 0 if f.stuck_timer > 0
  1457.       f.follower_attacktimer = 0 if f.follower_attacktimer > 0
  1458.       f.force_cancel_actions unless f.visible?
  1459.       f.battler.remove_state(9) if f.battler_guarding[0]
  1460.       f.battler_guarding = [false, nil]
  1461.       f.set_hook_variables
  1462.       f.making_spiral = false
  1463.     end
  1464.     reset_knockdown_actors
  1465.     reset_knockdown_enemies
  1466.     $game_player.projectiles.clear
  1467.     $game_player.damage_pop.clear
  1468.     $game_player.anime_action.clear
  1469.     $game_player.enemy_drops.clear
  1470.     @send_dispose_signal = true
  1471.   end
  1472. end
  1473.  
  1474. #===============================================================================
  1475. # Evets as enemies registration
  1476.  
  1477. class Game_Event < Game_Character
  1478.   attr_accessor :enemy, :move_type, :page, :deadposee
  1479.   attr_accessor :being_targeted, :agroto_f, :draw_drop, :dropped_items
  1480.   attr_accessor :start_delay, :epassive, :erased, :killed, :boom_grabdata
  1481.   attr_reader   :token_weapon, :token_armor,:token_item,:token_skill,:boom_start
  1482.   attr_reader   :hook_pull, :hook_grab, :event, :knockdown_enable, :boom_grab
  1483.   attr_reader   :respawn_anim
  1484.   alias falcaopearlabs_iniev initialize
  1485.   def initialize(map_id, event)
  1486.     @inrangeev = nil
  1487.     @being_targeted = false
  1488.     @agroto_f = nil
  1489.     @draw_drop = false
  1490.     @dropped_items = []
  1491.     @epassive = false
  1492.     @touch_damage = 0
  1493.     @start_delay = 0
  1494.     @touch_atkdelay = 0
  1495.     @killed = false
  1496.     @knockdown_enable = false
  1497.     @deadposee = false
  1498.     @respawn_anim = 0
  1499.     create_token_arrays
  1500.     falcaopearlabs_iniev(map_id, event)
  1501.     register_enemy(event)
  1502.   end
  1503.  
  1504.   def create_token_arrays
  1505.     @token_weapon = []
  1506.     @token_armor  = []
  1507.     @token_item   = []
  1508.     @token_skill  = []
  1509.   end
  1510.  
  1511.   alias falcaopearl_setup_page_settings setup_page_settings
  1512.   def setup_page_settings
  1513.     create_token_arrays
  1514.     falcaopearl_setup_page_settings
  1515.     wtag = string_data("<start_with_weapon: ")
  1516.     @token_weapon = wtag.split(",").map { |s| s.to_i } if wtag != nil
  1517.     atag = string_data("<start_with_armor: ")
  1518.     @token_armor = atag.split(",").map { |s| s.to_i } if atag != nil
  1519.     itag = string_data("<start_with_item: ")
  1520.     @token_item = itag.split(",").map { |s| s.to_i } if itag != nil
  1521.     stag = string_data("<start_with_skill: ")
  1522.     @token_skill = stag.split(",").map { |s| s.to_i } if stag != nil
  1523.     @hook_pull = string_data("<hook_pull: ") == "true"
  1524.     @hook_grab = string_data("<hook_grab: ") == "true"
  1525.     @boom_grab = string_data("<boom_grab: ") == "true"
  1526.     @boom_start = string_data("<boomed_start: ") == "true"
  1527.     @direction_fix = false if @hook_grab
  1528.     if has_token? || @hook_pull || @hook_grab || @boom_grab || @boom_start
  1529.       $game_map.events_withtags.push(self) unless
  1530.       $game_map.events_withtags.include?(self)
  1531.     end
  1532.   end
  1533.  
  1534.   def has_token?
  1535.     !@token_weapon.empty? || !@token_armor.empty? || !@token_item.empty? ||
  1536.     !@token_skill.empty?
  1537.   end
  1538.  
  1539.   def register_enemy(event)
  1540.  
  1541.     if !$game_system.remain_killed[$game_map.map_id].nil? and
  1542.       $game_system.remain_killed[$game_map.map_id].include?(self.id)
  1543.       return
  1544.     end
  1545.  
  1546.     @enemy  = Game_Enemy.new(0, $1.to_i) if event.name =~ /<enemy: (.*)>/i
  1547.     if @enemy != nil
  1548.       passive = @enemy.enemy.tool_data("Enemy Passive = ", false)
  1549.       @epassive = true if passive == "true"
  1550.       touch = @enemy.enemy.tool_data("Enemy Touch Damage Range = ")
  1551.       @sensor = @enemy.esensor
  1552.       @touch_damage = touch if touch != nil
  1553.       $game_map.event_enemies.push(self) # new separate enemy list
  1554.       $game_map.enemies.push(@enemy)     # just enemies used in the cooldown
  1555.       @event.pages.each do |page|
  1556.         if page.condition.self_switch_valid and
  1557.           page.condition.self_switch_ch == PearlKernel::KnockdownSelfW
  1558.           @knockdown_enable = true
  1559.           break
  1560.         end
  1561.       end
  1562.       pose = @enemy.enemy.tool_data("Enemy Dead Pose = ", false) == "true"
  1563.       @deadposee = true if pose and @knockdown_enable
  1564.     end
  1565.   end
  1566.  
  1567.   def update_state_effects
  1568.     @killed ? return : super
  1569.   end
  1570.  
  1571.   def collapsing?
  1572.     return true if @killed || @colapse_time > 0
  1573.     return false
  1574.   end
  1575.  
  1576.   def enemy_ready?
  1577.     return false if @enemy.nil? || @page.nil? || collapsing? || @enemy.object
  1578.     return true
  1579.   end
  1580.  
  1581.   def battler
  1582.     return @enemy
  1583.   end
  1584.  
  1585.   def apply_respawn
  1586.     return if @colapse_time > 0
  1587.     @draw_drop = false
  1588.     @dropped_items.clear
  1589.     @through = @die_through
  1590.     @through = false if @through.nil?
  1591.     @die_through = nil
  1592.     @secollapse = nil
  1593.     @colapse_time = 0
  1594.     @erased = false ; @opacity = 255
  1595.     @zoomfx_x = 1.0 ; @zoomfx_y = 1.0
  1596.     @killed = false
  1597.     @priority_type = 1 if @deadposee
  1598.     resetdeadpose
  1599.     refresh
  1600.   end
  1601.  
  1602.   def resetdeadpose
  1603.     if @deadposee
  1604.       $game_self_switches[[$game_map.map_id, @id,
  1605.       PearlKernel::KnockdownSelfW]] = false
  1606.     end
  1607.   end
  1608.  
  1609.   def kill_enemy
  1610.     @secollapse = nil
  1611.     @killed = true
  1612.     @priority_type = 0 if @deadposee
  1613.     gain_exp
  1614.     gain_gold
  1615.     etext = 'Exp '  + @enemy.exp.to_s if @enemy.exp > 0
  1616.     gtext = 'Gold ' + @enemy.gold.to_s if @enemy.gold > 0
  1617.     $game_player.pop_damage("#{etext} #{gtext}") if etext || gtext
  1618.     make_drop_items
  1619.     run_assigned_commands
  1620.   end
  1621.  
  1622.   def run_assigned_commands
  1623.     transform = @enemy.enemy.tool_data("Enemy Die Transform = ")
  1624.     switch = @enemy.enemy.tool_data("Enemy Die Switch = ")
  1625.     $game_switches[switch] = true if switch != nil
  1626.     variable = @enemy.enemy.tool_data("Enemy Die Variable = ")
  1627.     $game_variables[variable] += 1 if variable != nil
  1628.     self_sw = @enemy.enemy.tool_data("Enemy Die Self Switch = ", false)
  1629.     #$game_map.event_enemies.delete(self) if @enemy.object
  1630.     #$game_map.enemies.delete(@enemy) if @enemy.object
  1631.     if self_sw.is_a?(String)
  1632.       $game_self_switches[[$game_map.map_id, self.id, self_sw]] = true
  1633.       apply_respawn
  1634.       $game_map.event_enemies.delete(self)
  1635.       $game_map.enemies.delete(@enemy)
  1636.       unless $game_system.remain_killed.has_key?($game_map.map_id)
  1637.         $game_system.remain_killed[$game_map.map_id] = []
  1638.       end
  1639.       $game_system.remain_killed[$game_map.map_id].push(self.id) unless
  1640.       $game_system.remain_killed[$game_map.map_id].include?(self.id)
  1641.       @enemy = nil
  1642.     else
  1643.       erase unless @deadposee
  1644.       respawn = @enemy.enemy.tool_data("Enemy Respawn Seconds = ")
  1645.       animation = @enemy.enemy.tool_data("Enemy Respawn Animation = ")
  1646.       @respawn_count = respawn * 60 unless respawn.nil?
  1647.  
  1648.       @respawn_anim = animation unless animation.nil?
  1649.  
  1650.     end
  1651.     if transform != nil
  1652.       @enemy = Game_Enemy.new(0, transform)
  1653.       apply_respawn
  1654.     end
  1655.   end
  1656.  
  1657.   def make_drop_items
  1658.     @dropped_items = @enemy.make_drop_items
  1659.     unless @dropped_items.empty?
  1660.       $game_player.enemy_drops.push(self)
  1661.       $game_map.events_withtags.push(self) unless
  1662.       $game_map.events_withtags.include?(self)
  1663.     end
  1664.   end
  1665.  
  1666.   def gain_exp
  1667.     return if @enemy.exp == 0
  1668.     $game_party.all_members.each do |actor|
  1669.       actor.gain_exp(@enemy.exp)
  1670.     end
  1671.   end
  1672.  
  1673.   def gain_gold
  1674.     return if @enemy.gold == 0
  1675.     $game_party.gain_gold(@enemy.gold)
  1676.   end
  1677.  
  1678.   alias falcaopearlabs_updatev update
  1679.   def update
  1680.     @start_delay -= 1 if @start_delay > 0
  1681.     @touch_atkdelay -= 1 if @touch_atkdelay > 0
  1682.     update_enemy_sensor unless @enemy.nil?
  1683.     update_enemy_touch_damage unless @enemy.nil?
  1684.     falcaopearlabs_updatev
  1685.   end
  1686.  
  1687.   def update_enemy_touch_damage
  1688.     return unless @touch_damage > 0
  1689.     return unless @character_name != ""
  1690.     return if @epassive || @killed
  1691.     return if @touch_atkdelay > 0
  1692.     unless @enemy.object
  1693.       @agroto_f.nil? ? target = $game_player : target = @agroto_f
  1694.     else
  1695.       target = $game_player
  1696.       $game_player.followers.each do |follower|
  1697.         next unless follower.visible?
  1698.         if obj_size?(follower, @touch_damage) and !follower.battler.dead?
  1699.           execute_touch_damage(follower)
  1700.         end
  1701.       end
  1702.     end
  1703.     execute_touch_damage(target) if obj_size?(target, @touch_damage)
  1704.   end
  1705.  
  1706.   def execute_touch_damage(target)
  1707.     target.battler.attack_apply(@enemy)
  1708.     target.pop_damage
  1709.     @touch_atkdelay = 50
  1710.     target.colapse_time = 60 if target.battler.dead?
  1711.     return if target.battler.result.hp_damage == 0
  1712.     target.jump(0, 0)
  1713.   end
  1714.  
  1715.   # enemy sensor
  1716.   def update_enemy_sensor
  1717.     return if @hookshoting[0]
  1718.     return if @epassive
  1719.     if @sensor != nil
  1720.       @agroto_f.nil? ? target = $game_player : target = @agroto_f
  1721.       if obj_size?(target, @sensor)
  1722.         data = [$game_map.map_id, @id, PearlKernel::Enemy_Sensor]
  1723.         if @inrangeev.nil? and !$game_self_switches[[data[0], data[1],
  1724.           data[2]]]
  1725.           $game_self_switches[[data[0], data[1], data[2]]] = true
  1726.           @inrangeev = true
  1727.         end
  1728.       elsif @inrangeev != nil
  1729.         data = [$game_map.map_id, @id, PearlKernel::Enemy_Sensor]
  1730.         if $game_self_switches[[data[0], data[1], data[2]]]
  1731.           $game_self_switches[[data[0], data[1], data[2]]] = false
  1732.           @inrangeev = nil
  1733.         end
  1734.       end
  1735.     end
  1736.   end
  1737.  
  1738.   # on battle pixel, take a lot of time procesing, but it is very exact
  1739.   def on_battle_pixel?(out=0)
  1740.     w = Graphics.width + out; h = Graphics.height + out
  1741.     return true if screen_x.between?(0 - out,w) and screen_y.between?(0 - out,h)
  1742.     return false
  1743.   end
  1744.  
  1745.   def cmt_data(comment)
  1746.     return 0 if @list.nil? or @list.size <= 0
  1747.     for item in @list
  1748.       if item.code == 108 or item.code == 408
  1749.         return $1.to_i if item.parameters[0] =~ /#{comment}(.*)>/i
  1750.       end
  1751.     end
  1752.     return 0
  1753.   end
  1754.  
  1755.   def string_data(comment)
  1756.     return nil if @list.nil? or @list.size <= 0
  1757.     for item in @list
  1758.       if item.code == 108 or item.code == 408
  1759.         return $1.to_s if item.parameters[0] =~ /#{comment}(.*)>/i
  1760.       end
  1761.     end
  1762.     return nil
  1763.   end
  1764.  
  1765.   # stop event movement
  1766.   alias falcaopearl_update_self_movement update_self_movement
  1767.   def update_self_movement
  1768.     return if !@boom_grabdata.nil?
  1769.     return if force_stopped? || @colapse_time > 0 || @blowpower[0] > 0
  1770.     falcaopearl_update_self_movement
  1771.   end
  1772. end
  1773.  
  1774.  
  1775. class Game_System
  1776.   attr_accessor :remain_killed
  1777.   alias falcao_fantastic_store_ini initialize
  1778.   def initialize
  1779.     falcao_fantastic_store_ini
  1780.     @remain_killed = {}
  1781.   end
  1782. end
  1783.  
  1784. #===============================================================================
  1785.  
  1786. # mist
  1787. class Game_Map
  1788.   attr_reader   :map
  1789.   attr_accessor :event_enemies, :enemies, :events_withtags
  1790.   alias falcaopearl_enemycontrol_ini initialize
  1791.   def initialize
  1792.     @event_enemies = []
  1793.     @enemies = []
  1794.     @events_withtags = []
  1795.     falcaopearl_enemycontrol_ini
  1796.   end
  1797.  
  1798.   alias falcaopearl_enemycontrol_setup setup
  1799.   def setup(map_id)
  1800.     @event_enemies.clear
  1801.     @enemies.clear
  1802.     @events_withtags.clear
  1803.     falcaopearl_enemycontrol_setup(map_id)
  1804.     if $game_temp.loadingg != nil
  1805.       @event_enemies.each do |event|
  1806.         event.resetdeadpose
  1807.       end
  1808.       $game_temp.loadingg = nil
  1809.     end
  1810.   end
  1811.  
  1812.   alias falcaopearl_damage_floor damage_floor?
  1813.   def damage_floor?(x, y)
  1814.     return if $game_player.hookshoting[1]
  1815.     falcaopearl_damage_floor(x, y)
  1816.   end
  1817. end
  1818.  
  1819. class Game_Temp
  1820.   attr_accessor :pop_windowdata, :loadingg
  1821.   def pop_w(time, name, text)
  1822.     return unless @pop_windowdata.nil?
  1823.     @pop_windowdata = [time, text, name]
  1824.   end
  1825. end
  1826.  
  1827. class Game_Party < Game_Unit
  1828.   alias falcaopearl_swap_order swap_order
  1829.   def swap_order(index1, index2)
  1830.     unless SceneManager.scene_is?(Scene_Map)
  1831.       if $game_player.in_combat_mode?
  1832.         $game_temp.pop_w(180, 'Pearl ABS',
  1833.         'You cannot switch player while in combat!')
  1834.         return
  1835.       elsif $game_player.any_collapsing?
  1836.         $game_temp.pop_w(180, 'Pearl ABS',
  1837.         'You cannot switch player while collapsing!')
  1838.         return
  1839.       elsif $game_party.battle_members[index2].deadposing != nil
  1840.          $game_temp.pop_w(180, 'Pearl ABS',
  1841.         'You cannot move a dead ally!')
  1842.         return
  1843.       end
  1844.     end
  1845.     falcaopearl_swap_order(index1, index2)
  1846.   end
  1847. end
  1848.  
  1849. class << DataManager
  1850.   alias falcaopearl_extract extract_save_contents
  1851.   def DataManager.extract_save_contents(contents)
  1852.     falcaopearl_extract(contents)
  1853.     $game_temp.loadingg = true
  1854.   end
  1855. end



RUBY 代码复制
  1. #===============================================================================
  2. # * Falcao Pearl ABS script shelf # 7
  3. #
  4. # Actor / Eenemies HP and MP bars display v 2.0
  5. # 显示玩家和敌人的HP/MP条
  6. # This script acts like an Add-On, the main system can run without this piece
  7. # 这个脚本是附加脚本,核心脚本可以在无此脚本下运行
  8. #-------------------------------------------------------------------------------
  9.  
  10. # * Features
  11. # - 显示当前玩家的HP和MP条,经验还有TP条
  12. # -【Display HP, MP, experience and TP bars of the current player actor】
  13. # - 当敌人被攻击时,显示敌人的Hp【Display the Enemy HP bar when was hit】
  14. # - BOSS的HP条【Boss HP bar anabled】
  15. # - 显示玩家状态和增益减益效果图标【Display enemy states and buff / debuff icons】
  16. # - 无图像但是高定制的条?【Non-graphical bars but hightly customizable】
  17. # - 2.0现在支持直接使用图像而不是脚本绘制【2.0 now support images instead of script drawing bars】
  18.  
  19.  
  20. # * Usage and Installation【安装说明】
  21. # Just copy and paste below the Pearl ABS System【直接拷贝在PEARL ABS SYSTEM后即可】
  22. #
  23. # * Commands【指令】
  24. # PearlBars.hide          - Hide the actor bars【隐藏玩家条,栏】
  25. # PearlBars.show          - Show the actor bars (by default)【显示玩家条,栏(默认)】
  26. #
  27. # PearlBars.enemy_auto(id)- 不需要攻击敌人而自动显示敌人HP条,用来做BOSS的,id改为事件ID
  28. # 【Show automatically the enemy HP bars without need
  29. # to hit, this is mostly used for bosses, change id for the event id】
  30. # Tag any enemy with   Enemy Boss Bar = true   to eneble the boss bar mode
  31. # 在敌人标注栏里标注“Enemy Boss Bar = true”来开启BOSS血条模式
  32. #------------------------------------------------------------------------------
  33. module PearlBars
  34.   #=============================================================================
  35.   # * Actors bars configuration
  36.   #
  37.   # Bars x and y position on the screen【条的 X 和 Y 位置】
  38.   ScreenPos_X = -3
  39.   ScreenPos_Y = 410
  40.   #
  41.   # Dimentions of the bars you cant exceed 300 width x 100 height
  42.   #【条的大小不能超过宽300高100】
  43.   #                   x    y     width   height
  44.   HP_BarDimentions = [-3,   27,    79,     7]
  45.   MP_BarDimentions = [10,   40,    79,     7]
  46. #  EX_BarDimentions = [-500,   -500,    -518,    -510]#[8,   57,    118,    10]
  47.  
  48.   # Tp info     x   y
  49. # TP_Info =    [8,  64]
  50.   #
  51.   # color definition【定义颜色】
  52.   #           color 1    R    G    B   Opa     color 2   R   G    B    Opa
  53.   HP_Color = [Color.new(205, 255, 205, 200),   Color.new(10, 220, 45,  200)]
  54.   MP_Color = [Color.new(180, 225, 245, 200),   Color.new(20, 160, 225, 200)]
  55. #  EX_Color = [Color.new(180, 225, 245, 200),   Color.new(20, 160, 225, 200)]
  56.  
  57.   # Do you want to display graphics instead of script drawing bars?
  58.   # if so, fill this actors bars graphics requirements
  59.   # 想要用图像显示血条之类的而不是脚本简单的绘制?是的话,补充完整下面的栏目
  60.  
  61.   ActorsHp    = "HP"       # 玩家HP条图像名字 (引号内)
  62.   ActorsMp    = "Bullet"       # MP条名字
  63.   ActorsExp   = ""       # 经验条,不需要的话留空""
  64.   ActorsBack  = "BattleBackground"
  65.  
  66.   #=============================================================================
  67.   # * Normal Enemies bars【正常的敌人栏】
  68.   #
  69.   # Normal enemies Bars x and y position on the screen
  70.   NeScreenPos_X = 390
  71.   NeScreenPos_Y = 10
  72.   #
  73.   # Dimentions of the bars you cant exceed 300 width x 100 height
  74.   #                    x    y     width   height
  75.   EHP_BarDimentions = [8,   16,    126,    10]
  76.   #
  77.   # color definition
  78.   #            color 1    R    G    B   Opa     color 2   R   G    B    Opa
  79.   EHP_Color = [Color.new(205, 255, 205, 200),   Color.new(10, 220, 45,  200)]
  80.  
  81.   # if you want to display grahics bar pictures fill this
  82.   NormalEne = ""           # normal enemy hp bar
  83.   NormalBack = ""          # Background semi-transparent bar
  84.  
  85.   #=============================================================================
  86.   # * Enemy Boss HP Bar【BOSS的条子】
  87.   #
  88.   # Boss enemies Bar x and y position on the screen
  89.   BeScreenPos_X = 100
  90.   BeScreenPos_Y = 286
  91.   #
  92.   # Dimentions of the bars you cant exceed 640 width x 100 height
  93.   #                    x    y     width   height
  94.   BHP_BarDimentions = [8,   22,    330,    12]
  95.   #
  96.   #            color 1    R    G    B   Opa     color 2   R   G    B    Opa
  97.   BHP_Color = [Color.new(205, 255, 205, 200),   Color.new(10, 220, 45,  200)]
  98.  
  99.   # if you want to display grahics bar pictures fill this
  100.   BossEne = ""        # Boss enemy Hp bar
  101.   BossBack = ""       # Background semi-transparent bar
  102.   #=============================================================================
  103.  
  104.   def self.show() $game_system.pearlbars = nil  end
  105.   def self.hide() $game_system.pearlbars = true end
  106.  
  107.   def self.enemy_auto(event_id)
  108.     $game_system.enemy_lifeobject = $game_map.events[event_id]
  109.   end
  110.  
  111. end
  112.  
  113. ($imported ||= {})["Falcao Pearl ABS Life"] = true
  114.  
  115. class Spriteset_Map
  116.  
  117.   alias falcaopearl_lifebars_create create_pictures
  118.   def create_pictures
  119.     create_hud_lifebars
  120.     falcaopearl_lifebars_create
  121.   end
  122.  
  123.   def create_hud_lifebars
  124.     @enemy_lifeobject = $game_system.enemy_lifeobject
  125.     @enemyhpsp = Sprite_LifeBars.new(@viewport2, @enemy_lifeobject) if
  126.     not @enemy_lifeobject.nil?
  127.   end
  128.  
  129.   def create_actorlifebars
  130.     return if !@actor_lifebar.nil?
  131.     @actor_lifebar = Sprite_LifeBars.new(@viewport2, $game_player)
  132.   end
  133.  
  134.   def dispose_actorlifebars
  135.     return if @actor_lifebar.nil?
  136.     @actor_lifebar.dispose
  137.     @actor_lifebar = nil
  138.   end
  139.  
  140.   alias falcaopearl_lifebars_update update
  141.   def update
  142.     update_lifebars_sprites
  143.     falcaopearl_lifebars_update
  144.   end
  145.  
  146.   def update_lifebars_sprites
  147.     $game_system.pearlbars.nil? ? create_actorlifebars : dispose_actorlifebars
  148.     @actor_lifebar.update unless @actor_lifebar.nil?
  149.  
  150.     # enemy
  151.     if !@enemyhpsp.nil?
  152.       unless @enemyhpsp.disposed?
  153.         @enemyhpsp.update
  154.       else
  155.         @enemyhpsp.dispose
  156.         @enemyhpsp = nil
  157.         $game_system.enemy_lifeobject = nil
  158.         @enemy_lifeobject = nil
  159.       end
  160.     end
  161.  
  162.     if @enemy_lifeobject != $game_system.enemy_lifeobject
  163.       @enemyhpsp.dispose if !@enemyhpsp.nil?
  164.       @enemyhpsp = nil
  165.       @enemyhpsp = Sprite_LifeBars.new(@viewport2,$game_system.enemy_lifeobject)
  166.       @enemy_lifeobject = $game_system.enemy_lifeobject
  167.     end
  168.   end
  169.  
  170.   alias falcaopearl_lifebars_dispose dispose
  171.   def dispose
  172.     dispose_actorlifebars
  173.     @enemyhpsp.dispose unless @enemyhpsp.nil?
  174.     falcaopearl_lifebars_dispose
  175.   end
  176. end
  177.  
  178. # Life bars sprite
  179. class Sprite_LifeBars < Sprite
  180.   include PearlBars
  181.   def initialize(viewport, character)
  182.     super(viewport)
  183.     @character = character
  184.     self.bitmap = Bitmap.new(boss? ? 640 : 300, 120)
  185.     @old_hp = battler.hp
  186.     @old_mp = battler.mp
  187.     @erasetimer = 180
  188.     @state_checker = []
  189.     @buff_checker = []
  190.     refresh_contents
  191.     @view = viewport
  192.     update
  193.   end
  194.  
  195.   def boss?
  196.     return true if battler.is_a?(Game_Enemy) && battler.boss_hud
  197.     return false
  198.   end
  199.  
  200.   def battler
  201.     return @character.battler
  202.   end
  203.  
  204.   def refresh_contents
  205.     self.bitmap.clear
  206.     self.bitmap.font.size = 19
  207.     @erasetimer = 180
  208.     self.opacity = 255
  209.       if battler.is_a?(Game_Actor)
  210.   #    @old_exp = battler.exp
  211.    #   @old_tp = battler.tp
  212.       self.x = ScreenPos_X
  213.       self.y = ScreenPos_Y
  214.       h  = HP_BarDimentions ; m = MP_BarDimentions #; e = EX_BarDimentions
  215.       if PearlBars::ActorsHp != ""
  216.         @pimg = Cache.picture(PearlBars::ActorsHp)  if @pimg.nil?
  217.         @bimg = Cache.picture(PearlBars::ActorsBack) if @bimg.nil?
  218.         @pimp = Cache.picture(PearlBars::ActorsMp)  if @pimp.nil?
  219.         PearlKernel.image_mp(self.bitmap, m[0] + 4, m[1], @bimg, @pimp, battler )
  220.         PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1], @bimg, @pimg, battler,true)
  221.         #if PearlBars::ActorsExp != ""
  222.          # @piexp = Cache.picture(PearlBars::ActorsExp)  if @piexp.nil?
  223.         #  PearlKernel.image_exp(self.bitmap,e[0] + 4,e[1],@bimg,@piexp, battler)
  224.         #end
  225.       else
  226.         hc = HP_Color ; mc = MP_Color ; #ec = EX_Color
  227.         PearlKernel.draw_hp(self.bitmap,battler, h[0], h[1], h[2], h[3], hc)
  228.         PearlKernel.draw_mp(self.bitmap,battler, m[0], m[1], m[2], m[3], mc)
  229. #        PearlKernel.draw_exp(self.bitmap,battler, e[0], e[1], e[2], e[3], ec)
  230.       end
  231. #     PearlKernel.draw_tp(self.bitmap, TP_Info[0], TP_Info[1], battler)
  232.     else battler.is_a?(Game_Enemy)
  233.       if boss?
  234.         self.x = BeScreenPos_X
  235.         self.y = BeScreenPos_Y
  236.         h  = BHP_BarDimentions ; hc = BHP_Color
  237.         if PearlBars::BossEne != ""
  238.           @n_img = Cache.picture(PearlBars::BossEne) if @n_img.nil?
  239.           @n_back = Cache.picture(PearlBars::BossBack) if @n_back.nil?
  240.           PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@n_back,
  241.           @n_img, battler,true)
  242.         else
  243.           PearlKernel.draw_hp(self.bitmap,battler, h[0],h[1],h[2], h[3],hc,true)
  244.         end
  245.       else
  246.         self.x = NeScreenPos_X
  247.         self.y = NeScreenPos_Y
  248.         h  = EHP_BarDimentions ; hc = EHP_Color
  249.         if PearlBars::NormalEne != ""
  250.           @n_img = Cache.picture(PearlBars::NormalEne) if @n_img.nil?
  251.           @n_back = Cache.picture(PearlBars::NormalBack) if @n_back.nil?
  252.           PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@n_back,
  253.           @n_img, battler,true)
  254.         else
  255.           PearlKernel.draw_hp(self.bitmap,battler,h[0],h[1],h[2], h[3], hc,true)
  256.         end
  257.       end
  258.     end
  259.   end
  260.  
  261.   def update
  262.     super
  263.  
  264.  
  265.     if battler.nil?
  266.       dispose
  267.       return
  268.     end
  269.  
  270.     if @old_hp != battler.hp
  271.       refresh_contents
  272.       @old_hp = battler.hp
  273.     end
  274.     if @old_mp != battler.mp
  275.       refresh_contents
  276.       @character.actor.apply_usability if @character.is_a?(Game_Player)
  277.       @old_mp = battler.mp
  278.     end
  279.  
  280.     if battler.is_a?(Game_Actor)
  281.       if @old_exp != battler.exp
  282.         @old_exp = battler.exp
  283.         refresh_contents
  284.       end
  285.    #   if @old_tp != battler.tp
  286.    #     @old_tp = battler.tp
  287.    #     @character.actor.apply_usability if @character.is_a?(Game_Player)
  288.     #    refresh_contents
  289.     #  end
  290.  
  291.     elsif battler.is_a?(Game_Enemy)
  292.       if boss?
  293.         dispose if battler.dead?
  294.       else
  295.         if @erasetimer > 0
  296.           @erasetimer -= 1
  297.           self.opacity -= 10 if @erasetimer <= 25
  298.           @states.opacity = self.opacity if !@states.nil?
  299.           dispose if @erasetimer == 0
  300.         end
  301.       end
  302.       update_enemy_status_icons
  303.     end
  304.   end
  305.  
  306.   # enemy status icons engine
  307.   def update_enemy_status_icons
  308.     display_status? ? create_states_icons : dispose_state_icons
  309.     4.times.each {|i| refresh_states_icons if
  310.     @state_checker[i] != battler.state_icons[i]}
  311.     2.times.each {|i| refresh_states_icons if
  312.     @buff_checker[i] != battler.buff_icons[i]}
  313.   end
  314.  
  315.   def display_status?
  316.     return true if !battler.state_icons.empty?
  317.     return true if !battler.buff_icons.empty?
  318.     return false
  319.   end
  320.  
  321.   def create_states_icons
  322.     return if disposed?
  323.     return if !@states.nil?
  324.     @states = ::Sprite.new(@view)
  325.     @states.bitmap = Bitmap.new(144, 24)
  326.     @n_back.nil? ? y_plus = BHP_BarDimentions[3] : y_plus = @n_back.height
  327.     pos = [BeScreenPos_X, BeScreenPos_Y, y_plus] if  boss?
  328.     pos = [NeScreenPos_X, NeScreenPos_Y, y_plus] if !boss?
  329.     @states.x = pos[0] + 10
  330.     @states.y = pos[1] + pos[2] + 24
  331.     @states.zoom_x = 0.8
  332.     @states.zoom_y = 0.8
  333.     refresh_states_icons
  334.   end
  335.  
  336.   def dispose_state_icons
  337.     return if @states.nil?
  338.     @states.bitmap.dispose
  339.     @states.dispose
  340.     @states = nil
  341.   end
  342.  
  343.   def refresh_states_icons
  344.     4.times.each {|i| @state_checker[i] = battler.state_icons[i]}
  345.     2.times.each {|i| @buff_checker[i] = battler.buff_icons[i]}
  346.     return if @states.nil?
  347.     @states.bitmap.clear
  348.     x = 0
  349.     battler.state_icons.each {|icon| draw_icon(icon, x, 0) ; x += 24
  350.     break if x == 96}
  351.     count = 0
  352.     battler.buff_icons.each {|icon| draw_icon(icon, x, 0) ; x += 24 ; count += 1
  353.     break if count == 2}
  354.   end
  355.  
  356.   def draw_icon(icon_index, x, y, enabled = true)
  357.     bit = Cache.system("Iconset")
  358.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  359.     @states.bitmap.blt(x, y, bit, rect, enabled ? 255 : 150)
  360.   end
  361.  
  362.   def dispose
  363.     self.bitmap.dispose
  364.     dispose_state_icons
  365.     super
  366.   end
  367. end
  368.  
  369. # Make the enemy bars to load when enemy is hited
  370. class Projectile < Game_Character
  371.   alias falcao_lifebars_execute execute_damageto_enemy
  372.   def execute_damageto_enemy(event)
  373.     $game_system.enemy_lifeobject = event if @user.is_a?(Game_Player) &&
  374.     !event.battler.object
  375.     falcao_lifebars_execute(event)
  376.   end
  377. end

Lv2.观梦者

梦石
0
星屑
384
在线时间
328 小时
注册时间
2013-8-24
帖子
104
2
 楼主| 发表于 2016-8-19 21:13:04 | 只看该作者

↑完成效果大概是这样,想把hp的背景弄没就好了
回复 支持 反对

使用道具 举报

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9397
在线时间
2748 小时
注册时间
2008-9-5
帖子
3543

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

3
发表于 2016-8-19 22:14:36 | 只看该作者
  1. # image based bars definition
  2.   def self.image_hp(bitmap, x, y, back, image, battler, name=nil, with_back=false)
  3.     tag = 'Hp'
  4.     name = battler.name if !name.nil?
  5.     draw_i_gauge(bitmap, x, y, back, image, battler.hp, battler.mhp, tag, name, with_back)
  6.   end

  7.   def self.image_mp(bitmap, x, y, back, image, battler, name=nil, with_back=true)
  8.     tag = 'Mp'
  9.     name = battler.name if !name.nil?
  10.     draw_i_gauge(bitmap, x, y, back, image, battler.mp, battler.mmp, tag, name, with_back)
  11.   end

  12.   def self.draw_i_gauge(bitmap, x, y, back, image, nm, max, tag, name, with_back)
  13.     cw = back.width  
  14.     ch = back.height
  15.     max = 1 if max == 0
  16.     src_rect = Rect.new(0, 0, cw, ch)   
  17.     bitmap.blt(x - 12, y - ch + 30, back, src_rect) if with_back# 这里与背景有关
  18.     cw = image.width  * nm / max
  19.     ch = image.height
  20.     src_rect = Rect.new(0, 0, cw, ch)
  21.     bitmap.blt(x - -35, y - ch + 23, image, src_rect)
  22.    # bitmap.draw_text(x - 4, y + back.height - 14, back.width, 32, tag)
  23.    # bitmap.draw_text(x - 12, y + back.height - 14, back.width, 32, nm.to_s, 2)
  24.    # bitmap.draw_text(x - 6, y - 10, back.width, 32, name, 1) if !name.nil?
  25.   end
复制代码

给这3个方法加了个参数“with_back”,
HP默认不绘制背景,MP默认会绘制背景。
“与背景有关”的那句后面加了个条件,只有传进去的with_back的值是true才会绘制背景。
可以替换原脚本的这3个方法,或者搜索这段代码里的“with_back”,给原脚本对应的位置加上。

评分

参与人数 2星屑 +265 梦石 +1 收起 理由
RaidenInfinity + 250 + 1 楼主认可的解答
bakaki + 15 非常感谢!!!

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 00:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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