Advertisement
roninator2

Adjust Stats on Party Size

Dec 21st, 2024 (edited)
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 12.27 KB | None | 0 0
  1. # ╔═══════════════════════════════════════════════╦════════════════════╗
  2. # ║ Title: Adjust Stats on Party Size             ║  Version: 1.02     ║
  3. # ║ Author: Roninator2                            ║                    ║
  4. # ╠═══════════════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                                     ║   Date Created     ║
  6. # ║                                               ╠════════════════════╣
  7. # ║   Adjust params for actors                    ║    21 Dec 2024     ║
  8. # ╚═══════════════════════════════════════════════╩════════════════════╝
  9. # ╔════════════════════════════════════════════════════════════════════╗
  10. # ║ Requires: nil                                                      ║
  11. # ║                                                                    ║
  12. # ╚════════════════════════════════════════════════════════════════════╝
  13. # ╔════════════════════════════════════════════════════════════════════╗
  14. # ║ Brief Description:                                                 ║
  15. # ║        More battle memebrs causes battlers to lose ATK             ║
  16. # ╚════════════════════════════════════════════════════════════════════╝
  17. # ╔════════════════════════════════════════════════════════════════════╗
  18. # ║ Instructions:                                                      ║
  19. # ║   Turn Value below to true to have it get applied                  ║
  20. # ║      LOWER_ATK = true                                              ║
  21. # ║   Set value that will be changed for stat                          ║
  22. # ║                                                                    ║
  23. # ║   Add more ad you desire                                           ║
  24. # ╚════════════════════════════════════════════════════════════════════╝
  25. # ╔════════════════════════════════════════════════════════════════════╗
  26. # ║ Updates:                                                           ║
  27. # ║ 1.00 - 21 Dec 2024 - Script finished                               ║
  28. # ║ 1.01 - 23 Dec 2024 - For Yanfly Party System                       ║
  29. # ║ 1.02 - 24 Dec 2024 - fixed code error for yanfly party             ║
  30. # ╚════════════════════════════════════════════════════════════════════╝
  31. # ╔════════════════════════════════════════════════════════════════════╗
  32. # ║ Credits and Thanks:                                                ║
  33. # ║   Roninator2                                                       ║
  34. # ║                                                                    ║
  35. # ╚════════════════════════════════════════════════════════════════════╝
  36. # ╔════════════════════════════════════════════════════════════════════╗
  37. # ║ Terms of use:                                                      ║
  38. # ║  Follow the original Authors terms of use where applicable         ║
  39. # ║    - When not made by me (Roninator2)                              ║
  40. # ║  Free for all uses in RPG Maker except nudity                      ║
  41. # ║  Anyone using this script in their project before these terms      ║
  42. # ║  were changed are allowed to use this script even if it conflicts  ║
  43. # ║  with these new terms. New terms effective 03 Apr 2024             ║
  44. # ║  No part of this code can be used with AI programs or tools        ║
  45. # ║  Credit must be given                                              ║
  46. # ╚════════════════════════════════════════════════════════════════════╝
  47.  
  48. module R2_Modify_Battle_Stats_Large_Party
  49.   LOWER_ATK = true
  50.   ATK_AMOUNT = 10
  51.   # add more here as you need
  52.   # LOWER_DEF = true
  53.   # DEF_AMOUNT = 5
  54. end
  55.  
  56. # ╔════════════════════════════════════════════════════════════════════╗
  57. # ║                      End of editable region                        ║
  58. # ╚════════════════════════════════════════════════════════════════════╝
  59.  
  60. class Game_Party < Game_Unit
  61.   #--------------------------------------------------------------------------
  62.   # * Initial Party Setup
  63.   #--------------------------------------------------------------------------
  64.   alias :r2_setup_starting_members :setup_starting_members
  65.   def setup_starting_members
  66.     r2_setup_starting_members
  67.     remove_actor_stats_by_member
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # * Add an Actor
  71.   #--------------------------------------------------------------------------
  72.   alias :r2_change_stats_add :add_actor
  73.   def add_actor(actor_id)
  74.     reset_actor_stats_by_member
  75.     r2_change_stats_add(actor_id)
  76.     remove_actor_stats_by_member
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # * remove stats
  80.   #--------------------------------------------------------------------------
  81.   def reset_actor_stats_by_member
  82.     if $imported && $imported["YEA-PartySystem"] && !$BTEST
  83.       @battle_members_array.each do |act|
  84.         next if act == 0
  85.         mem = $game_actors[act]
  86.         mem.raise_battle_stat(2) if R2_Modify_Battle_Stats_Large_Party::LOWER_ATK
  87.         # add more here as you need
  88.         # act.raise_battle_stat(3) if R2_Modify_Battle_Stats_Large_Party::LOWER_DEF
  89.       end
  90.     else
  91.       battle_members.each do |act|
  92.         act.raise_battle_stat(2) if R2_Modify_Battle_Stats_Large_Party::LOWER_ATK
  93.         # add more here as you need
  94.         # act.raise_battle_stat(3) if R2_Modify_Battle_Stats_Large_Party::LOWER_DEF
  95.       end
  96.     end
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # * remove stats
  100.   #--------------------------------------------------------------------------
  101.   def remove_actor_stats_by_member
  102.     if $imported && $imported["YEA-PartySystem"] && !$BTEST
  103.       @battle_members_array.each do |act|
  104.         next if act == 0
  105.         mem = $game_actors[act]
  106.         mem.lower_battle_stat(2) if R2_Modify_Battle_Stats_Large_Party::LOWER_ATK
  107.         # add more here as you need
  108.       end
  109.     else
  110.       battle_members.each do |act|
  111.         act.lower_battle_stat(2) if R2_Modify_Battle_Stats_Large_Party::LOWER_ATK
  112.         # add more here as you need
  113.       end
  114.     end
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # * Remove Actor
  118.   #--------------------------------------------------------------------------
  119.   alias :r2_change_stats_remove :remove_actor
  120.   def remove_actor(actor_id)
  121.     reset_actor_stats_by_member
  122.     r2_change_stats_remove(actor_id)
  123.     remove_actor_stats_by_member
  124.   end
  125. end
  126.  
  127. class Game_Actor < Game_Battler
  128.   #--------------------------------------------------------------------------
  129.   # * Change Param Plus Value
  130.   #--------------------------------------------------------------------------
  131.   def lower_battle_stat(param)
  132.     if $imported && $imported["YEA-PartySystem"]
  133.       ps = $game_party.battle_members_array.select { |d| d != 0 }
  134.       adj = -((ps.size - 1) *
  135.         R2_Modify_Battle_Stats_Large_Party::ATK_AMOUNT) if param == 2
  136.     # add more here as you need
  137.     # params [mhp, mmp, atk, def, mat, mdf, agi, luk]
  138.     # params [ 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ]
  139.     else
  140.       adj = -(($game_party.battle_members.size - 1) *
  141.         R2_Modify_Battle_Stats_Large_Party::ATK_AMOUNT) if param == 2
  142.     # add more here as you need
  143.     # params [mhp, mmp, atk, def, mat, mdf, agi, luk]
  144.     # params [ 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ]
  145.     end
  146.     add_param(param, adj)
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # * Change Param Plus Value
  150.   #--------------------------------------------------------------------------
  151.   def raise_battle_stat(param)
  152.     if $imported && $imported["YEA-PartySystem"]
  153.       ps = $game_party.battle_members_array.select { |d| d != 0 }
  154.       adj = ((ps.size - 1) *
  155.         R2_Modify_Battle_Stats_Large_Party::ATK_AMOUNT) if param == 2
  156.     # add more here as you need
  157.     # params [mhp, mmp, atk, def, mat, mdf, agi, luk]
  158.     # params [ 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ]
  159.     else
  160.       adj = (($game_party.battle_members.size - 1) *
  161.         R2_Modify_Battle_Stats_Large_Party::ATK_AMOUNT) if param == 2
  162.     # add more here as you need
  163.     # params [mhp, mmp, atk, def, mat, mdf, agi, luk]
  164.     # params [ 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ]
  165.     end
  166.     add_param(param, adj)
  167.   end
  168. end
  169.  
  170. class Scene_Party < Scene_MenuBase
  171.   #--------------------------------------------------------------------------
  172.   # on_party_ok
  173.   #--------------------------------------------------------------------------
  174.   def on_party_ok
  175.     case @command_window.current_symbol
  176.     when :change
  177.       @list_window.activate
  178.     when :remove
  179.       $game_party.reset_actor_stats_by_member
  180.       index = @party_window.index
  181.       actor = $game_actors[$game_party.battle_members_array[index]]
  182.       Sound.play_equip
  183.       $game_party.battle_members_array[index] = 0
  184.       $game_party.remove_actor_stats_by_member
  185.       window_refresh
  186.       @party_window.activate
  187.     end
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # on_list_ok
  191.   #--------------------------------------------------------------------------
  192.   def on_list_ok
  193.     $game_party.reset_actor_stats_by_member
  194.     Sound.play_equip
  195.     replace = $game_actors[@party_window.item]
  196.     actor = $game_actors[@list_window.item]
  197.     index1 = @party_window.index
  198.     actor_id1 = actor.nil? ? 0 : actor.id
  199.     if actor.nil?
  200.       $game_party.battle_members_array[index1] = 0
  201.       window_refresh
  202.       @party_window.activate
  203.       return
  204.     end
  205.     actor_id2 = replace.nil? ? 0 : replace.id
  206.     if $game_party.battle_members_array.include?(actor_id1)
  207.       index2 = $game_party.battle_members_array.index(actor_id1)
  208.       $game_party.battle_members_array[index2] = actor_id2
  209.     end
  210.     $game_party.battle_members_array[index1] = actor_id1
  211.     $game_party.remove_actor_stats_by_member
  212.     window_refresh
  213.     @status_window.refresh
  214.     @party_window.activate
  215.   end
  216. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement