Changed: PokemonSafari @@ -121,0 +121,1 @@ + pbPokeRadarEndBattle(species,level,decision) Changed: PokemonMap @@ -27,0 +27,1 @@ + @pokeradar=nil @@ -175,0 +176,1 @@ + attr_accessor :pokeradarBattery @@ -228,0 +230,1 @@ + attr_accessor :pokeradar @@ -229,0 +232,1 @@ + @pokeradar=nil Changed: PokemonPhone @@ -10,0 +10,3 @@ + if $game_player && $game_map.map_id==num[6] + next + end Changed: EventScene @@ -120,0 +120,10 @@ + end + def adjustPosition(xOffset,yOffset) + for process in @processes + if process[0]==Processes::XY + process[3]+=xOffset + process[4]+=yOffset + process[5]+=xOffset + process[6]+=yOffset + end + end Changed: PokemonField @@ -246,0 +246,1 @@ + pbPokeRadarMakeShiny(genwildpoke) @@ -368,0 +369,1 @@ + pbPokeRadarEndBattle(species,level,decision) @@ -568,0 +570,5 @@ + end + if $PokemonGlobal.pokeradarBattery && + $PokemonGlobal.pokeradarBattery > 0 && + !$PokemonTemp.pokeradar + $PokemonGlobal.pokeradarBattery-=1 @@ -634,1 +641,1 @@ - elsif $PokemonEncounters.isGrass? && !(Input.press?(Input::CTRL) && $DEBUG) + elsif $PokemonEncounters.isGrass? @@ -638,2 +645,3 @@ - if pbIsGrassTag?($game_map.terrain_tag(x,y)) - if encounter + if pbIsGrassTag?($game_map.terrain_tag(x,y)) && !(Input.press?(Input::CTRL) && $DEBUG) + if !pbPokeRadarEncounter && encounter # must run Poke Radar check first + $PokemonTemp.pokeradar=nil @@ -650,-1 +658,3 @@ + if !$PokemonEncounters.isGrass? || + !pbIsGrassTag?($game_map.terrain_tag($game_player.x,$game_player.y)) + pbPokeRadarCancel @@ -893,0 +905,1 @@ + $PokemonTemp.pokeradar=nil @@ -1065,0 +1078,1 @@ + $PokemonTemp.pokeradar=nil Changed: PokeBattle_ActualScene @@ -1698,0 +1698,1 @@ +pictureBall.adjustPosition(0,Graphics.height-320) @@ -2207,0 +2208,1 @@ + return if @battle.pbEnemyShouldUseItem?(index) @@ -2208,1 +2210,0 @@ - return if @battle.pbEnemyShouldUseItem?(index) Changed: PokemonTrainers @@ -28,0 +28,6 @@ + pokemon.ev[0]=[50,level].min + pokemon.ev[1]=[50,level].min + pokemon.ev[2]=[50,level].min + pokemon.ev[3]=[50,level].min + pokemon.ev[4]=[50,level].min + pokemon.ev[5]=[50,level].min Added: PokemonRadar Changed: BitmapCache @@ -42,0 +42,104 @@ +class WeakRef + @@id_map = {} # obj -> [ref,...] + @@id_rev_map = {} # ref -> obj + @@final = lambda{|id| + __old_status = Thread.critical + Thread.critical = true + begin + rids = @@id_map[id] + if rids + for rid in rids + @@id_rev_map.delete(rid) + end + @@id_map.delete(id) + end + rid = @@id_rev_map[id] + if rid + @@id_rev_map.delete(id) + @@id_map[rid].delete(id) + @@id_map.delete(rid) if @@id_map[rid].empty? + end + ensure + Thread.critical = __old_status + end + } + # Create a new WeakRef from +orig+. + def initialize(orig) + __setobj__(orig) + end + def __getobj__ + unless @@id_rev_map[self.__id__] == @__id + return nil + end + begin + ObjectSpace._id2ref(@__id) + rescue RangeError + return nil + end + end + def __setobj__(obj) + @__id = obj.__id__ + __old_status = Thread.critical + begin + Thread.critical = true + unless @@id_rev_map.key?(self) + ObjectSpace.define_finalizer obj, @@final + ObjectSpace.define_finalizer self, @@final + end + @@id_map[@__id] = [] unless @@id_map[@__id] + ensure + Thread.critical = __old_status + end + @@id_map[@__id].push self.__id__ + @@id_rev_map[self.__id__] = @__id + end + # Returns true if the referenced object still exists, and false if it has + # been garbage collected. + def weakref_alive? + @@id_rev_map[self.__id__] == @__id + end +end + +class WeakHashtable + include Enumerable + def initialize + @hash={} + end + def clear + @hash.clear + end + def delete(value) + @hash.delete(value) + end + def include?(value) + @hash.include?(value) + end + def each + @hash.each {|i| yield i } + end + def keys + @hash.keys + end + def values + @hash.values + end + def [](key) + o=@hash[key] + return o if !o + if o.weakref_alive? + o=o.__getobj__ + else + @hash.delete(key) + o=nil + end + return o + end + def []=(key,o) + if o!=nil + o=WeakRef.new(o) + end + @hash[key]=o + end +end + + @@ -44,1 +148,7 @@ - @cache = {} + @cache = WeakHashtable.new + def self.fromCache(i) + return nil if !@cache.include?(i) + obj=@cache[i] + return nil if obj && obj.disposed? + return obj + end @@ -47,5 +157,6 @@ - for i in @cache - if !i[1] - f.write("#{i[0]} (nil)\r\n") - elsif i[1].disposed? - f.write("#{i[0]} (disposed)\r\n") + for i in @cache.keys + k=fromCache(i) + if !k + f.write("#{i} (nil)\r\n") + elsif k.disposed? + f.write("#{i} (disposed)\r\n") @@ -53,1 +164,1 @@ - f.write("#{i[0]} (#{i[1].refcount}, #{i[1].width}x#{i[1].height})\r\n") + f.write("#{i} (#{k.refcount}, #{k.width}x#{k.height})\r\n") @@ -57,6 +168,0 @@ - end - def self.fromCache(i) - return nil if !@cache.include?(i) - obj=@cache[i] rescue nil - return nil if obj && obj.disposed? - return obj @@ -74,1 +179,0 @@ - @cache[i]=nil @@ -107,4 +211,5 @@ - @cache[key] = objPath.clone - @cache[key].hue_change(hue) - @cache[key].resetRef - objKey=@cache[key] + bitmap= objPath.clone + bitmap.hue_change(hue) + bitmap.resetRef + objKey=bitmap + @cache[key]=objKey @@ -160,1 +265,1 @@ - @cache[key]=BitmapWrapper.new(32, 32) + bitmap=BitmapWrapper.new(32, 32) @@ -165,1 +270,1 @@ - @cache[key].blt(0, 0, tileset, rect) + bitmap.blt(0, 0, tileset, rect) @@ -167,2 +272,3 @@ - @cache[key].hue_change(hue) - objKey=@cache[key] + bitmap.hue_change(hue) + objKey=bitmap + @cache[key]=objKey @@ -216,1 +322,7 @@ - @cache={} + @cache = WeakHashtable.new + def self.fromCache(i) + return nil if !@cache.include?(i) + obj=@cache[i] + return nil if obj && obj.disposed? + return obj + end @@ -218,6 +330,7 @@ - File.open("bitmapcache.txt","wb"){|f| - for i in @cache - if !i[1] - f.write("#{i[0]} (nil)\r\n") - elsif i[1].disposed? - f.write("#{i[0]} (disposed)\r\n") + File.open("bitmapcache2.txt","wb"){|f| + for i in @cache.keys + k=fromCache(i) + if !k + f.write("#{i} (nil)\r\n") + elsif k.disposed? + f.write("#{i} (disposed)\r\n") @@ -225,1 +338,1 @@ - f.write("#{i[0]} (#{i[1].refcount}, #{i[1].width}x#{i[1].height})\r\n") + f.write("#{i} (#{k.refcount}, #{k.width}x#{k.height})\r\n") @@ -233,1 +346,2 @@ - if not @cache.include?(path) or @cache[path].disposed? + objPath=fromCache(path) + if !objPath @@ -235,6 +349,6 @@ - for i in @cache.keys - if !@cache[i] || @cache[i].disposed? - @cache[i]=nil - @cache.delete(i) - end - end + for i in @cache.keys + obj=fromCache(i) + if !obj + @cache.delete(i) + end + end @@ -242,17 +356,15 @@ - begin - oldtime=Time.now.to_i - @cache[path] = BitmapWrapper.new(path) - @cache[path].key=path - if Time.now.to_i-oldtime>=3 - Graphics.update - end - rescue Hangup - begin - @cache[path] = BitmapWrapper.new(path) - @cache[path].key=path - rescue - raise _INTL("Failed to load bitmap: {1}",path) - end - rescue - raise _INTL("Failed to load bitmap: {1}",path) - end + begin + bm = BitmapWrapper.new(path) + rescue Hangup + begin + bm = BitmapWrapper.new(path) + rescue + bm = BitmapWrapper.new(32, 32) + raise _INTL("Failed to load bitmap: {1}",path) + end + rescue + bm = BitmapWrapper.new(32, 32) + raise _INTL("Failed to load bitmap: {1}",path) + end + objPath=bm + @cache[path]=objPath @@ -262,2 +374,2 @@ - @cache[path].addRef if cached - @cache[path] + objPath.addRef if cached + return objPath @@ -266,5 +378,7 @@ - if not @cache.include?(key) or !@cache[key] or @cache[key].disposed? - @cache[key] = @cache[path].clone - @cache[key].hue_change(hue) - # necessary because original object may have a higher refcount - @cache[key].resetRef + objKey=fromCache(key) + if !objKey + bitmap= objPath.clone + bitmap.hue_change(hue) + bitmap.resetRef + objKey=bitmap + @cache[key]=objKey @@ -272,1 +386,1 @@ - @cache[key].addRef + objKey.addRef @@ -274,1 +388,1 @@ - @cache[key] + return objKey @@ -281,1 +395,1 @@ - self.load_bitmap("Graphics/Autotiles/"+filename) + self.load_bitmap("Graphics/Autotiles/"+ filename) @@ -284,1 +398,1 @@ - self.load_bitmap("Graphics/Battlebacks/"+filename) + self.load_bitmap("Graphics/Battlebacks/"+ filename) @@ -287,1 +401,1 @@ - self.load_bitmap("Graphics/Battlers/"+filename, hue) + self.load_bitmap("Graphics/Battlers/"+ filename, hue) @@ -290,1 +404,1 @@ - self.load_bitmap("Graphics/Characters/"+filename, hue) + self.load_bitmap("Graphics/Characters/"+ filename, hue) @@ -293,1 +407,1 @@ - self.load_bitmap("Graphics/Fogs/"+filename, hue) + self.load_bitmap("Graphics/Fogs/"+ filename, hue) @@ -296,1 +410,1 @@ - self.load_bitmap("Graphics/Gameovers/"+filename) + self.load_bitmap("Graphics/Gameovers/"+ filename) @@ -299,1 +413,1 @@ - self.load_bitmap("Graphics/Icons/"+filename) + self.load_bitmap("Graphics/Icons/"+ filename) @@ -302,1 +416,1 @@ - self.load_bitmap("Graphics/Panoramas/"+filename, hue) + self.load_bitmap("Graphics/Panoramas/"+ filename, hue) @@ -305,1 +419,1 @@ - self.load_bitmap("Graphics/Pictures/"+filename) + self.load_bitmap("Graphics/Pictures/"+ filename) @@ -308,1 +422,1 @@ - self.load_bitmap("Graphics/Tilesets/"+filename) + self.load_bitmap("Graphics/Tilesets/"+ filename) @@ -311,1 +425,1 @@ - self.load_bitmap("Graphics/Titles/"+filename) + self.load_bitmap("Graphics/Titles/"+ filename) @@ -314,1 +428,1 @@ - self.load_bitmap("Graphics/Windowskins/"+filename) + self.load_bitmap("Graphics/Windowskins/"+ filename) @@ -318,2 +432,3 @@ - if not @cache.include?(key) or @cache[key].disposed? - @cache[key] = BitmapWrapper.new(32, 32) + objKey=fromCache(key) + if !objKey + bitmap=BitmapWrapper.new(32, 32) @@ -324,1 +439,1 @@ - @cache[key].blt(0, 0, tileset, rect) + bitmap.blt(0, 0, tileset, rect) @@ -326,1 +441,3 @@ - @cache[key].hue_change(hue) + bitmap.hue_change(hue) + objKey=bitmap + @cache[key]=objKey @@ -328,3 +445,3 @@ - @cache[key].addRef - end - @cache[key] + objKey.addRef + end + objKey Changed: PokeBattle_AI @@ -506,0 +506,52 @@ +def pbEnemyShouldWithdraw?(index) + shouldswitch=false + typecheck=false + movetype=-1 + if !@doublebattle && @opponent + money=@opponent.moneyEarned + if money>=70 # Experienced trainers only + opponent=@battlers[index].pbOppositeOpposing + if opponent.lastMoveUsed>0 && + (opponent.level-attacker.level).abs<=6 + move=PBMoveData.new(opponent.lastMoveUsed) + typemod=pbTypeModifier(move.type,@battlers[index]) + movetype=move.type + if move.basedamage>70 && typemod>4 + shouldswitch=pbAIRandom(100)<30 + movetype=move.type + elsif move.basedamage>50 && typemod>4 + shouldswitch=pbAIRandom(100)<20 + movetype=move.type + end + end + end + end + if @battlers[index].effects[PBEffects::PerishSong]==1 + shouldswitch=true + end + if shouldswitch + list=[] + party=pbParty(index) + for i in 0...party.length + if pbCanSwitch?(index,i,false) + if movetype>=0 && + pbTypeModifier(movetype,@battlers[index])==0 && + pbAIRandom(100)<80 + list.unshift(i) + elsif movetype>=0 && + pbTypeModifier(movetype,@battlers[index])<4 && + pbAIRandom(100)<55 + list.unshift(i) + else + list.push(i) + end + end + end + if list.length>0 + pbRegisterSwitch(index,list[0]) + return true + end + end + return false +end + Changed: WindowAndTilemap @@ -19,0 +19,3 @@ + end + def isEmpty? + return @x==0 && @y==0 && @width==0 && @height==0 @@ -100,1 +103,1 @@ - @active=true + @active=false @@ -185,1 +188,1 @@ - @active=value + @active=true @@ -267,1 +270,1 @@ - mustchange=true + mustchange=true if !@cursor_rect.isEmpty? Changed: Compiler @@ -132,1 +132,1 @@ - raise _INTL("Invalid quoted field (in: {1})\r\n{2}",ret,FileLineData.linereport) + raise _INTL("Invalid quoted field (in: {1})\r\n{2}",str,FileLineData.linereport) @@ -164,1 +164,1 @@ - raise _INTL("Field {1} is not a Boolean value (true, false, 1, 0)\r\n{2}",ret,FileLineData.linereport) + raise _INTL("Field {1} is not a Boolean value (true, false, 1, 0)\r\n{2}",field,FileLineData.linereport) @@ -189,1 +189,1 @@ - return Float(ret) rescue raise _INTL("Field {1} is not a number\r\n{2}",FileLineData.linereport) + return Float(ret) rescue raise _INTL("Field {1} is not a number\r\n{2}",ret,FileLineData.linereport) Changed: PokeBattle_BattlePalace @@ -65,0 +65,1 @@ + @justswitched=[false,false,false,false] @@ -170,2 +171,1 @@ - @battlers[index].status==PBStatuses::POISON || - @battlers[index].status==PBStatuses::PARALYSIS + @battlers[index].status==PBStatuses::POISON @@ -173,0 +173,3 @@ + end + if @battlers[index].status==PBStatuses::PARALYSIS + factor+=15 @@ -177,0 +180,4 @@ + end + if @justswitched[index] + factor-=40 + factor=0 if factor<0 @@ -184,0 +191,1 @@ + @justswitched[index]=shouldswitch Changed: Audio @@ -371,84 +371,1 @@ -=begin -module AudioThreadSafe - @@mutex=Mutex.new - @@audiothread=Thread.new { - loop do - @@mutex.synchronize { - params=Thread.current["params"] - if params - case params[0] - when :update - AudioInternal.update - when :bgm_play - AudioInternal.bgm_play(*params[1]) - when :bgm_fade - AudioInternal.bgm_fade(*params[1]) - when :bgm_stop - AudioInternal.bgm_stop(*params[1]) - when :me_play - AudioInternal.me_play(*params[1]) - when :me_fade - AudioInternal.me_fade(*params[1]) - when :me_stop - AudioInternal.me_stop(*params[1]) - when :bgs_play - AudioInternal.bgs_play(*params[1]) - when :bgs_fade - AudioInternal.bgs_fade(*params[1]) - when :bgs_stop - AudioInternal.bgs_stop(*params[1]) - end - end - Thread.current["params"]=nil - sleep(0.010) - } - end - } - def self.passParams(sym,*params) - @@mutex.synchronize { - @@audiothread["params"]=[sym,params] - } - end - def self.update - return if Graphics.frame_count%10!=0 - if AudioState.waitingBGM && !AudioState.meActive? - waitbgm=AudioState.waitingBGM - AudioState.waitingBGM=nil - bgm_play(waitbgm[0],waitbgm[1],waitbgm[2],waitbgm[3]) - end - end - def self.bgm_play(name,volume=80,pitch=100,position=nil) - self.passParams(:bgm_play,name,volume,pitch,position) - end - def self.bgm_fade(ms) - self.passParams(:bgm_fade,ms) - end - def self.bgm_stop - self.passParams(:bgm_stop) - end - def self.bgm_position - @@mutex.synchronize { - ret=Kernel.Audio_bgm_get_position - return ret - } - end - def self.me_play(name,volume=80,pitch=100) - self.passParams(:me_play,name,volume,pitch,0) - end - def self.me_fade(ms) - self.passParams(:me_fade,ms) - end - def self.me_stop - self.passParams(:me_stop) - end - def self.bgs_play(name,volume=80,pitch=100) - self.passParams(:bgs_play,name,volume,pitch,0) - end - def self.bgs_fade(ms) - self.passParams(:bgs_fade,ms) - end - def self.bgs_stop - self.passParams(:bgs_stop) - end -end -=end + Changed: SpriteWindow @@ -625,0 +625,3 @@ + def isEmpty? + return @x==0 && @y==0 && @width==0 && @height==0 + end @@ -774,2 +777,4 @@ - @contents=value - privRefresh + if @contents!=value + @contents=value + privRefresh if @visible + end @@ -778,2 +783,10 @@ - @ox=value - privRefresh + if @ox!=value + @ox=value + privRefresh if @visible + end + end + def oy=(value) + if @oy!=value + @oy=value + privRefresh if @visible + end @@ -798,4 +811,0 @@ - def oy=(value) - @oy=value - privRefresh - end @@ -813,1 +822,1 @@ - privRefresh + privRefresh if @visible @@ -817,1 +826,1 @@ - privRefresh + privRefresh if @visible @@ -821,1 +830,1 @@ - privRefresh + privRefresh if @visible @@ -827,1 +836,1 @@ - privRefresh + privRefresh if @visible @@ -833,1 +842,1 @@ - privRefresh + privRefresh if @visible @@ -839,1 +848,1 @@ - privRefresh + privRefresh if @visible @@ -843,1 +852,1 @@ - privRefresh + privRefresh if @visible @@ -847,1 +856,1 @@ - privRefresh + privRefresh if @visible @@ -851,1 +860,1 @@ - privRefresh + privRefresh if @visible @@ -870,1 +879,1 @@ - mustchange=true + privRefreshCursor @@ -872,1 +881,0 @@ - mustchange=true if @cursoropacity!=128 @@ -874,0 +882,1 @@ + privRefreshCursor @@ -996,0 +1005,5 @@ + end + def privRefreshCursor + contopac=self.contents_opacity + cursoropac=@cursoropacity*contopac/255 + @sprites["cursor"].opacity=cursoropac Changed: PokemonSystem @@ -88,1 +88,4 @@ - +$havetraceproc=false +$trace=nil +$lastcall="" +set_trace_func(nil) @@ -91,0 +94,17 @@ + if !$havetraceproc + $havetraceproc=true + Console::setup_console +=begin + $trace=File.open("calls.txt","wb"); + set_trace_func(proc {|event, file, line, id, binding, classname| + if event=="call" + $trace.write(Kernel.caller(2)[0,2].to_s) + $trace.write("\r\n") + end + }) +=end + else + $trace.close if $trace + set_trace_func nil + $havetraceproc=false + end Changed: PokemonUtilities @@ -246,0 +246,99 @@ +def drawSpot(bitmap,spotpattern,x,y,red,green,blue) + height=spotpattern.length + width=spotpattern[0].length + for yy in 0...height + spot=spotpattern[yy] + for xx in 0...width + if spot[xx]==1 + xOrg=(x+xx)<<1 + yOrg=(y+yy)<<1 + color=bitmap.get_pixel(xOrg,yOrg) + r=color.red+red + g=color.green+green + b=color.blue+blue + color.red=[[r,0].max,255].min + color.green=[[g,0].max,255].min + color.blue=[[b,0].max,255].min + bitmap.set_pixel(xOrg,yOrg,color) + bitmap.set_pixel(xOrg+1,yOrg,color) + bitmap.set_pixel(xOrg,yOrg+1,color) + bitmap.set_pixel(xOrg+1,yOrg+1,color) + end + end + end +end + +def pbSpindaSpots(pokemon,bitmap) + spot1=[ + [0,0,1,1,1,1,0,0], + [0,1,1,1,1,1,1,0], + [1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1], + [0,1,1,1,1,1,1,0], + [0,0,1,1,1,1,0,0] + ] + spot2=[ + [0,0,1,1,1,0,0], + [0,1,1,1,1,1,0], + [1,1,1,1,1,1,1], + [1,1,1,1,1,1,1], + [1,1,1,1,1,1,1], + [1,1,1,1,1,1,1], + [1,1,1,1,1,1,1], + [0,1,1,1,1,1,0], + [0,0,1,1,1,0,0] + ] + spot3=[ + [0,0,0,0,0,1,1,1,1,0,0,0,0], + [0,0,0,1,1,1,1,1,1,1,0,0,0], + [0,0,1,1,1,1,1,1,1,1,1,0,0], + [0,1,1,1,1,1,1,1,1,1,1,1,0], + [0,1,1,1,1,1,1,1,1,1,1,1,0], + [1,1,1,1,1,1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,1,1], + [0,1,1,1,1,1,1,1,1,1,1,1,0], + [0,1,1,1,1,1,1,1,1,1,1,1,0], + [0,0,1,1,1,1,1,1,1,1,1,0,0], + [0,0,0,1,1,1,1,1,1,1,1,0,0], + [0,0,0,0,0,1,1,1,0,0,0,0,0] + ] + spot4=[ + [0,0,0,0,1,1,1,0,0,0,0,0], + [0,0,1,1,1,1,1,1,1,0,0,0], + [0,1,1,1,1,1,1,1,1,1,0,0], + [0,1,1,1,1,1,1,1,1,1,1,0], + [1,1,1,1,1,1,1,1,1,1,1,0], + [1,1,1,1,1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,0], + [1,1,1,1,1,1,1,1,1,1,1,0], + [0,0,1,1,1,1,1,1,1,1,0,0], + [0,0,0,0,0,1,1,1,1,0,0,0] + ] + id=pokemon.personalID + h=(id>>28)&15 + g=(id>>24)&15 + f=(id>>20)&15 + e=(id>>16)&15 + d=(id>>12)&15 + c=(id>>8)&15 + b=(id>>4)&15 + a=(id)&15 + if pokemon.isShiny? + drawSpot(bitmap,spot1,b+33,a+25,-100,30,-100) + drawSpot(bitmap,spot2,d+21,c+24,-100,30,-100) + drawSpot(bitmap,spot3,f+39,e+7,-100,30,-100) + drawSpot(bitmap,spot4,h+15,g+6,-100,30,-100) + else + drawSpot(bitmap,spot1,b+33,a+25,30,-100,-100) + drawSpot(bitmap,spot2,d+21,c+24,30,-100,-100) + drawSpot(bitmap,spot3,f+39,e+7,30,-100,-100) + drawSpot(bitmap,spot4,h+15,g+6,30,-100,-100) + end +end + @@ -251,1 +350,7 @@ - if pokemon.isShiny? + if pokemon.species==PBSpecies::SPINDA && !back + bitmap=Bitmap.new( + sprintf("Graphics/Battlers/%03d%s%s.png",pokemon.species, + pokemon.isShiny? ? "s" : "", + back ? "b" : "")) + pbSpindaSpots(pokemon,bitmap) + elsif pokemon.isShiny? @@ -253,1 +358,1 @@ - return BitmapCache.load_bitmap( + bitmap=BitmapCache.load_bitmap( @@ -257,1 +362,1 @@ - return BitmapCache.load_bitmap( + bitmap=BitmapCache.load_bitmap( @@ -260,1 +365,2 @@ - # TODO: Spinda/Unown + # TODO: Unown + return bitmap @@ -268,1 +374,5 @@ - if pokemon.isShiny? + if pokemon.species==PBSpecies::SPINDA && !back + bitmap=Bitmap.new( + sprintf("Graphics/Battlers/%03ds%s.png",species,back ? "b" : "")) + pbSpindaSpots(pokemon,bitmap) + elsif pokemon.isShiny? @@ -270,1 +380,1 @@ - return BitmapCache.load_bitmap( + bitmap=BitmapCache.load_bitmap( @@ -274,1 +384,1 @@ - return BitmapCache.load_bitmap( + bitmap=BitmapCache.load_bitmap( @@ -277,1 +387,2 @@ - # TODO: Spinda/Unown + # TODO: Unown + return bitmap Changed: PokeBattle_Battle @@ -1642,13 +1642,0 @@ -end - -def pbEnemyShouldWithdraw?(index) - if @battlers[index].effects[PBEffects::PerishSong]==1 - party=pbParty(index) - for i in 0...party.length - if pbCanSwitch?(index,i,false) - pbRegisterSwitch(index,i) - return true - end - end - end - return false Changed: PokemonBag @@ -863,0 +863,2 @@ + ItemStorageHelper.pbStoreItem( + @items,MAXSIZE,MAXPERSLOT,PBItems::POTION,1) Changed: PokemonItems @@ -44,1 +44,1 @@ - @@useFromBag[item]=proc + @@useInField[item]=proc Changed: PokemonEncounters @@ -8,-1 +8,2 @@ + def stepcount + return @stepcount @@ -132,2 +135,4 @@ - if $PokemonGlobal.repel>0 && $Trainer.party.length>0 - return nil if encpoke[1]<=$Trainer.party[0].level + if $PokemonGlobal.repel>0 && + $Trainer.party.length>0 && + encpoke[1]<=$Trainer.party[0].level + return nil Changed: PokemonBugContest @@ -413,0 +413,1 @@ + pbPokeRadarEndBattle(species,level,decision) Changed: PokemonSafari Changed: PokemonMap Changed: PokemonPhone Changed: EventScene Changed: PokemonField Changed: PokeBattle_ActualScene Changed: PokemonTrainers Added: PokemonRadar Changed: BitmapCache Changed: PokeBattle_AI Changed: WindowAndTilemap Changed: Compiler Changed: PokeBattle_BattlePalace Changed: Audio Changed: SpriteWindow Changed: PokemonSystem Changed: PokemonUtilities Changed: PokeBattle_Battle Changed: PokemonBag Changed: PokemonItems Changed: PokemonEncounters Changed: PokemonBugContest