Advertisement
TheSixth

Projectile Update Patch v1.1

Jul 24th, 2016
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.31 KB | None | 0 0
  1. =begin
  2.  
  3. Projectile Update Patch for Falcao's ABS
  4. Made by: Sixth
  5.  
  6. This little script will make the update method in the Projectile class more
  7. expandable by separating the different things it updates into their own methods.
  8.  
  9. It also adds the possibility of guarding properly with any tool, regardless if
  10. it is equipped on the 1st tool slot or on a skill/item tool slot. This was not
  11. possible before, because the guard would end as soon as the tool's destroy time
  12. is elapsed (so, the ability to hold the guard button were missing for any tool
  13. slot except the 2nd one - armor by default).
  14.  
  15. And while messing with these methods, I also changed the check for shield type
  16. tools. You can now set any tool to be a shield type, not only armors!
  17. Although, using armors for that is the most logical thing to do still. :P
  18.  
  19. Place this patch right below the - Pearl Battler Settings script!
  20.  
  21. v1.1 - Fixed the "still guarding?" check.
  22.  
  23. =end
  24.  
  25. class Projectile < Game_Character
  26.  
  27.   alias fix_key_press8827 initialize
  28.   def initialize(*args)
  29.     @key_used = $game_player.last_key
  30.     fix_key_press8827(*args)
  31.   end
  32.  
  33.   def update
  34.     super
  35.     return if check_and_trigger_effects # Separated by Sixth!
  36.     @precombi = @user.doingcombo > 0 if @precombi.nil?
  37.     update_tool_token
  38.     if @target_effect[0]
  39.       follow_char(@target_effect[1]) if !moving?
  40.       @tool_distance = 0
  41.     end
  42.     @tool_distance = 0 if @tool_special == "area"
  43.     update_timer
  44.     # Tool special shield engine - Separated by Sixth!
  45.     return if update_shield_engine
  46.     update_hookshotdef if @customsteps != nil          # update hookshot
  47.     update_boomerand if @tool_special == "boomerang"   # update boomerang
  48.     update_spiral if @tool_special == "spiral"         # update spiral
  49.     return if @transparent and @customsteps != nil     # return is tranparent
  50.     update_damage                                      # update damage
  51.   end
  52.  
  53.   def check_and_trigger_effects
  54.     if magical_item?
  55.       case @item.scope
  56.       when 0 # scope 0 apply the effect to the user
  57.         apply_self_effect(@user, true)
  58.         return true
  59.       when 7 # heal one ally
  60.         apply_effectto_selection
  61.         return true
  62.       when 8 # heall all
  63.         apply_effectto_all_allies
  64.         return true
  65.       when 9 # revive one ally
  66.         apply_effectto_selection
  67.         return true
  68.       when 10 # revive all
  69.         apply_effectto_all_allies
  70.         return true
  71.       when 11 # to the user
  72.         apply_self_effect(@user, true)
  73.         return true
  74.       end
  75.     end
  76.   end
  77.  
  78.   def update_shield_engine
  79.     if @tool_special == "shield" # Removed the armor check! by Sixth
  80.       if !@user.battler_guarding[0]
  81.         if @tool_invoke > 0
  82.           @user.battler.melee_attack_apply(@user.battler,@tool_invoke)
  83.         else
  84.           @user.battler.item_apply(@user.battler, $data_skills[2])
  85.         end
  86.         @user.battler_guarding[0] = true
  87.         @user.battler_guarding[1] = @tool_guardrate
  88.         # shield directions
  89.       elsif @user.battler_guarding[0]
  90.         if @user.battler.is_a?(Game_Actor)
  91.           if @user.is_a?(Game_Player)
  92.             if $game_player.last_key == @key_used && PearlKey.press?(@key_used) &&
  93.               @tool_destroy_delay <= @originaldestory_delay - 16
  94.               @tool_destroy_delay = 10
  95.               @user.anime_speed = 10
  96.             end
  97.             @user.direction = 2 if Input.dir4 == 2
  98.             @user.direction = 4 if Input.dir4 == 4
  99.             @user.direction = 6 if Input.dir4 == 6
  100.             @user.direction = 8 if Input.dir4 == 8
  101.           end
  102.         else
  103.           if @user.is_a?(Game_Event) and @user.agroto_f != nil
  104.             @user.turn_toward_character(@user.agroto_f)
  105.           else
  106.             @user.turn_toward_character($game_player)
  107.           end
  108.         end
  109.       end
  110.       if @tool_destroy_delay == 0
  111.         @user.battler.remove_state(9)
  112.         @user.battler_guarding = [false, nil]
  113.       end
  114.       return true
  115.     end
  116.   end
  117.  
  118. end
  119.  
  120. class Game_Player < Game_Character
  121.  
  122.   attr_accessor :last_key
  123.  
  124.   def trigger_tool?(key, type)
  125.     if type == :keys && PearlKey.trigger?(key)
  126.       @last_key = key
  127.       return true
  128.     end
  129.     return true if @mouse_exist && Mouse.trigger?(0) && type == :mouse &&
  130.     @mouse_over == key
  131.     return false
  132.   end
  133.  
  134. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement