Advertisement
TheSixth

Stat Bonus Addon for Falcao's ABS by Sixth

Sep 2nd, 2015
726
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 19.03 KB | None | 0 0
  1. #===============================================================================
  2. # * [ACE] Stat Bonus Addon for Falcao's Pearl ABS Liquid v3
  3. #===============================================================================
  4. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  5. # * Version: 1.3
  6. # * Updated: 12/01/2016
  7. # * Requires: Falcao's Pearl ABS Liquid v3
  8. #-------------------------------------------------------------------------------
  9. # * < Change Log >
  10. #-------------------------------------------------------------------------------
  11. # * Version 1.0 (14/01/2015)
  12. #   - Initial release.
  13. # * Version 1.1 (26/09/2015)
  14. #   - Added compatibility with my Toolbar Addon for Falcao's ABS.
  15. # * Version 1.2 (06/01/2016)
  16. #   - Added compatibility with my ABS Stat Addon 2 for Falcao's ABS.
  17. # * Version 1.3 (12/01/2016)
  18. #   - Fixed an issue with tool data readings.
  19. #-------------------------------------------------------------------------------
  20. # * < Description >
  21. #-------------------------------------------------------------------------------
  22. # * By default, the some of the default stats (like AGI) won't do much in
  23. #   Falcao's ABS. That can be changed with this script.
  24. # * This script will introduce new note-tags for you which can manipulate
  25. #   several stats from Falcao's ABS. The current list is:
  26. #   Cooldown, Cast Time, Tool Speed, Blowpower, Guard Rate, Knockdown Rate,
  27. #   Effect Delay.
  28. #   These can be manipulated by the user's stats (ATK, DEF, AGI, etc).
  29. #   As the required stat raises, the more bonuses the player gets for their
  30. #   actions performed, thus allowing the players to actually feel the raise of
  31. #   their stats in Falcao's ABS.
  32. # * Configurable limits for each manipulable stat!
  33. # * Bonuses can affect the performance of the enemies as well (toggle-able)!
  34. # * Build-in debugger. It will print out the manipulable stats of the action
  35. #   performed, so you can see what needs to be changed and what doesn't.
  36. #-------------------------------------------------------------------------------
  37. # * < Note-tags >
  38. #-------------------------------------------------------------------------------
  39. # * The note-tags are usable on:
  40. #   Skills, Items, Weapons and Armors.
  41. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  42. # * To assign custom bonuses for an action, you can use these note-tags:
  43. #
  44. #     CD Bonus = <val stat, val stat, val stat ... > # For Cooldown Bonus.
  45. #     CT Bonus = <val stat, val stat, val stat ... > # For Cast Time Bonus.
  46. #     ED Bonus = <val stat, val stat, val stat ... > # For Effect Delay Bonus.
  47. #     TS Bonus = <val stat, val stat, val stat ... > # For Tool Speed Bonus.
  48. #     BP Bonus = <val stat, val stat, val stat ... > # For Blowpower Bonus.
  49. #     GR Bonus = <val stat, val stat, val stat ... > # For Guard Rate Bonus.
  50. #     KD Bonus = <val stat, val stat, val stat ... > # For Knockdown Bonus.
  51. #
  52. #   val = An integer number which represents percentage values.
  53. #         This much percentage from the assigned stat will be either added to
  54. #         an ABS stat, or subtracted from an ABS stat.
  55. #         In the case of Cooldown, Cast Time and Effect Delay bonuses, it will
  56. #         be added.
  57. #         In the case of Tool Speed, Blowpower, Guard Rate and Knockdown, it will
  58. #         be subtracted.
  59. #  stat = A stat assigned for the ABS stat bonus.
  60. #         Valid values: MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK.
  61. #         I guess, it is self-explanatory what each of them means.
  62. #
  63. #   The first two letters determine the affected ABS stat!
  64. #   The bonus data is placed between the "<" and ">" signs!
  65. #   Each bonus data must be separated with a comma and a space (", ")!
  66. #   You can have as many bonus data in a note-tag as you want!
  67. #
  68. #   Examples:
  69. #
  70. #     CD Bonus = <8 AGI, 2 STR>
  71. #
  72. #   The cooldown will be shortened for the action depending on the assigned bonus.
  73. #   The bonus value, in this example, equals:
  74. #   Bonus = (User's AGI * 8%) + (User's STR * 2%)
  75. #   This bonus will be subtracted from the base (default) cooldown for the action.
  76. #   Effectively, the more AGI and STR the user has, the quicker they can perform
  77. #   the same action over and over again.
  78. #
  79. #     GR Bonus = <14 DEF, 6 AGI, 1 LUK>
  80. #
  81. #   The guard rate will be higher for the action depending on the assigned bonus.
  82. #   The bonus value, in this example, equals:
  83. #   Bonus = (User's DEF * 14%) + (User's AGI * 6%) + (User's LUK * 1%)
  84. #   This bonus will be added to the base (default) guard rate for the action.
  85. #   Effectively, the more DEF, AGI and LUK the user has, the higher the chance
  86. #   that the guard will be successful.
  87. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  88. # * To limit the value of the ABS stats affected by the bonuses, you can use
  89. #   the following note-tags:
  90. #
  91. #     CD Limit = val # For Cooldown Limit.
  92. #     CT Limit = val # For Cast Time Limit.
  93. #     ED Limit = val # For Effect Delay Limit.
  94. #     TS Limit = val # For Tool Speed Limit.
  95. #     BP Limit = val # For Blowpower Limit.
  96. #     GR Limit = val # For Guard Rate Limit.
  97. #     KD Limit = val # For Knockdown Limit.
  98. #
  99. #   val = An integer number representing either the lowest or the highest value
  100. #         for the assigned ABS stat.
  101. #         Cooldown, Cast Time and Effect Delay use lowest limits.
  102. #         Tool Speed, Blowpower, Guard Rate and Knockdown use highest limits.
  103. #
  104. #   The first two letters determine the affected ABS stat!
  105. #   These note-tags have no effect if there is no bonus assigned for the same
  106. #   ABS stat for the action!
  107. #   Default limits can be setup in the script's settings!
  108. #
  109. #   Examples:
  110. #
  111. #     CT Limit = 20
  112. #
  113. #   The cast time will never be lower than 20 for the action, regardless of any
  114. #   bonuses.
  115. #
  116. #     KD Limit = 50
  117. #
  118. #   The knockdown chance will never be higher than 50 for the action, regardless
  119. #   of any bonuses.
  120. #-------------------------------------------------------------------------------
  121. # * < Installation >
  122. #-------------------------------------------------------------------------------
  123. # * Place this scipt below the last script from Falcao's Pearl ABS Liquid v3
  124. #   script series but above Main!
  125. # * If you are using my Toolbar Addon for Falcao's ABS script, you must put
  126. #   this one above that one!
  127. # * If you are using my ABS Features Addon for Falcao's ABS script, you must put
  128. #   this one above that one!
  129. #-------------------------------------------------------------------------------
  130. # * < Compatibility Info >
  131. #-------------------------------------------------------------------------------
  132. # * No known incompatibilities.
  133. #-------------------------------------------------------------------------------
  134. # * < Known Issues >
  135. #-------------------------------------------------------------------------------
  136. # * No known issues.
  137. #-------------------------------------------------------------------------------
  138. # * < Terms of Use >
  139. #-------------------------------------------------------------------------------
  140. # * Free to use for whatever purposes you want.
  141. # * Credit me (Sixth) in your game, pretty please! :P
  142. # * Posting modified versions of this script is allowed as long as you notice me
  143. #   about it with a link to it!
  144. #===============================================================================
  145. $imported = {} if $imported.nil?
  146. $imported["SixthABSStatAddon"] = true
  147. #===============================================================================
  148. # Settings:
  149. #===============================================================================
  150. module Sixth_Stat_Bonus # <-- No touchy-touchy!
  151.    
  152.   # If you set this to true, enemies performing an action with bonuses
  153.   # will get the bonus too. If you set this to false, only the
  154.   # player will get the bonuses upon performing an action, enemies will get
  155.   # the action's base ABS stat values instead without bonuses.
  156.   Enemy_Bonus = true
  157.  
  158.   # Set the default lowest limits for your actions here.
  159.   # These affect several stats from Falcao's ABS such as:
  160.   # Cooldown, Cast Time, Effect Delay.
  161.   # Usually, the lower these stats, the better they are in this ABS.
  162.   # These stats will never be lower than the value you set here regardless of
  163.   # any bonuses, unless you use a note-tag to change it for an action.
  164.   # Only use integer numbers!
  165.   Def_Cool_Limit   = 20 # Cooldown:     min = 0, max = infinite.
  166.   Def_Cast_Limit   = 20 # Cast Time:    min = 0, max = infinite.
  167.   Def_EDelay_Limit = 0  # Effect Delay: min = 0, max = infinite.
  168.  
  169.   # Set the default highest limits for your actions here.
  170.   # These affect several stats from Falcao's ABS such as:
  171.   # Tool Speed, Blowpower, Guard Rate, Knockdown Rate.
  172.   # Usually, the higher these stats, the better they are in this ABS.
  173.   # These stats will never be higher than the value you set here regardless of
  174.   # any bonuses, unless you use a note-tag to change it for an action.
  175.   # Only use integer numbers!
  176.   Def_TSpeed_Limit = 6 # Tool Speed: min = 1, max = 6.
  177.   Def_BPower_Limit = 6 # Blowpower:  min = 0, max = infinite.
  178.   Def_GRate_Limit = 90 # Guard Rate: min = 1, max = 100.
  179.   Def_KDown_Limit = 90 # Knockdown:  min = 1, max = 100.
  180.  
  181.   # If you want to see your effective ABS stats and bonuses and all info about
  182.   # them printed to the console after each action you do in the game, set this to
  183.   # true, else set it to false.
  184.   Debug_Print = false
  185.  
  186. end # <-- No touchy-touchy!
  187. #===============================================================================
  188. # End of Settings! Editing anything below may lead to... you know it, right?
  189. #===============================================================================
  190.  
  191. module S_CDCTBon
  192.  
  193.   def self.bonus_grabber(battler,info)
  194.     case info[1]
  195.     when "MHP"
  196.       bonus = (battler.mhp*(info[0]*0.01)).to_i
  197.     when "MMP"
  198.       bonus = (battler.mmp*(info[0]*0.01)).to_i
  199.     when "ATK"
  200.       bonus = (battler.atk*(info[0]*0.01)).to_i
  201.     when "DEF"
  202.       bonus = (battler.def*(info[0]*0.01)).to_i
  203.     when "MAT"
  204.       bonus = (battler.mat*(info[0]*0.01)).to_i
  205.     when "MDF"
  206.       bonus = (battler.mdf*(info[0]*0.01)).to_i
  207.     when "AGI"
  208.       bonus = (battler.agi*(info[0]*0.01)).to_i
  209.     when "LUK"
  210.       bonus = (battler.luk*(info[0]*0.01)).to_i
  211.     end
  212.     return bonus
  213.   end
  214.  
  215. end
  216.  
  217. # Making note-tags here.
  218. class RPG::BaseItem
  219.  
  220.   def cooldown_bonus
  221.     ary = []
  222.     if @note =~ /CD Bonus = <(\d+[ ].*(?:\s*,\s*\d+[ ].*)*)>/i
  223.       $1.split(", ").each do |info|
  224.         info =~ /(\d+) (.*)/i
  225.         ary << [$1.to_i, $2] # [value, stat]
  226.       end
  227.     end
  228.     return ary
  229.   end
  230.  
  231.   def cast_time_bonus
  232.     ary = []
  233.     if @note =~ /CT Bonus = <(\d+[ ].*(?:\s*,\s*\d+[ ].*)*)>/i
  234.       $1.split(", ").each do |info|
  235.         info =~ /(\d+) (.*)/i
  236.         ary << [$1.to_i, $2] # [value, stat]
  237.       end
  238.     end
  239.     return ary
  240.   end
  241.      
  242.   def tspeed_bonus
  243.     ary = []
  244.     if @note =~ /TS Bonus = <(\d+[ ].*(?:\s*,\s*\d+[ ].*)*)>/i
  245.       $1.split(", ").each do |info|
  246.         info =~ /(\d+) (.*)/i
  247.         ary << [$1.to_i, $2] # [value, stat]
  248.       end
  249.     end
  250.     return ary
  251.   end
  252.  
  253.   def bpower_bonus
  254.     ary = []
  255.     if @note =~ /BP Bonus = <(\d+[ ].*(?:\s*,\s*\d+[ ].*)*)>/i
  256.       $1.split(", ").each do |info|
  257.         info =~ /(\d+) (.*)/i
  258.         ary << [$1.to_i, $2] # [value, stat]
  259.       end
  260.     end
  261.     return ary
  262.   end
  263.  
  264.   def grate_bonus
  265.     ary = []
  266.     if @note =~ /GR Bonus = <(\d+[ ].*(?:\s*,\s*\d+[ ].*)*)>/i
  267.       $1.split(", ").each do |info|
  268.         info =~ /(\d+) (.*)/i
  269.         ary << [$1.to_i, $2] # [value, stat]
  270.       end
  271.     end
  272.     return ary
  273.   end
  274.  
  275.   def tkdown_bonus
  276.     ary = []
  277.     if @note =~ /KD Bonus = <(\d+[ ].*(?:\s*,\s*\d+[ ].*)*)>/i
  278.       $1.split(", ").each do |info|
  279.         info =~ /(\d+) (.*)/i
  280.         ary << [$1.to_i, $2] # [value, stat]
  281.       end
  282.     end
  283.     return ary
  284.   end
  285.  
  286.   def edelay_bonus
  287.     ary = []
  288.     if @note =~ /ED Bonus = <(\d+[ ].*(?:\s*,\s*\d+[ ].*)*)>/i
  289.       $1.split(", ").each do |info|
  290.         info =~ /(\d+) (.*)/i
  291.         ary << [$1.to_i, $2] # [value, stat]
  292.       end
  293.     end
  294.     return ary
  295.   end
  296.  
  297.   def cooldown_limit
  298.     @note =~ /CD Limit = (\d+)/i ? $1.to_i : Sixth_Stat_Bonus::Def_Cool_Limit
  299.   end  
  300.    
  301.   def cast_time_limit
  302.     @note =~ /CT Limit = (\d+)/i ? $1.to_i : Sixth_Stat_Bonus::Def_Cast_Limit
  303.   end  
  304.  
  305.   def tspeed_limit
  306.     @note =~ /TS Limit = (\d+)/i ? $1.to_i : Sixth_Stat_Bonus::Def_TSpeed_Limit
  307.   end  
  308.  
  309.   def bpower_limit
  310.     @note =~ /BP Limit = (\d+)/i ? $1.to_i : Sixth_Stat_Bonus::Def_BPower_Limit
  311.   end  
  312.  
  313.   def grate_limit
  314.     @note =~ /GR Limit = (\d+)/i ? $1.to_i : Sixth_Stat_Bonus::Def_GRate_Limit
  315.   end  
  316.  
  317.   def tkdown_limit
  318.     @note =~ /KD Limit = (\d+)/i ? $1.to_i : Sixth_Stat_Bonus::Def_KDown_Limit
  319.   end  
  320.  
  321.   def edelay_limit
  322.     @note =~ /ED Limit = (\d+)/i ? $1.to_i : Sixth_Stat_Bonus::Def_EDelay_Limit
  323.   end  
  324.  
  325. end
  326.  
  327. # Adding Cast time bonuses here.
  328. module PearlKernel
  329.  
  330.   def self.tool_castime(battler)  
  331.     base = @item.tool_data("Tool Cast Time = ")
  332.     puts "" if Sixth_Stat_Bonus::Debug_Print
  333.     puts "------------------------------------------------------" if Sixth_Stat_Bonus::Debug_Print
  334.     puts "#{@item.name} - Cast Time" if Sixth_Stat_Bonus::Debug_Print
  335.     puts "Notetag Data --- #{@item.cast_time_bonus}" if Sixth_Stat_Bonus::Debug_Print
  336.     puts "Base Value ----- #{base}" if Sixth_Stat_Bonus::Debug_Print
  337.     return base if battler.nil?
  338.     bonus = 0
  339.     if @item.cast_time_bonus != [] && (battler.is_a?(Game_Actor) || Sixth_Stat_Bonus::Enemy_Bonus)
  340.       @item.cast_time_bonus.each do |info|
  341.         bonus += S_CDCTBon.bonus_grabber(battler,info)
  342.       end
  343.     end
  344.     puts "Total Bonus ---- #{bonus}" if Sixth_Stat_Bonus::Debug_Print
  345.     final_time = base - bonus
  346.     if @item.cast_time_bonus != [] && final_time < @item.cast_time_limit
  347.       final_time = @item.cast_time_limit
  348.     end
  349.     puts "Final Value ---- #{final_time}" if Sixth_Stat_Bonus::Debug_Print
  350.     return final_time
  351.   end
  352.    
  353. end
  354.  
  355. class Game_CharacterBase
  356.  
  357.   def process_tool_action(item)
  358.     PearlKernel.load_item(item)
  359.     return if !battler.tool_ready?(item)
  360.     unless PearlKernel.has_data?
  361.       if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
  362.         msgbox('Tool data missing') if $DEBUG
  363.         return
  364.       end
  365.       if item.scope.between?(1, 6)
  366.         msgbox('Tool data missing') if $DEBUG
  367.         return
  368.       elsif item.scope == 0
  369.         return
  370.       elsif !battler.usable?(item)
  371.         RPG::SE.new("Cursor1", 80).play if self.is_a?(Game_Player)
  372.         return
  373.       end
  374.     end
  375.     if PearlKernel.has_data? and not usable_test_passed?(item)
  376.       RPG::SE.new("Cursor1", 80).play if self.is_a?(Game_Player)
  377.       return
  378.     end
  379.     @user_casting = [PearlKernel.tool_castime(battler),item] if PearlKernel.has_data?
  380.     if @user_casting[0] > 0
  381.       @animation_id = 0
  382.       @animation_id = PearlKernel.tool_castanimation
  383.     else
  384.       load_abs_tool(item)
  385.     end
  386.   end
  387.  
  388. end
  389.  
  390. # Adding Cooldown bonuses here.
  391. class Game_Battler < Game_BattlerBase
  392.    
  393.   def apply_cooldown(item, value)
  394.     puts "" if Sixth_Stat_Bonus::Debug_Print
  395.     puts "#{item.name} - Cooldown" if Sixth_Stat_Bonus::Debug_Print
  396.     puts "Notetag Data --- #{item.cooldown_bonus}" if Sixth_Stat_Bonus::Debug_Print
  397.     puts "Base Value ----- #{value}" if Sixth_Stat_Bonus::Debug_Print
  398.     bon = get_the_bonus(item)
  399.     final_value = value - bon
  400.     if item.cooldown_bonus != [] && final_value < item.cooldown_limit
  401.       final_value = item.cooldown_limit
  402.     end
  403.     puts "Final Value ---- #{final_value}" if Sixth_Stat_Bonus::Debug_Print
  404.     if $imported && $imported["SixthABSToolBarAddon"]
  405.       @msc[item.id] = final_value if item.is_a?(RPG::Skill)
  406.       @mic[item.id] = final_value if item.is_a?(RPG::Item)
  407.       @mwc[item.id] = final_value if item.is_a?(RPG::Weapon)
  408.       @mac[item.id] = final_value if item.is_a?(RPG::Armor)
  409.     end
  410.     @skill_cooldown[item.id]  = final_value if item.is_a?(RPG::Skill)
  411.     @item_cooldown[item.id]   = final_value if item.is_a?(RPG::Item)
  412.     @weapon_cooldown[item.id] = final_value if item.is_a?(RPG::Weapon)
  413.     @armor_cooldown[item.id]  = final_value if item.is_a?(RPG::Armor)
  414.     return final_value
  415.   end
  416.  
  417.   def get_the_bonus(item)
  418.     bonus = 0
  419.     if item.cooldown_bonus != [] && (self.is_a?(Game_Actor) || Sixth_Stat_Bonus::Enemy_Bonus)
  420.       item.cooldown_bonus.each do |info|
  421.         bonus += S_CDCTBon.bonus_grabber(self,info)
  422.       end
  423.     end
  424.     puts "Total Bonus ---- #{bonus}" if Sixth_Stat_Bonus::Debug_Print
  425.     return bonus
  426.   end
  427.    
  428. end
  429.  
  430. # Adding Effect Delay, Tool Speed, Blowpower, Guard Rate, Knockdown bonuses here.
  431. class Projectile < Game_Character
  432.  
  433.   alias sixth_bonus_adder1112 load_item_data
  434.   def load_item_data
  435.     sixth_bonus_adder1112
  436.     @tool_effect_delay  = them_bonuses(@tool_effect_delay,@user.battler,@original_item,5)
  437.     @move_speed         = them_bonuses(@move_speed,@user.battler,@original_item,1)
  438.     @tool_blow_power    = them_bonuses(@tool_blow_power,@user.battler,@original_item,2)
  439.     @tool_guardrate     = them_bonuses(@tool_guardrate,@user.battler,@original_item,3)
  440.     @tool_knockdownrate = them_bonuses(@tool_knockdownrate,@user.battler,@original_item,4)
  441.     puts "------------------------------------------------------" if Sixth_Stat_Bonus::Debug_Print
  442.   end
  443.  
  444.   def them_bonuses(base,battler,item,type)
  445.     puts "" if Sixth_Stat_Bonus::Debug_Print
  446.     case type
  447.     when 1
  448.       item_bonus = item.tspeed_bonus
  449.       item_limit = item.tspeed_limit
  450.       t1 = "Tool Speed"; neg = false
  451.     when 2
  452.       item_bonus = item.bpower_bonus
  453.       item_limit = item.bpower_limit
  454.       t1 = "Blowpower"; neg = false
  455.     when 3
  456.       item_bonus = item.grate_bonus
  457.       item_limit = item.grate_limit
  458.       t1 = "Guard Rate"; neg = false
  459.     when 4
  460.       item_bonus = item.tkdown_bonus
  461.       item_limit = item.tkdown_limit
  462.       t1 = "Knockdown"; neg = false
  463.     when 5
  464.       item_bonus = item.edelay_bonus
  465.       item_limit = item.edelay_limit
  466.       t1 = "Effect Delay"; neg = true
  467.     end
  468.     puts "#{item.name} - #{t1}" if Sixth_Stat_Bonus::Debug_Print
  469.     puts "Notetag Data --- #{item_bonus}" if Sixth_Stat_Bonus::Debug_Print
  470.     puts "Base Value ----- #{base}" if Sixth_Stat_Bonus::Debug_Print
  471.     bonus = 0
  472.     if item_bonus != [] && (battler.is_a?(Game_Actor) || Sixth_Stat_Bonus::Enemy_Bonus)
  473.       item_bonus.each do |info|
  474.         bonus += S_CDCTBon.bonus_grabber(battler,info)
  475.       end
  476.     end
  477.     puts "Total Bonus ---- #{bonus}" if Sixth_Stat_Bonus::Debug_Print
  478.     final_value = neg == false ? (base + bonus) : (base - bonus)
  479.     if item_bonus != [] && neg == false && final_value > item_limit
  480.       final_value = item_limit
  481.     elsif item_bonus != [] && neg == true && final_value < item_limit
  482.       final_value = item_limit
  483.     end
  484.     puts "Final Value ---- #{final_value}" if Sixth_Stat_Bonus::Debug_Print
  485.     return final_value
  486.   end
  487.    
  488. end
  489. #==============================================================================
  490. # !!END OF SCRIPT - OHH, NOES!!
  491. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement