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

@@ -53,26 +53,26 @@ module GameData
def self.editor_properties
return [
["Outdoor", BooleanProperty, _INTL("If true, this map is an outdoor map and will be tinted according to time of day.")],
["ShowArea", BooleanProperty, _INTL("If true, the game will display the map's name upon entry.")],
["Bicycle", BooleanProperty, _INTL("If true, the bicycle can be used on this map.")],
["BicycleAlways", BooleanProperty, _INTL("If true, the bicycle will be mounted automatically on this map and cannot be dismounted.")],
["HealingSpot", MapCoordsProperty, _INTL("Map ID of this Pokémon Center's town, and X and Y coordinates of its entrance within that town.")],
["Weather", WeatherEffectProperty, _INTL("Weather conditions in effect for this map.")],
["MapPosition", RegionMapCoordsProperty, _INTL("Identifies the point on the regional map for this map.")],
["DiveMap", MapProperty, _INTL("Specifies the underwater layer of this map. Use only if this map has deep water.")],
["DarkMap", BooleanProperty, _INTL("If true, this map is dark and a circle of light appears around the player. Flash can be used to expand the circle.")],
["SafariMap", BooleanProperty, _INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.")],
["SnapEdges", BooleanProperty, _INTL("If true, when the player goes near this map's edge, the game doesn't center the player as usual.")],
["Dungeon", BooleanProperty, _INTL("If true, this map has a randomly generated layout. See the wiki for more information.")],
["BattleBack", StringProperty, _INTL("PNG files named 'XXX_bg', 'XXX_base0', 'XXX_base1', 'XXX_message' in Battlebacks folder, where XXX is this property's value.")],
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles on this map.")],
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for trainer battles on this map.")],
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle on this map.")],
["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.")]
["Outdoor", BooleanProperty, _INTL("If true, this map is an outdoor map and will be tinted according to time of day.")],
["ShowArea", BooleanProperty, _INTL("If true, the game will display the map's name upon entry.")],
["Bicycle", BooleanProperty, _INTL("If true, the bicycle can be used on this map.")],
["BicycleAlways", BooleanProperty, _INTL("If true, the bicycle will be mounted automatically on this map and cannot be dismounted.")],
["HealingSpot", MapCoordsProperty, _INTL("Map ID of this Pokémon Center's town, and X and Y coordinates of its entrance within that town.")],
["Weather", WeatherEffectProperty, _INTL("Weather conditions in effect for this map.")],
["MapPosition", RegionMapCoordsProperty, _INTL("Identifies the point on the regional map for this map.")],
["DiveMap", MapProperty, _INTL("Specifies the underwater layer of this map. Use only if this map has deep water.")],
["DarkMap", BooleanProperty, _INTL("If true, this map is dark and a circle of light appears around the player. Flash can be used to expand the circle.")],
["SafariMap", BooleanProperty, _INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.")],
["SnapEdges", BooleanProperty, _INTL("If true, when the player goes near this map's edge, the game doesn't center the player as usual.")],
["Dungeon", BooleanProperty, _INTL("If true, this map has a randomly generated layout. See the wiki for more information.")],
["BattleBack", StringProperty, _INTL("PNG files named 'XXX_bg', 'XXX_base0', 'XXX_base1', 'XXX_message' in Battlebacks folder, where XXX is this property's value.")],
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles on this map.")],
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for trainer battles on this map.")],
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle on this map.")],
["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", 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,10 +26,9 @@ module PBNatures
QUIRKY = 24
def self.maxValue; 24; end
def self.getCount; 25; end
def self.getName(id)
id = getID(PBNatures,id)
id = getID(PBNatures, id)
names = [
_INTL("Hardy"),
_INTL("Lonely"),
@@ -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

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

View File

@@ -10,8 +10,7 @@ module PBHabitats
Urban = 8
Rare = 9
def self.maxValue; 9; end
def self.getCount; 10; end
def self.maxValue; 9; 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,139 +1,139 @@
#===============================================================================
# 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
@old = []
@new = []
@new = Array.new(size) { |i| i }
end
def get
if @new.length==0
# No new values
@new=@old.clone
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
MINWIDTH = 5
MINHEIGHT = 4
MAXWIDTH = 11
MAXHEIGHT = 10
None = 0
TurnLeft = 1
TurnRight = 2
Turn180 = 3
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
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
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
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
MINWIDTH = 5
MINHEIGHT = 4
MAXWIDTH = 11
MAXHEIGHT = 10
None = 0
TurnLeft = 1
TurnRight = 2
Turn180 = 3
def self.paintCell(dungeon,xDst,yDst,tile,rotation)
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)
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)
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]=TILE_WIDTH-1-width if rect[0]+width>TILE_WIDTH-1
rect[1]=TILE_HEIGHT-1-height if rect[0]+height>TILE_HEIGHT-1
dungeon.paint(rect,xDst,yDst)
return true
end
return false
paintTile(dungeon, xDst, yDst, tile, rotation)
return false if rand(100) < 30
# Generate a randomly placed room
width = rand(MINWIDTH, MAXWIDTH)
height = rand(MINHEIGHT, MAXHEIGHT)
return false if width <= 0 || height <= 0
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]
rect[0] = 1 if rect[0] < 1
rect[1] = 2 if rect[1] < 2
rect[0] = TILE_WIDTH - 1 - width if rect[0] + width > TILE_WIDTH - 1
rect[1] = TILE_HEIGHT - 1 - height if rect[0] + height > TILE_HEIGHT - 1
dungeon.paint(rect, xDst, yDst)
return true
end
def self.generateTiles
tiles=[]
tiles = []
for i in 0...6
tiles[i]=[]
for j in 0...TILE_WIDTH*TILE_HEIGHT
tiles[i][j]=0
tiles[i] = []
for j in 0...TILE_WIDTH * TILE_HEIGHT
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]
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
@@ -142,198 +142,226 @@ end
module EdgeMasks
North=1;West=2;East=4;South=8;Visited=16
North = 1
West = 2
East = 4
South = 8
Visited = 16
end
class MazeNode
def initialize
@edges=0
@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
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
attr_accessor :x, :y
def initialize(x,y)
@x=x;@y=y
def initialize(x, y)
@x = x
@y = y
end
end
class Maze
attr_accessor :cellWidth,:cellHeight,:nodeWidth,:nodeHeight
attr_accessor :cellWidth, :cellHeight, :nodeWidth, :nodeHeight
def initialize(cw,ch)
@nodes=[]
@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
@@dirs = [EdgeMasks::North, EdgeMasks::South, EdgeMasks::East, EdgeMasks::West]
def initialize(cw, ch)
@nodes = []
@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
for i in 0...cw * ch
@cells[i] = 0
end
clearAllEdges()
clearAllCells()
end
def buildNodeList
list=[]
list = []
for x in 0...nodeWidth
for y in 0...nodeHeight
list.push(NodeListElement.new(x,y))
list.push(NodeListElement.new(x, y))
end
end
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
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
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
return if nx<0||ny<0||nx>=nodeWidth||ny>=nodeHeight
@nodes[ny*nodeWidth+nx].setEdge(e)
return if nx < 0 || ny < 0 || nx >= nodeWidth || ny >= nodeHeight
@nodes[ny * nodeWidth + nx].setEdge(e)
end
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
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
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
return if nx<0||ny<0||nx>=nodeWidth||ny>=nodeHeight
@nodes[ny*nodeWidth+nx].clearEdge(e)
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?
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)
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)
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
for c in 0...nodeWidth * nodeHeight
@nodes[c].set
end
end
def clearAllEdges
for c in 0...nodeWidth*nodeHeight
for c in 0...nodeWidth * nodeHeight
@nodes[c].clear
end
end
def clearAllCells
for c in 0...cellWidth*cellHeight
@cells[c]=0
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
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
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
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)
def buildMazeWall(x, y, dir, len)
return if isBlockedNode?(x, y)
wx = x
wy = y
len.times do
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)
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
end
setEdgeNode(ox,oy,dir)
end
end
def generateWallGrowthMaze(minWall=nil,maxWall=nil)
minWall=0 if !minWall
maxWall=cellWidth if !maxWall
nlist=buildNodeList()
return if nlist.length==0
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)
d = randomDir()
len = rand(maxWall + 1)
x = nlist[c].x
y = nlist[c].y
buildMazeWall(x, y, d, len)
end
end
def recurseDepthFirst(x, y, depth)
setVisited(x,y)
setVisited(x, y)
dirs = @@dirs.shuffle!
for c in 0...4
d = dirs[c]
@@ -363,194 +391,194 @@ class Maze
end
def generateDepthFirstMaze
sx=rand(cellWidth)
sy=rand(cellHeight)
sx = rand(cellWidth)
sy = rand(cellHeight)
setAllEdges()
recurseDepthFirst(sx,sy,0)
recurseDepthFirst(sx, sy, 0)
end
end
class Dungeon
attr_accessor :width,:height
XBUFFER = 7
YBUFFER = 5
attr_accessor :width, :height
XBUFFER = 8
YBUFFER = 6
class DungeonTable
def initialize(dungeon)
@dungeon=dungeon
@dungeon = dungeon
end
def xsize; @dungeon.width; end
def xsize; @dungeon.width; end
def ysize; @dungeon.height; end
def [](x,y)
[1,2,3,2][@dungeon[x,y]]
def [](x, y)
[1, 2, 3, 2][@dungeon[x, y]] # Void, room floor, wall, corridor floor
end
end
def initialize(width,height)
@width=width
@height=height
@array=[]
def initialize(width, height)
@width = width
@height = height
@array = []
end
def clear
for i in 0...width*height
@array[i]=0
for i in 0...width * height
@array[i] = 0
end
end
def write
ret=""
i=0
ret = ""
i = 0
for y in 0...@height
for x in 0...@width
ret+=[" ",".","~"][value(x,y)]
i+=1
ret += [" ", ".", "~", ","][value(x, y)] # Void, room floor, wall, corridor floor
i += 1
end
ret+="\r\n"
ret += "\r\n"
end
return ret
end
def [](x,y)
@array[y*@width+x]
def [](x, y)
@array[y * @width + x]
end
def []=(x,y,value)
@array[y*@width+x]=value
def []=(x, y, value)
@array[y * @width + x] = value
end
def value(x,y)
return 0 if x<0||y<0||x>=@width||y>=@height
@array[y*@width+x]
def value(x, y)
return 0 if x < 0 || y < 0 || x >= @width || y >= @height
@array[y * @width + x]
end
def get(x,y)
return false if x<0||y<0||x>=@width||y>=@height
@array[y*@width+x]!=0
def get(x, y)
return false if x < 0 || y < 0 || x >= @width || y >= @height
@array[y * @width + x] != 0
end
def isWall?(x,y)
if value(x,y)==0
v1=value(x,y+1)
return true if (v1==1||v1==3)
if v1==0
v1=value(x,y+2)
return true if (v1==1||v1==3)
def isWall?(x, y)
if value(x, y) == 0 # This tile is void
v1 = value(x, y + 1)
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 # The tile below that is room floor/corridor floor
end
end
return false
end
def isRoom?(x,y)
if value(x,y)==1
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 false if value(x-1,y)==3
return false if value(x+1,y)==3
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
def isRoom?(x, y)
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
return false if value(x - 1, y) == 3
return false if value(x + 1, y) == 3
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 # No surrounding tiles are corridor floor
end
return false
end
def generate
self.clear
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
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 # 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
end
maze=Maze.new(maxWidth/cellWidth,maxHeight/cellHeight)
maze = Maze.new(maxWidth / cellWidth, maxHeight / cellHeight)
maze.generateDepthFirstMaze()
tiles=DungeonMaze.generateTiles()
roomcount=0
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])
roomcount+=1
tiles = DungeonMaze.generateTiles()
roomcount = 0
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])
roomcount += 1
end
end
end
if roomcount==0
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
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
def generateMapInPlace(map)
tbl=DungeonTable.new(self)
tbl = DungeonTable.new(self)
for i in 0...map.width
for j in 0...map.height
nb=TileDrawingHelper.tableNeighbors(tbl,i,j)
tile=TileDrawingHelper::NeighborsToTiles[nb]
map.data[i,j,0]=tile+48*(tbl[i,j])
map.data[i,j,1]=0
map.data[i,j,2]=0
nb = TileDrawingHelper.tableNeighbors(tbl, i, j)
tile = TileDrawingHelper::NeighborsToTiles[nb]
map.data[i, j, 0] = tile + 48 * (tbl[i, j])
map.data[i, j, 1] = 0
map.data[i, j, 2] = 0
end
end
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])
self[x,y]=1 # room tile
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
end
def intersects?(r1,r2)
return !((( r2[0] + r2[2] <= r1[0] ) ||
( r2[0] >= r1[0] + r1[2] ) ||
( r2[1] + r2[3] <= r1[1] ) ||
( r2[1] >= r1[1] + r1[3] ) ) &&
(( r1[0] <= r2[0] + r2[2] )||
( r1[0] >= r2[0] + r2[2] ) ||
( r1[1] + r1[3] <= r2[1] ) ||
( r1[1] >= r2[1] + r2[3] ))
def intersects?(r1, r2)
return !(((r2[0] + r2[2] <= r1[0]) ||
(r2[0] >= r1[0] + r1[2]) ||
(r2[1] + r2[3] <= r1[1]) ||
(r2[1] >= r1[1] + r1[3])) &&
((r1[0] <= r2[0] + r2[2])||
(r1[0] >= r2[0] + r2[2]) ||
(r1[1] + r1[3] <= r2[1]) ||
(r1[1] >= r2[1] + r2[3]))
);
end
end
def pbRandomRoomTile(dungeon,tiles)
ar1=AntiRandom.new(dungeon.width)
ar2=AntiRandom.new(dungeon.height)
((tiles.length+1)*1000).times do
x=ar1.get()
y=ar2.get()
if dungeon.isRoom?(x,y) &&
!tiles.any? { |item| (item[0]-x).abs<2 && (item[1]-y).abs<2 }
ret=[x,y]
# 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)
((tiles.length + 1) * 1000).times do
x = ar1.get()
y = ar2.get()
if dungeon.isRoom?(x, y) &&
!tiles.any? { |item| (item[0] - x).abs < 2 && (item[1] - y).abs < 2 }
ret = [x, y]
tiles.push(ret)
return ret
end
@@ -560,26 +588,26 @@ end
Events.onMapCreate += proc { |_sender, e|
mapID = e[0]
map = e[1]
map = e[1]
next if !GameData::MapMetadata.exists?(mapID) ||
!GameData::MapMetadata.get(mapID).random_dungeon
# this map is a randomly generated dungeon
dungeon=Dungeon.new(map.width,map.height)
dungeon = Dungeon.new(map.width, map.height)
dungeon.generate
dungeon.generateMapInPlace(map)
roomtiles=[]
roomtiles = []
# Reposition events
for event in map.events.values
tile=pbRandomRoomTile(dungeon,roomtiles)
tile = pbRandomRoomTile(dungeon, roomtiles)
if tile
event.x=tile[0]
event.y=tile[1]
event.x = tile[0]
event.y = tile[1]
end
end
# Override transfer X and Y
tile=pbRandomRoomTile(dungeon,roomtiles)
tile = pbRandomRoomTile(dungeon, roomtiles)
if tile
$game_temp.player_new_x=tile[0]
$game_temp.player_new_y=tile[1]
$game_temp.player_new_x = tile[0]
$game_temp.player_new_y = tile[1]
end
}

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,20 +1401,12 @@ 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.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.z = 2
title = Window_UnformattedTextPokemon.newWithSize(_INTL("Animations Organiser"),
Graphics.width / 2, 0, Graphics.width / 2, 64, viewport)
title.z = 2
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
cmd = [0,0]

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,13 +597,9 @@ 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.z=2
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)
else
@@ -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,13 +327,9 @@ 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"].z=2
@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
@mapconns=[]
@@ -362,13 +358,9 @@ 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.z=2
title = Window_UnformattedTextPokemon.newWithSize(helptext,
0, 0, 800 * 8 / 10, 600, @viewport)
title.z = 2
loop do
Graphics.update
Input.update