Changeset 523 for veekun

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.

Location:
veekun/trunk
Files:
2 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; 
  • veekun/trunk/templates/dex/utils/iv.tt

    r252 r523  
    5555    <td class="stat">[% pokemon.${StatColumns.$s} %]</td> 
    5656    <td class="possible-stats[% nature_class %]">[% possible_stats.$s %]</td> 
    57 [%         IF iv_ranges.$s.min >= 0 %] 
     57[%         IF NOT iv_ranges.$s%] 
     58    <td colspan="2">No input</td> 
     59[%         ELSIF iv_ranges.$s.min >= 0 %] 
    5860    <td class="possible-ivs">[% iv_ranges.$s.min %][% IF iv_ranges.$s.min != iv_ranges.$s.max %] - [% iv_ranges.$s.max %][% END %]</td> 
    5961    <td class="iv-graph"><div class="iv-bar">