Rsaves/findShinyJirachi.pl

31 lines
591 B
Perl

#!/usr/bin/env perl
use v5.36.0;
use strict;
use warnings;
open my $fh, '<', $ENV{HOME} . '/PokeFinder/jirachi';
while (my $line = <$fh>) {
my ($seed, $pid, $hpp) = [split ',', $line]->@[0,1,12];
my $tid = 40122;
my $sid = 29153;
$pid = hex($pid) + 0;
my $shiny_value = (_hihalf_u32($pid) ^ _lowhalf_u32($pid) ^ $sid ^ $tid);
say $shiny_value;
if ($shiny_value < 8 && $hpp > 65) {
say $line;
}
}
sub _hihalf_u32 {
my $n = shift;
return ( ( $n & 0xFFFF0000 ) >> 16 );
}
sub _lowhalf_u32 {
my $n = shift;
return ( $n & 0xFFFF );
}