Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def pbSetFloor(floor)
- $PokemonGlobal.floor = floor
- $PokemonGlobal.visited_floors.push($PokemonGlobal.floors[floor])
- $PokemonGlobal.visitedrooms = 0
- end
- def pbSetDoors(status)
- mapinfos = pbLoadRxData("Data/MapInfos")
- #Kernel.pbMessage(_INTL("{1}",mapinfos[$PokemonGlobal.oldmap].name))
- for event in $game_map.events
- if(event[1].name.include? "DOOR")
- $game_self_switches[[$game_map.map_id, event[1].id, "A"]] = status
- end
- end
- $game_map.refresh
- for event in $game_map.events
- if(event[1].name.include? "DOOR")
- if(!status && event[1].name == "DOOR_"+mapinfos[$PokemonGlobal.oldmap].name)
- event[1].character_name = "no_"+event[1].character_name
- end
- end
- end
- $game_map.refresh
- end
- def pbSetDoor(door, status)
- for event in $game_map.events
- if(event[1].name == door)
- $game_self_switches[[$game_map.map_id, event[1].id, "A"]] = status
- end
- end
- $game_map.refresh
- end
- def pbCountDefeated
- for event in $game_map.events
- if(event[1].name.include? "Battle Event")
- if !$game_self_switches[[$game_map.map_id, event[1].id, "B"]]
- return false
- end
- end
- end
- return true
- end
- def pbResetPowerups()
- for event in $game_map.events
- if(event[1].name.include? "PowerUp")
- $game_self_switches[[$game_map.map_id, event[1].id, "A"]] = false
- end
- end
- $game_map.refresh
- end
- def pbResetLocalSwitches()
- #Kernel.pbMessage(_INTL("{1}",$game_map.events[1].event.class))
- #$game_self_switches[[$game_map.map_id, 1, "A"]] = false
- pbResetPowerups
- for event in $game_map.events
- if(event[1].name == "Battle Event" || event[1].name == "Item Event")
- $game_self_switches[[$game_map.map_id, event[1].id, "A"]] = false
- $game_self_switches[[$game_map.map_id, event[1].id, "B"]] = false
- end
- end
- $game_map.refresh
- end
- def pbOpenDoors
- mapinfos = pbLoadRxData("Data/MapInfos")
- #Kernel.pbMessage(_INTL("{1} -> {2}",mapinfos[$PokemonGlobal.oldmap].name,mapinfos[$game_map.map_id].name))
- if mapinfos[$PokemonGlobal.oldmap].name.include? "Hall"
- for event in $game_map.events
- if(event[1].name.include? ("DOOR") && event[1].name != "DOOR_Hall")
- $game_self_switches[[$game_map.map_id, event[1].id, "A"]] = true
- end
- end
- else
- for event in $game_map.events
- if(event[1].name.include? ("DOOR") && event[1].name != "DOOR_Hall" && event[1].name != "DOOR_"+mapinfos[$PokemonGlobal.oldmap].name)
- $game_self_switches[[$game_map.map_id, event[1].id, "A"]] = true
- end
- end
- end
- #Kernel.pbMessage(_INTL("{1}",mapinfos[$PokemonGlobal.oldmap].name))
- for event in $game_map.events
- if mapinfos[$PokemonGlobal.oldmap].name.include? "Hall"
- if(event[1].name.include? ("PowerUp"))
- $game_self_switches[[$game_map.map_id, event[1].id, "A"]] = true
- end
- else
- if(event[1].name.include?("PowerUp") && event[1].name != "PowerUp_"+mapinfos[$PokemonGlobal.oldmap].name)
- #Kernel.pbMessage(_INTL("{1}",event[1].name))
- $game_self_switches[[$game_map.map_id, event[1].id, "A"]] = true
- end
- end
- end
- $game_map.refresh
- end
- def pbGivePowerUp(powerup)
- $PokemonGlobal.powerup = powerup
- $PokemonGlobal.lastpowerup = Time.new.to_i
- $PokemonGlobal.powerupperiod = 1*60
- pbIncreaseCombo
- end
- def pbIncreaseCombo
- if $PokemonGlobal.combo == 1
- $PokemonGlobal.combo = 1.2
- elsif $PokemonGlobal.combo == 1.2
- $PokemonGlobal.combo = 1.5
- elsif $PokemonGlobal.combo == 1.5
- $PokemonGlobal.combo = 1.7
- elsif $PokemonGlobal.combo == 1.7
- $PokemonGlobal.combo = 2
- elsif $PokemonGlobal.combo == 2
- $PokemonGlobal.combo = 2.2
- elsif $PokemonGlobal.combo == 2.2
- $PokemonGlobal.combo = 2.5
- end
- end
- def pbShowItem
- if $PokemonGlobal.powerup == "Loot" || $PokemonGlobal.powerup == "RareLoot"
- return true
- else
- if pbRandPercentage(25)
- return true
- else
- return false
- end
- end
- end
- def pbLootItem
- items = [[PBItems::POTION]]
- rareitems = [[PBItems::POKEBALL]]
- if $PokemonGlobal.powerup == "Loot"
- items = items
- elsif $PokemonGlobal.powerup == "RareLoot" && pbRandPercentage(15)
- items = rareitems
- else
- items = items + rareitems
- end
- Kernel.pbItemBall(items[$PokemonGlobal.floor].shuffle[0])
- end
- def pbSetBattles
- hasdominant = false
- for event in $game_map.events
- if(event[1].name == "Battle Event")
- $game_self_switches[[$game_map.map_id, event[1].id, "A"]] = true
- $game_map.refresh
- hasdominant = pbRandBattle(event[1].id, hasdominant)
- end
- end
- end
- def pbRandBattle(eventid, hasdominant)
- mapinfos = pbLoadRxData("Data/MapInfos")
- pokemon = {
- 0=>{
- "Top-Left"=>[[PBSpecies::SAWK,78],[PBSpecies::MACHOKE,77],[PBSpecies::PRIMEAPE,77],[PBSpecies::HITMONCHAN,78]],
- "Top-Center"=>[[PBSpecies::SKARMORY,78],[PBSpecies::AGGRON,80],[PBSpecies::MAWILE,78],[PBSpecies::MAGNETON,79]],
- "Top-Right"=>[[PBSpecies::KECLEON,85],[PBSpecies::SOLROCK,74],[PBSpecies::QUAGSIRE,79],[PBSpecies::FORRETRESS,79]],
- "Center-Left"=>[[PBSpecies::DUGTRIO,78],[PBSpecies::SANDSLASH,76],[PBSpecies::MAROWAK,78],[PBSpecies::RHYDON,78]],
- "Center-Right"=>[[PBSpecies::GOLEM,78],[PBSpecies::SUDOWOODO,80],[PBSpecies::OMASTAR,78],[PBSpecies::LUNATONE,74]],
- "Bottom-Left"=>[[PBSpecies::HERACROSS,78],[PBSpecies::LUCARIO,77],[PBSpecies::METAGROSS,82],[PBSpecies::DONPHAN,75]],
- "Bottom-Center"=>[[PBSpecies::MACHOKE,75],[PBSpecies::PRIMEAPE,75],[PBSpecies::HITMONLEE,78],[PBSpecies::THROH,78]],
- "Bottom-Right"=>[[PBSpecies::CLAYDOL,79],[PBSpecies::FLYGON,82],[PBSpecies::RHYDON,79],[PBSpecies::SANDSLASH,75]]
- }
- }
- rarepokemon = {
- 0=>{
- "Top-Left"=>[[PBSpecies::KECLEON,90]],
- "Top-Center"=>[[PBSpecies::KECLEON,90]],
- "Top-Right"=>[[PBSpecies::KECLEON,90]],
- "Center-Left"=>[[PBSpecies::KECLEON,90]],
- "Center-Right"=>[[PBSpecies::KECLEON,90]],
- "Bottom-Left"=>[[PBSpecies::KECLEON,90]],
- "Bottom-Center"=>[[PBSpecies::KECLEON,90]],
- "Bottom-Right"=>[[PBSpecies::KECLEON,90]]
- }
- }
- dominant = {
- 0=>{
- "Top-Left"=>[[PBSpecies::BASTIODON,84]],
- "Top-Center"=>[[PBSpecies::BASTIODON,84]],
- "Top-Right"=>[[PBSpecies::BASTIODON,84]],
- "Center-Left"=>[[PBSpecies::BASTIODON,84]],
- "Center-Right"=>[[PBSpecies::BASTIODON,84]],
- "Bottom-Left"=>[[PBSpecies::BASTIODON,84]],
- "Bottom-Center"=>[[PBSpecies::BASTIODON,84]],
- "Bottom-Right"=>[[PBSpecies::BASTIODON,84]]
- }
- }
- if $PokemonGlobal.powerup == "Hunter" and pbRandPercentage(50)
- pokemon = rarepokemon
- else
- if(pbRandPercentage(2*$PokemonGlobal.visitedrooms)) && !hasdominant
- pokemon = dominant
- hasdominant = true
- elsif(pbRandPercentage(95))
- pokemon = pokemon
- else
- pokemon = rarepokemon
- end
- end
- pokemon = pokemon[$PokemonGlobal.floor][mapinfos[$game_map.map_id].name].shuffle
- #Kernel.pbMessage(_INTL("{1}",pokemon.inspect))
- $game_map.events[eventid].character_name = pokemon[0][0].to_s.rjust(3, "0")
- $game_map.events[eventid].name = $game_map.events[eventid].name+","+pokemon[0][0].to_s+","+pokemon[0][1].to_s
- $game_map.refresh
- return hasdominant
- end
- def pbStartBattle(eventid)
- Graphics.frame_rate = 200
- pokemon = $game_map.events[eventid].name.split(",")[1].to_i
- level = $game_map.events[eventid].name.split(",")[2].to_i
- #Kernel.pbMessage(_INTL("{1}",pokemon))
- pbWildBattle(pokemon,level,26,false,false)
- Graphics.frame_rate = 40
- #Kernel.pbMessage(_INTL("{1}",$game_variables[26]))
- if $game_variables[26] == 1 && $PokemonGlobal.floor != 5#won
- if $game_switches[61]
- $PokemonGlobal.oldmap = $game_map.map_id
- if $game_switches[60] #survival mode
- maps = $PokemonGlobal.floors.shuffle - $PokemonGlobal.floors[$PokemonGlobal.floor]
- $MapFactory.setup(maps[0])
- else #story mode
- if($PokemonGlobal.floors.length > $PokemonGlobal.floor+1)
- maps = $PokemonGlobal.floors[1..-2].shuffle - $PokemonGlobal.visited_floors
- $PokemonGlobal.lastcombo = Time.new.to_i
- if $PokemonGlobal.floor == 4
- $MapFactory.setup(48)
- elsif maps.length == 0
- $MapFactory.setup($PokemonGlobal.floors[-1])
- else
- $MapFactory.setup(maps[0])
- end
- end
- end
- $game_player.moveto(10,7)
- $game_map.refresh
- end
- end
- end
- def pbRandPercentage(percentage)
- rnd = rand(100)
- return rnd >= 0 && rnd <= percentage
- end
- def pbCheckDirection(dir)
- direction = $game_player.direction
- if direction == 6 && dir == "right" #Right
- return true
- elsif direction == 4 && dir == "left" #Left
- return true
- elsif direction == 2 && dir == "bottom" #Bottom
- return true
- elsif direction == 8 && dir == "top" #Top
- return true
- else
- return false
- end
- end
- def pbInspectEvent(eventid)
- $game_map.events[eventid].event.pages[1].character_name = "002"
- #Kernel.pbMessage(_INTL("{1}",$game_map.events[eventid].event.pages.inspect))
- end
- Events.onMapUpdate+=proc{
- time_now = Time.new.to_i - $PokemonGlobal.lastcombo
- if $PokemonGlobal.lastcombo != -1
- if time_now >= 20 and $PokemonGlobal.lastmazemessage == -1
- $PokemonGlobal.lastmazemessage += 1
- pbWait(20)
- Kernel.pbMessage("Mensaje 1")
- pbWait(20)
- elsif time_now >= 40 and $PokemonGlobal.lastmazemessage == 0
- $PokemonGlobal.lastmazemessage += 1
- pbWait(20)
- Kernel.pbMessage("Mensaje 2")
- pbWait(20)
- end
- end
- if time_now > $PokemonGlobal.comboperiod and $PokemonGlobal.comboperiod != -1
- $PokemonGlobal.combo = 1
- $PokemonGlobal.comboperiod = -1
- $PokemonGlobal.powerup = ""
- $PokemonGlobal.powerupperiod = -1
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement