mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-03-24 16:32:27 +00:00
The Great Enspacening begins!
This commit is contained in:
@@ -13,7 +13,7 @@ class EventScriptError < Exception
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbGetExceptionMessage(e,_script="")
|
def pbGetExceptionMessage(e,_script = "")
|
||||||
return e.event_message.dup if e.is_a?(EventScriptError) # Message with map/event ID generated elsewhere
|
return e.event_message.dup if e.is_a?(EventScriptError) # Message with map/event ID generated elsewhere
|
||||||
emessage = e.message.dup
|
emessage = e.message.dup
|
||||||
emessage.force_encoding(Encoding::UTF_8)
|
emessage.force_encoding(Encoding::UTF_8)
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ end
|
|||||||
module RTP
|
module RTP
|
||||||
@rtpPaths = nil
|
@rtpPaths = nil
|
||||||
|
|
||||||
def self.exists?(filename,extensions=[])
|
def self.exists?(filename,extensions = [])
|
||||||
return false if nil_or_empty?(filename)
|
return false if nil_or_empty?(filename)
|
||||||
eachPathFor(filename) { |path|
|
eachPathFor(filename) { |path|
|
||||||
return true if safeExists?(path)
|
return true if safeExists?(path)
|
||||||
@@ -199,7 +199,7 @@ module RTP
|
|||||||
return self.getPath(filename,["",".wav",".wma",".mid",".ogg",".midi"]) # ".mp3"
|
return self.getPath(filename,["",".wav",".wma",".mid",".ogg",".midi"]) # ".mp3"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.getPath(filename,extensions=[])
|
def self.getPath(filename,extensions = [])
|
||||||
return filename if nil_or_empty?(filename)
|
return filename if nil_or_empty?(filename)
|
||||||
eachPathFor(filename) { |path|
|
eachPathFor(filename) { |path|
|
||||||
return path if safeExists?(path)
|
return path if safeExists?(path)
|
||||||
@@ -293,7 +293,7 @@ end
|
|||||||
|
|
||||||
# NOTE: load_data checks anything added in MKXP's RTP setting,
|
# NOTE: load_data checks anything added in MKXP's RTP setting,
|
||||||
# and matching mount points added through System.mount
|
# and matching mount points added through System.mount
|
||||||
def pbRgssOpen(file,mode=nil)
|
def pbRgssOpen(file,mode = nil)
|
||||||
# File.open("debug.txt","ab") { |fw| fw.write([file,mode,Time.now.to_f].inspect+"\r\n") }
|
# File.open("debug.txt","ab") { |fw| fw.write([file,mode,Time.now.to_f].inspect+"\r\n") }
|
||||||
if !safeExists?("./Game.rgssad")
|
if !safeExists?("./Game.rgssad")
|
||||||
if block_given?
|
if block_given?
|
||||||
@@ -421,7 +421,7 @@ class StringInput
|
|||||||
|
|
||||||
def pos=(value); seek(value); end
|
def pos=(value); seek(value); end
|
||||||
|
|
||||||
def seek(offset, whence=IO::SEEK_SET)
|
def seek(offset, whence = IO::SEEK_SET)
|
||||||
raise IOError, 'closed stream' if @closed
|
raise IOError, 'closed stream' if @closed
|
||||||
case whence
|
case whence
|
||||||
when IO::SEEK_SET then @pos = offset
|
when IO::SEEK_SET then @pos = offset
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# HTTP utility functions
|
# HTTP utility functions
|
||||||
#
|
#
|
||||||
#############################
|
#############################
|
||||||
def pbPostData(url, postdata, filename=nil, depth=0)
|
def pbPostData(url, postdata, filename = nil, depth = 0)
|
||||||
if url[/^http:\/\/([^\/]+)(.*)$/]
|
if url[/^http:\/\/([^\/]+)(.*)$/]
|
||||||
host = $1
|
host = $1
|
||||||
path = $2
|
path = $2
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ class OrderedHash < Hash
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def _dump(_depth=100)
|
def _dump(_depth = 100)
|
||||||
values=[]
|
values=[]
|
||||||
for key in @keys
|
for key in @keys
|
||||||
values.push(self[key])
|
values.push(self[key])
|
||||||
@@ -356,7 +356,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
class Messages
|
class Messages
|
||||||
def initialize(filename=nil,delayLoad=false)
|
def initialize(filename = nil,delayLoad = false)
|
||||||
@messages=nil
|
@messages=nil
|
||||||
@filename=filename
|
@filename=filename
|
||||||
if @filename && !delayLoad
|
if @filename && !delayLoad
|
||||||
@@ -410,7 +410,7 @@ class Messages
|
|||||||
return value
|
return value
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.writeObject(f,msgs,secname,origMessages=nil)
|
def self.writeObject(f,msgs,secname,origMessages = nil)
|
||||||
return if !msgs
|
return if !msgs
|
||||||
if msgs.is_a?(Array)
|
if msgs.is_a?(Array)
|
||||||
f.write("[#{secname}]\r\n")
|
f.write("[#{secname}]\r\n")
|
||||||
@@ -529,7 +529,7 @@ class Messages
|
|||||||
@messages[type]=Messages.addToHash(type,array,@messages[type])
|
@messages[type]=Messages.addToHash(type,array,@messages[type])
|
||||||
end
|
end
|
||||||
|
|
||||||
def saveMessages(filename=nil)
|
def saveMessages(filename = nil)
|
||||||
filename="Data/messages.dat" if !filename
|
filename="Data/messages.dat" if !filename
|
||||||
File.open(filename,"wb") { |f| Marshal.dump(@messages,f) }
|
File.open(filename,"wb") { |f| Marshal.dump(@messages,f) }
|
||||||
end
|
end
|
||||||
@@ -675,7 +675,7 @@ module MessageTypes
|
|||||||
@@messages.setMessagesAsHash(type,array)
|
@@messages.setMessagesAsHash(type,array)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.saveMessages(filename=nil)
|
def self.saveMessages(filename = nil)
|
||||||
@@messages.saveMessages(filename)
|
@@messages.saveMessages(filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -92,14 +92,14 @@ class HandlerHash
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def addIf(conditionProc,handler=nil,&handlerBlock)
|
def addIf(conditionProc,handler = nil,&handlerBlock)
|
||||||
if ![Proc,Hash].include?(handler.class) && !block_given?
|
if ![Proc,Hash].include?(handler.class) && !block_given?
|
||||||
raise ArgumentError, "addIf call for #{self.class.name} has no valid handler (#{handler.inspect} was given)"
|
raise ArgumentError, "addIf call for #{self.class.name} has no valid handler (#{handler.inspect} was given)"
|
||||||
end
|
end
|
||||||
@addIfs.push([conditionProc,handler || handlerBlock])
|
@addIfs.push([conditionProc,handler || handlerBlock])
|
||||||
end
|
end
|
||||||
|
|
||||||
def add(sym,handler=nil,&handlerBlock) # 'sym' can be an ID or symbol
|
def add(sym,handler = nil,&handlerBlock) # 'sym' can be an ID or symbol
|
||||||
if ![Proc,Hash].include?(handler.class) && !block_given?
|
if ![Proc,Hash].include?(handler.class) && !block_given?
|
||||||
raise ArgumentError, "#{self.class.name} for #{sym.inspect} has no valid handler (#{handler.inspect} was given)"
|
raise ArgumentError, "#{self.class.name} for #{sym.inspect} has no valid handler (#{handler.inspect} was given)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class Game_System
|
|||||||
Graphics.frame_reset
|
Graphics.frame_reset
|
||||||
end
|
end
|
||||||
|
|
||||||
def bgm_pause(fadetime=0.0) # :nodoc:
|
def bgm_pause(fadetime = 0.0) # :nodoc:
|
||||||
pos = Audio.bgm_pos rescue 0
|
pos = Audio.bgm_pos rescue 0
|
||||||
self.bgm_fade(fadetime) if fadetime>0.0
|
self.bgm_fade(fadetime) if fadetime>0.0
|
||||||
@bgm_position = pos
|
@bgm_position = pos
|
||||||
@@ -130,7 +130,7 @@ class Game_System
|
|||||||
return (@playing_bgm) ? @playing_bgm.clone : nil
|
return (@playing_bgm) ? @playing_bgm.clone : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def setDefaultBGM(bgm,volume=80,pitch=100)
|
def setDefaultBGM(bgm,volume = 80,pitch = 100)
|
||||||
bgm = RPG::AudioFile.new(bgm,volume,pitch) if bgm.is_a?(String)
|
bgm = RPG::AudioFile.new(bgm,volume,pitch) if bgm.is_a?(String)
|
||||||
if bgm!=nil && bgm.name!=""
|
if bgm!=nil && bgm.name!=""
|
||||||
@defaultBGM = nil
|
@defaultBGM = nil
|
||||||
@@ -178,7 +178,7 @@ class Game_System
|
|||||||
Graphics.frame_reset
|
Graphics.frame_reset
|
||||||
end
|
end
|
||||||
|
|
||||||
def bgs_pause(fadetime=0.0) # :nodoc:
|
def bgs_pause(fadetime = 0.0) # :nodoc:
|
||||||
if fadetime>0.0
|
if fadetime>0.0
|
||||||
self.bgs_fade(fadetime)
|
self.bgs_fade(fadetime)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ class Game_Map
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
def terrain_tag(x,y,countBridge=false)
|
def terrain_tag(x,y,countBridge = false)
|
||||||
if valid?(x, y)
|
if valid?(x, y)
|
||||||
for i in [2, 1, 0]
|
for i in [2, 1, 0]
|
||||||
tile_id = data[x, y, i]
|
tile_id = data[x, y, i]
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class Interpreter
|
|||||||
# y : y coordinate to scroll to and center on
|
# y : y coordinate to scroll to and center on
|
||||||
# speed : (optional) scroll speed (from 1-6, default being 4)
|
# speed : (optional) scroll speed (from 1-6, default being 4)
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
def autoscroll(x,y,speed=SCROLL_SPEED_DEFAULT)
|
def autoscroll(x,y,speed = SCROLL_SPEED_DEFAULT)
|
||||||
if $game_map.scrolling?
|
if $game_map.scrolling?
|
||||||
return false
|
return false
|
||||||
elsif !$game_map.valid?(x,y)
|
elsif !$game_map.valid?(x,y)
|
||||||
@@ -138,7 +138,7 @@ class Interpreter
|
|||||||
# * Map Autoscroll (to Player)
|
# * Map Autoscroll (to Player)
|
||||||
# speed : (optional) scroll speed (from 1-6, default being 4)
|
# speed : (optional) scroll speed (from 1-6, default being 4)
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
def autoscroll_player(speed=SCROLL_SPEED_DEFAULT)
|
def autoscroll_player(speed = SCROLL_SPEED_DEFAULT)
|
||||||
autoscroll($game_player.x,$game_player.y,speed)
|
autoscroll($game_player.x,$game_player.y,speed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class PokemonMapFactory
|
|||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
|
|
||||||
def getMap(id,add=true)
|
def getMap(id,add = true)
|
||||||
for map in @maps
|
for map in @maps
|
||||||
return map if map.map_id==id
|
return map if map.map_id==id
|
||||||
end
|
end
|
||||||
@@ -194,7 +194,7 @@ class PokemonMapFactory
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Only used by dependent events
|
# Only used by dependent events
|
||||||
def isPassableStrict?(mapID,x,y,thisEvent=nil)
|
def isPassableStrict?(mapID,x,y,thisEvent = nil)
|
||||||
thisEvent = $game_player if !thisEvent
|
thisEvent = $game_player if !thisEvent
|
||||||
map = getMapNoAdd(mapID)
|
map = getMapNoAdd(mapID)
|
||||||
return false if !map
|
return false if !map
|
||||||
@@ -214,19 +214,19 @@ class PokemonMapFactory
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def getTerrainTag(mapid,x,y,countBridge=false)
|
def getTerrainTag(mapid,x,y,countBridge = false)
|
||||||
map = getMapNoAdd(mapid)
|
map = getMapNoAdd(mapid)
|
||||||
return map.terrain_tag(x,y,countBridge)
|
return map.terrain_tag(x,y,countBridge)
|
||||||
end
|
end
|
||||||
|
|
||||||
# NOTE: Assumes the event is 1x1 tile in size. Only returns one terrain tag.
|
# NOTE: Assumes the event is 1x1 tile in size. Only returns one terrain tag.
|
||||||
def getFacingTerrainTag(dir=nil,event=nil)
|
def getFacingTerrainTag(dir = nil,event = nil)
|
||||||
tile = getFacingTile(dir,event)
|
tile = getFacingTile(dir,event)
|
||||||
return GameData::TerrainTag.get(:None) if !tile
|
return GameData::TerrainTag.get(:None) if !tile
|
||||||
return getTerrainTag(tile[0],tile[1],tile[2])
|
return getTerrainTag(tile[0],tile[1],tile[2])
|
||||||
end
|
end
|
||||||
|
|
||||||
def getTerrainTagFromCoords(mapid,x,y,countBridge=false)
|
def getTerrainTagFromCoords(mapid,x,y,countBridge = false)
|
||||||
tile = getRealTilePos(mapid,x,y)
|
tile = getRealTilePos(mapid,x,y)
|
||||||
return GameData::TerrainTag.get(:None) if !tile
|
return GameData::TerrainTag.get(:None) if !tile
|
||||||
return getTerrainTag(tile[0],tile[1],tile[2])
|
return getTerrainTag(tile[0],tile[1],tile[2])
|
||||||
@@ -289,7 +289,7 @@ class PokemonMapFactory
|
|||||||
end
|
end
|
||||||
|
|
||||||
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
|
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
|
||||||
def getFacingTile(direction=nil,event=nil,steps=1)
|
def getFacingTile(direction = nil,event = nil,steps = 1)
|
||||||
event = $game_player if event==nil
|
event = $game_player if event==nil
|
||||||
return [0,0,0] if !event
|
return [0,0,0] if !event
|
||||||
x = event.x
|
x = event.x
|
||||||
@@ -299,7 +299,7 @@ class PokemonMapFactory
|
|||||||
return getFacingTileFromPos(id,x,y,direction,steps)
|
return getFacingTileFromPos(id,x,y,direction,steps)
|
||||||
end
|
end
|
||||||
|
|
||||||
def getFacingTileFromPos(mapID,x,y,direction=0,steps=1)
|
def getFacingTileFromPos(mapID,x,y,direction = 0,steps = 1)
|
||||||
id = mapID
|
id = mapID
|
||||||
case direction
|
case direction
|
||||||
when 1
|
when 1
|
||||||
@@ -354,7 +354,7 @@ class PokemonMapFactory
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def getFacingCoords(x,y,direction=0,steps=1)
|
def getFacingCoords(x,y,direction = 0,steps = 1)
|
||||||
case direction
|
case direction
|
||||||
when 1
|
when 1
|
||||||
x -= steps
|
x -= steps
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Game_Character
|
|||||||
attr_accessor :walk_anime
|
attr_accessor :walk_anime
|
||||||
attr_writer :bob_height
|
attr_writer :bob_height
|
||||||
|
|
||||||
def initialize(map=nil)
|
def initialize(map = nil)
|
||||||
@map = map
|
@map = map
|
||||||
@id = 0
|
@id = 0
|
||||||
@original_x = 0
|
@original_x = 0
|
||||||
@@ -629,7 +629,7 @@ class Game_Character
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def move_random_range(xrange=-1,yrange=-1)
|
def move_random_range(xrange = -1,yrange = -1)
|
||||||
dirs = [] # 0=down, 1=left, 2=right, 3=up
|
dirs = [] # 0=down, 1=left, 2=right, 3=up
|
||||||
if xrange<0
|
if xrange<0
|
||||||
dirs.push(1)
|
dirs.push(1)
|
||||||
@@ -654,11 +654,11 @@ class Game_Character
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def move_random_UD(range=-1)
|
def move_random_UD(range = -1)
|
||||||
move_random_range(0,range)
|
move_random_range(0,range)
|
||||||
end
|
end
|
||||||
|
|
||||||
def move_random_LR(range=-1)
|
def move_random_LR(range = -1)
|
||||||
move_random_range(range,0)
|
move_random_range(range,0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Game_Event < Game_Character
|
|||||||
attr_reader :tempSwitches # Temporary self-switches
|
attr_reader :tempSwitches # Temporary self-switches
|
||||||
attr_accessor :need_refresh
|
attr_accessor :need_refresh
|
||||||
|
|
||||||
def initialize(map_id, event, map=nil)
|
def initialize(map_id, event, map = nil)
|
||||||
super(map)
|
super(map)
|
||||||
@map_id = map_id
|
@map_id = map_id
|
||||||
@event = event
|
@event = event
|
||||||
@@ -99,13 +99,13 @@ class Game_Event < Game_Character
|
|||||||
return $PokemonGlobal.eventvars[[@map_id,@event.id]].to_i
|
return $PokemonGlobal.eventvars[[@map_id,@event.id]].to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def expired?(secs=86400)
|
def expired?(secs = 86400)
|
||||||
ontime=self.variable
|
ontime=self.variable
|
||||||
time=pbGetTimeNow
|
time=pbGetTimeNow
|
||||||
return ontime && (time.to_i>ontime+secs)
|
return ontime && (time.to_i>ontime+secs)
|
||||||
end
|
end
|
||||||
|
|
||||||
def expiredDays?(days=1)
|
def expiredDays?(days = 1)
|
||||||
ontime=self.variable.to_i
|
ontime=self.variable.to_i
|
||||||
return false if !ontime
|
return false if !ontime
|
||||||
now=pbGetTimeNow
|
now=pbGetTimeNow
|
||||||
@@ -242,7 +242,7 @@ class Game_Event < Game_Character
|
|||||||
check_event_trigger_auto
|
check_event_trigger_auto
|
||||||
end
|
end
|
||||||
|
|
||||||
def should_update?(recalc=false)
|
def should_update?(recalc = false)
|
||||||
return @to_update if !recalc
|
return @to_update if !recalc
|
||||||
return true if @trigger && (@trigger == 3 || @trigger == 4)
|
return true if @trigger && (@trigger == 3 || @trigger == 4)
|
||||||
return true if @move_route_forcing
|
return true if @move_route_forcing
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ class Game_Player < Game_Character
|
|||||||
triggerLeaveTile
|
triggerLeaveTile
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbTriggeredTrainerEvents(triggers,checkIfRunning=true)
|
def pbTriggeredTrainerEvents(triggers,checkIfRunning = true)
|
||||||
result = []
|
result = []
|
||||||
# If event is running
|
# If event is running
|
||||||
return result if checkIfRunning && $game_system.map_interpreter.running?
|
return result if checkIfRunning && $game_system.map_interpreter.running?
|
||||||
@@ -196,7 +196,7 @@ class Game_Player < Game_Character
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbTriggeredCounterEvents(triggers,checkIfRunning=true)
|
def pbTriggeredCounterEvents(triggers,checkIfRunning = true)
|
||||||
result = []
|
result = []
|
||||||
# If event is running
|
# If event is running
|
||||||
return result if checkIfRunning && $game_system.map_interpreter.running?
|
return result if checkIfRunning && $game_system.map_interpreter.running?
|
||||||
@@ -230,7 +230,7 @@ class Game_Player < Game_Character
|
|||||||
return $game_map.terrain_tag(@x, @y, countBridge)
|
return $game_map.terrain_tag(@x, @y, countBridge)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFacingEvent(ignoreInterpreter=false)
|
def pbFacingEvent(ignoreInterpreter = false)
|
||||||
return nil if $game_system.map_interpreter.running? && !ignoreInterpreter
|
return nil if $game_system.map_interpreter.running? && !ignoreInterpreter
|
||||||
# Check the tile in front of the player for events
|
# Check the tile in front of the player for events
|
||||||
new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
|
new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Sprite_Timer
|
class Sprite_Timer
|
||||||
def initialize(viewport=nil)
|
def initialize(viewport = nil)
|
||||||
@viewport=viewport
|
@viewport=viewport
|
||||||
@timer=nil
|
@timer=nil
|
||||||
@total_sec=nil
|
@total_sec=nil
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Sprite_Reflection
|
|||||||
attr_reader :visible
|
attr_reader :visible
|
||||||
attr_accessor :event
|
attr_accessor :event
|
||||||
|
|
||||||
def initialize(sprite,event,viewport=nil)
|
def initialize(sprite,event,viewport = nil)
|
||||||
@rsprite = sprite
|
@rsprite = sprite
|
||||||
@sprite = nil
|
@sprite = nil
|
||||||
@event = event
|
@event = event
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Sprite_SurfBase
|
|||||||
attr_reader :visible
|
attr_reader :visible
|
||||||
attr_accessor :event
|
attr_accessor :event
|
||||||
|
|
||||||
def initialize(sprite,event,viewport=nil)
|
def initialize(sprite,event,viewport = nil)
|
||||||
@rsprite = sprite
|
@rsprite = sprite
|
||||||
@sprite = nil
|
@sprite = nil
|
||||||
@event = event
|
@event = event
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Spriteset_Map
|
|||||||
return @@viewport1
|
return @@viewport1
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(map=nil)
|
def initialize(map = nil)
|
||||||
@map = (map) ? map : $game_map
|
@map = (map) ? map : $game_map
|
||||||
$scene.map_renderer.add_tileset(@map.tileset_name)
|
$scene.map_renderer.add_tileset(@map.tileset_name)
|
||||||
@map.autotile_names.each { |filename| $scene.map_renderer.add_autotile(filename) }
|
@map.autotile_names.each { |filename| $scene.map_renderer.add_autotile(filename) }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ automatically when its animation is finished.
|
|||||||
Used for grass rustling and so forth.
|
Used for grass rustling and so forth.
|
||||||
=end
|
=end
|
||||||
class AnimationSprite < RPG::Sprite
|
class AnimationSprite < RPG::Sprite
|
||||||
def initialize(animID,map,tileX,tileY,viewport=nil,tinting=false,height=3)
|
def initialize(animID,map,tileX,tileY,viewport = nil,tinting = false,height = 3)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
@tileX = tileX
|
@tileX = tileX
|
||||||
@tileY = tileY
|
@tileY = tileY
|
||||||
@@ -45,12 +45,12 @@ class Spriteset_Map
|
|||||||
alias _animationSprite_update update
|
alias _animationSprite_update update
|
||||||
alias _animationSprite_dispose dispose
|
alias _animationSprite_dispose dispose
|
||||||
|
|
||||||
def initialize(map=nil)
|
def initialize(map = nil)
|
||||||
@usersprites=[]
|
@usersprites=[]
|
||||||
_animationSprite_initialize(map)
|
_animationSprite_initialize(map)
|
||||||
end
|
end
|
||||||
|
|
||||||
def addUserAnimation(animID,x,y,tinting=false,height=3)
|
def addUserAnimation(animID,x,y,tinting = false,height = 3)
|
||||||
sprite=AnimationSprite.new(animID,self.map,x,y,@@viewport1,tinting,height)
|
sprite=AnimationSprite.new(animID,self.map,x,y,@@viewport1,tinting,height)
|
||||||
addUserSprite(sprite)
|
addUserSprite(sprite)
|
||||||
return sprite
|
return sprite
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
class Sprite_Shadow < RPG::Sprite
|
class Sprite_Shadow < RPG::Sprite
|
||||||
attr_accessor :character
|
attr_accessor :character
|
||||||
|
|
||||||
def initialize(viewport, character = nil,params=[])
|
def initialize(viewport, character = nil,params = [])
|
||||||
super(viewport)
|
super(viewport)
|
||||||
@source = params[0]
|
@source = params[0]
|
||||||
@anglemin = (params.size>1) ? params[1] : 0
|
@anglemin = (params.size>1) ? params[1] : 0
|
||||||
@@ -184,7 +184,7 @@ class Spriteset_Map
|
|||||||
attr_accessor :shadows
|
attr_accessor :shadows
|
||||||
|
|
||||||
alias shadow_initialize initialize
|
alias shadow_initialize initialize
|
||||||
def initialize(map=nil)
|
def initialize(map = nil)
|
||||||
@shadows = []
|
@shadows = []
|
||||||
warn = false
|
warn = false
|
||||||
map = $game_map if !map
|
map = $game_map if !map
|
||||||
@@ -228,7 +228,7 @@ end
|
|||||||
# p XPML_read("third", event_id) -> [3]
|
# p XPML_read("third", event_id) -> [3]
|
||||||
# p XPML_read("forth", event_id) -> nil
|
# p XPML_read("forth", event_id) -> nil
|
||||||
#===================================================
|
#===================================================
|
||||||
def XPML_read(map,markup,event,max_param_number=0)
|
def XPML_read(map,markup,event,max_param_number = 0)
|
||||||
parameter_list = nil
|
parameter_list = nil
|
||||||
return nil if !event || event.list == nil
|
return nil if !event || event.list == nil
|
||||||
for i in 0...event.list.size
|
for i in 0...event.list.size
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Based on version 2 by Near Fantastica, 04.01.06
|
# Based on version 2 by Near Fantastica, 04.01.06
|
||||||
# In turn based on the Particle Engine designed by PinkMan
|
# In turn based on the Particle Engine designed by PinkMan
|
||||||
class Particle_Engine
|
class Particle_Engine
|
||||||
def initialize(viewport=nil,map=nil)
|
def initialize(viewport = nil,map = nil)
|
||||||
@map = (map) ? map : $game_map
|
@map = (map) ? map : $game_map
|
||||||
@viewport = viewport
|
@viewport = viewport
|
||||||
@effect = []
|
@effect = []
|
||||||
@@ -177,7 +177,7 @@ end
|
|||||||
class ParticleEffect_Event < ParticleEffect
|
class ParticleEffect_Event < ParticleEffect
|
||||||
attr_accessor :event
|
attr_accessor :event
|
||||||
|
|
||||||
def initialize(event,viewport=nil)
|
def initialize(event,viewport = nil)
|
||||||
@event = event
|
@event = event
|
||||||
@viewport = viewport
|
@viewport = viewport
|
||||||
@particles = []
|
@particles = []
|
||||||
@@ -202,7 +202,7 @@ class ParticleEffect_Event < ParticleEffect
|
|||||||
return bitmap
|
return bitmap
|
||||||
end
|
end
|
||||||
|
|
||||||
def initParticles(filename,opacity,zOffset=0,blendtype=1)
|
def initParticles(filename,opacity,zOffset = 0,blendtype = 1)
|
||||||
@particles = []
|
@particles = []
|
||||||
@particlex = []
|
@particlex = []
|
||||||
@particley = []
|
@particley = []
|
||||||
@@ -570,7 +570,7 @@ class Game_Event < Game_Character
|
|||||||
attr_accessor :pe_refresh
|
attr_accessor :pe_refresh
|
||||||
|
|
||||||
alias nf_particles_game_map_initialize initialize
|
alias nf_particles_game_map_initialize initialize
|
||||||
def initialize(map_id,event,map=nil)
|
def initialize(map_id,event,map = nil)
|
||||||
@pe_refresh = false
|
@pe_refresh = false
|
||||||
begin
|
begin
|
||||||
nf_particles_game_map_initialize(map_id, event, map)
|
nf_particles_game_map_initialize(map_id, event, map)
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class PictureEx
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def setCallback(delay, cb=nil)
|
def setCallback(delay, cb = nil)
|
||||||
delay = ensureDelayAndDuration(delay)
|
delay = ensureDelayAndDuration(delay)
|
||||||
@processes.push([nil,delay,0,0,cb])
|
@processes.push([nil,delay,0,0,cb])
|
||||||
end
|
end
|
||||||
@@ -149,7 +149,7 @@ class PictureEx
|
|||||||
return ret.to_i
|
return ret.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensureDelayAndDuration(delay, duration=nil)
|
def ensureDelayAndDuration(delay, duration = nil)
|
||||||
delay = self.totalDuration if delay<0
|
delay = self.totalDuration if delay<0
|
||||||
delay *= Graphics.frame_rate/20.0
|
delay *= Graphics.frame_rate/20.0
|
||||||
if !duration.nil?
|
if !duration.nil?
|
||||||
@@ -194,149 +194,149 @@ class PictureEx
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def move(delay, duration, origin, x, y, zoom_x=100.0, zoom_y=100.0, opacity=255)
|
def move(delay, duration, origin, x, y, zoom_x = 100.0, zoom_y = 100.0, opacity = 255)
|
||||||
setOrigin(delay,duration,origin)
|
setOrigin(delay,duration,origin)
|
||||||
moveXY(delay,duration,x,y)
|
moveXY(delay,duration,x,y)
|
||||||
moveZoomXY(delay,duration,zoom_x,zoom_y)
|
moveZoomXY(delay,duration,zoom_x,zoom_y)
|
||||||
moveOpacity(delay,duration,opacity)
|
moveOpacity(delay,duration,opacity)
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveXY(delay, duration, x, y, cb=nil)
|
def moveXY(delay, duration, x, y, cb = nil)
|
||||||
delay, duration = ensureDelayAndDuration(delay,duration)
|
delay, duration = ensureDelayAndDuration(delay,duration)
|
||||||
@processes.push([Processes::XY,delay,duration,0,cb,@x,@y,x,y])
|
@processes.push([Processes::XY,delay,duration,0,cb,@x,@y,x,y])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setXY(delay, x, y, cb=nil)
|
def setXY(delay, x, y, cb = nil)
|
||||||
moveXY(delay,0,x,y,cb)
|
moveXY(delay,0,x,y,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveCurve(delay, duration, x1, y1, x2, y2, x3, y3, cb=nil)
|
def moveCurve(delay, duration, x1, y1, x2, y2, x3, y3, cb = nil)
|
||||||
delay, duration = ensureDelayAndDuration(delay,duration)
|
delay, duration = ensureDelayAndDuration(delay,duration)
|
||||||
@processes.push([Processes::Curve,delay,duration,0,cb,[@x,@y,x1,y1,x2,y2,x3,y3]])
|
@processes.push([Processes::Curve,delay,duration,0,cb,[@x,@y,x1,y1,x2,y2,x3,y3]])
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveDelta(delay, duration, x, y, cb=nil)
|
def moveDelta(delay, duration, x, y, cb = nil)
|
||||||
delay, duration = ensureDelayAndDuration(delay,duration)
|
delay, duration = ensureDelayAndDuration(delay,duration)
|
||||||
@processes.push([Processes::DeltaXY,delay,duration,0,cb,@x,@y,x,y])
|
@processes.push([Processes::DeltaXY,delay,duration,0,cb,@x,@y,x,y])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setDelta(delay, x, y, cb=nil)
|
def setDelta(delay, x, y, cb = nil)
|
||||||
moveDelta(delay,0,x,y,cb)
|
moveDelta(delay,0,x,y,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveZ(delay, duration, z, cb=nil)
|
def moveZ(delay, duration, z, cb = nil)
|
||||||
delay, duration = ensureDelayAndDuration(delay,duration)
|
delay, duration = ensureDelayAndDuration(delay,duration)
|
||||||
@processes.push([Processes::Z,delay,duration,0,cb,@z,z])
|
@processes.push([Processes::Z,delay,duration,0,cb,@z,z])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setZ(delay, z, cb=nil)
|
def setZ(delay, z, cb = nil)
|
||||||
moveZ(delay,0,z,cb)
|
moveZ(delay,0,z,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveZoomXY(delay, duration, zoom_x, zoom_y, cb=nil)
|
def moveZoomXY(delay, duration, zoom_x, zoom_y, cb = nil)
|
||||||
delay, duration = ensureDelayAndDuration(delay,duration)
|
delay, duration = ensureDelayAndDuration(delay,duration)
|
||||||
@processes.push([Processes::Zoom,delay,duration,0,cb,@zoom_x,@zoom_y,zoom_x,zoom_y])
|
@processes.push([Processes::Zoom,delay,duration,0,cb,@zoom_x,@zoom_y,zoom_x,zoom_y])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setZoomXY(delay, zoom_x, zoom_y, cb=nil)
|
def setZoomXY(delay, zoom_x, zoom_y, cb = nil)
|
||||||
moveZoomXY(delay,0,zoom_x,zoom_y,cb)
|
moveZoomXY(delay,0,zoom_x,zoom_y,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveZoom(delay, duration, zoom, cb=nil)
|
def moveZoom(delay, duration, zoom, cb = nil)
|
||||||
moveZoomXY(delay,duration,zoom,zoom,cb)
|
moveZoomXY(delay,duration,zoom,zoom,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
def setZoom(delay, zoom, cb=nil)
|
def setZoom(delay, zoom, cb = nil)
|
||||||
moveZoomXY(delay,0,zoom,zoom,cb)
|
moveZoomXY(delay,0,zoom,zoom,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveAngle(delay, duration, angle, cb=nil)
|
def moveAngle(delay, duration, angle, cb = nil)
|
||||||
delay, duration = ensureDelayAndDuration(delay,duration)
|
delay, duration = ensureDelayAndDuration(delay,duration)
|
||||||
@processes.push([Processes::Angle,delay,duration,0,cb,@angle,angle])
|
@processes.push([Processes::Angle,delay,duration,0,cb,@angle,angle])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setAngle(delay, angle, cb=nil)
|
def setAngle(delay, angle, cb = nil)
|
||||||
moveAngle(delay,0,angle,cb)
|
moveAngle(delay,0,angle,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveTone(delay, duration, tone, cb=nil)
|
def moveTone(delay, duration, tone, cb = nil)
|
||||||
delay, duration = ensureDelayAndDuration(delay,duration)
|
delay, duration = ensureDelayAndDuration(delay,duration)
|
||||||
target = (tone) ? tone.clone : Tone.new(0,0,0,0)
|
target = (tone) ? tone.clone : Tone.new(0,0,0,0)
|
||||||
@processes.push([Processes::Tone,delay,duration,0,cb,@tone.clone,target])
|
@processes.push([Processes::Tone,delay,duration,0,cb,@tone.clone,target])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setTone(delay, tone, cb=nil)
|
def setTone(delay, tone, cb = nil)
|
||||||
moveTone(delay,0,tone,cb)
|
moveTone(delay,0,tone,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveColor(delay, duration, color, cb=nil)
|
def moveColor(delay, duration, color, cb = nil)
|
||||||
delay, duration = ensureDelayAndDuration(delay,duration)
|
delay, duration = ensureDelayAndDuration(delay,duration)
|
||||||
target = (color) ? color.clone : Color.new(0,0,0,0)
|
target = (color) ? color.clone : Color.new(0,0,0,0)
|
||||||
@processes.push([Processes::Color,delay,duration,0,cb,@color.clone,target])
|
@processes.push([Processes::Color,delay,duration,0,cb,@color.clone,target])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setColor(delay, color, cb=nil)
|
def setColor(delay, color, cb = nil)
|
||||||
moveColor(delay,0,color,cb)
|
moveColor(delay,0,color,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Hue changes don't actually work.
|
# Hue changes don't actually work.
|
||||||
def moveHue(delay, duration, hue, cb=nil)
|
def moveHue(delay, duration, hue, cb = nil)
|
||||||
delay, duration = ensureDelayAndDuration(delay,duration)
|
delay, duration = ensureDelayAndDuration(delay,duration)
|
||||||
@processes.push([Processes::Hue,delay,duration,0,cb,@hue,hue])
|
@processes.push([Processes::Hue,delay,duration,0,cb,@hue,hue])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Hue changes don't actually work.
|
# Hue changes don't actually work.
|
||||||
def setHue(delay, hue, cb=nil)
|
def setHue(delay, hue, cb = nil)
|
||||||
moveHue(delay,0,hue,cb)
|
moveHue(delay,0,hue,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveOpacity(delay, duration, opacity, cb=nil)
|
def moveOpacity(delay, duration, opacity, cb = nil)
|
||||||
delay, duration = ensureDelayAndDuration(delay,duration)
|
delay, duration = ensureDelayAndDuration(delay,duration)
|
||||||
@processes.push([Processes::Opacity,delay,duration,0,cb,@opacity,opacity])
|
@processes.push([Processes::Opacity,delay,duration,0,cb,@opacity,opacity])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setOpacity(delay, opacity, cb=nil)
|
def setOpacity(delay, opacity, cb = nil)
|
||||||
moveOpacity(delay,0,opacity,cb)
|
moveOpacity(delay,0,opacity,cb)
|
||||||
end
|
end
|
||||||
|
|
||||||
def setVisible(delay, visible, cb=nil)
|
def setVisible(delay, visible, cb = nil)
|
||||||
delay = ensureDelay(delay)
|
delay = ensureDelay(delay)
|
||||||
@processes.push([Processes::Visible,delay,0,0,cb,visible])
|
@processes.push([Processes::Visible,delay,0,0,cb,visible])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Only values of 0 (normal), 1 (additive) and 2 (subtractive) are allowed.
|
# Only values of 0 (normal), 1 (additive) and 2 (subtractive) are allowed.
|
||||||
def setBlendType(delay, blend, cb=nil)
|
def setBlendType(delay, blend, cb = nil)
|
||||||
delay = ensureDelayAndDuration(delay)
|
delay = ensureDelayAndDuration(delay)
|
||||||
@processes.push([Processes::BlendType,delay,0,0,cb,blend])
|
@processes.push([Processes::BlendType,delay,0,0,cb,blend])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setSE(delay, seFile, volume=nil, pitch=nil, cb=nil)
|
def setSE(delay, seFile, volume = nil, pitch = nil, cb = nil)
|
||||||
delay = ensureDelay(delay)
|
delay = ensureDelay(delay)
|
||||||
@processes.push([Processes::SE,delay,0,0,cb,seFile,volume,pitch])
|
@processes.push([Processes::SE,delay,0,0,cb,seFile,volume,pitch])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setName(delay, name, cb=nil)
|
def setName(delay, name, cb = nil)
|
||||||
delay = ensureDelay(delay)
|
delay = ensureDelay(delay)
|
||||||
@processes.push([Processes::Name,delay,0,0,cb,name])
|
@processes.push([Processes::Name,delay,0,0,cb,name])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setOrigin(delay, origin, cb=nil)
|
def setOrigin(delay, origin, cb = nil)
|
||||||
delay = ensureDelay(delay)
|
delay = ensureDelay(delay)
|
||||||
@processes.push([Processes::Origin,delay,0,0,cb,origin])
|
@processes.push([Processes::Origin,delay,0,0,cb,origin])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setSrc(delay, srcX, srcY, cb=nil)
|
def setSrc(delay, srcX, srcY, cb = nil)
|
||||||
delay = ensureDelay(delay)
|
delay = ensureDelay(delay)
|
||||||
@processes.push([Processes::Src,delay,0,0,cb,srcX,srcY])
|
@processes.push([Processes::Src,delay,0,0,cb,srcX,srcY])
|
||||||
end
|
end
|
||||||
|
|
||||||
def setSrcSize(delay, srcWidth, srcHeight, cb=nil)
|
def setSrcSize(delay, srcWidth, srcHeight, cb = nil)
|
||||||
delay = ensureDelay(delay)
|
delay = ensureDelay(delay)
|
||||||
@processes.push([Processes::SrcSize,delay,0,0,cb,srcWidth,srcHeight])
|
@processes.push([Processes::SrcSize,delay,0,0,cb,srcWidth,srcHeight])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Used to cut Pokémon sprites off when they faint and sink into the ground.
|
# Used to cut Pokémon sprites off when they faint and sink into the ground.
|
||||||
def setCropBottom(delay, y, cb=nil)
|
def setCropBottom(delay, y, cb = nil)
|
||||||
delay = ensureDelay(delay)
|
delay = ensureDelay(delay)
|
||||||
@processes.push([Processes::CropBottom,delay,0,0,cb,y])
|
@processes.push([Processes::CropBottom,delay,0,0,cb,y])
|
||||||
end
|
end
|
||||||
@@ -462,7 +462,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def setPictureSprite(sprite, picture, iconSprite=false)
|
def setPictureSprite(sprite, picture, iconSprite = false)
|
||||||
return if picture.frameUpdates.length==0
|
return if picture.frameUpdates.length==0
|
||||||
for i in 0...picture.frameUpdates.length
|
for i in 0...picture.frameUpdates.length
|
||||||
case picture.frameUpdates[i]
|
case picture.frameUpdates[i]
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ module ScreenPosHelper
|
|||||||
return h
|
return h
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.pbScreenZ(ch,height=nil)
|
def self.pbScreenZ(ch,height = nil)
|
||||||
if height==nil
|
if height==nil
|
||||||
height=0
|
height=0
|
||||||
if ch.tile_id > 0
|
if ch.tile_id > 0
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class TileDrawingHelper
|
|||||||
bitmap.stretch_blt(Rect.new(x, y, cxTile, cyTile), @tileset, rect)
|
bitmap.stretch_blt(Rect.new(x, y, cxTile, cyTile), @tileset, rect)
|
||||||
end
|
end
|
||||||
|
|
||||||
def bltSmallTile(bitmap,x,y,cxTile,cyTile,id,frame=0)
|
def bltSmallTile(bitmap,x,y,cxTile,cyTile,id,frame = 0)
|
||||||
if id >= 384
|
if id >= 384
|
||||||
bltSmallRegularTile(bitmap, x, y, cxTile, cyTile, id)
|
bltSmallRegularTile(bitmap, x, y, cxTile, cyTile, id)
|
||||||
elsif id > 0
|
elsif id > 0
|
||||||
@@ -134,7 +134,7 @@ class TileDrawingHelper
|
|||||||
bltSmallRegularTile(bitmap, x, y, 32, 32, id)
|
bltSmallRegularTile(bitmap, x, y, 32, 32, id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def bltTile(bitmap,x,y,id,frame=0)
|
def bltTile(bitmap,x,y,id,frame = 0)
|
||||||
if id >= 384
|
if id >= 384
|
||||||
bltRegularTile(bitmap, x, y, id)
|
bltRegularTile(bitmap, x, y, id)
|
||||||
elsif id > 0
|
elsif id > 0
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ def pbBottomLeft(window)
|
|||||||
window.y=Graphics.height-window.height
|
window.y=Graphics.height-window.height
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbBottomLeftLines(window,lines,width=nil)
|
def pbBottomLeftLines(window,lines,width = nil)
|
||||||
window.x=0
|
window.x=0
|
||||||
window.width=width ? width : Graphics.width
|
window.width=width ? width : Graphics.width
|
||||||
window.height=(window.borderY rescue 32)+lines*32
|
window.height=(window.borderY rescue 32)+lines*32
|
||||||
@@ -229,7 +229,7 @@ def pbPositionNearMsgWindow(cmdwindow,msgwindow,side)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# internal function
|
# internal function
|
||||||
def pbRepositionMessageWindow(msgwindow, linecount=2)
|
def pbRepositionMessageWindow(msgwindow, linecount = 2)
|
||||||
msgwindow.height=32*linecount+msgwindow.borderY
|
msgwindow.height=32*linecount+msgwindow.borderY
|
||||||
msgwindow.y=(Graphics.height)-(msgwindow.height)
|
msgwindow.y=(Graphics.height)-(msgwindow.height)
|
||||||
if $game_system
|
if $game_system
|
||||||
@@ -246,7 +246,7 @@ def pbRepositionMessageWindow(msgwindow, linecount=2)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# internal function
|
# internal function
|
||||||
def pbUpdateMsgWindowPos(msgwindow,event,eventChanged=false)
|
def pbUpdateMsgWindowPos(msgwindow,event,eventChanged = false)
|
||||||
if event
|
if event
|
||||||
if eventChanged
|
if eventChanged
|
||||||
msgwindow.resizeToFit2(msgwindow.text,Graphics.width*2/3,msgwindow.height)
|
msgwindow.resizeToFit2(msgwindow.text,Graphics.width*2/3,msgwindow.height)
|
||||||
@@ -272,7 +272,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Determine the colour of a background
|
# Determine the colour of a background
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def isDarkBackground(background,rect=nil)
|
def isDarkBackground(background,rect = nil)
|
||||||
return true if !background || background.disposed?
|
return true if !background || background.disposed?
|
||||||
rect = background.rect if !rect
|
rect = background.rect if !rect
|
||||||
return true if rect.width<=0 || rect.height<=0
|
return true if rect.width<=0 || rect.height<=0
|
||||||
@@ -545,7 +545,7 @@ end
|
|||||||
# pbFadeOutIn(z) { block }
|
# pbFadeOutIn(z) { block }
|
||||||
# Fades out the screen before a block is run and fades it back in after the
|
# Fades out the screen before a block is run and fades it back in after the
|
||||||
# block exits. z indicates the z-coordinate of the viewport used for this effect
|
# block exits. z indicates the z-coordinate of the viewport used for this effect
|
||||||
def pbFadeOutIn(z=99999,nofadeout=false)
|
def pbFadeOutIn(z = 99999,nofadeout = false)
|
||||||
col=Color.new(0,0,0,0)
|
col=Color.new(0,0,0,0)
|
||||||
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||||
viewport.z=z
|
viewport.z=z
|
||||||
@@ -576,7 +576,7 @@ def pbFadeOutIn(z=99999,nofadeout=false)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFadeOutInWithUpdate(z,sprites,nofadeout=false)
|
def pbFadeOutInWithUpdate(z,sprites,nofadeout = false)
|
||||||
col=Color.new(0,0,0,0)
|
col=Color.new(0,0,0,0)
|
||||||
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||||
viewport.z=z
|
viewport.z=z
|
||||||
@@ -609,7 +609,7 @@ end
|
|||||||
|
|
||||||
# Similar to pbFadeOutIn, but pauses the music as it fades out.
|
# Similar to pbFadeOutIn, but pauses the music as it fades out.
|
||||||
# Requires scripts "Audio" (for bgm_pause) and "SpriteWindow" (for pbFadeOutIn).
|
# Requires scripts "Audio" (for bgm_pause) and "SpriteWindow" (for pbFadeOutIn).
|
||||||
def pbFadeOutInWithMusic(zViewport=99999)
|
def pbFadeOutInWithMusic(zViewport = 99999)
|
||||||
playingBGS = $game_system.getPlayingBGS
|
playingBGS = $game_system.getPlayingBGS
|
||||||
playingBGM = $game_system.getPlayingBGM
|
playingBGM = $game_system.getPlayingBGM
|
||||||
$game_system.bgm_pause(1.0)
|
$game_system.bgm_pause(1.0)
|
||||||
@@ -642,7 +642,7 @@ def pbFadeOutAndHide(sprites)
|
|||||||
return visiblesprites
|
return visiblesprites
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFadeInAndShow(sprites,visiblesprites=nil)
|
def pbFadeInAndShow(sprites,visiblesprites = nil)
|
||||||
if visiblesprites
|
if visiblesprites
|
||||||
for i in visiblesprites
|
for i in visiblesprites
|
||||||
if i[1] && sprites[i[0]] && !pbDisposed?(sprites[i[0]])
|
if i[1] && sprites[i[0]] && !pbDisposed?(sprites[i[0]])
|
||||||
@@ -713,7 +713,7 @@ end
|
|||||||
# _background_ is a filename within the Graphics/Pictures/ folder and can be
|
# _background_ is a filename within the Graphics/Pictures/ folder and can be
|
||||||
# an animated image.
|
# an animated image.
|
||||||
# _viewport_ is a viewport to place the background in.
|
# _viewport_ is a viewport to place the background in.
|
||||||
def addBackgroundPlane(sprites,planename,background,viewport=nil)
|
def addBackgroundPlane(sprites,planename,background,viewport = nil)
|
||||||
sprites[planename]=AnimatedPlane.new(viewport)
|
sprites[planename]=AnimatedPlane.new(viewport)
|
||||||
bitmapName=pbResolveBitmap("Graphics/Pictures/#{background}")
|
bitmapName=pbResolveBitmap("Graphics/Pictures/#{background}")
|
||||||
if bitmapName==nil
|
if bitmapName==nil
|
||||||
@@ -736,7 +736,7 @@ end
|
|||||||
# an animated image.
|
# an animated image.
|
||||||
# _color_ is the color to use if the background can't be found.
|
# _color_ is the color to use if the background can't be found.
|
||||||
# _viewport_ is a viewport to place the background in.
|
# _viewport_ is a viewport to place the background in.
|
||||||
def addBackgroundOrColoredPlane(sprites,planename,background,color,viewport=nil)
|
def addBackgroundOrColoredPlane(sprites,planename,background,color,viewport = nil)
|
||||||
bitmapName=pbResolveBitmap("Graphics/Pictures/#{background}")
|
bitmapName=pbResolveBitmap("Graphics/Pictures/#{background}")
|
||||||
if bitmapName==nil
|
if bitmapName==nil
|
||||||
# Plane should exist in any case
|
# Plane should exist in any case
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class Window
|
|||||||
@_windowskin
|
@_windowskin
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(viewport=nil)
|
def initialize(viewport = nil)
|
||||||
@sprites={}
|
@sprites={}
|
||||||
@spritekeys=[
|
@spritekeys=[
|
||||||
"back",
|
"back",
|
||||||
@@ -345,7 +345,7 @@ class Window
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def privRefresh(changeBitmap=false)
|
def privRefresh(changeBitmap = false)
|
||||||
return if self.disposed?
|
return if self.disposed?
|
||||||
backopac=self.back_opacity*self.opacity/255
|
backopac=self.back_opacity*self.opacity/255
|
||||||
contopac=self.contents_opacity
|
contopac=self.contents_opacity
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class SpriteWindow < Window
|
|||||||
privRefresh(true)
|
privRefresh(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(viewport=nil)
|
def initialize(viewport = nil)
|
||||||
@sprites={}
|
@sprites={}
|
||||||
@spritekeys=[
|
@spritekeys=[
|
||||||
"back",
|
"back",
|
||||||
@@ -474,7 +474,7 @@ class SpriteWindow < Window
|
|||||||
@sprites["cursor"].opacity=cursoropac
|
@sprites["cursor"].opacity=cursoropac
|
||||||
end
|
end
|
||||||
|
|
||||||
def privRefresh(changeBitmap=false)
|
def privRefresh(changeBitmap = false)
|
||||||
return if !self || self.disposed?
|
return if !self || self.disposed?
|
||||||
backopac=self.back_opacity*self.opacity/255
|
backopac=self.back_opacity*self.opacity/255
|
||||||
contopac=self.contents_opacity
|
contopac=self.contents_opacity
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class Window_UnformattedTextPokemon < SpriteWindow_Base
|
|||||||
refresh
|
refresh
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(text="")
|
def initialize(text = "")
|
||||||
super(0,0,33,33)
|
super(0,0,33,33)
|
||||||
self.contents=Bitmap.new(1,1)
|
self.contents=Bitmap.new(1,1)
|
||||||
pbSetSystemFont(self.contents)
|
pbSetSystemFont(self.contents)
|
||||||
@@ -37,7 +37,7 @@ class Window_UnformattedTextPokemon < SpriteWindow_Base
|
|||||||
resizeToFit(text)
|
resizeToFit(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.newWithSize(text,x,y,width,height,viewport=nil)
|
def self.newWithSize(text,x,y,width,height,viewport = nil)
|
||||||
ret=self.new(text)
|
ret=self.new(text)
|
||||||
ret.x=x
|
ret.x=x
|
||||||
ret.y=y
|
ret.y=y
|
||||||
@@ -56,7 +56,7 @@ class Window_UnformattedTextPokemon < SpriteWindow_Base
|
|||||||
return dims
|
return dims
|
||||||
end
|
end
|
||||||
|
|
||||||
def setTextToFit(text,maxwidth=-1)
|
def setTextToFit(text,maxwidth = -1)
|
||||||
resizeToFit(text,maxwidth)
|
resizeToFit(text,maxwidth)
|
||||||
self.text=text
|
self.text=text
|
||||||
end
|
end
|
||||||
@@ -118,7 +118,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
|||||||
attr_accessor :letterbyletter
|
attr_accessor :letterbyletter
|
||||||
attr_reader :waitcount
|
attr_reader :waitcount
|
||||||
|
|
||||||
def initialize(text="")
|
def initialize(text = "")
|
||||||
@cursorMode = MessageConfig::CURSOR_POSITION
|
@cursorMode = MessageConfig::CURSOR_POSITION
|
||||||
@endOfText = nil
|
@endOfText = nil
|
||||||
@scrollstate = 0
|
@scrollstate = 0
|
||||||
@@ -148,7 +148,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
|||||||
@starting = false
|
@starting = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.newWithSize(text,x,y,width,height,viewport=nil)
|
def self.newWithSize(text,x,y,width,height,viewport = nil)
|
||||||
ret = self.new(text)
|
ret = self.new(text)
|
||||||
ret.x = x
|
ret.x = x
|
||||||
ret.y = y
|
ret.y = y
|
||||||
@@ -210,7 +210,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
|||||||
self.text = self.text if !@starting
|
self.text = self.text if !@starting
|
||||||
end
|
end
|
||||||
|
|
||||||
def resizeToFit(text,maxwidth=-1)
|
def resizeToFit(text,maxwidth = -1)
|
||||||
dims = resizeToFitInternal(text,maxwidth)
|
dims = resizeToFitInternal(text,maxwidth)
|
||||||
oldstarting = @starting
|
oldstarting = @starting
|
||||||
@starting = true
|
@starting = true
|
||||||
@@ -242,7 +242,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
|||||||
return dims
|
return dims
|
||||||
end
|
end
|
||||||
|
|
||||||
def resizeHeightToFit(text,width=-1)
|
def resizeHeightToFit(text,width = -1)
|
||||||
dims = resizeToFitInternal(text,width)
|
dims = resizeToFitInternal(text,width)
|
||||||
oldstarting = @starting
|
oldstarting = @starting
|
||||||
@starting = true
|
@starting = true
|
||||||
@@ -252,7 +252,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
|||||||
redrawText
|
redrawText
|
||||||
end
|
end
|
||||||
|
|
||||||
def setSkin(skin,redrawText=true)
|
def setSkin(skin,redrawText = true)
|
||||||
super(skin)
|
super(skin)
|
||||||
privRefresh(true)
|
privRefresh(true)
|
||||||
oldbaser = @baseColor.red
|
oldbaser = @baseColor.red
|
||||||
@@ -275,7 +275,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def setTextToFit(text,maxwidth=-1)
|
def setTextToFit(text,maxwidth = -1)
|
||||||
resizeToFit(text,maxwidth)
|
resizeToFit(text,maxwidth)
|
||||||
self.text = text
|
self.text = text
|
||||||
end
|
end
|
||||||
@@ -913,7 +913,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base
|
|||||||
return (self.height - self.borderY) / @row_height * @column_max
|
return (self.height - self.borderY) / @row_height * @column_max
|
||||||
end
|
end
|
||||||
|
|
||||||
def priv_update_cursor_rect(force=false)
|
def priv_update_cursor_rect(force = false)
|
||||||
if @index < 0
|
if @index < 0
|
||||||
self.cursor_rect.empty
|
self.cursor_rect.empty
|
||||||
self.refresh
|
self.refresh
|
||||||
@@ -1040,7 +1040,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
|
|||||||
attr_reader :baseColor
|
attr_reader :baseColor
|
||||||
attr_reader :shadowColor
|
attr_reader :shadowColor
|
||||||
|
|
||||||
def initialize(x,y,width,height,viewport=nil)
|
def initialize(x,y,width,height,viewport = nil)
|
||||||
super(x,y,width,height)
|
super(x,y,width,height)
|
||||||
self.viewport = viewport if viewport
|
self.viewport = viewport if viewport
|
||||||
if isDarkWindowskin(self.windowskin)
|
if isDarkWindowskin(self.windowskin)
|
||||||
@@ -1076,7 +1076,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
|
|||||||
return bitmap.text_size(text).width
|
return bitmap.text_size(text).width
|
||||||
end
|
end
|
||||||
|
|
||||||
def getAutoDims(commands,dims,width=nil)
|
def getAutoDims(commands,dims,width = nil)
|
||||||
rowMax = ((commands.length + self.columns - 1) / self.columns).to_i
|
rowMax = ((commands.length + self.columns - 1) / self.columns).to_i
|
||||||
windowheight = (rowMax*self.rowHeight)
|
windowheight = (rowMax*self.rowHeight)
|
||||||
windowheight += self.borderY
|
windowheight += self.borderY
|
||||||
@@ -1146,7 +1146,7 @@ end
|
|||||||
class Window_CommandPokemon < Window_DrawableCommand
|
class Window_CommandPokemon < Window_DrawableCommand
|
||||||
attr_reader :commands
|
attr_reader :commands
|
||||||
|
|
||||||
def initialize(commands,width=nil)
|
def initialize(commands,width = nil)
|
||||||
@starting=true
|
@starting=true
|
||||||
@commands=[]
|
@commands=[]
|
||||||
dims=[]
|
dims=[]
|
||||||
@@ -1163,7 +1163,7 @@ class Window_CommandPokemon < Window_DrawableCommand
|
|||||||
@starting=false
|
@starting=false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.newWithSize(commands,x,y,width,height,viewport=nil)
|
def self.newWithSize(commands,x,y,width,height,viewport = nil)
|
||||||
ret=self.new(commands,width)
|
ret=self.new(commands,width)
|
||||||
ret.x=x
|
ret.x=x
|
||||||
ret.y=y
|
ret.y=y
|
||||||
@@ -1173,7 +1173,7 @@ class Window_CommandPokemon < Window_DrawableCommand
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.newEmpty(x,y,width,height,viewport=nil)
|
def self.newEmpty(x,y,width,height,viewport = nil)
|
||||||
ret=self.new([],width)
|
ret=self.new([],width)
|
||||||
ret.x=x
|
ret.x=x
|
||||||
ret.y=y
|
ret.y=y
|
||||||
@@ -1211,7 +1211,7 @@ class Window_CommandPokemon < Window_DrawableCommand
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def resizeToFit(commands,width=nil)
|
def resizeToFit(commands,width = nil)
|
||||||
dims=[]
|
dims=[]
|
||||||
getAutoDims(commands,dims,width)
|
getAutoDims(commands,dims,width)
|
||||||
self.width=dims[0]
|
self.width=dims[0]
|
||||||
@@ -1258,7 +1258,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
return dims[1]-dims[0]
|
return dims[1]-dims[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(commands,width=nil)
|
def initialize(commands,width = nil)
|
||||||
@starting=true
|
@starting=true
|
||||||
@commands=[]
|
@commands=[]
|
||||||
dims=[]
|
dims=[]
|
||||||
@@ -1275,7 +1275,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
@starting=false
|
@starting=false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.newWithSize(commands,x,y,width,height,viewport=nil)
|
def self.newWithSize(commands,x,y,width,height,viewport = nil)
|
||||||
ret=self.new(commands,width)
|
ret=self.new(commands,width)
|
||||||
ret.x=x
|
ret.x=x
|
||||||
ret.y=y
|
ret.y=y
|
||||||
@@ -1285,7 +1285,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.newEmpty(x,y,width,height,viewport=nil)
|
def self.newEmpty(x,y,width,height,viewport = nil)
|
||||||
ret=self.new([],width)
|
ret=self.new([],width)
|
||||||
ret.x=x
|
ret.x=x
|
||||||
ret.y=y
|
ret.y=y
|
||||||
@@ -1325,7 +1325,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def resizeToFit(commands,width=nil)
|
def resizeToFit(commands,width = nil)
|
||||||
dims=[]
|
dims=[]
|
||||||
getAutoDims(commands,dims,width)
|
getAutoDims(commands,dims,width)
|
||||||
self.width=dims[0]
|
self.width=dims[0]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
class IconWindow < SpriteWindow_Base
|
class IconWindow < SpriteWindow_Base
|
||||||
attr_reader :name
|
attr_reader :name
|
||||||
|
|
||||||
def initialize(x,y,width,height,viewport=nil)
|
def initialize(x,y,width,height,viewport = nil)
|
||||||
super(x,y,width,height)
|
super(x,y,width,height)
|
||||||
self.viewport=viewport
|
self.viewport=viewport
|
||||||
self.contents=nil
|
self.contents=nil
|
||||||
@@ -37,7 +37,7 @@ class IconWindow < SpriteWindow_Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Sets the icon's filename.
|
# Sets the icon's filename.
|
||||||
def setBitmap(file,hue=0)
|
def setBitmap(file,hue = 0)
|
||||||
clearBitmaps()
|
clearBitmaps()
|
||||||
@name=file
|
@name=file
|
||||||
return if file==nil
|
return if file==nil
|
||||||
@@ -91,7 +91,7 @@ class PictureWindow < SpriteWindow_Base
|
|||||||
|
|
||||||
# Sets the icon's bitmap or filename. (hue parameter
|
# Sets the icon's bitmap or filename. (hue parameter
|
||||||
# is ignored unless pathOrBitmap is a filename)
|
# is ignored unless pathOrBitmap is a filename)
|
||||||
def setBitmap(pathOrBitmap,hue=0)
|
def setBitmap(pathOrBitmap,hue = 0)
|
||||||
clearBitmaps()
|
clearBitmaps()
|
||||||
if pathOrBitmap!=nil && pathOrBitmap!=""
|
if pathOrBitmap!=nil && pathOrBitmap!=""
|
||||||
if pathOrBitmap.is_a?(Bitmap)
|
if pathOrBitmap.is_a?(Bitmap)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# SpriteWrapper is a class which wraps (most of) Sprite's properties.
|
# SpriteWrapper is a class which wraps (most of) Sprite's properties.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class SpriteWrapper
|
class SpriteWrapper
|
||||||
def initialize(viewport=nil)
|
def initialize(viewport = nil)
|
||||||
@sprite = Sprite.new(viewport)
|
@sprite = Sprite.new(viewport)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ end
|
|||||||
# This bitmap can't be changed to a different one.
|
# This bitmap can't be changed to a different one.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class BitmapSprite < SpriteWrapper
|
class BitmapSprite < SpriteWrapper
|
||||||
def initialize(width,height,viewport=nil)
|
def initialize(width,height,viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
self.bitmap=Bitmap.new(width,height)
|
self.bitmap=Bitmap.new(width,height)
|
||||||
@initialized=true
|
@initialized=true
|
||||||
@@ -190,7 +190,7 @@ class AnimatedSprite < SpriteWrapper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create(animname,framecount,frameskip,viewport=nil)
|
def self.create(animname,framecount,frameskip,viewport = nil)
|
||||||
return self.new([animname,framecount,frameskip,viewport])
|
return self.new([animname,framecount,frameskip,viewport])
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ class IconSprite < SpriteWrapper
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Sets the icon's filename.
|
# Sets the icon's filename.
|
||||||
def setBitmap(file,hue=0)
|
def setBitmap(file,hue = 0)
|
||||||
oldrc=self.src_rect
|
oldrc=self.src_rect
|
||||||
clearBitmaps()
|
clearBitmaps()
|
||||||
@name=file
|
@name=file
|
||||||
@@ -326,7 +326,7 @@ end
|
|||||||
# SpriteWrapper that stores multiple bitmaps, and displays only one at once.
|
# SpriteWrapper that stores multiple bitmaps, and displays only one at once.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class ChangelingSprite < SpriteWrapper
|
class ChangelingSprite < SpriteWrapper
|
||||||
def initialize(x=0,y=0,viewport=nil)
|
def initialize(x = 0,y = 0,viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
|
|||||||
@@ -225,14 +225,14 @@ def pbGetTileBitmap(filename, tile_id, hue, width = 1, height = 1)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbGetTileset(name,hue=0)
|
def pbGetTileset(name,hue = 0)
|
||||||
return AnimatedBitmap.new("Graphics/Tilesets/" + name, hue).deanimate
|
return AnimatedBitmap.new("Graphics/Tilesets/" + name, hue).deanimate
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbGetAutotile(name,hue=0)
|
def pbGetAutotile(name,hue = 0)
|
||||||
return AnimatedBitmap.new("Graphics/Autotiles/" + name, hue).deanimate
|
return AnimatedBitmap.new("Graphics/Autotiles/" + name, hue).deanimate
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbGetAnimation(name,hue=0)
|
def pbGetAnimation(name,hue = 0)
|
||||||
return AnimatedBitmap.new("Graphics/Animations/" + name, hue).deanimate
|
return AnimatedBitmap.new("Graphics/Animations/" + name, hue).deanimate
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ def itemIconTag(item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def getFormattedTextForDims(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
def getFormattedTextForDims(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
||||||
newlineBreaks=true,explicitBreaksOnly=false)
|
newlineBreaks = true,explicitBreaksOnly = false)
|
||||||
text2=text.gsub(/<(\/?)(c|c2|c3|o|u|s)(\s*\=\s*([^>]*))?>/i,"")
|
text2=text.gsub(/<(\/?)(c|c2|c3|o|u|s)(\s*\=\s*([^>]*))?>/i,"")
|
||||||
if newlineBreaks
|
if newlineBreaks
|
||||||
text2.gsub!(/<(\/?)(br)(\s*\=\s*([^>]*))?>/i,"\n")
|
text2.gsub!(/<(\/?)(br)(\s*\=\s*([^>]*))?>/i,"\n")
|
||||||
@@ -169,7 +169,7 @@ def getFormattedTextForDims(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
|||||||
end
|
end
|
||||||
|
|
||||||
def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
||||||
newlineBreaks=true,explicitBreaksOnly=false)
|
newlineBreaks = true,explicitBreaksOnly = false)
|
||||||
x=y=0
|
x=y=0
|
||||||
characters=[]
|
characters=[]
|
||||||
textchunks=[]
|
textchunks=[]
|
||||||
@@ -385,9 +385,9 @@ To draw the characters, pass the returned array to the
|
|||||||
_drawFormattedChars_ function.
|
_drawFormattedChars_ function.
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight = 32,
|
||||||
newlineBreaks=true,explicitBreaksOnly=false,
|
newlineBreaks = true,explicitBreaksOnly = false,
|
||||||
collapseAlignments=false)
|
collapseAlignments = false)
|
||||||
dummybitmap=nil
|
dummybitmap=nil
|
||||||
if !bitmap || bitmap.disposed? # allows function to be called with nil bitmap
|
if !bitmap || bitmap.disposed? # allows function to be called with nil bitmap
|
||||||
dummybitmap=Bitmap.new(1,1)
|
dummybitmap=Bitmap.new(1,1)
|
||||||
@@ -908,7 +908,7 @@ def getLineBrokenText(bitmap,value,width,dims)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def getLineBrokenChunks(bitmap,value,width,dims,plain=false)
|
def getLineBrokenChunks(bitmap,value,width,dims,plain = false)
|
||||||
x=0
|
x=0
|
||||||
y=0
|
y=0
|
||||||
ret=[]
|
ret=[]
|
||||||
@@ -962,7 +962,7 @@ def getLineBrokenChunks(bitmap,value,width,dims,plain=false)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def renderLineBrokenChunks(bitmap,xDst,yDst,normtext,maxheight=0)
|
def renderLineBrokenChunks(bitmap,xDst,yDst,normtext,maxheight = 0)
|
||||||
for i in 0...normtext.length
|
for i in 0...normtext.length
|
||||||
width=normtext[i][3]
|
width=normtext[i][3]
|
||||||
textx=normtext[i][1]+xDst
|
textx=normtext[i][1]+xDst
|
||||||
@@ -1094,7 +1094,7 @@ def drawTextEx(bitmap,x,y,width,numlines,text,baseColor,shadowColor)
|
|||||||
baseColor,shadowColor)
|
baseColor,shadowColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
def drawFormattedTextEx(bitmap,x,y,width,text,baseColor=nil,shadowColor=nil,lineheight=32)
|
def drawFormattedTextEx(bitmap,x,y,width,text,baseColor = nil,shadowColor = nil,lineheight = 32)
|
||||||
base=!baseColor ? Color.new(12*8,12*8,12*8) : baseColor.clone
|
base=!baseColor ? Color.new(12*8,12*8,12*8) : baseColor.clone
|
||||||
shadow=!shadowColor ? Color.new(26*8,26*8,25*8) : shadowColor.clone
|
shadow=!shadowColor ? Color.new(26*8,26*8,25*8) : shadowColor.clone
|
||||||
text="<c2="+colorToRgb16(base)+colorToRgb16(shadow)+">"+text
|
text="<c2="+colorToRgb16(base)+colorToRgb16(shadow)+">"+text
|
||||||
@@ -1108,7 +1108,7 @@ def pbDrawShadow(bitmap,x,y,width,height,string)
|
|||||||
pbDrawShadowText(bitmap,x,y,width,height,string,nil,bitmap.font.color)
|
pbDrawShadowText(bitmap,x,y,width,height,string,nil,bitmap.font.color)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbDrawShadowText(bitmap,x,y,width,height,string,baseColor,shadowColor=nil,align=0)
|
def pbDrawShadowText(bitmap,x,y,width,height,string,baseColor,shadowColor = nil,align = 0)
|
||||||
return if !bitmap || !string
|
return if !bitmap || !string
|
||||||
width=(width<0) ? bitmap.text_size(string).width+1 : width
|
width=(width<0) ? bitmap.text_size(string).width+1 : width
|
||||||
height=(height<0) ? bitmap.text_size(string).height+1 : height
|
height=(height<0) ? bitmap.text_size(string).height+1 : height
|
||||||
@@ -1125,7 +1125,7 @@ def pbDrawShadowText(bitmap,x,y,width,height,string,baseColor,shadowColor=nil,al
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbDrawOutlineText(bitmap,x,y,width,height,string,baseColor,shadowColor=nil,align=0)
|
def pbDrawOutlineText(bitmap,x,y,width,height,string,baseColor,shadowColor = nil,align = 0)
|
||||||
return if !bitmap || !string
|
return if !bitmap || !string
|
||||||
width=(width<0) ? bitmap.text_size(string).width+4 : width
|
width=(width<0) ? bitmap.text_size(string).width+4 : width
|
||||||
height=(height<0) ? bitmap.text_size(string).height+4 : height
|
height=(height<0) ? bitmap.text_size(string).height+4 : height
|
||||||
@@ -1179,7 +1179,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Draw images on a bitmap
|
# Draw images on a bitmap
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbCopyBitmap(dstbm,srcbm,x,y,opacity=255)
|
def pbCopyBitmap(dstbm,srcbm,x,y,opacity = 255)
|
||||||
rc = Rect.new(0,0,srcbm.width,srcbm.height)
|
rc = Rect.new(0,0,srcbm.width,srcbm.height)
|
||||||
dstbm.blt(x,y,srcbm,rc,opacity)
|
dstbm.blt(x,y,srcbm,rc,opacity)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbCreateStatusWindow(viewport=nil)
|
def pbCreateStatusWindow(viewport = nil)
|
||||||
msgwindow=Window_AdvancedTextPokemon.new("")
|
msgwindow=Window_AdvancedTextPokemon.new("")
|
||||||
if !viewport
|
if !viewport
|
||||||
msgwindow.z=99999
|
msgwindow.z=99999
|
||||||
@@ -391,7 +391,7 @@ def pbCreateStatusWindow(viewport=nil)
|
|||||||
return msgwindow
|
return msgwindow
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCreateMessageWindow(viewport=nil,skin=nil)
|
def pbCreateMessageWindow(viewport = nil,skin = nil)
|
||||||
msgwindow=Window_AdvancedTextPokemon.new("")
|
msgwindow=Window_AdvancedTextPokemon.new("")
|
||||||
if !viewport
|
if !viewport
|
||||||
msgwindow.z=99999
|
msgwindow.z=99999
|
||||||
@@ -418,7 +418,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Main message-displaying function
|
# Main message-displaying function
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
|
def pbMessageDisplay(msgwindow,message,letterbyletter = true,commandProc = nil)
|
||||||
return if !msgwindow
|
return if !msgwindow
|
||||||
oldletterbyletter=msgwindow.letterbyletter
|
oldletterbyletter=msgwindow.letterbyletter
|
||||||
msgwindow.letterbyletter=(letterbyletter) ? true : false
|
msgwindow.letterbyletter=(letterbyletter) ? true : false
|
||||||
@@ -708,7 +708,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Message-displaying functions
|
# Message-displaying functions
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbMessage(message,commands=nil,cmdIfCancel=0,skin=nil,defaultCmd=0,&block)
|
def pbMessage(message,commands = nil,cmdIfCancel = 0,skin = nil,defaultCmd = 0,&block)
|
||||||
ret = 0
|
ret = 0
|
||||||
msgwindow = pbCreateMessageWindow(nil,skin)
|
msgwindow = pbCreateMessageWindow(nil,skin)
|
||||||
if commands
|
if commands
|
||||||
@@ -742,7 +742,7 @@ def pbMessageChooseNumber(message,params,&block)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowCommands(msgwindow,commands=nil,cmdIfCancel=0,defaultCmd=0)
|
def pbShowCommands(msgwindow,commands = nil,cmdIfCancel = 0,defaultCmd = 0)
|
||||||
return 0 if !commands
|
return 0 if !commands
|
||||||
cmdwindow=Window_CommandPokemonEx.new(commands)
|
cmdwindow=Window_CommandPokemonEx.new(commands)
|
||||||
cmdwindow.z=99999
|
cmdwindow.z=99999
|
||||||
@@ -778,7 +778,7 @@ def pbShowCommands(msgwindow,commands=nil,cmdIfCancel=0,defaultCmd=0)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowCommandsWithHelp(msgwindow,commands,help,cmdIfCancel=0,defaultCmd=0)
|
def pbShowCommandsWithHelp(msgwindow,commands,help,cmdIfCancel = 0,defaultCmd = 0)
|
||||||
msgwin=msgwindow
|
msgwin=msgwindow
|
||||||
msgwin=pbCreateMessageWindow(nil) if !msgwindow
|
msgwin=pbCreateMessageWindow(nil) if !msgwindow
|
||||||
oldlbl=msgwin.letterbyletter
|
oldlbl=msgwin.letterbyletter
|
||||||
@@ -828,7 +828,7 @@ def pbShowCommandsWithHelp(msgwindow,commands,help,cmdIfCancel=0,defaultCmd=0)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# frames is the number of 1/20 seconds to wait for
|
# frames is the number of 1/20 seconds to wait for
|
||||||
def pbMessageWaitForInput(msgwindow,frames,showPause=false)
|
def pbMessageWaitForInput(msgwindow,frames,showPause = false)
|
||||||
return if !frames || frames<=0
|
return if !frames || frames<=0
|
||||||
msgwindow.startPause if msgwindow && showPause
|
msgwindow.startPause if msgwindow && showPause
|
||||||
frames = frames*Graphics.frame_rate/20
|
frames = frames*Graphics.frame_rate/20
|
||||||
@@ -845,7 +845,7 @@ def pbMessageWaitForInput(msgwindow,frames,showPause=false)
|
|||||||
msgwindow.stopPause if msgwindow && showPause
|
msgwindow.stopPause if msgwindow && showPause
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFreeText(msgwindow,currenttext,passwordbox,maxlength,width=240)
|
def pbFreeText(msgwindow,currenttext,passwordbox,maxlength,width = 240)
|
||||||
window=Window_TextEntry_Keyboard.new(currenttext,0,0,width,64)
|
window=Window_TextEntry_Keyboard.new(currenttext,0,0,width,64)
|
||||||
ret=""
|
ret=""
|
||||||
window.maxlength=maxlength
|
window.maxlength=maxlength
|
||||||
@@ -875,7 +875,7 @@ def pbFreeText(msgwindow,currenttext,passwordbox,maxlength,width=240)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbMessageFreeText(message,currenttext,passwordbox,maxlength,width=240,&block)
|
def pbMessageFreeText(message,currenttext,passwordbox,maxlength,width = 240,&block)
|
||||||
msgwindow=pbCreateMessageWindow
|
msgwindow=pbCreateMessageWindow
|
||||||
retval=pbMessageDisplay(msgwindow,message,true,
|
retval=pbMessageDisplay(msgwindow,message,true,
|
||||||
proc { |msgwindow|
|
proc { |msgwindow|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ end
|
|||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Window_TextEntry < SpriteWindow_Base
|
class Window_TextEntry < SpriteWindow_Base
|
||||||
def initialize(text,x,y,width,height,heading=nil,usedarkercolor=false)
|
def initialize(text,x,y,width,height,heading = nil,usedarkercolor = false)
|
||||||
super(x,y,width,height)
|
super(x,y,width,height)
|
||||||
colors=getDefaultTextColors(self.windowskin)
|
colors=getDefaultTextColors(self.windowskin)
|
||||||
@baseColor=colors[0]
|
@baseColor=colors[0]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# Exit is not called when game is reset (using F12)
|
# Exit is not called when game is reset (using F12)
|
||||||
$AtExitProcs=[] if !$AtExitProcs
|
$AtExitProcs=[] if !$AtExitProcs
|
||||||
|
|
||||||
def exit(code=0)
|
def exit(code = 0)
|
||||||
for p in $AtExitProcs
|
for p in $AtExitProcs
|
||||||
p.call
|
p.call
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ end
|
|||||||
# filename:volume:pitch
|
# filename:volume:pitch
|
||||||
# volume -- Volume of the file, up to 100
|
# volume -- Volume of the file, up to 100
|
||||||
# pitch -- Pitch of the file, normally 100
|
# pitch -- Pitch of the file, normally 100
|
||||||
def pbResolveAudioFile(str,volume=nil,pitch=nil)
|
def pbResolveAudioFile(str,volume = nil,pitch = nil)
|
||||||
if str.is_a?(String)
|
if str.is_a?(String)
|
||||||
str = pbStringToAudioFile(str)
|
str = pbStringToAudioFile(str)
|
||||||
str.volume = volume || 100
|
str.volume = volume || 100
|
||||||
@@ -49,7 +49,7 @@ end
|
|||||||
# filename:volume:pitch
|
# filename:volume:pitch
|
||||||
# volume -- Volume of the file, up to 100
|
# volume -- Volume of the file, up to 100
|
||||||
# pitch -- Pitch of the file, normally 100
|
# pitch -- Pitch of the file, normally 100
|
||||||
def pbBGMPlay(param,volume=nil,pitch=nil)
|
def pbBGMPlay(param,volume = nil,pitch = nil)
|
||||||
return if !param
|
return if !param
|
||||||
param=pbResolveAudioFile(param,volume,pitch)
|
param=pbResolveAudioFile(param,volume,pitch)
|
||||||
if param.name && param.name!=""
|
if param.name && param.name!=""
|
||||||
@@ -68,10 +68,10 @@ def pbBGMPlay(param,volume=nil,pitch=nil)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
|
||||||
def pbBGMFade(x=0.0); pbBGMStop(x); end
|
def pbBGMFade(x = 0.0); pbBGMStop(x); end
|
||||||
|
|
||||||
# Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
|
||||||
def pbBGMStop(timeInSeconds=0.0)
|
def pbBGMStop(timeInSeconds = 0.0)
|
||||||
if $game_system && timeInSeconds > 0.0
|
if $game_system && timeInSeconds > 0.0
|
||||||
$game_system.bgm_fade(timeInSeconds)
|
$game_system.bgm_fade(timeInSeconds)
|
||||||
return
|
return
|
||||||
@@ -99,7 +99,7 @@ end
|
|||||||
# filename:volume:pitch
|
# filename:volume:pitch
|
||||||
# volume -- Volume of the file, up to 100
|
# volume -- Volume of the file, up to 100
|
||||||
# pitch -- Pitch of the file, normally 100
|
# pitch -- Pitch of the file, normally 100
|
||||||
def pbMEPlay(param,volume=nil,pitch=nil)
|
def pbMEPlay(param,volume = nil,pitch = nil)
|
||||||
return if !param
|
return if !param
|
||||||
param=pbResolveAudioFile(param,volume,pitch)
|
param=pbResolveAudioFile(param,volume,pitch)
|
||||||
if param.name && param.name!=""
|
if param.name && param.name!=""
|
||||||
@@ -118,10 +118,10 @@ def pbMEPlay(param,volume=nil,pitch=nil)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Fades out or stops ME playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops ME playback. 'x' is the time in seconds to fade out.
|
||||||
def pbMEFade(x=0.0); pbMEStop(x); end
|
def pbMEFade(x = 0.0); pbMEStop(x); end
|
||||||
|
|
||||||
# Fades out or stops ME playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops ME playback. 'x' is the time in seconds to fade out.
|
||||||
def pbMEStop(timeInSeconds=0.0)
|
def pbMEStop(timeInSeconds = 0.0)
|
||||||
if $game_system && timeInSeconds>0.0 && $game_system.respond_to?("me_fade")
|
if $game_system && timeInSeconds>0.0 && $game_system.respond_to?("me_fade")
|
||||||
$game_system.me_fade(timeInSeconds)
|
$game_system.me_fade(timeInSeconds)
|
||||||
return
|
return
|
||||||
@@ -149,7 +149,7 @@ end
|
|||||||
# filename:volume:pitch
|
# filename:volume:pitch
|
||||||
# volume -- Volume of the file, up to 100
|
# volume -- Volume of the file, up to 100
|
||||||
# pitch -- Pitch of the file, normally 100
|
# pitch -- Pitch of the file, normally 100
|
||||||
def pbBGSPlay(param,volume=nil,pitch=nil)
|
def pbBGSPlay(param,volume = nil,pitch = nil)
|
||||||
return if !param
|
return if !param
|
||||||
param=pbResolveAudioFile(param,volume,pitch)
|
param=pbResolveAudioFile(param,volume,pitch)
|
||||||
if param.name && param.name!=""
|
if param.name && param.name!=""
|
||||||
@@ -168,10 +168,10 @@ def pbBGSPlay(param,volume=nil,pitch=nil)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
|
||||||
def pbBGSFade(x=0.0); pbBGSStop(x); end
|
def pbBGSFade(x = 0.0); pbBGSStop(x); end
|
||||||
|
|
||||||
# Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
|
# Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
|
||||||
def pbBGSStop(timeInSeconds=0.0)
|
def pbBGSStop(timeInSeconds = 0.0)
|
||||||
if $game_system && timeInSeconds > 0.0
|
if $game_system && timeInSeconds > 0.0
|
||||||
$game_system.bgs_fade(timeInSeconds)
|
$game_system.bgs_fade(timeInSeconds)
|
||||||
return
|
return
|
||||||
@@ -199,7 +199,7 @@ end
|
|||||||
# filename:volume:pitch
|
# filename:volume:pitch
|
||||||
# volume -- Volume of the file, up to 100
|
# volume -- Volume of the file, up to 100
|
||||||
# pitch -- Pitch of the file, normally 100
|
# pitch -- Pitch of the file, normally 100
|
||||||
def pbSEPlay(param,volume=nil,pitch=nil)
|
def pbSEPlay(param,volume = nil,pitch = nil)
|
||||||
return if !param
|
return if !param
|
||||||
param = pbResolveAudioFile(param,volume,pitch)
|
param = pbResolveAudioFile(param,volume,pitch)
|
||||||
if param.name && param.name!=""
|
if param.name && param.name!=""
|
||||||
@@ -219,10 +219,10 @@ def pbSEPlay(param,volume=nil,pitch=nil)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Stops SE playback.
|
# Stops SE playback.
|
||||||
def pbSEFade(x=0.0); pbSEStop(x); end
|
def pbSEFade(x = 0.0); pbSEStop(x); end
|
||||||
|
|
||||||
# Stops SE playback.
|
# Stops SE playback.
|
||||||
def pbSEStop(_timeInSeconds=0.0)
|
def pbSEStop(_timeInSeconds = 0.0)
|
||||||
if $game_system
|
if $game_system
|
||||||
$game_system.se_stop
|
$game_system.se_stop
|
||||||
elsif (RPG.const_defined?(:SE) rescue false)
|
elsif (RPG.const_defined?(:SE) rescue false)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def pbTextBitmap(text, maxwidth=Graphics.width)
|
def pbTextBitmap(text, maxwidth = Graphics.width)
|
||||||
tmp = Bitmap.new(maxwidth,Graphics.height)
|
tmp = Bitmap.new(maxwidth,Graphics.height)
|
||||||
pbSetSystemFont(tmp)
|
pbSetSystemFont(tmp)
|
||||||
drawFormattedTextEx(tmp,0,0,maxwidth,text,Color.new(248,248,248),Color.new(168,184,184))
|
drawFormattedTextEx(tmp,0,0,maxwidth,text,Color.new(248,248,248),Color.new(168,184,184))
|
||||||
@@ -67,7 +67,7 @@ end
|
|||||||
class EventScene
|
class EventScene
|
||||||
attr_accessor :onCTrigger,:onBTrigger,:onUpdate
|
attr_accessor :onCTrigger,:onBTrigger,:onUpdate
|
||||||
|
|
||||||
def initialize(viewport=nil)
|
def initialize(viewport = nil)
|
||||||
@viewport = viewport
|
@viewport = viewport
|
||||||
@onCTrigger = Event.new
|
@onCTrigger = Event.new
|
||||||
@onBTrigger = Event.new
|
@onBTrigger = Event.new
|
||||||
@@ -140,7 +140,7 @@ class EventScene
|
|||||||
frames.times { update }
|
frames.times { update }
|
||||||
end
|
end
|
||||||
|
|
||||||
def pictureWait(extraframes=0)
|
def pictureWait(extraframes = 0)
|
||||||
loop do
|
loop do
|
||||||
hasRunning = false
|
hasRunning = false
|
||||||
for pic in @pictures
|
for pic in @pictures
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ class Battle
|
|||||||
|
|
||||||
# Returns the player's team in its display order. Used when showing the party
|
# Returns the player's team in its display order. Used when showing the party
|
||||||
# screen.
|
# screen.
|
||||||
def pbPlayerDisplayParty(idxBattler=0)
|
def pbPlayerDisplayParty(idxBattler = 0)
|
||||||
partyOrders = pbPartyOrder(idxBattler)
|
partyOrders = pbPartyOrder(idxBattler)
|
||||||
idxStart, _idxEnd = pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
idxStart, _idxEnd = pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||||
ret = []
|
ret = []
|
||||||
@@ -318,14 +318,14 @@ class Battle
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAbleCount(idxBattler=0)
|
def pbAbleCount(idxBattler = 0)
|
||||||
party = pbParty(idxBattler)
|
party = pbParty(idxBattler)
|
||||||
count = 0
|
count = 0
|
||||||
party.each { |pkmn| count += 1 if pkmn && pkmn.able? }
|
party.each { |pkmn| count += 1 if pkmn && pkmn.able? }
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAbleNonActiveCount(idxBattler=0)
|
def pbAbleNonActiveCount(idxBattler = 0)
|
||||||
party = pbParty(idxBattler)
|
party = pbParty(idxBattler)
|
||||||
inBattleIndices = allSameSideBattlers(idxBattler).map { |b| b.pokemonIndex }
|
inBattleIndices = allSameSideBattlers(idxBattler).map { |b| b.pokemonIndex }
|
||||||
count = 0
|
count = 0
|
||||||
@@ -337,7 +337,7 @@ class Battle
|
|||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAllFainted?(idxBattler=0)
|
def pbAllFainted?(idxBattler = 0)
|
||||||
return pbAbleCount(idxBattler)==0
|
return pbAbleCount(idxBattler)==0
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -442,7 +442,7 @@ class Battle
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Unused
|
# Unused
|
||||||
def eachSameSideBattler(idxBattler=0)
|
def eachSameSideBattler(idxBattler = 0)
|
||||||
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
||||||
@battlers.each { |b| yield b if b && !b.fainted? && !b.opposes?(idxBattler) }
|
@battlers.each { |b| yield b if b && !b.fainted? && !b.opposes?(idxBattler) }
|
||||||
end
|
end
|
||||||
@@ -453,7 +453,7 @@ class Battle
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Unused
|
# Unused
|
||||||
def eachOtherSideBattler(idxBattler=0)
|
def eachOtherSideBattler(idxBattler = 0)
|
||||||
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
||||||
@battlers.each { |b| yield b if b && !b.fainted? && b.opposes?(idxBattler) }
|
@battlers.each { |b| yield b if b && !b.fainted? && b.opposes?(idxBattler) }
|
||||||
end
|
end
|
||||||
@@ -463,11 +463,11 @@ class Battle
|
|||||||
return @battlers.select { |b| b && !b.fainted? && b.opposes?(idxBattler) }
|
return @battlers.select { |b| b && !b.fainted? && b.opposes?(idxBattler) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbSideBattlerCount(idxBattler=0)
|
def pbSideBattlerCount(idxBattler = 0)
|
||||||
return allSameSideBattlers(idxBattler).length
|
return allSameSideBattlers(idxBattler).length
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbOpposingBattlerCount(idxBattler=0)
|
def pbOpposingBattlerCount(idxBattler = 0)
|
||||||
return allOtherSideBattlers(idxBattler).length
|
return allOtherSideBattlers(idxBattler).length
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -481,7 +481,7 @@ class Battle
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCheckOpposingAbility(abil,idxBattler=0,nearOnly=false)
|
def pbCheckOpposingAbility(abil,idxBattler = 0,nearOnly = false)
|
||||||
allOtherSideBattlers(idxBattler).each do |b|
|
allOtherSideBattlers(idxBattler).each do |b|
|
||||||
next if nearOnly && !b.near?(idxBattler)
|
next if nearOnly && !b.near?(idxBattler)
|
||||||
return b if b.hasActiveAbility?(abil)
|
return b if b.hasActiveAbility?(abil)
|
||||||
@@ -536,7 +536,7 @@ class Battle
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Comparing the positions of two battlers
|
# Comparing the positions of two battlers
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def opposes?(idxBattler1,idxBattler2=0)
|
def opposes?(idxBattler1,idxBattler2 = 0)
|
||||||
idxBattler1 = idxBattler1.index if idxBattler1.respond_to?("index")
|
idxBattler1 = idxBattler1.index if idxBattler1.respond_to?("index")
|
||||||
idxBattler2 = idxBattler2.index if idxBattler2.respond_to?("index")
|
idxBattler2 = idxBattler2.index if idxBattler2.respond_to?("index")
|
||||||
return (idxBattler1&1)!=(idxBattler2&1)
|
return (idxBattler1&1)!=(idxBattler2&1)
|
||||||
@@ -631,7 +631,7 @@ class Battle
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Returns the battler representing the Pokémon at index idxParty in its party,
|
# Returns the battler representing the Pokémon at index idxParty in its party,
|
||||||
# on the same side as a battler with battler index of idxBattlerOther.
|
# on the same side as a battler with battler index of idxBattlerOther.
|
||||||
def pbFindBattler(idxParty,idxBattlerOther=0)
|
def pbFindBattler(idxParty,idxBattlerOther = 0)
|
||||||
allSameSideBattlers(idxBattlerOther).each { |b| return b if b.pokemonIndex==idxParty }
|
allSameSideBattlers(idxBattlerOther).each { |b| return b if b.pokemonIndex==idxParty }
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@@ -696,7 +696,7 @@ class Battle
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Used for causing weather by a move or by an ability.
|
# Used for causing weather by a move or by an ability.
|
||||||
def pbStartWeather(user,newWeather,fixedDuration=false,showAnim=true)
|
def pbStartWeather(user,newWeather,fixedDuration = false,showAnim = true)
|
||||||
return if @field.weather==newWeather
|
return if @field.weather==newWeather
|
||||||
@field.weather = newWeather
|
@field.weather = newWeather
|
||||||
duration = (fixedDuration) ? 5 : -1
|
duration = (fixedDuration) ? 5 : -1
|
||||||
@@ -774,7 +774,7 @@ class Battle
|
|||||||
@field.terrainDuration = -1
|
@field.terrainDuration = -1
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbStartTerrain(user,newTerrain,fixedDuration=true)
|
def pbStartTerrain(user,newTerrain,fixedDuration = true)
|
||||||
return if @field.terrain==newTerrain
|
return if @field.terrain==newTerrain
|
||||||
@field.terrain = newTerrain
|
@field.terrain = newTerrain
|
||||||
duration = (fixedDuration) ? 5 : -1
|
duration = (fixedDuration) ? 5 : -1
|
||||||
@@ -820,19 +820,19 @@ class Battle
|
|||||||
return @scene.pbDisplayConfirmMessage(msg)
|
return @scene.pbDisplayConfirmMessage(msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowCommands(msg,commands,canCancel=true)
|
def pbShowCommands(msg,commands,canCancel = true)
|
||||||
@scene.pbShowCommands(msg,commands,canCancel)
|
@scene.pbShowCommands(msg,commands,canCancel)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAnimation(move,user,targets,hitNum=0)
|
def pbAnimation(move,user,targets,hitNum = 0)
|
||||||
@scene.pbAnimation(move,user,targets,hitNum) if @showAnims
|
@scene.pbAnimation(move,user,targets,hitNum) if @showAnims
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCommonAnimation(name,user=nil,targets=nil)
|
def pbCommonAnimation(name,user = nil,targets = nil)
|
||||||
@scene.pbCommonAnimation(name,user,targets) if @showAnims
|
@scene.pbCommonAnimation(name,user,targets) if @showAnims
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAbilitySplash(battler,delay=false,logTrigger=true)
|
def pbShowAbilitySplash(battler,delay = false,logTrigger = true)
|
||||||
PBDebug.log("[Ability triggered] #{battler.pbThis}'s #{battler.abilityName}") if logTrigger
|
PBDebug.log("[Ability triggered] #{battler.pbThis}'s #{battler.abilityName}") if logTrigger
|
||||||
return if !Scene::USE_ABILITY_SPLASH
|
return if !Scene::USE_ABILITY_SPLASH
|
||||||
@scene.pbShowAbilitySplash(battler)
|
@scene.pbShowAbilitySplash(battler)
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ class Battle
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Judging
|
# Judging
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbJudgeCheckpoint(user,move=nil); end
|
def pbJudgeCheckpoint(user,move = nil); end
|
||||||
|
|
||||||
def pbDecisionOnTime
|
def pbDecisionOnTime
|
||||||
counts = [0,0]
|
counts = [0,0]
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class Battle
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbGainExpOne(idxParty,defeatedBattler,numPartic,expShare,expAll,showMessages=true)
|
def pbGainExpOne(idxParty,defeatedBattler,numPartic,expShare,expAll,showMessages = true)
|
||||||
pkmn = pbParty(0)[idxParty] # The Pokémon gaining Exp from defeatedBattler
|
pkmn = pbParty(0)[idxParty] # The Pokémon gaining Exp from defeatedBattler
|
||||||
growth_rate = pkmn.growth_rate
|
growth_rate = pkmn.growth_rate
|
||||||
# Don't bother calculating if gainer is already at max Exp
|
# Don't bother calculating if gainer is already at max Exp
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Battle
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Choosing a move/target
|
# Choosing a move/target
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbCanChooseMove?(idxBattler,idxMove,showMessages,sleepTalk=false)
|
def pbCanChooseMove?(idxBattler,idxMove,showMessages,sleepTalk = false)
|
||||||
battler = @battlers[idxBattler]
|
battler = @battlers[idxBattler]
|
||||||
move = battler.moves[idxMove]
|
move = battler.moves[idxMove]
|
||||||
return false unless move
|
return false unless move
|
||||||
@@ -17,7 +17,7 @@ class Battle
|
|||||||
return battler.pbCanChooseMove?(move,true,showMessages,sleepTalk)
|
return battler.pbCanChooseMove?(move,true,showMessages,sleepTalk)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCanChooseAnyMove?(idxBattler,sleepTalk=false)
|
def pbCanChooseAnyMove?(idxBattler,sleepTalk = false)
|
||||||
battler = @battlers[idxBattler]
|
battler = @battlers[idxBattler]
|
||||||
battler.eachMoveWithIndex do |m,i|
|
battler.eachMoveWithIndex do |m,i|
|
||||||
next if m.pp==0 && m.total_pp>0 && !sleepTalk
|
next if m.pp==0 && m.total_pp>0 && !sleepTalk
|
||||||
@@ -33,7 +33,7 @@ class Battle
|
|||||||
|
|
||||||
# Called when the Pokémon is Encored, or if it can't use any of its moves.
|
# Called when the Pokémon is Encored, or if it can't use any of its moves.
|
||||||
# Makes the Pokémon use the Encored move (if Encored), or Struggle.
|
# Makes the Pokémon use the Encored move (if Encored), or Struggle.
|
||||||
def pbAutoChooseMove(idxBattler,showMessages=true)
|
def pbAutoChooseMove(idxBattler,showMessages = true)
|
||||||
battler = @battlers[idxBattler]
|
battler = @battlers[idxBattler]
|
||||||
if battler.fainted?
|
if battler.fainted?
|
||||||
pbClearChoice(idxBattler)
|
pbClearChoice(idxBattler)
|
||||||
@@ -67,7 +67,7 @@ class Battle
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRegisterMove(idxBattler,idxMove,showMessages=true)
|
def pbRegisterMove(idxBattler,idxMove,showMessages = true)
|
||||||
battler = @battlers[idxBattler]
|
battler = @battlers[idxBattler]
|
||||||
move = battler.moves[idxMove]
|
move = battler.moves[idxMove]
|
||||||
return false if !pbCanChooseMove?(idxBattler,idxMove,showMessages)
|
return false if !pbCanChooseMove?(idxBattler,idxMove,showMessages)
|
||||||
@@ -133,7 +133,7 @@ class Battle
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Turn order calculation (priority)
|
# Turn order calculation (priority)
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbCalculatePriority(fullCalc=false,indexArray=nil)
|
def pbCalculatePriority(fullCalc = false,indexArray = nil)
|
||||||
needRearranging = false
|
needRearranging = false
|
||||||
if fullCalc
|
if fullCalc
|
||||||
@priorityTrickRoom = (@field.effects[PBEffects::TrickRoom]>0)
|
@priorityTrickRoom = (@field.effects[PBEffects::TrickRoom]>0)
|
||||||
@@ -231,7 +231,7 @@ class Battle
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbPriority(onlySpeedSort=false)
|
def pbPriority(onlySpeedSort = false)
|
||||||
ret = []
|
ret = []
|
||||||
if onlySpeedSort
|
if onlySpeedSort
|
||||||
# Sort battlers by their speed stats and tie-breaker order only.
|
# Sort battlers by their speed stats and tie-breaker order only.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Battle
|
|||||||
# battle.
|
# battle.
|
||||||
# NOTE: Messages are only shown while in the party screen when choosing a
|
# NOTE: Messages are only shown while in the party screen when choosing a
|
||||||
# command for the next round.
|
# command for the next round.
|
||||||
def pbCanSwitchLax?(idxBattler,idxParty,partyScene=nil)
|
def pbCanSwitchLax?(idxBattler,idxParty,partyScene = nil)
|
||||||
return true if idxParty<0
|
return true if idxParty<0
|
||||||
party = pbParty(idxBattler)
|
party = pbParty(idxBattler)
|
||||||
return false if idxParty>=party.length
|
return false if idxParty>=party.length
|
||||||
@@ -40,7 +40,7 @@ class Battle
|
|||||||
# switch out (and that its replacement at party index idxParty can switch in).
|
# switch out (and that its replacement at party index idxParty can switch in).
|
||||||
# NOTE: Messages are only shown while in the party screen when choosing a
|
# NOTE: Messages are only shown while in the party screen when choosing a
|
||||||
# command for the next round.
|
# command for the next round.
|
||||||
def pbCanSwitch?(idxBattler,idxParty=-1,partyScene=nil)
|
def pbCanSwitch?(idxBattler,idxParty = -1,partyScene = nil)
|
||||||
# Check whether party Pokémon can switch in
|
# Check whether party Pokémon can switch in
|
||||||
return false if !pbCanSwitchLax?(idxBattler,idxParty,partyScene)
|
return false if !pbCanSwitchLax?(idxBattler,idxParty,partyScene)
|
||||||
# Make sure another battler isn't already choosing to switch to the party
|
# Make sure another battler isn't already choosing to switch to the party
|
||||||
@@ -113,7 +113,7 @@ class Battle
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Open party screen and potentially choose a Pokémon to switch with. Used in
|
# Open party screen and potentially choose a Pokémon to switch with. Used in
|
||||||
# all instances where the party screen is opened.
|
# all instances where the party screen is opened.
|
||||||
def pbPartyScreen(idxBattler,checkLaxOnly=false,canCancel=false,shouldRegister=false)
|
def pbPartyScreen(idxBattler,checkLaxOnly = false,canCancel = false,shouldRegister = false)
|
||||||
ret = -1
|
ret = -1
|
||||||
@scene.pbPartyScreen(idxBattler,canCancel) { |idxParty,partyScene|
|
@scene.pbPartyScreen(idxBattler,canCancel) { |idxParty,partyScene|
|
||||||
if checkLaxOnly
|
if checkLaxOnly
|
||||||
@@ -132,7 +132,7 @@ class Battle
|
|||||||
|
|
||||||
# For choosing a replacement Pokémon when prompted in the middle of other
|
# For choosing a replacement Pokémon when prompted in the middle of other
|
||||||
# things happening (U-turn, Baton Pass, in def pbEORSwitch).
|
# things happening (U-turn, Baton Pass, in def pbEORSwitch).
|
||||||
def pbSwitchInBetween(idxBattler,checkLaxOnly=false,canCancel=false)
|
def pbSwitchInBetween(idxBattler,checkLaxOnly = false,canCancel = false)
|
||||||
return pbPartyScreen(idxBattler,checkLaxOnly,canCancel) if pbOwnedByPlayer?(idxBattler)
|
return pbPartyScreen(idxBattler,checkLaxOnly,canCancel) if pbOwnedByPlayer?(idxBattler)
|
||||||
return @battleAI.pbDefaultChooseNewEnemy(idxBattler,pbParty(idxBattler))
|
return @battleAI.pbDefaultChooseNewEnemy(idxBattler,pbParty(idxBattler))
|
||||||
end
|
end
|
||||||
@@ -142,7 +142,7 @@ class Battle
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# General switching method that checks if any Pokémon need to be sent out and,
|
# General switching method that checks if any Pokémon need to be sent out and,
|
||||||
# if so, does. Called at the end of each round.
|
# if so, does. Called at the end of each round.
|
||||||
def pbEORSwitch(favorDraws=false)
|
def pbEORSwitch(favorDraws = false)
|
||||||
return if @decision>0 && !favorDraws
|
return if @decision>0 && !favorDraws
|
||||||
return if @decision==5 && favorDraws
|
return if @decision==5 && favorDraws
|
||||||
pbJudge
|
pbJudge
|
||||||
@@ -206,7 +206,7 @@ class Battle
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbGetReplacementPokemonIndex(idxBattler,random=false)
|
def pbGetReplacementPokemonIndex(idxBattler,random = false)
|
||||||
if random
|
if random
|
||||||
choices = [] # Find all Pokémon that can switch in
|
choices = [] # Find all Pokémon that can switch in
|
||||||
eachInTeamFromBattlerIndex(idxBattler) do |_pkmn,i|
|
eachInTeamFromBattlerIndex(idxBattler) do |_pkmn,i|
|
||||||
@@ -220,7 +220,7 @@ class Battle
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Actually performs the recalling and sending out in all situations.
|
# Actually performs the recalling and sending out in all situations.
|
||||||
def pbRecallAndReplace(idxBattler,idxParty,randomReplacement=false,batonPass=false)
|
def pbRecallAndReplace(idxBattler,idxParty,randomReplacement = false,batonPass = false)
|
||||||
@scene.pbRecall(idxBattler) if !@battlers[idxBattler].fainted?
|
@scene.pbRecall(idxBattler) if !@battlers[idxBattler].fainted?
|
||||||
@battlers[idxBattler].pbAbilitiesOnSwitchOut # Inc. primordial weather check
|
@battlers[idxBattler].pbAbilitiesOnSwitchOut # Inc. primordial weather check
|
||||||
@scene.pbShowPartyLineup(idxBattler&1) if pbSideSize(idxBattler)==1
|
@scene.pbShowPartyLineup(idxBattler&1) if pbSideSize(idxBattler)==1
|
||||||
@@ -274,7 +274,7 @@ class Battle
|
|||||||
|
|
||||||
# Only called from def pbRecallAndReplace above and Battle Arena's def
|
# Only called from def pbRecallAndReplace above and Battle Arena's def
|
||||||
# pbSwitch.
|
# pbSwitch.
|
||||||
def pbReplace(idxBattler,idxParty,batonPass=false)
|
def pbReplace(idxBattler,idxParty,batonPass = false)
|
||||||
party = pbParty(idxBattler)
|
party = pbParty(idxBattler)
|
||||||
idxPartyOld = @battlers[idxBattler].pokemonIndex
|
idxPartyOld = @battlers[idxBattler].pokemonIndex
|
||||||
# Initialise the new Pokémon
|
# Initialise the new Pokémon
|
||||||
@@ -289,7 +289,7 @@ class Battle
|
|||||||
|
|
||||||
# Called from def pbReplace above and at the start of battle.
|
# Called from def pbReplace above and at the start of battle.
|
||||||
# sendOuts is an array; each element is itself an array: [idxBattler,pkmn]
|
# sendOuts is an array; each element is itself an array: [idxBattler,pkmn]
|
||||||
def pbSendOut(sendOuts,startBattle=false)
|
def pbSendOut(sendOuts,startBattle = false)
|
||||||
sendOuts.each { |b| @peer.pbOnEnteringBattle(self, @battlers[b[0]], b[1]) }
|
sendOuts.each { |b| @peer.pbOnEnteringBattle(self, @battlers[b[0]], b[1]) }
|
||||||
@scene.pbSendOutBattlers(sendOuts,startBattle)
|
@scene.pbSendOutBattlers(sendOuts,startBattle)
|
||||||
sendOuts.each do |b|
|
sendOuts.each do |b|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Battle
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Choosing to use an item
|
# Choosing to use an item
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages=true)
|
def pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages = true)
|
||||||
if !pkmn || pkmn.egg?
|
if !pkmn || pkmn.egg?
|
||||||
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
||||||
return false
|
return false
|
||||||
@@ -24,7 +24,7 @@ class Battle
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRegisterItem(idxBattler,item,idxTarget=nil,idxMove=nil)
|
def pbRegisterItem(idxBattler,item,idxTarget = nil,idxMove = nil)
|
||||||
# Register for use of item on a Pokémon in the party
|
# Register for use of item on a Pokémon in the party
|
||||||
@choices[idxBattler][0] = :UseItem
|
@choices[idxBattler][0] = :UseItem
|
||||||
@choices[idxBattler][1] = item # ID of item to be used
|
@choices[idxBattler][1] = item # ID of item to be used
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Battle
|
|||||||
# 1: Succeeded at fleeing, battle will end
|
# 1: Succeeded at fleeing, battle will end
|
||||||
# duringBattle is true for replacing a fainted Pokémon during the End Of Round
|
# duringBattle is true for replacing a fainted Pokémon during the End Of Round
|
||||||
# phase, and false for choosing the Run command.
|
# phase, and false for choosing the Run command.
|
||||||
def pbRun(idxBattler,duringBattle=false)
|
def pbRun(idxBattler,duringBattle = false)
|
||||||
battler = @battlers[idxBattler]
|
battler = @battlers[idxBattler]
|
||||||
if battler.opposes?
|
if battler.opposes?
|
||||||
return 0 if trainerBattle?
|
return 0 if trainerBattle?
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ class Battle::Battler
|
|||||||
return (itm) ? itm.name : ""
|
return (itm) ? itm.name : ""
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbThis(lowerCase=false)
|
def pbThis(lowerCase = false)
|
||||||
if opposes?
|
if opposes?
|
||||||
if @battle.trainerBattle?
|
if @battle.trainerBattle?
|
||||||
return lowerCase ? _INTL("the opposing {1}",name) : _INTL("The opposing {1}",name)
|
return lowerCase ? _INTL("the opposing {1}",name) : _INTL("The opposing {1}",name)
|
||||||
@@ -221,14 +221,14 @@ class Battle::Battler
|
|||||||
return name
|
return name
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbTeam(lowerCase=false)
|
def pbTeam(lowerCase = false)
|
||||||
if opposes?
|
if opposes?
|
||||||
return lowerCase ? _INTL("the opposing team") : _INTL("The opposing team")
|
return lowerCase ? _INTL("the opposing team") : _INTL("The opposing team")
|
||||||
end
|
end
|
||||||
return lowerCase ? _INTL("your team") : _INTL("Your team")
|
return lowerCase ? _INTL("your team") : _INTL("Your team")
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbOpposingTeam(lowerCase=false)
|
def pbOpposingTeam(lowerCase = false)
|
||||||
if opposes?
|
if opposes?
|
||||||
return lowerCase ? _INTL("your team") : _INTL("Your team")
|
return lowerCase ? _INTL("your team") : _INTL("Your team")
|
||||||
end
|
end
|
||||||
@@ -301,7 +301,7 @@ class Battle::Battler
|
|||||||
|
|
||||||
# Returns the active types of this Pokémon. The array should not include the
|
# Returns the active types of this Pokémon. The array should not include the
|
||||||
# same type more than once, and should not include any invalid types.
|
# same type more than once, and should not include any invalid types.
|
||||||
def pbTypes(withType3=false)
|
def pbTypes(withType3 = false)
|
||||||
ret = @types.uniq
|
ret = @types.uniq
|
||||||
# Burn Up erases the Fire-type.
|
# Burn Up erases the Fire-type.
|
||||||
ret.delete(:FIRE) if @effects[PBEffects::BurnUp]
|
ret.delete(:FIRE) if @effects[PBEffects::BurnUp]
|
||||||
@@ -413,7 +413,7 @@ class Battle::Battler
|
|||||||
return ability_blacklist.include?(abil.id)
|
return ability_blacklist.include?(abil.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def itemActive?(ignoreFainted=false)
|
def itemActive?(ignoreFainted = false)
|
||||||
return false if fainted? && !ignoreFainted
|
return false if fainted? && !ignoreFainted
|
||||||
return false if @effects[PBEffects::Embargo]>0
|
return false if @effects[PBEffects::Embargo]>0
|
||||||
return false if @battle.field.effects[PBEffects::MagicRoom]>0
|
return false if @battle.field.effects[PBEffects::MagicRoom]>0
|
||||||
@@ -509,7 +509,7 @@ class Battle::Battler
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def takesIndirectDamage?(showMsg=false)
|
def takesIndirectDamage?(showMsg = false)
|
||||||
return false if fainted?
|
return false if fainted?
|
||||||
if hasActiveAbility?(:MAGICGUARD)
|
if hasActiveAbility?(:MAGICGUARD)
|
||||||
if showMsg
|
if showMsg
|
||||||
@@ -558,7 +558,7 @@ class Battle::Battler
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def affectedByPowder?(showMsg=false)
|
def affectedByPowder?(showMsg = false)
|
||||||
return false if fainted?
|
return false if fainted?
|
||||||
if pbHasType?(:GRASS) && Settings::MORE_TYPE_EFFECTS
|
if pbHasType?(:GRASS) && Settings::MORE_TYPE_EFFECTS
|
||||||
@battle.pbDisplay(_INTL("{1} is unaffected!",pbThis)) if showMsg
|
@battle.pbDisplay(_INTL("{1} is unaffected!",pbThis)) if showMsg
|
||||||
@@ -593,7 +593,7 @@ class Battle::Battler
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def affectedByContactEffect?(showMsg=false)
|
def affectedByContactEffect?(showMsg = false)
|
||||||
return false if fainted?
|
return false if fainted?
|
||||||
if hasActiveItem?(:PROTECTIVEPADS)
|
if hasActiveItem?(:PROTECTIVEPADS)
|
||||||
@battle.pbDisplay(_INTL("{1} protected itself with the {2}!",pbThis,itemName)) if showMsg
|
@battle.pbDisplay(_INTL("{1} protected itself with the {2}!",pbThis,itemName)) if showMsg
|
||||||
@@ -687,7 +687,7 @@ class Battle::Battler
|
|||||||
# Methods relating to this battler's position on the battlefield
|
# Methods relating to this battler's position on the battlefield
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Returns whether the given position belongs to the opposing Pokémon's side.
|
# Returns whether the given position belongs to the opposing Pokémon's side.
|
||||||
def opposes?(i=0)
|
def opposes?(i = 0)
|
||||||
i = i.index if i.respond_to?("index")
|
i = i.index if i.respond_to?("index")
|
||||||
return (@index&1)!=(i&1)
|
return (@index&1)!=(i&1)
|
||||||
end
|
end
|
||||||
@@ -755,7 +755,7 @@ class Battle::Battler
|
|||||||
|
|
||||||
# Returns the battler that is most directly opposite to self. unfaintedOnly is
|
# Returns the battler that is most directly opposite to self. unfaintedOnly is
|
||||||
# whether it should prefer to return a non-fainted battler.
|
# whether it should prefer to return a non-fainted battler.
|
||||||
def pbDirectOpposing(unfaintedOnly=false)
|
def pbDirectOpposing(unfaintedOnly = false)
|
||||||
@battle.pbGetOpposingIndicesInOrder(@index).each do |i|
|
@battle.pbGetOpposingIndicesInOrder(@index).each do |i|
|
||||||
next if !@battle.battlers[i]
|
next if !@battle.battlers[i]
|
||||||
break if unfaintedOnly && @battle.battlers[i].fainted?
|
break if unfaintedOnly && @battle.battlers[i].fainted?
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class Battle::Battler
|
|||||||
@dummy = true
|
@dummy = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbInitialize(pkmn,idxParty,batonPass=false)
|
def pbInitialize(pkmn,idxParty,batonPass = false)
|
||||||
pbInitPokemon(pkmn,idxParty)
|
pbInitPokemon(pkmn,idxParty)
|
||||||
pbInitEffects(batonPass)
|
pbInitEffects(batonPass)
|
||||||
@damageState.reset
|
@damageState.reset
|
||||||
@@ -288,7 +288,7 @@ class Battle::Battler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Refreshing a battler's properties
|
# Refreshing a battler's properties
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbUpdate(fullChange=false)
|
def pbUpdate(fullChange = false)
|
||||||
return if !@pokemon
|
return if !@pokemon
|
||||||
@pokemon.calc_stats
|
@pokemon.calc_stats
|
||||||
@level = @pokemon.level
|
@level = @pokemon.level
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Battle::Battler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Change HP
|
# Change HP
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbReduceHP(amt,anim=true,registerDamage=true,anyAnim=true)
|
def pbReduceHP(amt,anim = true,registerDamage = true,anyAnim = true)
|
||||||
amt = amt.round
|
amt = amt.round
|
||||||
amt = @hp if amt>@hp
|
amt = @hp if amt>@hp
|
||||||
amt = 1 if amt<1 && !fainted?
|
amt = 1 if amt<1 && !fainted?
|
||||||
@@ -19,7 +19,7 @@ class Battle::Battler
|
|||||||
return amt
|
return amt
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRecoverHP(amt,anim=true,anyAnim=true)
|
def pbRecoverHP(amt,anim = true,anyAnim = true)
|
||||||
amt = amt.round
|
amt = amt.round
|
||||||
amt = @totalhp-@hp if amt>@totalhp-@hp
|
amt = @totalhp-@hp if amt>@totalhp-@hp
|
||||||
amt = 1 if amt<1 && @hp<@totalhp
|
amt = 1 if amt<1 && @hp<@totalhp
|
||||||
@@ -33,7 +33,7 @@ class Battle::Battler
|
|||||||
return amt
|
return amt
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRecoverHPFromDrain(amt,target,msg=nil)
|
def pbRecoverHPFromDrain(amt,target,msg = nil)
|
||||||
if target.hasActiveAbility?(:LIQUIDOOZE)
|
if target.hasActiveAbility?(:LIQUIDOOZE)
|
||||||
@battle.pbShowAbilitySplash(target)
|
@battle.pbShowAbilitySplash(target)
|
||||||
pbReduceHP(amt)
|
pbReduceHP(amt)
|
||||||
@@ -60,7 +60,7 @@ class Battle::Battler
|
|||||||
@droppedBelowHalfHP = false
|
@droppedBelowHalfHP = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFaint(showMessage=true)
|
def pbFaint(showMessage = true)
|
||||||
if !fainted?
|
if !fainted?
|
||||||
PBDebug.log("!!!***Can't faint with HP greater than 0")
|
PBDebug.log("!!!***Can't faint with HP greater than 0")
|
||||||
return
|
return
|
||||||
@@ -227,7 +227,7 @@ class Battle::Battler
|
|||||||
# Checks the Pokémon's form and updates it if necessary. Used for when a
|
# Checks the Pokémon's form and updates it if necessary. Used for when a
|
||||||
# Pokémon enters battle (endOfRound=false) and at the end of each round
|
# Pokémon enters battle (endOfRound=false) and at the end of each round
|
||||||
# (endOfRound=true).
|
# (endOfRound=true).
|
||||||
def pbCheckForm(endOfRound=false)
|
def pbCheckForm(endOfRound = false)
|
||||||
return if fainted? || @effects[PBEffects::Transform]
|
return if fainted? || @effects[PBEffects::Transform]
|
||||||
# Form changes upon entering battle and when the weather changes
|
# Form changes upon entering battle and when the weather changes
|
||||||
pbCheckFormOnWeatherChange if !endOfRound
|
pbCheckFormOnWeatherChange if !endOfRound
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Battle::Battler
|
|||||||
return @status != :NONE
|
return @status != :NONE
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCanInflictStatus?(newStatus,user,showMessages,move=nil,ignoreStatus=false)
|
def pbCanInflictStatus?(newStatus,user,showMessages,move = nil,ignoreStatus = false)
|
||||||
return false if fainted?
|
return false if fainted?
|
||||||
selfInflicted = (user && user.index==@index)
|
selfInflicted = (user && user.index==@index)
|
||||||
# Already have that status problem
|
# Already have that status problem
|
||||||
@@ -214,7 +214,7 @@ class Battle::Battler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Generalised infliction of status problem
|
# Generalised infliction of status problem
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbInflictStatus(newStatus,newStatusCount=0,msg=nil,user=nil)
|
def pbInflictStatus(newStatus,newStatusCount = 0,msg = nil,user = nil)
|
||||||
# Inflict the new status
|
# Inflict the new status
|
||||||
self.status = newStatus
|
self.status = newStatus
|
||||||
self.statusCount = newStatusCount
|
self.statusCount = newStatusCount
|
||||||
@@ -420,7 +420,7 @@ class Battle::Battler
|
|||||||
PBDebug.log("[Status continues] #{pbThis}'s sleep count is #{@statusCount}") if self.status == :SLEEP
|
PBDebug.log("[Status continues] #{pbThis}'s sleep count is #{@statusCount}") if self.status == :SLEEP
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCureStatus(showMessages=true)
|
def pbCureStatus(showMessages = true)
|
||||||
oldStatus = status
|
oldStatus = status
|
||||||
self.status = :NONE
|
self.status = :NONE
|
||||||
if showMessages
|
if showMessages
|
||||||
@@ -438,7 +438,7 @@ class Battle::Battler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Confusion
|
# Confusion
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbCanConfuse?(user=nil,showMessages=true,move=nil,selfInflicted=false)
|
def pbCanConfuse?(user = nil,showMessages = true,move = nil,selfInflicted = false)
|
||||||
return false if fainted?
|
return false if fainted?
|
||||||
if @effects[PBEffects::Confusion]>0
|
if @effects[PBEffects::Confusion]>0
|
||||||
@battle.pbDisplay(_INTL("{1} is already confused.",pbThis)) if showMessages
|
@battle.pbDisplay(_INTL("{1} is already confused.",pbThis)) if showMessages
|
||||||
@@ -480,7 +480,7 @@ class Battle::Battler
|
|||||||
return pbCanConfuse?(nil,showMessages,nil,true)
|
return pbCanConfuse?(nil,showMessages,nil,true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbConfuse(msg=nil)
|
def pbConfuse(msg = nil)
|
||||||
@effects[PBEffects::Confusion] = pbConfusionDuration
|
@effects[PBEffects::Confusion] = pbConfusionDuration
|
||||||
@battle.pbCommonAnimation("Confusion",self)
|
@battle.pbCommonAnimation("Confusion",self)
|
||||||
msg = _INTL("{1} became confused!",pbThis) if nil_or_empty?(msg)
|
msg = _INTL("{1} became confused!",pbThis) if nil_or_empty?(msg)
|
||||||
@@ -491,7 +491,7 @@ class Battle::Battler
|
|||||||
pbAbilityStatusCureCheck
|
pbAbilityStatusCureCheck
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbConfusionDuration(duration=-1)
|
def pbConfusionDuration(duration = -1)
|
||||||
duration = 2+@battle.pbRandom(4) if duration<=0
|
duration = 2+@battle.pbRandom(4) if duration<=0
|
||||||
return duration
|
return duration
|
||||||
end
|
end
|
||||||
@@ -503,7 +503,7 @@ class Battle::Battler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Attraction
|
# Attraction
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbCanAttract?(user,showMessages=true)
|
def pbCanAttract?(user,showMessages = true)
|
||||||
return false if fainted?
|
return false if fainted?
|
||||||
return false if !user || user.fainted?
|
return false if !user || user.fainted?
|
||||||
if @effects[PBEffects::Attract]>=0
|
if @effects[PBEffects::Attract]>=0
|
||||||
@@ -547,7 +547,7 @@ class Battle::Battler
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAttract(user,msg=nil)
|
def pbAttract(user,msg = nil)
|
||||||
@effects[PBEffects::Attract] = user.index
|
@effects[PBEffects::Attract] = user.index
|
||||||
@battle.pbCommonAnimation("Attract",self)
|
@battle.pbCommonAnimation("Attract",self)
|
||||||
msg = _INTL("{1} fell in love!",pbThis) if nil_or_empty?(msg)
|
msg = _INTL("{1} fell in love!",pbThis) if nil_or_empty?(msg)
|
||||||
@@ -568,7 +568,7 @@ class Battle::Battler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Flinching
|
# Flinching
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbFlinch(_user=nil)
|
def pbFlinch(_user = nil)
|
||||||
return if hasActiveAbility?(:INNERFOCUS) && !@battle.moldBreaker
|
return if hasActiveAbility?(:INNERFOCUS) && !@battle.moldBreaker
|
||||||
@effects[PBEffects::Flinch] = true
|
@effects[PBEffects::Flinch] = true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Battle::Battler
|
|||||||
return @stages[stat]>=6
|
return @stages[stat]>=6
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCanRaiseStatStage?(stat,user=nil,move=nil,showFailMsg=false,ignoreContrary=false)
|
def pbCanRaiseStatStage?(stat,user = nil,move = nil,showFailMsg = false,ignoreContrary = false)
|
||||||
return false if fainted?
|
return false if fainted?
|
||||||
# Contrary
|
# Contrary
|
||||||
if hasActiveAbility?(:CONTRARY) && !ignoreContrary && !@battle.moldBreaker
|
if hasActiveAbility?(:CONTRARY) && !ignoreContrary && !@battle.moldBreaker
|
||||||
@@ -21,7 +21,7 @@ class Battle::Battler
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRaiseStatStageBasic(stat,increment,ignoreContrary=false)
|
def pbRaiseStatStageBasic(stat,increment,ignoreContrary = false)
|
||||||
if !@battle.moldBreaker
|
if !@battle.moldBreaker
|
||||||
# Contrary
|
# Contrary
|
||||||
if hasActiveAbility?(:CONTRARY) && !ignoreContrary
|
if hasActiveAbility?(:CONTRARY) && !ignoreContrary
|
||||||
@@ -42,7 +42,7 @@ class Battle::Battler
|
|||||||
return increment
|
return increment
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRaiseStatStage(stat,increment,user,showAnim=true,ignoreContrary=false)
|
def pbRaiseStatStage(stat,increment,user,showAnim = true,ignoreContrary = false)
|
||||||
# Contrary
|
# Contrary
|
||||||
if hasActiveAbility?(:CONTRARY) && !ignoreContrary && !@battle.moldBreaker
|
if hasActiveAbility?(:CONTRARY) && !ignoreContrary && !@battle.moldBreaker
|
||||||
return pbLowerStatStage(stat,increment,user,showAnim,true)
|
return pbLowerStatStage(stat,increment,user,showAnim,true)
|
||||||
@@ -65,7 +65,7 @@ class Battle::Battler
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRaiseStatStageByCause(stat,increment,user,cause,showAnim=true,ignoreContrary=false)
|
def pbRaiseStatStageByCause(stat,increment,user,cause,showAnim = true,ignoreContrary = false)
|
||||||
# Contrary
|
# Contrary
|
||||||
if hasActiveAbility?(:CONTRARY) && !ignoreContrary && !@battle.moldBreaker
|
if hasActiveAbility?(:CONTRARY) && !ignoreContrary && !@battle.moldBreaker
|
||||||
return pbLowerStatStageByCause(stat,increment,user,cause,showAnim,true)
|
return pbLowerStatStageByCause(stat,increment,user,cause,showAnim,true)
|
||||||
@@ -96,7 +96,7 @@ class Battle::Battler
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRaiseStatStageByAbility(stat,increment,user,splashAnim=true)
|
def pbRaiseStatStageByAbility(stat,increment,user,splashAnim = true)
|
||||||
return false if fainted?
|
return false if fainted?
|
||||||
ret = false
|
ret = false
|
||||||
@battle.pbShowAbilitySplash(user) if splashAnim
|
@battle.pbShowAbilitySplash(user) if splashAnim
|
||||||
@@ -163,7 +163,7 @@ class Battle::Battler
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbLowerStatStageBasic(stat,increment,ignoreContrary=false)
|
def pbLowerStatStageBasic(stat,increment,ignoreContrary = false)
|
||||||
if !@battle.moldBreaker
|
if !@battle.moldBreaker
|
||||||
# Contrary
|
# Contrary
|
||||||
if hasActiveAbility?(:CONTRARY) && !ignoreContrary
|
if hasActiveAbility?(:CONTRARY) && !ignoreContrary
|
||||||
@@ -275,7 +275,7 @@ class Battle::Battler
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbLowerStatStageByAbility(stat,increment,user,splashAnim=true,checkContact=false)
|
def pbLowerStatStageByAbility(stat,increment,user,splashAnim = true,checkContact = false)
|
||||||
ret = false
|
ret = false
|
||||||
@battle.pbShowAbilitySplash(user) if splashAnim
|
@battle.pbShowAbilitySplash(user) if splashAnim
|
||||||
if pbCanLowerStatStage?(stat,user,nil,Battle::Scene::USE_ABILITY_SPLASH) &&
|
if pbCanLowerStatStage?(stat,user,nil,Battle::Scene::USE_ABILITY_SPLASH) &&
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class Battle::Battler
|
|||||||
|
|
||||||
# Called when a Pokémon (self) enters battle, at the end of each move used,
|
# Called when a Pokémon (self) enters battle, at the end of each move used,
|
||||||
# and at the end of each round.
|
# and at the end of each round.
|
||||||
def pbContinualAbilityChecks(onSwitchIn=false)
|
def pbContinualAbilityChecks(onSwitchIn = false)
|
||||||
# Check for end of primordial weather
|
# Check for end of primordial weather
|
||||||
@battle.pbEndPrimordialWeather
|
@battle.pbEndPrimordialWeather
|
||||||
# Trace
|
# Trace
|
||||||
@@ -227,7 +227,7 @@ class Battle::Battler
|
|||||||
self.item = nil
|
self.item = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbConsumeItem(recoverable=true,symbiosis=true,belch=true)
|
def pbConsumeItem(recoverable = true,symbiosis = true,belch = true)
|
||||||
PBDebug.log("[Item consumed] #{pbThis} consumed its held #{itemName}")
|
PBDebug.log("[Item consumed] #{pbThis} consumed its held #{itemName}")
|
||||||
if recoverable
|
if recoverable
|
||||||
setRecycleItem(@item_id)
|
setRecycleItem(@item_id)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Battle::Battler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Turn processing
|
# Turn processing
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbProcessTurn(choice,tryFlee=true)
|
def pbProcessTurn(choice,tryFlee = true)
|
||||||
return false if fainted?
|
return false if fainted?
|
||||||
# Wild roaming Pokémon always flee if possible
|
# Wild roaming Pokémon always flee if possible
|
||||||
if tryFlee && wild? &&
|
if tryFlee && wild? &&
|
||||||
@@ -144,7 +144,7 @@ class Battle::Battler
|
|||||||
# Simple "use move" method, used when a move calls another move and for Future
|
# Simple "use move" method, used when a move calls another move and for Future
|
||||||
# Sight's attack
|
# Sight's attack
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbUseMoveSimple(moveID,target=-1,idxMove=-1,specialUsage=true)
|
def pbUseMoveSimple(moveID,target = -1,idxMove = -1,specialUsage = true)
|
||||||
choice = []
|
choice = []
|
||||||
choice[0] = :UseMove # "Use move"
|
choice[0] = :UseMove # "Use move"
|
||||||
choice[1] = idxMove # Index of move to be used in user's moveset
|
choice[1] = idxMove # Index of move to be used in user's moveset
|
||||||
@@ -162,7 +162,7 @@ class Battle::Battler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Master "use move" method
|
# Master "use move" method
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbUseMove(choice,specialUsage=false)
|
def pbUseMove(choice,specialUsage = false)
|
||||||
# NOTE: This is intentionally determined before a multi-turn attack can
|
# NOTE: This is intentionally determined before a multi-turn attack can
|
||||||
# set specialUsage to true.
|
# set specialUsage to true.
|
||||||
skipAccuracyCheck = (specialUsage && choice[2]!=@battle.struggle)
|
skipAccuracyCheck = (specialUsage && choice[2]!=@battle.struggle)
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ class Battle::Battler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Register target
|
# Register target
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbAddTarget(targets,user,target,move,nearOnly=true,allowUser=false)
|
def pbAddTarget(targets,user,target,move,nearOnly = true,allowUser = false)
|
||||||
return false if !target || (target.fainted? && !move.targetsPosition?)
|
return false if !target || (target.fainted? && !move.targetsPosition?)
|
||||||
return false if !allowUser && target == user
|
return false if !allowUser && target == user
|
||||||
return false if nearOnly && !user.near?(target) && target != user
|
return false if nearOnly && !user.near?(target) && target != user
|
||||||
@@ -190,7 +190,7 @@ class Battle::Battler
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAddTargetRandomFoe(targets, user, move, nearOnly =true)
|
def pbAddTargetRandomFoe(targets, user, move, nearOnly = true)
|
||||||
choices = []
|
choices = []
|
||||||
user.allOpposing.each do |b|
|
user.allOpposing.each do |b|
|
||||||
next if nearOnly && !user.near?(b)
|
next if nearOnly && !user.near?(b)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class Battle::Battler
|
|||||||
# earlier in the same round (after choosing the command but before using the
|
# earlier in the same round (after choosing the command but before using the
|
||||||
# move) or an unusable move may be called by another move such as Metronome.
|
# move) or an unusable move may be called by another move such as Metronome.
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbCanChooseMove?(move,commandPhase,showMessages=true,specialUsage=false)
|
def pbCanChooseMove?(move,commandPhase,showMessages = true,specialUsage = false)
|
||||||
# Disable
|
# Disable
|
||||||
if @effects[PBEffects::DisableMove]==move.id && !specialUsage
|
if @effects[PBEffects::DisableMove]==move.id && !specialUsage
|
||||||
if showMessages
|
if showMessages
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class Battle::Move
|
|||||||
|
|
||||||
# NOTE: This method is only ever called while using a move (and also by the
|
# NOTE: This method is only ever called while using a move (and also by the
|
||||||
# AI), so using @calcType here is acceptable.
|
# AI), so using @calcType here is acceptable.
|
||||||
def physicalMove?(thisType=nil)
|
def physicalMove?(thisType = nil)
|
||||||
return (@category==0) if Settings::MOVE_CATEGORY_PER_MOVE
|
return (@category==0) if Settings::MOVE_CATEGORY_PER_MOVE
|
||||||
thisType ||= @calcType
|
thisType ||= @calcType
|
||||||
thisType ||= @type
|
thisType ||= @type
|
||||||
@@ -84,7 +84,7 @@ class Battle::Move
|
|||||||
|
|
||||||
# NOTE: This method is only ever called while using a move (and also by the
|
# NOTE: This method is only ever called while using a move (and also by the
|
||||||
# AI), so using @calcType here is acceptable.
|
# AI), so using @calcType here is acceptable.
|
||||||
def specialMove?(thisType=nil)
|
def specialMove?(thisType = nil)
|
||||||
return (@category==1) if Settings::MOVE_CATEGORY_PER_MOVE
|
return (@category==1) if Settings::MOVE_CATEGORY_PER_MOVE
|
||||||
thisType ||= @calcType
|
thisType ||= @calcType
|
||||||
thisType ||= @type
|
thisType ||= @type
|
||||||
@@ -134,7 +134,7 @@ class Battle::Move
|
|||||||
def danceMove?; return @flags.any? { |f| f[/^Dance$/i] }; end
|
def danceMove?; return @flags.any? { |f| f[/^Dance$/i] }; end
|
||||||
|
|
||||||
# Causes perfect accuracy (param=1) and double damage (param=2).
|
# Causes perfect accuracy (param=1) and double damage (param=2).
|
||||||
def tramplesMinimize?(_param=1); return false; end
|
def tramplesMinimize?(_param = 1); return false; end
|
||||||
def nonLethal?(_user,_target); return false; end # For False Swipe
|
def nonLethal?(_user,_target); return false; end # For False Swipe
|
||||||
|
|
||||||
def ignoresSubstitute?(user) # user is the Pokémon using this move
|
def ignoresSubstitute?(user) # user is the Pokémon using this move
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class Battle::Move
|
|||||||
def pbDesignateTargetsForHit(targets, hitNum); return targets; end # For Dragon Darts
|
def pbDesignateTargetsForHit(targets, hitNum); return targets; end # For Dragon Darts
|
||||||
def pbRepeatHit?; return false; end # For Dragon Darts
|
def pbRepeatHit?; return false; end # For Dragon Darts
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
return if !showAnimation
|
return if !showAnimation
|
||||||
if user.effects[PBEffects::ParentalBond]==1
|
if user.effects[PBEffects::ParentalBond]==1
|
||||||
@battle.pbCommonAnimation("ParentalBond",user,targets)
|
@battle.pbCommonAnimation("ParentalBond",user,targets)
|
||||||
@@ -122,7 +122,7 @@ class Battle::Move
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbMoveFailedAromaVeil?(user,target,showMessage=true)
|
def pbMoveFailedAromaVeil?(user,target,showMessage = true)
|
||||||
return false if @battle.moldBreaker
|
return false if @battle.moldBreaker
|
||||||
if target.hasActiveAbility?(:AROMAVEIL)
|
if target.hasActiveAbility?(:AROMAVEIL)
|
||||||
if showMessage
|
if showMessage
|
||||||
@@ -265,7 +265,7 @@ class Battle::Move
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Messages upon being hit
|
# Messages upon being hit
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbEffectivenessMessage(user,target,numTargets=1)
|
def pbEffectivenessMessage(user,target,numTargets = 1)
|
||||||
return if target.damageState.disguise || target.damageState.iceFace
|
return if target.damageState.disguise || target.damageState.iceFace
|
||||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||||
if numTargets>1
|
if numTargets>1
|
||||||
@@ -282,7 +282,7 @@ class Battle::Move
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbHitEffectivenessMessages(user,target,numTargets=1)
|
def pbHitEffectivenessMessages(user,target,numTargets = 1)
|
||||||
return if target.damageState.disguise || target.damageState.iceFace
|
return if target.damageState.disguise || target.damageState.iceFace
|
||||||
if target.damageState.substitute
|
if target.damageState.substitute
|
||||||
@battle.pbDisplay(_INTL("The substitute took damage for {1}!",target.pbThis(true)))
|
@battle.pbDisplay(_INTL("The substitute took damage for {1}!",target.pbThis(true)))
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ class Battle::Move
|
|||||||
return target.defense, target.stages[:DEFENSE]+6
|
return target.defense, target.stages[:DEFENSE]+6
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCalcDamage(user,target,numTargets=1)
|
def pbCalcDamage(user,target,numTargets = 1)
|
||||||
return if statusMove?
|
return if statusMove?
|
||||||
if target.damageState.disguise || target.damageState.iceFace
|
if target.damageState.disguise || target.damageState.iceFace
|
||||||
target.damageState.calcDamage = 1
|
target.damageState.calcDamage = 1
|
||||||
@@ -476,7 +476,7 @@ class Battle::Move
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Additional effect chance
|
# Additional effect chance
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbAdditionalEffectChance(user,target,effectChance=0)
|
def pbAdditionalEffectChance(user,target,effectChance = 0)
|
||||||
return 0 if target.hasActiveAbility?(:SHIELDDUST) && !@battle.moldBreaker
|
return 0 if target.hasActiveAbility?(:SHIELDDUST) && !@battle.moldBreaker
|
||||||
ret = (effectChance>0) ? effectChance : @addlEffect
|
ret = (effectChance>0) ? effectChance : @addlEffect
|
||||||
if Settings::MECHANICS_GENERATION >= 6 || @function != "EffectDependsOnEnvironment"
|
if Settings::MECHANICS_GENERATION >= 6 || @function != "EffectDependsOnEnvironment"
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ class Battle::Move::Confusion < Battle::Move
|
|||||||
@snatched = false
|
@snatched = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def physicalMove?(thisType=nil); return true; end
|
def physicalMove?(thisType = nil); return true; end
|
||||||
def specialMove?(thisType=nil); return false; end
|
def specialMove?(thisType = nil); return false; end
|
||||||
def pbCritialOverride(user,target); return -1; end
|
def pbCritialOverride(user,target); return -1; end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -70,8 +70,8 @@ class Battle::Move::Struggle < Battle::Move
|
|||||||
@snatched = false
|
@snatched = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def physicalMove?(thisType=nil); return true; end
|
def physicalMove?(thisType = nil); return true; end
|
||||||
def specialMove?(thisType=nil); return false; end
|
def specialMove?(thisType = nil); return false; end
|
||||||
|
|
||||||
def pbEffectAfterAllHits(user,target)
|
def pbEffectAfterAllHits(user,target)
|
||||||
return if target.damageState.unaffected
|
return if target.damageState.unaffected
|
||||||
@@ -279,7 +279,7 @@ end
|
|||||||
class Battle::Move::FixedDamageMove < Battle::Move
|
class Battle::Move::FixedDamageMove < Battle::Move
|
||||||
def pbFixedDamage(user,target); return 1; end
|
def pbFixedDamage(user,target); return 1; end
|
||||||
|
|
||||||
def pbCalcDamage(user,target,numTargets=1)
|
def pbCalcDamage(user,target,numTargets = 1)
|
||||||
target.damageState.critical = false
|
target.damageState.critical = false
|
||||||
target.damageState.calcDamage = pbFixedDamage(user,target)
|
target.damageState.calcDamage = pbFixedDamage(user,target)
|
||||||
target.damageState.calcDamage = 1 if target.damageState.calcDamage<1
|
target.damageState.calcDamage = 1 if target.damageState.calcDamage<1
|
||||||
@@ -367,7 +367,7 @@ class Battle::Move::TwoTurnMove < Battle::Move
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
hitNum = 1 if @chargingTurn && !@damagingTurn # Charging anim
|
hitNum = 1 if @chargingTurn && !@damagingTurn # Charging anim
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
@@ -601,7 +601,7 @@ class Battle::Move::PledgeMove < Battle::Move
|
|||||||
@battle.pbCommonAnimation(animName) if animName
|
@battle.pbCommonAnimation(animName) if animName
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
return if @pledgeSetup # No animation for setting up
|
return if @pledgeSetup # No animation for setting up
|
||||||
id = @overrideAnim if @overrideAnim
|
id = @overrideAnim if @overrideAnim
|
||||||
return super
|
return super
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ class Battle::Move::AttackTwoTurnsLater < Battle::Move
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
hitNum = 1 if !@battle.futureSight # Charging anim
|
hitNum = 1 if !@battle.futureSight # Charging anim
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1721,7 +1721,7 @@ end
|
|||||||
class Battle::Move::UserStealTargetPositiveStatStages < Battle::Move
|
class Battle::Move::UserStealTargetPositiveStatStages < Battle::Move
|
||||||
def ignoresSubstitute?(user); return true; end
|
def ignoresSubstitute?(user); return true; end
|
||||||
|
|
||||||
def pbCalcDamage(user,target,numTargets=1)
|
def pbCalcDamage(user,target,numTargets = 1)
|
||||||
if target.hasRaisedStatStages?
|
if target.hasRaisedStatStages?
|
||||||
pbShowAnimation(@id,user,target,1) # Stat stage-draining animation
|
pbShowAnimation(@id,user,target,1) # Stat stage-draining animation
|
||||||
@battle.pbDisplay(_INTL("{1} stole the target's boosted stats!",user.pbThis))
|
@battle.pbDisplay(_INTL("{1} stole the target's boosted stats!",user.pbThis))
|
||||||
@@ -1931,7 +1931,7 @@ class Battle::Move::StartSwapAllBattlersBaseDefensiveStats < Battle::Move
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
return if @battle.field.effects[PBEffects::WonderRoom]>0 # No animation
|
return if @battle.field.effects[PBEffects::WonderRoom]>0 # No animation
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ end
|
|||||||
# Minimized. (Body Slam (Gen 6+))
|
# Minimized. (Body Slam (Gen 6+))
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Battle::Move::ParalyzeTargetTrampleMinimize < Battle::Move::ParalyzeTarget
|
class Battle::Move::ParalyzeTargetTrampleMinimize < Battle::Move::ParalyzeTarget
|
||||||
def tramplesMinimize?(param=1)
|
def tramplesMinimize?(param = 1)
|
||||||
return true if param==1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
|
return true if param==1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
|
||||||
return true if param==2 # Double damage
|
return true if param==2 # Double damage
|
||||||
return super
|
return super
|
||||||
@@ -442,7 +442,7 @@ class Battle::Move::CureUserPartyStatus < Battle::Move
|
|||||||
return target.status == :NONE
|
return target.status == :NONE
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAromatherapyHeal(pkmn,battler=nil)
|
def pbAromatherapyHeal(pkmn,battler = nil)
|
||||||
oldStatus = (battler) ? battler.status : pkmn.status
|
oldStatus = (battler) ? battler.status : pkmn.status
|
||||||
curedName = (battler) ? battler.pbThis : pkmn.name
|
curedName = (battler) ? battler.pbThis : pkmn.name
|
||||||
if battler
|
if battler
|
||||||
@@ -488,7 +488,7 @@ class Battle::Move::CureUserPartyStatus < Battle::Move
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
super
|
super
|
||||||
if @id == :AROMATHERAPY
|
if @id == :AROMATHERAPY
|
||||||
@battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
|
@battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
|
||||||
@@ -552,7 +552,7 @@ end
|
|||||||
# the target is Minimized. (Dragon Rush (Gen 6+), Steamroller, Stomp)
|
# the target is Minimized. (Dragon Rush (Gen 6+), Steamroller, Stomp)
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Battle::Move::FlinchTargetTrampleMinimize < Battle::Move::FlinchTarget
|
class Battle::Move::FlinchTargetTrampleMinimize < Battle::Move::FlinchTarget
|
||||||
def tramplesMinimize?(param=1)
|
def tramplesMinimize?(param = 1)
|
||||||
return true if param==1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
|
return true if param==1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
|
||||||
return true if param==2 # Double damage
|
return true if param==2 # Double damage
|
||||||
return super
|
return super
|
||||||
@@ -1388,7 +1388,7 @@ class Battle::Move::TransformUserIntoTarget < Battle::Move
|
|||||||
user.pbTransform(target)
|
user.pbTransform(target)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
super
|
super
|
||||||
@battle.scene.pbChangePokemon(user,targets[0].pokemon)
|
@battle.scene.pbChangePokemon(user,targets[0].pokemon)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class Battle::Move::OHKO < Battle::Move::FixedDamageMove
|
|||||||
return target.totalhp
|
return target.totalhp
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbHitEffectivenessMessages(user,target,numTargets=1)
|
def pbHitEffectivenessMessages(user,target,numTargets = 1)
|
||||||
super
|
super
|
||||||
if target.fainted?
|
if target.fainted?
|
||||||
@battle.pbDisplay(_INTL("It's a one-hit KO!"))
|
@battle.pbDisplay(_INTL("It's a one-hit KO!"))
|
||||||
@@ -310,7 +310,7 @@ end
|
|||||||
# Does double damage and has perfect accuracy if the target is Minimized.
|
# Does double damage and has perfect accuracy if the target is Minimized.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Battle::Move::PowerHigherWithUserHeavierThanTarget < Battle::Move
|
class Battle::Move::PowerHigherWithUserHeavierThanTarget < Battle::Move
|
||||||
def tramplesMinimize?(param=1)
|
def tramplesMinimize?(param = 1)
|
||||||
return true if Settings::MECHANICS_GENERATION >= 7 # Perfect accuracy and double damage
|
return true if Settings::MECHANICS_GENERATION >= 7 # Perfect accuracy and double damage
|
||||||
return super
|
return super
|
||||||
end
|
end
|
||||||
@@ -850,7 +850,7 @@ class Battle::Move::RemoveScreens < Battle::Move
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
if user.pbOpposingSide.effects[PBEffects::LightScreen]>0 ||
|
if user.pbOpposingSide.effects[PBEffects::LightScreen]>0 ||
|
||||||
user.pbOpposingSide.effects[PBEffects::Reflect]>0 ||
|
user.pbOpposingSide.effects[PBEffects::Reflect]>0 ||
|
||||||
user.pbOpposingSide.effects[PBEffects::AuroraVeil]>0
|
user.pbOpposingSide.effects[PBEffects::AuroraVeil]>0
|
||||||
@@ -1121,7 +1121,7 @@ end
|
|||||||
# Minimized. (Flying Press)
|
# Minimized. (Flying Press)
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Battle::Move::EffectivenessIncludesFlyingType < Battle::Move
|
class Battle::Move::EffectivenessIncludesFlyingType < Battle::Move
|
||||||
def tramplesMinimize?(param=1)
|
def tramplesMinimize?(param = 1)
|
||||||
return true if param==1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
|
return true if param==1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
|
||||||
return true if param==2 # Double damage
|
return true if param==2 # Double damage
|
||||||
return super
|
return super
|
||||||
@@ -1195,8 +1195,8 @@ class Battle::Move::CategoryDependsOnHigherDamageIgnoreTargetAbility < Battle::M
|
|||||||
@calcCategory = 1
|
@calcCategory = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
def physicalMove?(thisType=nil); return (@calcCategory==0); end
|
def physicalMove?(thisType = nil); return (@calcCategory==0); end
|
||||||
def specialMove?(thisType=nil); return (@calcCategory==1); end
|
def specialMove?(thisType = nil); return (@calcCategory==1); end
|
||||||
|
|
||||||
def pbOnStartUse(user,targets)
|
def pbOnStartUse(user,targets)
|
||||||
# Calculate user's effective attacking value
|
# Calculate user's effective attacking value
|
||||||
@@ -1568,7 +1568,7 @@ class Battle::Move::TypeDependsOnUserDrive < Battle::Move
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
t = pbBaseType(user)
|
t = pbBaseType(user)
|
||||||
hitNum = 0
|
hitNum = 0
|
||||||
hitNum = 1 if t == :ELECTRIC
|
hitNum = 1 if t == :ELECTRIC
|
||||||
@@ -1623,7 +1623,7 @@ class Battle::Move::TypeAndPowerDependOnWeather < Battle::Move
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
t = pbBaseType(user)
|
t = pbBaseType(user)
|
||||||
hitNum = 1 if t == :FIRE # Type-specific anims
|
hitNum = 1 if t == :FIRE # Type-specific anims
|
||||||
hitNum = 2 if t == :WATER
|
hitNum = 2 if t == :WATER
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Battle::Move::HitTwoTimesFlinchTarget < Battle::Move::FlinchTarget
|
class Battle::Move::HitTwoTimesFlinchTarget < Battle::Move::FlinchTarget
|
||||||
def multiHitMove?; return true; end
|
def multiHitMove?; return true; end
|
||||||
def pbNumHits(user,targets); return 2; end
|
def pbNumHits(user, targets); return 2; end
|
||||||
def tramplesMinimize?(param=1); return Settings::MECHANICS_GENERATION <= 7; end
|
def tramplesMinimize?(param = 1); return Settings::MECHANICS_GENERATION <= 7; end
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
@@ -615,7 +615,7 @@ class Battle::Move::MultiTurnAttackBideThenReturnDoubleDamage < Battle::Move::Fi
|
|||||||
user.effects[PBEffects::Bide] -= 1
|
user.effects[PBEffects::Bide] -= 1
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
hitNum = 1 if !@damagingTurn # Charging anim
|
hitNum = 1 if !@damagingTurn # Charging anim
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -649,7 +649,7 @@ class Battle::Move::StartPerishCountsForAllBattlers < Battle::Move
|
|||||||
target.effects[PBEffects::PerishSongUser] = user.index
|
target.effects[PBEffects::PerishSongUser] = user.index
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
super
|
super
|
||||||
@battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
|
@battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ class Battle::Move::StartNegateHeldItems < Battle::Move
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
return if @battle.field.effects[PBEffects::MagicRoom]>0 # No animation
|
return if @battle.field.effects[PBEffects::MagicRoom]>0 # No animation
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class Battle::Move::RandomlyDamageOrHealTarget < Battle::Move
|
|||||||
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
|
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
hitNum = 1 if @presentDmg==0 # Healing anim
|
hitNum = 1 if @presentDmg==0 # Healing anim
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
@@ -125,7 +125,7 @@ class Battle::Move::HealAllyOrDamageFoe < Battle::Move
|
|||||||
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
|
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
hitNum = 1 if @healing # Healing anim
|
hitNum = 1 if @healing # Healing anim
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
@@ -193,7 +193,7 @@ class Battle::Move::CurseTargetOrLowerUserSpd1RaiseUserAtkDef1 < Battle::Move
|
|||||||
user.pbItemHPHealCheck
|
user.pbItemHPHealCheck
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
hitNum = 1 if !user.pbHasType?(:GHOST) # Non-Ghost anim
|
hitNum = 1 if !user.pbHasType?(:GHOST) # Non-Ghost anim
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
@@ -288,7 +288,7 @@ class Battle::Move::EffectDependsOnEnvironment < Battle::Move
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
id = :BODYSLAM # Environment-specific anim
|
id = :BODYSLAM # Environment-specific anim
|
||||||
case @secretPower
|
case @secretPower
|
||||||
when 1 then id = :THUNDERSHOCK if GameData::Move.exists?(:THUNDERSHOCK)
|
when 1 then id = :THUNDERSHOCK if GameData::Move.exists?(:THUNDERSHOCK)
|
||||||
@@ -371,7 +371,7 @@ class Battle::Move::DoublePowerAfterFusionFlare < Battle::Move
|
|||||||
@battle.field.effects[PBEffects::FusionBolt] = true
|
@battle.field.effects[PBEffects::FusionBolt] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
hitNum = 1 if (targets.length>0 && targets[0].damageState.critical) ||
|
hitNum = 1 if (targets.length>0 && targets[0].damageState.critical) ||
|
||||||
@doublePower # Charged anim
|
@doublePower # Charged anim
|
||||||
super
|
super
|
||||||
@@ -396,7 +396,7 @@ class Battle::Move::DoublePowerAfterFusionBolt < Battle::Move
|
|||||||
@battle.field.effects[PBEffects::FusionFlare] = true
|
@battle.field.effects[PBEffects::FusionFlare] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
hitNum = 1 if (targets.length>0 && targets[0].damageState.critical) ||
|
hitNum = 1 if (targets.length>0 && targets[0].damageState.critical) ||
|
||||||
@doublePower # Charged anim
|
@doublePower # Charged anim
|
||||||
super
|
super
|
||||||
@@ -777,7 +777,7 @@ class Battle::Move::UseLastMoveUsedByTarget < Battle::Move
|
|||||||
user.pbUseMoveSimple(target.lastRegularMoveUsed,target.index)
|
user.pbUseMoveSimple(target.lastRegularMoveUsed,target.index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
# No animation
|
# No animation
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ class Battle::Move::StartSlowerBattlersActFirst < Battle::Move
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
|
||||||
return if @battle.field.effects[PBEffects::TrickRoom]>0 # No animation
|
return if @battle.field.effects[PBEffects::TrickRoom]>0 # No animation
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class Battle::Scene
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Updating and refreshing
|
# Updating and refreshing
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbUpdate(cw=nil)
|
def pbUpdate(cw = nil)
|
||||||
pbGraphicsUpdate
|
pbGraphicsUpdate
|
||||||
pbInputUpdate
|
pbInputUpdate
|
||||||
pbFrameUpdate(cw)
|
pbFrameUpdate(cw)
|
||||||
@@ -111,7 +111,7 @@ class Battle::Scene
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFrameUpdate(cw=nil)
|
def pbFrameUpdate(cw = nil)
|
||||||
cw.update if cw
|
cw.update if cw
|
||||||
@battle.battlers.each_with_index do |b,i|
|
@battle.battlers.each_with_index do |b,i|
|
||||||
next if !b
|
next if !b
|
||||||
@@ -185,7 +185,7 @@ class Battle::Scene
|
|||||||
|
|
||||||
# NOTE: A regular message is displayed for 1 second after it fully appears (or
|
# NOTE: A regular message is displayed for 1 second after it fully appears (or
|
||||||
# less if Back/Use is pressed). Disappears automatically after that time.
|
# less if Back/Use is pressed). Disappears automatically after that time.
|
||||||
def pbDisplayMessage(msg,brief=false)
|
def pbDisplayMessage(msg,brief = false)
|
||||||
pbWaitMessage
|
pbWaitMessage
|
||||||
pbShowWindow(MESSAGE_BOX)
|
pbShowWindow(MESSAGE_BOX)
|
||||||
cw = @sprites["messageWindow"]
|
cw = @sprites["messageWindow"]
|
||||||
@@ -379,7 +379,7 @@ class Battle::Scene
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
#
|
#
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbSelectBattler(idxBattler,selectMode=1)
|
def pbSelectBattler(idxBattler,selectMode = 1)
|
||||||
numWindows = @battle.sideSizes.max*2
|
numWindows = @battle.sideSizes.max*2
|
||||||
for i in 0...numWindows
|
for i in 0...numWindows
|
||||||
sel = (idxBattler.is_a?(Array)) ? !idxBattler[i].nil? : i==idxBattler
|
sel = (idxBattler.is_a?(Array)) ? !idxBattler[i].nil? : i==idxBattler
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class Battle::Scene
|
|||||||
cmdBarBG.z = 180
|
cmdBarBG.z = 180
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCreateTrainerBackSprite(idxTrainer,trainerType,numTrainers=1)
|
def pbCreateTrainerBackSprite(idxTrainer,trainerType,numTrainers = 1)
|
||||||
if idxTrainer==0 # Player's sprite
|
if idxTrainer==0 # Player's sprite
|
||||||
trainerFile = GameData::TrainerType.player_back_sprite_filename(trainerType)
|
trainerFile = GameData::TrainerType.player_back_sprite_filename(trainerType)
|
||||||
else # Partner trainer's sprite
|
else # Partner trainer's sprite
|
||||||
@@ -169,7 +169,7 @@ class Battle::Scene
|
|||||||
trainer.oy = trainer.bitmap.height
|
trainer.oy = trainer.bitmap.height
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCreateTrainerFrontSprite(idxTrainer,trainerType,numTrainers=1)
|
def pbCreateTrainerFrontSprite(idxTrainer,trainerType,numTrainers = 1)
|
||||||
trainerFile = GameData::TrainerType.front_sprite_filename(trainerType)
|
trainerFile = GameData::TrainerType.front_sprite_filename(trainerType)
|
||||||
spriteX, spriteY = Battle::Scene.pbTrainerPosition(1,idxTrainer,numTrainers)
|
spriteX, spriteY = Battle::Scene.pbTrainerPosition(1,idxTrainer,numTrainers)
|
||||||
trainer = pbAddSprite("trainer_#{idxTrainer+1}",spriteX,spriteY,trainerFile,@viewport)
|
trainer = pbAddSprite("trainer_#{idxTrainer+1}",spriteX,spriteY,trainerFile,@viewport)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class Battle::Scene
|
|||||||
# 2 = regular battle with "Call" (for Shadow Pokémon battles)
|
# 2 = regular battle with "Call" (for Shadow Pokémon battles)
|
||||||
# 3 = Safari Zone
|
# 3 = Safari Zone
|
||||||
# 4 = Bug Catching Contest
|
# 4 = Bug Catching Contest
|
||||||
def pbCommandMenuEx(idxBattler,texts,mode=0)
|
def pbCommandMenuEx(idxBattler,texts,mode = 0)
|
||||||
pbShowWindow(COMMAND_BOX)
|
pbShowWindow(COMMAND_BOX)
|
||||||
cw = @sprites["commandWindow"]
|
cw = @sprites["commandWindow"]
|
||||||
cw.setTexts(texts)
|
cw.setTexts(texts)
|
||||||
@@ -65,7 +65,7 @@ class Battle::Scene
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# The player chooses a move for a Pokémon to use
|
# The player chooses a move for a Pokémon to use
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbFightMenu(idxBattler,megaEvoPossible=false)
|
def pbFightMenu(idxBattler,megaEvoPossible = false)
|
||||||
battler = @battle.battlers[idxBattler]
|
battler = @battle.battlers[idxBattler]
|
||||||
cw = @sprites["fightWindow"]
|
cw = @sprites["fightWindow"]
|
||||||
cw.battler = battler
|
cw.battler = battler
|
||||||
@@ -140,7 +140,7 @@ class Battle::Scene
|
|||||||
# Opens the party screen to choose a Pokémon to switch in (or just view its
|
# Opens the party screen to choose a Pokémon to switch in (or just view its
|
||||||
# summary screens)
|
# summary screens)
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbPartyScreen(idxBattler,canCancel=false)
|
def pbPartyScreen(idxBattler,canCancel = false)
|
||||||
# Fade out and hide all sprites
|
# Fade out and hide all sprites
|
||||||
visibleSprites = pbFadeOutAndHide(@sprites)
|
visibleSprites = pbFadeOutAndHide(@sprites)
|
||||||
# Get player's party
|
# Get player's party
|
||||||
@@ -373,7 +373,7 @@ class Battle::Scene
|
|||||||
return idxBattler # Target the user initially
|
return idxBattler # Target the user initially
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChooseTarget(idxBattler,target_data,visibleSprites=nil)
|
def pbChooseTarget(idxBattler,target_data,visibleSprites = nil)
|
||||||
pbShowWindow(TARGET_BOX)
|
pbShowWindow(TARGET_BOX)
|
||||||
cw = @sprites["targetWindow"]
|
cw = @sprites["targetWindow"]
|
||||||
# Create an array of battler names (only valid targets are named)
|
# Create an array of battler names (only valid targets are named)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class Battle::Scene
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Animates a party lineup appearing for the given side
|
# Animates a party lineup appearing for the given side
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbShowPartyLineup(side,fullAnim=false)
|
def pbShowPartyLineup(side,fullAnim = false)
|
||||||
@animations.push(Animation::LineupAppear.new(@sprites,@viewport,
|
@animations.push(Animation::LineupAppear.new(@sprites,@viewport,
|
||||||
side,@battle.pbParty(side),@battle.pbPartyStarts(side),fullAnim))
|
side,@battle.pbParty(side),@battle.pbPartyStarts(side),fullAnim))
|
||||||
if !fullAnim
|
if !fullAnim
|
||||||
@@ -88,7 +88,7 @@ class Battle::Scene
|
|||||||
# animation for it if relevant.
|
# animation for it if relevant.
|
||||||
# sendOuts is an array; each element is itself an array: [idxBattler,pkmn]
|
# sendOuts is an array; each element is itself an array: [idxBattler,pkmn]
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbSendOutBattlers(sendOuts,startBattle=false)
|
def pbSendOutBattlers(sendOuts,startBattle = false)
|
||||||
return if sendOuts.length==0
|
return if sendOuts.length==0
|
||||||
# If party balls are still appearing, wait for them to finish showing up, as
|
# If party balls are still appearing, wait for them to finish showing up, as
|
||||||
# the FadeAnimation will make them disappear.
|
# the FadeAnimation will make them disappear.
|
||||||
@@ -216,7 +216,7 @@ class Battle::Scene
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Shows a HP-changing common animation and animates a data box's HP bar.
|
# Shows a HP-changing common animation and animates a data box's HP bar.
|
||||||
# Called by def pbReduceHP, def pbRecoverHP.
|
# Called by def pbReduceHP, def pbRecoverHP.
|
||||||
def pbHPChanged(battler,oldHP,showAnim=false)
|
def pbHPChanged(battler,oldHP,showAnim = false)
|
||||||
@briefMessage = false
|
@briefMessage = false
|
||||||
if battler.hp>oldHP
|
if battler.hp>oldHP
|
||||||
pbCommonAnimation("HealthUp",battler) if showAnim && @battle.showAnims
|
pbCommonAnimation("HealthUp",battler) if showAnim && @battle.showAnims
|
||||||
@@ -229,7 +229,7 @@ class Battle::Scene
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbDamageAnimation(battler,effectiveness=0)
|
def pbDamageAnimation(battler,effectiveness = 0)
|
||||||
@briefMessage = false
|
@briefMessage = false
|
||||||
# Damage animation
|
# Damage animation
|
||||||
damageAnim = Animation::BattlerDamage.new(@sprites,@viewport,battler.index,effectiveness)
|
damageAnim = Animation::BattlerDamage.new(@sprites,@viewport,battler.index,effectiveness)
|
||||||
@@ -324,7 +324,7 @@ class Battle::Scene
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Animates throwing a Poké Ball at a Pokémon in an attempt to catch it
|
# Animates throwing a Poké Ball at a Pokémon in an attempt to catch it
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbThrow(ball,shakes,critical,targetBattler,showPlayer=false)
|
def pbThrow(ball,shakes,critical,targetBattler,showPlayer = false)
|
||||||
@briefMessage = false
|
@briefMessage = false
|
||||||
captureAnim = Animation::PokeballThrowCapture.new(@sprites,@viewport,
|
captureAnim = Animation::PokeballThrowCapture.new(@sprites,@viewport,
|
||||||
ball,shakes,critical,@battle.battlers[targetBattler],showPlayer)
|
ball,shakes,critical,@battle.battlers[targetBattler],showPlayer)
|
||||||
@@ -403,7 +403,7 @@ class Battle::Scene
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Returns the animation ID to use for a given move/user. Returns nil if that
|
# Returns the animation ID to use for a given move/user. Returns nil if that
|
||||||
# move has no animations defined for it.
|
# move has no animations defined for it.
|
||||||
def pbFindMoveAnimDetails(move2anim,moveID,idxUser,hitNum=0)
|
def pbFindMoveAnimDetails(move2anim,moveID,idxUser,hitNum = 0)
|
||||||
real_move_id = GameData::Move.get(moveID).id
|
real_move_id = GameData::Move.get(moveID).id
|
||||||
noFlip = false
|
noFlip = false
|
||||||
if (idxUser&1)==0 # On player's side
|
if (idxUser&1)==0 # On player's side
|
||||||
@@ -483,7 +483,7 @@ class Battle::Scene
|
|||||||
# Plays a move/common animation
|
# Plays a move/common animation
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Plays a move animation.
|
# Plays a move animation.
|
||||||
def pbAnimation(moveID,user,targets,hitNum=0)
|
def pbAnimation(moveID,user,targets,hitNum = 0)
|
||||||
animID = pbFindMoveAnimation(moveID,user.index,hitNum)
|
animID = pbFindMoveAnimation(moveID,user.index,hitNum)
|
||||||
return if !animID
|
return if !animID
|
||||||
anim = animID[0]
|
anim = animID[0]
|
||||||
@@ -500,7 +500,7 @@ class Battle::Scene
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Plays a common animation.
|
# Plays a common animation.
|
||||||
def pbCommonAnimation(animName,user=nil,target=nil)
|
def pbCommonAnimation(animName,user = nil,target = nil)
|
||||||
return if nil_or_empty?(animName)
|
return if nil_or_empty?(animName)
|
||||||
target = target[0] if target && target.is_a?(Array)
|
target = target[0] if target && target.is_a?(Array)
|
||||||
animations = pbLoadBattleAnimations
|
animations = pbLoadBattleAnimations
|
||||||
@@ -512,7 +512,7 @@ class Battle::Scene
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAnimationCore(animation,user,target,oppMove=false)
|
def pbAnimationCore(animation,user,target,oppMove = false)
|
||||||
return if !animation
|
return if !animation
|
||||||
@briefMessage = false
|
@briefMessage = false
|
||||||
userSprite = (user) ? @sprites["pokemon_#{user.index}"] : nil
|
userSprite = (user) ? @sprites["pokemon_#{user.index}"] : nil
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class Battle::Scene::MenuBase
|
|||||||
TEXT_BASE_COLOR = Battle::Scene::MESSAGE_BASE_COLOR
|
TEXT_BASE_COLOR = Battle::Scene::MESSAGE_BASE_COLOR
|
||||||
TEXT_SHADOW_COLOR = Battle::Scene::MESSAGE_SHADOW_COLOR
|
TEXT_SHADOW_COLOR = Battle::Scene::MESSAGE_SHADOW_COLOR
|
||||||
|
|
||||||
def initialize(viewport=nil)
|
def initialize(viewport = nil)
|
||||||
@x = 0
|
@x = 0
|
||||||
@y = 0
|
@y = 0
|
||||||
@z = 0
|
@z = 0
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
|||||||
FEMALE_BASE_COLOR = Color.new(248,88,40)
|
FEMALE_BASE_COLOR = Color.new(248,88,40)
|
||||||
FEMALE_SHADOW_COLOR = NAME_SHADOW_COLOR
|
FEMALE_SHADOW_COLOR = NAME_SHADOW_COLOR
|
||||||
|
|
||||||
def initialize(battler,sideSize,viewport=nil)
|
def initialize(battler,sideSize,viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
@battler = battler
|
@battler = battler
|
||||||
@sprites = {}
|
@sprites = {}
|
||||||
@@ -193,7 +193,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
|||||||
pbSEPlay("Pkmn exp gain") if @showExp
|
pbSEPlay("Pkmn exp gain") if @showExp
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbDrawNumber(number,btmp,startX,startY,align=0)
|
def pbDrawNumber(number,btmp,startX,startY,align = 0)
|
||||||
# -1 means draw the / character
|
# -1 means draw the / character
|
||||||
n = (number == -1) ? [10] : number.to_i.digits.reverse
|
n = (number == -1) ? [10] : number.to_i.digits.reverse
|
||||||
charWidth = @numbersBitmap.width/11
|
charWidth = @numbersBitmap.width/11
|
||||||
@@ -363,7 +363,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(frameCounter=0)
|
def update(frameCounter = 0)
|
||||||
super()
|
super()
|
||||||
# Animate HP bar
|
# Animate HP bar
|
||||||
updateHPAnimation
|
updateHPAnimation
|
||||||
@@ -386,7 +386,7 @@ class Battle::Scene::AbilitySplashBar < SpriteWrapper
|
|||||||
TEXT_BASE_COLOR = Color.new(0,0,0)
|
TEXT_BASE_COLOR = Color.new(0,0,0)
|
||||||
TEXT_SHADOW_COLOR = Color.new(248,248,248)
|
TEXT_SHADOW_COLOR = Color.new(248,248,248)
|
||||||
|
|
||||||
def initialize(side,viewport=nil)
|
def initialize(side,viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
@side = side
|
@side = side
|
||||||
@battler = nil
|
@battler = nil
|
||||||
@@ -550,7 +550,7 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
|||||||
@pkmn.species_data.apply_metrics_to_sprite(self, @index)
|
@pkmn.species_data.apply_metrics_to_sprite(self, @index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def setPokemonBitmap(pkmn,back=false)
|
def setPokemonBitmap(pkmn,back = false)
|
||||||
@pkmn = pkmn
|
@pkmn = pkmn
|
||||||
@_iconBitmap.dispose if @_iconBitmap
|
@_iconBitmap.dispose if @_iconBitmap
|
||||||
@_iconBitmap = GameData::Species.sprite_bitmap_from_pokemon(@pkmn, back)
|
@_iconBitmap = GameData::Species.sprite_bitmap_from_pokemon(@pkmn, back)
|
||||||
@@ -562,14 +562,14 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
|||||||
# this is just playing the Pokémon's cry, but you can expand on it. The
|
# this is just playing the Pokémon's cry, but you can expand on it. The
|
||||||
# recommendation is to create a PictureEx animation and push it into
|
# recommendation is to create a PictureEx animation and push it into
|
||||||
# the @battleAnimations array.
|
# the @battleAnimations array.
|
||||||
def pbPlayIntroAnimation(pictureEx=nil)
|
def pbPlayIntroAnimation(pictureEx = nil)
|
||||||
@pkmn.play_cry if @pkmn
|
@pkmn.play_cry if @pkmn
|
||||||
end
|
end
|
||||||
|
|
||||||
QUARTER_ANIM_PERIOD = Graphics.frame_rate*3/20
|
QUARTER_ANIM_PERIOD = Graphics.frame_rate*3/20
|
||||||
SIXTH_ANIM_PERIOD = Graphics.frame_rate*2/20
|
SIXTH_ANIM_PERIOD = Graphics.frame_rate*2/20
|
||||||
|
|
||||||
def update(frameCounter=0)
|
def update(frameCounter = 0)
|
||||||
return if !@_iconBitmap
|
return if !@_iconBitmap
|
||||||
@updating = true
|
@updating = true
|
||||||
# Update bitmap
|
# Update bitmap
|
||||||
@@ -653,7 +653,7 @@ class Battle::Scene::BattlerShadowSprite < RPG::Sprite
|
|||||||
pbSetPosition
|
pbSetPosition
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(frameCounter=0)
|
def update(frameCounter = 0)
|
||||||
return if !@_iconBitmap
|
return if !@_iconBitmap
|
||||||
# Update bitmap
|
# Update bitmap
|
||||||
@_iconBitmap.update
|
@_iconBitmap.update
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Battle::Scene::Animation
|
|||||||
def empty?; return @pictureEx.length==0; end
|
def empty?; return @pictureEx.length==0; end
|
||||||
def animDone?; return @animDone; end
|
def animDone?; return @animDone; end
|
||||||
|
|
||||||
def addSprite(s,origin=PictureOrigin::TopLeft)
|
def addSprite(s,origin = PictureOrigin::TopLeft)
|
||||||
num = @pictureEx.length
|
num = @pictureEx.length
|
||||||
picture = PictureEx.new(s.z)
|
picture = PictureEx.new(s.z)
|
||||||
picture.x = s.x
|
picture.x = s.x
|
||||||
@@ -31,7 +31,7 @@ class Battle::Scene::Animation
|
|||||||
return picture
|
return picture
|
||||||
end
|
end
|
||||||
|
|
||||||
def addNewSprite(x,y,name,origin=PictureOrigin::TopLeft)
|
def addNewSprite(x,y,name,origin = PictureOrigin::TopLeft)
|
||||||
num = @pictureEx.length
|
num = @pictureEx.length
|
||||||
picture = PictureEx.new(num)
|
picture = PictureEx.new(num)
|
||||||
picture.setXY(0,x,y)
|
picture.setXY(0,x,y)
|
||||||
@@ -96,7 +96,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
|||||||
return ball
|
return ball
|
||||||
end
|
end
|
||||||
|
|
||||||
def ballTracksHand(ball,traSprite,safariThrow=false)
|
def ballTracksHand(ball,traSprite,safariThrow = false)
|
||||||
# Back sprite isn't animated, no hand-tracking needed
|
# Back sprite isn't animated, no hand-tracking needed
|
||||||
if traSprite.bitmap.width<traSprite.bitmap.height*2
|
if traSprite.bitmap.width<traSprite.bitmap.height*2
|
||||||
ball.setVisible(7,true)
|
ball.setVisible(7,true)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
|
|||||||
blackBar.moveOpacity(appearTime*3/4,appearTime/4,0)
|
blackBar.moveOpacity(appearTime*3/4,appearTime/4,0)
|
||||||
end
|
end
|
||||||
|
|
||||||
def makeSlideSprite(spriteName,deltaMult,appearTime,origin=nil)
|
def makeSlideSprite(spriteName,deltaMult,appearTime,origin = nil)
|
||||||
# If deltaMult is positive, the sprite starts off to the right and moves
|
# If deltaMult is positive, the sprite starts off to the right and moves
|
||||||
# left (for sprites on the player's side and the background).
|
# left (for sprites on the player's side and the background).
|
||||||
return if !@sprites[spriteName]
|
return if !@sprites[spriteName]
|
||||||
@@ -304,7 +304,7 @@ end
|
|||||||
# Doesn't show the ball thrown or the Pokémon.
|
# Doesn't show the ball thrown or the Pokémon.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
|
class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
|
||||||
def initialize(sprites,viewport,fullAnim=false)
|
def initialize(sprites,viewport,fullAnim = false)
|
||||||
@fullAnim = fullAnim # True at start of battle, false when switching
|
@fullAnim = fullAnim # True at start of battle, false when switching
|
||||||
super(sprites,viewport)
|
super(sprites,viewport)
|
||||||
end
|
end
|
||||||
@@ -357,7 +357,7 @@ end
|
|||||||
# Doesn't show the ball thrown or the Pokémon.
|
# Doesn't show the ball thrown or the Pokémon.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
|
class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
|
||||||
def initialize(sprites,viewport,fullAnim=false)
|
def initialize(sprites,viewport,fullAnim = false)
|
||||||
@fullAnim = fullAnim # True at start of battle, false when switching
|
@fullAnim = fullAnim # True at start of battle, false when switching
|
||||||
super(sprites,viewport)
|
super(sprites,viewport)
|
||||||
end
|
end
|
||||||
@@ -404,7 +404,7 @@ end
|
|||||||
class Battle::Scene::Animation::PokeballPlayerSendOut < Battle::Scene::Animation
|
class Battle::Scene::Animation::PokeballPlayerSendOut < Battle::Scene::Animation
|
||||||
include Battle::Scene::Animation::BallAnimationMixin
|
include Battle::Scene::Animation::BallAnimationMixin
|
||||||
|
|
||||||
def initialize(sprites,viewport,idxTrainer,battler,startBattle,idxOrder=0)
|
def initialize(sprites,viewport,idxTrainer,battler,startBattle,idxOrder = 0)
|
||||||
@idxTrainer = idxTrainer
|
@idxTrainer = idxTrainer
|
||||||
@battler = battler
|
@battler = battler
|
||||||
@showingTrainer = startBattle
|
@showingTrainer = startBattle
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ class Battle::DebugSceneNoLogging
|
|||||||
def pbBeginCommandPhase; end
|
def pbBeginCommandPhase; end
|
||||||
def pbBeginAttackPhase; end
|
def pbBeginAttackPhase; end
|
||||||
def pbShowOpponent(idxTrainer); end
|
def pbShowOpponent(idxTrainer); end
|
||||||
def pbDamageAnimation(battler,effectiveness=0); end
|
def pbDamageAnimation(battler,effectiveness = 0); end
|
||||||
def pbCommonAnimation(animName,user=nil,target=nil); end
|
def pbCommonAnimation(animName,user = nil,target = nil); end
|
||||||
def pbAnimation(moveID,user,targets,hitNum=0); end
|
def pbAnimation(moveID,user,targets,hitNum = 0); end
|
||||||
def pbEndBattle(result); end
|
def pbEndBattle(result); end
|
||||||
def pbWildBattleSuccess; end
|
def pbWildBattleSuccess; end
|
||||||
def pbTrainerBattleSuccess; end
|
def pbTrainerBattleSuccess; end
|
||||||
@@ -34,17 +34,17 @@ class Battle::DebugSceneNoLogging
|
|||||||
|
|
||||||
def pbRefresh; end
|
def pbRefresh; end
|
||||||
|
|
||||||
def pbDisplayMessage(msg,brief=false); end
|
def pbDisplayMessage(msg,brief = false); end
|
||||||
def pbDisplayPausedMessage(msg); end
|
def pbDisplayPausedMessage(msg); end
|
||||||
def pbDisplayConfirmMessage(msg); return true; end
|
def pbDisplayConfirmMessage(msg); return true; end
|
||||||
def pbShowCommands(msg,commands,defaultValue); return 0; end
|
def pbShowCommands(msg,commands,defaultValue); return 0; end
|
||||||
|
|
||||||
def pbSendOutBattlers(sendOuts,startBattle=false); end
|
def pbSendOutBattlers(sendOuts,startBattle = false); end
|
||||||
def pbRecall(idxBattler); end
|
def pbRecall(idxBattler); end
|
||||||
def pbItemMenu(idxBattler,firstAction); return -1; end
|
def pbItemMenu(idxBattler,firstAction); return -1; end
|
||||||
def pbResetMoveIndex(idxBattler); end
|
def pbResetMoveIndex(idxBattler); end
|
||||||
|
|
||||||
def pbHPChanged(battler,oldHP,showAnim=false); end
|
def pbHPChanged(battler,oldHP,showAnim = false); end
|
||||||
def pbFaintBattler(battler); end
|
def pbFaintBattler(battler); end
|
||||||
def pbEXPBar(battler,startExp,endExp,tempExp1,tempExp2); end
|
def pbEXPBar(battler,startExp,endExp,tempExp1,tempExp2); end
|
||||||
def pbLevelUp(pkmn, battler, oldTotalHP, oldAttack, oldDefense,
|
def pbLevelUp(pkmn, battler, oldTotalHP, oldAttack, oldDefense,
|
||||||
@@ -57,20 +57,20 @@ class Battle::DebugSceneNoLogging
|
|||||||
return 0 # Fight
|
return 0 # Fight
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFightMenu(idxBattler,megaEvoPossible=false)
|
def pbFightMenu(idxBattler,megaEvoPossible = false)
|
||||||
battler = @battle.battlers[idxBattler]
|
battler = @battle.battlers[idxBattler]
|
||||||
50.times do
|
50.times do
|
||||||
break if yield rand(battler.move.length)
|
break if yield rand(battler.move.length)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChooseTarget(idxBattler,target_data,visibleSprites=nil)
|
def pbChooseTarget(idxBattler,target_data,visibleSprites = nil)
|
||||||
targets = @battle.allOtherSideBattlers(idxBattler).map { |b| b.index }
|
targets = @battle.allOtherSideBattlers(idxBattler).map { |b| b.index }
|
||||||
return -1 if targets.length==0
|
return -1 if targets.length==0
|
||||||
return targets.sample
|
return targets.sample
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbPartyScreen(idxBattler,canCancel=false)
|
def pbPartyScreen(idxBattler,canCancel = false)
|
||||||
replacements = []
|
replacements = []
|
||||||
@battle.eachInTeamFromBattlerIndex(idxBattler) do |_b,idxParty|
|
@battle.eachInTeamFromBattlerIndex(idxBattler) do |_b,idxParty|
|
||||||
replacements.push(idxParty) if !@battle.pbFindBattler(idxParty,idxBattler)
|
replacements.push(idxParty) if !@battle.pbFindBattler(idxParty,idxBattler)
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ class Battle::AI
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Get a score for the given move being used against the given target
|
# Get a score for the given move being used against the given target
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbGetMoveScore(move,user,target,skill=100)
|
def pbGetMoveScore(move,user,target,skill = 100)
|
||||||
skill = PBTrainerAI.minimumSkill if skill<PBTrainerAI.minimumSkill
|
skill = PBTrainerAI.minimumSkill if skill<PBTrainerAI.minimumSkill
|
||||||
score = 100
|
score = 100
|
||||||
score = pbGetMoveScoreFunctionCode(score,move,user,target,skill)
|
score = pbGetMoveScoreFunctionCode(score,move,user,target,skill)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Battle::AI
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Get a score for the given move based on its effect
|
# Get a score for the given move based on its effect
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbGetMoveScoreFunctionCode(score,move,user,target,skill=100)
|
def pbGetMoveScoreFunctionCode(score,move,user,target,skill = 100)
|
||||||
case move.function
|
case move.function
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "None" # No extra effect
|
when "None" # No extra effect
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Battle::Peer
|
|||||||
end
|
end
|
||||||
|
|
||||||
# For switching out, including due to fainting, and for the end of battle
|
# For switching out, including due to fainting, and for the end of battle
|
||||||
def pbOnLeavingBattle(battle,pkmn,usedInBattle,endBattle=false)
|
def pbOnLeavingBattle(battle,pkmn,usedInBattle,endBattle = false)
|
||||||
return if !pkmn
|
return if !pkmn
|
||||||
f = MultipleForms.call("getFormOnLeavingBattle",pkmn,battle,usedInBattle,endBattle)
|
f = MultipleForms.call("getFormOnLeavingBattle",pkmn,battle,usedInBattle,endBattle)
|
||||||
pkmn.form = f if f && pkmn.form!=f
|
pkmn.form = f if f && pkmn.form!=f
|
||||||
@@ -58,7 +58,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Battle::NullPeer
|
class Battle::NullPeer
|
||||||
def pbOnEnteringBattle(battle, battler, pkmn, wild = false); end
|
def pbOnEnteringBattle(battle, battler, pkmn, wild = false); end
|
||||||
def pbOnLeavingBattle(battle,pkmn,usedInBattle,endBattle=false); end
|
def pbOnLeavingBattle(battle,pkmn,usedInBattle,endBattle = false); end
|
||||||
|
|
||||||
def pbStorePokemon(player,pkmn)
|
def pbStorePokemon(player,pkmn)
|
||||||
player.party[player.party.length] = pkmn if !player.party_full?
|
player.party[player.party.length] = pkmn if !player.party_full?
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ module Battle::CatchAndStoreMixin
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Throw a Poké Ball
|
# Throw a Poké Ball
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbThrowPokeBall(idxBattler,ball,catch_rate=nil,showPlayer=false)
|
def pbThrowPokeBall(idxBattler,ball,catch_rate = nil,showPlayer = false)
|
||||||
# Determine which Pokémon you're throwing the Poké Ball at
|
# Determine which Pokémon you're throwing the Poké Ball at
|
||||||
battler = nil
|
battler = nil
|
||||||
if opposes?(idxBattler)
|
if opposes?(idxBattler)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Battle
|
|||||||
return __clauses__pbDecisionOnDraw
|
return __clauses__pbDecisionOnDraw
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbJudgeCheckpoint(user,move=nil)
|
def pbJudgeCheckpoint(user,move = nil)
|
||||||
if pbAllFainted?(0) && pbAllFainted?(1)
|
if pbAllFainted?(0) && pbAllFainted?(1)
|
||||||
if @rules["drawclause"] # NOTE: Also includes Life Orb (not implemented)
|
if @rules["drawclause"] # NOTE: Also includes Life Orb (not implemented)
|
||||||
if !(move && move.function=="HealUserByHalfOfDamageDone")
|
if !(move && move.function=="HealUserByHalfOfDamageDone")
|
||||||
@@ -62,7 +62,7 @@ class Battle::Battler
|
|||||||
@__clauses__aliased = true
|
@__clauses__aliased = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCanSleep?(user,showMessages,move=nil,ignoreStatus=false)
|
def pbCanSleep?(user,showMessages,move = nil,ignoreStatus = false)
|
||||||
selfsleep = (user && user.index==@index)
|
selfsleep = (user && user.index==@index)
|
||||||
if ((@battle.rules["modifiedsleepclause"]) || (!selfsleep && @battle.rules["sleepclause"])) &&
|
if ((@battle.rules["modifiedsleepclause"]) || (!selfsleep && @battle.rules["sleepclause"])) &&
|
||||||
pbHasStatusPokemon?(:SLEEP)
|
pbHasStatusPokemon?(:SLEEP)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ def isReversed(src0,src1,dst0,dst1)
|
|||||||
return (dst0<dst1)
|
return (dst0<dst1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCreateCel(x,y,pattern,focus=4)
|
def pbCreateCel(x,y,pattern,focus = 4)
|
||||||
frame = []
|
frame = []
|
||||||
frame[AnimFrame::X] = x
|
frame[AnimFrame::X] = x
|
||||||
frame[AnimFrame::Y] = y
|
frame[AnimFrame::Y] = y
|
||||||
@@ -256,7 +256,7 @@ class PBAnimTiming
|
|||||||
attr_accessor :flashColor
|
attr_accessor :flashColor
|
||||||
attr_accessor :flashDuration
|
attr_accessor :flashDuration
|
||||||
|
|
||||||
def initialize(type=0)
|
def initialize(type = 0)
|
||||||
@frame = 0
|
@frame = 0
|
||||||
@timingType = type
|
@timingType = type
|
||||||
@name = ""
|
@name = ""
|
||||||
@@ -358,7 +358,7 @@ class PBAnimations < Array
|
|||||||
attr_reader :array
|
attr_reader :array
|
||||||
attr_accessor :selected
|
attr_accessor :selected
|
||||||
|
|
||||||
def initialize(size=1)
|
def initialize(size = 1)
|
||||||
@array = []
|
@array = []
|
||||||
@selected = 0
|
@selected = 0
|
||||||
size = 1 if size<1 # Always create at least one animation
|
size = 1 if size<1 # Always create at least one animation
|
||||||
@@ -433,7 +433,7 @@ class PBAnimation < Array
|
|||||||
return @speed || 20
|
return @speed || 20
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(size=1)
|
def initialize(size = 1)
|
||||||
@id = -1
|
@id = -1
|
||||||
@name = ""
|
@name = ""
|
||||||
@graphic = ""
|
@graphic = ""
|
||||||
@@ -494,7 +494,7 @@ class PBAnimation < Array
|
|||||||
return @array[pos]
|
return @array[pos]
|
||||||
end
|
end
|
||||||
|
|
||||||
def playTiming(frame,bgGraphic,bgColor,foGraphic,foColor,oldbg=[],oldfo=[],user=nil)
|
def playTiming(frame,bgGraphic,bgColor,foGraphic,foColor,oldbg = [],oldfo = [],user = nil)
|
||||||
for i in @timing
|
for i in @timing
|
||||||
next if i.frame!=frame
|
next if i.frame!=frame
|
||||||
case i.timingType
|
case i.timingType
|
||||||
@@ -617,7 +617,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbSpriteSetAnimFrame(sprite,frame,user=nil,target=nil,inEditor=false)
|
def pbSpriteSetAnimFrame(sprite,frame,user = nil,target = nil,inEditor = false)
|
||||||
return if !sprite
|
return if !sprite
|
||||||
if !frame
|
if !frame
|
||||||
sprite.visible = false
|
sprite.visible = false
|
||||||
@@ -702,7 +702,7 @@ class PBAnimationPlayerX
|
|||||||
|
|
||||||
MAX_SPRITES = 60
|
MAX_SPRITES = 60
|
||||||
|
|
||||||
def initialize(animation,user,target,scene=nil,oppMove=false,inEditor=false)
|
def initialize(animation,user,target,scene = nil,oppMove = false,inEditor = false)
|
||||||
@animation = animation
|
@animation = animation
|
||||||
@user = (oppMove) ? target : user # Just used for playing user's cry
|
@user = (oppMove) ? target : user # Just used for playing user's cry
|
||||||
@usersprite = (user) ? scene.sprites["pokemon_#{user.index}"] : nil
|
@usersprite = (user) ? scene.sprites["pokemon_#{user.index}"] : nil
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class Battle::FakeBattler
|
|||||||
return $player.owned?(pokemon.species)
|
return $player.owned?(pokemon.species)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbThis(lowerCase=false)
|
def pbThis(lowerCase = false)
|
||||||
return (lowerCase) ? _INTL("the wild {1}",name) : _INTL("The wild {1}",name)
|
return (lowerCase) ? _INTL("the wild {1}",name) : _INTL("The wild {1}",name)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ end
|
|||||||
class Battle::Scene::SafariDataBox < SpriteWrapper
|
class Battle::Scene::SafariDataBox < SpriteWrapper
|
||||||
attr_accessor :selected
|
attr_accessor :selected
|
||||||
|
|
||||||
def initialize(battle,viewport=nil)
|
def initialize(battle,viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
@selected = 0
|
@selected = 0
|
||||||
@battle = battle
|
@battle = battle
|
||||||
@@ -88,7 +88,7 @@ class Battle::Scene::SafariDataBox < SpriteWrapper
|
|||||||
pbDrawTextPositions(self.bitmap,textpos)
|
pbDrawTextPositions(self.bitmap,textpos)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(frameCounter=0)
|
def update(frameCounter = 0)
|
||||||
super()
|
super()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -381,12 +381,12 @@ class SafariBattle
|
|||||||
return (opposes?(idxBattler)) ? @party2 : nil
|
return (opposes?(idxBattler)) ? @party2 : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAllFainted?(idxBattler=0); return false; end
|
def pbAllFainted?(idxBattler = 0); return false; end
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Battler-related
|
# Battler-related
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def opposes?(idxBattler1,idxBattler2=0)
|
def opposes?(idxBattler1,idxBattler2 = 0)
|
||||||
idxBattler1 = idxBattler1.index if idxBattler1.respond_to?("index")
|
idxBattler1 = idxBattler1.index if idxBattler1.respond_to?("index")
|
||||||
idxBattler2 = idxBattler2.index if idxBattler2.respond_to?("index")
|
idxBattler2 = idxBattler2.index if idxBattler2.respond_to?("index")
|
||||||
return (idxBattler1&1)!=(idxBattler2&1)
|
return (idxBattler1&1)!=(idxBattler2&1)
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class BattlePalaceBattle < Battle
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRegisterMove(idxBattler,idxMove,_showMessages=true)
|
def pbRegisterMove(idxBattler,idxMove,_showMessages = true)
|
||||||
this_battler = @battlers[idxBattler]
|
this_battler = @battlers[idxBattler]
|
||||||
if idxMove==-2
|
if idxMove==-2
|
||||||
@choices[idxBattler][0] = :UseMove # "Use move"
|
@choices[idxBattler][0] = :UseMove # "Use move"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Battle::SuccessState
|
|||||||
|
|
||||||
def initialize; clear; end
|
def initialize; clear; end
|
||||||
|
|
||||||
def clear(full=true)
|
def clear(full = true)
|
||||||
@typeMod = Effectiveness::NORMAL_EFFECTIVE
|
@typeMod = Effectiveness::NORMAL_EFFECTIVE
|
||||||
@useState = 0
|
@useState = 0
|
||||||
@protected = false
|
@protected = false
|
||||||
@@ -51,14 +51,14 @@ class BattleArenaBattle < Battle
|
|||||||
@battleAI.battleArena = true
|
@battleAI.battleArena = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCanSwitchLax?(idxBattler,_idxParty,partyScene=nil)
|
def pbCanSwitchLax?(idxBattler,_idxParty,partyScene = nil)
|
||||||
if partyScene
|
if partyScene
|
||||||
partyScene.pbDisplay(_INTL("{1} can't be switched out!",@battlers[idxBattler].pbThis))
|
partyScene.pbDisplay(_INTL("{1} can't be switched out!",@battlers[idxBattler].pbThis))
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbEORSwitch(favorDraws=false)
|
def pbEORSwitch(favorDraws = false)
|
||||||
return if favorDraws && @decision==5
|
return if favorDraws && @decision==5
|
||||||
return if !favorDraws && @decision>0
|
return if !favorDraws && @decision>0
|
||||||
pbJudge
|
pbJudge
|
||||||
|
|||||||
@@ -73,13 +73,13 @@ module RecordedBattleModule
|
|||||||
return Marshal.dump([pbGetBattleType,@properties,@rounds,@randomnumbers,@switches])
|
return Marshal.dump([pbGetBattleType,@properties,@rounds,@randomnumbers,@switches])
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbSwitchInBetween(idxBattler,checkLaxOnly=false,canCancel=false)
|
def pbSwitchInBetween(idxBattler,checkLaxOnly = false,canCancel = false)
|
||||||
ret = super
|
ret = super
|
||||||
@switches.push(ret)
|
@switches.push(ret)
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRegisterMove(idxBattler,idxMove,showMessages=true)
|
def pbRegisterMove(idxBattler,idxMove,showMessages = true)
|
||||||
if super
|
if super
|
||||||
@rounds[@roundindex][idxBattler] = [Commands::Fight,idxMove]
|
@rounds[@roundindex][idxBattler] = [Commands::Fight,idxMove]
|
||||||
return true
|
return true
|
||||||
@@ -92,13 +92,13 @@ module RecordedBattleModule
|
|||||||
@rounds[@roundindex][idxBattler][2] = idxTarget
|
@rounds[@roundindex][idxBattler][2] = idxTarget
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRun(idxBattler,duringBattle=false)
|
def pbRun(idxBattler,duringBattle = false)
|
||||||
ret = super
|
ret = super
|
||||||
@rounds[@roundindex][idxBattler] = [Commands::Run,@decision]
|
@rounds[@roundindex][idxBattler] = [Commands::Run,@decision]
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAutoChooseMove(idxBattler,showMessages=true)
|
def pbAutoChooseMove(idxBattler,showMessages = true)
|
||||||
ret = super
|
ret = super
|
||||||
@rounds[@roundindex][idxBattler] = [Commands::Fight,-1]
|
@rounds[@roundindex][idxBattler] = [Commands::Fight,-1]
|
||||||
return ret
|
return ret
|
||||||
@@ -112,7 +112,7 @@ module RecordedBattleModule
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRegisterItem(idxBattler,item,idxTarget=nil,idxMove=nil)
|
def pbRegisterItem(idxBattler,item,idxTarget = nil,idxMove = nil)
|
||||||
if super
|
if super
|
||||||
@rounds[@roundindex][idxBattler] = [Commands::Bag,item,idxTarget,idxMove]
|
@rounds[@roundindex][idxBattler] = [Commands::Bag,item,idxTarget,idxMove]
|
||||||
return true
|
return true
|
||||||
@@ -183,7 +183,7 @@ module RecordedBattlePlaybackModule
|
|||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbSwitchInBetween(_idxBattler,_checkLaxOnly=false,_canCancel=false)
|
def pbSwitchInBetween(_idxBattler,_checkLaxOnly = false,_canCancel = false)
|
||||||
ret = @switches[@switchindex]
|
ret = @switches[@switchindex]
|
||||||
@switchindex += 1
|
@switchindex += 1
|
||||||
return ret
|
return ret
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ end
|
|||||||
class DarknessSprite < SpriteWrapper
|
class DarknessSprite < SpriteWrapper
|
||||||
attr_reader :radius
|
attr_reader :radius
|
||||||
|
|
||||||
def initialize(viewport=nil)
|
def initialize(viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
@darkness = BitmapWrapper.new(Graphics.width,Graphics.height)
|
@darkness = BitmapWrapper.new(Graphics.width,Graphics.height)
|
||||||
@radius = radiusMin
|
@radius = radiusMin
|
||||||
@@ -91,7 +91,7 @@ end
|
|||||||
# Light effects
|
# Light effects
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class LightEffect
|
class LightEffect
|
||||||
def initialize(event,viewport=nil,map=nil,filename=nil)
|
def initialize(event,viewport = nil,map = nil,filename = nil)
|
||||||
@light = IconSprite.new(0,0,viewport)
|
@light = IconSprite.new(0,0,viewport)
|
||||||
if filename!=nil && filename!="" && pbResolveBitmap("Graphics/Pictures/"+filename)
|
if filename!=nil && filename!="" && pbResolveBitmap("Graphics/Pictures/"+filename)
|
||||||
@light.setBitmap("Graphics/Pictures/"+filename)
|
@light.setBitmap("Graphics/Pictures/"+filename)
|
||||||
@@ -123,7 +123,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
class LightEffect_Lamp < LightEffect
|
class LightEffect_Lamp < LightEffect
|
||||||
def initialize(event,viewport=nil,map=nil)
|
def initialize(event,viewport = nil,map = nil)
|
||||||
lamp = AnimatedBitmap.new("Graphics/Pictures/LE")
|
lamp = AnimatedBitmap.new("Graphics/Pictures/LE")
|
||||||
@light = Sprite.new(viewport)
|
@light = Sprite.new(viewport)
|
||||||
@light.bitmap = Bitmap.new(128,64)
|
@light.bitmap = Bitmap.new(128,64)
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Blacking out animation
|
# Blacking out animation
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbStartOver(gameover=false)
|
def pbStartOver(gameover = false)
|
||||||
if pbInBugContest?
|
if pbInBugContest?
|
||||||
pbBugContestStartOver
|
pbBugContestStartOver
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ Events.onMapSceneChange += proc { |_sender, e|
|
|||||||
# Event locations, terrain tags
|
# Event locations, terrain tags
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
|
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
|
||||||
def pbFacingTile(direction=nil,event=nil)
|
def pbFacingTile(direction = nil,event = nil)
|
||||||
return $map_factory.getFacingTile(direction,event) if $map_factory
|
return $map_factory.getFacingTile(direction,event) if $map_factory
|
||||||
return pbFacingTileRegular(direction,event)
|
return pbFacingTileRegular(direction,event)
|
||||||
end
|
end
|
||||||
@@ -395,7 +395,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Audio playing
|
# Audio playing
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)
|
def pbCueBGM(bgm,seconds,volume = nil,pitch = nil)
|
||||||
return if !bgm
|
return if !bgm
|
||||||
bgm = pbResolveAudioFile(bgm,volume,pitch)
|
bgm = pbResolveAudioFile(bgm,volume,pitch)
|
||||||
playingBGM = $game_system.playing_bgm
|
playingBGM = $game_system.playing_bgm
|
||||||
@@ -484,7 +484,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def pbMoveRoute(event,commands,waitComplete=false)
|
def pbMoveRoute(event,commands,waitComplete = false)
|
||||||
route = RPG::MoveRoute.new
|
route = RPG::MoveRoute.new
|
||||||
route.repeat = false
|
route.repeat = false
|
||||||
route.skippable = true
|
route.skippable = true
|
||||||
@@ -612,7 +612,7 @@ def pbMoveTowardPlayer(event)
|
|||||||
$PokemonMap.addMovedEvent(event.id) if $PokemonMap
|
$PokemonMap.addMovedEvent(event.id) if $PokemonMap
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbJumpToward(dist=1,playSound=false,cancelSurf=false)
|
def pbJumpToward(dist = 1,playSound = false,cancelSurf = false)
|
||||||
x = $game_player.x
|
x = $game_player.x
|
||||||
y = $game_player.y
|
y = $game_player.y
|
||||||
case $game_player.direction
|
case $game_player.direction
|
||||||
@@ -640,7 +640,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Bridges, cave escape points, and setting the heal point
|
# Bridges, cave escape points, and setting the heal point
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbBridgeOn(height=2)
|
def pbBridgeOn(height = 2)
|
||||||
$PokemonGlobal.bridge = height
|
$PokemonGlobal.bridge = height
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -706,7 +706,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Picking up an item found on the ground
|
# Picking up an item found on the ground
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbItemBall(item,quantity=1)
|
def pbItemBall(item,quantity = 1)
|
||||||
item = GameData::Item.get(item)
|
item = GameData::Item.get(item)
|
||||||
return false if !item || quantity<1
|
return false if !item || quantity<1
|
||||||
itemname = (quantity>1) ? item.name_plural : item.name
|
itemname = (quantity>1) ? item.name_plural : item.name
|
||||||
@@ -752,7 +752,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Being given an item
|
# Being given an item
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbReceiveItem(item,quantity=1)
|
def pbReceiveItem(item,quantity = 1)
|
||||||
item = GameData::Item.get(item)
|
item = GameData::Item.get(item)
|
||||||
return false if !item || quantity<1
|
return false if !item || quantity<1
|
||||||
itemname = (quantity>1) ? item.name_plural : item.name
|
itemname = (quantity>1) ? item.name_plural : item.name
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ end
|
|||||||
# Standard methods that start a wild battle of various sizes
|
# Standard methods that start a wild battle of various sizes
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Used when walking in tall grass, hence the additional code.
|
# Used when walking in tall grass, hence the additional code.
|
||||||
def pbWildBattle(species, level, outcomeVar=1, canRun=true, canLose=false)
|
def pbWildBattle(species, level, outcomeVar = 1, canRun = true, canLose = false)
|
||||||
species = GameData::Species.get(species).id
|
species = GameData::Species.get(species).id
|
||||||
# Potentially call a different pbWildBattle-type method instead (for roaming
|
# Potentially call a different pbWildBattle-type method instead (for roaming
|
||||||
# Pokémon, Safari battles, Bug Contest battles)
|
# Pokémon, Safari battles, Bug Contest battles)
|
||||||
@@ -329,7 +329,7 @@ def pbWildBattle(species, level, outcomeVar=1, canRun=true, canLose=false)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbDoubleWildBattle(species1, level1, species2, level2,
|
def pbDoubleWildBattle(species1, level1, species2, level2,
|
||||||
outcomeVar=1, canRun=true, canLose=false)
|
outcomeVar = 1, canRun = true, canLose = false)
|
||||||
# Set some battle rules
|
# Set some battle rules
|
||||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||||
setBattleRule("cannotRun") if !canRun
|
setBattleRule("cannotRun") if !canRun
|
||||||
@@ -342,7 +342,7 @@ def pbDoubleWildBattle(species1, level1, species2, level2,
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbTripleWildBattle(species1, level1, species2, level2, species3, level3,
|
def pbTripleWildBattle(species1, level1, species2, level2, species3, level3,
|
||||||
outcomeVar=1, canRun=true, canLose=false)
|
outcomeVar = 1, canRun = true, canLose = false)
|
||||||
# Set some battle rules
|
# Set some battle rules
|
||||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||||
setBattleRule("cannotRun") if !canRun
|
setBattleRule("cannotRun") if !canRun
|
||||||
@@ -467,8 +467,8 @@ end
|
|||||||
# Used by most trainer events, which can be positioned in such a way that
|
# Used by most trainer events, which can be positioned in such a way that
|
||||||
# multiple trainer events spot the player at once. The extra code in this method
|
# multiple trainer events spot the player at once. The extra code in this method
|
||||||
# deals with that case and can cause a double trainer battle instead.
|
# deals with that case and can cause a double trainer battle instead.
|
||||||
def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
|
def pbTrainerBattle(trainerID, trainerName, endSpeech = nil,
|
||||||
doubleBattle=false, trainerPartyID=0, canLose=false, outcomeVar=1)
|
doubleBattle = false, trainerPartyID = 0, canLose = false, outcomeVar = 1)
|
||||||
# If there is another NPC trainer who spotted the player at the same time, and
|
# If there is another NPC trainer who spotted the player at the same time, and
|
||||||
# it is possible to have a double battle (the player has 2+ able Pokémon or
|
# it is possible to have a double battle (the player has 2+ able Pokémon or
|
||||||
# has a partner trainer), then record this first NPC trainer into
|
# has a partner trainer), then record this first NPC trainer into
|
||||||
@@ -523,8 +523,8 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbDoubleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1,
|
def pbDoubleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1,
|
||||||
trainerID2, trainerName2, trainerPartyID2=0, endSpeech2=nil,
|
trainerID2, trainerName2, trainerPartyID2 = 0, endSpeech2 = nil,
|
||||||
canLose=false, outcomeVar=1)
|
canLose = false, outcomeVar = 1)
|
||||||
# Set some battle rules
|
# Set some battle rules
|
||||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||||
setBattleRule("canLose") if canLose
|
setBattleRule("canLose") if canLose
|
||||||
@@ -540,8 +540,8 @@ end
|
|||||||
|
|
||||||
def pbTripleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1,
|
def pbTripleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1,
|
||||||
trainerID2, trainerName2, trainerPartyID2, endSpeech2,
|
trainerID2, trainerName2, trainerPartyID2, endSpeech2,
|
||||||
trainerID3, trainerName3, trainerPartyID3=0, endSpeech3=nil,
|
trainerID3, trainerName3, trainerPartyID3 = 0, endSpeech3 = nil,
|
||||||
canLose=false, outcomeVar=1)
|
canLose = false, outcomeVar = 1)
|
||||||
# Set some battle rules
|
# Set some battle rules
|
||||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||||
setBattleRule("canLose") if canLose
|
setBattleRule("canLose") if canLose
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ def pbSceneStandby
|
|||||||
$scene.createSpritesets if $scene && $scene.is_a?(Scene_Map)
|
$scene.createSpritesets if $scene && $scene.is_a?(Scene_Map)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
def pbBattleAnimation(bgm = nil,battletype = 0,foe = nil)
|
||||||
$game_temp.in_battle = true
|
$game_temp.in_battle = true
|
||||||
viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||||
viewport.z = 99999
|
viewport.z = 99999
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ end
|
|||||||
# Creates and returns a Pokémon based on the given species and level.
|
# Creates and returns a Pokémon based on the given species and level.
|
||||||
# Applies wild Pokémon modifiers (wild held item, shiny chance modifiers,
|
# Applies wild Pokémon modifiers (wild held item, shiny chance modifiers,
|
||||||
# Pokérus, gender/nature forcing because of player's lead Pokémon).
|
# Pokérus, gender/nature forcing because of player's lead Pokémon).
|
||||||
def pbGenerateWildPokemon(species,level,isRoamer=false)
|
def pbGenerateWildPokemon(species,level,isRoamer = false)
|
||||||
genwildpoke = Pokemon.new(species,level)
|
genwildpoke = Pokemon.new(species,level)
|
||||||
# Give the wild Pokémon a held item
|
# Give the wild Pokémon a held item
|
||||||
items = genwildpoke.wildHoldItems
|
items = genwildpoke.wildHoldItems
|
||||||
|
|||||||
@@ -39,31 +39,31 @@ module PBDayNight
|
|||||||
@oneOverSixty = 1/60.0
|
@oneOverSixty = 1/60.0
|
||||||
|
|
||||||
# Returns true if it's day.
|
# Returns true if it's day.
|
||||||
def self.isDay?(time=nil)
|
def self.isDay?(time = nil)
|
||||||
time = pbGetTimeNow if !time
|
time = pbGetTimeNow if !time
|
||||||
return (time.hour>=5 && time.hour<20)
|
return (time.hour>=5 && time.hour<20)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns true if it's night.
|
# Returns true if it's night.
|
||||||
def self.isNight?(time=nil)
|
def self.isNight?(time = nil)
|
||||||
time = pbGetTimeNow if !time
|
time = pbGetTimeNow if !time
|
||||||
return (time.hour>=20 || time.hour<5)
|
return (time.hour>=20 || time.hour<5)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns true if it's morning.
|
# Returns true if it's morning.
|
||||||
def self.isMorning?(time=nil)
|
def self.isMorning?(time = nil)
|
||||||
time = pbGetTimeNow if !time
|
time = pbGetTimeNow if !time
|
||||||
return (time.hour>=5 && time.hour<10)
|
return (time.hour>=5 && time.hour<10)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns true if it's the afternoon.
|
# Returns true if it's the afternoon.
|
||||||
def self.isAfternoon?(time=nil)
|
def self.isAfternoon?(time = nil)
|
||||||
time = pbGetTimeNow if !time
|
time = pbGetTimeNow if !time
|
||||||
return (time.hour>=14 && time.hour<17)
|
return (time.hour>=14 && time.hour<17)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns true if it's the evening.
|
# Returns true if it's the evening.
|
||||||
def self.isEvening?(time=nil)
|
def self.isEvening?(time = nil)
|
||||||
time = pbGetTimeNow if !time
|
time = pbGetTimeNow if !time
|
||||||
return (time.hour>=17 && time.hour<20)
|
return (time.hour>=17 && time.hour<20)
|
||||||
end
|
end
|
||||||
@@ -137,7 +137,7 @@ end
|
|||||||
# 5 - Waning Gibbous
|
# 5 - Waning Gibbous
|
||||||
# 6 - Last Quarter
|
# 6 - Last Quarter
|
||||||
# 7 - Waning Crescent
|
# 7 - Waning Crescent
|
||||||
def moonphase(time=nil) # in UTC
|
def moonphase(time = nil) # in UTC
|
||||||
time = pbGetTimeNow if !time
|
time = pbGetTimeNow if !time
|
||||||
transitions = [
|
transitions = [
|
||||||
1.8456618033125,
|
1.8456618033125,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def pbCanUseHiddenMove?(pkmn,move,showmsg=true)
|
def pbCanUseHiddenMove?(pkmn,move,showmsg = true)
|
||||||
return HiddenMoveHandlers.triggerCanUseMove(move,pkmn,showmsg)
|
return HiddenMoveHandlers.triggerCanUseMove(move,pkmn,showmsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ def pbHiddenMoveEvent
|
|||||||
Events.onAction.trigger(nil)
|
Events.onAction.trigger(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCheckHiddenMoveBadge(badge=-1,showmsg=true)
|
def pbCheckHiddenMoveBadge(badge = -1,showmsg = true)
|
||||||
return true if badge<0 # No badge requirement
|
return true if badge<0 # No badge requirement
|
||||||
return true if $DEBUG
|
return true if $DEBUG
|
||||||
if (Settings::FIELD_MOVES_COUNT_BADGES) ? $player.badge_count >= badge : $player.badges[badge]
|
if (Settings::FIELD_MOVES_COUNT_BADGES) ? $player.badge_count >= badge : $player.badges[badge]
|
||||||
@@ -368,7 +368,7 @@ def pbSurfacing
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @deprecated This method is slated to be removed in v21.
|
# @deprecated This method is slated to be removed in v21.
|
||||||
def pbTransferUnderwater(mapid,x,y,direction=$game_player.direction)
|
def pbTransferUnderwater(mapid,x,y,direction = $game_player.direction)
|
||||||
Deprecation.warn_method('pbTransferUnderwater', 'v21', '"Transfer Player" event command')
|
Deprecation.warn_method('pbTransferUnderwater', 'v21', '"Transfer Player" event command')
|
||||||
pbFadeOutIn {
|
pbFadeOutIn {
|
||||||
$game_temp.player_new_map_id = mapid
|
$game_temp.player_new_map_id = mapid
|
||||||
@@ -560,7 +560,7 @@ HiddenMoveHandlers::UseMove.add(:FLY,proc { |move, pkmn|
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Headbutt
|
# Headbutt
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbHeadbuttEffect(event=nil)
|
def pbHeadbuttEffect(event = nil)
|
||||||
event = $game_player.pbFacingEvent(true) if !event
|
event = $game_player.pbFacingEvent(true) if !event
|
||||||
a = (event.x+(event.x/24).floor+1)*(event.y+(event.y/24).floor+1)
|
a = (event.x+(event.x/24).floor+1)*(event.y+(event.y/24).floor+1)
|
||||||
a = (a*2/5)%10 # Even 2x as likely as odd, 0 is 1.5x as likely as odd
|
a = (a*2/5)%10 # Even 2x as likely as odd, 0 is 1.5x as likely as odd
|
||||||
@@ -585,7 +585,7 @@ def pbHeadbuttEffect(event=nil)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbHeadbutt(event=nil)
|
def pbHeadbutt(event = nil)
|
||||||
move = :HEADBUTT
|
move = :HEADBUTT
|
||||||
movefinder = $player.get_pokemon_with_move(move)
|
movefinder = $player.get_pokemon_with_move(move)
|
||||||
if !$DEBUG && !movefinder
|
if !$DEBUG && !movefinder
|
||||||
@@ -781,7 +781,7 @@ def pbEndSurf(_xOffset,_yOffset)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @deprecated This method is slated to be removed in v21.
|
# @deprecated This method is slated to be removed in v21.
|
||||||
def pbTransferSurfing(mapid,xcoord,ycoord,direction=$game_player.direction)
|
def pbTransferSurfing(mapid,xcoord,ycoord,direction = $game_player.direction)
|
||||||
Deprecation.warn_method('pbTransferSurfing', 'v21', '"Transfer Player" event command')
|
Deprecation.warn_method('pbTransferSurfing', 'v21', '"Transfer Player" event command')
|
||||||
pbFadeOutIn {
|
pbFadeOutIn {
|
||||||
$game_temp.player_new_map_id = mapid
|
$game_temp.player_new_map_id = mapid
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ def pbFishingEnd
|
|||||||
$PokemonGlobal.fishing = false
|
$PokemonGlobal.fishing = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFishing(hasEncounter,rodType=1)
|
def pbFishing(hasEncounter,rodType = 1)
|
||||||
$stats.fishing_count += 1
|
$stats.fishing_count += 1
|
||||||
speedup = ($player.first_pokemon && [:STICKYHOLD, :SUCTIONCUPS].include?($player.first_pokemon.ability_id))
|
speedup = ($player.first_pokemon && [:STICKYHOLD, :SUCTIONCUPS].include?($player.first_pokemon.ability_id))
|
||||||
biteChance = 20+(25*rodType) # 45, 70, 95
|
biteChance = 20+(25*rodType) # 45, 70, 95
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ module ItemHandlers
|
|||||||
return [UseOnPokemonMaximum.trigger(item, pkmn), 1].max
|
return [UseOnPokemonMaximum.trigger(item, pkmn), 1].max
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.triggerCanUseInBattle(item,pkmn,battler,move,firstAction,battle,scene,showMessages=true)
|
def self.triggerCanUseInBattle(item,pkmn,battler,move,firstAction,battle,scene,showMessages = true)
|
||||||
return true if !CanUseInBattle[item] # Can use the item by default
|
return true if !CanUseInBattle[item] # Can use the item by default
|
||||||
return CanUseInBattle.trigger(item,pkmn,battler,move,firstAction,battle,scene,showMessages)
|
return CanUseInBattle.trigger(item,pkmn,battler,move,firstAction,battle,scene,showMessages)
|
||||||
end
|
end
|
||||||
@@ -640,7 +640,7 @@ end
|
|||||||
# Use an item from the Bag and/or on a Pokémon
|
# Use an item from the Bag and/or on a Pokémon
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# @return [Integer] 0 = item wasn't used; 1 = item used; 2 = close Bag to use in field
|
# @return [Integer] 0 = item wasn't used; 1 = item used; 2 = close Bag to use in field
|
||||||
def pbUseItem(bag,item,bagscene=nil)
|
def pbUseItem(bag,item,bagscene = nil)
|
||||||
itm = GameData::Item.get(item)
|
itm = GameData::Item.get(item)
|
||||||
useType = itm.field_use
|
useType = itm.field_use
|
||||||
if itm.is_machine? # TM or TR or HM
|
if itm.is_machine? # TM or TR or HM
|
||||||
@@ -794,7 +794,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Give an item to a Pokémon to hold, and take a held item from a Pokémon
|
# Give an item to a Pokémon to hold, and take a held item from a Pokémon
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbGiveItemToPokemon(item,pkmn,scene,pkmnid=0)
|
def pbGiveItemToPokemon(item,pkmn,scene,pkmnid = 0)
|
||||||
newitemname = GameData::Item.get(item).name
|
newitemname = GameData::Item.get(item).name
|
||||||
if pkmn.egg?
|
if pkmn.egg?
|
||||||
scene.pbDisplay(_INTL("Eggs can't hold items."))
|
scene.pbDisplay(_INTL("Eggs can't hold items."))
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Register contacts
|
# Register contacts
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbPhoneRegisterNPC(ident,name,mapid,showmessage=true)
|
def pbPhoneRegisterNPC(ident,name,mapid,showmessage = true)
|
||||||
$PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers
|
$PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers
|
||||||
exists = pbFindPhoneTrainer(ident,name)
|
exists = pbFindPhoneTrainer(ident,name)
|
||||||
if exists
|
if exists
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ def pbPokeRadarCancel
|
|||||||
$game_temp.poke_radar_data = nil
|
$game_temp.poke_radar_data = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbPokeRadarHighlightGrass(showmessage=true)
|
def pbPokeRadarHighlightGrass(showmessage = true)
|
||||||
grasses = [] # x, y, ring (0-3 inner to outer), rarity
|
grasses = [] # x, y, ring (0-3 inner to outer), rarity
|
||||||
# Choose 1 random tile from each ring around the player
|
# Choose 1 random tile from each ring around the player
|
||||||
for i in 0...4
|
for i in 0...4
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ def pbMoveToMailbox(pokemon)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbStoreMail(pkmn,item,message,poke1=nil,poke2=nil,poke3=nil)
|
def pbStoreMail(pkmn,item,message,poke1 = nil,poke2 = nil,poke3 = nil)
|
||||||
raise _INTL("Pokémon already has mail") if pkmn.mail
|
raise _INTL("Pokémon already has mail") if pkmn.mail
|
||||||
pkmn.mail = Mail.new(item, message, $player.name, poke1, poke2, poke3)
|
pkmn.mail = Mail.new(item, message, $player.name, poke1, poke2, poke3)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbDisplayMail(mail,_bearer=nil)
|
def pbDisplayMail(mail,_bearer = nil)
|
||||||
sprites = {}
|
sprites = {}
|
||||||
viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||||
viewport.z = 99999
|
viewport.z = 99999
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class ItemIconSprite < SpriteWrapper
|
|||||||
ANIM_ICON_SIZE = 48
|
ANIM_ICON_SIZE = 48
|
||||||
FRAMES_PER_CYCLE = Graphics.frame_rate
|
FRAMES_PER_CYCLE = Graphics.frame_rate
|
||||||
|
|
||||||
def initialize(x,y,item,viewport=nil)
|
def initialize(x,y,item,viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
@animbitmap = nil
|
@animbitmap = nil
|
||||||
@animframe = 0
|
@animframe = 0
|
||||||
@@ -42,7 +42,7 @@ class ItemIconSprite < SpriteWrapper
|
|||||||
@forceitemchange = false
|
@forceitemchange = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def setOffset(offset=PictureOrigin::Center)
|
def setOffset(offset = PictureOrigin::Center)
|
||||||
@offset = offset
|
@offset = offset
|
||||||
changeOrigin
|
changeOrigin
|
||||||
end
|
end
|
||||||
@@ -116,7 +116,7 @@ end
|
|||||||
# Item held icon (used in the party screen)
|
# Item held icon (used in the party screen)
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class HeldItemIconSprite < SpriteWrapper
|
class HeldItemIconSprite < SpriteWrapper
|
||||||
def initialize(x,y,pokemon,viewport=nil)
|
def initialize(x,y,pokemon,viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class RelicStoneScene
|
|||||||
@viewport.dispose
|
@viewport.dispose
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbDisplay(msg,brief=false)
|
def pbDisplay(msg,brief = false)
|
||||||
UIHelper.pbDisplay(@sprites["msgwindow"],msg,brief) { pbUpdate }
|
UIHelper.pbDisplay(@sprites["msgwindow"],msg,brief) { pbUpdate }
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ end
|
|||||||
class Battle
|
class Battle
|
||||||
alias __shadow__pbCanUseItemOnPokemon? pbCanUseItemOnPokemon?
|
alias __shadow__pbCanUseItemOnPokemon? pbCanUseItemOnPokemon?
|
||||||
|
|
||||||
def pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages=true)
|
def pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages = true)
|
||||||
ret = __shadow__pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages)
|
ret = __shadow__pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages)
|
||||||
if ret && pkmn.hyper_mode && ![:JOYSCENT, :EXCITESCENT, :VIVIDSCENT].include?(item)
|
if ret && pkmn.hyper_mode && ![:JOYSCENT, :EXCITESCENT, :VIVIDSCENT].include?(item)
|
||||||
scene.pbDisplay(_INTL("This item can't be used on that Pokémon."))
|
scene.pbDisplay(_INTL("This item can't be used on that Pokémon."))
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Pokémon sprite (used out of battle)
|
# Pokémon sprite (used out of battle)
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokemonSprite < SpriteWrapper
|
class PokemonSprite < SpriteWrapper
|
||||||
def initialize(viewport=nil)
|
def initialize(viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
@_iconbitmap = nil
|
@_iconbitmap = nil
|
||||||
end
|
end
|
||||||
@@ -20,7 +20,7 @@ class PokemonSprite < SpriteWrapper
|
|||||||
self.bitmap = nil
|
self.bitmap = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def setOffset(offset=PictureOrigin::Center)
|
def setOffset(offset = PictureOrigin::Center)
|
||||||
@offset = offset
|
@offset = offset
|
||||||
changeOrigin
|
changeOrigin
|
||||||
end
|
end
|
||||||
@@ -46,7 +46,7 @@ class PokemonSprite < SpriteWrapper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def setPokemonBitmap(pokemon,back=false)
|
def setPokemonBitmap(pokemon,back = false)
|
||||||
@_iconbitmap.dispose if @_iconbitmap
|
@_iconbitmap.dispose if @_iconbitmap
|
||||||
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back) : nil
|
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back) : nil
|
||||||
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
||||||
@@ -54,7 +54,7 @@ class PokemonSprite < SpriteWrapper
|
|||||||
changeOrigin
|
changeOrigin
|
||||||
end
|
end
|
||||||
|
|
||||||
def setPokemonBitmapSpecies(pokemon,species,back=false)
|
def setPokemonBitmapSpecies(pokemon,species,back = false)
|
||||||
@_iconbitmap.dispose if @_iconbitmap
|
@_iconbitmap.dispose if @_iconbitmap
|
||||||
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back, species) : nil
|
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back, species) : nil
|
||||||
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
||||||
@@ -87,7 +87,7 @@ class PokemonIconSprite < SpriteWrapper
|
|||||||
attr_accessor :active
|
attr_accessor :active
|
||||||
attr_reader :pokemon
|
attr_reader :pokemon
|
||||||
|
|
||||||
def initialize(pokemon,viewport=nil)
|
def initialize(pokemon,viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
@selected = false
|
@selected = false
|
||||||
@active = false
|
@active = false
|
||||||
@@ -138,7 +138,7 @@ class PokemonIconSprite < SpriteWrapper
|
|||||||
changeOrigin
|
changeOrigin
|
||||||
end
|
end
|
||||||
|
|
||||||
def setOffset(offset=PictureOrigin::Center)
|
def setOffset(offset = PictureOrigin::Center)
|
||||||
@offset = offset
|
@offset = offset
|
||||||
changeOrigin
|
changeOrigin
|
||||||
end
|
end
|
||||||
@@ -223,7 +223,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
|||||||
attr_reader :form
|
attr_reader :form
|
||||||
attr_reader :shiny
|
attr_reader :shiny
|
||||||
|
|
||||||
def initialize(species,viewport=nil)
|
def initialize(species,viewport = nil)
|
||||||
super(viewport)
|
super(viewport)
|
||||||
@species = species
|
@species = species
|
||||||
@gender = 0
|
@gender = 0
|
||||||
@@ -260,7 +260,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
|||||||
refresh
|
refresh
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbSetParams(species,gender,form,shiny=false)
|
def pbSetParams(species,gender,form,shiny = false)
|
||||||
@species = species
|
@species = species
|
||||||
@gender = gender
|
@gender = gender
|
||||||
@form = form
|
@form = form
|
||||||
@@ -268,7 +268,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
|||||||
refresh
|
refresh
|
||||||
end
|
end
|
||||||
|
|
||||||
def setOffset(offset=PictureOrigin::Center)
|
def setOffset(offset = PictureOrigin::Center)
|
||||||
@offset = offset
|
@offset = offset
|
||||||
changeOrigin
|
changeOrigin
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ class PokemonStorage
|
|||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](x,y=nil)
|
def [](x,y = nil)
|
||||||
if y==nil
|
if y==nil
|
||||||
return (x==-1) ? self.party : @boxes[x]
|
return (x==-1) ? self.party : @boxes[x]
|
||||||
else
|
else
|
||||||
@@ -338,7 +338,7 @@ class RegionalStorage
|
|||||||
getCurrentStorage.currentBox = value
|
getCurrentStorage.currentBox = value
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](x,y=nil)
|
def [](x,y = nil)
|
||||||
getCurrentStorage[x,y]
|
getCurrentStorage[x,y]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user