Fixed some errors when converting code in old trainer events to new code

This commit is contained in:
Maruno17
2023-04-07 12:43:24 +01:00
parent 5315b53eae
commit 956a511ec5

View File

@@ -1012,13 +1012,13 @@ module Compiler
list[index].parameters[1] = sprintf("WildBattle.start(#{pkmn1}, #{pkmn2})")
old_indent = list[index].indent
new_events = []
if battle_params[3] && battle_params[5][/false/]
if battle_params[5] && battle_params[5][/false/]
push_script(new_events, "setBattleRule(\"cannotRun\")", old_indent)
end
if battle_params[4] && battle_params[6][/true/]
if battle_params[6] && battle_params[6][/true/]
push_script(new_events, "setBattleRule(\"canLose\")", old_indent)
end
if battle_params[2] && battle_params[4] != "1"
if battle_params[4] && battle_params[4] != "1"
push_script(new_events, "setBattleRule(\"outcome\", #{battle_params[4]})", old_indent)
end
list[index, 0] = new_events if new_events.length > 0
@@ -1031,13 +1031,13 @@ module Compiler
list[index].parameters[1] = sprintf("WildBattle.start(#{pkmn1}, #{pkmn2}, #{pkmn3})")
old_indent = list[index].indent
new_events = []
if battle_params[3] && battle_params[7][/false/]
if battle_params[7] && battle_params[7][/false/]
push_script(new_events, "setBattleRule(\"cannotRun\")", old_indent)
end
if battle_params[4] && battle_params[8][/true/]
if battle_params[8] && battle_params[8][/true/]
push_script(new_events, "setBattleRule(\"canLose\")", old_indent)
end
if battle_params[2] && battle_params[6] != "1"
if battle_params[6] && battle_params[6] != "1"
push_script(new_events, "setBattleRule(\"outcome\", #{battle_params[6]})", old_indent)
end
list[index, 0] = new_events if new_events.length > 0
@@ -1108,7 +1108,7 @@ module Compiler
speech = battle_params[7].gsub(/^\s*_I\(\s*"\s*/, "").gsub(/\"\s*\)\s*$/, "")
push_comment(new_events, "EndSpeech2: #{speech.strip}", old_indent)
end
if battle_params[7] && !battle_params[7].empty? && battle_params[11] != "nil"
if battle_params[11] && !battle_params[11].empty? && battle_params[11] != "nil"
speech = battle_params[11].gsub(/^\s*_I\(\s*"\s*/, "").gsub(/\"\s*\)\s*$/, "")
push_comment(new_events, "EndSpeech3: #{speech.strip}", old_indent)
end