Skip to content

Commit 2a7cd8a

Browse files
committed
Add Joker Bombs game.
1 parent f0df8eb commit 2a7cd8a

File tree

3 files changed

+61
-4
lines changed

3 files changed

+61
-4
lines changed

html-src/rules/jokerbombs.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<h1>Joker Bombs</h1>
2+
<p>
3+
One-Deck game type. 1 joker deck. No redeal.
4+
5+
<h3>Object</h3>
6+
<p>
7+
Move all cards except the four Aces to the single foundation.
8+
9+
<h3>Quick Description</h3>
10+
<p>
11+
Like <a href="acesup.html">Aces Up</a>,
12+
but with jokers. Jokers can be removed at any time - if a joker
13+
is removed, all of the cards under it are removed and shuffled back
14+
into the talon.

pysollib/gamedb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ def _callback(gi, gt=game_type):
607607
('fc-3.4', tuple(range(971, 981)) + tuple(range(5419, 5421)) +
608608
tuple(range(16683, 16686)) + tuple(range(18005, 18007)) +
609609
(44, 526, 5906, 22399,)),
610-
('dev', tuple(range(981, 984)) + tuple(range(16686, 16687))),
610+
('dev', tuple(range(981, 985)) + tuple(range(16686, 16687))),
611611
)
612612

613613
# deprecated - the correct way is to or a GI.GT_XXX flag

pysollib/games/acesup.py

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,46 @@ class RussianAces(AcesUp):
161161
Talon_Class = RussianAces_Talon
162162

163163

164+
# ************************************************************************
165+
# * Joker Bombs
166+
# ************************************************************************
167+
168+
class JokerBombs_Foundation(AcesUp_Foundation):
169+
def acceptsCards(self, from_stack, cards):
170+
if cards[0].suit == 4:
171+
return True
172+
173+
return AcesUp_Foundation.acceptsCards(self, from_stack, cards)
174+
175+
176+
class JokerBombs_RowStack(AcesUp_RowStack):
177+
def moveMove(self, ncards, to_stack, frames=-1, shadow=-1):
178+
if self.cards[-1].suit == 4:
179+
s = BasicRowStack.moveMove(self, ncards, to_stack, frames=frames,
180+
shadow=shadow)
181+
182+
old_state = self.game.enterState(self.game.S_FILL)
183+
self.game.saveStateMove(2 | 16) # for undo
184+
185+
while self.cards:
186+
self.game.flipMove(self)
187+
self.game.moveMove(1, self, self.game.s.talon, frames=frames)
188+
self.game.shuffleStackMove(self.game.s.talon)
189+
190+
self.game.saveStateMove(1 | 16) # for redo
191+
self.game.leaveState(old_state)
192+
193+
return s
194+
else:
195+
return BasicRowStack.moveMove(self, ncards, to_stack,
196+
frames=frames, shadow=shadow)
197+
198+
199+
class JokerBombs(AcesUp):
200+
RowStack_Class = StackWrapper(JokerBombs_RowStack, max_accept=1)
201+
Foundation_Class = JokerBombs_Foundation
202+
203+
164204
# ************************************************************************
165205
# * Perpetual Motion
166206
# ************************************************************************
@@ -500,12 +540,12 @@ def createGame(self):
500540

501541
# register the game
502542
registerGame(GameInfo(903, AcesUp, "Aces Up", # was: 52
503-
GI.GT_1DECK_TYPE | GI.GT_CHILDREN, 1, 0, GI.SL_LUCK,
543+
GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_LUCK,
504544
altnames=("Aces High", "Drivel", "Discard")))
505545
registerGame(GameInfo(206, Fortunes, "Fortunes",
506-
GI.GT_1DECK_TYPE, 1, 0, GI.SL_LUCK))
546+
GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_LUCK))
507547
registerGame(GameInfo(213, RussianAces, "Russian Aces",
508-
GI.GT_1DECK_TYPE, 1, 0, GI.SL_LUCK))
548+
GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_LUCK))
509549
registerGame(GameInfo(130, PerpetualMotion, "Perpetual Motion",
510550
GI.GT_1DECK_TYPE, 1, -1, GI.SL_MOSTLY_LUCK,
511551
altnames=("First Law", "Narcotic")))
@@ -526,3 +566,6 @@ def createGame(self):
526566
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_SKILL))
527567
registerGame(GameInfo(934, Valentine, "Valentine",
528568
GI.GT_1DECK_TYPE, 1, -1, GI.SL_LUCK))
569+
registerGame(GameInfo(984, JokerBombs, "Joker Bombs",
570+
GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_LUCK,
571+
subcategory=GI.GS_JOKER_DECK, trumps=list(range(2))))

0 commit comments

Comments
 (0)