From 9416387fe70c358ed101fdce7c83ae57c8a0f37c Mon Sep 17 00:00:00 2001 From: "Jesse C. Fisher" Date: Sun, 27 Oct 2019 01:34:52 -0700 Subject: [PATCH] Add double run bombs. Logic still incomplete. --- app/models/play.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/models/play.rb b/app/models/play.rb index a47dcf38..a75dd346 100644 --- a/app/models/play.rb +++ b/app/models/play.rb @@ -60,14 +60,16 @@ class Play < ActiveRecord::Base # current player is not the player to beat if (game.player_to_beat != player) # valid bomb? - if (self.hand_type == 'bomb' && game.play_to_beat.try("play").try("hand_type") == 'single' && game.play_to_beat.try("play").try("player_cards")[0].try('rank') == '2') + # if (self.hand_type =~ /bomb|double run/ && game.play_to_beat.try("play").try("hand_type") == 'single' && game.play_to_beat.try("play").try("player_cards")[0].try('rank') == '2') + if (self.hand_type =~ /bomb|double run/) @truths << true return @truths + else + # hand_type match? + @truths << (self.hand_type == game.play_to_beat.try("play").try("hand_type")) if game.play_to_beat.try("play").try(:hand_type) + # beats? + @truths << (self.beats? self.game.play_to_beat.try(:play)) end - # hand_type match? - @truths << (self.hand_type == game.play_to_beat.try("play").try("hand_type")) if game.play_to_beat.try("play").try(:hand_type) - # beats? - @truths << (self.beats? self.game.play_to_beat.try(:play)) end end