SHARE
TWEET

Fantastic Pearl ABS Patch

Falmc Jan 24th, 2013 6,820 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===============================================================================
  2. # * Fantastic Pearl ABS Patch
  3. #
  4. # This patch is designed to work with Pearl ABS Liquid V2 script, it add some
  5. # great features to the main engine, enchant the game play, apply some bug fix
  6. # and much more.
  7. #
  8. #------------------------------------------------------------------------------
  9. # * Features
  10. #
  11. # - User and  Projectiles iconset graphic enabled
  12. # - User graphic has 3 different animation types to chose from
  13. # - Projectile graphics has 2 animation types
  14. # - All battle members dead fix
  15. # - Repeated shield bug fix
  16. # - Self switch note tag bug fix (now able to use the Dead enemy self witch tag)
  17. # - Now able to erase an enemy forever when dead (if tagged with self switch)
  18. # - Game play enchanted
  19. #-----------------------------------------------------------------------------
  20. #
  21. # * Installation
  22. #
  23. # Paste this script BELOW Pearl ABS Liquid V2 scripts
  24. #-----------------------------------------------------------------------------
  25. #
  26. # * User and projectiles iconset graphic instructions
  27. #
  28. # Tag any weapon, armor, item or skill with the followings note tags
  29. #
  30. # User Iconset = animated   - You have 3 options available:
  31. #                             animated, static, shielding. animated plays
  32. #                             3 patterns swing effect. static plays only one
  33. #                             and shielding for shield usage effect
  34. #
  35. # Projectile Iconset = animated  - you have 2 options available
  36. #                                animated and static.
  37. #                                animated play a zoom in and zoom out effect
  38. #                                static plays no effect
  39. #-------------------------------------------------------------------------------
  40. # * License
  41. #
  42. # This script adopt the same terms of use of Pearl ABS
  43. #-----------------------------------------------------------------------------
  44.  
  45. #==============================================================================
  46. # * User and prjectiles icon sprites feature
  47. #==============================================================================
  48.  
  49. ($imported ||= {})[:Fantastic_Pearl_ABS_Patch] = 1.0
  50.  
  51. class Game_CharacterBase
  52.   attr_accessor :user_iconset, :pro_iconset
  53. end
  54.  
  55. class Sprite_Character < Sprite_Base
  56.  
  57.   def iconset_graphic?
  58.     !@character.user_iconset.nil? || !@character.pro_iconset.nil?
  59.   end
  60.  
  61.   alias falcao_fantastic_bit update_bitmap
  62.   def update_bitmap
  63.     if iconset_graphic?
  64.       if @apply_iconset.nil?
  65.         icon = @character.user_iconset[0] if !@character.user_iconset.nil? and
  66.         @character.is_a?(Anime_Obj)
  67.         icon = @character.pro_iconset[0] if !@character.pro_iconset.nil? and
  68.         @character.is_a?(Projectile)
  69.         set_iconsetbitmap(icon)
  70.         @apply_iconset = true
  71.       end
  72.       apply_breath_effect2(@character) if !@character.pro_iconset.nil? and
  73.       @character.is_a?(Projectile) and @character.pro_iconset[1] == :animated
  74.       @enable_angle = @character.user_iconset[1] if
  75.       !@character.user_iconset.nil? and @character.is_a?(Anime_Obj)
  76.       return
  77.     end
  78.     falcao_fantastic_bit
  79.   end
  80.  
  81.   alias falcao_fantastic_update_position update_position
  82.   def update_position
  83.     falcao_fantastic_update_position
  84.     set_angle_changes(@enable_angle) if @enable_angle != nil
  85.   end
  86.  
  87.   def apply_angle_pattern(x_plus, y_plus, angle)
  88.     self.x = @character.user.screen_x + x_plus
  89.     self.y = @character.user.screen_y + y_plus
  90.     self.angle = angle
  91.   end
  92.  
  93.   def set_angle_changes(type)
  94.     ani= @character.user.anime_speed.to_f/@character.original_speed.to_f * 100.0
  95.     case ani
  96.     when 80..100
  97.       perform_animated(0) if type == :animated
  98.     when 60..80
  99.       perform_animated(1) if type == :animated
  100.     when 0..60
  101.       perform_animated(2) if type == :animated
  102.     end
  103.     if type != :animated
  104.       perform_static       if type == :static
  105.       perform_shielding    if type == :shielding
  106.     end
  107.   end
  108.  
  109.   # animated
  110.   def perform_animated(pattern)
  111.     case pattern
  112.     when 0
  113.       apply_angle_pattern(10, -12, -166) if @character.user.direction == 2
  114.       if @character.user.direction == 4 || @character.user.direction == 6
  115.         apply_angle_pattern(-8, -26, -46)
  116.         self.z = @character.user.screen_z - 1
  117.       end
  118.       apply_angle_pattern(-22, -10, 0)   if @character.user.direction == 8
  119.     when 1
  120.       apply_angle_pattern(0, 0, -266)   if @character.user.direction == 2
  121.       apply_angle_pattern(-20, -10, 12) if @character.user.direction == 4
  122.       apply_angle_pattern(7, -20, -78)  if @character.user.direction == 6
  123.       if @character.user.direction == 8
  124.         apply_angle_pattern(-8, -26, -46)
  125.         self.z = @character.user.screen_z - 1
  126.       end
  127.     when 2
  128.       apply_angle_pattern(8, -5, -210)    if @character.user.direction == 2
  129.       apply_angle_pattern(-10, 2, 52)     if @character.user.direction == 4
  130.       apply_angle_pattern(8, -15, -126)  if @character.user.direction == 6
  131.       apply_angle_pattern(10, -16, - 100) if @character.user.direction == 8
  132.     end
  133.   end
  134.  
  135.   # static
  136.   def perform_static
  137.     apply_angle_pattern(8, -5, -210)    if @character.user.direction == 2
  138.     apply_angle_pattern(-10, 2, 52)     if @character.user.direction == 4
  139.     apply_angle_pattern(8, -15, -126)  if @character.user.direction == 6
  140.     if @character.user.direction == 8
  141.       apply_angle_pattern(-8, -26, -46)
  142.       self.z = @character.user.screen_z - 1
  143.     end
  144.   end
  145.  
  146.   # shielding
  147.   def perform_shielding
  148.     apply_angle_pattern(2, 4, 0)    if @character.user.direction == 2
  149.     apply_angle_pattern(-10, 0, 0)     if @character.user.direction == 4
  150.     if @character.user.direction == 6
  151.       apply_angle_pattern(10, 0, 0)  
  152.       self.z = @character.user.screen_z - 1
  153.     elsif @character.user.direction == 8
  154.       apply_angle_pattern(11, -9, 0)  
  155.       self.z = @character.user.screen_z - 1
  156.     end
  157.   end
  158.  
  159.   def apply_breath_effect2(char)
  160.     char.zoomfx_x -= 0.03 if !char.zfx_bol
  161.     char.zoomfx_y -= 0.03 if !char.zfx_bol
  162.     char.zoomfx_x += 0.03 if char.zfx_bol
  163.     char.zoomfx_y += 0.03 if char.zfx_bol
  164.     char.zfx_bol = true if char.zoomfx_x <= 0.84
  165.     char.zfx_bol = false if char.zoomfx_x >= 1.0
  166.   end
  167.  
  168.   alias falcao_fantastic_src update_src_rect
  169.   def update_src_rect
  170.     return if iconset_graphic?
  171.     falcao_fantastic_src
  172.   end
  173.  
  174.   def set_iconsetbitmap(icon_index, enabled = true)
  175.     self.bitmap = Bitmap.new(24, 24)
  176.     bit = Cache.system("Iconset")
  177.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  178.     self.bitmap.blt(0, 0, bit, rect, enabled ? 255 : 150)
  179.     @cw = self.ox = 12
  180.     @ch = self.oy = 24
  181.   end
  182. end
  183.  
  184. module PearlKernel
  185.   def self.check_iconset(item, tag, object)
  186.     data = item.tool_data(tag, false)
  187.     return if data.nil?
  188.     v = [item.icon_index, data.to_sym] if data == "animated" ||
  189.     data == "static" || data == "shielding"
  190.     object.is_a?(Projectile) ? object.pro_iconset = v : object.user_iconset = v
  191.   end
  192. end
  193.  
  194. class Projectile < Game_Character
  195.   alias falcao_fantastic_load load_item_data
  196.   def load_item_data
  197.     PearlKernel.check_iconset(@item, "Projectile Iconset = ", self)
  198.     falcao_fantastic_load
  199.     @character_name = "" if @pro_iconset != nil
  200.   end
  201. end
  202.  
  203. class Anime_Obj < Game_Character
  204.   alias falcao_fantastic_animeini initialize
  205.   def initialize(user, item)
  206.     falcao_fantastic_animeini(user, item)
  207.     PearlKernel.check_iconset(@item, "User Iconset = ", self)
  208.     @character_name = "" if @user_iconset != nil
  209.   end
  210. end
  211.  
  212. #==============================================================================
  213. # all battle members dead issue fix
  214. #==============================================================================
  215. class Game_CharacterBase
  216.   alias falcao_fantastic_collapse update_battler_collapse
  217.   def update_battler_collapse
  218.     falcao_fantastic_collapse
  219.     check_for_dead_four if @colapse_time == 0
  220.   end
  221.  
  222.   def check_for_dead_four
  223.     return if $game_party.members.size <= 4
  224.     SceneManager.goto(Scene_Gameover) if all_fourdead?
  225.   end
  226.  
  227.   def all_fourdead?
  228.     m = $game_party.battle_members
  229.     return true if m[0].dead? && m[1].dead? && m[2].dead? && m[3].dead?
  230.     return false
  231.   end
  232.  
  233.   alias falcao_fantastic_anim create_anime_sprite_object
  234.   def create_anime_sprite_object(item)
  235.     falcao_fantastic_anim(item)
  236.     if PearlKernel.user_graphic == "nil" and
  237.       !item.tool_data("User Iconset = ", false).nil?
  238.       return if PearlKernel.user_graphic.nil?
  239.       $game_player.anime_action.push(Anime_Obj.new(self, item))
  240.     end
  241.   end
  242. end
  243.  
  244. #==============================================================================
  245. # Hardcoding projectiles, repeated shield bug issue
  246. #==============================================================================
  247. class Spriteset_Map
  248.   def update_projectile_sprites
  249.     @projectile_sprites.each {|sprite| sprite.update if !sprite.disposed?}
  250.     $game_player.projectiles.each do |projectile|
  251.       unless projectile.draw_it
  252.         @projectile_sprites.push(Sprite_Character.new(@viewport1, projectile))
  253.         projectile.draw_it = true
  254.       end
  255.       if projectile.destroy_it
  256.         @projectile_sprites.each {|i|
  257.         if i.character.is_a?(Projectile) and i.character.destroy_it
  258.           i.dispose
  259.           @projectile_sprites.delete(i)
  260.         end
  261.         }
  262.         if projectile.user.making_spiral
  263.           projectile.user.making_spiral = false
  264.         end
  265.         if projectile.user.battler_guarding[0]
  266.           projectile.user.battler_guarding = [false, nil]
  267.           projectile.user.battler.remove_state(9)
  268.         end
  269.         $game_player.projectiles.delete(projectile)
  270.       end
  271.     end
  272.   end
  273. end
  274.  
  275. #==============================================================================
  276. # Self switch note tag bug issue fix
  277. # now enemies can be erased forever when note ntagged with a self switch
  278. #==============================================================================
  279. class Game_CharacterBase
  280.   alias falcaopearl_fx update_state_effects
  281.   def update_state_effects
  282.     return if battler.nil?
  283.     falcaopearl_fx
  284.   end
  285. end
  286.  
  287. class Sprite_LifeBars < Sprite
  288.   alias falcaopearl_fx_up update
  289.   def update
  290.     if battler.nil?
  291.       dispose
  292.       return
  293.     end
  294.     falcaopearl_fx_up
  295.   end
  296. end
  297.  
  298. class Game_System
  299.   attr_accessor :remain_killed
  300.   alias falcao_fantastic_store_ini initialize
  301.   def initialize
  302.     falcao_fantastic_store_ini
  303.     @remain_killed = {}
  304.   end
  305. end
  306.  
  307. class Game_Event < Game_Character
  308.   alias falcao_fantastic_register register_enemy
  309.   def register_enemy(event)
  310.     if !$game_system.remain_killed[$game_map.map_id].nil? and
  311.       $game_system.remain_killed[$game_map.map_id].include?(self.id)
  312.       return
  313.     end
  314.     falcao_fantastic_register(event)
  315.   end
  316.  
  317.   def run_assigned_commands
  318.     transform = @enemy.enemy.tool_data("Enemy Die Transform = ")
  319.     switch = @enemy.enemy.tool_data("Enemy Die Switch = ")
  320.     $game_switches[switch] = true if switch != nil
  321.     variable = @enemy.enemy.tool_data("Enemy Die Variable = ")
  322.     $game_variables[variable] += 1 if variable != nil
  323.     self_sw = @enemy.enemy.tool_data("Enemy Die Self Switch = ", false)
  324.     $game_map.event_enemies.delete(self) if @enemy.object
  325.     $game_map.enemies.delete(@enemy) if @enemy.object
  326.     if self_sw.is_a?(String)
  327.       $game_self_switches[[$game_map.map_id, self.id, self_sw]] = true
  328.       apply_respawn
  329.       $game_map.event_enemies.delete(self)
  330.       $game_map.enemies.delete(@enemy)
  331.       unless $game_system.remain_killed.has_key?($game_map.map_id)
  332.         $game_system.remain_killed[$game_map.map_id] = []
  333.       end
  334.       $game_system.remain_killed[$game_map.map_id].push(self.id) unless
  335.       $game_system.remain_killed[$game_map.map_id].include?(self.id)
  336.       @enemy = nil
  337.     else
  338.       erase unless @deadposee
  339.     end
  340.     if transform != nil
  341.       @enemy = Game_Enemy.new(0, transform)
  342.       apply_respawn
  343.     end
  344.   end
  345. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top