Lots of rubocop

This commit is contained in:
Maruno17
2023-01-28 15:21:12 +00:00
parent 2d056052ce
commit 13aab8d911
159 changed files with 1679 additions and 1931 deletions

View File

@@ -190,13 +190,13 @@ def pbChangeLevel(pkmn, new_level, scene)
# Check for evolution
new_species = pkmn.check_evolution_on_level_up
if new_species
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn, new_species)
evo.pbEvolution
evo.pbEndScreen
scene.pbRefresh if scene.is_a?(PokemonPartyScreen)
}
end
end
end
end
@@ -299,13 +299,13 @@ def pbChangeExp(pkmn, new_exp, scene)
# Check for evolution
new_species = pkmn.check_evolution_on_level_up
if new_species
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn, new_species)
evo.pbEvolution
evo.pbEndScreen
scene.pbRefresh if scene.is_a?(PokemonPartyScreen)
}
end
end
end
end
@@ -624,11 +624,11 @@ end
def pbForgetMove(pkmn, moveToLearn)
ret = -1
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonSummary_Scene.new
screen = PokemonSummaryScreen.new(scene)
ret = screen.pbStartForgetScreen([pkmn], 0, moveToLearn)
}
end
return ret
end
@@ -653,7 +653,7 @@ def pbUseItem(bag, item, bagscene = nil)
annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE"))
end
end
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
screen.pbStartScene(_INTL("Use on which Pokémon?"), false, annot)
@@ -685,7 +685,7 @@ def pbUseItem(bag, item, bagscene = nil)
end
screen.pbEndScene
bagscene&.pbRefresh
}
end
return (ret) ? 1 : 0
elsif useType == 2 || itm.is_machine? # Item is usable from Bag or teaches a move
intret = ItemHandlers.triggerUseFromBag(item)
@@ -853,33 +853,33 @@ end
#===============================================================================
def pbChooseItem(var = 0, *args)
ret = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
ret = screen.pbChooseItemScreen
}
end
$game_variables[var] = ret || :NONE if var > 0
return ret
end
def pbChooseApricorn(var = 0)
ret = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
ret = screen.pbChooseItemScreen(proc { |item| GameData::Item.get(item).is_apricorn? })
}
end
$game_variables[var] = ret || :NONE if var > 0
return ret
end
def pbChooseFossil(var = 0)
ret = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
ret = screen.pbChooseItemScreen(proc { |item| GameData::Item.get(item).is_fossil? })
}
end
$game_variables[var] = ret || :NONE if var > 0
return ret
end

View File

@@ -54,13 +54,13 @@ ItemHandlers::UseFromBag.add(:ITEMFINDER, proc { |item|
ItemHandlers::UseFromBag.copy(:ITEMFINDER, :DOWSINGMCHN, :DOWSINGMACHINE)
ItemHandlers::UseFromBag.add(:TOWNMAP, proc { |item|
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonRegionMap_Scene.new(-1, false)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartScreen
$game_temp.fly_destination = ret if ret
next 99999 if ret # Ugly hack to make Bag scene not reappear if flying
}
end
next ($game_temp.fly_destination) ? 2 : 0
})
@@ -148,11 +148,11 @@ EventHandlers.add(:on_player_step_taken, :repel_counter,
end
next if !pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"))
ret = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
ret = screen.pbChooseItemScreen(proc { |item| repels.include?(item) })
}
end
pbUseItem($bag, ret) if ret
}
)
@@ -190,7 +190,7 @@ ItemHandlers::UseInField.add(:ESCAPEROPE, proc { |item|
next false
end
pbUseItemMessage(item)
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = escape[0]
$game_temp.player_new_x = escape[1]
$game_temp.player_new_y = escape[2]
@@ -199,7 +199,7 @@ ItemHandlers::UseInField.add(:ESCAPEROPE, proc { |item|
$scene.transfer_player
$game_map.autoplay
$game_map.refresh
}
end
pbEraseEscapePoint
next true
})
@@ -220,7 +220,7 @@ ItemHandlers::UseInField.add(:SACREDASH, proc { |item|
next false
end
revived = 0
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
screen.pbStartScene(_INTL("Using item..."), false)
@@ -231,11 +231,9 @@ ItemHandlers::UseInField.add(:SACREDASH, proc { |item|
screen.pbRefreshSingle(i)
screen.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name))
end
if revived == 0
screen.pbDisplay(_INTL("It won't have any effect."))
end
screen.pbDisplay(_INTL("It won't have any effect.")) if revived == 0
screen.pbEndScene
}
end
next (revived > 0)
})
@@ -371,7 +369,7 @@ ItemHandlers::UseOnPokemon.addIf(:evolution_stones,
end
newspecies = pkmn.check_evolution_on_use_item(item)
if newspecies
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn, newspecies)
evo.pbEvolution(false)
@@ -380,7 +378,7 @@ ItemHandlers::UseOnPokemon.addIf(:evolution_stones,
scene.pbRefreshAnnotations(proc { |p| !p.check_evolution_on_use_item(item).nil? })
scene.pbRefresh
end
}
end
next true
end
scene.pbDisplay(_INTL("It won't have any effect."))
@@ -896,13 +894,13 @@ ItemHandlers::UseOnPokemon.add(:RARECANDY, proc { |item, qty, pkmn, scene|
next false
end
# Check for evolution
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn, new_species)
evo.pbEvolution
evo.pbEndScreen
scene.pbRefresh if scene.is_a?(PokemonPartyScreen)
}
end
next true
end
# Level up
@@ -1093,10 +1091,10 @@ ItemHandlers::UseOnPokemon.add(:GRACIDEA, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
next false
end
pkmn.setForm(1) {
pkmn.setForm(1) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
next true
})
@@ -1108,10 +1106,10 @@ ItemHandlers::UseOnPokemon.add(:REDNECTAR, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
next false
end
pkmn.setForm(0) {
pkmn.setForm(0) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
end
next true
})
@@ -1123,10 +1121,10 @@ ItemHandlers::UseOnPokemon.add(:YELLOWNECTAR, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
next false
end
pkmn.setForm(1) {
pkmn.setForm(1) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
end
next true
})
@@ -1138,10 +1136,10 @@ ItemHandlers::UseOnPokemon.add(:PINKNECTAR, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
next false
end
pkmn.setForm(2) {
pkmn.setForm(2) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
end
next true
})
@@ -1153,10 +1151,10 @@ ItemHandlers::UseOnPokemon.add(:PURPLENECTAR, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
next false
end
pkmn.setForm(3) {
pkmn.setForm(3) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
end
next true
})
@@ -1171,10 +1169,10 @@ ItemHandlers::UseOnPokemon.add(:REVEALGLASS, proc { |item, qty, pkmn, scene|
next false
end
newForm = (pkmn.form == 0) ? 1 : 0
pkmn.setForm(newForm) {
pkmn.setForm(newForm) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
next true
})
@@ -1187,10 +1185,10 @@ ItemHandlers::UseOnPokemon.add(:PRISONBOTTLE, proc { |item, qty, pkmn, scene|
next false
end
newForm = (pkmn.form == 0) ? 1 : 0
pkmn.setForm(newForm) {
pkmn.setForm(newForm) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
next true
})
@@ -1217,10 +1215,10 @@ ItemHandlers::UseOnPokemon.add(:ROTOMCATALOG, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("It won't have any effect."))
next false
elsif new_form > 0 && new_form < choices.length - 1
pkmn.setForm(new_form) {
pkmn.setForm(new_form) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} transformed!", pkmn.name))
}
end
next true
end
next false
@@ -1238,10 +1236,10 @@ ItemHandlers::UseOnPokemon.add(:ZYGARDECUBE, proc { |item, qty, pkmn, scene|
[_INTL("Change form"), _INTL("Change Ability"), _INTL("Cancel")])
when 0 # Change form
newForm = (pkmn.form == 0) ? 1 : 0
pkmn.setForm(newForm) {
pkmn.setForm(newForm) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} transformed!", pkmn.name))
}
end
next true
when 1 # Change ability
new_abil = (pkmn.ability_index + 1) % 2
@@ -1282,12 +1280,12 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERS, proc { |item, qty, pkmn, scene|
newForm = 0
newForm = 1 if other_pkmn.isSpecies?(:RESHIRAM)
newForm = 2 if other_pkmn.isSpecies?(:ZEKROM)
pkmn.setForm(newForm) {
pkmn.setForm(newForm) do
pkmn.fused = other_pkmn
$player.remove_pokemon_at_index(chosen)
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:DNASPLICERS, :DNASPLICERSUSED)
next true
})
@@ -1304,12 +1302,12 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERSUSED, proc { |item, qty, pkmn, scene|
next false
end
# Unfusing
pkmn.setForm(0) {
pkmn.setForm(0) do
$player.party[$player.party.length] = pkmn.fused
pkmn.fused = nil
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:DNASPLICERSUSED, :DNASPLICERS)
next true
})
@@ -1339,12 +1337,12 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
next false
end
pkmn.setForm(1) {
pkmn.setForm(1) do
pkmn.fused = other_pkmn
$player.remove_pokemon_at_index(chosen)
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:NSOLARIZER, :NSOLARIZERUSED)
next true
})
@@ -1361,12 +1359,12 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZERUSED, proc { |item, qty, pkmn, scene|
next false
end
# Unfusing
pkmn.setForm(0) {
pkmn.setForm(0) do
$player.party[$player.party.length] = pkmn.fused
pkmn.fused = nil
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:NSOLARIZERUSED, :NSOLARIZER)
next true
})
@@ -1396,12 +1394,12 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZER, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
next false
end
pkmn.setForm(2) {
pkmn.setForm(2) do
pkmn.fused = other_pkmn
$player.remove_pokemon_at_index(chosen)
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:NLUNARIZER, :NLUNARIZERUSED)
next true
})
@@ -1418,12 +1416,12 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZERUSED, proc { |item, qty, pkmn, scene|
next false
end
# Unfusing
pkmn.setForm(0) {
pkmn.setForm(0) do
$player.party[$player.party.length] = pkmn.fused
pkmn.fused = nil
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:NLUNARIZERUSED, :NLUNARIZER)
next true
})
@@ -1457,12 +1455,12 @@ ItemHandlers::UseOnPokemon.add(:REINSOFUNITY, proc { |item, qty, pkmn, scene|
newForm = 0
newForm = 1 if other_pkmn.isSpecies?(:GLASTRIER)
newForm = 2 if other_pkmn.isSpecies?(:SPECTRIER)
pkmn.setForm(newForm) {
pkmn.setForm(newForm) do
pkmn.fused = other_pkmn
$player.remove_pokemon_at_index(chosen)
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:REINSOFUNITY, :REINSOFUNITYUSED)
next true
})
@@ -1479,12 +1477,12 @@ ItemHandlers::UseOnPokemon.add(:REINSOFUNITYUSED, proc { |item, qty, pkmn, scene
next false
end
# Unfusing
pkmn.setForm(0) {
pkmn.setForm(0) do
$player.party[$player.party.length] = pkmn.fused
pkmn.fused = nil
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:REINSOFUNITYUSED, :REINSOFUNITY)
next true
})

View File

@@ -88,12 +88,10 @@ class Phone
if contact
contact.visible = true
@contacts.delete(contact)
@contacts.push(contact)
else
contact = Contact.new(true, args[0].map_id, args[0].id,
trainer_type, name, args[3], args[4], args[5])
contact.increment_version
@contacts.push(contact)
end
elsif args[1].is_a?(Numeric)
# Trainer
@@ -104,12 +102,10 @@ class Phone
if contact
contact.visible = true
@contacts.delete(contact)
@contacts.push(contact)
else
contact = Contact.new(true, args[0], args[1],
trainer_type, name, args[4], args[5], args[6])
contact.increment_version
@contacts.push(contact)
end
else
# Non-trainer
@@ -118,12 +114,11 @@ class Phone
if contact
contact.visible = true
@contacts.delete(contact)
@contacts.push(contact)
else
contact = Contact.new(false, *args)
@contacts.push(contact)
end
end
@contacts.push(contact)
sort_contacts
return true
end
@@ -264,9 +259,9 @@ class Phone
# Map ID, name, common event ID
def initialize(trainer, *args)
@trainer = trainer
@map_id = args[0]
if @trainer
# Trainer
@map_id = args[0]
@event_id = args[1]
@trainer_type = args[2]
@name = args[3]
@@ -279,7 +274,6 @@ class Phone
@common_event_id = args[6] || 0
else
# Non-trainer
@map_id = args[0]
@name = args[1]
@common_event_id = args[2] || 0
end
@@ -320,7 +314,7 @@ class Phone
def display_name
if trainer?
return sprintf("%s %s", GameData::TrainerType.get(@trainer_type).name,
pbGetMessageFromHash(MessageTypes::TrainerNames, @name))
pbGetMessageFromHash(MessageTypes::TRAINER_NAMES, @name))
end
return _INTL(@name)
end
@@ -482,11 +476,11 @@ class Phone
messages = GameData::PhoneMessage.try_get(contact.trainer_type, contact.name, contact.start_version) if !messages
messages = GameData::PhoneMessage::DATA["default"] if !messages
# Create lambda for choosing a random message and translating it
get_random_message = lambda do |messages|
return "" if !messages
msg = messages.sample
get_random_message = lambda do |msgs|
return "" if !msgs
msg = msgs.sample
return "" if !msg
return pbGetMessageFromHash(MessageTypes::PhoneMessages, msg)
return pbGetMessageFromHash(MessageTypes::PHONE_MESSAGES, msg)
end
# Choose random greeting depending on time of day
ret = get_random_message.call(messages.intro)
@@ -505,10 +499,11 @@ class Phone
# Choose main message set
if Phone.rematches_enabled && contact.rematch_flag > 0
# Trainer is ready for a rematch, so tell/remind the player
if contact.rematch_flag == 1 # Tell the player
case contact.rematch_flag
when 1 # Tell the player
ret += get_random_message.call(messages.battle_request)
contact.rematch_flag = 2 # Ready for rematch and told player
elsif contact.rematch_flag == 2 # Remind the player
when 2 # Remind the player
if messages.battle_remind
ret += get_random_message.call(messages.battle_remind)
else
@@ -555,9 +550,7 @@ class Phone
species = get_species_from_table.call(enc_tables[:Land])
if !species
species = get_species_from_table.call(enc_tables[:Cave])
if !species
species = get_species_from_table.call(enc_tables[:Water])
end
species = get_species_from_table.call(enc_tables[:Water]) if !species
end
return "" if !species
return GameData::Species.get(species).name