Changed: TileDrawingHelper --- Left +++ Right @@ -63,4 +63,13 @@ end +def dispose + @tileset.dispose if @tileset + @tileset=nil + for i in 0...@autotiles.length + @autotiles[i].dispose + @autotiles[i]=nil + end +end + def self.fromTileset(tileset) bmtileset=pbGetTileset(tileset.tileset_name) Changed: PokemonRadar --- Left +++ Right @@ -128,4 +128,6 @@ # + + Events.onWildPokemonCreate+=proc {|sender,e| pokemon=e[0] Changed: SpriteWindow --- Left +++ Right @@ -1116,5 +1116,4 @@ pbDeactivateWindows(sprites){ for j in 0..26 - block_given? ? yield : pbUpdateSpriteHash(sprites) for i in sprites next if pbDisposed?(i[1]) @@ -1128,4 +1127,5 @@ Graphics.update Input.update + block_given? ? yield : pbUpdateSpriteHash(sprites) end } @@ -1149,6 +1149,5 @@ end pbDeactivateWindows(sprites){ - for j in 0..26 - block_given? ? yield : pbUpdateSpriteHash(sprites) + for j in 0..27 for i in sprites next if pbDisposed?(i[1]) @@ -1162,4 +1161,5 @@ Graphics.update Input.update + block_given? ? yield : pbUpdateSpriteHash(sprites) end } @@ -3945,9 +3945,18 @@ @__disposed=true end + super end def ox; @__ox; end def oy; @__oy; end - def ox=(value); @__ox=value; refresh; end - def oy=(value); @__oy=value; refresh; end + def ox=(value); + if @__ox!=value + @__ox=value; refresh + end + end + def oy=(value); + if @__oy!=value + @__oy=value; refresh + end + end def bitmap return @__bitmap Changed: PokemonUtilities --- Left +++ Right @@ -1397,6 +1397,5 @@ location=-1 name="" - pbEachNonEggPokemon {|poke,box| - id=poke.publicID + id=rand(65536) numbers=0 mod=100000 @@ -1411,8 +1410,7 @@ if numbers>=maxNumbers maxNumbers=numbers - location=box - name=poke.name + location=-1 + name=$Trainer.party[0].name end - } pbSet(locationVariableNum,location) pbSet(nameVariableNum,name) Changed: PokeBattle_Battle --- Left +++ Right @@ -1791,7 +1791,4 @@ evgain*=2 end - if thispoke.pokerus > 0 - evgain*=2 - end if evgain>0 # Can't exceed overall limit Changed: PokeBattle_BattleArena --- Left +++ Right @@ -45,5 +45,5 @@ @partyindexes[1]+=1 newenemy=@partyindexes[1] - pbDisplayBrief(_INTL("{1} sent out {2}!",@opponent.fullname,@party2[newenemy].name)) + pbDisplayBrief(_INTL("{1} sent out\r\n{2}!",@opponent.fullname,@party2[newenemy].name)) @battlers[1].pbInitialize(@party2[newenemy],newenemy,false); @scene.pbTrainerSendOut(1,@party2[newenemy]) Changed: PokemonDebug --- Left +++ Right @@ -527,4 +527,5 @@ end end +=begin pokerus=data[28] if (pokerus&0xF0)>0 @@ -534,4 +535,5 @@ pokemon.pokerusTime=Time.now.to_i end +=end pokemon.calcStats if pokemonsize>0x20 @@ -643,4 +645,5 @@ when 3 data=struct.unpack("CCCCVV") +=begin if (data[0]&0xF0)>0 pokemon.pokerus=2 @@ -649,4 +652,5 @@ pokemon.pokerusTime=Time.now.to_i end +=end if ((data[3]>>3)&0x0F)>0 toballused=[0,4,3,1,0,2,5,6,7,8,9,10,11] Changed: PokeBattle_MoveEffects --- Left +++ Right @@ -153,5 +153,5 @@ def pbEffect(attacker,opponent) if attacker.effects[PBEffects::MirrorMove]<=0 - @battle.pbDisplay(_INTL("The Mirror Move failed!")) + @battle.pbDisplay(_INTL("The mirror move failed!")) return -1 end Changed: AudioUtilities --- Left +++ Right @@ -718,5 +718,4 @@ end waveForm.generateSound - waveForm.save("waveform.wav") waveForm.play(volume,async) end Changed: PokeBattle_Pokemon --- Left +++ Right @@ -72,6 +72,6 @@ attr_accessor(:trainerID) # Trainer ID attr_accessor(:hp) # Current HP -attr_accessor(:pokerus) # Three states: Not infected, infected, cured -attr_accessor(:pokerusTime) # Time infected by Pokerus +#attr_accessor(:pokerus) # Three states: Not infected, infected, cured +#attr_accessor(:pokerusTime) # Time infected by Pokerus attr_accessor(:item) # Held item attr_accessor(:ot) # Original Trainer name @@ -177,5 +177,5 @@ iv|=0x80000000 if @abilityflag==1 iv|=0x40000000 if @eggsteps>0 - pokerus=[0,1,0x10][@pokerus] + pokerus=[0,1,0x10][@pokerus||0] fromballused= [0,3,5,2,1,6,7,8,9,10,11,12] ballused=@ballused && @ballused=pkmn.pokerusTime+345600 - # Cured - pkmn.pokerus=2 - end - end -} Events.onStepTaken+=proc{ @@ -1679,12 +1639,6 @@ end - - def Kernel.pbPokerus? - return false if $game_switches[POKeRUS_SWITCH] - for i in $Trainer.party - return true if i.pokerus==1 && !i.egg? - end - return false + return false end Changed: Dungeon --- Left +++ Right @@ -17,5 +17,5 @@ @old.clear end - if @old.length>0 && rand(5)==0 + if @old.length>0 && rand(7)==0 # Get old value value=rand(@old.length) @@ -38,59 +38,315 @@ end -class DungeonGraph - def initialize(size) - @size=size + +class DungeonMaze + TILEWIDTH=13 + TILEHEIGHT=13 + def self.paintRect(tile,x,y,w,h) + for j in 0...h + for i in 0...w + tile[(j+y)*TILEWIDTH+(i+x)]=3 + end + end + end + def self.paintTile(dungeon,dstX,dstY,tile,rotation) + if rotation==None + for y in 0...TILEHEIGHT;for x in 0...TILEWIDTH + dungeon[x+dstX,y+dstY]=tile[y*TILEWIDTH+x] + end;end + elsif rotation==TurnLeft + for y in 0...TILEHEIGHT;for x in 0...TILEWIDTH + dungeon[y+dstX,TILEWIDTH-1-x+dstY]=tile[y*TILEWIDTH+x] + end;end + elsif rotation==TurnRight + for y in 0...TILEHEIGHT;for x in 0...TILEWIDTH + dungeon[TILEHEIGHT-1-y+dstX,x+dstY]=tile[y*TILEWIDTH+x] + end;end + elsif rotation==Turn180 + for y in 0...TILEHEIGHT;for x in 0...TILEWIDTH + dungeon[TILEWIDTH-1-x+dstX,TILEHEIGHT-1-y+dstY]=tile[y*TILEWIDTH+x] + end;end + end + end + MINWIDTH=5 + MINHEIGHT=4 + MAXWIDTH=11 + MAXHEIGHT=10 + None=0 + TurnLeft=1 + TurnRight=2 + Turn180=3 + def self.paintCell(dungeon,xDst,yDst,tile,rotation) + return false if !tile + paintTile(dungeon,xDst,yDst,tile,rotation) + if rand(10)<7 + # Generate a randomly placed room + width=MINWIDTH+rand(MAXWIDTH-MINWIDTH+1) + height=MINHEIGHT+rand(MAXHEIGHT-MINHEIGHT+1) + centerX=TILEWIDTH/2 + centerY=TILEHEIGHT/2 + centerX=(rand(2)==0) ? centerX-rand(3) : centerX+rand(3) + centerY=(rand(2)==0) ? centerY-rand(3) : centerY+rand(3) + x=centerX-(width/2) + y=centerY-(height/2) + rect=[x,y,width,height] + rect[0]=1 if rect[0]<1 + rect[1]=2 if rect[1]<2 + rect[0]=TILEWIDTH-1-width if rect[0]+width>TILEWIDTH-1 + rect[1]=TILEHEIGHT-1-height if rect[0]+height>TILEHEIGHT-1 + dungeon.paint(rect,xDst,yDst) + return true + end + return false + end + def self.generateTiles + tiles=[] + for i in 0...6 + tiles[i]=[] + for j in 0...TILEWIDTH*TILEHEIGHT + tiles[i][j]=0 + end + end + paintRect(tiles[0],5,0,3,10) # N + paintRect(tiles[1],5,0,3,8) # N E + paintRect(tiles[1],5,5,8,3) + paintRect(tiles[2],5,0,3,8) # N W E + paintRect(tiles[2],0,5,13,3) + paintRect(tiles[3],5,0,3,13) # N S + paintRect(tiles[4],5,0,3,13) + paintRect(tiles[4],0,5,13,3) + realtiles=[ + [tiles[4],None], # N W E S + [tiles[2],Turn180], # W E S + [tiles[2],TurnRight], # N E S + [tiles[1],TurnRight], # E S + [tiles[2],TurnLeft], # N W S + [tiles[1],Turn180], # W S + [tiles[3],None], # N S + [tiles[0],Turn180], # S + [tiles[2],None], # N W E + [tiles[3],TurnLeft], # W E + [tiles[1],None], # N E + [tiles[0],TurnRight], # E + [tiles[1],TurnLeft], # N W + [tiles[0],TurnLeft], # W + [tiles[0],None], # N + [nil,None] + ] + return realtiles + end +end + +module EdgeMasks + North=1;West=2;East=4;South=8;Visited=16 +end + +# Dungeon generation algorithm found at: +# http://members.gamedev.net/potentialwell/ProceduralDungeonGeneration-JTippets.pdf + +class MazeNode + def initialize + @edges=0 + end + def setEdge(e); @edges|=e; end + def clearEdge(e); @edges&=~e; end + def clear; @edges=0; end + def set; @edges=15; end + def getEdge(e); return (@edges&e)!=0; end + def isBlocked?; return @edges!=0; end +end + +class NodeListElement + attr_accessor :x,:y + def initialize(x,y) + @x=x;@y=y + end +end + + +class Maze + attr_accessor :cellWidth,:cellHeight,:nodeWidth,:nodeHeight + def initialize(cw,ch) @nodes=[] - for i in 0...size - @nodes[i]=[] + @cells=[] + raise ArgumentError.new if cw==0 || ch==0 + @cellWidth=cw + @cellHeight=ch + @nodeWidth=cw+1 + @nodeHeight=ch+1 + for i in 0...@nodeWidth*@nodeHeight + @nodes[i]=MazeNode.new end + for i in 0...cw*ch + @cells[i]=0 + end + clearAllEdges() + clearAllCells() end - def addConnection(a,b) - if !@nodes[a].include?(b) - @nodes[a].push(b) + def buildNodeList + list=[] + for x in 0...nodeWidth + for y in 0...nodeHeight + list.push(NodeListElement.new(x,y)) + end end - if !@nodes[b].include?(a) - @nodes[b].push(a) + list.shuffle! + return list + end + def setEdgeNode(x,y,edge) + return if x<0||x>=nodeWidth||y<0||y>=nodeHeight + @nodes[y*nodeWidth+x].setEdge(edge) + e=0;nx=0;ny=0 + if edge==EdgeMasks::North + e=EdgeMasks::South;nx=x;ny=y-1 + elsif edge==EdgeMasks::South + e=EdgeMasks::North;nx=x;ny=y+1 + elsif edge==EdgeMasks::East + e=EdgeMasks::West;nx=x+1;ny=y + elsif edge==EdgeMasks::West + e=EdgeMasks::East;nx=x-1;ny=y + else + return end + return if nx<0||ny<0||nx>=nodeWidth||ny>=nodeHeight + @nodes[ny*nodeWidth+nx].setEdge(e) end - def unvisitedRooms - alreadyVisited=[] - if @nodes.length>0 - alreadyVisited.push(0) - visitInternal(0,alreadyVisited) + def clearEdgeNode(x,y,edge) + return if x<0||x>=nodeWidth||y<0||y>=nodeHeight + @nodes[y*nodeWidth+x].clearEdge(edge) + e=0;nx=0;ny=0 + if edge==EdgeMasks::North + e=EdgeMasks::South;nx=x;ny=y-1 + elsif edge==EdgeMasks::South + e=EdgeMasks::North;nx=x;ny=y+1 + elsif edge==EdgeMasks::East + e=EdgeMasks::West;nx=x+1;ny=y + elsif edge==EdgeMasks::West + e=EdgeMasks::East;nx=x-1;ny=y + else + raise ArgumentError.new end - unvisited=[] - for i in 0...@size - if !alreadyVisited.include?(i) - unvisited.push(i) + return if nx<0||ny<0||nx>=nodeWidth||ny>=nodeHeight + @nodes[ny*nodeWidth+nx].clearEdge(e) + end + def isBlockedNode?(x,y) + return false if x<0||y<0||x>=nodeWidth||y>=nodeHeight + return @nodes[y*nodeWidth+x].isBlocked? + end + def getEdgeNode(x,y,edge) + return false if x<0||y<0||x>=nodeWidth||y>=nodeHeight + return @nodes[y*nodeWidth+x].getEdge(edge) + end + def getEdgePattern(x,y) + pattern=0 + pattern|=EdgeMasks::North if getEdgeNode(x,y,EdgeMasks::North) + pattern|=EdgeMasks::South if getEdgeNode(x,y,EdgeMasks::South) + pattern|=EdgeMasks::East if getEdgeNode(x,y,EdgeMasks::East) + pattern|=EdgeMasks::West if getEdgeNode(x,y,EdgeMasks::West) + return pattern + end + def setAllEdges + for c in 0...nodeWidth*nodeHeight + @nodes[c].set + end + end + def clearAllEdges + for c in 0...nodeWidth*nodeHeight + @nodes[c].clear + end + end + def clearAllCells + for c in 0...cellWidth*cellHeight + @cells[c]=0 + end + end + def setVisited(x,y) + return if x<0||y<0||x>=cellWidth||x>=cellHeight + @cells[y*cellWidth+x]|=EdgeMasks::Visited + end + def getVisited(x,y) + return false if x<0||y<0||x>=cellWidth||x>=cellHeight + return (@cells[y*cellWidth+x]&EdgeMasks::Visited)!=0 + end + def clearVisited(x,y) + return if x<0||y<0||x>=cellWidth||x>=cellHeight + @cells[y*cellWidth+x]&=~EdgeMasks::Visited + end + @@dirs=[EdgeMasks::North,EdgeMasks::South, + EdgeMasks::East,EdgeMasks::West] + def randomDir + return @@dirs[rand(4)] + end + def buildMazeWall(x,y,dir,len) + wx=x;wy=y + return if isBlockedNode?(x,y) + for c in 0...len + ox=wx;oy=wy + wy-=1 if dir==EdgeMasks::North + wx-=1 if dir==EdgeMasks::West + wx+=1 if dir==EdgeMasks::East + wy+=1 if dir==EdgeMasks::South + if isBlockedNode?(wx,wy) + setEdgeNode(ox,oy,dir); return + else + setEdgeNode(ox,oy,dir) end end - return unvisited end - # Returns true if a path exists where each - # node is visited at least once. - def visit - alreadyVisited=[] - if @nodes.length>0 - alreadyVisited.push(0) - visitInternal(0,alreadyVisited) + def generateWallGrowthMaze(minWall=nil,maxWall=nil) + minWall=0 if !minWall + maxWall=cellWidth if !maxWall + nlist=buildNodeList() + return if nlist.length==0 + for c in 0...nlist.length + d=randomDir() + len=rand(minWall+(maxWall-minWall)+1) + x=nlist[c].x + y=nlist[c].y + buildMazeWall(x,y,d,len) end - return alreadyVisited.length==@nodes.length end - private - def visitInternal(i,alreadyVisited) - for j in @nodes[i] - if !alreadyVisited.include?(j) - alreadyVisited.push(j) # must add to list before recursing - visitInternal(j,alreadyVisited) + def recurseDepthFirst(x,y,depth) + setVisited(x,y) + dirs=@@dirs.shuffle + success=0 + for c in 0...4 + d=dirs[c] + cx=0;cy=0 + case d + when EdgeMasks::North; cx=x; cy=y-1 + when EdgeMasks::South; cx=x; cy=y+1 + when EdgeMasks::East; cx=x+1; cy=y + when EdgeMasks::West; cx=x-1; cy=y end + if cx>=0 && cy>=0 && cxmaxfailures - break - end - end end end - for room in rooms - paint(room,XBUFFER,YBUFFER) - end - # Draw corridors - failures=0 - ar1=AntiRandom.new(rooms.length) - ar2=AntiRandom.new(rooms.length) - if rooms.length>1 - graph=DungeonGraph.new(rooms.length) - while !graph.visit() - i1=ar1.get() - i2=ar2.get() - next if i1==i2 - room1=rooms[i1] - room2=rooms[i2] - failure=false - if rand(2)==0 # north to south/south to north - startY=0;endY=0;startX=0;endX=0 - if room1[1]+room1[3]+ROOMDISTY <= room2[1] - startY=room1[1]+room1[3]; endY=room2[1] - startX=room1[0]+rand(room1[2]) - endX=room2[0]+rand(room2[2]) - elsif room2[1]+room2[3]+ROOMDISTY <= room1[1] - startY=room2[1]+room2[3]; endY=room1[1] - startX=room2[0]+rand(room2[2]) - endX=room1[0]+rand(room1[2]) - else - failure=true - end - startX+=XBUFFER;startY+=YBUFFER - endX+=XBUFFER;endY+=YBUFFER - if !failure && startX==endX - if verttest(startX,startY,endY-1,true,true) - vert(startX,startY,endY) - else - failure=true - end - elsif !failure - brk=startY+(endY-startY)/2 - if verttest(startX,startY,brk,true,false) && - horiztest(brk,startX,endX,false,false) && - verttest(endX,brk,endY-1,false,true) - vert(startX,startY,brk) - horiz(brk,startX,endX) - vert(endX,brk,endY-1) - else - failure=true - end - end - else # west to east/east to west - startX=0;endX=0;startY=0;endY=0 - if room1[0]+room1[2]+ROOMDISTX <= room2[0] - startX=room1[0]+room1[2]; endX=room2[0] - startY=room1[1]+rand(room1[3]) - endY=room2[1]+rand(room2[3]) - elsif room2[0]+room2[2]+ROOMDISTX <= room1[0] - startX=room2[0]+room2[2]; endX=room1[0] - startY=room2[1]+rand(room2[3]) - endY=room1[1]+rand(room1[3]) - else - failure=true - end - startX+=XBUFFER;startY+=YBUFFER - endX+=XBUFFER;endY+=YBUFFER - if !failure && startY==endY - if horiztest(startY,startX,endX-1,true,true) - horiz(startY,startX,endX) - else - failure=true - end - elsif !failure - brk=startX+(endX-startX)/2 - if horiztest(startY,startX,brk,true,false) && - verttest(brk,startY,endY,false,false) && - horiztest(endY,brk,endX-1,false,true) - horiz(startY,startX,brk) - vert(brk,startY,endY) - horiz(endY,brk,endX-1) - else - failure=true - end - end + if roomcount==0 + # Handle situation where no rooms were generated + for x in 0...maxWidth + for y in 0...maxHeight + self[x+XBUFFER,y+YBUFFER]=1 end - if !failure - graph.addConnection(i1,i2) - failures=0 - else - failures+=1 - if failures>@width+@height - break - end - end end - # Eliminate unconnected rooms - unconnectedRooms=graph.unvisitedRooms - for room in unconnectedRooms - unpaint(rooms[room],XBUFFER,YBUFFER) - end end # Generate walls @@ -300,19 +455,11 @@ end end - def randomRoomTile - ar1=AntiRandom.new(@width) - ar2=AntiRandom.new(@height) - while true - x=ar1.get() - y=ar2.get() - return [x,y] if self[x,y]==1 - end - end def generateMapInPlace(map) + tbl=DungeonTable.new(self) for i in 0...map.width for j in 0...map.height - nb=TileDrawingHelper.tableNeighbors(self,i,j) + nb=TileDrawingHelper.tableNeighbors(tbl,i,j) tile=TileDrawingHelper::NeighborsToTiles[nb] - map.data[i,j,0]=tile+48*([1,2,3,2][self[i,j]]) + map.data[i,j,0]=tile+48*(tbl[i,j]) map.data[i,j,1]=0 map.data[i,j,2]=0 @@ -320,81 +467,4 @@ end end - private - YCLEAR=3 - def isclear(x,y) - for yy in y-3..y+3 - return false if get(x,yy) - return false if get(x-1,yy) - return false if get(x,yy) - end - return true - end - def horiztest(y,xstart,xend,st,en) - xmin=xstartxend ? xstart : xend - for x in xmin..xmax - if st && x==xmin - # ignore west tiles when checking if clear - for yy in y-YCLEAR..y+YCLEAR - return false if get(x,yy) - return false if get(x+1,yy) - end - elsif en && x==xmax - # ignore east tiles - for yy in y-YCLEAR..y+YCLEAR - return false if get(x,yy) - return false if get(x-1,yy) - end - else - return false if !isclear(x,y) - end - end - return true - end - def horiz(y,xstart,xend) - xmin=xstartxend ? xstart : xend - for x in xmin..xmax - self[x,y]=3 # corridor tile - end - end - def verttest(x,ystart,yend,st,en) - ymin=ystartyend ? ystart : yend - for y in ymin..ymax - if st && (y-ymin).absyend ? ystart : yend - for y in ymin..ymax - self[x,y]=3 # corridor tile - end - end - def unpaint(rect,offsetX,offsetY) - for y in (rect[1]+offsetY...rect[1]+offsetY+rect[3]) - for x in (rect[0]+offsetX...rect[0]+offsetX+rect[2]) - self[x,y]=0 - end - end - end def paint(rect,offsetX,offsetY) for y in (rect[1]+offsetY...rect[1]+offsetY+rect[3]) @@ -420,8 +490,9 @@ ar1=AntiRandom.new(dungeon.width) ar2=AntiRandom.new(dungeon.height) - while true + for i in 0...(tiles.length+1)*1000 x=ar1.get() y=ar2.get() - if dungeon[x,y]==1 && (!tiles.any?{|item| item[0]==x && item[1]==y}) + if dungeon.isRoom?(x,y) && (!tiles.any?{|item| + (item[0]-x).abs>=2 && (item[1]-y).abs>=2 }) ret=[x,y] tiles.push(ret) @@ -429,4 +500,5 @@ end end + return nil end @@ -444,12 +516,16 @@ for event in map.events.values tile=pbRandomRoomTile(dungeon,roomtiles) - event.x=tile[0] - event.y=tile[1] + if tile + event.x=tile[0] + event.y=tile[1] + end end # Override transfer X and Y - tile=dungeon.randomRoomTile() - $game_temp.player_new_x=tile[0] - $game_temp.player_new_y=tile[1] + tile=pbRandomRoomTile(dungeon,roomtiles) + if tile + $game_temp.player_new_x=tile[0] + $game_temp.player_new_y=tile[1] + end end } Changed: PokemonSummary --- Left +++ Right @@ -58,4 +58,8 @@ class PokemonSummaryScene +def pbPokerus(pkmn) + return 0 +end + def pbUpdate pbUpdateSpriteHash(@sprites) @@ -156,7 +160,7 @@ imagepos=[] - if pokemon.pokerus==1 || pokemon.hp==0 || @pokemon.status>0 + if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0 status=@pokemon.status-1 - status=6 if pokemon.pokerus==1 + status=6 if pbPokerus(pokemon)==1 status=5 if pokemon.hp==0 imagepos.push(["Graphics/Pictures/statuspane",0,288,0,0,-1,-1]) @@ -167,5 +171,5 @@ imagepos.push([ballimage,16,254,0,0,-1,-1]) pbDrawImagePositions(overlay,imagepos) - if pokemon.pokerus==2 + if pbPokerus(pokemon)==2 overlay.fill_rect(52,278,4,4,Color.new(0,0,0)) end @@ -199,5 +203,5 @@ textpos.push([_INTL("♀"),132,254,false,Color.new(248,128,128),Color.new(168,24,24)]) end - if pokemon.pokerus==1 || pokemon.hp==0 || pokemon.status>0 + if pbPokerus(pokemon)==1 || pokemon.hp==0 || pokemon.status>0 textpos.push([_INTL("STATUS"),4,288,false,base,shadow]) end @@ -298,7 +302,7 @@ @sprites["background"].setBitmap("Graphics/Pictures/summary2") imagepos=[] - if pokemon.pokerus==1 || pokemon.hp==0 || @pokemon.status>0 + if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0 status=@pokemon.status-1 - status=6 if pokemon.pokerus==1 + status=6 if pbPokerus(pokemon)==1 status=5 if pokemon.hp==0 imagepos.push(["Graphics/Pictures/statuspane",0,288,0,0,-1,-1]) @@ -309,5 +313,5 @@ imagepos.push([ballimage,16,254,0,0,-1,-1]) pbDrawImagePositions(overlay,imagepos) - if pokemon.pokerus==2 + if pbPokerus(pokemon)==2 overlay.fill_rect(52,278,4,4,Color.new(0,0,0)) end @@ -351,5 +355,5 @@ textpos.push([_INTL("♀"),132,254,false,Color.new(248,128,128),Color.new(168,24,24)]) end - if pokemon.pokerus==1 || pokemon.hp==0 || pokemon.status>0 + if pbPokerus(pokemon)==1 || pokemon.hp==0 || pokemon.status>0 textpos.push([_INTL("STATUS"),4,288,false,base,shadow]) end @@ -375,7 +379,7 @@ @sprites["background"].setBitmap("Graphics/Pictures/summary3") imagepos=[] - if pokemon.pokerus==1 || pokemon.hp==0 || @pokemon.status>0 + if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0 status=@pokemon.status-1 - status=6 if pokemon.pokerus==1 + status=6 if pbPokerus(pokemon)==1 status=5 if pokemon.hp==0 imagepos.push(["Graphics/Pictures/statuspane",0,288,0,0,-1,-1]) @@ -386,5 +390,5 @@ imagepos.push([ballimage,16,254,0,0,-1,-1]) pbDrawImagePositions(overlay,imagepos) - if pokemon.pokerus==2 + if pbPokerus(pokemon)==2 overlay.fill_rect(52,278,4,4,Color.new(0,0,0)) end @@ -421,5 +425,5 @@ yPos+=32 end - if pokemon.pokerus==1 || pokemon.hp==0 || pokemon.status>0 + if pbPokerus(pokemon)==1 || pokemon.hp==0 || pokemon.status>0 textpos.push([_INTL("STATUS"),4,288,false,base,shadow]) end Changed: PokemonEncounters --- Left +++ Right @@ -87,21 +87,8 @@ return EncounterTypes::Cave elsif self.isGrass? - hour=Time.now.hour enctype=EncounterTypes::Land if pbInBugContest? if self.hasEncounter?(EncounterTypes::BugContest) enctype=EncounterTypes::BugContest - end - elsif hour<6 || hour>=20 - if self.hasEncounter?(EncounterTypes::LandNight) - enctype=EncounterTypes::LandNight - end - elsif hour<12 - if self.hasEncounter?(EncounterTypes::LandMorning) - enctype=EncounterTypes::LandMorning - end - else - if self.hasEncounter?(EncounterTypes::LandDay) - enctype=EncounterTypes::LandDay end end Changed: PokemonTilesetEditor --- Left +++ Right @@ -10,6 +10,6 @@ _INTL("The editor has detected that the tileset data was recently edited in RPG Maker XP.") ) -next Kernel.pbConfirmMessage( - _INTL("Do you want to ignore those recent edits?") +next !Kernel.pbConfirmMessage( + _INTL("Do you want to load those recent edits?") ) } @@ -25,22 +25,39 @@ textpos=[] @sprites["tileset"].src_rect=Rect.new(0,@y,256,Graphics.height-64) - @sprites["overlay"].bitmap.fill_rect(@x,0,32,2,Color.new(255,0,0)) - @sprites["overlay"].bitmap.fill_rect(@x,0,2,32,Color.new(255,0,0)) - @sprites["overlay"].bitmap.fill_rect(@x,30,32,2,Color.new(255,0,0)) - @sprites["overlay"].bitmap.fill_rect(@x+30,0,2,32,Color.new(255,0,0)) tilesize=@tileset.terrain_tags.xsize for yy in 0...(Graphics.height-64)/32 - ypos=(yy+(@y>>5))*8+384 + ypos=(yy+(@y/32))*8+384 next if ypos>=tilesize for xx in 0...8 - terr=@tileset.terrain_tags[ypos+xx] + terr=ypos<384 ? @tileset.terrain_tags[xx*48] : + @tileset.terrain_tags[ypos+xx] + if ypos<384 + @tilehelper.bltTile(@sprites["overlay"].bitmap,xx*32,yy*32,xx*48) + end textpos.push(["#{terr}",xx*32+16,yy*32,2,Color.new(80,80,80),Color.new(192,192,192)]) end end + @sprites["overlay"].bitmap.fill_rect(@x,0,32,2,Color.new(255,0,0)) + @sprites["overlay"].bitmap.fill_rect(@x,0,2,32,Color.new(255,0,0)) + @sprites["overlay"].bitmap.fill_rect(@x,30,32,2,Color.new(255,0,0)) + @sprites["overlay"].bitmap.fill_rect(@x+30,0,2,32,Color.new(255,0,0)) pbDrawTextPositions(@sprites["overlay"].bitmap,textpos) end def pbGetSelected(x,y) - return (y>>5)*8+384+(x>>5) + if y<0 + return 48*(x/32) + else + return (y/32)*8+384+(x/32) + end end +def pbSetSelected(i,value) + if i<384 + for j in 0...48 + @tileset.terrain_tags[i+j]=value + end + else + @tileset.terrain_tags[i]=value + end +end def pbChooseTileset @@ -52,7 +69,9 @@ if ret>=0 @tileset=@tilesetwrapper.data[ret+1] + @tilehelper.dispose + @tilehelper=TileDrawingHelper.fromTileset(@tileset) @sprites["tileset"].setBitmap("Graphics/Tilesets/#{@tileset.tileset_name}") @x=0 - @y=0 + @y=-32 pbUpdateTileset end @@ -65,4 +84,5 @@ @tilesetwrapper=pbTilesetWrapper @tileset=@tilesetwrapper.data[1] + @tilehelper=TileDrawingHelper.fromTileset(@tileset) @sprites={} @sprites["title"]=Window_UnformattedTextPokemon.new(_INTL("Tileset Editor (L/R: SCROLL; Z/F5: MENU)")) @@ -83,5 +103,5 @@ @sprites["overlay"].visible=true @x=0 - @y=0 + @y=-32 pbUpdateTileset pbFadeInAndShow(@sprites) @@ -126,5 +146,5 @@ elsif Input.repeat?(Input::UP) @y-=32 - @y=0 if @y<0 + @y=-32 if @y<-32 pbUpdateTileset elsif Input.repeat?(Input::R) @@ -141,7 +161,7 @@ params.setRange(0,99) params.setDefaultValue(@tileset.terrain_tags[selected]) - @tileset.terrain_tags[selected]=Kernel.pbMessageChooseNumber( + pbSetSelected(selected,Kernel.pbMessageChooseNumber( _INTL("Set the terrain tag."),params - ) + )) pbUpdateTileset elsif Input.trigger?(Input::A) @@ -166,4 +186,5 @@ pbDisposeSpriteHash(@sprites) @viewport.dispose + @tilehelper.dispose ######## end