diff --git a/Data/Actors.rxdata b/Data/Actors.rxdata index 7967a5432..41edc8e26 100644 Binary files a/Data/Actors.rxdata and b/Data/Actors.rxdata differ diff --git a/Data/Animations.rxdata b/Data/Animations.rxdata index d940ad63a..065a7e253 100644 Binary files a/Data/Animations.rxdata and b/Data/Animations.rxdata differ diff --git a/Data/Armors.rxdata b/Data/Armors.rxdata index 2249bec14..901f2bb2b 100644 Binary files a/Data/Armors.rxdata and b/Data/Armors.rxdata differ diff --git a/Data/CommonEvents.rxdata b/Data/CommonEvents.rxdata index 68fb7070c..0fdb778d1 100644 Binary files a/Data/CommonEvents.rxdata and b/Data/CommonEvents.rxdata differ diff --git a/Data/Enemies.rxdata b/Data/Enemies.rxdata index 004ee903d..be622f513 100644 Binary files a/Data/Enemies.rxdata and b/Data/Enemies.rxdata differ diff --git a/Data/Items.rxdata b/Data/Items.rxdata index 3e62ba6d2..fe767fa0b 100644 Binary files a/Data/Items.rxdata and b/Data/Items.rxdata differ diff --git a/Data/Map295.rxdata b/Data/Map295.rxdata index 56bcb78eb..5b4ea64d5 100644 Binary files a/Data/Map295.rxdata and b/Data/Map295.rxdata differ diff --git a/Data/Map318.rxdata b/Data/Map318.rxdata index 0e56b83a5..4c0a59d5d 100644 Binary files a/Data/Map318.rxdata and b/Data/Map318.rxdata differ diff --git a/Data/Map328.rxdata b/Data/Map328.rxdata index 951cfa3cc..2e7635edb 100644 Binary files a/Data/Map328.rxdata and b/Data/Map328.rxdata differ diff --git a/Data/Map405.rxdata b/Data/Map405.rxdata index 66d7f6751..83821cbac 100644 Binary files a/Data/Map405.rxdata and b/Data/Map405.rxdata differ diff --git a/Data/Map407.rxdata b/Data/Map407.rxdata index 820455ec4..38dd60c08 100644 Binary files a/Data/Map407.rxdata and b/Data/Map407.rxdata differ diff --git a/Data/MapInfos.rxdata b/Data/MapInfos.rxdata index 638419312..261775b02 100644 Binary files a/Data/MapInfos.rxdata and b/Data/MapInfos.rxdata differ diff --git a/Data/Scripts/007_Objects and windows/011_Messages.rb b/Data/Scripts/007_Objects and windows/011_Messages.rb index 3420fe1b8..2fe29e4a2 100644 --- a/Data/Scripts/007_Objects and windows/011_Messages.rb +++ b/Data/Scripts/007_Objects and windows/011_Messages.rb @@ -3,8 +3,8 @@ #=============================================================================== class Scene_Map def updatemini - oldmws=$game_temp.message_window_showing - $game_temp.message_window_showing=true + oldmws = $game_temp.message_window_showing + $game_temp.message_window_showing = true loop do $game_map.update $game_player.update @@ -18,22 +18,20 @@ class Scene_Map transfer_player break if $game_temp.transition_processing end - $game_temp.message_window_showing=oldmws + $game_temp.message_window_showing = oldmws @spriteset.update if @spriteset @message_window.update if @message_window end end - - class Scene_Battle def updatemini if self.respond_to?("update_basic") update_basic(true) - update_info_viewport # Update information viewport + update_info_viewport # Update information viewport else - oldmws=$game_temp.message_window_showing - $game_temp.message_window_showing=true + oldmws = $game_temp.message_window_showing + $game_temp.message_window_showing = true # Update system (timer) and screen $game_system.update if $game_screen @@ -51,7 +49,7 @@ class Scene_Battle @party_command_window.update if @party_command_window @actor_command_window.update if @actor_command_window @status_window.update if @status_window - $game_temp.message_window_showing=oldmws + $game_temp.message_window_showing = oldmws @message_window.update if @message_window # Update sprite set @spriteset.update if @spriteset @@ -59,8 +57,6 @@ class Scene_Battle end end - - def pbMapInterpreter if $game_map.respond_to?("interpreter") return $game_map.interpreter @@ -104,9 +100,9 @@ end #=============================================================================== def pbEventCommentInput(*args) parameters = [] - list = *args[0].list # Event or event page - elements = *args[1] # Number of elements - trigger = *args[2] # Trigger + list = *args[0].list # Event or event page + elements = *args[1] # Number of elements + trigger = *args[2] # Trigger return nil if list == nil return nil unless list.is_a?(Array) for item in list @@ -124,40 +120,38 @@ def pbEventCommentInput(*args) return nil end -def pbCurrentEventCommentInput(elements,trigger) +def pbCurrentEventCommentInput(elements, trigger) return nil if !pbMapInterpreterRunning? event = pbMapInterpreter.get_character(0) return nil if !event - return pbEventCommentInput(event,elements,trigger) + return pbEventCommentInput(event, elements, trigger) end - - #=============================================================================== # #=============================================================================== class ChooseNumberParams def initialize - @maxDigits=0 - @minNumber=0 - @maxNumber=0 - @skin=nil - @messageSkin=nil - @negativesAllowed=false - @initialNumber=0 - @cancelNumber=nil + @maxDigits = 0 + @minNumber = 0 + @maxNumber = 0 + @skin = nil + @messageSkin = nil + @negativesAllowed = false + @initialNumber = 0 + @cancelNumber = nil end def setMessageSkin(value) - @messageSkin=value + @messageSkin = value end - def messageSkin # Set the full path for the message's window skin + def messageSkin # Set the full path for the message's window skin @messageSkin end def setSkin(value) - @skin=value + @skin = value end def skin @@ -165,35 +159,35 @@ class ChooseNumberParams end def setNegativesAllowed(value) - @negativeAllowed=value + @negativeAllowed = value end def negativesAllowed @negativeAllowed ? true : false end - def setRange(minNumber,maxNumber) - maxNumber=minNumber if minNumber>maxNumber - @maxDigits=0 - @minNumber=minNumber - @maxNumber=maxNumber + def setRange(minNumber, maxNumber) + maxNumber = minNumber if minNumber > maxNumber + @maxDigits = 0 + @minNumber = minNumber + @maxNumber = maxNumber end def setDefaultValue(number) - @initialNumber=number - @cancelNumber=nil + @initialNumber = number + @cancelNumber = nil end def setInitialValue(number) - @initialNumber=number + @initialNumber = number end def setCancelValue(number) - @cancelNumber=number + @cancelNumber = number end def initialNumber - return clamp(@initialNumber,self.minNumber,self.maxNumber) + return clamp(@initialNumber, self.minNumber, self.maxNumber) end def cancelNumber @@ -201,72 +195,70 @@ class ChooseNumberParams end def minNumber - ret=0 - if @maxDigits>0 - ret=-((10**@maxDigits)-1) + ret = 0 + if @maxDigits > 0 + ret = -((10 ** @maxDigits) - 1) else - ret=@minNumber + ret = @minNumber end - ret=0 if !@negativeAllowed && ret<0 + ret = 0 if !@negativeAllowed && ret < 0 return ret end def maxNumber - ret=0 - if @maxDigits>0 - ret=((10**@maxDigits)-1) + ret = 0 + if @maxDigits > 0 + ret = ((10 ** @maxDigits) - 1) else - ret=@maxNumber + ret = @maxNumber end - ret=0 if !@negativeAllowed && ret<0 + ret = 0 if !@negativeAllowed && ret < 0 return ret end def setMaxDigits(value) - @maxDigits=[1,value].max + @maxDigits = [1, value].max end def maxDigits - if @maxDigits>0 + if @maxDigits > 0 return @maxDigits else - return [numDigits(self.minNumber),numDigits(self.maxNumber)].max + return [numDigits(self.minNumber), numDigits(self.maxNumber)].max end end private - def clamp(v,mn,mx) - return vmx ? mx : v) + def clamp(v, mn, mx) + return v < mn ? mn : (v > mx ? mx : v) end def numDigits(number) ans = 1 - number=number.abs + number = number.abs while number >= 10 - ans+=1 - number/=10 + ans += 1 + number /= 10 end return ans end end - - -def pbChooseNumber(msgwindow,params) +def pbChooseNumber(msgwindow, params) return 0 if !params - ret=0 - maximum=params.maxNumber - minimum=params.minNumber - defaultNumber=params.initialNumber - cancelNumber=params.cancelNumber - cmdwindow=Window_InputNumberPokemon.new(params.maxDigits) - cmdwindow.z=99999 - cmdwindow.visible=true + ret = 0 + maximum = params.maxNumber + minimum = params.minNumber + defaultNumber = params.initialNumber + cancelNumber = params.cancelNumber + cmdwindow = Window_InputNumberPokemon.new(params.maxDigits) + cmdwindow.z = 99999 + cmdwindow.visible = true cmdwindow.setSkin(params.skin) if params.skin - cmdwindow.sign=params.negativesAllowed # must be set before number - cmdwindow.number=defaultNumber - pbPositionNearMsgWindow(cmdwindow,msgwindow,:right) + cmdwindow.sign = params.negativesAllowed # must be set before number + cmdwindow.number = defaultNumber + pbPositionNearMsgWindow(cmdwindow, msgwindow, :right) loop do Graphics.update Input.update @@ -275,10 +267,10 @@ def pbChooseNumber(msgwindow,params) msgwindow.update if msgwindow yield if block_given? if Input.trigger?(Input::USE) - ret=cmdwindow.number - if ret>maximum + ret = cmdwindow.number + if ret > maximum pbPlayBuzzerSE() - elsif ret1 + if @facebitmaptmp.totalFrames > 1 @facebitmaptmp.update - @facebitmap.blt(0,0,@facebitmaptmp.bitmap,Rect.new( - (@faceIndex % 4) * 96, - (@faceIndex / 4) * 96, 96, 96 + @facebitmap.blt(0, 0, @facebitmaptmp.bitmap, Rect.new( + (@faceIndex % 4) * 96, + (@faceIndex / 4) * 96, 96, 96 )) end end @@ -335,8 +325,6 @@ class FaceWindowVX < SpriteWindow_Base end end - - #=============================================================================== # #=============================================================================== @@ -351,254 +339,248 @@ def pbGetBasicMapNameFromId(id) end def pbGetMapNameFromId(id) - map=pbGetBasicMapNameFromId(id) - map.gsub!(/\\PN/,$Trainer.name) if $Trainer + map = pbGetBasicMapNameFromId(id) + map.gsub!(/\\PN/, $Trainer.name) if $Trainer return map end def pbCsvField!(str) - ret="" - str.sub!(/\A\s*/,"") - if str[0,1]=="\"" - str[0,1]="" - escaped=false - fieldbytes=0 + ret = "" + str.sub!(/\A\s*/, "") + if str[0, 1] == "\"" + str[0, 1] = "" + escaped = false + fieldbytes = 0 str.scan(/./) do |s| - fieldbytes+=s.length - break if s=="\"" && !escaped - if s=="\\" && !escaped - escaped=true + fieldbytes += s.length + break if s == "\"" && !escaped + if s == "\\" && !escaped + escaped = true else - ret+=s - escaped=false + ret += s + escaped = false end end - str[0,fieldbytes]="" + str[0, fieldbytes] = "" if !str[/\A\s*,/] && !str[/\A\s*$/] - raise _INTL("Invalid quoted field (in: {1})",ret) + raise _INTL("Invalid quoted field (in: {1})", ret) end - str[0,str.length]=$~.post_match + str[0, str.length] = $~.post_match else if str[/,/] - str[0,str.length]=$~.post_match - ret=$~.pre_match + str[0, str.length] = $~.post_match + ret = $~.pre_match else - ret=str.clone - str[0,str.length]="" + ret = str.clone + str[0, str.length] = "" end - ret.gsub!(/\s+$/,"") + ret.gsub!(/\s+$/, "") end return ret end def pbCsvPosInt!(str) - ret=pbCsvField!(str) + ret = pbCsvField!(str) if !ret[/\A\d+$/] - raise _INTL("Field {1} is not a positive integer",ret) + raise _INTL("Field {1} is not a positive integer", ret) end return ret.to_i end - - #=============================================================================== # Money and coins windows #=============================================================================== def pbGetGoldString - moneyString="" + moneyString = "" begin - moneyString=_INTL("${1}",$Trainer.money.to_s_formatted) + moneyString = _INTL("${1}", $Trainer.money.to_s_formatted) rescue if $data_system.respond_to?("words") - moneyString=_INTL("{1} {2}",$game_party.gold,$data_system.words.gold) + moneyString = _INTL("{1} {2}", $game_party.gold, $data_system.words.gold) else - moneyString=_INTL("{1} {2}",$game_party.gold,Vocab.gold) + moneyString = _INTL("{1} {2}", $game_party.gold, Vocab.gold) end end return moneyString end def pbDisplayGoldWindow(msgwindow) - moneyString=pbGetGoldString() - goldwindow=Window_AdvancedTextPokemon.new(_INTL("Money:\n{1}",moneyString)) + moneyString = pbGetGoldString() + goldwindow = Window_AdvancedTextPokemon.new(_INTL("Money:\n{1}", moneyString)) goldwindow.setSkin("Graphics/Windowskins/goldskin") - goldwindow.resizeToFit(goldwindow.text,Graphics.width) - goldwindow.width=160 if goldwindow.width<=160 - if msgwindow.y==0 - goldwindow.y=Graphics.height-goldwindow.height + goldwindow.resizeToFit(goldwindow.text, Graphics.width) + goldwindow.width = 160 if goldwindow.width <= 160 + if msgwindow.y == 0 + goldwindow.y = Graphics.height - goldwindow.height else - goldwindow.y=0 + goldwindow.y = 0 end - goldwindow.viewport=msgwindow.viewport - goldwindow.z=msgwindow.z + goldwindow.viewport = msgwindow.viewport + goldwindow.z = msgwindow.z return goldwindow end def pbDisplayBattleFactoryPointsWindow(msgwindow) pointsString = $game_variables[BATTLE_FACTORY_TOKENS].to_s - pointswindow=Window_AdvancedTextPokemon.new(_INTL("Tokens:\n{1}", pointsString)) + pointswindow = Window_AdvancedTextPokemon.new(_INTL("Tokens:\n{1}", pointsString)) pointswindow.setSkin("Graphics/Windowskins/goldskin") - pointswindow.resizeToFit(pointswindow.text,Graphics.width) - pointswindow.width=160 if pointswindow.width<=160 - if msgwindow.y==0 - pointswindow.y=Graphics.height-pointswindow.height + pointswindow.resizeToFit(pointswindow.text, Graphics.width) + pointswindow.width = 160 if pointswindow.width <= 160 + if msgwindow.y == 0 + pointswindow.y = Graphics.height - pointswindow.height else - pointswindow.y=0 + pointswindow.y = 0 end - pointswindow.viewport=msgwindow.viewport - pointswindow.z=msgwindow.z + pointswindow.viewport = msgwindow.viewport + pointswindow.z = msgwindow.z return pointswindow end def pbDisplayHeartScalesWindow(msgwindow) pointsString = $PokemonBag.pbQuantity(:HEARTSCALE).to_s - pointswindow=Window_AdvancedTextPokemon.new(_INTL("Heart Scales:\n{1}", pointsString)) + pointswindow = Window_AdvancedTextPokemon.new(_INTL("Heart Scales:\n{1}", pointsString)) pointswindow.setSkin("Graphics/Windowskins/goldskin") - pointswindow.resizeToFit(pointswindow.text,Graphics.width) - pointswindow.width=160 if pointswindow.width<=160 - if msgwindow.y==0 - pointswindow.y=Graphics.height-pointswindow.height + pointswindow.resizeToFit(pointswindow.text, Graphics.width) + pointswindow.width = 160 if pointswindow.width <= 160 + if msgwindow.y == 0 + pointswindow.y = Graphics.height - pointswindow.height else - pointswindow.y=0 + pointswindow.y = 0 end - pointswindow.viewport=msgwindow.viewport - pointswindow.z=msgwindow.z + pointswindow.viewport = msgwindow.viewport + pointswindow.z = msgwindow.z return pointswindow end -def pbDisplayCoinsWindow(msgwindow,goldwindow) - coinString=($Trainer) ? $Trainer.coins.to_s_formatted : "0" - coinwindow=Window_AdvancedTextPokemon.new(_INTL("Coins:\n{1}",coinString)) +def pbDisplayCoinsWindow(msgwindow, goldwindow) + coinString = ($Trainer) ? $Trainer.coins.to_s_formatted : "0" + coinwindow = Window_AdvancedTextPokemon.new(_INTL("Coins:\n{1}", coinString)) coinwindow.setSkin("Graphics/Windowskins/goldskin") - coinwindow.resizeToFit(coinwindow.text,Graphics.width) - coinwindow.width=160 if coinwindow.width<=160 - if msgwindow.y==0 - coinwindow.y=(goldwindow) ? goldwindow.y-coinwindow.height : Graphics.height-coinwindow.height + coinwindow.resizeToFit(coinwindow.text, Graphics.width) + coinwindow.width = 160 if coinwindow.width <= 160 + if msgwindow.y == 0 + coinwindow.y = (goldwindow) ? goldwindow.y - coinwindow.height : Graphics.height - coinwindow.height else - coinwindow.y=(goldwindow) ? goldwindow.height : 0 + coinwindow.y = (goldwindow) ? goldwindow.height : 0 end - coinwindow.viewport=msgwindow.viewport - coinwindow.z=msgwindow.z + coinwindow.viewport = msgwindow.viewport + coinwindow.z = msgwindow.z return coinwindow end def pbDisplayBattlePointsWindow(msgwindow) pointsString = ($Trainer) ? $Trainer.battle_points.to_s_formatted : "0" - pointswindow=Window_AdvancedTextPokemon.new(_INTL("Battle Points:\n{1}", pointsString)) + pointswindow = Window_AdvancedTextPokemon.new(_INTL("Battle Points:\n{1}", pointsString)) pointswindow.setSkin("Graphics/Windowskins/goldskin") - pointswindow.resizeToFit(pointswindow.text,Graphics.width) - pointswindow.width=160 if pointswindow.width<=160 - if msgwindow.y==0 - pointswindow.y=Graphics.height-pointswindow.height + pointswindow.resizeToFit(pointswindow.text, Graphics.width) + pointswindow.width = 160 if pointswindow.width <= 160 + if msgwindow.y == 0 + pointswindow.y = Graphics.height - pointswindow.height else - pointswindow.y=0 + pointswindow.y = 0 end - pointswindow.viewport=msgwindow.viewport - pointswindow.z=msgwindow.z + pointswindow.viewport = msgwindow.viewport + pointswindow.z = msgwindow.z return pointswindow end - - #=============================================================================== # #=============================================================================== -def pbCreateStatusWindow(viewport=nil) - msgwindow=Window_AdvancedTextPokemon.new("") +def pbCreateStatusWindow(viewport = nil) + msgwindow = Window_AdvancedTextPokemon.new("") if !viewport - msgwindow.z=99999 + msgwindow.z = 99999 else - msgwindow.viewport=viewport + msgwindow.viewport = viewport end - msgwindow.visible=false - msgwindow.letterbyletter=false - pbBottomLeftLines(msgwindow,2) - skinfile=MessageConfig.pbGetSpeechFrame() + msgwindow.visible = false + msgwindow.letterbyletter = false + pbBottomLeftLines(msgwindow, 2) + skinfile = MessageConfig.pbGetSpeechFrame() msgwindow.setSkin(skinfile) return msgwindow end -def pbCreateMessageWindow(viewport=nil,skin=nil) - msgwindow=Window_AdvancedTextPokemon.new("") +def pbCreateMessageWindow(viewport = nil, skin = nil) + msgwindow = Window_AdvancedTextPokemon.new("") if !viewport - msgwindow.z=99999 + msgwindow.z = 99999 else - msgwindow.viewport=viewport + msgwindow.viewport = viewport end - msgwindow.visible=true - msgwindow.letterbyletter=true - msgwindow.back_opacity=MessageConfig::WINDOW_OPACITY - pbBottomLeftLines(msgwindow,2) - $game_temp.message_window_showing=true if $game_temp - skin=MessageConfig.pbGetSpeechFrame() if !skin + msgwindow.visible = true + msgwindow.letterbyletter = true + msgwindow.back_opacity = MessageConfig::WINDOW_OPACITY + pbBottomLeftLines(msgwindow, 2) + $game_temp.message_window_showing = true if $game_temp + skin = MessageConfig.pbGetSpeechFrame() if !skin msgwindow.setSkin(skin) return msgwindow end def pbDisposeMessageWindow(msgwindow) - $game_temp.message_window_showing=false if $game_temp + $game_temp.message_window_showing = false if $game_temp msgwindow.dispose end - - #=============================================================================== # Main message-displaying function #=============================================================================== -def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) +def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = nil) return if !msgwindow - oldletterbyletter=msgwindow.letterbyletter - msgwindow.letterbyletter=(letterbyletter) ? true : false - ret=nil - commands=nil - facewindow=nil - goldwindow=nil - coinwindow=nil - battlepointswindow=nil - cmdvariable=0 - cmdIfCancel=0 - msgwindow.waitcount=0 - autoresume=false - text=message.clone - msgback=nil - linecount=(Graphics.height>400) ? 3 : 2 + oldletterbyletter = msgwindow.letterbyletter + msgwindow.letterbyletter = (letterbyletter) ? true : false + ret = nil + commands = nil + facewindow = nil + goldwindow = nil + coinwindow = nil + battlepointswindow = nil + cmdvariable = 0 + cmdIfCancel = 0 + msgwindow.waitcount = 0 + autoresume = false + text = message.clone + msgback = nil + linecount = (Graphics.height > 400) ? 3 : 2 ### Text replacement - text.gsub!(/\\sign\[([^\]]*)\]/i) { # \sign[something] gets turned into - next "\\op\\cl\\ts[]\\w["+$1+"]" # \op\cl\ts[]\w[something] + text.gsub!(/\\sign\[([^\]]*)\]/i) { # \sign[something] gets turned into + next "\\op\\cl\\ts[]\\w[" + $1 + "]" # \op\cl\ts[]\w[something] } - text.gsub!(/\\\\/,"\5") - text.gsub!(/\\1/,"\1") + text.gsub!(/\\\\/, "\5") + text.gsub!(/\\1/, "\1") if $game_actors text.gsub!(/\\n\[([1-8])\]/i) { m = $1.to_i next $game_actors[m].name } end - text.gsub!(/\\pn/i,$Trainer.name) if $Trainer - text.gsub!(/\\pm/i,_INTL("${1}",$Trainer.money.to_s_formatted)) if $Trainer - text.gsub!(/\\n/i,"\n") - text.gsub!(/\\\[([0-9a-f]{8,8})\]/i) { "" } - text.gsub!(/\\pg/i,"\\b") if $Trainer && $Trainer.male? - text.gsub!(/\\pg/i,"\\r") if $Trainer && $Trainer.female? - text.gsub!(/\\pog/i,"\\r") if $Trainer && $Trainer.male? - text.gsub!(/\\pog/i,"\\b") if $Trainer && $Trainer.female? - text.gsub!(/\\pg/i,"") - text.gsub!(/\\pog/i,"") - text.gsub!(/\\b/i,"") - text.gsub!(/\\r/i,"") + text.gsub!(/\\pn/i, $Trainer.name) if $Trainer + text.gsub!(/\\pm/i, _INTL("${1}", $Trainer.money.to_s_formatted)) if $Trainer + text.gsub!(/\\n/i, "\n") + text.gsub!(/\\\[([0-9a-f]{8,8})\]/i) { "" } + text.gsub!(/\\pg/i, "\\b") if $Trainer && $Trainer.male? + text.gsub!(/\\pg/i, "\\r") if $Trainer && $Trainer.female? + text.gsub!(/\\pog/i, "\\r") if $Trainer && $Trainer.male? + text.gsub!(/\\pog/i, "\\b") if $Trainer && $Trainer.female? + text.gsub!(/\\pg/i, "") + text.gsub!(/\\pog/i, "") + text.gsub!(/\\b/i, "") + text.gsub!(/\\r/i, "") text.gsub!(/\\[Ww]\[([^\]]*)\]/) { w = $1.to_s - if w=="" + if w == "" msgwindow.windowskin = nil else - msgwindow.setSkin("Graphics/Windowskins/#{w}",false) + msgwindow.setSkin("Graphics/Windowskins/#{w}", false) end next "" } isDarkSkin = isDarkWindowskin(msgwindow.windowskin) text.gsub!(/\\[Cc]\[([0-9]+)\]/) { m = $1.to_i - next getSkinColor(msgwindow.windowskin,m,isDarkSkin) + next getSkinColor(msgwindow.windowskin, m, isDarkSkin) } loop do last_text = text.clone @@ -608,34 +590,34 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) loop do last_text = text.clone text.gsub!(/\\l\[([0-9]+)\]/i) { - linecount = [1,$1.to_i].max + linecount = [1, $1.to_i].max next "" } break if text == last_text end colortag = "" if $game_system && $game_system.respond_to?("message_frame") && - $game_system.message_frame != 0 - colortag = getSkinColor(msgwindow.windowskin,0,true) + $game_system.message_frame != 0 + colortag = getSkinColor(msgwindow.windowskin, 0, true) else - colortag = getSkinColor(msgwindow.windowskin,0,isDarkSkin) + colortag = getSkinColor(msgwindow.windowskin, 0, isDarkSkin) end - text = colortag+text + text = colortag + text ### Controls - textchunks=[] - controls=[] + textchunks = [] + controls = [] while text[/(?:\\(f|ff|ts|cl|me|se|wt|wtnp|ch)\[([^\]]*)\]|\\(g|cn|pt|ft|hs|wd|wm|op|cl|wu|\.|\||\!|\^))/i] textchunks.push($~.pre_match) if $~[1] - controls.push([$~[1].downcase,$~[2],-1]) + controls.push([$~[1].downcase, $~[2], -1]) else - controls.push([$~[3].downcase,"",-1]) + controls.push([$~[3].downcase, "", -1]) end - text=$~.post_match + text = $~.post_match end textchunks.push(text) for chunk in textchunks - chunk.gsub!(/\005/,"\\") + chunk.gsub!(/\005/, "\\") end textlen = 0 for i in 0...controls.length @@ -651,7 +633,7 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) end text = textchunks.join("") signWaitCount = 0 - signWaitTime = Graphics.frame_rate/2 + signWaitTime = Graphics.frame_rate / 2 haveSpecialClose = false specialCloseSE = "" for i in 0...controls.length @@ -659,9 +641,9 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) param = controls[i][1] case control when "op" - signWaitCount = signWaitTime+1 + signWaitCount = signWaitTime + 1 when "cl" - text = text.sub(/\001\z/,"") # fix: '$' can match end of line as well + text = text.sub(/\001\z/, "") # fix: '$' can match end of line as well haveSpecialClose = true specialCloseSE = param when "f" @@ -675,111 +657,115 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) cmdvariable = pbCsvPosInt!(cmds) cmdIfCancel = pbCsvField!(cmds).to_i commands = [] - while cmds.length>0 + while cmds.length > 0 commands.push(pbCsvField!(cmds)) end when "wtnp", "^" - text = text.sub(/\001\z/,"") # fix: '$' can match end of line as well + text = text.sub(/\001\z/, "") # fix: '$' can match end of line as well when "se" - if controls[i][2]==0 + if controls[i][2] == 0 startSE = param controls[i] = nil end end end - if startSE!=nil + if startSE != nil pbSEPlay(pbStringToAudioFile(startSE)) - elsif signWaitCount==0 && letterbyletter + elsif signWaitCount == 0 && letterbyletter pbPlayDecisionSE() end ########## Position message window ############## - pbRepositionMessageWindow(msgwindow,linecount) + pbRepositionMessageWindow(msgwindow, linecount) if facewindow - pbPositionNearMsgWindow(facewindow,msgwindow,:left) + pbPositionNearMsgWindow(facewindow, msgwindow, :left) facewindow.viewport = msgwindow.viewport - facewindow.z = msgwindow.z + facewindow.z = msgwindow.z end - atTop = (msgwindow.y==0) + atTop = (msgwindow.y == 0) ########## Show text ############################# msgwindow.text = text - Graphics.frame_reset if Graphics.frame_rate>40 + Graphics.frame_reset if Graphics.frame_rate > 40 loop do - if signWaitCount>0 + if signWaitCount > 0 signWaitCount -= 1 if atTop - msgwindow.y = -msgwindow.height*signWaitCount/signWaitTime + msgwindow.y = -msgwindow.height * signWaitCount / signWaitTime else - msgwindow.y = Graphics.height-msgwindow.height*(signWaitTime-signWaitCount)/signWaitTime + msgwindow.y = Graphics.height - msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime end end for i in 0...controls.length next if !controls[i] - next if controls[i][2]>msgwindow.position || msgwindow.waitcount!=0 + next if controls[i][2] > msgwindow.position || msgwindow.waitcount != 0 control = controls[i][0] param = controls[i][1] case control when "f" + isFusion = param.to_i > NB_POKEMON + head = getBasePokemonID(param.to_i, false) + body = getBasePokemonID(param.to_i, true) facewindow.dispose if facewindow - facewindow = PictureWindow.new("Graphics/Pictures/#{param}") - pbPositionNearMsgWindow(facewindow,msgwindow,:left) + path = obtainPokemonSpritePath(body, head, $game_variables[CUSTOM_SPRITES_ENABLED] == 0) + facewindow = isFusion ? PictureWindow.new(path) : PictureWindow.new("Graphics/Battlers/#{head}/#{head}.png") + pbPositionNearMsgWindow(facewindow, msgwindow, :left) facewindow.viewport = msgwindow.viewport - facewindow.z = msgwindow.z + facewindow.z = msgwindow.z when "ff" facewindow.dispose if facewindow facewindow = FaceWindowVX.new(param) - pbPositionNearMsgWindow(facewindow,msgwindow,:left) + pbPositionNearMsgWindow(facewindow, msgwindow, :left) facewindow.viewport = msgwindow.viewport - facewindow.z = msgwindow.z - when "g" # Display gold window + facewindow.z = msgwindow.z + when "g" # Display gold window goldwindow.dispose if goldwindow goldwindow = pbDisplayGoldWindow(msgwindow) - when "ft" # Display battle factory tokens + when "ft" # Display battle factory tokens goldwindow.dispose if goldwindow goldwindow = pbDisplayBattleFactoryPointsWindow(msgwindow) - when "hs" # Display battle factory tokens + when "hs" # Display battle factory tokens goldwindow.dispose if goldwindow goldwindow = pbDisplayHeartScalesWindow(msgwindow) - when "cn" # Display coins window + when "cn" # Display coins window coinwindow.dispose if coinwindow - coinwindow = pbDisplayCoinsWindow(msgwindow,goldwindow) - when "pt" # Display battle points window + coinwindow = pbDisplayCoinsWindow(msgwindow, goldwindow) + when "pt" # Display battle points window battlepointswindow.dispose if battlepointswindow battlepointswindow = pbDisplayBattlePointsWindow(msgwindow) when "wu" msgwindow.y = 0 atTop = true msgback.y = msgwindow.y if msgback - pbPositionNearMsgWindow(facewindow,msgwindow,:left) - msgwindow.y = -msgwindow.height*signWaitCount/signWaitTime + pbPositionNearMsgWindow(facewindow, msgwindow, :left) + msgwindow.y = -msgwindow.height * signWaitCount / signWaitTime when "wm" atTop = false - msgwindow.y = (Graphics.height-msgwindow.height)/2 + msgwindow.y = (Graphics.height - msgwindow.height) / 2 msgback.y = msgwindow.y if msgback - pbPositionNearMsgWindow(facewindow,msgwindow,:left) + pbPositionNearMsgWindow(facewindow, msgwindow, :left) when "wd" atTop = false - msgwindow.y = Graphics.height-msgwindow.height + msgwindow.y = Graphics.height - msgwindow.height msgback.y = msgwindow.y if msgback - pbPositionNearMsgWindow(facewindow,msgwindow,:left) - msgwindow.y = Graphics.height-msgwindow.height*(signWaitTime-signWaitCount)/signWaitTime - when "ts" # Change text speed - msgwindow.textspeed = (param=="") ? -999 : param.to_i - when "." # Wait 0.25 seconds - msgwindow.waitcount += Graphics.frame_rate/4 - when "|" # Wait 1 second + pbPositionNearMsgWindow(facewindow, msgwindow, :left) + msgwindow.y = Graphics.height - msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime + when "ts" # Change text speed + msgwindow.textspeed = (param == "") ? -999 : param.to_i + when "." # Wait 0.25 seconds + msgwindow.waitcount += Graphics.frame_rate / 4 + when "|" # Wait 1 second msgwindow.waitcount += Graphics.frame_rate - when "wt" # Wait X/20 seconds - param = param.sub(/\A\s+/,"").sub(/\s+\z/,"") - msgwindow.waitcount += param.to_i*Graphics.frame_rate/20 - when "wtnp" # Wait X/20 seconds, no pause - param = param.sub(/\A\s+/,"").sub(/\s+\z/,"") - msgwindow.waitcount = param.to_i*Graphics.frame_rate/20 + when "wt" # Wait X/20 seconds + param = param.sub(/\A\s+/, "").sub(/\s+\z/, "") + msgwindow.waitcount += param.to_i * Graphics.frame_rate / 20 + when "wtnp" # Wait X/20 seconds, no pause + param = param.sub(/\A\s+/, "").sub(/\s+\z/, "") + msgwindow.waitcount = param.to_i * Graphics.frame_rate / 20 autoresume = true - when "^" # Wait, no pause + when "^" # Wait, no pause autoresume = true - when "se" # Play SE + when "se" # Play SE pbSEPlay(pbStringToAudioFile(param)) - when "me" # Play ME + when "me" # Play ME pbMEPlay(pbStringToAudioFile(param)) end controls[i] = nil @@ -788,7 +774,7 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) Graphics.update Input.update facewindow.update if facewindow - if autoresume && msgwindow.waitcount==0 + if autoresume && msgwindow.waitcount == 0 msgwindow.resume if msgwindow.busy? break if !msgwindow.busy? end @@ -797,7 +783,7 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) pbPlayDecisionSE if msgwindow.pausing? msgwindow.resume else - break if signWaitCount==0 + break if signWaitCount == 0 end end pbUpdateSceneMap @@ -805,14 +791,14 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) yield if block_given? break if (!letterbyletter || commandProc || commands) && !msgwindow.busy? end - Input.update # Must call Input.update again to avoid extra triggers - msgwindow.letterbyletter=oldletterbyletter + Input.update # Must call Input.update again to avoid extra triggers + msgwindow.letterbyletter = oldletterbyletter if commands - $game_variables[cmdvariable]=pbShowCommands(msgwindow,commands,cmdIfCancel) + $game_variables[cmdvariable] = pbShowCommands(msgwindow, commands, cmdIfCancel) $game_map.need_refresh = true if $game_map end if commandProc - ret=commandProc.call(msgwindow) + ret = commandProc.call(msgwindow) end msgback.dispose if msgback goldwindow.dispose if goldwindow @@ -821,12 +807,12 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) facewindow.dispose if facewindow if haveSpecialClose pbSEPlay(pbStringToAudioFile(specialCloseSE)) - atTop = (msgwindow.y==0) + atTop = (msgwindow.y == 0) for i in 0..signWaitTime if atTop - msgwindow.y = -msgwindow.height*i/signWaitTime + msgwindow.y = -msgwindow.height * i / signWaitTime else - msgwindow.y = Graphics.height-msgwindow.height*(signWaitTime-i)/signWaitTime + msgwindow.y = Graphics.height - msgwindow.height * (signWaitTime - i) / signWaitTime end Graphics.update Input.update @@ -837,54 +823,52 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) return ret end - - #=============================================================================== # Message-displaying functions #=============================================================================== -def pbMessage(message,commands=nil,cmdIfCancel=0,skin=nil,defaultCmd=0,&block) +def pbMessage(message, commands = nil, cmdIfCancel = 0, skin = nil, defaultCmd = 0, &block) ret = 0 - msgwindow = pbCreateMessageWindow(nil,skin) + msgwindow = pbCreateMessageWindow(nil, skin) if commands - ret = pbMessageDisplay(msgwindow,message,true, - proc { |msgwindow| - next Kernel.pbShowCommands(msgwindow,commands,cmdIfCancel,defaultCmd,&block) - },&block) + ret = pbMessageDisplay(msgwindow, message, true, + proc { |msgwindow| + next Kernel.pbShowCommands(msgwindow, commands, cmdIfCancel, defaultCmd, &block) + }, &block) else - pbMessageDisplay(msgwindow,message,&block) + pbMessageDisplay(msgwindow, message, &block) end pbDisposeMessageWindow(msgwindow) Input.update return ret end -def pbConfirmMessage(message,&block) - return (pbMessage(message,[_INTL("Yes"),_INTL("No")],2,&block)==0) +def pbConfirmMessage(message, &block) + return (pbMessage(message, [_INTL("Yes"), _INTL("No")], 2, &block) == 0) end -def pbConfirmMessageSerious(message,&block) - return (pbMessage(message,[_INTL("No"),_INTL("Yes")],1,&block)==1) +def pbConfirmMessageSerious(message, &block) + return (pbMessage(message, [_INTL("No"), _INTL("Yes")], 1, &block) == 1) end -def pbMessageChooseNumber(message,params,&block) - msgwindow = pbCreateMessageWindow(nil,params.messageSkin) - ret = pbMessageDisplay(msgwindow,message,true, - proc { |msgwindow| - next pbChooseNumber(msgwindow,params,&block) - },&block) +def pbMessageChooseNumber(message, params, &block) + msgwindow = pbCreateMessageWindow(nil, params.messageSkin) + ret = pbMessageDisplay(msgwindow, message, true, + proc { |msgwindow| + next pbChooseNumber(msgwindow, params, &block) + }, &block) pbDisposeMessageWindow(msgwindow) return ret end -def pbShowCommands(msgwindow,commands=nil,cmdIfCancel=0,defaultCmd=0) +def pbShowCommands(msgwindow, commands = nil, cmdIfCancel = 0, defaultCmd = 0) return 0 if !commands - cmdwindow=Window_CommandPokemonEx.new(commands) - cmdwindow.z=99999 - cmdwindow.visible=true + cmdwindow = Window_CommandPokemonEx.new(commands) + cmdwindow.z = 99999 + cmdwindow.visible = true cmdwindow.resizeToFit(cmdwindow.commands) - pbPositionNearMsgWindow(cmdwindow,msgwindow,:right) - cmdwindow.index=defaultCmd - command=0 + pbPositionNearMsgWindow(cmdwindow, msgwindow, :right) + cmdwindow.index = defaultCmd + command = 0 loop do Graphics.update Input.update @@ -892,80 +876,80 @@ def pbShowCommands(msgwindow,commands=nil,cmdIfCancel=0,defaultCmd=0) msgwindow.update if msgwindow yield if block_given? if Input.trigger?(Input::BACK) - if cmdIfCancel>0 - command=cmdIfCancel-1 + if cmdIfCancel > 0 + command = cmdIfCancel - 1 break - elsif cmdIfCancel<0 - command=cmdIfCancel + elsif cmdIfCancel < 0 + command = cmdIfCancel break end end if Input.trigger?(Input::USE) - command=cmdwindow.index + command = cmdwindow.index break end pbUpdateSceneMap end - ret=command + ret = command cmdwindow.dispose Input.update return ret end -def pbShowCommandsWithHelp(msgwindow,commands,help,cmdIfCancel=0,defaultCmd=0) - msgwin=msgwindow - msgwin=pbCreateMessageWindow(nil) if !msgwindow - oldlbl=msgwin.letterbyletter - msgwin.letterbyletter=false +def pbShowCommandsWithHelp(msgwindow, commands, help, cmdIfCancel = 0, defaultCmd = 0) + msgwin = msgwindow + msgwin = pbCreateMessageWindow(nil) if !msgwindow + oldlbl = msgwin.letterbyletter + msgwin.letterbyletter = false if commands - cmdwindow=Window_CommandPokemonEx.new(commands) - cmdwindow.z=99999 - cmdwindow.visible=true + cmdwindow = Window_CommandPokemonEx.new(commands) + cmdwindow.z = 99999 + cmdwindow.visible = true cmdwindow.resizeToFit(cmdwindow.commands) - cmdwindow.height=msgwin.y if cmdwindow.height>msgwin.y - cmdwindow.index=defaultCmd - command=0 - msgwin.text=help[cmdwindow.index] - msgwin.width=msgwin.width # Necessary evil to make it use the proper margins + cmdwindow.height = msgwin.y if cmdwindow.height > msgwin.y + cmdwindow.index = defaultCmd + command = 0 + msgwin.text = help[cmdwindow.index] + msgwin.width = msgwin.width # Necessary evil to make it use the proper margins loop do Graphics.update Input.update - oldindex=cmdwindow.index + oldindex = cmdwindow.index cmdwindow.update - if oldindex!=cmdwindow.index - msgwin.text=help[cmdwindow.index] + if oldindex != cmdwindow.index + msgwin.text = help[cmdwindow.index] end msgwin.update yield if block_given? if Input.trigger?(Input::BACK) - if cmdIfCancel>0 - command=cmdIfCancel-1 + if cmdIfCancel > 0 + command = cmdIfCancel - 1 break - elsif cmdIfCancel<0 - command=cmdIfCancel + elsif cmdIfCancel < 0 + command = cmdIfCancel break end end if Input.trigger?(Input::USE) - command=cmdwindow.index + command = cmdwindow.index break end pbUpdateSceneMap end - ret=command + ret = command cmdwindow.dispose Input.update end - msgwin.letterbyletter=oldlbl + msgwin.letterbyletter = oldlbl msgwin.dispose if !msgwindow return ret end # frames is the number of 1/20 seconds to wait for -def pbMessageWaitForInput(msgwindow,frames,showPause=false) - return if !frames || frames<=0 +def pbMessageWaitForInput(msgwindow, frames, showPause = false) + return if !frames || frames <= 0 msgwindow.startPause if msgwindow && showPause - frames = frames*Graphics.frame_rate/20 + frames = frames * Graphics.frame_rate / 20 frames.times do Graphics.update Input.update @@ -979,24 +963,24 @@ def pbMessageWaitForInput(msgwindow,frames,showPause=false) msgwindow.stopPause if msgwindow && showPause end -def pbFreeText(msgwindow,currenttext,passwordbox,maxlength,width=240) - window=Window_TextEntry_Keyboard.new(currenttext,0,0,width,64) - ret="" - window.maxlength=maxlength - window.visible=true - window.z=99999 - pbPositionNearMsgWindow(window,msgwindow,:right) - window.text=currenttext - window.passwordChar="*" if passwordbox +def pbFreeText(msgwindow, currenttext, passwordbox, maxlength, width = 240) + window = Window_TextEntry_Keyboard.new(currenttext, 0, 0, width, 64) + ret = "" + window.maxlength = maxlength + window.visible = true + window.z = 99999 + pbPositionNearMsgWindow(window, msgwindow, :right) + window.text = currenttext + window.passwordChar = "*" if passwordbox Input.text_input = true loop do Graphics.update Input.update if Input.triggerex?(:ESCAPE) - ret=currenttext + ret = currenttext break elsif Input.triggerex?(:RETURN) - ret=window.text + ret = window.text break end window.update @@ -1009,12 +993,12 @@ def pbFreeText(msgwindow,currenttext,passwordbox,maxlength,width=240) return ret end -def pbMessageFreeText(message,currenttext,passwordbox,maxlength,width=240,&block) - msgwindow=pbCreateMessageWindow - retval=pbMessageDisplay(msgwindow,message,true, - proc { |msgwindow| - next pbFreeText(msgwindow,currenttext,passwordbox,maxlength,width,&block) - },&block) +def pbMessageFreeText(message, currenttext, passwordbox, maxlength, width = 240, &block) + msgwindow = pbCreateMessageWindow + retval = pbMessageDisplay(msgwindow, message, true, + proc { |msgwindow| + next pbFreeText(msgwindow, currenttext, passwordbox, maxlength, width, &block) + }, &block) pbDisposeMessageWindow(msgwindow) return retval end diff --git a/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb b/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb index 1b5fdc59b..9d5d5c55f 100644 --- a/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb +++ b/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb @@ -115,7 +115,7 @@ def pbAddToPartySilent(pkmn, level = nil, see_form = true) end def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner_gender = 0, see_form = true) - return false if !pkmn || $Trainer.party_full? + return false if !pkmn pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon) # Set original trainer to a foreign one pkmn.owner = Pokemon::Owner.new_foreign(owner_name || "", owner_gender) diff --git a/Data/Scripts/049_Compatibility/Constants.rb b/Data/Scripts/049_Compatibility/Constants.rb index c2028a732..dadd367b2 100644 --- a/Data/Scripts/049_Compatibility/Constants.rb +++ b/Data/Scripts/049_Compatibility/Constants.rb @@ -24,7 +24,7 @@ GOT_BADGE_16 = 50 DEFAULT_BATTLE_TYPE = 242 BATTLE_FACTORY_TOKENS = 243 NB_GYM_REMATCHES = 162 - +CUSTOM_SPRITES_ENABLED= 196 #Settings # This is for settings that are used in scripts since it's a chore to change them everywhere to include the module name NUM_BADGES = Settings::NB_BADGES diff --git a/Data/Scripts/050_AddOns/GeneralUtils.rb b/Data/Scripts/050_AddOns/GeneralUtils.rb index 5b29c0069..0eeedcefb 100644 --- a/Data/Scripts/050_AddOns/GeneralUtils.rb +++ b/Data/Scripts/050_AddOns/GeneralUtils.rb @@ -298,3 +298,25 @@ def getGenericPokemonCryText(pokemonSpecies) end end +def obtainPokemonSpritePath(id,includeCustoms=true) + head=getBasePokemonID(param.to_i,false) + body=getBasePokemonID(param.to_i,true) + return obtainPokemonSpritePath(body,head,includeCustoms) +end + +def obtainPokemonSpritePath(bodyId, headId,include_customs=true) + hasCustom=false + picturePath = _INTL("Graphics/Battlers/{1}/{1}.{2}.png", headId, bodyId) + + if include_customs + pathCustom = _INTL("Graphics/CustomBattlers/{1}.{2}.png", headId, bodyId) + if (pbResolveBitmap(pathCustom)) + picturePath = pathCustom + hasCustom = true + end + end + return picturePath +end + + + diff --git a/Data/Scripts/050_AddOns/Trainers Rebattle.rb b/Data/Scripts/050_AddOns/Trainers Rebattle.rb index b9ecc9656..324d396fc 100644 --- a/Data/Scripts/050_AddOns/Trainers Rebattle.rb +++ b/Data/Scripts/050_AddOns/Trainers Rebattle.rb @@ -134,33 +134,37 @@ def evolveRematchPokemon(nbRematch, speciesSymbol) end def getEvolution(species) - if species >= Settings::NB_POKEMON - body = getBasePokemonID(species) - head = getBasePokemonID(species, false) + begin + if species >= Settings::NB_POKEMON + body = getBasePokemonID(species) + head = getBasePokemonID(species, false) - bodyPossibleEvolutions = GameData::Species.get(body).get_evolutions(true) - headPossibleEvolutions = GameData::Species.get(head).get_evolutions(true) + bodyPossibleEvolutions = GameData::Species.get(body).get_evolutions(true) + headPossibleEvolutions = GameData::Species.get(head).get_evolutions(true) - bodyCanEvolve = !bodyPossibleEvolutions.empty? - headCanEvolve = !headPossibleEvolutions.empty? + bodyCanEvolve = !bodyPossibleEvolutions.empty? + headCanEvolve = !headPossibleEvolutions.empty? - evoBodySpecies = bodyCanEvolve ? bodyPossibleEvolutions[rand(bodyPossibleEvolutions.length - 1)][0] : nil - evoHeadSpecies = headCanEvolve ? headPossibleEvolutions[rand(headPossibleEvolutions.length - 1)][0] : nil - if evoBodySpecies != nil - evoBody= getDexNumberForSpecies(evoBodySpecies) + evoBodySpecies = bodyCanEvolve ? bodyPossibleEvolutions[rand(bodyPossibleEvolutions.length - 1)][0] : nil + evoHeadSpecies = headCanEvolve ? headPossibleEvolutions[rand(headPossibleEvolutions.length - 1)][0] : nil + if evoBodySpecies != nil + evoBody = getDexNumberForSpecies(evoBodySpecies) + end + if evoHeadSpecies != nil + evoHead = getDexNumberForSpecies(evoHeadSpecies) + end + + return -1 if evoBody == nil && evoHead == nil + return body * Settings::NB_POKEMON + evoHead if evoBody == nil #only head evolves + return evoBody * Settings::NB_POKEMON + head if evoHead == nil #only body evolves + return evoBody * Settings::NB_POKEMON + evoHead #both evolve + else + evo = pbGetEvolvedFormData(species) + newSpecies = evo[rand(evo.length - 1)][0] + return evo.any? ? getDexNumberForSpecies(newSpecies) : -1 end - if evoHeadSpecies != nil - evoHead= getDexNumberForSpecies(evoHeadSpecies) - end - - return -1 if evoBody == nil && evoHead == nil - return body * Settings::NB_POKEMON + evoHead if evoBody == nil #only head evolves - return evoBody * Settings::NB_POKEMON + head if evoHead == nil #only body evolves - return evoBody * Settings::NB_POKEMON + evoHead #both evolve - else - evo = pbGetEvolvedFormData(species) - newSpecies = evo[rand(evo.length - 1)][0] - return evo.any? ? getDexNumberForSpecies(newSpecies) : -1 + rescue + return -1 end end diff --git a/Data/Skills.rxdata b/Data/Skills.rxdata index 61cba7ea2..a45219f5e 100644 Binary files a/Data/Skills.rxdata and b/Data/Skills.rxdata differ diff --git a/Data/States.rxdata b/Data/States.rxdata index 0f9b4ae5d..868d49e59 100644 Binary files a/Data/States.rxdata and b/Data/States.rxdata differ diff --git a/Data/System.rxdata b/Data/System.rxdata index c80074570..44c126451 100644 Binary files a/Data/System.rxdata and b/Data/System.rxdata differ diff --git a/Data/Tilesets.rxdata b/Data/Tilesets.rxdata index e3795ef66..838a3a9d6 100644 Binary files a/Data/Tilesets.rxdata and b/Data/Tilesets.rxdata differ diff --git a/Data/Weapons.rxdata b/Data/Weapons.rxdata index d9bd35260..c7ea19a7a 100644 Binary files a/Data/Weapons.rxdata and b/Data/Weapons.rxdata differ diff --git a/Data/messages.dat b/Data/messages.dat index 77bf1296b..1caa05dee 100644 Binary files a/Data/messages.dat and b/Data/messages.dat differ