Adds factory for Pokemon class

This commit is contained in:
infinitefusion
2023-08-05 11:03:37 -04:00
parent 178d61eec0
commit d304d223bd
33 changed files with 54 additions and 43 deletions

View File

@@ -1,193 +0,0 @@
def pbSpecialTutor(pokemon,legendaries=false)
retval = true
tutorUtil = FusionTutorService.new(pokemon)
pbFadeOutIn {
scene = MoveRelearner_Scene.new
screen = MoveRelearnerScreen.new(scene)
moves = tutorUtil.getCompatibleMoves(legendaries)
if !moves.empty?
retval = screen.pbStartScreen(pokemon, moves)
else
return false
end
}
return retval
end
def pbShowRareTutorFullList(includeLegendaries = false)
tutorUtil = FusionTutorService.new(nil)
tutorUtil.setShowList(true)
pbFadeOutIn {
scene = MoveRelearner_Scene.new
screen = MoveRelearnerScreen.new(scene)
moves = tutorUtil.getCompatibleMoves(includeLegendaries)
screen.pbStartScreen(nil, moves)
}
return false
end
def pbCheckRareTutorCompatibleMoves(pokemon, includeLeshgendaries)
tutorUtil = FusionTutorService.new(pokemon)
return tutorUtil.has_compatible_move(includeLeshgendaries)
end
def showRandomRareMoveConditionExample(legendary = false)
example = legendary ? getlegendaryConditionExample : getRegularConditionExample
text = "For example, " + example
pbMessage(text)
end
def getRegularConditionExample()
list = [
"a Sandslash fusion which has the electric type will be able to learn the move Zing Zap.",
"any Pokémon that is both Flying and Fighting type will be able to learn the move Flying Press.",
"the move Shadow Bone can only be learned by ghost-type Marowak fusions.",
"any Pokémon that is both Ghost and Grass type will be able to learn the move Trick or Treat.",
"the move Forest's Curse can only be learned by Ghost/Grass typed Pokémon.",
"a grass-type fusion of a spiky Pokémon such as Jolteon will be able to learn the move Spiky Shield.",
"only a ground-type fusion of Grimer or Muk will be able to learn the move Shore Up.",
"any ice-type fusion that can already learn the move Crabhammer will also be able to learn the move Ice Hammer.",
"only water-type fusions of a ninja-like Pokémon such as Ninjask or Zoroark will be able to learn the move Water Shuriken.",
]
return list.sample
end
def getlegendaryConditionExample()
list = [
"any Rotom fusion that can already learn the move Thunder Punch can also be taught the move Plasma Fists.",
"only an Electric-type fusion of a legendary Ice-type Pokémon will be able to learn the move Freeze Shock.",
"only a Fire-type fusion of a legendary Ice-type Pokémon will be able to learn the move Ice Burn.",
"any Pokémon that is both Flying and Dark type will be able to learn the move Oblivion Wing.",
"a ground-type fusion of a spiky Pokémon such as Ferrothorn will be able to learn the move Thousand Arrows.",
"any steel-type Pokémon that can already learn the move Double Slap will be able to learn Double Iron Bash.",
"any Pokémon that is both Fairy and Rock type will be able to learn the move Diamond Storm.",
"any water-type Pokémon that can already learn the move Eruption can also be taught the move Steam Eruption",
]
return list.sample
end
class FusionTutorService
def has_compatible_move(include_legendaries = false)
return !getCompatibleMoves(include_legendaries).empty?
end
def initialize(pokemon)
@pokemon = pokemon
@show_full_list = false
end
def setShowList(value)
@show_full_list = value
end
def getCompatibleMoves(includeLegendaries = false)
compatibleMoves = []
#normal moves
if !includeLegendaries
compatibleMoves << :ATTACKORDER if is_fusion_of([:BEEDRILL])
compatibleMoves << :FIRSTIMPRESSION if is_fusion_of([:SCYTHER, :SCIZOR, :PINSIR, :FARFETCHD, :TRAPINCH, :VIBRAVA, :FLYGON, :KABUTOPS, :ARMALDO])
compatibleMoves << :POLLENPUFF if is_fusion_of([:BUTTERFREE, :CELEBI, :VILEPLUME, :PARASECT, :BRELOOM])
compatibleMoves << :LUNGE if is_fusion_of([:SPINARAK, :ARIADOS, :JOLTIK, :GALVANTULA, :VENOMOTH, :VOLCARONA, :PINSIR, :PARASECT, :LEDIAN, :DODUO, :DODRIO, :STANTLER])
compatibleMoves << :DEFENDORDER if is_fusion_of([:BEEDRILL])
compatibleMoves << :HEALORDER if is_fusion_of([:BEEDRILL])
compatibleMoves << :POWDER if is_fusion_of([:BUTTERFREE, :VENOMOTH, :VOLCARONA, :PARASECT, :BRELOOM])
compatibleMoves << :TAILGLOW if is_fusion_of([:MAREEP, :FLAAFFY, :AMPHAROS, :LANTURN, :ZEKROM, :RESHIRAM])
compatibleMoves << :DARKESTLARIAT if is_fusion_of([:SNORLAX, :REGIGIGAS, :POLIWRATH, :MACHAMP, :ELECTIVIRE, :DUSKNOIR, :SWAMPERT, :KROOKODILE, :GOLURK])
compatibleMoves << :PARTINGSHOT if is_fusion_of([:MEOWTH, :PERSIAN, :SANDILE, :KROKOROK, :KROOKODILE, :UMBREON])
compatibleMoves << :TOPSYTURVY if is_fusion_of([:HITMONTOP, :WOBBUFFET])
compatibleMoves << :CLANGINGSCALES if is_fusion_of([:EKANS, :ARBOK, :GARCHOMP, :FLYGON, :HAXORUS])
compatibleMoves << :ZINGZAP if is_fusion_of([:PICHU, :PIKACHU, :RAICHU, :VOLTORB, :ELECTRODE]) || (is_fusion_of([:SANDSLASH, :GOLEM]) && hasType(:ELECTRIC))
compatibleMoves << :PARABOLICCHARGE if is_fusion_of([:PICHU, :PIKACHU, :RAICHU, :MAGNEMITE, :MAGNETON, :MAGNEZONE, :MAREEP, :FLAAFFY, :AMPHAROS, :ELEKID, :ELECTABUZZ, :ELECTIVIRE, :ZAPDOS, :CHINCHOU, :LANTURN, :RAIKOU, :KLINK, :KLANG, :KLINKLANG, :ROTOM, :STUNFISK])
compatibleMoves << :ELECTRIFY if is_fusion_of([:KLINK, :KLANG, :KLINKLANG]) || hasType(:ELECTRIC)
compatibleMoves << :AROMATICMIST if is_fusion_of([:WEEZING, :BULBASAUR, :IVYSAUR, :VENUSAUR, :CHIKORITA, :BAYLEEF, :MEGANIUM, :GLOOM, :VILEPLUME, :BELLOSSOM, :ROSELIA, :ROSERADE])
compatibleMoves << :FLORALHEALING if is_fusion_of([:SUNFLORA, :BELLOSSOM, :ROSELIA, :ROSERADE])
compatibleMoves << :FLYINGPRESS if is_fusion_of([:TORCHIC, :COMBUSKEN, :BLAZIKEN, :FARFETCHD, :HERACROSS]) || (hasType(:FLYING) && hasType(:FIGHTING))
compatibleMoves << :SECRETSWORD if is_fusion_of([:HONEDGE, :DOUBLADE, :AEGISLASH, :GALLADE, :FARFETCHD, :ABSOL, :BISHARP])
compatibleMoves << :MATBLOCK if is_fusion_of([:MACHOP, :MACHOKE, :MACHAMP, :TYROGUE, :HITMONLEE, :HITMONCHAN, :HITMONTOP])
compatibleMoves << :MINDBLOWN if is_fusion_of([:VOLTORB, :ELECTRODE, :EXEGGUTOR])
compatibleMoves << :SHELLTRAP if is_fusion_of([:MAGCARGO, :FORRETRESS])
compatibleMoves << :HEATCRASH if is_fusion_of([:BLAZIKEN, :RESHIRAM, :GROUDON, :CHARIZARD, :GOLURK, :REGIGIGAS, :RHYDON, :RHYPERIOR, :SNORLAX])
compatibleMoves << :SHADOWBONE if is_fusion_of([:MAROWAK]) && hasType(:GHOST)
compatibleMoves << :SPIRITSHACKLE if is_fusion_of([:BANETTE, :SPIRITOMB, :DUSKNOIR, :SHEDINJA, :COFAGRIGUS])
compatibleMoves << :TRICKORTREAT if (hasType(:GRASS) && hasType(:GHOST)) || is_fusion_of([:GASTLY, :HAUNTER, :GENGAR, :MIMIKYU, :ZORUA, :ZOROARK])
compatibleMoves << :TROPKICK if is_fusion_of([:HITMONLEE, :HITMONTOP, :ROSERADE]) || (hasType(:GRASS) && hasType(:FIGHTING))
compatibleMoves << :NEEDLEARM if is_fusion_of([:FERROTHORN])
compatibleMoves << :FORESTSCURSE if (hasType(:GRASS) && hasType(:GHOST))
compatibleMoves << :SPIKYSHIELD if is_fusion_of([:FERROSEED, :FERROTHORN]) || (is_fusion_of([:SANDSLASH, :JOLTEON, :CLOYSTER]) && hasType(:GRASS))
compatibleMoves << :STRENGTHSAP if is_fusion_of([:ODDISH, :GLOOM, :VILEPLUME, :BELLOSSOM, :HOPPIP, :SKIPLOOM, :JUMPLUFF, :BELLSPROUT, :WEEPINBELL, :VICTREEBEL, :PARAS, :PARASECT, :DRIFBLIM, :BRELOOM])
compatibleMoves << :SHOREUP if is_fusion_of([:GRIMER, :MUK]) && hasType(:GROUND)
compatibleMoves << :ICEHAMMER if (canLearnMove(:CRABHAMMER) || canLearnMove(:GRASSHAMMER)) && hasType(:ICE)
compatibleMoves << :MULTIATTACK if is_fusion_of([:ARCEUS, :MEW, :GENESECT])
compatibleMoves << :REVELATIONDANCE if is_fusion_of([:KECLEON, :BELLOSSOM, :CLEFAIRY, :CLEFABLE, :CLEFFA])
compatibleMoves << :BANEFULBUNKER if is_fusion_of([:TENTACOOL, :TENTACRUEL, :NIDORINA, :NIDORINO, :NIDOQUEEN, :NIDOKING, :GRIMER, :MUK, :QWILFISH])
compatibleMoves << :INSTRUCT if is_fusion_of([:CHIMCHAR, :MONFERNO, :INFERNAPE, :KADABRA, :ALAKAZAM, :SLOWKING])
compatibleMoves << :PSYCHICTERRAIN if hasType(:PSYCHIC)
compatibleMoves << :GRASSYTERRAIN if hasType(:GRASS)
compatibleMoves << :MISTYTERRAIN if hasType(:FAIRY)
compatibleMoves << :SPEEDSWAP if is_fusion_of([:PIKACHU, :RAICHU, :ABRA, :KADABRA, :ALAKAZAM, :PORYGON, :PORYGON2, :PORYGONZ, :MEWTWO, :MEW, :JOLTIK, :GALVANTULA])
compatibleMoves << :ACCELEROCK if is_fusion_of([:AERODACTYL, :KABUTOPS, :ANORITH, :ARMALDO])
compatibleMoves << :ANCHORSHOT if (is_fusion_of([:EMPOLEON, :STEELIX, :BELDUM, :METANG, :METAGROSS, :KLINK, :KLINKLANG, :KLANG, :ARON, :LAIRON, :AGGRON]) && hasType(:WATER)) || (is_fusion_of([:LAPRAS, :WAILORD, :KYOGRE]) && hasType(:STEEL))
compatibleMoves << :SPARKLINGARIA if (is_fusion_of([:JYNX, :JIGGLYPUFF, :WIGGLYTUFF]) && hasType(:WATER)) || is_fusion_of([:LAPRAS])
compatibleMoves << :WATERSHURIKEN if is_fusion_of([:NINJASK, :LUCARIO, :ZOROARK, :BISHARP]) && hasType(:WATER)
end
if includeLegendaries
#legendary moves (only available after a certain trigger, maybe a different npc)
compatibleMoves << :HYPERSPACEFURY if is_fusion_of([:GIRATINA, :PALKIA, :DIALGA, :ARCEUS])
compatibleMoves << :COREENFORCER if is_fusion_of([:GIRATINA, :PALKIA, :DIALGA, :RAYQUAZA])
compatibleMoves << :PLASMAFISTS if is_fusion_of([:ELECTABUZZ, :ELECTIVIRE, :ZEKROM]) || (is_fusion_of([:ROTOM]) && canLearnMove(:THUNDERPUNCH))
compatibleMoves << :LIGHTOFRUIN if is_fusion_of([:ARCEUS, :MEW, :CELEBI, :JIRACHI])
compatibleMoves << :FLEURCANNON if is_fusion_of([:GARDEVOIR, :GALLADE, :SYLVEON, :WIGGLYTUFF])
compatibleMoves << :NATURESMADNESS if is_fusion_of([:CELEBI, :KYOGRE, :GROUDON, :ABSOL])
compatibleMoves << :GEOMANCY if is_fusion_of([:CELEBI])
compatibleMoves << :VCREATE if is_fusion_of([:ENTEI, :HOOH, :TYPHLOSION])
compatibleMoves << :MAGMASTORM if is_fusion_of([:MAGCARGO, :TYPHLOSION, :MAGMORTAR, :MAGMAR, :ENTEI, :GROUDON]) || canLearnMove(:ERUPTION)
compatibleMoves << :SEARINGSHOT if is_fusion_of([:MAGMORTAR])
compatibleMoves << :OBLIVIONWING if is_fusion_of([:MURKROW, :HONCHKROW]) || (hasType(:DARK) && hasType(:FLYING))
compatibleMoves << :MOONGEISTBEAM if (is_fusion_of([:CLEFFA, :CLEFAIRY, :CLEFABLE]) && hasType(:DARK)) || is_fusion_of([:DARKRAI, :MISDREAVUS, :MISMAGIUS])
compatibleMoves << :SPECTRALTHIEF if is_fusion_of([:HAUNTER, :GENGAR, :BANETTE, :GIRATINA, :HONEDGE, :DOUBLADE, :AEGISLASH])
compatibleMoves << :SEEDFLARE if is_fusion_of([:JUMPLUFF, :SUNFLORA])
compatibleMoves << :LANDSWRATH if is_fusion_of([:GROUDON])
compatibleMoves << :THOUSANDARROWS if is_fusion_of([:SANDSLASH, :JOLTEON, :FERROTHORN]) && hasType(:GROUND)
compatibleMoves << :THOUSANDWAVES if is_fusion_of([:STUNFISK, :QUAGSIRE, :SWAMPERT])
compatibleMoves << :FREEZESHOCK if is_fusion_of([:KYUREM, :ARTICUNO]) && hasType(:ELECTRIC)
compatibleMoves << :ICEBURN if is_fusion_of([:KYUREM, :ARTICUNO]) && hasType(:FIRE)
compatibleMoves << :RELICSONG if is_fusion_of([:JYNX, :LAPRAS, :JIGGLYPUFF, :WIGGLYTUFF, :MISDREAVUS, :MISMAGIUS])
compatibleMoves << :HAPPYHOUR if is_fusion_of([:MEOWTH, :JIRACHI, :DELIBIRD, :MUNCHLAX, :SNORLAX, :PIKACHU, :RAICHU])
compatibleMoves << :HOLDHANDS if is_fusion_of([:CHARMANDER, :BULBASAUR, :SQUIRTLE, :PIKACHU, :TOGEPI])
compatibleMoves << :PRISMATICLASER if is_fusion_of([:LANTURN, :AMPHAROS, :HOOH, :DEOXYS, :MEWTWO, :MEW]) && hasType(:PSYCHIC)
compatibleMoves << :PHOTONGEYSER if is_fusion_of([:LANTURN, :AMPHAROS, :HOOH, :MEW, :MEWTWO, :DEOXYS]) && hasType(:PSYCHIC)
compatibleMoves << :LUNARDANCE if is_fusion_of([:CLEFAIRY, :CLEFABLE, :STARYU, :STARMIE])
compatibleMoves << :DIAMONDSTORM if ((hasType(:FAIRY) && hasType(:ROCK)) || (hasType(:ROCK) && hasType(:STEEL))) || is_fusion_of([:DIALGA, :STEELIX])
compatibleMoves << :SUNSTEELSTRIKE if is_fusion_of([:CHARIZARD, :VOLCARONA, :FLAREON, :NINETALES, :ENTEI, :HOOH, :RAPIDASH]) && hasType(:STEEL)
compatibleMoves << :DOUBLEIRONBASH if canLearnMove(:DOUBLESLAP) && hasType(:STEEL)
compatibleMoves << :STEAMERUPTION if canLearnMove(:ERUPTION) && hasType(:WATER)
end
return compatibleMoves
end
def is_fusion_of(pokemonList)
return true if @show_full_list
is_species = false
for fusionPokemon in pokemonList
if @pokemon.isFusionOf(fusionPokemon)
is_species = true
end
end
return is_species
end
def hasType(type)
return true if @show_full_list
return @pokemon.hasType?(type)
end
def canLearnMove(move)
return true if @show_full_list
return @pokemon.compatible_with_move?(move)
end
end

View File

@@ -1,236 +0,0 @@
module GameData
class Species
def self.sprite_bitmap_from_pokemon(pkmn, back = false, species = nil)
species = pkmn.species if !species
species = GameData::Species.get(species).id_number # Just to be sure it's a number
return self.egg_sprite_bitmap(species, pkmn.form) if pkmn.egg?
if back
ret = self.back_sprite_bitmap(species, nil, nil, pkmn.shiny?,pkmn.bodyShiny?,pkmn.headShiny?)
else
ret = self.front_sprite_bitmap(species, nil, nil, pkmn.shiny?,pkmn.bodyShiny?,pkmn.headShiny?)
end
return ret
end
def self.sprite_bitmap_from_pokemon_id(id, back = false, shiny=false, bodyShiny=false,headShiny=false)
if back
ret = self.back_sprite_bitmap(id,nil,nil,shiny,bodyShiny,headShiny)
else
ret = self.front_sprite_bitmap(id,nil,nil,shiny,bodyShiny,headShiny)
end
return ret
end
MAX_SHIFT_VALUE = 360
MINIMUM_OFFSET=40
ADDITIONAL_OFFSET_WHEN_TOO_CLOSE=40
MINIMUM_DEX_DIF=20
def self.calculateShinyHueOffset(dex_number, isBodyShiny = false, isHeadShiny = false)
if dex_number <= NB_POKEMON
if SHINY_COLOR_OFFSETS[dex_number]
return SHINY_COLOR_OFFSETS[dex_number]
end
body_number = dex_number
head_number=dex_number
else
body_number = getBodyID(dex_number)
head_number=getHeadID(dex_number,body_number)
end
if isBodyShiny && isHeadShiny && SHINY_COLOR_OFFSETS[body_number] && SHINY_COLOR_OFFSETS[head_number]
offset = SHINY_COLOR_OFFSETS[body_number] + SHINY_COLOR_OFFSETS[head_number]
elsif isHeadShiny && SHINY_COLOR_OFFSETS[head_number]
offset = SHINY_COLOR_OFFSETS[head_number]
elsif isBodyShiny && SHINY_COLOR_OFFSETS[body_number]
offset = SHINY_COLOR_OFFSETS[body_number]
else
offset = calculateShinyHueOffsetDefaultMethod(body_number,head_number,dex_number,isBodyShiny,isHeadShiny)
end
return offset
end
def self.calculateShinyHueOffsetDefaultMethod(body_number,head_number,dex_number, isBodyShiny = false, isHeadShiny = false)
dex_offset = dex_number
#body_number = getBodyID(dex_number)
#head_number=getHeadID(dex_number,body_number)
dex_diff = (body_number-head_number).abs
if isBodyShiny && isHeadShiny
dex_offset = dex_number
elsif isHeadShiny
dex_offset = head_number
elsif isBodyShiny
dex_offset = dex_diff > MINIMUM_DEX_DIF ? body_number : body_number+ADDITIONAL_OFFSET_WHEN_TOO_CLOSE
end
offset = dex_offset + Settings::SHINY_HUE_OFFSET
offset /= MAX_SHIFT_VALUE if offset > NB_POKEMON
offset = MINIMUM_OFFSET if offset < MINIMUM_OFFSET
offset = MINIMUM_OFFSET if (MAX_SHIFT_VALUE - offset).abs < MINIMUM_OFFSET
offset += pbGet(VAR_SHINY_HUE_OFFSET) #for testing - always 0 during normal gameplay
return offset
end
def self.front_sprite_bitmap(dex_number, a = 0, b = 0, isShiny = false, bodyShiny = false, headShiny = false)
#la méthode est utilisé ailleurs avec d'autres arguments (gender, form, etc.) mais on les veut pas
if dex_number.is_a?(Symbol)
dex_number = GameData::Species.get(dex_number).id_number
end
filename = self.sprite_filename(dex_number)
sprite = (filename) ? AnimatedBitmap.new(filename) : nil
if isShiny
sprite.shiftColors(self.calculateShinyHueOffset(dex_number, bodyShiny, headShiny))
end
return sprite
end
def self.back_sprite_bitmap(dex_number, b = 0, form = 0, isShiny = false, bodyShiny = false, headShiny = false)
filename = self.sprite_filename(dex_number)
sprite = (filename) ? AnimatedBitmap.new(filename) : nil
if isShiny
sprite.shiftColors(self.calculateShinyHueOffset(dex_number, bodyShiny, headShiny))
end
return sprite
end
def self.egg_sprite_bitmap(dex_number, form = 0)
filename = self.egg_sprite_filename(dex_number, form)
return (filename) ? AnimatedBitmap.new(filename) : nil
end
def self.getSpecialSpriteName(dexNum)
base_path = "Graphics/Battlers/special/"
case dexNum
when Settings::ZAPMOLCUNO_NB..Settings::ZAPMOLCUNO_NB + 1
return sprintf(base_path + "144.145.146")
when Settings::ZAPMOLCUNO_NB + 2
return sprintf(base_path + "243.244.245")
when Settings::ZAPMOLCUNO_NB + 3
return sprintf(base_path +"340.341.342")
when Settings::ZAPMOLCUNO_NB + 4
return sprintf(base_path +"343.344.345")
when Settings::ZAPMOLCUNO_NB + 5
return sprintf(base_path +"349.350.351")
when Settings::ZAPMOLCUNO_NB + 6
return sprintf(base_path +"151.251.381")
when Settings::ZAPMOLCUNO_NB + 11
return sprintf(base_path +"150.348.380")
#starters
when Settings::ZAPMOLCUNO_NB + 7
return sprintf(base_path +"3.6.9")
when Settings::ZAPMOLCUNO_NB + 8
return sprintf(base_path +"154.157.160")
when Settings::ZAPMOLCUNO_NB + 9
return sprintf(base_path +"278.281.284")
when Settings::ZAPMOLCUNO_NB + 10
return sprintf(base_path +"318.321.324")
#starters prevos
when Settings::ZAPMOLCUNO_NB + 12
return sprintf(base_path +"1.4.7")
when Settings::ZAPMOLCUNO_NB + 13
return sprintf(base_path +"2.5.8")
when Settings::ZAPMOLCUNO_NB + 14
return sprintf(base_path +"152.155.158")
when Settings::ZAPMOLCUNO_NB + 15
return sprintf(base_path +"153.156.159")
when Settings::ZAPMOLCUNO_NB + 16
return sprintf(base_path +"276.279.282")
when Settings::ZAPMOLCUNO_NB + 17
return sprintf(base_path +"277.280.283")
when Settings::ZAPMOLCUNO_NB + 18
return sprintf(base_path +"316.319.322")
when Settings::ZAPMOLCUNO_NB + 19
return sprintf(base_path +"317.320.323")
when Settings::ZAPMOLCUNO_NB + 20 #birdBoss Left
return sprintf(base_path +"invisible")
when Settings::ZAPMOLCUNO_NB + 21 #birdBoss middle
return sprintf(base_path + "144.145.146")
when Settings::ZAPMOLCUNO_NB + 22 #birdBoss right
return sprintf(base_path +"invisible")
when Settings::ZAPMOLCUNO_NB + 23 #sinnohboss left
return sprintf(base_path +"invisible")
when Settings::ZAPMOLCUNO_NB + 24 #sinnohboss middle
return sprintf(base_path +"343.344.345")
when Settings::ZAPMOLCUNO_NB + 25 #sinnohboss right
return sprintf(base_path +"invisible")
else
return sprintf(base_path + "000")
end
end
def self.sprite_filename(dex_number)
return nil if dex_number == nil
if dex_number <= Settings::NB_POKEMON
return get_unfused_sprite_path(dex_number)
else
if dex_number >= Settings::ZAPMOLCUNO_NB
specialPath = getSpecialSpriteName(dex_number)
return pbResolveBitmap(specialPath)
head_id=nil
else
body_id = getBodyID(dex_number)
head_id = getHeadID(dex_number, body_id)
return get_fusion_sprite_path(head_id,body_id)
# folder = head_id.to_s
# filename = sprintf("%s.%s.png", head_id, body_id)
end
end
# customPath = pbResolveBitmap(Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + "/" + head_id.to_s + "/" +filename)
# customPath = download_custom_sprite(head_id,body_id)
#
# species = getSpecies(dex_number)
# use_custom = customPath && !species.always_use_generated
# if use_custom
# return customPath
# end
# #return Settings::BATTLERS_FOLDER + folder + "/" + filename
# return download_autogen_sprite(head_id,body_id)
end
end
end
def get_unfused_sprite_path(dex_number)
folder = dex_number.to_s
filename = sprintf("%s.png", dex_number)
if alt_sprites_substitutions_available && $PokemonGlobal.alt_sprite_substitutions.keys.include?(dex_number)
return $PokemonGlobal.alt_sprite_substitutions[dex_number]
end
normal_path = Settings::BATTLERS_FOLDER + folder + "/" + filename
lightmode_path = Settings::BATTLERS_FOLDER + filename
return normal_path if pbResolveBitmap(normal_path)
return lightmode_path
end
def alt_sprites_substitutions_available
return $PokemonGlobal && $PokemonGlobal.alt_sprite_substitutions
end
def get_fusion_sprite_path(head_id,body_id)
#Swap path if alt is selected for this pokemon
dex_num = getSpeciesIdForFusion(head_id,body_id)
if alt_sprites_substitutions_available && $PokemonGlobal.alt_sprite_substitutions.keys.include?(dex_num)
return $PokemonGlobal.alt_sprite_substitutions[dex_num]
end
#Try local custom sprite
filename = sprintf("%s.%s.png", head_id, body_id)
local_custom_path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + head_id.to_s + "/" +filename
return local_custom_path if pbResolveBitmap(local_custom_path)
#Try to download custom sprite if none found locally
downloaded_custom = download_custom_sprite(head_id,body_id)
return downloaded_custom if downloaded_custom
#Try local generated sprite
local_generated_path = Settings::BATTLERS_FOLDER + head_id.to_s + "/" + filename
return local_generated_path if pbResolveBitmap(local_generated_path)
#Download generate sprite if nothing else found
autogen_path= download_autogen_sprite(head_id,body_id)
return autogen_path if pbResolveBitmap(autogen_path)
return Settings::DEFAULT_SPRITE_PATH
end

View File

@@ -9,7 +9,7 @@ def pbAddPokemonID(pokemon, level = nil, seeform = true, dontRandomize = false)
end
if pokemon.is_a?(Integer) && level.is_a?(Integer)
pokemon = Pokemon.new(pokemon, level, $Trainer)
pokemon = Pokemon.create(pokemon, level, $Trainer)
end
#random species if randomized gift pokemon & wild poke
if $game_switches[SWITCH_RANDOM_GIFT_POKEMON] && $game_switches[SWITCH_RANDOM_WILD] && !dontRandomize
@@ -32,7 +32,7 @@ def pbAddPokemonID(pokemon_id, level = 1, see_form = true, skip_randomize = fals
return false
end
if pokemon_id.is_a?(Integer) && level.is_a?(Integer)
pokemon = Pokemon.new(pokemon_id, level)
pokemon = Pokemon.create(pokemon_id, level)
species_name = pokemon.speciesName
end
@@ -343,7 +343,7 @@ end
def generateSimpleTrainerParty(teamSpecies, level)
team = []
for species in teamSpecies
poke = Pokemon.new(species, level)
poke = Pokemon.create(species, level)
team << poke
end
return team

View File

@@ -1471,14 +1471,14 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
new_level = calculateUnfuseLevelOldMethod(pokemon, supersplicers)
body_level = new_level
head_level = new_level
poke1 = Pokemon.new(bodyPoke, body_level)
poke2 = Pokemon.new(headPoke, head_level)
poke1 = Pokemon.create(bodyPoke, body_level)
poke2 = Pokemon.create(headPoke, head_level)
else
exp_body = pokemon.exp_when_fused_body + pokemon.exp_gained_since_fused
exp_head = pokemon.exp_when_fused_head + pokemon.exp_gained_since_fused
poke1 = Pokemon.new(bodyPoke, pokemon.level)
poke2 = Pokemon.new(headPoke, pokemon.level)
poke1 = Pokemon.create(bodyPoke, pokemon.level)
poke2 = Pokemon.create(headPoke, pokemon.level)
poke1.exp = exp_body
poke2.exp = exp_head
end
@@ -1540,8 +1540,8 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
$PokemonStorage.pbStoreCaught(poke2)
scene.pbDisplay(_INTL("{1} was sent to the PC.", poke2.name))
else
poke2 = Pokemon.new(bodyPoke, body_level)
poke1 = Pokemon.new(headPoke, head_level)
poke2 = Pokemon.create(bodyPoke, body_level)
poke1 = Pokemon.create(headPoke, head_level)
if pcPosition != nil
box = pcPosition[0]

View File

@@ -141,7 +141,7 @@ def generateCurrentGalleryBattle(level = nil, number_of_pokemon = 3)
selected_battlers_idx = possible_battlers.sample(number_of_pokemon)
party = []
selected_battlers_idx.each { |species|00
party << Pokemon.new(species, level)
party << Pokemon.create(species, level)
}
customTrainerBattle(spriter_name,
:PAINTER,

View File

@@ -1,90 +0,0 @@
class TripleFusion < Pokemon
attr_reader :species1
attr_reader :species2
attr_reader :species3
def initialize(species1, species2,species3, level, owner = $Trainer, withMoves = true, recheck_form = true)
@species1=species1
@species2=species2
@species3=species3
@species1_data = GameData::Species.get(@species1)
@species2_data = GameData::Species.get(@species2)
@species3_data = GameData::Species.get(@species3)
@species_name = generate_triple_fusion_name()
super(:ZAPMOLTICUNO,level,owner,withMoves,recheck_form)
end
def types
return [@species1_data.type1, @species2_data.type1,@species3_data.type1]
end
def baseStats
ret = {}
GameData::Stat.each_main do |s|
stat1 = @species1_data.base_stats[s.id]
stat2 = @species2_data.base_stats[s.id]
stat3 = @species3_data.base_stats[s.id]
ret[s.id] = (stat1 + stat2 + stat3) / 3
end
return ret
end
def name
return (nicknamed?) ? @name : @species_name
end
def speciesName
return @species_name
end
def generate_triple_fusion_name()
part1 = split_string_with_syllables(@species1_data.name)[0]
part2 = split_string_with_syllables(@species2_data.name)[1]
part3 = split_string_with_syllables(@species3_data.name)[2]
return _INTL("{1}{2}{3}",part1,part2,part3).capitalize!
end
def split_string_with_syllables(name)
syllable_pattern = /[bcdfghjklmnpqrstvwxyz]*[aeiou]+[bcdfghjklmnpqrstvwxyz]*/
syllables = name.downcase.scan(syllable_pattern)
first_syllable= syllables.first
last_syllable = syllables.last
if syllables.length > 1
middle_syllable = syllables[1]
else
middle_syllable = first_syllable.downcase
end
last_syllable.nil? ? first_syllable : last_syllable
return [first_syllable,middle_syllable,last_syllable]
end
def ability_id
if !@ability
abil_index = ability_index
if !@ability # Natural ability or no hidden ability defined
chosen_poke_for_ability= rand(1..3)
if chosen_poke_for_ability == 1
@ability = @species1_data.abilities[abil_index] || @species1_data.abilities[0]
elsif chosen_poke_for_ability == 2
@ability = @species2_data.abilities[abil_index] || @species2_data.abilities[0]
else
@ability = @species3_data.abilities[abil_index] || @species3_data.abilities[0]
end
end
end
return @ability
end
end