From 2302beb243bae272bf5701c9fb5713ac194a42cb Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Mon, 20 Apr 2020 13:17:43 -0400 Subject: [PATCH] Euchre::Delear: Fix led suit on leading left bower When leading the jack of color, trump should be the suit led. Thanks ~ckarle for noticing! This would have been a RIP to find out mid real game :) --- lib/Euchre/Dealer.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Euchre/Dealer.pm b/lib/Euchre/Dealer.pm index 59c8fb7..6d0c622 100644 --- a/lib/Euchre/Dealer.pm +++ b/lib/Euchre/Dealer.pm @@ -363,9 +363,10 @@ sub play_card { my $game = $p->{game}; my $seat = $p->{seat}; + my %colors = (H => 'D', D => 'H', S => 'C', C => 'S'); + # Validate they follow suit if they CAN if (defined $game->{led}) { - my %colors = (H => 'D', D => 'H', S => 'C', C => 'S'); # Build up a list of valid cards my @followers = map { "$_$game->{led}" } qw(N T Q K A); # no jack @@ -404,7 +405,13 @@ sub play_card { if ($played_cards == 1) { # First card! my ($val, $suit) = split('', $msg->{card}); - $game->{led} = $suit; + + # Special case Jack of Color == trump + if ($val eq 'J' && $suit eq $colors{$game->{trump}}) { + $game->{led} = $game->{trump}; + } else { + $game->{led} = $suit; + } } # Adjust num cards on table by if there's an out player -- libgit2 1.1.1