Vendily

Juice Shoppe

Aug 16th, 2020
1,393
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. JUICESHOPPE_BERRYDATA={
  2.   :CHERIBERRY   => [0,0],
  3.   :LEPPABERRY   => [0,0],
  4.   :RAZZBERRY    => [0,0],
  5.   :SPELONBERRY  => [0,0],
  6.   :CHESTOBERRY  => [1,0],
  7.   :BLUKBERRY    => [1,0],
  8.   :CORNNBERRY   => [1,0],
  9.   :PAMTREBERRY  => [1,0],
  10.   :BELUEBERRY   => [1,0],
  11.   :PECHABERRY   => [2,0],
  12.   :PERSIMBERRY  => [2,0],
  13.   :NANABBERRY   => [2,0],
  14.   :MAGOSTBERRY  => [2,0],
  15.   :WATMELBERRY  => [2,0],
  16.   :RAWSTBERRY   => [3,0],
  17.   :WEPEARBERRY  => [3,0],
  18.   :RABUTABERRY  => [3,0],
  19.   :DURINBERRY   => [3,0],
  20.   :ASPEARBERRY  => [4,0],
  21.   :PINAPBERRY   => [4,0],
  22.   :NOMELBERRY   => [4,0],
  23.   :ORANBERRY    => [5,0],
  24.  
  25.   :OCCABERRY    => [0,1],
  26.   :CHOPLEBERRY  => [0,1],
  27.   :HABANBERRY   => [0,1],
  28.   :PAYAPABERRY  => [1,1],
  29.   :KASIBBERRY   => [1,1],
  30.   :COLBURBERRY  => [1,1],
  31.   :MAGOBERRY    => [2,1],
  32.   :LUMBERRY     => [3,1],
  33.   :RINDOBERRY   => [3,1],
  34.   :KEBIABERRY   => [3,1],
  35.   :TANGABERRY   => [3,1],
  36.   :BABIRIBERRY  => [3,1],
  37.   :SITRUSBERRY  => [4,1],
  38.   :WACANBERRY   => [4,1],
  39.   :SHUCABERRY   => [4,1],
  40.   :CHARTIBERRY  => [4,1],
  41.   :CHILANBERRY  => [4,1],
  42.   :PASSHOBERRY  => [5,1],
  43.   :YACHEBERRY   => [5,1],
  44.   :COBABERRY    => [5,1],
  45.  
  46.   :FIGYBERRY    => [0,2],
  47.   :POMEGBERRY   => [0,2],
  48.   :TAMATOBERRY  => [0,2],
  49.   :LIECHIBERRY  => [0,2],
  50.   :LANSATBERRY  => [0,2],
  51.   :CUSTAPBERRY  => [0,2],
  52.   :WIKIBERRY    => [1,2],
  53.   :GANLONBERRY  => [1,2],
  54.   :ENIGMABERRY  => [1,2],
  55.   :PETAYABERRY  => [2,2],
  56.   :ROSELIBERRY  => [2,2],
  57.   :AGUAVBERRY   => [3,2],
  58.   :HONDEWBERRY  => [3,2],
  59.   :SALACBERRY   => [3,2],
  60.   :STARFBERRY   => [3,2],
  61.   :MICLEBERRY   => [3,2],
  62.   :IAPAPABERRY  => [4,2],
  63.   :QUALOTBERRY  => [4,2],
  64.   :GREPABERRY   => [4,2],
  65.   :JABOCABERRY  => [4,2],
  66.   :KEEBERRY     => [4,2],
  67.   :KELPSYBERRY  => [5,2],
  68.   :APICOTBERRY  => [5,2],
  69.   :ROWAPBERRY   => [5,2],
  70.   :MARANGABERRY => [5,2],
  71. }
  72. JUICESHOPPE_COLORBLEND_STRENGTHS=[
  73.   [12,16,24],
  74.   [16,24,32],
  75.   [24,32,32]
  76. ]
  77. JUICESHOPPE_EVBLEND_STRENGTHS=[
  78.   [ 8,12,16],
  79.   [12,16,32],
  80.   [16,32,32],
  81.   [ 4, 8,12]
  82. ]
  83. def pbJuiceShoppe(event,move_route1=nil,move_route2=nil)
  84.   Kernel.pbMessage(_INTL("Hiya! Welcome to the counter\nfor fresh Berry juice!\\1"))
  85.   if Kernel.pbConfirmMessage(_INTL("Shall I make a juice using your Berries?"))
  86.     Kernel.pbMessage(_INTL("All right! Please chose Berries to blend.\\1"))
  87.     berry1=0
  88.     pbFadeOutIn(99999){
  89.       scene = PokemonBag_Scene.new
  90.       screen = PokemonBagScreen.new(scene,$PokemonBag)
  91.       berry1 = screen.pbChooseItemScreen(Proc.new{|item| pbIsBerry?(item) })
  92.     }
  93.     if berry1>0
  94.       $PokemonBag.pbDeleteItem(berry1)
  95.       berry1name=PBItems.getName(berry1)
  96.       if ['a','e','i','o','u'].include?(berry1name[0,1].downcase)
  97.         Kernel.pbMessage(_INTL("Hmmm. An {1}.\nA great choice!\\1",berry1name))
  98.       else
  99.         Kernel.pbMessage(_INTL("Hmmm. A {1}.\nA great choice!\\1",berry1name))
  100.       end
  101.       Kernel.pbMessage(_INTL("Now, please chose another Berry to blend!\\1"))
  102.       berry2=0
  103.       pbFadeOutIn(99999){
  104.         scene = PokemonBag_Scene.new
  105.         screen = PokemonBagScreen.new(scene,$PokemonBag)
  106.         berry2 = screen.pbChooseItemScreen(Proc.new{|item| pbIsBerry?(item) })
  107.       }
  108.       if berry2>0
  109.         $PokemonBag.pbDeleteItem(berry2)
  110.         berry2name=PBItems.getName(berry2)
  111.         if ['a','e','i','o','u'].include?(berry2name[0,1].downcase)
  112.           Kernel.pbMessage(_INTL("Hmmm. An {1}.\nIt's another great choice!\\1",berry2name))
  113.         else
  114.           Kernel.pbMessage(_INTL("Hmmm. A {1}.\nIt's another great choice!\\1",berry2name))
  115.         end
  116.         move_route=(move_route1)? move_route1 : [PBMoveRoute::TurnAwayFromPlayer]
  117.         pbMoveRoute(event,move_route)
  118.         Kernel.pbMessage(_INTL("Mixing, blending...\\1"))
  119.         Kernel.pbMessage(_INTL("Blending, mixing...\\1"))
  120.         move_route=(move_route2)? move_route2 : [PBMoveRoute::TurnTowardPlayer]
  121.         pbMoveRoute(event,move_route)
  122.         b1data=JUICESHOPPE_BERRYDATA[getConstantName(PBItems,berry1).to_sym]
  123.         b2data=JUICESHOPPE_BERRYDATA[getConstantName(PBItems,berry2).to_sym]
  124.         drink_type=-1
  125.         drink_strength=0
  126.         drink_name=""
  127.         if [berry1,berry2].include?(getID(PBItems,:LANSATBERRY)) &&
  128.            [berry1,berry2].include?(getID(PBItems,:STARFBERRY))
  129.            drink_type=7
  130.            drink_strength=3
  131.            drink_name=_INTL("Rare Soda")
  132.         elsif [berry1,berry2].include?(getID(PBItems,:ENIGMABERRY)) &&
  133.               [berry1,berry2].include?(getID(PBItems,:ROSELIBERRY))
  134.            drink_type=7
  135.            drink_strength=5
  136.            drink_name=_INTL("Ultra Rare Soda")
  137.         elsif [berry1,berry2].include?(getID(PBItems,:KEEBERRY)) &&
  138.               [berry1,berry2].include?(getID(PBItems,:MARANGABERRY))
  139.           drink_type=8
  140.           drink_name=_INTL("Perilous Soup")
  141.         elsif b1data[0] != b2data[0]
  142.           drink_type=0
  143.           drink_strength=JUICESHOPPE_COLORBLEND_STRENGTHS[b1data[1]][b2data[1]]
  144.           drink_name=_INTL("Colorful Shake")
  145.         else
  146.           drink_type=b1data[0]+1
  147.           drink_name=[_INTL("Red Shake"),_INTL("Purple Shake"),_INTL("Pink Shake"),
  148.                       _INTL("Green Shake"),_INTL("Yellow Shake"),_INTL("Blue Shake")][drink_type-1]
  149.           if berry1 == berry2
  150.             drink_strength=JUICESHOPPE_EVBLEND_STRENGTHS[3][b1data[1]]
  151.           else
  152.             drink_strength=JUICESHOPPE_EVBLEND_STRENGTHS[b1data[1]][b2data[1]]
  153.           end
  154.         end
  155.         Kernel.pbMessage(_INTL("Ta-da!\nHere's a fresh {1}!\\1",drink_name))
  156.         Kernel.pbMessage(_INTL("Which Pokémon will you give this to?\\1"))
  157.         chosen = -1
  158.         loop do
  159.           break if chosen>=0
  160.           pbFadeOutIn(99999){
  161.             scene = PokemonParty_Scene.new
  162.             screen = PokemonPartyScreen.new(scene,$Trainer.party)
  163.             chosen=screen.pbChooseAblePokemon(proc {|poke|!poke.egg?})
  164.           }
  165.           if chosen<0
  166.              if Kernel.pbConfirmMessage(_INTL("Huh?\nAre you sure you want to cancel?"))
  167.                Kernel.pbMessage(_INTL("See you next time then!"))
  168.                break
  169.              end
  170.           end
  171.         end
  172.         return if chosen<0
  173.         mon=$Trainer.party[chosen]
  174.         Kernel.pbMessage(_INTL("{1} drank\nthe {2}!\\1",mon.name,drink_name))
  175.         case drink_type
  176.         when 0
  177.           gain=drink_strength
  178.           if isConst?(mon.item,PBItems,:SOOTHEBELL) && gain>0
  179.             gain=(gain*1.5).floor
  180.           end
  181.           mon.happiness+=gain
  182.           mon.happiness=[[255,mon.happiness].min,0].max
  183.           Kernel.pbMessage(_INTL("{1} became friendlier!\\1",mon.name))
  184.         when 1,2,3,4,5,6
  185.           stat=[PBStats::ATTACK,PBStats::HP,PBStats::SPEED,
  186.                 PBStats::SPDEF,PBStats::DEFENSE,PBStats::SPATK][drink_type]
  187.           gain=pbJustRaiseEffortValues(mon,stat,drink_strength)
  188.           if gain==0
  189.             Kernel.pbMessage(_INTL("But it had no effect...\\1"))
  190.           else
  191.             Kernel.pbMessage(_INTL("{1}'s base {2} increased!\\1",mon.name,PBStats.getName(stat)))
  192.             gain=4
  193.             if isConst?(mon.item,PBItems,:SOOTHEBELL) && gain>0
  194.               gain=(gain*1.5).floor
  195.             end
  196.             mon.happiness+=gain
  197.             mon.happiness=[[255,mon.happiness].min,0].max
  198.           end
  199.         when 7
  200.           pbJustChangeLevel(mon,mon.level+drink_strength,nil,true)
  201.         when 8
  202.           for i in 0..5
  203.             mon.ev[i]=0
  204.           end
  205.           mon.calcStats
  206.           Kernel.pbMessage(_INTL("{1}'s base stats became zero!\\1",mon.name))
  207.         end
  208.         Kernel.pbMessage(_INTL("Did your Pokémon like it?\nPlease come back again!"))
  209.       else
  210.         $PokemonBag.pbStoreItem(berry1)
  211.         Kernel.pbMessage(_INTL("Please come back again!"))
  212.       end
  213.     else
  214.       Kernel.pbMessage(_INTL("Please come back again!"))
  215.     end
  216.   else
  217.     Kernel.pbMessage(_INTL("Please come back again!"))
  218.   end
  219. end
  220.  
  221. def pbJustChangeLevel(pokemon,newlevel,scene=nil,msgcont=false)
  222.   newlevel=1 if newlevel<1
  223.   newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
  224.   if pokemon.level>newlevel
  225.     attackdiff=pokemon.attack
  226.     defensediff=pokemon.defense
  227.     speeddiff=pokemon.speed
  228.     spatkdiff=pokemon.spatk
  229.     spdefdiff=pokemon.spdef
  230.     totalhpdiff=pokemon.totalhp
  231.     pokemon.level=newlevel
  232.     pokemon.calcStats
  233.     scene.pbRefresh if scene
  234.     if msgcont
  235.       Kernel.pbMessage(_INTL("{1} was downgraded to Level {2}!\\1",pokemon.name,pokemon.level))
  236.     else
  237.       Kernel.pbMessage(_INTL("{1} was downgraded to Level {2}!",pokemon.name,pokemon.level))
  238.     end
  239.     attackdiff=pokemon.attack-attackdiff
  240.     defensediff=pokemon.defense-defensediff
  241.     speeddiff=pokemon.speed-speeddiff
  242.     spatkdiff=pokemon.spatk-spatkdiff
  243.     spdefdiff=pokemon.spdef-spdefdiff
  244.     totalhpdiff=pokemon.totalhp-totalhpdiff
  245.     pbTopRightWindow(_INTL("Max. HP<r>{1}\r\nAttack<r>{2}\r\nDefense<r>{3}\r\nSp. Atk<r>{4}\r\nSp. Def<r>{5}\r\nSpeed<r>{6}",
  246.        totalhpdiff,attackdiff,defensediff,spatkdiff,spdefdiff,speeddiff))
  247.     pbTopRightWindow(_INTL("Max. HP<r>{1}\r\nAttack<r>{2}\r\nDefense<r>{3}\r\nSp. Atk<r>{4}\r\nSp. Def<r>{5}\r\nSpeed<r>{6}",
  248.        pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
  249.   elsif pokemon.level==newlevel
  250.     if msgcont
  251.       Kernel.pbMessage(_INTL("{1}'s level remained unchanged.{2}\\1",pokemon.name,(msgcont ? "\\1":"")))
  252.     else
  253.       Kernel.pbMessage(_INTL("{1}'s level remained unchanged.{2}",pokemon.name,(msgcont ? "\\1":"")))
  254.     end
  255.   else
  256.     attackdiff=pokemon.attack
  257.     defensediff=pokemon.defense
  258.     speeddiff=pokemon.speed
  259.     spatkdiff=pokemon.spatk
  260.     spdefdiff=pokemon.spdef
  261.     totalhpdiff=pokemon.totalhp
  262.     oldlevel=pokemon.level
  263.     pokemon.level=newlevel
  264.     pokemon.changeHappiness("levelup")
  265.     pokemon.calcStats
  266.     scene.pbRefresh if scene
  267.     if msgcont
  268.       Kernel.pbMessage(_INTL("{1} was elevated to Level {2}!\\1",pokemon.name,pokemon.level))
  269.     else
  270.       Kernel.pbMessage(_INTL("{1} was elevated to Level {2}!",pokemon.name,pokemon.level))
  271.     end
  272.     attackdiff=pokemon.attack-attackdiff
  273.     defensediff=pokemon.defense-defensediff
  274.     speeddiff=pokemon.speed-speeddiff
  275.     spatkdiff=pokemon.spatk-spatkdiff
  276.     spdefdiff=pokemon.spdef-spdefdiff
  277.     totalhpdiff=pokemon.totalhp-totalhpdiff
  278.     pbTopRightWindow(_INTL("Max. HP<r>+{1}\r\nAttack<r>+{2}\r\nDefense<r>+{3}\r\nSp. Atk<r>+{4}\r\nSp. Def<r>+{5}\r\nSpeed<r>+{6}",
  279.        totalhpdiff,attackdiff,defensediff,spatkdiff,spdefdiff,speeddiff))
  280.     pbTopRightWindow(_INTL("Max. HP<r>{1}\r\nAttack<r>{2}\r\nDefense<r>{3}\r\nSp. Atk<r>{4}\r\nSp. Def<r>{5}\r\nSpeed<r>{6}",
  281.        pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
  282.   end
  283. end
RAW Paste Data