[wip] pokedex refactor for fusions

This commit is contained in:
infinitefusion
2022-04-16 12:15:13 -04:00
parent 54c2b7a364
commit 801706ed0d
6 changed files with 154 additions and 51 deletions

View File

@@ -6,7 +6,7 @@
module Settings
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
GAME_VERSION = '5.0.0'
GAME_VERSION_NUMBER = "5.0.18 - beta"
GAME_VERSION_NUMBER = "5.0.18.1 - beta"
POKERADAR_LIGHT_ANIMATION_RED_ID = 17
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18

View File

@@ -24,41 +24,88 @@ class Player < Trainer
def clear
@seen = {}
@owned = {}
@seen_fusion = {}
@owned_fusion = {}
@seen_forms = {}
@last_seen_forms = {}
@owned_shadow = {}
self.refresh_accessible_dexes
end
def isFusion(species)
num = getDexNumberForSpecies(species)
return num > Settings::NB_POKEMON && num < Settings::ZAPMOLCUNO_NB
end
#===========================================================================
# Sets the given species as seen in the Pokédex.
# @param species [Symbol, GameData::Species] species to set as seen
# @param should_refresh_dexes [Boolean] whether Dex accessibility should be recalculated
def set_seen(species, should_refresh_dexes = true)
def set_seen_fusion(species)
bodyId = getBodyID(species)
headId = getHeadID(species,bodyId)
@seen_fusion[headId][bodyId] = true
p @seen_fusion
end
def set_seen_normalDex(species)
species_id = GameData::Species.try_get(species)&.species
return if species_id.nil?
@seen[species_id] = true
end
def set_seen(species, should_refresh_dexes = true)
return #TODO
if isFusion(species)
set_seen_fusion(species)
else
set_seen_normalDex(species)
end
self.refresh_accessible_dexes if should_refresh_dexes
end
# @param species [Symbol, GameData::Species] species to check
# @return [Boolean] whether the species is seen
def seen?(species)
def seen_fusion?(species)
bodyId = getBodyID(species)
headId = getHeadID(species,bodyId)
return @seen_fusion[headId][bodyId]
end
def seen_normalDex?(species)
species_id = GameData::Species.try_get(species)&.species
return false if species_id.nil?
return @seen[species_id] == true
end
def seen?(species)
return false#TODO
if isFusion(species)
return seen_fusion?(species)
else
return seen_normalDex?(species)
end
end
# @param species [Symbol, GameData::Species] species to check
# @param gender [Integer] gender to check
# @param form [Integer] form to check
# @return [Boolean] whether the species of the given gender and form is seen
def seen_form?(species, gender, form)
species_id = GameData::Species.try_get(species)&.species
return false if species_id.nil?
@seen_forms[species_id] ||= [[], []]
return @seen_forms[species_id][gender][form] == true
return true
# species_id = GameData::Species.try_get(species)&.species
# return false if species_id.nil?
# @seen_forms[species_id] ||= [[], []]
# return @seen_forms[species_id][gender][form] == true
end
# Returns the amount of seen Pokémon.
@@ -118,25 +165,70 @@ class Player < Trainer
# Sets the given species as owned in the Pokédex.
# @param species [Symbol, GameData::Species] species to set as owned
# @param should_refresh_dexes [Boolean] whether Dex accessibility should be recalculated
def set_owned(species, should_refresh_dexes = true)
def set_owned_fusion(species)
bodyId = getBodyID(species)
headId = getHeadID(species,bodyId)
@owned_fusion[headId][bodyId]=true
p @owned_fusion
end
def set_owned_normalDex(species)
species_id = GameData::Species.try_get(species)&.species
return if species_id.nil?
@owned[species_id] = true
end
def set_owned(species, should_refresh_dexes = true)
return #TODO
if isFusion(species)
set_owned_fusion(species)
else
set_owned_normalDex(species)
end
self.refresh_accessible_dexes if should_refresh_dexes
end
# Sets the given species as owned in the Pokédex.
# @param species [Symbol, GameData::Species] species to set as owned
def set_shadow_pokemon_owned(species)
species_id = GameData::Species.try_get(species)&.species
return if species_id.nil?
@owned_shadow[species_id] = true
self.refresh_accessible_dexes
return
# species_id = GameData::Species.try_get(species)&.species
# return if species_id.nil?
# @owned_shadow[species_id] = true
# self.refresh_accessible_dexes
end
# @param species [Symbol, GameData::Species] species to check
# @return [Boolean] whether the species is owned
def owned_fusion?(species)
bodyId = getBodyID(species)
headId = getHeadID(species,bodyId)
p @owned
p @owned[headId]
return @owned[headId][bodyId] == true
end
def owned?(species)
return false #TODO
if isFusion(species)
return owned_fusion?(species)
else
return owned_normalDex?(species)
end
end
def owned_normalDex?(species)
species_id = GameData::Species.try_get(species)&.species
return false if species_id.nil?
return @owned[species_id] == true
@@ -145,9 +237,10 @@ class Player < Trainer
# @param species [Symbol, GameData::Species] species to check
# @return [Boolean] whether a Shadow Pokémon of the species is owned
def owned_shadow_pokemon?(species)
species_id = GameData::Species.try_get(species)&.species
return false if species_id.nil?
return @owned_shadow[species_id] == true
return
# species_id = GameData::Species.try_get(species)&.species
# return false if species_id.nil?
# return @owned_shadow[species_id] == true
end
# Returns the amount of owned Pokémon.
@@ -165,16 +258,18 @@ class Player < Trainer
# @param gender [Integer] gender to register (0=male, 1=female, 2=genderless)
# @param form [Integer] form to register
def register(species, gender = 0, form = 0, should_refresh_dexes = true)
return
if species.is_a?(Pokemon)
species_data = species.species_data
#gender = species.gender
else
species_data = GameData::Species.get(species)
end
species = species_data.species
@seen[species] = true
self.refresh_accessible_dexes if should_refresh_dexes
set_owned(species,should_refresh_dexes)
set_seen(species,should_refresh_dexes)
# return
# if species.is_a?(Pokemon)
# species_data = species.species_data
# #gender = species.gender
# else
# species_data = GameData::Species.get(species)
# end
# species = species_data.species
# @seen[species] = true
# self.refresh_accessible_dexes if should_refresh_dexes
end
# @param pkmn [Pokemon] Pokemon to register as most recently seen

View File

@@ -692,9 +692,9 @@ class PokemonFusionScene
_INTL("\\se[]Congratulations! Your Pokémon were fused into {2}!\\wt[80]", @pokemon1.name, newspeciesname))
#exp
@pokemon1.exp_when_fused_head = @pokemon2.exp #peut-être l'inverse
@pokemon1.exp_when_fused_body = @pokemon1.exp #peut-être l'inverse
@pokemon1.exp_gained_since_fused=0
@pokemon1.exp_when_fused_head = @pokemon2.exp #peut-être l'inverse
@pokemon1.exp_when_fused_body = @pokemon1.exp #peut-être l'inverse
@pokemon1.exp_gained_since_fused = 0
averageFusionIvs()
#add to pokedex
@@ -708,17 +708,21 @@ class PokemonFusionScene
#first check if hidden ability
hiddenAbility1 = @pokemon1.ability == @pokemon1.getAbilityList[0][-1]
hiddenAbility2 = @pokemon2.ability == @pokemon2.getAbilityList[0][-1]
@pokemon1.ability = pbChooseAbility(@pokemon1, hiddenAbility1, hiddenAbility2)
if superSplicer
@pokemon1.nature = pbChooseNature(@pokemon1.nature, @pokemon2.nature)
end
setFusionMoves(@pokemon1, @pokemon2) if !noMoves
#change species
@pokemon1.species = newSpecies
#Check moves for new species
movelist = @pokemon1.getMoveList
for i in movelist
if i[0] == @pokemon1.level
pbLearnMove(@pokemon1, i[1]) if !noMoves #(pokemon,move,ignoreifknown=true, byTM=false , quick =true)
end
end
# movelist = @pokemon1.getMoveList
# for i in movelist
# if i[0] == @pokemon1.level
# pbLearnMove(@pokemon1, i[1]) if !noMoves #(pokemon,move,ignoreifknown=true, byTM=false , quick =true)
# end
# end
#@pokemon1.ability = pbChooseAbility(@pokemon1,@pokemon2)
removeItem = false
if @pokemon2.isShiny? || @pokemon1.isShiny?
@@ -730,21 +734,8 @@ class PokemonFusionScene
@pokemon1.owner = Pokemon::Owner.new_from_trainer($Trainer)
@pokemon1.ability = pbChooseAbility(@pokemon1, hiddenAbility1, hiddenAbility2)
if superSplicer
@pokemon1.nature = pbChooseNature(@pokemon1.nature, @pokemon2.nature)
end
movelist = @pokemon2.moves
for k in movelist
if k.id != 0
pbLearnMove(@pokemon1, k.id, true, false,true) if !noMoves #todo: learn moves faster
end
end
pbSEPlay("Voltorb Flip Point")
#@pokemon1.firstmoves = []
@pokemon1.name = newspeciesname if @pokemon1.name == oldspeciesname
@pokemon1.level = setPokemonLevel(@pokemon1.level, @pokemon2.level, superSplicer)
@@ -755,6 +746,24 @@ class PokemonFusionScene
end
end
def setFusionMoves(fusedPoke, poke2)
choice = Kernel.pbMessage("What to do with the moveset?", [_INTL("Learn moves"), _INTL("Keep {1}'s moveset", fusedPoke.name), _INTL("Keep {1}'s moveset", poke2.name)], 2)
if choice == 1
return
elsif choice == 2
fusedPoke.moves = poke2.moves
return
else
#Learn moves
movelist = poke2.moves
for move in movelist
if move.id != 0
pbLearnMove(fusedPoke, move.id, true, false, true)
end
end
end
end
def setPokemonLevel(pokemon1, pokemon2, superSplicers)
lv1 = @pokemon1.level
lv2 = @pokemon2.level
@@ -794,14 +803,13 @@ def pbChooseAbility(poke, hidden1 = false, hidden2 = false)
abID1 = hidden1 ? abilityList[4][0] : abilityList[0][0]
abID2 = hidden2 ? abilityList[5][0] : abilityList[1][0]
ability1_name = GameData::Ability.get(abID1).name
ability2_name = GameData::Ability.get(abID2).name
if (Kernel.pbMessage("Choose an ability.", [_INTL("{1}", ability1_name), _INTL("{1}", ability2_name)], 2)) == 0
return abID1#hidden1 ? 4 : 0
return abID1 #hidden1 ? 4 : 0
end
return abID2#hidden2 ? 5 : 1
return abID2 #hidden2 ? 5 : 1
end
def pbChooseNature(species1_nature, species2_nature)