mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
refactored fusing into its own method
This commit is contained in:
@@ -687,50 +687,7 @@ def drawPokemonType(pokemon_id, x_pos = 192, y_pos = 264)
|
|||||||
return viewport
|
return viewport
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFuse(pokemon, poke2, supersplicers = false)
|
|
||||||
|
|
||||||
newid = (pokemon.species) * NB_POKEMON + poke2.species
|
|
||||||
playingBGM = $game_system.getPlayingBGM
|
|
||||||
|
|
||||||
pathCustom = _INTL("Graphics/CustomBattlers/{1}.{2}.png", poke2.species, pokemon.species)
|
|
||||||
#pbResolveBitmap(pathCustom) && $game_variables[196]==0 ? pathCustom : pathReg
|
|
||||||
hasCustom = false
|
|
||||||
if (pbResolveBitmap(pathCustom))
|
|
||||||
picturePath = pathCustom
|
|
||||||
hasCustom = true
|
|
||||||
else
|
|
||||||
picturePath = _INTL("Graphics/Battlers/{1}/{1}.{2}.png", poke2.species, pokemon.species)
|
|
||||||
end
|
|
||||||
|
|
||||||
previewwindow = PictureWindow.new(picturePath)
|
|
||||||
|
|
||||||
if hasCustom
|
|
||||||
previewwindow.picture.pbSetColor(0, 255, 255, 200)
|
|
||||||
else
|
|
||||||
previewwindow.picture.pbSetColor(255, 255, 255, 200)
|
|
||||||
end
|
|
||||||
previewwindow.x = (Graphics.width / 2) - (previewwindow.width / 2)
|
|
||||||
previewwindow.y = ((Graphics.height - 96) / 2) - (previewwindow.height / 2)
|
|
||||||
previewwindow.z = 1000000
|
|
||||||
|
|
||||||
if (Kernel.pbConfirmMessage(_INTL("Fuse the two Pokémon?", newid)))
|
|
||||||
previewwindow.dispose
|
|
||||||
fus = PokemonFusionScene.new
|
|
||||||
if (fus.pbStartScreen(pokemon, poke2, newid))
|
|
||||||
returnItemsToBag(pokemon, poke2)
|
|
||||||
fus.pbFusionScreen(false, supersplicers)
|
|
||||||
$game_variables[126] += 1 #fuse counter
|
|
||||||
fus.pbEndScreen
|
|
||||||
scene.pbHardRefresh
|
|
||||||
pbBGMPlay(playingBGM)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
else
|
|
||||||
previewwindow.dispose
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
ItemHandlers::UseOnPokemon.add(:SUPERSPLICERS, proc { |item, pokemon, scene|
|
ItemHandlers::UseOnPokemon.add(:SUPERSPLICERS, proc { |item, pokemon, scene|
|
||||||
next true if pbDNASplicing(pokemon, scene, true, true)
|
next true if pbDNASplicing(pokemon, scene, true, true)
|
||||||
@@ -1333,11 +1290,33 @@ def pbDNASplicing(pokemon, scene, supersplicers = false, superSplicer = false)
|
|||||||
scene.pbDisplay(_INTL("A fainted Pokémon cannot be fused!"))
|
scene.pbDisplay(_INTL("A fainted Pokémon cannot be fused!"))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
if(pbFuse(pokemon,poke2,superSplicer))
|
||||||
|
pbRemovePokemonAt(chosen)
|
||||||
|
scene.pbHardRefresh
|
||||||
|
pbBGMPlay(playingBGM)
|
||||||
|
end
|
||||||
|
elsif pokemon == poke2
|
||||||
|
scene.pbDisplay(_INTL("{1} can't be fused with itself!", pokemon.name))
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
scene.pbDisplay(_INTL("{1} can't be fused with {2}.", poke2.name, pokemon.name))
|
||||||
|
return false
|
||||||
|
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
#UNFUSE
|
||||||
|
return true if pbUnfuse(pokemon,scene,supersplicers)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def pbFuse(pokemon,poke2,supersplicers=false)
|
||||||
newid = (pokemon.species_data.id_number) * NB_POKEMON + poke2.species_data.id_number
|
newid = (pokemon.species_data.id_number) * NB_POKEMON + poke2.species_data.id_number
|
||||||
|
|
||||||
pathCustom = _INTL("Graphics/CustomBattlers/{1}.{2}.png", poke2.species_data.id_number, pokemon.species_data.id_number)
|
pathCustom = _INTL("Graphics/CustomBattlers/{1}.{2}.png", poke2.species_data.id_number, pokemon.species_data.id_number)
|
||||||
#pbResolveBitmap(pathCustom) && $game_variables[196]==0 ? pathCustom : pathReg
|
|
||||||
hasCustom = false
|
hasCustom = false
|
||||||
if (pbResolveBitmap(pathCustom))
|
if (pbResolveBitmap(pathCustom))
|
||||||
picturePath = pathCustom
|
picturePath = pathCustom
|
||||||
@@ -1367,10 +1346,7 @@ def pbDNASplicing(pokemon, scene, supersplicers = false, superSplicer = false)
|
|||||||
returnItemsToBag(pokemon, poke2)
|
returnItemsToBag(pokemon, poke2)
|
||||||
fus.pbFusionScreen(false, supersplicers)
|
fus.pbFusionScreen(false, supersplicers)
|
||||||
$game_variables[126] += 1 #fuse counter
|
$game_variables[126] += 1 #fuse counter
|
||||||
pbRemovePokemonAt(chosen)
|
|
||||||
fus.pbEndScreen
|
fus.pbEndScreen
|
||||||
scene.pbHardRefresh
|
|
||||||
pbBGMPlay(playingBGM)
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1380,26 +1356,10 @@ def pbDNASplicing(pokemon, scene, supersplicers = false, superSplicer = false)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
elsif pokemon == poke2
|
|
||||||
scene.pbDisplay(_INTL("{1} can't be fused with itself!", pokemon.name))
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
scene.pbDisplay(_INTL("{1} can't be fused with {2}.", poke2.name, pokemon.name))
|
|
||||||
return false
|
|
||||||
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
#UNFUSE
|
|
||||||
return true if pbUnfuse(pokemon,scene,supersplicers)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def pbUnfuse(pokemon, scene,supersplicers)
|
def pbUnfuse(pokemon, scene,supersplicers,pcPosition=nil)
|
||||||
|
|
||||||
bodyPoke = getBasePokemonID(pokemon.species_data.id_number, true)
|
bodyPoke = getBasePokemonID(pokemon.species_data.id_number, true)
|
||||||
headPoke = getBasePokemonID(pokemon.species_data.id_number, false)
|
headPoke = getBasePokemonID(pokemon.species_data.id_number, false)
|
||||||
|
|||||||
Reference in New Issue
Block a user