From 760232f8dd31e124dd02acf192ca39f2f5b44371 Mon Sep 17 00:00:00 2001 From: ElTata <eltata@firemail.cc> Date: Mon, 20 Jul 2020 15:35:14 +0200 Subject: [PATCH] improvment: reduce mystic battle loser ttl gain The TTL gain (before class modifier to be applied) for the loser of a mystic battle is now the min betweene the previous calculation and the TTL removed from the winner's clock. --- Irpg/Action.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Irpg/Action.pm b/Irpg/Action.pm index c66e13c..98cd520 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; -- GitLab