mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Fixing up merge
This commit is contained in:
@@ -828,7 +828,7 @@ def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbAutoplayOnTransition
|
def pbAutoplayOnTransition
|
||||||
surfbgm = pbGetMetadata(0,MetadataSurfBGM)
|
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||||
if $PokemonGlobal.surfing && surfbgm
|
if $PokemonGlobal.surfing && surfbgm
|
||||||
pbBGMPlay(surfbgm)
|
pbBGMPlay(surfbgm)
|
||||||
else
|
else
|
||||||
@@ -837,7 +837,7 @@ def pbAutoplayOnTransition
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbAutoplayOnSave
|
def pbAutoplayOnSave
|
||||||
surfbgm = pbGetMetadata(0,MetadataSurfBGM)
|
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||||
if $PokemonGlobal.surfing && surfbgm
|
if $PokemonGlobal.surfing && surfbgm
|
||||||
pbBGMPlay(surfbgm)
|
pbBGMPlay(surfbgm)
|
||||||
else
|
else
|
||||||
@@ -1124,7 +1124,7 @@ def pbFishingBegin
|
|||||||
$PokemonGlobal.fishing = true
|
$PokemonGlobal.fishing = true
|
||||||
if !pbCommonEvent(FISHING_BEGIN_COMMON_EVENT)
|
if !pbCommonEvent(FISHING_BEGIN_COMMON_EVENT)
|
||||||
patternb = 2*$game_player.direction - 1
|
patternb = 2*$game_player.direction - 1
|
||||||
meta = pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
|
meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||||
num = ($PokemonGlobal.surfing) ? 7 : 6
|
num = ($PokemonGlobal.surfing) ? 7 : 6
|
||||||
if meta && meta[num] && meta[num]!=""
|
if meta && meta[num] && meta[num]!=""
|
||||||
charset = pbGetPlayerCharset(meta,num)
|
charset = pbGetPlayerCharset(meta,num)
|
||||||
@@ -1143,7 +1143,7 @@ end
|
|||||||
def pbFishingEnd
|
def pbFishingEnd
|
||||||
if !pbCommonEvent(FISHING_END_COMMON_EVENT)
|
if !pbCommonEvent(FISHING_END_COMMON_EVENT)
|
||||||
patternb = 2*($game_player.direction - 2)
|
patternb = 2*($game_player.direction - 2)
|
||||||
meta = pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
|
meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||||
num = ($PokemonGlobal.surfing) ? 7 : 6
|
num = ($PokemonGlobal.surfing) ? 7 : 6
|
||||||
if meta && meta[num] && meta[num]!=""
|
if meta && meta[num] && meta[num]!=""
|
||||||
charset = pbGetPlayerCharset(meta,num)
|
charset = pbGetPlayerCharset(meta,num)
|
||||||
@@ -1308,8 +1308,7 @@ def pbRegisterPartner(trainerid,trainername,partyid=0)
|
|||||||
trainerobject = PokeBattle_Trainer.new(_INTL(trainer[0].name),trainerid)
|
trainerobject = PokeBattle_Trainer.new(_INTL(trainer[0].name),trainerid)
|
||||||
trainerobject.setForeignID($Trainer)
|
trainerobject.setForeignID($Trainer)
|
||||||
for i in trainer[2]
|
for i in trainer[2]
|
||||||
i.trainerID = trainerobject.id
|
i.owner = Pokemon::Owner.new_from_trainer(trainerobject)
|
||||||
i.ot = trainerobject.name
|
|
||||||
i.calcStats
|
i.calcStats
|
||||||
end
|
end
|
||||||
$PokemonGlobal.partner = [trainerid,trainerobject.name,trainerobject.id,trainer[2]]
|
$PokemonGlobal.partner = [trainerid,trainerobject.name,trainerobject.id,trainer[2]]
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ end
|
|||||||
# Compiler
|
# Compiler
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
module Compiler
|
module Compiler
|
||||||
extend self
|
module_function
|
||||||
|
|
||||||
def findIndex(a)
|
def findIndex(a)
|
||||||
index = -1
|
index = -1
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
class PBTrainers; end
|
class PBTrainers; end
|
||||||
|
|
||||||
module Compiler
|
module Compiler
|
||||||
|
module_function
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Compile metadata
|
# Compile metadata
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
@@ -12,20 +14,22 @@ module Compiler
|
|||||||
sectionname = $~[1]
|
sectionname = $~[1]
|
||||||
if currentmap==0
|
if currentmap==0
|
||||||
if sections[currentmap][Metadata::HOME]==nil
|
if sections[currentmap][Metadata::HOME]==nil
|
||||||
raise _INTL("The entry Home is required in metadata.txt section [{1}]",sectionname)
|
raise _INTL("The entry Home is required in metadata.txt section [{1}].",sectionname)
|
||||||
end
|
elsif sections[currentmap][Metadata::PLAYER_A]==nil
|
||||||
if sections[currentmap][Metadata::PLAYER_A]==nil
|
raise _INTL("The entry PlayerA is required in metadata.txt section [{1}].",sectionname)
|
||||||
raise _INTL("The entry PlayerA is required in metadata.txt section [{1}]",sectionname)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
currentmap = sectionname.to_i
|
currentmap = sectionname.to_i
|
||||||
|
if sections[currentmap]
|
||||||
|
raise _INTL("Section [{1}] is defined twice in metadata.txt.\r\n{2}",currentmap,FileLineData.linereport)
|
||||||
|
end
|
||||||
sections[currentmap] = []
|
sections[currentmap] = []
|
||||||
else
|
else
|
||||||
if currentmap<0
|
if currentmap<0
|
||||||
raise _INTL("Expected a section at the beginning of the file\r\n{1}",FileLineData.linereport)
|
raise _INTL("Expected a section at the beginning of the file.\r\n{1}",FileLineData.linereport)
|
||||||
end
|
end
|
||||||
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
|
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
|
||||||
raise _INTL("Bad line syntax (expected syntax like XXX=YYY)\r\n{1}",FileLineData.linereport)
|
raise _INTL("Bad line syntax (expected syntax like XXX=YYY).\r\n{1}",FileLineData.linereport)
|
||||||
end
|
end
|
||||||
matchData = $~
|
matchData = $~
|
||||||
schema = nil
|
schema = nil
|
||||||
@@ -219,7 +223,7 @@ module Compiler
|
|||||||
if currentmap>=0
|
if currentmap>=0
|
||||||
for reqtype in requiredtypes.keys
|
for reqtype in requiredtypes.keys
|
||||||
if !foundtypes.include?(reqtype)
|
if !foundtypes.include?(reqtype)
|
||||||
raise _INTL("Required value '{1}' not given in section '{2}'\r\n{3}",reqtype,currentmap,FileLineData.linereport)
|
raise _INTL("Required value '{1}' not given in section [{2}].\r\n{3}",reqtype,currentmap,FileLineData.linereport)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
foundtypes.clear
|
foundtypes.clear
|
||||||
@@ -228,10 +232,10 @@ module Compiler
|
|||||||
types[currentmap] = [currentmap,nil,nil,false,false,[],[],[]]
|
types[currentmap] = [currentmap,nil,nil,false,false,[],[],[]]
|
||||||
else
|
else
|
||||||
if currentmap<0
|
if currentmap<0
|
||||||
raise _INTL("Expected a section at the beginning of the file\r\n{1}",FileLineData.linereport)
|
raise _INTL("Expected a section at the beginning of the file.\r\n{1}",FileLineData.linereport)
|
||||||
end
|
end
|
||||||
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
|
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
|
||||||
raise _INTL("Bad line syntax (expected syntax like XXX=YYY)\r\n{1}",FileLineData.linereport)
|
raise _INTL("Bad line syntax (expected syntax like XXX=YYY).\r\n{1}",FileLineData.linereport)
|
||||||
end
|
end
|
||||||
matchData = $~
|
matchData = $~
|
||||||
schema = nil
|
schema = nil
|
||||||
@@ -266,17 +270,17 @@ module Compiler
|
|||||||
n = type[1]
|
n = type[1]
|
||||||
for w in type[5]
|
for w in type[5]
|
||||||
if !typeinames.include?(w)
|
if !typeinames.include?(w)
|
||||||
raise _INTL("'{1}' is not a defined type (PBS/types.txt, {2}, Weaknesses)",w,n)
|
raise _INTL("'{1}' is not a defined type (PBS/types.txt, {2}, Weaknesses).",w,n)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for w in type[6]
|
for w in type[6]
|
||||||
if !typeinames.include?(w)
|
if !typeinames.include?(w)
|
||||||
raise _INTL("'{1}' is not a defined type (PBS/types.txt, {2}, Resistances)",w,n)
|
raise _INTL("'{1}' is not a defined type (PBS/types.txt, {2}, Resistances).",w,n)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for w in type[7]
|
for w in type[7]
|
||||||
if !typeinames.include?(w)
|
if !typeinames.include?(w)
|
||||||
raise _INTL("'{1}' is not a defined type (PBS/types.txt, {2}, Immunities)",w,n)
|
raise _INTL("'{1}' is not a defined type (PBS/types.txt, {2}, Immunities).",w,n)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -328,6 +332,9 @@ module Compiler
|
|||||||
maxValue = 0
|
maxValue = 0
|
||||||
pbCompilerEachPreppedLine("PBS/abilities.txt") { |line,lineno|
|
pbCompilerEachPreppedLine("PBS/abilities.txt") { |line,lineno|
|
||||||
record = pbGetCsvRecord(line,lineno,[0,"vnss"])
|
record = pbGetCsvRecord(line,lineno,[0,"vnss"])
|
||||||
|
if movenames[record[0]]
|
||||||
|
raise _INTL("Ability ID number '{1}' is used twice.\r\n{2}",record[0],FileLineData.linereport)
|
||||||
|
end
|
||||||
movenames[record[0]] = record[2]
|
movenames[record[0]] = record[2]
|
||||||
movedescs[record[0]] = record[3]
|
movedescs[record[0]] = record[3]
|
||||||
maxValue = [maxValue,record[0]].max
|
maxValue = [maxValue,record[0]].max
|
||||||
@@ -410,6 +417,9 @@ module Compiler
|
|||||||
pbCompilerEachCommentedLine("PBS/items.txt") { |line,lineno|
|
pbCompilerEachCommentedLine("PBS/items.txt") { |line,lineno|
|
||||||
linerecord = pbGetCsvRecord(line,lineno,[0,"vnssuusuuUN"])
|
linerecord = pbGetCsvRecord(line,lineno,[0,"vnssuusuuUN"])
|
||||||
id = linerecord[0]
|
id = linerecord[0]
|
||||||
|
if records[id]
|
||||||
|
raise _INTL("Item ID number '{1}' is used twice.\r\n{2}",id,FileLineData.linereport)
|
||||||
|
end
|
||||||
record = []
|
record = []
|
||||||
record[ItemData::ID] = id
|
record[ItemData::ID] = id
|
||||||
constant = linerecord[1]
|
constant = linerecord[1]
|
||||||
@@ -468,11 +478,14 @@ module Compiler
|
|||||||
nil,nil,nil,nil,nil,PBTypes,["Physical","Special","Status"],
|
nil,nil,nil,nil,nil,PBTypes,["Physical","Special","Status"],
|
||||||
nil,nil,nil,PBTargets,nil,nil,nil
|
nil,nil,nil,PBTargets,nil,nil,nil
|
||||||
])
|
])
|
||||||
|
if records[lineRecord[0]]
|
||||||
|
raise _INTL("Move ID number '{1}' is used twice.\r\n{2}",lineRecord[0],FileLineData.linereport)
|
||||||
|
end
|
||||||
if lineRecord[6]==2 && lineRecord[4]!=0
|
if lineRecord[6]==2 && lineRecord[4]!=0
|
||||||
raise _INTL("Status moves must have a base damage of 0, use either Physical or Special\r\n{1}",FileLineData.linereport)
|
raise _INTL("Status moves must have a base damage of 0, use either Physical or Special.\r\n{1}",FileLineData.linereport)
|
||||||
end
|
end
|
||||||
if lineRecord[6]!=2 && lineRecord[4]==0
|
if lineRecord[6]!=2 && lineRecord[4]==0
|
||||||
print _INTL("Warning: Physical and special moves can't have a base damage of 0, changing to a Status move\r\n{1}",FileLineData.linereport)
|
print _INTL("Warning: Physical and special moves can't have a base damage of 0, changing to a Status move.\r\n{1}",FileLineData.linereport)
|
||||||
lineRecord[6] = 2
|
lineRecord[6] = 2
|
||||||
end
|
end
|
||||||
record[MoveData::ID] = lineRecord[0]
|
record[MoveData::ID] = lineRecord[0]
|
||||||
@@ -590,6 +603,14 @@ module Compiler
|
|||||||
# contents is a hash containing all the XXX=YYY lines in that section, where
|
# contents is a hash containing all the XXX=YYY lines in that section, where
|
||||||
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
||||||
pbEachFileSection(f) { |contents,speciesID|
|
pbEachFileSection(f) { |contents,speciesID|
|
||||||
|
# Raise an error if the species ID is 0.
|
||||||
|
if speciesID==0
|
||||||
|
raise _INTL("A Pokémon species can't be numbered 0 (PBS/pokemon.txt).")
|
||||||
|
end
|
||||||
|
# Raise an error if the species ID has already been defined.
|
||||||
|
if speciesData[speciesID]
|
||||||
|
raise _INTL("Species ID number '{1}' is used twice.\r\n{2}",speciesID,FileLineData.linereport)
|
||||||
|
end
|
||||||
# Create array to store compiled data in.
|
# Create array to store compiled data in.
|
||||||
speciesData[speciesID] = []
|
speciesData[speciesID] = []
|
||||||
# Copy Type1 into Type2 if Type2 is undefined. (All species must have two
|
# Copy Type1 into Type2 if Type2 is undefined. (All species must have two
|
||||||
@@ -606,10 +627,6 @@ module Compiler
|
|||||||
FileLineData.setSection(speciesID,key,contents[key]) # For error reporting
|
FileLineData.setSection(speciesID,key,contents[key]) # For error reporting
|
||||||
maxValue = [maxValue,speciesID].max # Set highest species ID
|
maxValue = [maxValue,speciesID].max # Set highest species ID
|
||||||
next if hash[key][0]<0 # Property is not to be compiled; skip it
|
next if hash[key][0]<0 # Property is not to be compiled; skip it
|
||||||
# Raise an error if the species ID is 0.
|
|
||||||
if speciesID==0
|
|
||||||
raise _INTL("A Pokémon species can't be numbered 0 (PBS/pokemon.txt)")
|
|
||||||
end
|
|
||||||
# Skip empty optional properties, or raise an error if a required
|
# Skip empty optional properties, or raise an error if a required
|
||||||
# property is empty.
|
# property is empty.
|
||||||
if !contents[key] || contents[key]==""
|
if !contents[key] || contents[key]==""
|
||||||
@@ -1012,6 +1029,9 @@ module Compiler
|
|||||||
if !line[/^\#/] && !line[/^\s*$/]
|
if !line[/^\#/] && !line[/^\s*$/]
|
||||||
if line[/^\s*\[\s*(.*)\s*\]\s*$/]
|
if line[/^\s*\[\s*(.*)\s*\]\s*$/]
|
||||||
sectionname = parseMove($~[1])
|
sectionname = parseMove($~[1])
|
||||||
|
if sections[sectionname]
|
||||||
|
raise _INTL("TM section [{1}] is defined twice.\r\n{2}",sectionname,FileLineData.linereport)
|
||||||
|
end
|
||||||
sections[sectionname] = WordArray.new
|
sections[sectionname] = WordArray.new
|
||||||
havesection = true
|
havesection = true
|
||||||
else
|
else
|
||||||
@@ -1092,13 +1112,16 @@ module Compiler
|
|||||||
mapid = line[/^\d+$/]
|
mapid = line[/^\d+$/]
|
||||||
if mapid
|
if mapid
|
||||||
lastmapid = mapid
|
lastmapid = mapid
|
||||||
|
if encounters[mapid.to_i]
|
||||||
|
raise _INTL("Encounters for map ID '{1}' are defined twice.\r\n{2}",mapid,FileLineData.linereport)
|
||||||
|
end
|
||||||
if thisenc && (thisenc[1][EncounterTypes::Land] ||
|
if thisenc && (thisenc[1][EncounterTypes::Land] ||
|
||||||
thisenc[1][EncounterTypes::LandMorning] ||
|
thisenc[1][EncounterTypes::LandMorning] ||
|
||||||
thisenc[1][EncounterTypes::LandDay] ||
|
thisenc[1][EncounterTypes::LandDay] ||
|
||||||
thisenc[1][EncounterTypes::LandNight] ||
|
thisenc[1][EncounterTypes::LandNight] ||
|
||||||
thisenc[1][EncounterTypes::BugContest]) &&
|
thisenc[1][EncounterTypes::BugContest]) &&
|
||||||
thisenc[1][EncounterTypes::Cave]
|
thisenc[1][EncounterTypes::Cave]
|
||||||
raise _INTL("Can't define both Land and Cave encounters in the same area (map ID {1})",mapid)
|
raise _INTL("Can't define both Land and Cave encounters in the same area (map ID '{1}').",mapid)
|
||||||
end
|
end
|
||||||
thisenc = [EncounterTypes::EnctypeDensities.clone,[]]
|
thisenc = [EncounterTypes::EnctypeDensities.clone,[]]
|
||||||
encounters[mapid.to_i] = thisenc
|
encounters[mapid.to_i] = thisenc
|
||||||
@@ -1223,10 +1246,10 @@ module Compiler
|
|||||||
if line[/^\s*\[\s*(.+)\s*\]\s*$/]
|
if line[/^\s*\[\s*(.+)\s*\]\s*$/]
|
||||||
# Section [trainertype,trainername] or [trainertype,trainername,partyid]
|
# Section [trainertype,trainername] or [trainertype,trainername,partyid]
|
||||||
if oldcompilerline>0
|
if oldcompilerline>0
|
||||||
raise _INTL("Previous trainer not defined with as many Pokémon as expected\r\n{1}",FileLineData.linereport)
|
raise _INTL("Previous trainer not defined with as many Pokémon as expected.\r\n{1}",FileLineData.linereport)
|
||||||
end
|
end
|
||||||
if pokemonindex==-1
|
if pokemonindex==-1
|
||||||
raise _INTL("Started new trainer while previous trainer has no Pokémon\r\n{1}",FileLineData.linereport)
|
raise _INTL("Started new trainer while previous trainer has no Pokémon.\r\n{1}",FileLineData.linereport)
|
||||||
end
|
end
|
||||||
section = pbGetCsvRecord($~[1],lineno,[0,"esU",PBTrainers])
|
section = pbGetCsvRecord($~[1],lineno,[0,"esU",PBTrainers])
|
||||||
trainerindex += 1
|
trainerindex += 1
|
||||||
@@ -1239,10 +1262,10 @@ module Compiler
|
|||||||
elsif line[/^\s*(\w+)\s*=\s*(.*)$/]
|
elsif line[/^\s*(\w+)\s*=\s*(.*)$/]
|
||||||
# XXX=YYY lines
|
# XXX=YYY lines
|
||||||
if trainerindex<0
|
if trainerindex<0
|
||||||
raise _INTL("Expected a section at the beginning of the file\r\n{1}",FileLineData.linereport)
|
raise _INTL("Expected a section at the beginning of the file.\r\n{1}",FileLineData.linereport)
|
||||||
end
|
end
|
||||||
if oldcompilerline>0
|
if oldcompilerline>0
|
||||||
raise _INTL("Previous trainer not defined with as many Pokémon as expected\r\n{1}",FileLineData.linereport)
|
raise _INTL("Previous trainer not defined with as many Pokémon as expected.\r\n{1}",FileLineData.linereport)
|
||||||
end
|
end
|
||||||
settingname = $~[1]
|
settingname = $~[1]
|
||||||
schema = trainer_info_types[settingname]
|
schema = trainer_info_types[settingname]
|
||||||
@@ -1252,43 +1275,43 @@ module Compiler
|
|||||||
case settingname
|
case settingname
|
||||||
when "Pokemon"
|
when "Pokemon"
|
||||||
if record[1]>mLevel
|
if record[1]>mLevel
|
||||||
raise _INTL("Bad level: {1} (must be 1-{2})\r\n{3}",record[1],mLevel,FileLineData.linereport)
|
raise _INTL("Bad level: {1} (must be 1-{2}).\r\n{3}",record[1],mLevel,FileLineData.linereport)
|
||||||
end
|
end
|
||||||
when "Moves"
|
when "Moves"
|
||||||
record = [record] if record.is_a?(Integer)
|
record = [record] if record.is_a?(Integer)
|
||||||
record.compact!
|
record.compact!
|
||||||
when "Ability"
|
when "Ability"
|
||||||
if record>5
|
if record>5
|
||||||
raise _INTL("Bad ability flag: {1} (must be 0 or 1 or 2-5)\r\n{2}",record,FileLineData.linereport)
|
raise _INTL("Bad ability flag: {1} (must be 0 or 1 or 2-5).\r\n{2}",record,FileLineData.linereport)
|
||||||
end
|
end
|
||||||
when "IV"
|
when "IV"
|
||||||
record = [record] if record.is_a?(Integer)
|
record = [record] if record.is_a?(Integer)
|
||||||
record.compact!
|
record.compact!
|
||||||
for i in record
|
for i in record
|
||||||
next if i<=Pokemon::IV_STAT_LIMIT
|
next if i<=Pokemon::IV_STAT_LIMIT
|
||||||
raise _INTL("Bad IV: {1} (must be 0-{2})\r\n{3}", i, Pokemon::IV_STAT_LIMIT, FileLineData.linereport)
|
raise _INTL("Bad IV: {1} (must be 0-{2}).\r\n{3}", i, Pokemon::IV_STAT_LIMIT, FileLineData.linereport)
|
||||||
end
|
end
|
||||||
when "EV"
|
when "EV"
|
||||||
record = [record] if record.is_a?(Integer)
|
record = [record] if record.is_a?(Integer)
|
||||||
record.compact!
|
record.compact!
|
||||||
for i in record
|
for i in record
|
||||||
next if i<=Pokemon::EV_STAT_LIMIT
|
next if i<=Pokemon::EV_STAT_LIMIT
|
||||||
raise _INTL("Bad EV: {1} (must be 0-{2})\r\n{3}", i, Pokemon::EV_STAT_LIMIT, FileLineData.linereport)
|
raise _INTL("Bad EV: {1} (must be 0-{2}).\r\n{3}", i, Pokemon::EV_STAT_LIMIT, FileLineData.linereport)
|
||||||
end
|
end
|
||||||
evtotal = 0
|
evtotal = 0
|
||||||
for i in 0...6
|
for i in 0...6
|
||||||
evtotal += (i<record.length) ? record[i] : record[0]
|
evtotal += (i<record.length) ? record[i] : record[0]
|
||||||
end
|
end
|
||||||
if evtotal>Pokemon::EV_LIMIT
|
if evtotal>Pokemon::EV_LIMIT
|
||||||
raise _INTL("Total EVs are greater than allowed ({1})\r\n{2}", Pokemon::EV_LIMIT, FileLineData.linereport)
|
raise _INTL("Total EVs are greater than allowed ({1}).\r\n{2}", Pokemon::EV_LIMIT, FileLineData.linereport)
|
||||||
end
|
end
|
||||||
when "Happiness"
|
when "Happiness"
|
||||||
if record>255
|
if record>255
|
||||||
raise _INTL("Bad happiness: {1} (must be 0-255)\r\n{2}",record,FileLineData.linereport)
|
raise _INTL("Bad happiness: {1} (must be 0-255).\r\n{2}",record,FileLineData.linereport)
|
||||||
end
|
end
|
||||||
when "Name"
|
when "Name"
|
||||||
if record.length>Pokemon::MAX_NAME_SIZE
|
if record.length>Pokemon::MAX_NAME_SIZE
|
||||||
raise _INTL("Bad nickname: {1} (must be 1-{2} characters)\r\n{3}", record, Pokemon::MAX_NAME_SIZE, FileLineData.linereport)
|
raise _INTL("Bad nickname: {1} (must be 1-{2} characters).\r\n{3}", record, Pokemon::MAX_NAME_SIZE, FileLineData.linereport)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Record XXX=YYY setting
|
# Record XXX=YYY setting
|
||||||
@@ -1314,7 +1337,7 @@ module Compiler
|
|||||||
else
|
else
|
||||||
# Old compiler - backwards compatibility is SUCH fun!
|
# Old compiler - backwards compatibility is SUCH fun!
|
||||||
if pokemonindex==-1 && oldcompilerline==0
|
if pokemonindex==-1 && oldcompilerline==0
|
||||||
raise _INTL("Unexpected line format, started new trainer while previous trainer has no Pokémon\r\n{1}",FileLineData.linereport)
|
raise _INTL("Unexpected line format, started new trainer while previous trainer has no Pokémon.\r\n{1}",FileLineData.linereport)
|
||||||
end
|
end
|
||||||
if oldcompilerline==0 # Started an old trainer section
|
if oldcompilerline==0 # Started an old trainer section
|
||||||
oldcompilerlength = 3
|
oldcompilerlength = 3
|
||||||
@@ -1356,29 +1379,29 @@ module Compiler
|
|||||||
case i
|
case i
|
||||||
when TrainerData::LEVEL
|
when TrainerData::LEVEL
|
||||||
if record[i]>mLevel
|
if record[i]>mLevel
|
||||||
raise _INTL("Bad level: {1} (must be 1-{2})\r\n{3}",record[i],mLevel,FileLineData.linereport)
|
raise _INTL("Bad level: {1} (must be 1-{2}).\r\n{3}",record[i],mLevel,FileLineData.linereport)
|
||||||
end
|
end
|
||||||
when TrainerData::ABILITY+3
|
when TrainerData::ABILITY+3
|
||||||
if record[i]>5
|
if record[i]>5
|
||||||
raise _INTL("Bad ability flag: {1} (must be 0 or 1 or 2-5)\r\n{2}",record[i],FileLineData.linereport)
|
raise _INTL("Bad ability flag: {1} (must be 0 or 1 or 2-5).\r\n{2}",record[i],FileLineData.linereport)
|
||||||
end
|
end
|
||||||
when TrainerData::IV+3
|
when TrainerData::IV+3
|
||||||
if record[i]>31
|
if record[i]>31
|
||||||
raise _INTL("Bad IV: {1} (must be 0-31)\r\n{2}",record[i],FileLineData.linereport)
|
raise _INTL("Bad IV: {1} (must be 0-31).\r\n{2}",record[i],FileLineData.linereport)
|
||||||
end
|
end
|
||||||
record[i] = [record[i]]
|
record[i] = [record[i]]
|
||||||
when TrainerData::EV+3
|
when TrainerData::EV+3
|
||||||
if record[i]>Pokemon::EV_STAT_LIMIT
|
if record[i]>Pokemon::EV_STAT_LIMIT
|
||||||
raise _INTL("Bad EV: {1} (must be 0-{2})\r\n{3}", record[i], Pokemon::EV_STAT_LIMIT, FileLineData.linereport)
|
raise _INTL("Bad EV: {1} (must be 0-{2}).\r\n{3}", record[i], Pokemon::EV_STAT_LIMIT, FileLineData.linereport)
|
||||||
end
|
end
|
||||||
record[i] = [record[i]]
|
record[i] = [record[i]]
|
||||||
when TrainerData::HAPPINESS+3
|
when TrainerData::HAPPINESS+3
|
||||||
if record[i]>255
|
if record[i]>255
|
||||||
raise _INTL("Bad happiness: {1} (must be 0-255)\r\n{2}",record[i],FileLineData.linereport)
|
raise _INTL("Bad happiness: {1} (must be 0-255).\r\n{2}",record[i],FileLineData.linereport)
|
||||||
end
|
end
|
||||||
when TrainerData::NAME+3
|
when TrainerData::NAME+3
|
||||||
if record[i].length>Pokemon::MAX_NAME_SIZE
|
if record[i].length>Pokemon::MAX_NAME_SIZE
|
||||||
raise _INTL("Bad nickname: {1} (must be 1-{2} characters)\r\n{3}", record[i], Pokemon::MAX_NAME_SIZE, FileLineData.linereport)
|
raise _INTL("Bad nickname: {1} (must be 1-{2} characters).\r\n{3}", record[i], Pokemon::MAX_NAME_SIZE, FileLineData.linereport)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1482,10 +1505,10 @@ module Compiler
|
|||||||
rsection[schema[0]] = record
|
rsection[schema[0]] = record
|
||||||
end
|
end
|
||||||
if !rsection[0]
|
if !rsection[0]
|
||||||
raise _INTL("No trainer data file given in section {1}\r\n{2}",name,FileLineData.linereport)
|
raise _INTL("No trainer data file given in section {1}.\r\n{2}",name,FileLineData.linereport)
|
||||||
end
|
end
|
||||||
if !rsection[1]
|
if !rsection[1]
|
||||||
raise _INTL("No trainer data file given in section {1}\r\n{2}",name,FileLineData.linereport)
|
raise _INTL("No trainer data file given in section {1}.\r\n{2}",name,FileLineData.linereport)
|
||||||
end
|
end
|
||||||
rsection[3] = rsection[0]
|
rsection[3] = rsection[0]
|
||||||
rsection[4] = rsection[1]
|
rsection[4] = rsection[1]
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
module Compiler
|
module Compiler
|
||||||
|
module_function
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Add new map files to the map tree.
|
# Add new map files to the map tree.
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
@@ -579,7 +581,7 @@ module Compiler
|
|||||||
end
|
end
|
||||||
push_script(firstpage.list,"setBattleRule(\"double\")") if doublebattle
|
push_script(firstpage.list,"setBattleRule(\"double\")") if doublebattle
|
||||||
push_script(firstpage.list,sprintf("setBattleRule(\"backdrop\",\"%s\")",safequote(backdrop))) if backdrop
|
push_script(firstpage.list,sprintf("setBattleRule(\"backdrop\",\"%s\")",safequote(backdrop))) if backdrop
|
||||||
push_script(firstpage.list,sprintf("setBattleRule(\"outcomeVar\",%d)",outcomeVar)) if outcome>1
|
push_script(firstpage.list,sprintf("setBattleRule(\"outcomeVar\",%d)",outcome)) if outcome>1
|
||||||
push_script(firstpage.list,"setBattleRule(\"canLose\")") if continue
|
push_script(firstpage.list,"setBattleRule(\"canLose\")") if continue
|
||||||
espeech = (endspeeches[0]) ? sprintf("_I(\"%s\")",safequote2(endspeeches[0])) : "nil"
|
espeech = (endspeeches[0]) ? sprintf("_I(\"%s\")",safequote2(endspeeches[0])) : "nil"
|
||||||
if battleid>0
|
if battleid>0
|
||||||
@@ -628,7 +630,7 @@ module Compiler
|
|||||||
push_text(rematchpage.list,battles[i],1)
|
push_text(rematchpage.list,battles[i],1)
|
||||||
push_script(rematchpage.list,"setBattleRule(\"double\")",1) if doublebattle
|
push_script(rematchpage.list,"setBattleRule(\"double\")",1) if doublebattle
|
||||||
push_script(rematchpage.list,sprintf("setBattleRule(\"backdrop\",%s)",safequote(backdrop)),1) if backdrop
|
push_script(rematchpage.list,sprintf("setBattleRule(\"backdrop\",%s)",safequote(backdrop)),1) if backdrop
|
||||||
push_script(rematchpage.list,sprintf("setBattleRule(\"outcomeVar\",%d)",outcomeVar),1) if outcome>1
|
push_script(rematchpage.list,sprintf("setBattleRule(\"outcomeVar\",%d)",outcome),1) if outcome>1
|
||||||
push_script(rematchpage.list,"setBattleRule(\"canLose\")",1) if continue
|
push_script(rematchpage.list,"setBattleRule(\"canLose\")",1) if continue
|
||||||
espeech = nil
|
espeech = nil
|
||||||
if endspeeches.length>0
|
if endspeeches.length>0
|
||||||
|
|||||||
Reference in New Issue
Block a user