Advertisement
TheSixth

Falcao's ABS + Victor's Pixel Movement Patch

May 7th, 2016
826
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.10 KB | None | 0 0
  1. #===============================================================================
  2. # * [ACE] Falcao's ABS + Victor's Pixel Movement Patch
  3. #===============================================================================
  4. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  5. # * Version: 1.0
  6. # * Updated: 08/05/2016
  7. # * Requires: Falcao's Pearl ABS Liquid v3
  8. #             Victor's Pixel Movement
  9. #-------------------------------------------------------------------------------
  10. # * < Change Log >
  11. #-------------------------------------------------------------------------------
  12. # * Version 1.0 (08/05/2016)
  13. #   - Initial release.
  14. #-------------------------------------------------------------------------------
  15. # * < Description >
  16. #-------------------------------------------------------------------------------
  17. # * This script aims to fix the collision issues with Victor's pixel movement
  18. #   system in Falcao's ABS. It is far from being fully functional, but most
  19. #   of the tools should work.
  20. #-------------------------------------------------------------------------------
  21. # * < Note-tags >
  22. #-------------------------------------------------------------------------------
  23. # * To add a custom size for your tools, use this note-tag:
  24. #
  25. #     <proj size: width, height>
  26. #
  27. #   The width and height are measured in pixels.
  28. #
  29. #   If you don't set this up, the default size will be used, which is gotten
  30. #   from the image size of the projectile, I guess... Not sure, never really
  31. #   tested it, but it uses the same method Victor used in his pixel movement
  32. #   script, so whatever that does, it will do with your projectiles too.
  33. #
  34. #   NOTE:
  35. #
  36. #   The width and height you set up means the width and height of the
  37. #   character/projectile when it is facing up or down!
  38. #   If the character/projectile is facing left or right, the width and height
  39. #   will be inverted! This is to enable you to make events/projectiles which
  40. #   change their collision size based on their direction.
  41. #   This behaviour is true for the player, followers, events and projectiles!
  42. #-------------------------------------------------------------------------------
  43. # * < Installation >
  44. #-------------------------------------------------------------------------------
  45. # * Place this script below all of Falcao's ABS scripts but above Main!
  46. # * If you are using my Bugfixes script for Falcao's ABS, you must put this
  47. #   script below that one!
  48. # * If you plan to use Pikakapi's Battle Royale Addon for Falcao's ABS, you must
  49. #   put this script below that one (and below the Bugfixes + Battle Royal patch
  50. #   if you use my Bugfixes script)!
  51. #-------------------------------------------------------------------------------
  52. # * < Compatibility Info >
  53. #-------------------------------------------------------------------------------
  54. # * No known incompatibilities.
  55. #-------------------------------------------------------------------------------
  56. # * < Known Issues >
  57. #-------------------------------------------------------------------------------
  58. # * The hookshot and boomerang special tool types will NOT work!
  59. #   Can't promise a fix for this, just a "maybe sometimes"...
  60. #-------------------------------------------------------------------------------
  61. # * < Terms of Use >
  62. #-------------------------------------------------------------------------------
  63. # * Free to use for whatever purposes you want.
  64. # * Credit me (Sixth) in your game, pretty please! :P
  65. # * Posting modified versions of this script is allowed as long as you notice me
  66. #   about it with a link to it!
  67. #===============================================================================
  68. $imported = {} if $imported.nil?
  69. $imported["SixthFABSPlusVPixel"] = true
  70. #===============================================================================
  71. # Settings:
  72. #===============================================================================
  73. module FABS_VPixel
  74.  
  75.   # This is a simple enable/disable option.
  76.   # If you use Pikakapi's Battle Royale addon for Falcao's ABS, you must set
  77.   # this to true or else that addon will not function properly!
  78.   # If you don't use that addon, leave this on false, or else your game will
  79.   # crash as soon as a tool hits a target!
  80.   BattleRoyale = false
  81.  
  82. end
  83. #===============================================================================
  84. # End of Settings! Editing anything below may lead to... you know it, right?
  85. #===============================================================================
  86.  
  87. class Projectile < Game_Character
  88.  
  89.   def bw
  90.     case @direction
  91.     when 2, 8
  92.       init_size if @bw.nil?
  93.       return @bw
  94.     when 4, 6
  95.       init_size if @bh.nil?
  96.       return @bh
  97.     end
  98.   end
  99.  
  100.   def bh
  101.     case @direction
  102.     when 2, 8
  103.       init_size if @bh.nil?
  104.       return @bh
  105.     when 4, 6
  106.       init_size if @bw.nil?
  107.       return @bw
  108.     end
  109.   end
  110.  
  111.   def init_size
  112.     if @item.note =~ /<proj size: (\d+), (\d+)>/i
  113.       setup_custom_dimension($1.to_i, $2.to_i)
  114.     else
  115.       setup_bitmap_dimension
  116.     end
  117.   end
  118.  
  119.   def setup_custom_dimension(x, y)
  120.     x1 = (x / 8).to_i
  121.     y1 = (y / 8).to_i
  122.     @bw = x1 / 4.0
  123.     @bh = y1 / 4.0
  124.   end
  125.  
  126.   def apply_damageto_enemy
  127.     return if @tool_effect_delay > 0
  128.     $game_map.event_enemies.each do |event|
  129.       next if event.collapsing?
  130.       if FABS_VPixel::BattleRoyale == true
  131.         unless @tool_selfdamage
  132.           if @user.battler.is_a?(Game_Enemy)
  133.             next if @user.ally_battler?(event)
  134.           elsif @user.battler.is_a?(Game_Actor)
  135.             next if event.ally?
  136.           end
  137.         end
  138.       end
  139.       if obj_size?(event, @tool_size) and event.just_hitted == 0
  140.         event.just_hitted = @tool_inv_time.nil? ? 20 : @tool_inv_time
  141.         next if event.page.nil?
  142.         if !enable_dame_execution?(event.battler)
  143.           unless event.battler.object
  144.             RPG::SE.new(Key::GuardSe, 80).play
  145.             event.pop_damage('Guard')
  146.             play_hit_animation(event)
  147.           end
  148.           return
  149.         end
  150.         execute_damageto_enemy(event)
  151.       end
  152.     end
  153.   end
  154.  
  155. end
  156.  
  157. class Game_CharacterBase
  158.    
  159.   def bw
  160.     case @direction
  161.     when 2, 8
  162.       setup_bitmap_dimension unless @bw && character_name == @character_name_wh
  163.       @bw
  164.     when 4, 6
  165.       setup_bitmap_dimension unless @bh && character_name == @character_name_wh
  166.       @bh
  167.     end
  168.   end
  169.  
  170.   def bh
  171.     case @direction
  172.     when 2, 8
  173.       setup_bitmap_dimension unless @bh && character_name == @character_name_wh
  174.       @bh
  175.     when 4, 6
  176.       setup_bitmap_dimension unless @bw && character_name == @character_name_wh
  177.       @bw
  178.     end
  179.   end
  180.  
  181.   alias add_proj_collision9382 obj_size?
  182.   def obj_size?(target, size)
  183.     return false if target.nil?
  184.     result = add_proj_collision9382(target, size) || proj_collision?(target)
  185.     return result
  186.   end
  187.  
  188.   def proj_collision?(target)
  189.     return target.collision?(@x, @y, bw, bh)
  190.   end
  191.  
  192. end
  193. #==============================================================================
  194. # !!END OF SCRIPT - OHH, NOES!!
  195. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement