mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-11 15:15:00 +00:00
update 6.7
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
def generateEggGroupTeam(eggGroup)
|
||||
teamComplete = false
|
||||
generatedTeam = []
|
||||
while !teamComplete
|
||||
species = rand(PBSpecies.maxValue)
|
||||
if getPokemonEggGroups(species).include?(eggGroup)
|
||||
generatedTeam << species
|
||||
end
|
||||
teamComplete = generatedTeam.length == 3
|
||||
end
|
||||
return generatedTeam
|
||||
end
|
||||
|
||||
def generateSimpleTrainerParty(teamSpecies, level)
|
||||
team = []
|
||||
for species in teamSpecies
|
||||
poke = Pokemon.new(species, level)
|
||||
team << poke
|
||||
end
|
||||
return team
|
||||
end
|
||||
|
||||
def Kernel.getRoamingMap(roamingArrayPos)
|
||||
curmap = $PokemonGlobal.roamPosition[roamingArrayPos]
|
||||
mapinfos = $RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
|
||||
text = mapinfos[curmap].name #,(curmap==$game_map.map_id) ? _INTL("(this map)") : "")
|
||||
return text
|
||||
end
|
||||
|
||||
def Kernel.getItemNamesAsString(list)
|
||||
strList = ""
|
||||
for i in 0..list.length - 1
|
||||
id = list[i]
|
||||
name = PBItems.getName(id)
|
||||
strList += name
|
||||
if i != list.length - 1 && list.length > 1
|
||||
strList += ","
|
||||
end
|
||||
end
|
||||
return strList
|
||||
end
|
||||
|
||||
def getCurrentLevelCap()
|
||||
current_max_level = Settings::LEVEL_CAPS[$Trainer.badge_count]
|
||||
current_max_level *= Settings::HARD_MODE_LEVEL_MODIFIER if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
return current_max_level
|
||||
end
|
||||
|
||||
def pokemonExceedsLevelCap(pokemon)
|
||||
return false if $Trainer.badge_count >= Settings::NB_BADGES
|
||||
current_max_level = getCurrentLevelCap()
|
||||
return pokemon.level >= current_max_level
|
||||
end
|
||||
|
||||
def get_spritecharacter_for_event(event_id)
|
||||
for sprite in $scene.spriteset.character_sprites
|
||||
if sprite.character.id == event_id
|
||||
return sprite
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def setForcedAltSprites(forcedSprites_map)
|
||||
$PokemonTemp.forced_alt_sprites = forcedSprites_map
|
||||
end
|
||||
@@ -0,0 +1,37 @@
|
||||
def reverseFusionSpecies(species)
|
||||
dexId = getDexNumberForSpecies(species)
|
||||
return species if dexId <= NB_POKEMON
|
||||
return species if dexId > (NB_POKEMON * NB_POKEMON) + NB_POKEMON
|
||||
body = getBasePokemonID(dexId, true)
|
||||
head = getBasePokemonID(dexId, false)
|
||||
newspecies = (head) * NB_POKEMON + body
|
||||
return getPokemon(newspecies)
|
||||
end
|
||||
|
||||
def replaceFusionSpecies(pokemon, speciesToChange, newSpecies)
|
||||
currentBody = pokemon.species_data.get_body_species_symbol()
|
||||
currentHead = pokemon.species_data.get_head_species_symbol()
|
||||
should_update_body = currentBody == speciesToChange
|
||||
should_update_head = currentHead == speciesToChange
|
||||
|
||||
echoln speciesToChange
|
||||
echoln currentBody
|
||||
echoln currentHead
|
||||
|
||||
return if !should_update_body && !should_update_head
|
||||
|
||||
newSpeciesBody = should_update_body ? newSpecies : currentBody
|
||||
newSpeciesHead = should_update_head ? newSpecies : currentHead
|
||||
|
||||
newSpecies = getFusionSpecies(newSpeciesBody, newSpeciesHead)
|
||||
echoln newSpecies.id_number
|
||||
pokemon.species = newSpecies
|
||||
end
|
||||
|
||||
def npc_fuse_screen(species_head,species_body)
|
||||
head_pokemon = Pokemon.new(species_head,1)
|
||||
body_pokemon = Pokemon.new(species_body,1)
|
||||
return if head_pokemon.isFusion? || body_pokemon.isFusion?
|
||||
npcTrainerFusionScreenPokemon(head_pokemon,body_pokemon)
|
||||
|
||||
end
|
||||
@@ -0,0 +1,79 @@
|
||||
def pbPokemonIconFile(pokemon)
|
||||
bitmapFileName = pbCheckPokemonIconFiles(pokemon.species, pokemon.isEgg?)
|
||||
return bitmapFileName
|
||||
end
|
||||
|
||||
def pbCheckPokemonIconFiles(speciesID, egg = false, dna = false)
|
||||
if egg
|
||||
bitmapFileName = sprintf("Graphics/Icons/iconEgg")
|
||||
return pbResolveBitmap(bitmapFileName)
|
||||
else
|
||||
bitmapFileName = "Graphics/Pokemon/Icons/#{speciesID}"
|
||||
ret = pbResolveBitmap(bitmapFileName)
|
||||
return ret if ret
|
||||
end
|
||||
ret = pbResolveBitmap("Graphics/Icons/iconDNA.png")
|
||||
return ret if ret
|
||||
return pbResolveBitmap("Graphics/Icons/iconDNA.png")
|
||||
end
|
||||
|
||||
def addShinyStarsToGraphicsArray(imageArray, xPos, yPos, shinyBody, shinyHead, debugShiny, srcx = nil, srcy = nil, width = nil, height = nil,
|
||||
showSecondStarUnder = false, showSecondStarAbove = false)
|
||||
color = debugShiny ? Color.new(0, 0, 0, 255) : nil
|
||||
imageArray.push(["Graphics/Pictures/shiny", xPos, yPos, srcx, srcy, width, height, color])
|
||||
if shinyBody && shinyHead
|
||||
if showSecondStarUnder
|
||||
yPos += 15
|
||||
elsif showSecondStarAbove
|
||||
yPos -= 15
|
||||
else
|
||||
xPos -= 15
|
||||
end
|
||||
imageArray.push(["Graphics/Pictures/shiny", xPos, yPos, srcx, srcy, width, height, color])
|
||||
end
|
||||
# if onlyOutline
|
||||
# imageArray.push(["Graphics/Pictures/shiny_black",xPos,yPos,srcx,srcy,width,height,color])
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
def pbBitmap(path)
|
||||
if !pbResolveBitmap(path).nil?
|
||||
bmp = RPG::Cache.load_bitmap_path(path)
|
||||
bmp.storedPath = path
|
||||
else
|
||||
p "Image located at '#{path}' was not found!" if $DEBUG
|
||||
bmp = Bitmap.new(1, 1)
|
||||
end
|
||||
return bmp
|
||||
end
|
||||
|
||||
|
||||
|
||||
# if need to play animation from event route
|
||||
def playAnimation(animationId, x = nil, y = nil)
|
||||
return if !$scene.is_a?(Scene_Map)
|
||||
x = @event.x unless x
|
||||
y = @event.y unless y
|
||||
$scene.spriteset.addUserAnimation(animationId, x, y, true)
|
||||
end
|
||||
|
||||
#Shows a picture, centered in the middle of the screen in a new viewport
|
||||
# Returns the viewport. Use viewport.dispose to get rid of the picture
|
||||
def showPicture(path,x,y,viewport_x=(Graphics.width / 4), viewport_y=0)
|
||||
begin
|
||||
echoln path
|
||||
viewport = Viewport.new(viewport_x, viewport_y, Graphics.width, Graphics.height)
|
||||
sprite = Sprite.new(viewport)
|
||||
|
||||
bitmap = AnimatedBitmap.new(path) if pbResolveBitmap(path)
|
||||
|
||||
sprite.bitmap = bitmap.bitmap
|
||||
sprite.x = x
|
||||
sprite.y = y
|
||||
|
||||
viewport.z = 99999
|
||||
return viewport
|
||||
rescue
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,84 @@
|
||||
def Kernel.getPlateType(item)
|
||||
return :FIGHTING if item == PBItems::FISTPLATE
|
||||
return :FLYING if item == PBItems::SKYPLATE
|
||||
return :POISON if item == PBItems::TOXICPLATE
|
||||
return :GROUND if item == PBItems::EARTHPLATE
|
||||
return :ROCK if item == PBItems::STONEPLATE
|
||||
return :BUG if item == PBItems::INSECTPLATE
|
||||
return :GHOST if item == PBItems::SPOOKYPLATE
|
||||
return :STEEL if item == PBItems::IRONPLATE
|
||||
return :FIRE if item == PBItems::FLAMEPLATE
|
||||
return :WATER if item == PBItems::SPLASHPLATE
|
||||
return :GRASS if item == PBItems::MEADOWPLATE
|
||||
return :ELECTRIC if item == PBItems::ZAPPLATE
|
||||
return :PSYCHIC if item == PBItems::MINDPLATE
|
||||
return :ICE if item == PBItems::ICICLEPLATE
|
||||
return :DRAGON if item == PBItems::DRACOPLATE
|
||||
return :DARK if item == PBItems::DREADPLATE
|
||||
return :FAIRY if item == PBItems::PIXIEPLATE
|
||||
return -1
|
||||
end
|
||||
|
||||
def Kernel.listPlatesInBag()
|
||||
list = []
|
||||
list << PBItems::FISTPLATE if $PokemonBag.pbQuantity(:FISTPLATE) >= 1
|
||||
list << PBItems::SKYPLATE if $PokemonBag.pbQuantity(:SKYPLATE) >= 1
|
||||
list << PBItems::TOXICPLATE if $PokemonBag.pbQuantity(:TOXICPLATE) >= 1
|
||||
list << PBItems::EARTHPLATE if $PokemonBag.pbQuantity(:EARTHPLATE) >= 1
|
||||
list << PBItems::STONEPLATE if $PokemonBag.pbQuantity(:STONEPLATE) >= 1
|
||||
list << PBItems::INSECTPLATE if $PokemonBag.pbQuantity(:INSECTPLATE) >= 1
|
||||
list << PBItems::SPOOKYPLATE if $PokemonBag.pbQuantity(:SPOOKYPLATE) >= 1
|
||||
list << PBItems::IRONPLATE if $PokemonBag.pbQuantity(:IRONPLATE) >= 1
|
||||
list << PBItems::FLAMEPLATE if $PokemonBag.pbQuantity(:FLAMEPLATE) >= 1
|
||||
list << PBItems::SPLASHPLATE if $PokemonBag.pbQuantity(:SPLASHPLATE) >= 1
|
||||
list << PBItems::MEADOWPLATE if $PokemonBag.pbQuantity(:MEADOWPLATE) >= 1
|
||||
list << PBItems::ZAPPLATE if $PokemonBag.pbQuantity(:ZAPPLATE) >= 1
|
||||
list << PBItems::MINDPLATE if $PokemonBag.pbQuantity(:MINDPLATE) >= 1
|
||||
list << PBItems::ICICLEPLATE if $PokemonBag.pbQuantity(:ICICLEPLATE) >= 1
|
||||
list << PBItems::DRACOPLATE if $PokemonBag.pbQuantity(:DRACOPLATE) >= 1
|
||||
list << PBItems::DREADPLATE if $PokemonBag.pbQuantity(:DREADPLATE) >= 1
|
||||
list << PBItems::PIXIEPLATE if $PokemonBag.pbQuantity(:PIXIEPLATE) >= 1
|
||||
return list
|
||||
end
|
||||
|
||||
def getArceusPlateType(heldItem)
|
||||
return :NORMAL if heldItem == nil
|
||||
case heldItem
|
||||
when :FISTPLATE
|
||||
return :FIGHTING
|
||||
when :SKYPLATE
|
||||
return :FLYING
|
||||
when :TOXICPLATE
|
||||
return :POISON
|
||||
when :EARTHPLATE
|
||||
return :GROUND
|
||||
when :STONEPLATE
|
||||
return :ROCK
|
||||
when :INSECTPLATE
|
||||
return :BUG
|
||||
when :SPOOKYPLATE
|
||||
return :GHOST
|
||||
when :IRONPLATE
|
||||
return :STEEL
|
||||
when :FLAMEPLATE
|
||||
return :FIRE
|
||||
when :SPLASHPLATE
|
||||
return :WATER
|
||||
when :MEADOWPLATE
|
||||
return :GRASS
|
||||
when :ZAPPLATE
|
||||
return :ELECTRIC
|
||||
when :MINDPLATE
|
||||
return :PSYCHIC
|
||||
when :ICICLEPLATE
|
||||
return :ICE
|
||||
when :DRACOPLATE
|
||||
return :DRAGON
|
||||
when :DREADPLATE
|
||||
return :DARK
|
||||
when :PIXIEPLATE
|
||||
return :FAIRY
|
||||
else
|
||||
return :NORMAL
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,91 @@
|
||||
def obtainBadgeMessage(badgeName)
|
||||
Kernel.pbMessage(_INTL("\\me[Badge get]{1} obtained the {2}!", $Trainer.name, badgeName))
|
||||
end
|
||||
|
||||
def promptCaughtPokemonAction(pokemon)
|
||||
pickedOption = false
|
||||
return pbStorePokemon(pokemon) if !$Trainer.party_full?
|
||||
return promptKeepOrRelease(pokemon) if isOnPinkanIsland() && !$game_switches[SWITCH_PINKAN_FINISHED]
|
||||
while !pickedOption
|
||||
command = pbMessage(_INTL("\\ts[]Your team is full!"),
|
||||
[_INTL("Add to your party"), _INTL("Store to PC"),], 2)
|
||||
echoln ("command " + command.to_s)
|
||||
case command
|
||||
when 0 # SWAP
|
||||
if swapCaughtPokemon(pokemon)
|
||||
echoln pickedOption
|
||||
pickedOption = true
|
||||
end
|
||||
else
|
||||
# STORE
|
||||
pbStorePokemon(pokemon)
|
||||
echoln pickedOption
|
||||
pickedOption = true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def promptKeepOrRelease(pokemon)
|
||||
pickedOption = false
|
||||
while !pickedOption
|
||||
command = pbMessage(_INTL("\\ts[]Your team is full!"),
|
||||
[_INTL("Release a party member"), _INTL("Release this #{pokemon.name}"),], 2)
|
||||
echoln ("command " + command.to_s)
|
||||
case command
|
||||
when 0 # SWAP
|
||||
if swapReleaseCaughtPokemon(pokemon)
|
||||
pickedOption = true
|
||||
end
|
||||
else
|
||||
pickedOption = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# def pbChoosePokemon(variableNumber, nameVarNumber, ableProc = nil, allowIneligible = false)
|
||||
def swapCaughtPokemon(caughtPokemon)
|
||||
pbChoosePokemon(1, 2,
|
||||
proc { |poke|
|
||||
!poke.egg? &&
|
||||
!(poke.isShadow? rescue false)
|
||||
})
|
||||
index = pbGet(1)
|
||||
return false if index == -1
|
||||
$PokemonStorage.pbStoreCaught($Trainer.party[index])
|
||||
pbRemovePokemonAt(index)
|
||||
pbStorePokemon(caughtPokemon)
|
||||
|
||||
tmp = $Trainer.party[index]
|
||||
$Trainer.party[index] = $Trainer.party[-1]
|
||||
$Trainer.party[-1] = tmp
|
||||
return true
|
||||
end
|
||||
|
||||
def swapReleaseCaughtPokemon(caughtPokemon)
|
||||
pbChoosePokemon(1, 2,
|
||||
proc { |poke|
|
||||
!poke.egg? &&
|
||||
!(poke.isShadow? rescue false)
|
||||
})
|
||||
index = pbGet(1)
|
||||
return false if index == -1
|
||||
releasedPokemon = $Trainer.party[index]
|
||||
pbMessage(_INTL("{1} was released.",releasedPokemon.name))
|
||||
pbRemovePokemonAt(index)
|
||||
pbStorePokemon(caughtPokemon)
|
||||
|
||||
tmp = $Trainer.party[index]
|
||||
$Trainer.party[index] = $Trainer.party[-1]
|
||||
$Trainer.party[-1] = tmp
|
||||
return true
|
||||
end
|
||||
|
||||
def select_any_pokemon()
|
||||
commands = []
|
||||
for dex_num in 1..NB_POKEMON
|
||||
species = getPokemon(dex_num)
|
||||
commands.push([dex_num - 1, species.real_name, species.id])
|
||||
end
|
||||
return pbChooseList(commands, 0, nil, 1)
|
||||
end
|
||||
@@ -0,0 +1,164 @@
|
||||
def unlock_easter_egg_hats()
|
||||
if $Trainer.name.downcase == "ash"
|
||||
$Trainer.hat = HAT_ASH
|
||||
$Trainer.unlock_hat(HAT_ASH)
|
||||
end
|
||||
if $Trainer.name.downcase == "frogman"
|
||||
$Trainer.hat = HAT_FROG
|
||||
$Trainer.unlock_hat(HAT_FROG)
|
||||
end
|
||||
end
|
||||
|
||||
def getPlayerDefaultName(gender)
|
||||
if gender == GENDER_MALE
|
||||
return Settings::GAME_ID == :IF_HOENN ? "Brendan" : "Red"
|
||||
else
|
||||
return Settings::GAME_ID == :IF_HOENN ? "May" : "Green"
|
||||
end
|
||||
end
|
||||
|
||||
def getDefaultClothes(gender)
|
||||
if gender == GENDER_MALE
|
||||
return Settings::GAME_ID == :IF_HOENN ? CLOTHES_BRENDAN : DEFAULT_OUTFIT_MALE
|
||||
else
|
||||
return Settings::GAME_ID == :IF_HOENN ? CLOTHES_MAY : DEFAULT_OUTFIT_FEMALE
|
||||
end
|
||||
end
|
||||
|
||||
def getDefaultHat(gender)
|
||||
if gender == GENDER_MALE
|
||||
return Settings::GAME_ID == :IF_HOENN ? HAT_BRENDAN : DEFAULT_OUTFIT_MALE
|
||||
else
|
||||
return Settings::GAME_ID == :IF_HOENN ? HAT_MAY : DEFAULT_OUTFIT_FEMALE
|
||||
end
|
||||
end
|
||||
|
||||
def getDefaultHair(gender)
|
||||
if gender == GENDER_MALE
|
||||
return Settings::GAME_ID == :IF_HOENN ? HAIR_BRENDAN : DEFAULT_OUTFIT_MALE
|
||||
else
|
||||
return Settings::GAME_ID == :IF_HOENN ? HAIR_MAY : DEFAULT_OUTFIT_FEMALE
|
||||
end
|
||||
end
|
||||
|
||||
def setupStartingOutfit()
|
||||
default_clothes_male = getDefaultClothes(GENDER_MALE)
|
||||
default_clothes_female = getDefaultClothes(GENDER_FEMALE)
|
||||
|
||||
default_hat_male = getDefaultHat(GENDER_MALE)
|
||||
default_hat_female = getDefaultHat(GENDER_FEMALE)
|
||||
|
||||
default_hair_male = getDefaultHair(GENDER_MALE)
|
||||
default_hair_female = getDefaultHair(GENDER_FEMALE)
|
||||
|
||||
$Trainer.hat = nil
|
||||
$Trainer.clothes = STARTING_OUTFIT
|
||||
unlock_easter_egg_hats()
|
||||
gender = pbGet(VAR_TRAINER_GENDER)
|
||||
if gender == GENDER_FEMALE
|
||||
$Trainer.unlock_clothes(default_clothes_female, true)
|
||||
$Trainer.unlock_hat(default_hat_female, true)
|
||||
$Trainer.hair = "3_" + default_hair_female if !$Trainer.hair # when migrating old savefiles
|
||||
|
||||
elsif gender == GENDER_MALE
|
||||
$Trainer.unlock_clothes(default_clothes_male, true)
|
||||
$Trainer.unlock_hat(default_hat_male, true)
|
||||
|
||||
echoln $Trainer.hair
|
||||
$Trainer.hair = ("3_" + default_hair_male) if !$Trainer.hair # when migrating old savefiles
|
||||
echoln $Trainer.hair
|
||||
end
|
||||
$Trainer.unlock_hair(default_hair_male, true)
|
||||
$Trainer.unlock_hair(default_hair_female, true)
|
||||
$Trainer.unlock_clothes(STARTING_OUTFIT, true)
|
||||
end
|
||||
|
||||
def give_date_specific_hats()
|
||||
current_date = Time.new
|
||||
# Christmas
|
||||
if (current_date.day == 24 || current_date.day == 25) && current_date.month == 12
|
||||
if !$Trainer.unlocked_hats.include?(HAT_SANTA)
|
||||
pbCallBub(2, @event_id, true)
|
||||
pbMessage(_INTL("Hi! We're giving out a special hat today for the holidays season. Enjoy!"))
|
||||
obtainHat(HAT_SANTA)
|
||||
end
|
||||
end
|
||||
|
||||
# April's fool
|
||||
if (current_date.day == 1 && current_date.month == 4)
|
||||
if !$Trainer.unlocked_hats.include?(HAT_CLOWN)
|
||||
pbCallBub(2, @event_id, true)
|
||||
pbMessage(_INTL("Hi! We're giving out this fun accessory for this special day. Enjoy!"))
|
||||
obtainHat(HAT_CLOWN)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def qmarkMaskCheck()
|
||||
if $Trainer.seen_qmarks_sprite
|
||||
unless hasHat?(HAT_QMARKS)
|
||||
obtainHat(HAT_QMARKS)
|
||||
obtainClothes(CLOTHES_GLITCH)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def purchaseDyeKitMenu(hats_kit_price = 0, clothes_kit_price = 0)
|
||||
|
||||
commands = []
|
||||
command_hats = _INTL("Hats Dye Kit (${1})",hats_kit_price)
|
||||
command_clothes = _INTL("Clothes Dye Kit (${1})",clothes_kit_price)
|
||||
command_cancel = _INTL("Cancel")
|
||||
|
||||
commands << command_hats if !$PokemonBag.pbHasItem?(:HATSDYEKIT)
|
||||
commands << command_clothes if !$PokemonBag.pbHasItem?(:CLOTHESDYEKIT)
|
||||
commands << command_cancel
|
||||
|
||||
if commands.length <= 1
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("\\C[1]Dye Kits\\C[0] can be used to dye clothes all sorts of colours!"))
|
||||
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("You can use them at any time when you change clothes."))
|
||||
return
|
||||
end
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("\\GWelcome! Are you interested in dyeing your outfits different colours?"))
|
||||
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("I make handy \\C[1]Dye Kits\\C[0] from my Smeargle's paint that can be used to dye your outfits any color you want!"))
|
||||
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("\\GWhat's more is that it's reusable so you can go completely wild with it if you want! Are you interested?"))
|
||||
|
||||
choice = optionsMenu(commands, commands.length)
|
||||
case commands[choice]
|
||||
when command_hats
|
||||
if $Trainer.money < hats_kit_price
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("Oh, you don't have enough money..."))
|
||||
return
|
||||
end
|
||||
pbMessage(_INTL("\\G\\PN purchased the dye kit."))
|
||||
$Trainer.money -= hats_kit_price
|
||||
pbSEPlay("SlotsCoin")
|
||||
Kernel.pbReceiveItem(:HATSDYEKIT)
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("\\GHere you go! Have fun dyeing your hats!"))
|
||||
when command_clothes
|
||||
if $Trainer.money < clothes_kit_price
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("Oh, you don't have enough money..."))
|
||||
return
|
||||
end
|
||||
pbMessage(_INTL("\\G\\PN purchased the dye kit."))
|
||||
$Trainer.money -= clothes_kit_price
|
||||
pbSEPlay("SlotsCoin")
|
||||
Kernel.pbReceiveItem(:CLOTHESDYEKIT)
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("\\GHere you go! Have fun dyeing your clothes!"))
|
||||
end
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("You can use \\C[1]Dye Kits\\C[0] at any time when you change clothes."))
|
||||
end
|
||||
|
||||
@@ -0,0 +1,383 @@
|
||||
def pbAddPokemonID(pokemon_id, level = 1, see_form = true, skip_randomize = false)
|
||||
return false if !pokemon_id
|
||||
skip_randomize = true if $game_switches[SWITCH_CHOOSING_STARTER] # when choosing starters
|
||||
if pbBoxesFull?
|
||||
pbMessage(_INTL("There's no more room for Pokémon!\1"))
|
||||
pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
|
||||
return false
|
||||
end
|
||||
if pokemon_id.is_a?(Integer) && level.is_a?(Integer)
|
||||
pokemon = Pokemon.new(pokemon_id, level)
|
||||
species_name = pokemon.speciesName
|
||||
end
|
||||
|
||||
# random species if randomized gift pokemon & wild poke
|
||||
if $game_switches[SWITCH_RANDOM_GIFT_POKEMON] && $game_switches[SWITCH_RANDOM_WILD] && !skip_randomize
|
||||
tryRandomizeGiftPokemon(pokemon, skip_randomize)
|
||||
end
|
||||
|
||||
pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, species_name))
|
||||
pbNicknameAndStore(pokemon)
|
||||
$Trainer.pokedex.register(pokemon) if see_form
|
||||
return true
|
||||
end
|
||||
|
||||
def pbHasSpecies?(species)
|
||||
if species.is_a?(String) || species.is_a?(Symbol)
|
||||
id = getID(PBSpecies, species)
|
||||
elsif species.is_a?(Pokemon)
|
||||
id = species.dexNum
|
||||
end
|
||||
for pokemon in $Trainer.party
|
||||
next if pokemon.isEgg?
|
||||
return true if pokemon.dexNum == id
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def getID(pbspecies_unused, species)
|
||||
if species.is_a?(String)
|
||||
return nil
|
||||
elsif species.is_a?(Symbol)
|
||||
return GameData::Species.get(species).id_number
|
||||
elsif species.is_a?(Pokemon)
|
||||
id = species.dexNum
|
||||
end
|
||||
end
|
||||
|
||||
# Check if the Pokemon can learn a TM
|
||||
def CanLearnMove(pokemon, move)
|
||||
species = getID(PBSpecies, pokemon)
|
||||
return false if species <= 0
|
||||
data = load_data("Data/tm.dat")
|
||||
return false if !data[move]
|
||||
return data[move].any? { |item| item == species }
|
||||
end
|
||||
|
||||
def getPokemon(dexNum)
|
||||
if dexNum.is_a?(Integer)
|
||||
if dexNum > NB_POKEMON
|
||||
body_id = getBodyID(dexNum)
|
||||
head_id = getHeadID(dexNum, body_id)
|
||||
pokemon_id = getFusedPokemonIdFromDexNum(body_id, head_id)
|
||||
else
|
||||
pokemon_id = dexNum
|
||||
end
|
||||
else
|
||||
pokemon_id = dexNum
|
||||
end
|
||||
|
||||
return GameData::Species.get(pokemon_id)
|
||||
end
|
||||
|
||||
def getSpecies(dexnum)
|
||||
return getPokemon(dexnum.species) if dexnum.is_a?(Pokemon)
|
||||
return getPokemon(dexnum)
|
||||
end
|
||||
|
||||
def getAbilityIndexFromID(abilityID, fusedPokemon)
|
||||
abilityList = fusedPokemon.getAbilityList
|
||||
for abilityArray in abilityList #ex: [:CHLOROPHYLL, 0]
|
||||
ability = abilityArray[0]
|
||||
index = abilityArray[1]
|
||||
return index if ability == abilityID
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def getPokemonEggGroups(species)
|
||||
return GameData::Species.get(species).egg_groups
|
||||
end
|
||||
|
||||
def getAllNonLegendaryPokemon()
|
||||
list = []
|
||||
for i in 1..143
|
||||
list.push(i)
|
||||
end
|
||||
for i in 147..149
|
||||
list.push(i)
|
||||
end
|
||||
for i in 152..242
|
||||
list.push(i)
|
||||
end
|
||||
list.push(246)
|
||||
list.push(247)
|
||||
list.push(248)
|
||||
for i in 252..314
|
||||
list.push(i)
|
||||
end
|
||||
for i in 316..339
|
||||
list.push(i)
|
||||
end
|
||||
for i in 352..377
|
||||
list.push(i)
|
||||
end
|
||||
for i in 382..420
|
||||
list.push(i)
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
|
||||
def isInKantoGeneration(dexNumber)
|
||||
return dexNumber <= 151
|
||||
end
|
||||
|
||||
def isKantoPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
return isInKantoGeneration(dexNum) || isInKantoGeneration(head_dex) || isInKantoGeneration(body_dex)
|
||||
end
|
||||
|
||||
def isInJohtoGeneration(dexNumber)
|
||||
return dexNumber > 151 && dexNumber <= 251
|
||||
end
|
||||
|
||||
def isJohtoPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
return isInJohtoGeneration(dexNum) || isInJohtoGeneration(head_dex) || isInJohtoGeneration(body_dex)
|
||||
end
|
||||
|
||||
def isAlolaPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
list = [
|
||||
370, 373, 430, 431, 432, 433, 450, 451, 452,
|
||||
453, 454, 455, 459, 460, 463, 464, 465, 469, 470,
|
||||
471, 472, 473, 474, 475, 476, 477, 498, 499,
|
||||
]
|
||||
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
|
||||
end
|
||||
|
||||
def isKalosPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
list =
|
||||
[327, 328, 329, 339, 371, 372, 417, 418,
|
||||
425, 426, 438, 439, 440, 441, 444, 445, 446,
|
||||
456, 461, 462, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487,
|
||||
489, 490, 491, 492, 500,
|
||||
|
||||
]
|
||||
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
|
||||
end
|
||||
|
||||
def isUnovaPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
list =
|
||||
[
|
||||
330, 331, 337, 338, 348, 349, 350, 351, 359, 360, 361,
|
||||
362, 363, 364, 365, 366, 367, 368, 369, 374, 375, 376, 377,
|
||||
397, 398, 399, 406, 407, 408, 409, 410, 411, 412, 413, 414,
|
||||
415, 416, 419, 420,
|
||||
422, 423, 424, 434, 345,
|
||||
466, 467, 494, 493,
|
||||
]
|
||||
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
|
||||
end
|
||||
|
||||
def isSinnohPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
list =
|
||||
[254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
|
||||
266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 288, 294,
|
||||
295, 296, 297, 298, 299, 305, 306, 307, 308, 315, 316, 317,
|
||||
318, 319, 320, 321, 322, 323, 324, 326, 332, 343, 344, 345,
|
||||
346, 347, 352, 353, 354, 358, 383, 384, 388, 389, 400, 402,
|
||||
403, 429, 468]
|
||||
|
||||
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
|
||||
end
|
||||
|
||||
def isHoennPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
list = [252, 253, 276, 277, 278, 279, 280, 281, 282, 283, 284,
|
||||
285, 286, 287, 289, 290, 291, 292, 293, 300, 301, 302, 303,
|
||||
304, 309, 310, 311, 312, 313, 314, 325, 333, 334, 335, 336, 340,
|
||||
341, 342, 355, 356, 357, 378, 379, 380, 381, 382, 385, 386,
|
||||
387, 390, 391, 392, 393, 394, 395, 396, 401, 404, 405, 421,
|
||||
427, 428, 436, 437, 442, 443, 447, 448, 449, 457, 458, 488,
|
||||
495, 496, 497, 501, 502, 503, 504, 505, 506, 507, 508, 509,
|
||||
510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521,
|
||||
522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533,
|
||||
534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545,
|
||||
546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557,
|
||||
558, 559, 560, 561, 562, 563, 564, 565
|
||||
]
|
||||
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
|
||||
end
|
||||
|
||||
|
||||
def get_default_moves_at_level(species, level)
|
||||
moveset = GameData::Species.get(species).moves
|
||||
knowable_moves = []
|
||||
moveset.each { |m| knowable_moves.push(m[1]) if m[0] <= level }
|
||||
# Remove duplicates (retaining the latest copy of each move)
|
||||
knowable_moves = knowable_moves.reverse
|
||||
knowable_moves |= []
|
||||
knowable_moves = knowable_moves.reverse
|
||||
# Add all moves
|
||||
moves = []
|
||||
first_move_index = knowable_moves.length - MAX_MOVES
|
||||
first_move_index = 0 if first_move_index < 0
|
||||
for i in first_move_index...knowable_moves.length
|
||||
#moves.push(Pokemon::Move.new(knowable_moves[i]))
|
||||
moves << knowable_moves[i]
|
||||
end
|
||||
return moves
|
||||
end
|
||||
|
||||
def listPokemonIDs()
|
||||
for id in 0..NB_POKEMON
|
||||
pokemon = GameData::Species.get(id).species
|
||||
echoln id.to_s + ": " + "\"" + pokemon.to_s + "\"" + ", "
|
||||
end
|
||||
end
|
||||
|
||||
#IMPORTANT
|
||||
#La méthode def pbCheckEvolution(pokemon,item=0)
|
||||
#dans PokemonFusion (class PokemonFusionScene)
|
||||
#a été modifiée et pour une raison ou une autre ca marche
|
||||
#pas quand on la copie ici.
|
||||
#Donc NE PAS OUBLIER DE LE COPIER AVEC
|
||||
|
||||
|
||||
def isPartPokemon(src, target)
|
||||
return Kernel.isPartPokemon(src, target)
|
||||
end
|
||||
#in: pokemon number
|
||||
def Kernel.isPartPokemon(src, target)
|
||||
|
||||
src = getDexNumberForSpecies(src)
|
||||
target = getDexNumberForSpecies(target)
|
||||
return true if src == target
|
||||
return false if src <= NB_POKEMON
|
||||
bod = getBasePokemonID(src, true)
|
||||
head = getBasePokemonID(src, false)
|
||||
return bod == target || head == target
|
||||
end
|
||||
|
||||
##EDITED HERE
|
||||
#Retourne le pokemon de base
|
||||
#param1 = int
|
||||
#param2 = true pour body, false pour head
|
||||
#return int du pokemon de base
|
||||
def getBasePokemonID(pokemon, body = true)
|
||||
if pokemon.is_a?(Symbol)
|
||||
dex_number = GameData::Species.get(pokemon).id_number
|
||||
pokemon = dex_number
|
||||
end
|
||||
return nil if pokemon <= 0
|
||||
return nil if pokemon >= Settings::ZAPMOLCUNO_NB
|
||||
|
||||
# cname = getConstantName(PBSpecies, pokemon) rescue nil
|
||||
cname = GameData::Species.get(pokemon).id.to_s
|
||||
return pokemon if pokemon <= NB_POKEMON
|
||||
return pokemon if cname == nil
|
||||
|
||||
arr = cname.split(/[B,H]/)
|
||||
|
||||
bod = arr[1]
|
||||
head = arr[2]
|
||||
|
||||
return bod.to_i if body
|
||||
return head.to_i
|
||||
end
|
||||
|
||||
def getGenericPokemonCryText(pokemonSpecies)
|
||||
case pokemonSpecies
|
||||
when 25
|
||||
return "Pika!"
|
||||
when 16, 17, 18, 21, 22, 144, 145, 146, 227, 417, 418, 372 # birds
|
||||
return "Squawk!"
|
||||
when 163, 164
|
||||
return "Hoot!" # owl
|
||||
else
|
||||
return "Guaugh!"
|
||||
end
|
||||
end
|
||||
|
||||
def setPokemonMoves(pokemon, move_ids = [])
|
||||
moves = []
|
||||
move_ids.each { |move_id|
|
||||
moves << Pokemon::Move.new(move_id)
|
||||
}
|
||||
pokemon.moves = moves
|
||||
end
|
||||
|
||||
def changeSpeciesSpecific(pokemon, newSpecies)
|
||||
pokemon.species = newSpecies
|
||||
$Trainer.pokedex.set_seen(newSpecies)
|
||||
$Trainer.pokedex.set_owned(newSpecies)
|
||||
end
|
||||
|
||||
def calculate_pokemon_weight(pokemon, nerf = 0)
|
||||
|
||||
base_weight = pokemon.weight
|
||||
ivs = []
|
||||
pokemon.iv.each { |iv|
|
||||
ivs << iv[1]
|
||||
}
|
||||
level = pokemon.level
|
||||
# Ensure IVs is an array of 6 values and level is between 1 and 100
|
||||
raise "IVs array must have 6 values" if ivs.length != 6
|
||||
raise "Level must be between 1 and 100" unless (1..100).include?(level)
|
||||
|
||||
# Calculate the IV Factor
|
||||
iv_sum = ivs.sum
|
||||
iv_factor = (iv_sum.to_f / 186) * 30 * 10
|
||||
|
||||
# Calculate the Level Factor
|
||||
level_factor = (level.to_f / 100) * 5 * 10
|
||||
|
||||
# Calculate the weight
|
||||
weight = base_weight * (1 + (iv_factor / 100) + (level_factor / 100))
|
||||
weight -= base_weight
|
||||
# Enforce the weight variation limits
|
||||
max_weight = base_weight * 4.00 # 400% increase
|
||||
min_weight = base_weight * 0.5 # 50% decrease
|
||||
|
||||
# Cap the weight between min and max values
|
||||
weight = [[weight, min_weight].max, max_weight].min
|
||||
weight -= nerf if weight - nerf > min_weight
|
||||
return weight.round(2) # Round to 2 decimal places
|
||||
end
|
||||
|
||||
|
||||
def playCry(pokemonSpeciesSymbol)
|
||||
species = GameData::Species.get(pokemonSpeciesSymbol).species
|
||||
GameData::Species.play_cry_from_species(species)
|
||||
end
|
||||
|
||||
def getHiddenPowerName(pokemon)
|
||||
hiddenpower = pbHiddenPower(pokemon)
|
||||
hiddenPowerType = hiddenpower[0]
|
||||
|
||||
echoln hiddenPowerType
|
||||
if Settings::TRIPLE_TYPES.include?(hiddenPowerType)
|
||||
return _INTL("Neutral")
|
||||
end
|
||||
return PBTypes.getName(hiddenPowerType)
|
||||
end
|
||||
|
||||
def has_species_or_fusion?(species, form = -1)
|
||||
return $Trainer.pokemon_party.any? { |p| p && p.isSpecies?(species) || p.isFusionOf(species) }
|
||||
end
|
||||
@@ -0,0 +1,231 @@
|
||||
###################
|
||||
## CONVERTER #
|
||||
###################
|
||||
def convertAllPokemon()
|
||||
Kernel.pbMessage(_INTL("The game has detected that your previous savefile was from an earlier build of the game."))
|
||||
Kernel.pbMessage(_INTL("In order to play this version, your Pokémon need to be converted to their new Pokédex numbers. "))
|
||||
Kernel.pbMessage(_INTL("If you were playing Randomized mode, the trainers and wild Pokémon will also need to be reshuffled."))
|
||||
|
||||
|
||||
if (Kernel.pbConfirmMessage(_INTL("Convert your Pokémon?")))
|
||||
|
||||
#get previous version
|
||||
msgwindow = Kernel.pbCreateMessageWindow(nil)
|
||||
msgwindow.text = _INTL("What is the last version of the game you played?")
|
||||
choice = Kernel.pbShowCommands(msgwindow, [
|
||||
_INTL("4.7 (September 2020)"),
|
||||
_INTL("4.5-4.6.2 (2019-2020)"),
|
||||
_INTL("4.2-4.4 (2019)"),
|
||||
_INTL("4.0-4.1 (2018-2019)"),
|
||||
_INTL("3.x or earlier (2015-2018)")], -1)
|
||||
case choice
|
||||
when 0
|
||||
prev_total = 381
|
||||
when 1
|
||||
prev_total = 351
|
||||
when 2
|
||||
prev_total = 315
|
||||
when 3
|
||||
prev_total = 275
|
||||
when 4
|
||||
prev_total = 151
|
||||
else
|
||||
prev_total = 381
|
||||
end
|
||||
Kernel.pbDisposeMessageWindow(msgwindow)
|
||||
|
||||
pbEachPokemon { |poke, box|
|
||||
if poke.species >= NB_POKEMON
|
||||
pf = poke.species
|
||||
pBody = (pf / prev_total).round
|
||||
pHead = pf - (prev_total * pBody)
|
||||
|
||||
# Kernel.pbMessage("pbod {1} pHead {2}, species: {3})",pBody,pHead,pf)
|
||||
|
||||
prev_max_value = (prev_total * prev_total) + prev_total
|
||||
if pf >= prev_max_value
|
||||
newSpecies = convertTripleFusion(pf, prev_max_value)
|
||||
if newSpecies == nil
|
||||
boxname = box == -1 ? "Party" : box
|
||||
Kernel.pbMessage(_INTL("Invalid Pokémon detected in box {1}:\n num. {2}, {3} (lv. {4})", boxname, pf, poke.name, poke.level))
|
||||
if (Kernel.pbConfirmMessage(_INTL("Delete Pokémon and continue?")))
|
||||
poke = nil
|
||||
next
|
||||
else
|
||||
Kernel.pbMessage(_INTL("Conversion cancelled. Please restart the game."))
|
||||
Graphics.freeze
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
newSpecies = pBody * NB_POKEMON + pHead
|
||||
poke.species = newSpecies
|
||||
end
|
||||
}
|
||||
Kernel.initRandomTypeArray()
|
||||
if $game_switches[SWITCH_RANDOM_TRAINERS] #randomized trainers
|
||||
Kernel.pbShuffleTrainers()
|
||||
end
|
||||
if $game_switches[956] #randomized pokemon
|
||||
range = pbGet(197) == nil ? 25 : pbGet(197)
|
||||
Kernel.pbShuffleDex(range, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def convertTripleFusion(species, prev_max_value)
|
||||
if prev_max_value == (351 * 351) + 351
|
||||
case species
|
||||
when 123553
|
||||
return 145543
|
||||
when 123554
|
||||
return 145544
|
||||
when 123555
|
||||
return 145545
|
||||
when 123556
|
||||
return 145546
|
||||
when 123557
|
||||
return 145547
|
||||
when 123558
|
||||
return 145548
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
def convertTrainers()
|
||||
if ($game_switches[SWITCH_RANDOM_TRAINERS])
|
||||
Kernel.pbShuffleTrainers()
|
||||
end
|
||||
end
|
||||
|
||||
def convertAllPokemonManually()
|
||||
|
||||
if (Kernel.pbConfirmMessage(_INTL("When you last played the game, where there any gen 2 Pokémon?")))
|
||||
#4.0
|
||||
prev_total = 315
|
||||
else
|
||||
#3.0
|
||||
prev_total = 151
|
||||
end
|
||||
convertPokemon(prev_total)
|
||||
end
|
||||
|
||||
def convertPokemon(prev_total = 275)
|
||||
pbEachPokemon { |poke, box|
|
||||
if poke.species >= NB_POKEMON
|
||||
pf = poke.species
|
||||
pBody = (pf / prev_total).round
|
||||
pHead = pf - (prev_total * pBody)
|
||||
|
||||
newSpecies = pBody * NB_POKEMON + pHead
|
||||
poke.species = newSpecies
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def fixMissedHMs()
|
||||
# Flash
|
||||
if $PokemonBag.pbQuantity(:HM08) < 1 && $PokemonGlobal.questRewardsObtained.include?(:HM08)
|
||||
pbReceiveItem(:HM08)
|
||||
end
|
||||
|
||||
# Cut
|
||||
if $PokemonBag.pbQuantity(:HM01) < 1 && $game_switches[SWITCH_SS_ANNE_DEPARTED]
|
||||
pbReceiveItem(:HM01)
|
||||
end
|
||||
|
||||
# Strength
|
||||
if $PokemonBag.pbQuantity(:HM04) < 1 && $game_switches[SWITCH_SNORLAX_GONE_ROUTE_12]
|
||||
pbReceiveItem(:HM04)
|
||||
end
|
||||
|
||||
# Surf
|
||||
if $PokemonBag.pbQuantity(:HM03) < 1 && $game_self_switches[[107, 1, "A"]]
|
||||
pbReceiveItem(:HM03)
|
||||
end
|
||||
|
||||
# Teleport
|
||||
if $PokemonBag.pbQuantity(:HM07) < 1 && $game_switches[SWITCH_TELEPORT_NPC]
|
||||
pbReceiveItem(:HM07)
|
||||
end
|
||||
|
||||
# Fly
|
||||
if $PokemonBag.pbQuantity(:HM02) < 1 && $game_self_switches[[439, 1, "B"]]
|
||||
pbReceiveItem(:HM02)
|
||||
end
|
||||
|
||||
# Waterfall
|
||||
if $PokemonBag.pbQuantity(:HM05) < 1 && $game_switches[SWITCH_GOT_WATERFALL]
|
||||
pbReceiveItem(:HM05)
|
||||
end
|
||||
|
||||
# Dive
|
||||
if $PokemonBag.pbQuantity(:HM06) < 1 && $game_switches[SWITCH_GOT_DIVE]
|
||||
pbReceiveItem(:HM06)
|
||||
end
|
||||
|
||||
# Rock Climb
|
||||
if $PokemonBag.pbQuantity(:HM10) < 1 && $game_switches[SWITCH_GOT_ROCK_CLIMB]
|
||||
pbReceiveItem(:HM10)
|
||||
end
|
||||
end
|
||||
|
||||
def fixFinishedRocketQuests()
|
||||
fix_broken_TR_quests()
|
||||
|
||||
var_tr_missions_cerulean = 288
|
||||
|
||||
switch_tr_mission_cerulean_4 = 1116
|
||||
switch_tr_mission_celadon_1 = 1084
|
||||
switch_tr_mission_celadon_2 = 1086
|
||||
switch_tr_mission_celadon_3 = 1088
|
||||
switch_tr_mission_celadon_4 = 1110
|
||||
switch_pinkan_done = 1119
|
||||
|
||||
nb_cerulean_missions = pbGet(var_tr_missions_cerulean)
|
||||
|
||||
finishTRQuest("tr_cerulean_1", :SUCCESS, true) if nb_cerulean_missions >= 1 && !pbCompletedQuest?("tr_cerulean_1")
|
||||
echoln pbCompletedQuest?("tr_cerulean_1")
|
||||
finishTRQuest("tr_cerulean_2", :SUCCESS, true) if nb_cerulean_missions >= 2 && !pbCompletedQuest?("tr_cerulean_2")
|
||||
finishTRQuest("tr_cerulean_3", :SUCCESS, true) if nb_cerulean_missions >= 3 && !pbCompletedQuest?("tr_cerulean_3")
|
||||
finishTRQuest("tr_cerulean_4", :SUCCESS, true) if $game_switches[switch_tr_mission_cerulean_4] && !pbCompletedQuest?("tr_cerulean_4")
|
||||
|
||||
finishTRQuest("tr_celadon_1", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_1] && !pbCompletedQuest?("tr_celadon_1")
|
||||
finishTRQuest("tr_celadon_2", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_2] && !pbCompletedQuest?("tr_celadon_2")
|
||||
finishTRQuest("tr_celadon_3", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_3] && !pbCompletedQuest?("tr_celadon_3")
|
||||
finishTRQuest("tr_celadon_4", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_4] && !pbCompletedQuest?("tr_celadon_4")
|
||||
|
||||
finishTRQuest("tr_pinkan", :SUCCESS, true) if $game_switches[switch_pinkan_done] && !pbCompletedQuest?("tr_pinkan")
|
||||
end
|
||||
|
||||
def fix_broken_TR_quests()
|
||||
for trainer_quest in $Trainer.quests
|
||||
if trainer_quest.id == 0 # tr quests were all set to ID 0 instead of their real ID in v 6.4.0
|
||||
for rocket_quest_id in TR_QUESTS.keys
|
||||
rocket_quest = TR_QUESTS[rocket_quest_id]
|
||||
next if !rocket_quest
|
||||
if trainer_quest.name == rocket_quest.name
|
||||
trainer_quest.id = rocket_quest_id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def fix_missing_infinite_splicers
|
||||
return unless Settings::KANTO
|
||||
obtained_infinite_splicers = $game_switches[275]
|
||||
obtained_upgraded_infinite_splicers = $game_self_switches[[703,4,"A"]]
|
||||
if obtained_infinite_splicers && pbQuantity(:INFINITESPLICERS) <= 0 && pbQuantity(:INFINITESPLICERS2) <= 0
|
||||
pbReceiveItem(:INFINITESPLICERS)
|
||||
end
|
||||
if obtained_upgraded_infinite_splicers && pbQuantity(:INFINITESPLICERS2) <= 0
|
||||
pbReceiveItem(:INFINITESPLICERS2)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,159 @@
|
||||
def splitSpriteCredits(name, bitmap, max_width)
|
||||
name_full_width = bitmap.text_size(name).width
|
||||
# use original name if can fit on one line
|
||||
return [ name ] if name_full_width <= max_width
|
||||
|
||||
temp_string = name
|
||||
name_split = []
|
||||
|
||||
# split name by collab separator " & " nearest to max width
|
||||
start_pos = temp_string.index(' & ')
|
||||
temp_pos = nil
|
||||
while start_pos && (bitmap.text_size(temp_string).width > max_width)
|
||||
substring_width = bitmap.text_size(temp_string[0, start_pos]).width
|
||||
if substring_width > max_width
|
||||
name_split << temp_string[0, temp_pos].strip
|
||||
temp_string = temp_string[(temp_pos + 1)..].strip
|
||||
start_pos = temp_string.index(' & ')
|
||||
temp_pos = nil
|
||||
next
|
||||
end
|
||||
|
||||
temp_pos = start_pos
|
||||
start_pos = temp_string.index(' & ', start_pos + 1)
|
||||
end
|
||||
|
||||
# append remainder of " & " split if within max width
|
||||
if temp_pos != nil
|
||||
name_split << temp_string[0, temp_pos].strip
|
||||
temp_string = temp_string[(temp_pos + 1)..].strip
|
||||
end
|
||||
|
||||
# split remaining string by space
|
||||
temp_pos = nil
|
||||
if (bitmap.text_size(temp_string).width > max_width) && (start_pos = temp_string.index(' '))
|
||||
while start_pos && (bitmap.text_size(temp_string).width > max_width)
|
||||
substring_width = bitmap.text_size(temp_string[0, start_pos]).width
|
||||
if substring_width > max_width
|
||||
name_split << temp_string[0, temp_pos].strip
|
||||
temp_string = temp_string[(temp_pos + 1)..].strip
|
||||
start_pos = temp_string.index(' ')
|
||||
temp_pos = nil
|
||||
next
|
||||
end
|
||||
|
||||
temp_pos = start_pos
|
||||
start_pos = temp_string.index(' ', start_pos + 1)
|
||||
end
|
||||
end
|
||||
|
||||
# append remaining text, even if too long for screen
|
||||
name_split << temp_string if temp_string != ''
|
||||
|
||||
return name_split
|
||||
end
|
||||
|
||||
def pbLoadPokemonBitmapSpecies(pokemon, species, back = false, scale = POKEMONSPRITESCALE)
|
||||
ret = nil
|
||||
pokemon = pokemon.pokemon if pokemon.respond_to?(:pokemon)
|
||||
if pokemon.isEgg?
|
||||
bitmapFileName = getEggBitmapPath(pokemon)
|
||||
bitmapFileName = pbResolveBitmap(bitmapFileName)
|
||||
elsif pokemon.species >= ZAPMOLCUNO_NB #zapmolcuno
|
||||
bitmapFileName = getSpecialSpriteName(pokemon.species) #sprintf("Graphics/Battlers/special/144.145.146")
|
||||
bitmapFileName = pbResolveBitmap(bitmapFileName)
|
||||
else
|
||||
#edited here
|
||||
isFusion = species > NB_POKEMON
|
||||
if isFusion
|
||||
poke1 = getBodyID(species)
|
||||
poke2 = getHeadID(species, poke1)
|
||||
else
|
||||
poke1 = species
|
||||
poke2 = species
|
||||
end
|
||||
bitmapFileName = GetSpritePath(poke1, poke2, isFusion)
|
||||
# Alter bitmap if supported
|
||||
alterBitmap = (MultipleForms.getFunction(species, "alterBitmap") rescue nil)
|
||||
end
|
||||
if bitmapFileName && alterBitmap
|
||||
animatedBitmap = AnimatedBitmap.new(bitmapFileName)
|
||||
copiedBitmap = animatedBitmap.copy
|
||||
animatedBitmap.dispose
|
||||
copiedBitmap.each { |bitmap| alterBitmap.call(pokemon, bitmap) }
|
||||
ret = copiedBitmap
|
||||
elsif bitmapFileName
|
||||
ret = AnimatedBitmap.new(bitmapFileName)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbPokemonBitmapFile(species)
|
||||
# Used by the Pokédex
|
||||
# Load normal bitmap
|
||||
#get body and head num
|
||||
isFused = species > NB_POKEMON
|
||||
if isFused
|
||||
if species >= ZAPMOLCUNO_NB
|
||||
path = getSpecialSpriteName(species) + ".png"
|
||||
else
|
||||
poke1 = getBodyID(species) #getBasePokemonID(species,true)
|
||||
poke2 = getHeadID(species, poke1) #getBasePokemonID(species,false)
|
||||
path = GetSpritePath(poke1, poke2, isFused)
|
||||
end
|
||||
else
|
||||
path = GetSpritePath(species, species, false)
|
||||
end
|
||||
ret = sprintf(path) rescue nil
|
||||
if !pbResolveBitmap(ret)
|
||||
ret = "Graphics/Battlers/000.png"
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
def pbLoadPokemonBitmap(pokemon, species, back = false)
|
||||
#species est utilisé par elitebattle mais ca sert a rien
|
||||
return pbLoadPokemonBitmapSpecies(pokemon, pokemon.species, back)
|
||||
end
|
||||
|
||||
def getEggBitmapPath(pokemon)
|
||||
return "Graphics/Battlers/Eggs/000" if $PokemonSystem.hide_custom_eggs
|
||||
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%s", getConstantName(PBSpecies, pokemon.species)) rescue nil
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
if pokemon.species >= NUM_ZAPMOLCUNO
|
||||
bitmapFileName = "Graphics/Battlers/Eggs/egg_base"
|
||||
else
|
||||
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%03d", pokemon.species)
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
bitmapFileName = sprintf("Graphics/Battlers/Eggs/000")
|
||||
end
|
||||
end
|
||||
end
|
||||
return bitmapFileName
|
||||
end
|
||||
|
||||
def GetSpritePath(poke1, poke2, isFused)
|
||||
#Check if custom exists
|
||||
spritename = GetSpriteName(poke1, poke2, isFused)
|
||||
pathCustom = sprintf("Graphics/%s/indexed/%s/%s.png", DOSSIERCUSTOMSPRITES,poke2, spritename)
|
||||
pathReg = sprintf("Graphics/%s/%s/%s.png", BATTLERSPATH, poke2, spritename)
|
||||
path = pbResolveBitmap(pathCustom) && $game_variables[196] == 0 ? pathCustom : pathReg
|
||||
return path
|
||||
end
|
||||
|
||||
|
||||
def GetSpritePathForced(poke1, poke2, isFused)
|
||||
#Check if custom exists
|
||||
spritename = GetSpriteName(poke1, poke2, isFused)
|
||||
pathCustom = sprintf("Graphics/%s/indexed/%s/%s.png", DOSSIERCUSTOMSPRITES, poke2, spritename)
|
||||
pathReg = sprintf("Graphics/%s/%s/%s.png", BATTLERSPATH, poke2, spritename)
|
||||
path = pbResolveBitmap(pathCustom) ? pathCustom : pathReg
|
||||
return path
|
||||
end
|
||||
|
||||
|
||||
def GetSpriteName(poke1, poke2, isFused)
|
||||
ret = isFused ? sprintf("%d.%d", poke2, poke1) : sprintf("%d", poke2) rescue nil
|
||||
return ret
|
||||
end
|
||||
@@ -0,0 +1,115 @@
|
||||
def pbGetSelfSwitch(eventId, switch)
|
||||
return $game_self_switches[[@map_id, eventId, switch]]
|
||||
end
|
||||
|
||||
def find_newer_available_version
|
||||
latest_Version = fetch_latest_game_version
|
||||
return nil if !latest_Version
|
||||
return nil if is_higher_version(Settings::GAME_VERSION_NUMBER, latest_Version)
|
||||
return latest_Version
|
||||
end
|
||||
|
||||
def is_higher_version(gameVersion, latestVersion)
|
||||
gameVersion_parts = gameVersion.split('.').map(&:to_i)
|
||||
latestVersion_parts = latestVersion.split('.').map(&:to_i)
|
||||
|
||||
# Compare each part of the version numbers from left to right
|
||||
gameVersion_parts.each_with_index do |part, i|
|
||||
return true if (latestVersion_parts[i].nil? || part > latestVersion_parts[i])
|
||||
return false if part < latestVersion_parts[i]
|
||||
end
|
||||
return latestVersion_parts.length <= gameVersion_parts.length
|
||||
end
|
||||
|
||||
def get_current_game_difficulty
|
||||
return :EASY if $game_switches[SWITCH_GAME_DIFFICULTY_EASY]
|
||||
return :HARD if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
return :NORMAL
|
||||
end
|
||||
|
||||
def get_difficulty_text
|
||||
if $game_switches[SWITCH_GAME_DIFFICULTY_EASY]
|
||||
return _INTL("Easy")
|
||||
elsif $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
return _INTL("Hard")
|
||||
else
|
||||
return _INTL("Normal")
|
||||
end
|
||||
end
|
||||
|
||||
def getLatestSpritepackDate()
|
||||
return Time.new(Settings::NEWEST_SPRITEPACK_YEAR, Settings::NEWEST_SPRITEPACK_MONTH)
|
||||
end
|
||||
|
||||
def new_spritepack_was_released()
|
||||
current_spritepack_date = $PokemonGlobal.current_spritepack_date
|
||||
latest_spritepack_date = getLatestSpritepackDate()
|
||||
if !current_spritepack_date || (current_spritepack_date < latest_spritepack_date)
|
||||
$PokemonGlobal.current_spritepack_date = latest_spritepack_date
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def clearAllSelfSwitches(mapID, switch = "A", newValue = false)
|
||||
map = $MapFactory.getMap(mapID, false)
|
||||
map.events.each { |event_array|
|
||||
event_id = event_array[0]
|
||||
pbSetSelfSwitch(event_id, switch, newValue, mapID)
|
||||
}
|
||||
end
|
||||
|
||||
def openUrlInBrowser(url = "")
|
||||
begin
|
||||
# Open the URL in the default web browser
|
||||
system("xdg-open", url) || system("open", url) || system("start", url)
|
||||
rescue
|
||||
Input.clipboard = url
|
||||
pbMessage(_INTL("The game could not open the link in the browser"))
|
||||
pbMessage(_INTL("The link has been copied to your clipboard instead"))
|
||||
end
|
||||
end
|
||||
|
||||
# todo: implement
|
||||
def getMappedKeyFor(internalKey)
|
||||
|
||||
keybinding_fileName = "keybindings.mkxp1"
|
||||
path = System.data_directory + keybinding_fileName
|
||||
|
||||
parse_keybindings(path)
|
||||
|
||||
# echoln Keybindings.new(path).bindings
|
||||
end
|
||||
|
||||
def formatNumberToString(number)
|
||||
return number.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
|
||||
end
|
||||
|
||||
def optionsMenu(options = [], cmdIfCancel = -1, startingOption = 0)
|
||||
cmdIfCancel = -1 if !cmdIfCancel
|
||||
result = pbShowCommands(nil, options, cmdIfCancel, startingOption)
|
||||
# echoln "menuResult :#{result}"
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
def displaySpriteWindowWithMessage(pif_sprite, message = "", x = 0, y = 0, z = 0)
|
||||
spriteLoader = BattleSpriteLoader.new
|
||||
sprite_bitmap = spriteLoader.load_pif_sprite_directly(pif_sprite)
|
||||
if sprite_bitmap
|
||||
pictureWindow = PictureWindow.new(sprite_bitmap.bitmap)
|
||||
else
|
||||
pictureWindow = PictureWindow.new("")
|
||||
end
|
||||
|
||||
pictureWindow.opacity = 0
|
||||
pictureWindow.z = z
|
||||
pictureWindow.x = x
|
||||
pictureWindow.y = y
|
||||
pbMessage(message)
|
||||
pictureWindow.dispose
|
||||
end
|
||||
|
||||
def numeric_string?(str)
|
||||
str.match?(/\A\d+\z/)
|
||||
end
|
||||
Reference in New Issue
Block a user