Vlue

Weapon/Armor Randomization

Jun 29th, 2013
5,291
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Weapon/Armor Randomization v1.7
  2. #----------#
  3. #Features: Allow the stats of an item to be randomized, yay! Also can tack
  4. #           on random prefixes and suffixes. Oooh, fancy.
  5. #
  6. #Usage:    Basic Usage:
  7. #
  8. #           Note tags for weapons and armors:
  9. #
  10. #            <HP amount>  <HP% amount>  <ATK amount>  <ATK% amount>
  11. #            <MP amount>  <MP% amount>  <DEF amount>  <DEF% amount>
  12. #          <MAT amount>  <MAT% amount>  <MDF amount>  <MDF% amount>
  13. #          <AGI amount>  <AGI% amount>  <LUK amount>  <LUK% amount>
  14. #          <PRICE amount> <PRICE% amount>
  15. #
  16. #           Where amount is the amount to be randomly added on, with % being
  17. #             a percentage instead of specific.
  18. #           Examples: <HP 500>  or  <HP% 10>
  19. #
  20. #           Script calls:
  21. #            add_armor(base_id, amount)
  22. #            add_weapon(base_id, amount)
  23. #          
  24. #           These script calls create a new version of the item of the base_id
  25. #            number, with randomized stats as set in their note.
  26. #
  27. #          Advanced Usage:
  28. #          
  29. #           Note tags for weapons and armors:
  30. #
  31. #            <SUFFIX# rarity>    <PREFIX# rarity>
  32. #
  33. #           Where # is the id number of the affix and rarity is the chance of it
  34. #            occuring with 100 always occuring and 1 almost never occuring.
  35. #            Multiple affix notes can be added and the first one that passes it's
  36. #            rarity chance will be added.
  37. #           Examples: <PREFIX1 50>  or  <SUFFIX2 90>
  38. #
  39. #          The Complicated Part: (Affixes)
  40. #           See that AFFIXES hash down there? That's where you set these up.
  41. #           Basic setup is:
  42. #             ID => { :symbol => data, },
  43. #           You can have as many different symbols in there as you want, each
  44. #            seperated by a comma, and don't forget the comma between each AFFIX
  45. #            id.
  46. #
  47. #           Usable Symbols:
  48. #          :name = "name"               :color = Color.new(r,g,b)
  49. #          :rarity = value              #Arbitrary value
  50. #          :animation = id      
  51. #          :icon = id
  52. #          :desc = "description"
  53. #           #Pdesc and Sdesc are added on to the current item description
  54. #          :pdesc = "prefix description"
  55. #          :sdesc = "suffix description"
  56. #
  57. #   :hp,   :mp,   :atk,   :def,   :mat,   :mdf,   :agi,   :luk    (random bonus)
  58. #   :Shp,  :Smp,  :Satk,  :Sdef,  :Smat,  :Smdf,  :Sagi,  :Sluk   (static bonus)
  59. #   :hpP,  :mpP,  :atkP,  :defP,  :matP,  :mdfP,  :agiP,  :lukP   (random % bonus)
  60. #   :ShpP, :SmpP, :SatkP, :SdefP, :SmatP, :SmdfP, :SagiP, :SlukP  (static % bonus)
  61. #
  62. #   :price, :Sprice, :priceP, :SpriceP
  63. #
  64. #       each of these goes :symbol = value
  65. #
  66. #          The fun part, :features
  67. #           You can have as many features as you want, set up in an array:
  68. #           :features = [[code, id, value],[code, id, value]] etc...
  69. #          But what are the codes, ids, and values?? Don't worry, I found out:
  70. #
  71. #           Element Rate   = 11, element_id, float value
  72. #           Debuff Rate    = 12, param_id, float value
  73. #           State Rate     = 13, state_id, float value
  74. #           State Resist   = 14, state_id, 0
  75. #
  76. #           Parameter      = 21, param_id, float value
  77. #           Ex-Parameter   = 22, exparam_id, float value
  78. #           Sp-Parameter   = 23, spparam_id, float value
  79. #
  80. #           Atk Element    = 31, element_id, 0
  81. #           Atk State      = 32, state_id, float value
  82. #           Atk Speed      = 33, 0, value
  83. #           Atk Times+     = 34, 0, value
  84. #
  85. #           Add Skill Type = 41, skill_type, 0
  86. #          Seal Skill Type = 42, skill_type, 0
  87. #           Add Skill      = 43, skill_id, 0
  88. #           Seal Skill     = 44, skill_id, 0
  89. #
  90. #           Equip Weapon   = 51, weapon_skill, 0
  91. #           Equip Armor    = 52, armor_skill, 0
  92. #           Fix Equip      = 53, item_type, 0
  93. #           Seal Equip     = 54, item_type, 0
  94. #           Slot Type      = 55, 1, 0
  95. #
  96. #           Action Times+  = 61, 0, value
  97. #           Special Flag   = 62, flag_id, 0
  98. #          Collapse Effect = 62, flag_id, 0
  99. #           Party Ability  = 63, flag_id, 0
  100. #
  101. #     float value = percentage value where 1 = 100%, 0.75 = 75%, and 1.25 = 125%
  102. #     param_id, 0=hp, 1=mp, 2=atk, 3=def, 4=mat, 5=mdf, 6=agi, 7=luk
  103. #
  104. #     Examples: [21, 2, 1.5] which would increase atk to 150%
  105. #               [62, 0, 0]   which makes the item give the auto-battle flag
  106. #               [32, 1, 0.5] which gives a 50% of applying death state
  107. #
  108. #----------#
  109. #-- Script by: Vlue of Daimonious Tails
  110. #
  111. #- Questions or comments can be:
  112. #    given by email: sumptuaryspade@live.ca
  113. #    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
  114. #   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
  115. #
  116. #--- Free to use in any project, commercial or non-commercial, with credit given
  117. # - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
  118.  
  119. $imported = {} if $imported.nil?
  120. $imported[:Vlue_WARandom] = true
  121.  
  122. #If true, then weapons and armors dropped by enemies will be randomized
  123. RANDOM_ENEMY_DROPS = true
  124. #Pool Rarity (Instead of a first come first serve, each affix is given a chance)
  125. POOL_RARITY = false
  126. #If true, weapons and armors bought from shops will be randomized
  127. WA_SHOP_RANDOM = false
  128. #When shop items are specifically set to this price, they are randomized
  129. SHOP_SPECIFIC_RANDOM = 998
  130. #True if you are using Sleek Item Popup, and want those to popup!
  131. USE_ITEM_POPUP = false
  132. #Stack random weapons and armor, when false all equips are unique
  133. STACK_SAME_EQUIP = false
  134.  
  135. AFFIXES = {
  136.             #COLORS
  137.             1 => { :color => Color.new(50,255,0),
  138.             :ShpP => 10, :SmpP => 10, :SatkP => 10, :SdefP => 10,
  139.             :SmatP => 10, :SmdfP => 10, :SagiP => 10, :SlukP => 10}, #UNCOMMON
  140.             2 => { :color => Color.new(50,100,235),
  141.             :ShpP => 20, :SmpP => 20, :SatkP => 20, :SdefP => 20,
  142.             :SmatP => 20, :SmdfP => 20, :SagiP => 20, :SlukP => 20}, #RARE
  143.             3 => { :color => Color.new(255,25,255),
  144.             :ShpP => 35, :SmpP => 35, :SatkP => 35, :SdefP => 35,
  145.             :SmatP => 35, :SmdfP => 35, :SagiP => 35, :SlukP => 35}, #EPIC
  146.             4 => { :name => "Legendary ", :color => Color.new(255,175,75),
  147.             :ShpP => 50, :SmpP => 50, :SatkP => 50, :SdefP => 50,
  148.             :SmatP => 50, :SmdfP => 50, :SagiP => 50, :SlukP => 50}, #LEGENDARY
  149.            
  150.             #Shared Suffixes
  151.             10 => { :name => "Powerful ", :Shp => 1,
  152.                     :features => [[21,0,1.25]] },
  153.             11 => { :name => "Fiery ", :Smp => 1,
  154.                     :features => [[21,1,1.25]] },
  155.             12 => { :name => " of Strength", :Satk => 1,
  156.                     :features => [[21,2,1.25]] },
  157.             13 => { :name => " of Defense", :Sdef => 1,
  158.                     :features => [[21,3,1.25]] },
  159.             14 => { :name => " of Intelligence", :Smat => 1,
  160.                     :features => [[21,4,1.25]] },
  161.             15 => { :name => " of Piety", :Smdf => 1,
  162.                     :features => [[21,5,1.25]] },
  163.             16 => { :name => " of Speed", :Sagi => 1,
  164.                     :features => [[21,6,1.25]] },
  165.             17 => { :name => " of Luck", :Sluk => 1,
  166.                     :features => [[21,7,1.25]] },
  167.             18 => { :name => " of the Soul", :Shp => 1, :Smp => 1,
  168.                     :features => [[21,0,1.20],[21,1,1.20]] },
  169.             19 => { :name => " of the Strong", :Satk => 1, :Sdef => 1,
  170.                     :features => [[21,2,1.20],[21,3,1.20]] },
  171.             20 => { :name => " of the Smart", :Smat => 1, :Smdf => 1,
  172.                     :features => [[21,4,1.20],[21,5,1.20]] },
  173.             21 => { :name => " of the Favoured", :Sagi => 1, :Sluk => 1,
  174.                     :features => [[21,6,1.20],[21,7,1.20]] },
  175.             22 => { :name => " of the Lord", :Satk => 1, :Sdef => 1, :Sagi => 1,
  176.                     :features => [[21,2,1.15],[21,3,1.15],[21,6,1.15]] },
  177.             23 => { :name => " of the Noble", :Smat => 1, :Smdf => 1, :Sluk => 1,
  178.                     :features => [[21,4,1.15],[21,5,1.15],[21,7,1.15]] },
  179.             24 => { :name => " of Legend",
  180.                     :Smat => 1, :Smdf => 1, :Sluk => 1,
  181.                     :Smat => 1, :Smdf => 1, :Sluk => 1,
  182.                     :features => [[21,4,1.15],[21,5,1.15],[21,7,1.15],
  183.                                   [21,2,1.15],[21,3,1.15],[21,6,1.15]], },  
  184.                                  
  185.             #Weapon Suffixes
  186.             50 => { :name => "of Venom", :feature => [[32,2,0.25]] },
  187.             51 => { :name => "of Darkness", :feature => [[32,3,0.25]] },
  188.             52 => { :name => "of Silence", :feature => [[32,4,0.25]] },
  189.             53 => { :name => "of Doom", :feature => [[32,1,0.05]] },
  190.            
  191.             60 => { :name => "of Flame", :SatkP => 10, :SmatP => 10,
  192.                     :feature => [[31,4,0]] },
  193.             61 => { :name => "of Ice", :SatkP => 10, :SmatP => 10,
  194.                     :feature => [[31,5,0]] },
  195.             62 => { :name => "of Earth", :SatkP => 10, :SmatP => 10,
  196.                     :feature => [[31,5,0]] },
  197.             63 => { :name => "of Wind", :SatkP => 10, :SmatP => 10,
  198.                     :feature => [[31,5,0]] },
  199.             64 => { :name => "of Light", :SatkP => 10, :SmatP => 10,
  200.                     :feature => [[31,5,0]] },
  201.             65 => { :name => "of the Void", :SatkP => 10, :SmatP => 10,
  202.                     :feature => [[31,5,0]] },
  203.                    
  204.             70 => { :name => "of Quickness", :feature => [[34,0,1]] },
  205.                    
  206.             }
  207.  
  208. class Game_Interpreter
  209.   def add_weapon(id, am)
  210.     item = $game_party.add_weapon(id,am)
  211.     popup(1,item.id,am) if USE_ITEM_POPUP
  212.     item
  213.   end
  214.   def add_armor(id, am)
  215.     item = $game_party.add_armor(id, am)
  216.     popup(2,item.id,am) if USE_ITEM_POPUP
  217.     item
  218.   end
  219.   def add_item(id, am)
  220.     item = $game_party.add_item(id, am)
  221.     popup(0,item.id,am) if USE_ITEM_POPUP
  222.     item
  223.   end
  224.   def edit_affixes(item, subnote = nil)
  225.     $game_party.edit_affixes(item, subnote)
  226.   end
  227. end
  228.  
  229. class Game_Party
  230.   alias rig_initialize initialize
  231.   def initialize
  232.     rig_initialize
  233.     @saved_weapons = $data_weapons
  234.     @saved_armors = $data_armors
  235.   end
  236.   attr_accessor :saved_weapons
  237.   attr_accessor :saved_armors
  238.   def add_weapon(id, amount, false_add = false)
  239.     item = Marshal.load(Marshal.dump($data_weapons[id]))
  240.     edit_item(item)
  241.     edit_affixes(item)
  242.     if STACK_SAME_EQUIP
  243.       $data_weapons.each do |base_item|
  244.         next if base_item.nil?
  245.         if ( item.params == base_item.params &&
  246.             item.price == base_item.price &&
  247.             item.name == base_item.name &&
  248.             item.color == base_item.color)
  249.           $game_party.gain_item(base_item, amount) unless false_add
  250.           return base_item
  251.         end
  252.       end
  253.     end
  254.     item.note = $data_weapons[item.id].note
  255.     item.set_original(item.id)
  256.     item.id = $data_weapons.size
  257.     $data_weapons.push(item)
  258.     $game_party.gain_item(item, amount) unless false_add
  259.     return item
  260.   end
  261.   def add_armor(id, amount, false_add = false)
  262.     item = Marshal.load(Marshal.dump($data_armors[id]))
  263.     edit_item(item)
  264.     edit_affixes(item)
  265.     if STACK_SAME_EQUIP
  266.       $data_armors.each do |base_item|
  267.         next if base_item.nil?
  268.         if ( item.params == base_item.params &&
  269.             item.price == base_item.price &&
  270.             item.name == base_item.name &&
  271.             item.color == base_item.color)
  272.           $game_party.gain_item(base_item, amount) unless false_add
  273.           return base_item
  274.         end
  275.       end
  276.     end
  277.     item.note = $data_armors[item.id].note
  278.     item.set_original(item.id)
  279.     item.id = $data_armors.size
  280.     $data_armors.push(item)
  281.     $game_party.gain_item(item, amount) unless false_add
  282.     return item
  283.   end
  284.   def add_item(id, amount, false_add = false)
  285.     item = Marshal.load(Marshal.dump($data_items[id]))
  286.     edit_item(item)
  287.     edit_affixes(item)
  288.     $data_items.each do |base_item|
  289.       next if base_item.nil?
  290.       if (item.price == base_item.price &&
  291.           item.name == base_item.name )
  292.         $game_party.gain_item(base_item, amount) unless false_add
  293.         return base_item
  294.       end
  295.     end
  296.     item.note = $data_items[item.id].note
  297.     item.set_original(item.id)
  298.     item.id = $data_items.size
  299.     $data_items.push(item)
  300.     $game_party.gain_item(item, amount) unless false_add
  301.     return item
  302.   end
  303.   def edit_affixes(item, subnote = nil)
  304.     note = item.note.clone
  305.     note = subnote.clone if subnote
  306.     affix_pool = []
  307.     while note.include?("<SUF")
  308.       id = note =~ /<SUFFIX(\d+) (\d+)>/
  309.       if !POOL_RARITY
  310.         if !AFFIXES[$~[1].to_i].nil?
  311.           break if add_affix(item, $~[1].to_i, false) if rand(100) < $2.to_i
  312.           note[id] = "N"
  313.         else
  314.           msgbox("Affix #" + $1 + " doesn't exist. \nItem creation failed.")
  315.           return
  316.         end
  317.       else
  318.         if !AFFIXES[$~[1].to_i].nil?
  319.           $2.to_i.times do
  320.             affix_pool.push($1)
  321.           end
  322.           note[id] = "N"
  323.         else
  324.           msgbox("Affix #" + $1 + " doesn't exist. \nItem creation failed.")
  325.           return
  326.         end
  327.       end
  328.     end
  329.     if !affix_pool.empty?
  330.       add_affix(item, affix_pool[rand(affix_pool.size)], false) if POOL_RARITY
  331.     end
  332.     affix_pool = []
  333.     while note.include?("<PRE")
  334.       id = note =~ /<PREFIX(\d+) (\d+)>/
  335.       if !POOL_RARITY
  336.         if !AFFIXES[$~[1].to_i].nil?
  337.           break if add_affix(item, $~[1].to_i, true) if rand(100) < $2.to_i
  338.           note[id] = "N"
  339.         else
  340.           msgbox("Affix #" + $1 + " doesn't exist. \nItem creation failed.")
  341.           return
  342.         end
  343.       else
  344.         if !AFFIXES[$~[1].to_i].nil?
  345.           $2.to_i.times do
  346.             affix_pool.push($1)
  347.           end
  348.           note[id] = "N"
  349.         else
  350.           msgbox("Affix #" + $1 + " doesn't exist. \nItem creation failed.")
  351.           return
  352.         end
  353.       end
  354.     end
  355.     if !affix_pool.empty?
  356.       add_affix(item, affix_pool[rand(affix_pool.size)], true) if POOL_RARITY
  357.     end
  358.   end
  359.   def add_affix(item, id, prefix)
  360.     affix = AFFIXES[id.to_i]
  361.     if prefix && !affix[:name].nil?
  362.       item.name = affix[:name] + item.name
  363.     elsif !affix[:name].nil?
  364.       item.name = item.name + affix[:name]  
  365.     end
  366.     if !affix[:rarity].nil?
  367.       if item.rarity.nil? || item.rarity < affix[:rarity]
  368.         item.set_color(affix[:color]) if !affix[:color].nil?
  369.         item.rarity = affix[:rarity]
  370.       end
  371.     else
  372.       item.set_color(affix[:color]) if !affix[:color].nil?
  373.     end
  374.    
  375.     if !affix[:desc].nil?
  376.       item.description = affix[:desc]
  377.     end
  378.     if !affix[:pdesc].nil?
  379.       item.description = affix[:pdesc] + item.description
  380.     end
  381.     if !affix[:sdesc].nil?
  382.       item.description = item.description + affix[:sdesc]
  383.     end
  384.    
  385.    
  386.     if !item.is_a?(RPG::Armor) && !affix[:animation].nil?
  387.       item.animation_id = affix[:animation]
  388.     end
  389.    
  390.     item.icon_index = affix[:icon] if !affix[:icon].nil?
  391.    
  392.     if !item.is_a?(RPG::Item)
  393.       item.params[0] += rand(affix[:hp]) if !affix[:hp].nil?
  394.       item.params[1] += rand(affix[:mp]) if !affix[:mp].nil?
  395.       item.params[2] += rand(affix[:atk]) if !affix[:atk].nil?
  396.       item.params[3] += rand(affix[:def]) if !affix[:def].nil?
  397.       item.params[4] += rand(affix[:mat]) if !affix[:mat].nil?
  398.       item.params[5] += rand(affix[:mdf]) if !affix[:mdf].nil?
  399.       item.params[6] += rand(affix[:agi]) if !affix[:agi].nil?
  400.       item.params[7] += rand(affix[:luk]) if !affix[:luk].nil?
  401.     end
  402.     item.price += rand(affix[:price]) if !affix[:price].nil?
  403.    
  404.     if !item.is_a?(RPG::Item)
  405.       item.params[0] += affix[:Shp] if !affix[:Shp].nil?
  406.       item.params[1] += affix[:Smp] if !affix[:Smp].nil?
  407.       item.params[2] += affix[:Satk] if !affix[:Satk].nil?
  408.       item.params[3] += affix[:Sdef] if !affix[:Sdef].nil?
  409.       item.params[4] += affix[:Smat] if !affix[:Smat].nil?
  410.       item.params[5] += affix[:Smdf] if !affix[:Smdf].nil?
  411.       item.params[6] += affix[:Sagi] if !affix[:Sagi].nil?
  412.       item.params[7] += affix[:Sluk] if !affix[:Sluk].nil?
  413.     end
  414.     item.price += affix[:Sprice] if !affix[:Sprice].nil?
  415.    
  416.     if !item.is_a?(RPG::Item)
  417.       item.params[0] += item.params[0] * (rand(affix[:hpP])) / 100 if !affix[:hpP].nil?
  418.       item.params[1] += item.params[1] * (rand(affix[:mpP])) / 100 if !affix[:mpP].nil?
  419.       item.params[2] += item.params[2] * (rand(affix[:atkP])) / 100 if !affix[:atkP].nil?
  420.       item.params[3] += item.params[3] * (rand(affix[:defP])) / 100 if !affix[:defP].nil?
  421.       item.params[4] += item.params[4] * (rand(affix[:matP])) / 100 if !affix[:matP].nil?
  422.       item.params[5] += item.params[5] * (rand(affix[:mdfP])) / 100 if !affix[:mdfP].nil?
  423.       item.params[6] += item.params[6] * (rand(affix[:agiP])) / 100 if !affix[:agiP].nil?
  424.       item.params[7] += item.params[7] * (rand(affix[:lukP])) / 100 if !affix[:lukP].nil?
  425.     end
  426.     item.price += item.price * (rand(affix[:priceP])) / 100 if !affix[:priceP].nil?
  427.    
  428.     if !item.is_a?(RPG::Item)
  429.       item.params[0] += item.params[0] * affix[:ShpP] / 100 if !affix[:ShpP].nil?
  430.       item.params[1] += item.params[1] * affix[:SmpP] / 100 if !affix[:SmpP].nil?
  431.       item.params[2] += item.params[2] * affix[:SatkP] / 100 if !affix[:SatkP].nil?
  432.       item.params[3] += item.params[3] * affix[:SdefP] / 100 if !affix[:SdefP].nil?
  433.       item.params[4] += item.params[4] * affix[:SmatP] / 100 if !affix[:SmatP].nil?
  434.       item.params[5] += item.params[5] * affix[:SmdfP] / 100 if !affix[:SmdfP].nil?
  435.       item.params[6] += item.params[6] * affix[:SagiP] / 100 if !affix[:SagiP].nil?
  436.       item.params[7] += item.params[7] * affix[:SlukP] / 100 if !affix[:SlukP].nil?
  437.     end
  438.     item.price += item.price * affix[:SpriceP] / 100 if !affix[:SpriceP].nil?
  439.    
  440.     if !affix[:features].nil? && !item.is_a?(RPG::Item)
  441.       for feature in affix[:features]
  442.         new_feature = RPG::BaseItem::Feature.new(feature[0], feature[1], feature[2])
  443.         item.features.push(new_feature)
  444.       end
  445.     end
  446.    
  447.     return true
  448.   end
  449.   def edit_item(item)
  450.     if !item.is_a?(RPG::Item)
  451.       item.note =~ /<HP (\d+)>/
  452.       item.params[0] += rand($~[1].to_i) if $~
  453.       item.note =~ /<MP (\d+)>/
  454.       item.params[1] += rand($~[1].to_i) if $~
  455.       item.note =~ /<ATK (\d+)>/
  456.       item.params[2] += rand($~[1].to_i) if $~
  457.       item.note =~ /<DEF (\d+)>/
  458.       item.params[3] += rand($~[1].to_i) if $~
  459.       item.note =~ /<MAT (\d+)>/
  460.       item.params[4] += rand($~[1].to_i) if $~
  461.       item.note =~ /<MDF (\d+)>/
  462.       item.params[5] += rand($~[1].to_i) if $~
  463.       item.note =~ /<AGI (\d+)>/
  464.       item.params[6] += rand($~[1].to_i) if $~
  465.       item.note =~ /<LUK (\d+)>/
  466.       item.params[7] += rand($~[1].to_i) if $~
  467.       item.note =~ /<PRICE (\d+)>/
  468.     end
  469.     item.price += rand($~[1].to_i) if $~
  470.    
  471.     if !item.is_a?(RPG::Item)
  472.       item.note =~ /<HP% (\d+)>/
  473.       item.params[0] += item.params[2] * (rand($~[1].to_i)) / 100 if $~
  474.       item.note =~ /<MP% (\d+)>/
  475.       item.params[1] += item.params[2] * (rand($~[1].to_i)) / 100 if $~
  476.       item.note =~ /<ATK% (\d+)>/
  477.       item.params[2] += item.params[2] * (rand($~[1].to_i)) / 100 if $~
  478.       item.note =~ /<DEF% (\d+)>/
  479.       item.params[3] += item.params[2] * (rand($~[1].to_i)) / 100 if $~
  480.       item.note =~ /<MAT% (\d+)>/
  481.       item.params[4] += item.params[2] * (rand($~[1].to_i)) / 100 if $~
  482.       item.note =~ /<MDF% (\d+)>/
  483.       item.params[5] += item.params[2] * (rand($~[1].to_i)) / 100 if $~
  484.       item.note =~ /<AGI% (\d+)>/
  485.       item.params[6] += item.params[2] * (rand($~[1].to_i)) / 100 if $~
  486.       item.note =~ /<LUK% (\d+)>/
  487.       item.params[7] += item.params[2] * (rand($~[1].to_i)) / 100 if $~
  488.       item.note =~ /<PRICE% (\d+)>/
  489.     end
  490.     item.price += item.price * (rand($~[1].to_i)) / 100 if $~
  491.   end
  492. end
  493.  
  494. module BattleManager
  495.   def self.gain_drop_items
  496.     $game_troop.make_drop_items.each do |item|
  497.       if RANDOM_ENEMY_DROPS
  498.         if item.is_a?(RPG::Weapon)
  499.           item = $game_party.add_weapon(item.id, 1)
  500.         elsif item.is_a?(RPG::Armor)
  501.           item = $game_party.add_armor(item.id, 1)
  502.         else
  503.           $game_party.gain_item(item, 1)
  504.         end
  505.       else
  506.         $game_party.gain_item(item, 1)
  507.       end
  508.       $game_message.add(sprintf(Vocab::ObtainItem, item.name))
  509.     end
  510.     wait_for_message
  511.   end
  512. end
  513.  
  514. class Scene_Load
  515.   alias rig_on_load_success on_load_success
  516.   def on_load_success
  517.     rig_on_load_success
  518.     $data_weapons = $game_party.saved_weapons
  519.     $data_armors = $game_party.saved_armors
  520.   end
  521. end
  522.  
  523. class Window_Base
  524.   def draw_item_name(item, x, y, enabled = true, width = 172)
  525.     return unless item
  526.     draw_icon(item.icon_index, x, y, enabled)
  527.     change_color(item.color, enabled)
  528.     draw_text(x + 24, y, width, line_height, item.name)
  529.     change_color(normal_color)
  530.   end
  531. end
  532.  
  533. class RPG::BaseItem
  534.   attr_accessor  :rarity
  535.   def color
  536.     return Color.new(255,255,255) unless @color
  537.     @color
  538.   end
  539.   def set_color(color)
  540.     @color = color
  541.   end
  542.   def original_id
  543.     @original_id ? @original_id : @id
  544.   end
  545.   def set_original(new_id)
  546.     @original_id = new_id
  547.   end
  548. end
  549.  
  550. class Scene_Shop
  551.   alias wa_do_buy do_buy
  552.   alias wa_prepare prepare
  553.   def prepare(*args)
  554.     wa_prepare(*args)
  555.     iter = -1
  556.     @goods.each do |array|
  557.       iter += 1
  558.       next unless array[2] == 1 && array[3] == SHOP_SPECIFIC_RANDOM
  559.       item = $game_party.add_item(array[1],1,true) if array[0] == 0
  560.       item = $game_party.add_weapon(array[1],1,true) if array[0] == 1
  561.       item = $game_party.add_armor(array[1],1,true) if array[0] == 2
  562.       @goods[iter] = [array[0],item.id,0,0]
  563.     end
  564.   end
  565.   def do_buy(number)
  566.     if WA_SHOP_RANDOM
  567.       number.times do |i|
  568.         $game_party.lose_gold(buying_price)
  569.         $game_party.add_weapon(@item.id, 1) if @item.is_a?(RPG::Weapon)
  570.         $game_party.add_armor(@item.id, 1) if @item.is_a?(RPG::Armor)
  571.         $game_party.gain_item(@item, 1) if @item.is_a?(RPG::Item)
  572.       end
  573.     else
  574.       wa_do_buy(number)
  575.     end
  576.   end
  577. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×