Changeset 523 for veekun/trunk/lib

Show
Ignore:
Timestamp:
08/25/09 10:39:32 (7 months ago)
Author:
eevee
Message:

Fixed IV calculator bitching about impossible nonexistent input, which also fixes a bunch of nonnumeric warnings.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • veekun/trunk/lib/Vee/Controller/Dex/Utils.pm

    r441 r523  
    476476 
    477477        # ok done with that validation nonsense 
    478              
     478 
    479479        my (@ivs, @iv_ranges, @possible_stats); 
    480480        my @nature_change = (1) x 6; 
     
    492492            my $func = ($stat =~ /hp/) ? \&ingame_hp : \&ingame_stats; 
    493493 
     494            # entire range of possible stats for this Pokemon 
     495            $possible_stats[$s] = 
     496                int( $nature_change[$s] * $func->($base, $p->{level}, 0,  $effort) ) . ' - ' . 
     497                int( $nature_change[$s] * $func->($base, $p->{level}, 31, $effort) ); 
     498 
     499            # bail if there was no input provided 
     500            if (not $p->{$stat}) { 
     501                next; 
     502            } 
     503 
    494504            # possible IVs; doing this inversely is very difficult due to rounding 
    495505            for my $iv (0 .. 31) { 
     
    505515                if $iv_ranges[$s]{min} != $iv_ranges[$s]{max} 
    506516                or $iv_ranges[$s]{min} == -1; 
    507  
    508             # entire range of possible stats for this Pokemon 
    509             $possible_stats[$s] = 
    510                 int( $nature_change[$s] * $func->($base, $p->{level}, 0,  $effort) ) . ' - ' . 
    511                 int( $nature_change[$s] * $func->($base, $p->{level}, 31, $effort) ); 
    512517        } 
    513518        $s->{ivs}            = \@ivs;