Advertisement
bo4p5687

Untitled

Nov 23rd, 2020
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.24 KB | None | 0 0
  1. # Credit: bo4p5687
  2. #---------------------------------------------------------------------------------------------------
  3. In module PBEvolution
  4.  
  5. below
  6. TradeSpecies      = 59
  7. add
  8. SweetItem       = 60
  9.  
  10. def self.maxValue; return 60; end # change max value, here, 60
  11.  
  12. #---------------------------------------------------------------------------------------------------
  13. # Put these lines above Main
  14. # Create item
  15. def pbIsSweet?(item)
  16.   ret = pbGetItemData(item,ITEM_TYPE)
  17.   return ret && ret==13
  18. end
  19.  
  20. # Create new method
  21. class PokemonGlobalMetadata
  22.   attr_accessor :milceryevolve
  23.  
  24.   alias old_ini initialize
  25.   def initialize
  26.     @milceryevolve = false
  27.     old_ini
  28.   end
  29.  
  30. end
  31.  
  32. # Create evolution method
  33. PBEvolution.register(:SweetItem, {
  34.   "sweetItem" => proc { |pkmn, parameter|
  35.      next $PokemonGlobal.milceryevolve
  36.   }
  37. })
  38.  
  39. # Spin
  40. class Scene_Map
  41.   alias old_update_micery update
  42.   def update
  43.     old_update_micery
  44.     spinEvolve if !$game_player.moving?
  45.   end
  46. end
  47.  
  48. def spinEvolve
  49.   exit = false
  50.   # animation >= 15 (5 seconds)
  51.   # animation >= 30 (10 seconds)
  52.   anywise = false
  53.   clockwise = false
  54.   counterclockwise = false
  55.   animation = 0
  56.   if !pbMapInterpreterRunning?
  57.     if Input.press?(Input::L)
  58.       anywise = true
  59.       clockwise = true
  60.       loop do
  61.         Graphics.update
  62.         Input.update
  63.         pbUpdateSceneMap
  64.         break if exit
  65.         exit = true if Input.press?(Input::B)
  66.         animation += 1
  67.         # Spin
  68.         4.times do
  69.           exit = true if Input.press?(Input::B)
  70.           $game_player.turn_left_90
  71.           pbWait(3)
  72.         end
  73.       end
  74.       pbWait(2)
  75.       setFormMilcery(anywise,clockwise,counterclockwise,animation)
  76.       anywise = false; clockwise = false; counterclockwise = false
  77.     elsif Input.press?(Input::R)
  78.       anywise = true
  79.       counterclockwise = true
  80.       loop do
  81.         Graphics.update
  82.         Input.update
  83.         pbUpdateSceneMap
  84.         break if exit
  85.         exit = true if Input.press?(Input::B)
  86.         animation += 1
  87.         # Spin
  88.         4.times do
  89.           exit = true if Input.press?(Input::B)
  90.           $game_player.turn_right_90
  91.           pbWait(3)
  92.         end
  93.       end
  94.       pbWait(2)
  95.       setFormMilcery(anywise,clockwise,counterclockwise,animation)
  96.       anywise = false; clockwise = false; counterclockwise = false
  97.     end
  98.   end
  99. end
  100.  
  101. # Set new time
  102. module PBDayNight
  103.   def self.isSpecialTime?(time=nil)
  104.     time = pbGetTimeNow if !time
  105.     return (time.hour>=19 && time.hour<20)
  106.   end
  107. end
  108.  
  109. # Set form
  110. def setFormMilcery(anywise,clockwise,counterclockwise,number)
  111.   $Trainer.party.each do |pkmn|
  112.     evolution = nil
  113.     # Set form
  114.     if pkmn.species==PBSpecies::MILCERY && pbIsSweet?(pkmn.item)
  115.       $PokemonGlobal.milceryevolve = true
  116.       itemSweet = [PBItems::STRAWBERRYSWEET,
  117.       PBItems::BERRYSWEET,
  118.       PBItems::LOVESWEET,
  119.       PBItems::STARSWEET,
  120.       PBItems::CLOVERSWEET,
  121.       PBItems::FLOWERSWEET,
  122.       PBItems::RIBBONSWEET
  123.       ]
  124.       # Spin type (set form)
  125.       if clockwise
  126.         if number <= 15 # 5 seconds
  127.           # Vanilla Cream
  128.           if PBDayNight.isDay?
  129.             (0...itemSweet.size).each{|i|
  130.             evolution = i if pkmn.item == itemSweet[i] }
  131.           # Matcha Cream
  132.           elsif PBDayNight.isNight?
  133.             (0...itemSweet.size).each{|i|
  134.             evolution = 14 + i if pkmn.item == itemSweet[i] }
  135.           end
  136.         else
  137.           # Caramel Swirl
  138.           if PBDayNight.isDay?
  139.             (0...itemSweet.size).each{|i|
  140.             evolution = 49 + i if pkmn.item == itemSweet[i] }
  141.           # Lemon Cream
  142.           elsif PBDayNight.isNight?
  143.             (0...itemSweet.size).each{|i|
  144.             evolution = 28 + i if pkmn.item == itemSweet[i] }
  145.           end
  146.         end
  147.       elsif counterclockwise
  148.         if number <= 15 # 5 seconds
  149.           # Ruby Cream
  150.           if PBDayNight.isDay?
  151.             (0...itemSweet.size).each{|i|
  152.             evolution = 7 + i if pkmn.item == itemSweet[i] }
  153.           # Salted Cream
  154.           elsif PBDayNight.isNight?
  155.             (0...itemSweet.size).each{|i|
  156.             evolution = 35 + i if pkmn.item == itemSweet[i] }
  157.           end
  158.         else
  159.           # Ruby Swirl
  160.           if PBDayNight.isDay?
  161.             (0...itemSweet.size).each{|i|
  162.             evolution = 42 + i if pkmn.item == itemSweet[i] }
  163.           # Mint Cream
  164.           elsif PBDayNight.isNight?
  165.             (0...itemSweet.size).each{|i|
  166.             evolution = 21 + i if pkmn.item == itemSweet[i] }
  167.           end
  168.         end
  169.       end
  170.       if anywise
  171.         # Rainbow Swirl
  172.         if PBDayNight.isSpecialTime? && number > 30 # 10 seconds
  173.           (0...itemSweet.size).each{|i|
  174.           evolution = 56 + i if pkmn.item == itemSweet[i] }
  175.         end
  176.       end
  177.     end
  178.     ret = pbCheckEvolutionEx(pkmn) { |pkmn, method, parameter, new_species|
  179.     success = PBEvolution.call("sweetItem", method, pkmn, parameter)
  180.     next (success) ? new_species : -1 }
  181.     if ret>0
  182.       pbFadeOutInWithMusic {
  183.       pkmn.form = evolution
  184.       evo = PokemonEvolutionScene.new
  185.       evo.pbStartScreen(pkmn,ret)
  186.       evo.pbEvolution(true)
  187.       evo.pbEndScreen }
  188.       $PokemonGlobal.milceryevolve = false
  189.     end
  190.   end
  191. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement