diff --git a/Irpg/Action.pm b/Irpg/Action.pm index c66e13cf30723815d5efa209b5c5457a02bbf96b..98cd520e99cfbde5b18d4bee562dc591b327acfe 100644 --- a/Irpg/Action.pm +++ b/Irpg/Action.pm @@ -5,6 +5,7 @@ use warnings; use POSIX; use Irpg::Utils qw(:text); use Irpg::Irc qw(:interaction); +use List::Util qw(min); use Exporter qw(import); our @EXPORT = qw(&choose_action &itemsum &challenge_opp &collision_action &team_battle); @@ -147,7 +148,7 @@ sub mystic_result { my $perc = perc_victory($rps->{$p2}{level} - $rps->{$p1}{level})*0.60; $perc *= 1.2 if ($wanted); my $gain_p1 = int(($perc/100)*$rps->{$p1}{next}); - my $gain_p2 = int(($perc/100)*$rps->{$p2}{next}); + my $gain_p2 = min($gain_p1, int(($perc/100)*$rps->{$p2}{next})); $gain_p1 = -$rps->{$p1}{class}->real_gain(-$gain_p1); $gain_p2 = $rps->{$p2}{class}->real_gain($gain_p2); $rps->{$p1}{next} = $gain_p1 >= $rps->{$p1}{next} ? @@ -175,8 +176,8 @@ sub mystic_result { #$gain = 5 if $gain < 5; my $perc = perc_defeat($rps->{$p2}{level} - $rps->{$p1}{level})*0.60; $perc *= 1.2 if ($wanted); - my $gain_p1 = int(($perc/100)*$rps->{$p1}{next}); my $gain_p2 = int(($perc/100)*$rps->{$p2}{next}); + my $gain_p1 = min($gain_p2, int(($perc/100)*$rps->{$p1}{next})); $gain_p1 = $rps->{$p1}{class}->real_gain($gain_p1); $gain_p2 = -$rps->{$p2}{class}->real_gain(-$gain_p2); $rps->{$p1}{next} += $gain_p1;