From ae903a3b62dec4ef5f3bf2cda6e22e32cb885958 Mon Sep 17 00:00:00 2001 From: Pat Ludwig Date: Fri, 7 Jan 2022 14:03:15 -0600 Subject: [PATCH] Apply Both damage correctly Choices 2 and 3 should both have missile damage applied. --- 12_Bombs_Away/perl/bombsaway.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/12_Bombs_Away/perl/bombsaway.pl b/12_Bombs_Away/perl/bombsaway.pl index 70d8850e..1b4989f6 100644 --- a/12_Bombs_Away/perl/bombsaway.pl +++ b/12_Bombs_Away/perl/bombsaway.pl @@ -168,6 +168,7 @@ NOW THEN, '; my $response = choose( 'DOES THE ENEMY HAVE GUNS(1), MISSILES(2), OR BOTH(3)', 3); + # Apply Gun damage for responses 1 and 3 if ($response != 2) { # there's some guns involved, ask more say ''; @@ -190,7 +191,8 @@ NOW THEN, '; } say ''; } - else { + # Apply missile damage for responses 2 and 3 + if ($response > 1 ) { $missiles_hit_rate = 35; # remember... this is a global variable }