Add double run bombs. Logic still incomplete.

This commit is contained in:
Jesse C. Fisher 2019-10-27 01:34:52 -07:00
parent 5abbc66446
commit 577b01a1d9

View File

@ -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