Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ==========================================
- # The Bro Codes v6
- # ==========================================
- # Outputs the highest variable index of arguments 1-X in argument 0
- # Usage:
- # pbHighestVar(var_out, vars...)
- def pbHighestVar(*args)
- # Store first variable argument before removing from Array
- out_var = args[0]
- args.delete_at(0)
- val = 0
- i = 0
- matches = []
- args.each do |var|
- if $game_variables[var] > val
- matches = [i]
- val = $game_variables[var]
- elsif $game_variables[var] == val
- matches.push(i)
- end
- i += 1
- end
- $game_variables[out_var] = args[matches[rand(matches.length)]]
- end
- def pbMapLoop(x_offset)
- $game_player.moveto($game_player.x + x_offset, $game_player.y)
- $game_map.update
- Graphics.frame_reset
- Input.update
- end
- class Game_Character
- def screen_z(height = 0)
- return 0 if @character_name == "MTNSand"
- return 999 if @always_on_top
- z = screen_y_ground
- if @tile_id > 0
- begin
- return z + (self.map.priorities[@tile_id] * 32)
- rescue
- raise "Event's graphic is an out-of-range tile (event #{@id}, map #{self.map.map_id})"
- end
- end
- # Add z if height exceeds 32
- return z + ((height > Game_Map::TILE_HEIGHT) ? Game_Map::TILE_HEIGHT - 1 : 0)
- end
- end
- class Battle::Scene::PokemonDataBox < Sprite
- NAME_BASE_COLOR = Color.new(72, 72, 72)
- NAME_SHADOW_COLOR = Color.new(184, 184, 184)
- MALE_BASE_COLOR = Color.new(48, 96, 216)
- MALE_SHADOW_COLOR = NAME_SHADOW_COLOR
- FEMALE_BASE_COLOR = Color.new(248, 88, 40)
- FEMALE_SHADOW_COLOR = NAME_SHADOW_COLOR
- def draw_level
- pbDrawTextPositions(self.bitmap, [["Lv. ", @spriteBaseX + 140, 16, :left,
- NAME_BASE_COLOR, NAME_SHADOW_COLOR, true]])
- pbDrawTextPositions(self.bitmap, [[@battler.level.inspect, @spriteBaseX + 166, 16, :left,
- NAME_BASE_COLOR, NAME_SHADOW_COLOR, true]])
- end
- def draw_name
- # Sets the bitmap font to be small
- pbSetSmallFont(self.bitmap)
- nameWidth = self.bitmap.text_size(@battler.name).width
- nameOffset = 0
- nameOffset = nameWidth - 116 if nameWidth > 116
- # Adds 'true' as the outline parameter
- pbDrawTextPositions(self.bitmap, [[@battler.name, @spriteBaseX + 8 - nameOffset, 12, :left,
- NAME_BASE_COLOR, NAME_SHADOW_COLOR, true]]
- )
- end
- def draw_gender
- gender = @battler.displayGender
- return if ![0, 1].include?(gender)
- gender_text = (gender == 0) ? _INTL("♂") : _INTL("♀")
- base_color = (gender == 0) ? MALE_BASE_COLOR : FEMALE_BASE_COLOR
- shadow_color = (gender == 0) ? MALE_SHADOW_COLOR : FEMALE_SHADOW_COLOR
- pbDrawTextPositions(self.bitmap, [[gender_text, @spriteBaseX + 126, 12, :left, base_color, shadow_color, true]])
- end
- end
- # Returns false if party is full or no species are provided
- # Returns true if egg is successfully added
- # Usage
- # Script command:
- #
- # $game_variables[10] = pbGrottoEgg(
- # :PIKACHU,
- # :JIGGLYPUFF
- # )
- def pbGrottoEgg(*species)
- return false if $player.party_full?
- return false if species.length == 0
- mon = species[rand(species.length)]
- baby = GameData::Species.get(mon).get_baby_species(true, nil, nil)
- pbGenerateEgg(baby, _I("Hidden Grotto"))
- egg = $player.last_party
- egg_moves = egg.species_data.egg_moves.clone
- index_a = rand(egg_moves.length)
- move_a = egg_moves[index_a]
- egg_moves.delete_at(index_a)
- index_b = rand(egg_moves.length)
- move_b = egg_moves[index_b]
- egg.learn_move(move_a)
- if rand(4) == 0
- egg.learn_move(move_b)
- end
- egg.shiny = true if rand(512) < 1
- egg.ability_index = 2
- return true
- end
- # Returns true if a party member has the matching ability
- def pbHasAbilityInParty?(check_ability = nil)
- $player.party.each_with_index do |pkmn, i|
- return true if pkmn.hasAbility?(check_ability)
- end
- return false
- end
- # Returns true if player has a shiny in party
- def pbHasShinyInParty?
- $player.party.each_with_index do |pkmn, i|
- return true if pkmn.shiny?
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement