mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Misc tidying
This commit is contained in:
@@ -72,7 +72,7 @@ module GameData
|
|||||||
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer 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.")],
|
["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.")],
|
["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
|
end
|
||||||
|
|
||||||
|
|||||||
83
Data/Scripts/011_Data/004_PBTypes.rb
Normal file
83
Data/Scripts/011_Data/004_PBTypes.rb
Normal 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
|
||||||
@@ -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
|
|
||||||
@@ -26,7 +26,6 @@ module PBNatures
|
|||||||
QUIRKY = 24
|
QUIRKY = 24
|
||||||
|
|
||||||
def self.maxValue; 24; end
|
def self.maxValue; 24; end
|
||||||
def self.getCount; 25; end
|
|
||||||
|
|
||||||
def self.getName(id)
|
def self.getName(id)
|
||||||
id = getID(PBNatures, id)
|
id = getID(PBNatures, id)
|
||||||
@@ -61,15 +60,17 @@ module PBNatures
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.getStatRaised(id)
|
def self.getStatRaised(id)
|
||||||
m = (id%25)/5 # 25 here is (number of stats)**2, not PBNatures.getCount
|
stats = [PBStats::ATTACK, PBStats::DEFENSE, PBStats::SPEED,
|
||||||
return [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
|
PBStats::SPATK, PBStats::SPDEF]
|
||||||
PBStats::SPATK,PBStats::SPDEF][m]
|
m = (id % (stats.length ** 2)) / stats.length
|
||||||
|
return stats[m]
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.getStatLowered(id)
|
def self.getStatLowered(id)
|
||||||
m = id%5 # Don't need to %25 here because 25 is a multiple of 5
|
stats = [PBStats::ATTACK, PBStats::DEFENSE, PBStats::SPEED,
|
||||||
return [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
|
PBStats::SPATK, PBStats::SPDEF]
|
||||||
PBStats::SPATK,PBStats::SPDEF][m]
|
m = id % stats.length
|
||||||
|
return stats[m]
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.getStatChanges(id)
|
def self.getStatChanges(id)
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ module PBGenderRates
|
|||||||
FemaleSevenEighths = 6
|
FemaleSevenEighths = 6
|
||||||
AlwaysFemale = 7
|
AlwaysFemale = 7
|
||||||
|
|
||||||
|
def self.maxValue; return 7; end
|
||||||
|
|
||||||
def self.genderByte(gender)
|
def self.genderByte(gender)
|
||||||
case gender
|
case gender
|
||||||
when AlwaysMale then return 0
|
when AlwaysMale then return 0
|
||||||
|
|||||||
@@ -16,27 +16,4 @@ module PBEggGroups
|
|||||||
Dragon = 14
|
Dragon = 14
|
||||||
|
|
||||||
def self.maxValue; 14; end
|
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
|
end
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ module PBColors
|
|||||||
Pink = 9
|
Pink = 9
|
||||||
|
|
||||||
def self.maxValue; 9; end
|
def self.maxValue; 9; end
|
||||||
def self.getCount; 10; end
|
|
||||||
|
|
||||||
def self.getName(id)
|
def self.getName(id)
|
||||||
id = getID(PBColors,id)
|
id = getID(PBColors,id)
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ module PBHabitats
|
|||||||
Rare = 9
|
Rare = 9
|
||||||
|
|
||||||
def self.maxValue; 9; end
|
def self.maxValue; 9; end
|
||||||
def self.getCount; 10; end
|
|
||||||
|
|
||||||
def self.getName(id)
|
def self.getName(id)
|
||||||
id = getID(PBHabitats,id)
|
id = getID(PBHabitats,id)
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ module PBRibbons
|
|||||||
WORLDCHAMPION = 80
|
WORLDCHAMPION = 80
|
||||||
|
|
||||||
def self.maxValue; 80; end
|
def self.maxValue; 80; end
|
||||||
def self.getCount; 80; end
|
|
||||||
|
|
||||||
def self.getName(id)
|
def self.getName(id)
|
||||||
id = getID(PBRibbons,id)
|
id = getID(PBRibbons,id)
|
||||||
|
|||||||
@@ -1,72 +1,39 @@
|
|||||||
|
#===============================================================================
|
||||||
# This class is designed to favor different values more than a uniform
|
# This class is designed to favor different values more than a uniform
|
||||||
# random generator does
|
# random generator does
|
||||||
|
#===============================================================================
|
||||||
class AntiRandom
|
class AntiRandom
|
||||||
def initialize(size)
|
def initialize(size)
|
||||||
@old = []
|
@old = []
|
||||||
@new = []
|
@new = []
|
||||||
for i in 0...size
|
@new = Array.new(size) { |i| i }
|
||||||
@new[i]=i
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get
|
def get
|
||||||
if @new.length==0
|
if @new.length == 0 # No new values
|
||||||
# No new values
|
|
||||||
@new = @old.clone
|
@new = @old.clone
|
||||||
@old.clear
|
@old.clear
|
||||||
end
|
end
|
||||||
if @old.length>0 && rand(7)==0
|
if @old.length > 0 && rand(7) == 0 # Get old value
|
||||||
# Get old value
|
return @old[rand(@old.length)]
|
||||||
value=rand(@old.length)
|
|
||||||
return @old[value]
|
|
||||||
end
|
end
|
||||||
if @new.length>0
|
if @new.length > 0 # Get new value
|
||||||
# Get new value
|
ret = @new.delete_at(rand(@new.length))
|
||||||
value=rand(@new.length)
|
|
||||||
ret=@new.delete_at(value)
|
|
||||||
@old.push(ret)
|
@old.push(ret)
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
# Get old value
|
return @old[rand(@old.length)] # Get old value
|
||||||
value=rand(@old.length)
|
|
||||||
return @old[value]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DungeonMaze
|
#===============================================================================
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
module DungeonMaze
|
||||||
TILE_WIDTH = 13
|
TILE_WIDTH = 13
|
||||||
TILE_HEIGHT = 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
|
MINWIDTH = 5
|
||||||
MINHEIGHT = 4
|
MINHEIGHT = 4
|
||||||
MAXWIDTH = 11
|
MAXWIDTH = 11
|
||||||
@@ -76,18 +43,53 @@ class DungeonMaze
|
|||||||
TurnRight = 2
|
TurnRight = 2
|
||||||
Turn180 = 3
|
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)
|
def self.paintCell(dungeon, xDst, yDst, tile, rotation)
|
||||||
return false if !tile
|
return false if !tile
|
||||||
paintTile(dungeon, xDst, yDst, tile, rotation)
|
paintTile(dungeon, xDst, yDst, tile, rotation)
|
||||||
if rand(10)<7
|
return false if rand(100) < 30
|
||||||
# Generate a randomly placed room
|
# Generate a randomly placed room
|
||||||
width=MINWIDTH+rand(MAXWIDTH-MINWIDTH+1)
|
width = rand(MINWIDTH, MAXWIDTH)
|
||||||
height=MINHEIGHT+rand(MAXHEIGHT-MINHEIGHT+1)
|
height = rand(MINHEIGHT, MAXHEIGHT)
|
||||||
return false if width <= 0 || height <= 0
|
return false if width <= 0 || height <= 0
|
||||||
centerX=TILE_WIDTH/2
|
centerX = TILE_WIDTH / 2 + rand(5) - 2
|
||||||
centerY=TILE_HEIGHT/2
|
centerY = TILE_HEIGHT / 2 + rand(5) - 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)
|
x = centerX - (width / 2)
|
||||||
y = centerY - (height / 2)
|
y = centerY - (height / 2)
|
||||||
rect = [x, y, width, height]
|
rect = [x, y, width, height]
|
||||||
@@ -98,8 +100,6 @@ class DungeonMaze
|
|||||||
dungeon.paint(rect, xDst, yDst)
|
dungeon.paint(rect, xDst, yDst)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.generateTiles
|
def self.generateTiles
|
||||||
tiles = []
|
tiles = []
|
||||||
@@ -142,7 +142,11 @@ end
|
|||||||
|
|
||||||
|
|
||||||
module EdgeMasks
|
module EdgeMasks
|
||||||
North=1;West=2;East=4;South=8;Visited=16
|
North = 1
|
||||||
|
West = 2
|
||||||
|
East = 4
|
||||||
|
South = 8
|
||||||
|
Visited = 16
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -166,7 +170,8 @@ class NodeListElement
|
|||||||
attr_accessor :x, :y
|
attr_accessor :x, :y
|
||||||
|
|
||||||
def initialize(x, y)
|
def initialize(x, y)
|
||||||
@x=x;@y=y
|
@x = x
|
||||||
|
@y = y
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -175,6 +180,8 @@ end
|
|||||||
class Maze
|
class Maze
|
||||||
attr_accessor :cellWidth, :cellHeight, :nodeWidth, :nodeHeight
|
attr_accessor :cellWidth, :cellHeight, :nodeWidth, :nodeHeight
|
||||||
|
|
||||||
|
@@dirs = [EdgeMasks::North, EdgeMasks::South, EdgeMasks::East, EdgeMasks::West]
|
||||||
|
|
||||||
def initialize(cw, ch)
|
def initialize(cw, ch)
|
||||||
@nodes = []
|
@nodes = []
|
||||||
@cells = []
|
@cells = []
|
||||||
@@ -207,15 +214,26 @@ class Maze
|
|||||||
def setEdgeNode(x, y, edge)
|
def setEdgeNode(x, y, edge)
|
||||||
return if x < 0 || x >= nodeWidth || y < 0 || y >= nodeHeight
|
return if x < 0 || x >= nodeWidth || y < 0 || y >= nodeHeight
|
||||||
@nodes[y * nodeWidth + x].setEdge(edge)
|
@nodes[y * nodeWidth + x].setEdge(edge)
|
||||||
e=0;nx=0;ny=0
|
e = 0
|
||||||
if edge==EdgeMasks::North
|
nx = 0
|
||||||
e=EdgeMasks::South;nx=x;ny=y-1
|
ny = 0
|
||||||
elsif edge==EdgeMasks::South
|
case edge
|
||||||
e=EdgeMasks::North;nx=x;ny=y+1
|
when EdgeMasks::North
|
||||||
elsif edge==EdgeMasks::East
|
e = EdgeMasks::South
|
||||||
e=EdgeMasks::West;nx=x+1;ny=y
|
nx = x
|
||||||
elsif edge==EdgeMasks::West
|
ny = y - 1
|
||||||
e=EdgeMasks::East;nx=x-1;ny=y
|
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
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -226,15 +244,26 @@ class Maze
|
|||||||
def clearEdgeNode(x, y, edge)
|
def clearEdgeNode(x, y, edge)
|
||||||
return if x < 0 || x >= nodeWidth || y < 0 || y >= nodeHeight
|
return if x < 0 || x >= nodeWidth || y < 0 || y >= nodeHeight
|
||||||
@nodes[y * nodeWidth + x].clearEdge(edge)
|
@nodes[y * nodeWidth + x].clearEdge(edge)
|
||||||
e=0;nx=0;ny=0
|
e = 0
|
||||||
if edge==EdgeMasks::North
|
nx = 0
|
||||||
e=EdgeMasks::South;nx=x;ny=y-1
|
ny = 0
|
||||||
elsif edge==EdgeMasks::South
|
case edge
|
||||||
e=EdgeMasks::North;nx=x;ny=y+1
|
when EdgeMasks::North
|
||||||
elsif edge==EdgeMasks::East
|
e = EdgeMasks::South
|
||||||
e=EdgeMasks::West;nx=x+1;ny=y
|
nx = x
|
||||||
elsif edge==EdgeMasks::West
|
ny = y - 1
|
||||||
e=EdgeMasks::East;nx=x-1;ny=y
|
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
|
else
|
||||||
raise ArgumentError.new
|
raise ArgumentError.new
|
||||||
end
|
end
|
||||||
@@ -294,27 +323,26 @@ class Maze
|
|||||||
@cells[y * cellWidth + x] &=~EdgeMasks::Visited
|
@cells[y * cellWidth + x] &=~EdgeMasks::Visited
|
||||||
end
|
end
|
||||||
|
|
||||||
@@dirs=[EdgeMasks::North,EdgeMasks::South,
|
|
||||||
EdgeMasks::East,EdgeMasks::West]
|
|
||||||
|
|
||||||
def randomDir
|
def randomDir
|
||||||
return @@dirs[rand(4)]
|
return @@dirs[rand(4)]
|
||||||
end
|
end
|
||||||
|
|
||||||
def buildMazeWall(x, y, dir, len)
|
def buildMazeWall(x, y, dir, len)
|
||||||
wx=x;wy=y
|
|
||||||
return if isBlockedNode?(x, y)
|
return if isBlockedNode?(x, y)
|
||||||
|
wx = x
|
||||||
|
wy = y
|
||||||
len.times do
|
len.times do
|
||||||
ox=wx;oy=wy
|
ox = wx
|
||||||
|
oy = wy
|
||||||
wy -= 1 if dir == EdgeMasks::North
|
wy -= 1 if dir == EdgeMasks::North
|
||||||
wx -= 1 if dir == EdgeMasks::West
|
wx -= 1 if dir == EdgeMasks::West
|
||||||
wx += 1 if dir == EdgeMasks::East
|
wx += 1 if dir == EdgeMasks::East
|
||||||
wy += 1 if dir == EdgeMasks::South
|
wy += 1 if dir == EdgeMasks::South
|
||||||
if isBlockedNode?(wx, wy)
|
if isBlockedNode?(wx, wy)
|
||||||
setEdgeNode(ox,oy,dir); return
|
|
||||||
else
|
|
||||||
setEdgeNode(ox, oy, dir)
|
setEdgeNode(ox, oy, dir)
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
setEdgeNode(ox,oy,dir)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -325,7 +353,7 @@ class Maze
|
|||||||
return if nlist.length == 0
|
return if nlist.length == 0
|
||||||
for c in 0...nlist.length
|
for c in 0...nlist.length
|
||||||
d = randomDir()
|
d = randomDir()
|
||||||
len=rand(minWall+(maxWall-minWall)+1)
|
len = rand(maxWall + 1)
|
||||||
x = nlist[c].x
|
x = nlist[c].x
|
||||||
y = nlist[c].y
|
y = nlist[c].y
|
||||||
buildMazeWall(x, y, d, len)
|
buildMazeWall(x, y, d, len)
|
||||||
@@ -374,8 +402,8 @@ end
|
|||||||
|
|
||||||
class Dungeon
|
class Dungeon
|
||||||
attr_accessor :width, :height
|
attr_accessor :width, :height
|
||||||
XBUFFER = 7
|
XBUFFER = 8
|
||||||
YBUFFER = 5
|
YBUFFER = 6
|
||||||
|
|
||||||
class DungeonTable
|
class DungeonTable
|
||||||
def initialize(dungeon)
|
def initialize(dungeon)
|
||||||
@@ -386,7 +414,7 @@ class Dungeon
|
|||||||
def ysize; @dungeon.height; end
|
def ysize; @dungeon.height; end
|
||||||
|
|
||||||
def [](x, y)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -407,7 +435,7 @@ class Dungeon
|
|||||||
i = 0
|
i = 0
|
||||||
for y in 0...@height
|
for y in 0...@height
|
||||||
for x in 0...@width
|
for x in 0...@width
|
||||||
ret+=[" ",".","~"][value(x,y)]
|
ret += [" ", ".", "~", ","][value(x, y)] # Void, room floor, wall, corridor floor
|
||||||
i += 1
|
i += 1
|
||||||
end
|
end
|
||||||
ret += "\r\n"
|
ret += "\r\n"
|
||||||
@@ -434,19 +462,19 @@ class Dungeon
|
|||||||
end
|
end
|
||||||
|
|
||||||
def isWall?(x, y)
|
def isWall?(x, y)
|
||||||
if value(x,y)==0
|
if value(x, y) == 0 # This tile is void
|
||||||
v1 = value(x, y + 1)
|
v1 = value(x, y + 1)
|
||||||
return true if (v1==1||v1==3)
|
return true if v1 == 1 || v1 == 3 # The tile below is room floor/corridor floor
|
||||||
if v1==0
|
if v1 == 0 # The tile below is void
|
||||||
v1 = value(x, y + 2)
|
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
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
def isRoom?(x, y)
|
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 - 1, y - 1) == 3
|
||||||
return false if value( x, 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 - 1) == 3
|
||||||
@@ -455,22 +483,22 @@ class Dungeon
|
|||||||
return false if value(x - 1, y + 1) == 3
|
return false if value(x - 1, y + 1) == 3
|
||||||
return false if value( x, 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 + 1) == 3
|
||||||
return true
|
return true # No surrounding tiles are corridor floor
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate
|
def generate
|
||||||
self.clear
|
self.clear
|
||||||
maxWidth=@width-(XBUFFER*2)
|
maxWidth = @width - XBUFFER * 2
|
||||||
maxHeight=@height-(YBUFFER*2)
|
maxHeight = @height - YBUFFER * 2
|
||||||
cellWidth = DungeonMaze::TILE_WIDTH
|
cellWidth = DungeonMaze::TILE_WIDTH
|
||||||
cellHeight = DungeonMaze::TILE_HEIGHT
|
cellHeight = DungeonMaze::TILE_HEIGHT
|
||||||
return if maxWidth < 0 || maxHeight < 0
|
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 x in 0...maxWidth
|
||||||
for y in 0...maxHeight
|
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
|
end
|
||||||
return
|
return
|
||||||
@@ -482,8 +510,8 @@ class Dungeon
|
|||||||
for y in 0...maxHeight / cellHeight
|
for y in 0...maxHeight / cellHeight
|
||||||
for x in 0...maxWidth / cellWidth
|
for x in 0...maxWidth / cellWidth
|
||||||
tile = maze.getEdgePattern(x, y)
|
tile = maze.getEdgePattern(x, y)
|
||||||
if DungeonMaze.paintCell(self,XBUFFER+x*cellWidth,
|
if DungeonMaze.paintCell(self, XBUFFER + x * cellWidth, YBUFFER + y * cellHeight,
|
||||||
YBUFFER+y*cellHeight,tiles[tile][0],tiles[tile][1])
|
tiles[tile][0], tiles[tile][1])
|
||||||
roomcount += 1
|
roomcount += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -492,16 +520,14 @@ class Dungeon
|
|||||||
# Handle situation where no rooms were generated
|
# Handle situation where no rooms were generated
|
||||||
for x in 0...maxWidth
|
for x in 0...maxWidth
|
||||||
for y in 0...maxHeight
|
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
|
end
|
||||||
end
|
end
|
||||||
# Generate walls
|
# Generate walls
|
||||||
for y in 0...@height
|
for y in 0...@height
|
||||||
for x in 0...@width
|
for x in 0...@width
|
||||||
if isWall?(x,y)
|
self[x, y] = 2 if isWall?(x, y) # Make appropriate tiles wall tiles
|
||||||
self[x,y]=2
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -520,8 +546,8 @@ class Dungeon
|
|||||||
end
|
end
|
||||||
|
|
||||||
def paint(rect,offsetX,offsetY)
|
def paint(rect,offsetX,offsetY)
|
||||||
for y in (rect[1]+offsetY...rect[1]+offsetY+rect[3])
|
for y in (rect[1] + offsetY)...(rect[1] + offsetY + rect[3])
|
||||||
for x in (rect[0]+offsetX...rect[0]+offsetX+rect[2])
|
for x in (rect[0] + offsetX)...(rect[0] + offsetX + rect[2])
|
||||||
self[x, y] = 1 # room tile
|
self[x, y] = 1 # room tile
|
||||||
end
|
end
|
||||||
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)
|
def pbRandomRoomTile(dungeon, tiles)
|
||||||
ar1 = AntiRandom.new(dungeon.width)
|
ar1 = AntiRandom.new(dungeon.width)
|
||||||
ar2 = AntiRandom.new(dungeon.height)
|
ar2 = AntiRandom.new(dungeon.height)
|
||||||
|
|||||||
@@ -196,15 +196,11 @@ class PokemonBag_Scene
|
|||||||
@sprites["itemlist"].baseColor = ITEMLISTBASECOLOR
|
@sprites["itemlist"].baseColor = ITEMLISTBASECOLOR
|
||||||
@sprites["itemlist"].shadowColor = ITEMLISTSHADOWCOLOR
|
@sprites["itemlist"].shadowColor = ITEMLISTSHADOWCOLOR
|
||||||
@sprites["itemicon"] = ItemIconSprite.new(48,Graphics.height-48,nil,@viewport)
|
@sprites["itemicon"] = ItemIconSprite.new(48,Graphics.height-48,nil,@viewport)
|
||||||
@sprites["itemtext"] = Window_UnformattedTextPokemon.new("")
|
@sprites["itemtext"] = Window_UnformattedTextPokemon.newWithSize("",
|
||||||
@sprites["itemtext"].x = 72
|
72, 270, Graphics.width - 72 - 24, 128, @viewport)
|
||||||
@sprites["itemtext"].y = 270
|
|
||||||
@sprites["itemtext"].width = Graphics.width-72-24
|
|
||||||
@sprites["itemtext"].height = 128
|
|
||||||
@sprites["itemtext"].baseColor = ITEMTEXTBASECOLOR
|
@sprites["itemtext"].baseColor = ITEMTEXTBASECOLOR
|
||||||
@sprites["itemtext"].shadowColor = ITEMTEXTSHADOWCOLOR
|
@sprites["itemtext"].shadowColor = ITEMTEXTSHADOWCOLOR
|
||||||
@sprites["itemtext"].visible = true
|
@sprites["itemtext"].visible = true
|
||||||
@sprites["itemtext"].viewport = @viewport
|
|
||||||
@sprites["itemtext"].windowskin = nil
|
@sprites["itemtext"].windowskin = nil
|
||||||
@sprites["helpwindow"] = Window_UnformattedTextPokemon.new("")
|
@sprites["helpwindow"] = Window_UnformattedTextPokemon.new("")
|
||||||
@sprites["helpwindow"].visible = false
|
@sprites["helpwindow"].visible = false
|
||||||
|
|||||||
@@ -207,16 +207,11 @@ class PokemonMart_Scene
|
|||||||
@sprites["itemwindow"].viewport = @viewport
|
@sprites["itemwindow"].viewport = @viewport
|
||||||
@sprites["itemwindow"].index = 0
|
@sprites["itemwindow"].index = 0
|
||||||
@sprites["itemwindow"].refresh
|
@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"])
|
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"].baseColor = Color.new(248, 248, 248)
|
||||||
@sprites["itemtextwindow"].shadowColor = Color.new(0, 0, 0)
|
@sprites["itemtextwindow"].shadowColor = Color.new(0, 0, 0)
|
||||||
@sprites["itemtextwindow"].visible = true
|
|
||||||
@sprites["itemtextwindow"].viewport = @viewport
|
|
||||||
@sprites["itemtextwindow"].windowskin = nil
|
@sprites["itemtextwindow"].windowskin = nil
|
||||||
@sprites["helpwindow"] = Window_AdvancedTextPokemon.new("")
|
@sprites["helpwindow"] = Window_AdvancedTextPokemon.new("")
|
||||||
pbPrepareWindow(@sprites["helpwindow"])
|
pbPrepareWindow(@sprites["helpwindow"])
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ PokemonDebugMenuCommands.register("setnature", {
|
|||||||
"always_show" => true,
|
"always_show" => true,
|
||||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||||
commands = []
|
commands = []
|
||||||
(PBNatures.getCount).times do |i|
|
(PBNatures.maxValue + 1).times do |i|
|
||||||
statUp = PBNatures.getStatRaised(i)
|
statUp = PBNatures.getStatRaised(i)
|
||||||
statDown = PBNatures.getStatLowered(i)
|
statDown = PBNatures.getStatLowered(i)
|
||||||
if statUp != statDown
|
if statUp != statDown
|
||||||
@@ -654,10 +654,10 @@ PokemonDebugMenuCommands.register("setnature", {
|
|||||||
mag = _INTL("Nature is {1}.", PBNatures.getName(pkmn.nature))
|
mag = _INTL("Nature is {1}.", PBNatures.getName(pkmn.nature))
|
||||||
cmd = screen.pbShowCommands(mag, commands, cmd)
|
cmd = screen.pbShowCommands(mag, commands, cmd)
|
||||||
break if cmd < 0
|
break if cmd < 0
|
||||||
if cmd >= 0 && cmd < PBNatures.getCount # Set nature
|
if cmd >= 0 && cmd <= PBNatures.maxValue # Set nature
|
||||||
pkmn.nature = cmd
|
pkmn.nature = cmd
|
||||||
pkmn.calcStats
|
pkmn.calcStats
|
||||||
elsif cmd == PBNatures.getCount # Reset
|
elsif cmd == PBNatures.maxValue + 1 # Reset
|
||||||
pkmn.nature = nil
|
pkmn.nature = nil
|
||||||
end
|
end
|
||||||
screen.pbRefreshSingle(pkmnid)
|
screen.pbRefreshSingle(pkmnid)
|
||||||
|
|||||||
@@ -284,12 +284,8 @@ def pbDefinePath(canvas)
|
|||||||
showline=false
|
showline=false
|
||||||
sliderwin2.visible=false
|
sliderwin2.visible=false
|
||||||
# This window displays the mouse's current position
|
# This window displays the mouse's current position
|
||||||
window=Window_UnformattedTextPokemon.new("")
|
window=Window_UnformattedTextPokemon.newWithSize("",
|
||||||
window.x=0
|
0, 320 - 64, 128, 64, canvas.viewport)
|
||||||
window.y=320-64
|
|
||||||
window.width=128
|
|
||||||
window.height=64
|
|
||||||
window.viewport=canvas.viewport
|
|
||||||
loop do
|
loop do
|
||||||
Graphics.update
|
Graphics.update
|
||||||
Input.update
|
Input.update
|
||||||
|
|||||||
@@ -667,7 +667,7 @@ module TrainerPokemonProperty
|
|||||||
pkmn_properties.concat([
|
pkmn_properties.concat([
|
||||||
[_INTL("Ability"), LimitProperty2.new(99), _INTL("Ability flag. 0=first ability, 1=second ability, 2-5=hidden ability.")],
|
[_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("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("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("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).")],
|
[_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("BaseStats"), BaseStatsProperty, _INTL("Base stats of the Pokémon.")],
|
||||||
[_INTL("EffortPoints"), EffortValuesProperty, _INTL("Effort Value points earned when this species is defeated.")],
|
[_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("BaseEXP"), LimitProperty.new(9999), _INTL("Base experience earned when this species is defeated.")],
|
||||||
[_INTL("GrowthRate"), EnumProperty.new([
|
[_INTL("GrowthRate"), EnumProperty2.new(PBGrowthRates), _INTL("Pokémon's growth rate.")],
|
||||||
_INTL("Medium"), _INTL("Erratic"), _INTL("Fluctuating"),
|
[_INTL("GenderRate"), EnumProperty2.new(PBGenderRates), _INTL("Proportion of males to females for this species.")],
|
||||||
_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("Rareness"), LimitProperty.new(255), _INTL("Catch rate of this species (0-255).")],
|
[_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("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.")],
|
[_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("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("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("WildItemRare"), ItemProperty, _INTL("Item rarely held by wild Pokémon of this species.")],
|
||||||
[_INTL("Compat1"), EnumProperty.new([
|
[_INTL("Compat1"), EnumProperty2.new(PBEggGroups), _INTL("Compatibility group (egg group) for breeding purposes.")],
|
||||||
"Undiscovered", "Monster", "Water 1", "Bug", "Flying",
|
[_INTL("Compat2"), EnumProperty2.new(PBEggGroups), _INTL("Compatibility group (egg group) for breeding purposes.")],
|
||||||
"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("StepsToHatch"), LimitProperty.new(99999), _INTL("Number of steps until an egg of this species hatches.")],
|
[_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("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("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("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("Weight"), NonzeroLimitProperty.new(9999), _INTL("Weight of the Pokémon in 0.1 kilograms (e.g. 42 = 4.2kg).")],
|
||||||
[_INTL("Color"), EnumProperty.new([
|
[_INTL("Color"), EnumProperty2.new(PBColors), _INTL("Pokémon's body color.")],
|
||||||
_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("Shape"), LimitProperty.new(14), _INTL("Body shape of this species (0-14).")],
|
[_INTL("Shape"), LimitProperty.new(14), _INTL("Body shape of this species (0-14).")],
|
||||||
[_INTL("Habitat"), EnumProperty.new([
|
[_INTL("Habitat"), EnumProperty2.new(PBHabitats), _INTL("The habitat of this species.")],
|
||||||
_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("Generation"), LimitProperty.new(99999), _INTL("The number of the generation the Pokémon debuted in.")],
|
[_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("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.")],
|
[_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 = pbListWindow([])
|
||||||
cmdwin.viewport = viewport
|
cmdwin.viewport = viewport
|
||||||
cmdwin.z = 2
|
cmdwin.z = 2
|
||||||
title = Window_UnformattedTextPokemon.new(_INTL("Animations Organiser"))
|
title = Window_UnformattedTextPokemon.newWithSize(_INTL("Animations Organiser"),
|
||||||
title.x = Graphics.width/2
|
Graphics.width / 2, 0, Graphics.width / 2, 64, viewport)
|
||||||
title.y = 0
|
|
||||||
title.width = Graphics.width/2
|
|
||||||
title.height = 64
|
|
||||||
title.viewport = viewport
|
|
||||||
title.z = 2
|
title.z = 2
|
||||||
info = Window_AdvancedTextPokemon.new(_INTL("Z+Up/Down: Swap\nZ+Left: Delete\nZ+Right: Insert"))
|
info = Window_AdvancedTextPokemon.newWithSize(_INTL("Z+Up/Down: Swap\nZ+Left: Delete\nZ+Right: Insert"),
|
||||||
info.x = Graphics.width/2
|
Graphics.width / 2, 64, Graphics.width / 2, Graphics.height - 64, viewport)
|
||||||
info.y = 64
|
|
||||||
info.width = Graphics.width/2
|
|
||||||
info.height = Graphics.height-64
|
|
||||||
info.viewport = viewport
|
|
||||||
info.z = 2
|
info.z = 2
|
||||||
commands = []
|
commands = []
|
||||||
refreshlist = true; oldsel = -1
|
refreshlist = true; oldsel = -1
|
||||||
|
|||||||
@@ -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
|
module BGMProperty
|
||||||
def self.set(settingname,oldsetting)
|
def self.set(settingname,oldsetting)
|
||||||
chosenmap = pbListScreen(settingname,MusicFileLister.new(true,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
|
class IVsProperty
|
||||||
def initialize(limit)
|
def initialize(limit)
|
||||||
@limit = limit
|
@limit = limit
|
||||||
@@ -592,12 +597,8 @@ end
|
|||||||
def chooseMapPoint(map,rgnmap=false)
|
def chooseMapPoint(map,rgnmap=false)
|
||||||
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||||
viewport.z=99999
|
viewport.z=99999
|
||||||
title=Window_UnformattedTextPokemon.new(_INTL("Click a point on the map."))
|
title = Window_UnformattedTextPokemon.newWithSize(_INTL("Click a point on the map."),
|
||||||
title.x=0
|
0, Graphics.height - 64, Graphics.width, 64, viewport)
|
||||||
title.y=Graphics.height-64
|
|
||||||
title.width=Graphics.width
|
|
||||||
title.height=64
|
|
||||||
title.viewport=viewport
|
|
||||||
title.z = 2
|
title.z = 2
|
||||||
if rgnmap
|
if rgnmap
|
||||||
sprite=RegionMapSprite.new(map,viewport)
|
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
|
module MapProperty
|
||||||
def self.set(settingname,oldsetting)
|
def self.set(settingname,oldsetting)
|
||||||
chosenmap = pbListScreen(settingname,MapLister.new(oldsetting ? oldsetting : 0))
|
chosenmap = pbListScreen(settingname,MapLister.new(oldsetting ? oldsetting : 0))
|
||||||
@@ -789,14 +773,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
module PocketProperty
|
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)
|
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
|
return (cmd >= 0) ? cmd + 1 : oldsetting
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -806,7 +786,7 @@ module PocketProperty
|
|||||||
|
|
||||||
def self.format(value)
|
def self.format(value)
|
||||||
return _INTL("No Pocket") if value == 0
|
return _INTL("No Pocket") if value == 0
|
||||||
return (value) ? pocketnames[value - 1] : value.inspect
|
return (value) ? pbPocketNames[value] : value.inspect
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ def pbListScreenBlock(title,lister)
|
|||||||
list.viewport = viewport
|
list.viewport = viewport
|
||||||
list.z = 2
|
list.z = 2
|
||||||
title = Window_UnformattedTextPokemon.newWithSize(title,
|
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
|
title.z = 2
|
||||||
lister.setViewport(viewport)
|
lister.setViewport(viewport)
|
||||||
selectedmap = -1
|
selectedmap = -1
|
||||||
|
|||||||
@@ -81,12 +81,8 @@ class PokemonTilesetScene
|
|||||||
@tileset = @tilesetwrapper.data[1]
|
@tileset = @tilesetwrapper.data[1]
|
||||||
@tilehelper = TileDrawingHelper.fromTileset(@tileset)
|
@tilehelper = TileDrawingHelper.fromTileset(@tileset)
|
||||||
@sprites = {}
|
@sprites = {}
|
||||||
@sprites["title"] = Window_UnformattedTextPokemon.new(_INTL("Tileset Editor\r\nPgUp/PgDn: SCROLL\r\nZ: MENU"))
|
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(_INTL("Tileset Editor\r\nPgUp/PgDn: SCROLL\r\nZ: MENU"),
|
||||||
@sprites["title"].viewport = @viewport
|
TILESET_WIDTH, 0, Graphics.width - TILESET_WIDTH, 128, @viewport)
|
||||||
@sprites["title"].x = TILESET_WIDTH
|
|
||||||
@sprites["title"].y = 0
|
|
||||||
@sprites["title"].width = Graphics.width - TILESET_WIDTH
|
|
||||||
@sprites["title"].height = 128
|
|
||||||
@sprites["tileset"] = IconSprite.new(0,0,@viewport)
|
@sprites["tileset"] = IconSprite.new(0,0,@viewport)
|
||||||
@sprites["tileset"].setBitmap("Graphics/Tilesets/#{@tileset.tileset_name}")
|
@sprites["tileset"].setBitmap("Graphics/Tilesets/#{@tileset.tileset_name}")
|
||||||
@sprites["tileset"].src_rect = Rect.new(0,0,TILESET_WIDTH,Graphics.height)
|
@sprites["tileset"].src_rect = Rect.new(0,0,TILESET_WIDTH,Graphics.height)
|
||||||
|
|||||||
@@ -327,12 +327,8 @@ class MapScreenScene
|
|||||||
@selmapid=-1
|
@selmapid=-1
|
||||||
addBackgroundPlane(@sprites,"background","Trainer Card/bg",@viewport)
|
addBackgroundPlane(@sprites,"background","Trainer Card/bg",@viewport)
|
||||||
@sprites["selsprite"]=SelectionSprite.new(@viewport)
|
@sprites["selsprite"]=SelectionSprite.new(@viewport)
|
||||||
@sprites["title"]=Window_UnformattedTextPokemon.new(_INTL("F: Help"))
|
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(_INTL("F: Help"),
|
||||||
@sprites["title"].x=0
|
0, 600 - 64, 800, 64, @viewport)
|
||||||
@sprites["title"].y=600-64
|
|
||||||
@sprites["title"].width=800
|
|
||||||
@sprites["title"].height=64
|
|
||||||
@sprites["title"].viewport=@viewport
|
|
||||||
@sprites["title"].z = 2
|
@sprites["title"].z = 2
|
||||||
@mapinfos=load_data("Data/MapInfos.rxdata")
|
@mapinfos=load_data("Data/MapInfos.rxdata")
|
||||||
conns=MapFactoryHelper.getMapConnections
|
conns=MapFactoryHelper.getMapConnections
|
||||||
@@ -362,12 +358,8 @@ class MapScreenScene
|
|||||||
helptext+=_INTL("Double-click: Edit map's metadata\r\n")
|
helptext+=_INTL("Double-click: Edit map's metadata\r\n")
|
||||||
helptext+=_INTL("Drag map to move it\r\n")
|
helptext+=_INTL("Drag map to move it\r\n")
|
||||||
helptext+=_INTL("Arrow keys/drag canvas: Move around canvas")
|
helptext+=_INTL("Arrow keys/drag canvas: Move around canvas")
|
||||||
title=Window_UnformattedTextPokemon.new(helptext)
|
title = Window_UnformattedTextPokemon.newWithSize(helptext,
|
||||||
title.x=0
|
0, 0, 800 * 8 / 10, 600, @viewport)
|
||||||
title.y=0
|
|
||||||
title.width=800*8/10
|
|
||||||
title.height=600
|
|
||||||
title.viewport=@viewport
|
|
||||||
title.z = 2
|
title.z = 2
|
||||||
loop do
|
loop do
|
||||||
Graphics.update
|
Graphics.update
|
||||||
|
|||||||
Reference in New Issue
Block a user