mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-06-20 09:44:12 +00:00
Tidied up semicolon use, refactored random dungeon generation code, fixed visual bug in Day Care debug screen
This commit is contained in:
@@ -410,10 +410,14 @@ module PluginManager
|
|||||||
def self.compare_versions(v1, v2)
|
def self.compare_versions(v1, v2)
|
||||||
d1 = v1.split("")
|
d1 = v1.split("")
|
||||||
d1.insert(0, "0") if d1[0] == "." # Turn ".123" into "0.123"
|
d1.insert(0, "0") if d1[0] == "." # Turn ".123" into "0.123"
|
||||||
while d1[-1] == "."; d1 = d1[0..-2]; end # Turn "123." into "123"
|
while d1[-1] == "." # Turn "123." into "123"
|
||||||
|
d1 = d1[0..-2]
|
||||||
|
end
|
||||||
d2 = v2.split("")
|
d2 = v2.split("")
|
||||||
d2.insert(0, "0") if d2[0] == "." # Turn ".123" into "0.123"
|
d2.insert(0, "0") if d2[0] == "." # Turn ".123" into "0.123"
|
||||||
while d2[-1] == "."; d2 = d2[0..-2]; end # Turn "123." into "123"
|
while d2[-1] == "." # Turn "123." into "123"
|
||||||
|
d2 = d2[0..-2]
|
||||||
|
end
|
||||||
for i in 0...[d1.size, d2.size].max # Compare each digit in turn
|
for i in 0...[d1.size, d2.size].max # Compare each digit in turn
|
||||||
c1 = d1[i]
|
c1 = d1[i]
|
||||||
c2 = d2[i]
|
c2 = d2[i]
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ module SaveData
|
|||||||
# new_game_value { Bar.new }
|
# new_game_value { Bar.new }
|
||||||
# end
|
# end
|
||||||
# @param id [Symbol] value id
|
# @param id [Symbol] value id
|
||||||
# @yieldself [Value]
|
# @yield the block of code to be saved as a Value
|
||||||
def self.register(id, &block)
|
def self.register(id, &block)
|
||||||
validate id => Symbol
|
validate id => Symbol
|
||||||
unless block_given?
|
unless block_given?
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ module SaveData
|
|||||||
# save_data[:new_value] = Foo.new
|
# save_data[:new_value] = Foo.new
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
# @yield self [Conversion]
|
# @yield the block of code to be saved as a Conversion
|
||||||
def self.register_conversion(id, &block)
|
def self.register_conversion(id, &block)
|
||||||
validate id => Symbol
|
validate id => Symbol
|
||||||
unless block_given?
|
unless block_given?
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ SaveData.register(:player) do
|
|||||||
save_value { $Trainer }
|
save_value { $Trainer }
|
||||||
load_value { |value| $Trainer = value }
|
load_value { |value| $Trainer = value }
|
||||||
new_game_value {
|
new_game_value {
|
||||||
trainer_type = nil # Get the first defined trainer type as a placeholder
|
# Get the first defined trainer type as a placeholder
|
||||||
GameData::TrainerType.each { |t| trainer_type = t.id; break }
|
trainer_type = GameData::TrainerType.keys.first
|
||||||
Player.new("Unnamed", trainer_type)
|
Player.new("Unnamed", trainer_type)
|
||||||
}
|
}
|
||||||
from_old_format { |old_format| old_format[0] }
|
from_old_format { |old_format| old_format[0] }
|
||||||
|
|||||||
@@ -620,13 +620,15 @@ class Game_Character
|
|||||||
def move_random_range(xrange=-1,yrange=-1)
|
def move_random_range(xrange=-1,yrange=-1)
|
||||||
dirs = [] # 0=down, 1=left, 2=right, 3=up
|
dirs = [] # 0=down, 1=left, 2=right, 3=up
|
||||||
if xrange<0
|
if xrange<0
|
||||||
dirs.push(1); dirs.push(2)
|
dirs.push(1)
|
||||||
|
dirs.push(2)
|
||||||
elsif xrange>0
|
elsif xrange>0
|
||||||
dirs.push(1) if @x > @original_x - xrange
|
dirs.push(1) if @x > @original_x - xrange
|
||||||
dirs.push(2) if @x < @original_x + xrange
|
dirs.push(2) if @x < @original_x + xrange
|
||||||
end
|
end
|
||||||
if yrange<0
|
if yrange<0
|
||||||
dirs.push(0); dirs.push(3)
|
dirs.push(0)
|
||||||
|
dirs.push(3)
|
||||||
elsif yrange>0
|
elsif yrange>0
|
||||||
dirs.push(0) if @y < @original_y + yrange
|
dirs.push(0) if @y < @original_y + yrange
|
||||||
dirs.push(3) if @y > @original_y - yrange
|
dirs.push(3) if @y > @original_y - yrange
|
||||||
|
|||||||
@@ -401,9 +401,12 @@ def pbUpdateVehicle
|
|||||||
meta = GameData::Metadata.get_player($Trainer.character_ID)
|
meta = GameData::Metadata.get_player($Trainer.character_ID)
|
||||||
if meta
|
if meta
|
||||||
charset = 1 # Regular graphic
|
charset = 1 # Regular graphic
|
||||||
if $PokemonGlobal.diving; charset = 5 # Diving graphic
|
if $PokemonGlobal.diving
|
||||||
elsif $PokemonGlobal.surfing; charset = 3 # Surfing graphic
|
charset = 5 # Diving graphic
|
||||||
elsif $PokemonGlobal.bicycle; charset = 2 # Bicycle graphic
|
elsif $PokemonGlobal.surfing
|
||||||
|
charset = 3 # Surfing graphic
|
||||||
|
elsif $PokemonGlobal.bicycle
|
||||||
|
charset = 2 # Bicycle graphic
|
||||||
end
|
end
|
||||||
newCharName = pbGetPlayerCharset(meta,charset)
|
newCharName = pbGetPlayerCharset(meta,charset)
|
||||||
$game_player.character_name = newCharName if newCharName
|
$game_player.character_name = newCharName if newCharName
|
||||||
|
|||||||
@@ -38,10 +38,14 @@ end
|
|||||||
|
|
||||||
|
|
||||||
def getCubicPoint2(src,t)
|
def getCubicPoint2(src,t)
|
||||||
x0 = src[0]; y0 = src[1]
|
x0 = src[0]
|
||||||
cx0 = src[2]; cy0 = src[3]
|
y0 = src[1]
|
||||||
cx1 = src[4]; cy1 = src[5]
|
cx0 = src[2]
|
||||||
x1 = src[6]; y1 = src[7]
|
cy0 = src[3]
|
||||||
|
cx1 = src[4]
|
||||||
|
cy1 = src[5]
|
||||||
|
x1 = src[6]
|
||||||
|
y1 = src[7]
|
||||||
|
|
||||||
x1 = cx1+(x1-cx1)*t
|
x1 = cx1+(x1-cx1)*t
|
||||||
x0 = x0+(cx0-x0)*t
|
x0 = x0+(cx0-x0)*t
|
||||||
@@ -117,9 +121,12 @@ class PictureEx
|
|||||||
end
|
end
|
||||||
|
|
||||||
def callback(cb)
|
def callback(cb)
|
||||||
if cb.is_a?(Proc); cb.call(self)
|
if cb.is_a?(Proc)
|
||||||
elsif cb.is_a?(Array); cb[0].method(cb[1]).call(self)
|
cb.call(self)
|
||||||
elsif cb.is_a?(Method); cb.call(self)
|
elsif cb.is_a?(Array)
|
||||||
|
cb[0].method(cb[1]).call(self)
|
||||||
|
elsif cb.is_a?(Method)
|
||||||
|
cb.call(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -163,7 +170,9 @@ class PictureEx
|
|||||||
# the angle another way too.
|
# the angle another way too.
|
||||||
def rotate(speed)
|
def rotate(speed)
|
||||||
@rotate_speed = speed*20.0/Graphics.frame_rate
|
@rotate_speed = speed*20.0/Graphics.frame_rate
|
||||||
while @rotate_speed<0; @rotate_speed += 360; end
|
while @rotate_speed<0
|
||||||
|
@rotate_speed += 360
|
||||||
|
end
|
||||||
@rotate_speed %= 360
|
@rotate_speed %= 360
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -440,7 +449,9 @@ class PictureEx
|
|||||||
if @rotate_speed != 0
|
if @rotate_speed != 0
|
||||||
@frameUpdates.push(Processes::Angle) if !@frameUpdates.include?(Processes::Angle)
|
@frameUpdates.push(Processes::Angle) if !@frameUpdates.include?(Processes::Angle)
|
||||||
@angle += @rotate_speed
|
@angle += @rotate_speed
|
||||||
while @angle<0; @angle += 360; end
|
while @angle<0
|
||||||
|
@angle += 360
|
||||||
|
end
|
||||||
@angle %= 360
|
@angle %= 360
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -233,7 +233,8 @@ class CustomTilemap
|
|||||||
return if disposed?
|
return if disposed?
|
||||||
@help.dispose if @help
|
@help.dispose if @help
|
||||||
@help = nil
|
@help = nil
|
||||||
i = 0; len = @autotileInfo.length
|
i = 0
|
||||||
|
len = @autotileInfo.length
|
||||||
while i<len
|
while i<len
|
||||||
if @autotileInfo[i]
|
if @autotileInfo[i]
|
||||||
@autotileInfo[i].dispose
|
@autotileInfo[i].dispose
|
||||||
@@ -241,7 +242,8 @@ class CustomTilemap
|
|||||||
end
|
end
|
||||||
i += 1
|
i += 1
|
||||||
end
|
end
|
||||||
i = 0; len = @regularTileInfo.length
|
i = 0
|
||||||
|
len = @regularTileInfo.length
|
||||||
while i<len
|
while i<len
|
||||||
if @regularTileInfo[i]
|
if @regularTileInfo[i]
|
||||||
@regularTileInfo[i].dispose
|
@regularTileInfo[i].dispose
|
||||||
@@ -249,13 +251,15 @@ class CustomTilemap
|
|||||||
end
|
end
|
||||||
i += 1
|
i += 1
|
||||||
end
|
end
|
||||||
i = 0; len = @tiles.length
|
i = 0
|
||||||
|
len = @tiles.length
|
||||||
while i<len
|
while i<len
|
||||||
@tiles[i].dispose
|
@tiles[i].dispose
|
||||||
@tiles[i] = nil
|
@tiles[i] = nil
|
||||||
i += 2
|
i += 2
|
||||||
end
|
end
|
||||||
i = 0; len = @autosprites.length
|
i = 0
|
||||||
|
len = @autosprites.length
|
||||||
while i<len
|
while i<len
|
||||||
@autosprites[i].dispose
|
@autosprites[i].dispose
|
||||||
@autosprites[i] = nil
|
@autosprites[i] = nil
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ def isDarkBackground(background,rect=nil)
|
|||||||
yStart = (ySeg==0) ? rect.y+(rect.height/2) : rect.y+ySeg/2
|
yStart = (ySeg==0) ? rect.y+(rect.height/2) : rect.y+ySeg/2
|
||||||
count = 0
|
count = 0
|
||||||
y = yStart
|
y = yStart
|
||||||
r = 0; g = 0; b = 0
|
r = g = b = 0
|
||||||
yLoop.times do
|
yLoop.times do
|
||||||
x = xStart
|
x = xStart
|
||||||
xLoop.times do
|
xLoop.times do
|
||||||
|
|||||||
@@ -335,8 +335,10 @@ class Window
|
|||||||
return if !srcbitmap || srcbitmap.disposed?
|
return if !srcbitmap || srcbitmap.disposed?
|
||||||
left=dstrect.x
|
left=dstrect.x
|
||||||
top=dstrect.y
|
top=dstrect.y
|
||||||
y=0;loop do break unless y<dstrect.height
|
y = 0
|
||||||
x=0;loop do break unless x<dstrect.width
|
loop do break unless y < dstrect.height
|
||||||
|
x = 0
|
||||||
|
loop do break unless x < dstrect.width
|
||||||
dstbitmap.blt(x+left,y+top,srcbitmap,srcrect)
|
dstbitmap.blt(x+left,y+top,srcbitmap,srcrect)
|
||||||
x+=srcrect.width
|
x+=srcrect.width
|
||||||
end
|
end
|
||||||
@@ -432,10 +434,10 @@ class Window
|
|||||||
backRect=Rect.new(0,0,128,128)
|
backRect=Rect.new(0,0,128,128)
|
||||||
blindsRect=nil
|
blindsRect=nil
|
||||||
end
|
end
|
||||||
@sprites["corner0"].src_rect.set(trimX,trimY+0,16,16);
|
@sprites["corner0"].src_rect.set(trimX,trimY+0,16,16)
|
||||||
@sprites["corner1"].src_rect.set(trimX+48,trimY+0,16,16);
|
@sprites["corner1"].src_rect.set(trimX+48,trimY+0,16,16)
|
||||||
@sprites["corner2"].src_rect.set(trimX,trimY+48,16,16);
|
@sprites["corner2"].src_rect.set(trimX,trimY+48,16,16)
|
||||||
@sprites["corner3"].src_rect.set(trimX+48,trimY+48,16,16);
|
@sprites["corner3"].src_rect.set(trimX+48,trimY+48,16,16)
|
||||||
@sprites["scroll0"].src_rect.set(trimX+24, trimY+16, 16, 8) # up
|
@sprites["scroll0"].src_rect.set(trimX+24, trimY+16, 16, 8) # up
|
||||||
@sprites["scroll3"].src_rect.set(trimX+24, trimY+40, 16, 8) # down
|
@sprites["scroll3"].src_rect.set(trimX+24, trimY+40, 16, 8) # down
|
||||||
@sprites["scroll1"].src_rect.set(trimX+16, trimY+24, 8, 16) # left
|
@sprites["scroll1"].src_rect.set(trimX+16, trimY+24, 8, 16) # left
|
||||||
|
|||||||
@@ -455,8 +455,10 @@ class SpriteWindow < Window
|
|||||||
return if !srcbitmap || srcbitmap.disposed?
|
return if !srcbitmap || srcbitmap.disposed?
|
||||||
left=dstrect.x
|
left=dstrect.x
|
||||||
top=dstrect.y
|
top=dstrect.y
|
||||||
y=0;loop do break unless y<dstrect.height
|
y = 0
|
||||||
x=0;loop do break unless x<dstrect.width
|
loop do break unless y < dstrect.height
|
||||||
|
x = 0
|
||||||
|
loop do break unless x < dstrect.width
|
||||||
dstbitmap.blt(x+left,y+top,srcbitmap,srcrect)
|
dstbitmap.blt(x+left,y+top,srcbitmap,srcrect)
|
||||||
x+=srcrect.width
|
x+=srcrect.width
|
||||||
end
|
end
|
||||||
@@ -567,10 +569,10 @@ class SpriteWindow < Window
|
|||||||
blindsRect=nil
|
blindsRect=nil
|
||||||
end
|
end
|
||||||
if @_windowskin && !@_windowskin.disposed?
|
if @_windowskin && !@_windowskin.disposed?
|
||||||
@sprites["corner0"].src_rect.set(trimX,trimY+0,16,16);
|
@sprites["corner0"].src_rect.set(trimX,trimY+0,16,16)
|
||||||
@sprites["corner1"].src_rect.set(trimX+48,trimY+0,16,16);
|
@sprites["corner1"].src_rect.set(trimX+48,trimY+0,16,16)
|
||||||
@sprites["corner2"].src_rect.set(trimX,trimY+48,16,16);
|
@sprites["corner2"].src_rect.set(trimX,trimY+48,16,16)
|
||||||
@sprites["corner3"].src_rect.set(trimX+48,trimY+48,16,16);
|
@sprites["corner3"].src_rect.set(trimX+48,trimY+48,16,16)
|
||||||
@sprites["scroll0"].src_rect.set(trimX+24, trimY+16, 16, 8) # up
|
@sprites["scroll0"].src_rect.set(trimX+24, trimY+16, 16, 8) # up
|
||||||
@sprites["scroll3"].src_rect.set(trimX+24, trimY+40, 16, 8) # down
|
@sprites["scroll3"].src_rect.set(trimX+24, trimY+40, 16, 8) # down
|
||||||
@sprites["scroll1"].src_rect.set(trimX+16, trimY+24, 8, 16) # left
|
@sprites["scroll1"].src_rect.set(trimX+16, trimY+24, 8, 16) # left
|
||||||
@@ -613,12 +615,12 @@ class SpriteWindow < Window
|
|||||||
endX=(!@_windowskin || @_windowskin.disposed?) ? @skinrect.x : @_windowskin.width-cx
|
endX=(!@_windowskin || @_windowskin.disposed?) ? @skinrect.x : @_windowskin.width-cx
|
||||||
# height of bottom end of window
|
# height of bottom end of window
|
||||||
endY=(!@_windowskin || @_windowskin.disposed?) ? @skinrect.y : @_windowskin.height-cy
|
endY=(!@_windowskin || @_windowskin.disposed?) ? @skinrect.y : @_windowskin.height-cy
|
||||||
@sprites["corner0"].src_rect.set(0,0,startX,startY);
|
@sprites["corner0"].src_rect.set(0,0,startX,startY)
|
||||||
@sprites["corner1"].src_rect.set(cx,0,endX,startY);
|
@sprites["corner1"].src_rect.set(cx,0,endX,startY)
|
||||||
@sprites["corner2"].src_rect.set(0,cy,startX,endY);
|
@sprites["corner2"].src_rect.set(0,cy,startX,endY)
|
||||||
@sprites["corner3"].src_rect.set(cx,cy,endX,endY);
|
@sprites["corner3"].src_rect.set(cx,cy,endX,endY)
|
||||||
backRect=Rect.new(@skinrect.x,@skinrect.y,
|
backRect=Rect.new(@skinrect.x,@skinrect.y,
|
||||||
@skinrect.width,@skinrect.height);
|
@skinrect.width,@skinrect.height)
|
||||||
blindsRect=nil
|
blindsRect=nil
|
||||||
sideRects=[
|
sideRects=[
|
||||||
Rect.new(startX,0,@skinrect.width,startY), # side0 (top)
|
Rect.new(startX,0,@skinrect.width,startY), # side0 (top)
|
||||||
|
|||||||
@@ -346,14 +346,14 @@ class ChangelingSprite < SpriteWrapper
|
|||||||
|
|
||||||
def dispose
|
def dispose
|
||||||
return if disposed?
|
return if disposed?
|
||||||
for bm in @bitmaps.values; bm.dispose; end
|
@bitmaps.values.each { |bm| bm.dispose }
|
||||||
@bitmaps.clear
|
@bitmaps.clear
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
return if disposed?
|
return if disposed?
|
||||||
for bm in @bitmaps.values; bm.update; end
|
@bitmaps.values.each { |bm| bm.update }
|
||||||
self.bitmap = (@currentBitmap) ? @currentBitmap.bitmap : nil
|
self.bitmap = (@currentBitmap) ? @currentBitmap.bitmap : nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ class LargePlane < Plane
|
|||||||
def ox; @__ox; end
|
def ox; @__ox; end
|
||||||
def oy; @__oy; end
|
def oy; @__oy; end
|
||||||
|
|
||||||
def ox=(value);
|
def ox=(value)
|
||||||
return if @__ox==value
|
return if @__ox==value
|
||||||
@__ox = value
|
@__ox = value
|
||||||
refresh
|
refresh
|
||||||
end
|
end
|
||||||
|
|
||||||
def oy=(value);
|
def oy=(value)
|
||||||
return if @__oy==value
|
return if @__oy==value
|
||||||
@__oy = value
|
@__oy = value
|
||||||
refresh
|
refresh
|
||||||
@@ -89,13 +89,13 @@ class LargePlane < Plane
|
|||||||
def color; @__sprite.color; end
|
def color; @__sprite.color; end
|
||||||
def tone; @__sprite.tone; end
|
def tone; @__sprite.tone; end
|
||||||
|
|
||||||
def zoom_x=(v);
|
def zoom_x=(v)
|
||||||
return if @__sprite.zoom_x==v
|
return if @__sprite.zoom_x==v
|
||||||
@__sprite.zoom_x = v
|
@__sprite.zoom_x = v
|
||||||
refresh
|
refresh
|
||||||
end
|
end
|
||||||
|
|
||||||
def zoom_y=(v);
|
def zoom_y=(v)
|
||||||
return if @__sprite.zoom_y==v
|
return if @__sprite.zoom_y==v
|
||||||
@__sprite.zoom_y = v
|
@__sprite.zoom_y = v
|
||||||
refresh
|
refresh
|
||||||
@@ -107,7 +107,7 @@ class LargePlane < Plane
|
|||||||
def z=(v); @__sprite.z=(v); end
|
def z=(v); @__sprite.z=(v); end
|
||||||
def color=(v); @__sprite.color=(v); end
|
def color=(v); @__sprite.color=(v); end
|
||||||
def tone=(v); @__sprite.tone=(v); end
|
def tone=(v); @__sprite.tone=(v); end
|
||||||
def update; ;end
|
def update; end
|
||||||
|
|
||||||
def refresh
|
def refresh
|
||||||
@__sprite.visible = (@__visible && !@__bitmap.nil?)
|
@__sprite.visible = (@__visible && !@__bitmap.nil?)
|
||||||
|
|||||||
@@ -93,7 +93,9 @@ end
|
|||||||
|
|
||||||
def getContrastColor(color)
|
def getContrastColor(color)
|
||||||
raise "No color given" if !color
|
raise "No color given" if !color
|
||||||
r=color.red; g=color.green; b=color.blue
|
r=color.red
|
||||||
|
g=color.green
|
||||||
|
b=color.blue
|
||||||
yuv=[
|
yuv=[
|
||||||
r * 0.299 + g * 0.587 + b * 0.114,
|
r * 0.299 + g * 0.587 + b * 0.114,
|
||||||
r * -0.1687 + g * -0.3313 + b * 0.500 + 0.5,
|
r * -0.1687 + g * -0.3313 + b * 0.500 + 0.5,
|
||||||
@@ -593,7 +595,8 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
|||||||
elsif control=="r" # Right align this line
|
elsif control=="r" # Right align this line
|
||||||
if !endtag
|
if !endtag
|
||||||
x=0
|
x=0
|
||||||
rightalign=1; lastword=[characters.length,x]
|
rightalign=1
|
||||||
|
lastword=[characters.length,x]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
controls[i]=nil
|
controls[i]=nil
|
||||||
@@ -719,13 +722,15 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
|||||||
leftSearch = 0
|
leftSearch = 0
|
||||||
rightSearch = 0
|
rightSearch = 0
|
||||||
# Search left for a space
|
# Search left for a space
|
||||||
i = half; while i>=0
|
i = half
|
||||||
|
while i>=0
|
||||||
break if realtext[i,1][/\s/]||isWaitChar(realtext[i,1]) # found a space
|
break if realtext[i,1][/\s/]||isWaitChar(realtext[i,1]) # found a space
|
||||||
leftSearch += 1
|
leftSearch += 1
|
||||||
i -= 1
|
i -= 1
|
||||||
end
|
end
|
||||||
# Search right for a space
|
# Search right for a space
|
||||||
i = half; while i<realtext.length
|
i = half
|
||||||
|
while i<realtext.length
|
||||||
break if realtext[i,1][/\s/]||isWaitChar(realtext[i,1]) # found a space
|
break if realtext[i,1][/\s/]||isWaitChar(realtext[i,1]) # found a space
|
||||||
rightSearch += 1
|
rightSearch += 1
|
||||||
i += 1
|
i += 1
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ def pbBGMPlay(param,volume=nil,pitch=nil)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
|
||||||
def pbBGMFade(x=0.0); pbBGMStop(x);end
|
def pbBGMFade(x=0.0); pbBGMStop(x); end
|
||||||
|
|
||||||
# Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
|
||||||
def pbBGMStop(timeInSeconds=0.0)
|
def pbBGMStop(timeInSeconds=0.0)
|
||||||
@@ -109,7 +109,8 @@ def pbMEPlay(param,volume=nil,pitch=nil)
|
|||||||
elsif (RPG.const_defined?(:ME) rescue false)
|
elsif (RPG.const_defined?(:ME) rescue false)
|
||||||
b=RPG::ME.new(param.name,param.volume,param.pitch)
|
b=RPG::ME.new(param.name,param.volume,param.pitch)
|
||||||
if b && b.respond_to?("play")
|
if b && b.respond_to?("play")
|
||||||
b.play; return
|
b.play
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Audio.me_play(canonicalize("Audio/ME/"+param.name),param.volume,param.pitch)
|
Audio.me_play(canonicalize("Audio/ME/"+param.name),param.volume,param.pitch)
|
||||||
@@ -117,7 +118,7 @@ def pbMEPlay(param,volume=nil,pitch=nil)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Fades out or stops ME playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops ME playback. 'x' is the time in seconds to fade out.
|
||||||
def pbMEFade(x=0.0); pbMEStop(x);end
|
def pbMEFade(x=0.0); pbMEStop(x); end
|
||||||
|
|
||||||
# Fades out or stops ME playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops ME playback. 'x' is the time in seconds to fade out.
|
||||||
def pbMEStop(timeInSeconds=0.0)
|
def pbMEStop(timeInSeconds=0.0)
|
||||||
@@ -158,7 +159,8 @@ def pbBGSPlay(param,volume=nil,pitch=nil)
|
|||||||
elsif (RPG.const_defined?(:BGS) rescue false)
|
elsif (RPG.const_defined?(:BGS) rescue false)
|
||||||
b=RPG::BGS.new(param.name,param.volume,param.pitch)
|
b=RPG::BGS.new(param.name,param.volume,param.pitch)
|
||||||
if b && b.respond_to?("play")
|
if b && b.respond_to?("play")
|
||||||
b.play; return
|
b.play
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Audio.bgs_play(canonicalize("Audio/BGS/"+param.name),param.volume,param.pitch)
|
Audio.bgs_play(canonicalize("Audio/BGS/"+param.name),param.volume,param.pitch)
|
||||||
@@ -166,7 +168,7 @@ def pbBGSPlay(param,volume=nil,pitch=nil)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
|
||||||
def pbBGSFade(x=0.0); pbBGSStop(x);end
|
def pbBGSFade(x=0.0); pbBGSStop(x); end
|
||||||
|
|
||||||
# Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
|
||||||
def pbBGSStop(timeInSeconds=0.0)
|
def pbBGSStop(timeInSeconds=0.0)
|
||||||
@@ -217,7 +219,7 @@ def pbSEPlay(param,volume=nil,pitch=nil)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Stops SE playback.
|
# Stops SE playback.
|
||||||
def pbSEFade(x=0.0); pbSEStop(x);end
|
def pbSEFade(x=0.0); pbSEStop(x); end
|
||||||
|
|
||||||
# Stops SE playback.
|
# Stops SE playback.
|
||||||
def pbSEStop(_timeInSeconds=0.0)
|
def pbSEStop(_timeInSeconds=0.0)
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ class PokeBattle_Battler
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
# Ability immunity
|
# Ability immunity
|
||||||
immuneByAbility = false; immAlly = nil
|
immuneByAbility = false
|
||||||
|
immAlly = nil
|
||||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,newStatus)
|
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,newStatus)
|
||||||
immuneByAbility = true
|
immuneByAbility = true
|
||||||
elsif selfInflicted || !@battle.moldBreaker
|
elsif selfInflicted || !@battle.moldBreaker
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ class PokeBattle_Battler
|
|||||||
# Snatch
|
# Snatch
|
||||||
move.snatched = false
|
move.snatched = false
|
||||||
if move.statusMove? && move.canSnatch?
|
if move.statusMove? && move.canSnatch?
|
||||||
newUser = nil; strength = 100
|
newUser = nil
|
||||||
|
strength = 100
|
||||||
@battle.eachBattler do |b|
|
@battle.eachBattler do |b|
|
||||||
next if b.effects[PBEffects::Snatch]==0 ||
|
next if b.effects[PBEffects::Snatch]==0 ||
|
||||||
b.effects[PBEffects::Snatch]>=strength
|
b.effects[PBEffects::Snatch]>=strength
|
||||||
@@ -101,7 +102,8 @@ class PokeBattle_Battler
|
|||||||
priority = @battle.pbPriority(true)
|
priority = @battle.pbPriority(true)
|
||||||
nearOnly = !target_data.can_choose_distant_target?
|
nearOnly = !target_data.can_choose_distant_target?
|
||||||
# Spotlight (takes priority over Follow Me/Rage Powder/Lightning Rod/Storm Drain)
|
# Spotlight (takes priority over Follow Me/Rage Powder/Lightning Rod/Storm Drain)
|
||||||
newTarget = nil; strength = 100 # Lower strength takes priority
|
newTarget = nil
|
||||||
|
strength = 100 # Lower strength takes priority
|
||||||
priority.each do |b|
|
priority.each do |b|
|
||||||
next if b.fainted? || b.effects[PBEffects::SkyDrop]>=0
|
next if b.fainted? || b.effects[PBEffects::SkyDrop]>=0
|
||||||
next if b.effects[PBEffects::Spotlight]==0 ||
|
next if b.effects[PBEffects::Spotlight]==0 ||
|
||||||
@@ -118,7 +120,8 @@ class PokeBattle_Battler
|
|||||||
return targets
|
return targets
|
||||||
end
|
end
|
||||||
# Follow Me/Rage Powder (takes priority over Lightning Rod/Storm Drain)
|
# Follow Me/Rage Powder (takes priority over Lightning Rod/Storm Drain)
|
||||||
newTarget = nil; strength = 100 # Lower strength takes priority
|
newTarget = nil
|
||||||
|
strength = 100 # Lower strength takes priority
|
||||||
priority.each do |b|
|
priority.each do |b|
|
||||||
next if b.fainted? || b.effects[PBEffects::SkyDrop]>=0
|
next if b.fainted? || b.effects[PBEffects::SkyDrop]>=0
|
||||||
next if b.effects[PBEffects::RagePowder] && !user.affectedByPowder?
|
next if b.effects[PBEffects::RagePowder] && !user.affectedByPowder?
|
||||||
|
|||||||
@@ -506,7 +506,8 @@ class PokeBattle_Battler
|
|||||||
user.effects[PBEffects::LockOnPos]==target.index
|
user.effects[PBEffects::LockOnPos]==target.index
|
||||||
# Toxic
|
# Toxic
|
||||||
return true if move.pbOverrideSuccessCheckPerHit(user,target)
|
return true if move.pbOverrideSuccessCheckPerHit(user,target)
|
||||||
miss = false; hitsInvul = false
|
miss = false
|
||||||
|
hitsInvul = false
|
||||||
# No Guard
|
# No Guard
|
||||||
hitsInvul = true if user.hasActiveAbility?(:NOGUARD) ||
|
hitsInvul = true if user.hasActiveAbility?(:NOGUARD) ||
|
||||||
target.hasActiveAbility?(:NOGUARD)
|
target.hasActiveAbility?(:NOGUARD)
|
||||||
|
|||||||
@@ -493,8 +493,10 @@ def pbBattleConfusionBerry(battler,battle,item,forced,flavor,confuseMsg)
|
|||||||
return false if !forced && !battler.canConsumePinchBerry?(Settings::MECHANICS_GENERATION >= 7)
|
return false if !forced && !battler.canConsumePinchBerry?(Settings::MECHANICS_GENERATION >= 7)
|
||||||
itemName = GameData::Item.get(item).name
|
itemName = GameData::Item.get(item).name
|
||||||
fraction_to_heal = 8 # Gens 6 and lower
|
fraction_to_heal = 8 # Gens 6 and lower
|
||||||
if Settings::MECHANICS_GENERATION == 7; fraction_to_heal = 2
|
if Settings::MECHANICS_GENERATION == 7
|
||||||
elsif Settings::MECHANICS_GENERATION >= 8; fraction_to_heal = 3
|
fraction_to_heal = 2
|
||||||
|
elsif Settings::MECHANICS_GENERATION >= 8
|
||||||
|
fraction_to_heal = 3
|
||||||
end
|
end
|
||||||
amt = battler.totalhp / fraction_to_heal
|
amt = battler.totalhp / fraction_to_heal
|
||||||
ripening = false
|
ripening = false
|
||||||
|
|||||||
@@ -240,8 +240,10 @@ class PokeBattle_Move
|
|||||||
oldHP = b.hp+b.damageState.hpLost
|
oldHP = b.hp+b.damageState.hpLost
|
||||||
PBDebug.log("[Move damage] #{b.pbThis} lost #{b.damageState.hpLost} HP (#{oldHP}=>#{b.hp})")
|
PBDebug.log("[Move damage] #{b.pbThis} lost #{b.damageState.hpLost} HP (#{oldHP}=>#{b.hp})")
|
||||||
effectiveness = 0
|
effectiveness = 0
|
||||||
if Effectiveness.resistant?(b.damageState.typeMod); effectiveness = 1
|
if Effectiveness.resistant?(b.damageState.typeMod)
|
||||||
elsif Effectiveness.super_effective?(b.damageState.typeMod); effectiveness = 2
|
effectiveness = 1
|
||||||
|
elsif Effectiveness.super_effective?(b.damageState.typeMod)
|
||||||
|
effectiveness = 2
|
||||||
end
|
end
|
||||||
animArray.push([b,oldHP,effectiveness])
|
animArray.push([b,oldHP,effectiveness])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -492,8 +492,10 @@ class PokeBattle_TwoTurnMove < PokeBattle_Move
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbEffectAgainstTarget(user,target)
|
def pbEffectAgainstTarget(user,target)
|
||||||
if @damagingTurn; pbAttackingTurnEffect(user,target)
|
if @damagingTurn
|
||||||
elsif @chargingTurn; pbChargingTurnEffect(user,target)
|
pbAttackingTurnEffect(user,target)
|
||||||
|
elsif @chargingTurn
|
||||||
|
pbChargingTurnEffect(user,target)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -652,14 +654,20 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokeBattle_PledgeMove < PokeBattle_Move
|
class PokeBattle_PledgeMove < PokeBattle_Move
|
||||||
def pbOnStartUse(user,targets)
|
def pbOnStartUse(user,targets)
|
||||||
@pledgeSetup = false; @pledgeCombo = false; @pledgeOtherUser = nil
|
@pledgeSetup = false
|
||||||
@comboEffect = nil; @overrideType = nil; @overrideAnim = nil
|
@pledgeCombo = false
|
||||||
|
@pledgeOtherUser = nil
|
||||||
|
@comboEffect = nil
|
||||||
|
@overrideType = nil
|
||||||
|
@overrideAnim = nil
|
||||||
# Check whether this is the use of a combo move
|
# Check whether this is the use of a combo move
|
||||||
@combos.each do |i|
|
@combos.each do |i|
|
||||||
next if i[0]!=user.effects[PBEffects::FirstPledge]
|
next if i[0]!=user.effects[PBEffects::FirstPledge]
|
||||||
@battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
|
@battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
|
||||||
@pledgeCombo = true
|
@pledgeCombo = true
|
||||||
@comboEffect = i[1]; @overrideType = i[2]; @overrideAnim = i[3]
|
@comboEffect = i[1]
|
||||||
|
@overrideType = i[2]
|
||||||
|
@overrideAnim = i[3]
|
||||||
@overrideType = nil if !GameData::Type.exists?(@overrideType)
|
@overrideType = nil if !GameData::Type.exists?(@overrideType)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@@ -706,7 +714,8 @@ class PokeBattle_PledgeMove < PokeBattle_Move
|
|||||||
|
|
||||||
def pbEffectAfterAllHits(user,target)
|
def pbEffectAfterAllHits(user,target)
|
||||||
return if !@pledgeCombo
|
return if !@pledgeCombo
|
||||||
msg = nil; animName = nil
|
msg = nil
|
||||||
|
animName = nil
|
||||||
case @comboEffect
|
case @comboEffect
|
||||||
when :SeaOfFire # Grass + Fire
|
when :SeaOfFire # Grass + Fire
|
||||||
if user.pbOpposingSide.effects[PBEffects::SeaOfFire]==0
|
if user.pbOpposingSide.effects[PBEffects::SeaOfFire]==0
|
||||||
|
|||||||
@@ -927,12 +927,14 @@ class PokeBattle_Move_035 < PokeBattle_Move
|
|||||||
failed = true
|
failed = true
|
||||||
for i in 0...@statUp.length/2
|
for i in 0...@statUp.length/2
|
||||||
if user.pbCanRaiseStatStage?(@statUp[i*2],user,self)
|
if user.pbCanRaiseStatStage?(@statUp[i*2],user,self)
|
||||||
failed = false; break
|
failed = false
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for i in 0...@statDown.length/2
|
for i in 0...@statDown.length/2
|
||||||
if user.pbCanLowerStatStage?(@statDown[i*2],user,self)
|
if user.pbCanLowerStatStage?(@statDown[i*2],user,self)
|
||||||
failed = false; break
|
failed = false
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if failed
|
if failed
|
||||||
@@ -1686,11 +1688,15 @@ end
|
|||||||
class PokeBattle_Move_05A < PokeBattle_Move
|
class PokeBattle_Move_05A < PokeBattle_Move
|
||||||
def pbEffectAgainstTarget(user,target)
|
def pbEffectAgainstTarget(user,target)
|
||||||
newHP = (user.hp+target.hp)/2
|
newHP = (user.hp+target.hp)/2
|
||||||
if user.hp>newHP; user.pbReduceHP(user.hp-newHP,false,false)
|
if user.hp>newHP
|
||||||
elsif user.hp<newHP; user.pbRecoverHP(newHP-user.hp,false)
|
user.pbReduceHP(user.hp-newHP,false,false)
|
||||||
|
elsif user.hp<newHP
|
||||||
|
user.pbRecoverHP(newHP-user.hp,false)
|
||||||
end
|
end
|
||||||
if target.hp>newHP; target.pbReduceHP(target.hp-newHP,false,false)
|
if target.hp>newHP
|
||||||
elsif target.hp<newHP; target.pbRecoverHP(newHP-target.hp,false)
|
target.pbReduceHP(target.hp-newHP,false,false)
|
||||||
|
elsif target.hp<newHP
|
||||||
|
target.pbRecoverHP(newHP-target.hp,false)
|
||||||
end
|
end
|
||||||
@battle.pbDisplay(_INTL("The battlers shared their pain!"))
|
@battle.pbDisplay(_INTL("The battlers shared their pain!"))
|
||||||
user.pbItemHPHealCheck
|
user.pbItemHPHealCheck
|
||||||
|
|||||||
@@ -260,7 +260,8 @@ def pbHiddenPower(pkmn)
|
|||||||
# NOTE: This allows Hidden Power to be Fairy-type (if you have that type in
|
# NOTE: This allows Hidden Power to be Fairy-type (if you have that type in
|
||||||
# your game). I don't care that the official games don't work like that.
|
# your game). I don't care that the official games don't work like that.
|
||||||
iv = pkmn.iv
|
iv = pkmn.iv
|
||||||
idxType = 0; power = 60
|
idxType = 0
|
||||||
|
power = 60
|
||||||
types = []
|
types = []
|
||||||
GameData::Type.each do |t|
|
GameData::Type.each do |t|
|
||||||
types[t.icon_position] ||= []
|
types[t.icon_position] ||= []
|
||||||
@@ -355,9 +356,12 @@ class PokeBattle_Move_094 < PokeBattle_Move
|
|||||||
def pbOnStartUse(user,targets)
|
def pbOnStartUse(user,targets)
|
||||||
@presentDmg = 0 # 0 = heal, >0 = damage
|
@presentDmg = 0 # 0 = heal, >0 = damage
|
||||||
r = @battle.pbRandom(100)
|
r = @battle.pbRandom(100)
|
||||||
if r<40; @presentDmg = 40
|
if r<40
|
||||||
elsif r<70; @presentDmg = 80
|
@presentDmg = 40
|
||||||
elsif r<80; @presentDmg = 120
|
elsif r<70
|
||||||
|
@presentDmg = 80
|
||||||
|
elsif r<80
|
||||||
|
@presentDmg = 120
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -549,11 +553,16 @@ class PokeBattle_Move_098 < PokeBattle_Move
|
|||||||
def pbBaseDamage(baseDmg,user,target)
|
def pbBaseDamage(baseDmg,user,target)
|
||||||
ret = 20
|
ret = 20
|
||||||
n = 48*user.hp/user.totalhp
|
n = 48*user.hp/user.totalhp
|
||||||
if n<2; ret = 200
|
if n<2
|
||||||
elsif n<5; ret = 150
|
ret = 200
|
||||||
elsif n<10; ret = 100
|
elsif n<5
|
||||||
elsif n<17; ret = 80
|
ret = 150
|
||||||
elsif n<33; ret = 40
|
elsif n<10
|
||||||
|
ret = 100
|
||||||
|
elsif n<17
|
||||||
|
ret = 80
|
||||||
|
elsif n<33
|
||||||
|
ret = 40
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
@@ -568,10 +577,14 @@ class PokeBattle_Move_099 < PokeBattle_Move
|
|||||||
def pbBaseDamage(baseDmg,user,target)
|
def pbBaseDamage(baseDmg,user,target)
|
||||||
ret = 40
|
ret = 40
|
||||||
n = user.pbSpeed/target.pbSpeed
|
n = user.pbSpeed/target.pbSpeed
|
||||||
if n>=4; ret = 150
|
if n>=4
|
||||||
elsif n>=3; ret = 120
|
ret = 150
|
||||||
elsif n>=2; ret = 80
|
elsif n>=3
|
||||||
elsif n>=1; ret = 60
|
ret = 120
|
||||||
|
elsif n>=2
|
||||||
|
ret = 80
|
||||||
|
elsif n>=1
|
||||||
|
ret = 60
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
@@ -586,11 +599,16 @@ class PokeBattle_Move_09A < PokeBattle_Move
|
|||||||
def pbBaseDamage(baseDmg,user,target)
|
def pbBaseDamage(baseDmg,user,target)
|
||||||
ret = 20
|
ret = 20
|
||||||
weight = target.pbWeight
|
weight = target.pbWeight
|
||||||
if weight>=2000; ret = 120
|
if weight>=2000
|
||||||
elsif weight>=1000; ret = 100
|
ret = 120
|
||||||
elsif weight>=500; ret = 80
|
elsif weight>=1000
|
||||||
elsif weight>=250; ret = 60
|
ret = 100
|
||||||
elsif weight>=100; ret = 40
|
elsif weight>=500
|
||||||
|
ret = 80
|
||||||
|
elsif weight>=250
|
||||||
|
ret = 60
|
||||||
|
elsif weight>=100
|
||||||
|
ret = 40
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
@@ -611,10 +629,14 @@ class PokeBattle_Move_09B < PokeBattle_Move
|
|||||||
def pbBaseDamage(baseDmg,user,target)
|
def pbBaseDamage(baseDmg,user,target)
|
||||||
ret = 40
|
ret = 40
|
||||||
n = (user.pbWeight/target.pbWeight).floor
|
n = (user.pbWeight/target.pbWeight).floor
|
||||||
if n>=5; ret = 120
|
if n>=5
|
||||||
elsif n>=4; ret = 100
|
ret = 120
|
||||||
elsif n>=3; ret = 80
|
elsif n>=4
|
||||||
elsif n>=2; ret = 60
|
ret = 100
|
||||||
|
elsif n>=3
|
||||||
|
ret = 80
|
||||||
|
elsif n>=2
|
||||||
|
ret = 60
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
@@ -3324,8 +3346,10 @@ class PokeBattle_Move_0F2 < PokeBattle_Move
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbEffectAgainstTarget(user,target)
|
def pbEffectAgainstTarget(user,target)
|
||||||
oldUserItem = user.item; oldUserItemName = user.itemName
|
oldUserItem = user.item
|
||||||
oldTargetItem = target.item; oldTargetItemName = target.itemName
|
oldUserItemName = user.itemName
|
||||||
|
oldTargetItem = target.item
|
||||||
|
oldTargetItemName = target.itemName
|
||||||
user.item = oldTargetItem
|
user.item = oldTargetItem
|
||||||
user.effects[PBEffects::ChoiceBand] = nil if user.ability_id != :GORILLATACTICS
|
user.effects[PBEffects::ChoiceBand] = nil if user.ability_id != :GORILLATACTICS
|
||||||
user.effects[PBEffects::Unburden] = (!user.item && oldUserItem)
|
user.effects[PBEffects::Unburden] = (!user.item && oldUserItem)
|
||||||
|
|||||||
@@ -1017,7 +1017,9 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokeBattle_Move_125 < PokeBattle_Move
|
class PokeBattle_Move_125 < PokeBattle_Move
|
||||||
def pbFailsAgainstTarget?(user,target)
|
def pbFailsAgainstTarget?(user,target)
|
||||||
hasThisMove = false; hasOtherMoves = false; hasUnusedMoves = false
|
hasThisMove = false
|
||||||
|
hasOtherMoves = false
|
||||||
|
hasUnusedMoves = false
|
||||||
user.eachMove do |m|
|
user.eachMove do |m|
|
||||||
hasThisMove = true if m.id==@id
|
hasThisMove = true if m.id==@id
|
||||||
hasOtherMoves = true if m.id!=@id
|
hasOtherMoves = true if m.id!=@id
|
||||||
|
|||||||
@@ -195,11 +195,16 @@ module PokeBattle_BattleCommon
|
|||||||
if Settings::ENABLE_CRITICAL_CAPTURES
|
if Settings::ENABLE_CRITICAL_CAPTURES
|
||||||
dex_modifier = 0
|
dex_modifier = 0
|
||||||
numOwned = $Trainer.pokedex.owned_count
|
numOwned = $Trainer.pokedex.owned_count
|
||||||
if numOwned>600; dex_modifier = 5
|
if numOwned>600
|
||||||
elsif numOwned>450; dex_modifier = 4
|
dex_modifier = 5
|
||||||
elsif numOwned>300; dex_modifier = 3
|
elsif numOwned>450
|
||||||
elsif numOwned>150; dex_modifier = 2
|
dex_modifier = 4
|
||||||
elsif numOwned>30; dex_modifier = 1
|
elsif numOwned>300
|
||||||
|
dex_modifier = 3
|
||||||
|
elsif numOwned>150
|
||||||
|
dex_modifier = 2
|
||||||
|
elsif numOwned>30
|
||||||
|
dex_modifier = 1
|
||||||
end
|
end
|
||||||
dex_modifier *= 2 if $PokemonBag.pbHasItem?(:CATCHINGCHARM)
|
dex_modifier *= 2 if $PokemonBag.pbHasItem?(:CATCHINGCHARM)
|
||||||
c = x * dex_modifier / 12
|
c = x * dex_modifier / 12
|
||||||
|
|||||||
@@ -531,9 +531,12 @@ class PokeBattle_Battle
|
|||||||
def pbJudge
|
def pbJudge
|
||||||
fainted1 = pbAllFainted?(0)
|
fainted1 = pbAllFainted?(0)
|
||||||
fainted2 = pbAllFainted?(1)
|
fainted2 = pbAllFainted?(1)
|
||||||
if fainted1 && fainted2; @decision = pbDecisionOnDraw # Draw
|
if fainted1 && fainted2
|
||||||
elsif fainted1; @decision = 2 # Loss
|
@decision = pbDecisionOnDraw # Draw
|
||||||
elsif fainted2; @decision = 1 # Win
|
elsif fainted1
|
||||||
|
@decision = 2 # Loss
|
||||||
|
elsif fainted2
|
||||||
|
@decision = 1 # Win
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2003,7 +2003,9 @@ BattleHandlers::EORGainItemAbility.add(:HARVEST,
|
|||||||
BattleHandlers::EORGainItemAbility.add(:PICKUP,
|
BattleHandlers::EORGainItemAbility.add(:PICKUP,
|
||||||
proc { |ability,battler,battle|
|
proc { |ability,battler,battle|
|
||||||
next if battler.item
|
next if battler.item
|
||||||
foundItem = nil; fromBattler = nil; use = 0
|
foundItem = nil
|
||||||
|
fromBattler = nil
|
||||||
|
use = 0
|
||||||
battle.eachBattler do |b|
|
battle.eachBattler do |b|
|
||||||
next if b.index==battler.index
|
next if b.index==battler.index
|
||||||
next if b.effects[PBEffects::PickupUse]<=use
|
next if b.effects[PBEffects::PickupUse]<=use
|
||||||
|
|||||||
@@ -193,10 +193,14 @@ class PokeBattle_AI
|
|||||||
# Pick a good move for the Choice items
|
# Pick a good move for the Choice items
|
||||||
if user.hasActiveItem?([:CHOICEBAND,:CHOICESPECS,:CHOICESCARF]) ||
|
if user.hasActiveItem?([:CHOICEBAND,:CHOICESPECS,:CHOICESCARF]) ||
|
||||||
user.hasActiveAbility?(:GORILLATACTICS)
|
user.hasActiveAbility?(:GORILLATACTICS)
|
||||||
if move.baseDamage>=60; score += 60
|
if move.baseDamage>=60
|
||||||
elsif move.damagingMove?; score += 30
|
score += 60
|
||||||
elsif move.function=="0F2"; score += 70 # Trick
|
elsif move.damagingMove?
|
||||||
else; score -= 60
|
score += 30
|
||||||
|
elsif move.function=="0F2"
|
||||||
|
score += 70 # Trick
|
||||||
|
else
|
||||||
|
score -= 60
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# If user is asleep, prefer moves that are usable while asleep
|
# If user is asleep, prefer moves that are usable while asleep
|
||||||
|
|||||||
@@ -166,11 +166,14 @@ class PokeBattle_AI
|
|||||||
agender = user.gender
|
agender = user.gender
|
||||||
ogender = target.gender
|
ogender = target.gender
|
||||||
if agender==2 || ogender==2 || agender==ogender
|
if agender==2 || ogender==2 || agender==ogender
|
||||||
score -= 90; canattract = false
|
score -= 90
|
||||||
|
canattract = false
|
||||||
elsif target.effects[PBEffects::Attract]>=0
|
elsif target.effects[PBEffects::Attract]>=0
|
||||||
score -= 80; canattract = false
|
score -= 80
|
||||||
|
canattract = false
|
||||||
elsif skill>=PBTrainerAI.bestSkill && target.hasActiveAbility?(:OBLIVIOUS)
|
elsif skill>=PBTrainerAI.bestSkill && target.hasActiveAbility?(:OBLIVIOUS)
|
||||||
score -= 80; canattract = false
|
score -= 80
|
||||||
|
canattract = false
|
||||||
end
|
end
|
||||||
if skill>=PBTrainerAI.highSkill
|
if skill>=PBTrainerAI.highSkill
|
||||||
if canattract && target.hasActiveItem?(:DESTINYKNOT) &&
|
if canattract && target.hasActiveItem?(:DESTINYKNOT) &&
|
||||||
@@ -727,7 +730,8 @@ class PokeBattle_AI
|
|||||||
end
|
end
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "037"
|
when "037"
|
||||||
avgStat = 0; canChangeStat = false
|
avgStat = 0
|
||||||
|
canChangeStat = false
|
||||||
GameData::Stat.each_battle do |s|
|
GameData::Stat.each_battle do |s|
|
||||||
next if target.statStageAtMax?(s.id)
|
next if target.statStageAtMax?(s.id)
|
||||||
avgStat -= target.stages[s.id]
|
avgStat -= target.stages[s.id]
|
||||||
@@ -1116,7 +1120,8 @@ class PokeBattle_AI
|
|||||||
if target.effects[PBEffects::Substitute]>0
|
if target.effects[PBEffects::Substitute]>0
|
||||||
score -= 90
|
score -= 90
|
||||||
else
|
else
|
||||||
avg = 0; anyChange = false
|
avg = 0
|
||||||
|
anyChange = false
|
||||||
GameData::Stat.each_battle do |s|
|
GameData::Stat.each_battle do |s|
|
||||||
next if target.stages[s.id]==0
|
next if target.stages[s.id]==0
|
||||||
avg += target.stages[s.id]
|
avg += target.stages[s.id]
|
||||||
@@ -1178,7 +1183,8 @@ class PokeBattle_AI
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "054"
|
when "054"
|
||||||
if skill>=PBTrainerAI.mediumSkill
|
if skill>=PBTrainerAI.mediumSkill
|
||||||
userStages = 0; targetStages = 0
|
userStages = 0
|
||||||
|
targetStages = 0
|
||||||
GameData::Stat.each_battle do |s|
|
GameData::Stat.each_battle do |s|
|
||||||
userStages += user.stages[s.id]
|
userStages += user.stages[s.id]
|
||||||
targetStages += target.stages[s.id]
|
targetStages += target.stages[s.id]
|
||||||
@@ -2675,7 +2681,8 @@ class PokeBattle_AI
|
|||||||
if target.effects[PBEffects::Substitute]>0
|
if target.effects[PBEffects::Substitute]>0
|
||||||
score -= 90
|
score -= 90
|
||||||
else
|
else
|
||||||
numpos = 0; numneg = 0
|
numpos = 0
|
||||||
|
numneg = 0
|
||||||
GameData::Stat.each_battle do |s|
|
GameData::Stat.each_battle do |s|
|
||||||
numpos += target.stages[s.id] if target.stages[s.id] > 0
|
numpos += target.stages[s.id] if target.stages[s.id] > 0
|
||||||
numneg += target.stages[s.id] if target.stages[s.id] < 0
|
numneg += target.stages[s.id] if target.stages[s.id] < 0
|
||||||
|
|||||||
@@ -106,9 +106,12 @@ BallHandlers::ModifyCatchRate.add(:LEVELBALL,proc { |ball,catchRate,battle,battl
|
|||||||
battle.eachSameSideBattler do |b|
|
battle.eachSameSideBattler do |b|
|
||||||
maxlevel = b.level if b.level>maxlevel
|
maxlevel = b.level if b.level>maxlevel
|
||||||
end
|
end
|
||||||
if maxlevel>=battler.level*4; catchRate *= 8
|
if maxlevel >= battler.level * 4
|
||||||
elsif maxlevel>=battler.level*2; catchRate *= 4
|
catchRate *= 8
|
||||||
elsif maxlevel>battler.level; catchRate *= 2
|
elsif maxlevel >= battler.level * 2
|
||||||
|
catchRate *= 4
|
||||||
|
elsif maxlevel > battler.level
|
||||||
|
catchRate *= 2
|
||||||
end
|
end
|
||||||
next [catchRate,255].min
|
next [catchRate,255].min
|
||||||
})
|
})
|
||||||
@@ -123,15 +126,22 @@ BallHandlers::ModifyCatchRate.add(:HEAVYBALL,proc { |ball,catchRate,battle,battl
|
|||||||
next 0 if catchRate==0
|
next 0 if catchRate==0
|
||||||
weight = battler.pokemon.species_data.base_stats[:SPEED]
|
weight = battler.pokemon.species_data.base_stats[:SPEED]
|
||||||
if Settings::NEW_POKE_BALL_CATCH_RATES
|
if Settings::NEW_POKE_BALL_CATCH_RATES
|
||||||
if weight>=3000; catchRate += 30
|
if weight >= 3000
|
||||||
elsif weight>=2000; catchRate += 20
|
catchRate += 30
|
||||||
elsif weight<1000; catchRate -= 20
|
elsif weight >= 2000
|
||||||
|
catchRate += 20
|
||||||
|
elsif weight < 1000
|
||||||
|
catchRate -= 20
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if weight>=4096; catchRate += 40
|
if weight >= 4096
|
||||||
elsif weight>=3072; catchRate += 30
|
catchRate += 40
|
||||||
elsif weight>=2048; catchRate += 20
|
elsif weight >= 3072
|
||||||
else; catchRate -= 20
|
catchRate += 30
|
||||||
|
elsif weight >= 2048
|
||||||
|
catchRate += 20
|
||||||
|
else
|
||||||
|
catchRate -= 20
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
catchRate = [catchRate,1].max
|
catchRate = [catchRate,1].max
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ class PokeBattle_Scene
|
|||||||
# animations (including cry)
|
# animations (including cry)
|
||||||
@animations.push(BattleIntroAnimation2.new(@sprites,@viewport,@battle.sideSizes[1]))
|
@animations.push(BattleIntroAnimation2.new(@sprites,@viewport,@battle.sideSizes[1]))
|
||||||
# Play all the animations
|
# Play all the animations
|
||||||
while inPartyAnimation?; pbUpdate; end
|
while inPartyAnimation?
|
||||||
|
pbUpdate
|
||||||
|
end
|
||||||
# Show shiny animation for wild Pokémon
|
# Show shiny animation for wild Pokémon
|
||||||
if @battle.showAnims
|
if @battle.showAnims
|
||||||
for i in 0...@battle.sideSizes[1]
|
for i in 0...@battle.sideSizes[1]
|
||||||
@@ -59,7 +61,9 @@ class PokeBattle_Scene
|
|||||||
@animations.push(LineupAppearAnimation.new(@sprites,@viewport,
|
@animations.push(LineupAppearAnimation.new(@sprites,@viewport,
|
||||||
side,@battle.pbParty(side),@battle.pbPartyStarts(side),fullAnim))
|
side,@battle.pbParty(side),@battle.pbPartyStarts(side),fullAnim))
|
||||||
if !fullAnim
|
if !fullAnim
|
||||||
while inPartyAnimation?; pbUpdate; end
|
while inPartyAnimation?
|
||||||
|
pbUpdate
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -73,7 +77,9 @@ class PokeBattle_Scene
|
|||||||
appearAnim = TrainerAppearAnimation.new(@sprites,@viewport,idxTrainer)
|
appearAnim = TrainerAppearAnimation.new(@sprites,@viewport,idxTrainer)
|
||||||
@animations.push(appearAnim)
|
@animations.push(appearAnim)
|
||||||
# Play the animation
|
# Play the animation
|
||||||
while inPartyAnimation?; pbUpdate; end
|
while inPartyAnimation?
|
||||||
|
pbUpdate
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
@@ -86,7 +92,9 @@ class PokeBattle_Scene
|
|||||||
return if sendOuts.length==0
|
return if sendOuts.length==0
|
||||||
# If party balls are still appearing, wait for them to finish showing up, as
|
# If party balls are still appearing, wait for them to finish showing up, as
|
||||||
# the FadeAnimation will make them disappear.
|
# the FadeAnimation will make them disappear.
|
||||||
while inPartyAnimation?; pbUpdate; end
|
while inPartyAnimation?
|
||||||
|
pbUpdate
|
||||||
|
end
|
||||||
@briefMessage = false
|
@briefMessage = false
|
||||||
# Make all trainers and party lineups disappear (player-side trainers may
|
# Make all trainers and party lineups disappear (player-side trainers may
|
||||||
# animate throwing a Poké Ball)
|
# animate throwing a Poké Ball)
|
||||||
@@ -130,7 +138,10 @@ class PokeBattle_Scene
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
fadeAnim.dispose
|
fadeAnim.dispose
|
||||||
sendOutAnims.each { |a| a[0].dispose; a[1].dispose }
|
sendOutAnims.each do |a|
|
||||||
|
a[0].dispose
|
||||||
|
a[1].dispose
|
||||||
|
end
|
||||||
# Play shininess animations for shiny Pokémon
|
# Play shininess animations for shiny Pokémon
|
||||||
sendOuts.each do |b|
|
sendOuts.each do |b|
|
||||||
next if !@battle.showAnims || !@battle.battlers[b[0]].shiny?
|
next if !@battle.showAnims || !@battle.battlers[b[0]].shiny?
|
||||||
@@ -274,7 +285,9 @@ class PokeBattle_Scene
|
|||||||
expRange = endExp-startExp
|
expRange = endExp-startExp
|
||||||
dataBox = @sprites["dataBox_#{battler.index}"]
|
dataBox = @sprites["dataBox_#{battler.index}"]
|
||||||
dataBox.animateExp(startExpLevel,endExpLevel,expRange)
|
dataBox.animateExp(startExpLevel,endExpLevel,expRange)
|
||||||
while dataBox.animatingExp; pbUpdate; end
|
while dataBox.animatingExp
|
||||||
|
pbUpdate
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ class PBAnimation < Array
|
|||||||
@position = 4 # 1=target, 2=user, 3=user and target, 4=screen
|
@position = 4 # 1=target, 2=user, 3=user and target, 4=screen
|
||||||
@array = []
|
@array = []
|
||||||
size = 1 if size<1 # Always create at least one frame
|
size = 1 if size<1 # Always create at least one frame
|
||||||
size.times do; addFrame; end
|
size.times { addFrame }
|
||||||
@timing = []
|
@timing = []
|
||||||
@scope = 0
|
@scope = 0
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,10 +20,14 @@ class PokeBattle_SuccessState
|
|||||||
if @useState==1
|
if @useState==1
|
||||||
@skill = -2 if !@protected
|
@skill = -2 if !@protected
|
||||||
elsif @useState==2
|
elsif @useState==2
|
||||||
if Effectiveness.super_effective?(@typeMod); @skill = 2
|
if Effectiveness.super_effective?(@typeMod)
|
||||||
elsif Effectiveness.normal?(@typeMod); @skill = 1
|
@skill = 2
|
||||||
elsif Effectiveness.not_very_effective?(@typeMod); @skill = -1
|
elsif Effectiveness.normal?(@typeMod)
|
||||||
else; @skill = -2 # Ineffective
|
@skill = 1
|
||||||
|
elsif Effectiveness.not_very_effective?(@typeMod)
|
||||||
|
@skill = -1
|
||||||
|
else # Ineffective
|
||||||
|
@skill = -2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
clear(false)
|
clear(false)
|
||||||
|
|||||||
@@ -41,8 +41,10 @@ class PokeBattle_Battle
|
|||||||
if @rules["suddendeath"] && @decision==0
|
if @rules["suddendeath"] && @decision==0
|
||||||
p1able = pbAbleCount(0)
|
p1able = pbAbleCount(0)
|
||||||
p2able = pbAbleCount(1)
|
p2able = pbAbleCount(1)
|
||||||
if p1able>p2able; @decision = 1 # loss
|
if p1able>p2able
|
||||||
elsif p1able<p2able; @decision = 2 # win
|
@decision = 1 # loss
|
||||||
|
elsif p1able<p2able
|
||||||
|
@decision = 2 # win
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -157,9 +157,12 @@ def pbPrepareBattle(battle)
|
|||||||
battle.time = 2 # This makes Dusk Balls work properly in caves
|
battle.time = 2 # This makes Dusk Balls work properly in caves
|
||||||
elsif Settings::TIME_SHADING
|
elsif Settings::TIME_SHADING
|
||||||
timeNow = pbGetTimeNow
|
timeNow = pbGetTimeNow
|
||||||
if PBDayNight.isNight?(timeNow); battle.time = 2
|
if PBDayNight.isNight?(timeNow)
|
||||||
elsif PBDayNight.isEvening?(timeNow); battle.time = 1
|
battle.time = 2
|
||||||
else; battle.time = 0
|
elsif PBDayNight.isEvening?(timeNow)
|
||||||
|
battle.time = 1
|
||||||
|
else
|
||||||
|
battle.time = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -79,8 +79,10 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
|||||||
2.times do
|
2.times do
|
||||||
viewport.color.alpha = 0
|
viewport.color.alpha = 0
|
||||||
for i in 0...halfFlashTime*2
|
for i in 0...halfFlashTime*2
|
||||||
if i<halfFlashTime; viewport.color.alpha += alphaDiff
|
if i<halfFlashTime
|
||||||
else; viewport.color.alpha -= alphaDiff
|
viewport.color.alpha += alphaDiff
|
||||||
|
else
|
||||||
|
viewport.color.alpha -= alphaDiff
|
||||||
end
|
end
|
||||||
Graphics.update
|
Graphics.update
|
||||||
pbUpdateSceneMap
|
pbUpdateSceneMap
|
||||||
|
|||||||
@@ -542,9 +542,12 @@ def pbHeadbuttEffect(event=nil)
|
|||||||
a = (a*2/5)%10 # Even 2x as likely as odd, 0 is 1.5x as likely as odd
|
a = (a*2/5)%10 # Even 2x as likely as odd, 0 is 1.5x as likely as odd
|
||||||
b = $Trainer.public_ID % 10 # Practically equal odds of each value
|
b = $Trainer.public_ID % 10 # Practically equal odds of each value
|
||||||
chance = 1 # ~50%
|
chance = 1 # ~50%
|
||||||
if a==b; chance = 8 # 10%
|
if a==b # 10%
|
||||||
elsif a>b && (a-b).abs<5; chance = 5 # ~30.3%
|
chance = 8
|
||||||
elsif a<b && (a-b).abs>5; chance = 5 # ~9.7%
|
elsif a>b && (a-b).abs<5 # ~30.3%
|
||||||
|
chance = 5
|
||||||
|
elsif a<b && (a-b).abs>5 # ~9.7%
|
||||||
|
chance = 5
|
||||||
end
|
end
|
||||||
if rand(10)>=chance
|
if rand(10)>=chance
|
||||||
pbMessage(_INTL("Nope. Nothing..."))
|
pbMessage(_INTL("Nope. Nothing..."))
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# This class is designed to favor different values more than a uniform
|
# Code that generates a random dungeon layout, and implements it in a given map.
|
||||||
# random generator does
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class AntiRandom
|
module RandomDungeonGenerator
|
||||||
|
#=============================================================================
|
||||||
|
# This class is designed to favor different values more than a uniform
|
||||||
|
# random generator does.
|
||||||
|
#=============================================================================
|
||||||
|
class AntiRandom
|
||||||
def initialize(size)
|
def initialize(size)
|
||||||
@old = []
|
@old = []
|
||||||
@new = Array.new(size) { |i| i }
|
@new = Array.new(size) { |i| i }
|
||||||
@@ -23,18 +27,19 @@ class AntiRandom
|
|||||||
end
|
end
|
||||||
return @old[rand(@old.length)] # Get old value
|
return @old[rand(@old.length)] # Get old value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
#
|
# Contains constants that define what types of tiles a random dungeon map can
|
||||||
#===============================================================================
|
# consist of, and helper methods that translate those tiles into data usable
|
||||||
module DungeonTile
|
# by a map/printable to the console (for debug purposes).
|
||||||
|
#=============================================================================
|
||||||
|
module DungeonTile
|
||||||
VOID = 0
|
VOID = 0
|
||||||
ROOM = 1
|
ROOM = 1
|
||||||
WALL = 2
|
WALL = 2
|
||||||
CORRIDOR = 3
|
CORRIDOR = 3
|
||||||
|
# Which autotile each type of tile uses (1-7)
|
||||||
# Which autotile each type of tile uses
|
|
||||||
TILE_IDS = {
|
TILE_IDS = {
|
||||||
VOID => 1,
|
VOID => 1,
|
||||||
ROOM => 2,
|
ROOM => 2,
|
||||||
@@ -58,12 +63,12 @@ module DungeonTile
|
|||||||
def to_text(value)
|
def to_text(value)
|
||||||
return TEXT_SYMBOLS[value] || TEXT_SYMBOLS[VOID]
|
return TEXT_SYMBOLS[value] || TEXT_SYMBOLS[VOID]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
# Helper functions that sets tiles in the map to a particular type.
|
# Helper functions that set tiles in the map to a particular type.
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
module DungeonMaze
|
module DungeonMaze
|
||||||
CELL_WIDTH = 13 # Should be at least 7
|
CELL_WIDTH = 13 # Should be at least 7
|
||||||
CELL_HEIGHT = 13 # Should be at least 7
|
CELL_HEIGHT = 13 # Should be at least 7
|
||||||
ROOM_MIN_WIDTH = 5
|
ROOM_MIN_WIDTH = 5
|
||||||
@@ -109,7 +114,7 @@ module DungeonMaze
|
|||||||
return @@corridor_layouts
|
return @@corridor_layouts
|
||||||
end
|
end
|
||||||
|
|
||||||
# Makes all tiles in a particular area corridor tiles
|
# Makes all tiles in a particular area corridor tiles.
|
||||||
def paint_corridor(tile, x, y, width, height)
|
def paint_corridor(tile, x, y, width, height)
|
||||||
for j in 0...height
|
for j in 0...height
|
||||||
for i in 0...width
|
for i in 0...width
|
||||||
@@ -118,7 +123,7 @@ module DungeonMaze
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Used to draw tiles from the given tile_layout and rotation (for corridors)
|
# Used to draw tiles from the given tile_layout and rotation (for corridors).
|
||||||
def paint_tile_layout(dungeon, dstX, dstY, tile_layout, rotation)
|
def paint_tile_layout(dungeon, dstX, dstY, tile_layout, rotation)
|
||||||
case rotation
|
case rotation
|
||||||
when None
|
when None
|
||||||
@@ -148,8 +153,8 @@ module DungeonMaze
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Draws a cell's contents, which is an underlying pattern based on tile_layout
|
# Draws a cell's contents, which is an underlying pattern based on tile
|
||||||
# and a rotation, and possibly a room on top of that
|
#_layout and a rotation (the corridors), and possibly a room on top of that.
|
||||||
def paint_cell_contents(dungeon, xDst, yDst, tile_layout, rotation)
|
def paint_cell_contents(dungeon, xDst, yDst, tile_layout, rotation)
|
||||||
return false if !tile_layout
|
return false if !tile_layout
|
||||||
# Draw the corridors
|
# Draw the corridors
|
||||||
@@ -169,23 +174,24 @@ module DungeonMaze
|
|||||||
dungeon.paint_room(rect, xDst, yDst)
|
dungeon.paint_room(rect, xDst, yDst)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
#
|
# Bitwise values used to keep track of the generation of node connections.
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
module EdgeMasks
|
module EdgeMasks
|
||||||
North = 1
|
North = 1
|
||||||
West = 2
|
West = 2
|
||||||
East = 4
|
East = 4
|
||||||
South = 8
|
South = 8
|
||||||
Visited = 16
|
Visited = 16
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
#
|
# A node in a randomly generated dungeon. There is one node per cell, and
|
||||||
#===============================================================================
|
# nodes are connected to each other.
|
||||||
class MazeNode
|
#=============================================================================
|
||||||
|
class MazeNode
|
||||||
def initialize
|
def initialize
|
||||||
@edges = 0
|
@edges = 0
|
||||||
end
|
end
|
||||||
@@ -196,30 +202,29 @@ class MazeNode
|
|||||||
def set; @edges = 15; end
|
def set; @edges = 15; end
|
||||||
def getEdge(e); return (@edges & e) != 0; end
|
def getEdge(e); return (@edges & e) != 0; end
|
||||||
def isBlocked?; return @edges != 0; end
|
def isBlocked?; return @edges != 0; end
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
#
|
# Vector class representing the location of a node.
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
class NodeListElement
|
class NodeListElement
|
||||||
attr_accessor :x, :y
|
attr_accessor :x, :y
|
||||||
|
|
||||||
def initialize(x, y)
|
def initialize(x, y)
|
||||||
@x = x
|
@x = x
|
||||||
@y = y
|
@y = y
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
# Maze generator. Given the number of cells horizontally and vertically in a
|
# Maze generator. Given the number of cells horizontally and vertically in a
|
||||||
# map, connects all the cells together.
|
# map, connects all the cells together.
|
||||||
# A node is the boundary between two adjacent cells, which may or may not be a
|
# A node is the boundary between two adjacent cells, which may or may not be a
|
||||||
# connection.
|
# connection.
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
class Maze
|
class Maze
|
||||||
attr_accessor :cellWidth, :cellHeight, :nodeWidth, :nodeHeight
|
attr_accessor :cellWidth, :cellHeight, :nodeWidth, :nodeHeight
|
||||||
|
DIRECTIONS = [EdgeMasks::North, EdgeMasks::South, EdgeMasks::East, EdgeMasks::West]
|
||||||
@@dirs = [EdgeMasks::North, EdgeMasks::South, EdgeMasks::East, EdgeMasks::West]
|
|
||||||
|
|
||||||
def initialize(cw, ch)
|
def initialize(cw, ch)
|
||||||
raise ArgumentError.new if cw == 0 || ch == 0
|
raise ArgumentError.new if cw == 0 || ch == 0
|
||||||
@@ -229,11 +234,11 @@ class Maze
|
|||||||
@nodeHeight = ch + 1
|
@nodeHeight = ch + 1
|
||||||
@cells = []
|
@cells = []
|
||||||
clearAllCells
|
clearAllCells
|
||||||
@nodes = Array.new(@nodeWidth * @nodeHeight) { |i| MazeNode.new }
|
@nodes = Array.new(@nodeWidth * @nodeHeight) { MazeNode.new }
|
||||||
end
|
end
|
||||||
|
|
||||||
def randomDir
|
def randomDir
|
||||||
return @@dirs[rand(4)]
|
return DIRECTIONS[rand(4)]
|
||||||
end
|
end
|
||||||
|
|
||||||
def getVisited(x, y)
|
def getVisited(x, y)
|
||||||
@@ -391,7 +396,7 @@ class Maze
|
|||||||
|
|
||||||
def recurseDepthFirst(x, y, depth)
|
def recurseDepthFirst(x, y, depth)
|
||||||
setVisited(x, y)
|
setVisited(x, y)
|
||||||
dirs = @@dirs.shuffle
|
dirs = DIRECTIONS.shuffle
|
||||||
for c in 0...4
|
for c in 0...4
|
||||||
d = dirs[c]
|
d = dirs[c]
|
||||||
cx = x
|
cx = x
|
||||||
@@ -424,12 +429,28 @@ class Maze
|
|||||||
# Generate a maze
|
# Generate a maze
|
||||||
recurseDepthFirst(sx, sy, 0)
|
recurseDepthFirst(sx, sy, 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Random dungeon generator class. Calls class Maze to generate the abstract
|
||||||
|
# layout of the dungeon, and turns that into usable map data.
|
||||||
|
#=============================================================================
|
||||||
|
class Dungeon
|
||||||
|
class DungeonTable
|
||||||
|
def initialize(dungeon)
|
||||||
|
@dungeon = dungeon
|
||||||
|
end
|
||||||
|
|
||||||
|
def xsize; @dungeon.width; end
|
||||||
|
def ysize; @dungeon.height; end
|
||||||
|
|
||||||
|
# Returns which tile in the tileset corresponds to the type of tile is at
|
||||||
|
# the given coordinates
|
||||||
|
def [](x, y)
|
||||||
|
return DungeonTile.to_tile_id(@dungeon[x, y])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#===============================================================================
|
|
||||||
#
|
|
||||||
#===============================================================================
|
|
||||||
class Dungeon
|
|
||||||
attr_accessor :width, :height
|
attr_accessor :width, :height
|
||||||
BUFFER_X = 8
|
BUFFER_X = 8
|
||||||
BUFFER_Y = 6
|
BUFFER_Y = 6
|
||||||
@@ -575,21 +596,6 @@ class Dungeon
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class DungeonTable
|
|
||||||
def initialize(dungeon)
|
|
||||||
@dungeon = dungeon
|
|
||||||
end
|
|
||||||
|
|
||||||
def xsize; @dungeon.width; end
|
|
||||||
def ysize; @dungeon.height; end
|
|
||||||
|
|
||||||
# Returns which tile in the tileset corresponds to the type of tile is at
|
|
||||||
# the given coordinates
|
|
||||||
def [](x, y)
|
|
||||||
return DungeonTile.to_tile_id(@dungeon[x, y])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Convert dungeon layout into proper map tiles
|
# Convert dungeon layout into proper map tiles
|
||||||
def generateMapInPlace(map)
|
def generateMapInPlace(map)
|
||||||
tbl = DungeonTable.new(self)
|
tbl = DungeonTable.new(self)
|
||||||
@@ -603,14 +609,14 @@ class Dungeon
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#=============================================================================
|
||||||
# Get a random room tile that isn't too close to a corridor (to avoid blocking
|
# Get a random room tile that isn't too close to a corridor (to avoid blocking
|
||||||
# a room's entrance)
|
# a room's entrance).
|
||||||
def pbRandomRoomTile(dungeon, tiles)
|
def self.pbRandomRoomTile(dungeon, tiles)
|
||||||
ar1 = AntiRandom.new(dungeon.width)
|
ar1 = AntiRandom.new(dungeon.width)
|
||||||
ar2 = AntiRandom.new(dungeon.height)
|
ar2 = AntiRandom.new(dungeon.height)
|
||||||
((tiles.length + 1) * 1000).times do
|
((tiles.length + 1) * 1000).times do
|
||||||
@@ -624,6 +630,17 @@ def pbRandomRoomTile(dungeon, tiles)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test method that generates a dungeon map and prints it to the console.
|
||||||
|
# @param x_cells [Integer] the number of cells wide the dungeon will be
|
||||||
|
# @param y_cells [Intenger] the number of cells tall the dungeon will be
|
||||||
|
def self.generate_test_dungeon(x_cells = 4, y_cells = 4)
|
||||||
|
dungeon = Dungeon.new(Dungeon::BUFFER_X * 2 + DungeonMaze::CELL_WIDTH * x_cells,
|
||||||
|
Dungeon::BUFFER_Y * 2 + DungeonMaze::CELL_HEIGHT * y_cells)
|
||||||
|
dungeon.generate
|
||||||
|
echoln dungeon.write
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onMapCreate += proc { |_sender, e|
|
Events.onMapCreate += proc { |_sender, e|
|
||||||
@@ -632,29 +649,22 @@ Events.onMapCreate += proc { |_sender, e|
|
|||||||
next if !GameData::MapMetadata.exists?(mapID) ||
|
next if !GameData::MapMetadata.exists?(mapID) ||
|
||||||
!GameData::MapMetadata.get(mapID).random_dungeon
|
!GameData::MapMetadata.get(mapID).random_dungeon
|
||||||
# this map is a randomly generated dungeon
|
# this map is a randomly generated dungeon
|
||||||
dungeon = Dungeon.new(map.width, map.height)
|
dungeon = RandomDungeonGenerator::Dungeon.new(map.width, map.height)
|
||||||
dungeon.generate
|
dungeon.generate
|
||||||
dungeon.generateMapInPlace(map)
|
dungeon.generateMapInPlace(map)
|
||||||
roomtiles = []
|
roomtiles = []
|
||||||
# Reposition events
|
# Reposition events
|
||||||
for event in map.events.values
|
for event in map.events.values
|
||||||
tile = pbRandomRoomTile(dungeon, roomtiles)
|
tile = RandomDungeonGenerator.pbRandomRoomTile(dungeon, roomtiles)
|
||||||
if tile
|
if tile
|
||||||
event.x = tile[0]
|
event.x = tile[0]
|
||||||
event.y = tile[1]
|
event.y = tile[1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Override transfer X and Y
|
# Override transfer X and Y
|
||||||
tile = pbRandomRoomTile(dungeon, roomtiles)
|
tile = RandomDungeonGenerator.pbRandomRoomTile(dungeon, roomtiles)
|
||||||
if tile
|
if tile
|
||||||
$game_temp.player_new_x = tile[0]
|
$game_temp.player_new_x = tile[0]
|
||||||
$game_temp.player_new_y = tile[1]
|
$game_temp.player_new_y = tile[1]
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
def generate_test_dungeon(x_cells = 4, y_cells = 4)
|
|
||||||
dungeon = Dungeon.new(Dungeon::BUFFER_X * 2 + DungeonMaze::CELL_WIDTH * x_cells,
|
|
||||||
Dungeon::BUFFER_Y * 2 + DungeonMaze::CELL_HEIGHT * y_cells)
|
|
||||||
dungeon.generate
|
|
||||||
echoln dungeon.write
|
|
||||||
end
|
|
||||||
|
|||||||
@@ -185,7 +185,8 @@ ItemHandlers::UseInField.add(:SACREDASH,proc { |item|
|
|||||||
canrevive = false
|
canrevive = false
|
||||||
for i in $Trainer.pokemon_party
|
for i in $Trainer.pokemon_party
|
||||||
next if !i.fainted?
|
next if !i.fainted?
|
||||||
canrevive = true; break
|
canrevive = true
|
||||||
|
break
|
||||||
end
|
end
|
||||||
if !canrevive
|
if !canrevive
|
||||||
pbMessage(_INTL("It won't have any effect."))
|
pbMessage(_INTL("It won't have any effect."))
|
||||||
|
|||||||
@@ -434,10 +434,9 @@ MultipleForms.register(:AEGISLASH,{
|
|||||||
MultipleForms.register(:PUMPKABOO,{
|
MultipleForms.register(:PUMPKABOO,{
|
||||||
"getFormOnCreation" => proc { |pkmn|
|
"getFormOnCreation" => proc { |pkmn|
|
||||||
r = rand(100)
|
r = rand(100)
|
||||||
if r<5; next 3 # Super Size (5%)
|
next 3 if r < 5 # Super Size (5%)
|
||||||
elsif r<20; next 2 # Large (15%)
|
next 2 if r < 20 # Large (15%)
|
||||||
elsif r<65; next 1 # Average (45%)
|
next 1 if r < 65 # Average (45%)
|
||||||
end
|
|
||||||
next 0 # Small (35%)
|
next 0 # Small (35%)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -172,8 +172,10 @@ class PokemonIconSprite < SpriteWrapper
|
|||||||
# ret is initially the time a whole animation cycle lasts. It is divided by
|
# ret is initially the time a whole animation cycle lasts. It is divided by
|
||||||
# the number of frames in that cycle at the end.
|
# the number of frames in that cycle at the end.
|
||||||
ret = Graphics.frame_rate/4 # Green HP - 0.25 seconds
|
ret = Graphics.frame_rate/4 # Green HP - 0.25 seconds
|
||||||
if @pokemon.hp<=@pokemon.totalhp/4; ret *= 4 # Red HP - 1 second
|
if @pokemon.hp<=@pokemon.totalhp/4 # Red HP - 1 second
|
||||||
elsif @pokemon.hp<=@pokemon.totalhp/2; ret *= 2 # Yellow HP - 0.5 seconds
|
ret *= 4
|
||||||
|
elsif @pokemon.hp<=@pokemon.totalhp/2 # Yellow HP - 0.5 seconds
|
||||||
|
ret *= 2
|
||||||
end
|
end
|
||||||
ret /= @numFrames
|
ret /= @numFrames
|
||||||
ret = 1 if ret<1
|
ret = 1 if ret<1
|
||||||
|
|||||||
@@ -108,7 +108,8 @@ class PokemonStorage
|
|||||||
@unlockedWallpapers = [] if !@unlockedWallpapers
|
@unlockedWallpapers = [] if !@unlockedWallpapers
|
||||||
for i in 0...papers.length
|
for i in 0...papers.length
|
||||||
next if !isAvailableWallpaper?(i)
|
next if !isAvailableWallpaper?(i)
|
||||||
ret[0].push(papers[i]); ret[1].push(i)
|
ret[0].push(papers[i])
|
||||||
|
ret[1].push(i)
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1110,7 +1110,7 @@ class Pokemon
|
|||||||
# @param level [Integer] Pokémon level
|
# @param level [Integer] Pokémon level
|
||||||
# @param owner [Owner, Player, NPCTrainer] Pokémon owner (the player by default)
|
# @param owner [Owner, Player, NPCTrainer] Pokémon owner (the player by default)
|
||||||
# @param withMoves [TrueClass, FalseClass] whether the Pokémon should have moves
|
# @param withMoves [TrueClass, FalseClass] whether the Pokémon should have moves
|
||||||
# @param rechech_form [TrueClass, FalseClass] whether to auto-check the form
|
# @param recheck_form [TrueClass, FalseClass] whether to auto-check the form
|
||||||
def initialize(species, level, owner = $Trainer, withMoves = true, recheck_form = true)
|
def initialize(species, level, owner = $Trainer, withMoves = true, recheck_form = true)
|
||||||
species_data = GameData::Species.get(species)
|
species_data = GameData::Species.get(species)
|
||||||
@species = species_data.species
|
@species = species_data.species
|
||||||
|
|||||||
@@ -73,8 +73,10 @@ class Pokemon
|
|||||||
|
|
||||||
def makeUnprimal
|
def makeUnprimal
|
||||||
v = MultipleForms.call("getUnprimalForm", self)
|
v = MultipleForms.call("getUnprimalForm", self)
|
||||||
if !v.nil?; self.form = v
|
if !v.nil?
|
||||||
elsif primal?; self.form = 0
|
self.form = v
|
||||||
|
elsif primal?
|
||||||
|
self.form = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class Player < Trainer
|
|||||||
# Returns whether there are any seen Pokémon.
|
# Returns whether there are any seen Pokémon.
|
||||||
# If a region is given, returns whether there are seen Pokémon
|
# If a region is given, returns whether there are seen Pokémon
|
||||||
# in that region.
|
# in that region.
|
||||||
# @param region [Integer] region ID
|
# @param dex [Integer] region ID
|
||||||
# @return [Boolean] whether there are any seen Pokémon
|
# @return [Boolean] whether there are any seen Pokémon
|
||||||
def seen_any?(dex = -1)
|
def seen_any?(dex = -1)
|
||||||
validate dex => Integer
|
validate dex => Integer
|
||||||
@@ -153,7 +153,7 @@ class Player < Trainer
|
|||||||
# Returns the amount of owned Pokémon.
|
# Returns the amount of owned Pokémon.
|
||||||
# If a region ID is given, returns the amount of owned Pokémon
|
# If a region ID is given, returns the amount of owned Pokémon
|
||||||
# in that region.
|
# in that region.
|
||||||
# @param region [Integer] region ID
|
# @param dex [Integer] region ID
|
||||||
def owned_count(dex = -1)
|
def owned_count(dex = -1)
|
||||||
validate dex => Integer
|
validate dex => Integer
|
||||||
return self.count_species(@owned, dex)
|
return self.count_species(@owned, dex)
|
||||||
@@ -161,7 +161,7 @@ class Player < Trainer
|
|||||||
|
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
|
|
||||||
# @param pkmn [Pokemon, Symbol, GameData::Species] Pokemon to register as seen
|
# @param species [Pokemon, Symbol, GameData::Species] Pokemon to register as seen
|
||||||
# @param gender [Integer] gender to register (0=male, 1=female, 2=genderless)
|
# @param gender [Integer] gender to register (0=male, 1=female, 2=genderless)
|
||||||
# @param form [Integer] form to register
|
# @param form [Integer] form to register
|
||||||
def register(species, gender = 0, form = 0, should_refresh_dexes = true)
|
def register(species, gender = 0, form = 0, should_refresh_dexes = true)
|
||||||
|
|||||||
@@ -103,27 +103,39 @@ class PokedexSearchSelectionSprite < SpriteWrapper
|
|||||||
@mode = value
|
@mode = value
|
||||||
case @mode
|
case @mode
|
||||||
when 0 # Order
|
when 0 # Order
|
||||||
@xstart = 46; @ystart = 128
|
@xstart = 46
|
||||||
@xgap = 236; @ygap = 64
|
@ystart = 128
|
||||||
|
@xgap = 236
|
||||||
|
@ygap = 64
|
||||||
@cols = 2
|
@cols = 2
|
||||||
when 1 # Name
|
when 1 # Name
|
||||||
@xstart = 78; @ystart = 114
|
@xstart = 78
|
||||||
@xgap = 52; @ygap = 52
|
@ystart = 114
|
||||||
|
@xgap = 52
|
||||||
|
@ygap = 52
|
||||||
@cols = 7
|
@cols = 7
|
||||||
when 2 # Type
|
when 2 # Type
|
||||||
@xstart = 8; @ystart = 104
|
@xstart = 8
|
||||||
@xgap = 124; @ygap = 44
|
@ystart = 104
|
||||||
|
@xgap = 124
|
||||||
|
@ygap = 44
|
||||||
@cols = 4
|
@cols = 4
|
||||||
when 3,4 # Height, weight
|
when 3,4 # Height, weight
|
||||||
@xstart = 44; @ystart = 110
|
@xstart = 44
|
||||||
@xgap = 8; @ygap = 112
|
@ystart = 110
|
||||||
|
@xgap = 8
|
||||||
|
@ygap = 112
|
||||||
when 5 # Color
|
when 5 # Color
|
||||||
@xstart = 62; @ystart = 114
|
@xstart = 62
|
||||||
@xgap = 132; @ygap = 52
|
@ystart = 114
|
||||||
|
@xgap = 132
|
||||||
|
@ygap = 52
|
||||||
@cols = 3
|
@cols = 3
|
||||||
when 6 # Shape
|
when 6 # Shape
|
||||||
@xstart = 82; @ystart = 116
|
@xstart = 82
|
||||||
@xgap = 70; @ygap = 70
|
@ystart = 116
|
||||||
|
@xgap = 70
|
||||||
|
@ygap = 70
|
||||||
@cols = 5
|
@cols = 5
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -133,46 +145,63 @@ class PokedexSearchSelectionSprite < SpriteWrapper
|
|||||||
if @mode==-1 # Main search screen
|
if @mode==-1 # Main search screen
|
||||||
case @index
|
case @index
|
||||||
when 0 # Order
|
when 0 # Order
|
||||||
self.src_rect.y = 0; self.src_rect.height = 44
|
self.src_rect.y = 0
|
||||||
|
self.src_rect.height = 44
|
||||||
when 1,5 # Name, color
|
when 1,5 # Name, color
|
||||||
self.src_rect.y = 44; self.src_rect.height = 44
|
self.src_rect.y = 44
|
||||||
|
self.src_rect.height = 44
|
||||||
when 2 # Type
|
when 2 # Type
|
||||||
self.src_rect.y = 88; self.src_rect.height = 44
|
self.src_rect.y = 88
|
||||||
|
self.src_rect.height = 44
|
||||||
when 3,4 # Height, weight
|
when 3,4 # Height, weight
|
||||||
self.src_rect.y = 132; self.src_rect.height = 44
|
self.src_rect.y = 132
|
||||||
|
self.src_rect.height = 44
|
||||||
when 6 # Shape
|
when 6 # Shape
|
||||||
self.src_rect.y = 176; self.src_rect.height = 68
|
self.src_rect.y = 176
|
||||||
|
self.src_rect.height = 68
|
||||||
else # Reset/start/cancel
|
else # Reset/start/cancel
|
||||||
self.src_rect.y = 244; self.src_rect.height = 40
|
self.src_rect.y = 244
|
||||||
|
self.src_rect.height = 40
|
||||||
end
|
end
|
||||||
case @index
|
case @index
|
||||||
when 0 # Order
|
when 0 # Order
|
||||||
self.x = 252; self.y = 52
|
self.x = 252
|
||||||
|
self.y = 52
|
||||||
when 1,2,3,4 # Name, type, height, weight
|
when 1,2,3,4 # Name, type, height, weight
|
||||||
self.x = 114; self.y = 110+(@index-1)*52
|
self.x = 114
|
||||||
|
self.y = 110 + (@index - 1) * 52
|
||||||
when 5 # Color
|
when 5 # Color
|
||||||
self.x = 382; self.y = 110
|
self.x = 382
|
||||||
|
self.y = 110
|
||||||
when 6 # Shape
|
when 6 # Shape
|
||||||
self.x = 420; self.y = 214
|
self.x = 420
|
||||||
|
self.y = 214
|
||||||
when 7,8,9 # Reset, start, cancel
|
when 7,8,9 # Reset, start, cancel
|
||||||
self.x = 4+(@index-7)*176; self.y = 334
|
self.x = 4 + (@index - 7) * 176
|
||||||
|
self.y = 334
|
||||||
end
|
end
|
||||||
else # Parameter screen
|
else # Parameter screen
|
||||||
case @index
|
case @index
|
||||||
when -2,-3 # OK, Cancel
|
when -2,-3 # OK, Cancel
|
||||||
self.src_rect.y = 244; self.src_rect.height = 40
|
self.src_rect.y = 244
|
||||||
|
self.src_rect.height = 40
|
||||||
else
|
else
|
||||||
case @mode
|
case @mode
|
||||||
when 0 # Order
|
when 0 # Order
|
||||||
self.src_rect.y = 0; self.src_rect.height = 44
|
self.src_rect.y = 0
|
||||||
|
self.src_rect.height = 44
|
||||||
when 1 # Name
|
when 1 # Name
|
||||||
self.src_rect.y = 284; self.src_rect.height = 44
|
self.src_rect.y = 284
|
||||||
|
self.src_rect.height = 44
|
||||||
when 2,5 # Type, color
|
when 2,5 # Type, color
|
||||||
self.src_rect.y = 44; self.src_rect.height = 44
|
self.src_rect.y = 44
|
||||||
|
self.src_rect.height = 44
|
||||||
when 3,4 # Height, weight
|
when 3,4 # Height, weight
|
||||||
self.src_rect.y = (@minmax==1) ? 328 : 424; self.src_rect.height = 96
|
self.src_rect.y = (@minmax == 1) ? 328 : 424
|
||||||
|
self.src_rect.height = 96
|
||||||
when 6 # Shape
|
when 6 # Shape
|
||||||
self.src_rect.y = 176; self.src_rect.height = 68
|
self.src_rect.y = 176
|
||||||
|
self.src_rect.height = 68
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
case @index
|
case @index
|
||||||
@@ -185,9 +214,11 @@ class PokedexSearchSelectionSprite < SpriteWrapper
|
|||||||
self.y = @ystart+(@cmds/@cols).floor*@ygap
|
self.y = @ystart+(@cmds/@cols).floor*@ygap
|
||||||
end
|
end
|
||||||
when -2 # OK
|
when -2 # OK
|
||||||
self.x = 4; self.y = 334
|
self.x = 4
|
||||||
|
self.y = 334
|
||||||
when -3 # Cancel
|
when -3 # Cancel
|
||||||
self.x = 356; self.y = 334
|
self.x = 356
|
||||||
|
self.y = 334
|
||||||
else
|
else
|
||||||
case @mode
|
case @mode
|
||||||
when 0,1,2,5,6 # Order, name, type, color, shape
|
when 0,1,2,5,6 # Order, name, type, color, shape
|
||||||
@@ -527,34 +558,57 @@ class PokemonPokedex_Scene
|
|||||||
textpos.push([title,102,(mode==6) ? 58 : 52,0,base,shadow])
|
textpos.push([title,102,(mode==6) ? 58 : 52,0,base,shadow])
|
||||||
case mode
|
case mode
|
||||||
when 0 # Order
|
when 0 # Order
|
||||||
xstart = 46; ystart = 128
|
xstart = 46
|
||||||
xgap = 236; ygap = 64
|
ystart = 128
|
||||||
halfwidth = 92; cols = 2
|
xgap = 236
|
||||||
selbuttony = 0; selbuttonheight = 44
|
ygap = 64
|
||||||
|
halfwidth = 92
|
||||||
|
cols = 2
|
||||||
|
selbuttony = 0
|
||||||
|
selbuttonheight = 44
|
||||||
when 1 # Name
|
when 1 # Name
|
||||||
xstart = 78; ystart = 114
|
xstart = 78
|
||||||
xgap = 52; ygap = 52
|
ystart = 114
|
||||||
halfwidth = 22; cols = 7
|
xgap = 52
|
||||||
selbuttony = 156; selbuttonheight = 44
|
ygap = 52
|
||||||
|
halfwidth = 22
|
||||||
|
cols = 7
|
||||||
|
selbuttony = 156
|
||||||
|
selbuttonheight = 44
|
||||||
when 2 # Type
|
when 2 # Type
|
||||||
xstart = 8; ystart = 104
|
xstart = 8
|
||||||
xgap = 124; ygap = 44
|
ystart = 104
|
||||||
halfwidth = 62; cols = 4
|
xgap = 124
|
||||||
selbuttony = 44; selbuttonheight = 44
|
ygap = 44
|
||||||
|
halfwidth = 62
|
||||||
|
cols = 4
|
||||||
|
selbuttony = 44
|
||||||
|
selbuttonheight = 44
|
||||||
when 3,4 # Height, weight
|
when 3,4 # Height, weight
|
||||||
xstart = 44; ystart = 110
|
xstart = 44
|
||||||
xgap = 304/(cmds.length+1); ygap = 112
|
ystart = 110
|
||||||
halfwidth = 60; cols = cmds.length+1
|
xgap = 304 / (cmds.length + 1)
|
||||||
|
ygap = 112
|
||||||
|
halfwidth = 60
|
||||||
|
cols = cmds.length + 1
|
||||||
when 5 # Color
|
when 5 # Color
|
||||||
xstart = 62; ystart = 114
|
xstart = 62
|
||||||
xgap = 132; ygap = 52
|
ystart = 114
|
||||||
halfwidth = 62; cols = 3
|
xgap = 132
|
||||||
selbuttony = 44; selbuttonheight = 44
|
ygap = 52
|
||||||
|
halfwidth = 62
|
||||||
|
cols = 3
|
||||||
|
selbuttony = 44
|
||||||
|
selbuttonheight = 44
|
||||||
when 6 # Shape
|
when 6 # Shape
|
||||||
xstart = 82; ystart = 116
|
xstart = 82
|
||||||
xgap = 70; ygap = 70
|
ystart = 116
|
||||||
halfwidth = 0; cols = 5
|
xgap = 70
|
||||||
selbuttony = 88; selbuttonheight = 68
|
ygap = 70
|
||||||
|
halfwidth = 0
|
||||||
|
cols = 5
|
||||||
|
selbuttony = 88
|
||||||
|
selbuttonheight = 68
|
||||||
end
|
end
|
||||||
# Draw selected option(s) text in top bar
|
# Draw selected option(s) text in top bar
|
||||||
case mode
|
case mode
|
||||||
@@ -870,23 +924,32 @@ class PokemonPokedex_Scene
|
|||||||
Input.update
|
Input.update
|
||||||
if mode==3 || mode==4
|
if mode==3 || mode==4
|
||||||
if Input.trigger?(Input::UP)
|
if Input.trigger?(Input::UP)
|
||||||
if index<-1; minmax = 0; index = selindex[minmax] # From OK/Cancel
|
if index<-1 # From OK/Cancel
|
||||||
elsif minmax==0; minmax = 1; index = selindex[minmax]
|
minmax = 0
|
||||||
|
index = selindex[minmax]
|
||||||
|
elsif minmax==0
|
||||||
|
minmax = 1
|
||||||
|
index = selindex[minmax]
|
||||||
end
|
end
|
||||||
if index!=oldindex || minmax!=oldminmax
|
if index!=oldindex || minmax!=oldminmax
|
||||||
pbPlayCursorSE
|
pbPlayCursorSE
|
||||||
pbRefreshDexSearchParam(mode,cmds,selindex,index)
|
pbRefreshDexSearchParam(mode,cmds,selindex,index)
|
||||||
end
|
end
|
||||||
elsif Input.trigger?(Input::DOWN)
|
elsif Input.trigger?(Input::DOWN)
|
||||||
if minmax==1; minmax = 0; index = selindex[minmax]
|
if minmax==1
|
||||||
elsif minmax==0; minmax = -1; index = -2
|
minmax = 0
|
||||||
|
index = selindex[minmax]
|
||||||
|
elsif minmax==0
|
||||||
|
minmax = -1
|
||||||
|
index = -2
|
||||||
end
|
end
|
||||||
if index!=oldindex || minmax!=oldminmax
|
if index!=oldindex || minmax!=oldminmax
|
||||||
pbPlayCursorSE
|
pbPlayCursorSE
|
||||||
pbRefreshDexSearchParam(mode,cmds,selindex,index)
|
pbRefreshDexSearchParam(mode,cmds,selindex,index)
|
||||||
end
|
end
|
||||||
elsif Input.repeat?(Input::LEFT)
|
elsif Input.repeat?(Input::LEFT)
|
||||||
if index==-3; index = -2
|
if index==-3
|
||||||
|
index = -2
|
||||||
elsif index>=-1
|
elsif index>=-1
|
||||||
if minmax==1 && index==-1
|
if minmax==1 && index==-1
|
||||||
index = cmds.length-1 if selindex[0]<cmds.length-1
|
index = cmds.length-1 if selindex[0]<cmds.length-1
|
||||||
@@ -902,10 +965,13 @@ class PokemonPokedex_Scene
|
|||||||
pbRefreshDexSearchParam(mode,cmds,selindex,index)
|
pbRefreshDexSearchParam(mode,cmds,selindex,index)
|
||||||
end
|
end
|
||||||
elsif Input.repeat?(Input::RIGHT)
|
elsif Input.repeat?(Input::RIGHT)
|
||||||
if index==-2; index = -3
|
if index==-2
|
||||||
|
index = -3
|
||||||
elsif index>=-1
|
elsif index>=-1
|
||||||
if minmax==1 && index>=cmds.length; index = 0
|
if minmax==1 && index>=cmds.length
|
||||||
elsif minmax==1 && index==cmds.length-1; index = -1
|
index = 0
|
||||||
|
elsif minmax==1 && index==cmds.length-1
|
||||||
|
index = -1
|
||||||
elsif index<cmds.length && !(minmax==1 && index<0)
|
elsif index<cmds.length && !(minmax==1 && index<0)
|
||||||
index += 1 if minmax==1 || selindex[1]==-1 ||
|
index += 1 if minmax==1 || selindex[1]==-1 ||
|
||||||
(selindex[1]<cmds.length && selindex[1]>=index+1)
|
(selindex[1]<cmds.length && selindex[1]>=index+1)
|
||||||
@@ -919,17 +985,24 @@ class PokemonPokedex_Scene
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if Input.trigger?(Input::UP)
|
if Input.trigger?(Input::UP)
|
||||||
if index==-1; index = cmds.length-1-(cmds.length-1)%cols-1 # From blank
|
if index==-1 # From blank
|
||||||
elsif index==-2; index = ((cmds.length-1)/cols).floor*cols # From OK
|
index = cmds.length-1-(cmds.length-1)%cols-1
|
||||||
elsif index==-3 && mode==0; index = cmds.length-1 # From Cancel
|
elsif index==-2 # From OK
|
||||||
elsif index==-3; index = -1 # From Cancel
|
index = ((cmds.length-1)/cols).floor*cols
|
||||||
elsif index>=cols; index -= cols
|
elsif index==-3 && mode==0 # From Cancel
|
||||||
|
index = cmds.length-1
|
||||||
|
elsif index==-3 # From Cancel
|
||||||
|
index = -1
|
||||||
|
elsif index>=cols
|
||||||
|
index -= cols
|
||||||
end
|
end
|
||||||
pbPlayCursorSE if index!=oldindex
|
pbPlayCursorSE if index!=oldindex
|
||||||
elsif Input.trigger?(Input::DOWN)
|
elsif Input.trigger?(Input::DOWN)
|
||||||
if index==-1; index = -3 # From blank
|
if index==-1 # From blank
|
||||||
|
index = -3
|
||||||
elsif index>=0
|
elsif index>=0
|
||||||
if index+cols<cmds.length; index += cols
|
if index+cols<cmds.length
|
||||||
|
index += cols
|
||||||
elsif (index/cols).floor<((cmds.length-1)/cols).floor
|
elsif (index/cols).floor<((cmds.length-1)/cols).floor
|
||||||
index = (index%cols<cols/2.0) ? cmds.length-1 : -1
|
index = (index%cols<cols/2.0) ? cmds.length-1 : -1
|
||||||
else
|
else
|
||||||
@@ -938,15 +1011,21 @@ class PokemonPokedex_Scene
|
|||||||
end
|
end
|
||||||
pbPlayCursorSE if index!=oldindex
|
pbPlayCursorSE if index!=oldindex
|
||||||
elsif Input.trigger?(Input::LEFT)
|
elsif Input.trigger?(Input::LEFT)
|
||||||
if index==-3; index = -2
|
if index==-3
|
||||||
elsif index==-1; index = cmds.length-1
|
index = -2
|
||||||
elsif index>0 && index%cols!=0; index -= 1
|
elsif index==-1
|
||||||
|
index = cmds.length-1
|
||||||
|
elsif index>0 && index%cols!=0
|
||||||
|
index -= 1
|
||||||
end
|
end
|
||||||
pbPlayCursorSE if index!=oldindex
|
pbPlayCursorSE if index!=oldindex
|
||||||
elsif Input.trigger?(Input::RIGHT)
|
elsif Input.trigger?(Input::RIGHT)
|
||||||
if index==-2; index = -3
|
if index==-2
|
||||||
elsif index==cmds.length-1 && mode!=0; index = -1
|
index = -3
|
||||||
elsif index>=0 && index%cols!=cols-1; index += 1
|
elsif index==cmds.length-1 && mode!=0
|
||||||
|
index = -1
|
||||||
|
elsif index>=0 && index%cols!=cols-1
|
||||||
|
index += 1
|
||||||
end
|
end
|
||||||
pbPlayCursorSE if index!=oldindex
|
pbPlayCursorSE if index!=oldindex
|
||||||
end
|
end
|
||||||
@@ -1043,26 +1122,37 @@ class PokemonPokedex_Scene
|
|||||||
oldindex = index
|
oldindex = index
|
||||||
end
|
end
|
||||||
if Input.trigger?(Input::UP)
|
if Input.trigger?(Input::UP)
|
||||||
if index>=7; index = 4
|
if index>=7
|
||||||
elsif index==5; index = 0
|
index = 4
|
||||||
elsif index>0; index -= 1
|
elsif index==5
|
||||||
|
index = 0
|
||||||
|
elsif index>0
|
||||||
|
index -= 1
|
||||||
end
|
end
|
||||||
pbPlayCursorSE if index!=oldindex
|
pbPlayCursorSE if index!=oldindex
|
||||||
elsif Input.trigger?(Input::DOWN)
|
elsif Input.trigger?(Input::DOWN)
|
||||||
if index==4 || index==6; index = 8
|
if index==4 || index==6
|
||||||
elsif index<7; index += 1
|
index = 8
|
||||||
|
elsif index<7
|
||||||
|
index += 1
|
||||||
end
|
end
|
||||||
pbPlayCursorSE if index!=oldindex
|
pbPlayCursorSE if index!=oldindex
|
||||||
elsif Input.trigger?(Input::LEFT)
|
elsif Input.trigger?(Input::LEFT)
|
||||||
if index==5; index = 1
|
if index==5
|
||||||
elsif index==6; index = 3
|
index = 1
|
||||||
elsif index>7; index -= 1
|
elsif index==6
|
||||||
|
index = 3
|
||||||
|
elsif index>7
|
||||||
|
index -= 1
|
||||||
end
|
end
|
||||||
pbPlayCursorSE if index!=oldindex
|
pbPlayCursorSE if index!=oldindex
|
||||||
elsif Input.trigger?(Input::RIGHT)
|
elsif Input.trigger?(Input::RIGHT)
|
||||||
if index==1; index = 5
|
if index==1
|
||||||
elsif index>=2 && index<=4; index = 6
|
index = 5
|
||||||
elsif index==7 || index==8; index += 1
|
elsif index>=2 && index<=4
|
||||||
|
index = 6
|
||||||
|
elsif index==7 || index==8
|
||||||
|
index += 1
|
||||||
end
|
end
|
||||||
pbPlayCursorSE if index!=oldindex
|
pbPlayCursorSE if index!=oldindex
|
||||||
elsif Input.trigger?(Input::ACTION)
|
elsif Input.trigger?(Input::ACTION)
|
||||||
|
|||||||
@@ -372,7 +372,8 @@ class PokemonPokedexInfo_Scene
|
|||||||
formname = ""
|
formname = ""
|
||||||
for i in @available
|
for i in @available
|
||||||
if i[1]==@gender && i[2]==@form
|
if i[1]==@gender && i[2]==@form
|
||||||
formname = i[0]; break
|
formname = i[0]
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
textpos = [
|
textpos = [
|
||||||
|
|||||||
@@ -298,15 +298,22 @@ class PokemonPartyPanel < SpriteWrapper
|
|||||||
@refreshing = true
|
@refreshing = true
|
||||||
if @panelbgsprite && !@panelbgsprite.disposed?
|
if @panelbgsprite && !@panelbgsprite.disposed?
|
||||||
if self.selected
|
if self.selected
|
||||||
if self.preselected; @panelbgsprite.changeBitmap("swapsel2")
|
if self.preselected
|
||||||
elsif @switching; @panelbgsprite.changeBitmap("swapsel")
|
@panelbgsprite.changeBitmap("swapsel2")
|
||||||
elsif @pokemon.fainted?; @panelbgsprite.changeBitmap("faintedsel")
|
elsif @switching
|
||||||
else; @panelbgsprite.changeBitmap("ablesel")
|
@panelbgsprite.changeBitmap("swapsel")
|
||||||
|
elsif @pokemon.fainted?
|
||||||
|
@panelbgsprite.changeBitmap("faintedsel")
|
||||||
|
else
|
||||||
|
@panelbgsprite.changeBitmap("ablesel")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if self.preselected; @panelbgsprite.changeBitmap("swap")
|
if self.preselected
|
||||||
elsif @pokemon.fainted?; @panelbgsprite.changeBitmap("fainted")
|
@panelbgsprite.changeBitmap("swap")
|
||||||
else; @panelbgsprite.changeBitmap("able")
|
elsif @pokemon.fainted?
|
||||||
|
@panelbgsprite.changeBitmap("fainted")
|
||||||
|
else
|
||||||
|
@panelbgsprite.changeBitmap("able")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@panelbgsprite.x = self.x
|
@panelbgsprite.x = self.x
|
||||||
@@ -316,9 +323,12 @@ class PokemonPartyPanel < SpriteWrapper
|
|||||||
if @hpbgsprite && !@hpbgsprite.disposed?
|
if @hpbgsprite && !@hpbgsprite.disposed?
|
||||||
@hpbgsprite.visible = (!@pokemon.egg? && !(@text && @text.length>0))
|
@hpbgsprite.visible = (!@pokemon.egg? && !(@text && @text.length>0))
|
||||||
if @hpbgsprite.visible
|
if @hpbgsprite.visible
|
||||||
if self.preselected || (self.selected && @switching); @hpbgsprite.changeBitmap("swap")
|
if self.preselected || (self.selected && @switching)
|
||||||
elsif @pokemon.fainted?; @hpbgsprite.changeBitmap("fainted")
|
@hpbgsprite.changeBitmap("swap")
|
||||||
else; @hpbgsprite.changeBitmap("able")
|
elsif @pokemon.fainted?
|
||||||
|
@hpbgsprite.changeBitmap("fainted")
|
||||||
|
else
|
||||||
|
@hpbgsprite.changeBitmap("able")
|
||||||
end
|
end
|
||||||
@hpbgsprite.x = self.x+96
|
@hpbgsprite.x = self.x+96
|
||||||
@hpbgsprite.y = self.y+50
|
@hpbgsprite.y = self.y+50
|
||||||
@@ -1022,7 +1032,9 @@ class PokemonPartyScreen
|
|||||||
addedEntry = false
|
addedEntry = false
|
||||||
if pkmnid == Settings::MAX_PARTY_SIZE # Confirm was chosen
|
if pkmnid == Settings::MAX_PARTY_SIZE # Confirm was chosen
|
||||||
ret = []
|
ret = []
|
||||||
for i in realorder; ret.push(@party[i]); end
|
for i in realorder
|
||||||
|
ret.push(@party[i])
|
||||||
|
end
|
||||||
error = []
|
error = []
|
||||||
break if ruleset.isValid?(ret,error)
|
break if ruleset.isValid?(ret,error)
|
||||||
pbDisplay(error[0])
|
pbDisplay(error[0])
|
||||||
|
|||||||
@@ -705,9 +705,12 @@ class PokemonSummary_Scene
|
|||||||
if move.total_pp>0
|
if move.total_pp>0
|
||||||
textpos.push([_INTL("PP"),342,yPos+32,0,moveBase,moveShadow])
|
textpos.push([_INTL("PP"),342,yPos+32,0,moveBase,moveShadow])
|
||||||
ppfraction = 0
|
ppfraction = 0
|
||||||
if move.pp==0; ppfraction = 3
|
if move.pp==0
|
||||||
elsif move.pp*4<=move.total_pp; ppfraction = 2
|
ppfraction = 3
|
||||||
elsif move.pp*2<=move.total_pp; ppfraction = 1
|
elsif move.pp*4<=move.total_pp
|
||||||
|
ppfraction = 2
|
||||||
|
elsif move.pp*2<=move.total_pp
|
||||||
|
ppfraction = 1
|
||||||
end
|
end
|
||||||
textpos.push([sprintf("%d/%d",move.pp,move.total_pp),460,yPos+32,1,ppBase[ppfraction],ppShadow[ppfraction]])
|
textpos.push([sprintf("%d/%d",move.pp,move.total_pp),460,yPos+32,1,ppBase[ppfraction],ppShadow[ppfraction]])
|
||||||
end
|
end
|
||||||
@@ -768,9 +771,12 @@ class PokemonSummary_Scene
|
|||||||
if move.total_pp>0
|
if move.total_pp>0
|
||||||
textpos.push([_INTL("PP"),342,yPos+32,0,moveBase,moveShadow])
|
textpos.push([_INTL("PP"),342,yPos+32,0,moveBase,moveShadow])
|
||||||
ppfraction = 0
|
ppfraction = 0
|
||||||
if move.pp==0; ppfraction = 3
|
if move.pp==0
|
||||||
elsif move.pp*4<=move.total_pp; ppfraction = 2
|
ppfraction = 3
|
||||||
elsif move.pp*2<=move.total_pp; ppfraction = 1
|
elsif move.pp*4<=move.total_pp
|
||||||
|
ppfraction = 2
|
||||||
|
elsif move.pp*2<=move.total_pp
|
||||||
|
ppfraction = 1
|
||||||
end
|
end
|
||||||
textpos.push([sprintf("%d/%d",move.pp,move.total_pp),460,yPos+32,1,ppBase[ppfraction],ppShadow[ppfraction]])
|
textpos.push([sprintf("%d/%d",move.pp,move.total_pp),460,yPos+32,1,ppBase[ppfraction],ppShadow[ppfraction]])
|
||||||
end
|
end
|
||||||
@@ -1128,17 +1134,25 @@ class PokemonSummary_Scene
|
|||||||
redraw = true
|
redraw = true
|
||||||
end
|
end
|
||||||
elsif Input.trigger?(Input::UP)
|
elsif Input.trigger?(Input::UP)
|
||||||
if index==7; index = 6
|
if index==7
|
||||||
elsif index==6; index = 4
|
index = 6
|
||||||
elsif index<3; index = 7
|
elsif index==6
|
||||||
else; index -= 3
|
index = 4
|
||||||
|
elsif index<3
|
||||||
|
index = 7
|
||||||
|
else
|
||||||
|
index -= 3
|
||||||
end
|
end
|
||||||
pbPlayCursorSE
|
pbPlayCursorSE
|
||||||
elsif Input.trigger?(Input::DOWN)
|
elsif Input.trigger?(Input::DOWN)
|
||||||
if index==7; index = 1
|
if index==7
|
||||||
elsif index==6; index = 7
|
index = 1
|
||||||
elsif index>=3; index = 6
|
elsif index==6
|
||||||
else; index += 3
|
index = 7
|
||||||
|
elsif index>=3
|
||||||
|
index = 6
|
||||||
|
else
|
||||||
|
index += 3
|
||||||
end
|
end
|
||||||
pbPlayCursorSE
|
pbPlayCursorSE
|
||||||
elsif Input.trigger?(Input::LEFT)
|
elsif Input.trigger?(Input::LEFT)
|
||||||
|
|||||||
@@ -160,9 +160,11 @@ class PokemonBag_Scene
|
|||||||
(!@filterlist && @bag.pockets[lastpocket].length==0)
|
(!@filterlist && @bag.pockets[lastpocket].length==0)
|
||||||
for i in 1...@bag.pockets.length
|
for i in 1...@bag.pockets.length
|
||||||
if @filterlist && @filterlist[i].length>0
|
if @filterlist && @filterlist[i].length>0
|
||||||
lastpocket = i; break
|
lastpocket = i
|
||||||
|
break
|
||||||
elsif !@filterlist && @bag.pockets[i].length>0
|
elsif !@filterlist && @bag.pockets[i].length>0
|
||||||
lastpocket = i; break
|
lastpocket = i
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -117,8 +117,10 @@ class PokemonReadyMenu_Scene
|
|||||||
if @index[1]>=@itemcommands.length && @itemcommands.length>0
|
if @index[1]>=@itemcommands.length && @itemcommands.length>0
|
||||||
@index[1] = @itemcommands.length-1
|
@index[1] = @itemcommands.length-1
|
||||||
end
|
end
|
||||||
if @index[2]==0 && @movecommands.length==0; @index[2] = 1
|
if @index[2]==0 && @movecommands.length==0
|
||||||
elsif @index[2]==1 && @itemcommands.length==0; @index[2] = 0
|
@index[2] = 1
|
||||||
|
elsif @index[2]==1 && @itemcommands.length==0
|
||||||
|
@index[2] = 0
|
||||||
end
|
end
|
||||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||||
@viewport.z = 99999
|
@viewport.z = 99999
|
||||||
|
|||||||
@@ -1262,16 +1262,24 @@ class PokemonStorageScene
|
|||||||
selection -= 3 if selection%3==0
|
selection -= 3 if selection%3==0
|
||||||
end
|
end
|
||||||
when Input::UP
|
when Input::UP
|
||||||
if selection==7; selection = 6
|
if selection==7
|
||||||
elsif selection==6; selection = 4
|
selection = 6
|
||||||
elsif selection<3; selection = 7
|
elsif selection==6
|
||||||
else; selection -= 3
|
selection = 4
|
||||||
|
elsif selection<3
|
||||||
|
selection = 7
|
||||||
|
else
|
||||||
|
selection -= 3
|
||||||
end
|
end
|
||||||
when Input::DOWN
|
when Input::DOWN
|
||||||
if selection==7; selection = 1
|
if selection==7
|
||||||
elsif selection==6; selection = 7
|
selection = 1
|
||||||
elsif selection>=3; selection = 6
|
elsif selection==6
|
||||||
else; selection += 3
|
selection = 7
|
||||||
|
elsif selection>=3
|
||||||
|
selection = 6
|
||||||
|
else
|
||||||
|
selection += 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return selection
|
return selection
|
||||||
@@ -1675,7 +1683,7 @@ class PokemonStorageScreen
|
|||||||
box = selected[0]
|
box = selected[0]
|
||||||
index = selected[1]
|
index = selected[1]
|
||||||
if box==-1
|
if box==-1
|
||||||
raise _INTL("Can't withdraw from party...");
|
raise _INTL("Can't withdraw from party...")
|
||||||
end
|
end
|
||||||
if @storage.party_full?
|
if @storage.party_full?
|
||||||
pbDisplay(_INTL("Your party's full!"))
|
pbDisplay(_INTL("Your party's full!"))
|
||||||
@@ -1912,7 +1920,8 @@ class PokemonStorageScreen
|
|||||||
index = 0
|
index = 0
|
||||||
for i in 0...papers[1].length
|
for i in 0...papers[1].length
|
||||||
if papers[1][i]==@storage[@storage.currentBox].background
|
if papers[1][i]==@storage[@storage.currentBox].background
|
||||||
index = i; break
|
index = i
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
wpaper = pbShowCommands(_INTL("Pick the wallpaper."),papers[0],index)
|
wpaper = pbShowCommands(_INTL("Pick the wallpaper."),papers[0],index)
|
||||||
|
|||||||
@@ -1181,7 +1181,9 @@ class PurifyChamberScene
|
|||||||
def pbSetScreen
|
def pbSetScreen
|
||||||
pbDeactivateWindows(@sprites) {
|
pbDeactivateWindows(@sprites) {
|
||||||
loop do
|
loop do
|
||||||
Graphics.update; Input.update; pbUpdate
|
Graphics.update
|
||||||
|
Input.update
|
||||||
|
pbUpdate
|
||||||
btn=0
|
btn=0
|
||||||
btn=Input::DOWN if Input.repeat?(Input::DOWN)
|
btn=Input::DOWN if Input.repeat?(Input::DOWN)
|
||||||
btn=Input::UP if Input.repeat?(Input::UP)
|
btn=Input::UP if Input.repeat?(Input::UP)
|
||||||
@@ -1218,7 +1220,9 @@ class PurifyChamberScene
|
|||||||
oldindex=@sprites["setwindow"].index
|
oldindex=@sprites["setwindow"].index
|
||||||
@sprites["setview"].set=oldindex
|
@sprites["setview"].set=oldindex
|
||||||
end
|
end
|
||||||
Graphics.update; Input.update; pbUpdate
|
Graphics.update
|
||||||
|
Input.update
|
||||||
|
pbUpdate
|
||||||
if Input.trigger?(Input::USE)
|
if Input.trigger?(Input::USE)
|
||||||
pbPlayDecisionSE()
|
pbPlayDecisionSE()
|
||||||
return @sprites["setwindow"].index
|
return @sprites["setwindow"].index
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ def pbEditMysteryGift(type,item,id=0,giftname="")
|
|||||||
master=IO.read("MysteryGiftMaster.txt")
|
master=IO.read("MysteryGiftMaster.txt")
|
||||||
master=pbMysteryGiftDecrypt(master)
|
master=pbMysteryGiftDecrypt(master)
|
||||||
end
|
end
|
||||||
for i in master; idlist.push(i[0]); end
|
for i in master
|
||||||
|
idlist.push(i[0])
|
||||||
|
end
|
||||||
params=ChooseNumberParams.new
|
params=ChooseNumberParams.new
|
||||||
params.setRange(0,99999)
|
params.setRange(0,99999)
|
||||||
params.setDefaultValue(id)
|
params.setDefaultValue(id)
|
||||||
@@ -199,7 +201,8 @@ def pbManageMysteryGifts
|
|||||||
replaced=false
|
replaced=false
|
||||||
for i in 0...$Trainer.mystery_gifts.length
|
for i in 0...$Trainer.mystery_gifts.length
|
||||||
if $Trainer.mystery_gifts[i][0]==gift[0]
|
if $Trainer.mystery_gifts[i][0]==gift[0]
|
||||||
$Trainer.mystery_gifts[i]=gift; replaced=true
|
$Trainer.mystery_gifts[i]=gift
|
||||||
|
replaced=true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
$Trainer.mystery_gifts.push(gift) if !replaced
|
$Trainer.mystery_gifts.push(gift) if !replaced
|
||||||
@@ -260,7 +263,9 @@ def pbDownloadMysteryGift(trainer)
|
|||||||
else
|
else
|
||||||
loop do
|
loop do
|
||||||
commands=[]
|
commands=[]
|
||||||
for gift in pending; commands.push(gift[3]); end
|
for gift in pending
|
||||||
|
commands.push(gift[3])
|
||||||
|
end
|
||||||
commands.push(_INTL("Cancel"))
|
commands.push(_INTL("Cancel"))
|
||||||
pbMessageDisplay(sprites["msgwindow"],_INTL("Choose the gift you want to receive.\\wtnp[0]"))
|
pbMessageDisplay(sprites["msgwindow"],_INTL("Choose the gift you want to receive.\\wtnp[0]"))
|
||||||
command=pbShowCommands(sprites["msgwindow"],commands,-1)
|
command=pbShowCommands(sprites["msgwindow"],commands,-1)
|
||||||
|
|||||||
@@ -67,11 +67,16 @@ class TriadCard
|
|||||||
ret *= (@north + @east + @south + @west)
|
ret *= (@north + @east + @south + @west)
|
||||||
ret /= 10 # Ranges from 2 to 24,000
|
ret /= 10 # Ranges from 2 to 24,000
|
||||||
# Quantize prices to the next highest "unit"
|
# Quantize prices to the next highest "unit"
|
||||||
if ret > 10000; ret = (1 + ret / 1000) * 1000
|
if ret > 10000
|
||||||
elsif ret > 5000; ret = (1 + ret / 500) * 500
|
ret = (1 + ret / 1000) * 1000
|
||||||
elsif ret > 1000; ret = (1 + ret / 100) * 100
|
elsif ret > 5000
|
||||||
elsif ret > 500; ret = (1 + ret / 50) * 50
|
ret = (1 + ret / 500) * 500
|
||||||
else; ret = (1 + ret / 10) * 10
|
elsif ret > 1000
|
||||||
|
ret = (1 + ret / 100) * 100
|
||||||
|
elsif ret > 500
|
||||||
|
ret = (1 + ret / 50) * 50
|
||||||
|
else
|
||||||
|
ret = (1 + ret / 10) * 10
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -42,11 +42,16 @@ class MiningGameTile < BitmapSprite
|
|||||||
@viewport.z=99999
|
@viewport.z=99999
|
||||||
super(32,32,@viewport)
|
super(32,32,@viewport)
|
||||||
r = rand(100)
|
r = rand(100)
|
||||||
if r<10; @layer = 2 # 10%
|
if r < 10
|
||||||
elsif r<25; @layer = 3 # 15%
|
@layer = 2 # 10%
|
||||||
elsif r<60; @layer = 4 # 35%
|
elsif r < 25
|
||||||
elsif r<85; @layer = 5 # 25%
|
@layer = 3 # 15%
|
||||||
else; @layer = 6 # 15%
|
elsif r < 60
|
||||||
|
@layer = 4 # 35%
|
||||||
|
elsif r < 85
|
||||||
|
@layer = 5 # 25%
|
||||||
|
else
|
||||||
|
@layer = 6 # 15%
|
||||||
end
|
end
|
||||||
@image=AnimatedBitmap.new(_INTL("Graphics/Pictures/Mining/tiles"))
|
@image=AnimatedBitmap.new(_INTL("Graphics/Pictures/Mining/tiles"))
|
||||||
update
|
update
|
||||||
@@ -104,10 +109,12 @@ class MiningGameCursor < BitmapSprite
|
|||||||
y = 32*(@position/MiningGameScene::BOARDWIDTH)
|
y = 32*(@position/MiningGameScene::BOARDWIDTH)
|
||||||
if @counter>0
|
if @counter>0
|
||||||
@counter -= 1
|
@counter -= 1
|
||||||
toolx = x; tooly = y
|
toolx = x
|
||||||
|
tooly = y
|
||||||
i = 10-(@counter/2).floor
|
i = 10-(@counter/2).floor
|
||||||
if ToolPositions[i][1]==1
|
if ToolPositions[i][1]==1
|
||||||
toolx -= 8; tooly += 8
|
toolx -= 8
|
||||||
|
tooly += 8
|
||||||
elsif ToolPositions[i][1]==2
|
elsif ToolPositions[i][1]==2
|
||||||
toolx += 6
|
toolx += 6
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -153,7 +153,9 @@ class TilePuzzleScene
|
|||||||
addBackgroundPlane(@sprites,"bg","Tile Puzzle/bg",@viewport)
|
addBackgroundPlane(@sprites,"bg","Tile Puzzle/bg",@viewport)
|
||||||
end
|
end
|
||||||
@tilebitmap=AnimatedBitmap.new("Graphics/Pictures/Tile Puzzle/tiles#{@board}")
|
@tilebitmap=AnimatedBitmap.new("Graphics/Pictures/Tile Puzzle/tiles#{@board}")
|
||||||
@tilebitmap1=nil; @tilebitmap2=nil; @tilebitmap3=nil
|
@tilebitmap1=nil
|
||||||
|
@tilebitmap2=nil
|
||||||
|
@tilebitmap3=nil
|
||||||
if pbResolveBitmap("Graphics/Pictures/Tile Puzzle/tiles#{@board}_1")
|
if pbResolveBitmap("Graphics/Pictures/Tile Puzzle/tiles#{@board}_1")
|
||||||
@tilebitmap1=AnimatedBitmap.new("Graphics/Pictures/Tile Puzzle/tiles#{@board}_1")
|
@tilebitmap1=AnimatedBitmap.new("Graphics/Pictures/Tile Puzzle/tiles#{@board}_1")
|
||||||
end
|
end
|
||||||
@@ -184,7 +186,10 @@ class TilePuzzleScene
|
|||||||
|
|
||||||
def pbShuffleTiles
|
def pbShuffleTiles
|
||||||
ret=[]
|
ret=[]
|
||||||
for i in 0...@boardwidth*@boardheight; ret.push(i); @angles.push(0); end
|
for i in 0...@boardwidth*@boardheight
|
||||||
|
ret.push(i)
|
||||||
|
@angles.push(0)
|
||||||
|
end
|
||||||
if @game==6
|
if @game==6
|
||||||
@tiles=ret
|
@tiles=ret
|
||||||
5.times do
|
5.times do
|
||||||
@@ -199,7 +204,8 @@ class TilePuzzleScene
|
|||||||
else
|
else
|
||||||
ret.shuffle!
|
ret.shuffle!
|
||||||
if @game==3 # Make sure only solvable Mystic Squares are allowed.
|
if @game==3 # Make sure only solvable Mystic Squares are allowed.
|
||||||
num=0; blank=-1
|
num=0
|
||||||
|
blank=-1
|
||||||
for i in 0...ret.length-1
|
for i in 0...ret.length-1
|
||||||
blank=i if ret[i]==@boardwidth*@boardheight-1
|
blank=i if ret[i]==@boardwidth*@boardheight-1
|
||||||
for j in i...ret.length
|
for j in i...ret.length
|
||||||
@@ -216,11 +222,15 @@ class TilePuzzleScene
|
|||||||
end
|
end
|
||||||
if @game==1 || @game==2
|
if @game==1 || @game==2
|
||||||
ret2=[]
|
ret2=[]
|
||||||
for i in 0...@boardwidth*@boardheight; ret2.push(-1); end
|
for i in 0...@boardwidth*@boardheight
|
||||||
|
ret2.push(-1)
|
||||||
|
end
|
||||||
ret=ret2+ret
|
ret=ret2+ret
|
||||||
end
|
end
|
||||||
if @game==2 || @game==5
|
if @game==2 || @game==5
|
||||||
for i in 0...@angles.length; @angles[i]=rand(4); end
|
for i in 0...@angles.length
|
||||||
|
@angles[i]=rand(4)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
@@ -399,7 +409,8 @@ class TilePuzzleScene
|
|||||||
|
|
||||||
def pbShiftLine(dir,cursor,anim=true)
|
def pbShiftLine(dir,cursor,anim=true)
|
||||||
# Get tiles involved
|
# Get tiles involved
|
||||||
tiles=[]; dist=0
|
tiles=[]
|
||||||
|
dist=0
|
||||||
if dir==2 || dir==8
|
if dir==2 || dir==8
|
||||||
dist=(dir/4).floor-1
|
dist=(dir/4).floor-1
|
||||||
while (dist>0 && cursor<(@boardwidth-1)*@boardheight) ||
|
while (dist>0 && cursor<(@boardwidth-1)*@boardheight) ||
|
||||||
@@ -453,7 +464,9 @@ class TilePuzzleScene
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
temp=[]
|
temp=[]
|
||||||
for i in tiles; temp.push(@tiles[i]); end
|
for i in tiles
|
||||||
|
temp.push(@tiles[i])
|
||||||
|
end
|
||||||
for i in 0...temp.length
|
for i in 0...temp.length
|
||||||
@tiles[tiles[(i+1)%(temp.length)]]=temp[i]
|
@tiles[tiles[(i+1)%(temp.length)]]=temp[i]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -134,9 +134,7 @@ class PBPokemon
|
|||||||
move_data = GameData::Move.try_get(moves[i])
|
move_data = GameData::Move.try_get(moves[i])
|
||||||
moveid.push(move_data.id) if move_data
|
moveid.push(move_data.id) if move_data
|
||||||
end
|
end
|
||||||
if moveid.length == 0
|
moveid.push(GameData::Move.keys.first) if moveid.length == 0 # Get any one move
|
||||||
GameData::Move.each { |mov| moveid.push(mov.id); break } # Get any one move
|
|
||||||
end
|
|
||||||
return self.new(species, item, nature, moveid[0], moveid[1], moveid[2], moveid[3], ev_array)
|
return self.new(species, item, nature, moveid[0], moveid[1], moveid[2], moveid[3], ev_array)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -379,8 +379,7 @@ def pbRuledBattle(team1, team2, rule)
|
|||||||
decision = pbDecideWinner(party1, party2, team1.rating, team2.rating)
|
decision = pbDecideWinner(party1, party2, team1.rating, team2.rating)
|
||||||
else
|
else
|
||||||
level = rule.ruleset.suggestedLevel
|
level = rule.ruleset.suggestedLevel
|
||||||
t_type = nil
|
t_type = GameData::TrainerType.keys.first
|
||||||
GameData::TrainerType.each { |t| t_type = t.id; break }
|
|
||||||
trainer1 = NPCTrainer.new("PLAYER1", t_type)
|
trainer1 = NPCTrainer.new("PLAYER1", t_type)
|
||||||
trainer2 = NPCTrainer.new("PLAYER2", t_type)
|
trainer2 = NPCTrainer.new("PLAYER2", t_type)
|
||||||
items1 = []
|
items1 = []
|
||||||
|
|||||||
@@ -1390,7 +1390,8 @@ def pbAnimationsOrganiser
|
|||||||
Graphics.width / 2, 64, Graphics.width / 2, Graphics.height - 64, viewport)
|
Graphics.width / 2, 64, Graphics.width / 2, Graphics.height - 64, viewport)
|
||||||
info.z = 2
|
info.z = 2
|
||||||
commands = []
|
commands = []
|
||||||
refreshlist = true; oldsel = -1
|
refreshlist = true
|
||||||
|
oldsel = -1
|
||||||
cmd = [0,0]
|
cmd = [0,0]
|
||||||
loop do
|
loop do
|
||||||
if refreshlist
|
if refreshlist
|
||||||
@@ -1399,7 +1400,8 @@ def pbAnimationsOrganiser
|
|||||||
commands.push(sprintf("%d: %s",i,(list[i]) ? list[i].name : "???"))
|
commands.push(sprintf("%d: %s",i,(list[i]) ? list[i].name : "???"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
refreshlist = false; oldsel = -1
|
refreshlist = false
|
||||||
|
oldsel = -1
|
||||||
cmd = pbCommands3(cmdwin,commands,-1,cmd[1],true)
|
cmd = pbCommands3(cmdwin,commands,-1,cmd[1],true)
|
||||||
if cmd[0]==1 # Swap animation up
|
if cmd[0]==1 # Swap animation up
|
||||||
if cmd[1]>=0 && cmd[1]<commands.length-1
|
if cmd[1]>=0 && cmd[1]<commands.length-1
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ class MiniBattle
|
|||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@battlers=[]
|
@battlers=[]
|
||||||
for i in 0...4; @battlers[i]=MiniBattler.new(i); end
|
for i in 0...4
|
||||||
|
@battlers[i] = MiniBattler.new(i)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -950,8 +952,8 @@ def pbAnimEditorHelpWindow
|
|||||||
helptext=""+
|
helptext=""+
|
||||||
"To add a cel to the scene, click on the canvas. The selected cel will have a black "+
|
"To add a cel to the scene, click on the canvas. The selected cel will have a black "+
|
||||||
"frame. After a cel is selected, you can modify its properties using the keyboard:\n"+
|
"frame. After a cel is selected, you can modify its properties using the keyboard:\n"+
|
||||||
"E, R - Rotate left/right;\nP - Open properties screen;\nArrow keys - Move cel 8 pixels "+
|
"E, R - Rotate left/right.\nP - Open properties screen.\nArrow keys - Move cel 8 pixels "+
|
||||||
"(hold ALT for 2 pixels);\n+/- : Zoom in/out;\nL - Lock a cel. Locking a cel prevents it "+
|
"(hold ALT for 2 pixels).\n+/- : Zoom in/out.\nL - Lock a cel. Locking a cel prevents it "+
|
||||||
"from being moved or deleted.\nDEL - Deletes the cel.\nAlso press TAB to switch the selected cel."
|
"from being moved or deleted.\nDEL - Deletes the cel.\nAlso press TAB to switch the selected cel."
|
||||||
cmdwin=Window_UnformattedTextPokemon.newWithSize("",0,0,640,512)
|
cmdwin=Window_UnformattedTextPokemon.newWithSize("",0,0,640,512)
|
||||||
cmdwin.opacity=224
|
cmdwin.opacity=224
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ class SpriteWindow_DebugVariables < Window_DrawableCommand
|
|||||||
|
|
||||||
def drawItem(index,_count,rect)
|
def drawItem(index,_count,rect)
|
||||||
pbSetNarrowFont(self.contents)
|
pbSetNarrowFont(self.contents)
|
||||||
colors = 0; codeswitch = false
|
colors = 0
|
||||||
|
codeswitch = false
|
||||||
if @mode==0
|
if @mode==0
|
||||||
name = $data_system.switches[index+1]
|
name = $data_system.switches[index+1]
|
||||||
codeswitch = (name[/^s\:/])
|
codeswitch = (name[/^s\:/])
|
||||||
@@ -235,7 +236,7 @@ def pbDebugDayCare
|
|||||||
for i in 0...2
|
for i in 0...2
|
||||||
textpos.push([_INTL("Pokémon {1}",i+1),Graphics.width/4+i*Graphics.width/2,2,2,base,shadow])
|
textpos.push([_INTL("Pokémon {1}",i+1),Graphics.width/4+i*Graphics.width/2,2,2,base,shadow])
|
||||||
end
|
end
|
||||||
for i in 0...pbDayCareDeposited
|
for i in 0...2
|
||||||
next if !$PokemonGlobal.daycare[i][0]
|
next if !$PokemonGlobal.daycare[i][0]
|
||||||
y = 34
|
y = 34
|
||||||
pkmn = $PokemonGlobal.daycare[i][0]
|
pkmn = $PokemonGlobal.daycare[i][0]
|
||||||
@@ -381,12 +382,16 @@ class SpriteWindow_DebugRoamers < Window_DrawableCommand
|
|||||||
|
|
||||||
def shadowtext(t,x,y,w,h,align=0,colors=0)
|
def shadowtext(t,x,y,w,h,align=0,colors=0)
|
||||||
width = self.contents.text_size(t).width
|
width = self.contents.text_size(t).width
|
||||||
if align==1 ; x += (w-width) # Right aligned
|
if align==1
|
||||||
elsif align==2; x += (w/2)-(width/2) # Centre aligned
|
x += (w-width) # Right aligned
|
||||||
|
elsif align==2
|
||||||
|
x += (w/2)-(width/2) # Centre aligned
|
||||||
end
|
end
|
||||||
base = Color.new(12*8,12*8,12*8)
|
base = Color.new(12*8,12*8,12*8)
|
||||||
if colors==1; base = Color.new(168,48,56) # Red
|
if colors==1
|
||||||
elsif colors==2; base = Color.new(0,144,0) # Green
|
base = Color.new(168,48,56) # Red
|
||||||
|
elsif colors==2
|
||||||
|
base = Color.new(0,144,0) # Green
|
||||||
end
|
end
|
||||||
pbDrawShadowText(self.contents,x,y,[width,w].max,h,t,base,Color.new(26*8,26*8,25*8))
|
pbDrawShadowText(self.contents,x,y,[width,w].max,h,t,base,Color.new(26*8,26*8,25*8))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -587,7 +587,8 @@ module Compiler
|
|||||||
for key in enumer.keys
|
for key in enumer.keys
|
||||||
if enumer[key]==rec[i]
|
if enumer[key]==rec[i]
|
||||||
file.write(key)
|
file.write(key)
|
||||||
hasenum = true; break
|
hasenum = true
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
file.write(rec[i]) unless hasenum
|
file.write(rec[i]) unless hasenum
|
||||||
|
|||||||
@@ -1002,10 +1002,12 @@ module Compiler
|
|||||||
deleteMoveRouteAt = proc { |list,i|
|
deleteMoveRouteAt = proc { |list,i|
|
||||||
arr = []
|
arr = []
|
||||||
if list[i] && list[i].code==209 # Set Move Route
|
if list[i] && list[i].code==209 # Set Move Route
|
||||||
arr.push(list[i]); list.delete_at(i)
|
arr.push(list[i])
|
||||||
|
list.delete_at(i)
|
||||||
while i<list.length
|
while i<list.length
|
||||||
break if !list[i] || list[i].code!=509 # Set Move Route (continuation line)
|
break if !list[i] || list[i].code!=509 # Set Move Route (continuation line)
|
||||||
arr.push(list[i]); list.delete_at(i)
|
arr.push(list[i])
|
||||||
|
list.delete_at(i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next arr
|
next arr
|
||||||
@@ -1028,17 +1030,26 @@ module Compiler
|
|||||||
if route && route.list.length<=2
|
if route && route.list.length<=2
|
||||||
# Delete superfluous move route command if necessary
|
# Delete superfluous move route command if necessary
|
||||||
if route.list[0].code==16 # Player Turn Down
|
if route.list[0].code==16 # Player Turn Down
|
||||||
deleteMoveRouteAt.call(list,i+1); params[4] = 2; changed = true
|
deleteMoveRouteAt.call(list,i+1)
|
||||||
|
params[4] = 2
|
||||||
|
changed = true
|
||||||
elsif route.list[0].code==17 # Player Turn Left
|
elsif route.list[0].code==17 # Player Turn Left
|
||||||
deleteMoveRouteAt.call(list,i+1); params[4] = 4; changed = true
|
deleteMoveRouteAt.call(list,i+1)
|
||||||
|
params[4] = 4
|
||||||
|
changed = true
|
||||||
elsif route.list[0].code==18 # Player Turn Right
|
elsif route.list[0].code==18 # Player Turn Right
|
||||||
deleteMoveRouteAt.call(list,i+1); params[4] = 6; changed = true
|
deleteMoveRouteAt.call(list,i+1)
|
||||||
|
params[4] = 6
|
||||||
|
changed = true
|
||||||
elsif route.list[0].code==19 # Player Turn Up
|
elsif route.list[0].code==19 # Player Turn Up
|
||||||
deleteMoveRouteAt.call(list,i+1); params[4] = 8; changed = true
|
deleteMoveRouteAt.call(list,i+1)
|
||||||
|
params[4] = 8
|
||||||
|
changed = true
|
||||||
elsif (route.list[0].code==1 || route.list[0].code==2 || # Player Move (4-dir)
|
elsif (route.list[0].code==1 || route.list[0].code==2 || # Player Move (4-dir)
|
||||||
route.list[0].code==3 || route.list[0].code==4) && list.length==4
|
route.list[0].code==3 || route.list[0].code==4) && list.length==4
|
||||||
params[4] = [0,2,4,6,8][route.list[0].code]
|
params[4] = [0,2,4,6,8][route.list[0].code]
|
||||||
deletedRoute = deleteMoveRouteAt.call(list,i+1); changed = true
|
deletedRoute = deleteMoveRouteAt.call(list,i+1)
|
||||||
|
changed = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# If an event command before this one is a Move Route that just
|
# If an event command before this one is a Move Route that just
|
||||||
@@ -1055,13 +1066,25 @@ module Compiler
|
|||||||
# oldlistlength = list.length
|
# oldlistlength = list.length
|
||||||
# # Delete superfluous move route command if necessary
|
# # Delete superfluous move route command if necessary
|
||||||
# if route.list[0].code==16 # Player Turn Down
|
# if route.list[0].code==16 # Player Turn Down
|
||||||
# deleteMoveRouteAt.call(list,j); params[4] = 2; changed = true; i -= (oldlistlength-list.length)
|
# deleteMoveRouteAt.call(list,j)
|
||||||
|
# params[4] = 2
|
||||||
|
# changed = true
|
||||||
|
# i -= (oldlistlength-list.length)
|
||||||
# elsif route.list[0].code==17 # Player Turn Left
|
# elsif route.list[0].code==17 # Player Turn Left
|
||||||
# deleteMoveRouteAt.call(list,j); params[4] = 4; changed = true; i -= (oldlistlength-list.length)
|
# deleteMoveRouteAt.call(list,j)
|
||||||
|
# params[4] = 4
|
||||||
|
# changed = true
|
||||||
|
# i -= (oldlistlength-list.length)
|
||||||
# elsif route.list[0].code==18 # Player Turn Right
|
# elsif route.list[0].code==18 # Player Turn Right
|
||||||
# deleteMoveRouteAt.call(list,j); params[4] = 6; changed = true; i -= (oldlistlength-list.length)
|
# deleteMoveRouteAt.call(list,j)
|
||||||
|
# params[4] = 6
|
||||||
|
# changed = true
|
||||||
|
# i -= (oldlistlength-list.length)
|
||||||
# elsif route.list[0].code==19 # Player Turn Up
|
# elsif route.list[0].code==19 # Player Turn Up
|
||||||
# deleteMoveRouteAt.call(list,j); params[4] = 8; changed = true; i -= (oldlistlength-list.length)
|
# deleteMoveRouteAt.call(list,j)
|
||||||
|
# params[4] = 8
|
||||||
|
# changed = true
|
||||||
|
# i -= (oldlistlength-list.length)
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
@@ -1080,13 +1103,21 @@ module Compiler
|
|||||||
if route && route.list.length<=2
|
if route && route.list.length<=2
|
||||||
# Delete superfluous move route command if necessary
|
# Delete superfluous move route command if necessary
|
||||||
if route.list[0].code==16 # Player Turn Down
|
if route.list[0].code==16 # Player Turn Down
|
||||||
deleteMoveRouteAt.call(list,i+2); params[4] = 2; changed = true
|
deleteMoveRouteAt.call(list,i+2)
|
||||||
|
params[4] = 2
|
||||||
|
changed = true
|
||||||
elsif route.list[0].code==17 # Player Turn Left
|
elsif route.list[0].code==17 # Player Turn Left
|
||||||
deleteMoveRouteAt.call(list,i+2); params[4] = 4; changed = true
|
deleteMoveRouteAt.call(list,i+2)
|
||||||
|
params[4] = 4
|
||||||
|
changed = true
|
||||||
elsif route.list[0].code==18 # Player Turn Right
|
elsif route.list[0].code==18 # Player Turn Right
|
||||||
deleteMoveRouteAt.call(list,i+2); params[4] = 6; changed = true
|
deleteMoveRouteAt.call(list,i+2)
|
||||||
|
params[4] = 6
|
||||||
|
changed = true
|
||||||
elsif route.list[0].code==19 # Player Turn Up
|
elsif route.list[0].code==19 # Player Turn Up
|
||||||
deleteMoveRouteAt.call(list,i+2); params[4] = 8; changed = true
|
deleteMoveRouteAt.call(list,i+2)
|
||||||
|
params[4] = 8
|
||||||
|
changed = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user