Adding leftovers hadler.

This commit is contained in:
Sergiotarxz 2023-11-03 18:24:54 +01:00
parent a6c29f6b96
commit ba2a735551
7 changed files with 138 additions and 36 deletions

BIN
celebi.gba Normal file

Binary file not shown.

BIN
celebi.sav Normal file

Binary file not shown.

View File

@ -9,7 +9,7 @@ use feature 'signatures';
use Rsaves 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_mirage_island_for_pokemon parse_version_name pokemon_fill_pp to_3rd_encoding translate_3rd_encoding/; 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_mirage_island_for_pokemon parse_version_name pokemon_fill_pp to_3rd_encoding translate_3rd_encoding/;
use Rsaves::Constants::Global use Rsaves::Constants::Global
qw/$MOVE_SPIKES $MOVE_DRILL_PECK $MOVE_HIDDEN_POWER $MOVE_TAUNT $MOVE_THUNDERBOLT $MOVE_ROAR $MOVE_THUNDER_WAVE $ITEM_LEFTOVERS $MOVE_DRAGON_DANCE $MOVE_ROCK_SLIDE $MOVE_EARTHQUAKE $MOVE_TAUNT $MOVE_FLAMETHROWER $MOVE_WILL_O_WISP $MOVE_HYDRO_PUMP $MOVE_ICE_BEAM $MOVE_FOCUS_PUNCH $MOVE_PSYCHIC $MOVE_FIRE_PUNCH $MOVE_WISH $MOVE_PROTECT $MOVE_TOXIC/; qw/$MOVE_SPIKES $MOVE_DRILL_PECK $MOVE_HIDDEN_POWER $MOVE_TAUNT $MOVE_THUNDERBOLT $MOVE_ROAR $MOVE_THUNDER_WAVE $ITEM_LEFTOVERS $MOVE_DRAGON_DANCE $MOVE_ROCK_SLIDE $MOVE_EARTHQUAKE $MOVE_TAUNT $MOVE_FLAMETHROWER $MOVE_WILL_O_WISP $MOVE_HYDRO_PUMP $MOVE_ICE_BEAM $MOVE_FOCUS_PUNCH $MOVE_PSYCHIC $MOVE_FIRE_PUNCH $MOVE_WISH $MOVE_PROTECT $MOVE_TOXIC $MOVE_LEECH_SEED $MOVE_RECOVER/;
use Rsaves::Constants::Ruby::Global qw/$MALE $FEMALE/; use Rsaves::Constants::Ruby::Global qw/$MALE $FEMALE/;
@ -25,10 +25,15 @@ sub start {
my $save = $saves[$current_save_index]; my $save = $saves[$current_save_index];
my $pc = read_pc_storage($save); my $pc = read_pc_storage($save);
my $jirachi = $pc->{boxes}[13][2];
my $skarmory = $pc->{boxes}[13][0]; my $skarmory = $pc->{boxes}[13][0];
my $celebi = $pc->{boxes}[13][1];
my $jirachi = $pc->{boxes}[13][2];
my $claydol = $pc->{boxes}[13][3];
modifyJirachi($jirachi); modifyJirachi($jirachi);
modifyCelebi($celebi);
modifySkarmory($skarmory); modifySkarmory($skarmory);
modifyClaydol($claydol);
# modifyJolteon($jolteon); # modifyJolteon($jolteon);
# modifyLarvitar($larvitar); # modifyLarvitar($larvitar);
# modifyMoltres($moltres); # modifyMoltres($moltres);
@ -36,7 +41,10 @@ sub start {
# modifyStarmie($starmie); # modifyStarmie($starmie);
# #
pokemon_fill_pp($jirachi); pokemon_fill_pp($jirachi);
pokemon_fill_pp($celebi);
pokemon_fill_pp($skarmory); pokemon_fill_pp($skarmory);
pokemon_fill_pp($claydol);
# pokemon_fill_pp($larvitar); # pokemon_fill_pp($larvitar);
# pokemon_fill_pp($moltres); # pokemon_fill_pp($moltres);
# pokemon_fill_pp($mudkip); # pokemon_fill_pp($mudkip);
@ -46,11 +54,109 @@ sub start {
save_changes( @saves, $extra, $output ); save_changes( @saves, $extra, $output );
} }
sub modifySkarmory ($pokemon) { sub modifyClaydol ($pokemon) {
say $pokemon->{otid}; $pokemon->{personality} = 0xAB1B5E9E;
say _hihalf_u32($pokemon->{otid});
say _lowhalf_u32($pokemon->{otid});
$hi_otid = $hi_personality ^ $lo_personality ^ 6 ^ $lo_otid;
$pokemon->{otid} = ( $hi_otid << 16 ) | $lo_otid;
my $ivs_egg_status_and_ability =
$pokemon->{substructures}[3]{ivs_egg_status_and_ability};
my $ability = $ivs_egg_status_and_ability >> 31 & 1;
my $egg = $ivs_egg_status_and_ability >> 30 & 1;
my $iv_special_defense = $ivs_egg_status_and_ability >> 25 & 0x1F;
my $iv_special_attack = $ivs_egg_status_and_ability >> 20 & 0x1F;
my $iv_speed = $ivs_egg_status_and_ability >> 15 & 0x1F;
my $iv_defense = $ivs_egg_status_and_ability >> 10 & 0x1F;
my $iv_attack = $ivs_egg_status_and_ability >> 5 & 0x1F;
my $iv_hp = $ivs_egg_status_and_ability >> 0 & 0x1F;
(
$iv_hp, $iv_attack, $iv_defense, $iv_special_attack,
$iv_special_defense, $iv_speed, $ability
) = ( 29, 30, 31, 30, 31, 31, 0 );
$ivs_egg_status_and_ability = 0;
$ivs_egg_status_and_ability |= ( ( $ability & 1 ) << 31 );
$ivs_egg_status_and_ability |= ( ( $egg & 1 ) << 30 );
$ivs_egg_status_and_ability |= ( ( $iv_special_defense & 0x1F ) << 25 );
$ivs_egg_status_and_ability |= ( ( $iv_special_attack & 0x1F ) << 20 );
$ivs_egg_status_and_ability |= ( ( $iv_speed & 0x1F ) << 15 );
$ivs_egg_status_and_ability |= ( ( $iv_defense & 0x1F ) << 10 );
$ivs_egg_status_and_ability |= ( ( $iv_attack & 0x1F ) << 5 );
$ivs_egg_status_and_ability |= ( ( $iv_hp & 0x1F ) );
$pokemon->{substructures}[3]{ivs_egg_status_and_ability} =
$ivs_egg_status_and_ability;
$pokemon->{substructures}[2]{hp_ev} = 248;
$pokemon->{substructures}[2]{attack_ev} = 0;
$pokemon->{substructures}[2]{defense_ev} = 80;
$pokemon->{substructures}[2]{special_attack_ev} = 0;
$pokemon->{substructures}[2]{special_defense_ev} = 44;
$pokemon->{substructures}[2]{speed_ev} = 136;
$pokemon->{substructures}[1]{movements}[0] = $MOVE_PSYCHIC;
$pokemon->{substructures}[1]{movements}[1] = $MOVE_HIDDEN_POWER;
$pokemon->{substructures}[1]{movements}[2] = $MOVE_LEECH_SEED;
$pokemon->{substructures}[1]{movements}[3] = $MOVE_RECOVER;
$pokemon->{substructures}[0]{held_item} = $ITEM_LEFTOVERS;
$pokemon->{substructures}[0]{experience} = 1_059_862;
}
sub modifyCelebi ($pokemon) {
my $hi_otid = _hihalf_u32( $pokemon->{otid} );
my $lo_otid = _lowhalf_u32( $pokemon->{otid} );
my $personality = $pokemon->{personality} = 0xAB1B5E9E;
my $hi_personality = _hihalf_u32($personality);
my $lo_personality = _lowhalf_u32($personality);
$hi_otid = $hi_personality ^ $lo_personality ^ 6 ^ $lo_otid;
$pokemon->{otid} = ( $hi_otid << 16 ) | $lo_otid;
my $ivs_egg_status_and_ability =
$pokemon->{substructures}[3]{ivs_egg_status_and_ability};
my $ability = $ivs_egg_status_and_ability >> 31 & 1;
my $egg = $ivs_egg_status_and_ability >> 30 & 1;
my $iv_special_defense = $ivs_egg_status_and_ability >> 25 & 0x1F;
my $iv_special_attack = $ivs_egg_status_and_ability >> 20 & 0x1F;
my $iv_speed = $ivs_egg_status_and_ability >> 15 & 0x1F;
my $iv_defense = $ivs_egg_status_and_ability >> 10 & 0x1F;
my $iv_attack = $ivs_egg_status_and_ability >> 5 & 0x1F;
my $iv_hp = $ivs_egg_status_and_ability >> 0 & 0x1F;
(
$iv_hp, $iv_attack, $iv_defense, $iv_special_attack,
$iv_special_defense, $iv_speed, $ability
) = ( 29, 30, 31, 30, 31, 31, 0 );
$ivs_egg_status_and_ability = 0;
$ivs_egg_status_and_ability |= ( ( $ability & 1 ) << 31 );
$ivs_egg_status_and_ability |= ( ( $egg & 1 ) << 30 );
$ivs_egg_status_and_ability |= ( ( $iv_special_defense & 0x1F ) << 25 );
$ivs_egg_status_and_ability |= ( ( $iv_special_attack & 0x1F ) << 20 );
$ivs_egg_status_and_ability |= ( ( $iv_speed & 0x1F ) << 15 );
$ivs_egg_status_and_ability |= ( ( $iv_defense & 0x1F ) << 10 );
$ivs_egg_status_and_ability |= ( ( $iv_attack & 0x1F ) << 5 );
$ivs_egg_status_and_ability |= ( ( $iv_hp & 0x1F ) );
$pokemon->{substructures}[3]{ivs_egg_status_and_ability} =
$ivs_egg_status_and_ability;
$pokemon->{substructures}[2]{hp_ev} = 248;
$pokemon->{substructures}[2]{attack_ev} = 0;
$pokemon->{substructures}[2]{defense_ev} = 80;
$pokemon->{substructures}[2]{special_attack_ev} = 0;
$pokemon->{substructures}[2]{special_defense_ev} = 44;
$pokemon->{substructures}[2]{speed_ev} = 136;
$pokemon->{substructures}[1]{movements}[0] = $MOVE_PSYCHIC;
$pokemon->{substructures}[1]{movements}[1] = $MOVE_HIDDEN_POWER;
$pokemon->{substructures}[1]{movements}[2] = $MOVE_LEECH_SEED;
$pokemon->{substructures}[1]{movements}[3] = $MOVE_RECOVER;
$pokemon->{substructures}[0]{held_item} = $ITEM_LEFTOVERS;
$pokemon->{substructures}[0]{experience} = 1_059_862;
}
sub modifySkarmory ($pokemon) {
$pokemon->{personality} = 0xC6C32B9F; $pokemon->{personality} = 0xC6C32B9F;
my $ivs_egg_status_and_ability = my $ivs_egg_status_and_ability =
$pokemon->{substructures}[3]{ivs_egg_status_and_ability}; $pokemon->{substructures}[3]{ivs_egg_status_and_ability};
@ -97,10 +203,6 @@ sub modifySkarmory ($pokemon) {
} }
sub modifyJirachi ($pokemon) { sub modifyJirachi ($pokemon) {
say $pokemon->{otid};
say _hihalf_u32($pokemon->{otid});
say _lowhalf_u32($pokemon->{otid});
$pokemon->{personality} = 0xC6C32B9F; $pokemon->{personality} = 0xC6C32B9F;
my $ivs_egg_status_and_ability = my $ivs_egg_status_and_ability =
$pokemon->{substructures}[3]{ivs_egg_status_and_ability}; $pokemon->{substructures}[3]{ivs_egg_status_and_ability};

BIN
hadlerleafgreen.gba Normal file

Binary file not shown.

BIN
hadlerleafgreen.sav Normal file

Binary file not shown.

BIN
hadlerleafgreenrestos.gba Normal file

Binary file not shown.

BIN
hadlerleafgreenrestos.sav Normal file

Binary file not shown.