mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 06:04:59 +00:00
Added decent spacing to all scripts thanks to Rubocop
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
class LocationWindow
|
||||
def initialize(name)
|
||||
@window = Window_AdvancedTextPokemon.new(name)
|
||||
@window.resizeToFit(name,Graphics.width)
|
||||
@window.resizeToFit(name, Graphics.width)
|
||||
@window.x = 0
|
||||
@window.y = -@window.height
|
||||
@window.viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@window.viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@window.viewport.z = 99999
|
||||
@currentmap = $game_map.map_id
|
||||
@frames = 0
|
||||
@@ -24,15 +24,15 @@ class LocationWindow
|
||||
def update
|
||||
return if @window.disposed?
|
||||
@window.update
|
||||
if $game_temp.message_window_showing || @currentmap!=$game_map.map_id
|
||||
if $game_temp.message_window_showing || @currentmap != $game_map.map_id
|
||||
@window.dispose
|
||||
return
|
||||
end
|
||||
if @frames > Graphics.frame_rate * 2
|
||||
@window.y -= 4
|
||||
@window.dispose if @window.y+@window.height<0
|
||||
@window.dispose if @window.y + @window.height < 0
|
||||
else
|
||||
@window.y += 4 if @window.y<0
|
||||
@window.y += 4 if @window.y < 0
|
||||
@frames += 1
|
||||
end
|
||||
end
|
||||
@@ -48,7 +48,7 @@ class DarknessSprite < SpriteWrapper
|
||||
|
||||
def initialize(viewport = nil)
|
||||
super(viewport)
|
||||
@darkness = BitmapWrapper.new(Graphics.width,Graphics.height)
|
||||
@darkness = BitmapWrapper.new(Graphics.width, Graphics.height)
|
||||
@radius = radiusMin
|
||||
self.bitmap = @darkness
|
||||
self.z = 99998
|
||||
@@ -69,18 +69,18 @@ class DarknessSprite < SpriteWrapper
|
||||
end
|
||||
|
||||
def refresh
|
||||
@darkness.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0,255))
|
||||
cx = Graphics.width/2
|
||||
cy = Graphics.height/2
|
||||
@darkness.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 255))
|
||||
cx = Graphics.width / 2
|
||||
cy = Graphics.height / 2
|
||||
cradius = @radius
|
||||
numfades = 5
|
||||
for i in 1..numfades
|
||||
for j in cx-cradius..cx+cradius
|
||||
for j in cx - cradius..cx + cradius
|
||||
diff2 = (cradius * cradius) - ((j - cx) * (j - cx))
|
||||
diff = Math.sqrt(diff2)
|
||||
@darkness.fill_rect(j,cy-diff,1,diff*2,Color.new(0,0,0,255.0*(numfades-i)/numfades))
|
||||
@darkness.fill_rect(j, cy - diff, 1, diff * 2, Color.new(0, 0, 0, 255.0 * (numfades - i) / numfades))
|
||||
end
|
||||
cradius = (cradius*0.9).floor
|
||||
cradius = (cradius * 0.9).floor
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -91,10 +91,10 @@ end
|
||||
# Light effects
|
||||
#===============================================================================
|
||||
class LightEffect
|
||||
def initialize(event,viewport = nil,map = nil,filename = nil)
|
||||
@light = IconSprite.new(0,0,viewport)
|
||||
if filename!=nil && filename!="" && pbResolveBitmap("Graphics/Pictures/"+filename)
|
||||
@light.setBitmap("Graphics/Pictures/"+filename)
|
||||
def initialize(event, viewport = nil, map = nil, filename = nil)
|
||||
@light = IconSprite.new(0, 0, viewport)
|
||||
if filename != nil && filename != "" && pbResolveBitmap("Graphics/Pictures/" + filename)
|
||||
@light.setBitmap("Graphics/Pictures/" + filename)
|
||||
else
|
||||
@light.setBitmap("Graphics/Pictures/LE")
|
||||
end
|
||||
@@ -123,10 +123,10 @@ end
|
||||
|
||||
|
||||
class LightEffect_Lamp < LightEffect
|
||||
def initialize(event,viewport = nil,map = nil)
|
||||
def initialize(event, viewport = nil, map = nil)
|
||||
lamp = AnimatedBitmap.new("Graphics/Pictures/LE")
|
||||
@light = Sprite.new(viewport)
|
||||
@light.bitmap = Bitmap.new(128,64)
|
||||
@light.bitmap = Bitmap.new(128, 64)
|
||||
src_rect = Rect.new(0, 0, 64, 64)
|
||||
@light.bitmap.blt(0, 0, lamp.bitmap, src_rect)
|
||||
@light.bitmap.blt(20, 0, lamp.bitmap, src_rect)
|
||||
@@ -177,15 +177,15 @@ class LightEffect_DayNight < LightEffect
|
||||
return if !@light || !@event
|
||||
super
|
||||
shade = PBDayNight.getShade
|
||||
if shade>=144 # If light enough, call it fully day
|
||||
if shade >= 144 # If light enough, call it fully day
|
||||
shade = 255
|
||||
elsif shade<=64 # If dark enough, call it fully night
|
||||
elsif shade <= 64 # If dark enough, call it fully night
|
||||
shade = 0
|
||||
else
|
||||
shade = 255-(255*(144-shade)/(144-64))
|
||||
shade = 255 - (255 * (144 - shade) / (144 - 64))
|
||||
end
|
||||
@light.opacity = 255-shade
|
||||
if @light.opacity>0
|
||||
@light.opacity = 255 - shade
|
||||
if @light.opacity > 0
|
||||
if (Object.const_defined?(:ScreenPosHelper) rescue false)
|
||||
@light.x = ScreenPosHelper.pbScreenX(@event)
|
||||
@light.y = ScreenPosHelper.pbScreenY(@event) - Game_Map::TILE_HEIGHT / 2
|
||||
@@ -205,22 +205,22 @@ end
|
||||
|
||||
|
||||
|
||||
Events.onSpritesetCreate += proc { |_sender,e|
|
||||
Events.onSpritesetCreate += proc { |_sender, e|
|
||||
spriteset = e[0] # Spriteset being created
|
||||
viewport = e[1] # Viewport used for tilemap and characters
|
||||
map = spriteset.map # Map associated with the spriteset (not necessarily the current map)
|
||||
for i in map.events.keys
|
||||
if map.events[i].name[/^outdoorlight\((\w+)\)$/i]
|
||||
filename = $~[1].to_s
|
||||
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],viewport,map,filename))
|
||||
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i], viewport, map, filename))
|
||||
elsif map.events[i].name[/^outdoorlight$/i]
|
||||
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],viewport,map))
|
||||
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i], viewport, map))
|
||||
elsif map.events[i].name[/^light\((\w+)\)$/i]
|
||||
filename = $~[1].to_s
|
||||
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],viewport,map,filename))
|
||||
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i], viewport, map, filename))
|
||||
elsif map.events[i].name[/^light$/i]
|
||||
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],viewport,map))
|
||||
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i], viewport, map))
|
||||
end
|
||||
end
|
||||
spriteset.addUserSprite(Particle_Engine.new(viewport,map))
|
||||
spriteset.addUserSprite(Particle_Engine.new(viewport, map))
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
#===============================================================================
|
||||
def pbCaveEntranceEx(exiting)
|
||||
# Create bitmap
|
||||
sprite = BitmapSprite.new(Graphics.width,Graphics.height)
|
||||
sprite = BitmapSprite.new(Graphics.width, Graphics.height)
|
||||
sprite.z = 100000
|
||||
# Define values used for the animation
|
||||
totalFrames = (Graphics.frame_rate*0.4).floor
|
||||
increment = (255.0/totalFrames).ceil
|
||||
totalFrames = (Graphics.frame_rate * 0.4).floor
|
||||
increment = (255.0 / totalFrames).ceil
|
||||
totalBands = 15
|
||||
bandheight = ((Graphics.height/2.0)-10)/totalBands
|
||||
bandwidth = ((Graphics.width/2.0)-12)/totalBands
|
||||
bandheight = ((Graphics.height / 2.0) - 10) / totalBands
|
||||
bandwidth = ((Graphics.width / 2.0) - 12) / totalBands
|
||||
# Create initial array of band colors (black if exiting, white if entering)
|
||||
grays = Array.new(totalBands) { |i| (exiting) ? 0 : 255 }
|
||||
# Animate bands changing color
|
||||
@@ -19,47 +19,47 @@ def pbCaveEntranceEx(exiting)
|
||||
y = 0
|
||||
# Calculate color of each band
|
||||
for k in 0...totalBands
|
||||
next if k>=totalBands*j/totalFrames
|
||||
next if k >= totalBands * j / totalFrames
|
||||
inc = increment
|
||||
inc *= -1 if exiting
|
||||
grays[k] -= inc
|
||||
grays[k] = 0 if grays[k]<0
|
||||
grays[k] = 0 if grays[k] < 0
|
||||
end
|
||||
# Draw gray rectangles
|
||||
rectwidth = Graphics.width
|
||||
rectheight = Graphics.height
|
||||
for i in 0...totalBands
|
||||
currentGray = grays[i]
|
||||
sprite.bitmap.fill_rect(Rect.new(x,y,rectwidth,rectheight),
|
||||
Color.new(currentGray,currentGray,currentGray))
|
||||
sprite.bitmap.fill_rect(Rect.new(x, y, rectwidth, rectheight),
|
||||
Color.new(currentGray, currentGray, currentGray))
|
||||
x += bandwidth
|
||||
y += bandheight
|
||||
rectwidth -= bandwidth*2
|
||||
rectheight -= bandheight*2
|
||||
rectwidth -= bandwidth * 2
|
||||
rectheight -= bandheight * 2
|
||||
end
|
||||
Graphics.update
|
||||
Input.update
|
||||
end
|
||||
# Set the tone at end of band animation
|
||||
if exiting
|
||||
pbToneChangeAll(Tone.new(255,255,255),0)
|
||||
pbToneChangeAll(Tone.new(255, 255, 255), 0)
|
||||
else
|
||||
pbToneChangeAll(Tone.new(-255,-255,-255),0)
|
||||
pbToneChangeAll(Tone.new(-255, -255, -255), 0)
|
||||
end
|
||||
# Animate fade to white (if exiting) or black (if entering)
|
||||
for j in 0...totalFrames
|
||||
if exiting
|
||||
sprite.color = Color.new(255,255,255,j*increment)
|
||||
sprite.color = Color.new(255, 255, 255, j * increment)
|
||||
else
|
||||
sprite.color = Color.new(0,0,0,j*increment)
|
||||
sprite.color = Color.new(0, 0, 0, j * increment)
|
||||
end
|
||||
Graphics.update
|
||||
Input.update
|
||||
end
|
||||
# Set the tone at end of fading animation
|
||||
pbToneChangeAll(Tone.new(0,0,0),8)
|
||||
pbToneChangeAll(Tone.new(0, 0, 0), 8)
|
||||
# Pause briefly
|
||||
(Graphics.frame_rate/10).times do
|
||||
(Graphics.frame_rate / 10).times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
end
|
||||
@@ -88,7 +88,7 @@ def pbStartOver(gameover = false)
|
||||
end
|
||||
$stats.blacked_out_count += 1
|
||||
$player.heal_party
|
||||
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0
|
||||
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId >= 0
|
||||
if gameover
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back to a Pokémon Center."))
|
||||
else
|
||||
@@ -106,9 +106,9 @@ def pbStartOver(gameover = false)
|
||||
else
|
||||
homedata = GameData::PlayerMetadata.get($player.character_ID)&.home
|
||||
homedata = GameData::Metadata.get.home if !homedata
|
||||
if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata",homedata[0]))
|
||||
if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata", homedata[0]))
|
||||
if $DEBUG
|
||||
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))
|
||||
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.", homedata[0]))
|
||||
end
|
||||
$player.heal_party
|
||||
return
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
# Constant checks
|
||||
#===============================================================================
|
||||
# Pokérus check
|
||||
Events.onMapUpdate += proc { |_sender,_e|
|
||||
Events.onMapUpdate += proc { |_sender, _e|
|
||||
next if !$player
|
||||
last = $PokemonGlobal.pokerusTime
|
||||
now = pbGetTimeNow
|
||||
if !last || last.year!=now.year || last.month!=now.month || last.day!=now.day
|
||||
if !last || last.year != now.year || last.month != now.month || last.day != now.day
|
||||
for i in $player.pokemon_party
|
||||
i.lowerPokerusCount
|
||||
end
|
||||
@@ -19,7 +19,7 @@ Events.onMapUpdate += proc { |_sender,_e|
|
||||
def pbPokerus?
|
||||
return false if $game_switches[Settings::SEEN_POKERUS_SWITCH]
|
||||
for i in $player.party
|
||||
return true if i.pokerusStage==1
|
||||
return true if i.pokerusStage == 1
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -46,12 +46,12 @@ def pbBatteryLow?
|
||||
return false
|
||||
end
|
||||
|
||||
Events.onMapUpdate += proc { |_sender,_e|
|
||||
Events.onMapUpdate += proc { |_sender, _e|
|
||||
if !$game_temp.warned_low_battery && pbBatteryLow?
|
||||
if !$game_temp.in_menu && !$game_temp.in_battle &&
|
||||
!$game_player.move_route_forcing && !$game_temp.message_window_showing &&
|
||||
!pbMapInterpreterRunning?
|
||||
if pbGetTimeNow.sec==0
|
||||
if pbGetTimeNow.sec == 0
|
||||
pbMessage(_INTL("The game has detected that the battery is low. You should save soon to avoid losing your progress."))
|
||||
$game_temp.warned_low_battery = true
|
||||
end
|
||||
@@ -77,19 +77,19 @@ Events.onMapUpdate += proc { |_sender,_e|
|
||||
Events.onStepTaken += proc {
|
||||
$PokemonGlobal.happinessSteps = 0 if !$PokemonGlobal.happinessSteps
|
||||
$PokemonGlobal.happinessSteps += 1
|
||||
if $PokemonGlobal.happinessSteps>=128
|
||||
if $PokemonGlobal.happinessSteps >= 128
|
||||
for pkmn in $player.able_party
|
||||
pkmn.changeHappiness("walking") if rand(2)==0
|
||||
pkmn.changeHappiness("walking") if rand(2) == 0
|
||||
end
|
||||
$PokemonGlobal.happinessSteps = 0
|
||||
end
|
||||
}
|
||||
|
||||
# Poison party Pokémon
|
||||
Events.onStepTakenTransferPossible += proc { |_sender,e|
|
||||
Events.onStepTakenTransferPossible += proc { |_sender, e|
|
||||
handled = e[0]
|
||||
next if handled[0]
|
||||
if $PokemonGlobal.stepcount%4==0 && Settings::POISON_IN_FIELD
|
||||
if $PokemonGlobal.stepcount % 4 == 0 && Settings::POISON_IN_FIELD
|
||||
flashed = false
|
||||
for i in $player.able_party
|
||||
if i.status == :POISON && !i.hasAbility?(:IMMUNITY)
|
||||
@@ -97,15 +97,15 @@ Events.onStepTakenTransferPossible += proc { |_sender,e|
|
||||
pbFlash(Color.new(255, 0, 0, 128), 8)
|
||||
flashed = true
|
||||
end
|
||||
i.hp -= 1 if i.hp>1 || Settings::POISON_FAINT_IN_FIELD
|
||||
if i.hp==1 && !Settings::POISON_FAINT_IN_FIELD
|
||||
i.hp -= 1 if i.hp > 1 || Settings::POISON_FAINT_IN_FIELD
|
||||
if i.hp == 1 && !Settings::POISON_FAINT_IN_FIELD
|
||||
i.status = :NONE
|
||||
pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\1",i.name))
|
||||
pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\1", i.name))
|
||||
next
|
||||
elsif i.hp==0
|
||||
elsif i.hp == 0
|
||||
i.changeHappiness("faint")
|
||||
i.status = :NONE
|
||||
pbMessage(_INTL("{1} fainted...",i.name))
|
||||
pbMessage(_INTL("{1} fainted...", i.name))
|
||||
end
|
||||
if $player.able_pokemon_count == 0
|
||||
handled[0] = true
|
||||
@@ -127,12 +127,12 @@ def pbCheckAllFainted
|
||||
end
|
||||
|
||||
# Gather soot from soot grass
|
||||
Events.onStepTakenFieldMovement += proc { |_sender,e|
|
||||
Events.onStepTakenFieldMovement += proc { |_sender, e|
|
||||
event = e[0] # Get the event affected by field movement
|
||||
thistile = $map_factory.getRealTilePos(event.map.map_id,event.x,event.y)
|
||||
thistile = $map_factory.getRealTilePos(event.map.map_id, event.x, event.y)
|
||||
map = $map_factory.getMap(thistile[0])
|
||||
for i in [2, 1, 0]
|
||||
tile_id = map.data[thistile[1],thistile[2],i]
|
||||
tile_id = map.data[thistile[1], thistile[2], i]
|
||||
next if tile_id == nil
|
||||
next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass
|
||||
if event == $game_player && $bag.has?(:SOOTSACK)
|
||||
@@ -167,7 +167,7 @@ Events.onStepTakenFieldMovement += proc { |_sender, e|
|
||||
|
||||
def pbOnStepTaken(eventTriggered)
|
||||
if $game_player.move_route_forcing || pbMapInterpreterRunning?
|
||||
Events.onStepTakenFieldMovement.trigger(nil,$game_player)
|
||||
Events.onStepTakenFieldMovement.trigger(nil, $game_player)
|
||||
return
|
||||
end
|
||||
$PokemonGlobal.stepcount = 0 if !$PokemonGlobal.stepcount
|
||||
@@ -177,7 +177,7 @@ def pbOnStepTaken(eventTriggered)
|
||||
Events.onStepTaken.trigger(nil)
|
||||
# Events.onStepTakenFieldMovement.trigger(nil,$game_player)
|
||||
handled = [nil]
|
||||
Events.onStepTakenTransferPossible.trigger(nil,handled)
|
||||
Events.onStepTakenTransferPossible.trigger(nil, handled)
|
||||
return if handled[0]
|
||||
pbBattleOnStepTaken(repel_active) if !eventTriggered && !$game_temp.in_menu
|
||||
$game_temp.encounter_triggered = false # This info isn't needed here
|
||||
@@ -311,9 +311,9 @@ Events.onMapSceneChange += proc { |_sender, e|
|
||||
# Event locations, terrain tags
|
||||
#===============================================================================
|
||||
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
|
||||
def pbFacingTile(direction = nil,event = nil)
|
||||
return $map_factory.getFacingTile(direction,event) if $map_factory
|
||||
return pbFacingTileRegular(direction,event)
|
||||
def pbFacingTile(direction = nil, event = nil)
|
||||
return $map_factory.getFacingTile(direction, event) if $map_factory
|
||||
return pbFacingTileRegular(direction, event)
|
||||
end
|
||||
|
||||
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
|
||||
@@ -395,11 +395,11 @@ end
|
||||
#===============================================================================
|
||||
# Audio playing
|
||||
#===============================================================================
|
||||
def pbCueBGM(bgm,seconds,volume = nil,pitch = nil)
|
||||
def pbCueBGM(bgm, seconds, volume = nil, pitch = nil)
|
||||
return if !bgm
|
||||
bgm = pbResolveAudioFile(bgm,volume,pitch)
|
||||
bgm = pbResolveAudioFile(bgm, volume, pitch)
|
||||
playingBGM = $game_system.playing_bgm
|
||||
if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch
|
||||
if !playingBGM || playingBGM.name != bgm.name || playingBGM.pitch != bgm.pitch
|
||||
pbBGMFade(seconds)
|
||||
if !$game_temp.cue_bgm_frame_delay
|
||||
$game_temp.cue_bgm_frame_delay = (seconds * Graphics.frame_rate) * 3 / 5
|
||||
@@ -484,30 +484,30 @@ end
|
||||
|
||||
|
||||
|
||||
def pbMoveRoute(event,commands,waitComplete = false)
|
||||
def pbMoveRoute(event, commands, waitComplete = false)
|
||||
route = RPG::MoveRoute.new
|
||||
route.repeat = false
|
||||
route.skippable = true
|
||||
route.list.clear
|
||||
route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOn))
|
||||
i=0
|
||||
while i<commands.length
|
||||
i = 0
|
||||
while i < commands.length
|
||||
case commands[i]
|
||||
when PBMoveRoute::Wait, PBMoveRoute::SwitchOn, PBMoveRoute::SwitchOff,
|
||||
PBMoveRoute::ChangeSpeed, PBMoveRoute::ChangeFreq, PBMoveRoute::Opacity,
|
||||
PBMoveRoute::Blending, PBMoveRoute::PlaySE, PBMoveRoute::Script
|
||||
route.list.push(RPG::MoveCommand.new(commands[i],[commands[i+1]]))
|
||||
route.list.push(RPG::MoveCommand.new(commands[i], [commands[i + 1]]))
|
||||
i += 1
|
||||
when PBMoveRoute::ScriptAsync
|
||||
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Script,[commands[i+1]]))
|
||||
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Wait,[0]))
|
||||
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Script, [commands[i + 1]]))
|
||||
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Wait, [0]))
|
||||
i += 1
|
||||
when PBMoveRoute::Jump
|
||||
route.list.push(RPG::MoveCommand.new(commands[i],[commands[i+1],commands[i+2]]))
|
||||
route.list.push(RPG::MoveCommand.new(commands[i], [commands[i + 1], commands[i + 2]]))
|
||||
i += 2
|
||||
when PBMoveRoute::Graphic
|
||||
route.list.push(RPG::MoveCommand.new(commands[i],
|
||||
[commands[i+1],commands[i+2],commands[i+3],commands[i+4]]))
|
||||
[commands[i + 1], commands[i + 2], commands[i + 3], commands[i + 4]]))
|
||||
i += 4
|
||||
else
|
||||
route.list.push(RPG::MoveCommand.new(commands[i]))
|
||||
@@ -535,12 +535,12 @@ end
|
||||
#===============================================================================
|
||||
# Player/event movement in the field
|
||||
#===============================================================================
|
||||
def pbLedge(_xOffset,_yOffset)
|
||||
def pbLedge(_xOffset, _yOffset)
|
||||
if $game_player.pbFacingTerrainTag.ledge
|
||||
if pbJumpToward(2,true)
|
||||
$scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID,$game_player.x,$game_player.y,true,1)
|
||||
if pbJumpToward(2, true)
|
||||
$scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID, $game_player.x, $game_player.y, true, 1)
|
||||
$game_player.increase_steps
|
||||
$game_player.check_event_trigger_here([1,2])
|
||||
$game_player.check_event_trigger_here([1, 2])
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -574,7 +574,7 @@ def pbSlideOnIce
|
||||
$PokemonGlobal.sliding = false
|
||||
end
|
||||
|
||||
def pbTurnTowardEvent(event,otherEvent)
|
||||
def pbTurnTowardEvent(event, otherEvent)
|
||||
sx = 0
|
||||
sy = 0
|
||||
if $map_factory
|
||||
@@ -612,7 +612,7 @@ def pbMoveTowardPlayer(event)
|
||||
$PokemonMap.addMovedEvent(event.id) if $PokemonMap
|
||||
end
|
||||
|
||||
def pbJumpToward(dist = 1,playSound = false,cancelSurf = false)
|
||||
def pbJumpToward(dist = 1, playSound = false, cancelSurf = false)
|
||||
x = $game_player.x
|
||||
y = $game_player.y
|
||||
case $game_player.direction
|
||||
@@ -621,7 +621,7 @@ def pbJumpToward(dist = 1,playSound = false,cancelSurf = false)
|
||||
when 6 then $game_player.jump(dist, 0) # right
|
||||
when 8 then $game_player.jump(0, -dist) # up
|
||||
end
|
||||
if $game_player.x!=x || $game_player.y!=y
|
||||
if $game_player.x != x || $game_player.y != y
|
||||
pbSEPlay("Player jump") if playSound
|
||||
$PokemonEncounters.reset_step_count if cancelSurf
|
||||
$game_temp.ending_surf = true if cancelSurf
|
||||
@@ -666,7 +666,7 @@ def pbSetEscapePoint
|
||||
yco += 1
|
||||
dir = 2
|
||||
end
|
||||
$PokemonGlobal.escapePoint = [$game_map.map_id,xco,yco,dir]
|
||||
$PokemonGlobal.escapePoint = [$game_map.map_id, xco, yco, dir]
|
||||
end
|
||||
|
||||
def pbEraseEscapePoint
|
||||
@@ -706,26 +706,26 @@ end
|
||||
#===============================================================================
|
||||
# Picking up an item found on the ground
|
||||
#===============================================================================
|
||||
def pbItemBall(item,quantity = 1)
|
||||
def pbItemBall(item, quantity = 1)
|
||||
item = GameData::Item.get(item)
|
||||
return false if !item || quantity<1
|
||||
itemname = (quantity>1) ? item.name_plural : item.name
|
||||
return false if !item || quantity < 1
|
||||
itemname = (quantity > 1) ? item.name_plural : item.name
|
||||
pocket = item.pocket
|
||||
move = item.move
|
||||
if $bag.add(item, quantity) # If item can be picked up
|
||||
meName = (item.is_key_item?) ? "Key item get" : "Item get"
|
||||
if item == :LEFTOVERS
|
||||
pbMessage(_INTL("\\me[{1}]You found some \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
|
||||
pbMessage(_INTL("\\me[{1}]You found some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
|
||||
elsif item == :DNASPLICERS
|
||||
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
|
||||
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
|
||||
elsif item.is_machine? # TM or HM
|
||||
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,GameData::Move.get(move).name))
|
||||
elsif quantity>1
|
||||
pbMessage(_INTL("\\me[{1}]You found {2} \\c[1]{3}\\c[0]!\\wtnp[30]",meName,quantity,itemname))
|
||||
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name))
|
||||
elsif quantity > 1
|
||||
pbMessage(_INTL("\\me[{1}]You found {2} \\c[1]{3}\\c[0]!\\wtnp[30]", meName, quantity, itemname))
|
||||
elsif itemname.starts_with_vowel?
|
||||
pbMessage(_INTL("\\me[{1}]You found an \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
|
||||
pbMessage(_INTL("\\me[{1}]You found an \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
|
||||
else
|
||||
pbMessage(_INTL("\\me[{1}]You found a \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
|
||||
pbMessage(_INTL("\\me[{1}]You found a \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
|
||||
end
|
||||
pbMessage(_INTL("You put the {1} in\\nyour Bag's <icon=bagPocket{2}>\\c[1]{3}\\c[0] pocket.",
|
||||
itemname, pocket, PokemonBag.pocket_names[pocket - 1]))
|
||||
@@ -733,15 +733,15 @@ def pbItemBall(item,quantity = 1)
|
||||
end
|
||||
# Can't add the item
|
||||
if item == :LEFTOVERS
|
||||
pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
|
||||
pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
|
||||
elsif item.is_machine? # TM or HM
|
||||
pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,GameData::Move.get(move).name))
|
||||
elsif quantity>1
|
||||
pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname))
|
||||
pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]", itemname, GameData::Move.get(move).name))
|
||||
elsif quantity > 1
|
||||
pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]", quantity, itemname))
|
||||
elsif itemname.starts_with_vowel?
|
||||
pbMessage(_INTL("You found an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
|
||||
pbMessage(_INTL("You found an \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
|
||||
else
|
||||
pbMessage(_INTL("You found a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
|
||||
pbMessage(_INTL("You found a \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
|
||||
end
|
||||
pbMessage(_INTL("But your Bag is full..."))
|
||||
return false
|
||||
@@ -752,25 +752,25 @@ end
|
||||
#===============================================================================
|
||||
# Being given an item
|
||||
#===============================================================================
|
||||
def pbReceiveItem(item,quantity = 1)
|
||||
def pbReceiveItem(item, quantity = 1)
|
||||
item = GameData::Item.get(item)
|
||||
return false if !item || quantity<1
|
||||
itemname = (quantity>1) ? item.name_plural : item.name
|
||||
return false if !item || quantity < 1
|
||||
itemname = (quantity > 1) ? item.name_plural : item.name
|
||||
pocket = item.pocket
|
||||
move = item.move
|
||||
meName = (item.is_key_item?) ? "Key item get" : "Item get"
|
||||
if item == :LEFTOVERS
|
||||
pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
|
||||
pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
|
||||
elsif item == :DNASPLICERS
|
||||
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
|
||||
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
|
||||
elsif item.is_machine? # TM or HM
|
||||
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,GameData::Move.get(move).name))
|
||||
elsif quantity>1
|
||||
pbMessage(_INTL("\\me[{1}]You obtained {2} \\c[1]{3}\\c[0]!\\wtnp[30]",meName,quantity,itemname))
|
||||
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name))
|
||||
elsif quantity > 1
|
||||
pbMessage(_INTL("\\me[{1}]You obtained {2} \\c[1]{3}\\c[0]!\\wtnp[30]", meName, quantity, itemname))
|
||||
elsif itemname.starts_with_vowel?
|
||||
pbMessage(_INTL("\\me[{1}]You obtained an \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
|
||||
pbMessage(_INTL("\\me[{1}]You obtained an \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
|
||||
else
|
||||
pbMessage(_INTL("\\me[{1}]You obtained a \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
|
||||
pbMessage(_INTL("\\me[{1}]You obtained a \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
|
||||
end
|
||||
if $bag.add(item, quantity) # If item can be added
|
||||
pbMessage(_INTL("You put the {1} in\\nyour Bag's <icon=bagPocket{2}>\\c[1]{3}\\c[0] pocket.",
|
||||
|
||||
@@ -80,7 +80,7 @@ def setBattleRule(*args)
|
||||
$game_temp.add_battle_rule(arg)
|
||||
end
|
||||
end
|
||||
raise _INTL("Argument {1} expected a variable after it but didn't have one.",r) if r
|
||||
raise _INTL("Argument {1} expected a variable after it but didn't have one.", r) if r
|
||||
end
|
||||
|
||||
def pbNewBattleScene
|
||||
@@ -103,10 +103,10 @@ def pbPrepareBattle(battle)
|
||||
# Whether the player gains/loses money at the end of the battle (default: true)
|
||||
battle.moneyGain = battleRules["moneyGain"] if !battleRules["moneyGain"].nil?
|
||||
# Whether the player is able to switch when an opponent's Pokémon faints
|
||||
battle.switchStyle = ($PokemonSystem.battlestyle==0)
|
||||
battle.switchStyle = ($PokemonSystem.battlestyle == 0)
|
||||
battle.switchStyle = battleRules["switchStyle"] if !battleRules["switchStyle"].nil?
|
||||
# Whether battle animations are shown
|
||||
battle.showAnims = ($PokemonSystem.battlescene==0)
|
||||
battle.showAnims = ($PokemonSystem.battlescene == 0)
|
||||
battle.showAnims = battleRules["battleAnims"] if !battleRules["battleAnims"].nil?
|
||||
# Terrain
|
||||
battle.defaultTerrain = battleRules["defaultTerrain"] if !battleRules["defaultTerrain"].nil?
|
||||
@@ -219,7 +219,7 @@ def pbWildBattleCore(*args)
|
||||
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
|
||||
if $player.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $player.pokemon_count > 0
|
||||
pbSet(outcomeVar,1) # Treat it as a win
|
||||
pbSet(outcomeVar, 1) # Treat it as a win
|
||||
$game_temp.clear_battle_rules
|
||||
$PokemonGlobal.nextBattleBGM = nil
|
||||
$PokemonGlobal.nextBattleME = nil
|
||||
@@ -239,18 +239,18 @@ def pbWildBattleCore(*args)
|
||||
foeParty.push(arg)
|
||||
elsif arg.is_a?(Array)
|
||||
species = GameData::Species.get(arg[0]).id
|
||||
pkmn = pbGenerateWildPokemon(species,arg[1])
|
||||
pkmn = pbGenerateWildPokemon(species, arg[1])
|
||||
foeParty.push(pkmn)
|
||||
elsif sp
|
||||
species = GameData::Species.get(sp).id
|
||||
pkmn = pbGenerateWildPokemon(species,arg)
|
||||
pkmn = pbGenerateWildPokemon(species, arg)
|
||||
foeParty.push(pkmn)
|
||||
sp = nil
|
||||
else
|
||||
sp = arg
|
||||
end
|
||||
end
|
||||
raise _INTL("Expected a level after being given {1}, but one wasn't found.",sp) if sp
|
||||
raise _INTL("Expected a level after being given {1}, but one wasn't found.", sp) if sp
|
||||
# Calculate who the trainers and their party are
|
||||
playerTrainers = [$player]
|
||||
playerParty = $player.party
|
||||
@@ -261,7 +261,7 @@ def pbWildBattleCore(*args)
|
||||
room_for_partner = true
|
||||
end
|
||||
if $PokemonGlobal.partner && !$game_temp.battle_rules["noPartner"] && room_for_partner
|
||||
ally = NPCTrainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
|
||||
ally = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
|
||||
ally.id = $PokemonGlobal.partner[2]
|
||||
ally.party = $PokemonGlobal.partner[3]
|
||||
playerTrainers.push(ally)
|
||||
@@ -274,18 +274,18 @@ def pbWildBattleCore(*args)
|
||||
# Create the battle scene (the visual side of it)
|
||||
scene = pbNewBattleScene
|
||||
# Create the battle class (the mechanics side of it)
|
||||
battle = Battle.new(scene,playerParty,foeParty,playerTrainers,nil)
|
||||
battle = Battle.new(scene, playerParty, foeParty, playerTrainers, nil)
|
||||
battle.party1starts = playerPartyStarts
|
||||
# Set various other properties in the battle class
|
||||
pbPrepareBattle(battle)
|
||||
$game_temp.clear_battle_rules
|
||||
# Perform the battle itself
|
||||
decision = 0
|
||||
pbBattleAnimation(pbGetWildBattleBGM(foeParty),(foeParty.length==1) ? 0 : 2,foeParty) {
|
||||
pbBattleAnimation(pbGetWildBattleBGM(foeParty), (foeParty.length == 1) ? 0 : 2, foeParty) {
|
||||
pbSceneStandby {
|
||||
decision = battle.pbStartBattle
|
||||
}
|
||||
pbAfterBattle(decision,canLose)
|
||||
pbAfterBattle(decision, canLose)
|
||||
}
|
||||
Input.update
|
||||
# Save the result of the battle in a Game Variable (1 by default)
|
||||
@@ -301,7 +301,7 @@ def pbWildBattleCore(*args)
|
||||
when 2, 3, 5 # Lost, fled, draw
|
||||
$stats.wild_battles_lost += 1
|
||||
end
|
||||
pbSet(outcomeVar,decision)
|
||||
pbSet(outcomeVar, decision)
|
||||
return decision
|
||||
end
|
||||
|
||||
@@ -314,44 +314,44 @@ def pbWildBattle(species, level, outcomeVar = 1, canRun = true, canLose = false)
|
||||
# Potentially call a different pbWildBattle-type method instead (for roaming
|
||||
# Pokémon, Safari battles, Bug Contest battles)
|
||||
handled = [nil]
|
||||
Events.onWildBattleOverride.trigger(nil,species,level,handled)
|
||||
return handled[0] if handled[0]!=nil
|
||||
Events.onWildBattleOverride.trigger(nil, species, level, handled)
|
||||
return handled[0] if handled[0] != nil
|
||||
# Set some battle rules
|
||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||
setBattleRule("outcomeVar", outcomeVar) if outcomeVar != 1
|
||||
setBattleRule("cannotRun") if !canRun
|
||||
setBattleRule("canLose") if canLose
|
||||
# Perform the battle
|
||||
decision = pbWildBattleCore(species, level)
|
||||
# Used by the Poké Radar to update/break the chain
|
||||
Events.onWildBattleEnd.trigger(nil,species,level,decision)
|
||||
Events.onWildBattleEnd.trigger(nil, species, level, decision)
|
||||
# Return false if the player lost or drew the battle, and true if any other result
|
||||
return (decision!=2 && decision!=5)
|
||||
return (decision != 2 && decision != 5)
|
||||
end
|
||||
|
||||
def pbDoubleWildBattle(species1, level1, species2, level2,
|
||||
outcomeVar = 1, canRun = true, canLose = false)
|
||||
# Set some battle rules
|
||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||
setBattleRule("outcomeVar", outcomeVar) if outcomeVar != 1
|
||||
setBattleRule("cannotRun") if !canRun
|
||||
setBattleRule("canLose") if canLose
|
||||
setBattleRule("double")
|
||||
# Perform the battle
|
||||
decision = pbWildBattleCore(species1, level1, species2, level2)
|
||||
# Return false if the player lost or drew the battle, and true if any other result
|
||||
return (decision!=2 && decision!=5)
|
||||
return (decision != 2 && decision != 5)
|
||||
end
|
||||
|
||||
def pbTripleWildBattle(species1, level1, species2, level2, species3, level3,
|
||||
outcomeVar = 1, canRun = true, canLose = false)
|
||||
# Set some battle rules
|
||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||
setBattleRule("outcomeVar", outcomeVar) if outcomeVar != 1
|
||||
setBattleRule("cannotRun") if !canRun
|
||||
setBattleRule("canLose") if canLose
|
||||
setBattleRule("triple")
|
||||
# Perform the battle
|
||||
decision = pbWildBattleCore(species1, level1, species2, level2, species3, level3)
|
||||
# Return false if the player lost or drew the battle, and true if any other result
|
||||
return (decision!=2 && decision!=5)
|
||||
return (decision != 2 && decision != 5)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
@@ -390,10 +390,10 @@ def pbTrainerBattleCore(*args)
|
||||
foeEndSpeeches.push(arg.lose_text)
|
||||
foeItems.push(arg.items)
|
||||
elsif arg.is_a?(Array) # [trainer type, trainer name, ID, speech (optional)]
|
||||
trainer = pbLoadTrainer(arg[0],arg[1],arg[2])
|
||||
pbMissingTrainer(arg[0],arg[1],arg[2]) if !trainer
|
||||
trainer = pbLoadTrainer(arg[0], arg[1], arg[2])
|
||||
pbMissingTrainer(arg[0], arg[1], arg[2]) if !trainer
|
||||
return 0 if !trainer
|
||||
Events.onTrainerPartyLoad.trigger(nil,trainer)
|
||||
Events.onTrainerPartyLoad.trigger(nil, trainer)
|
||||
foeTrainers.push(trainer)
|
||||
foePartyStarts.push(foeParty.length)
|
||||
trainer.party.each { |pkmn| foeParty.push(pkmn) }
|
||||
@@ -426,7 +426,7 @@ def pbTrainerBattleCore(*args)
|
||||
# Create the battle scene (the visual side of it)
|
||||
scene = pbNewBattleScene
|
||||
# Create the battle class (the mechanics side of it)
|
||||
battle = Battle.new(scene,playerParty,foeParty,playerTrainers,foeTrainers)
|
||||
battle = Battle.new(scene, playerParty, foeParty, playerTrainers, foeTrainers)
|
||||
battle.party1starts = playerPartyStarts
|
||||
battle.party2starts = foePartyStarts
|
||||
battle.items = foeItems
|
||||
@@ -438,11 +438,11 @@ def pbTrainerBattleCore(*args)
|
||||
Audio.me_stop
|
||||
# Perform the battle itself
|
||||
decision = 0
|
||||
pbBattleAnimation(pbGetTrainerBattleBGM(foeTrainers),(battle.singleBattle?) ? 1 : 3,foeTrainers) {
|
||||
pbBattleAnimation(pbGetTrainerBattleBGM(foeTrainers), (battle.singleBattle?) ? 1 : 3, foeTrainers) {
|
||||
pbSceneStandby {
|
||||
decision = battle.pbStartBattle
|
||||
}
|
||||
pbAfterBattle(decision,canLose)
|
||||
pbAfterBattle(decision, canLose)
|
||||
}
|
||||
Input.update
|
||||
# Save the result of the battle in a Game Variable (1 by default)
|
||||
@@ -457,7 +457,7 @@ def pbTrainerBattleCore(*args)
|
||||
when 2, 3, 5 # Lost, fled, draw
|
||||
$stats.trainer_battles_lost += 1
|
||||
end
|
||||
pbSet(outcomeVar,decision)
|
||||
pbSet(outcomeVar, decision)
|
||||
return decision
|
||||
end
|
||||
|
||||
@@ -480,18 +480,18 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech = nil,
|
||||
($player.able_pokemon_count > 0 && $PokemonGlobal.partner))
|
||||
thisEvent = pbMapInterpreter.get_self
|
||||
# Find all other triggered trainer events
|
||||
triggeredEvents = $game_player.pbTriggeredTrainerEvents([2],false)
|
||||
triggeredEvents = $game_player.pbTriggeredTrainerEvents([2], false)
|
||||
otherEvent = []
|
||||
for i in triggeredEvents
|
||||
next if i.id==thisEvent.id
|
||||
next if $game_self_switches[[$game_map.map_id,i.id,"A"]]
|
||||
next if i.id == thisEvent.id
|
||||
next if $game_self_switches[[$game_map.map_id, i.id, "A"]]
|
||||
otherEvent.push(i)
|
||||
end
|
||||
# Load the trainer's data, and call an event which might modify it
|
||||
trainer = pbLoadTrainer(trainerID,trainerName,trainerPartyID)
|
||||
pbMissingTrainer(trainerID,trainerName,trainerPartyID) if !trainer
|
||||
trainer = pbLoadTrainer(trainerID, trainerName, trainerPartyID)
|
||||
pbMissingTrainer(trainerID, trainerName, trainerPartyID) if !trainer
|
||||
return false if !trainer
|
||||
Events.onTrainerPartyLoad.trigger(nil,trainer)
|
||||
Events.onTrainerPartyLoad.trigger(nil, trainer)
|
||||
# If there is exactly 1 other triggered trainer event, and this trainer has
|
||||
# 6 or fewer Pokémon, record this trainer for a double battle caused by the
|
||||
# other triggered trainer event
|
||||
@@ -502,40 +502,40 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech = nil,
|
||||
end
|
||||
end
|
||||
# Set some battle rules
|
||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||
setBattleRule("outcomeVar", outcomeVar) if outcomeVar != 1
|
||||
setBattleRule("canLose") if canLose
|
||||
setBattleRule("double") if doubleBattle || $game_temp.waiting_trainer
|
||||
# Perform the battle
|
||||
if $game_temp.waiting_trainer
|
||||
decision = pbTrainerBattleCore($game_temp.waiting_trainer[0],
|
||||
[trainerID,trainerName,trainerPartyID,endSpeech]
|
||||
[trainerID, trainerName, trainerPartyID, endSpeech]
|
||||
)
|
||||
else
|
||||
decision = pbTrainerBattleCore([trainerID,trainerName,trainerPartyID,endSpeech])
|
||||
decision = pbTrainerBattleCore([trainerID, trainerName, trainerPartyID, endSpeech])
|
||||
end
|
||||
# Finish off the recorded waiting trainer, because they have now been battled
|
||||
if decision==1 && $game_temp.waiting_trainer # Win
|
||||
if decision == 1 && $game_temp.waiting_trainer # Win
|
||||
pbMapInterpreter.pbSetSelfSwitch($game_temp.waiting_trainer[1], "A", true)
|
||||
end
|
||||
$game_temp.waiting_trainer = nil
|
||||
# Return true if the player won the battle, and false if any other result
|
||||
return (decision==1)
|
||||
return (decision == 1)
|
||||
end
|
||||
|
||||
def pbDoubleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1,
|
||||
trainerID2, trainerName2, trainerPartyID2 = 0, endSpeech2 = nil,
|
||||
canLose = false, outcomeVar = 1)
|
||||
# Set some battle rules
|
||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||
setBattleRule("outcomeVar", outcomeVar) if outcomeVar != 1
|
||||
setBattleRule("canLose") if canLose
|
||||
setBattleRule("double")
|
||||
# Perform the battle
|
||||
decision = pbTrainerBattleCore(
|
||||
[trainerID1,trainerName1,trainerPartyID1,endSpeech1],
|
||||
[trainerID2,trainerName2,trainerPartyID2,endSpeech2]
|
||||
[trainerID1, trainerName1, trainerPartyID1, endSpeech1],
|
||||
[trainerID2, trainerName2, trainerPartyID2, endSpeech2]
|
||||
)
|
||||
# Return true if the player won the battle, and false if any other result
|
||||
return (decision==1)
|
||||
return (decision == 1)
|
||||
end
|
||||
|
||||
def pbTripleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1,
|
||||
@@ -543,23 +543,23 @@ def pbTripleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1,
|
||||
trainerID3, trainerName3, trainerPartyID3 = 0, endSpeech3 = nil,
|
||||
canLose = false, outcomeVar = 1)
|
||||
# Set some battle rules
|
||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||
setBattleRule("outcomeVar", outcomeVar) if outcomeVar != 1
|
||||
setBattleRule("canLose") if canLose
|
||||
setBattleRule("triple")
|
||||
# Perform the battle
|
||||
decision = pbTrainerBattleCore(
|
||||
[trainerID1,trainerName1,trainerPartyID1,endSpeech1],
|
||||
[trainerID2,trainerName2,trainerPartyID2,endSpeech2],
|
||||
[trainerID3,trainerName3,trainerPartyID3,endSpeech3]
|
||||
[trainerID1, trainerName1, trainerPartyID1, endSpeech1],
|
||||
[trainerID2, trainerName2, trainerPartyID2, endSpeech2],
|
||||
[trainerID3, trainerName3, trainerPartyID3, endSpeech3]
|
||||
)
|
||||
# Return true if the player won the battle, and false if any other result
|
||||
return (decision==1)
|
||||
return (decision == 1)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# After battles
|
||||
#===============================================================================
|
||||
def pbAfterBattle(decision,canLose)
|
||||
def pbAfterBattle(decision, canLose)
|
||||
$player.party.each do |pkmn|
|
||||
pkmn.statusCount = 0 if pkmn.status == :POISON # Bad poison becomes regular
|
||||
pkmn.makeUnmega
|
||||
@@ -573,22 +573,22 @@ def pbAfterBattle(decision,canLose)
|
||||
pkmn.makeUnprimal
|
||||
end
|
||||
end
|
||||
if decision==2 || decision==5 # if loss or draw
|
||||
if decision == 2 || decision == 5 # if loss or draw
|
||||
if canLose
|
||||
$player.party.each { |pkmn| pkmn.heal }
|
||||
(Graphics.frame_rate/4).times { Graphics.update }
|
||||
(Graphics.frame_rate / 4).times { Graphics.update }
|
||||
end
|
||||
end
|
||||
Events.onEndBattle.trigger(nil,decision,canLose)
|
||||
Events.onEndBattle.trigger(nil, decision, canLose)
|
||||
$game_player.straighten
|
||||
end
|
||||
|
||||
Events.onEndBattle += proc { |_sender,e|
|
||||
Events.onEndBattle += proc { |_sender, e|
|
||||
decision = e[0]
|
||||
canLose = e[1]
|
||||
# Check for evolutions
|
||||
pbEvolutionCheck if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES ||
|
||||
(decision!=2 && decision!=5) # not a loss or a draw
|
||||
(decision != 2 && decision != 5) # not a loss or a draw
|
||||
$game_temp.party_levels_before_battle = nil
|
||||
$game_temp.party_critical_hits_dealt = nil
|
||||
$game_temp.party_direct_damage_taken = nil
|
||||
@@ -642,7 +642,7 @@ end
|
||||
def pbPickup(pkmn)
|
||||
return if pkmn.egg? || !pkmn.hasAbility?(:PICKUP)
|
||||
return if pkmn.hasItem?
|
||||
return unless rand(100)<10 # 10% chance
|
||||
return unless rand(100) < 10 # 10% chance
|
||||
# Common items to find (9 items from this list are added to the pool)
|
||||
pickupList = pbDynamicItemList(
|
||||
:POTION,
|
||||
@@ -678,29 +678,29 @@ def pbPickup(pkmn)
|
||||
:LEFTOVERS,
|
||||
:DESTINYKNOT
|
||||
)
|
||||
return if pickupList.length<18
|
||||
return if pickupListRare.length<11
|
||||
return if pickupList.length < 18
|
||||
return if pickupListRare.length < 11
|
||||
# Generate a pool of items depending on the Pokémon's level
|
||||
items = []
|
||||
pkmnLevel = [100,pkmn.level].min
|
||||
itemStartIndex = (pkmnLevel-1)/10
|
||||
itemStartIndex = 0 if itemStartIndex<0
|
||||
pkmnLevel = [100, pkmn.level].min
|
||||
itemStartIndex = (pkmnLevel - 1) / 10
|
||||
itemStartIndex = 0 if itemStartIndex < 0
|
||||
for i in 0...9
|
||||
items.push(pickupList[itemStartIndex+i])
|
||||
items.push(pickupList[itemStartIndex + i])
|
||||
end
|
||||
for i in 0...2
|
||||
items.push(pickupListRare[itemStartIndex+i])
|
||||
items.push(pickupListRare[itemStartIndex + i])
|
||||
end
|
||||
# Probabilities of choosing each item in turn from the pool
|
||||
chances = [30,10,10,10,10,10,10,4,4,1,1] # Needs to be 11 numbers
|
||||
chances = [30, 10, 10, 10, 10, 10, 10, 4, 4, 1, 1] # Needs to be 11 numbers
|
||||
chanceSum = 0
|
||||
chances.each { |c| chanceSum += c }
|
||||
# Randomly choose an item from the pool to give to the Pokémon
|
||||
rnd = rand(chanceSum)
|
||||
cumul = 0
|
||||
chances.each_with_index do |c,i|
|
||||
chances.each_with_index do |c, i|
|
||||
cumul += c
|
||||
next if rnd>=cumul
|
||||
next if rnd >= cumul
|
||||
pkmn.item = items[i]
|
||||
break
|
||||
end
|
||||
|
||||
@@ -39,9 +39,9 @@ def pbSceneStandby
|
||||
$scene.createSpritesets if $scene && $scene.is_a?(Scene_Map)
|
||||
end
|
||||
|
||||
def pbBattleAnimation(bgm = nil,battletype = 0,foe = nil)
|
||||
def pbBattleAnimation(bgm = nil, battletype = 0, foe = nil)
|
||||
$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
|
||||
# Set up audio
|
||||
playingBGS = nil
|
||||
@@ -53,7 +53,7 @@ def pbBattleAnimation(bgm = nil,battletype = 0,foe = nil)
|
||||
$game_system.bgs_pause
|
||||
end
|
||||
pbMEFade(0.25)
|
||||
pbWait(Graphics.frame_rate/4)
|
||||
pbWait(Graphics.frame_rate / 4)
|
||||
pbMEStop
|
||||
# Play battle music
|
||||
bgm = pbGetWildBattleBGM([]) if !bgm
|
||||
@@ -83,34 +83,34 @@ def pbBattleAnimation(bgm = nil,battletype = 0,foe = nil)
|
||||
if PBDayNight.isDay?
|
||||
case battletype
|
||||
when 0, 2 # Wild, double wild
|
||||
anim = ["SnakeSquares","DiagonalBubbleTL","DiagonalBubbleBR","RisingSplash"][location]
|
||||
anim = ["SnakeSquares", "DiagonalBubbleTL", "DiagonalBubbleBR", "RisingSplash"][location]
|
||||
when 1 # Trainer
|
||||
anim = ["TwoBallPass","ThreeBallDown","BallDown","WavyThreeBallUp"][location]
|
||||
anim = ["TwoBallPass", "ThreeBallDown", "BallDown", "WavyThreeBallUp"][location]
|
||||
when 3 # Double trainer
|
||||
anim = "FourBallBurst"
|
||||
end
|
||||
else
|
||||
case battletype
|
||||
when 0, 2 # Wild, double wild
|
||||
anim = ["SnakeSquares","DiagonalBubbleBR","DiagonalBubbleBR","RisingSplash"][location]
|
||||
anim = ["SnakeSquares", "DiagonalBubbleBR", "DiagonalBubbleBR", "RisingSplash"][location]
|
||||
when 1 # Trainer
|
||||
anim = ["SpinBallSplit","BallDown","BallDown","WavySpinBall"][location]
|
||||
anim = ["SpinBallSplit", "BallDown", "BallDown", "WavySpinBall"][location]
|
||||
when 3 # Double trainer
|
||||
anim = "FourBallBurst"
|
||||
end
|
||||
end
|
||||
# Initial screen flashing
|
||||
if location==2 || PBDayNight.isNight?
|
||||
viewport.color = Color.new(0,0,0) # Fade to black a few times
|
||||
if location == 2 || PBDayNight.isNight?
|
||||
viewport.color = Color.new(0, 0, 0) # Fade to black a few times
|
||||
else
|
||||
viewport.color = Color.new(255,255,255) # Fade to white a few times
|
||||
viewport.color = Color.new(255, 255, 255) # Fade to white a few times
|
||||
end
|
||||
halfFlashTime = Graphics.frame_rate*2/10 # 0.2 seconds, 8 frames
|
||||
alphaDiff = (255.0/halfFlashTime).ceil
|
||||
halfFlashTime = Graphics.frame_rate * 2 / 10 # 0.2 seconds, 8 frames
|
||||
alphaDiff = (255.0 / halfFlashTime).ceil
|
||||
2.times do
|
||||
viewport.color.alpha = 0
|
||||
for i in 0...halfFlashTime*2
|
||||
if i<halfFlashTime
|
||||
for i in 0...halfFlashTime * 2
|
||||
if i < halfFlashTime
|
||||
viewport.color.alpha += alphaDiff
|
||||
else
|
||||
viewport.color.alpha -= alphaDiff
|
||||
@@ -124,10 +124,10 @@ def pbBattleAnimation(bgm = nil,battletype = 0,foe = nil)
|
||||
$game_temp.background_bitmap = Graphics.snap_to_bitmap
|
||||
# Play main animation
|
||||
Graphics.freeze
|
||||
viewport.color = Color.new(0,0,0,255) # Ensure screen is black
|
||||
viewport.color = Color.new(0, 0, 0, 255) # Ensure screen is black
|
||||
Graphics.transition(25, "Graphics/Transitions/" + anim)
|
||||
# Slight pause after animation before starting up the battle scene
|
||||
(Graphics.frame_rate/10).times do
|
||||
(Graphics.frame_rate / 10).times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
@@ -148,7 +148,7 @@ def pbBattleAnimation(bgm = nil,battletype = 0,foe = nil)
|
||||
$PokemonGlobal.nextBattleBack = nil
|
||||
$PokemonEncounters.reset_step_count
|
||||
# Fade back to the overworld in 0.4 seconds
|
||||
viewport.color = Color.new(0,0,0,255)
|
||||
viewport.color = Color.new(0, 0, 0, 255)
|
||||
timer = 0.0
|
||||
loop do
|
||||
Graphics.update
|
||||
|
||||
@@ -387,12 +387,12 @@ end
|
||||
# Creates and returns a Pokémon based on the given species and level.
|
||||
# Applies wild Pokémon modifiers (wild held item, shiny chance modifiers,
|
||||
# Pokérus, gender/nature forcing because of player's lead Pokémon).
|
||||
def pbGenerateWildPokemon(species,level,isRoamer = false)
|
||||
genwildpoke = Pokemon.new(species,level)
|
||||
def pbGenerateWildPokemon(species, level, isRoamer = false)
|
||||
genwildpoke = Pokemon.new(species, level)
|
||||
# Give the wild Pokémon a held item
|
||||
items = genwildpoke.wildHoldItems
|
||||
first_pkmn = $player.first_pokemon
|
||||
chances = [50,5,1]
|
||||
chances = [50, 5, 1]
|
||||
if first_pkmn
|
||||
case first_pkmn.ability_id
|
||||
when :COMPOUNDEYES
|
||||
@@ -402,11 +402,11 @@ def pbGenerateWildPokemon(species,level,isRoamer = false)
|
||||
end
|
||||
end
|
||||
itemrnd = rand(100)
|
||||
if (items[0]==items[1] && items[1]==items[2]) || itemrnd<chances[0]
|
||||
if (items[0] == items[1] && items[1] == items[2]) || itemrnd < chances[0]
|
||||
genwildpoke.item = items[0].sample
|
||||
elsif itemrnd<(chances[0]+chances[1])
|
||||
elsif itemrnd < (chances[0] + chances[1])
|
||||
genwildpoke.item = items[1].sample
|
||||
elsif itemrnd<(chances[0]+chances[1]+chances[2])
|
||||
elsif itemrnd < (chances[0] + chances[1] + chances[2])
|
||||
genwildpoke.item = items[2].sample
|
||||
end
|
||||
# Improve chances of shiny Pokémon with Shiny Charm and battling more of the
|
||||
@@ -439,9 +439,9 @@ def pbGenerateWildPokemon(species,level,isRoamer = false)
|
||||
if first_pkmn
|
||||
if first_pkmn.hasAbility?(:CUTECHARM) && !genwildpoke.singleGendered?
|
||||
if first_pkmn.male?
|
||||
(rand(3)<2) ? genwildpoke.makeFemale : genwildpoke.makeMale
|
||||
(rand(3) < 2) ? genwildpoke.makeFemale : genwildpoke.makeMale
|
||||
elsif first_pkmn.female?
|
||||
(rand(3)<2) ? genwildpoke.makeMale : genwildpoke.makeFemale
|
||||
(rand(3) < 2) ? genwildpoke.makeMale : genwildpoke.makeFemale
|
||||
end
|
||||
elsif first_pkmn.hasAbility?(:SYNCHRONIZE)
|
||||
if !isRoamer && (Settings::MORE_ABILITIES_AFFECT_WILD_ENCOUNTERS || (rand(100) < 50))
|
||||
@@ -450,7 +450,7 @@ def pbGenerateWildPokemon(species,level,isRoamer = false)
|
||||
end
|
||||
end
|
||||
# Trigger events that may alter the generated Pokémon further
|
||||
Events.onWildPokemonCreate.trigger(nil,genwildpoke)
|
||||
Events.onWildPokemonCreate.trigger(nil, genwildpoke)
|
||||
return genwildpoke
|
||||
end
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ end
|
||||
def pbResetAllRoamers
|
||||
return if !$PokemonGlobal.roamPokemon
|
||||
for i in 0...$PokemonGlobal.roamPokemon.length
|
||||
next if $PokemonGlobal.roamPokemon[i]!=true || !$PokemonGlobal.roamPokemonCaught[i]
|
||||
next if $PokemonGlobal.roamPokemon[i] != true || !$PokemonGlobal.roamPokemonCaught[i]
|
||||
$PokemonGlobal.roamPokemon[i] = nil
|
||||
end
|
||||
end
|
||||
@@ -62,11 +62,11 @@ end
|
||||
def pbRoamPokemonOne(idxRoamer)
|
||||
# [species ID, level, Game Switch, encounter type, battle BGM, area maps hash]
|
||||
roamData = Settings::ROAMING_SPECIES[idxRoamer]
|
||||
return if roamData[2]>0 && !$game_switches[roamData[2]] # Game Switch is off
|
||||
return if roamData[2] > 0 && !$game_switches[roamData[2]] # Game Switch is off
|
||||
return if !GameData::Species.exists?(roamData[0])
|
||||
# Get hash of area patrolled by the roaming Pokémon
|
||||
mapIDs = pbRoamingAreas(idxRoamer).keys
|
||||
return if !mapIDs || mapIDs.length==0 # No roaming area defined somehow
|
||||
return if !mapIDs || mapIDs.length == 0 # No roaming area defined somehow
|
||||
# Get the roaming Pokémon's current map
|
||||
currentMap = $PokemonGlobal.roamPosition[idxRoamer]
|
||||
if !currentMap
|
||||
@@ -82,23 +82,23 @@ def pbRoamPokemonOne(idxRoamer)
|
||||
newMapChoices.push(map)
|
||||
end
|
||||
# Rarely, add a random possible map into the mix
|
||||
if rand(32)==0
|
||||
if rand(32) == 0
|
||||
newMapChoices.push(mapIDs[rand(mapIDs.length)])
|
||||
end
|
||||
# Choose a random new map to roam to
|
||||
if newMapChoices.length>0
|
||||
if newMapChoices.length > 0
|
||||
$PokemonGlobal.roamPosition[idxRoamer] = newMapChoices[rand(newMapChoices.length)]
|
||||
end
|
||||
end
|
||||
|
||||
# When the player moves to a new map (with a different name), make all roaming
|
||||
# Pokémon roam.
|
||||
Events.onMapChange += proc { |_sender,e|
|
||||
Events.onMapChange += proc { |_sender, e|
|
||||
oldMapID = e[0]
|
||||
# Get and compare map names
|
||||
mapInfos = pbLoadMapInfos
|
||||
next if mapInfos && oldMapID>0 && mapInfos[oldMapID] &&
|
||||
mapInfos[oldMapID].name && $game_map.name==mapInfos[oldMapID].name
|
||||
next if mapInfos && oldMapID > 0 && mapInfos[oldMapID] &&
|
||||
mapInfos[oldMapID].name && $game_map.name == mapInfos[oldMapID].name
|
||||
# Make roaming Pokémon roam
|
||||
pbRoamPokemon
|
||||
$PokemonGlobal.roamedAlready = false
|
||||
@@ -185,11 +185,11 @@ EncounterModifier.register(proc { |encounter|
|
||||
next [roamer[1], roamer[2]] # Species, level
|
||||
})
|
||||
|
||||
Events.onWildBattleOverride += proc { |_sender,e|
|
||||
Events.onWildBattleOverride += proc { |_sender, e|
|
||||
species = e[0]
|
||||
level = e[1]
|
||||
handled = e[2]
|
||||
next if handled[0]!=nil
|
||||
next if handled[0] != nil
|
||||
next if !$PokemonGlobal.roamEncounter || $game_temp.roamer_index_for_encounter.nil?
|
||||
handled[0] = pbRoamingPokemonBattle(species, level)
|
||||
}
|
||||
@@ -200,7 +200,7 @@ def pbRoamingPokemonBattle(species, level)
|
||||
idxRoamer = $game_temp.roamer_index_for_encounter
|
||||
if !$PokemonGlobal.roamPokemon[idxRoamer] ||
|
||||
!$PokemonGlobal.roamPokemon[idxRoamer].is_a?(Pokemon)
|
||||
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(species,level,true)
|
||||
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(species, level, true)
|
||||
end
|
||||
# Set some battle rules
|
||||
setBattleRule("single")
|
||||
@@ -208,16 +208,16 @@ def pbRoamingPokemonBattle(species, level)
|
||||
# Perform the battle
|
||||
decision = pbWildBattleCore($PokemonGlobal.roamPokemon[idxRoamer])
|
||||
# Update Roaming Pokémon data based on result of battle
|
||||
if decision==1 || decision==4 # Defeated or caught
|
||||
if decision == 1 || decision == 4 # Defeated or caught
|
||||
$PokemonGlobal.roamPokemon[idxRoamer] = true
|
||||
$PokemonGlobal.roamPokemonCaught[idxRoamer] = (decision==4)
|
||||
$PokemonGlobal.roamPokemonCaught[idxRoamer] = (decision == 4)
|
||||
end
|
||||
$PokemonGlobal.roamEncounter = nil
|
||||
$PokemonGlobal.roamedAlready = true
|
||||
# Used by the Poké Radar to update/break the chain
|
||||
Events.onWildBattleEnd.trigger(nil,species,level,decision)
|
||||
Events.onWildBattleEnd.trigger(nil, species, level, decision)
|
||||
# Return false if the player lost or drew the battle, and true if any other result
|
||||
return (decision!=2 && decision!=5)
|
||||
return (decision != 2 && decision != 5)
|
||||
end
|
||||
|
||||
EncounterModifier.registerEncounterEnd(proc {
|
||||
|
||||
@@ -70,11 +70,11 @@ class PokemonGlobalMetadata
|
||||
@creditsPlayed = false
|
||||
# Pokédex
|
||||
numRegions = pbLoadRegionalDexes.length
|
||||
@pokedexDex = (numRegions==0) ? -1 : 0
|
||||
@pokedexDex = (numRegions == 0) ? -1 : 0
|
||||
@pokedexIndex = []
|
||||
@pokedexMode = 0
|
||||
for i in 0...numRegions+1 # National Dex isn't a region, but is included
|
||||
@pokedexIndex[i] = 0
|
||||
for i in 0...numRegions + 1 # National Dex isn't a region, but is included
|
||||
@pokedexIndex[i] = 0
|
||||
end
|
||||
# Day Care
|
||||
@day_care = DayCare.new
|
||||
@@ -142,27 +142,27 @@ class PokemonMapMetadata
|
||||
end
|
||||
|
||||
def addErasedEvent(eventID)
|
||||
key = [$game_map.map_id,eventID]
|
||||
key = [$game_map.map_id, eventID]
|
||||
@erasedEvents[key] = true
|
||||
end
|
||||
|
||||
def addMovedEvent(eventID)
|
||||
key = [$game_map.map_id,eventID]
|
||||
key = [$game_map.map_id, eventID]
|
||||
event = $game_map.events[eventID] if eventID.is_a?(Integer)
|
||||
@movedEvents[key] = [event.x,event.y,event.direction,event.through] if event
|
||||
@movedEvents[key] = [event.x, event.y, event.direction, event.through] if event
|
||||
end
|
||||
|
||||
def updateMap
|
||||
for i in @erasedEvents
|
||||
if i[0][0]==$game_map.map_id && i[1]
|
||||
if i[0][0] == $game_map.map_id && i[1]
|
||||
event = $game_map.events[i[0][1]]
|
||||
event.erase if event
|
||||
end
|
||||
end
|
||||
for i in @movedEvents
|
||||
if i[0][0]==$game_map.map_id && i[1]
|
||||
if i[0][0] == $game_map.map_id && i[1]
|
||||
next if !$game_map.events[i[0][1]]
|
||||
$game_map.events[i[0][1]].moveto(i[1][0],i[1][1])
|
||||
$game_map.events[i[0][1]].moveto(i[1][0], i[1][1])
|
||||
case i[1][2]
|
||||
when 2 then $game_map.events[i[0][1]].turn_down
|
||||
when 4 then $game_map.events[i[0][1]].turn_left
|
||||
@@ -170,7 +170,7 @@ class PokemonMapMetadata
|
||||
when 8 then $game_map.events[i[0][1]].turn_up
|
||||
end
|
||||
end
|
||||
if i[1][3]!=nil
|
||||
if i[1][3] != nil
|
||||
$game_map.events[i[0][1]].through = i[1][3]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,52 +36,52 @@ module PBDayNight
|
||||
]
|
||||
@cachedTone = nil
|
||||
@dayNightToneLastUpdate = nil
|
||||
@oneOverSixty = 1/60.0
|
||||
@oneOverSixty = 1 / 60.0
|
||||
|
||||
# Returns true if it's day.
|
||||
def self.isDay?(time = nil)
|
||||
time = pbGetTimeNow if !time
|
||||
return (time.hour>=5 && time.hour<20)
|
||||
return (time.hour >= 5 && time.hour < 20)
|
||||
end
|
||||
|
||||
# Returns true if it's night.
|
||||
def self.isNight?(time = nil)
|
||||
time = pbGetTimeNow if !time
|
||||
return (time.hour>=20 || time.hour<5)
|
||||
return (time.hour >= 20 || time.hour < 5)
|
||||
end
|
||||
|
||||
# Returns true if it's morning.
|
||||
def self.isMorning?(time = nil)
|
||||
time = pbGetTimeNow if !time
|
||||
return (time.hour>=5 && time.hour<10)
|
||||
return (time.hour >= 5 && time.hour < 10)
|
||||
end
|
||||
|
||||
# Returns true if it's the afternoon.
|
||||
def self.isAfternoon?(time = nil)
|
||||
time = pbGetTimeNow if !time
|
||||
return (time.hour>=14 && time.hour<17)
|
||||
return (time.hour >= 14 && time.hour < 17)
|
||||
end
|
||||
|
||||
# Returns true if it's the evening.
|
||||
def self.isEvening?(time = nil)
|
||||
time = pbGetTimeNow if !time
|
||||
return (time.hour>=17 && time.hour<20)
|
||||
return (time.hour >= 17 && time.hour < 20)
|
||||
end
|
||||
|
||||
# Gets a number representing the amount of daylight (0=full night, 255=full day).
|
||||
def self.getShade
|
||||
time = pbGetDayNightMinutes
|
||||
time = (24*60)-time if time>(12*60)
|
||||
return 255*time/(12*60)
|
||||
time = (24 * 60) - time if time > (12 * 60)
|
||||
return 255 * time / (12 * 60)
|
||||
end
|
||||
|
||||
# Gets a Tone object representing a suggested shading
|
||||
# tone for the current time of day.
|
||||
def self.getTone
|
||||
@cachedTone = Tone.new(0,0,0) if !@cachedTone
|
||||
@cachedTone = Tone.new(0, 0, 0) if !@cachedTone
|
||||
return @cachedTone if !Settings::TIME_SHADING
|
||||
if !@dayNightToneLastUpdate ||
|
||||
Graphics.frame_count-@dayNightToneLastUpdate>=Graphics.frame_rate*30
|
||||
Graphics.frame_count - @dayNightToneLastUpdate >= Graphics.frame_rate * 30
|
||||
getToneInternal
|
||||
@dayNightToneLastUpdate = Graphics.frame_count
|
||||
end
|
||||
@@ -90,7 +90,7 @@ module PBDayNight
|
||||
|
||||
def self.pbGetDayNightMinutes
|
||||
now = pbGetTimeNow # Get the current in-game time
|
||||
return (now.hour*60)+now.min
|
||||
return (now.hour * 60) + now.min
|
||||
end
|
||||
|
||||
private
|
||||
@@ -98,16 +98,16 @@ module PBDayNight
|
||||
def self.getToneInternal
|
||||
# Calculates the tone for the current frame, used for day/night effects
|
||||
realMinutes = pbGetDayNightMinutes
|
||||
hour = realMinutes/60
|
||||
minute = realMinutes%60
|
||||
hour = realMinutes / 60
|
||||
minute = realMinutes % 60
|
||||
tone = PBDayNight::HourlyTones[hour]
|
||||
nexthourtone = PBDayNight::HourlyTones[(hour+1)%24]
|
||||
nexthourtone = PBDayNight::HourlyTones[(hour + 1) % 24]
|
||||
# Calculate current tint according to current and next hour's tint and
|
||||
# depending on current minute
|
||||
@cachedTone.red = ((nexthourtone.red-tone.red)*minute*@oneOverSixty)+tone.red
|
||||
@cachedTone.green = ((nexthourtone.green-tone.green)*minute*@oneOverSixty)+tone.green
|
||||
@cachedTone.blue = ((nexthourtone.blue-tone.blue)*minute*@oneOverSixty)+tone.blue
|
||||
@cachedTone.gray = ((nexthourtone.gray-tone.gray)*minute*@oneOverSixty)+tone.gray
|
||||
@cachedTone.red = ((nexthourtone.red - tone.red) * minute * @oneOverSixty) + tone.red
|
||||
@cachedTone.green = ((nexthourtone.green - tone.green) * minute * @oneOverSixty) + tone.green
|
||||
@cachedTone.blue = ((nexthourtone.blue - tone.blue) * minute * @oneOverSixty) + tone.blue
|
||||
@cachedTone.gray = ((nexthourtone.gray - tone.gray) * minute * @oneOverSixty) + tone.gray
|
||||
end
|
||||
end
|
||||
|
||||
@@ -117,9 +117,9 @@ def pbDayNightTint(object)
|
||||
return if !$scene.is_a?(Scene_Map)
|
||||
if Settings::TIME_SHADING && $game_map.metadata&.outdoor_map
|
||||
tone = PBDayNight.getTone
|
||||
object.tone.set(tone.red,tone.green,tone.blue,tone.gray)
|
||||
object.tone.set(tone.red, tone.green, tone.blue, tone.gray)
|
||||
else
|
||||
object.tone.set(0,0,0,0)
|
||||
object.tone.set(0, 0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -149,39 +149,39 @@ def moonphase(time = nil) # in UTC
|
||||
23.9936034430625,
|
||||
27.6849270496875
|
||||
]
|
||||
yy = time.year-((12-time.mon)/10.0).floor
|
||||
j = (365.25*(4712+yy)).floor + (((time.mon+9)%12)*30.6+0.5).floor + time.day+59
|
||||
j -= (((yy/100.0)+49).floor*0.75).floor-38 if j>2299160
|
||||
j += (((time.hour*60)+time.min*60)+time.sec)/86400.0
|
||||
v = (j-2451550.1)/29.530588853
|
||||
v = ((v-v.floor)+(v<0 ? 1 : 0))
|
||||
ag = v*29.53
|
||||
yy = time.year - ((12 - time.mon) / 10.0).floor
|
||||
j = (365.25 * (4712 + yy)).floor + (((time.mon + 9) % 12) * 30.6 + 0.5).floor + time.day + 59
|
||||
j -= (((yy / 100.0) + 49).floor * 0.75).floor - 38 if j > 2299160
|
||||
j += (((time.hour * 60) + time.min * 60) + time.sec) / 86400.0
|
||||
v = (j - 2451550.1) / 29.530588853
|
||||
v = ((v - v.floor) + (v < 0 ? 1 : 0))
|
||||
ag = v * 29.53
|
||||
for i in 0...transitions.length
|
||||
return i if ag<=transitions[i]
|
||||
return i if ag <= transitions[i]
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
# Calculates the zodiac sign based on the given month and day:
|
||||
# 0 is Aries, 11 is Pisces. Month is 1 if January, and so on.
|
||||
def zodiac(month,day)
|
||||
def zodiac(month, day)
|
||||
time = [
|
||||
3,21,4,19, # Aries
|
||||
4,20,5,20, # Taurus
|
||||
5,21,6,20, # Gemini
|
||||
6,21,7,20, # Cancer
|
||||
7,23,8,22, # Leo
|
||||
8,23,9,22, # Virgo
|
||||
9,23,10,22, # Libra
|
||||
10,23,11,21, # Scorpio
|
||||
11,22,12,21, # Sagittarius
|
||||
12,22,1,19, # Capricorn
|
||||
1,20,2,18, # Aquarius
|
||||
2,19,3,20 # Pisces
|
||||
3, 21, 4, 19, # Aries
|
||||
4, 20, 5, 20, # Taurus
|
||||
5, 21, 6, 20, # Gemini
|
||||
6, 21, 7, 20, # Cancer
|
||||
7, 23, 8, 22, # Leo
|
||||
8, 23, 9, 22, # Virgo
|
||||
9, 23, 10, 22, # Libra
|
||||
10, 23, 11, 21, # Scorpio
|
||||
11, 22, 12, 21, # Sagittarius
|
||||
12, 22, 1, 19, # Capricorn
|
||||
1, 20, 2, 18, # Aquarius
|
||||
2, 19, 3, 20 # Pisces
|
||||
]
|
||||
for i in 0...12
|
||||
return i if month==time[i*4] && day>=time[i*4+1]
|
||||
return i if month==time[i*4+2] && day<=time[i*4+3]
|
||||
return i if month == time[i * 4] && day >= time[i * 4 + 1]
|
||||
return i if month == time[i * 4 + 2] && day <= time[i * 4 + 3]
|
||||
end
|
||||
return 0
|
||||
end
|
||||
@@ -189,30 +189,30 @@ end
|
||||
# Returns the opposite of the given zodiac sign.
|
||||
# 0 is Aries, 11 is Pisces.
|
||||
def zodiacOpposite(sign)
|
||||
return (sign+6)%12
|
||||
return (sign + 6) % 12
|
||||
end
|
||||
|
||||
# 0 is Aries, 11 is Pisces.
|
||||
def zodiacPartners(sign)
|
||||
return [(sign+4)%12,(sign+8)%12]
|
||||
return [(sign + 4) % 12, (sign + 8) % 12]
|
||||
end
|
||||
|
||||
# 0 is Aries, 11 is Pisces.
|
||||
def zodiacComplements(sign)
|
||||
return [(sign+1)%12,(sign+11)%12]
|
||||
return [(sign + 1) % 12, (sign + 11) % 12]
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Days of the week
|
||||
#===============================================================================
|
||||
def pbIsWeekday(wdayVariable,*arg)
|
||||
def pbIsWeekday(wdayVariable, *arg)
|
||||
timenow = pbGetTimeNow
|
||||
wday = timenow.wday
|
||||
ret = false
|
||||
for wd in arg
|
||||
ret = true if wd==wday
|
||||
ret = true if wd == wday
|
||||
end
|
||||
if wdayVariable>0
|
||||
if wdayVariable > 0
|
||||
$game_variables[wdayVariable] = [
|
||||
_INTL("Sunday"),
|
||||
_INTL("Monday"),
|
||||
@@ -230,14 +230,14 @@ end
|
||||
#===============================================================================
|
||||
# Months
|
||||
#===============================================================================
|
||||
def pbIsMonth(monVariable,*arg)
|
||||
def pbIsMonth(monVariable, *arg)
|
||||
timenow = pbGetTimeNow
|
||||
thismon = timenow.mon
|
||||
ret = false
|
||||
for wd in arg
|
||||
ret = true if wd==thismon
|
||||
ret = true if wd == thismon
|
||||
end
|
||||
if monVariable>0
|
||||
if monVariable > 0
|
||||
$game_variables[monVariable] = pbGetMonthName(thismon)
|
||||
$game_map.need_refresh = true if $game_map
|
||||
end
|
||||
@@ -256,7 +256,7 @@ def pbGetMonthName(month)
|
||||
_INTL("September"),
|
||||
_INTL("October"),
|
||||
_INTL("November"),
|
||||
_INTL("December")][month-1]
|
||||
_INTL("December")][month - 1]
|
||||
end
|
||||
|
||||
def pbGetAbbrevMonthName(month)
|
||||
@@ -279,16 +279,16 @@ end
|
||||
# Seasons
|
||||
#===============================================================================
|
||||
def pbGetSeason
|
||||
return (pbGetTimeNow.mon-1)%4
|
||||
return (pbGetTimeNow.mon - 1) % 4
|
||||
end
|
||||
|
||||
def pbIsSeason(seasonVariable,*arg)
|
||||
def pbIsSeason(seasonVariable, *arg)
|
||||
thisseason = pbGetSeason
|
||||
ret = false
|
||||
for wd in arg
|
||||
ret = true if wd==thisseason
|
||||
ret = true if wd == thisseason
|
||||
end
|
||||
if seasonVariable>0
|
||||
if seasonVariable > 0
|
||||
$game_variables[seasonVariable] = [
|
||||
_INTL("Spring"),
|
||||
_INTL("Summer"),
|
||||
@@ -300,11 +300,11 @@ def pbIsSeason(seasonVariable,*arg)
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbIsSpring; return pbIsSeason(0,0); end # Jan, May, Sep
|
||||
def pbIsSummer; return pbIsSeason(0,1); end # Feb, Jun, Oct
|
||||
def pbIsAutumn; return pbIsSeason(0,2); end # Mar, Jul, Nov
|
||||
def pbIsSpring; return pbIsSeason(0, 0); end # Jan, May, Sep
|
||||
def pbIsSummer; return pbIsSeason(0, 1); end # Feb, Jun, Oct
|
||||
def pbIsAutumn; return pbIsSeason(0, 2); end # Mar, Jul, Nov
|
||||
def pbIsFall; return pbIsAutumn; end
|
||||
def pbIsWinter; return pbIsSeason(0,3); end # Apr, Aug, Dec
|
||||
def pbIsWinter; return pbIsSeason(0, 3); end # Apr, Aug, Dec
|
||||
|
||||
def pbGetSeasonName(season)
|
||||
return [_INTL("Spring"),
|
||||
|
||||
@@ -6,45 +6,45 @@ module HiddenMoveHandlers
|
||||
ConfirmUseMove = MoveHandlerHash.new
|
||||
UseMove = MoveHandlerHash.new
|
||||
|
||||
def self.addCanUseMove(item,proc); CanUseMove.add(item,proc); end
|
||||
def self.addConfirmUseMove(item,proc); ConfirmUseMove.add(item,proc); end
|
||||
def self.addUseMove(item,proc); UseMove.add(item,proc); end
|
||||
def self.addCanUseMove(item, proc); CanUseMove.add(item, proc); end
|
||||
def self.addConfirmUseMove(item, proc); ConfirmUseMove.add(item, proc); end
|
||||
def self.addUseMove(item, proc); UseMove.add(item, proc); end
|
||||
|
||||
def self.hasHandler(item)
|
||||
return CanUseMove[item]!=nil && UseMove[item]!=nil
|
||||
return CanUseMove[item] != nil && UseMove[item] != nil
|
||||
end
|
||||
|
||||
# Returns whether move can be used
|
||||
def self.triggerCanUseMove(item,pokemon,showmsg)
|
||||
def self.triggerCanUseMove(item, pokemon, showmsg)
|
||||
return false if !CanUseMove[item]
|
||||
return CanUseMove.trigger(item,pokemon,showmsg)
|
||||
return CanUseMove.trigger(item, pokemon, showmsg)
|
||||
end
|
||||
|
||||
# Returns whether the player confirmed that they want to use the move
|
||||
def self.triggerConfirmUseMove(item,pokemon)
|
||||
def self.triggerConfirmUseMove(item, pokemon)
|
||||
return true if !ConfirmUseMove[item]
|
||||
return ConfirmUseMove.trigger(item,pokemon)
|
||||
return ConfirmUseMove.trigger(item, pokemon)
|
||||
end
|
||||
|
||||
# Returns whether move was used
|
||||
def self.triggerUseMove(item,pokemon)
|
||||
def self.triggerUseMove(item, pokemon)
|
||||
return false if !UseMove[item]
|
||||
return UseMove.trigger(item,pokemon)
|
||||
return UseMove.trigger(item, pokemon)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbCanUseHiddenMove?(pkmn,move,showmsg = true)
|
||||
return HiddenMoveHandlers.triggerCanUseMove(move,pkmn,showmsg)
|
||||
def pbCanUseHiddenMove?(pkmn, move, showmsg = true)
|
||||
return HiddenMoveHandlers.triggerCanUseMove(move, pkmn, showmsg)
|
||||
end
|
||||
|
||||
def pbConfirmUseHiddenMove(pokemon,move)
|
||||
return HiddenMoveHandlers.triggerConfirmUseMove(move,pokemon)
|
||||
def pbConfirmUseHiddenMove(pokemon, move)
|
||||
return HiddenMoveHandlers.triggerConfirmUseMove(move, pokemon)
|
||||
end
|
||||
|
||||
def pbUseHiddenMove(pokemon,move)
|
||||
return HiddenMoveHandlers.triggerUseMove(move,pokemon)
|
||||
def pbUseHiddenMove(pokemon, move)
|
||||
return HiddenMoveHandlers.triggerUseMove(move, pokemon)
|
||||
end
|
||||
|
||||
# Unused
|
||||
@@ -52,8 +52,8 @@ def pbHiddenMoveEvent
|
||||
Events.onAction.trigger(nil)
|
||||
end
|
||||
|
||||
def pbCheckHiddenMoveBadge(badge = -1,showmsg = true)
|
||||
return true if badge<0 # No badge requirement
|
||||
def pbCheckHiddenMoveBadge(badge = -1, showmsg = true)
|
||||
return true if badge < 0 # No badge requirement
|
||||
return true if $DEBUG
|
||||
if (Settings::FIELD_MOVES_COUNT_BADGES) ? $player.badge_count >= badge : $player.badges[badge]
|
||||
return true
|
||||
@@ -69,33 +69,33 @@ end
|
||||
#===============================================================================
|
||||
def pbHiddenMoveAnimation(pokemon)
|
||||
return false if !pokemon
|
||||
viewport=Viewport.new(0,0,0,0)
|
||||
viewport.z=99999
|
||||
bg=Sprite.new(viewport)
|
||||
bg.bitmap=RPG::Cache.picture("hiddenMovebg")
|
||||
sprite=PokemonSprite.new(viewport)
|
||||
viewport = Viewport.new(0, 0, 0, 0)
|
||||
viewport.z = 99999
|
||||
bg = Sprite.new(viewport)
|
||||
bg.bitmap = RPG::Cache.picture("hiddenMovebg")
|
||||
sprite = PokemonSprite.new(viewport)
|
||||
sprite.setOffset(PictureOrigin::Center)
|
||||
sprite.setPokemonBitmap(pokemon)
|
||||
sprite.z=1
|
||||
sprite.visible=false
|
||||
strobebitmap=AnimatedBitmap.new("Graphics/Pictures/hiddenMoveStrobes")
|
||||
strobes=[]
|
||||
sprite.z = 1
|
||||
sprite.visible = false
|
||||
strobebitmap = AnimatedBitmap.new("Graphics/Pictures/hiddenMoveStrobes")
|
||||
strobes = []
|
||||
15.times do |i|
|
||||
strobe=BitmapSprite.new(26*2,8*2,viewport)
|
||||
strobe.bitmap.blt(0,0,strobebitmap.bitmap,Rect.new(0,(i%2)*8*2,26*2,8*2))
|
||||
strobe.z=((i%2)==0 ? 2 : 0)
|
||||
strobe.visible=false
|
||||
strobe = BitmapSprite.new(26 * 2, 8 * 2, viewport)
|
||||
strobe.bitmap.blt(0, 0, strobebitmap.bitmap, Rect.new(0, (i % 2) * 8 * 2, 26 * 2, 8 * 2))
|
||||
strobe.z = ((i % 2) == 0 ? 2 : 0)
|
||||
strobe.visible = false
|
||||
strobes.push(strobe)
|
||||
end
|
||||
strobebitmap.dispose
|
||||
interp=RectInterpolator.new(
|
||||
Rect.new(0,Graphics.height/2,Graphics.width,0),
|
||||
Rect.new(0,(Graphics.height-bg.bitmap.height)/2,Graphics.width,bg.bitmap.height),
|
||||
Graphics.frame_rate/4)
|
||||
ptinterp=nil
|
||||
phase=1
|
||||
frames=0
|
||||
strobeSpeed = 64*20/Graphics.frame_rate
|
||||
interp = RectInterpolator.new(
|
||||
Rect.new(0, Graphics.height / 2, Graphics.width, 0),
|
||||
Rect.new(0, (Graphics.height - bg.bitmap.height) / 2, Graphics.width, bg.bitmap.height),
|
||||
Graphics.frame_rate / 4)
|
||||
ptinterp = nil
|
||||
phase = 1
|
||||
frames = 0
|
||||
strobeSpeed = 64 * 20 / Graphics.frame_rate
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -104,71 +104,71 @@ def pbHiddenMoveAnimation(pokemon)
|
||||
when 1 # Expand viewport height from zero to full
|
||||
interp.update
|
||||
interp.set(viewport.rect)
|
||||
bg.oy=(bg.bitmap.height-viewport.rect.height)/2
|
||||
bg.oy = (bg.bitmap.height - viewport.rect.height) / 2
|
||||
if interp.done?
|
||||
phase=2
|
||||
ptinterp=PointInterpolator.new(
|
||||
Graphics.width+(sprite.bitmap.width/2),bg.bitmap.height/2,
|
||||
Graphics.width/2,bg.bitmap.height/2,
|
||||
Graphics.frame_rate*4/10)
|
||||
phase = 2
|
||||
ptinterp = PointInterpolator.new(
|
||||
Graphics.width + (sprite.bitmap.width / 2), bg.bitmap.height / 2,
|
||||
Graphics.width / 2, bg.bitmap.height / 2,
|
||||
Graphics.frame_rate * 4 / 10)
|
||||
end
|
||||
when 2 # Slide Pokémon sprite in from right to centre
|
||||
ptinterp.update
|
||||
sprite.x=ptinterp.x
|
||||
sprite.y=ptinterp.y
|
||||
sprite.visible=true
|
||||
sprite.x = ptinterp.x
|
||||
sprite.y = ptinterp.y
|
||||
sprite.visible = true
|
||||
if ptinterp.done?
|
||||
phase=3
|
||||
phase = 3
|
||||
pokemon.play_cry
|
||||
frames=0
|
||||
frames = 0
|
||||
end
|
||||
when 3 # Wait
|
||||
frames+=1
|
||||
if frames>Graphics.frame_rate*3/4
|
||||
phase=4
|
||||
ptinterp=PointInterpolator.new(
|
||||
Graphics.width/2,bg.bitmap.height/2,
|
||||
-(sprite.bitmap.width/2),bg.bitmap.height/2,
|
||||
Graphics.frame_rate*4/10)
|
||||
frames=0
|
||||
frames += 1
|
||||
if frames > Graphics.frame_rate * 3 / 4
|
||||
phase = 4
|
||||
ptinterp = PointInterpolator.new(
|
||||
Graphics.width / 2, bg.bitmap.height / 2,
|
||||
-(sprite.bitmap.width / 2), bg.bitmap.height / 2,
|
||||
Graphics.frame_rate * 4 / 10)
|
||||
frames = 0
|
||||
end
|
||||
when 4 # Slide Pokémon sprite off from centre to left
|
||||
ptinterp.update
|
||||
sprite.x=ptinterp.x
|
||||
sprite.y=ptinterp.y
|
||||
sprite.x = ptinterp.x
|
||||
sprite.y = ptinterp.y
|
||||
if ptinterp.done?
|
||||
phase=5
|
||||
sprite.visible=false
|
||||
interp=RectInterpolator.new(
|
||||
Rect.new(0,(Graphics.height-bg.bitmap.height)/2,Graphics.width,bg.bitmap.height),
|
||||
Rect.new(0,Graphics.height/2,Graphics.width,0),
|
||||
Graphics.frame_rate/4)
|
||||
phase = 5
|
||||
sprite.visible = false
|
||||
interp = RectInterpolator.new(
|
||||
Rect.new(0, (Graphics.height - bg.bitmap.height) / 2, Graphics.width, bg.bitmap.height),
|
||||
Rect.new(0, Graphics.height / 2, Graphics.width, 0),
|
||||
Graphics.frame_rate / 4)
|
||||
end
|
||||
when 5 # Shrink viewport height from full to zero
|
||||
interp.update
|
||||
interp.set(viewport.rect)
|
||||
bg.oy=(bg.bitmap.height-viewport.rect.height)/2
|
||||
phase=6 if interp.done?
|
||||
bg.oy = (bg.bitmap.height - viewport.rect.height) / 2
|
||||
phase = 6 if interp.done?
|
||||
end
|
||||
# Constantly stream the strobes across the screen
|
||||
for strobe in strobes
|
||||
strobe.ox=strobe.viewport.rect.x
|
||||
strobe.oy=strobe.viewport.rect.y
|
||||
strobe.ox = strobe.viewport.rect.x
|
||||
strobe.oy = strobe.viewport.rect.y
|
||||
if !strobe.visible # Initial placement of strobes
|
||||
randomY = 16*(1+rand(bg.bitmap.height/16-2))
|
||||
strobe.y = randomY+(Graphics.height-bg.bitmap.height)/2
|
||||
randomY = 16 * (1 + rand(bg.bitmap.height / 16 - 2))
|
||||
strobe.y = randomY + (Graphics.height - bg.bitmap.height) / 2
|
||||
strobe.x = rand(Graphics.width)
|
||||
strobe.visible = true
|
||||
elsif strobe.x<Graphics.width # Move strobe right
|
||||
elsif strobe.x < Graphics.width # Move strobe right
|
||||
strobe.x += strobeSpeed
|
||||
else # Strobe is off the screen, reposition it to the left of the screen
|
||||
randomY = 16*(1+rand(bg.bitmap.height/16-2))
|
||||
strobe.y = randomY+(Graphics.height-bg.bitmap.height)/2
|
||||
strobe.x = -strobe.bitmap.width-rand(Graphics.width/4)
|
||||
randomY = 16 * (1 + rand(bg.bitmap.height / 16 - 2))
|
||||
strobe.y = randomY + (Graphics.height - bg.bitmap.height) / 2
|
||||
strobe.x = -strobe.bitmap.width - rand(Graphics.width / 4)
|
||||
end
|
||||
end
|
||||
pbUpdateSceneMap
|
||||
break if phase==6
|
||||
break if phase == 6
|
||||
end
|
||||
sprite.dispose
|
||||
for strobe in strobes
|
||||
@@ -188,7 +188,7 @@ end
|
||||
def pbCut
|
||||
move = :CUT
|
||||
movefinder = $player.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_CUT,false) || (!$DEBUG && !movefinder)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_CUT, false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("This tree looks like it can be cut down."))
|
||||
return false
|
||||
end
|
||||
@@ -196,15 +196,15 @@ def pbCut
|
||||
if pbConfirmMessage(_INTL("Would you like to cut it?"))
|
||||
$stats.cut_count += 1
|
||||
speciesname = (movefinder) ? movefinder.name : $player.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:CUT,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_CUT,showmsg)
|
||||
HiddenMoveHandlers::CanUseMove.add(:CUT, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_CUT, showmsg)
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
if !facingEvent || !facingEvent.name[/cuttree/i]
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
@@ -213,9 +213,9 @@ HiddenMoveHandlers::CanUseMove.add(:CUT,proc { |move,pkmn,showmsg|
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:CUT,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:CUT, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
$stats.cut_count += 1
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
@@ -228,20 +228,20 @@ HiddenMoveHandlers::UseMove.add(:CUT,proc { |move,pokemon|
|
||||
def pbSmashEvent(event)
|
||||
return if !event
|
||||
if event.name[/cuttree/i]
|
||||
pbSEPlay("Cut",80)
|
||||
pbSEPlay("Cut", 80)
|
||||
elsif event.name[/smashrock/i]
|
||||
pbSEPlay("Rock Smash",80)
|
||||
pbSEPlay("Rock Smash", 80)
|
||||
end
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::Wait,2,
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::Wait, 2,
|
||||
PBMoveRoute::TurnLeft,
|
||||
PBMoveRoute::Wait,2,
|
||||
PBMoveRoute::Wait, 2,
|
||||
PBMoveRoute::TurnRight,
|
||||
PBMoveRoute::Wait,2,
|
||||
PBMoveRoute::Wait, 2,
|
||||
PBMoveRoute::TurnUp,
|
||||
PBMoveRoute::Wait,2
|
||||
PBMoveRoute::Wait, 2
|
||||
])
|
||||
pbWait(Graphics.frame_rate*4/10)
|
||||
pbWait(Graphics.frame_rate * 4 / 10)
|
||||
event.erase
|
||||
$PokemonMap.addErasedEvent(event.id) if $PokemonMap
|
||||
end
|
||||
@@ -251,9 +251,9 @@ end
|
||||
#===============================================================================
|
||||
# Dig
|
||||
#===============================================================================
|
||||
HiddenMoveHandlers::CanUseMove.add(:DIG,proc { |move,pkmn,showmsg|
|
||||
HiddenMoveHandlers::CanUseMove.add(:DIG, proc { |move, pkmn, showmsg|
|
||||
escape = ($PokemonGlobal.escapePoint rescue nil)
|
||||
if !escape || escape==[]
|
||||
if !escape || escape == []
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -264,18 +264,18 @@ HiddenMoveHandlers::CanUseMove.add(:DIG,proc { |move,pkmn,showmsg|
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::ConfirmUseMove.add(:DIG,proc { |move,pkmn|
|
||||
HiddenMoveHandlers::ConfirmUseMove.add(:DIG, proc { |move, pkmn|
|
||||
escape = ($PokemonGlobal.escapePoint rescue nil)
|
||||
next false if !escape || escape==[]
|
||||
next false if !escape || escape == []
|
||||
mapname = pbGetMapNameFromId(escape[0])
|
||||
next pbConfirmMessage(_INTL("Want to escape from here and return to {1}?",mapname))
|
||||
next pbConfirmMessage(_INTL("Want to escape from here and return to {1}?", mapname))
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:DIG,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:DIG, proc { |move, pokemon|
|
||||
escape = ($PokemonGlobal.escapePoint rescue nil)
|
||||
if escape
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = escape[0]
|
||||
@@ -303,13 +303,13 @@ def pbDive
|
||||
return false if !map_metadata || !map_metadata.dive_map_id
|
||||
move = :DIVE
|
||||
movefinder = $player.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE,false) || (!$DEBUG && !movefinder)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("The sea is deep here. A Pokémon may be able to go underwater."))
|
||||
return false
|
||||
end
|
||||
if pbConfirmMessage(_INTL("The sea is deep here. Would you like to use Dive?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $player.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = map_metadata.dive_map_id
|
||||
@@ -341,13 +341,13 @@ def pbSurfacing
|
||||
return if !surface_map_id
|
||||
move = :DIVE
|
||||
movefinder = $player.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE,false) || (!$DEBUG && !movefinder)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("Light is filtering down from above. A Pokémon may be able to surface here."))
|
||||
return false
|
||||
end
|
||||
if pbConfirmMessage(_INTL("Light is filtering down from above. Would you like to use Dive?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $player.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = surface_map_id
|
||||
@@ -359,7 +359,7 @@ def pbSurfacing
|
||||
pbUpdateVehicle
|
||||
$scene.transfer_player(false)
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
(surfbgm) ? pbBGMPlay(surfbgm) : $game_map.autoplayAsCue
|
||||
(surfbgm) ? pbBGMPlay(surfbgm) : $game_map.autoplayAsCue
|
||||
$game_map.refresh
|
||||
}
|
||||
return true
|
||||
@@ -368,7 +368,7 @@ def pbSurfacing
|
||||
end
|
||||
|
||||
# @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')
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = mapid
|
||||
@@ -398,8 +398,8 @@ Events.onAction += proc { |_sender, _e|
|
||||
end
|
||||
}
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE,showmsg)
|
||||
HiddenMoveHandlers::CanUseMove.add(:DIVE, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, showmsg)
|
||||
if $PokemonGlobal.diving
|
||||
surface_map_id = nil
|
||||
GameData::MapMetadata.each do |map_data|
|
||||
@@ -425,7 +425,7 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:DIVE, proc { |move, pokemon|
|
||||
wasdiving = $PokemonGlobal.diving
|
||||
if $PokemonGlobal.diving
|
||||
dive_map_id = nil
|
||||
@@ -439,7 +439,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
|
||||
end
|
||||
next false if !dive_map_id
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = dive_map_id
|
||||
@@ -461,8 +461,8 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
|
||||
#===============================================================================
|
||||
# Flash
|
||||
#===============================================================================
|
||||
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_FLASH,showmsg)
|
||||
HiddenMoveHandlers::CanUseMove.add(:FLASH, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_FLASH, showmsg)
|
||||
if !$game_map.metadata&.dark_map
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
@@ -474,21 +474,21 @@ HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:FLASH,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:FLASH, proc { |move, pokemon|
|
||||
darkness = $game_temp.darkness_sprite
|
||||
next false if !darkness || darkness.disposed?
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
$PokemonGlobal.flashUsed = true
|
||||
$stats.flash_count += 1
|
||||
radiusDiff = 8*20/Graphics.frame_rate
|
||||
while darkness.radius<darkness.radiusMax
|
||||
radiusDiff = 8 * 20 / Graphics.frame_rate
|
||||
while darkness.radius < darkness.radiusMax
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
darkness.radius += radiusDiff
|
||||
darkness.radius = darkness.radiusMax if darkness.radius>darkness.radiusMax
|
||||
darkness.radius = darkness.radiusMax if darkness.radius > darkness.radiusMax
|
||||
end
|
||||
next true
|
||||
})
|
||||
@@ -542,11 +542,11 @@ def pbFlyToNewLocation(pkmn = nil, move = :FLY)
|
||||
return true
|
||||
end
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:FLY,proc { |move, pkmn, showmsg|
|
||||
HiddenMoveHandlers::CanUseMove.add(:FLY, proc { |move, pkmn, showmsg|
|
||||
next pbCanFly?(pkmn, showmsg)
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:FLY,proc { |move, pkmn|
|
||||
HiddenMoveHandlers::UseMove.add(:FLY, proc { |move, pkmn|
|
||||
if $game_temp.fly_destination.nil?
|
||||
pbMessage(_INTL("Can't use that here."))
|
||||
next false
|
||||
@@ -562,21 +562,21 @@ HiddenMoveHandlers::UseMove.add(:FLY,proc { |move, pkmn|
|
||||
#===============================================================================
|
||||
def pbHeadbuttEffect(event = nil)
|
||||
event = $game_player.pbFacingEvent(true) if !event
|
||||
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 = (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
|
||||
b = $player.public_ID % 10 # Practically equal odds of each value
|
||||
chance = 1 # ~50%
|
||||
if a==b # 10%
|
||||
if a == b # 10%
|
||||
chance = 8
|
||||
elsif a>b && (a-b).abs<5 # ~30.3%
|
||||
elsif a > b && (a - b).abs < 5 # ~30.3%
|
||||
chance = 5
|
||||
elsif a<b && (a-b).abs>5 # ~9.7%
|
||||
elsif a < b && (a - b).abs > 5 # ~9.7%
|
||||
chance = 5
|
||||
end
|
||||
if rand(10)>=chance
|
||||
if rand(10) >= chance
|
||||
pbMessage(_INTL("Nope. Nothing..."))
|
||||
else
|
||||
enctype = (chance==1) ? :HeadbuttLow : :HeadbuttHigh
|
||||
enctype = (chance == 1) ? :HeadbuttLow : :HeadbuttHigh
|
||||
if pbEncounter(enctype)
|
||||
$stats.headbutt_battles += 1
|
||||
else
|
||||
@@ -595,7 +595,7 @@ def pbHeadbutt(event = nil)
|
||||
if pbConfirmMessage(_INTL("A Pokémon could be in this tree. Would you like to use Headbutt?"))
|
||||
$stats.headbutt_count += 1
|
||||
speciesname = (movefinder) ? movefinder.name : $player.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbHeadbuttEffect(event)
|
||||
return true
|
||||
@@ -603,7 +603,7 @@ def pbHeadbutt(event = nil)
|
||||
return false
|
||||
end
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:HEADBUTT,proc { |move,pkmn,showmsg|
|
||||
HiddenMoveHandlers::CanUseMove.add(:HEADBUTT, proc { |move, pkmn, showmsg|
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
if !facingEvent || !facingEvent.name[/headbutttree/i]
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
@@ -612,9 +612,9 @@ HiddenMoveHandlers::CanUseMove.add(:HEADBUTT,proc { |move,pkmn,showmsg|
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:HEADBUTT,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:HEADBUTT, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
$stats.headbutt_count += 1
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
@@ -636,22 +636,22 @@ end
|
||||
def pbRockSmash
|
||||
move = :ROCKSMASH
|
||||
movefinder = $player.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_ROCKSMASH,false) || (!$DEBUG && !movefinder)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_ROCKSMASH, false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("It's a rugged rock, but a Pokémon may be able to smash it."))
|
||||
return false
|
||||
end
|
||||
if pbConfirmMessage(_INTL("This rock appears to be breakable. Would you like to use Rock Smash?"))
|
||||
$stats.rock_smash_count += 1
|
||||
speciesname = (movefinder) ? movefinder.name : $player.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:ROCKSMASH,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_ROCKSMASH,showmsg)
|
||||
HiddenMoveHandlers::CanUseMove.add(:ROCKSMASH, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_ROCKSMASH, showmsg)
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
if !facingEvent || !facingEvent.name[/smashrock/i]
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
@@ -660,9 +660,9 @@ HiddenMoveHandlers::CanUseMove.add(:ROCKSMASH,proc { |move,pkmn,showmsg|
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:ROCKSMASH,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:ROCKSMASH, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
$stats.rock_smash_count += 1
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
@@ -685,29 +685,29 @@ def pbStrength
|
||||
end
|
||||
move = :STRENGTH
|
||||
movefinder = $player.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_STRENGTH,false) || (!$DEBUG && !movefinder)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_STRENGTH, false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("It's a big boulder, but a Pokémon may be able to push it aside."))
|
||||
return false
|
||||
end
|
||||
pbMessage(_INTL("It's a big boulder, but a Pokémon may be able to push it aside.\1"))
|
||||
if pbConfirmMessage(_INTL("Would you like to use Strength?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $player.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbMessage(_INTL("{1}'s Strength made it possible to move boulders around!",speciesname))
|
||||
pbMessage(_INTL("{1}'s Strength made it possible to move boulders around!", speciesname))
|
||||
$PokemonMap.strengthUsed = true
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
pbStrength if facingEvent && facingEvent.name[/strengthboulder/i]
|
||||
}
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:STRENGTH,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_STRENGTH,showmsg)
|
||||
HiddenMoveHandlers::CanUseMove.add(:STRENGTH, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_STRENGTH, showmsg)
|
||||
if $PokemonMap.strengthUsed
|
||||
pbMessage(_INTL("Strength is already being used.")) if showmsg
|
||||
next false
|
||||
@@ -715,11 +715,11 @@ HiddenMoveHandlers::CanUseMove.add(:STRENGTH,proc { |move,pkmn,showmsg|
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:STRENGTH,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:STRENGTH, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!\1",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!\1", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
pbMessage(_INTL("{1}'s Strength made it possible to move boulders around!",pokemon.name))
|
||||
pbMessage(_INTL("{1}'s Strength made it possible to move boulders around!", pokemon.name))
|
||||
$PokemonMap.strengthUsed = true
|
||||
next true
|
||||
})
|
||||
@@ -734,16 +734,16 @@ def pbSurf
|
||||
return false if !$game_player.can_ride_vehicle_with_follower?
|
||||
move = :SURF
|
||||
movefinder = $player.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF,false) || (!$DEBUG && !movefinder)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, false) || (!$DEBUG && !movefinder)
|
||||
return false
|
||||
end
|
||||
if pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $player.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbCancelVehicles
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
pbCueBGM(surfbgm,0.5) if surfbgm
|
||||
pbCueBGM(surfbgm, 0.5) if surfbgm
|
||||
pbStartSurfing
|
||||
return true
|
||||
end
|
||||
@@ -759,19 +759,19 @@ def pbStartSurfing
|
||||
$game_temp.surf_base_coords = $map_factory.getFacingCoords($game_player.x, $game_player.y, $game_player.direction)
|
||||
pbJumpToward
|
||||
$game_temp.surf_base_coords = nil
|
||||
$game_player.check_event_trigger_here([1,2])
|
||||
$game_player.check_event_trigger_here([1, 2])
|
||||
end
|
||||
|
||||
def pbEndSurf(_xOffset,_yOffset)
|
||||
def pbEndSurf(_xOffset, _yOffset)
|
||||
return false if !$PokemonGlobal.surfing
|
||||
x = $game_player.x
|
||||
y = $game_player.y
|
||||
if $game_map.terrain_tag(x,y).can_surf && !$game_player.pbFacingTerrainTag.can_surf
|
||||
if $game_map.terrain_tag(x, y).can_surf && !$game_player.pbFacingTerrainTag.can_surf
|
||||
$game_temp.surf_base_coords = [x, y]
|
||||
if pbJumpToward(1,false,true)
|
||||
if pbJumpToward(1, false, true)
|
||||
$game_map.autoplayAsCue
|
||||
$game_player.increase_steps
|
||||
result = $game_player.check_event_trigger_here([1,2])
|
||||
result = $game_player.check_event_trigger_here([1, 2])
|
||||
pbOnStepTaken(result)
|
||||
end
|
||||
$game_temp.surf_base_coords = nil
|
||||
@@ -781,7 +781,7 @@ def pbEndSurf(_xOffset,_yOffset)
|
||||
end
|
||||
|
||||
# @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')
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = mapid
|
||||
@@ -794,16 +794,16 @@ def pbTransferSurfing(mapid,xcoord,ycoord,direction = $game_player.direction)
|
||||
}
|
||||
end
|
||||
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
next if $PokemonGlobal.surfing
|
||||
next if $game_map.metadata&.always_bicycle
|
||||
next if !$game_player.pbFacingTerrainTag.can_surf_freely
|
||||
next if !$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||
next if !$game_map.passable?($game_player.x, $game_player.y, $game_player.direction, $game_player)
|
||||
pbSurf
|
||||
}
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:SURF,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF,showmsg)
|
||||
HiddenMoveHandlers::CanUseMove.add(:SURF, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, showmsg)
|
||||
if $PokemonGlobal.surfing
|
||||
pbMessage(_INTL("You're already surfing.")) if showmsg
|
||||
next false
|
||||
@@ -817,21 +817,21 @@ HiddenMoveHandlers::CanUseMove.add(:SURF,proc { |move,pkmn,showmsg|
|
||||
next false
|
||||
end
|
||||
if !$game_player.pbFacingTerrainTag.can_surf_freely ||
|
||||
!$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||
!$game_map.passable?($game_player.x, $game_player.y, $game_player.direction, $game_player)
|
||||
pbMessage(_INTL("No surfing here!")) if showmsg
|
||||
next false
|
||||
end
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:SURF,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:SURF, proc { |move, pokemon|
|
||||
$game_temp.in_menu = false
|
||||
pbCancelVehicles
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
pbCueBGM(surfbgm,0.5) if surfbgm
|
||||
pbCueBGM(surfbgm, 0.5) if surfbgm
|
||||
pbStartSurfing
|
||||
next true
|
||||
})
|
||||
@@ -846,7 +846,7 @@ def pbSweetScent
|
||||
pbMessage(_INTL("The sweet scent faded for some reason..."))
|
||||
return
|
||||
end
|
||||
viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
viewport.z = 99999
|
||||
count = 0
|
||||
viewport.color.red = 255
|
||||
@@ -855,9 +855,9 @@ def pbSweetScent
|
||||
viewport.color.alpha -= 10
|
||||
alphaDiff = 12 * 20 / Graphics.frame_rate
|
||||
loop do
|
||||
if count==0 && viewport.color.alpha<128
|
||||
if count == 0 && viewport.color.alpha < 128
|
||||
viewport.color.alpha += alphaDiff
|
||||
elsif count>Graphics.frame_rate/4
|
||||
elsif count > Graphics.frame_rate / 4
|
||||
viewport.color.alpha -= alphaDiff
|
||||
else
|
||||
count += 1
|
||||
@@ -865,7 +865,7 @@ def pbSweetScent
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
break if viewport.color.alpha<=0
|
||||
break if viewport.color.alpha <= 0
|
||||
end
|
||||
viewport.dispose
|
||||
enctype = $PokemonEncounters.encounter_type
|
||||
@@ -875,13 +875,13 @@ def pbSweetScent
|
||||
end
|
||||
end
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:SWEETSCENT,proc { |move,pkmn,showmsg|
|
||||
HiddenMoveHandlers::CanUseMove.add(:SWEETSCENT, proc { |move, pkmn, showmsg|
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:SWEETSCENT,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:SWEETSCENT, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
pbSweetScent
|
||||
next true
|
||||
@@ -892,7 +892,7 @@ HiddenMoveHandlers::UseMove.add(:SWEETSCENT,proc { |move,pokemon|
|
||||
#===============================================================================
|
||||
# Teleport
|
||||
#===============================================================================
|
||||
HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
|
||||
HiddenMoveHandlers::CanUseMove.add(:TELEPORT, proc { |move, pkmn, showmsg|
|
||||
if !$game_map.metadata&.outdoor_map
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
@@ -911,22 +911,22 @@ HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn|
|
||||
HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT, proc { |move, pkmn|
|
||||
healing = $PokemonGlobal.healingSpot
|
||||
healing = GameData::PlayerMetadata.get($player.character_ID)&.home if !healing
|
||||
healing = GameData::Metadata.get.home if !healing # Home
|
||||
next false if !healing
|
||||
mapname = pbGetMapNameFromId(healing[0])
|
||||
next pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname))
|
||||
next pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?", mapname))
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:TELEPORT,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:TELEPORT, proc { |move, pokemon|
|
||||
healing = $PokemonGlobal.healingSpot
|
||||
healing = GameData::PlayerMetadata.get($player.character_ID)&.home if !healing
|
||||
healing = GameData::Metadata.get.home if !healing # Home
|
||||
next false if !healing
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = healing[0]
|
||||
@@ -985,13 +985,13 @@ end
|
||||
def pbWaterfall
|
||||
move = :WATERFALL
|
||||
movefinder = $player.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL,false) || (!$DEBUG && !movefinder)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL, false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
|
||||
return false
|
||||
end
|
||||
if pbConfirmMessage(_INTL("It's a large waterfall. Would you like to use Waterfall?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $player.name
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbAscendWaterfall
|
||||
return true
|
||||
@@ -999,7 +999,7 @@ def pbWaterfall
|
||||
return false
|
||||
end
|
||||
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
terrain = $game_player.pbFacingTerrainTag
|
||||
if terrain.waterfall
|
||||
pbWaterfall
|
||||
@@ -1008,8 +1008,8 @@ Events.onAction += proc { |_sender,_e|
|
||||
end
|
||||
}
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:WATERFALL,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL,showmsg)
|
||||
HiddenMoveHandlers::CanUseMove.add(:WATERFALL, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL, showmsg)
|
||||
if !$game_player.pbFacingTerrainTag.waterfall
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
@@ -1017,9 +1017,9 @@ HiddenMoveHandlers::CanUseMove.add(:WATERFALL,proc { |move,pkmn,showmsg|
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:WATERFALL,proc { |move,pokemon|
|
||||
HiddenMoveHandlers::UseMove.add(:WATERFALL, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
pbAscendWaterfall
|
||||
next true
|
||||
|
||||
@@ -37,38 +37,38 @@ def pbFishingEnd
|
||||
$PokemonGlobal.fishing = false
|
||||
end
|
||||
|
||||
def pbFishing(hasEncounter,rodType = 1)
|
||||
def pbFishing(hasEncounter, rodType = 1)
|
||||
$stats.fishing_count += 1
|
||||
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
|
||||
biteChance *= 1.5 if speedup # 67.5, 100, 100
|
||||
hookChance = 100
|
||||
pbFishingBegin
|
||||
msgWindow = pbCreateMessageWindow
|
||||
ret = false
|
||||
loop do
|
||||
time = 5+rand(6)
|
||||
time = [time,5+rand(6)].min if speedup
|
||||
time = 5 + rand(6)
|
||||
time = [time, 5 + rand(6)].min if speedup
|
||||
message = ""
|
||||
time.times { message += ". " }
|
||||
if pbWaitMessage(msgWindow,time)
|
||||
if pbWaitMessage(msgWindow, time)
|
||||
pbFishingEnd {
|
||||
pbMessageDisplay(msgWindow,_INTL("Not even a nibble..."))
|
||||
pbMessageDisplay(msgWindow, _INTL("Not even a nibble..."))
|
||||
}
|
||||
break
|
||||
end
|
||||
if hasEncounter && rand(100)<biteChance
|
||||
$scene.spriteset.addUserAnimation(Settings::EXCLAMATION_ANIMATION_ID,$game_player.x,$game_player.y,true,3)
|
||||
frames = Graphics.frame_rate - rand(Graphics.frame_rate/2) # 0.5-1 second
|
||||
if !pbWaitForInput(msgWindow,message+_INTL("\r\nOh! A bite!"),frames)
|
||||
if hasEncounter && rand(100) < biteChance
|
||||
$scene.spriteset.addUserAnimation(Settings::EXCLAMATION_ANIMATION_ID, $game_player.x, $game_player.y, true, 3)
|
||||
frames = Graphics.frame_rate - rand(Graphics.frame_rate / 2) # 0.5-1 second
|
||||
if !pbWaitForInput(msgWindow, message + _INTL("\r\nOh! A bite!"), frames)
|
||||
pbFishingEnd {
|
||||
pbMessageDisplay(msgWindow,_INTL("The Pokémon got away..."))
|
||||
pbMessageDisplay(msgWindow, _INTL("The Pokémon got away..."))
|
||||
}
|
||||
break
|
||||
end
|
||||
if Settings::FISHING_AUTO_HOOK || rand(100) < hookChance
|
||||
pbFishingEnd {
|
||||
pbMessageDisplay(msgWindow,_INTL("Landed a Pokémon!")) if !Settings::FISHING_AUTO_HOOK
|
||||
pbMessageDisplay(msgWindow, _INTL("Landed a Pokémon!")) if !Settings::FISHING_AUTO_HOOK
|
||||
}
|
||||
ret = true
|
||||
break
|
||||
@@ -77,7 +77,7 @@ def pbFishing(hasEncounter,rodType = 1)
|
||||
# hookChance += 15
|
||||
else
|
||||
pbFishingEnd {
|
||||
pbMessageDisplay(msgWindow,_INTL("Not even a nibble..."))
|
||||
pbMessageDisplay(msgWindow, _INTL("Not even a nibble..."))
|
||||
}
|
||||
break
|
||||
end
|
||||
@@ -87,12 +87,12 @@ def pbFishing(hasEncounter,rodType = 1)
|
||||
end
|
||||
|
||||
# Show waiting dots before a Pokémon bites
|
||||
def pbWaitMessage(msgWindow,time)
|
||||
def pbWaitMessage(msgWindow, time)
|
||||
message = ""
|
||||
periodTime = Graphics.frame_rate*4/10 # 0.4 seconds, 16 frames per dot
|
||||
(time+1).times do |i|
|
||||
message += ". " if i>0
|
||||
pbMessageDisplay(msgWindow,message,false)
|
||||
periodTime = Graphics.frame_rate * 4 / 10 # 0.4 seconds, 16 frames per dot
|
||||
(time + 1).times do |i|
|
||||
message += ". " if i > 0
|
||||
pbMessageDisplay(msgWindow, message, false)
|
||||
periodTime.times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -106,8 +106,8 @@ def pbWaitMessage(msgWindow,time)
|
||||
end
|
||||
|
||||
# A Pokémon is biting, reflex test to reel it in
|
||||
def pbWaitForInput(msgWindow,message,frames)
|
||||
pbMessageDisplay(msgWindow,message,false)
|
||||
def pbWaitForInput(msgWindow, message, frames)
|
||||
pbMessageDisplay(msgWindow, message, false)
|
||||
numFrame = 0
|
||||
twitchFrame = 0
|
||||
twitchFrameTime = Graphics.frame_rate * 2 / 10 # 0.2 seconds, 8 frames
|
||||
@@ -116,8 +116,8 @@ def pbWaitForInput(msgWindow,message,frames)
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
# Twitch cycle: 1,0,1,0,0,0,0,0
|
||||
twitchFrame = (twitchFrame+1)%(twitchFrameTime*8)
|
||||
case twitchFrame%twitchFrameTime
|
||||
twitchFrame = (twitchFrame + 1) % (twitchFrameTime * 8)
|
||||
case twitchFrame % twitchFrameTime
|
||||
when 0, 2
|
||||
$game_player.pattern = 1
|
||||
else
|
||||
|
||||
@@ -555,7 +555,7 @@ end
|
||||
# With each step taken, add Exp to Pokémon in the Day Care and try to generate
|
||||
# an egg.
|
||||
#===============================================================================
|
||||
Events.onStepTaken += proc { |_sender,_e|
|
||||
Events.onStepTaken += proc { |_sender, _e|
|
||||
$PokemonGlobal.day_care.update_on_step_taken
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ module RandomDungeonGenerator
|
||||
|
||||
def clearVisited(x, y)
|
||||
return if x < 0 || y < 0 || x >= cellWidth || x >= cellHeight
|
||||
@cells[y * cellWidth + x] &=~EdgeMasks::Visited
|
||||
@cells[y * cellWidth + x] &= ~EdgeMasks::Visited
|
||||
end
|
||||
|
||||
def clearAllCells
|
||||
@@ -367,7 +367,7 @@ module RandomDungeonGenerator
|
||||
setEdgeNode(ox, oy, dir)
|
||||
return
|
||||
end
|
||||
setEdgeNode(ox,oy,dir)
|
||||
setEdgeNode(ox, oy, dir)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -507,7 +507,7 @@ module RandomDungeonGenerator
|
||||
(r2[0] >= r1[0] + r1[2]) ||
|
||||
(r2[1] + r2[3] <= r1[1]) ||
|
||||
(r2[1] >= r1[1] + r1[3])) &&
|
||||
((r1[0] <= r2[0] + r2[2])||
|
||||
((r1[0] <= r2[0] + r2[2]) ||
|
||||
(r1[0] >= r2[0] + r2[2]) ||
|
||||
(r1[1] + r1[3] <= r2[1]) ||
|
||||
(r1[1] >= r2[1] + r2[3]))
|
||||
@@ -543,7 +543,7 @@ module RandomDungeonGenerator
|
||||
return false
|
||||
end
|
||||
|
||||
def paint_room(rect,offsetX,offsetY)
|
||||
def paint_room(rect, offsetX, offsetY)
|
||||
for y in (rect[1] + offsetY)...(rect[1] + offsetY + rect[3])
|
||||
for x in (rect[0] + offsetX)...(rect[0] + offsetX + rect[2])
|
||||
self[x, y] = DungeonTile::ROOM
|
||||
|
||||
Reference in New Issue
Block a user