Renames $Trainer to $player

This commit is contained in:
chardub
2025-04-24 19:57:12 -04:00
parent 95ef337de8
commit 7de024dafd
34 changed files with 391 additions and 391 deletions

View File

@@ -1,5 +1,5 @@
def has_species_or_fusion?(species, form = -1)
return $Trainer.pokemon_party.any? { |p| p && p.isSpecies?(species) || p.isFusionOf(species) }
return $player.pokemon_party.any? { |p| p && p.isSpecies?(species) || p.isFusionOf(species) }
end
# frozen_string_literal: true

View File

@@ -54,7 +54,7 @@ def isOutdoor()
end
def qmarkMaskCheck()
if $Trainer.seen_qmarks_sprite
if $player.seen_qmarks_sprite
unless hasHat?(HAT_QMARKS)
obtainHat(HAT_QMARKS)
obtainClothes(CLOTHES_GLITCH)
@@ -77,7 +77,7 @@ def giveJigglypuffScribbles(possible_versions = [1,2,3,4])
return if !scribbles_id
if !hasHat?(scribbles_id)
$Trainer.unlocked_hats << scribbles_id
$player.unlocked_hats << scribbles_id
end
putOnHat(scribbles_id,true,true)
end
@@ -481,7 +481,7 @@ def Kernel.setRocketPassword(variableNum)
end
def obtainBadgeMessage(badgeName)
Kernel.pbMessage(_INTL("\\me[Badge get]{1} obtained the {2}!", $Trainer.name, badgeName))
Kernel.pbMessage(_INTL("\\me[Badge get]{1} obtained the {2}!", $player.name, badgeName))
end

View File

@@ -26,7 +26,7 @@ end
def playPokeFluteAnimation
# return if $Trainer.outfit != 0
# return if $player.outfit != 0
# $game_player.setDefaultCharName("players/pokeflute", 0, false)
# Graphics.update
# Input.update
@@ -34,7 +34,7 @@ def playPokeFluteAnimation
end
def restoreDefaultCharacterSprite(charset_number = 0)
meta = GameData::Metadata.get_player($Trainer.character_ID)
meta = GameData::Metadata.get_player($player.character_ID)
$game_player.setDefaultCharName(nil, 0, false)
$game_player.character_name = meta[1]
Graphics.update

View File

@@ -58,25 +58,25 @@ def purchaseDyeKitMenu(hats_kit_price=0,clothes_kit_price=0)
choice = optionsMenu(commands,commands.length)
case commands[choice]
when command_hats
if $Trainer.money < hats_kit_price
if $player.money < hats_kit_price
pbCallBub(2,@event_id)
pbMessage("Oh, you don't have enough money...")
return
end
pbMessage("\\G\\PN purchased the dye kit.")
$Trainer.money -= hats_kit_price
$player.money -= hats_kit_price
pbSEPlay("SlotsCoin")
Kernel.pbReceiveItem(:HATSDYEKIT)
pbCallBub(2,@event_id)
pbMessage("\\GHere you go! Have fun dyeing your hats!")
when command_clothes
if $Trainer.money < clothes_kit_price
if $player.money < clothes_kit_price
pbCallBub(2,@event_id)
pbMessage("Oh, you don't have enough money...")
return
end
pbMessage("\\G\\PN purchased the dye kit.")
$Trainer.money -= clothes_kit_price
$player.money -= clothes_kit_price
pbSEPlay("SlotsCoin")
Kernel.pbReceiveItem(:CLOTHESDYEKIT)
pbCallBub(2,@event_id)
@@ -89,7 +89,7 @@ end
def promptCaughtPokemonAction(pokemon)
pickedOption = false
return pbStorePokemon(pokemon) if !$Trainer.party_full?
return pbStorePokemon(pokemon) if !$player.party_full?
return promptKeepOrRelease(pokemon) if isOnPinkanIsland() && !$game_switches[SWITCH_PINKAN_FINISHED]
while !pickedOption
command = pbMessage(_INTL("\\ts[]Your team is full!"),
@@ -137,13 +137,13 @@ def swapCaughtPokemon(caughtPokemon)
})
index = pbGet(1)
return false if index == -1
$PokemonStorage.pbStoreCaught($Trainer.party[index])
$PokemonStorage.pbStoreCaught($player.party[index])
pbRemovePokemonAt(index)
pbStorePokemon(caughtPokemon)
tmp = $Trainer.party[index]
$Trainer.party[index] = $Trainer.party[-1]
$Trainer.party[-1] = tmp
tmp = $player.party[index]
$player.party[index] = $player.party[-1]
$player.party[-1] = tmp
return true
end
@@ -155,13 +155,13 @@ def swapReleaseCaughtPokemon(caughtPokemon)
})
index = pbGet(1)
return false if index == -1
releasedPokemon = $Trainer.party[index]
releasedPokemon = $player.party[index]
pbMessage("#{releasedPokemon.name} was released.")
pbRemovePokemonAt(index)
pbStorePokemon(caughtPokemon)
tmp = $Trainer.party[index]
$Trainer.party[index] = $Trainer.party[-1]
$Trainer.party[-1] = tmp
tmp = $player.party[index]
$player.party[index] = $player.party[-1]
$player.party[-1] = tmp
return true
end

View File

@@ -1,44 +1,44 @@
# frozen_string_literal: true
def unlock_easter_egg_hats()
if $Trainer.name == "Ash"
$Trainer.hat = HAT_ASH
$Trainer.unlock_hat(HAT_ASH)
if $player.name == "Ash"
$player.hat = HAT_ASH
$player.unlock_hat(HAT_ASH)
end
if $Trainer.name == "Frogman"
$Trainer.hat = HAT_FROG
$Trainer.unlock_hat(HAT_FROG)
if $player.name == "Frogman"
$player.hat = HAT_FROG
$player.unlock_hat(HAT_FROG)
end
end
def setupStartingOutfit()
$Trainer.hat = nil
$Trainer.clothes = STARTING_OUTFIT
$player.hat = nil
$player.clothes = STARTING_OUTFIT
unlock_easter_egg_hats()
gender = pbGet(VAR_TRAINER_GENDER)
if gender == GENDER_FEMALE
$Trainer.unlock_clothes(DEFAULT_OUTFIT_FEMALE, true)
$Trainer.unlock_hat(DEFAULT_OUTFIT_FEMALE, true)
$Trainer.hair = "3_" + DEFAULT_OUTFIT_FEMALE if !$Trainer.hair # when migrating old savefiles
$player.unlock_clothes(DEFAULT_OUTFIT_FEMALE, true)
$player.unlock_hat(DEFAULT_OUTFIT_FEMALE, true)
$player.hair = "3_" + DEFAULT_OUTFIT_FEMALE if !$player.hair # when migrating old savefiles
elsif gender == GENDER_MALE
$Trainer.unlock_clothes(DEFAULT_OUTFIT_MALE, true)
$Trainer.unlock_hat(DEFAULT_OUTFIT_MALE, true)
$player.unlock_clothes(DEFAULT_OUTFIT_MALE, true)
$player.unlock_hat(DEFAULT_OUTFIT_MALE, true)
echoln $Trainer.hair
$Trainer.hair = ("3_" + DEFAULT_OUTFIT_MALE) if !$Trainer.hair # when migrating old savefiles
echoln $Trainer.hair
echoln $player.hair
$player.hair = ("3_" + DEFAULT_OUTFIT_MALE) if !$player.hair # when migrating old savefiles
echoln $player.hair
end
$Trainer.unlock_hair(DEFAULT_OUTFIT_MALE, true)
$Trainer.unlock_hair(DEFAULT_OUTFIT_FEMALE, true)
$Trainer.unlock_clothes(STARTING_OUTFIT, true)
$player.unlock_hair(DEFAULT_OUTFIT_MALE, true)
$player.unlock_hair(DEFAULT_OUTFIT_FEMALE, true)
$player.unlock_clothes(STARTING_OUTFIT, true)
end
def give_date_specific_hats()
current_date = Time.new
# Christmas
if (current_date.day == 24 || current_date.day == 25) && current_date.month == 12
if !$Trainer.unlocked_hats.include?(HAT_SANTA)
if !$player.unlocked_hats.include?(HAT_SANTA)
pbCallBub(2, @event_id, true)
pbMessage("Hi! We're giving out a special hat today for the holidays season. Enjoy!")
obtainHat(HAT_SANTA)
@@ -47,7 +47,7 @@ def give_date_specific_hats()
# April's fool
if (current_date.day == 1 && current_date.month == 4)
if !$Trainer.unlocked_hats.include?(HAT_CLOWN)
if !$player.unlocked_hats.include?(HAT_CLOWN)
pbCallBub(2, @event_id, true)
pbMessage("Hi! We're giving out this fun accessory for this special day. Enjoy!")
obtainHat(HAT_CLOWN)

View File

@@ -21,8 +21,8 @@ end
def changeSpeciesSpecific(pokemon, newSpecies)
pokemon.species = newSpecies
$Trainer.pokedex.set_seen(newSpecies)
$Trainer.pokedex.set_owned(newSpecies)
$player.pokedex.set_seen(newSpecies)
$player.pokedex.set_owned(newSpecies)
end
@@ -163,8 +163,8 @@ def changeOricorioForm(pokemon, form = nil)
body_number = getDexNumberForSpecies(body_id)
newForm = pokemon.isFusion? ? getSpeciesIdForFusion(head_number, body_number) : head_id
$Trainer.pokedex.set_seen(newForm)
$Trainer.pokedex.set_owned(newForm)
$player.pokedex.set_seen(newForm)
$player.pokedex.set_owned(newForm)
pokemon.species = newForm
return true
@@ -182,7 +182,7 @@ def changeOricorioFlower(form = 1)
$PokemonGlobal.stepcount += 1
end
end
return if !($Trainer.has_species_or_fusion?(:ORICORIO_1) || $Trainer.has_species_or_fusion?(:ORICORIO_2) || $Trainer.has_species_or_fusion?(:ORICORIO_3) || $Trainer.has_species_or_fusion?(:ORICORIO_4))
return if !($player.has_species_or_fusion?(:ORICORIO_1) || $player.has_species_or_fusion?(:ORICORIO_2) || $player.has_species_or_fusion?(:ORICORIO_3) || $player.has_species_or_fusion?(:ORICORIO_4))
message = ""
form_name = ""
if form == 1
@@ -210,7 +210,7 @@ def changeOricorioFlower(form = 1)
Kernel.isPartPokemon(poke, :ORICORIO_4))
})
if (pbGet(1) != -1)
poke = $Trainer.party[pbGet(1)]
poke = $player.party[pbGet(1)]
if changeOricorioForm(poke, form)
pbMessage(_INTL("{1} switched to the {2} style", poke.name, form_name))
pbSet(1, poke.name)
@@ -231,17 +231,17 @@ def oricorioEventPickFlower(flower_color)
$game_switches[SWITCH_ORICORIO_QUEST_PINK] = true
pbMessage(_INTL("It's a flower with pink nectar."))
pbSEPlay("MiningAllFound")
pbMessage(_INTL("{1} picked some of the pink flowers.", $Trainer.name))
pbMessage(_INTL("{1} picked some of the pink flowers.", $player.name))
elsif flower_color == :RED && quest_progression == 1
$game_switches[SWITCH_ORICORIO_QUEST_RED] = true
pbMessage(_INTL("It's a flower with red nectar."))
pbSEPlay("MiningAllFound")
pbMessage(_INTL("{1} picked some of the red flowers.", $Trainer.name))
pbMessage(_INTL("{1} picked some of the red flowers.", $player.name))
elsif flower_color == :BLUE && quest_progression == 2
$game_switches[SWITCH_ORICORIO_QUEST_BLUE] = true
pbMessage(_INTL("It's a flower with blue nectar."))
pbSEPlay("MiningAllFound")
pbMessage(_INTL("{1} picked some of the blue flowers.", $Trainer.name))
pbMessage(_INTL("{1} picked some of the blue flowers.", $player.name))
end
end

View File

@@ -74,7 +74,7 @@ def fixFinishedRocketQuests()
end
def fix_broken_TR_quests()
for trainer_quest in $Trainer.quests
for trainer_quest in $player.quests
if trainer_quest.id == 0 # tr quests were all set to ID 0 instead of their real ID in v 6.4.0
for rocket_quest_id in TR_QUESTS.keys
rocket_quest = TR_QUESTS[rocket_quest_id]
@@ -88,7 +88,7 @@ def fix_broken_TR_quests()
end
def failAllIncompleteRocketQuests()
for trainer_quest in $Trainer.quests
for trainer_quest in $player.quests
finishTRQuest("tr_cerulean_1", :FAILURE) if trainer_quest.id == "tr_cerulean_1" && !pbCompletedQuest?("tr_cerulean_1")
finishTRQuest("tr_cerulean_2", :FAILURE) if trainer_quest.id == "tr_cerulean_2" && !pbCompletedQuest?("tr_cerulean_2")
finishTRQuest("tr_cerulean_3", :FAILURE) if trainer_quest.id == "tr_cerulean_3" && !pbCompletedQuest?("tr_cerulean_3")

View File

@@ -24,9 +24,9 @@ end
# Get difficulty for displaying in-game
def getDisplayDifficulty
if $game_switches[SWITCH_GAME_DIFFICULTY_EASY] || $Trainer.lowest_difficulty <= 0
if $game_switches[SWITCH_GAME_DIFFICULTY_EASY] || $player.lowest_difficulty <= 0
return getDisplayDifficultyFromIndex(0)
elsif $Trainer.lowest_difficulty <= 1
elsif $player.lowest_difficulty <= 1
return getDisplayDifficultyFromIndex(1)
elsif $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
return getDisplayDifficultyFromIndex(2)
@@ -81,7 +81,7 @@ end
def setDifficulty(index)
$Trainer.selected_difficulty = index
$player.selected_difficulty = index
case index
when 0 # EASY
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = true