Misc tidying

This commit is contained in:
Maruno17
2021-01-31 19:13:51 +00:00
parent f68cc1c98b
commit 168a1e5df7
19 changed files with 520 additions and 585 deletions

View File

@@ -72,7 +72,7 @@ module GameData
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle on this map.")],
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a wild Pokémon on this map.")],
["MapSize", MapSizeProperty, _INTL("The width of the map in Town Map squares, and a string indicating which squares are part of this map.")],
["Environment", EnvironmentProperty, _INTL("The default battle environment for battles on this map.")]
["Environment", EnumProperty2.new(PBEnvironment), _INTL("The default battle environment for battles on this map.")]
]
end

View File

@@ -0,0 +1,83 @@
module PBTypeEffectiveness
INEFFECTIVE = 0
NOT_EFFECTIVE_ONE = 1
NORMAL_EFFECTIVE_ONE = 2
SUPER_EFFECTIVE_ONE = 4
NORMAL_EFFECTIVE = NORMAL_EFFECTIVE_ONE ** 3
def self.ineffective?(value)
return value == INEFFECTIVE
end
def self.notVeryEffective?(value)
return value > INEFFECTIVE && value < NORMAL_EFFECTIVE
end
def self.resistant?(value)
return value < NORMAL_EFFECTIVE
end
def self.normalEffective?(value)
return value == NORMAL_EFFECTIVE
end
def self.superEffective?(value)
return value > NORMAL_EFFECTIVE
end
end
module PBTypes
def self.regularTypesCount
ret = 0
GameData::Type.each { |t| ret += 1 if !t.pseudo_type && t.id != :SHADOW }
return ret
end
def self.isPhysicalType?(type); return GameData::Type.get(type).physical?; end
def self.isSpecialType?(type); return GameData::Type.get(type).special?; end
def self.isPseudoType?(type); return GameData::Type.get(type).pseudo_type; end
def self.getEffectiveness(attack_type, target_type)
return GameData::Type.get(target_type).effectiveness(attack_type)
end
def self.getCombinedEffectiveness(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
mod1 = self.getEffectiveness(attack_type, target_type1)
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
mod3 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
if target_type2 && target_type1 != target_type2
mod2 = self.getEffectiveness(attack_type, target_type2)
end
if target_type3 && target_type1 != target_type3 && target_type2 != target_type3
mod3 = self.getEffectiveness(attack_type, target_type3)
end
return mod1 * mod2 * mod3
end
def self.ineffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
value = self.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
return PBTypeEffectiveness.ineffective?(value)
end
def self.notVeryEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
value = self.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
return PBTypeEffectiveness.notVeryEffective?(value)
end
def self.resistant?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
value = self.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
return PBTypeEffectiveness.resistant?(value)
end
def self.normalEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
value = self.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
return PBTypeEffectiveness.normalEffective?(value)
end
def self.superEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
value = self.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
return PBTypeEffectiveness.superEffective?(value)
end
end

View File

@@ -1,83 +0,0 @@
module PBTypeEffectiveness
INEFFECTIVE = 0
NOT_EFFECTIVE_ONE = 1
NORMAL_EFFECTIVE_ONE = 2
SUPER_EFFECTIVE_ONE = 4
NORMAL_EFFECTIVE = NORMAL_EFFECTIVE_ONE ** 3
def self.ineffective?(value)
return value == INEFFECTIVE
end
def self.notVeryEffective?(value)
return value > INEFFECTIVE && value < NORMAL_EFFECTIVE
end
def self.resistant?(value)
return value < NORMAL_EFFECTIVE
end
def self.normalEffective?(value)
return value == NORMAL_EFFECTIVE
end
def self.superEffective?(value)
return value > NORMAL_EFFECTIVE
end
end
class PBTypes
def PBTypes.regularTypesCount
ret = 0
GameData::Type.each { |t| ret += 1 if !t.pseudo_type && t.id != :SHADOW }
return ret
end
def PBTypes.isPhysicalType?(type); return GameData::Type.get(type).physical?; end
def PBTypes.isSpecialType?(type); return GameData::Type.get(type).special?; end
def PBTypes.isPseudoType?(type); return GameData::Type.get(type).pseudo_type; end
def PBTypes.getEffectiveness(attack_type, target_type)
return GameData::Type.get(target_type).effectiveness(attack_type)
end
def PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
mod1 = PBTypes.getEffectiveness(attack_type, target_type1)
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
mod3 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
if target_type2 && target_type1 != target_type2
mod2 = PBTypes.getEffectiveness(attack_type, target_type2)
end
if target_type3 && target_type1 != target_type3 && target_type2 != target_type3
mod3 = PBTypes.getEffectiveness(attack_type, target_type3)
end
return mod1 * mod2 * mod3
end
def PBTypes.ineffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
value = PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
return PBTypeEffectiveness.ineffective?(value)
end
def PBTypes.notVeryEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
value = PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
return PBTypeEffectiveness.notVeryEffective?(value)
end
def PBTypes.resistant?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
value = PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
return PBTypeEffectiveness.resistant?(value)
end
def PBTypes.normalEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
value = PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
return PBTypeEffectiveness.normalEffective?(value)
end
def PBTypes.superEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
value = PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
return PBTypeEffectiveness.superEffective?(value)
end
end

View File

@@ -26,7 +26,6 @@ module PBNatures
QUIRKY = 24
def self.maxValue; 24; end
def self.getCount; 25; end
def self.getName(id)
id = getID(PBNatures, id)
@@ -61,15 +60,17 @@ module PBNatures
end
def self.getStatRaised(id)
m = (id%25)/5 # 25 here is (number of stats)**2, not PBNatures.getCount
return [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
PBStats::SPATK,PBStats::SPDEF][m]
stats = [PBStats::ATTACK, PBStats::DEFENSE, PBStats::SPEED,
PBStats::SPATK, PBStats::SPDEF]
m = (id % (stats.length ** 2)) / stats.length
return stats[m]
end
def self.getStatLowered(id)
m = id%5 # Don't need to %25 here because 25 is a multiple of 5
return [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
PBStats::SPATK,PBStats::SPDEF][m]
stats = [PBStats::ATTACK, PBStats::DEFENSE, PBStats::SPEED,
PBStats::SPATK, PBStats::SPDEF]
m = id % stats.length
return stats[m]
end
def self.getStatChanges(id)

View File

@@ -8,6 +8,8 @@ module PBGenderRates
FemaleSevenEighths = 6
AlwaysFemale = 7
def self.maxValue; return 7; end
def self.genderByte(gender)
case gender
when AlwaysMale then return 0

View File

@@ -16,27 +16,4 @@ module PBEggGroups
Dragon = 14
def self.maxValue; 14; end
def self.getCount; 15; end
def self.getName(id)
id = getID(PBEggGroups,id)
names = [
_INTL("Undiscovered"),
_INTL("Monster"),
_INTL("Water 1"),
_INTL("Bug"),
_INTL("Flying"),
_INTL("Field"),
_INTL("Fairy"),
_INTL("Grass"),
_INTL("Human-like"),
_INTL("Water 3"),
_INTL("Mineral"),
_INTL("Amorphous"),
_INTL("Water 2"),
_INTL("Ditto"),
_INTL("Dragon")
]
return names[id]
end
end

View File

@@ -12,7 +12,6 @@ module PBColors
Pink = 9
def self.maxValue; 9; end
def self.getCount; 10; end
def self.getName(id)
id = getID(PBColors,id)

View File

@@ -11,7 +11,6 @@ module PBHabitats
Rare = 9
def self.maxValue; 9; end
def self.getCount; 10; end
def self.getName(id)
id = getID(PBHabitats,id)

View File

@@ -81,7 +81,6 @@ module PBRibbons
WORLDCHAMPION = 80
def self.maxValue; 80; end
def self.getCount; 80; end
def self.getName(id)
id = getID(PBRibbons,id)

View File

@@ -1,72 +1,39 @@
#===============================================================================
# This class is designed to favor different values more than a uniform
# random generator does
#===============================================================================
class AntiRandom
def initialize(size)
@old = []
@new = []
for i in 0...size
@new[i]=i
end
@new = Array.new(size) { |i| i }
end
def get
if @new.length==0
# No new values
if @new.length == 0 # No new values
@new = @old.clone
@old.clear
end
if @old.length>0 && rand(7)==0
# Get old value
value=rand(@old.length)
return @old[value]
if @old.length > 0 && rand(7) == 0 # Get old value
return @old[rand(@old.length)]
end
if @new.length>0
# Get new value
value=rand(@new.length)
ret=@new.delete_at(value)
if @new.length > 0 # Get new value
ret = @new.delete_at(rand(@new.length))
@old.push(ret)
return ret
end
# Get old value
value=rand(@old.length)
return @old[value]
return @old[rand(@old.length)] # Get old value
end
end
class DungeonMaze
#===============================================================================
#
#===============================================================================
module DungeonMaze
TILE_WIDTH = 13
TILE_HEIGHT = 13
def self.paintRect(tile,x,y,w,h) # paints a room
for j in 0...h
for i in 0...w
tile[(j+y)*TILE_WIDTH+(i+x)]=3
end
end
end
def self.paintTile(dungeon,dstX,dstY,tile,rotation) # paints a tile
if rotation==None
for y in 0...TILE_HEIGHT;for x in 0...TILE_WIDTH
dungeon[x+dstX,y+dstY]=tile[y*TILE_WIDTH+x]
end;end
elsif rotation==TurnLeft
for y in 0...TILE_HEIGHT;for x in 0...TILE_WIDTH
dungeon[y+dstX,TILE_WIDTH-1-x+dstY]=tile[y*TILE_WIDTH+x]
end;end
elsif rotation==TurnRight
for y in 0...TILE_HEIGHT;for x in 0...TILE_WIDTH
dungeon[TILE_HEIGHT-1-y+dstX,x+dstY]=tile[y*TILE_WIDTH+x]
end;end
elsif rotation==Turn180
for y in 0...TILE_HEIGHT;for x in 0...TILE_WIDTH
dungeon[TILE_WIDTH-1-x+dstX,TILE_HEIGHT-1-y+dstY]=tile[y*TILE_WIDTH+x]
end;end
end
end
MINWIDTH = 5
MINHEIGHT = 4
MAXWIDTH = 11
@@ -76,18 +43,53 @@ class DungeonMaze
TurnRight = 2
Turn180 = 3
def self.paintRect(tile, x, y, width, height) # paints a room
for j in 0...height
for i in 0...width
tile[(y + j) * TILE_WIDTH + (x + i)] = 3
end
end
end
def self.paintTile(dungeon, dstX, dstY, tile, rotation) # paints a tile
case rotation
when None
for y in 0...TILE_HEIGHT
for x in 0...TILE_WIDTH
dungeon[x + dstX, y + dstY] = tile[y * TILE_WIDTH + x]
end
end
when TurnLeft
for y in 0...TILE_HEIGHT
for x in 0...TILE_WIDTH
dungeon[y + dstX , TILE_WIDTH - 1 - x + dstY] = tile[y * TILE_WIDTH + x]
end
end
when TurnRight
for y in 0...TILE_HEIGHT
for x in 0...TILE_WIDTH
dungeon[TILE_HEIGHT - 1 - y + dstX, x + dstY] = tile[y * TILE_WIDTH + x]
end
end
when Turn180
for y in 0...TILE_HEIGHT
for x in 0...TILE_WIDTH
dungeon[TILE_WIDTH - 1 - x + dstX, TILE_HEIGHT - 1 - y + dstY] = tile[y * TILE_WIDTH + x]
end
end
end
end
def self.paintCell(dungeon, xDst, yDst, tile, rotation)
return false if !tile
paintTile(dungeon, xDst, yDst, tile, rotation)
if rand(10)<7
return false if rand(100) < 30
# Generate a randomly placed room
width=MINWIDTH+rand(MAXWIDTH-MINWIDTH+1)
height=MINHEIGHT+rand(MAXHEIGHT-MINHEIGHT+1)
width = rand(MINWIDTH, MAXWIDTH)
height = rand(MINHEIGHT, MAXHEIGHT)
return false if width <= 0 || height <= 0
centerX=TILE_WIDTH/2
centerY=TILE_HEIGHT/2
centerX=(rand(2)==0) ? centerX-rand(3) : centerX+rand(3)
centerY=(rand(2)==0) ? centerY-rand(3) : centerY+rand(3)
centerX = TILE_WIDTH / 2 + rand(5) - 2
centerY = TILE_HEIGHT / 2 + rand(5) - 2
x = centerX - (width / 2)
y = centerY - (height / 2)
rect = [x, y, width, height]
@@ -98,8 +100,6 @@ class DungeonMaze
dungeon.paint(rect, xDst, yDst)
return true
end
return false
end
def self.generateTiles
tiles = []
@@ -142,7 +142,11 @@ end
module EdgeMasks
North=1;West=2;East=4;South=8;Visited=16
North = 1
West = 2
East = 4
South = 8
Visited = 16
end
@@ -166,7 +170,8 @@ class NodeListElement
attr_accessor :x, :y
def initialize(x, y)
@x=x;@y=y
@x = x
@y = y
end
end
@@ -175,6 +180,8 @@ end
class Maze
attr_accessor :cellWidth, :cellHeight, :nodeWidth, :nodeHeight
@@dirs = [EdgeMasks::North, EdgeMasks::South, EdgeMasks::East, EdgeMasks::West]
def initialize(cw, ch)
@nodes = []
@cells = []
@@ -207,15 +214,26 @@ class Maze
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
e = 0
nx = 0
ny = 0
case edge
when EdgeMasks::North
e = EdgeMasks::South
nx = x
ny = y - 1
when EdgeMasks::South
e = EdgeMasks::North
nx = x
ny = y + 1
when EdgeMasks::East
e = EdgeMasks::West
nx = x + 1
ny = y
when EdgeMasks::West
e = EdgeMasks::East
nx = x - 1
ny = y
else
return
end
@@ -226,15 +244,26 @@ class Maze
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
e = 0
nx = 0
ny = 0
case edge
when EdgeMasks::North
e = EdgeMasks::South
nx = x
ny = y - 1
when EdgeMasks::South
e = EdgeMasks::North
nx = x
ny = y + 1
when EdgeMasks::East
e = EdgeMasks::West
nx = x + 1
ny = y
when EdgeMasks::West
e = EdgeMasks::East
nx = x - 1
ny = y
else
raise ArgumentError.new
end
@@ -294,27 +323,26 @@ class Maze
@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)
wx = x
wy = y
len.times do
ox=wx;oy=wy
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)
return
end
setEdgeNode(ox,oy,dir)
end
end
@@ -325,7 +353,7 @@ class Maze
return if nlist.length == 0
for c in 0...nlist.length
d = randomDir()
len=rand(minWall+(maxWall-minWall)+1)
len = rand(maxWall + 1)
x = nlist[c].x
y = nlist[c].y
buildMazeWall(x, y, d, len)
@@ -374,8 +402,8 @@ end
class Dungeon
attr_accessor :width, :height
XBUFFER = 7
YBUFFER = 5
XBUFFER = 8
YBUFFER = 6
class DungeonTable
def initialize(dungeon)
@@ -386,7 +414,7 @@ class Dungeon
def ysize; @dungeon.height; end
def [](x, y)
[1,2,3,2][@dungeon[x,y]]
[1, 2, 3, 2][@dungeon[x, y]] # Void, room floor, wall, corridor floor
end
end
@@ -407,7 +435,7 @@ class Dungeon
i = 0
for y in 0...@height
for x in 0...@width
ret+=[" ",".","~"][value(x,y)]
ret += [" ", ".", "~", ","][value(x, y)] # Void, room floor, wall, corridor floor
i += 1
end
ret += "\r\n"
@@ -434,19 +462,19 @@ class Dungeon
end
def isWall?(x, y)
if value(x,y)==0
if value(x, y) == 0 # This tile is void
v1 = value(x, y + 1)
return true if (v1==1||v1==3)
if v1==0
return true if v1 == 1 || v1 == 3 # The tile below is room floor/corridor floor
if v1 == 0 # The tile below is void
v1 = value(x, y + 2)
return true if (v1==1||v1==3)
return true if v1 == 1 || v1 == 3 # The tile below that is room floor/corridor floor
end
end
return false
end
def isRoom?(x, y)
if value(x,y)==1
if value(x, y) == 1 # This tile is a room floor
return false if value(x - 1, y - 1) == 3
return false if value( x, y - 1) == 3
return false if value(x + 1, y - 1) == 3
@@ -455,22 +483,22 @@ class Dungeon
return false if value(x - 1, y + 1) == 3
return false if value( x, y + 1) == 3
return false if value(x + 1, y + 1) == 3
return true
return true # No surrounding tiles are corridor floor
end
return false
end
def generate
self.clear
maxWidth=@width-(XBUFFER*2)
maxHeight=@height-(YBUFFER*2)
maxWidth = @width - XBUFFER * 2
maxHeight = @height - YBUFFER * 2
cellWidth = DungeonMaze::TILE_WIDTH
cellHeight = DungeonMaze::TILE_HEIGHT
return if maxWidth < 0 || maxHeight < 0
if maxWidth<cellWidth || maxHeight<cellHeight
if maxWidth < cellWidth || maxHeight < cellHeight # Map is too small
for x in 0...maxWidth
for y in 0...maxHeight
self[x+XBUFFER,y+YBUFFER]=1
self[x + XBUFFER, y + YBUFFER] = 1 # Make all tiles room floor
end
end
return
@@ -482,8 +510,8 @@ class Dungeon
for y in 0...maxHeight / cellHeight
for x in 0...maxWidth / cellWidth
tile = maze.getEdgePattern(x, y)
if DungeonMaze.paintCell(self,XBUFFER+x*cellWidth,
YBUFFER+y*cellHeight,tiles[tile][0],tiles[tile][1])
if DungeonMaze.paintCell(self, XBUFFER + x * cellWidth, YBUFFER + y * cellHeight,
tiles[tile][0], tiles[tile][1])
roomcount += 1
end
end
@@ -492,16 +520,14 @@ class Dungeon
# Handle situation where no rooms were generated
for x in 0...maxWidth
for y in 0...maxHeight
self[x+XBUFFER,y+YBUFFER]=1
self[x + XBUFFER, y + YBUFFER] = 1 # Make all tiles room floor
end
end
end
# Generate walls
for y in 0...@height
for x in 0...@width
if isWall?(x,y)
self[x,y]=2
end
self[x, y] = 2 if isWall?(x, y) # Make appropriate tiles wall tiles
end
end
end
@@ -520,8 +546,8 @@ class Dungeon
end
def paint(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])
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] = 1 # room tile
end
end
@@ -542,6 +568,8 @@ end
# Get a random room tile that isn't too close to a corridor (to avoid blocking
# a room's entrance)
def pbRandomRoomTile(dungeon, tiles)
ar1 = AntiRandom.new(dungeon.width)
ar2 = AntiRandom.new(dungeon.height)

View File

@@ -196,15 +196,11 @@ class PokemonBag_Scene
@sprites["itemlist"].baseColor = ITEMLISTBASECOLOR
@sprites["itemlist"].shadowColor = ITEMLISTSHADOWCOLOR
@sprites["itemicon"] = ItemIconSprite.new(48,Graphics.height-48,nil,@viewport)
@sprites["itemtext"] = Window_UnformattedTextPokemon.new("")
@sprites["itemtext"].x = 72
@sprites["itemtext"].y = 270
@sprites["itemtext"].width = Graphics.width-72-24
@sprites["itemtext"].height = 128
@sprites["itemtext"] = Window_UnformattedTextPokemon.newWithSize("",
72, 270, Graphics.width - 72 - 24, 128, @viewport)
@sprites["itemtext"].baseColor = ITEMTEXTBASECOLOR
@sprites["itemtext"].shadowColor = ITEMTEXTSHADOWCOLOR
@sprites["itemtext"].visible = true
@sprites["itemtext"].viewport = @viewport
@sprites["itemtext"].windowskin = nil
@sprites["helpwindow"] = Window_UnformattedTextPokemon.new("")
@sprites["helpwindow"].visible = false

View File

@@ -207,16 +207,11 @@ class PokemonMart_Scene
@sprites["itemwindow"].viewport = @viewport
@sprites["itemwindow"].index = 0
@sprites["itemwindow"].refresh
@sprites["itemtextwindow"] = Window_UnformattedTextPokemon.new("")
@sprites["itemtextwindow"] = Window_UnformattedTextPokemon.newWithSize("",
64, Graphics.height - 96 - 16, Graphics.width - 64, 128, @viewport)
pbPrepareWindow(@sprites["itemtextwindow"])
@sprites["itemtextwindow"].x = 64
@sprites["itemtextwindow"].y = Graphics.height - 96 - 16
@sprites["itemtextwindow"].width = Graphics.width - 64
@sprites["itemtextwindow"].height = 128
@sprites["itemtextwindow"].baseColor = Color.new(248, 248, 248)
@sprites["itemtextwindow"].shadowColor = Color.new(0, 0, 0)
@sprites["itemtextwindow"].visible = true
@sprites["itemtextwindow"].viewport = @viewport
@sprites["itemtextwindow"].windowskin = nil
@sprites["helpwindow"] = Window_AdvancedTextPokemon.new("")
pbPrepareWindow(@sprites["helpwindow"])

View File

@@ -637,7 +637,7 @@ PokemonDebugMenuCommands.register("setnature", {
"always_show" => true,
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
commands = []
(PBNatures.getCount).times do |i|
(PBNatures.maxValue + 1).times do |i|
statUp = PBNatures.getStatRaised(i)
statDown = PBNatures.getStatLowered(i)
if statUp != statDown
@@ -654,10 +654,10 @@ PokemonDebugMenuCommands.register("setnature", {
mag = _INTL("Nature is {1}.", PBNatures.getName(pkmn.nature))
cmd = screen.pbShowCommands(mag, commands, cmd)
break if cmd < 0
if cmd >= 0 && cmd < PBNatures.getCount # Set nature
if cmd >= 0 && cmd <= PBNatures.maxValue # Set nature
pkmn.nature = cmd
pkmn.calcStats
elsif cmd == PBNatures.getCount # Reset
elsif cmd == PBNatures.maxValue + 1 # Reset
pkmn.nature = nil
end
screen.pbRefreshSingle(pkmnid)

View File

@@ -284,12 +284,8 @@ def pbDefinePath(canvas)
showline=false
sliderwin2.visible=false
# This window displays the mouse's current position
window=Window_UnformattedTextPokemon.new("")
window.x=0
window.y=320-64
window.width=128
window.height=64
window.viewport=canvas.viewport
window=Window_UnformattedTextPokemon.newWithSize("",
0, 320 - 64, 128, 64, canvas.viewport)
loop do
Graphics.update
Input.update

View File

@@ -667,7 +667,7 @@ module TrainerPokemonProperty
pkmn_properties.concat([
[_INTL("Ability"), LimitProperty2.new(99), _INTL("Ability flag. 0=first ability, 1=second ability, 2-5=hidden ability.")],
[_INTL("Held item"), ItemProperty, _INTL("Item held by the Pokémon.")],
[_INTL("Nature"), NatureProperty, _INTL("Nature of the Pokémon.")],
[_INTL("Nature"), EnumProperty2.new(PBNatures), _INTL("Nature of the Pokémon.")],
[_INTL("IVs"), IVsProperty.new(Pokemon::IV_STAT_LIMIT), _INTL("Individual values for each of the Pokémon's stats.")],
[_INTL("EVs"), EVsProperty.new(Pokemon::EV_STAT_LIMIT), _INTL("Effort values for each of the Pokémon's stats.")],
[_INTL("Happiness"), LimitProperty2.new(255), _INTL("Happiness of the Pokémon (0-255).")],
@@ -958,13 +958,8 @@ def pbPokemonEditor
[_INTL("BaseStats"), BaseStatsProperty, _INTL("Base stats of the Pokémon.")],
[_INTL("EffortPoints"), EffortValuesProperty, _INTL("Effort Value points earned when this species is defeated.")],
[_INTL("BaseEXP"), LimitProperty.new(9999), _INTL("Base experience earned when this species is defeated.")],
[_INTL("GrowthRate"), EnumProperty.new([
_INTL("Medium"), _INTL("Erratic"), _INTL("Fluctuating"),
_INTL("Parabolic"), _INTL("Fast"), _INTL("Slow")]), _INTL("Pokémon's growth rate.")],
[_INTL("GenderRate"), EnumProperty.new([
_INTL("Genderless"), _INTL("AlwaysMale"), _INTL("FemaleOneEighth"),
_INTL("Female25Percent"), _INTL("Female50Percent"), _INTL("Female75Percent"),
_INTL("FemaleSevenEighths"), _INTL("AlwaysFemale")]), _INTL("Proportion of males to females for this species.")],
[_INTL("GrowthRate"), EnumProperty2.new(PBGrowthRates), _INTL("Pokémon's growth rate.")],
[_INTL("GenderRate"), EnumProperty2.new(PBGenderRates), _INTL("Proportion of males to females for this species.")],
[_INTL("Rareness"), LimitProperty.new(255), _INTL("Catch rate of this species (0-255).")],
[_INTL("Happiness"), LimitProperty.new(255), _INTL("Base happiness of this species (0-255).")],
[_INTL("Moves"), MovePoolProperty, _INTL("Moves which the Pokémon learns while levelling up.")],
@@ -979,28 +974,16 @@ def pbPokemonEditor
[_INTL("WildItemCommon"), ItemProperty, _INTL("Item commonly held by wild Pokémon of this species.")],
[_INTL("WildItemUncommon"), ItemProperty, _INTL("Item uncommonly held by wild Pokémon of this species.")],
[_INTL("WildItemRare"), ItemProperty, _INTL("Item rarely held by wild Pokémon of this species.")],
[_INTL("Compat1"), EnumProperty.new([
"Undiscovered", "Monster", "Water 1", "Bug", "Flying",
"Field", "Fairy", "Grass", "Human-like", "Water 3",
"Mineral", "Amorphous", "Water 2", "Ditto", "Dragon"]), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("Compat2"), EnumProperty.new([
"Undiscovered", "Monster", "Water 1", "Bug", "Flying",
"Field", "Fairy", "Grass", "Human-like", "Water 3",
"Mineral", "Amorphous", "Water 2", "Ditto", "Dragon"]), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("Compat1"), EnumProperty2.new(PBEggGroups), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("Compat2"), EnumProperty2.new(PBEggGroups), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("StepsToHatch"), LimitProperty.new(99999), _INTL("Number of steps until an egg of this species hatches.")],
[_INTL("Incense"), ItemProperty, _INTL("Item needed to be held by a parent to produce an egg of this species.")],
[_INTL("Evolutions"), EvolutionsProperty.new, _INTL("Evolution paths of this species.")],
[_INTL("Height"), NonzeroLimitProperty.new(999), _INTL("Height of the Pokémon in 0.1 metres (e.g. 42 = 4.2m).")],
[_INTL("Weight"), NonzeroLimitProperty.new(9999), _INTL("Weight of the Pokémon in 0.1 kilograms (e.g. 42 = 4.2kg).")],
[_INTL("Color"), EnumProperty.new([
_INTL("Red"), _INTL("Blue"), _INTL("Yellow"), _INTL("Green"),
_INTL("Black"), _INTL("Brown"), _INTL("Purple"), _INTL("Gray"),
_INTL("White"), _INTL("Pink")]), _INTL("Pokémon's body color.")],
[_INTL("Color"), EnumProperty2.new(PBColors), _INTL("Pokémon's body color.")],
[_INTL("Shape"), LimitProperty.new(14), _INTL("Body shape of this species (0-14).")],
[_INTL("Habitat"), EnumProperty.new([
_INTL("None"), _INTL("Grassland"), _INTL("Forest"), _INTL("WatersEdge"),
_INTL("Sea"), _INTL("Cave"), _INTL("Mountain"), _INTL("RoughTerrain"),
_INTL("Urban"), _INTL("Rare")]), _INTL("The habitat of this species.")],
[_INTL("Habitat"), EnumProperty2.new(PBHabitats), _INTL("The habitat of this species.")],
[_INTL("Generation"), LimitProperty.new(99999), _INTL("The number of the generation the Pokémon debuted in.")],
[_INTL("BattlerPlayerX"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
[_INTL("BattlerPlayerY"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
@@ -1418,19 +1401,11 @@ def pbAnimationsOrganiser
cmdwin = pbListWindow([])
cmdwin.viewport = viewport
cmdwin.z = 2
title = Window_UnformattedTextPokemon.new(_INTL("Animations Organiser"))
title.x = Graphics.width/2
title.y = 0
title.width = Graphics.width/2
title.height = 64
title.viewport = viewport
title = Window_UnformattedTextPokemon.newWithSize(_INTL("Animations Organiser"),
Graphics.width / 2, 0, Graphics.width / 2, 64, viewport)
title.z = 2
info = Window_AdvancedTextPokemon.new(_INTL("Z+Up/Down: Swap\nZ+Left: Delete\nZ+Right: Insert"))
info.x = Graphics.width/2
info.y = 64
info.width = Graphics.width/2
info.height = Graphics.height-64
info.viewport = viewport
info = Window_AdvancedTextPokemon.newWithSize(_INTL("Z+Up/Down: Swap\nZ+Left: Delete\nZ+Right: Insert"),
Graphics.width / 2, 64, Graphics.width / 2, Graphics.height - 64, viewport)
info.z = 2
commands = []
refreshlist = true; oldsel = -1

View File

@@ -209,6 +209,32 @@ end
class EnumProperty2
def initialize(value)
@module = value
end
def set(settingname,oldsetting)
commands = []
for i in 0..@module.maxValue
commands.push(getConstantName(@module, i))
end
cmd = pbMessage(_INTL("Choose a value for {1}.", settingname), commands, -1, nil, oldsetting)
return oldsetting if cmd < 0
return cmd
end
def defaultValue
return nil
end
def format(value)
return (value) ? getConstantName(@module, value) : "-"
end
end
module BGMProperty
def self.set(settingname,oldsetting)
chosenmap = pbListScreen(settingname,MusicFileLister.new(true,oldsetting))
@@ -393,27 +419,6 @@ end
module NatureProperty
def self.set(_settingname,_oldsetting)
commands = []
(PBNatures.getCount).times do |i|
commands.push(PBNatures.getName(i))
end
ret = pbShowCommands(nil,commands,-1)
return (ret>=0) ? ret : nil
end
def self.defaultValue
return nil
end
def self.format(value)
return (value) ? getConstantName(PBNatures,value) : "-"
end
end
class IVsProperty
def initialize(limit)
@limit = limit
@@ -592,12 +597,8 @@ end
def chooseMapPoint(map,rgnmap=false)
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
title=Window_UnformattedTextPokemon.new(_INTL("Click a point on the map."))
title.x=0
title.y=Graphics.height-64
title.width=Graphics.width
title.height=64
title.viewport=viewport
title = Window_UnformattedTextPokemon.newWithSize(_INTL("Click a point on the map."),
0, Graphics.height - 64, Graphics.width, 64, viewport)
title.z = 2
if rgnmap
sprite=RegionMapSprite.new(map,viewport)
@@ -737,23 +738,6 @@ end
module EnvironmentProperty
def self.set(_settingname,_oldsetting)
options = []
for i in 0..PBEnvironment.maxValue
options.push(getConstantName(PBEnvironment,i) || "ERROR")
end
cmd = pbMessage(_INTL("Choose an environment."),options,1)
return cmd
end
def self.format(value)
return (value) ? (getConstantName(PBEnvironment,value) || "ERROR") : "-"
end
end
module MapProperty
def self.set(settingname,oldsetting)
chosenmap = pbListScreen(settingname,MapLister.new(oldsetting ? oldsetting : 0))
@@ -789,14 +773,10 @@ end
module PocketProperty
def self.pocketnames
return [_INTL("Items"), _INTL("Medicine"), _INTL("Poké Balls"),
_INTL("TMs & HMs"), _INTL("Berries"), _INTL("Mail"),
_INTL("Battle Items"), _INTL("Key Items")]
end
def self.set(_settingname, oldsetting)
cmd = pbMessage(_INTL("Choose a pocket for this item."), pocketnames(), -1)
commands = pbPocketNames.clone
commands.shift
cmd = pbMessage(_INTL("Choose a pocket for this item."), commands, -1)
return (cmd >= 0) ? cmd + 1 : oldsetting
end
@@ -806,7 +786,7 @@ module PocketProperty
def self.format(value)
return _INTL("No Pocket") if value == 0
return (value) ? pocketnames[value - 1] : value.inspect
return (value) ? pbPocketNames[value] : value.inspect
end
end

View File

@@ -64,7 +64,7 @@ def pbListScreenBlock(title,lister)
list.viewport = viewport
list.z = 2
title = Window_UnformattedTextPokemon.newWithSize(title,
Graphics.width / 2, 0, Graphics.width - title.x, 64, viewport)
Graphics.width / 2, 0, Graphics.width / 2, 64, viewport)
title.z = 2
lister.setViewport(viewport)
selectedmap = -1

View File

@@ -81,12 +81,8 @@ class PokemonTilesetScene
@tileset = @tilesetwrapper.data[1]
@tilehelper = TileDrawingHelper.fromTileset(@tileset)
@sprites = {}
@sprites["title"] = Window_UnformattedTextPokemon.new(_INTL("Tileset Editor\r\nPgUp/PgDn: SCROLL\r\nZ: MENU"))
@sprites["title"].viewport = @viewport
@sprites["title"].x = TILESET_WIDTH
@sprites["title"].y = 0
@sprites["title"].width = Graphics.width - TILESET_WIDTH
@sprites["title"].height = 128
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(_INTL("Tileset Editor\r\nPgUp/PgDn: SCROLL\r\nZ: MENU"),
TILESET_WIDTH, 0, Graphics.width - TILESET_WIDTH, 128, @viewport)
@sprites["tileset"] = IconSprite.new(0,0,@viewport)
@sprites["tileset"].setBitmap("Graphics/Tilesets/#{@tileset.tileset_name}")
@sprites["tileset"].src_rect = Rect.new(0,0,TILESET_WIDTH,Graphics.height)

View File

@@ -327,12 +327,8 @@ class MapScreenScene
@selmapid=-1
addBackgroundPlane(@sprites,"background","Trainer Card/bg",@viewport)
@sprites["selsprite"]=SelectionSprite.new(@viewport)
@sprites["title"]=Window_UnformattedTextPokemon.new(_INTL("F: Help"))
@sprites["title"].x=0
@sprites["title"].y=600-64
@sprites["title"].width=800
@sprites["title"].height=64
@sprites["title"].viewport=@viewport
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(_INTL("F: Help"),
0, 600 - 64, 800, 64, @viewport)
@sprites["title"].z = 2
@mapinfos=load_data("Data/MapInfos.rxdata")
conns=MapFactoryHelper.getMapConnections
@@ -362,12 +358,8 @@ class MapScreenScene
helptext+=_INTL("Double-click: Edit map's metadata\r\n")
helptext+=_INTL("Drag map to move it\r\n")
helptext+=_INTL("Arrow keys/drag canvas: Move around canvas")
title=Window_UnformattedTextPokemon.new(helptext)
title.x=0
title.y=0
title.width=800*8/10
title.height=600
title.viewport=@viewport
title = Window_UnformattedTextPokemon.newWithSize(helptext,
0, 0, 800 * 8 / 10, 600, @viewport)
title.z = 2
loop do
Graphics.update