diff --git a/Data/Scripts/002_Save data/004_Game_SaveValues.rb b/Data/Scripts/002_Save data/004_Game_SaveValues.rb index 0d02a84ec..3cda2628f 100644 --- a/Data/Scripts/002_Save data/004_Game_SaveValues.rb +++ b/Data/Scripts/002_Save data/004_Game_SaveValues.rb @@ -133,3 +133,11 @@ SaveData.register(:game_version) do load_value { |value| $save_game_version = value } new_game_value { Settings::GAME_VERSION } end + +SaveData.register(:stats) do + load_in_bootup + ensure_class :GameStats + save_value { $stats } + load_value { |value| $stats = value } + new_game_value { GameStats.new } +end diff --git a/Data/Scripts/002_Save data/005_Game_SaveConversions.rb b/Data/Scripts/002_Save data/005_Game_SaveConversions.rb index e6214de29..d1bd520d2 100644 --- a/Data/Scripts/002_Save data/005_Game_SaveConversions.rb +++ b/Data/Scripts/002_Save data/005_Game_SaveConversions.rb @@ -225,3 +225,31 @@ SaveData.register_conversion(:v20_refactor_day_care_variables) do end end end + +SaveData.register_conversion(:v20_add_stats) do + essentials_version 20 + display_title 'Adding stats to save data' + to_all do |save_data| + unless save_data.has_key?(:stats) + save_data[:stats] = GameStats.new + save_data[:stats].play_time = save_data[:frame_count].to_f / Graphics.frame_rate + save_data[:stats].play_sessions = 1 + save_data[:stats].time_last_saved = save_data[:stats].play_time + end + end +end + +SaveData.register_conversion(:v20_adding_pokedex_records) do + essentials_version 20 + display_title 'Adding more Pokédex records' + to_value :player do |player| + player.pokedex.instance_eval do + @seen_eggs = {} if @seen_eggs.nil? + @seen_forms.each_value do |sp| + next if !sp || sp[0][0].is_a?(Array) # Already converted to include shininess + sp[0] = [sp[0], []] + sp[1] = [sp[1], []] + end + end + end +end diff --git a/Data/Scripts/003_Game processing/001_StartGame.rb b/Data/Scripts/003_Game processing/001_StartGame.rb index ef376080b..d9b2d6671 100644 --- a/Data/Scripts/003_Game processing/001_StartGame.rb +++ b/Data/Scripts/003_Game processing/001_StartGame.rb @@ -45,6 +45,7 @@ module Game $game_temp.begun_new_game = true $scene = Scene_Map.new SaveData.load_new_game_values + $stats.play_sessions += 1 $map_factory = PokemonMapFactory.new($data_system.start_map_id) $game_player.moveto($data_system.start_x, $data_system.start_y) $game_player.refresh @@ -60,6 +61,7 @@ module Game def self.load(save_data) validate save_data => Hash SaveData.load_all_values(save_data) + $stats.play_sessions += 1 self.load_map pbAutoplayOnSave $game_map.update @@ -110,6 +112,7 @@ module Game $PokemonGlobal.safesave = safe $game_system.save_count += 1 $game_system.magic_number = $data_system.magic_number + $stats.set_time_last_saved begin SaveData.save_to_file(save_file) Graphics.frame_reset diff --git a/Data/Scripts/003_Game processing/003_Interpreter.rb b/Data/Scripts/003_Game processing/003_Interpreter.rb index d9e2ffb8b..1756a900e 100644 --- a/Data/Scripts/003_Game processing/003_Interpreter.rb +++ b/Data/Scripts/003_Game processing/003_Interpreter.rb @@ -378,6 +378,7 @@ class Interpreter # Apply strict version of passable, which treats tiles that are passable # only from certain directions as fully impassible return if !event.can_move_in_direction?($game_player.direction, true) + $stats.strength_push_count += 1 case $game_player.direction when 2 then event.move_down when 4 then event.move_left diff --git a/Data/Scripts/004_Game classes/009_Game_Player.rb b/Data/Scripts/004_Game classes/009_Game_Player.rb index 83592371a..2284eab31 100644 --- a/Data/Scripts/004_Game classes/009_Game_Player.rb +++ b/Data/Scripts/004_Game classes/009_Game_Player.rb @@ -112,6 +112,14 @@ class Game_Player < Game_Character if !$game_temp.encounter_triggered @x += x_offset @y += y_offset + if $PokemonGlobal&.diving || $PokemonGlobal&.surfing + $stats.distance_surfed += 1 + elsif $PokemonGlobal&.bicycle + $stats.distance_cycled += 1 + else + $stats.distance_walked += 1 + end + $stats.distance_slid_on_ice += 1 if $PokemonGlobal.sliding increase_steps end elsif !check_event_trigger_touch(dir) @@ -130,6 +138,39 @@ class Game_Player < Game_Character end end + def jump(x_plus, y_plus) + if x_plus != 0 || y_plus != 0 + if x_plus.abs > y_plus.abs + (x_plus < 0) ? turn_left : turn_right + else + (y_plus < 0) ? turn_up : turn_down + end + each_occupied_tile { |i, j| return if !passable?(i + x_plus, j + y_plus, 0) } + end + @x = @x + x_plus + @y = @y + y_plus + real_distance = Math::sqrt(x_plus * x_plus + y_plus * y_plus) + distance = [1, real_distance].max + @jump_peak = distance * Game_Map::TILE_HEIGHT * 3 / 8 # 3/4 of tile for ledge jumping + @jump_distance = [x_plus.abs * Game_Map::REAL_RES_X, y_plus.abs * Game_Map::REAL_RES_Y].max + @jump_distance_left = 1 # Just needs to be non-zero + if real_distance > 0 # Jumping to somewhere else + if $PokemonGlobal&.diving || $PokemonGlobal&.surfing + $stats.distance_surfed += x_plus.abs + y_pos.abs + elsif $PokemonGlobal&.bicycle + $stats.distance_cycled += x_plus.abs + y_pos.abs + else + $stats.distance_walked += x_plus.abs + y_pos.abs + end + @jump_count = 0 + else # Jumping on the spot + @jump_speed_real = nil # Reset jump speed + @jump_count = Game_Map::REAL_RES_X / jump_speed_real # Number of frames to jump one tile + end + @stop_count = 0 + triggerLeaveTile + end + def pbTriggeredTrainerEvents(triggers,checkIfRunning=true) result = [] # If event is running @@ -551,6 +592,7 @@ end def pbMountBike return if $PokemonGlobal.bicycle $PokemonGlobal.bicycle = true + $stats.cycle_count += 1 pbUpdateVehicle bike_bgm = GameData::Metadata.get.bicycle_BGM pbCueBGM(bike_bgm, 0.5) if bike_bgm diff --git a/Data/Scripts/004_Game classes/013_Game_Stats.rb b/Data/Scripts/004_Game classes/013_Game_Stats.rb new file mode 100644 index 000000000..50f807066 --- /dev/null +++ b/Data/Scripts/004_Game classes/013_Game_Stats.rb @@ -0,0 +1,196 @@ +#=============================================================================== +# Stored in $stats +#=============================================================================== +class GameStats + # Travel + attr_accessor :distance_walked, :distance_cycled, :distance_surfed # surfed includes diving + attr_accessor :distance_slid_on_ice # Also counted in distance_walked + attr_accessor :cycle_count, :surf_count, :dive_count + # Field actions + attr_accessor :fly_count, :cut_count, :flash_count + attr_accessor :rock_smash_count, :rock_smash_battles + attr_accessor :headbutt_count, :headbutt_battles + attr_accessor :strength_push_count # Number of shoves, not the times Strength was used + attr_accessor :waterfall_count, :waterfalls_descended + # Items + attr_accessor :repel_count + attr_accessor :itemfinder_count + attr_accessor :fishing_count, :fishing_battles + attr_accessor :poke_radar_count, :poke_radar_longest_chain + attr_accessor :berry_plants_picked, :max_yield_berry_plants + attr_accessor :berries_planted + # NPCs + attr_accessor :poke_center_count + attr_accessor :revived_fossil_count + attr_accessor :lottery_prize_count # Times won any prize at all + # Pokémon + attr_accessor :eggs_hatched + attr_accessor :evolution_count # Doesn't count cancelled evolutions + attr_accessor :trade_count + attr_accessor :moves_taught_by_item, :moves_taught_by_tutor, :moves_taught_by_reminder + attr_accessor :day_care_deposits, :day_care_levels_gained + attr_accessor :pokerus_infections + attr_accessor :shadow_pokemon_purified + # Battles + attr_accessor :wild_battles_won, :wild_battles_lost # Lost includes fled from + attr_accessor :trainer_battles_won, :trainer_battles_lost + attr_accessor :total_exp_gained + attr_accessor :battle_money_gained, :battle_money_lost + attr_accessor :blacked_out_count + attr_accessor :mega_evolution_count + attr_accessor :failed_poke_ball_count + # Currency + attr_accessor :money_spent_at_marts + attr_accessor :money_earned_at_marts + attr_accessor :mart_items_bought, :premier_balls_earned + attr_accessor :drinks_bought, :drinks_won # From vending machines + attr_accessor :coins_won, :coins_lost # Not bought, not spent + attr_accessor :battle_points_won, :battle_points_spent # Currently unused + attr_accessor :soot_collected + # Special stats + attr_accessor :times_to_get_badges # An array of times in seconds + attr_accessor :elite_four_attempts + attr_accessor :hall_of_fame_entry_count # See also Game Variable 13 + attr_accessor :time_to_enter_hall_of_fame # In seconds + attr_accessor :safari_pokemon_caught, :most_captures_per_safari_game + attr_accessor :bug_contest_count, :bug_contest_wins + # Play + attr_accessor :play_time # In seconds + attr_accessor :play_sessions + attr_accessor :time_last_saved # In seconds + + def initialize + # Travel + @distance_walked = 0 + @distance_cycled = 0 + @distance_surfed = 0 + @distance_slid_on_ice = 0 + @cycle_count = 0 + @surf_count = 0 + @dive_count = 0 + # Field actions + @fly_count = 0 + @cut_count = 0 + @flash_count = 0 + @rock_smash_count = 0 + @rock_smash_battles = 0 + @headbutt_count = 0 + @headbutt_battles = 0 + @strength_push_count = 0 + @waterfall_count = 0 + @waterfalls_descended = 0 + # Items + @repel_count = 0 + @itemfinder_count = 0 + @fishing_count = 0 + @fishing_battles = 0 + @poke_radar_count = 0 + @poke_radar_longest_chain = 0 + @berry_plants_picked = 0 + @max_yield_berry_plants = 0 + @berries_planted = 0 + # NPCs + @poke_center_count = 0 # Incremented in Poké Center nurse events + @revived_fossil_count = 0 # Incremented in fossil reviver events + @lottery_prize_count = 0 # Incremented in lottery NPC events + # Pokémon + @eggs_hatched = 0 + @evolution_count = 0 + @trade_count = 0 + @moves_taught_by_item = 0 + @moves_taught_by_tutor = 0 + @moves_taught_by_reminder = 0 + @day_care_deposits = 0 + @day_care_levels_gained = 0 + @pokerus_infections = 0 + @shadow_pokemon_purified = 0 + # Battles + @wild_battles_won = 0 + @wild_battles_lost = 0 + @trainer_battles_won = 0 + @trainer_battles_lost = 0 + @total_exp_gained = 0 + @battle_money_gained = 0 + @battle_money_lost = 0 + @blacked_out_count = 0 + @mega_evolution_count = 0 + @failed_poke_ball_count = 0 + # Currency + @money_spent_at_marts = 0 + @money_earned_at_marts = 0 + @mart_items_bought = 0 + @premier_balls_earned = 0 + @drinks_bought = 0 # Incremented in vending machine events + @drinks_won = 0 # Incremented in vending machine events + @coins_won = 0 + @coins_lost = 0 + @battle_points_won = 0 + @battle_points_spent = 0 + @soot_collected = 0 + # Special stats + @gym_leader_attempts = [] # Incremented in Gym Leader events + @times_to_get_badges = [] # Set with set_time_to_badge(number) in Gym Leader events + @elite_four_attempts = 0 # Incremented in door event leading to the first E4 member + @hall_of_fame_entry_count = 0 # Incremented in Hall of Fame event + @time_to_enter_hall_of_fame = 0 # Set with set_time_to_hall_of_fame in Hall of Fame event + @safari_pokemon_caught = 0 + @most_captures_per_safari_game = 0 + @bug_contest_count = 0 + @bug_contest_wins = 0 + # Play + @play_time = 0 + @play_sessions = 0 + @time_last_saved = 0 + end + + def distance_moved + return @distance_walked + @distance_cycled + @distance_surfed + end + + def caught_pokemon_count + return 0 if !$player + ret = 0 + GameData::Species.each_species { |sp| ret += $player.pokedex.caught_count(sp) } + return ret + end + + def save_count + return $game_system&.save_count || 0 + end + + def set_time_to_badge(number) + @times_to_get_badges[number] = @play_time + end + + def set_time_to_hall_of_fame + @time_to_enter_hall_of_fame = @play_time + end + + def play_time_per_session + return @play_time / @play_sessions + end + + def set_time_last_saved + @time_last_saved = @play_time + end + + def time_since_last_save + return @play_time - @time_last_saved + end +end + +#=============================================================================== +# +#=============================================================================== +module Graphics + unless defined?(update_stats_play_time) + class << Graphics + alias update_stats_play_time update + end + end + + def self.update + update_stats_play_time + $stats.play_time += self.delta_s if $stats && $PokemonEncounters + end +end diff --git a/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb b/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb index a363d5444..94fef959d 100644 --- a/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb +++ b/Data/Scripts/011_Battle/003_Battle/002_PokeBattle_Battle.rb @@ -652,7 +652,8 @@ class PokeBattle_Battle def pbSetSeen(battler) return if !battler || !@internalBattle if battler.is_a?(PokeBattle_Battler) - pbPlayer.pokedex.register(battler.displaySpecies,battler.displayGender,battler.displayForm) + pbPlayer.pokedex.register(battler.displaySpecies, battler.displayGender, + battler.displayForm, battler.shiny?) else pbPlayer.pokedex.register(battler) end diff --git a/Data/Scripts/011_Battle/003_Battle/003_Battle_StartAndEnd.rb b/Data/Scripts/011_Battle/003_Battle/003_Battle_StartAndEnd.rb index bd9971323..c83c22908 100644 --- a/Data/Scripts/011_Battle/003_Battle/003_Battle_StartAndEnd.rb +++ b/Data/Scripts/011_Battle/003_Battle/003_Battle_StartAndEnd.rb @@ -349,6 +349,7 @@ class PokeBattle_Battle pbPlayer.money += tMoney moneyGained = pbPlayer.money-oldMoney if moneyGained>0 + $stats.battle_money_gained += moneyGained pbDisplayPaused(_INTL("You got ${1} for winning!",moneyGained.to_s_formatted)) end end @@ -360,6 +361,7 @@ class PokeBattle_Battle pbPlayer.money += @field.effects[PBEffects::PayDay] moneyGained = pbPlayer.money-oldMoney if moneyGained>0 + $stats.battle_money_gained += moneyGained pbDisplayPaused(_INTL("You picked up ${1}!",moneyGained.to_s_formatted)) end end @@ -377,6 +379,7 @@ class PokeBattle_Battle pbPlayer.money -= tMoney moneyLost = oldMoney-pbPlayer.money if moneyLost>0 + $stats.battle_money_lost += moneyLost if trainerBattle? pbDisplayPaused(_INTL("You gave ${1} to the winner...",moneyLost.to_s_formatted)) else diff --git a/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb b/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb index 8b6b90104..11c0bf5d7 100644 --- a/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb +++ b/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb @@ -178,6 +178,7 @@ class PokeBattle_Battle pkmn.name,debugInfo)) end # Give Exp + $stats.total_exp_gained += expGained if pkmn.shadowPokemon? pkmn.exp += expGained return diff --git a/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb b/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb index ff63f9ac2..87ce9bc85 100644 --- a/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb +++ b/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb @@ -127,6 +127,7 @@ class PokeBattle_Battle battler = @battlers[idxBattler] return if !battler || !battler.pokemon return if !battler.hasMega? || battler.mega? + $stats.mega_evolution_count += 1 if battler.pbOwnedByPlayer? trainerName = pbGetOwnerName(idxBattler) old_ability = battler.ability_id # Break Illusion diff --git a/Data/Scripts/011_Battle/005_BallHandlers_PokeBallEffects.rb b/Data/Scripts/011_Battle/005_BallHandlers_PokeBallEffects.rb index 794ff466b..ff1b50e3f 100644 --- a/Data/Scripts/011_Battle/005_BallHandlers_PokeBallEffects.rb +++ b/Data/Scripts/011_Battle/005_BallHandlers_PokeBallEffects.rb @@ -22,6 +22,7 @@ module BallHandlers end def self.onFailCatch(ball,battle,battler) + $stats.failed_poke_ball_count += 1 OnFailCatch.trigger(ball,battle,battler) end end diff --git a/Data/Scripts/011_Battle/006_Other battle types/002_PokeBattle_SafariZone.rb b/Data/Scripts/011_Battle/006_Other battle types/002_PokeBattle_SafariZone.rb index 1b4d3efb7..f889f3fcb 100644 --- a/Data/Scripts/011_Battle/006_Other battle types/002_PokeBattle_SafariZone.rb +++ b/Data/Scripts/011_Battle/006_Other battle types/002_PokeBattle_SafariZone.rb @@ -358,7 +358,8 @@ class PokeBattle_SafariZone def pbSetSeen(battler) return if !battler || !@internalBattle if battler.is_a?(PokeBattle_Battler) - pbPlayer.pokedex.register(battler.displaySpecies,battler.displayGender,battler.displayForm) + pbPlayer.pokedex.register(battler.displaySpecies, battler.displayGender, + battler.displayForm, battler.shiny?) else pbPlayer.pokedex.register(battler) end diff --git a/Data/Scripts/012_Overworld/001_Overworld visuals/003_Overworld_MapTransitionAnims.rb b/Data/Scripts/012_Overworld/001_Overworld visuals/003_Overworld_MapTransitionAnims.rb index d8a4b7d59..637fab861 100644 --- a/Data/Scripts/012_Overworld/001_Overworld visuals/003_Overworld_MapTransitionAnims.rb +++ b/Data/Scripts/012_Overworld/001_Overworld visuals/003_Overworld_MapTransitionAnims.rb @@ -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 diff --git a/Data/Scripts/012_Overworld/001_Overworld.rb b/Data/Scripts/012_Overworld/001_Overworld.rb index e7e16f55e..a1e8e89eb 100644 --- a/Data/Scripts/012_Overworld/001_Overworld.rb +++ b/Data/Scripts/012_Overworld/001_Overworld.rb @@ -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 diff --git a/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb b/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb index e8e4eaf23..1646660d4 100644 --- a/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb +++ b/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb @@ -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 diff --git a/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb b/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb index 6e48d5a51..dd871502a 100644 --- a/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb +++ b/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb @@ -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= 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)) diff --git a/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb b/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb index f51747877..d04f7acc2 100644 --- a/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb +++ b/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb @@ -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 diff --git a/Data/Scripts/013_Items/002_Item_Effects.rb b/Data/Scripts/013_Items/002_Item_Effects.rb index d96629c32..b6a65488a 100644 --- a/Data/Scripts/013_Items/002_Item_Effects.rb +++ b/Data/Scripts/013_Items/002_Item_Effects.rb @@ -99,6 +99,7 @@ def pbRepel(item,steps) pbMessage(_INTL("But a repellent's effect still lingers from earlier.")) return false end + $stats.repel_count += 1 pbUseItemMessage(item) $PokemonGlobal.repel = steps return true @@ -243,6 +244,7 @@ ItemHandlers::UseInField.add(:OLDROD,proc { |item| end encounter = $PokemonEncounters.has_encounter_type?(:OldRod) if pbFishing(encounter,1) + $stats.fishing_battles += 1 pbEncounter(:OldRod) end next true @@ -256,6 +258,7 @@ ItemHandlers::UseInField.add(:GOODROD,proc { |item| end encounter = $PokemonEncounters.has_encounter_type?(:GoodRod) if pbFishing(encounter,2) + $stats.fishing_battles += 1 pbEncounter(:GoodRod) end next true @@ -269,12 +272,14 @@ ItemHandlers::UseInField.add(:SUPERROD,proc { |item| end encounter = $PokemonEncounters.has_encounter_type?(:SuperRod) if pbFishing(encounter,3) + $stats.fishing_battles += 1 pbEncounter(:SuperRod) end next true }) ItemHandlers::UseInField.add(:ITEMFINDER,proc { |item| + $stats.itemfinder_count += 1 event = pbClosestHiddenItem if !event pbMessage(_INTL("... \\wt[10]... \\wt[10]... \\wt[10]...\\wt[10]Nope! There's no response.")) diff --git a/Data/Scripts/013_Items/005_Item_PokeRadar.rb b/Data/Scripts/013_Items/005_Item_PokeRadar.rb index 8d278afb0..89b0b5470 100644 --- a/Data/Scripts/013_Items/005_Item_PokeRadar.rb +++ b/Data/Scripts/013_Items/005_Item_PokeRadar.rb @@ -43,6 +43,7 @@ end def pbUsePokeRadar return false if !pbCanUsePokeRadar? + $stats.poke_radar_count += 1 $game_temp.poke_radar_data = [0, 0, 0, [], false] if !$game_temp.poke_radar_data $game_temp.poke_radar_data[4] = false $PokemonGlobal.pokeradarBattery = 50 @@ -80,7 +81,7 @@ def pbPokeRadarHighlightGrass(showmessage=true) # Choose a rarity for the grass (0=normal, 1=rare, 2=shiny) s = (rand(100) < 25) ? 1 : 0 if $game_temp.poke_radar_data && $game_temp.poke_radar_data[2] > 0 - v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - $game_temp.poke_radar_data[2] * 200, 200].max + v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - [$game_temp.poke_radar_data[2], 40].min * 200, 200].max v = (65536 / v.to_f).ceil s = 2 if rand(65536) < v end @@ -163,7 +164,7 @@ EncounterModifier.register(proc { |encounter| $game_temp.poke_radar_data[3].each { |g| rarity = g[3] if g[2] == ring } if $game_temp.poke_radar_data[2] > 0 # Chain count, i.e. is chaining if rarity == 2 || - rand(100) < 58 + ring * 10 + ($game_temp.poke_radar_data[2] / 4) + ($game_temp.poke_radar_data[4] ? 10 : 0) + rand(100) < 58 + ring * 10 + ([$game_temp.poke_radar_data[2], 40].min / 4) + ($game_temp.poke_radar_data[4] ? 10 : 0) # Continue the chain encounter = [$game_temp.poke_radar_data[0], $game_temp.poke_radar_data[1]] $game_temp.force_single_battle = true @@ -210,7 +211,8 @@ Events.onWildBattleEnd += proc { |_sender,e| if $game_temp.poke_radar_data && (decision==1 || decision==4) # Defeated/caught $game_temp.poke_radar_data[0] = species $game_temp.poke_radar_data[1] = level - $game_temp.poke_radar_data[2] = [$game_temp.poke_radar_data[2] + 1, 40].min + $game_temp.poke_radar_data[2] += 1 + $stats.poke_radar_longest_chain = [$game_temp.poke_radar_data[2], $stats.poke_radar_longest_chain].max # Catching makes the next Radar encounter more likely to continue the chain $game_temp.poke_radar_data[4] = (decision == 4) pbPokeRadarHighlightGrass(false) diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/002_ShadowPokemon_Other.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/002_ShadowPokemon_Other.rb index 2ee3dbb76..e9b2a72a0 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/002_ShadowPokemon_Other.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/002_ShadowPokemon_Other.rb @@ -18,6 +18,7 @@ critical hit. #=============================================================================== def pbPurify(pkmn, scene) return if !pkmn.shadowPokemon? || pkmn.heart_gauge != 0 + $stats.shadow_pokemon_purified += 1 pkmn.shadow = false pkmn.giveRibbon(:NATIONAL) scene.pbDisplay(_INTL("{1} opened the door to its heart!", pkmn.name)) diff --git a/Data/Scripts/014_Pokemon/001_Pokemon.rb b/Data/Scripts/014_Pokemon/001_Pokemon.rb index 7732fd1a5..4224e317a 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon.rb @@ -797,6 +797,7 @@ class Pokemon # @param strain [Integer] Pokérus strain to give def givePokerus(strain = 0) return if self.pokerusStage == 2 # Can't re-infect a cured Pokémon + $stats.pokerus_infections += 1 strain = rand(1..16) if strain <= 0 || strain >= 16 time = 1 + (strain % 4) @pokerus = time diff --git a/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb b/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb index c17a47488..4ffb6d6c9 100644 --- a/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb +++ b/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb @@ -22,13 +22,15 @@ class Player < Trainer # Clears the Pokédex. def clear - @seen = {} - @owned = {} - @seen_forms = {} - @last_seen_forms = {} - @owned_shadow = {} - @caught_counts = {} - @defeated_counts = {} + @seen = {} + @owned = {} + @seen_forms = {} # Gender (0 or 1), shiny (0 or 1), form number + @seen_shiny_forms = {} + @seen_eggs = {} + @last_seen_forms = {} + @owned_shadow = {} + @caught_counts = {} + @defeated_counts = {} self.refresh_accessible_dexes end @@ -55,12 +57,33 @@ class Player < Trainer # @param species [Symbol, GameData::Species] species to check # @param gender [Integer] gender to check # @param form [Integer] form to check - # @return [Boolean] whether the species of the given gender and form is seen - def seen_form?(species, gender, form) + # @param shiny [Boolean, nil] shininess to check (checks both if nil) + # @return [Boolean] whether the species of the given gender/form/shininess is seen + def seen_form?(species, gender, form, shiny = nil) species_id = GameData::Species.try_get(species)&.species return false if species_id.nil? - @seen_forms[species_id] ||= [[], []] - return @seen_forms[species_id][gender][form] == true + @seen_forms[species_id] ||= [[[], []], [[], []]] + if shiny.nil? + return @seen_forms[species_id][gender][0][form] || @seen_forms[species_id][gender][1][form] + end + shin = (shiny) ? 1 : 0 + return @seen_forms[species_id][gender][shin][form] == true + end + + # Sets the egg for the given species as seen. + # @param species [Symbol, GameData::Species] species to set as seen + def set_seen_egg(species) + species_id = GameData::Species.try_get(species)&.species + return if species_id.nil? + @seen_eggs[species_id] = true + end + + # @param species [Symbol, GameData::Species] species to check + # @return [Boolean] whether the egg for the given species is seen + def seen_egg?(species) + species_id = GameData::Species.try_get(species)&.species + return false if species_id.nil? + return @seen_eggs[species_id] == true end # Returns the amount of seen Pokémon. @@ -94,10 +117,11 @@ class Player < Trainer species_id = GameData::Species.try_get(species)&.species return 0 if species_id.nil? ret = 0 - @seen_forms[species_id] ||= [[], []] + @seen_forms[species_id] ||= [[[], []], [[], []]] array = @seen_forms[species_id] for i in 0...[array[0].length, array[1].length].max - ret += 1 if array[0][i] || array[1][i] + ret += 1 if array[0][0][i] || array[0][1][i] || # male or genderless shiny/non-shiny + array[1][0][i] || array[1][1][i] # female shiny/non-shiny end return ret end @@ -166,16 +190,20 @@ class Player < Trainer # @param species [Pokemon, Symbol, GameData::Species] Pokemon to register as seen # @param gender [Integer] gender to register (0=male, 1=female, 2=genderless) # @param form [Integer] form to register - def register(species, gender = 0, form = 0, should_refresh_dexes = true) + # @param shiny [Boolean] shininess to register + # @param should_refresh_dexes [Boolean] whether to recalculate accessible Dex lists + def register(species, gender = 0, form = 0, shiny = false, should_refresh_dexes = true) if species.is_a?(Pokemon) species_data = species.species_data gender = species.gender + shiny = species.shiny? else species_data = GameData::Species.get_species_form(species, form) end species = species_data.species gender = 0 if gender >= 2 form = species_data.form + shin = (shiny) ? 1 : 0 if form != species_data.pokedex_form species_data = GameData::Species.get_species_form(species, species_data.pokedex_form) form = species_data.form @@ -183,8 +211,8 @@ class Player < Trainer form = 0 if species_data.form_name.nil? || species_data.form_name.empty? # Register as seen @seen[species] = true - @seen_forms[species] ||= [[], []] - @seen_forms[species][gender][form] = true + @seen_forms[species] ||= [[[], []], [[], []]] + @seen_forms[species][gender][shin][form] = true @last_seen_forms[species] ||= [] @last_seen_forms[species] = [gender, form] if @last_seen_forms[species] == [] self.refresh_accessible_dexes if should_refresh_dexes @@ -207,7 +235,7 @@ class Player < Trainer def caught_count(species) species_id = GameData::Species.try_get(species)&.species return 0 if species_id.nil? - return @caught_counts[species] || 0 + return @caught_counts[species_id] || 0 end # @param species [Symbol, GameData::Species] species to check @@ -216,7 +244,7 @@ class Player < Trainer def defeated_count(species) species_id = GameData::Species.try_get(species)&.species return 0 if species_id.nil? - return @defeated_counts[species] || 0 + return @defeated_counts[species_id] || 0 end # @param species [Symbol, GameData::Species] species to check @@ -225,23 +253,23 @@ class Player < Trainer def battled_count(species) species_id = GameData::Species.try_get(species)&.species return 0 if species_id.nil? - return (@defeated_counts[species] || 0) + (@caught_counts[species] || 0) + return (@defeated_counts[species_id] || 0) + (@caught_counts[species_id] || 0) end # @param species [Symbol, GameData::Species] species to count as caught def register_caught(species) species_id = GameData::Species.try_get(species)&.species return if species_id.nil? - @caught_counts[species] = 0 if @caught_counts[species].nil? - @caught_counts[species] += 1 + @caught_counts[species_id] = 0 if @caught_counts[species_id].nil? + @caught_counts[species_id] += 1 end # @param species [Symbol, GameData::Species] species to count as defeated def register_defeated(species) species_id = GameData::Species.try_get(species)&.species return if species_id.nil? - @defeated_counts[species] = 0 if @defeated_counts[species].nil? - @defeated_counts[species] += 1 + @defeated_counts[species_id] = 0 if @defeated_counts[species_id].nil? + @defeated_counts[species_id] += 1 end #=========================================================================== diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb b/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb index 639fcb6cf..eebc65839 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb @@ -189,6 +189,7 @@ def pbHatchAnimation(pokemon) end def pbHatch(pokemon) + $stats.eggs_hatched += 1 speciesname = pokemon.speciesName pokemon.name = nil pokemon.owner = Pokemon::Owner.new_from_trainer($player) @@ -198,6 +199,7 @@ def pbHatch(pokemon) pokemon.hatched_map = $game_map.map_id $player.pokedex.register(pokemon) $player.pokedex.set_owned(pokemon.species) + $player.pokedex.set_seen_egg(pokemon.species) pokemon.record_first_moves if !pbHatchAnimation(pokemon) pbMessage(_INTL("Huh?\1")) diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb index 13e6d3f37..a7a79fc79 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb @@ -566,6 +566,7 @@ class PokemonEvolutionScene end def pbEvolutionSuccess + $stats.evolution_count += 1 # Play cry of evolved species frames = GameData::Species.cry_length(@newspecies, @pokemon.form) pbBGMStop diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb b/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb index 7585b97e1..3f49c5c73 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb @@ -198,6 +198,7 @@ end # #=============================================================================== def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0) + $stats.trade_count += 1 myPokemon = $player.party[pokemonIndex] opponent = NPCTrainer.new(trainerName,trainerGender) opponent.id = $player.make_foreign_ID diff --git a/Data/Scripts/016_UI/012_UI_TrainerCard.rb b/Data/Scripts/016_UI/012_UI_TrainerCard.rb index 1c599f624..fb0a5f7c6 100644 --- a/Data/Scripts/016_UI/012_UI_TrainerCard.rb +++ b/Data/Scripts/016_UI/012_UI_TrainerCard.rb @@ -39,7 +39,7 @@ class PokemonTrainerCard_Scene overlay.clear baseColor = Color.new(72,72,72) shadowColor = Color.new(160,160,160) - totalsec = Graphics.frame_count / Graphics.frame_rate + totalsec = $stats.play_time.to_i hour = totalsec / 60 / 60 min = totalsec / 60 % 60 time = (hour>0) ? _INTL("{1}h {2}m",hour,min) : _INTL("{1}m",min) diff --git a/Data/Scripts/016_UI/013_UI_Load.rb b/Data/Scripts/016_UI/013_UI_Load.rb index d9a31617e..149b06ac2 100644 --- a/Data/Scripts/016_UI/013_UI_Load.rb +++ b/Data/Scripts/016_UI/013_UI_Load.rb @@ -11,13 +11,13 @@ class PokemonLoadPanel < SpriteWrapper FEMALETEXTCOLOR = Color.new(240,72,88) FEMALETEXTSHADOWCOLOR = Color.new(160,64,64) - def initialize(index,title,isContinue,trainer,framecount,mapid,viewport=nil) + def initialize(index, title, isContinue, trainer, framecount, stats, mapid, viewport = nil) super(viewport) @index = index @title = title @isContinue = isContinue @trainer = trainer - @totalsec = (framecount || 0) / Graphics.frame_rate + @totalsec = (stats) ? stats.play_time.to_i : ((framecount || 0) / Graphics.frame_rate) @mapid = mapid @selected = (index==0) @bgbitmap = AnimatedBitmap.new("Graphics/Pictures/loadPanels") @@ -98,7 +98,7 @@ end # #=============================================================================== class PokemonLoad_Scene - def pbStartScene(commands, show_continue, trainer, frame_count, map_id) + def pbStartScene(commands, show_continue, trainer, frame_count, stats, map_id) @commands = commands @sprites = {} @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) @@ -106,8 +106,8 @@ class PokemonLoad_Scene addBackgroundOrColoredPlane(@sprites,"background","loadbg",Color.new(248,248,248),@viewport) y = 16*2 for i in 0...commands.length - @sprites["panel#{i}"] = PokemonLoadPanel.new(i,commands[i], - (show_continue) ? (i==0) : false,trainer,frame_count,map_id,@viewport) + @sprites["panel#{i}"] = PokemonLoadPanel.new(i, commands[i], + (show_continue) ? (i == 0) : false, trainer, frame_count, stats, map_id, @viewport) @sprites["panel#{i}"].x = 24*2 @sprites["panel#{i}"].y = y @sprites["panel#{i}"].pbRefresh @@ -297,7 +297,7 @@ class PokemonLoadScreen commands[cmd_quit = commands.length] = _INTL('Quit Game') map_id = show_continue ? @save_data[:map_factory].map.map_id : 0 @scene.pbStartScene(commands, show_continue, @save_data[:player], - @save_data[:frame_count] || 0, map_id) + @save_data[:frame_count] || 0, @save_data[:stats], map_id) @scene.pbSetParty(@save_data[:player]) if show_continue @scene.pbStartScene2 loop do diff --git a/Data/Scripts/016_UI/014_UI_Save.rb b/Data/Scripts/016_UI/014_UI_Save.rb index 85d036034..711757d4e 100644 --- a/Data/Scripts/016_UI/014_UI_Save.rb +++ b/Data/Scripts/016_UI/014_UI_Save.rb @@ -28,7 +28,7 @@ class PokemonSave_Scene @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @viewport.z=99999 @sprites={} - totalsec = Graphics.frame_count / Graphics.frame_rate + totalsec = $stats.play_time.to_i hour = totalsec / 60 / 60 min = totalsec / 60 % 60 mapname=$game_map.name diff --git a/Data/Scripts/016_UI/020_UI_PokeMart.rb b/Data/Scripts/016_UI/020_UI_PokeMart.rb index 6dc04cc16..92903e7ec 100644 --- a/Data/Scripts/016_UI/020_UI_PokeMart.rb +++ b/Data/Scripts/016_UI/020_UI_PokeMart.rb @@ -587,6 +587,8 @@ class PokemonMartScreen end pbDisplayPaused(_INTL("You have no more room in the Bag.")) else + $stats.money_spent_at_marts += price + $stats.mart_items_bought += quantity @adapter.setMoney(@adapter.getMoney-price) @stock.delete_if { |item| GameData::Item.get(item).is_important? && $bag.has?(item) } pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") } @@ -597,6 +599,7 @@ class PokemonMartScreen break if !@adapter.addItem(:PREMIERBALL) premier_balls_added += 1 end + $stats.premier_balls_earned += premier_balls_added if premier_balls_added > 1 pbDisplayPaused(_INTL("I'll throw in some {1}, too.", GameData::Item.get(:PREMIERBALL).name_plural)) elsif premier_balls_added > 0 @@ -604,6 +607,7 @@ class PokemonMartScreen end elsif !Settings::MORE_BONUS_PREMIER_BALLS && GameData::Item.get(item) == :POKEBALL if @adapter.addItem(GameData::Item.get(:PREMIERBALL)) + $stats.premier_balls_earned += 1 pbDisplayPaused(_INTL("I'll throw in a Premier Ball, too.")) end end @@ -638,7 +642,9 @@ class PokemonMartScreen price/=2 price*=qty if pbConfirm(_INTL("I can pay ${1}. Would that be OK?",price.to_s_formatted)) + old_money = @adapter.getMoney @adapter.setMoney(@adapter.getMoney+price) + $stats.money_earned_at_marts += @adapter.getMoney - old_money qty.times do @adapter.removeItem(item) end diff --git a/Data/Scripts/016_UI/021_UI_MoveRelearner.rb b/Data/Scripts/016_UI/021_UI_MoveRelearner.rb index 57ac32320..24519a77c 100644 --- a/Data/Scripts/016_UI/021_UI_MoveRelearner.rb +++ b/Data/Scripts/016_UI/021_UI_MoveRelearner.rb @@ -177,6 +177,7 @@ class MoveRelearnerScreen if move if @scene.pbConfirm(_INTL("Teach {1}?", GameData::Move.get(move).name)) if pbLearnMove(pkmn, move) + $stats.moves_taught_by_reminder += 1 @scene.pbEndScene return true end diff --git a/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb b/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb index 9a2ee59ce..c89b29e8b 100644 --- a/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb +++ b/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb @@ -361,7 +361,13 @@ class SlotMachineScene end frame = (frame+1)%(Graphics.frame_rate*4) end + old_coins = $player.coins $player.coins = @sprites["credit"].score + if $player.coins > old_coins + $stats.coins_won += $player.coins - old_coins + elsif $player.coins < old_coins + $stats.coins_lost += old_coins - $player.coins + end end def pbEndScene diff --git a/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb b/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb index 58e0e6aa2..f882a5848 100644 --- a/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb +++ b/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb @@ -370,7 +370,9 @@ class VoltorbFlip # Update level text @sprites["level"].bitmap.clear pbDrawShadowText(@sprites["level"].bitmap,8,150,118,28,_INTL("Level {1}",@level.to_s),Color.new(60,60,60),Color.new(150,190,170),1) + old_coins = $player.coins $player.coins+=@points + $stats.coins_won += $player.coins - old_coins if $player.coins > old_coins @points=0 pbUpdateCoins @sprites["curtain"].opacity=0 @@ -414,7 +416,9 @@ class VoltorbFlip end elsif pbConfirmMessage(_INTL("If you quit now, you will recieve {1} Coin(s). Will you quit?",@points.to_s_formatted)) pbMessage(_INTL("{1} received {2} Coin(s)!",$player.name,@points.to_s_formatted)) + old_coins = $player.coins $player.coins+=@points + $stats.coins_won += $player.coins - old_coins if $player.coins > old_coins @points=0 pbUpdateCoins @sprites["curtain"].opacity=0 diff --git a/Data/Scripts/018_Alternate battle modes/001_SafariZone.rb b/Data/Scripts/018_Alternate battle modes/001_SafariZone.rb index 2e3c062d1..933df83bf 100644 --- a/Data/Scripts/018_Alternate battle modes/001_SafariZone.rb +++ b/Data/Scripts/018_Alternate battle modes/001_SafariZone.rb @@ -1,11 +1,13 @@ class SafariState attr_accessor :ballcount + attr_accessor :captures attr_accessor :decision attr_accessor :steps def initialize @start = nil @ballcount = 0 + @captures = 0 @inProgress = false @steps = 0 @decision = 0 @@ -43,6 +45,7 @@ class SafariState def pbEnd @start = nil @ballcount = 0 + @captures = 0 @inProgress = false @steps = 0 @decision = 0 @@ -130,6 +133,11 @@ def pbSafariBattle(species,level) # 2 - Player ran out of Safari Balls # 3 - Player or wild Pokémon ran from battle, or player forfeited the match # 4 - Wild Pokémon was caught + if decision == 4 + $stats.safari_pokemon_caught += 1 + pbSafariState.captures += 1 + $stats.most_captures_per_safari_game = [$stats.most_captures_per_safari_game, pbSafariState.captures].max + end pbSet(1,decision) # Used by the Poké Radar to update/break the chain Events.onWildBattleEnd.trigger(nil,species,level,decision) diff --git a/Data/Scripts/018_Alternate battle modes/002_BugContest.rb b/Data/Scripts/018_Alternate battle modes/002_BugContest.rb index 6421e9244..87adeb0ba 100644 --- a/Data/Scripts/018_Alternate battle modes/002_BugContest.rb +++ b/Data/Scripts/018_Alternate battle modes/002_BugContest.rb @@ -188,6 +188,7 @@ class BugContestState $player.party=[chosenpkmn] @decision=0 @ended=false + $stats.bug_contest_count += 1 end def place @@ -210,6 +211,7 @@ class BugContestState else @ended=false end + $stats.bug_contest_wins += 1 if place == 0 @lastPokemon=nil @otherparty=[] @reception=[] diff --git a/Data/Scripts/019_Utilities/001_Utilities.rb b/Data/Scripts/019_Utilities/001_Utilities.rb index f07272a55..9e814c19b 100644 --- a/Data/Scripts/019_Utilities/001_Utilities.rb +++ b/Data/Scripts/019_Utilities/001_Utilities.rb @@ -452,6 +452,8 @@ def pbMoveTutorChoose(move,movelist=nil,bymachine=false,oneusemachine=false) pbMessage(_INTL("{1} can't learn {2}.",pokemon.name,movename)) { screen.pbUpdate } else if pbLearnMove(pokemon,move,false,bymachine) { screen.pbUpdate } + $stats.moves_taught_by_item += 1 if bymachine + $stats.moves_taught_by_tutor += 1 if !bymachine pokemon.add_first_move(move) if oneusemachine ret = true break diff --git a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb index 7ebba86cc..089cc1d39 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb @@ -632,15 +632,19 @@ DebugMenuCommands.register("fillboxes", { if f == 0 if species_data.single_gendered? g = (species_data.gender_ratio == :AlwaysFemale) ? 1 : 0 - $player.pokedex.register(sp, g, f, false) + $player.pokedex.register(sp, g, f, 0, false) + $player.pokedex.register(sp, g, f, 1, false) else # Both male and female - $player.pokedex.register(sp, 0, f, false) - $player.pokedex.register(sp, 1, f, false) + $player.pokedex.register(sp, 0, f, 0, false) + $player.pokedex.register(sp, 0, f, 1, false) + $player.pokedex.register(sp, 1, f, 0, false) + $player.pokedex.register(sp, 1, f, 1, false) end $player.pokedex.set_owned(sp, false) elsif species_data.real_form_name && !species_data.real_form_name.empty? g = (species_data.gender_ratio == :AlwaysFemale) ? 1 : 0 - $player.pokedex.register(sp, g, f, false) + $player.pokedex.register(sp, g, f, 0, false) + $player.pokedex.register(sp, g, f, 1, false) end # Add Pokémon (if form 0, i.e. one of each species) next if f != 0 diff --git a/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb index 864b9b702..25311e70f 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb @@ -888,6 +888,7 @@ PokemonDebugMenuCommands.register("setshininess", { pkmn.shiny = nil pkmn.super_shiny = nil end + $player.pokedex.register(pkmn) if !settingUpBattle screen.pbRefreshSingle(pkmnid) end next false