commit 2302beb243bae272bf5701c9fb5713ac194a42cb (patch)
parent 54701cc9c08d684a25a1f5157a4c036ac5bc9fd6
Author: Alex Karle <alex@karle.co>
Date: Mon, 20 Apr 2020 13:17:43 -0400
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 :)
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git 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