Renamed trainers.txt property Ability to AbilityIndex, and added the property Ability which accepts an ability ID (and an index number for backwards compatibility)

This commit is contained in:
Maruno17
2021-05-13 22:34:46 +01:00
parent 8384adeb22
commit 2e1a7646ed
6 changed files with 84 additions and 65 deletions

View File

@@ -19,7 +19,8 @@ module GameData
"Form" => [:form, "u"], "Form" => [:form, "u"],
"Name" => [:name, "s"], "Name" => [:name, "s"],
"Moves" => [:moves, "*e", :Move], "Moves" => [:moves, "*e", :Move],
"Ability" => [:ability_flag, "u"], "Ability" => [:ability, "s"],
"AbilityIndex" => [:ability_index, "u"],
"Item" => [:item, "e", :Item], "Item" => [:item, "e", :Item],
"Gender" => [:gender, "e", { "M" => 0, "m" => 0, "Male" => 0, "male" => 0, "0" => 0, "Gender" => [:gender, "e", { "M" => 0, "m" => 0, "Male" => 0, "male" => 0, "0" => 0,
"F" => 1, "f" => 1, "Female" => 1, "female" => 1, "1" => 1 }], "F" => 1, "f" => 1, "Female" => 1, "female" => 1, "1" => 1 }],
@@ -127,7 +128,8 @@ module GameData
else else
pkmn.reset_moves pkmn.reset_moves
end end
pkmn.ability_index = pkmn_data[:ability_flag] pkmn.ability_index = pkmn_data[:ability_index]
pkmn.ability = pkmn_data[:ability]
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1) pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
pkmn.shiny = (pkmn_data[:shininess]) ? true : false pkmn.shiny = (pkmn_data[:shininess]) ? true : false
if pkmn_data[:nature] if pkmn_data[:nature]

View File

@@ -645,7 +645,8 @@ module TrainerPokemonProperty
oldsetting.push((initsetting[:moves]) ? initsetting[:moves][i] : nil) oldsetting.push((initsetting[:moves]) ? initsetting[:moves][i] : nil)
end end
oldsetting.concat([ oldsetting.concat([
initsetting[:ability_flag], initsetting[:ability],
initsetting[:ability_index],
initsetting[:item], initsetting[:item],
initsetting[:nature], initsetting[:nature],
initsetting[:iv], initsetting[:iv],
@@ -664,10 +665,12 @@ module TrainerPokemonProperty
[_INTL("Shadow"), BooleanProperty2, _INTL("If set to true, the Pokémon is a Shadow Pokémon.")] [_INTL("Shadow"), BooleanProperty2, _INTL("If set to true, the Pokémon is a Shadow Pokémon.")]
] ]
Pokemon::MAX_MOVES.times do |i| Pokemon::MAX_MOVES.times do |i|
pkmn_properties.push([_INTL("Move {1}", i + 1), MovePropertyForSpecies.new(oldsetting), _INTL("A move known by the Pokémon. Leave all moves blank (use Z key to delete) for a wild moveset.")]) pkmn_properties.push([_INTL("Move {1}", i + 1),
MovePropertyForSpecies.new(oldsetting), _INTL("A move known by the Pokémon. Leave all moves blank (use Z key to delete) for a wild moveset.")])
end end
pkmn_properties.concat([ pkmn_properties.concat([
[_INTL("Ability"), LimitProperty2.new(99), _INTL("Ability flag. 0=first ability, 1=second ability, 2-5=hidden ability.")], [_INTL("Ability"), AbilityProperty, _INTL("Ability of the Pokémon. Overrides the ability index.")],
[_INTL("Ability index"), LimitProperty2.new(99), _INTL("Ability index. 0=first ability, 1=second ability, 2+=hidden ability.")],
[_INTL("Held item"), ItemProperty, _INTL("Item held by the Pokémon.")], [_INTL("Held item"), ItemProperty, _INTL("Item held by the Pokémon.")],
[_INTL("Nature"), GameDataProperty.new(:Nature), _INTL("Nature of the Pokémon.")], [_INTL("Nature"), GameDataProperty.new(:Nature), _INTL("Nature of the Pokémon.")],
[_INTL("IVs"), IVsProperty.new(Pokemon::IV_STAT_LIMIT), _INTL("Individual values for each of the Pokémon's stats.")], [_INTL("IVs"), IVsProperty.new(Pokemon::IV_STAT_LIMIT), _INTL("Individual values for each of the Pokémon's stats.")],
@@ -685,13 +688,14 @@ module TrainerPokemonProperty
:gender => oldsetting[4], :gender => oldsetting[4],
:shininess => oldsetting[5], :shininess => oldsetting[5],
:shadowness => oldsetting[6], :shadowness => oldsetting[6],
:ability_flag => oldsetting[7 + Pokemon::MAX_MOVES], :ability => oldsetting[7 + Pokemon::MAX_MOVES],
:item => oldsetting[8 + Pokemon::MAX_MOVES], :ability_index => oldsetting[8 + Pokemon::MAX_MOVES],
:nature => oldsetting[9 + Pokemon::MAX_MOVES], :item => oldsetting[9 + Pokemon::MAX_MOVES],
:iv => oldsetting[10 + Pokemon::MAX_MOVES], :nature => oldsetting[10 + Pokemon::MAX_MOVES],
:ev => oldsetting[11 + Pokemon::MAX_MOVES], :iv => oldsetting[11 + Pokemon::MAX_MOVES],
:happiness => oldsetting[12 + Pokemon::MAX_MOVES], :ev => oldsetting[12 + Pokemon::MAX_MOVES],
:poke_ball => oldsetting[13 + Pokemon::MAX_MOVES], :happiness => oldsetting[13 + Pokemon::MAX_MOVES],
:poke_ball => oldsetting[14 + Pokemon::MAX_MOVES],
} }
moves = [] moves = []
Pokemon::MAX_MOVES.times do |i| Pokemon::MAX_MOVES.times do |i|

View File

@@ -574,7 +574,11 @@ class TrainerBattleLister
@sprite.bitmap.dispose if @sprite.bitmap @sprite.bitmap.dispose if @sprite.bitmap
return if index < 0 return if index < 0
begin begin
if @ids[index].is_a?(Array)
@sprite.setBitmap(GameData::TrainerType.front_sprite_filename(@ids[index][0]), 0) @sprite.setBitmap(GameData::TrainerType.front_sprite_filename(@ids[index][0]), 0)
else
@sprite.setBitmap(nil)
end
rescue rescue
@sprite.setBitmap(nil) @sprite.setBitmap(nil)
end end

View File

@@ -1215,6 +1215,14 @@ module Compiler
raise _INTL("Pokémon hasn't been defined yet!\r\n{1}", FileLineData.linereport) raise _INTL("Pokémon hasn't been defined yet!\r\n{1}", FileLineData.linereport)
end end
case property_name case property_name
when "Ability"
if property_value[/^\d+$/]
current_pkmn[:ability_index] = property_value.to_i
elsif !GameData::Ability.exists?(property_value.to_sym)
raise _INTL("Value {1} isn't a defined Ability.\r\n{2}", property_value, FileLineData.linereport)
else
current_pkmn[line_schema[0]] = property_value.to_sym
end
when "IV", "EV" when "IV", "EV"
value_hash = {} value_hash = {}
GameData::Stat.each_main do |s| GameData::Stat.each_main do |s|
@@ -1322,7 +1330,7 @@ module Compiler
current_pkmn[:level] = line_data[1] current_pkmn[:level] = line_data[1]
current_pkmn[:item] = line_data[2] if line_data[2] current_pkmn[:item] = line_data[2] if line_data[2]
current_pkmn[:moves] = moves if moves.length > 0 current_pkmn[:moves] = moves if moves.length > 0
current_pkmn[:ability_flag] = line_data[7] if line_data[7] current_pkmn[:ability_index] = line_data[7] if line_data[7]
current_pkmn[:gender] = line_data[8] if line_data[8] current_pkmn[:gender] = line_data[8] if line_data[8]
current_pkmn[:form] = line_data[9] if line_data[9] current_pkmn[:form] = line_data[9] if line_data[9]
current_pkmn[:shininess] = line_data[10] if line_data[10] current_pkmn[:shininess] = line_data[10] if line_data[10]

View File

@@ -609,7 +609,8 @@ module Compiler
f.write(" Shiny = yes\r\n") if pkmn[:shininess] f.write(" Shiny = yes\r\n") if pkmn[:shininess]
f.write(" Shadow = yes\r\n") if pkmn[:shadowness] f.write(" Shadow = yes\r\n") if pkmn[:shadowness]
f.write(sprintf(" Moves = %s\r\n", pkmn[:moves].join(","))) if pkmn[:moves] && pkmn[:moves].length > 0 f.write(sprintf(" Moves = %s\r\n", pkmn[:moves].join(","))) if pkmn[:moves] && pkmn[:moves].length > 0
f.write(sprintf(" Ability = %d\r\n", pkmn[:ability_flag])) if pkmn[:ability_flag] f.write(sprintf(" Ability = %s\r\n", pkmn[:ability])) if pkmn[:ability]
f.write(sprintf(" AbilityIndex = %d\r\n", pkmn[:ability_index])) if pkmn[:ability_index]
f.write(sprintf(" Item = %s\r\n", pkmn[:item])) if pkmn[:item] f.write(sprintf(" Item = %s\r\n", pkmn[:item])) if pkmn[:item]
f.write(sprintf(" Nature = %s\r\n", pkmn[:nature])) if pkmn[:nature] f.write(sprintf(" Nature = %s\r\n", pkmn[:nature])) if pkmn[:nature]
ivs_array = [] ivs_array = []

View File

@@ -11,14 +11,14 @@ LoseText = "Very good."
Pokemon = GEODUDE,12 Pokemon = GEODUDE,12
Gender = male Gender = male
Moves = DEFENSECURL,HEADSMASH,ROCKPOLISH,ROCKTHROW Moves = DEFENSECURL,HEADSMASH,ROCKPOLISH,ROCKTHROW
Ability = 0 AbilityIndex = 0
IV = 20,20,20,20,20,20 IV = 20,20,20,20,20,20
Pokemon = ONIX,14 Pokemon = ONIX,14
Name = Rocky Name = Rocky
Gender = male Gender = male
Shiny = yes Shiny = yes
Moves = HEADSMASH,ROCKTHROW,RAGE,ROCKTOMB Moves = HEADSMASH,ROCKTHROW,RAGE,ROCKTOMB
Ability = 0 AbilityIndex = 0
Item = SITRUSBERRY Item = SITRUSBERRY
IV = 20,20,20,20,20,20 IV = 20,20,20,20,20,20
Ball = HEAVYBALL Ball = HEAVYBALL