adds fused species abilities & fixes pokedex issue

This commit is contained in:
infinitefusion
2023-08-06 10:49:26 -04:00
parent 9f44271b99
commit b8a27ff6e3
21 changed files with 102 additions and 47 deletions

View File

@@ -20,7 +20,7 @@ module Settings
FUSION_ICON_SPRITE_OFFSET = 10
#Infinite fusion settings
NB_POKEMON = 420
NB_POKEMON = 809
CUSTOM_BASE_SPRITES_FOLDER = "Graphics/CustomBattlers/customBaseSprites/"
CUSTOM_BATTLERS_FOLDER = "Graphics/CustomBattlers/"
CUSTOM_BATTLERS_FOLDER_INDEXED = "Graphics/CustomBattlers/indexed/"

View File

@@ -180,7 +180,6 @@ class PokemonIconSprite < SpriteWrapper
bodyPoke_number = getBodyID(pokemon.species)
headPoke_number = getHeadID(pokemon.species, bodyPoke_number)
bodyPoke = GameData::Species.get(bodyPoke_number).species
headPoke = GameData::Species.get(headPoke_number).species

View File

@@ -45,7 +45,6 @@ class Pokemon
attr_accessor :body_original_ability_index
attr_accessor :head_original_ability_index
# @return [Array<Pokemon::Move>] the moves known by this Pokémon
attr_accessor :moves
# @return [Array<Integer>] the IDs of moves known by this Pokémon when it was obtained
@@ -126,7 +125,9 @@ class Pokemon
end
def species_data
@species_data = GameData::Species.get(@species) if ! @species_data
if !@species_data || @species != @species_data.species
@species_data = GameData::Species.get(@species)
end
return @species_data #GameData::Species.get(@species)
end
@@ -163,7 +164,7 @@ class Pokemon
return isSpecies?(check_species)
end
bodySpecies = getBodyID(species)
checkSpeciesId = getID(nil,check_species)
checkSpeciesId = getID(nil, check_species)
return bodySpecies == checkSpeciesId
end
@@ -172,14 +173,14 @@ class Pokemon
return isSpecies?(check_species)
end
headSpecies = getHeadID(species)
checkSpeciesId = getID(nil,check_species)
checkSpeciesId = getID(nil, check_species)
return headSpecies == checkSpeciesId
end
def shiny=(value)
@shiny=value
@shiny = value
if value && Settings::SHINY_POKEMON_CHANCE != S_CHANCE_VALIDATOR
@debug_shiny=true
@debug_shiny = true
end
end
@@ -480,8 +481,6 @@ class Pokemon
return [:AlwaysMale, :AlwaysFemale, :Genderless].include?(gender_ratio)
end
#=============================================================================
# Shininess
#=============================================================================
@@ -496,13 +495,13 @@ class Pokemon
is_shiny = d < Settings::SHINY_POKEMON_CHANCE
if is_shiny
@shiny = true
@natural_shiny=true
@natural_shiny = true
end
end
if @shiny && Settings::SHINY_POKEMON_CHANCE != S_CHANCE_VALIDATOR
@debug_shiny=true
@natural_shiny=false
@debug_shiny = true
@natural_shiny = false
end
return @shiny
end
@@ -789,9 +788,9 @@ class Pokemon
body_species_id = getBasePokemonID(species)
head_species = GameData::Species.get(head_species_id)
body_species = GameData::Species.get(body_species_id)
return move_data && (pokemon_can_learn_move(head_species,move_data) || pokemon_can_learn_move(body_species,move_data))
return move_data && (pokemon_can_learn_move(head_species, move_data) || pokemon_can_learn_move(body_species, move_data))
else
return move_data && pokemon_can_learn_move(species_data,move_data)
return move_data && pokemon_can_learn_move(species_data, move_data)
end
end
@@ -1262,7 +1261,7 @@ class Pokemon
@ivMaxed = {}
@ev = {}
@hiddenPowerType = nil
@glitter=nil
@glitter = nil
GameData::Stat.each_main do |s|
@iv[s.id] = rand(IV_STAT_LIMIT + 1)
@ev[s.id] = 0

View File

@@ -38,18 +38,22 @@ class Player < Trainer
self.refresh_accessible_dexes
end
def initStandardDexArray()
def initStandardDexArray(resync=false)
dex_array = []
(0..NB_POKEMON).each { |poke|
if poke == 0
dex_array << nil
end
dex_array << false
if resync && @seen_standard[poke]
dex_array << @seen_standard[poke]
else
dex_array << false
end
}
return dex_array
end
def initFusionDexArray()
def initFusionDexArray(resync=false)
head_array = []
(0..NB_POKEMON).each { |head|
body_array = []
@@ -60,7 +64,11 @@ class Player < Trainer
if body == 0
body_array << nil
end
body_array << false
if resync && @seen_fusion[body]
body_array << @seen_fusion[body]
else
body_array << false
end
}
head_array << body_array
}
@@ -79,17 +87,22 @@ class Player < Trainer
return num > Settings::NB_POKEMON && !isTripleFusion(num)
end
def set_seen_fusion(species)
initFusionDexArray() if @seen_fusion.length < NB_POKEMON+2
def resyncPokedexIfNumberOfPokemonChanged()
if @seen_standard.length < NB_POKEMON || @seen_fusion.length < NB_POKEMON
@seen_fusion = initFusionDexArray(true)
@seen_standard=initStandardDexArray(true )
end
end
def set_seen_fusion(species)
resyncPokedexIfNumberOfPokemonChanged()
bodyId = getBodyID(species)
headId = getHeadID(species, bodyId)
@seen_fusion[headId][bodyId] = true
end
def set_seen_normalDex(species)
initStandardDexArray() if @seen_standard.length < NB_POKEMON
resyncPokedexIfNumberOfPokemonChanged()
dex_num = getDexNumberForSpecies(species)
@seen_standard[dex_num] = true
end

View File

@@ -607,6 +607,10 @@ class PokemonEvolutionScene
# Check for consumed item and check if Pokémon should be duplicated
pbEvolutionMethodAfterEvolution if !reversing
@pokemon
@pokemon.ability
oldAbility = @pokemon.ability.id
newSpecies = GameData::Species.get(@newspecies)

View File

@@ -38,13 +38,16 @@ module GameData
@gender_ratio = calculate_gender() #todo
@catch_rate = calculate_catch_rate()
@happiness = calculate_base_happiness()
#Moves
@moves = calculate_moveset()
@tutor_moves =calculate_tutor_moves() # hash[:tutor_moves] || []
@egg_moves = calculate_egg_moves() # hash[:egg_moves] || []
#todo : all below
@tutor_moves = [] # hash[:tutor_moves] || []
@egg_moves = [] # hash[:egg_moves] || []
@abilities = [] # hash[:abilities] || []
@hidden_abilities = [] # hash[:hidden_abilities] || []
@abilities = calculate_abilities(@body_pokemon,@head_pokemon) # hash[:abilities] || []
@hidden_abilities = calculate_hidden_abilities(@body_pokemon,@head_pokemon) # hash[:hidden_abilities] || []
@wild_item_common = [] # hash[:wild_item_common]
@wild_item_uncommon = [] # hash[:wild_item_uncommon]
@wild_item_rare = [] # hash[:wild_item_rare]
@@ -130,6 +133,40 @@ module GameData
return combine_arrays(@body_pokemon.moves, @head_pokemon.moves)
end
def calculate_egg_moves
return combine_arrays(@body_pokemon.egg_moves, @head_pokemon.egg_moves)
end
def calculate_tutor_moves
return combine_arrays(@body_pokemon.tutor_moves, @head_pokemon.tutor_moves)
end
def calculate_abilities(pokemon1,pokemon2)
abilities_hash = []
ability1 = pokemon1.abilities[0]
ability2 = pokemon2.abilities[1]
if !ability2
ability2 = pokemon2.abilities[0]
end
abilities_hash << ability1
abilities_hash << ability2
return abilities_hash
end
def calculate_hidden_abilities(pokemon1,pokemon2)
#First two spots are the other abilities of the two pokemon
abilities_hash = calculate_abilities(pokemon2,pokemon1)
#add the hidden ability for the two base pokemon
abilities_hash << @body_pokemon.hidden_abilities[0]
abilities_hash << @head_pokemon.hidden_abilities[0]
return abilities_hash
end
#TODO
# ################## UNFINISHED ####################
#todo
def calculate_name()
return @body_pokemon.name + "/" + @head_pokemon.name
@@ -155,7 +192,7 @@ module GameData
return :Genderless
end
#UTILS
############################# UTIL METHODS ###############################
#
def calculate_fused_stats(dominantStat, otherStat)
return ((2 * dominantStat) / 3) + (otherStat / 3).floor

View File

@@ -216,13 +216,16 @@ class PokemonFusionScene
def pbChooseAbility(poke, hidden1 = false, hidden2 = false)
abilityList = poke.getAbilityList
if $game_switches[SWITCH_DOUBLE_ABILITIES]
abID1 = @pokemon1.ability
abID2 = @pokemon2.ability
else
abID1 = hidden1 ? abilityList[4][0] : abilityList[0][0]
abID2 = hidden2 ? abilityList[5][0] : abilityList[1][0]
abID1 = hidden1 ? abilityList[-2][0] : abilityList[0][0]
p abilityList
p abilityList[5]
p abilityList[1]
abID2 = hidden2 ? abilityList[-1][0] : abilityList[1][0]
end
availableNatures = []
availableNatures << @pokemon1.nature

View File

@@ -14,7 +14,7 @@
# PokemonFusion
#
NB_POKEMON = 809#420 #351 #aussi CONST_NB_POKE
NB_POKEMON = Settings::NB_POKEMON#809#420 #351 #aussi CONST_NB_POKE
CONST_NB_POKE = NB_POKEMON
def pbPokemonBitmapFile(species)
# Used by the Pokédex