More or less standardised separator comments in the code

This commit is contained in:
Maruno17
2024-06-27 21:21:26 +01:00
parent 225549bfce
commit 509a414f37
198 changed files with 1907 additions and 1263 deletions

View File

@@ -1,6 +1,8 @@
#===============================================================================
# All weather particles are assumed to start at the top/right and move to the
# bottom/left. Particles are only reset if they are off-screen to the left or
# bottom.
#===============================================================================
module RPG
class Weather
attr_reader :type

View File

@@ -1,5 +1,5 @@
#===============================================================================
# Constant checks
# Constant checks.
#===============================================================================
# Pokérus check
EventHandlers.add(:on_frame_update, :pokerus_counter,
@@ -64,7 +64,7 @@ EventHandlers.add(:on_frame_update, :cue_bgm_after_delay,
)
#===============================================================================
# Checks per step
# Checks per step.
#===============================================================================
# Party Pokémon gain happiness from walking
EventHandlers.add(:on_player_step_taken, :gain_happiness,
@@ -122,7 +122,7 @@ def pbCheckAllFainted
end
end
# Gather soot from soot grass
# Gather soot from soot grass.
EventHandlers.add(:on_step_taken, :pick_up_soot,
proc { |event|
thistile = $map_factory.getRealTilePos(event.map.map_id, event.x, event.y)
@@ -142,7 +142,7 @@ EventHandlers.add(:on_step_taken, :pick_up_soot,
}
)
# Show grass rustle animation
# Show grass rustle animation.
EventHandlers.add(:on_step_taken, :grass_rustling,
proc { |event|
next if !$scene.is_a?(Scene_Map)
@@ -155,7 +155,7 @@ EventHandlers.add(:on_step_taken, :grass_rustling,
}
)
# Show water ripple animation
# Show water ripple animation.
EventHandlers.add(:on_step_taken, :still_water_ripple,
proc { |event|
next if !$scene.is_a?(Scene_Map)
@@ -168,7 +168,7 @@ EventHandlers.add(:on_step_taken, :still_water_ripple,
}
)
# Auto-move the player over waterfalls and ice
# Auto-move the player over waterfalls and ice.
EventHandlers.add(:on_step_taken, :auto_move_player,
proc { |event|
next if !$scene.is_a?(Scene_Map)
@@ -211,7 +211,7 @@ def pbOnStepTaken(eventTriggered)
$game_temp.encounter_triggered = false # This info isn't needed here
end
# Start wild encounters while turning on the spot
# Start wild encounters while turning on the spot.
EventHandlers.add(:on_player_change_direction, :trigger_encounter,
proc {
repel_active = ($PokemonGlobal.repel > 0)
@@ -243,7 +243,7 @@ def pbBattleOnStepTaken(repel_active)
end
#===============================================================================
# Checks when moving between maps
# Checks when moving between maps.
#===============================================================================
# Set up various data related to the new map.
EventHandlers.add(:on_enter_map, :setup_new_map,
@@ -340,7 +340,7 @@ EventHandlers.add(:on_map_or_spriteset_change, :show_location_window,
)
#===============================================================================
# Event locations, terrain tags
# Event locations, terrain tags.
#===============================================================================
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
def pbFacingTile(direction = nil, event = nil)
@@ -425,7 +425,7 @@ def pbFacingEachOther(event1, event2)
end
#===============================================================================
# Audio playing
# Audio playing.
#===============================================================================
def pbCueBGM(bgm, seconds, volume = nil, pitch = nil)
return if !bgm
@@ -462,7 +462,7 @@ def pbAutoplayOnSave
end
#===============================================================================
# Event movement
# Event movement.
#===============================================================================
module PBMoveRoute
DOWN = 1
@@ -550,7 +550,7 @@ def pbMoveRoute(event, commands, waitComplete = false)
return route
end
# duration is in seconds
# duration is in seconds.
def pbWait(duration)
timer_start = System.uptime
until System.uptime - timer_start >= duration
@@ -562,7 +562,7 @@ def pbWait(duration)
end
#===============================================================================
# Player/event movement in the field
# Player/event movement in the field.
#===============================================================================
def pbSlideOnIce
if !$DEBUG || !Input.press?(Input::CTRL)
@@ -616,7 +616,7 @@ def pbMoveTowardPlayer(event)
end
#===============================================================================
# Bridges, cave escape points, and setting the heal point
# Bridges, cave escape points, and setting the heal point.
#===============================================================================
def pbBridgeOn(height = 2)
$PokemonGlobal.bridge = height
@@ -659,7 +659,7 @@ def pbSetPokemonCenter
end
#===============================================================================
# Partner trainer
# Partner trainer.
#===============================================================================
def pbRegisterPartner(tr_type, tr_name, tr_id = 0)
tr_type = GameData::TrainerType.get(tr_type).id
@@ -678,7 +678,7 @@ def pbDeregisterPartner
end
#===============================================================================
# Picking up an item found on the ground
# Picking up an item found on the ground.
#===============================================================================
def pbItemBall(item, quantity = 1)
item = GameData::Item.get(item)
@@ -728,7 +728,7 @@ def pbItemBall(item, quantity = 1)
end
#===============================================================================
# Being given an item
# Being given an item.
#===============================================================================
def pbReceiveItem(item, quantity = 1)
item = GameData::Item.get(item)
@@ -763,7 +763,7 @@ def pbReceiveItem(item, quantity = 1)
end
#===============================================================================
# Buying a prize item from the Game Corner
# Buying a prize item from the Game Corner.
#===============================================================================
def pbBuyPrize(item, quantity = 1)
item = GameData::Item.get(item)

View File

@@ -1,5 +1,5 @@
#===============================================================================
# Battle preparation
# Battle preparation.
#===============================================================================
class PokemonGlobalMetadata
attr_accessor :nextBattleBGM
@@ -127,7 +127,7 @@ def pbCanTripleBattle?
end
#===============================================================================
# Helper methods for setting up and closing down battles
# Helper methods for setting up and closing down battles.
#===============================================================================
module BattleCreationHelperMethods
module_function
@@ -343,7 +343,7 @@ module BattleCreationHelperMethods
end
#===============================================================================
# Wild battles
# Wild battles.
#===============================================================================
class WildBattle
# Used when walking in tall grass, hence the additional code.
@@ -436,7 +436,7 @@ class WildBattle
end
#===============================================================================
# Trainer battles
# Trainer battles.
#===============================================================================
class TrainerBattle
# Used by most trainer events, which can be positioned in such a way that
@@ -597,7 +597,7 @@ class TrainerBattle
end
#===============================================================================
# After battles
# After battles.
#===============================================================================
EventHandlers.add(:on_end_battle, :evolve_and_black_out,
proc { |outcome, canLose|

View File

@@ -42,7 +42,7 @@ module SpecialBattleIntroAnimations
end
#===============================================================================
# Battle intro animation
# Battle intro animation.
#===============================================================================
class Game_Temp
attr_accessor :transition_animation_data

View File

@@ -1,5 +1,5 @@
#===============================================================================
# Day and night system
# Day and night system.
#===============================================================================
def pbGetTimeNow
return Time.now
@@ -36,42 +36,45 @@ module PBDayNight
Tone.new(-70, -90, 15, 55) # Night
]
CACHED_TONE_LIFETIME = 30 # In seconds; recalculates overworld tone once per this time
@cachedTone = nil
@dayNightToneLastUpdate = nil
@oneOverSixty = 1 / 60.0
module_function
# Returns true if it's day.
def self.isDay?(time = nil)
def isDay?(time = nil)
time = pbGetTimeNow if !time
return (time.hour >= 5 && time.hour < 20)
end
# Returns true if it's night.
def self.isNight?(time = nil)
def isNight?(time = nil)
time = pbGetTimeNow if !time
return (time.hour >= 20 || time.hour < 5)
end
# Returns true if it's morning.
def self.isMorning?(time = nil)
def isMorning?(time = nil)
time = pbGetTimeNow if !time
return (time.hour >= 5 && time.hour < 10)
end
# Returns true if it's the afternoon.
def self.isAfternoon?(time = nil)
def isAfternoon?(time = nil)
time = pbGetTimeNow if !time
return (time.hour >= 14 && time.hour < 17)
end
# Returns true if it's the evening.
def self.isEvening?(time = nil)
def isEvening?(time = nil)
time = pbGetTimeNow if !time
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
def getShade
time = pbGetDayNightMinutes
time = (24 * 60) - time if time > (12 * 60)
return 255 * time / (12 * 60)
@@ -79,7 +82,7 @@ module PBDayNight
# Gets a Tone object representing a suggested shading
# tone for the current time of day.
def self.getTone
def getTone
@cachedTone = Tone.new(0, 0, 0) if !@cachedTone
return @cachedTone if !Settings::TIME_SHADING
if !@dayNightToneLastUpdate || (System.uptime - @dayNightToneLastUpdate >= CACHED_TONE_LIFETIME)
@@ -89,12 +92,12 @@ module PBDayNight
return @cachedTone
end
def self.pbGetDayNightMinutes
def pbGetDayNightMinutes
now = pbGetTimeNow # Get the current in-game time
return (now.hour * 60) + now.min
end
def self.getToneInternal
def getToneInternal
# Calculates the tone for the current frame, used for day/night effects
realMinutes = pbGetDayNightMinutes
hour = realMinutes / 60
@@ -124,7 +127,7 @@ def pbDayNightTint(object)
end
#===============================================================================
# Days of the week
# Days of the week.
#===============================================================================
def pbIsWeekday(wdayVariable, *arg)
timenow = pbGetTimeNow
@@ -149,7 +152,7 @@ def pbIsWeekday(wdayVariable, *arg)
end
#===============================================================================
# Months
# Months.
#===============================================================================
def pbIsMonth(monVariable, *arg)
timenow = pbGetTimeNow
@@ -196,7 +199,7 @@ def pbGetAbbrevMonthName(month)
end
#===============================================================================
# Seasons
# Seasons.
#===============================================================================
def pbGetSeason
return (pbGetTimeNow.mon - 1) % 4
@@ -232,7 +235,7 @@ def pbGetSeasonName(season)
end
#===============================================================================
# Moon phases and Zodiac
# Moon phases and Zodiac.
#===============================================================================
# Calculates the phase of the moon. time is in UTC.
# 0 - New Moon

View File

@@ -1,5 +1,5 @@
#===============================================================================
# Hidden move handlers
# Hidden move handlers.
#===============================================================================
module HiddenMoveHandlers
CanUseMove = MoveHandlerHash.new
@@ -64,7 +64,7 @@ def pbCheckHiddenMoveBadge(badge = -1, showmsg = true)
end
#===============================================================================
# Hidden move animation
# Hidden move animation.
#===============================================================================
def pbHiddenMoveAnimation(pokemon)
return false if !pokemon
@@ -171,7 +171,7 @@ def pbHiddenMoveAnimation(pokemon)
end
#===============================================================================
# Cut
# Cut.
#===============================================================================
def pbCut
move = :CUT
@@ -227,7 +227,7 @@ def pbSmashEvent(event)
end
#===============================================================================
# Dig
# Dig.
#===============================================================================
HiddenMoveHandlers::CanUseMove.add(:DIG, proc { |move, pkmn, showmsg|
escape = ($PokemonGlobal.escapePoint rescue nil)
@@ -272,7 +272,7 @@ HiddenMoveHandlers::UseMove.add(:DIG, proc { |move, pokemon|
})
#===============================================================================
# Dive
# Dive.
#===============================================================================
def pbDive
map_metadata = $game_map.metadata
@@ -420,7 +420,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE, proc { |move, pokemon|
})
#===============================================================================
# Flash
# Flash.
#===============================================================================
HiddenMoveHandlers::CanUseMove.add(:FLASH, proc { |move, pkmn, showmsg|
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_FLASH, showmsg)
@@ -452,7 +452,7 @@ HiddenMoveHandlers::UseMove.add(:FLASH, proc { |move, pokemon|
})
#===============================================================================
# Fly
# Fly.
#===============================================================================
def pbCanFly?(pkmn = nil, show_messages = false)
return false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_FLY, show_messages)
@@ -513,7 +513,7 @@ HiddenMoveHandlers::UseMove.add(:FLY, proc { |move, pkmn|
})
#===============================================================================
# Headbutt
# Headbutt.
#===============================================================================
def pbHeadbuttEffect(event = nil)
pbSEPlay("Headbutt")
@@ -579,7 +579,7 @@ HiddenMoveHandlers::UseMove.add(:HEADBUTT, proc { |move, pokemon|
})
#===============================================================================
# Rock Smash
# Rock Smash.
#===============================================================================
def pbRockSmashRandomEncounter
if $PokemonEncounters.encounter_triggered?(:RockSmash, false, false)
@@ -629,7 +629,7 @@ HiddenMoveHandlers::UseMove.add(:ROCKSMASH, proc { |move, pokemon|
})
#===============================================================================
# Strength
# Strength.
#===============================================================================
def pbStrength
if $PokemonMap.strengthUsed
@@ -680,7 +680,7 @@ HiddenMoveHandlers::UseMove.add(:STRENGTH, proc { |move, pokemon|
})
#===============================================================================
# Surf
# Surf.
#===============================================================================
def pbSurf
return false if !$game_player.can_ride_vehicle_with_follower?
@@ -786,7 +786,7 @@ HiddenMoveHandlers::UseMove.add(:SURF, proc { |move, pokemon|
})
#===============================================================================
# Sweet Scent
# Sweet Scent.
#===============================================================================
def pbSweetScent
if $game_screen.weather_type != :None
@@ -832,7 +832,7 @@ HiddenMoveHandlers::UseMove.add(:SWEETSCENT, proc { |move, pokemon|
})
#===============================================================================
# Teleport
# Teleport.
#===============================================================================
HiddenMoveHandlers::CanUseMove.add(:TELEPORT, proc { |move, pkmn, showmsg|
if !$game_map.metadata&.outdoor_map
@@ -885,7 +885,7 @@ HiddenMoveHandlers::UseMove.add(:TELEPORT, proc { |move, pokemon|
})
#===============================================================================
# Waterfall
# Waterfall.
#===============================================================================
# Starts the ascending of a waterfall.
def pbAscendWaterfall

View File

@@ -1,5 +1,5 @@
#===============================================================================
# Fishing
# Fishing.
#===============================================================================
def pbFishingBegin
$PokemonGlobal.fishing = true

View File

@@ -316,7 +316,7 @@ class DayCare
end
end
#=============================================================================
#-----------------------------------------------------------------------------
attr_reader :slots
attr_accessor :egg_generated

View File

@@ -115,7 +115,7 @@ module RandomDungeon
return new_x, new_y
end
#===========================================================================
#---------------------------------------------------------------------------
def generate_layout
# Set visitable nodes
@@ -394,7 +394,7 @@ module RandomDungeon
return @map_data.write
end
#===========================================================================
#---------------------------------------------------------------------------
# Returns whether the given coordinates are a room floor that isn't too
# close to a corridor. For positioning events/the player upon entering.
@@ -423,7 +423,7 @@ module RandomDungeon
return tile_is_ground?(@map_data[x, y, 0]) && !tile_is_wall?(@map_data[x, y, 1])
end
#===========================================================================
#---------------------------------------------------------------------------
def generate
@rng_seed = @parameters.rng_seed || $PokemonGlobal.dungeon_rng_seed || Random.new_seed
@@ -505,7 +505,7 @@ module RandomDungeon
end
end
#===========================================================================
#---------------------------------------------------------------------------
# Determines whether all floor tiles are contiguous. Sets @need_redraw if
# there are 2+ floor regions that are isolated from each other.
@@ -725,7 +725,7 @@ module RandomDungeon
end
end
#===========================================================================
#---------------------------------------------------------------------------
# Draws a cell's contents, which is an underlying pattern based on
# tile_layout (the corridors), and possibly a room on top of that.
@@ -975,7 +975,7 @@ module RandomDungeon
end
end
#===========================================================================
#---------------------------------------------------------------------------
# Convert dungeon layout into proper map tiles from a tileset, and modifies
# the given map's data accordingly.