]> ruin.nu Git - ndwebbie.git/commitdiff
pa_xp function
authorMichael Andreen <harv@ruin.nu>
Fri, 13 Apr 2007 15:19:20 +0000 (15:19 +0000)
committerMichael Andreen <harv@ruin.nu>
Fri, 13 Apr 2007 15:19:20 +0000 (15:19 +0000)
ND/IRC/PA.pm
ND/Include.pm

index 29bdb7722f647226b3f230d289ea7e0878682653..ca73ea59030b818d885de1ea0a2ce300cb4faef7 100644 (file)
@@ -166,7 +166,7 @@ sub calcXp {
                $ND::server->command("notice $ND::target Doesn't seem to be a planet at $x:$y:$z");
                return;
        }
-       my $xp = int(max($roids * 10 * (min(2,$tscore/$ascore) + min(2,$tvalue/$avalue) - 1),0));
+       my $xp = pa_xp($roids,$ascore,$avalue,$tscore,$tvalue);
        my $score = 60 * $xp;
        my $value = $roids*200;
        my $totscore = prettyValue($score + $value);
index 27d0eb11a912aadf122523295be6ef8951df1fa4..b5bf757dc15a1169251ac45f953a485b31588152 100644 (file)
@@ -25,7 +25,7 @@ require Exporter;
 
 our @ISA = qw/Exporter/;
 
-our @EXPORT = qw/min max parseValue prettyValue log_message intel_log unread_query/;
+our @EXPORT = qw/min max parseValue prettyValue log_message intel_log unread_query pa_xp/;
 
 sub min {
     my ($x,$y) = @_;
@@ -81,6 +81,14 @@ sub intel_log {
        $log->execute($uid,$message,$planet) or $ND::ERROR .= p($ND::DBH->errstr);
 }
 
+sub pa_xp {
+       my ($roids,$ascore,$avalue,$tscore,$tvalue) = @_;
+       print "@_";
+       my $bravery = (min(2,$tscore/$ascore)-0.6) * (min(2,$tvalue/$avalue)-0.4);
+       return int(max($roids * 10 * $bravery,0))
+
+}
+
 sub unread_query {
        return $ND::DBH->prepare_cached(q{
                        SELECT count(*) AS unread, count(NULLIF(fp.time > $2,FALSE)) AS new