mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-22 14:26:01 +00:00
Added class GameStats, added Pokédex records for eggs seen and expanded seen_forms to include shinies
This commit is contained in:
@@ -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
|
||||
|
||||
196
Data/Scripts/004_Game classes/013_Game_Stats.rb
Normal file
196
Data/Scripts/004_Game classes/013_Game_Stats.rb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user