mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-06-15 08:04:12 +00:00
Resolved many Rubocop warnings
This commit is contained in:
@@ -4,8 +4,9 @@ $scene = nil
|
||||
Font.default_shadow = false if Font.respond_to?(:default_shadow)
|
||||
Graphics.frame_rate = 40
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
=begin
|
||||
class Win32API
|
||||
class << self
|
||||
@@ -14,9 +15,9 @@ class Win32API
|
||||
end
|
||||
|
||||
def new(*args)
|
||||
File.open("winapi.txt","ab") { |f| f.write("new(#{args[0]},#{args[1]})\r\n") }
|
||||
b=debug_new(*args)
|
||||
b.setDllName(args[0],args[1])
|
||||
File.open("winapi.txt", "ab") { |f| f.write("new(#{args[0]},#{args[1]})\r\n") }
|
||||
b = debug_new(*args)
|
||||
b.setDllName(args[0], args[1])
|
||||
return b
|
||||
end
|
||||
end
|
||||
@@ -26,13 +27,13 @@ class Win32API
|
||||
end
|
||||
|
||||
def setDllName(a,b)
|
||||
@w32dll=a
|
||||
@w32name=b
|
||||
@w32dll = a
|
||||
@w32name = b
|
||||
end
|
||||
|
||||
def call(*args)
|
||||
if @w32name!="GetAsyncKeyState"
|
||||
File.open("winapi.txt","ab") { |f|
|
||||
if @w32name != "GetAsyncKeyState"
|
||||
File.open("winapi.txt", "ab") { |f|
|
||||
f.write("call(#{@w32dll},#{@w32name},#{args.inspect})\r\n")
|
||||
}
|
||||
end
|
||||
@@ -47,8 +48,8 @@ class Bitmap
|
||||
end
|
||||
|
||||
def new(*args)
|
||||
if args.length==1
|
||||
File.open("winapib.txt","ab") { |f| f.write("new(#{args[0]})\r\n") }
|
||||
if args.length == 1
|
||||
File.open("winapib.txt", "ab") { |f| f.write("new(#{args[0]})\r\n") }
|
||||
end
|
||||
debug_new(*args)
|
||||
end
|
||||
@@ -58,31 +59,28 @@ end
|
||||
alias debug_load_data load_data
|
||||
|
||||
def load_data(*args)
|
||||
File.open("winapif.txt","ab") { |f| f.write("load(#{args[0]})\r\n") }
|
||||
File.open("winapif.txt", "ab") { |f| f.write("load(#{args[0]})\r\n") }
|
||||
debug_load_data(*args)
|
||||
end
|
||||
=end
|
||||
|
||||
|
||||
|
||||
class Hangup < Exception; end
|
||||
|
||||
|
||||
|
||||
if false
|
||||
p (Tilemap.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
# no changes
|
||||
p (Plane.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
# no changes
|
||||
p (Viewport.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
p (Bitmap.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
# openness(=)
|
||||
p (Window.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
p (Sprite.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
p (Tilemap.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
# no changes
|
||||
p (Plane.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
# no changes
|
||||
p (Viewport.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
p (Bitmap.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
# openness(=)
|
||||
p (Window.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
p (Sprite.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module RPG
|
||||
class Animation
|
||||
attr_accessor :id
|
||||
@@ -107,8 +105,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Animation
|
||||
class Frame
|
||||
@@ -123,8 +119,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Animation
|
||||
class Timing
|
||||
@@ -139,7 +133,7 @@ module RPG
|
||||
@frame = 0
|
||||
@se = RPG::AudioFile.new("", 80)
|
||||
@flash_scope = 0
|
||||
@flash_color = Color.new(255,255,255,255)
|
||||
@flash_color = Color.new(255, 255, 255, 255)
|
||||
@flash_duration = 5
|
||||
@condition = 0
|
||||
end
|
||||
@@ -147,8 +141,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class System
|
||||
attr_accessor :magic_number
|
||||
@@ -227,8 +219,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Tileset
|
||||
attr_accessor :id
|
||||
@@ -253,7 +243,7 @@ module RPG
|
||||
@id = 0
|
||||
@name = ""
|
||||
@tileset_name = ""
|
||||
@autotile_names = [""]*7
|
||||
@autotile_names = [""] * 7
|
||||
@panorama_name = ""
|
||||
@panorama_hue = 0
|
||||
@fog_name = ""
|
||||
@@ -272,8 +262,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class CommonEvent
|
||||
attr_accessor :id
|
||||
@@ -292,8 +280,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Map
|
||||
attr_accessor :tileset_id
|
||||
@@ -324,8 +310,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class MapInfo
|
||||
attr_accessor :name
|
||||
@@ -346,8 +330,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Event
|
||||
attr_accessor :id
|
||||
@@ -366,8 +348,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Event
|
||||
class Page
|
||||
@@ -404,8 +384,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Event
|
||||
class Page
|
||||
@@ -436,8 +414,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Event
|
||||
class Page
|
||||
@@ -464,8 +440,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class EventCommand
|
||||
attr_accessor :code
|
||||
@@ -480,8 +454,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class MoveRoute
|
||||
attr_accessor :repeat
|
||||
@@ -496,8 +468,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class MoveCommand
|
||||
attr_accessor :code
|
||||
@@ -510,8 +480,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class System
|
||||
class Words
|
||||
@@ -562,8 +530,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class System
|
||||
class TestBattler
|
||||
@@ -588,8 +554,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class AudioFile
|
||||
attr_accessor :name
|
||||
|
||||
@@ -8,7 +8,7 @@ class SpriteAnimation
|
||||
|
||||
%w[
|
||||
x y ox oy viewport flash src_rect opacity tone
|
||||
].each_with_index do |s, i|
|
||||
].each_with_index do |s, _i|
|
||||
eval <<-__END__
|
||||
|
||||
def #{s}(*arg)
|
||||
@@ -49,7 +49,7 @@ class SpriteAnimation
|
||||
end
|
||||
@_animation_sprites = []
|
||||
if @_animation.position != 3 or not @@_animations.include?(animation)
|
||||
for i in 0..15
|
||||
16.times do
|
||||
sprite = ::Sprite.new(self.viewport)
|
||||
sprite.bitmap = bitmap
|
||||
sprite.visible = false
|
||||
@@ -82,7 +82,7 @@ class SpriteAnimation
|
||||
@@_reference_count[bitmap] = 1
|
||||
end
|
||||
@_loop_animation_sprites = []
|
||||
for i in 0..15
|
||||
16.times do
|
||||
sprite = ::Sprite.new(self.viewport)
|
||||
sprite.bitmap = bitmap
|
||||
sprite.visible = false
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class Win32API
|
||||
@@RGSSWINDOW = nil
|
||||
@@GetCurrentThreadId = Win32API.new('kernel32','GetCurrentThreadId', '%w()','l')
|
||||
@@GetWindowThreadProcessId = Win32API.new('user32','GetWindowThreadProcessId', '%w(l p)','l')
|
||||
@@FindWindowEx = Win32API.new('user32','FindWindowEx', '%w(l l p p)','l')
|
||||
@@GetCurrentThreadId = Win32API.new('kernel32', 'GetCurrentThreadId', '%w()', 'l')
|
||||
@@GetWindowThreadProcessId = Win32API.new('user32', 'GetWindowThreadProcessId', '%w(l p)', 'l')
|
||||
@@FindWindowEx = Win32API.new('user32', 'FindWindowEx', '%w(l l p p)', 'l')
|
||||
|
||||
def Win32API.SetWindowText(text)
|
||||
hWnd = pbFindRgssWindow
|
||||
@@ -16,7 +16,7 @@ class Win32API
|
||||
processid = [0].pack('l')
|
||||
threadid = @@GetCurrentThreadId.call
|
||||
nextwindow = 0
|
||||
begin
|
||||
loop do
|
||||
nextwindow = @@FindWindowEx.call(0,nextwindow,"RGSS Player",0)
|
||||
if nextwindow!=0
|
||||
wndthreadid = @@GetWindowThreadProcessId.call(nextwindow,processid)
|
||||
@@ -25,9 +25,9 @@ class Win32API
|
||||
return @@RGSSWINDOW
|
||||
end
|
||||
end
|
||||
end until nextwindow==0
|
||||
break if nextwindow==0
|
||||
end
|
||||
raise "Can't find RGSS player window"
|
||||
return 0
|
||||
end
|
||||
|
||||
def Win32API.SetWindowPos(w, h)
|
||||
|
||||
@@ -48,7 +48,6 @@ module Console
|
||||
@apiSetConsoleTitle = Win32API.new("kernel32","SetConsoleTitle","p","s")
|
||||
access = (GENERIC_READ | GENERIC_WRITE)
|
||||
sharemode = (FILE_SHARE_READ | FILE_SHARE_WRITE)
|
||||
returnCode = AllocConsole()
|
||||
@bufferHandle = CreateConsoleScreenBuffer(access,sharemode,CONSOLE_TEXTMODE_BUFFER)
|
||||
f = File.open("Game.ini")
|
||||
lines = f.readlines()
|
||||
@@ -94,7 +93,7 @@ module Console
|
||||
offset=0
|
||||
events=eventsread.unpack("V")
|
||||
echo("got input [eventsread #{events}")
|
||||
for i in 0...events[0]
|
||||
events[0].length.times do
|
||||
keyevent=buffer[offset,20]
|
||||
keyevent=keyevent.unpack("vCvvvvV")
|
||||
if keyevent[0]==1 && keyevent[1]>0
|
||||
@@ -121,7 +120,6 @@ module Console
|
||||
echo(sprintf("failed (%d)\r\n",getlast.call()))
|
||||
break
|
||||
end
|
||||
offset=0
|
||||
events=eventsread.unpack("V")
|
||||
if events[0]>0
|
||||
echo("got input [eventsread #{events}][buffer #{buffer}]\r\n")
|
||||
|
||||
@@ -157,7 +157,7 @@ module Graphics
|
||||
|
||||
def self.wait(frames)
|
||||
return if frames<=0
|
||||
frames.times do |i|
|
||||
frames.times do
|
||||
self.update
|
||||
end
|
||||
end
|
||||
@@ -675,16 +675,16 @@ class Bitmap
|
||||
end
|
||||
|
||||
def swap32(x)
|
||||
return ((x>>24)&0x000000FF)|
|
||||
((x>>8)&0x0000FF00)|
|
||||
((x<<8)&0x00FF0000)|
|
||||
((x<<24)&0xFF000000)
|
||||
return ((x >> 24) & 0x000000FF) |
|
||||
((x >> 8) & 0x0000FF00) |
|
||||
((x << 8) & 0x00FF0000) |
|
||||
((x << 24) & 0xFF000000)
|
||||
end
|
||||
|
||||
def asOpaque
|
||||
data=getData
|
||||
j=3
|
||||
for i in 0...width*height
|
||||
(width*height).times do
|
||||
data[j]=0xFF
|
||||
j+=4
|
||||
end
|
||||
@@ -705,7 +705,6 @@ class Bitmap
|
||||
row=(self.height-1)*bytesPerScan
|
||||
data=self.getData
|
||||
data2=data.clone
|
||||
width=self.width
|
||||
x=""
|
||||
len=bytesPerScan*self.height
|
||||
ttt=Time.now
|
||||
@@ -713,13 +712,14 @@ class Bitmap
|
||||
SwapRgb.call(data2,data2.length)
|
||||
else
|
||||
# the following is considerably slower
|
||||
b=0;c=2;while b!=len
|
||||
b=0; c=2
|
||||
while b!=len
|
||||
data2[b]=data[c]
|
||||
data2[c]=data[b]
|
||||
b+=4;c+=4;
|
||||
b+=4; c+=4;
|
||||
end
|
||||
end
|
||||
#$times.push(Time.now-ttt)
|
||||
# $times.push(Time.now-ttt)
|
||||
filter="\0"
|
||||
while row>=0
|
||||
thisRow=data2[row,bytesPerScan]
|
||||
|
||||
@@ -22,7 +22,7 @@ class Game_Character
|
||||
attr_accessor :transparent
|
||||
attr_reader :move_speed
|
||||
attr_accessor :walk_anime
|
||||
attr_accessor :bob_height
|
||||
attr_writer :bob_height
|
||||
|
||||
def initialize(map=nil)
|
||||
@map = map
|
||||
@@ -415,7 +415,7 @@ class Game_Character
|
||||
when 42; @opacity = command.parameters[0]
|
||||
when 43; @blend_type = command.parameters[0]
|
||||
when 44; pbSEPlay(command.parameters[0])
|
||||
when 45; result = eval(command.parameters[0])
|
||||
when 45; eval(command.parameters[0])
|
||||
end
|
||||
@move_route_index += 1
|
||||
end
|
||||
|
||||
@@ -225,8 +225,6 @@ class Game_Player < Game_Character
|
||||
def center(x, y)
|
||||
center_x = (Graphics.width/2 - Game_Map::TILE_WIDTH/2) * Game_Map::X_SUBPIXELS
|
||||
center_y = (Graphics.height/2 - Game_Map::TILE_HEIGHT/2) * Game_Map::Y_SUBPIXELS
|
||||
max_x = (self.map.width - Graphics.width*1.0/Game_Map::TILE_WIDTH) * Game_Map::REAL_RES_X
|
||||
max_y = (self.map.height - Graphics.height*1.0/Game_Map::TILE_HEIGHT) * Game_Map::REAL_RES_Y
|
||||
dispx = x * Game_Map::REAL_RES_X - center_x
|
||||
dispy = y * Game_Map::REAL_RES_Y - center_y
|
||||
self.map.display_x = dispx
|
||||
@@ -464,7 +462,6 @@ end
|
||||
def pbUpdateVehicle
|
||||
meta = pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
|
||||
if meta
|
||||
newCharName = nil
|
||||
charset = 1 # Regular graphic
|
||||
if $PokemonGlobal.diving; charset = 5 # Diving graphic
|
||||
elsif $PokemonGlobal.surfing; charset = 3 # Surfing graphic
|
||||
|
||||
@@ -25,8 +25,8 @@ class Game_Map
|
||||
attr_reader :fog_oy # fog y-coordinate starting point
|
||||
attr_reader :fog_tone # fog color tone
|
||||
attr_accessor :battleback_name # battleback file name
|
||||
attr_accessor :display_x # display x-coordinate * 128
|
||||
attr_accessor :display_y # display y-coordinate * 128
|
||||
attr_reader :display_x # display x-coordinate * 128
|
||||
attr_reader :display_y # display y-coordinate * 128
|
||||
attr_accessor :need_refresh # refresh request flag
|
||||
|
||||
TILE_WIDTH = 32
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
class Spriteset_Global
|
||||
attr_reader :playersprite
|
||||
@@viewport2 = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@@viewport2 = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@@viewport2.z = 200
|
||||
|
||||
def initialize
|
||||
@playersprite = Sprite_Character.new(Spriteset_Map.viewport,$game_player)
|
||||
@playersprite = Sprite_Character.new(Spriteset_Map.viewport, $game_player)
|
||||
@picture_sprites = []
|
||||
for i in 1..100
|
||||
@picture_sprites.push(Sprite_Picture.new(@@viewport2,$game_screen.pictures[i]))
|
||||
@picture_sprites.push(Sprite_Picture.new(@@viewport2, $game_screen.pictures[i]))
|
||||
end
|
||||
@timer_sprite = Sprite_Timer.new
|
||||
update
|
||||
@@ -15,9 +15,7 @@ class Spriteset_Global
|
||||
|
||||
def dispose
|
||||
@playersprite.dispose
|
||||
for sprite in @picture_sprites
|
||||
sprite.dispose
|
||||
end
|
||||
@picture_sprites.each { |sprite| sprite.dispose }
|
||||
@timer_sprite.dispose
|
||||
@playersprite = nil
|
||||
@picture_sprites.clear
|
||||
@@ -26,9 +24,7 @@ class Spriteset_Global
|
||||
|
||||
def update
|
||||
@playersprite.update
|
||||
for sprite in @picture_sprites
|
||||
sprite.update
|
||||
end
|
||||
@picture_sprites.each { |sprite| sprite.update }
|
||||
@timer_sprite.update
|
||||
end
|
||||
end
|
||||
|
||||
@@ -117,7 +117,8 @@ end
|
||||
|
||||
|
||||
class ParticleSprite
|
||||
attr_accessor :x, :y, :z, :ox, :oy, :opacity, :bitmap, :blend_type
|
||||
attr_accessor :x, :y, :z, :ox, :oy, :opacity, :blend_type
|
||||
attr_reader :bitmap
|
||||
|
||||
def initialize(viewport)
|
||||
@viewport = viewport
|
||||
|
||||
@@ -41,24 +41,24 @@ class CustomTilemap
|
||||
attr_reader :viewport
|
||||
attr_reader :graphicsWidth
|
||||
attr_reader :graphicsHeight
|
||||
attr_accessor :ox
|
||||
attr_accessor :oy
|
||||
attr_reader :ox
|
||||
attr_reader :oy
|
||||
attr_accessor :tone
|
||||
attr_accessor :color
|
||||
|
||||
Autotiles = [
|
||||
[ [27, 28, 33, 34], [ 5, 28, 33, 34], [27, 6, 33, 34], [ 5, 6, 33, 34],
|
||||
[27, 28, 33, 12], [ 5, 28, 33, 12], [27, 6, 33, 12], [ 5, 6, 33, 12] ],
|
||||
[ [27, 28, 11, 34], [ 5, 28, 11, 34], [27, 6, 11, 34], [ 5, 6, 11, 34],
|
||||
[27, 28, 11, 12], [ 5, 28, 11, 12], [27, 6, 11, 12], [ 5, 6, 11, 12] ],
|
||||
[ [25, 26, 31, 32], [25, 6, 31, 32], [25, 26, 31, 12], [25, 6, 31, 12],
|
||||
[15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
|
||||
[ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
|
||||
[39, 40, 45, 46], [ 5, 40, 45, 46], [39, 6, 45, 46], [ 5, 6, 45, 46] ],
|
||||
[ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
|
||||
[17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
|
||||
[ [37, 38, 43, 44], [37, 6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
|
||||
[37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1, 2, 7, 8] ]
|
||||
[ [27, 28, 33, 34], [ 5, 28, 33, 34], [27, 6, 33, 34], [ 5, 6, 33, 34],
|
||||
[27, 28, 33, 12], [ 5, 28, 33, 12], [27, 6, 33, 12], [ 5, 6, 33, 12] ],
|
||||
[ [27, 28, 11, 34], [ 5, 28, 11, 34], [27, 6, 11, 34], [ 5, 6, 11, 34],
|
||||
[27, 28, 11, 12], [ 5, 28, 11, 12], [27, 6, 11, 12], [ 5, 6, 11, 12] ],
|
||||
[ [25, 26, 31, 32], [25, 6, 31, 32], [25, 26, 31, 12], [25, 6, 31, 12],
|
||||
[15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
|
||||
[ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
|
||||
[39, 40, 45, 46], [ 5, 40, 45, 46], [39, 6, 45, 46], [ 5, 6, 45, 46] ],
|
||||
[ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
|
||||
[17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
|
||||
[ [37, 38, 43, 44], [37, 6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
|
||||
[37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1, 2, 7, 8] ]
|
||||
]
|
||||
Animated_Autotiles_Frames = 5*Graphics.frame_rate/20 # Frequency of updating animated autotiles
|
||||
FlashOpacity = [100,90,80,70,80,90]
|
||||
@@ -132,26 +132,30 @@ class CustomTilemap
|
||||
return if disposed?
|
||||
@help.dispose if @help
|
||||
@help = nil
|
||||
i = 0; len = @autotileInfo.length; while i<len
|
||||
i = 0; len = @autotileInfo.length
|
||||
while i<len
|
||||
if @autotileInfo[i]
|
||||
@autotileInfo[i].dispose
|
||||
@autotileInfo[i] = nil
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
i = 0; len = @regularTileInfo.length; while i<len
|
||||
i = 0; len = @regularTileInfo.length
|
||||
while i<len
|
||||
if @regularTileInfo[i]
|
||||
@regularTileInfo[i].dispose
|
||||
@regularTileInfo[i] = nil
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
i = 0; len = @tiles.length; while i<len
|
||||
i = 0; len = @tiles.length
|
||||
while i<len
|
||||
@tiles[i].dispose
|
||||
@tiles[i] = nil
|
||||
i += 2
|
||||
end
|
||||
i = 0; len = @autosprites.length; while i<len
|
||||
i = 0; len = @autosprites.length
|
||||
while i<len
|
||||
@autosprites[i].dispose
|
||||
@autosprites[i] = nil
|
||||
i += 2
|
||||
@@ -449,7 +453,6 @@ class CustomTilemap
|
||||
bitmap = @flash.bitmap
|
||||
ysize = @map_data.ysize
|
||||
xsize = @map_data.xsize
|
||||
zsize = @map_data.zsize
|
||||
@firsttimeflash = false
|
||||
@oxFlash = @ox-(width>>2)
|
||||
@oyFlash = @oy-(height>>2)
|
||||
@@ -488,7 +491,8 @@ class CustomTilemap
|
||||
end
|
||||
|
||||
def refresh_tileset
|
||||
i = 0; len = @regularTileInfo.length; while i<len
|
||||
i = 0; len = @regularTileInfo.length
|
||||
while i<len
|
||||
if @regularTileInfo[i]
|
||||
@regularTileInfo[i].dispose
|
||||
@regularTileInfo[i] = nil
|
||||
@@ -518,14 +522,16 @@ class CustomTilemap
|
||||
end
|
||||
|
||||
def refresh_autotiles
|
||||
i = 0; len = @autotileInfo.length; while i<len
|
||||
i = 0; len = @autotileInfo.length
|
||||
while i<len
|
||||
if @autotileInfo[i]
|
||||
@autotileInfo[i].dispose
|
||||
@autotileInfo[i] = nil
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
i = 0; len = @autosprites.length; while i<len
|
||||
i = 0; len = @autosprites.length
|
||||
while i<len
|
||||
if @autosprites[i]
|
||||
@autosprites[i].dispose
|
||||
@autosprites[i] = nil
|
||||
@@ -798,10 +804,6 @@ class CustomTilemap
|
||||
usesprites = true
|
||||
end
|
||||
refreshFlashSprite
|
||||
vpx = @viewport.rect.x
|
||||
vpy = @viewport.rect.y
|
||||
vpr = @viewport.rect.width+vpx
|
||||
vpb = @viewport.rect.height+vpy
|
||||
xsize = @map_data.xsize
|
||||
ysize = @map_data.ysize
|
||||
minX = (@ox/@tileWidth)-1
|
||||
@@ -870,7 +872,8 @@ class CustomTilemap
|
||||
end
|
||||
if count<@tiles.length
|
||||
bigchange = (count<=(@tiles.length*2/3)) && (@tiles.length*2/3)>25
|
||||
j = count; len = @tiles.length; while j<len
|
||||
j = count; len = @tiles.length
|
||||
while j<len
|
||||
sprite = @tiles[j]
|
||||
@tiles[j+1] = -1
|
||||
if bigchange
|
||||
|
||||
@@ -197,11 +197,11 @@ class Draw_Tilemap # This class controls a set of sprites, with
|
||||
end
|
||||
|
||||
def redrawmap
|
||||
# Provide blank data in proper object form
|
||||
# Provide blank data in proper object form
|
||||
self.clear
|
||||
xsize=@map_data.xsize
|
||||
ysize=@map_data.ysize
|
||||
# Bitmaps used for each priority's drawing. Priorities 2-5 are combined.
|
||||
# Bitmaps used for each priority's drawing. Priorities 2-5 are combined.
|
||||
@bitmaps = [Bitmap.new(xsize*32, ysize*32+StripSize),
|
||||
Bitmap.new(xsize*32, ysize*32+StripSize),
|
||||
Bitmap.new(xsize*32, ysize*32+StripSize)]
|
||||
@@ -213,10 +213,10 @@ class Draw_Tilemap # This class controls a set of sprites, with
|
||||
end
|
||||
@drawnstrips.clear
|
||||
@contentstrips.clear
|
||||
# Generate blank sprites
|
||||
# Generate blank sprites
|
||||
@sprites.clear
|
||||
@numsprites=ysize * (32 / StripSize)
|
||||
for i in 0...@map_data.zsize # For each layer
|
||||
@map_data.zsize.times do # For each layer
|
||||
@sprites.push([])
|
||||
@contentstrips.push([])
|
||||
end
|
||||
@@ -227,7 +227,6 @@ class Draw_Tilemap # This class controls a set of sprites, with
|
||||
end
|
||||
|
||||
def update
|
||||
oyunchanged=false
|
||||
if !@flash_data.nil? && @sprites.length>0
|
||||
flashindex=@sprites.length-1
|
||||
for j in 0...@numsprites
|
||||
@@ -249,8 +248,6 @@ class Draw_Tilemap # This class controls a set of sprites, with
|
||||
@doredraw=false
|
||||
elsif @oldOx==@ox && @oldOy==@oy
|
||||
return
|
||||
elsif @oldOy==@oy
|
||||
oyunchanged=true
|
||||
end
|
||||
@oldOx=@ox
|
||||
@oldOy=@oy
|
||||
@@ -274,7 +271,6 @@ class Draw_Tilemap # This class controls a set of sprites, with
|
||||
end
|
||||
vpy=@viewport.rect.y
|
||||
vpr=@viewport.rect.x+@viewport.rect.width
|
||||
vpb=@viewport.rect.y+@viewport.rect.height
|
||||
numsprites=0
|
||||
for i in @sprites
|
||||
numsprites+=i.compact.length
|
||||
|
||||
@@ -57,7 +57,6 @@ class SynchronizedTilemapAutotilesInternal
|
||||
end
|
||||
|
||||
def sync
|
||||
frameused = []
|
||||
for i in 0...7
|
||||
frames = [1,@atframes[i].length].max
|
||||
frame = (Graphics.frame_count/15)%frames
|
||||
|
||||
@@ -3,38 +3,38 @@ class TileDrawingHelper
|
||||
attr_accessor :autotiles
|
||||
|
||||
Autotiles = [
|
||||
[ [27, 28, 33, 34], [ 5, 28, 33, 34], [27, 6, 33, 34], [ 5, 6, 33, 34],
|
||||
[27, 28, 33, 12], [ 5, 28, 33, 12], [27, 6, 33, 12], [ 5, 6, 33, 12] ],
|
||||
[ [27, 28, 11, 34], [ 5, 28, 11, 34], [27, 6, 11, 34], [ 5, 6, 11, 34],
|
||||
[27, 28, 11, 12], [ 5, 28, 11, 12], [27, 6, 11, 12], [ 5, 6, 11, 12] ],
|
||||
[ [25, 26, 31, 32], [25, 6, 31, 32], [25, 26, 31, 12], [25, 6, 31, 12],
|
||||
[15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
|
||||
[ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
|
||||
[39, 40, 45, 46], [ 5, 40, 45, 46], [39, 6, 45, 46], [ 5, 6, 45, 46] ],
|
||||
[ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
|
||||
[17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
|
||||
[ [37, 38, 43, 44], [37, 6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
|
||||
[37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1, 2, 7, 8] ]
|
||||
[ [27, 28, 33, 34], [ 5, 28, 33, 34], [27, 6, 33, 34], [ 5, 6, 33, 34],
|
||||
[27, 28, 33, 12], [ 5, 28, 33, 12], [27, 6, 33, 12], [ 5, 6, 33, 12] ],
|
||||
[ [27, 28, 11, 34], [ 5, 28, 11, 34], [27, 6, 11, 34], [ 5, 6, 11, 34],
|
||||
[27, 28, 11, 12], [ 5, 28, 11, 12], [27, 6, 11, 12], [ 5, 6, 11, 12] ],
|
||||
[ [25, 26, 31, 32], [25, 6, 31, 32], [25, 26, 31, 12], [25, 6, 31, 12],
|
||||
[15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
|
||||
[ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
|
||||
[39, 40, 45, 46], [ 5, 40, 45, 46], [39, 6, 45, 46], [ 5, 6, 45, 46] ],
|
||||
[ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
|
||||
[17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
|
||||
[ [37, 38, 43, 44], [37, 6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
|
||||
[37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1, 2, 7, 8] ]
|
||||
]
|
||||
|
||||
# converts neighbors returned from tableNeighbors to tile indexes
|
||||
NeighborsToTiles = [
|
||||
46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40,
|
||||
42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16,
|
||||
46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40,
|
||||
42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16,
|
||||
45, 39, 45, 39, 33, 31, 33, 29, 45, 39, 45, 39, 33, 31, 33, 29,
|
||||
37, 27, 37, 27, 23, 15, 23, 13, 37, 27, 37, 27, 22, 11, 22, 9,
|
||||
45, 39, 45, 39, 33, 31, 33, 29, 45, 39, 45, 39, 33, 31, 33, 29,
|
||||
36, 26, 36, 26, 21, 7, 21, 5, 36, 26, 36, 26, 20, 3, 20, 1,
|
||||
46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40,
|
||||
42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16,
|
||||
46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40,
|
||||
42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16,
|
||||
45, 38, 45, 38, 33, 30, 33, 28, 45, 38, 45, 38, 33, 30, 33, 28,
|
||||
37, 25, 37, 25, 23, 14, 23, 12, 37, 25, 37, 25, 22, 10, 22, 8,
|
||||
45, 38, 45, 38, 33, 30, 33, 28, 45, 38, 45, 38, 33, 30, 33, 28,
|
||||
36, 24, 36, 24, 21, 6, 21, 4, 36, 24, 36, 24, 20, 2, 20, 0
|
||||
46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40,
|
||||
42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16,
|
||||
46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40,
|
||||
42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16,
|
||||
45, 39, 45, 39, 33, 31, 33, 29, 45, 39, 45, 39, 33, 31, 33, 29,
|
||||
37, 27, 37, 27, 23, 15, 23, 13, 37, 27, 37, 27, 22, 11, 22, 9,
|
||||
45, 39, 45, 39, 33, 31, 33, 29, 45, 39, 45, 39, 33, 31, 33, 29,
|
||||
36, 26, 36, 26, 21, 7, 21, 5, 36, 26, 36, 26, 20, 3, 20, 1,
|
||||
46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40,
|
||||
42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16,
|
||||
46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40,
|
||||
42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16,
|
||||
45, 38, 45, 38, 33, 30, 33, 28, 45, 38, 45, 38, 33, 30, 33, 28,
|
||||
37, 25, 37, 25, 23, 14, 23, 12, 37, 25, 37, 25, 22, 10, 22, 8,
|
||||
45, 38, 45, 38, 33, 30, 33, 28, 45, 38, 45, 38, 33, 30, 33, 28,
|
||||
36, 24, 36, 24, 21, 6, 21, 4, 36, 24, 36, 24, 20, 2, 20, 0
|
||||
]
|
||||
|
||||
def self.tableNeighbors(data,x,y)
|
||||
|
||||
@@ -192,10 +192,6 @@ class Interpreter
|
||||
$game_temp.choice_proc = Proc.new { |n| @branch[current_indent] = n }
|
||||
end
|
||||
|
||||
def command_dummy
|
||||
return true
|
||||
end
|
||||
|
||||
def pbExecuteScript(script)
|
||||
begin
|
||||
result = eval(script)
|
||||
@@ -234,7 +230,6 @@ class Interpreter
|
||||
if e.is_a?(Hangup)
|
||||
$EVENTHANGUPMSG = err; raise
|
||||
end
|
||||
raise err
|
||||
elsif $game_map
|
||||
mapname = ($game_map.name rescue nil) || "???"
|
||||
err = "Script error within map #{$game_map.map_id} "
|
||||
@@ -242,15 +237,13 @@ class Interpreter
|
||||
if e.is_a?(Hangup)
|
||||
$EVENTHANGUPMSG = err; raise
|
||||
end
|
||||
raise err
|
||||
else
|
||||
err = "Script error in interpreter:\r\n#{message}\r\n#{s}"
|
||||
if e.is_a?(Hangup)
|
||||
$EVENTHANGUPMSG = err; raise
|
||||
end
|
||||
raise err
|
||||
end
|
||||
return false
|
||||
raise err
|
||||
end
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -844,7 +837,7 @@ class Interpreter
|
||||
value = $game_variables[@parameters[4]]
|
||||
when 2 # random number
|
||||
value = @parameters[4] + rand(@parameters[5] - @parameters[4] + 1)
|
||||
when 3, 4, 5 # item, actor, enemy
|
||||
# when 3, 4, 5 # item, actor, enemy
|
||||
when 6 # character
|
||||
character = get_character(@parameters[4])
|
||||
if character != nil
|
||||
@@ -860,14 +853,13 @@ class Interpreter
|
||||
when 7 # other
|
||||
case @parameters[4]
|
||||
when 0; value = $game_map.map_id # map ID
|
||||
when 1, 3 # number of party members, steps
|
||||
# when 1, 3 # number of party members, steps
|
||||
when 2; value = $Trainer.money # gold
|
||||
when 4; value = Graphics.frame_count / Graphics.frame_rate # play time
|
||||
when 5; value = $game_system.timer / Graphics.frame_rate # timer
|
||||
when 6; value = $game_system.save_count # save count
|
||||
end
|
||||
end
|
||||
shouldRefresh = false
|
||||
# Loop for group control
|
||||
for i in @parameters[0] .. @parameters[1]
|
||||
# Branch with control
|
||||
@@ -1463,7 +1455,7 @@ class Interpreter
|
||||
end
|
||||
@index += 1
|
||||
end
|
||||
result = pbExecuteScript(script)
|
||||
pbExecuteScript(script)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -133,7 +133,7 @@ def getKnownFolder(guid)
|
||||
coTaskMemFree = Win32API.new("ole32.dll","CoTaskMemFree","i","") rescue nil
|
||||
return "" if !(shGetKnownFolderPath && coTaskMemFree)
|
||||
path = "\0"*4
|
||||
ret = shGetKnownFolderPath.call(packedGuid,0,0,path)
|
||||
path = shGetKnownFolderPath.call(packedGuid,0,0,path)
|
||||
path = path.unpack("V")[0]
|
||||
ret = getUnicodeString(path)
|
||||
coTaskMemFree.call(path)
|
||||
@@ -245,7 +245,7 @@ module RTP
|
||||
return false if !dir || dir==""
|
||||
loop do
|
||||
name = dir.gsub(/[\/\\]$/,"")+"/writetest"
|
||||
for i in 0...12
|
||||
12.times do
|
||||
name += sprintf("%02X",rand(256))
|
||||
end
|
||||
name += ".tmp"
|
||||
@@ -471,12 +471,12 @@ module MiniRegistry
|
||||
type = type.unpack("V")[0]
|
||||
data = data[0,size.unpack("V")[0]]
|
||||
case type
|
||||
when 1; return data.chop # REG_SZ
|
||||
when 2; return data.gsub(/%([^%]+)%/) { ENV[$1] || $& } # REG_EXPAND_SZ
|
||||
when 3; return data # REG_BINARY
|
||||
when 4; return data.unpack("V")[0] # REG_DWORD
|
||||
when 5; return data.unpack("V")[0] # REG_DWORD_BIG_ENDIAN
|
||||
when 11; qw = data.unpack("VV"); return (data[1]<<32|data[0]) # REG_QWORD
|
||||
when 1; return data.chop # REG_SZ
|
||||
when 2; return data.gsub(/%([^%]+)%/) { ENV[$1] || $& } # REG_EXPAND_SZ
|
||||
when 3; return data # REG_BINARY
|
||||
when 4; return data.unpack("V")[0] # REG_DWORD
|
||||
when 5; return data.unpack("V")[0] # REG_DWORD_BIG_ENDIAN
|
||||
when 11; data.unpack("VV"); return (data[1]<<32|data[0]) # REG_QWORD
|
||||
else; raise "Type #{type} not supported."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,121 +1,113 @@
|
||||
module FileInputMixin
|
||||
def fgetb
|
||||
x=0
|
||||
ret=0
|
||||
ret = 0
|
||||
each_byte do |i|
|
||||
ret=i || 0
|
||||
ret = i || 0
|
||||
break
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def fgetw
|
||||
x=0
|
||||
ret=0
|
||||
x = 0
|
||||
ret = 0
|
||||
each_byte do |i|
|
||||
break if !i
|
||||
ret|=(i<<x)
|
||||
x+=8
|
||||
break if x==16
|
||||
ret |= (i << x)
|
||||
x += 8
|
||||
break if x == 16
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def fgetdw
|
||||
x=0
|
||||
ret=0
|
||||
x = 0
|
||||
ret = 0
|
||||
each_byte do |i|
|
||||
break if !i
|
||||
ret|=(i<<x)
|
||||
x+=8
|
||||
break if x==32
|
||||
ret |= (i << x)
|
||||
x += 8
|
||||
break if x == 32
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def fgetsb
|
||||
ret=fgetb
|
||||
if (ret&0x80)!=0
|
||||
return ret-256
|
||||
else
|
||||
return ret
|
||||
end
|
||||
ret = fgetb
|
||||
ret -= 256 if (ret & 0x80) != 0
|
||||
return ret
|
||||
end
|
||||
|
||||
def xfgetb(offset)
|
||||
self.pos=offset
|
||||
self.pos = offset
|
||||
return fgetb
|
||||
end
|
||||
|
||||
def xfgetw(offset)
|
||||
self.pos=offset
|
||||
self.pos = offset
|
||||
return fgetw
|
||||
end
|
||||
|
||||
def xfgetdw(offset)
|
||||
self.pos=offset
|
||||
self.pos = offset
|
||||
return fgetdw
|
||||
end
|
||||
|
||||
def getOffset(index)
|
||||
self.binmode
|
||||
self.pos=0
|
||||
offset=fgetdw>>3
|
||||
return 0 if index>=offset
|
||||
self.pos=index*8
|
||||
self.pos = 0
|
||||
offset = fgetdw >> 3
|
||||
return 0 if index >= offset
|
||||
self.pos = index * 8
|
||||
return fgetdw
|
||||
end
|
||||
|
||||
def getLength(index)
|
||||
self.binmode
|
||||
self.pos=0
|
||||
offset=fgetdw>>3
|
||||
return 0 if index>=offset
|
||||
self.pos=index*8+4
|
||||
self.pos = 0
|
||||
offset = fgetdw >> 3
|
||||
return 0 if index >= offset
|
||||
self.pos = index * 8 + 4
|
||||
return fgetdw
|
||||
end
|
||||
|
||||
def readName(index)
|
||||
self.binmode
|
||||
self.pos=0
|
||||
offset=fgetdw>>3
|
||||
return "" if index>=offset
|
||||
self.pos=index<<3
|
||||
offset=fgetdw
|
||||
length=fgetdw
|
||||
return "" if length==0
|
||||
self.pos=offset
|
||||
self.pos = 0
|
||||
offset = fgetdw >> 3
|
||||
return "" if index >= offset
|
||||
self.pos = index << 3
|
||||
offset = fgetdw
|
||||
length = fgetdw
|
||||
return "" if length == 0
|
||||
self.pos = offset
|
||||
return read(length)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module FileOutputMixin
|
||||
def fputb(b)
|
||||
b=b&0xFF
|
||||
b &= 0xFF
|
||||
write(b.chr)
|
||||
end
|
||||
|
||||
def fputw(w)
|
||||
2.times do
|
||||
b=w&0xFF
|
||||
b = w & 0xFF
|
||||
write(b.chr)
|
||||
w>>=8
|
||||
w >>= 8
|
||||
end
|
||||
end
|
||||
|
||||
def fputdw(w)
|
||||
4.times do
|
||||
b=w&0xFF
|
||||
b = w & 0xFF
|
||||
write(b.chr)
|
||||
w>>=8
|
||||
w >>= 8
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class File < IO
|
||||
=begin
|
||||
unless defined?(debugopen)
|
||||
@@ -124,12 +116,12 @@ class File < IO
|
||||
end
|
||||
end
|
||||
|
||||
def open(f,m="r")
|
||||
debugopen("debug.txt","ab") { |file| file.write([f,m,Time.now.to_f].inspect+"\r\n") }
|
||||
def open(f, m = "r")
|
||||
debugopen("debug.txt", "ab") { |file| file.write([f, m, Time.now.to_f].inspect + "\r\n") }
|
||||
if block_given?
|
||||
debugopen(f,m) { |file| yield file }
|
||||
debugopen(f, m) { |file| yield file }
|
||||
else
|
||||
return debugopen(f,m)
|
||||
return debugopen(f, m)
|
||||
end
|
||||
end
|
||||
=end
|
||||
@@ -137,8 +129,6 @@ class File < IO
|
||||
include FileOutputMixin
|
||||
end
|
||||
|
||||
|
||||
|
||||
class StringInput
|
||||
include FileInputMixin
|
||||
|
||||
@@ -152,12 +142,9 @@ class StringInput
|
||||
end
|
||||
end
|
||||
|
||||
def binmode
|
||||
end
|
||||
def binmode; end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class StringOutput
|
||||
include FileOutputMixin
|
||||
end
|
||||
|
||||
@@ -228,7 +228,6 @@ def pbGetText(infile)
|
||||
begin
|
||||
pbEachIntlSection(file) { |section,name|
|
||||
next if section.length==0
|
||||
index=name
|
||||
if !name[/^([Mm][Aa][Pp])?(\d+)$/]
|
||||
raise _INTL("Invalid section name {1}",name)
|
||||
end
|
||||
@@ -335,7 +334,7 @@ class OrderedHash < Hash
|
||||
return ret
|
||||
end
|
||||
|
||||
def _dump(depth=100)
|
||||
def _dump(_depth=100)
|
||||
values=[]
|
||||
for key in @keys
|
||||
values.push(self[key])
|
||||
@@ -476,7 +475,7 @@ class Messages
|
||||
@messages[type]=arr
|
||||
end
|
||||
|
||||
def self.createHash(type,array)
|
||||
def self.createHash(_type,array)
|
||||
arr=OrderedHash.new
|
||||
for i in 0...array.length
|
||||
if array[i]
|
||||
@@ -487,10 +486,8 @@ class Messages
|
||||
return arr
|
||||
end
|
||||
|
||||
def self.addToHash(type,array,hash)
|
||||
if !hash
|
||||
hash=OrderedHash.new
|
||||
end
|
||||
def self.addToHash(_type,array,hash)
|
||||
hash=OrderedHash.new if !hash
|
||||
for i in 0...array.length
|
||||
if array[i]
|
||||
key=Messages.stringToKey(array[i])
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
class Thread
|
||||
def Thread.exclusive
|
||||
_old = Thread.critical
|
||||
old_critical = Thread.critical
|
||||
begin
|
||||
Thread.critical = true
|
||||
return yield
|
||||
ensure
|
||||
Thread.critical = _old
|
||||
Thread.critical = old_critical
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -220,7 +220,7 @@ end
|
||||
def pbSEFade(x=0.0); pbSEStop(x);end
|
||||
|
||||
# Stops SE playback.
|
||||
def pbSEStop(timeInSeconds=0.0)
|
||||
def pbSEStop(_timeInSeconds=0.0)
|
||||
if $game_system
|
||||
$game_system.se_stop
|
||||
elsif (RPG.const_defined?(:SE) rescue false)
|
||||
|
||||
@@ -99,7 +99,7 @@ def pbPlaySoundData(samples,volume,async=false,sampleFreq=11025)
|
||||
saveToTemp = proc { |samples,freq|
|
||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
ret = nil
|
||||
for i in 1...1000
|
||||
999.times do
|
||||
name=""
|
||||
8.times { name += chars[rand(chars.length),1] }
|
||||
name = ENV["TEMP"]+"\\"+name+"_tmp.wav"
|
||||
@@ -110,14 +110,14 @@ def pbPlaySoundData(samples,volume,async=false,sampleFreq=11025)
|
||||
end
|
||||
return ret
|
||||
}
|
||||
playThenDelete = proc { |path,volume,length,async|
|
||||
playThenDelete = proc { |path,volume,length,_async|
|
||||
next if !path || !safeExists?(path)
|
||||
thread=Thread.new{
|
||||
Thread.stop
|
||||
_path=Thread.current[:path]
|
||||
_length=Thread.current[:length]
|
||||
sleep(_length)
|
||||
File.delete(_path) rescue nil
|
||||
cur_path=Thread.current[:path]
|
||||
cur_length=Thread.current[:length]
|
||||
sleep(cur_length)
|
||||
File.delete(cur_path) rescue nil
|
||||
}
|
||||
thread[:path]=path
|
||||
thread[:length]=length
|
||||
@@ -132,14 +132,14 @@ def pbPlaySoundData(samples,volume,async=false,sampleFreq=11025)
|
||||
waveOutHandle=" "*4
|
||||
code=waveOutOpen.call(waveOutHandle,-1,waveFormat,0,0,0)
|
||||
if code!=0
|
||||
timeLength=samples.length.to_f/sampleFreq
|
||||
timeLength=duration.to_f/sampleFreq
|
||||
path=saveToTemp.call(samples,sampleFreq)
|
||||
playThenDelete.call(path,volume,timeLength,async)
|
||||
return
|
||||
end
|
||||
waveOutHandle=waveOutHandle.unpack("L")[0]
|
||||
volume=(volume*65535/100)
|
||||
volume=(volume<<16)|volume
|
||||
volume=(volume << 16)|volume
|
||||
waveOutSetVolume.call(waveOutHandle,volume)
|
||||
code=waveOutPrepareHeader.call(waveOutHandle,waveHdr,waveHdr.length)
|
||||
if code!=0
|
||||
@@ -150,7 +150,6 @@ def pbPlaySoundData(samples,volume,async=false,sampleFreq=11025)
|
||||
Thread.stop
|
||||
waveOut=Thread.current[:waveOut]
|
||||
waveHdr=Thread.current[:waveHeader]
|
||||
waveData=Thread.current[:waveData]
|
||||
waveOutUnprepareHeader=Win32API.new("winmm.dll","waveOutUnprepareHeader","lpl","l")
|
||||
waveOutClose=Win32API.new("winmm.dll","waveOutClose","l","l")
|
||||
loop do
|
||||
@@ -272,7 +271,7 @@ class WaveData
|
||||
return ret
|
||||
end
|
||||
|
||||
def _dump(depth=100)
|
||||
def _dump(_depth=100)
|
||||
return Marshal.dump([@freq,Zlib::Deflate.deflate(@samples)])
|
||||
end
|
||||
|
||||
@@ -594,11 +593,17 @@ class WaveForm# :nodoc:
|
||||
def lcm(x,y)
|
||||
return y if x==0; return x if y==0
|
||||
return x if x==y
|
||||
if x>y; incr=x
|
||||
while x%y!=0; x+=incr; end
|
||||
if x>y
|
||||
incr=x
|
||||
while x%y!=0
|
||||
x+=incr
|
||||
end
|
||||
return x
|
||||
else; incr=y
|
||||
while y%x!=0; y+=incr; end
|
||||
else
|
||||
incr=y
|
||||
while y%x!=0
|
||||
y+=incr
|
||||
end
|
||||
return y
|
||||
end
|
||||
end
|
||||
@@ -626,7 +631,6 @@ class WaveForm# :nodoc:
|
||||
vol=@volumeIterator.getValue(fframe)
|
||||
end
|
||||
if @proc
|
||||
updateBuffer=false
|
||||
if @freqEnvelope.length>0 # Update frequency
|
||||
freq=@freqIterator.getValue(fframe)
|
||||
if freq!=@freq # update sample buffer
|
||||
@@ -843,8 +847,6 @@ module Audio
|
||||
t2=852 if "7pqrs8tuv9wxyzC".include?(tone)
|
||||
t2=941 if "*0#D".include?(tone)
|
||||
return if t1==0 || t2==0
|
||||
f1=Math::PI*2.0*t1/WaveForm::SAMPLEFREQ
|
||||
f2=Math::PI*2.0*t2/WaveForm::SAMPLEFREQ
|
||||
doubleSine(durationInMs,t1,t2,volume,volume,0.5,0.5,async)
|
||||
end
|
||||
|
||||
@@ -908,7 +910,7 @@ def callheld(duration,volume=95)
|
||||
volume,volume)
|
||||
end
|
||||
|
||||
def loudFastBusy(duration,volume=95)
|
||||
def loudFastBusy(duration,_volume=95)
|
||||
Audio.doubleSine(duration,
|
||||
SoundEnvelope.blink(480,250,250,duration),
|
||||
SoundEnvelope.blink(620,250,250,duration)
|
||||
@@ -1009,7 +1011,6 @@ end
|
||||
|
||||
# internal function
|
||||
def getOggPage(file)
|
||||
pos=file.pos
|
||||
fgetdw=proc { |file|
|
||||
(file.eof? ? 0 : (file.read(4).unpack("V")[0] || 0))
|
||||
}
|
||||
@@ -1035,13 +1036,15 @@ def oggfiletime(file)
|
||||
}
|
||||
pages=[]
|
||||
page=nil
|
||||
begin
|
||||
loop do
|
||||
page=getOggPage(file)
|
||||
if page
|
||||
pages.push(page)
|
||||
file.pos=page[3]
|
||||
else
|
||||
break
|
||||
end
|
||||
end while page
|
||||
end
|
||||
if pages.length==0
|
||||
return -1
|
||||
end
|
||||
@@ -1054,30 +1057,23 @@ def oggfiletime(file)
|
||||
serial=header[10,4].unpack("V")
|
||||
frame=header[2,8].unpack("C*")
|
||||
frameno=frame[7]
|
||||
frameno=(frameno<<8)|frame[6]
|
||||
frameno=(frameno<<8)|frame[5]
|
||||
frameno=(frameno<<8)|frame[4]
|
||||
frameno=(frameno<<8)|frame[3]
|
||||
frameno=(frameno<<8)|frame[2]
|
||||
frameno=(frameno<<8)|frame[1]
|
||||
frameno=(frameno<<8)|frame[0]
|
||||
frameno=(frameno << 8)|frame[6]
|
||||
frameno=(frameno << 8)|frame[5]
|
||||
frameno=(frameno << 8)|frame[4]
|
||||
frameno=(frameno << 8)|frame[3]
|
||||
frameno=(frameno << 8)|frame[2]
|
||||
frameno=(frameno << 8)|frame[1]
|
||||
frameno=(frameno << 8)|frame[0]
|
||||
if serial!=curserial
|
||||
curserial=serial
|
||||
file.pos=page[1]
|
||||
packtype=(file.read(1)[0] rescue 0)
|
||||
string=file.read(6)
|
||||
if string!="vorbis"
|
||||
return -1
|
||||
end
|
||||
if packtype!=1
|
||||
return -1
|
||||
end
|
||||
return -1 if string!="vorbis"
|
||||
return -1 if packtype!=1
|
||||
i+=1
|
||||
version=fgetdw.call(file)
|
||||
if version!=0
|
||||
return -1
|
||||
end
|
||||
channels=(file.read(1)[0] rescue 0)
|
||||
return -1 if version!=0
|
||||
rates[i]=fgetdw.call(file)
|
||||
end
|
||||
pcmlengths[i]=frameno
|
||||
@@ -1180,7 +1176,6 @@ end
|
||||
|
||||
# Creates wave data from the given WAV file path
|
||||
def getWaveData(filename)
|
||||
time=-1
|
||||
fgetdw=proc { |file|
|
||||
(file.eof? ? 0 : (file.read(4).unpack("V")[0] || 0))
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class WeakRef
|
||||
@@id_map = {}
|
||||
@@id_rev_map = {}
|
||||
@@final = lambda { |id|
|
||||
__old_status = Thread.critical
|
||||
old_thread_status = Thread.critical
|
||||
Thread.critical = true
|
||||
begin
|
||||
rids = @@id_map[id]
|
||||
@@ -61,7 +61,7 @@ class WeakRef
|
||||
@@id_map.delete(rid) if @@id_map[rid].empty?
|
||||
end
|
||||
ensure
|
||||
Thread.critical = __old_status
|
||||
Thread.critical = old_thread_status
|
||||
end
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class WeakRef
|
||||
|
||||
def __setobj__(obj)
|
||||
@__id = obj.__id__
|
||||
__old_status = Thread.critical
|
||||
old_thread_status = Thread.critical
|
||||
begin
|
||||
Thread.critical = true
|
||||
unless @@id_rev_map.key?(self)
|
||||
@@ -92,7 +92,7 @@ class WeakRef
|
||||
end
|
||||
@@id_map[@__id] = [] unless @@id_map[@__id]
|
||||
ensure
|
||||
Thread.critical = __old_status
|
||||
Thread.critical = old_thread_status
|
||||
end
|
||||
@@id_map[@__id].push self.__id__
|
||||
@@id_rev_map[self.__id__] = @__id
|
||||
@@ -111,7 +111,7 @@ class WeakHashtable
|
||||
include Enumerable
|
||||
|
||||
def initialize
|
||||
@hash={}
|
||||
@hash = {}
|
||||
end
|
||||
|
||||
def clear
|
||||
@@ -277,12 +277,12 @@ end
|
||||
# bitmap is freed when the reference count reaches 0.
|
||||
class Thread
|
||||
def Thread.exclusive
|
||||
_old = Thread.critical
|
||||
old_thread_status = Thread.critical
|
||||
begin
|
||||
Thread.critical = true
|
||||
return yield
|
||||
ensure
|
||||
Thread.critical = _old
|
||||
Thread.critical = old_thread_status
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -519,10 +519,10 @@ end
|
||||
# Fades and window activations for sprite hashes
|
||||
#===============================================================================
|
||||
class Game_Temp
|
||||
attr_accessor :fadestate
|
||||
attr_writer :fadestate
|
||||
|
||||
def fadestate
|
||||
return (@fadestate) ? @fadestate : 0
|
||||
return @fadestate || 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ class SpriteWindow < Window
|
||||
attr_reader :skinformat
|
||||
attr_reader :skinrect
|
||||
|
||||
def loadSkinFile(file)
|
||||
def loadSkinFile(_file)
|
||||
if (self.windowskin.width==80 || self.windowskin.width==96) &&
|
||||
self.windowskin.height==48
|
||||
# Body = X, Y, width, height of body rectangle within windowskin
|
||||
@@ -519,9 +519,9 @@ class SpriteWindow < Window
|
||||
dstbitmap.blt(x+left,y+top,srcbitmap,srcrect)
|
||||
x+=srcrect.width
|
||||
end
|
||||
y+=srcrect.height
|
||||
end
|
||||
end
|
||||
y+=srcrect.height
|
||||
end
|
||||
end
|
||||
|
||||
def privRefreshCursor
|
||||
contopac=self.contents_opacity
|
||||
@@ -666,8 +666,6 @@ class SpriteWindow < Window
|
||||
startX=@skinrect.x
|
||||
# width of top end of window
|
||||
startY=@skinrect.y
|
||||
backWidth=@skinrect.width
|
||||
backHeight=@skinrect.height
|
||||
cx=@skinrect.x+@skinrect.width # right side of BODY rect
|
||||
cy=@skinrect.y+@skinrect.height # bottom side of BODY rect
|
||||
# width of right end of window
|
||||
@@ -707,8 +705,6 @@ class SpriteWindow < Window
|
||||
end
|
||||
end
|
||||
if @_windowskin && !@_windowskin.disposed?
|
||||
backTrimX=startX+endX
|
||||
backTrimY=startX+endX
|
||||
borderX=startX+endX
|
||||
borderY=startY+endY
|
||||
@sprites["corner0"].x=@x
|
||||
@@ -857,8 +853,6 @@ class SpriteWindow < Window
|
||||
sprite.zoom_x=1.0
|
||||
sprite.oy=0
|
||||
sprite.y=(@y+(@height/2.0)+(@height*ratio*opn)-(@height/2*opn)).floor
|
||||
oldbitmap=sprite.bitmap
|
||||
oldsrcrect=sprite.src_rect.clone
|
||||
end
|
||||
else
|
||||
for k in @spritekeys
|
||||
@@ -1117,7 +1111,6 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
attr_reader :baseColor
|
||||
attr_reader :shadowColor
|
||||
attr_accessor :letterbyletter
|
||||
attr_reader :lineHeight
|
||||
attr_reader :waitcount
|
||||
|
||||
def initialize(text="")
|
||||
@@ -1291,7 +1284,6 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
@curchar = 0
|
||||
@drawncurchar = -1
|
||||
@lastDrawnChar = -1
|
||||
oldtext = @text
|
||||
@text = value
|
||||
@textlength = unformattedTextLength(value)
|
||||
@scrollstate = 0
|
||||
@@ -1466,7 +1458,6 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
self.oy = @scrollY
|
||||
numchars = @numtextchars
|
||||
numchars = [@curchar,@numtextchars].min if self.letterbyletter
|
||||
startchar = 0
|
||||
return if busy? && @drawncurchar==@curchar && @scrollstate==0
|
||||
if !self.letterbyletter || !oldcontents.equal?(self.contents)
|
||||
@drawncurchar = -1
|
||||
@@ -1614,7 +1605,6 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
attr_reader :number
|
||||
attr_reader :sign
|
||||
|
||||
def initialize(digits_max)
|
||||
@@ -1643,13 +1633,6 @@ class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
@number*(@sign && @negative ? -1 : 1)
|
||||
end
|
||||
|
||||
def sign=(value)
|
||||
@sign=value
|
||||
self.width=@digits_max*24+8+self.borderX+(@sign ? 24 : 0)
|
||||
@index=(@digits_max-1)+(@sign ? 1 : 0)
|
||||
refresh
|
||||
end
|
||||
|
||||
def number=(value)
|
||||
value=0 if !value.is_a?(Numeric)
|
||||
if @sign
|
||||
@@ -1661,13 +1644,19 @@ class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
refresh
|
||||
end
|
||||
|
||||
def sign=(value)
|
||||
@sign=value
|
||||
self.width=@digits_max*24+8+self.borderX+(@sign ? 24 : 0)
|
||||
@index=(@digits_max-1)+(@sign ? 1 : 0)
|
||||
refresh
|
||||
end
|
||||
|
||||
def refresh
|
||||
self.contents=pbDoEnsureBitmap(self.contents,
|
||||
self.width-self.borderX,self.height-self.borderY)
|
||||
pbSetSystemFont(self.contents)
|
||||
self.contents.clear
|
||||
s=sprintf("%0*d",@digits_max,@number.abs)
|
||||
x=0
|
||||
if @sign
|
||||
textHelper(0,0,@negative ? "-" : "+",0)
|
||||
end
|
||||
@@ -2080,7 +2069,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
|
||||
end
|
||||
|
||||
def textWidth(bitmap,text)
|
||||
return tmpbitmap.text_size(i).width
|
||||
return bitmap.text_size(text).width
|
||||
end
|
||||
|
||||
def getAutoDims(commands,dims,width=nil)
|
||||
@@ -2230,7 +2219,7 @@ class Window_CommandPokemon < Window_DrawableCommand
|
||||
return @commands ? @commands.length : 0
|
||||
end
|
||||
|
||||
def drawItem(index,count,rect)
|
||||
def drawItem(index,_count,rect)
|
||||
pbSetSystemFont(self.contents) if @starting
|
||||
rect=drawCursor(index,rect)
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,
|
||||
@@ -2344,7 +2333,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
||||
return @commands ? @commands.length : 0
|
||||
end
|
||||
|
||||
def drawItem(index,count,rect)
|
||||
def drawItem(index,_count,rect)
|
||||
pbSetSystemFont(self.contents)
|
||||
rect=drawCursor(index,rect)
|
||||
if toUnformattedText(@commands[index]).gsub(/\n/,"")==@commands[index]
|
||||
|
||||
@@ -111,7 +111,7 @@ class PngAnimatedBitmap
|
||||
@currentFrame
|
||||
end
|
||||
|
||||
def frameDelay(index)
|
||||
def frameDelay(_index)
|
||||
return @frameDelay
|
||||
end
|
||||
|
||||
@@ -259,10 +259,6 @@ class GifBitmap
|
||||
return @gifbitmaps[index]
|
||||
end
|
||||
|
||||
def width; self.bitmap.width; end
|
||||
|
||||
def height; self.bitmap.height; end
|
||||
|
||||
def deanimate
|
||||
for i in 1...@gifbitmaps.length
|
||||
@gifbitmaps[i].dispose
|
||||
@@ -349,7 +345,7 @@ end
|
||||
|
||||
def pbGetTileBitmap(filename, tile_id, hue)
|
||||
return BitmapCache.tileEx(filename, tile_id, hue) { |f|
|
||||
AnimatedBitmap.new("Graphics/Tilesets/"+filename).deanimate;
|
||||
AnimatedBitmap.new("Graphics/Tilesets/"+filename).deanimate
|
||||
}
|
||||
end
|
||||
|
||||
@@ -1000,8 +996,10 @@ class LargePlane < Plane
|
||||
top = (dstrect.y-@__oy/@__sprite.zoom_y).to_i
|
||||
while left>0; left -= srcbitmap.width; end
|
||||
while top>0; top -= srcbitmap.height; end
|
||||
y = top; while y<dstrect.height
|
||||
x = left; while x<dstrect.width
|
||||
y = top
|
||||
while y<dstrect.height
|
||||
x = left
|
||||
while x<dstrect.width
|
||||
dstbitmap.blt(x+@borderX,y+@borderY,srcbitmap,srcrect)
|
||||
x += srcrect.width
|
||||
end
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
# Text colours
|
||||
#===============================================================================
|
||||
def ctag(color)
|
||||
ret=(color.red.to_i<<24)
|
||||
ret|=((color.green.to_i)<<16)
|
||||
ret|=((color.blue.to_i)<<8)
|
||||
ret=(color.red.to_i << 24)
|
||||
ret|=((color.green.to_i) << 16)
|
||||
ret|=((color.blue.to_i) << 8)
|
||||
ret|=((color.alpha.to_i))
|
||||
return sprintf("<c=%08X>",ret)
|
||||
end
|
||||
@@ -168,13 +168,9 @@ end
|
||||
|
||||
def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
||||
newlineBreaks=true,explicitBreaksOnly=false)
|
||||
numchars=0
|
||||
x=y=0
|
||||
characters=[]
|
||||
charactersInternal=[]
|
||||
textchunks=[]
|
||||
controls=[]
|
||||
charsonline=0
|
||||
textchunks.push(text)
|
||||
text=textchunks.join("")
|
||||
textchars=text.scan(/./m)
|
||||
@@ -192,19 +188,18 @@ def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
||||
end
|
||||
defaultfontname=defaultfontname.clone
|
||||
havenl=false
|
||||
position=0;while position<textchars.length
|
||||
position=0
|
||||
while position<textchars.length
|
||||
yStart=0
|
||||
xStart=0
|
||||
width=isWaitChar(textchars[position]) ? 0 : bitmap.text_size(textchars[position]).width
|
||||
if textchars[position]=="\n"
|
||||
if newlineBreaks # treat newline as break
|
||||
if true
|
||||
havenl=true
|
||||
characters.push(["\n",x,y*lineheight+yDst,0,lineheight,false,false,
|
||||
false,colorclone,nil,false,false,"",8,position,nil,0])
|
||||
y+=1
|
||||
x=0
|
||||
end
|
||||
havenl=true
|
||||
characters.push(["\n",x,y*lineheight+yDst,0,lineheight,false,false,
|
||||
false,colorclone,nil,false,false,"",8,position,nil,0])
|
||||
y+=1
|
||||
x=0
|
||||
hadspace=true
|
||||
hadnonspace=false
|
||||
position+=1
|
||||
@@ -223,10 +218,8 @@ def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
||||
elsif isspace
|
||||
hadspace=true
|
||||
end
|
||||
textx=x+xStart # independent of xDst
|
||||
texty=(lineheight*y)+yDst+yStart
|
||||
oldx=x
|
||||
# Push character, textx will be calculated later
|
||||
# Push character
|
||||
if heightDst<0 || yStart<yDst+heightDst
|
||||
havenl=true if isWaitChar(textchars[position])
|
||||
characters.push([
|
||||
@@ -455,11 +448,9 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
||||
dummybitmap.dispose if dummybitmap
|
||||
return ret
|
||||
end
|
||||
numchars=0
|
||||
x=y=0
|
||||
characters=[]
|
||||
charactersInternal=[]
|
||||
charsonline=0
|
||||
realtext=nil
|
||||
realtextStart=""
|
||||
if !explicitBreaksOnly && textchunks.join("").length==0
|
||||
@@ -511,7 +502,8 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
||||
hadspace=false
|
||||
hadnonspace=false
|
||||
havenl=false
|
||||
position=0; while position<textchars.length
|
||||
position=0
|
||||
while position<textchars.length
|
||||
nextline=0
|
||||
graphic=nil
|
||||
graphicX=0
|
||||
@@ -712,11 +704,9 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
||||
elsif isspace
|
||||
hadspace=true
|
||||
end
|
||||
textx=x+xStart # independent of xDst
|
||||
texty=(lineheight*y)+yDst+yStart
|
||||
colors=getLastColors(colorstack,opacitystack,defaultcolors)
|
||||
oldx=x
|
||||
# Push character, textx will be calculated later
|
||||
# Push character
|
||||
if heightDst<0 || texty<yDst+heightDst
|
||||
havenl=true if !graphic && isWaitChar(textchars[position])
|
||||
extraspace=(!graphic && italiccount>0) ? 2+(width/2) : 2
|
||||
@@ -909,7 +899,6 @@ def getLineBrokenChunks(bitmap,value,width,dims,plain=false)
|
||||
reNoMatch=/<c=[^>]+>/
|
||||
return ret if !bitmap || bitmap.disposed? || width<=0
|
||||
textmsg=value.clone
|
||||
lines=0
|
||||
color=Font.default_color
|
||||
while (c = textmsg.slice!(/\n|[^ \r\t\f\n\-]*\-+|(\S*([ \r\t\f]?))/)) != nil
|
||||
break if c==""
|
||||
@@ -1111,7 +1100,7 @@ def coloredToFormattedText(text,baseColor=nil,shadowColor=nil)
|
||||
end
|
||||
|
||||
# Deprecated -- not to be used in new code
|
||||
def drawColoredTextEx(bitmap,x,y,width,text,baseColor=nil,shadowColor=nil)
|
||||
def drawColoredTextEx(bitmap,x,y,width,text,_baseColor=nil,_shadowColor=nil)
|
||||
chars=getFormattedText(bitmap,x,y,width,-1,coloredToFormattedText(text),32)
|
||||
drawFormattedChars(bitmap,chars)
|
||||
end
|
||||
|
||||
@@ -315,12 +315,13 @@ module InterpreterMixin
|
||||
if common_event != nil
|
||||
interp = Interpreter.new
|
||||
interp.setup(common_event.list,0)
|
||||
begin
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
interp.update
|
||||
pbUpdateSceneMap
|
||||
end while interp.running?
|
||||
break if !interp.running?
|
||||
end
|
||||
end
|
||||
else
|
||||
$game_system.battle_interpreter.setup(common_event.list, 0)
|
||||
@@ -705,7 +706,7 @@ class ChooseNumberParams
|
||||
ret=0
|
||||
if @maxDigits>0
|
||||
ret=-((10**@maxDigits)-1)
|
||||
elsif
|
||||
else
|
||||
ret=@minNumber
|
||||
end
|
||||
ret=0 if !@negativeAllowed && ret<0
|
||||
@@ -716,7 +717,7 @@ class ChooseNumberParams
|
||||
ret=0
|
||||
if @maxDigits>0
|
||||
ret=((10**@maxDigits)-1)
|
||||
elsif
|
||||
else
|
||||
ret=@maxNumber
|
||||
end
|
||||
ret=0 if !@negativeAllowed && ret<0
|
||||
@@ -767,9 +768,7 @@ def pbChooseNumber(msgwindow,params)
|
||||
cmdwindow.setSkin(params.skin) if params.skin
|
||||
cmdwindow.sign=params.negativesAllowed # must be set before number
|
||||
cmdwindow.number=defaultNumber
|
||||
curnumber=defaultNumber
|
||||
pbPositionNearMsgWindow(cmdwindow,msgwindow,:right)
|
||||
command=0
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -1007,7 +1006,6 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
|
||||
oldletterbyletter=msgwindow.letterbyletter
|
||||
msgwindow.letterbyletter=(letterbyletter) ? true : false
|
||||
ret=nil
|
||||
count=0
|
||||
commands=nil
|
||||
facewindow=nil
|
||||
goldwindow=nil
|
||||
@@ -1048,17 +1046,19 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
|
||||
m = $1.to_i
|
||||
next getSkinColor(msgwindow.windowskin,m,isDarkSkin)
|
||||
}
|
||||
begin
|
||||
loop do
|
||||
last_text = text.clone
|
||||
text.gsub!(/\\v\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
|
||||
end until text == last_text
|
||||
begin
|
||||
break if text == last_text
|
||||
end
|
||||
loop do
|
||||
last_text = text.clone
|
||||
text.gsub!(/\\l\[([0-9]+)\]/i) {
|
||||
linecount = [1,$1.to_i].max
|
||||
next ""
|
||||
}
|
||||
end until text == last_text
|
||||
break if text == last_text
|
||||
end
|
||||
colortag = ""
|
||||
if ($game_message && $game_message.background>0) ||
|
||||
($game_system && $game_system.respond_to?("message_frame") &&
|
||||
@@ -1156,7 +1156,7 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
|
||||
########## Show text #############################
|
||||
msgwindow.text = text
|
||||
Graphics.frame_reset if Graphics.frame_rate>40
|
||||
begin
|
||||
loop do
|
||||
if signWaitCount>0
|
||||
signWaitCount -= 1
|
||||
if atTop
|
||||
@@ -1256,7 +1256,8 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
|
||||
pbUpdateSceneMap
|
||||
msgwindow.update
|
||||
yield if block_given?
|
||||
end until (!letterbyletter || commandProc || commands) && !msgwindow.busy?
|
||||
break if (!letterbyletter || commandProc || commands) && !msgwindow.busy?
|
||||
end
|
||||
Input.update # Must call Input.update again to avoid extra triggers
|
||||
msgwindow.letterbyletter=oldletterbyletter
|
||||
if commands
|
||||
|
||||
@@ -46,7 +46,7 @@ class Window_CharacterEntry < Window_DrawableCommand
|
||||
return @charset.length+3
|
||||
end
|
||||
|
||||
def drawItem(index,count,rect)
|
||||
def drawItem(index,_count,rect)
|
||||
rect=drawCursor(index,rect)
|
||||
if index==@charset.length # -1
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,"[ ]",
|
||||
@@ -70,9 +70,9 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class CharacterEntryHelper
|
||||
attr_reader :text
|
||||
attr_reader :maxlength
|
||||
attr_reader :passwordChar
|
||||
attr_reader :text
|
||||
attr_accessor :maxlength
|
||||
attr_reader :passwordChar
|
||||
attr_accessor :cursor
|
||||
|
||||
def initialize(text)
|
||||
@@ -80,12 +80,10 @@ class CharacterEntryHelper
|
||||
@text=text
|
||||
@passwordChar=""
|
||||
@cursor=text.scan(/./m).length
|
||||
ensure
|
||||
end
|
||||
|
||||
def text=(value)
|
||||
@text=value
|
||||
ensure
|
||||
end
|
||||
|
||||
def textChars
|
||||
@@ -100,11 +98,6 @@ class CharacterEntryHelper
|
||||
@passwordChar=value ? value : ""
|
||||
end
|
||||
|
||||
def maxlength=(value)
|
||||
@maxlength=value
|
||||
ensure
|
||||
end
|
||||
|
||||
def length
|
||||
return self.text.scan(/./m).length
|
||||
end
|
||||
@@ -264,7 +257,6 @@ class Window_TextEntry < SpriteWindow_Base
|
||||
end
|
||||
x+=4
|
||||
width=self.width-self.borderX
|
||||
height=self.height-self.borderY
|
||||
cursorcolor=Color.new(16,24,32)
|
||||
textscan=self.text.scan(/./m)
|
||||
scanlength=textscan.length
|
||||
@@ -316,8 +308,6 @@ def getLineBrokenText(bitmap,value,width,dims)
|
||||
column=0
|
||||
return ret if !bitmap || bitmap.disposed? || width<=0
|
||||
textmsg=value.clone
|
||||
lines=0
|
||||
color=Font.default_color
|
||||
ret.push(["",0,0,0,bitmap.text_size("X").height,0,0,0,0])
|
||||
while ((c = textmsg.slice!(/\n|(\S*([ \r\t\f]?))/)) != nil)
|
||||
break if c==""
|
||||
@@ -334,7 +324,6 @@ def getLineBrokenText(bitmap,value,width,dims)
|
||||
ret.push(["",x,y,0,textheight,line,position,column,0])
|
||||
next
|
||||
end
|
||||
textcols=[]
|
||||
words=[ccheck]
|
||||
for i in 0...words.length
|
||||
word=words[i]
|
||||
@@ -355,7 +344,6 @@ def getLineBrokenText(bitmap,value,width,dims)
|
||||
x+=textwidth
|
||||
dims[0]=x if dims && dims[0]<x
|
||||
end
|
||||
color=textcols[i] if textcols[i]
|
||||
end
|
||||
position+=length
|
||||
column+=length
|
||||
@@ -451,87 +439,72 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
|
||||
def getTotalLines
|
||||
textchars=getTextChars
|
||||
if textchars.length==0
|
||||
return 1
|
||||
else
|
||||
tchar=textchars[textchars.length-1]
|
||||
return tchar[5]+1
|
||||
end
|
||||
return 1 if textchars.length==0
|
||||
tchar=textchars[textchars.length-1]
|
||||
return tchar[5]+1
|
||||
end
|
||||
|
||||
def getLineY(line)
|
||||
textchars=getTextChars
|
||||
if textchars.length==0
|
||||
return 0
|
||||
else
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
maximumY=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
y=textchars[i][2]
|
||||
return y if thisline==line
|
||||
maximumY=y if maximumY<y
|
||||
end
|
||||
return maximumY
|
||||
return 0 if textchars.length==0
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
maximumY=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
y=textchars[i][2]
|
||||
return y if thisline==line
|
||||
maximumY=y if maximumY<y
|
||||
end
|
||||
return maximumY
|
||||
end
|
||||
|
||||
def getColumnsInLine(line)
|
||||
textchars=getTextChars
|
||||
if textchars.length==0
|
||||
return 0
|
||||
else
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
endpos=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thispos=textchars[i][6]
|
||||
thislength=textchars[i][8]
|
||||
if thisline==line
|
||||
endpos+=thislength
|
||||
end
|
||||
end
|
||||
return endpos
|
||||
return 0 if textchars.length==0
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
endpos=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thislength=textchars[i][8]
|
||||
endpos+=thislength if thisline==line
|
||||
end
|
||||
return endpos
|
||||
end
|
||||
|
||||
def getPosFromLineAndColumn(line,column)
|
||||
textchars=getTextChars
|
||||
if textchars.length==0
|
||||
return 0
|
||||
else
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
endpos=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thispos=textchars[i][6]
|
||||
thiscolumn=textchars[i][7]
|
||||
thislength=textchars[i][8]
|
||||
if thisline==line
|
||||
endpos=thispos+thislength
|
||||
# echoln [endpos,thispos+(column-thiscolumn),textchars[i]]
|
||||
if column>=thiscolumn && column<=thiscolumn+thislength && thislength>0
|
||||
return thispos+(column-thiscolumn)
|
||||
end
|
||||
return 0 if textchars.length==0
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
endpos=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thispos=textchars[i][6]
|
||||
thiscolumn=textchars[i][7]
|
||||
thislength=textchars[i][8]
|
||||
if thisline==line
|
||||
endpos=thispos+thislength
|
||||
# echoln [endpos,thispos+(column-thiscolumn),textchars[i]]
|
||||
if column>=thiscolumn && column<=thiscolumn+thislength && thislength>0
|
||||
return thispos+(column-thiscolumn)
|
||||
end
|
||||
end
|
||||
if endpos==0
|
||||
# echoln [totallines,line,column]
|
||||
# echoln textchars
|
||||
end
|
||||
# echoln "endpos=#{endpos}"
|
||||
return endpos
|
||||
end
|
||||
# if endpos==0
|
||||
# echoln [totallines,line,column]
|
||||
# echoln textchars
|
||||
# end
|
||||
# echoln "endpos=#{endpos}"
|
||||
return endpos
|
||||
end
|
||||
|
||||
def getLastVisibleLine
|
||||
textchars=getTextChars()
|
||||
getTextChars()
|
||||
textheight=[1,self.contents.text_size("X").height].max
|
||||
lastVisible=@firstline+((self.height-self.borderY)/textheight)-1
|
||||
return lastVisible
|
||||
@@ -544,13 +517,9 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
@frame=0
|
||||
self.refresh
|
||||
end
|
||||
if @cursorLine<@firstline
|
||||
@firstline=@cursorLine
|
||||
end
|
||||
@firstline=@cursorLine if @cursorLine<@firstline
|
||||
lastVisible=getLastVisibleLine()
|
||||
if @cursorLine>lastVisible
|
||||
@firstline+=(@cursorLine-lastVisible)
|
||||
end
|
||||
@firstline+=(@cursorLine-lastVisible) if @cursorLine>lastVisible
|
||||
end
|
||||
|
||||
def moveCursor(lineOffset, columnOffset)
|
||||
@@ -570,7 +539,6 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
# Will happen if cursor is moved right from the end of a line
|
||||
@cursorLine+=1
|
||||
@cursorColumn=0
|
||||
updateColumns=true
|
||||
end
|
||||
# Ensure column bounds
|
||||
totalColumns=getColumnsInLine(@cursorLine)
|
||||
@@ -688,20 +656,13 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
self.contents=newContents
|
||||
bitmap=self.contents
|
||||
bitmap.clear
|
||||
x=0
|
||||
y=0
|
||||
getTextChars
|
||||
x+=4
|
||||
width=self.width-self.borderX
|
||||
height=self.height-self.borderY
|
||||
cursorcolor=Color.new(0,0,0)
|
||||
textchars=getTextChars()
|
||||
scanlength=@helper.length
|
||||
startY=getLineY(@firstline)
|
||||
lastheight=32
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thispos=textchars[i][6]
|
||||
thiscolumn=textchars[i][7]
|
||||
thislength=textchars[i][8]
|
||||
textY=textchars[i][2]-startY
|
||||
@@ -712,11 +673,10 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
c=textchars[i][0]
|
||||
# Don't draw spaces
|
||||
next if c==" "
|
||||
textwidth=textchars[i][3]+4 # add 4 to prevent draw_text from stretching text
|
||||
textwidth=textchars[i][3]+4 # add 4 to prevent draw_text from stretching text
|
||||
textheight=textchars[i][4]
|
||||
lastheight=textheight
|
||||
# Draw text
|
||||
pbDrawShadowText(bitmap,textchars[i][1],textY, textwidth, textheight, c,@baseColor,@shadowColor)
|
||||
pbDrawShadowText(bitmap, textchars[i][1], textY, textwidth, textheight, c, @baseColor, @shadowColor)
|
||||
end
|
||||
# Draw cursor
|
||||
if ((@frame/10)&1) == 0
|
||||
@@ -725,7 +685,6 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
cursorX=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thispos=textchars[i][6]
|
||||
thiscolumn=textchars[i][7]
|
||||
thislength=textchars[i][8]
|
||||
if thisline==@cursorLine && @cursorColumn>=thiscolumn &&
|
||||
@@ -1560,7 +1519,6 @@ class Interpreter
|
||||
if $game_actors && $data_actors && $data_actors[@parameters[0]] != nil
|
||||
# Set battle abort flag
|
||||
$game_temp.battle_abort = true
|
||||
ret=""
|
||||
pbFadeOutIn {
|
||||
sscene=PokemonEntryScene.new
|
||||
sscreen=PokemonEntry.new(sscene)
|
||||
@@ -1583,7 +1541,6 @@ class Game_Interpreter
|
||||
end
|
||||
if $game_actors && $data_actors && $data_actors[@params[0]] != nil
|
||||
# Set battle abort flag
|
||||
ret=""
|
||||
pbFadeOutIn {
|
||||
sscene=PokemonEntryScene.new
|
||||
sscreen=PokemonEntry.new(sscene)
|
||||
|
||||
@@ -385,7 +385,6 @@ class RandomStripeTransition
|
||||
rect = Rect.new(0,0,(dir==0) ? size : Graphics.width,(dir==0) ? Graphics.height : size)
|
||||
buffer = @buffer
|
||||
sprite = @sprite
|
||||
phase = @numframes-@duration
|
||||
count = (bands-bands*@duration/@numframes)-@rand_stripe_deleted_count
|
||||
while count > 0
|
||||
@rand_stripe_deleted[@rand_stripe_index_array.pop] = true
|
||||
|
||||
@@ -53,7 +53,6 @@ end
|
||||
|
||||
|
||||
def pbTextBitmap(text, maxwidth=Graphics.width)
|
||||
dims = []
|
||||
tmp = Bitmap.new(maxwidth,Graphics.height)
|
||||
pbSetSystemFont(tmp)
|
||||
drawFormattedTextEx(tmp,0,0,maxwidth,text,Color.new(248,248,248),Color.new(168,184,184))
|
||||
|
||||
@@ -3,7 +3,7 @@ class IntroEventScene < EventScene
|
||||
TICKS_PER_ENTER_FLASH = 40
|
||||
FADE_TICKS = 8
|
||||
|
||||
def initialize(pics,splash,viewport=nil)
|
||||
def initialize(pics,splash,_viewport=nil)
|
||||
super(nil)
|
||||
@pics = pics
|
||||
@splash = splash
|
||||
@@ -17,7 +17,7 @@ class IntroEventScene < EventScene
|
||||
openPic(self,nil)
|
||||
end
|
||||
|
||||
def openPic(scene,args)
|
||||
def openPic(_scene,_args)
|
||||
onCTrigger.clear
|
||||
@pic.name = "Graphics/Titles/"+@pics[@index]
|
||||
# fade to opacity 255 in FADE_TICKS ticks after waiting 0 frames
|
||||
@@ -49,7 +49,7 @@ class IntroEventScene < EventScene
|
||||
end
|
||||
end
|
||||
|
||||
def openSplash(scene,args)
|
||||
def openSplash(_scene,_args)
|
||||
onUpdate.clear
|
||||
onCTrigger.clear
|
||||
@pic.name = "Graphics/Titles/"+@splash
|
||||
@@ -63,7 +63,7 @@ class IntroEventScene < EventScene
|
||||
onCTrigger.set(method(:closeSplash)) # call closeSplash when C key is pressed
|
||||
end
|
||||
|
||||
def closeSplash(scene,args)
|
||||
def closeSplash(scene,_args)
|
||||
onUpdate.clear
|
||||
onCTrigger.clear
|
||||
# Play random cry
|
||||
@@ -83,7 +83,7 @@ class IntroEventScene < EventScene
|
||||
sscreen.pbStartLoadScreen
|
||||
end
|
||||
|
||||
def closeSplashDelete(scene,args)
|
||||
def closeSplashDelete(scene,_args)
|
||||
onUpdate.clear
|
||||
onCTrigger.clear
|
||||
# Play random cry
|
||||
|
||||
@@ -6,30 +6,30 @@
|
||||
# pbEventScreen(ButtonEventScene)
|
||||
#==============================================================================
|
||||
class ButtonEventScene < EventScene
|
||||
def initialize(viewport=nil)
|
||||
def initialize(viewport = nil)
|
||||
super
|
||||
Graphics.freeze
|
||||
addImage(0,0,"Graphics/Pictures/helpbg")
|
||||
@labels=[
|
||||
addLabel(52*2,13*2,Graphics.width*3/4,_INTL("Moves the main character. Also used to scroll through list entries.")),
|
||||
addLabel(52*2,53*2,Graphics.width*3/4,_INTL("Used to confirm a choice, check things, and talk to people.")),
|
||||
addLabel(52*2,93*2,Graphics.width*3/4,_INTL("Used to exit, cancel a choice or mode, and open the pause menu.")),
|
||||
addLabel(52*2,133*2,Graphics.width*3/4,_INTL("Hold down while walking to run.")),
|
||||
addLabel(52*2,157*2,Graphics.width*3/4,_INTL("Press to use a registered Key Item."))
|
||||
addImage(0, 0, "Graphics/Pictures/helpbg")
|
||||
@labels = [
|
||||
addLabel(52 * 2, 13 * 2, Graphics.width * 3 / 4, _INTL("Moves the main character. Also used to scroll through list entries.")),
|
||||
addLabel(52 * 2, 53 * 2, Graphics.width * 3 / 4, _INTL("Used to confirm a choice, check things, and talk to people.")),
|
||||
addLabel(52 * 2, 93 * 2, Graphics.width * 3 / 4, _INTL("Used to exit, cancel a choice or mode, and open the pause menu.")),
|
||||
addLabel(52 * 2, 133 * 2, Graphics.width * 3 / 4, _INTL("Hold down while walking to run.")),
|
||||
addLabel(52 * 2, 157 * 2, Graphics.width * 3 / 4, _INTL("Press to use a registered Key Item."))
|
||||
]
|
||||
@keys=[
|
||||
addImage(26*2,18*2,"Graphics/Pictures/helpArrowKeys"),
|
||||
addImage(26*2,59*2,"Graphics/Pictures/helpCkey"),
|
||||
addImage(26*2,99*2,"Graphics/Pictures/helpXkey"),
|
||||
addImage(26*2,130*2,"Graphics/Pictures/helpZkey"),
|
||||
addImage(26*2,154*2,"Graphics/Pictures/helpFkey")
|
||||
@keys = [
|
||||
addImage(26 * 2, 18 * 2, "Graphics/Pictures/helpArrowKeys"),
|
||||
addImage(26 * 2, 59 * 2, "Graphics/Pictures/helpCkey"),
|
||||
addImage(26 * 2, 99 * 2, "Graphics/Pictures/helpXkey"),
|
||||
addImage(26 * 2, 130 * 2, "Graphics/Pictures/helpZkey"),
|
||||
addImage(26 * 2, 154 * 2, "Graphics/Pictures/helpFkey")
|
||||
]
|
||||
for key in @keys
|
||||
key.origin=PictureOrigin::Top
|
||||
key.origin = PictureOrigin::Top
|
||||
end
|
||||
for i in 0...5 # Make everything show (almost) immediately
|
||||
@keys[i].setOrigin(0,PictureOrigin::Top)
|
||||
@keys[i].setOpacity(0,255)
|
||||
@keys[i].setOrigin(0, PictureOrigin::Top)
|
||||
@keys[i].setOpacity(0, 255)
|
||||
end
|
||||
pictureWait # Update event scene with the changes
|
||||
Graphics.transition(20)
|
||||
@@ -37,7 +37,7 @@ class ButtonEventScene < EventScene
|
||||
onCTrigger.set(method(:pbOnScreen1))
|
||||
end
|
||||
|
||||
def pbOnScreen1(scene,args)
|
||||
def pbOnScreen1(scene,_args)
|
||||
# End scene
|
||||
Graphics.freeze
|
||||
scene.dispose
|
||||
|
||||
@@ -135,7 +135,6 @@ _END_
|
||||
line = line.split("<s>")
|
||||
# LINE ADDED: If you use in your own game, you should remove this line
|
||||
pbSetSystemFont(credit_bitmap) # <--- This line was added
|
||||
x = 0
|
||||
xpos = 0
|
||||
align = 1 # Centre align
|
||||
linewidth = Graphics.width
|
||||
|
||||
@@ -15,7 +15,7 @@ class Scene_Movie
|
||||
def main
|
||||
@temp = Win32API.pbFindRgssWindow.to_s
|
||||
movie = Win32API.new('winmm','mciSendString','%w(p,p,l,l)','V')
|
||||
x=movie.call("open \""+@movie_name+
|
||||
movie.call("open \""+@movie_name+
|
||||
"\" alias FILE style 1073741824 parent " + @temp.to_s,0,0,0)
|
||||
@message = Win32API.new('user32','SendMessage','%w(l,l,l,l)','V')
|
||||
@detector = Win32API.new('user32','GetSystemMetrics','%w(l)','L')
|
||||
@@ -31,7 +31,7 @@ class Scene_Movie
|
||||
#fullscreen
|
||||
end
|
||||
status = " " * 255
|
||||
x=movie.call("play FILE",0,0,0)
|
||||
movie.call("play FILE",0,0,0)
|
||||
loop do
|
||||
sleep(0.1)
|
||||
@message.call(@temp.to_i,11,0,0)
|
||||
|
||||
@@ -54,8 +54,8 @@ class PBMoveData
|
||||
attr_reader :function,:basedamage,:type,:accuracy,:category
|
||||
attr_reader :totalpp,:addlEffect,:target,:priority,:flags
|
||||
|
||||
def initialize(moveid)
|
||||
moveData = pbGetMoveData(moveID)
|
||||
def initialize(move_id)
|
||||
moveData = pbGetMoveData(move_id)
|
||||
@function = moveData[MOVE_FUNCTION_CODE]
|
||||
@basedamage = moveData[MOVE_BASE_DAMAGE]
|
||||
@type = moveData[MOVE_TYPE]
|
||||
|
||||
@@ -11,15 +11,16 @@ begin
|
||||
def self.getName(id)
|
||||
id = getID(PBStatuses,id)
|
||||
names = [
|
||||
_INTL("healthy"),
|
||||
_INTL("asleep"),
|
||||
_INTL("poisoned"),
|
||||
_INTL("burned"),
|
||||
_INTL("paralyzed"),
|
||||
_INTL("frozen")
|
||||
_INTL("healthy"),
|
||||
_INTL("asleep"),
|
||||
_INTL("poisoned"),
|
||||
_INTL("burned"),
|
||||
_INTL("paralyzed"),
|
||||
_INTL("frozen")
|
||||
]
|
||||
return names[id]
|
||||
end end
|
||||
end
|
||||
end
|
||||
|
||||
rescue Exception
|
||||
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
|
||||
|
||||
@@ -185,12 +185,10 @@ module PBExperience
|
||||
mLevel = maxLevel
|
||||
maxexp = pbGetExpInternal(mLevel,growth)
|
||||
exp = maxexp if exp>maxexp
|
||||
i = 0
|
||||
for j in 0..mLevel
|
||||
currentExp = pbGetExpInternal(i,growth)
|
||||
return i if exp==currentExp
|
||||
return i-1 if exp<currentExp
|
||||
i += 1
|
||||
for lvl in 0..mLevel
|
||||
currentExp = pbGetExpInternal(lvl,growth)
|
||||
return lvl if exp==currentExp
|
||||
return lvl-1 if exp<currentExp
|
||||
end
|
||||
return mLevel
|
||||
end
|
||||
|
||||
@@ -21,21 +21,21 @@ module PBEggGroups
|
||||
def self.getName(id)
|
||||
id = getID(PBEggGroups,id)
|
||||
names = [
|
||||
_INTL("Undiscovered"),
|
||||
_INTL("Monster"),
|
||||
_INTL("Water 1"),
|
||||
_INTL("Bug"),
|
||||
_INTL("Flying"),
|
||||
_INTL("Field"),
|
||||
_INTL("Fairy"),
|
||||
_INTL("Grass"),
|
||||
_INTL("Human-like"),
|
||||
_INTL("Water 3"),
|
||||
_INTL("Mineral"),
|
||||
_INTL("Amorphous"),
|
||||
_INTL("Water 2"),
|
||||
_INTL("Ditto"),
|
||||
_INTL("Dragon")
|
||||
_INTL("Undiscovered"),
|
||||
_INTL("Monster"),
|
||||
_INTL("Water 1"),
|
||||
_INTL("Bug"),
|
||||
_INTL("Flying"),
|
||||
_INTL("Field"),
|
||||
_INTL("Fairy"),
|
||||
_INTL("Grass"),
|
||||
_INTL("Human-like"),
|
||||
_INTL("Water 3"),
|
||||
_INTL("Mineral"),
|
||||
_INTL("Amorphous"),
|
||||
_INTL("Water 2"),
|
||||
_INTL("Ditto"),
|
||||
_INTL("Dragon")
|
||||
]
|
||||
return names[id]
|
||||
end
|
||||
|
||||
@@ -17,16 +17,16 @@ module PBColors
|
||||
def self.getName(id)
|
||||
id = getID(PBColors,id)
|
||||
names = [
|
||||
_INTL("Red"),
|
||||
_INTL("Blue"),
|
||||
_INTL("Yellow"),
|
||||
_INTL("Green"),
|
||||
_INTL("Black"),
|
||||
_INTL("Brown"),
|
||||
_INTL("Purple"),
|
||||
_INTL("Gray"),
|
||||
_INTL("White"),
|
||||
_INTL("Pink")
|
||||
_INTL("Red"),
|
||||
_INTL("Blue"),
|
||||
_INTL("Yellow"),
|
||||
_INTL("Green"),
|
||||
_INTL("Black"),
|
||||
_INTL("Brown"),
|
||||
_INTL("Purple"),
|
||||
_INTL("Gray"),
|
||||
_INTL("White"),
|
||||
_INTL("Pink")
|
||||
]
|
||||
return names[id]
|
||||
end
|
||||
|
||||
@@ -16,16 +16,16 @@ module PBHabitats
|
||||
def self.getName(id)
|
||||
id = getID(PBHabitats,id)
|
||||
names = [
|
||||
_INTL("None"),
|
||||
_INTL("Grassland"),
|
||||
_INTL("Forest"),
|
||||
_INTL("Water's Edge"),
|
||||
_INTL("Sea"),
|
||||
_INTL("Cave"),
|
||||
_INTL("Mountain"),
|
||||
_INTL("Rough Terrain"),
|
||||
_INTL("Urban"),
|
||||
_INTL("Rare")
|
||||
_INTL("None"),
|
||||
_INTL("Grassland"),
|
||||
_INTL("Forest"),
|
||||
_INTL("Water's Edge"),
|
||||
_INTL("Sea"),
|
||||
_INTL("Cave"),
|
||||
_INTL("Mountain"),
|
||||
_INTL("Rough Terrain"),
|
||||
_INTL("Urban"),
|
||||
_INTL("Rare")
|
||||
]
|
||||
return names[id]
|
||||
end
|
||||
|
||||
@@ -351,7 +351,6 @@ class PokeBattle_Battler
|
||||
:COMATOSE,
|
||||
:RKSSYSTEM
|
||||
]
|
||||
failed = false
|
||||
abilityBlacklist.each do |abil|
|
||||
return true if isConst?(@ability,PBAbilities,abil)
|
||||
end
|
||||
|
||||
@@ -31,7 +31,6 @@ class PokeBattle_Battler
|
||||
|
||||
def pbRecoverHPFromDrain(amt,target,msg=nil)
|
||||
if target.hasActiveAbility?(:LIQUIDOOZE)
|
||||
oldHP = @hp
|
||||
@battle.pbShowAbilitySplash(target)
|
||||
pbReduceHP(amt)
|
||||
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",pbThis))
|
||||
|
||||
@@ -566,7 +566,7 @@ class PokeBattle_Battler
|
||||
#=============================================================================
|
||||
# Flinching
|
||||
#=============================================================================
|
||||
def pbFlinch(user=nil)
|
||||
def pbFlinch(_user=nil)
|
||||
return if hasActiveAbility?(:INNERFOCUS) && !@battle.moldBreaker
|
||||
@effects[PBEffects::Flinch] = true
|
||||
end
|
||||
|
||||
@@ -149,7 +149,7 @@ class PokeBattle_Battler
|
||||
#=============================================================================
|
||||
# Held item consuming/removing
|
||||
#=============================================================================
|
||||
def pbCanConsumeBerry?(item,alwaysCheckGluttony=true)
|
||||
def pbCanConsumeBerry?(_item,alwaysCheckGluttony=true)
|
||||
return false if @battle.pbCheckOpposingAbility(:UNNERVE,@index)
|
||||
return true if @hp<=@totalhp/4
|
||||
if alwaysCheckGluttony || NEWEST_BATTLE_MECHANICS
|
||||
|
||||
@@ -67,7 +67,7 @@ class PokeBattle_Battler
|
||||
#=============================================================================
|
||||
#
|
||||
#=============================================================================
|
||||
def pbBeginTurn(choice)
|
||||
def pbBeginTurn(_choice)
|
||||
# Cancel some lingering effects which only apply until the user next moves
|
||||
@effects[PBEffects::BeakBlast] = false
|
||||
@effects[PBEffects::DestinyBondPrevious] = @effects[PBEffects::DestinyBond]
|
||||
@@ -105,7 +105,7 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::FuryCutter] = 0
|
||||
end
|
||||
|
||||
def pbEndTurn(choice)
|
||||
def pbEndTurn(_choice)
|
||||
@lastRoundMoved = @battle.turnCount # Done something this round
|
||||
if @effects[PBEffects::ChoiceBand]<0 &&
|
||||
hasActiveItem?([:CHOICEBAND,:CHOICESPECS,:CHOICESCARF])
|
||||
@@ -438,7 +438,6 @@ class PokeBattle_Battler
|
||||
# NOTE: If a multi-hit move becomes disabled partway through doing those
|
||||
# hits (e.g. by Cursed Body), the rest of the hits continue as
|
||||
# normal.
|
||||
notFainted = false
|
||||
break if !targets.any? { |t| !t.fainted? } # All targets are fainted
|
||||
end
|
||||
# Battle Arena only - attack is successful
|
||||
@@ -479,7 +478,7 @@ class PokeBattle_Battler
|
||||
newTargets = pbChangeTargets(move,b,newTargets)
|
||||
success = pbProcessMoveHit(move,b,newTargets,0,false)
|
||||
b.lastMoveFailed = true if !success
|
||||
targets.each { |b| b.pbFaint if b && b.fainted? }
|
||||
targets.each { |otherB| otherB.pbFaint if otherB && otherB.fainted? }
|
||||
user.pbFaint if user.fainted?
|
||||
end
|
||||
# Magic Coat's bouncing back (move has no targets)
|
||||
|
||||
@@ -2,7 +2,7 @@ class PokeBattle_Battler
|
||||
#=============================================================================
|
||||
# Get move's user
|
||||
#=============================================================================
|
||||
def pbFindUser(choice,move)
|
||||
def pbFindUser(_choice,_move)
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -169,7 +169,7 @@ class PokeBattle_Battler
|
||||
return true
|
||||
end
|
||||
|
||||
def pbAddTargetRandomAlly(targets,user,move,nearOnly=true)
|
||||
def pbAddTargetRandomAlly(targets,user,_move,nearOnly=true)
|
||||
choices = []
|
||||
user.eachAlly do |b|
|
||||
next if nearOnly && !user.near?(b)
|
||||
@@ -180,7 +180,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
end
|
||||
|
||||
def pbAddTargetRandomFoe(targets,user,move,nearOnly=true)
|
||||
def pbAddTargetRandomFoe(targets,user,_move,nearOnly=true)
|
||||
choices = []
|
||||
user.eachOpposing do |b|
|
||||
next if nearOnly && !user.near?(b)
|
||||
|
||||
@@ -136,7 +136,7 @@ class PokeBattle_Battler
|
||||
@battle.pbDisplay(_INTL("{1} ignored orders!",pbThis))
|
||||
return false if !@battle.pbCanShowFightMenu?(@index)
|
||||
otherMoves = []
|
||||
eachMoveWithIndex do |m,i|
|
||||
eachMoveWithIndex do |_m,i|
|
||||
next if i==choice[1]
|
||||
otherMoves[otherMoves.length] = i if @battle.pbCanChooseMove?(@index,i,false)
|
||||
end
|
||||
|
||||
@@ -61,7 +61,7 @@ class PokeBattle_Move
|
||||
#=============================================================================
|
||||
# About the move
|
||||
#=============================================================================
|
||||
def pbTarget(user); return @target; end
|
||||
def pbTarget(_user); return @target; end
|
||||
|
||||
def totalpp
|
||||
return @totalpp if @totalpp && @totalpp>0 # Usually undefined
|
||||
@@ -127,8 +127,8 @@ class PokeBattle_Move
|
||||
def danceMove?; return @flags[/o/]; end
|
||||
|
||||
# Causes perfect accuracy (param=1) and double damage (param=2).
|
||||
def tramplesMinimize?(param=1); return false; end
|
||||
def nonLethal?(user,target); return false; end # For False Swipe
|
||||
def tramplesMinimize?(_param=1); return false; end
|
||||
def nonLethal?(_user,_target); return false; end # For False Swipe
|
||||
|
||||
def ignoresSubstitute?(user) # user is the Pokémon using this move
|
||||
if NEWEST_BATTLE_MECHANICS
|
||||
|
||||
@@ -30,8 +30,8 @@ class PokeBattle_Move
|
||||
# attack in the same turn.
|
||||
# user.effects[PBEffects::TwoTurnAttack] is set to the move's ID during the
|
||||
# charging turn, and is 0 during the attack turn.
|
||||
def pbIsChargingTurn?(user); return false; end
|
||||
def pbDamagingMove?; return damagingMove?; end
|
||||
def pbIsChargingTurn?(user); return false; end
|
||||
def pbDamagingMove?; return damagingMove?; end
|
||||
|
||||
def pbContactMove?(user)
|
||||
return false if user.hasActiveAbility?(:LONGREACH)
|
||||
@@ -92,7 +92,7 @@ class PokeBattle_Move
|
||||
# Move failure checks
|
||||
#=============================================================================
|
||||
# Check whether the move fails completely due to move-specific requirements.
|
||||
def pbMoveFailed?(user,targets); return false; end
|
||||
def pbMoveFailed?(user,targets); return false; end
|
||||
# Checks whether the move will be ineffective against the target.
|
||||
def pbFailsAgainstTarget?(user,target); return false; end
|
||||
|
||||
|
||||
@@ -543,8 +543,7 @@ class PokeBattle_Move_097 < PokeBattle_Move
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
dmgs = [200,80,60,50,40]
|
||||
ppLeft = [@pp,dmgs.length-1].min # PP is reduced before the move is used
|
||||
baseDmg = dmgs[ppLeft]
|
||||
return baseDmg
|
||||
return dmgs[ppLeft]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -897,7 +896,7 @@ class PokeBattle_Move_0A4 < PokeBattle_Move
|
||||
PBEnvironment::Forest, PBEnvironment::ForestGrass
|
||||
@secretPower = 2 # (Same as Grassy Terrain)
|
||||
when PBEnvironment::MovingWater, PBEnvironment::StillWater,
|
||||
PBEnvironment::Puddle, PBEnvironment::Underwater
|
||||
PBEnvironment::Underwater
|
||||
@secretPower = 5 # Water Pulse, lower Attack by 1
|
||||
when PBEnvironment::Puddle
|
||||
@secretPower = 6 # Mud Shot, lower Speed by 1
|
||||
@@ -1052,7 +1051,7 @@ class PokeBattle_Move_0A9 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbGetDefenseStats(user,target)
|
||||
ret1, ret2 = super
|
||||
ret1, _ret2 = super
|
||||
return ret1, 6 # Def/SpDef stat stage
|
||||
end
|
||||
end
|
||||
@@ -1321,7 +1320,6 @@ class PokeBattle_Move_0B3 < PokeBattle_Move
|
||||
# turn into, but what self-respecting game wouldn't at least have Tri
|
||||
# Attack in it?
|
||||
@npMove = getID(PBMoves,:TRIATTACK)
|
||||
m = nil
|
||||
case @battle.field.terrain
|
||||
when PBBattleTerrains::Electric
|
||||
@npMove = getConst(PBMoves,:THUNDERBOLT) || @npMove
|
||||
@@ -2409,7 +2407,7 @@ class PokeBattle_Move_0D3 < PokeBattle_Move
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
shift = (4-user.effects[PBEffects::Rollout]) # 0-4, where 0 is most powerful
|
||||
shift += 1 if user.effects[PBEffects::DefenseCurl]
|
||||
baseDmg = baseDmg<<shift
|
||||
baseDmg = baseDmg << shift
|
||||
return baseDmg
|
||||
end
|
||||
|
||||
@@ -3013,7 +3011,7 @@ class PokeBattle_Move_0EB < PokeBattle_Move
|
||||
end
|
||||
if @battle.trainerBattle?
|
||||
canSwitch = false
|
||||
@battle.eachInTeamFromBattlerIndex(target.index) do |pkmn,i|
|
||||
@battle.eachInTeamFromBattlerIndex(target.index) do |_pkmn,i|
|
||||
next if !@battle.pbCanSwitchLax?(target.index,i)
|
||||
canSwitch = true
|
||||
break
|
||||
@@ -3555,7 +3553,7 @@ class PokeBattle_Move_0F7 < PokeBattle_Move
|
||||
end
|
||||
return if pbIsMegaStone?(user.item)
|
||||
flingableItem = false
|
||||
@flingPowers.each do |power,items|
|
||||
@flingPowers.each do |_power,items|
|
||||
items.each do |i|
|
||||
next if !isConst?(user.item,PBItems,i)
|
||||
flingableItem = true
|
||||
|
||||
@@ -1029,7 +1029,7 @@ class PokeBattle_Move_133 < PokeBattle_Move
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
hasAlly = false
|
||||
user.eachAlly do |b|
|
||||
user.eachAlly do |_b|
|
||||
hasAlly = true
|
||||
break
|
||||
end
|
||||
|
||||
@@ -307,7 +307,7 @@ class PokeBattle_Battle
|
||||
# screen.
|
||||
def pbPlayerDisplayParty(idxBattler=0)
|
||||
partyOrders = pbPartyOrder(idxBattler)
|
||||
idxStart, idxEnd = pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||
idxStart, _idxEnd = pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||
ret = []
|
||||
eachInTeamFromBattlerIndex(idxBattler) { |pkmn,i| ret[partyOrders[i]-idxStart] = pkmn }
|
||||
return ret
|
||||
@@ -408,7 +408,7 @@ class PokeBattle_Battle
|
||||
# Used to calculate money gained/lost after winning/losing a battle.
|
||||
def pbMaxLevelInTeam(side,idxTrainer)
|
||||
ret = 1
|
||||
eachInTeam(side,idxTrainer) do |pkmn,i|
|
||||
eachInTeam(side,idxTrainer) do |pkmn,_i|
|
||||
ret = pkmn.level if pkmn.level>ret
|
||||
end
|
||||
return ret
|
||||
@@ -433,13 +433,13 @@ class PokeBattle_Battle
|
||||
|
||||
def pbSideBattlerCount(idxBattler=0)
|
||||
ret = 0
|
||||
eachSameSideBattler(idxBattler) { |b| ret += 1 }
|
||||
eachSameSideBattler(idxBattler) { |_b| ret += 1 }
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbOpposingBattlerCount(idxBattler=0)
|
||||
ret = 0
|
||||
eachOtherSideBattler(idxBattler) { |b| ret += 1 }
|
||||
eachOtherSideBattler(idxBattler) { |_b| ret += 1 }
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -558,7 +558,7 @@ class PokeBattle_Battle
|
||||
idxPartyEnd = (idxTrainer<partyStarts.length-1) ? partyStarts[idxTrainer+1] : party.length
|
||||
origPartyPos = partyOrders[idxParty] # Position of erased Pokémon initially
|
||||
partyOrders[idxParty] = idxPartyEnd # Put erased Pokémon last in the team
|
||||
party.each_with_index do |pkmn,i|
|
||||
party.each_with_index do |_pkmn,i|
|
||||
next if i<idxPartyStart || i>=idxPartyEnd # Only check the team
|
||||
next if partyOrders[i]<origPartyPos # Appeared before erased Pokémon
|
||||
partyOrders[i] -= 1 # Appeared after erased Pokémon; bump it up by 1
|
||||
@@ -756,8 +756,8 @@ class PokeBattle_Battle
|
||||
@scene.pbAnimation(move,user,targets,hitNum) if @showAnims
|
||||
end
|
||||
|
||||
def pbCommonAnimation(name,user=nil,targets=nil,hitNum=0)
|
||||
@scene.pbCommonAnimation(name,user,targets,hitNum) if @showAnims
|
||||
def pbCommonAnimation(name,user=nil,targets=nil)
|
||||
@scene.pbCommonAnimation(name,user,targets) if @showAnims
|
||||
end
|
||||
|
||||
def pbShowAbilitySplash(battler,delay=false,logTrigger=true)
|
||||
|
||||
@@ -58,7 +58,7 @@ class PokeBattle_Battle
|
||||
raise _INTL("Error: def pbGetOwnerIndexFromBattlerIndex gives invalid owner index ({1} for battle type {2}v{3}, trainers {4}v{5})",
|
||||
requireds.length-1,@sideSizes[0],@sideSizes[1],side1counts.length,side2counts.length)
|
||||
end
|
||||
sideCounts.each_with_index do |count,i|
|
||||
sideCounts.each_with_index do |_count,i|
|
||||
if !requireds[i] || requireds[i]==0
|
||||
raise _INTL("Player-side trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
|
||||
i+1,@sideSizes[0],@sideSizes[1]) if side==0
|
||||
@@ -139,7 +139,7 @@ class PokeBattle_Battle
|
||||
# For each trainer in turn, find the needed number of Pokémon for them to
|
||||
# send out, and initialize them
|
||||
battlerNumber = 0
|
||||
trainer.each_with_index do |t,idxTrainer|
|
||||
trainer.each_with_index do |_t,idxTrainer|
|
||||
ret[side][idxTrainer] = []
|
||||
eachInTeam(side,idxTrainer) do |pkmn,idxPkmn|
|
||||
next if !pkmn.able?
|
||||
@@ -403,7 +403,7 @@ class PokeBattle_Battle
|
||||
pbDisplayPaused(_INTL("You defeated {1}, {2} and {3}!",@opponent[0].fullname,
|
||||
@opponent[1].fullname,@opponent[2].fullname))
|
||||
end
|
||||
@opponent.each_with_index do |t,i|
|
||||
@opponent.each_with_index do |_t,i|
|
||||
@scene.pbShowOpponent(i)
|
||||
msg = (@endSpeeches[i] && @endSpeeches[i]!="") ? @endSpeeches[i] : "..."
|
||||
pbDisplayPaused(msg.gsub(/\\[Pp][Nn]/,pbPlayer.name))
|
||||
@@ -437,7 +437,7 @@ class PokeBattle_Battle
|
||||
pbDisplayPaused(_INTL("You blacked out!")) if !@canLose
|
||||
elsif @decision==2
|
||||
if @opponent
|
||||
@opponent.each_with_index do |t,i|
|
||||
@opponent.each_with_index do |_t,i|
|
||||
@scene.pbShowOpponent(i)
|
||||
msg = (@endSpeechesWin[i] && @endSpeechesWin[i]!="") ? @endSpeechesWin[i] : "..."
|
||||
pbDisplayPaused(msg.gsub(/\\[Pp][Nn]/,pbPlayer.name))
|
||||
|
||||
@@ -168,7 +168,6 @@ class PokeBattle_Battle
|
||||
raise RuntimeError.new(
|
||||
_INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
|
||||
pkmn.name,debugInfo))
|
||||
return
|
||||
end
|
||||
# Give Exp
|
||||
if pkmn.shadowPokemon?
|
||||
|
||||
@@ -94,7 +94,7 @@ class PokeBattle_Battle
|
||||
end
|
||||
|
||||
def pbCanChooseNonActive?(idxBattler)
|
||||
pbParty(idxBattler).each_with_index do |pkmn,i|
|
||||
pbParty(idxBattler).each_with_index do |_pkmn,i|
|
||||
return true if pbCanSwitchLax?(idxBattler,i)
|
||||
end
|
||||
return false
|
||||
@@ -212,7 +212,7 @@ class PokeBattle_Battle
|
||||
if random
|
||||
return -1 if !pbCanSwitch?(idxBattler) # Can battler switch out?
|
||||
choices = [] # Find all Pokémon that can switch in
|
||||
eachInTeamFromBattlerIndex(idxBattler) do |pkmn,i|
|
||||
eachInTeamFromBattlerIndex(idxBattler) do |_pkmn,i|
|
||||
choices.push(i) if pbCanSwitchLax?(idxBattler,i)
|
||||
end
|
||||
return -1 if choices.length==0
|
||||
|
||||
@@ -45,7 +45,7 @@ class PokeBattle_Battle
|
||||
return false if battler.effects[PBEffects::Encore]>0
|
||||
# No moves that can be chosen (will Struggle instead)
|
||||
usable = false
|
||||
battler.eachMoveWithIndex do |m,i|
|
||||
battler.eachMoveWithIndex do |_m,i|
|
||||
next if !pbCanChooseMove?(idxBattler,i,false)
|
||||
usable = true
|
||||
break
|
||||
|
||||
@@ -297,7 +297,7 @@ class PokeBattle_Battle
|
||||
next if !b.canHeal?
|
||||
hpGain = b.totalhp/16
|
||||
hpGain = (hpGain*1.3).floor if b.hasActiveItem?(:BIGROOT)
|
||||
hpGain = b.pbRecoverHP(hpGain)
|
||||
b.pbRecoverHP(hpGain)
|
||||
pbDisplay(_INTL("Aqua Ring restored {1}'s HP!",b.pbThis(true)))
|
||||
end
|
||||
# Ingrain
|
||||
@@ -306,7 +306,7 @@ class PokeBattle_Battle
|
||||
next if !b.canHeal?
|
||||
hpGain = b.totalhp/16
|
||||
hpGain = (hpGain*1.3).floor if b.hasActiveItem?(:BIGROOT)
|
||||
hpGain = b.pbRecoverHP(hpGain)
|
||||
b.pbRecoverHP(hpGain)
|
||||
pbDisplay(_INTL("{1} absorbed nutrients with its roots!",b.pbThis))
|
||||
end
|
||||
# Leech Seed
|
||||
|
||||
@@ -147,7 +147,7 @@ class PokeBattle_AI
|
||||
#=============================================================================
|
||||
def pbDefaultChooseNewEnemy(idxBattler,party)
|
||||
enemies = []
|
||||
party.each_with_index do |p,i|
|
||||
party.each_with_index do |_p,i|
|
||||
enemies.push(i) if @battle.pbCanSwitchLax?(idxBattler,i)
|
||||
end
|
||||
return -1 if enemies.length==0
|
||||
|
||||
@@ -14,7 +14,7 @@ class PokeBattle_AI
|
||||
# NOTE: A move is only added to the choices array if it has a non-zero
|
||||
# score.
|
||||
choices = []
|
||||
user.eachMoveWithIndex do |m,i|
|
||||
user.eachMoveWithIndex do |_m,i|
|
||||
next if !@battle.pbCanChooseMove?(idxBattler,i,false)
|
||||
if wildBattler
|
||||
pbRegisterMoveWild(user,i,choices)
|
||||
@@ -106,7 +106,7 @@ class PokeBattle_AI
|
||||
# Get scores for the given move against each possible target
|
||||
#=============================================================================
|
||||
# Wild Pokémon choose their moves randomly.
|
||||
def pbRegisterMoveWild(user,idxMove,choices)
|
||||
def pbRegisterMoveWild(_user,idxMove,choices)
|
||||
choices.push([idxMove,100,-1]) # Move index, score, target
|
||||
end
|
||||
|
||||
@@ -195,7 +195,6 @@ class PokeBattle_AI
|
||||
end
|
||||
# If user is asleep, prefer moves that are usable while asleep
|
||||
if user.status==PBStatuses::SLEEP && !move.usableWhenAsleep?
|
||||
hasSleepMove = false
|
||||
user.eachMove do |m|
|
||||
next unless m.usableWhenAsleep?
|
||||
score -= 60
|
||||
|
||||
@@ -12,13 +12,13 @@ class PokeBattle_AI
|
||||
@battle.eachBattler { |b| numTargets += 1 if b.near?(user) }
|
||||
return numTargets>1
|
||||
when PBTargets::UserAndAllies
|
||||
@battle.eachSameSideBattler(user) { |b| numTargets += 1 }
|
||||
@battle.eachSameSideBattler(user) { |_b| numTargets += 1 }
|
||||
return numTargets>1
|
||||
when PBTargets::AllFoes
|
||||
@battle.eachOtherSideBattler(user) { |b| numTargets += 1 }
|
||||
@battle.eachOtherSideBattler(user) { |_b| numTargets += 1 }
|
||||
return numTargets>1
|
||||
when PBTargets::AllBattlers
|
||||
@battle.eachBattler { |b| numTargets += 1 }
|
||||
@battle.eachBattler { |_b| numTargets += 1 }
|
||||
return numTargets>1
|
||||
end
|
||||
return false
|
||||
@@ -75,7 +75,7 @@ class PokeBattle_AI
|
||||
|
||||
# For switching. Determines the effectiveness of a potential switch-in against
|
||||
# an opposing battler.
|
||||
def pbCalcTypeModPokemon(battlerThis,battlerOther)
|
||||
def pbCalcTypeModPokemon(battlerThis,_battlerOther)
|
||||
mod1 = PBTypes.getCombinedEffectiveness(battlerThis.type1,target.type1,target.type2)
|
||||
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
if battlerThis.type1!=battlerThis.type2
|
||||
@@ -214,7 +214,7 @@ class PokeBattle_AI
|
||||
end
|
||||
when "0C1" # Beat Up
|
||||
mult = 0
|
||||
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,i|
|
||||
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,_i|
|
||||
mult += 1 if pkmn && pkmn.able? && pkmn.status==PBStatuses::NONE
|
||||
end
|
||||
baseDmg *= mult
|
||||
|
||||
@@ -18,16 +18,16 @@ class BattleIntroAnimation < PokeBattle_Animation
|
||||
makeSlideSprite("base_0",1,appearTime,PictureOrigin::Bottom)
|
||||
makeSlideSprite("base_1",-1,appearTime,PictureOrigin::Center)
|
||||
# Player sprite, partner trainer sprite
|
||||
@battle.player.each_with_index do |p,i|
|
||||
@battle.player.each_with_index do |_p,i|
|
||||
makeSlideSprite("player_#{i+1}",1,appearTime,PictureOrigin::Bottom)
|
||||
end
|
||||
# Opposing trainer sprite(s) or wild Pokémon sprite(s)
|
||||
if @battle.trainerBattle?
|
||||
@battle.opponent.each_with_index do |p,i|
|
||||
@battle.opponent.each_with_index do |_p,i|
|
||||
makeSlideSprite("trainer_#{i+1}",-1,appearTime,PictureOrigin::Bottom)
|
||||
end
|
||||
else # Wild battle
|
||||
@battle.pbParty(1).each_with_index do |pkmn,i|
|
||||
@battle.pbParty(1).each_with_index do |_pkmn,i|
|
||||
idxBattler = 2*i+1
|
||||
makeSlideSprite("pokemon_#{idxBattler}",-1,appearTime,PictureOrigin::Bottom)
|
||||
end
|
||||
@@ -574,9 +574,7 @@ class BattlerRecallAnimation < PokeBattle_Animation
|
||||
# Calculate the color to turn the battler sprite
|
||||
col = getBattlerColorFromBallType(ballType)
|
||||
col.alpha = 0
|
||||
# Calculate start and end coordinates for battler sprite movement
|
||||
battlerStartX = batSprite.x
|
||||
battlerStartY = batSprite.y
|
||||
# Calculate end coordinates for battler sprite movement
|
||||
ballPos = PokeBattle_SceneConstants.pbBattlerPosition(@idxBattler,batSprite.sideSize)
|
||||
battlerEndX = ballPos[0]
|
||||
battlerEndY = ballPos[1]
|
||||
@@ -867,8 +865,6 @@ class PokeballThrowDeflectAnimation < PokeBattle_Animation
|
||||
# Set up Poké Ball sprite
|
||||
ball = addBallSprite(ballStartX,ballStartY,@ballType)
|
||||
ball.setZ(0,90)
|
||||
# Set up battler sprite
|
||||
battler = addSprite(batSprite,PictureOrigin::Bottom)
|
||||
# Poké Ball arc animation
|
||||
ball.setSE(0,"Battle throw")
|
||||
createBallTrajectory(ball,0,16,
|
||||
|
||||
@@ -293,7 +293,7 @@ class PokeBattle_Scene
|
||||
def pbBeginEndOfRoundPhase
|
||||
end
|
||||
|
||||
def pbEndBattle(result)
|
||||
def pbEndBattle(_result)
|
||||
@abortable = false
|
||||
pbShowWindow(BLANK)
|
||||
# Fade out all sprites
|
||||
|
||||
@@ -144,9 +144,8 @@ class PokeBattle_Scene
|
||||
# Fade out and hide all sprites
|
||||
visibleSprites = pbFadeOutAndHide(@sprites)
|
||||
# Get player's party
|
||||
party = @battle.pbParty(idxBattler)
|
||||
partyPos = @battle.pbPartyOrder(idxBattler)
|
||||
partyStart, partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||
partyStart, _partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||
modParty = @battle.pbPlayerDisplayParty(idxBattler)
|
||||
# Start party screen
|
||||
scene = PokemonParty_Scene.new
|
||||
@@ -190,7 +189,7 @@ class PokeBattle_Scene
|
||||
#=============================================================================
|
||||
# Opens the Bag screen and chooses an item to use
|
||||
#=============================================================================
|
||||
def pbItemMenu(idxBattler,firstAction)
|
||||
def pbItemMenu(idxBattler,_firstAction)
|
||||
# Fade out and hide all sprites
|
||||
visibleSprites = pbFadeOutAndHide(@sprites)
|
||||
# Set Bag starting positions
|
||||
@@ -250,7 +249,7 @@ class PokeBattle_Scene
|
||||
# Get player's party
|
||||
party = @battle.pbParty(idxBattler)
|
||||
partyPos = @battle.pbPartyOrder(idxBattler)
|
||||
partyStart, partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||
partyStart, _partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||
modParty = @battle.pbPlayerDisplayParty(idxBattler)
|
||||
# Start party screen
|
||||
pkmnScene = PokemonParty_Scene.new
|
||||
|
||||
@@ -272,7 +272,7 @@ class PokeBattle_Scene
|
||||
#=============================================================================
|
||||
# Shows stats windows upon a Pokémon levelling up
|
||||
#=============================================================================
|
||||
def pbLevelUp(pkmn,battler,oldTotalHP,oldAttack,oldDefense,oldSpAtk,oldSpDef,oldSpeed)
|
||||
def pbLevelUp(pkmn,_battler,oldTotalHP,oldAttack,oldDefense,oldSpAtk,oldSpDef,oldSpeed)
|
||||
pbTopRightWindow(
|
||||
_INTL("Max. HP<r>+{1}\r\nAttack<r>+{2}\r\nDefense<r>+{3}\r\nSp. Atk<r>+{4}\r\nSp. Def<r>+{5}\r\nSpeed<r>+{6}",
|
||||
pkmn.totalhp-oldTotalHP,pkmn.attack-oldAttack,pkmn.defense-oldDefense,
|
||||
@@ -482,7 +482,7 @@ class PokeBattle_Scene
|
||||
end
|
||||
|
||||
# Plays a common animation.
|
||||
def pbCommonAnimation(animName,user=nil,target=nil,hitNum=0)
|
||||
def pbCommonAnimation(animName,user=nil,target=nil)
|
||||
return if !animName || animName==""
|
||||
target = target[0] if target && target.is_a?(Array)
|
||||
animations = pbLoadBattleAnimations
|
||||
|
||||
@@ -119,7 +119,7 @@ def pbConvertRPGAnimation(animation)
|
||||
pbAnim.graphic = animation.animation_name
|
||||
pbAnim.hue = animation.animation_hue
|
||||
pbAnim.array.clear
|
||||
yoffset = 0
|
||||
yOffset = 0
|
||||
pbAnim.position = animation.position
|
||||
yOffset = -64 if animation.position==0
|
||||
yOffset = 64 if animation.position==2
|
||||
@@ -240,7 +240,7 @@ end
|
||||
#===============================================================================
|
||||
class PBAnimTiming
|
||||
attr_accessor :frame
|
||||
attr_accessor :timingType # 0=play SE, 1=set bg, 2=bg mod
|
||||
attr_writer :timingType # 0=play SE, 1=set bg, 2=bg mod
|
||||
attr_accessor :name # Name of SE file or BG file
|
||||
attr_accessor :volume
|
||||
attr_accessor :pitch
|
||||
@@ -251,7 +251,7 @@ class PBAnimTiming
|
||||
attr_accessor :colorGreen # Color of bg (or to change bg to)
|
||||
attr_accessor :colorBlue # Color of bg (or to change bg to)
|
||||
attr_accessor :colorAlpha # Color of bg (or to change bg to)
|
||||
attr_accessor :duration # How long to spend changing to the new bg coords/color
|
||||
attr_writer :duration # How long to spend changing to the new bg coords/color
|
||||
attr_accessor :flashScope
|
||||
attr_accessor :flashColor
|
||||
attr_accessor :flashDuration
|
||||
@@ -276,13 +276,11 @@ class PBAnimTiming
|
||||
end
|
||||
|
||||
def timingType
|
||||
@timingType = 0 if !@timingType
|
||||
return @timingType
|
||||
return @timingType || 0
|
||||
end
|
||||
|
||||
def duration
|
||||
@duration = 5 if !@duration
|
||||
return @duration
|
||||
return @duration || 5
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
||||
@@ -110,7 +110,6 @@ class ThrowBaitAnimation < PokeBattle_Animation
|
||||
def createProcesses
|
||||
# Calculate start and end coordinates for battler sprite movement
|
||||
batSprite = @sprites["pokemon_#{@battler.index}"]
|
||||
shaSprite = @sprites["shadow_#{@battler.index}"]
|
||||
traSprite = @sprites["player_1"]
|
||||
ballPos = PokeBattle_SceneConstants.pbBattlerPosition(@battler.index,batSprite.sideSize)
|
||||
ballStartX = traSprite.x
|
||||
@@ -177,7 +176,6 @@ class ThrowRockAnimation < PokeBattle_Animation
|
||||
def createProcesses
|
||||
# Calculate start and end coordinates for battler sprite movement
|
||||
batSprite = @sprites["pokemon_#{@battler.index}"]
|
||||
shaSprite = @sprites["shadow_#{@battler.index}"]
|
||||
traSprite = @sprites["player_1"]
|
||||
ballStartX = traSprite.x
|
||||
ballStartY = traSprite.y-traSprite.bitmap.height/2
|
||||
@@ -431,7 +429,7 @@ class PokeBattle_SafariZone
|
||||
catchFactor = [[catchFactor,3].max,20].min
|
||||
escapeFactor = (pbEscapeRate(rareness)*100)/1275
|
||||
escapeFactor = [[escapeFactor,2].max,20].min
|
||||
begin
|
||||
loop do
|
||||
cmd = @scene.pbSafariCommandMenu(0)
|
||||
case cmd
|
||||
when 0 # Ball
|
||||
@@ -483,7 +481,8 @@ class PokeBattle_SafariZone
|
||||
# Weather continues
|
||||
@scene.pbCommonAnimation(PBWeather.animationName(@weather))
|
||||
end
|
||||
end while @decision==0
|
||||
break if @decision > 0
|
||||
end
|
||||
@scene.pbEndBattle(@decision)
|
||||
rescue BattleAbortedException
|
||||
@decision = 0
|
||||
|
||||
@@ -40,11 +40,11 @@ class PokeBattle_BugContestBattle < PokeBattle_Battle
|
||||
super(*arg)
|
||||
end
|
||||
|
||||
def pbItemMenu(idxBattler,firstAction)
|
||||
def pbItemMenu(idxBattler,_firstAction)
|
||||
return pbRegisterItem(idxBattler,@ballConst,1)
|
||||
end
|
||||
|
||||
def pbCommandMenu(idxBattler,firstAction)
|
||||
def pbCommandMenu(idxBattler,_firstAction)
|
||||
return @scene.pbCommandMenuEx(idxBattler,[
|
||||
_INTL("Sport Balls: {1}",@ballCount),
|
||||
_INTL("Fight"),
|
||||
@@ -54,7 +54,7 @@ class PokeBattle_BugContestBattle < PokeBattle_Battle
|
||||
],4)
|
||||
end
|
||||
|
||||
def pbConsumeItemInBag(item,idxBattler)
|
||||
def pbConsumeItemInBag(_item,_idxBattler)
|
||||
@ballCount -= 1 if @ballCount>0
|
||||
end
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
|
||||
end
|
||||
end
|
||||
|
||||
def pbRegisterMove(idxBattler,idxMove,showMessages=true)
|
||||
def pbRegisterMove(idxBattler,idxMove,_showMessages=true)
|
||||
thispkmn = @battlers[idxBattler]
|
||||
if idxMove==-2
|
||||
@choices[idxPokemon][0] = :UseMove # Move
|
||||
@@ -264,7 +264,7 @@ class PokeBattle_AI
|
||||
end
|
||||
@justswitched[idxBattler] = shouldswitch
|
||||
if shouldswitch
|
||||
@battle.pbParty(idxBattler).each_with_index do |pkmn,i|
|
||||
@battle.pbParty(idxBattler).each_with_index do |_pkmn,i|
|
||||
next if !@battle.pbCanSwitch?(idxBattler,i)
|
||||
@battle.pbRegisterSwitch(idxBattler,i)
|
||||
return true
|
||||
|
||||
@@ -13,7 +13,7 @@ class PokeBattle_BattleArena < PokeBattle_Battle
|
||||
@battleAI.battleArena = true
|
||||
end
|
||||
|
||||
def pbCanSwitchLax?(idxBattler,idxParty,partyScene=nil)
|
||||
def pbCanSwitchLax?(idxBattler,_idxParty,partyScene=nil)
|
||||
if partyScene
|
||||
partyScene.pbDisplay(_INTL("{1} can't be switched out!",@battlers[idxBattler].pbThis))
|
||||
end
|
||||
@@ -101,7 +101,6 @@ class PokeBattle_BattleArena < PokeBattle_Battle
|
||||
end
|
||||
# PBDebug.log("[Mind: #{@mind.inspect}, Skill: #{@skill.inspect}]")
|
||||
if @count==3
|
||||
points = [0,0]
|
||||
@battlers[0].pbCancelMoves
|
||||
@battlers[1].pbCancelMoves
|
||||
ratings1 = [0,0,0]
|
||||
|
||||
@@ -209,13 +209,13 @@ module PokeBattle_BattlePlayerModule
|
||||
super
|
||||
end
|
||||
|
||||
def pbSwitchInBetween(idxBattler,checkLaxOnly=false,canCancel=false)
|
||||
def pbSwitchInBetween(_idxBattler,_checkLaxOnly=false,_canCancel=false)
|
||||
ret = @switches[@switchindex]
|
||||
@switchindex += 1
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbRandom(num)
|
||||
def pbRandom(_num)
|
||||
ret = @randomnums[@randomindex]
|
||||
@randomindex += 1
|
||||
return ret
|
||||
|
||||
@@ -24,7 +24,7 @@ class PokeBattle_DebugSceneNoLogging
|
||||
def pbBeginAttackPhase; end
|
||||
def pbShowOpponent(idxTrainer); end
|
||||
def pbDamageAnimation(battler,effectiveness=0); end
|
||||
def pbCommonAnimation(animName,user=nil,target=nil,hitNum=0); end
|
||||
def pbCommonAnimation(animName,user=nil,target=nil); end
|
||||
def pbAnimation(moveID,user,targets,hitNum=0); end
|
||||
def pbEndBattle(result); end
|
||||
def pbWildBattleSuccess; end
|
||||
@@ -74,7 +74,7 @@ class PokeBattle_DebugSceneNoLogging
|
||||
|
||||
def pbPartyScreen(idxBattler,canCancel=false)
|
||||
replacements = []
|
||||
@battle.eachInTeamFromBattlerIndex(idxBattler) do |b,idxParty|
|
||||
@battle.eachInTeamFromBattlerIndex(idxBattler) do |_b,idxParty|
|
||||
replacements.push(idxParty) if !@battle.pbFindBattler(idxParty,idxBattler)
|
||||
end
|
||||
return if replacements.length==0
|
||||
|
||||
@@ -2129,7 +2129,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
|
||||
if NEWEST_BATTLE_MECHANICS && isConst?(m.id,PBMoves,:HIDDENPOWER)
|
||||
moveType = pbHiddenPower(b.pokemon)[0]
|
||||
end
|
||||
eff = PBTypes.getCombinedEffectiveness(moveData[MOVE_TYPE],type1,type2,type3)
|
||||
eff = PBTypes.getCombinedEffectiveness(moveType,type1,type2,type3)
|
||||
next if PBTypes.ineffective?(eff)
|
||||
next if !PBTypes.superEffective?(eff) && moveData[MOVE_FUNCTION_CODE]!="070" # OHKO
|
||||
else
|
||||
|
||||
@@ -173,7 +173,7 @@ end
|
||||
# Constant checks
|
||||
#===============================================================================
|
||||
# Pokérus check
|
||||
Events.onMapUpdate += proc { |sender,e|
|
||||
Events.onMapUpdate += proc { |_sender,_e|
|
||||
next if !$Trainer
|
||||
last = $PokemonGlobal.pokerusTime
|
||||
now = pbGetTimeNow
|
||||
@@ -226,7 +226,7 @@ def pbBatteryLow?
|
||||
return false
|
||||
end
|
||||
|
||||
Events.onMapUpdate += proc { |sender,e|
|
||||
Events.onMapUpdate += proc { |_sender,_e|
|
||||
if !$PokemonTemp.batterywarning && pbBatteryLow?
|
||||
if !$game_temp.in_menu && !$game_temp.in_battle &&
|
||||
!$game_player.move_route_forcing && !$game_temp.message_window_showing &&
|
||||
@@ -266,7 +266,7 @@ Events.onStepTaken += proc{
|
||||
}
|
||||
|
||||
# Poison party Pokémon
|
||||
Events.onStepTakenTransferPossible += proc { |sender,e|
|
||||
Events.onStepTakenTransferPossible += proc { |_sender,e|
|
||||
handled = e[0]
|
||||
next if handled[0]
|
||||
if $PokemonGlobal.stepcount%4==0 && POISON_IN_FIELD
|
||||
@@ -307,7 +307,7 @@ def pbCheckAllFainted
|
||||
end
|
||||
|
||||
# Gather soot from soot grass
|
||||
Events.onStepTakenFieldMovement += proc { |sender,e|
|
||||
Events.onStepTakenFieldMovement += proc { |_sender,e|
|
||||
event = e[0] # Get the event affected by field movement
|
||||
thistile = $MapFactory.getRealTilePos(event.map.map_id,event.x,event.y)
|
||||
map = $MapFactory.getMap(thistile[0])
|
||||
@@ -331,7 +331,7 @@ Events.onStepTakenFieldMovement += proc { |sender,e|
|
||||
}
|
||||
|
||||
# Show grass rustle animation, and auto-move the player over waterfalls and ice
|
||||
Events.onStepTakenFieldMovement += proc { |sender,e|
|
||||
Events.onStepTakenFieldMovement += proc { |_sender,e|
|
||||
event = e[0] # Get the event affected by field movement
|
||||
if $scene.is_a?(Scene_Map)
|
||||
currentTag = pbGetTerrainTag(event)
|
||||
@@ -395,9 +395,8 @@ end
|
||||
#===============================================================================
|
||||
# Clears the weather of the old map, if the old and new maps have different
|
||||
# names or defined weather
|
||||
Events.onMapChanging += proc { |sender,e|
|
||||
Events.onMapChanging += proc { |_sender,e|
|
||||
newMapID = e[0]
|
||||
newMap = e[1]
|
||||
if newMapID>0
|
||||
mapinfos = ($RPGVX) ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
|
||||
oldWeather = pbGetMetadata($game_map.map_id,MetadataWeather)
|
||||
@@ -411,7 +410,7 @@ Events.onMapChanging += proc { |sender,e|
|
||||
}
|
||||
|
||||
# Set up various data related to the new map
|
||||
Events.onMapChange += proc { |sender,e|
|
||||
Events.onMapChange += proc { |_sender,e|
|
||||
oldid = e[0] # previous map ID, 0 if no map ID
|
||||
healing = pbGetMetadata($game_map.map_id,MetadataHealingSpot)
|
||||
$PokemonGlobal.healingSpot = healing if healing
|
||||
@@ -430,18 +429,12 @@ Events.onMapChange += proc { |sender,e|
|
||||
end
|
||||
}
|
||||
|
||||
Events.onMapSceneChange += proc { |sender,e|
|
||||
Events.onMapSceneChange += proc { |_sender,e|
|
||||
scene = e[0]
|
||||
mapChanged = e[1]
|
||||
next if !scene || !scene.spriteset
|
||||
# Update map trail
|
||||
if $game_map
|
||||
lastmapdetails = $PokemonGlobal.mapTrail[0] ?
|
||||
pbGetMetadata($PokemonGlobal.mapTrail[0],MetadataMapPosition) : [-1,0,0]
|
||||
lastmapdetails = [-1,0,0] if !lastmapdetails
|
||||
newmapdetails = $game_map.map_id ?
|
||||
pbGetMetadata($game_map.map_id,MetadataMapPosition) : [-1,0,0]
|
||||
newmapdetails = [-1,0,0] if !newmapdetails
|
||||
$PokemonGlobal.mapTrail = [] if !$PokemonGlobal.mapTrail
|
||||
if $PokemonGlobal.mapTrail[0]!=$game_map.map_id
|
||||
$PokemonGlobal.mapTrail[3] = $PokemonGlobal.mapTrail[2] if $PokemonGlobal.mapTrail[2]
|
||||
@@ -556,7 +549,8 @@ def pbMoveRoute(event,commands,waitComplete=false)
|
||||
route.skippable = true
|
||||
route.list.clear
|
||||
route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOn))
|
||||
i=0; while i<commands.length
|
||||
i=0
|
||||
while i<commands.length
|
||||
case commands[i]
|
||||
when PBMoveRoute::Wait, PBMoveRoute::SwitchOn, PBMoveRoute::SwitchOff,
|
||||
PBMoveRoute::ChangeSpeed, PBMoveRoute::ChangeFreq, PBMoveRoute::Opacity,
|
||||
@@ -600,7 +594,7 @@ end
|
||||
#===============================================================================
|
||||
# Player/event movement in the field
|
||||
#===============================================================================
|
||||
def pbLedge(xOffset,yOffset)
|
||||
def pbLedge(_xOffset,_yOffset)
|
||||
if PBTerrain.isLedge?(pbFacingTerrainTag)
|
||||
if pbJumpToward(2,true)
|
||||
$scene.spriteset.addUserAnimation(DUST_ANIMATION_ID,$game_player.x,$game_player.y,true,1)
|
||||
@@ -914,7 +908,7 @@ def pbEventFacesPlayer?(event,player,distance)
|
||||
curx = event.x
|
||||
cury = event.y
|
||||
found = false
|
||||
for i in 0...distance
|
||||
distance.times do
|
||||
curx += deltaX
|
||||
cury += deltaY
|
||||
if player.x==curx && player.y==cury
|
||||
@@ -936,7 +930,7 @@ def pbEventCanReachPlayer?(event,player,distance)
|
||||
cury = event.y
|
||||
found = false
|
||||
realdist = 0
|
||||
for i in 0...distance
|
||||
distance.times do
|
||||
curx += deltaX
|
||||
cury += deltaY
|
||||
if player.x==curx && player.y==cury
|
||||
@@ -949,7 +943,7 @@ def pbEventCanReachPlayer?(event,player,distance)
|
||||
# Check passibility
|
||||
curx = event.x
|
||||
cury = event.y
|
||||
for i in 0...realdist
|
||||
realdist.times do
|
||||
return false if !event.passable?(curx,cury,event.direction)
|
||||
curx += deltaX
|
||||
cury += deltaY
|
||||
@@ -1059,11 +1053,12 @@ module InterpreterFieldMixin
|
||||
$PokemonMap.addMovedEvent(@event_id) if $PokemonMap
|
||||
if oldx!=event.x || oldy!=event.y
|
||||
$game_player.lock
|
||||
begin
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
end until !event.moving?
|
||||
break if !event.moving?
|
||||
end
|
||||
$game_player.unlock
|
||||
end
|
||||
end
|
||||
|
||||
@@ -200,7 +200,7 @@ end
|
||||
|
||||
|
||||
|
||||
Events.onSpritesetCreate += proc { |sender,e|
|
||||
Events.onSpritesetCreate += proc { |_sender,e|
|
||||
spriteset = e[0] # Spriteset being created
|
||||
viewport = e[1] # Viewport used for tilemap and characters
|
||||
map = spriteset.map # Map associated with the spriteset (not necessarily the current map)
|
||||
@@ -241,7 +241,6 @@ end
|
||||
|
||||
def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
||||
$game_temp.in_battle = true
|
||||
handled = false
|
||||
viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
viewport.z = 99999
|
||||
# Set up audio
|
||||
|
||||
@@ -134,7 +134,7 @@ module RPG
|
||||
@blizzardBitmap2.fill_rect(0,4,10,2,snowColor)
|
||||
@blizzardBitmap2.fill_rect(2,6,6,2,snowColor)
|
||||
@blizzardBitmap2.fill_rect(4,8,2,2,snowColor)
|
||||
for i in 0...540
|
||||
540.times do
|
||||
@blizzardBitmap3.fill_rect(rand(bmWidth/2)*2,rand(bmHeight/2)*2,2,2,snowColor)
|
||||
@blizzardBitmap4.fill_rect(rand(bmWidth/2)*2,rand(bmHeight/2)*2,2,2,snowColor)
|
||||
end
|
||||
@@ -163,7 +163,7 @@ module RPG
|
||||
bmHeight = 200
|
||||
@sandstormBitmap1 = Bitmap.new(bmWidth,bmHeight)
|
||||
@sandstormBitmap2 = Bitmap.new(bmWidth,bmHeight)
|
||||
for i in 0...540
|
||||
540.times do
|
||||
@sandstormBitmap1.fill_rect(rand(bmWidth/2)*2,rand(bmHeight/2)*2,2,2,
|
||||
sandstormColors[rand(sandstormColors.length)])
|
||||
@sandstormBitmap2.fill_rect(rand(bmWidth/2)*2,rand(bmHeight/2)*2,2,2,
|
||||
|
||||
@@ -43,7 +43,7 @@ class PokemonGlobalMetadata
|
||||
# Events
|
||||
attr_accessor :eventvars
|
||||
# Affecting the map
|
||||
attr_accessor :bridge
|
||||
attr_writer :bridge
|
||||
attr_accessor :repel
|
||||
attr_accessor :flashUsed
|
||||
# Map transfers
|
||||
|
||||
@@ -189,7 +189,7 @@ def pbGetEnvironment
|
||||
return ret
|
||||
end
|
||||
|
||||
Events.onStartBattle += proc { |sender|
|
||||
Events.onStartBattle += proc { |_sender|
|
||||
# Record current levels of Pokémon in party, to see if they gain a level
|
||||
# during battle and may need to evolve afterwards
|
||||
$PokemonTemp.evolutionLevels = []
|
||||
@@ -555,7 +555,7 @@ def pbAfterBattle(decision,canLose)
|
||||
Events.onEndBattle.trigger(nil,decision,canLose)
|
||||
end
|
||||
|
||||
Events.onEndBattle += proc { |sender,e|
|
||||
Events.onEndBattle += proc { |_sender,e|
|
||||
decision = e[0]
|
||||
canLose = e[1]
|
||||
if NEWEST_BATTLE_MECHANICS || (decision!=2 && decision!=5) # not a loss or a draw
|
||||
|
||||
@@ -420,7 +420,7 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
|
||||
end
|
||||
# Shiny Charm makes shiny Pokémon more likely to generate
|
||||
if hasConst?(PBItems,:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
|
||||
for i in 0...2 # 3 times as likely
|
||||
2.times do # 3 times as likely
|
||||
break if genwildpoke.shiny?
|
||||
genwildpoke.personalID = rand(65536)|(rand(65536)<<16)
|
||||
end
|
||||
@@ -454,7 +454,6 @@ def pbEncounter(enctype)
|
||||
encounter1 = $PokemonEncounters.pbEncounteredPokemon(enctype)
|
||||
encounter1 = EncounterModifier.trigger(encounter1)
|
||||
return false if !encounter1
|
||||
encounter2 = nil
|
||||
if $PokemonGlobal.partner
|
||||
encounter2 = $PokemonEncounters.pbEncounteredPokemon(enctype)
|
||||
encounter2 = EncounterModifier.trigger(encounter2)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
################################################################################
|
||||
|
||||
# Make all wild Pokémon shiny while a certain Switch is ON (see Settings).
|
||||
Events.onWildPokemonCreate += proc { |sender,e|
|
||||
Events.onWildPokemonCreate += proc { |_sender, e|
|
||||
pokemon = e[0]
|
||||
if $game_switches[SHINY_WILD_POKEMON_SWITCH]
|
||||
pokemon.makeShiny
|
||||
@@ -17,14 +17,14 @@ Events.onWildPokemonCreate += proc { |sender,e|
|
||||
# map depend on the levels of Pokémon in the player's party.
|
||||
# This is a simple method, and can/should be modified to account for evolutions
|
||||
# and other such details. Of course, you don't HAVE to use this code.
|
||||
Events.onWildPokemonCreate += proc { |sender,e|
|
||||
Events.onWildPokemonCreate += proc { |_sender, e|
|
||||
pokemon = e[0]
|
||||
if $game_map.map_id==51
|
||||
mLevel = PBExperience.maxLevel
|
||||
newlevel = pbBalancedLevel($Trainer.party) - 4 + rand(5) # For variety
|
||||
newlevel = 1 if newlevel<1
|
||||
newlevel = mLevel if newlevel>mLevel
|
||||
pokemon.level = newlevel
|
||||
if $game_map.map_id == 51
|
||||
max_level = PBExperience.maxLevel
|
||||
new_level = pbBalancedLevel($Trainer.party) - 4 + rand(5) # For variety
|
||||
new_level = 1 if new_level < 1
|
||||
new_level = max_level if new_level > max_level
|
||||
pokemon.level = new_level
|
||||
pokemon.calcStats
|
||||
pokemon.resetMoves
|
||||
end
|
||||
@@ -35,7 +35,7 @@ Events.onWildPokemonCreate += proc { |sender,e|
|
||||
# Note that you can only modify a partner trainer's Pokémon, and not the trainer
|
||||
# themselves nor their items this way, as those are generated from scratch
|
||||
# before each battle.
|
||||
#Events.onTrainerPartyLoad += proc { |sender,e|
|
||||
#Events.onTrainerPartyLoad += proc { |_sender, e|
|
||||
# if e[0] # Trainer data should exist to be loaded, but may not exist somehow
|
||||
# trainer = e[0][0] # A PokeBattle_Trainer object of the loaded trainer
|
||||
# items = e[0][1] # An array of the trainer's items they can use
|
||||
|
||||
@@ -3,11 +3,10 @@ class PokemonGlobalMetadata
|
||||
attr_accessor :roamedAlready # Whether a roamer has been encountered on current map
|
||||
attr_accessor :roamEncounter
|
||||
attr_accessor :roamPokemon
|
||||
attr_accessor :roamPokemonCaught
|
||||
attr_writer :roamPokemonCaught
|
||||
|
||||
def roamPokemonCaught
|
||||
@roamPokemonCaught = [] if !@roamPokemonCaught
|
||||
return @roamPokemonCaught
|
||||
return @roamPokemonCaught || []
|
||||
end
|
||||
end
|
||||
|
||||
@@ -97,7 +96,7 @@ end
|
||||
|
||||
# When the player moves to a new map (with a different name), make all roaming
|
||||
# Pokémon roam.
|
||||
Events.onMapChange += proc { |sender,e|
|
||||
Events.onMapChange += proc { |_sender,e|
|
||||
oldMapID = e[0]
|
||||
# Get and compare map names
|
||||
mapInfos = $RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
|
||||
@@ -206,7 +205,7 @@ EncounterModifier.register(proc { |encounter|
|
||||
next [chosenRoamer[1],chosenRoamer[2]] # Species, level
|
||||
})
|
||||
|
||||
Events.onWildBattleOverride += proc { |sender,e|
|
||||
Events.onWildBattleOverride += proc { |_sender,e|
|
||||
species = e[0]
|
||||
level = e[1]
|
||||
handled = e[2]
|
||||
|
||||
@@ -19,20 +19,17 @@ class AntiRandom
|
||||
# Get old value
|
||||
value=rand(@old.length)
|
||||
return @old[value]
|
||||
else
|
||||
if @new.length>0
|
||||
# Get new value
|
||||
value=rand(@new.length)
|
||||
ret=@new.delete_at(value)
|
||||
@old.push(ret)
|
||||
return ret
|
||||
else
|
||||
# Get old value
|
||||
value=rand(@old.length)
|
||||
return @old[value]
|
||||
end
|
||||
end
|
||||
return 0
|
||||
if @new.length>0
|
||||
# Get new value
|
||||
value=rand(@new.length)
|
||||
ret=@new.delete_at(value)
|
||||
@old.push(ret)
|
||||
return ret
|
||||
end
|
||||
# Get old value
|
||||
value=rand(@old.length)
|
||||
return @old[value]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -310,7 +307,7 @@ class Maze
|
||||
def buildMazeWall(x,y,dir,len)
|
||||
wx=x;wy=y
|
||||
return if isBlockedNode?(x,y)
|
||||
for c in 0...len
|
||||
len.times do
|
||||
ox=wx;oy=wy
|
||||
wy-=1 if dir==EdgeMasks::North
|
||||
wx-=1 if dir==EdgeMasks::West
|
||||
@@ -341,7 +338,6 @@ class Maze
|
||||
def recurseDepthFirst(x,y,depth)
|
||||
setVisited(x,y)
|
||||
dirs=@@dirs.shuffle!
|
||||
success=0
|
||||
for c in 0...4
|
||||
d=dirs[c]
|
||||
cx=0;cy=0
|
||||
@@ -543,7 +539,7 @@ end
|
||||
def pbRandomRoomTile(dungeon,tiles)
|
||||
ar1=AntiRandom.new(dungeon.width)
|
||||
ar2=AntiRandom.new(dungeon.height)
|
||||
for i in 0...(tiles.length+1)*1000
|
||||
((tiles.length+1)*1000).times do
|
||||
x=ar1.get()
|
||||
y=ar2.get()
|
||||
if dungeon.isRoom?(x,y) &&
|
||||
@@ -556,10 +552,9 @@ def pbRandomRoomTile(dungeon,tiles)
|
||||
return nil
|
||||
end
|
||||
|
||||
Events.onMapCreate += proc { |sender, e|
|
||||
Events.onMapCreate += proc { |_sender, e|
|
||||
mapID=e[0]
|
||||
map=e[1]
|
||||
tileset=e[2]
|
||||
if pbGetMetadata(mapID,MetadataDungeon)
|
||||
# this map is a randomly generated dungeon
|
||||
dungeon=Dungeon.new(map.width,map.height)
|
||||
|
||||
@@ -104,7 +104,7 @@ def pbHiddenMoveAnimation(pokemon)
|
||||
phase=1
|
||||
frames=0
|
||||
strobeSpeed = 64*20/Graphics.frame_rate
|
||||
begin
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
sprite.update
|
||||
@@ -176,7 +176,8 @@ def pbHiddenMoveAnimation(pokemon)
|
||||
end
|
||||
end
|
||||
pbUpdateSceneMap
|
||||
end while phase!=6
|
||||
break if phase==6
|
||||
end
|
||||
sprite.dispose
|
||||
for strobe in strobes
|
||||
strobe.dispose
|
||||
@@ -380,7 +381,7 @@ def pbTransferUnderwater(mapid,x,y,direction=$game_player.direction)
|
||||
}
|
||||
end
|
||||
|
||||
Events.onAction += proc { |sender,e|
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
if $PokemonGlobal.diving
|
||||
if DIVING_SURFACE_ANYWHERE
|
||||
pbSurfacing
|
||||
@@ -673,7 +674,7 @@ def pbStrength
|
||||
return false
|
||||
end
|
||||
|
||||
Events.onAction += proc { |sender,e|
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
pbStrength if facingEvent && facingEvent.name.downcase=="boulder"
|
||||
}
|
||||
@@ -733,7 +734,7 @@ def pbStartSurfing
|
||||
$game_player.check_event_trigger_here([1,2])
|
||||
end
|
||||
|
||||
def pbEndSurf(xOffset,yOffset)
|
||||
def pbEndSurf(_xOffset,_yOffset)
|
||||
return false if !$PokemonGlobal.surfing
|
||||
x = $game_player.x
|
||||
y = $game_player.y
|
||||
@@ -765,7 +766,7 @@ def pbTransferSurfing(mapid,xcoord,ycoord,direction=$game_player.direction)
|
||||
}
|
||||
end
|
||||
|
||||
Events.onAction += proc { |sender,e|
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
next if $PokemonGlobal.surfing
|
||||
next if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
|
||||
next if !PBTerrain.isSurfable?(pbFacingTerrainTag)
|
||||
@@ -825,7 +826,7 @@ def pbSweetScent
|
||||
viewport.color.blue = 0
|
||||
viewport.color.alpha -= 10
|
||||
alphaDiff = 12 * 20 / Graphics.frame_rate
|
||||
begin
|
||||
loop do
|
||||
if count==0 && viewport.color.alpha<128
|
||||
viewport.color.alpha += alphaDiff
|
||||
elsif count>Graphics.frame_rate/4
|
||||
@@ -836,9 +837,9 @@ def pbSweetScent
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
end until viewport.color.alpha<=0
|
||||
break if viewport.color.alpha<=0
|
||||
end
|
||||
viewport.dispose
|
||||
encounter = nil
|
||||
enctype = $PokemonEncounters.pbEncounterType
|
||||
if enctype<0 || !$PokemonEncounters.isEncounterPossibleHere? ||
|
||||
!pbEncounter(enctype)
|
||||
@@ -969,7 +970,7 @@ def pbWaterfall
|
||||
return false
|
||||
end
|
||||
|
||||
Events.onAction += proc { |sender,e|
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
terrain = pbFacingTerrainTag
|
||||
if terrain==PBTerrain::Waterfall
|
||||
pbWaterfall
|
||||
|
||||
@@ -28,7 +28,7 @@ def pbClearData
|
||||
__berryPlant__pbClearData
|
||||
end
|
||||
|
||||
Events.onSpritesetCreate += proc { |sender,e|
|
||||
Events.onSpritesetCreate += proc { |_sender,e|
|
||||
spriteset = e[0]
|
||||
viewport = e[1]
|
||||
map = spriteset.map
|
||||
@@ -105,7 +105,7 @@ end
|
||||
class BerryPlantSprite
|
||||
REPLANTS = 9
|
||||
|
||||
def initialize(event,map,viewport)
|
||||
def initialize(event,map,_viewport)
|
||||
@event=event
|
||||
@map=map
|
||||
@oldstage=0
|
||||
|
||||
@@ -321,7 +321,7 @@ def pbDayCareGenerateEgg
|
||||
ivinherit[i] = PBStats::SPEED if isConst?(parent.item,PBItems,:POWERANKLET)
|
||||
end
|
||||
num = 0; r = rand(2)
|
||||
for i in 0...2
|
||||
2.times do
|
||||
if ivinherit[r]!=nil
|
||||
parent = [mother,father][r]
|
||||
ivs[ivinherit[r]] = parent.iv[ivinherit[r]]
|
||||
@@ -355,7 +355,7 @@ def pbDayCareGenerateEgg
|
||||
shinyretries += 5 if father.language!=mother.language
|
||||
shinyretries += 2 if hasConst?(PBItems,:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
|
||||
if shinyretries>0
|
||||
for i in 0...shinyretries
|
||||
shinyretries.times do
|
||||
break if egg.shiny?
|
||||
egg.personalID = rand(65536)|(rand(65536)<<16)
|
||||
end
|
||||
@@ -410,7 +410,7 @@ end
|
||||
#===============================================================================
|
||||
# Code that happens every step the player takes.
|
||||
#===============================================================================
|
||||
Events.onStepTaken += proc { |sender,e|
|
||||
Events.onStepTaken += proc { |_sender,_e|
|
||||
# Make an egg available at the Day Care
|
||||
deposited = pbDayCareDeposited
|
||||
if deposited==2 && $PokemonGlobal.daycareEgg==0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class PokemonTemp
|
||||
attr_accessor :dependentEvents
|
||||
attr_writer :dependentEvents
|
||||
|
||||
def dependentEvents
|
||||
@dependentEvents=DependentEvents.new if !@dependentEvents
|
||||
@@ -38,11 +38,10 @@ end
|
||||
|
||||
|
||||
class PokemonGlobalMetadata
|
||||
attr_accessor :dependentEvents
|
||||
attr_writer :dependentEvents
|
||||
|
||||
def dependentEvents
|
||||
@dependentEvents=[] if !@dependentEvents
|
||||
return @dependentEvents
|
||||
return @dependentEvents || []
|
||||
end
|
||||
end
|
||||
|
||||
@@ -56,7 +55,7 @@ end
|
||||
|
||||
|
||||
|
||||
def pbTestPass(follower,x,y,direction=nil)
|
||||
def pbTestPass(follower,x,y,_direction=nil)
|
||||
return $MapFactory.isPassableStrict?(follower.map.map_id,x,y,follower)
|
||||
end
|
||||
|
||||
@@ -176,7 +175,6 @@ class DependentEvents
|
||||
|
||||
def pbEnsureEvent(event, newMapID)
|
||||
events=$PokemonGlobal.dependentEvents
|
||||
found=-1
|
||||
for i in 0...events.length
|
||||
# Check original map ID and original event ID
|
||||
if events[i][0]==event.map_id && events[i][1]==event.id
|
||||
@@ -552,15 +550,14 @@ end
|
||||
|
||||
|
||||
|
||||
Events.onSpritesetCreate += proc { |sender,e|
|
||||
Events.onSpritesetCreate += proc { |_sender,e|
|
||||
spriteset = e[0] # Spriteset being created
|
||||
viewport = e[1] # Viewport used for tilemap and characters
|
||||
map = spriteset.map # Map associated with the spriteset (not necessarily the current map)
|
||||
spriteset.addUserSprite(DependentEventSprites.new(viewport,map))
|
||||
}
|
||||
|
||||
Events.onMapSceneChange += proc { |sender,e|
|
||||
scene = e[0]
|
||||
Events.onMapSceneChange += proc { |_sender,e|
|
||||
mapChanged = e[1]
|
||||
if mapChanged
|
||||
$PokemonTemp.dependentEvents.pbMapChangeMoveDependentEvents
|
||||
|
||||
@@ -72,7 +72,7 @@ module PBDayNight
|
||||
def self.getShade
|
||||
time = pbGetDayNightMinutes
|
||||
time = (24*60)-time if time>(12*60)
|
||||
shade=255*time/(12*60)
|
||||
return 255*time/(12*60)
|
||||
end
|
||||
|
||||
# Gets a Tone object representing a suggested shading
|
||||
@@ -97,7 +97,7 @@ module PBDayNight
|
||||
|
||||
# Internal function
|
||||
|
||||
def self.getToneInternal
|
||||
def getToneInternal
|
||||
# Calculates the tone for the current frame, used for day/night effects
|
||||
realMinutes = pbGetDayNightMinutes
|
||||
hour = realMinutes/60
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
class PokeBattle_Trainer
|
||||
attr_accessor(:name)
|
||||
attr_accessor(:id)
|
||||
attr_accessor(:metaID)
|
||||
attr_accessor(:trainertype)
|
||||
attr_accessor(:outfit)
|
||||
attr_accessor(:badges)
|
||||
attr_accessor(:money)
|
||||
attr_accessor(:seen)
|
||||
attr_accessor(:owned)
|
||||
attr_accessor(:formseen)
|
||||
attr_accessor(:formlastseen)
|
||||
attr_accessor(:shadowcaught)
|
||||
attr_accessor(:party)
|
||||
attr_accessor(:pokedex) # Whether the Pokédex was obtained
|
||||
attr_accessor(:pokegear) # Whether the Pokégear was obtained
|
||||
attr_accessor(:language)
|
||||
attr_accessor :name
|
||||
attr_accessor :id
|
||||
attr_writer :metaID
|
||||
attr_accessor :trainertype
|
||||
attr_writer :outfit
|
||||
attr_accessor :badges
|
||||
attr_reader :money
|
||||
attr_accessor :seen
|
||||
attr_accessor :owned
|
||||
attr_accessor :formseen
|
||||
attr_accessor :formlastseen
|
||||
attr_accessor :shadowcaught
|
||||
attr_accessor :party
|
||||
attr_accessor :pokedex # Whether the Pokédex was obtained
|
||||
attr_accessor :pokegear # Whether the Pokégear was obtained
|
||||
attr_writer :language
|
||||
|
||||
def trainerTypeName # Name of this trainer type (localized)
|
||||
return PBTrainers.getName(@trainertype) rescue _INTL("PkMn Trainer")
|
||||
@@ -55,13 +55,11 @@ class PokeBattle_Trainer
|
||||
end
|
||||
|
||||
def outfit
|
||||
@outfit=0 if !@outfit
|
||||
return @outfit
|
||||
return @outfit || 0
|
||||
end
|
||||
|
||||
def language
|
||||
@language=pbGetLanguage() if !@language
|
||||
return @language
|
||||
return @language || pbGetLanguage
|
||||
end
|
||||
|
||||
def money=(value)
|
||||
|
||||
@@ -126,7 +126,6 @@ def pbNewTrainer(trainerid,trainername,trainerparty,savechanges=true)
|
||||
params.setDefaultValue(10)
|
||||
level = pbMessageChooseNumber(_INTL("Set the level for {1} (max. #{PBExperience.maxLevel}).",
|
||||
PBSpecies.getName(species)),params)
|
||||
tempPoke = pbNewPkmn(species,level)
|
||||
pokemon.push([species,level])
|
||||
break
|
||||
end
|
||||
@@ -136,7 +135,7 @@ def pbNewTrainer(trainerid,trainername,trainerparty,savechanges=true)
|
||||
if savechanges
|
||||
data = pbLoadTrainersData
|
||||
data.push(trainer)
|
||||
data = save_data(data,"Data/trainers.dat")
|
||||
save_data(data,"Data/trainers.dat")
|
||||
$PokemonTemp.trainersData = nil
|
||||
pbConvertTrainerData
|
||||
pbMessage(_INTL("The Trainer's data was added to the list of battles and in PBS/trainers.txt."))
|
||||
@@ -168,7 +167,6 @@ def pbGetFreeTrainerParty(trainerid,trainername)
|
||||
end
|
||||
trainerid = getID(PBTrainers,trainerid)
|
||||
end
|
||||
ret = -1
|
||||
trainers = pbLoadTrainersData
|
||||
usedparties = []
|
||||
for trainer in trainers
|
||||
@@ -213,8 +211,7 @@ def pbMissingTrainer(trainerid, trainername, trainerparty)
|
||||
end
|
||||
trainerid = getID(PBTrainers,trainerid)
|
||||
end
|
||||
traineridstring = "#{trainerid}"
|
||||
traineridstring = getConstantName(PBTrainers,trainerid) rescue "-"
|
||||
traineridstring = getConstantName(PBTrainers,trainerid) rescue "#{trainerid}"
|
||||
if !$DEBUG
|
||||
raise _INTL("Can't find trainer ({1}, {2}, ID {3})",traineridstring,trainername,trainerparty)
|
||||
end
|
||||
|
||||
@@ -209,7 +209,6 @@ def pbIsUnlosableItem?(item,species,ability)
|
||||
:KYOGRE => [:BLUEORB],
|
||||
:GROUDON => [:REDORB]
|
||||
}
|
||||
ret = false
|
||||
combos.each do |comboSpecies, items|
|
||||
next if !isConst?(species,PBSpecies,comboSpecies)
|
||||
items.each { |i| return true if isConst?(item,PBItems,i) }
|
||||
@@ -363,7 +362,6 @@ def pbChangeLevel(pkmn,newlevel,scene)
|
||||
spatkdiff = pkmn.spatk
|
||||
spdefdiff = pkmn.spdef
|
||||
totalhpdiff = pkmn.totalhp
|
||||
oldlevel = pkmn.level
|
||||
pkmn.level = newlevel
|
||||
pkmn.changeHappiness("vitamin")
|
||||
pkmn.calcStats
|
||||
@@ -677,7 +675,6 @@ end
|
||||
# Use an item from the Bag and/or on a Pokémon
|
||||
#===============================================================================
|
||||
def pbUseItem(bag,item,bagscene=nil)
|
||||
found = false
|
||||
useType = pbGetItemData(item,ITEM_FIELD_USE)
|
||||
if pbIsMachine?(item) # TM or HM
|
||||
if $Trainer.pokemonCount==0
|
||||
@@ -808,7 +805,7 @@ def pbUseItemMessage(item)
|
||||
end
|
||||
end
|
||||
|
||||
def pbCheckUseOnPokemon(item,pkmn,screen)
|
||||
def pbCheckUseOnPokemon(_item,pkmn,_screen)
|
||||
return pkmn && !pkmn.egg?
|
||||
end
|
||||
|
||||
@@ -905,7 +902,7 @@ end
|
||||
#===============================================================================
|
||||
# Choose an item from the Bag
|
||||
#===============================================================================
|
||||
def pbChooseItem(var=0,*args)
|
||||
def pbChooseItem(var=0,_args)
|
||||
ret = 0
|
||||
pbFadeOutIn {
|
||||
scene = PokemonBag_Scene.new
|
||||
|
||||
@@ -90,7 +90,7 @@ def pbFindPhoneTrainer(trtype,trname) # Ignores whether visible or not
|
||||
end
|
||||
|
||||
def pbHasPhoneTrainer?(trtype,trname)
|
||||
return pbFindPhoneTrainer!=nil
|
||||
return pbFindPhoneTrainer(trtype,trname)!=nil
|
||||
end
|
||||
|
||||
def pbPhoneBattleCount(trtype,trname)
|
||||
@@ -133,7 +133,7 @@ end
|
||||
#===============================================================================
|
||||
# Phone-related counters
|
||||
#===============================================================================
|
||||
Events.onMapUpdate += proc { |sender,e|
|
||||
Events.onMapUpdate += proc { |_sender,_e|
|
||||
next if !$Trainer || !$Trainer.pokegear
|
||||
# Reset time to next phone call if necessary
|
||||
if !$PokemonGlobal.phoneTime || $PokemonGlobal.phoneTime<=0
|
||||
@@ -207,7 +207,6 @@ end
|
||||
# Generate phone message
|
||||
#===============================================================================
|
||||
def pbPhoneGenerateCall(phonenum)
|
||||
call = ""
|
||||
phoneData = pbLoadPhoneData
|
||||
# Choose random greeting depending on time of day
|
||||
call = pbRandomPhoneItem(phoneData.greetings)
|
||||
|
||||
@@ -190,7 +190,7 @@ EncounterModifier.register(proc { |encounter|
|
||||
next encounter
|
||||
})
|
||||
|
||||
Events.onWildPokemonCreate += proc { |sender,e|
|
||||
Events.onWildPokemonCreate += proc { |_sender,e|
|
||||
pokemon = e[0]
|
||||
next if !$PokemonTemp.pokeradar
|
||||
grasses = $PokemonTemp.pokeradar[3]
|
||||
@@ -202,7 +202,7 @@ Events.onWildPokemonCreate += proc { |sender,e|
|
||||
end
|
||||
}
|
||||
|
||||
Events.onWildBattleEnd += proc { |sender,e|
|
||||
Events.onWildBattleEnd += proc { |_sender,e|
|
||||
species = e[0]
|
||||
level = e[1]
|
||||
decision = e[2]
|
||||
@@ -221,7 +221,7 @@ Events.onWildBattleEnd += proc { |sender,e|
|
||||
end
|
||||
}
|
||||
|
||||
Events.onStepTaken += proc { |sender,e|
|
||||
Events.onStepTaken += proc { |_sender,_e|
|
||||
if $PokemonGlobal.pokeradarBattery && $PokemonGlobal.pokeradarBattery>0 &&
|
||||
!$PokemonTemp.pokeradar
|
||||
$PokemonGlobal.pokeradarBattery -= 1
|
||||
@@ -232,11 +232,11 @@ Events.onStepTaken += proc { |sender,e|
|
||||
end
|
||||
}
|
||||
|
||||
Events.onMapUpdate += proc { |sender,e|
|
||||
Events.onMapUpdate += proc { |_sender,_e|
|
||||
pbPokeRadarCancel if $PokemonGlobal.bicycle
|
||||
}
|
||||
|
||||
Events.onMapChange += proc { |sender,e|
|
||||
Events.onMapChange += proc { |_sender,_e|
|
||||
pbPokeRadarCancel
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ def pbStoreMail(pkmn,item,message,poke1=nil,poke2=nil,poke3=nil)
|
||||
pkmn.mail = PokemonMail.new(item,message,$Trainer.name,poke1,poke2,poke3)
|
||||
end
|
||||
|
||||
def pbDisplayMail(mail,bearer=nil)
|
||||
def pbDisplayMail(mail,_bearer=nil)
|
||||
sprites = {}
|
||||
viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
viewport.z = 99999
|
||||
@@ -95,7 +95,7 @@ def pbWriteMail(item,pkmn,pkmnid,scene)
|
||||
"",false,256,Graphics.width) { scene.pbUpdate }
|
||||
if message!=""
|
||||
# Store mail if a message was written
|
||||
poke1 = poke2 = poke3 = nil
|
||||
poke1 = poke2 = nil
|
||||
if $Trainer.party[pkmnid+2]
|
||||
p = $Trainer.party[pkmnid+2]
|
||||
poke1 = [p.species,p.gender,p.shiny?,(p.form rescue 0),p.shadowPokemon?]
|
||||
@@ -110,8 +110,7 @@ def pbWriteMail(item,pkmn,pkmnid,scene)
|
||||
poke3.push(true) if pkmn.egg?
|
||||
pbStoreMail(pkmn,item,message,poke1,poke2,poke3)
|
||||
return true
|
||||
else
|
||||
return false if scene.pbConfirm(_INTL("Stop giving the Pokémon Mail?"))
|
||||
end
|
||||
return false if scene.pbConfirm(_INTL("Stop giving the Pokémon Mail?"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#===============================================================================
|
||||
class PokemonBag
|
||||
attr_accessor :lastpocket
|
||||
attr_reader :pockets
|
||||
|
||||
def self.pocketNames
|
||||
return pbPocketNames
|
||||
@@ -92,7 +91,6 @@ class PokemonBag
|
||||
item = getID(PBItems,item)
|
||||
if !item || item<1
|
||||
raise ArgumentError.new(_INTL("Item number {1} is invalid.",item))
|
||||
return 0
|
||||
end
|
||||
pocket = pbGetPocket(item)
|
||||
maxsize = maxPocketSize(pocket)
|
||||
@@ -108,7 +106,6 @@ class PokemonBag
|
||||
item = getID(PBItems,item)
|
||||
if !item || item<1
|
||||
raise ArgumentError.new(_INTL("Item number {1} is invalid.",item))
|
||||
return false
|
||||
end
|
||||
pocket = pbGetPocket(item)
|
||||
maxsize = maxPocketSize(pocket)
|
||||
@@ -121,7 +118,6 @@ class PokemonBag
|
||||
item = getID(PBItems,item)
|
||||
if !item || item<1
|
||||
raise ArgumentError.new(_INTL("Item number {1} is invalid.",item))
|
||||
return false
|
||||
end
|
||||
pocket = pbGetPocket(item)
|
||||
maxsize = maxPocketSize(pocket)
|
||||
@@ -134,7 +130,6 @@ class PokemonBag
|
||||
item = getID(PBItems,item)
|
||||
if !item || item<1
|
||||
raise ArgumentError.new(_INTL("Item number {1} is invalid.",item))
|
||||
return false
|
||||
end
|
||||
pocket = pbGetPocket(item)
|
||||
maxsize = maxPocketSize(pocket)
|
||||
@@ -148,10 +143,8 @@ class PokemonBag
|
||||
newitem = getID(PBItems,newitem)
|
||||
if !olditem || olditem<1
|
||||
raise ArgumentError.new(_INTL("Item number {1} is invalid.",olditem))
|
||||
return false
|
||||
elsif !newitem || newitem<1
|
||||
raise ArgumentError.new(_INTL("Item number {1} is invalid.",newitem))
|
||||
return false
|
||||
end
|
||||
pocket = pbGetPocket(olditem)
|
||||
maxsize = maxPocketSize(pocket)
|
||||
@@ -179,7 +172,6 @@ class PokemonBag
|
||||
item = getID(PBItems,item)
|
||||
if !item || item<1
|
||||
raise ArgumentError.new(_INTL("Item number {1} is invalid.",item))
|
||||
return false
|
||||
end
|
||||
pocket = pbGetPocket(item)
|
||||
maxsize = maxPocketSize(pocket)
|
||||
@@ -209,7 +201,6 @@ class PokemonBag
|
||||
item = getID(PBItems,item)
|
||||
if !item || item<1
|
||||
raise ArgumentError.new(_INTL("Item number {1} is invalid.",item))
|
||||
return
|
||||
end
|
||||
registeredlist = self.registeredItems
|
||||
registeredlist.push(item) if !registeredlist.include?(item)
|
||||
@@ -220,7 +211,6 @@ class PokemonBag
|
||||
item = getID(PBItems,item)
|
||||
if !item || item<1
|
||||
raise ArgumentError.new(_INTL("Item number {1} is invalid.",item))
|
||||
return
|
||||
end
|
||||
registeredlist = self.registeredItems
|
||||
if registeredlist.include?(item)
|
||||
|
||||
@@ -21,16 +21,16 @@ class PokeBattle_Pokemon
|
||||
attr_accessor :moves # Moves (PBMove)
|
||||
attr_accessor :firstmoves # The moves known when this Pokémon was obtained
|
||||
attr_accessor :item # Held item
|
||||
attr_accessor :mail # Mail
|
||||
attr_writer :mail # Mail
|
||||
attr_accessor :fused # The Pokémon fused into this one
|
||||
attr_accessor :iv # Array of 6 Individual Values for HP, Atk, Def,
|
||||
# Speed, Sp Atk, and Sp Def
|
||||
attr_accessor :ivMaxed # Array of booleans that max each IV value
|
||||
attr_writer :ivMaxed # Array of booleans that max each IV value
|
||||
attr_accessor :ev # Effort Values
|
||||
attr_accessor :happiness # Current happiness
|
||||
attr_accessor :ballused # Ball used
|
||||
attr_accessor :eggsteps # Steps to hatch egg, 0 if Pokémon is not an egg
|
||||
attr_accessor :markings # Markings
|
||||
attr_writer :markings # Markings
|
||||
attr_accessor :ribbons # Array of ribbons
|
||||
attr_accessor :pokerus # Pokérus strain and infection time
|
||||
attr_accessor :personalID # Personal ID
|
||||
@@ -41,15 +41,15 @@ class PokeBattle_Pokemon
|
||||
# 4 - fateful encounter
|
||||
attr_accessor :obtainMap # Map where obtained
|
||||
attr_accessor :obtainText # Replaces the obtain map's name if not nil
|
||||
attr_accessor :obtainLevel # Level obtained
|
||||
attr_writer :obtainLevel # Level obtained
|
||||
attr_accessor :hatchedMap # Map where an egg was hatched
|
||||
attr_accessor :language # Language
|
||||
attr_writer :language # Language
|
||||
attr_accessor :ot # Original Trainer's name
|
||||
attr_accessor :otgender # Original Trainer's gender:
|
||||
attr_writer :otgender # Original Trainer's gender:
|
||||
# 0 - male, 1 - female, 2 - mixed, 3 - unknown
|
||||
# For information only, not used to verify
|
||||
# ownership of the Pokémon
|
||||
attr_accessor :cool,:beauty,:cute,:smart,:tough,:sheen # Contest stats
|
||||
attr_writer :cool,:beauty,:cute,:smart,:tough,:sheen # Contest stats
|
||||
|
||||
IV_STAT_LIMIT = 31 # Max total IVs
|
||||
EV_LIMIT = 510 # Max total EVs
|
||||
@@ -348,7 +348,7 @@ class PokeBattle_Pokemon
|
||||
strain = 1+rand(15) if strain<=0 || strain>=16
|
||||
time = 1+(strain%4)
|
||||
@pokerus = time
|
||||
@pokerus |= strain<<4
|
||||
@pokerus |= strain << 4
|
||||
end
|
||||
|
||||
# Resets the infection time for this Pokémon's Pokérus (even if cured).
|
||||
@@ -357,7 +357,7 @@ class PokeBattle_Pokemon
|
||||
strain = @pokerus%16
|
||||
time = 1+(strain%4)
|
||||
@pokerus = time
|
||||
@pokerus |= strain<<4
|
||||
@pokerus |= strain << 4
|
||||
end
|
||||
|
||||
# Reduces the time remaining for this Pokémon's Pokérus (if infected).
|
||||
@@ -447,7 +447,8 @@ class PokeBattle_Pokemon
|
||||
return if move<=0
|
||||
for i in 0...4 # Already knows move, relocate it to the end of the list
|
||||
next if @moves[i].id!=move
|
||||
j = i+1; while j<4
|
||||
j = i+1
|
||||
while j<4
|
||||
break if @moves[j].id==0
|
||||
tmp = @moves[j]
|
||||
@moves[j] = @moves[j-1]
|
||||
@@ -524,12 +525,12 @@ class PokeBattle_Pokemon
|
||||
#=============================================================================
|
||||
# Contest attributes, ribbons
|
||||
#=============================================================================
|
||||
def cool; return @cool ? @cool : 0; end
|
||||
def beauty; return @beauty ? @beauty : 0; end
|
||||
def cute; return @cute ? @cute : 0; end
|
||||
def smart; return @smart ? @smart : 0; end
|
||||
def tough; return @tough ? @tough : 0; end
|
||||
def sheen; return @sheen ? @sheen : 0; end
|
||||
def cool; return @cool || 0; end
|
||||
def beauty; return @beauty || 0; end
|
||||
def cute; return @cute || 0; end
|
||||
def smart; return @smart || 0; end
|
||||
def tough; return @tough || 0; end
|
||||
def sheen; return @sheen || 0; end
|
||||
|
||||
# Returns the number of ribbons this Pokémon has.
|
||||
def ribbonCount
|
||||
@@ -672,8 +673,7 @@ class PokeBattle_Pokemon
|
||||
# Returns an array of booleans indicating whether a stat is made to have
|
||||
# maximum IVs (for Hyper Training). Set like @ivMaxed[PBStats::ATTACK] = true
|
||||
def ivMaxed
|
||||
@ivMaxed = [] if !@ivMaxed
|
||||
return @ivMaxed
|
||||
return @ivMaxed || []
|
||||
end
|
||||
|
||||
# Returns this Pokémon's effective IVs, taking into account Hyper Training.
|
||||
@@ -870,7 +870,6 @@ class PokeBattle_Pokemon
|
||||
realSpecies = pbGetSpeciesFromFSpecies(species)[0] if species && species>0
|
||||
if !species || species<=0 || realSpecies>PBSpecies.maxValue || !cname
|
||||
raise ArgumentError.new(_INTL("The species given ({1}) is invalid.",ospecies))
|
||||
return nil
|
||||
end
|
||||
@species = realSpecies
|
||||
@name = PBSpecies.getName(@species)
|
||||
|
||||
@@ -63,7 +63,7 @@ end
|
||||
|
||||
|
||||
class PokeBattle_RealBattlePeer
|
||||
def pbOnEnteringBattle(battle,pkmn,wild=false)
|
||||
def pbOnEnteringBattle(_battle,pkmn,wild=false)
|
||||
f = MultipleForms.call("getFormOnEnteringBattle",pkmn,wild)
|
||||
pkmn.form = f if f
|
||||
end
|
||||
@@ -248,7 +248,6 @@ MultipleForms.register(:BURMY,{
|
||||
},
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next if !endBattle || !usedInBattle
|
||||
env = battle.environment
|
||||
case battle.environment
|
||||
when PBEnvironment::Rock, PBEnvironment::Sand, PBEnvironment::Cave
|
||||
next 1 # Sandy Cloak
|
||||
|
||||
@@ -231,9 +231,9 @@ end
|
||||
# Pokémon class.
|
||||
#===============================================================================
|
||||
class PokeBattle_Pokemon
|
||||
attr_accessor :heartgauge
|
||||
attr_writer :heartgauge
|
||||
attr_accessor :shadow
|
||||
attr_accessor :hypermode
|
||||
attr_writer :hypermode
|
||||
attr_accessor :savedev
|
||||
attr_accessor :savedexp
|
||||
attr_accessor :shadowmoves
|
||||
@@ -260,8 +260,7 @@ class PokeBattle_Pokemon
|
||||
end
|
||||
|
||||
def heartgauge
|
||||
@heartgauge = 0 if !@heartgauge
|
||||
return @heartgauge
|
||||
return @heartgauge || 0
|
||||
end
|
||||
|
||||
def heartStage
|
||||
@@ -668,7 +667,7 @@ end
|
||||
|
||||
|
||||
|
||||
Events.onStartBattle += proc { |sender|
|
||||
Events.onStartBattle += proc { |_sender|
|
||||
# Record current heart gauges of Pokémon in party, to see if they drop to zero
|
||||
# during battle and need to say they're ready to be purified afterwards
|
||||
$PokemonTemp.heartgauges = []
|
||||
@@ -677,9 +676,7 @@ Events.onStartBattle += proc { |sender|
|
||||
end
|
||||
}
|
||||
|
||||
Events.onEndBattle += proc { |sender,e|
|
||||
decision = e[0]
|
||||
canLose = e[1]
|
||||
Events.onEndBattle += proc { |_sender,_e|
|
||||
for i in 0...$PokemonTemp.heartgauges.length
|
||||
pokemon = $Trainer.party[i]
|
||||
if pokemon && $PokemonTemp.heartgauges[i] &&
|
||||
|
||||
@@ -39,7 +39,7 @@ HiddenMoveHandlers::UseMove.add(:CHATTER,proc { |move,pokemon|
|
||||
|
||||
|
||||
class PokeBattle_Scene
|
||||
def pbChatter(user,target)
|
||||
def pbChatter(user,_target)
|
||||
pbPlayCry(user.pokemon,90,100) if user.pokemon
|
||||
Graphics.frame_rate.times do
|
||||
Graphics.update
|
||||
|
||||
@@ -111,7 +111,7 @@ class PokemonStorage
|
||||
$Trainer.party
|
||||
end
|
||||
|
||||
def party=(value)
|
||||
def party=(_value)
|
||||
raise ArgumentError.new("Not supported")
|
||||
end
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class Window_Pokedex < Window_DrawableCommand
|
||||
return @commands.length
|
||||
end
|
||||
|
||||
def drawItem(index,count,rect)
|
||||
def drawItem(index,_count,rect)
|
||||
return if index>=self.top_row+self.page_item_max
|
||||
rect = Rect.new(rect.x+16,rect.y,rect.width-16,rect.height)
|
||||
species = @commands[index][0]
|
||||
@@ -431,7 +431,8 @@ class PokemonPokedex_Scene
|
||||
y = 78
|
||||
y += ((sliderheight-boxheight)*itemlist.top_row/(itemlist.row_max-itemlist.page_row_max)).floor
|
||||
overlay.blt(468,y,@sliderbitmap.bitmap,Rect.new(40,0,40,8))
|
||||
i = 0; while i*16<boxheight-8-16
|
||||
i = 0
|
||||
while i*16<boxheight-8-16
|
||||
height = [boxheight-8-16-i*16,16].min
|
||||
overlay.blt(468,y+8+i*16,@sliderbitmap.bitmap,Rect.new(40,8,40,height))
|
||||
i += 1
|
||||
@@ -440,7 +441,7 @@ class PokemonPokedex_Scene
|
||||
end
|
||||
end
|
||||
|
||||
def pbRefreshDexSearch(params,index)
|
||||
def pbRefreshDexSearch(params,_index)
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
base = Color.new(248,248,248)
|
||||
@@ -509,7 +510,7 @@ class PokemonPokedex_Scene
|
||||
pbDrawTextPositions(overlay,textpos)
|
||||
end
|
||||
|
||||
def pbRefreshDexSearchParam(mode,cmds,sel,index)
|
||||
def pbRefreshDexSearchParam(mode,cmds,sel,_index)
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
base = Color.new(248,248,248)
|
||||
@@ -795,7 +796,6 @@ class PokemonPokedex_Scene
|
||||
region = dexnames[pbGetSavePositionIndex][1]
|
||||
end
|
||||
end
|
||||
ret = -1
|
||||
scene = PokemonPokedexInfo_Scene.new
|
||||
screen = PokemonPokedexInfoScreen.new(scene)
|
||||
ret = screen.pbStartScreen(@dexlist,index,region)
|
||||
@@ -985,7 +985,6 @@ class PokemonPokedex_Scene
|
||||
|
||||
def pbDexSearch
|
||||
oldsprites = pbFadeOutAndHide(@sprites)
|
||||
oldparams = @searchParams
|
||||
params = @searchParams.clone
|
||||
@orderCommands = []
|
||||
@orderCommands[MODENUMERICAL] = _INTL("Numerical")
|
||||
|
||||
@@ -113,7 +113,7 @@ class Window_CommandPokemonColor < Window_CommandPokemon
|
||||
super(commands,width)
|
||||
end
|
||||
|
||||
def drawItem(index,count,rect)
|
||||
def drawItem(index,_count,rect)
|
||||
pbSetSystemFont(self.contents) if @starting
|
||||
rect = drawCursor(index,rect)
|
||||
base = self.baseColor
|
||||
@@ -134,7 +134,7 @@ end
|
||||
class PokemonPartyBlankPanel < SpriteWrapper
|
||||
attr_accessor :text
|
||||
|
||||
def initialize(pokemon,index,viewport=nil)
|
||||
def initialize(_pokemon,index,viewport=nil)
|
||||
super(viewport)
|
||||
self.x = [0,256,0,256,0,256][index]
|
||||
self.y = [0,16,96,112,192,208][index]
|
||||
@@ -165,7 +165,7 @@ class PokemonPartyPanel < SpriteWrapper
|
||||
attr_reader :selected
|
||||
attr_reader :preselected
|
||||
attr_reader :switching
|
||||
attr_accessor :text
|
||||
attr_reader :text
|
||||
|
||||
def initialize(pokemon,index,viewport=nil)
|
||||
super(viewport)
|
||||
@@ -832,7 +832,7 @@ class PokemonPartyScreen
|
||||
@party = party
|
||||
end
|
||||
|
||||
def pbStartScene(helptext,numBattlersOut,annotations=nil)
|
||||
def pbStartScene(helptext,_numBattlersOut,annotations=nil)
|
||||
@scene.pbStartScene(@party,helptext,annotations)
|
||||
end
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user