Changed: Game_Event_ --- Left +++ Right @@ -223,5 +223,5 @@ if @interpreter != nil unless @interpreter.running? - @interpreter.setup(@list, @event.id) + @interpreter.setup(@list, @event.id, @map_id) end @interpreter.update Changed: PBAnimation --- Left +++ Right @@ -253,4 +253,8 @@ frame[AnimFrame::TONEBLUE]=0 frame[AnimFrame::TONEGRAY]=0 + frame[AnimFrame::FLASHRED]=0 + frame[AnimFrame::FLASHGREEN]=0 + frame[AnimFrame::FLASHBLUE]=0 + frame[AnimFrame::FLASHALPHA]=0 end @@ -330,5 +334,5 @@ pbanim=PBAnimation.new pbanim.id=animation.id - pbanim.name=animation.name + pbanim.name=animation.name.clone pbanim.graphic=animation.animation_name pbanim.hue=animation.animation_hue @@ -393,8 +397,13 @@ attr_accessor :name attr_accessor :position + attr_accessor :speed attr_reader :array attr_reader :timing attr_accessor :id MAXSPRITES=30 + def speed + @speed=20 if !@speed + return @speed + end def initialize(size=1) @array=[] Changed: Audio --- Left +++ Right @@ -145,5 +145,5 @@ volume=0 if !getPlayMusic() begin - filename = canonicalize(RTP.getPath(name,[".mid",".mp3",".wma",".ogg",".wav",""])) + filename = canonicalize(RTP.getAudioPath(name)) if AudioState.meActive? AudioState.setWaitingBGM(filename,volume,pitch,position) @@ -163,5 +163,5 @@ volume=0 if !getPlayMusic() begin - filename = canonicalize(RTP.getPath(name,[".mid",".mp3",".wma",".ogg",".wav",""])) + filename = canonicalize(RTP.getAudioPath(name)) if AudioState.bgmActive? bgmPosition=Kernel.Audio_bgm_get_position @@ -224,5 +224,5 @@ volume=0 if !getPlaySound() begin - filename = canonicalize(RTP.getPath(name,[".mid",".mp3",".wma",".ogg",".wav",""])) + filename = canonicalize(RTP.getAudioPath(name)) AudioState::AudioContextPlay.call(AudioState.bgsContext,filename,volume,pitch,position,0) rescue @@ -243,5 +243,5 @@ volume=0 if !getPlaySound() begin - filename = canonicalize(RTP.getPath(name,[".mid",".mp3",".wma",".ogg",".wav",""])) + filename = canonicalize(RTP.getAudioPath(name)) AudioState::AudioContextSEPlay.call(AudioState.seContext,filename,volume,pitch,position) rescue Changed: PokemonPokedex --- Left +++ Right @@ -438,16 +438,10 @@ end if params[2]!=0 || params[3]!=0 # Filter by type - typeCommands=[ - -1,PBTypes::NORMAL, - PBTypes::FIGHTING, - PBTypes::FLYING,PBTypes::POISON, - PBTypes::GROUND,PBTypes::ROCK, - PBTypes::BUG,PBTypes::GHOST, - PBTypes::STEEL,PBTypes::FIRE, - PBTypes::WATER,PBTypes::GRASS, - PBTypes::ELECTRIC,PBTypes::PSYCHIC, - PBTypes::ICE,PBTypes::DRAGON, - PBTypes::DARK - ] + typeCommands=[-1] + for i in 0..PBTypes.maxValue + if !PBTypes.isPseudoType?(i) + typeCommands.push(i) # Add type + end + end stype1=typeCommands[params[2]] stype2=typeCommands[params[3]] Changed: Game_Character_3_ --- Left +++ Right @@ -200,5 +200,5 @@ @stop_count = 0 if self.is_a?(Game_Player) - $PokemonTemp.dependentEvents.pbJumpDependentEvents + $PokemonTemp.dependentEvents.pbMoveDependentEvents end triggerLeaveTile() Changed: PokeBattle_Effects --- Left +++ Right @@ -8,5 +8,5 @@ def pbCanPoison?(showMessages) return false if hp<=0 - if pbHasType?(PBTypes::POISON) || pbHasType?(PBTypes::STEEL) + if pbHasType?(:POISON) || pbHasType?(:STEEL) @battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis)) if showMessages return false @@ -89,5 +89,5 @@ def pbCanPoisonSynchronize?(opponent) return false if hp<=0 - if pbHasType?(PBTypes::POISON) || pbHasType?(PBTypes::STEEL) + if pbHasType?(:POISON) || pbHasType?(:STEEL) @battle.pbDisplay(_INTL("{1}'s {2} had no effect on {3}!",opponent.pbThis, PBAbilities.getName(opponent.ability),pbThis)) @@ -196,5 +196,5 @@ pbOwnSide.effects[PBEffects::Safeguard]>0|| effects[PBEffects::Substitute]>0|| - pbHasType?(PBTypes::ICE) + pbHasType?(:ICE) return false end @@ -229,5 +229,5 @@ return false end - if pbHasType?(PBTypes::FIRE) + if pbHasType?(:FIRE) @battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis)) if showMessages return false @@ -259,5 +259,5 @@ return false end - if pbHasType?(PBTypes::FIRE) + if pbHasType?(:FIRE) @battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis)) if showMessages return false @@ -271,5 +271,5 @@ return false end - if isConst?(self.ability,PBAbilities,:FLASHFIRE) && move.type==PBTypes::FIRE + if isConst?(self.ability,PBAbilities,:FLASHFIRE) && isConst?(move.type,PBTypes,:FIRE) if !@effects[PBEffects::FlashFire] @battle.pbDisplay(_INTL("{1}'s Flash Fire raised its Fire power!",@pbThis)) @@ -292,5 +292,5 @@ def pbCanBurnSynchronize?(opponent) return false if hp<=0 - if pbHasType?(PBTypes::FIRE) + if pbHasType?(:FIRE) @battle.pbDisplay(_INTL("{1}'s Synchronize had no effect on {2}!",opponent.pbThis,pbThis)) return false Changed: PokemonMessages --- Left +++ Right @@ -1631,5 +1631,5 @@ end -def pbGetTerrainTag(event) +def pbGetTerrainTag(event=nil) event=$game_player if !event return 0 if !event @@ -1652,14 +1652,22 @@ def pbTurnTowardEvent(event,otherEvent) - sx = event.x - otherEvent.x - sy = event.y - otherEvent.y - if sx == 0 and sy == 0 - return - end - if sx.abs > sy.abs - sx > 0 ? event.turn_left : event.turn_right - else - sy > 0 ? event.turn_up : event.turn_down - end + sx=0 + sy=0 + if $MapFactory + relativePos=$MapFactory.getThisAndOtherEventRelativePos(otherEvent,event) + sx = relativePos[0] + sy = relativePos[1] + else + sx = event.x - otherEvent.x + sy = event.y - otherEvent.y + end + if sx == 0 and sy == 0 + return + end + if sx.abs > sy.abs + sx > 0 ? event.turn_left : event.turn_right + else + sy > 0 ? event.turn_up : event.turn_down + end end @@ -1706,19 +1714,4 @@ end return false -end - -def pbLedge(xOffset,yOffset) - x=$game_player.x - y=$game_player.y - currentTag=$game_map.terrain_tag(x,y) - facingTag=Kernel.pbFacingTerrainTag - if(facingTag==PBTerrain::Ledge) # ledge terrain tag - if Kernel.pbJumpToward(2,true) - $game_player.increase_steps - $game_player.check_event_trigger_here([1,2]) - end - return true - end - return false end Changed: SpriteWindow --- Left +++ Right @@ -274,4 +274,10 @@ return false end + def self.getImagePath(filename) + return self.getPath(filename,["",".png",".jpg",".gif",".bmp"]) + end + def self.getAudioPath(filename) + return self.getPath(filename,["",".mp3",".wav",".wma",".mid",".ogg"]) + end def self.getPath(filename,extensions=[]) return filename if !filename || filename=="" @@ -656,4 +662,5 @@ return $PokemonSystem ? $PokemonSystem.font : 0 end + def pbGetSystemTextSpeed return $PokemonSystem ? $PokemonSystem.textspeed : ((Graphics.frame_rate>40) ? 2 : 3) @@ -1223,7 +1230,25 @@ end +FontSubstitutes={ +"Power Clear"=>"Pokemon DP", +"Power Red and Blue"=>"Pokemon RS", +"Power Red and Green"=>"Pokemon FireLeaf", +"Power Green"=>"Pokemon Emerald", +"Power Green Narrow"=>"Pokemon Emerald Narrow", +"Power Green Small"=>"Pokemon Emerald Small" +} +def pbSystemFontName() + fontname=$VersionStyles[pbGetSystemFont][0] + if !Font.exist?(fontname) + fontname=FontSubstitutes[fontname] || fontname + return [fontname,"Arial Narrow","Arial"].find{|n| Font.exist?(n) } || "Arial" + else + return fontname + end +end + def pbSetSystemFont(bitmap) - bitmap.font.name=[$VersionStyles[pbGetSystemFont][0],"Arial Narrow","Arial"] + bitmap.font.name=pbSystemFontName() if pbGetSystemFont==2 bitmap.font.size=29 @@ -1232,10 +1257,18 @@ end end +def pbSmallFontName() + return ["Power Green Small","Pokemon Emerald Small", + "Arial Narrow","Arial"].find{|n| Font.exist?(n) } || "Arial" +end +def pbNarrowFontName() + return ["Power Green Narrow","Pokemon Emerald Narrow", + "Arial Narrow","Arial"].find{|n| Font.exist?(n) } || "Arial" +end def pbSetSmallFont(bitmap) - bitmap.font.name=["Power Green Small","Arial Narrow","Arial"] + bitmap.font.name=pbSmallFontName() bitmap.font.size=25 end def pbSetNarrowFont(bitmap) - bitmap.font.name=["Power Green Narrow","Arial Narrow","Arial"] + bitmap.font.name=pbNarrowFontName() bitmap.font.size=31 end @@ -1582,7 +1615,11 @@ if !(FileTest.exist?("./Game.rgssad") || FileTest.exist?("./Game.rgss2a")) return nil if !FileTest.exist?(file) - File.open(file,"rb"){|f| - return f.read(1) # read one byte - } + begin + File.open(file,"rb"){|f| + return f.read(1) # read one byte + } + rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES + return nil + end end Marshal.neverload=true @@ -1604,7 +1641,11 @@ if !(FileTest.exist?("./Game.rgssad") || FileTest.exist?("./Game.rgss2a")) return nil if !FileTest.exist?(file) - File.open(file,"rb"){|f| - return f.read # read all data - } + begin + File.open(file,"rb"){|f| + return f.read # read all data + } + rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES + return nil + end end Marshal.neverload=true Changed: PBIntl --- Left +++ Right @@ -501,4 +501,5 @@ PhoneMessages=15 MapNames=16 + Types=17 @@messages=Messages.new @@messagesFallback=Messages.new("Data/messages.dat",true) Changed: PokeBattle_Battler --- Left +++ Right @@ -33,4 +33,11 @@ attr_accessor :damagestate +def inHyperMode? + return false +end +def isShadow? + return false +end + ### -- complex accessors @@ -109,8 +116,10 @@ def pbHasType?(type) - if type1==type||type2==type - return true + if type.is_a?(Symbol) || type.is_a?(String) + return isConst?(type1,PBTypes,type) || + isConst?(type2,PBTypes,type) + else + return (type1==type||type2==type) end - return false end @@ -534,19 +543,20 @@ !@battle.pbCheckGlobalAbility(:AIRLOCK) weather=@battle.pbWeather - if weather==PBWeather::SUNNYDAY && !pbHasType?(PBTypes::FIRE) - @type1=PBTypes::FIRE - @type2=PBTypes::FIRE + if weather==PBWeather::SUNNYDAY && !pbHasType?(:FIRE) && hasConst?(PBTypes,:FIRE) + @type1=getConst(PBTypes,:FIRE) + @type2=@type1 @battle.pbDisplay(_INTL("{1} transformed!",pbThis)) - elsif weather==PBWeather::RAINDANCE && !pbHasType?(PBTypes::WATER) - @type1=PBTypes::WATER - @type2=PBTypes::WATER + elsif weather==PBWeather::RAINDANCE && !pbHasType?(:WATER) && hasConst?(PBTypes,:WATER) + @type1=getConst(PBTypes,:WATER) + @type2=@type1 @battle.pbDisplay(_INTL("{1} transformed!",pbThis)) - elsif weather==PBWeather::HAIL && !pbHasType?(PBTypes::ICE) - @type1=PBTypes::ICE - @type2=PBTypes::ICE + elsif weather==PBWeather::HAIL && !pbHasType?(:ICE) && hasConst?(PBTypes,:ICE) + @type1=getConst(PBTypes,:ICE) + @type2=@type1 @battle.pbDisplay(_INTL("{1} transformed!",pbThis)) - elsif (weather==0 || weather==PBWeather::SANDSTORM) && !pbHasType?(PBTypes::NORMAL) - @type1=PBTypes::NORMAL - @type2=PBTypes::NORMAL + elsif (weather==0 || weather==PBWeather::SANDSTORM) && !pbHasType?(:NORMAL) && + hasConst?(PBTypes,:NORMAL) + @type1=getConst(PBTypes,:NORMAL) + @type2=@type1 @battle.pbDisplay(_INTL("{1} transformed!",pbThis)) end @@ -921,5 +931,5 @@ target=userandtarget[1] # LightningRod here, considers Hidden Power as Normal - if thismove.type==PBTypes::ELECTRIC && targets.length>0 && + if targets.length>0 && isConst?(thismove.type,PBTypes,:ELECTRIC) && !isConst?(target.ability,PBAbilities,:LIGHTNINGROD) # all damaging Electric attacks have a target of "single non-user" @@ -975,4 +985,5 @@ isConst?(thismove.id,PBMoves,:METALSOUND)|| isConst?(thismove.id,PBMoves,:SING)|| + isConst?(thismove.id,PBMoves,:SHADOWPANIC)|| isConst?(thismove.id,PBMoves,:SCREECH)|| isConst?(thismove.id,PBMoves,:UPROAR)|| @@ -1019,8 +1030,14 @@ badgelevel=100 if @battle.pbPlayer.badges[7] move=choice[2] + disobedient=false if @pokemon.isForeign?(@battle.pbPlayer) && @level>badgelevel a=((@level+badgelevel)*@battle.pbRandom(256)/255).floor - return true if a