Adding rematch against Groudon or Kyogre.

This commit is contained in:
sergiotarxz 2023-01-30 17:56:01 +01:00
parent 7a76140c1f
commit 62685a8bc4
2 changed files with 199 additions and 0 deletions

View File

@ -0,0 +1,25 @@
#!/usr/bin/env perl
use v5.34.1;
use strict;
use warnings;
use Rsaves
qw/read_save check_correct_size get_saves find_current_save_index check_correct_size find_pokemon_substruct change_gender read_pc_storage save_pc_changes enable_eon_ticket save_changes pokemon_set_shiny read_pkm_file_box enable_rematch_main_legendary/;
use Rsaves::Constants::Ruby::Global qw/$MALE $FEMALE/;
sub start {
my ( @saves_raw, $extra );
( @saves_raw[ 0, 1 ], $extra ) = read_save('ruby.sav');
check_correct_size( @saves_raw, $extra );
my @saves = get_saves(@saves_raw);
my $current_save_index = find_current_save_index(@saves);
my $save = $saves[$current_save_index];
# Sightly more complex for other flags, take a look to enable_eon_ticket to see how it works.
enable_rematch_main_legendary($save);
save_changes( @saves, $extra, 'ruby1.sav' );
}
start;

View File

@ -0,0 +1,174 @@
package Rsaves::Constants::Ruby::Vars;
use v5.34.1;
use strict;
use warnings;
use Exporter;
use parent 'Exporter';
our $VARS_START = 0x4000;
our $VAR_TEMP_0 = 0x4000;
our $VAR_TEMP_1 = 0x4001;
our $VAR_TEMP_2 = 0x4002;
our $VAR_TEMP_3 = 0x4003;
our $VAR_TEMP_4 = 0x4004;
our $VAR_TEMP_5 = 0x4005;
our $VAR_TEMP_6 = 0x4006;
our $VAR_TEMP_7 = 0x4007;
our $VAR_TEMP_8 = 0x4008;
our $VAR_TEMP_9 = 0x4009;
our $VAR_TEMP_A = 0x400A;
our $VAR_TEMP_B = 0x400B;
our $VAR_TEMP_C = 0x400C;
our $VAR_TEMP_D = 0x400D;
our $VAR_TEMP_E = 0x400E;
our $VAR_TEMP_F = 0x400F;
our $VAR_OBJ_GFX_ID_0 = 0x4010;
our $VAR_OBJ_GFX_ID_1 = 0x4011;
our $VAR_OBJ_GFX_ID_2 = 0x4012;
our $VAR_OBJ_GFX_ID_3 = 0x4013;
our $VAR_OBJ_GFX_ID_4 = 0x4014;
our $VAR_OBJ_GFX_ID_5 = 0x4015;
our $VAR_OBJ_GFX_ID_6 = 0x4016;
our $VAR_OBJ_GFX_ID_7 = 0x4017;
our $VAR_OBJ_GFX_ID_8 = 0x4018;
our $VAR_OBJ_GFX_ID_9 = 0x4019;
our $VAR_OBJ_GFX_ID_A = 0x401A;
our $VAR_OBJ_GFX_ID_B = 0x401B;
our $VAR_OBJ_GFX_ID_C = 0x401C;
our $VAR_OBJ_GFX_ID_D = 0x401D;
our $VAR_OBJ_GFX_ID_E = 0x401E;
our $VAR_OBJ_GFX_ID_F = 0x401F;
our $VAR_RECYCLE_GOODS = 0x4020;
our $VAR_REPEL_STEP_COUNT = 0x4021;
our $VAR_ICE_STEP_COUNT = 0x4022;
our $VAR_STARTER_MON = 0x4023;
our $VAR_MIRAGE_RND_H = 0x4024;
our $VAR_MIRAGE_RND_L = 0x4025;
our $VAR_SECRET_BASE_MAP = 0x4026;
our $VAR_CYCLING_ROAD_RECORD_COLLISIONS = 0x4027;
our $VAR_CYCLING_ROAD_RECORD_TIME_L = 0x4028;
our $VAR_CYCLING_ROAD_RECORD_TIME_H = 0x4029;
our $VAR_HAPPINESS_STEP_COUNTER = 0x402A;
our $VAR_POISON_STEP_COUNTER = 0x402B;
our $VAR_RESET_RTC_ENABLE = 0x402C;
our $VAR_ENIGMA_BERRY_AVAILABLE = 0x402D;
our $VAR_DAYS = 0x4040;
our $VAR_FANCLUB_UNKNOWN_1 = 0x4041;
our $VAR_FANCLUB_UNKNOWN_2 = 0x4042;
our $VAR_DEPT_STORE_FLOOR = 0x4043;
our $VAR_TRICK_HOUSE_ROOMS_COMPLETED = 0x4044;
our $VAR_LOTTERY_PRIZE = 0x4045;
our $VAR_NATIONAL_DEX = 0x4046;
our $VAR_SHROOMISH_SIZE_RECORD = 0x4047;
our $VAR_ASH_GATHER_COUNT = 0x4048;
our $VAR_BIRCH_STATE = 0x4049;
our $VAR_CRUISE_STEP_COUNT = 0x404A;
our $VAR_LOTTERY_RND_L = 0x404B;
our $VAR_LOTTERY_RND_H = 0x404C;
our $VAR_BARBOACH_SIZE_RECORD = 0x404F;
our $VAR_LITTLEROOT_STATE = 0x4050;
our $VAR_ROUTE102_ACCESSIBLE = 0x4051;
our $VAR_LAVARIDGE_RIVAL_STATE = 0x4053;
our $VAR_CURRENT_SECRET_BASE = 0x4054;
our $VAR_PETALBURG_STATE = 0x4057;
our $VAR_SLATEPORT_STATE = 0x4058;
our $VAR_RUSTBORO_STATE = 0x405A;
our $VAR_SOOTOPOLIS_STATE = 0x405E;
our $VAR_ROUTE101_STATE = 0x4060;
our $VAR_ROUTE103_STATE = 0x4062;
our $VAR_ROUTE110_STATE = 0x4069;
our $VAR_ROUTE116_STATE = 0x406F;
our $VAR_ROUTE118_STATE = 0x4071;
our $VAR_ROUTE119_STATE = 0x4072;
our $VAR_ROUTE121_STATE = 0x4074;
our $VAR_ROUTE128_STATE = 0x407B;
our $VAR_LITTLEROOT_HOUSES_STATE = 0x4082;
our $VAR_BIRCH_LAB_STATE = 0x4084;
our $VAR_PETALBURG_GYM_STATE = 0x4085;
our $VAR_LINK_CONTEST_ROOM_STATE = 0x4086;
our $VAR_CABLE_CLUB_STATE = 0x4087;
our $VAR_CONTEST_LOCATION = 0x4088;
our $VAR_SECRET_BASE_INITIALIZED = 0x4089;
our $VAR_CONTEST_PRIZE_PICKUP = 0x408A;
our $VAR_LITTLEROOT_HOUSES_STATE_2 = 0x408C;
our $VAR_LITTLEROOT_RIVAL_STATE = 0x408D;
our $VAR_BOARD_BRINEY_BOAT_ROUTE104_STATE = 0x408E;
our $VAR_DEVON_CORP_3F_STATE = 0x408F;
our $VAR_BRINEY_HOUSE_STATE = 0x4090;
our $VAR_LITTLEROOT_INTRO_STATE = 0x4092;
our $VAR_MAUVILLE_GYM_STATE = 0x4093;
our $VAR_LILYCOVE_MUSEUM_2F_STATE = 0x4094;
our $VAR_LILYCOVE_FAN_CLUB_STATE = 0x4095;
our $VAR_BRINEY_LOCATION = 0x4096;
our $VAR_INIT_SECRET_BASE = 0x4097;
our $VAR_PETALBURG_WOODS_STATE = 0x4098;
our $VAR_LILYCOVE_CONTEST_LOBBY_STATE = 0x4099;
our $VAR_RUSTURF_TUNNEL_STATE = 0x409a;
our $VAR_CAVE_OF_ORIGIN_B4F_STATE = 0x409B;
our $VAR_ELITE_4_STATE = 0x409C;
our $VAR_SLATEPORT_HARBOR_STATE = 0x40A0;
our $VAR_SEAFLOOR_CAVERN_STATE = 0x40A2;
our $VAR_CABLE_CAR_STATION_STATE = 0x40A3;
our $VAR_SAFARI_ZONE_STATE = 0x40A4;
our $VAR_TRICK_HOUSE_ENTRANCE_STATE = 0x40A5;
our $VAR_TRICK_HOUSE_ENTRANCE_STATE_2 = 0x40A6;
our $VAR_TRICK_HOUSE_ENTRANCE_STATE_3 = 0x40A7;
our $VAR_CYCLING_CHALLENGE_STATE = 0x40A9;
our $VAR_SLATEPORT_MUSEUM_1F_STATE = 0x40AA;
our $VAR_TRICK_HOUSE_PUZZLE_1_STATE = 0x40AB;
our $VAR_TRICK_HOUSE_PUZZLE_2_STATE = 0x40AC;
our $VAR_TRICK_HOUSE_PUZZLE_3_STATE = 0x40AD;
our $VAR_TRICK_HOUSE_PUZZLE_4_STATE = 0x40AE;
our $VAR_TRICK_HOUSE_PUZZLE_5_STATE = 0x40AF;
our $VAR_TRICK_HOUSE_PUZZLE_6_STATE = 0x40B0;
our $VAR_TRICK_HOUSE_PUZZLE_7_STATE = 0x40B1;
our $VAR_TRICK_HOUSE_PUZZLE_8_STATE = 0x40B2;
our $VAR_WEATHER_INSTITUTE_STATE = 0x40B3;
our $VAR_PORTHOLE_STATE = 0x40B4;
our $VAR_TRICK_HOUSE_STATE = 0x40B5;
our $VAR_TRICK_HOUSE_PUZZLE_7_STATE_2 = 0x40B6;
our $VAR_SLATEPORT_FAN_CLUB_STATE = 0x40B7;
our $VAR_MT_PYRE_STATE = 0x40B9;
our $VAR_NEW_MAUVILLE_STATE = 0x40BA;
our $VAR_BRAVO_TRAINER_BATTLE_TOWER_ON = 0x40BC;
our $VAR_JAGGED_PASS_ASH_WEATHER = 0x40BD;
our $VAR_GLASS_WORKSHOP_STATE = 0x40BE;
our $VAR_METEOR_FALLS_STATE = 0x40BF;
our $VAR_GAME_CORNER_STATE = 0x40C0;
our $VAR_TRICK_HOUSE_PRIZE_PICKUP = 0x40C1;
our $VAR_PACIFIDLOG_TM_RECEIVED_DAY = 0x40C2;
our $VAR_VICTORY_ROAD_1F_STATE = 0x40C3;
our $VAR_FOSSIL_RESURRECTION_STATE = 0x40C4;
our $VAR_WHICH_FOSSIL_REVIVED = 0x40C5;
our $VAR_STEVENS_HOUSE_STATE = 0x40C6;
our $VAR_OLDALE_STATE = 0x40C7;
our @EXPORT_OK = (qw/ $VAR_TEMP_0 $VAR_TEMP_1 $VAR_TEMP_2 $VAR_TEMP_3 $VAR_TEMP_4 $VAR_TEMP_5 $VAR_TEMP_6 $VAR_TEMP_7 $VAR_TEMP_8 $VAR_TEMP_9 $VAR_TEMP_A $VAR_TEMP_B $VAR_TEMP_C $VAR_TEMP_D $VAR_TEMP_E $VAR_TEMP_F $VAR_OBJ_GFX_ID_0 $VAR_OBJ_GFX_ID_1 $VAR_OBJ_GFX_ID_2 $VAR_OBJ_GFX_ID_3 $VAR_OBJ_GFX_ID_4 $VAR_OBJ_GFX_ID_5 $VAR_OBJ_GFX_ID_6 $VAR_OBJ_GFX_ID_7 $VAR_OBJ_GFX_ID_8 $VAR_OBJ_GFX_ID_9 $VAR_OBJ_GFX_ID_A $VAR_OBJ_GFX_ID_B $VAR_OBJ_GFX_ID_C $VAR_OBJ_GFX_ID_D $VAR_OBJ_GFX_ID_E $VAR_OBJ_GFX_ID_F $VAR_RECYCLE_GOODS $VAR_REPEL_STEP_COUNT $VAR_ICE_STEP_COUNT $VAR_STARTER_MON $VAR_MIRAGE_RND_H $VAR_MIRAGE_RND_L $VAR_SECRET_BASE_MAP $VAR_CYCLING_ROAD_RECORD_COLLISIONS $VAR_CYCLING_ROAD_RECORD_TIME_L $VAR_CYCLING_ROAD_RECORD_TIME_H $VAR_HAPPINESS_STEP_COUNTER $VAR_POISON_STEP_COUNTER $VAR_RESET_RTC_ENABLE $VAR_ENIGMA_BERRY_AVAILABLE $VAR_DAYS $VAR_FANCLUB_UNKNOWN_1 $VAR_FANCLUB_UNKNOWN_2 $VAR_DEPT_STORE_FLOOR $VAR_TRICK_HOUSE_ROOMS_COMPLETED $VAR_LOTTERY_PRIZE $VAR_NATIONAL_DEX $VAR_SHROOMISH_SIZE_RECORD $VAR_ASH_GATHER_COUNT $VAR_BIRCH_STATE $VAR_CRUISE_STEP_COUNT $VAR_LOTTERY_RND_L $VAR_LOTTERY_RND_H $VAR_BARBOACH_SIZE_RECORD $VAR_LITTLEROOT_STATE $VAR_ROUTE102_ACCESSIBLE $VAR_LAVARIDGE_RIVAL_STATE $VAR_CURRENT_SECRET_BASE $VAR_PETALBURG_STATE $VAR_SLATEPORT_STATE $VAR_RUSTBORO_STATE $VAR_SOOTOPOLIS_STATE $VAR_ROUTE101_STATE $VAR_ROUTE103_STATE $VAR_ROUTE110_STATE $VAR_ROUTE116_STATE $VAR_ROUTE118_STATE $VAR_ROUTE119_STATE $VAR_ROUTE121_STATE $VAR_ROUTE128_STATE $VAR_LITTLEROOT_HOUSES_STATE $VAR_BIRCH_LAB_STATE $VAR_PETALBURG_GYM_STATE $VAR_LINK_CONTEST_ROOM_STATE $VAR_CABLE_CLUB_STATE $VAR_CONTEST_LOCATION $VAR_SECRET_BASE_INITIALIZED $VAR_CONTEST_PRIZE_PICKUP $VAR_LITTLEROOT_HOUSES_STATE_2 $VAR_LITTLEROOT_RIVAL_STATE $VAR_BOARD_BRINEY_BOAT_ROUTE104_STATE $VAR_DEVON_CORP_3F_STATE $VAR_BRINEY_HOUSE_STATE $VAR_LITTLEROOT_INTRO_STATE $VAR_MAUVILLE_GYM_STATE $VAR_LILYCOVE_MUSEUM_2F_STATE $VAR_LILYCOVE_FAN_CLUB_STATE $VAR_BRINEY_LOCATION $VAR_INIT_SECRET_BASE $VAR_PETALBURG_WOODS_STATE $VAR_LILYCOVE_CONTEST_LOBBY_STATE $VAR_RUSTURF_TUNNEL_STATE $VAR_CAVE_OF_ORIGIN_B4F_STATE $VAR_ELITE_4_STATE $VAR_SLATEPORT_HARBOR_STATE $VAR_SEAFLOOR_CAVERN_STATE $VAR_CABLE_CAR_STATION_STATE $VAR_SAFARI_ZONE_STATE $VAR_TRICK_HOUSE_ENTRANCE_STATE $VAR_TRICK_HOUSE_ENTRANCE_STATE_2 $VAR_TRICK_HOUSE_ENTRANCE_STATE_3 $VAR_CYCLING_CHALLENGE_STATE $VAR_SLATEPORT_MUSEUM_1F_STATE $VAR_TRICK_HOUSE_PUZZLE_1_STATE $VAR_TRICK_HOUSE_PUZZLE_2_STATE $VAR_TRICK_HOUSE_PUZZLE_3_STATE $VAR_TRICK_HOUSE_PUZZLE_4_STATE $VAR_TRICK_HOUSE_PUZZLE_5_STATE $VAR_TRICK_HOUSE_PUZZLE_6_STATE $VAR_TRICK_HOUSE_PUZZLE_7_STATE $VAR_TRICK_HOUSE_PUZZLE_8_STATE $VAR_WEATHER_INSTITUTE_STATE $VAR_PORTHOLE_STATE $VAR_TRICK_HOUSE_STATE $VAR_TRICK_HOUSE_PUZZLE_7_STATE_2 $VAR_SLATEPORT_FAN_CLUB_STATE $VAR_MT_PYRE_STATE $VAR_NEW_MAUVILLE_STATE $VAR_BRAVO_TRAINER_BATTLE_TOWER_ON $VAR_JAGGED_PASS_ASH_WEATHER $VAR_GLASS_WORKSHOP_STATE $VAR_METEOR_FALLS_STATE $VAR_GAME_CORNER_STATE $VAR_TRICK_HOUSE_PRIZE_PICKUP/);
@EXPORT_OK = (@EXPORT_OK, qw/$VAR_PACIFIDLOG_TM_RECEIVED_DAY $VAR_VICTORY_ROAD_1F_STATE $VAR_FOSSIL_RESURRECTION_STATE $VAR_WHICH_FOSSIL_REVIVED $VAR_STEVENS_HOUSE_STATE $VAR_OLDALE_STATE $VARS_START/);