Fixed error in evolution data saved to pokemon.txt

This commit is contained in:
Maruno17
2020-09-16 17:56:51 +01:00
parent 0f61f3f5ae
commit 36e492a3fe
5 changed files with 27 additions and 14 deletions

View File

@@ -839,11 +839,14 @@ def pbSavePokemonData
pokedata.write(",") if count>0
pokedata.write(sprintf("%s,%s,",cnew_species,evoname))
param_type = PBEvolution.getFunction(method, "parameterType")
if param_type
cparameter = getConstantName(param_type,parameter) rescue ""
pokedata.write("#{cparameter}")
else
pokedata.write("#{parameter}")
has_param = !PBEvolution.hasFunction?(method, "parameterType") || param_type != nil
if has_param
if param_type
cparameter = (getConstantName(param_type, parameter) rescue parameter)
pokedata.write("#{cparameter}")
else
pokedata.write("#{parameter}")
end
end
count += 1
end
@@ -1299,11 +1302,14 @@ def pbSavePokemonFormsData
next if !cnew_species || cnew_species==""
pokedata.write(sprintf("%s,%s,",cnew_species,evoname))
param_type = PBEvolution.getFunction(method, "parameterType")
if param_type
cparameter = getConstantName(param_type,parameter) rescue ""
pokedata.write("#{cparameter}")
else
pokedata.write("#{parameter}")
has_param = !PBEvolution.hasFunction?(method, "parameterType") || param_type != nil
if has_param
if param_type
cparameter = (getConstantName(param_type, parameter) rescue parameter)
pokedata.write("#{cparameter}")
else
pokedata.write("#{parameter}")
end
end
pokedata.write(",") if k<evos.length-1
end

View File

@@ -793,6 +793,7 @@ end
def pbGetConst(mod,item,err)
isDef = false
begin
mod = Object.const_get(mod) if mod.is_a?(Symbol)
isDef = mod.const_defined?(item.to_sym)
rescue
raise sprintf(err,item)
@@ -802,6 +803,7 @@ def pbGetConst(mod,item,err)
end
def getConstantName(mod,value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants
return c if mod.const_get(c.to_sym)==value
end
@@ -809,6 +811,7 @@ def getConstantName(mod,value)
end
def getConstantNameOrValue(mod,value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants
return c if mod.const_get(c.to_sym)==value
end
@@ -816,6 +819,7 @@ def getConstantNameOrValue(mod,value)
end
def setConstantName(mod,value,name)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants
mod.send(:remove_const,c.to_sym) if mod.const_get(c.to_sym)==value
end
@@ -823,6 +827,7 @@ def setConstantName(mod,value,name)
end
def removeConstantValue(mod,value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants
mod.send(:remove_const,c.to_sym) if mod.const_get(c.to_sym)==value
end

View File

@@ -815,7 +815,7 @@ Habitat = Forest
RegionalNumbers = 25,22
Kind = Mouse
Pokedex = It stores electricity in the electric sacs on its cheeks. When it releases pent-up energy in a burst, the electric power is equal to a lightning bolt.
WildItemuNCOMMON = LIGHTBALL
WildItemUncommon = LIGHTBALL
BattlerPlayerX = -5
BattlerPlayerY = 0
BattlerEnemyX = 4
@@ -9618,7 +9618,7 @@ BattlerEnemyX = -1
BattlerEnemyY = 29
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,20
Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,
#-------------------------------
[291]
Name = Ninjask

View File

@@ -816,6 +816,7 @@ Habitat = Forest
RegionalNumbers = 25,22
Kind = Mouse
Pokedex = It stores electricity in the electric sacs on its cheeks. When it releases pent-up energy in a burst, the electric power is equal to a lightning bolt.
WildItemUncommon = LIGHTBALL
BattlerPlayerX = -5
BattlerPlayerY = 0
BattlerEnemyX = 4
@@ -9617,7 +9618,7 @@ BattlerEnemyX = -1
BattlerEnemyY = 29
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,20
Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,
#-------------------------------
[291]
Name = Ninjask

View File

@@ -816,6 +816,7 @@ Habitat = Forest
RegionalNumbers = 25,22
Kind = Mouse
Pokedex = It stores electricity in the electric sacs on its cheeks. When it releases pent-up energy in a burst, the electric power is equal to a lightning bolt.
WildItemUncommon = LIGHTBALL
BattlerPlayerX = -5
BattlerPlayerY = 0
BattlerEnemyX = 4
@@ -9617,7 +9618,7 @@ BattlerEnemyX = -1
BattlerEnemyY = 29
BattlerShadowX = 0
BattlerShadowSize = 2
Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,20
Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,
#-------------------------------
[291]
Name = Ninjask