mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
fixed abilities and rival evolution
This commit is contained in:
@@ -130,8 +130,8 @@ end
|
||||
|
||||
#in: pokemon number
|
||||
def Kernel.isPartPokemon(src, target)
|
||||
src = convertSpeciesSymbolToDexNumber(src)
|
||||
target = convertSpeciesSymbolToDexNumber(target)
|
||||
src = getDexNumberForSpecies(src)
|
||||
target = getDexNumberForSpecies(target)
|
||||
return true if src == target
|
||||
return false if src <= NB_POKEMON
|
||||
bod = getBasePokemonID(src, true)
|
||||
@@ -152,8 +152,6 @@ def getBasePokemonID(pokemon, body = true)
|
||||
|
||||
# cname = getConstantName(PBSpecies, pokemon) rescue nil
|
||||
cname = GameData::Species.get(pokemon).id.to_s
|
||||
|
||||
|
||||
return pokemon if pokemon <= NB_POKEMON
|
||||
return pokemon if cname == nil
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ def pbCheckPokemonIconFiles(speciesNum,egg=false, dna=false)
|
||||
end
|
||||
|
||||
|
||||
def convertSpeciesSymbolToDexNumber(species)
|
||||
def getDexNumberForSpecies(species)
|
||||
return species if species.is_a?(Integer)
|
||||
if species.is_a?(Symbol)
|
||||
dexNum = GameData::Species.get(species).id_number
|
||||
@@ -158,13 +158,13 @@ def getRandomCustomFusion(returnRandomPokemonIfNoneFound=true,customPokeList=[],
|
||||
end
|
||||
|
||||
def getBodyID(species)
|
||||
dexNum = convertSpeciesSymbolToDexNumber(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
return (dexNum / NB_POKEMON).round
|
||||
end
|
||||
|
||||
def getHeadID(species, bodyId)
|
||||
head_dexNum = convertSpeciesSymbolToDexNumber(species)
|
||||
body_dexNum = convertSpeciesSymbolToDexNumber(bodyId)
|
||||
head_dexNum = getDexNumberForSpecies(species)
|
||||
body_dexNum = getDexNumberForSpecies(bodyId)
|
||||
calculated_number = (head_dexNum - (body_dexNum * NB_POKEMON)).round
|
||||
return calculated_number == 0 ? 420 : calculated_number
|
||||
end
|
||||
|
||||
@@ -788,9 +788,9 @@ def pbChooseAbility(poke, hidden1 = false, hidden2 = false)
|
||||
ability2_name = GameData::Ability.get(abID2).name
|
||||
|
||||
if (Kernel.pbMessage("Choose an ability.", [_INTL("{1}", ability1_name), _INTL("{1}", ability2_name)], 2)) == 0
|
||||
return hidden1 ? 4 : 0
|
||||
return abID1#hidden1 ? 4 : 0
|
||||
end
|
||||
return hidden2 ? 5 : 1
|
||||
return abID2#hidden2 ? 5 : 1
|
||||
end
|
||||
|
||||
def pbChooseNature(species1_nature, species2_nature)
|
||||
|
||||
@@ -148,17 +148,15 @@ def getEvolution(species)
|
||||
head = getBasePokemonID(species,false)
|
||||
ret_evoB = pbGetEvolvedFormData(body)
|
||||
ret_evoH = pbGetEvolvedFormData(head)
|
||||
|
||||
evoBody = ret_evoB.any? ? ret_evoB[0][2] : -1
|
||||
evoHead = ret_evoH.any? ? ret_evoH[0][2] : -1
|
||||
|
||||
return -1 if isNegativeOrNull(evoBody) && isNegativeOrNull(evoHead)
|
||||
return body*Settings::NB_POKEMON+evoHead if isNegativeOrNull(evoBody) #only head evolves
|
||||
return evoBody*Settings::NB_POKEMON + head if isNegativeOrNull(evoHead) #only body evolves
|
||||
return evoBody*Settings::NB_POKEMON+evoHead #both evolve
|
||||
else
|
||||
evo = pbGetEvolvedFormData(species)
|
||||
return evo.any? ? evo[0][2] : -1
|
||||
return evo.any? ? getDexNumberForSpecies(evo[0][0]) : -1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -169,25 +167,27 @@ def getFusionSpecies(body,head)
|
||||
end
|
||||
#
|
||||
def evolveHead(species)
|
||||
if species <= Settings::NB_POKEMON
|
||||
evo = getEvolution(species)
|
||||
return evo == -1 ? species : evo
|
||||
species_id = getDexNumberForSpecies(species)
|
||||
if species_id <= Settings::NB_POKEMON
|
||||
evo = getEvolution(species_id)
|
||||
return evo == -1 ? species_id : evo
|
||||
end
|
||||
head = getBasePokemonID(species,false)
|
||||
body = getBasePokemonID(species)
|
||||
head = getBasePokemonID(species_id,false)
|
||||
body = getBasePokemonID(species_id)
|
||||
headEvo = getEvolution(head)
|
||||
return headEvo == -1 ? species : getFusionSpecies(body,headEvo)
|
||||
return headEvo == -1 ? species_id : getFusionSpecies(body,headEvo)
|
||||
end
|
||||
|
||||
def evolveBody(species)
|
||||
if species <= Settings::NB_POKEMON
|
||||
evo = getEvolution(species)
|
||||
return evo == -1 ? species : evo
|
||||
species_id = getDexNumberForSpecies(species)
|
||||
if species_id <= Settings::NB_POKEMON
|
||||
evo = getEvolution(species_id)
|
||||
return evo == -1 ? species_id : evo
|
||||
end
|
||||
head = getBasePokemonID(species,false)
|
||||
body = getBasePokemonID(species)
|
||||
head = getBasePokemonID(species_id,false)
|
||||
body = getBasePokemonID(species_id)
|
||||
bodyEvo = getEvolution(body)
|
||||
return bodyEvo == -1 ? species : getFusionSpecies(bodyEvo,head)
|
||||
return bodyEvo == -1 ? species_id : getFusionSpecies(bodyEvo,head)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user