X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=PA.pm;h=b1ae3619434f9a68039b6e07a99c5362e86aad35;hb=094c16b1d21e4b336d9e791d52ad91493078cd9f;hp=62382dd8bf65da26587baf787473d0a309c3d140;hpb=6f1b756bc7abf8b4a6b06550b37b84ad06259097;p=NDIRC.git diff --git a/PA.pm b/PA.pm index 62382dd..b1ae361 100644 --- a/PA.pm +++ b/PA.pm @@ -148,6 +148,7 @@ sub shipEff { $number /= 0.60 if $tn eq 't2'; $number /= 0.30 if $tn eq 't3'; } + $number = int($number); $value = prettyValue($number*$t->{cost}/100); my $name = shipColor($t->{name},$t->{type}); $text .= " $ND::B$number$ND::O $name ($t->{init}:$value),"; @@ -164,12 +165,12 @@ sub calcEff { my $number = 0; if ($eff){ $number = $s->{type} eq 'Emp' ? - int($amount*$s->{guns}*(100-$t->{eres})/100) - : int($amount*$s->{damage}/$t->{armor}); + ($amount*$s->{guns}*(100-$t->{eres})/100) + : ($amount*$s->{damage}/$t->{armor}); }else{ $number = $t->{type} eq 'Emp' ? - int($amount*100/(100 - $s->{eres})/$t->{guns}) - : int($amount*$s->{armor}/$t->{damage}); + ($amount*100/(100 - $s->{eres})/$t->{guns}) + : ($amount*$s->{armor}/$t->{damage}); } for my $tn ('t1','t2','t3'){ @@ -268,7 +269,7 @@ sub findCovOpper { } my $attackers = $ND::DBH->prepare(q{ SELECT coords(p.x,p.y,p.z), ruler, planet FROM current_planet_stats p JOIN planet_stats ps using (id) WHERE - ps.tick = $1 AND (2000*$2*$3/ps.value)::int = $4 ; + ps.tick = $1 AND (2000.0*$2*$3/ps.value)::int = $4 ; }); $attackers->execute($tick,$agents,$value,$stolen); if ($attackers->rows == 0){