Added class GameStats, added Pokédex records for eggs seen and expanded seen_forms to include shinies

This commit is contained in:
Maruno17
2021-11-13 23:13:28 +00:00
parent 12fd500dbc
commit c6ecf60172
39 changed files with 443 additions and 42 deletions

View File

@@ -86,6 +86,7 @@ def pbStartOver(gameover=false)
pbBugContestStartOver
return
end
$stats.blacked_out_count += 1
$player.heal_party
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0
if gameover

View File

@@ -135,7 +135,11 @@ Events.onStepTakenFieldMovement += proc { |_sender,e|
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
$player.soot += 1 if event == $game_player && $bag.has?(:SOOTSACK)
if event == $game_player && $bag.has?(:SOOTSACK)
old_soot = $player.soot
$player.soot += 1
$stats.soot_collected += $player.soot - old_soot if $player.soot > old_soot
end
map.erase_tile(thistile[1], thistile[2], i)
break
end

View File

@@ -295,6 +295,12 @@ def pbWildBattleCore(*args)
# 3 - Player or wild Pokémon ran from battle, or player forfeited the match
# 4 - Wild Pokémon was caught
# 5 - Draw
case outcome
when 1, 4 # Won, caught
$stats.wild_battles_won += 1
when 2, 3, 5 # Lost, fled, draw
$stats.wild_battles_lost += 1
end
pbSet(outcomeVar,decision)
return decision
end
@@ -439,6 +445,12 @@ def pbTrainerBattleCore(*args)
pbAfterBattle(decision,canLose)
}
Input.update
case outcome
when 1 # Won
$stats.trainer_battles_won += 1
when 2, 3, 5 # Lost, fled, draw
$stats.trainer_battles_lost += 1
end
# Save the result of the battle in a Game Variable (1 by default)
# 0 - Undecided or aborted
# 1 - Player won

View File

@@ -194,6 +194,7 @@ def pbCut
end
pbMessage(_INTL("This tree looks like it can be cut down!\1"))
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))
pbHiddenMoveAnimation(movefinder)
@@ -216,6 +217,7 @@ HiddenMoveHandlers::UseMove.add(:CUT,proc { |move,pokemon|
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
end
$stats.cut_count += 1
facingEvent = $game_player.pbFacingEvent
if facingEvent
pbSmashEvent(facingEvent)
@@ -316,6 +318,7 @@ def pbDive
$game_temp.player_new_direction = $game_player.direction
$PokemonGlobal.surfing = false
$PokemonGlobal.diving = true
$stats.dive_count += 1
pbUpdateVehicle
$scene.transfer_player(false)
$game_map.autoplay
@@ -476,6 +479,7 @@ HiddenMoveHandlers::UseMove.add(:FLASH,proc { |move,pokemon|
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
Graphics.update
@@ -518,6 +522,7 @@ def pbFlyToNewLocation(pkmn = nil, move = :FLY)
name = pkmn&.name || $player.name
pbMessage(_INTL("{1} used {2}!", name, GameData::Move.get(move).name))
end
$stats.fly_count += 1
pbFadeOutIn {
pbSEPlay("Fly")
$game_temp.player_new_map_id = $game_temp.fly_destination[0]
@@ -570,7 +575,9 @@ def pbHeadbuttEffect(event=nil)
pbMessage(_INTL("Nope. Nothing..."))
else
enctype = (chance==1) ? :HeadbuttLow : :HeadbuttHigh
if !pbEncounter(enctype)
if pbEncounter(enctype)
$stats.headbutt_battles += 1
else
pbMessage(_INTL("Nope. Nothing..."))
end
end
@@ -584,6 +591,7 @@ def pbHeadbutt(event=nil)
return false
end
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))
pbHiddenMoveAnimation(movefinder)
@@ -606,6 +614,7 @@ HiddenMoveHandlers::UseMove.add(:HEADBUTT,proc { |move,pokemon|
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
end
$stats.headbutt_count += 1
facingEvent = $game_player.pbFacingEvent
pbHeadbuttEffect(facingEvent)
})
@@ -617,6 +626,7 @@ HiddenMoveHandlers::UseMove.add(:HEADBUTT,proc { |move,pokemon|
#===============================================================================
def pbRockSmashRandomEncounter
if $PokemonEncounters.encounter_triggered?(:RockSmash, false, false)
$stats.rock_smash_battles += 1
pbEncounter(:RockSmash)
end
end
@@ -629,6 +639,7 @@ def pbRockSmash
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))
pbHiddenMoveAnimation(movefinder)
@@ -651,6 +662,7 @@ HiddenMoveHandlers::UseMove.add(:ROCKSMASH,proc { |move,pokemon|
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
end
$stats.rock_smash_count += 1
facingEvent = $game_player.pbFacingEvent
if facingEvent
pbSmashEvent(facingEvent)
@@ -740,6 +752,7 @@ def pbStartSurfing
pbCancelVehicles
$PokemonEncounters.reset_step_count
$PokemonGlobal.surfing = true
$stats.surf_count += 1
pbUpdateVehicle
$game_temp.surf_base_coords = $map_factory.getFacingCoords($game_player.x, $game_player.y, $game_player.direction)
pbJumpToward
@@ -933,6 +946,7 @@ def pbAscendWaterfall
return if $game_player.direction != 8 # Can't ascend if not facing up
terrain = $game_player.pbFacingTerrainTag
return if !terrain.waterfall && !terrain.waterfall_crest
$stats.waterfall_count += 1
oldthrough = $game_player.through
oldmovespeed = $game_player.move_speed
$game_player.through = true
@@ -950,6 +964,7 @@ def pbDescendWaterfall
return if $game_player.direction != 2 # Can't descend if not facing down
terrain = $game_player.pbFacingTerrainTag
return if !terrain.waterfall && !terrain.waterfall_crest
$stats.waterfalls_descended += 1
oldthrough = $game_player.through
oldmovespeed = $game_player.move_speed
$game_player.through = true

View File

@@ -38,6 +38,7 @@ def pbFishingEnd
end
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 *= 1.5 if speedup # 67.5, 100, 100

View File

@@ -412,6 +412,7 @@ def pbBerryPlant
berry = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).is_berry? })
}
if berry
$stats.berries_planted += 1
berry_plant.plant(berry)
$bag.remove(berry)
if Settings::NEW_BERRY_PLANTS
@@ -441,6 +442,10 @@ def pbPickBerry(berry, qty = 1)
pbMessage(_INTL("Too bad...\nThe Bag is full..."))
return false
end
$stats.berry_plants_picked += 1
if qty >= GameData::BerryPlant.get(@berry_id).maximum_yield
$stats.max_yield_berry_plants += 1
end
$bag.add(berry, qty)
if qty > 1
pbMessage(_INTL("You picked the {1} \\c[1]{2}\\c[0].\\wtnp[30]", qty, berry_name))

View File

@@ -389,6 +389,7 @@ class DayCare
end
def self.deposit(party_index)
$stats.day_care_deposits += 1
day_care = $PokemonGlobal.day_care
pkmn = $player.party[party_index]
raise _INTL("No Pokémon at index {1} in party.", party_index) if pkmn.nil?
@@ -410,6 +411,7 @@ class DayCare
elsif $player.party_full?
raise _INTL("No room in party for Pokémon.")
end
$stats.day_care_levels_gained += slot.level_gain
$player.party.push(slot.pokemon)
slot.reset
day_care.reset_egg_counters