Added conversion of berry plant data, removed all uses of ID numbers for abilities and berry plants, fixed mulch not being consumed, removed use of ID numbers in map of moves to animation IDs

This commit is contained in:
Maruno17
2021-06-19 18:48:33 +01:00
parent 6e188666a4
commit 49655165e1
9 changed files with 134 additions and 48 deletions

View File

@@ -1,31 +1,29 @@
module GameData
class Ability
attr_reader :id
attr_reader :id_number
attr_reader :real_name
attr_reader :real_description
DATA = {}
DATA_FILENAME = "abilities.dat"
extend ClassMethods
extend ClassMethodsSymbols
include InstanceMethods
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number] || -1
@real_name = hash[:name] || "Unnamed"
@real_description = hash[:description] || "???"
end
# @return [String] the translated name of this ability
def name
return pbGetMessage(MessageTypes::Abilities, @id_number)
return pbGetMessageFromHash(MessageTypes::Abilities, @real_name)
end
# @return [String] the translated description of this ability
def description
return pbGetMessage(MessageTypes::AbilityDescs, @id_number)
return pbGetMessageFromHash(MessageTypes::AbilityDescs, @real_description)
end
end
end

View File

@@ -1,7 +1,6 @@
module GameData
class BerryPlant
attr_reader :id
attr_reader :id_number
attr_reader :hours_per_stage
attr_reader :drying_per_hour
attr_reader :minimum_yield
@@ -12,16 +11,15 @@ module GameData
NUMBER_OF_REPLANTS = 9
extend ClassMethods
extend ClassMethodsSymbols
include InstanceMethods
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number] || -1
@hours_per_stage = hash[:hours_per_stage] || 3
@drying_per_hour = hash[:drying_per_hour] || 15
@minimum_yield = hash[:minimum_yield] || 2
@maximum_yield = hash[:maximum_yield] || 5
@minimum_yield = hash[:minimum_yield] || 2
@maximum_yield = hash[:maximum_yield] || 5
end
end
end

View File

@@ -128,7 +128,7 @@ module GameData
else
pkmn.reset_moves
end
pkmn.ability_index = pkmn_data[:ability_index]
pkmn.ability_index = pkmn_data[:ability_index] || 0
pkmn.ability = pkmn_data[:ability]
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
pkmn.shiny = (pkmn_data[:shininess]) ? true : false
@@ -137,7 +137,8 @@ module GameData
else # Make the nature random but consistent for the same species used by the same trainer type
species_num = GameData::Species.keys.index(species) || 1
tr_type_num = GameData::TrainerType.keys.index(@trainer_type) || 1
pkmn.nature = (species_num + tr_type_num) % GameData::Nature.count
idx = (species_num + tr_type_num) % GameData::Nature.count
pkmn.nature = GameData::Nature.get(GameData::Nature.keys[idx]).id
end
GameData::Stat.each_main do |s|
if pkmn_data[:iv]