Advertisement
AngryPacman

PAC Item, Skill and Equip Addons 1.6

Jul 29th, 2011
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 44.49 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Pacman Advanced Creative (PAC) Engine - Item, Skill and Equip Addons (1.6)
  4. # 4/6/2011
  5. # Type: System
  6. # Installation: Tags.
  7. # Level: Average
  8. #
  9. #===============================================================================
  10. #
  11. # Description:
  12. # This will give you a number of features to add to your game in the manner
  13. # of making skills more interesting. They are all related to items, skills,
  14. # equipment or a combination of the three in some way. Read the instructions
  15. # for more information.
  16. #
  17. #===============================================================================
  18. #
  19. # Instructions:
  20. # INSTALLATION
  21. # Paste above main, below materials, in the script editor. Remember to save and
  22. # send a blank cheque to me.
  23. # TAGS
  24. #
  25. # <equipskill: x>
  26. # <equipskill: x, x, x>
  27. # Place this in an equipment (armour or weapon) notebox to give actors the
  28. # skill(s) with the ID x.
  29. #
  30. # <break equip: x>
  31. # <break equip: x, x, x>
  32. # Put this in a skill's notebox to make it break the equipment type x for the
  33. # actor it is used against. By default, they are:
  34. # 0 - Weapon
  35. # 1 - Shield
  36. # 2 - Helmet
  37. # 3 - Armour
  38. # 4 - Accessory
  39. #
  40. # <repair equip: x>
  41. # <repair equip: x, x, x>
  42. # Use these tags in a skill's notebox to make it repair the equipment type x
  43. # for the actor it is used on. The IDs are the same for break equip.
  44. #
  45. # <forget skill: x>
  46. # <forget skill: x, x, x>
  47. # If these tags are in a skill's notebox, once an actor learn the skill with the
  48. # tag, they will forget the skill ID(s) x.
  49. #
  50. # <passive param: +x>
  51. # <passive param: -x>
  52. # <passive param: x%>
  53. # Replace param with hp, mp, atk, def, agi, spi, dex, res, hit, eva, cit or
  54. # odds. Place these in a skill's notebox to increase or decrease those params
  55. # for the actors that have the skill by x, x% will increase by x%. Place
  56. # several of these if you wish to alter more than one parameter.
  57. #
  58. # <passive state: x>
  59. # <passive state: x, x, x>
  60. # Replace x with the state ID(s) you want any actor with the skill this tag
  61. # is in the notebox of to permanantly give the actor that state as long as they
  62. # have the skill.
  63. #
  64. # <teach skill: x>
  65. # <teach skill: x, x, x>
  66. # Put this in an item notebox and replace x with the skill ID(s) you want the
  67. # item to teach an actor(s) when applied to them.
  68. #
  69. # <target temp param: +x>
  70. # <target temp param: -x>
  71. # Placed in an item's or skill's notebox, these give a temporary boost or fall
  72. # to the specified parameter of the target of the skill or item until the end
  73. # of the battle. Replace param with maxhp, maxmp, atk, def, spi agi, hit, eva,
  74. # cri and odds (and dex or res if you have the scripts). To make several
  75. # effects, use multiple tags.
  76. #
  77. # <user temp param: +x>
  78. # <user temp param: -x>
  79. # These do the same as <target temp param>, only for the user of the skill.
  80. # Enter them the same as target temp param tags.
  81. #
  82. # <clear temp stats: user>
  83. # <clear temp stats: target>
  84. # Will clear the temporary boosts and falls of either the user or target,
  85. # respectively.
  86. #
  87. # \sticky
  88. # Place this in a weapon or armor's notebox to make it a sticky piece, meaning
  89. # that it cannot be unequipped from the equip menu. It can still be unequipped
  90. # via event commands.
  91. # \unsticky
  92. # Place this in an item or skill's notebox to make it able to remove sticky
  93. # equipment. If you want to remove all sticky pieces equipped to an actor, use:
  94. # $game_actors[ACTOR_ID].unequip_sticky_equips
  95. #
  96. #===============================================================================
  97. #
  98. # BEGIN PAC SKILL AND EQUIP ADDONS
  99. #
  100. #===============================================================================
  101.  
  102. $imported = {} if $imported == nil
  103. $imported["PAC_ISaEAddons_1.6"] = true
  104.  
  105. #===============================================================================
  106. #
  107. # PAC EQUIP SKILLS
  108. #
  109. #===============================================================================
  110.  
  111. #==============================================================================
  112. # RPG::BaseItem
  113. #==============================================================================
  114.  
  115. class RPG::BaseItem
  116.   #--------------------------------------------------------------------------
  117.   # skills
  118.   #--------------------------------------------------------------------------
  119.   def skills
  120.     return @equipment_skills if @equipment_skills != nil
  121.     @equipment_skills = []
  122.     self.note.split(/[\r\n]+/).each { |line|
  123.       case line
  124.       when /<(?:EQUIPMENTSKILL|equipskill):[ ](\d+(?:\s*,\s*\d+)*)>/i
  125.         $1.scan(/\d+/).each { |num|
  126.         @equipment_skills.push($data_skills[num.to_i]) if num.to_i > 0 }
  127.       end
  128.     }
  129.     return @equipment_skills
  130.   end
  131. end
  132.  
  133. #==============================================================================
  134. # Game Actor
  135. #==============================================================================
  136.  
  137. class Game_Actor < Game_Battler
  138.   #--------------------------------------------------------------------------
  139.   # skills
  140.   #--------------------------------------------------------------------------
  141.   alias pac_saea_skills skills unless $@
  142.   def skills
  143.     list = pac_saea_skills
  144.     for equip in equips.compact
  145.       next if equip == nil
  146.       list += equip.skills
  147.     end
  148.     return list.uniq
  149.   end
  150.  
  151.   #--------------------------------------------------------------------------
  152.   # skill_can_use?
  153.   #--------------------------------------------------------------------------
  154.   def skill_can_use?(skill)
  155.     return super(skill)
  156.   end
  157. end
  158.  
  159. #===============================================================================
  160. #
  161. # PAC BREAK EQUIP
  162. #
  163. #===============================================================================
  164.  
  165. #==============================================================================
  166. # RPG::Skill
  167. #==============================================================================
  168.  
  169. class RPG::Skill < RPG::UsableItem
  170.   #--------------------------------------------------------------------------
  171.   # # Equipment Break
  172.   #--------------------------------------------------------------------------
  173.   def equipment_break
  174.     return @equipment_break if @equipment_break != nil
  175.     @equipment_break = []
  176.     self.note.split(/[\r\n]+/).each { |line|
  177.       case line
  178.       when /<(?:BREAK EQUIP|break equips):[ ](\d+(?:\s*,\s*\d+)*)>/i
  179.         $1.scan(/\d+/).each { |num| @equipment_break.push(num.to_i) }
  180.       end
  181.     }
  182.     return @equipment_break
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # # Equipment Repair
  186.   #--------------------------------------------------------------------------
  187.   def equipment_repair
  188.     return @equipment_repair if @equipment_repair != nil
  189.     @equipment_repair = []
  190.     self.note.split(/[\r\n]+/).each { |line|
  191.       case line
  192.       when /<(?:REPAIR EQUIP|repair equips):[ ](\d+(?:\s*,\s*\d+)*)>/i
  193.         $1.scan(/\d+/).each { |num| @equipment_repair.push(num.to_i) }
  194.       end
  195.     }
  196.     return @equipment_repair
  197.   end
  198. end
  199.  
  200. #==============================================================================
  201. # ** Game_Battler
  202. #==============================================================================
  203.  
  204. class Game_Battler
  205.   #--------------------------------------------------------------------------
  206.   # * Apply Skill Effects
  207.   #--------------------------------------------------------------------------
  208.   alias pac_saea_skill_effect skill_effect unless $@
  209.   def skill_effect(user, skill)
  210.     pac_saea_skill_effect(user, skill)
  211.     break_equipment(skill) unless @skipped or @missed or @evaded
  212.     repair_equipment(skill) unless @skipped or @missed or @evaded
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # * Break Equipment
  216.   #--------------------------------------------------------------------------
  217.   def break_equipment(skill)
  218.     return unless $game_temp.in_battle
  219.     return unless actor?
  220.     return if skill.equipment_break.empty?
  221.     @broken_equipment = [] if @broken_equipment.nil?
  222.     @broken_equipment += skill.equipment_break
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # * Repair Equipment
  226.   #--------------------------------------------------------------------------
  227.   def repair_equipment(skill)
  228.     return unless $game_temp.in_battle
  229.     return unless actor?
  230.     return if skill.equipment_break.empty?
  231.     @broken_equipment = [] if @broken_equipment.nil?
  232.     @broken_equipment -= skill.equipment_repair
  233.   end
  234. end
  235.  
  236. #==============================================================================
  237. # ** Game_Actor
  238. #==============================================================================
  239.  
  240. class Game_Actor < Game_Battler
  241.   #--------------------------------------------------------------------------
  242.   # * Get Weapon Object Array
  243.   #--------------------------------------------------------------------------
  244.   alias pac_saea_weapons weapons unless $@
  245.   def weapons
  246.     result = pac_saea_weapons
  247.     @broken_equipment = [] if @broken_equipment.nil?
  248.     result[0] = nil if @broken_equipment.include?(0)
  249.     result[1] = nil if two_swords_style and @broken_equipment.include?(1)
  250.     return result
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # * Get Armor Object Array
  254.   #--------------------------------------------------------------------------
  255.   alias pac_saea_armors armors unless $@
  256.   def armors
  257.     result = pac_saea_armors
  258.     @broken_equipment = [] if @broken_equipment.nil?
  259.     for i in @broken_equipment
  260.       next if i == 0
  261.       result[i-1] = nil
  262.     end
  263.     return result
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # * Clear Broken Equipment
  267.   #--------------------------------------------------------------------------
  268.   def clear_broken_equipment
  269.     @broken_equipment = []
  270.   end
  271. end
  272.  
  273. #==============================================================================
  274. # ** Scene_Battle
  275. #==============================================================================
  276.  
  277. class Scene_Battle < Scene_Base
  278.   #--------------------------------------------------------------------------
  279.   # * Start processing
  280.   #--------------------------------------------------------------------------
  281.   alias pac_saea_start start unless $@
  282.   def start
  283.     for member in $game_party.members do member.clear_broken_equipment end
  284.     pac_saea_start
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # * End Battle
  288.   #--------------------------------------------------------------------------
  289.   alias pac_saea_battle_end battle_end unless $@
  290.   def battle_end(result)
  291.     for member in $game_party.members do member.clear_broken_equipment end
  292.     pac_saea_battle_end(result)
  293.   end
  294. end
  295.  
  296. #===============================================================================
  297. #
  298. # PAC FORGET SKILLS
  299. #
  300. #===============================================================================
  301.  
  302. class RPG::Skill < RPG::UsableItem
  303.   #--------------------------------------------------------------------------
  304.   # * Forget Upon Learning
  305.   #--------------------------------------------------------------------------
  306.   def forget_upon_learning
  307.     return @forget_upon_learning if @forget_upon_learning != nil
  308.     @forget_upon_learning = []
  309.     self.note.split(/[\r\n]+/).each { |line|
  310.     case line
  311.       when /<(?:FORGET SKILL|forget skills):[ ](\d+(?:\s*,\s*\d+)*)>/i
  312.         $1.scan(/\d+/).each { |num| @forget_upon_learning.push(num.to_i) }
  313.       end
  314.     }
  315.     return @forget_upon_learning
  316.   end
  317. end
  318.  
  319. #==============================================================================
  320. # ** Game_Actor
  321. #==============================================================================
  322.  
  323. class Game_Actor < Game_Battler
  324.   #--------------------------------------------------------------------------
  325.   # * Learn Skill
  326.   #--------------------------------------------------------------------------
  327.   alias pac_forget_learn_skill learn_skill unless $@
  328.   def learn_skill(skill_id)
  329.     unless skill_learn?($data_skills[skill_id])
  330.       for sk_id in $data_skills[skill_id].forget_upon_learning
  331.         forget_skill(sk_id)
  332.       end
  333.     end
  334.     pac_forget_learn_skill(skill_id)
  335.   end
  336. end
  337.  
  338. #===============================================================================
  339. #
  340. # PAC PASSIVE SKILLS
  341. #
  342. #===============================================================================
  343.  
  344. #==============================================================================
  345. # RPG::BaseItem
  346. #==============================================================================
  347.  
  348. class RPG::BaseItem
  349.  
  350.   #--------------------------------------------------------------------------
  351.   # passive_traits
  352.   #--------------------------------------------------------------------------
  353.   def passive_traits
  354.     return @passive_traits if @passive_traits != nil
  355.     @passive_traits = { :maxhp => 0, :maxmp => 0, :atk => 0, :def => 0,
  356.       :spi => 0, :agi => 0, :dex => 0, :res => 0, :hit => 0, :eva => 0,
  357.       :cri => 0, :odds => 0, :maxhpp => 100, :maxmpp => 100, :atkp => 100,
  358.       :defp => 100, :spip => 100, :agip => 100, :dexp => 100, :resp => 100,
  359.       :hitp => 100, :evap => 100, :crip => 100, :oddsp => 100, :states => []}
  360.     self.note.split(/[\r\n]+/).each { |line|
  361.       case line
  362.       when /<(?:PASSIVE|pas)[ ](.*):[ ]([\+\-]\d+)>/i
  363.         case $1.upcase
  364.         when "MAXHP", "HP"
  365.           @passive_traits[:maxhp] = $2.to_i
  366.         when "MAXMP", "MP"
  367.           @passive_traits[:maxmp] = $2.to_i
  368.         when "ATK"
  369.           @passive_traits[:atk] = $2.to_i
  370.         when "DEF"
  371.           @passive_traits[:def] = $2.to_i
  372.         when "SPI"
  373.           @passive_traits[:spi] = $2.to_i
  374.         when "AGI"
  375.           @passive_traits[:agi] = $2.to_i
  376.         when "DEX"
  377.           @passive_traits[:dex] = $2.to_i
  378.         when "RES"
  379.           @passive_traits[:res] = $2.to_i
  380.         when "HIT"
  381.           @passive_traits[:hit] = $2.to_i
  382.         when "EVA"
  383.           @passive_traits[:eva] = $2.to_i
  384.         when "CRI"
  385.           @passive_traits[:cri] = $2.to_i
  386.         when "ODDS"
  387.           @passive_traits[:odds] = $2.to_i
  388.         end
  389.       when /<(?:PASSIVE|pas)[ ](.*):[ ](\d+)([%ï¼…])>/i
  390.         case $1.upcase
  391.         when "MAXHP", "HP"
  392.           @passive_traits[:maxhpp] = $2.to_i
  393.         when "MAXMP", "MP"
  394.           @passive_traits[:maxmpp] = $2.to_i
  395.         when "ATK"
  396.           @passive_traits[:atkp] = $2.to_i
  397.         when "DEF"
  398.           @passive_traits[:defp] = $2.to_i
  399.         when "SPI"
  400.           @passive_traits[:spip] = $2.to_i
  401.         when "AGI"
  402.           @passive_traits[:agip] = $2.to_i
  403.         when "DEX"
  404.           @passive_traits[:dexp] = $2.to_i
  405.         when "RES"
  406.           @passive_traits[:resp] = $2.to_i
  407.         when "HIT"
  408.           @passive_traits[:hitp] = $2.to_i
  409.         when "EVA"
  410.           @passive_traits[:evap] = $2.to_i
  411.         when "CRI"
  412.           @passive_traits[:crip] = $2.to_i
  413.         when "ODDS"
  414.           @passive_traits[:oddsp] = $2.to_i
  415.         end
  416.       when /<(?:PASSIVE_STATE|passive state):[ ](\d+(?:\s*,\s*\d+)*)>/i
  417.         $1.scan(/\d+/).each { |num|
  418.         @passive_traits[:states].push($data_states[num.to_i]) if num.to_i > 0 }
  419.       end
  420.     }
  421.     return @passive_traits
  422.   end
  423.  
  424. end
  425.  
  426. #==============================================================================
  427. # ** Game_Battler
  428. #==============================================================================
  429.  
  430. class Game_Battler
  431.   #--------------------------------------------------------------------------
  432.   # * Get Current States as an Object Array
  433.   #--------------------------------------------------------------------------
  434.   alias states_pac_passive_skills states unless $@
  435.   def states
  436.     array = states_pac_passive_skills
  437.     if actor?
  438.       for skill in skills do array |= skill.passive_traits[:states] end
  439.     end
  440.     return array.compact
  441.   end
  442. end
  443.  
  444. #==============================================================================
  445. # Game Actor
  446. #==============================================================================
  447.  
  448. class Game_Actor < Game_Battler
  449.   #--------------------------------------------------------------------------
  450.   # * Get Basic Maximum HP
  451.   #--------------------------------------------------------------------------
  452.   alias base_maxhp_pac_passive_skills base_maxhp unless $@
  453.   def base_maxhp
  454.     n = base_maxhp_pac_passive_skills
  455.     for skill in skills do n = n * skill.passive_traits[:maxhpp] / 100.0 end
  456.     for skill in skills do n += skill.passive_traits[:maxhp] end
  457.     return Integer(n)
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # * Get Basic Maximum MP
  461.   #--------------------------------------------------------------------------
  462.   alias base_maxmp_pac_passive_skills base_maxmp unless $@
  463.   def base_maxmp
  464.     n = base_maxmp_pac_passive_skills
  465.     for skill in skills do n = n * skill.passive_traits[:maxmpp] / 100.0 end
  466.     for skill in skills do n += skill.passive_traits[:maxmp] end
  467.     return Integer(n)
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # * Get Basic Attack
  471.   #--------------------------------------------------------------------------
  472.   alias base_atk_pac_passive_skills base_atk unless $@
  473.   def base_atk
  474.     n = base_atk_pac_passive_skills
  475.     for skill in skills do n = n * skill.passive_traits[:atkp] / 100.0 end
  476.     for skill in skills do n += skill.passive_traits[:atk] end
  477.     return Integer(n)
  478.   end
  479.   #--------------------------------------------------------------------------
  480.   # * Get Basic Defense
  481.   #--------------------------------------------------------------------------
  482.   alias base_def_pac_passive_skills base_def unless $@
  483.   def base_def
  484.     n = base_def_pac_passive_skills
  485.     for skill in skills do n = n * skill.passive_traits[:defp] / 100.0 end
  486.     for skill in skills do n += skill.passive_traits[:def] end
  487.     return Integer(n)
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # * Get Basic Spirit
  491.   #--------------------------------------------------------------------------
  492.   alias base_spi_pac_passive_skills base_spi unless $@
  493.   def base_spi
  494.     n = base_spi_pac_passive_skills
  495.     for skill in skills do n = n * skill.passive_traits[:spip] / 100.0 end
  496.     for skill in skills do n += skill.passive_traits[:spi] end
  497.     return Integer(n)
  498.   end
  499.   #--------------------------------------------------------------------------
  500.   # * Get Basic Agility
  501.   #--------------------------------------------------------------------------
  502.   alias base_agi_pac_passive_skills base_agi unless $@
  503.   def base_agi
  504.     n = base_agi_pac_passive_skills
  505.     for skill in skills do n = n * skill.passive_traits[:agip] / 100.0 end
  506.     for skill in skills do n += skill.passive_traits[:agi] end
  507.     return Integer(n)
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # * Get Basic Dexterity
  511.   #--------------------------------------------------------------------------
  512.   if $imported["DEX Stat"]
  513.   alias base_dex_pac_passive_skills base_dex unless $@
  514.   def base_dex
  515.     n = base_dex_pac_passive_skills
  516.     for skill in skills do n = n * skill.passive_traits[:dexp] / 100.0 end
  517.     for skill in skills do n += skill.passive_traits[:dex] end
  518.     return Integer(n)
  519.   end
  520.   end
  521.   #--------------------------------------------------------------------------
  522.   # * Get Basic Resist
  523.   #--------------------------------------------------------------------------
  524.   if $imported["RES Stat"]
  525.   alias base_res_pac_passive_skills base_res unless $@
  526.   def base_res
  527.     n = base_res_pac_passive_skills
  528.     for skill in skills do n = n * skill.passive_traits[:resp] / 100.0 end
  529.     for skill in skills do n += skill.passive_traits[:res] end
  530.     return Integer(n)
  531.   end
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # * Get Hit Rate
  535.   #--------------------------------------------------------------------------
  536.   alias hit_pac_passive_skills hit unless $@
  537.   def hit
  538.     n = hit_pac_passive_skills
  539.     for skill in skills do n = n * skill.passive_traits[:hitp] / 100.0 end
  540.     for skill in skills do n += skill.passive_traits[:hit] end
  541.     return [Integer(n), 0].max
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # * Get Evasion Rate
  545.   #--------------------------------------------------------------------------
  546.   alias eva_pac_passive_skills eva unless $@
  547.   def eva
  548.     n = eva_pac_passive_skills
  549.     for skill in skills do n = n * skill.passive_traits[:evap] / 100.0 end
  550.     for skill in skills do n += skill.passive_traits[:eva] end
  551.     return [Integer(n), 0].max
  552.   end
  553.   #--------------------------------------------------------------------------
  554.   # * Get Critical Rate
  555.   #--------------------------------------------------------------------------
  556.   alias cri_pac_passive_skills cri unless $@
  557.   def cri
  558.     n = cri_pac_passive_skills
  559.     for skill in skills do n = n * skill.passive_traits[:crip] / 100.0 end
  560.     for skill in skills do n += skill.passive_traits[:cri] end
  561.     return [Integer(n), 0].max
  562.   end
  563.   #--------------------------------------------------------------------------
  564.   # * Get Ease of Hitting
  565.   #--------------------------------------------------------------------------
  566.   alias odds_pac_passive_skills odds unless $@
  567.   def odds
  568.     n = odds_pac_passive_skills
  569.     for skill in skills do n = n * skill.passive_traits[:oddsp] / 100.0 end
  570.     for skill in skills do n += skill.passive_traits[:odds] end
  571.     return [Integer(n), 1].max
  572.   end
  573. end
  574.  
  575. #===============================================================================
  576. #
  577. # PAC Item Teaching Skills
  578. #
  579. #===============================================================================
  580.  
  581. #==============================================================================
  582. # RPG::BaseItem
  583. #==============================================================================
  584.  
  585. class RPG::BaseItem
  586.   #--------------------------------------------------------------------------
  587.   # teach_skills
  588.   #--------------------------------------------------------------------------
  589.   def teach_skills
  590.     return @teach_skills if @teach_skills != nil
  591.     @teach_skills = []
  592.     self.note.split(/[\r\n]+/).each { |line|
  593.       case line
  594.       when /<(?:TEACH SKILL|LEARN SKILL):[ ](\d+(?:\s*,\s*\d+)*)>/i
  595.         $1.scan(/\d+/).each { |num|
  596.         @teach_skills.push(num.to_i) if num.to_i > 0 }
  597.       end
  598.     }
  599.     return @teach_skills
  600.   end
  601. end
  602.  
  603. #==============================================================================
  604. # ** Game_Battler
  605. #==============================================================================
  606.  
  607. class Game_Battler
  608.   #--------------------------------------------------------------------------
  609.   # * Item Application Test
  610.   #--------------------------------------------------------------------------
  611.   alias item_test_pac_teachskillitems item_test unless $@
  612.   def item_test(user, item)
  613.     return true if item.teach_skills != []
  614.     return item_test_pac_teachskillitems(user, item)
  615.   end
  616.   #--------------------------------------------------------------------------
  617.   # * Apply Item Effects
  618.   #--------------------------------------------------------------------------
  619.   alias item_effect_pac_teachskillitems item_effect unless $@
  620.   def item_effect(user, item)
  621.     item_effect_pac_teachskillitems(user, item)
  622.     return if @skipped or @missed or @evaded
  623.     teach_item_skills(item) if actor?
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # * teach_item_skills
  627.   #--------------------------------------------------------------------------
  628.   def teach_item_skills(item)
  629.     for skill_id in item.teach_skills do learn_skill(skill_id) end
  630.   end
  631. end
  632.  
  633. #===============================================================================
  634. #
  635. # PAC TEMPORARY BOOSTS
  636. #
  637. #===============================================================================
  638.  
  639. #==============================================================================
  640. # RPG::BaseItem
  641. #==============================================================================
  642.  
  643. class RPG::BaseItem
  644.   #--------------------------------------------------------------------------
  645.   # target_temp_boost
  646.   #--------------------------------------------------------------------------
  647.   def target_temp_boost
  648.     return @target_temp_boost if @target_temp_boost != nil
  649.     @target_temp_boost = {:maxhp => 0, :maxmp => 0, :atk => 0, :def => 0,
  650.       :spi => 0, :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0,
  651.       :dex => 0, :res => 0}
  652.     self.note.split(/[\r\n]+/).each { |line|
  653.       case line
  654.       when /<(?:TARGET TEMPORARY|target temp)[ ](.*):[ ]([\+\-]\d+)>/i
  655.         case $1.upcase
  656.         when "MAXHP"
  657.           @target_temp_boost[:maxhp] = $2.to_i
  658.         when "MAXMP"
  659.           @target_temp_boost[:maxmp] = $2.to_i
  660.         when "ATK"
  661.           @target_temp_boost[:atk] = $2.to_i
  662.         when "DEF"
  663.           @target_temp_boost[:def] = $2.to_i
  664.         when "SPI"
  665.           @target_temp_boost[:spi] = $2.to_i
  666.         when "AGI"
  667.           @target_temp_boost[:agi] = $2.to_i
  668.         when "HIT"
  669.           @target_temp_boost[:hit] = $2.to_i
  670.         when "EVA"
  671.           @target_temp_boost[:eva] = $2.to_i
  672.         when "CRI"
  673.           @target_temp_boost[:cri] = $2.to_i
  674.         when "ODDS"
  675.           @target_temp_boost[:odds] = $2.to_i
  676.         when "DEX"
  677.           @target_temp_boost[:dex] = $2.to_i
  678.         when "RES"
  679.           @target_temp_boost[:res] = $2.to_i
  680.         end
  681.       end
  682.     }
  683.     return @target_temp_boost
  684.   end
  685.   #--------------------------------------------------------------------------
  686.   # user_temp_boost
  687.   #--------------------------------------------------------------------------
  688.   def user_temp_boost
  689.     return @user_temp_boost if @user_temp_boost != nil
  690.     @user_temp_boost = {:maxhp => 0, :maxmp => 0, :atk => 0, :def => 0,
  691.       :spi => 0, :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0,
  692.       :dex => 0, :res => 0}
  693.     self.note.split(/[\r\n]+/).each { |line|
  694.       case line
  695.       when /<(?:USER TEMPORARY|user temp)[ ](.*):[ ]([\+\-]\d+)>/i
  696.         case $1.upcase
  697.         when "MAXHP"
  698.           @user_temp_boost[:maxhp] = $2.to_i
  699.         when "MAXMP"
  700.           @user_temp_boost[:maxmp] = $2.to_i
  701.         when "ATK"
  702.           @user_temp_boost[:atk] = $2.to_i
  703.         when "DEF"
  704.           @user_temp_boost[:def] = $2.to_i
  705.         when "SPI"
  706.           @user_temp_boost[:spi] = $2.to_i
  707.         when "AGI"
  708.           @user_temp_boost[:agi] = $2.to_i
  709.         when "HIT"
  710.           @user_temp_boost[:hit] = $2.to_i
  711.         when "EVA"
  712.           @user_temp_boost[:eva] = $2.to_i
  713.         when "CRI"
  714.           @user_temp_boost[:cri] = $2.to_i
  715.         when "ODDS"
  716.           @user_temp_boost[:odds] = $2.to_i
  717.         when "DEX"
  718.           @user_temp_boost[:dex] = $2.to_i
  719.         when "RES"
  720.           @user_temp_boost[:res] = $2.to_i
  721.         end
  722.       end
  723.     }
  724.     return @user_temp_boost
  725.   end
  726.   #--------------------------------------------------------------------------
  727.   # clear_temp_stats
  728.   #--------------------------------------------------------------------------
  729.   def clear_temp_stats
  730.     return @clear_temp_stats if @clear_temp_stats != nil
  731.     @clear_temp_stats = {:user => false, :target => false}
  732.     self.note.split(/[\r\n]+/).each { |line|
  733.       case line
  734.       when /<(?:CLEAR TEMP STATS|clear temp boosts)[ ](.*)>/i
  735.         case $1.upcase
  736.         when "USER"
  737.           @clear_temp_stats[:user] = true
  738.         when "TARGET", "TARGETS"
  739.           @clear_temp_stats[:target] = true
  740.         end
  741.       end
  742.     }
  743.     return @clear_temp_stats
  744.   end
  745. end
  746.  
  747. #==============================================================================
  748. # ** Game_Battler
  749. #==============================================================================
  750.  
  751. class Game_Battler
  752.   #--------------------------------------------------------------------------
  753.   # * Object Initialization
  754.   #--------------------------------------------------------------------------
  755.   alias initialize_pac_temp_stat_boosts initialize unless $@
  756.   def initialize
  757.     initialize_pac_temp_stat_boosts
  758.     clear_temp_stat_boosts
  759.   end
  760.   #--------------------------------------------------------------------------
  761.   # * Clear Temp Stat Boosts
  762.   #--------------------------------------------------------------------------
  763.   def clear_temp_stat_boosts
  764.     @temp_maxhp_boost = 0
  765.     @temp_maxmp_boost = 0
  766.     @temp_atk_boost = 0
  767.     @temp_def_boost = 0
  768.     @temp_spi_boost = 0
  769.     @temp_agi_boost = 0
  770.     @temp_hit_boost = 0
  771.     @temp_eva_boost = 0
  772.     @temp_cri_boost = 0
  773.     @temp_odds_boost = 0
  774.     @temp_dex_boost = 0
  775.     @temp_res_boost = 0
  776.   end
  777.   #--------------------------------------------------------------------------
  778.   # * Apply Temp Boost
  779.   #--------------------------------------------------------------------------
  780.   def apply_temp_boost(hash)
  781.     @temp_maxhp_boost += hash[:maxhp]
  782.     @temp_maxmp_boost += hash[:maxmp]
  783.     @temp_atk_boost += hash[:atk]
  784.     @temp_def_boost += hash[:def]
  785.     @temp_spi_boost += hash[:spi]
  786.     @temp_agi_boost += hash[:agi]
  787.     @temp_hit_boost += hash[:hit]
  788.     @temp_eva_boost += hash[:eva]
  789.     @temp_cri_boost += hash[:cri]
  790.     @temp_odds_boost += hash[:odds]
  791.     @temp_dex_boost += hash[:dex]
  792.     @temp_res_boost += hash[:res]
  793.   end
  794.   #--------------------------------------------------------------------------
  795.   # * Apply Skill Effects
  796.   #--------------------------------------------------------------------------
  797.   alias skill_effect_pac_temp_boosts skill_effect unless $@
  798.   def skill_effect(user, skill)
  799.     skill_effect_pac_temp_boosts(user, skill)
  800.     return unless $game_temp.in_battle
  801.     return if @skipped or @missed or @evaded
  802.     clear_temp_stat_boosts if skill.clear_temp_stats[:target]
  803.     user.clear_temp_stat_boosts if skill.clear_temp_stats[:user]
  804.     apply_temp_boost(skill.target_temp_boost)
  805.     user.apply_temp_boost(skill.user_temp_boost)
  806.   end
  807.   #--------------------------------------------------------------------------
  808.   # * Apply Item Effects
  809.   #--------------------------------------------------------------------------
  810.   alias item_effect_pac_temp_boosts item_effect unless $@
  811.   def item_effect(user, item)
  812.     item_effect_pac_temp_boosts(user, item)
  813.     return unless $game_temp.in_battle
  814.     return if @skipped or @missed or @evaded
  815.     clear_temp_stat_boosts if item.clear_temp_stats[:target]
  816.     user.clear_temp_stat_boosts if item.clear_temp_stats[:user]
  817.     apply_temp_boost(item.target_temp_boost)
  818.     user.apply_temp_boost(item.user_temp_boost)
  819.   end
  820.   #--------------------------------------------------------------------------
  821.   # * Maxmp Limit
  822.   #--------------------------------------------------------------------------
  823.   unless method_defined?(:maxmp_limit)
  824.   def maxmp_limit; return 9999; end
  825.   end
  826.   #--------------------------------------------------------------------------
  827.   # * Parameter Limit
  828.   #--------------------------------------------------------------------------
  829.   unless method_defined?(:parameter_limit)
  830.   def parameter_limit; return 999; end
  831.   end
  832.   #--------------------------------------------------------------------------
  833.   # * Get Maximum HP
  834.   #--------------------------------------------------------------------------
  835.   alias maxhp_pac_temp_boosts maxhp unless $@
  836.   def maxhp
  837.     clear_temp_stat_boosts if @temp_maxhp_boost.nil?
  838.     return [[maxhp_pac_temp_boosts + @temp_maxhp_boost, 1].max, maxhp_limit].min
  839.   end
  840.   #--------------------------------------------------------------------------
  841.   # * Get Maximum MP
  842.   #--------------------------------------------------------------------------
  843.   alias maxmp_pac_temp_boosts maxmp unless $@
  844.   def maxmp
  845.     clear_temp_stat_boosts if @temp_maxmp_boost.nil?
  846.     return [[maxmp_pac_temp_boosts + @temp_maxmp_boost, 0].max, maxmp_limit].min
  847.   end
  848.   #--------------------------------------------------------------------------
  849.   # * Get Attack
  850.   #--------------------------------------------------------------------------
  851.   alias atk_pac_temp_boosts atk unless $@
  852.   def atk
  853.     clear_temp_stat_boosts if @temp_atk_boost.nil?
  854.     return [[atk_pac_temp_boosts + @temp_atk_boost, 1].max, parameter_limit].min
  855.   end
  856.   #--------------------------------------------------------------------------
  857.   # * Get Defense
  858.   #--------------------------------------------------------------------------
  859.   alias def_pac_temp_boosts def unless $@
  860.   def def
  861.     clear_temp_stat_boosts if @temp_def_boost.nil?
  862.     return [[def_pac_temp_boosts + @temp_def_boost, 1].max, parameter_limit].min
  863.   end
  864.   #--------------------------------------------------------------------------
  865.   # * Get Spirit
  866.   #--------------------------------------------------------------------------
  867.   alias spi_pac_temp_boosts spi unless $@
  868.   def spi
  869.     clear_temp_stat_boosts if @temp_spi_boost.nil?
  870.     return [[spi_pac_temp_boosts + @temp_spi_boost, 1].max, parameter_limit].min
  871.   end
  872.   #--------------------------------------------------------------------------
  873.   # * Get Agility
  874.   #--------------------------------------------------------------------------
  875.   alias agi_pac_temp_boosts agi unless $@
  876.   def agi
  877.     clear_temp_stat_boosts if @temp_agi_boost.nil?
  878.     return [[agi_pac_temp_boosts + @temp_agi_boost, 1].max, parameter_limit].min
  879.   end
  880.   #--------------------------------------------------------------------------
  881.   # * Get Dexterity
  882.   #--------------------------------------------------------------------------
  883.   if $imported["DEX Stat"]
  884.   alias dex_pac_temp_boosts dex unless $@
  885.   def dex
  886.     clear_temp_stat_boosts if @temp_dex_boost.nil?
  887.     return [[dex_pac_temp_boosts + @temp_dex_boost, 1].max, parameter_limit].min
  888.   end
  889.   end
  890.   #--------------------------------------------------------------------------
  891.   # * Get Resist
  892.   #--------------------------------------------------------------------------
  893.   if $imported["RES Stat"]
  894.   alias res_pac_temp_boosts res unless $@
  895.   def res
  896.     clear_temp_stat_boosts if @temp_res_boost.nil?
  897.     return [[res_pac_temp_boosts + @temp_res_boost, 1].max, parameter_limit].min
  898.   end
  899.   end
  900. end
  901.  
  902. #==============================================================================
  903. # ** Game_Actor
  904. #==============================================================================
  905.  
  906. class Game_Actor < Game_Battler
  907.   #--------------------------------------------------------------------------
  908.   # * Get Hit Rate
  909.   #--------------------------------------------------------------------------
  910.   alias hit_pac_temp_boosts_actor hit unless $@
  911.   def hit
  912.     clear_temp_stat_boosts if @temp_hit_boost.nil?
  913.     return [hit_pac_temp_boosts_actor + @temp_hit_boost, 0].max
  914.   end
  915.   #--------------------------------------------------------------------------
  916.   # * Get Evasion Rate
  917.   #--------------------------------------------------------------------------
  918.   alias eva_pac_temp_boosts_actor eva unless $@
  919.   def eva
  920.     clear_temp_stat_boosts if @temp_eva_boost.nil?
  921.     return [eva_pac_temp_boosts_actor + @temp_eva_boost, 0].max
  922.   end
  923.   #--------------------------------------------------------------------------
  924.   # * Get Critical Ratio
  925.   #--------------------------------------------------------------------------
  926.   alias cri_pac_temp_boosts_actor cri unless $@
  927.   def cri
  928.     clear_temp_stat_boosts if @temp_cri_boost.nil?
  929.     return [cri_pac_temp_boosts_actor + @temp_cri_boost, 0].max
  930.   end
  931.   #--------------------------------------------------------------------------
  932.   # * Get Ease of Hitting
  933.   #--------------------------------------------------------------------------
  934.   alias odds_pac_temp_boosts_actor odds unless $@
  935.   def odds
  936.     clear_temp_stat_boosts if @temp_odds_boost.nil?
  937.     return [odds_pac_temp_boosts_actor + @temp_odds_boost, 0].max
  938.   end
  939. end
  940.  
  941. #==============================================================================
  942. # ** Game_Enemy
  943. #==============================================================================
  944.  
  945. class Game_Enemy < Game_Battler
  946.   #--------------------------------------------------------------------------
  947.   # * Get Hit Rate
  948.   #--------------------------------------------------------------------------
  949.   alias hit_pac_temp_boosts_enemy hit unless $@
  950.   def hit
  951.     clear_temp_stat_boosts if @temp_hit_boost.nil?
  952.     return [hit_pac_temp_boosts_enemy + @temp_hit_boost, 0].max
  953.   end
  954.   #--------------------------------------------------------------------------
  955.   # * Get Evasion Rate
  956.   #--------------------------------------------------------------------------
  957.   alias eva_pac_temp_boosts_enemy eva unless $@
  958.   def eva
  959.     clear_temp_stat_boosts if @temp_eva_boost.nil?
  960.     return [eva_pac_temp_boosts_enemy + @temp_eva_boost, 0].max
  961.   end
  962.   #--------------------------------------------------------------------------
  963.   # * Get Critical Ratio
  964.   #--------------------------------------------------------------------------
  965.   alias cri_pac_temp_boosts_enemy cri unless $@
  966.   def cri
  967.     clear_temp_stat_boosts if @temp_cri_boost.nil?
  968.     return [cri_pac_temp_boosts_enemy + @temp_cri_boost, 0].max
  969.   end
  970.   #--------------------------------------------------------------------------
  971.   # * Get Ease of Hitting
  972.   #--------------------------------------------------------------------------
  973.   alias odds_pac_temp_boosts_enemy odds unless $@
  974.   def odds
  975.     clear_temp_stat_boosts if @temp_odds_boost.nil?
  976.     return [odds_pac_temp_boosts_enemy + @temp_odds_boost, 0].max
  977.   end
  978. end
  979.  
  980. #==============================================================================
  981. # ** Scene_Battle
  982. #==============================================================================
  983.  
  984. class Scene_Battle < Scene_Base
  985.   #--------------------------------------------------------------------------
  986.   # * Battle Start Processing
  987.   #--------------------------------------------------------------------------
  988.   alias process_battle_start_pac_temp_boosts process_battle_start unless $@
  989.   def process_battle_start
  990.     for member in $game_party.members
  991.       member.clear_temp_stat_boosts
  992.     end
  993.     process_battle_start_pac_temp_boosts
  994.   end
  995.   #--------------------------------------------------------------------------
  996.   # * End Battle
  997.   #--------------------------------------------------------------------------
  998.   alias battle_end_pac_temp_boosts battle_end unless $@
  999.   def battle_end(result)
  1000.     battle_end_pac_temp_boosts(result)
  1001.     for member in $game_party.members
  1002.       member.clear_temp_stat_boosts
  1003.     end
  1004.   end
  1005. end
  1006.  
  1007. #===============================================================================
  1008. #
  1009. # PAC STICKY EQUIPMENT
  1010. #
  1011. #===============================================================================
  1012.  
  1013. #===============================================================================
  1014. # *** RPG
  1015. #-------------------------------------------------------------------------------
  1016. # Module for RPGVX data structures.
  1017. #===============================================================================
  1018.  
  1019. module RPG  
  1020.  
  1021. #===============================================================================
  1022. # ** UsableItem
  1023. #-------------------------------------------------------------------------------
  1024. # Superclass for items and skills.
  1025. #===============================================================================
  1026.  
  1027. class UsableItem  
  1028.   #--------------------------------------------------------------------------
  1029.   # * remove_sticky?
  1030.   #--------------------------------------------------------------------------
  1031.   def remove_sticky?
  1032.     @unsticky = !self.note[/\\UNSTICKY/i].nil? if @unsticky.nil?
  1033.     return @unsticky
  1034.   end
  1035. end
  1036.  
  1037. #===============================================================================
  1038. # ** Weapon
  1039. #-------------------------------------------------------------------------------
  1040. # Data class for weapons.
  1041. #===============================================================================
  1042.  
  1043. class Weapon
  1044.   #--------------------------------------------------------------------------
  1045.   # * sticky?
  1046.   #--------------------------------------------------------------------------
  1047.   def sticky?
  1048.     @sticky = !self.note[/\\STICKY/i].nil? if @sticky.nil?
  1049.     return @sticky
  1050.   end
  1051. end
  1052.  
  1053. #===============================================================================
  1054. # ** Armor
  1055. #-------------------------------------------------------------------------------
  1056. # Data class for armor.
  1057. #===============================================================================
  1058.  
  1059. class Armor
  1060.   #--------------------------------------------------------------------------
  1061.   # * sticky?
  1062.   #--------------------------------------------------------------------------
  1063.   def sticky?
  1064.     @sticky = !self.note[/\\STICKY/i].nil? if @sticky.nil?
  1065.     return @sticky
  1066.   end
  1067. end
  1068.  
  1069. end # RPG
  1070.  
  1071. #==============================================================================
  1072. # ** Game_Actor
  1073. #------------------------------------------------------------------------------
  1074. #  This class handles actors. It's used within the Game_Actors class
  1075. # ($game_actors) and referenced by the Game_Party class ($game_party).
  1076. #==============================================================================
  1077.  
  1078. class Game_Actor
  1079.   #--------------------------------------------------------------------------
  1080.   # alias listing
  1081.   #--------------------------------------------------------------------------
  1082.   alias pac_stky_eqp_skill_tst skill_test
  1083.   alias pac_stky_eqp_skill_effect skill_effect
  1084.   alias pac_stky_eqp_item_test item_test
  1085.   alias pac_stky_eqp_item_effect item_effect
  1086.   #--------------------------------------------------------------------------
  1087.   # * Skill Test
  1088.   #--------------------------------------------------------------------------
  1089.   def skill_test (user, skill, *args)
  1090.     if skill.remove_sticky?
  1091.       equips.each { |equip| return true if !equip.nil? && equip.sticky? }
  1092.     end
  1093.     return pac_stky_eqp_skill_tst(user, skill, *args) # Run Original Method
  1094.   end
  1095.   #--------------------------------------------------------------------------
  1096.   # * Skill Effect
  1097.   #--------------------------------------------------------------------------
  1098.   def skill_effect (user, skill, *args)
  1099.     unequip_sticky_equips if skill.remove_sticky?
  1100.     pac_stky_eqp_skill_effect(user, skill, *args) # Run Original Method
  1101.   end
  1102.   #--------------------------------------------------------------------------
  1103.   # * Item Test
  1104.   #--------------------------------------------------------------------------
  1105.   def item_test (user, item, *args)
  1106.     if item.remove_sticky?
  1107.       equips.each { |equip| return true if !equip.nil? && equip.sticky? }
  1108.     end
  1109.     return pac_stky_eqp_item_test(user, item, *args) # Run Original Method
  1110.   end
  1111.   #--------------------------------------------------------------------------
  1112.   # * Item Effect
  1113.   #--------------------------------------------------------------------------
  1114.   def item_effect(user, item, *args)
  1115.     pac_stky_eqp_item_effect(user, item, *args) # Run Original Method
  1116.     unequip_sticky_equips if item.remove_sticky?
  1117.   end
  1118.   #--------------------------------------------------------------------------
  1119.   # * Unequip sticky Items
  1120.   #--------------------------------------------------------------------------
  1121.   def unequip_sticky_equips
  1122.     for i in 0...equips.size
  1123.       change_equip(i, nil, false) if !equips[i].nil? && equips[i].sticky?
  1124.     end
  1125.   end
  1126. end
  1127.  
  1128. #==============================================================================
  1129. # ** Scene_Equip
  1130. #------------------------------------------------------------------------------
  1131. #  This class performs the equipment screen processing.
  1132. #==============================================================================
  1133.  
  1134. class Scene_Equip
  1135.   #--------------------------------------------------------------------------
  1136.   # alias listing
  1137.   #--------------------------------------------------------------------------
  1138.   alias pac_stky_eqp_update_equip_selection update_equip_selection
  1139.   #--------------------------------------------------------------------------
  1140.   # * Update Equip Region Selection
  1141.   #--------------------------------------------------------------------------
  1142.   def update_equip_selection(*args)
  1143.     if Input.trigger?(Input::C) && !@equip_window.item.nil? && @equip_window.item.sticky?
  1144.       Sound.play_buzzer
  1145.       return
  1146.     end
  1147.     pac_stky_eqp_update_equip_selection(*args) # Run Original Method
  1148.   end
  1149. end
  1150.  
  1151. #===============================================================================
  1152. #
  1153. # END OF SCRIPT
  1154. #
  1155. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement