Fixed being unable to extract plugin messages to translate them, fixed AI bug with Natural Gift and no item, fixed bad code when checking a trainer's party for a mon with a given type

This commit is contained in:
Maruno17
2021-06-15 19:23:50 +01:00
parent 128a002324
commit c23f50e5a6
3 changed files with 22 additions and 6 deletions

View File

@@ -32,6 +32,19 @@ def pbSetTextMessages
scr=Zlib::Inflate.inflate(script[2]) scr=Zlib::Inflate.inflate(script[2])
pbAddRgssScriptTexts(texts,scr) pbAddRgssScriptTexts(texts,scr)
end end
if safeExists?("Data/PluginScripts.rxdata")
plugin_scripts = load_data("Data/PluginScripts.rxdata")
for plugin in plugin_scripts
for script in plugin[2]
if Time.now.to_i - t >= 5
t = Time.now.to_i
Graphics.update
end
scr = Zlib::Inflate.inflate(script[1]).force_encoding(Encoding::UTF_8)
pbAddRgssScriptTexts(texts,scr)
end
end
end
# Must add messages because this code is used by both game system and Editor # Must add messages because this code is used by both game system and Editor
MessageTypes.addMessagesAsHash(MessageTypes::ScriptTexts,texts) MessageTypes.addMessagesAsHash(MessageTypes::ScriptTexts,texts)
commonevents = load_data("Data/CommonEvents.rxdata") commonevents = load_data("Data/CommonEvents.rxdata")
@@ -250,7 +263,8 @@ def pbGetText(infile)
raise _INTL("Section {1} has an odd number of entries (section was recognized as a hash because its first line is not a number)",name) raise _INTL("Section {1} has an odd number of entries (section was recognized as a hash because its first line is not a number)",name)
end end
end end
i=0;loop do break unless i<section.length i=0
loop do break unless i<section.length
if itemlength==3 if itemlength==3
if !section[i][/^\d+$/] if !section[i][/^\d+$/]
raise _INTL("Expected a number in section {1}, got {2} instead",name,section[i]) raise _INTL("Expected a number in section {1}, got {2} instead",name,section[i])

View File

@@ -489,11 +489,13 @@ class PokeBattle_Move_096 < PokeBattle_Move
def pbBaseType(user) def pbBaseType(user)
item = user.item item = user.item
ret = :NORMAL ret = :NORMAL
if item
@typeArray.each do |type, items| @typeArray.each do |type, items|
next if !items.include?(item.id) next if !items.include?(item.id)
ret = type if GameData::Type.exists?(type) ret = type if GameData::Type.exists?(type)
break break
end end
end
return ret return ret
end end

View File

@@ -152,7 +152,7 @@ class Trainer
def has_pokemon_of_type?(type) def has_pokemon_of_type?(type)
return false if !GameData::Type.exists?(type) return false if !GameData::Type.exists?(type)
type = GameData::Type.get(type).id type = GameData::Type.get(type).id
return pokemon_party.any? { |p| p && p.hasType(type) } return pokemon_party.any? { |p| p && p.hasType?(type) }
end end
# Checks whether any Pokémon in the party knows the given move, and returns # Checks whether any Pokémon in the party knows the given move, and returns