Adding starmie.

This commit is contained in:
Sergiotarxz 2023-11-02 20:06:00 +01:00
parent 1bde59217a
commit 4b41a7b06f
3 changed files with 72 additions and 1 deletions

View File

@ -9,7 +9,7 @@ use feature 'signatures';
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/;
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/;
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/;
use Rsaves::Constants::Ruby::Global qw/$MALE $FEMALE/;
@ -31,22 +31,93 @@ sub start {
my $moltres = $pc->{boxes}[0][3];
my $larvitar = $pc->{boxes}[0][2];
my $mudkip = $pc->{boxes}[0][0];
my $starmie = $pc->{boxes}[0][1];
modifySkarmory($skarmory);
modifyJolteon($jolteon);
modifyLarvitar($larvitar);
modifyMoltres($moltres);
modifyMudkip($mudkip);
modifyStarmie($starmie);
pokemon_fill_pp($skarmory);
pokemon_fill_pp($jolteon);
pokemon_fill_pp($larvitar);
pokemon_fill_pp($moltres);
pokemon_fill_pp($mudkip);
pokemon_fill_pp($starmie);
save_pc_changes( $save, $pc );
save_changes( @saves, $extra, $output );
}
sub modifyStarmie ($pokemon) {
$pokemon->{personality} = 0x6BB2770A;
$pokemon->{nickname} = to_3rd_encoding('Doctor');
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
) = ( 30, 11, 31, 30, 31, 31, 1 );
$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;
# /*0x02*/ u16 metLevel:7;
# /*0x02*/ u16 metGame:4;
# /*0x03*/ u16 pokeball:4;
# /*0x03*/ u16 otGender:1;
my $meet_data = $pokemon->{substructures}[3]{met_data};
my $ot_gender = $meet_data >> 15 & 1;
my $pokeball = $meet_data >> 11 & 0xF;
my $meet_game = $meet_data >> 7 & 0xF;
my $meet_level = $meet_data & 0x7F;
$meet_level = 22;
$meet_data = 0;
$meet_data |= ($ot_gender & 1) << 15;
$meet_data |= ($pokeball & 0xF) << 11;
$meet_data |= ($meet_game & 0xF) << 7;
$meet_data |= ($meet_level & 0x7F);
$pokemon->{substructures}[3]{met_data} = $meet_data;
$pokemon->{substructures}[2]{hp_ev} = 0;
$pokemon->{substructures}[2]{attack_ev} = 0;
$pokemon->{substructures}[2]{defense_ev} = 0;
$pokemon->{substructures}[2]{speed_ev} = 0;
$pokemon->{substructures}[2]{special_attack_ev} = 0;
$pokemon->{substructures}[2]{special_defense_ev} = 0;
$pokemon->{substructures}[1]{movements}[0] = $MOVE_HYDRO_PUMP;
$pokemon->{substructures}[1]{movements}[1] = $MOVE_ICE_BEAM;
$pokemon->{substructures}[1]{movements}[2] = $MOVE_THUNDERBOLT;
$pokemon->{substructures}[1]{movements}[3] = $MOVE_PSYCHIC;
$pokemon->{substructures}[0]{held_item} = $ITEM_LEFTOVERS;
}
sub modifyMudkip ($pokemon) {
$pokemon->{personality} = 0x6BB2770A;
$pokemon->{nickname} = to_3rd_encoding('Kumena');

BIN
starmie.gba Normal file

Binary file not shown.

BIN
starmie.sav Normal file

Binary file not shown.