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

@@ -645,7 +645,8 @@ module TrainerPokemonProperty
oldsetting.push((initsetting[:moves]) ? initsetting[:moves][i] : nil)
end
oldsetting.concat([
initsetting[:ability_flag],
initsetting[:ability],
initsetting[:ability_index],
initsetting[:item],
initsetting[:nature],
initsetting[:iv],
@@ -655,43 +656,46 @@ module TrainerPokemonProperty
])
max_level = GameData::GrowthRate.max_level
pkmn_properties = [
[_INTL("Species"), SpeciesProperty, _INTL("Species of the Pokémon.")],
[_INTL("Level"), NonzeroLimitProperty.new(max_level), _INTL("Level of the Pokémon (1-{1}).", max_level)],
[_INTL("Name"), StringProperty, _INTL("Name of the Pokémon.")],
[_INTL("Form"), LimitProperty2.new(999), _INTL("Form of the Pokémon.")],
[_INTL("Gender"), GenderProperty, _INTL("Gender of the Pokémon.")],
[_INTL("Shiny"), BooleanProperty2, _INTL("If set to true, the Pokémon is a different-colored Pokémon.")],
[_INTL("Shadow"), BooleanProperty2, _INTL("If set to true, the Pokémon is a Shadow Pokémon.")]
[_INTL("Species"), SpeciesProperty, _INTL("Species of the Pokémon.")],
[_INTL("Level"), NonzeroLimitProperty.new(max_level), _INTL("Level of the Pokémon (1-{1}).", max_level)],
[_INTL("Name"), StringProperty, _INTL("Name of the Pokémon.")],
[_INTL("Form"), LimitProperty2.new(999), _INTL("Form of the Pokémon.")],
[_INTL("Gender"), GenderProperty, _INTL("Gender of the Pokémon.")],
[_INTL("Shiny"), BooleanProperty2, _INTL("If set to true, the Pokémon is a different-colored Pokémon.")],
[_INTL("Shadow"), BooleanProperty2, _INTL("If set to true, the Pokémon is a Shadow Pokémon.")]
]
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
pkmn_properties.concat([
[_INTL("Ability"), LimitProperty2.new(99), _INTL("Ability flag. 0=first ability, 1=second ability, 2-5=hidden ability.")],
[_INTL("Held item"), ItemProperty, _INTL("Item held by 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("EVs"), EVsProperty.new(Pokemon::EV_STAT_LIMIT), _INTL("Effort values for each of the Pokémon's stats.")],
[_INTL("Happiness"), LimitProperty2.new(255), _INTL("Happiness of the Pokémon (0-255).")],
[_INTL("Poké Ball"), BallProperty.new(oldsetting), _INTL("The kind of Poké Ball the Pokémon is kept in.")]
[_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("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("EVs"), EVsProperty.new(Pokemon::EV_STAT_LIMIT), _INTL("Effort values for each of the Pokémon's stats.")],
[_INTL("Happiness"), LimitProperty2.new(255), _INTL("Happiness of the Pokémon (0-255).")],
[_INTL("Poké Ball"), BallProperty.new(oldsetting), _INTL("The kind of Poké Ball the Pokémon is kept in.")]
])
pbPropertyList(settingname, oldsetting, pkmn_properties, false)
return nil if !oldsetting[0] # Species is nil
ret = {
:species => oldsetting[0],
:level => oldsetting[1],
:name => oldsetting[2],
:form => oldsetting[3],
:gender => oldsetting[4],
:shininess => oldsetting[5],
:shadowness => oldsetting[6],
:ability_flag => oldsetting[7 + Pokemon::MAX_MOVES],
:item => oldsetting[8 + Pokemon::MAX_MOVES],
:nature => oldsetting[9 + Pokemon::MAX_MOVES],
:iv => oldsetting[10 + Pokemon::MAX_MOVES],
:ev => oldsetting[11 + Pokemon::MAX_MOVES],
:happiness => oldsetting[12 + Pokemon::MAX_MOVES],
:poke_ball => oldsetting[13 + Pokemon::MAX_MOVES],
:species => oldsetting[0],
:level => oldsetting[1],
:name => oldsetting[2],
:form => oldsetting[3],
:gender => oldsetting[4],
:shininess => oldsetting[5],
:shadowness => oldsetting[6],
:ability => oldsetting[7 + Pokemon::MAX_MOVES],
:ability_index => oldsetting[8 + Pokemon::MAX_MOVES],
:item => oldsetting[9 + Pokemon::MAX_MOVES],
:nature => oldsetting[10 + Pokemon::MAX_MOVES],
:iv => oldsetting[11 + Pokemon::MAX_MOVES],
:ev => oldsetting[12 + Pokemon::MAX_MOVES],
:happiness => oldsetting[13 + Pokemon::MAX_MOVES],
:poke_ball => oldsetting[14 + Pokemon::MAX_MOVES],
}
moves = []
Pokemon::MAX_MOVES.times do |i|

View File

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