From 7f45b610e1612ef7dc7954f9be109011f529ad5e Mon Sep 17 00:00:00 2001
From: ElTata <eltata@firemail.cc>
Date: Fri, 4 Oct 2019 14:52:49 +0200
Subject: [PATCH] choosing your adversary for an action costs 2 points

---
 Irpg/Action.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/Irpg/Action.pm b/Irpg/Action.pm
index 4d4affd..a2c4cd2 100644
--- a/Irpg/Action.pm
+++ b/Irpg/Action.pm
@@ -401,6 +401,14 @@ sub do_action {
 			"an undefined deed, but collapses out of exhaustion.");
 		return;
 	}
+	if ($rps->{$username}{action} < 2 && exists($arg[0])) {
+		Irpg::Irc::notice("You do not have enough energy to ".
+			"look for anyone.", $usernick);
+		Irpg::Irc::chanmsg("$username tries to contact someone, but ".
+			pronoun(2, $rps->{$username}{gender})." call dies with ".
+			pronoun(2, $rps->{$username}{gender})." breath.");
+		return;
+	}
     my @opps = grep { $rps->{$_}{online} && $username ne $_ } keys(%$rps);
 	if (!@opps) {
 		Irpg::Irc::notice("Your call echoes in the ambient silence...",$usernick);
@@ -430,6 +438,8 @@ sub do_action {
 	}
 	elsif (exists($arg[0])) {
 		$p2 = $arg[0];
+		# choosing your adversary cost an extra action point
+		$rps->{$username}{actions}--;
 	}
 	else {
 		$p2 = $opps[int(rand(@opps))];
@@ -442,7 +452,6 @@ sub do_action {
 
 	my $p1_res = "[$ret_action->{p1roll}/$ret_action->{p1sum}]";
 	my $p2_res = "[$ret_action->{p2roll}/$ret_action->{p2sum}]";
-	#my $mesg = "$p1 $p1_res has come upon $p2 $p2_res and ";
 	my $mesg = '';
 
 	if ($action_type eq 'fight') {
-- 
GitLab