Added decent spacing to all scripts thanks to Rubocop

This commit is contained in:
Maruno17
2021-12-18 15:25:40 +00:00
parent f7b76ae62e
commit d17fc40a47
207 changed files with 18577 additions and 18587 deletions

View File

@@ -98,7 +98,7 @@ class BattleChallenge
opponent = pbGenerateBattleTrainer(self.nextTrainer, self.rules)
bttrainers = pbGetBTTrainers(@id)
trainerdata = bttrainers[self.nextTrainer]
ret = pbOrganizedBattleEx(opponent,self.rules,
ret = pbOrganizedBattleEx(opponent, self.rules,
pbGetMessageFromHash(MessageTypes::EndSpeechLose, trainerdata[4]),
pbGetMessageFromHash(MessageTypes::EndSpeechWin, trainerdata[3]))
return ret

View File

@@ -105,7 +105,7 @@ end
#===============================================================================
def pbRecordLastBattle
$PokemonGlobal.lastbattle = $game_temp.last_battle_record
$game_temp.last_battle_record = nil
$game_temp.last_battle_record = nil
end
def pbPlayLastBattle

View File

@@ -115,7 +115,7 @@ class BattleSwapScene
end
def pbSwapChosen(_pkmnindex)
commands=pbGetCommands(@newPokemon, [])
commands = pbGetCommands(@newPokemon, [])
commands.push(_INTL("PKMN FOR SWAP"))
commands.push(_INTL("CANCEL"))
@sprites["help"].text = _INTL("Select Pokémon to accept.")

View File

@@ -36,7 +36,7 @@ class SafariState
end
def pbStart(ballcount)
@start = [$game_map.map_id,$game_player.x,$game_player.y,$game_player.direction]
@start = [$game_map.map_id, $game_player.x, $game_player.y, $game_player.direction]
@ballcount = ballcount
@inProgress = true
@steps = Settings::SAFARI_STEPS
@@ -55,7 +55,7 @@ end
Events.onMapChange += proc { |_sender,*args|
Events.onMapChange += proc { |_sender, *args|
pbSafariState.pbEnd if !pbInSafari?
}
@@ -75,12 +75,12 @@ def pbSafariState
return $PokemonGlobal.safariState
end
Events.onStepTakenTransferPossible += proc { |_sender,e|
Events.onStepTakenTransferPossible += proc { |_sender, e|
handled = e[0]
next if handled[0]
if pbInSafari? && pbSafariState.decision==0 && Settings::SAFARI_STEPS > 0
if pbInSafari? && pbSafariState.decision == 0 && Settings::SAFARI_STEPS > 0
pbSafariState.steps -= 1
if pbSafariState.steps<=0
if pbSafariState.steps <= 0
pbMessage(_INTL("PA: Ding-dong!\1"))
pbMessage(_INTL("PA: Your safari game is over!"))
pbSafariState.decision = 1
@@ -90,30 +90,30 @@ Events.onStepTakenTransferPossible += proc { |_sender,e|
end
}
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 !pbInSafari?
handled[0] = pbSafariBattle(species,level)
handled[0] = pbSafariBattle(species, level)
}
def pbSafariBattle(species,level)
def pbSafariBattle(species, level)
# Generate a wild Pokémon based on the species and level
pkmn = pbGenerateWildPokemon(species,level)
pkmn = pbGenerateWildPokemon(species, level)
foeParty = [pkmn]
# Calculate who the trainer is
playerTrainer = $player
# Create the battle scene (the visual side of it)
scene = pbNewBattleScene
# Create the battle class (the mechanics side of it)
battle = SafariBattle.new(scene,playerTrainer,foeParty)
battle = SafariBattle.new(scene, playerTrainer, foeParty)
battle.ballCount = pbSafariState.ballcount
pbPrepareBattle(battle)
# Perform the battle itself
decision = 0
pbBattleAnimation(pbGetWildBattleBGM(foeParty),0,foeParty) {
pbBattleAnimation(pbGetWildBattleBGM(foeParty), 0, foeParty) {
pbSceneStandby {
decision = battle.pbStartBattle
}
@@ -121,8 +121,8 @@ def pbSafariBattle(species,level)
Input.update
# Update Safari game data based on result of battle
pbSafariState.ballcount = battle.ballCount
if pbSafariState.ballcount<=0
if decision!=2 # Last Safari Ball was used to catch the wild Pokémon
if pbSafariState.ballcount <= 0
if decision != 2 # Last Safari Ball was used to catch the wild Pokémon
pbMessage(_INTL("Announcer: You're out of Safari Balls! Game over!"))
end
pbSafariState.decision = 1
@@ -138,9 +138,9 @@ def pbSafariBattle(species,level)
pbSafariState.captures += 1
$stats.most_captures_per_safari_game = [$stats.most_captures_per_safari_game, pbSafariState.captures].max
end
pbSet(1,decision)
pbSet(1, decision)
# 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 the outcome of the battle
return decision
end

View File

@@ -67,14 +67,14 @@ class PokemonChallengeRules
@levelAdjustment.unadjustLevels(party1, party2, adjusts) if @levelAdjustment && adjusts
end
def adjustLevelsBilateral(party1,party2)
def adjustLevelsBilateral(party1, party2)
if @levelAdjustment && @levelAdjustment.type == LevelAdjustment::BothTeams
return @levelAdjustment.adjustLevels(party1, party2)
end
return nil
end
def unadjustLevelsBilateral(party1,party2,adjusts)
def unadjustLevelsBilateral(party1, party2, adjusts)
if @levelAdjustment && adjusts && @levelAdjustment.type == LevelAdjustment::BothTeams
@levelAdjustment.unadjustLevels(party1, party2, adjusts)
end
@@ -85,7 +85,7 @@ class PokemonChallengeRules
return self
end
def addLevelRule(minLevel,maxLevel,totalLevel)
def addLevelRule(minLevel, maxLevel, totalLevel)
self.addPokemonRule(MinimumLevelRestriction.new(minLevel))
self.addPokemonRule(MaximumLevelRestriction.new(maxLevel))
self.addSubsetRule(TotalLevelRestriction.new(totalLevel))

View File

@@ -326,7 +326,7 @@ class BannedItemRestriction
@itemlist = itemlist.clone
end
def isSpecies?(item,itemlist)
def isSpecies?(item, itemlist)
return itemlist.include?(item)
end

View File

@@ -100,7 +100,7 @@ class TotalLevelAdjustment < LevelAdjustment
super(LevelAdjustment::EnemyTeam)
@minLevel = minLevel.clamp(1, GameData::GrowthRate.max_level)
@maxLevel = maxLevel.clamp(1, GameData::GrowthRate.max_level)
@totalLevel=totalLevel
@totalLevel = totalLevel
end
def getAdjustment(thisTeam, _otherTeam)
@@ -134,12 +134,12 @@ class CombinedLevelAdjustment < LevelAdjustment
@their = their
end
def getMyAdjustment(myTeam,theirTeam)
def getMyAdjustment(myTeam, theirTeam)
return @my.getAdjustment(myTeam, theirTeam) if @my
return LevelAdjustment.getNullAdjustment(myTeam, theirTeam)
end
def getTheirAdjustment(theirTeam,myTeam)
def getTheirAdjustment(theirTeam, myTeam)
return @their.getAdjustment(theirTeam, myTeam) if @their
return LevelAdjustment.getNullAdjustment(theirTeam, myTeam)
end

View File

@@ -18,35 +18,35 @@ class BugContestState
def initialize
clear
@lastContest=nil
@lastContest = nil
end
def pbContestHeld?
return false if !@lastContest
timenow=pbGetTimeNow
return timenow.to_i-@lastContest<86400
timenow = pbGetTimeNow
return timenow.to_i - @lastContest < 86400
end
def expired?
return false if !undecided?
return false if TimerSeconds<=0
curtime=@timer+TimerSeconds*Graphics.frame_rate
curtime=[curtime-Graphics.frame_count,0].max
return (curtime<=0)
return false if TimerSeconds <= 0
curtime = @timer + TimerSeconds * Graphics.frame_rate
curtime = [curtime - Graphics.frame_count, 0].max
return (curtime <= 0)
end
def clear
@ballcount=0
@ended=false
@inProgress=false
@decision=0
@encounterMap=0
@lastPokemon=nil
@otherparty=[]
@contestants=[]
@places=[]
@start=nil
@reception=[]
@ballcount = 0
@ended = false
@inProgress = false
@decision = 0
@encounterMap = 0
@lastPokemon = nil
@otherparty = []
@contestants = []
@places = []
@start = nil
@reception = []
end
def inProgress?
@@ -54,21 +54,21 @@ class BugContestState
end
def undecided?
return (@inProgress && @decision==0)
return (@inProgress && @decision == 0)
end
def decided?
return (@inProgress && @decision!=0) || @ended
return (@inProgress && @decision != 0) || @ended
end
def pbSetPokemon(chosenpoke)
@chosenPokemon=chosenpoke
@chosenPokemon = chosenpoke
end
# Reception map is handled separately from contest map since the reception map
# can be outdoors, with its own grassy patches.
def pbSetReception(*arg)
@reception=[]
@reception = []
for i in arg
@reception.push(i)
end
@@ -76,31 +76,31 @@ class BugContestState
def pbOffLimits?(map)
# p [map,@contestMap,@reception]
return false if map==@contestMap
return false if map == @contestMap
for i in @reception
return false if map==i
return false if map == i
end
return true
end
def pbSetJudgingPoint(startMap,startX,startY,dir = 8)
@start=[startMap,startX,startY,dir]
def pbSetJudgingPoint(startMap, startX, startY, dir = 8)
@start = [startMap, startX, startY, dir]
end
def pbSetContestMap(map)
@contestMap=map
@contestMap = map
end
def pbJudge
judgearray=[]
judgearray = []
if @lastPokemon
judgearray.push([-1,@lastPokemon.species,pbBugContestScore(@lastPokemon)])
judgearray.push([-1, @lastPokemon.species, pbBugContestScore(@lastPokemon)])
end
@contestants=[]
[5,ContestantNames.length].min.times do
@contestants = []
[5, ContestantNames.length].min.times do
loop do
value=rand(ContestantNames.length)
if !@contestants.any? { |i| i==value }
value = rand(ContestantNames.length)
if !@contestants.any? { |i| i == value }
@contestants.push(value)
break
end
@@ -111,33 +111,33 @@ class BugContestState
enctype = :Land
end
for cont in @contestants
enc=$PokemonEncounters.choose_wild_pokemon_for_map(@contestMap,enctype)
enc = $PokemonEncounters.choose_wild_pokemon_for_map(@contestMap, enctype)
if !enc
raise _INTL("No encounters for map {1}, so can't judge contest",@contestMap)
raise _INTL("No encounters for map {1}, so can't judge contest", @contestMap)
end
pokemon=Pokemon.new(enc[0],enc[1])
pokemon = Pokemon.new(enc[0], enc[1])
pokemon.hp = rand(1..pokemon.totalhp - 1)
score=pbBugContestScore(pokemon)
judgearray.push([cont,pokemon.species,score])
score = pbBugContestScore(pokemon)
judgearray.push([cont, pokemon.species, score])
end
if judgearray.length<3
if judgearray.length < 3
raise _INTL("Too few bug catching contestants")
end
judgearray.sort! { |a,b| b[2]<=>a[2] } # sort by score in descending order
judgearray.sort! { |a, b| b[2] <=> a[2] } # sort by score in descending order
@places.push(judgearray[0])
@places.push(judgearray[1])
@places.push(judgearray[2])
end
def pbGetPlaceInfo(place)
cont=@places[place][0]
if cont<0
$game_variables[1]=$player.name
cont = @places[place][0]
if cont < 0
$game_variables[1] = $player.name
else
$game_variables[1]=ContestantNames[cont]
$game_variables[1] = ContestantNames[cont]
end
$game_variables[2]=GameData::Species.get(@places[place][1]).name
$game_variables[3]=@places[place][2]
$game_variables[2] = GameData::Species.get(@places[place][1]).name
$game_variables[3] = @places[place][2]
end
def pbClearIfEnded
@@ -145,7 +145,7 @@ class BugContestState
end
def pbStartJudging
@decision=1
@decision = 1
pbJudge
if $scene.is_a?(Scene_Map)
pbFadeOutIn {
@@ -161,40 +161,40 @@ class BugContestState
end
def pbIsContestant?(i)
return @contestants.any? { |item| i==item }
return @contestants.any? { |item| i == item }
end
def pbStart(ballcount)
@ballcount=ballcount
@inProgress=true
@otherparty=[]
@lastPokemon=nil
@lastContest=nil
@timer=Graphics.frame_count
@places=[]
chosenpkmn=$player.party[@chosenPokemon]
@ballcount = ballcount
@inProgress = true
@otherparty = []
@lastPokemon = nil
@lastContest = nil
@timer = Graphics.frame_count
@places = []
chosenpkmn = $player.party[@chosenPokemon]
for i in 0...$player.party.length
@otherparty.push($player.party[i]) if i!=@chosenPokemon
@otherparty.push($player.party[i]) if i != @chosenPokemon
end
@contestants=[]
[5,ContestantNames.length].min.times do
@contestants = []
[5, ContestantNames.length].min.times do
loop do
value=rand(ContestantNames.length)
if !@contestants.any? { |i| i==value }
value = rand(ContestantNames.length)
if !@contestants.any? { |i| i == value }
@contestants.push(value)
break
end
end
end
$player.party=[chosenpkmn]
@decision=0
@ended=false
$player.party = [chosenpkmn]
@decision = 0
@ended = false
$stats.bug_contest_count += 1
end
def place
for i in 0...3
return i if @places[i][0]<0
return i if @places[i][0] < 0
end
return 3
end
@@ -208,32 +208,32 @@ class BugContestState
if @lastPokemon
pbNicknameAndStore(@lastPokemon)
end
@ended=true
@ended = true
else
@ended=false
@ended = false
end
$stats.bug_contest_wins += 1 if place == 0
@lastPokemon=nil
@otherparty=[]
@reception=[]
@ballcount=0
@inProgress=false
@decision=0
timenow=pbGetTimeNow
@lastContest=timenow.to_i
$game_map.need_refresh=true
@lastPokemon = nil
@otherparty = []
@reception = []
@ballcount = 0
@inProgress = false
@decision = 0
timenow = pbGetTimeNow
@lastContest = timenow.to_i
$game_map.need_refresh = true
end
end
class TimerDisplay # :nodoc:
def initialize(start,maxtime)
@timer=Window_AdvancedTextPokemon.newWithSize("",Graphics.width-120,0,120,64)
@timer.z=99999
@total_sec=nil
@start=start
@maxtime=maxtime
def initialize(start, maxtime)
@timer = Window_AdvancedTextPokemon.newWithSize("", Graphics.width - 120, 0, 120, 64)
@timer.z = 99999
@total_sec = nil
@start = start
@maxtime = maxtime
end
def dispose
@@ -245,8 +245,8 @@ class TimerDisplay # :nodoc:
end
def update
curtime=[(@start+@maxtime)-Graphics.frame_count,0].max
curtime/=Graphics.frame_rate
curtime = [(@start + @maxtime) - Graphics.frame_count, 0].max
curtime /= Graphics.frame_rate
if curtime != @total_sec
# Calculate total number of seconds
@total_sec = curtime
@@ -277,7 +277,7 @@ end
def pbBugContestState
if !$PokemonGlobal.bugContestState
$PokemonGlobal.bugContestState=BugContestState.new
$PokemonGlobal.bugContestState = BugContestState.new
end
return $PokemonGlobal.bugContestState
end
@@ -297,20 +297,20 @@ def pbBugContestDecided?
return pbBugContestState.decided?
end
Events.onMapChange += proc { |_sender,_e|
Events.onMapChange += proc { |_sender, _e|
pbBugContestState.pbClearIfEnded
}
Events.onMapSceneChange += proc { |_sender,e|
scene=e[0]
if pbInBugContest? && pbBugContestState.decision==0 && BugContestState::TimerSeconds>0
Events.onMapSceneChange += proc { |_sender, e|
scene = e[0]
if pbInBugContest? && pbBugContestState.decision == 0 && BugContestState::TimerSeconds > 0
scene.spriteset.addUserSprite(TimerDisplay.new(
pbBugContestState.timer,
BugContestState::TimerSeconds*Graphics.frame_rate))
BugContestState::TimerSeconds * Graphics.frame_rate))
end
}
Events.onMapUpdate += proc { |_sender,_e|
Events.onMapUpdate += proc { |_sender, _e|
if !$game_player.move_route_forcing && !pbMapInterpreterRunning? &&
!$game_temp.message_window_showing
if pbBugContestState.expired?
@@ -321,8 +321,8 @@ Events.onMapUpdate += proc { |_sender,_e|
end
}
Events.onMapChanging += proc { |_sender,e|
newmapID=e[0]
Events.onMapChanging += proc { |_sender, e|
newmapID = e[0]
if pbInBugContest?
if pbBugContestState.pbOffLimits?(newmapID)
# Clear bug contest if player flies/warps/teleports out of the contest
@@ -340,21 +340,21 @@ def pbBugContestStartOver
pbBugContestState.pbStartJudging
end
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 !pbInBugContest?
handled[0] = pbBugContestBattle(species,level)
handled[0] = pbBugContestBattle(species, level)
}
def pbBugContestBattle(species,level)
def pbBugContestBattle(species, level)
# Record information about party Pokémon to be used at the end of battle (e.g.
# comparing levels for an evolution check)
Events.onStartBattle.trigger(nil)
# Generate a wild Pokémon based on the species and level
pkmn = pbGenerateWildPokemon(species,level)
pkmn = pbGenerateWildPokemon(species, level)
foeParty = [pkmn]
# Calculate who the trainers and their party are
playerTrainer = [$player]
@@ -363,17 +363,17 @@ def pbBugContestBattle(species,level)
# Create the battle scene (the visual side of it)
scene = pbNewBattleScene
# Create the battle class (the mechanics side of it)
battle = BugContestBattle.new(scene,playerParty,foeParty,playerTrainer,nil)
battle = BugContestBattle.new(scene, playerParty, foeParty, playerTrainer, nil)
battle.party1starts = playerPartyStarts
battle.ballCount = pbBugContestState.ballcount
setBattleRule("single")
pbPrepareBattle(battle)
# Perform the battle itself
decision = 0
pbBattleAnimation(pbGetWildBattleBGM(foeParty),0,foeParty) {
pbBattleAnimation(pbGetWildBattleBGM(foeParty), 0, foeParty) {
decision = battle.pbStartBattle
pbAfterBattle(decision,true)
if decision==2 || decision==5 # Lost or drew
pbAfterBattle(decision, true)
if decision == 2 || decision == 5 # Lost or drew
$game_system.bgm_unpause
$game_system.bgs_unpause
pbBugContestStartOver
@@ -382,7 +382,7 @@ def pbBugContestBattle(species,level)
Input.update
# Update Bug Contest game data based on result of battle
pbBugContestState.ballcount = battle.ballCount
if pbBugContestState.ballcount==0
if pbBugContestState.ballcount == 0
pbMessage(_INTL("ANNOUNCER: The Bug-Catching Contest is over!"))
pbBugContestState.pbStartJudging
end
@@ -399,9 +399,9 @@ def pbBugContestBattle(species,level)
when 2, 3, 5 # Lost, fled, draw
$stats.wild_battles_lost += 1
end
pbSet(1,decision)
pbSet(1, decision)
# 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

View File

@@ -211,9 +211,9 @@ def pbGenerateChallenge(rule, tag)
for j in 0...teams[i].length
party.push(teams[i][j])
end
teams[i] = RuledTeam.new(party,rule)
teams[i] = RuledTeam.new(party, rule)
elsif teams[i].rating < toolowrating
teams[i] = RuledTeam.new(party,rule)
teams[i] = RuledTeam.new(party, rule)
end
i += 1
end

View File

@@ -49,7 +49,7 @@ class RuledTeam
(@totalGames || 0) + self.games
end
def addMatch(other,score)
def addMatch(other, score)
@history.addMatch(other.ratingData, score)
end
@@ -309,7 +309,7 @@ def pbDecideWinnerEffectiveness(move, otype1, otype2, ability, scores)
data = GameData::Move.get(move)
return 0 if data.base_damage == 0
atype = data.type
typemod = Effectiveness::NORMAL_EFFECTIVE_ONE ** 2
typemod = Effectiveness::NORMAL_EFFECTIVE_ONE**2
if ability != :LEVITATE || data.type != :GROUND
mod1 = Effectiveness.calculate_one(atype, otype1)
mod2 = (otype1 == otype2) ? Effectiveness::NORMAL_EFFECTIVE_ONE : Effectiveness.calculate_one(atype, otype2)