Advertisement
Guest User

PBContestMove

a guest
Sep 24th, 2014
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.48 KB | None | 0 0
  1. class PokemonContestTemp
  2.   attr_accessor :pokemonContestMoveData
  3.  
  4.   def pbOpenContestMoveData
  5.     if !self.pokemonContestMoveData
  6.       pbRgssOpen("Data/contestmoves.dat","rb"){|f|
  7.          self.pokemonContestMoveData=f.read
  8.       }
  9.     end
  10.     if block_given?
  11.       StringInput.open(self.pokemonContestMoveData) {|f| yield f }
  12.     else
  13.       return StringInput.open(self.pokemonContestMoveData)
  14.     end
  15.   end
  16. end
  17.  
  18.  
  19.  
  20. class PBContestMoveData
  21.  
  22. attr_reader :contestType
  23. attr_reader :hearts,:jam
  24. attr_reader :contestfunction
  25.  
  26.   def initialize(moveid)
  27.     contestmovedata=nil
  28.     if $PokemonContestTemp
  29.       contestmovedata=$PokemonContstTemp.pbOpenContestMoveData
  30.     else
  31.       contestmovedata=pbRgssOpen("Data/contestmoves.dat")
  32.     end
  33.     contestmovedata.pos=moveid*4
  34.     @contestType = contestmovedata.fgetb
  35.     @hearts      = contestmovedata.fgetb
  36.     @jam         = contestmovedata.fgetb
  37.     @contestfunction    = contestmovedata.fgetb
  38.     contestmovedata.close
  39.   end
  40. end
  41.  
  42.  
  43.  
  44. class PBContestMove
  45. attr_reader :hearts,:jam
  46. attr_reader :contestfunction,:id
  47.  
  48. # Gets this move's type.
  49.   def type
  50.     contestmovedata=PBContestMoveData.new(@id)
  51.     return contestmovedata.type
  52.   end
  53. #gets the number of hearts
  54. def hearts
  55.   contestmovedata=PBContestMoveData.new(@id)
  56.   return contestmovedata.hearts
  57. end
  58.  
  59. # Initializes this object to the specified move ID.
  60.   def initialize(moveid)
  61.     contestmovedata=PBContestMoveData.new(moveid)
  62.     @id=moveid
  63.   end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement