Files
infinitefusion-e18/Data/Scripts/998_InfiniteFusion/Gameplay/Utils/PokemonUtils.rb
2025-04-24 19:46:52 -04:00

247 lines
8.0 KiB
Ruby

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 changeSpeciesSpecific(pokemon, newSpecies)
pokemon.species = newSpecies
$Trainer.pokedex.set_seen(newSpecies)
$Trainer.pokedex.set_owned(newSpecies)
end
def setPokemonMoves(pokemon, move_ids = [])
moves = []
move_ids.each { |move_id|
moves << Pokemon::Move.new(move_id)
}
pokemon.moves = moves
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 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
def changeOricorioForm(pokemon, form = nil)
oricorio_forms = [:ORICORIO_1, :ORICORIO_2, :ORICORIO_3, :ORICORIO_4]
body_id = pokemon.isFusion? ? get_body_species_from_symbol(pokemon.species) : pokemon.species
head_id = pokemon.isFusion? ? get_head_species_from_symbol(pokemon.species) : pokemon.species
oricorio_body = oricorio_forms.include?(body_id)
oricorio_head = oricorio_forms.include?(head_id)
if form == 1
body_id = :ORICORIO_1 if oricorio_body
head_id = :ORICORIO_1 if oricorio_head
elsif form == 2
body_id = :ORICORIO_2 if oricorio_body
head_id = :ORICORIO_2 if oricorio_head
elsif form == 3
body_id = :ORICORIO_3 if oricorio_body
head_id = :ORICORIO_3 if oricorio_head
elsif form == 4
body_id = :ORICORIO_4 if oricorio_body
head_id = :ORICORIO_4 if oricorio_head
else
return false
end
head_number = getDexNumberForSpecies(head_id)
body_number = getDexNumberForSpecies(body_id)
newForm = pokemon.isFusion? ? getSpeciesIdForFusion(head_number, body_number) : head_id
$Trainer.pokedex.set_seen(newForm)
$Trainer.pokedex.set_owned(newForm)
pokemon.species = newForm
return true
end
def changeOricorioFlower(form = 1)
if $PokemonGlobal.stepcount % 25 == 0
if !hatUnlocked?(HAT_FLOWER) && rand(2) == 0
obtainHat(HAT_FLOWER)
$PokemonGlobal.stepcount += 1
else
pbMessage(_INTL("Woah! A Pokémon jumped out of the flower!"))
pbWildBattle(:FOMANTIS, 10)
$PokemonGlobal.stepcount += 1
end
end
return if !($Trainer.has_species_or_fusion?(:ORICORIO_1) || $Trainer.has_species_or_fusion?(:ORICORIO_2) || $Trainer.has_species_or_fusion?(:ORICORIO_3) || $Trainer.has_species_or_fusion?(:ORICORIO_4))
message = ""
form_name = ""
if form == 1
message = "It's a flower with red nectar. "
form_name = "Baile"
elsif form == 2
message = "It's a flower with yellow nectar. "
form_name = "Pom-pom"
elsif form == 3
message = "It's a flower with pink nectar. "
form_name = "Pa'u"
elsif form == 4
message = "It's a flower with blue nectar. "
form_name = "Sensu"
end
message = message + "Show it to a Pokémon?"
if pbConfirmMessage(message)
pbChoosePokemon(1, 2,
proc { |poke|
!poke.egg? &&
(Kernel.isPartPokemon(poke, :ORICORIO_1) ||
Kernel.isPartPokemon(poke, :ORICORIO_2) ||
Kernel.isPartPokemon(poke, :ORICORIO_3) ||
Kernel.isPartPokemon(poke, :ORICORIO_4))
})
if (pbGet(1) != -1)
poke = $Trainer.party[pbGet(1)]
if changeOricorioForm(poke, form)
pbMessage(_INTL("{1} switched to the {2} style", poke.name, form_name))
pbSet(1, poke.name)
else
pbMessage(_INTL("{1} remained the same...", poke.name, form_name))
end
end
end
end
def oricorioEventPickFlower(flower_color)
quest_progression = pbGet(VAR_ORICORIO_FLOWERS)
if flower_color == :PINK
if !$game_switches[SWITCH_ORICORIO_QUEST_PINK]
pbMessage(_INTL("Woah! A Pokémon jumped out of the flower!"))
pbWildBattle(:FOMANTIS, 10)
end
$game_switches[SWITCH_ORICORIO_QUEST_PINK] = true
pbMessage(_INTL("It's a flower with pink nectar."))
pbSEPlay("MiningAllFound")
pbMessage(_INTL("{1} picked some of the pink flowers.", $Trainer.name))
elsif flower_color == :RED && quest_progression == 1
$game_switches[SWITCH_ORICORIO_QUEST_RED] = true
pbMessage(_INTL("It's a flower with red nectar."))
pbSEPlay("MiningAllFound")
pbMessage(_INTL("{1} picked some of the red flowers.", $Trainer.name))
elsif flower_color == :BLUE && quest_progression == 2
$game_switches[SWITCH_ORICORIO_QUEST_BLUE] = true
pbMessage(_INTL("It's a flower with blue nectar."))
pbSEPlay("MiningAllFound")
pbMessage(_INTL("{1} picked some of the blue flowers.", $Trainer.name))
end
end