Advertisement
Vendily

Copy-Cat Minigame

Aug 10th, 2019
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.23 KB | None | 0 0
  1. ################################################################################
  2. # Copy-Cat mini-game by Vendily
  3. # A modification of the default Duel minigame
  4. # Based on the Duel minigame by Alael
  5. ################################################################################
  6. class PokemonCopyCat
  7.   MOVEMENTS=[
  8.               [PBMoveRoute::Jump,0,0,
  9.               PBMoveRoute::Wait,2,
  10.               PBMoveRoute::Jump,0,0],
  11.               [PBMoveRoute::TurnRight90,PBMoveRoute::Wait,2,
  12.               PBMoveRoute::TurnRight90,PBMoveRoute::Wait,2,
  13.               PBMoveRoute::TurnRight90,PBMoveRoute::Wait,2,
  14.               PBMoveRoute::TurnRight90,PBMoveRoute::Wait,2,
  15.               PBMoveRoute::TurnRight90,PBMoveRoute::Wait,2,
  16.               PBMoveRoute::TurnRight90,PBMoveRoute::Wait,2,
  17.               PBMoveRoute::TurnRight90,PBMoveRoute::Wait,2,
  18.               PBMoveRoute::TurnRight90,PBMoveRoute::Wait,2],
  19.               [PBMoveRoute::DirectionFixOn,
  20.                PBMoveRoute::ScriptAsync,"moveLeft90",
  21.                PBMoveRoute::ScriptAsync,"moveRight90",
  22.                PBMoveRoute::ScriptAsync,"moveRight90",
  23.                PBMoveRoute::ScriptAsync,"moveLeft90",
  24.                PBMoveRoute::DirectionFixOff]
  25.             ]
  26.  
  27.   def pbStartCopyCat(pokemon,event)
  28.     @event=event
  29.   end
  30.  
  31.   def pbEndCopyCat(pokemon,rounds,correct)
  32.     exp=rounds+correct
  33.     growthrate=pokemon.growthrate
  34.     newexp=PBExperience.pbAddExperience(pokemon.exp,exp,growthrate)
  35.     exp=newexp-pokemon.exp
  36.     pokemon.changeHappiness("groom")
  37.    
  38.     Kernel.pbMessage(_INTL("{1} gained {2} Exp. Points from playing!",pokemon.name,exp))
  39.     oldlevel=pokemon.level
  40.     pokemon.exp+=exp
  41.     if pokemon.level!=oldlevel
  42.       pokemon.changeHappiness("levelup")
  43.       pokemon.calcStats
  44.       movelist=pokemon.getMoveList
  45.       for i in movelist
  46.         pbLearnMove(pokemon,i[1],true) if i[0]==pokemon.level       # Try to learn a move
  47.       end
  48.       newspecies = Kernel.pbCheckEvolution(pokemon)
  49.       if newspecies>0
  50.          pbFadeOutInWithMusic(99999){
  51.          evo=PokemonEvolutionScene.new
  52.          evo.pbStartScreen(pokemon,newspecies)
  53.          evo.pbEvolution
  54.          evo.pbEndScreen
  55.       }
  56.       end
  57.     end
  58.   end
  59.  
  60.   def pbCopyCat(pokemon,event)
  61.     pbStartCopyCat(pokemon,event)
  62.     Kernel.pbMessage(_INTL("{1} wants to play Copy-Cat!\\.\\nCopy what {1} does!",pokemon.name))
  63.     rounds=0
  64.     correct=0
  65.     loop do
  66.       rounds+=1
  67.       action=rand(3)
  68.       pbMoveRoute(event,MOVEMENTS[action],true)
  69.       pbWait(60)
  70.       list=[
  71.          _INTL("Jump"),
  72.          _INTL("Spin"),
  73.          _INTL("Wiggle"),
  74.          _INTL("Quit")
  75.       ]
  76.       command=Kernel.pbMessage(_INTL("What did {1} do?",pokemon.name),list,0)
  77.       if command==3
  78.         Kernel.pbMessage(_INTL("You stop playing Copy-Cat with {1}.",pokemon.name))
  79.         break
  80.       end
  81.       pbMoveRoute($game_player,MOVEMENTS[command],true)
  82.       if command==action
  83.         correct+=1
  84.         pbPlayCry(pokemon,90,150)
  85.       else
  86.         pbPlayCry(pokemon,90,50)
  87.       end
  88.       pbWait(60)
  89.     end
  90.     pbEndCopyCat(pokemon,rounds,correct)
  91.   end
  92. end
  93.  
  94.  
  95. def pbCopyCat(pokemon,event)
  96.   return if !pokemon
  97.   copycat=PokemonCopyCat.new
  98.   copycat.pbCopyCat(pokemon,event)
  99. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement